You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/08/02 16:40:14 UTC
svn commit: r1368491 [4/8] - in /incubator/etch/trunk: ./
binding-cpp/runtime/ binding-cpp/runtime/include/common/
binding-cpp/runtime/include/serialization/
binding-cpp/runtime/include/transport/ binding-cpp/runtime/lib/capu/
binding-cpp/runtime/lib/c...
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h Thu Aug 2 14:40:08 2012
@@ -1,91 +1,99 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __STRINGUTILS_H__
-#define __STRINGUTILS_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-#define STRINGUTILS_INC_HEADER
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_HEADER
-
-namespace capu
-{
- class StringUtils
- {
-#define STRINGUTILS_INC_MEMBER
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_MEMBER
-
- public:
- /**
- * Static method to copy a String of length dstSize from src to dst
- * @param dst destination buffer
- * @param dstSize number of chars to be copied
- * @param src source buffer
- */
- inline static void Strncpy(char* dst, uint32_t dstSize, const char* src);
-
- /**
- * Static method to write a C string according to the given format into the array pointed by buffer.
- * After the format parameter, the function expects at least as many additional arguments as specified in format.
- * @param buffer which contains the string
- * @param bufferSize size of the buffer
- * @param format the format of the string
- * @param arguments
- */
- inline static void Sprintf(char* buffer, uint32_t bufferSize, const char* format, ...);
-
- /**
- * Static method to write a C string according to the given format into the array pointed by buffer.
+/* $Id$
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to you under the Apache License, Version
+* 2.0 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __STRINGUTILS_H__
+#define __STRINGUTILS_H__
+
+#include "capu/Config.h"
+#include "capu/Error.h"
+
+#define STRINGUTILS_INC_HEADER
+#include "arch/StringUtils.inc"
+#undef STRINGUTILS_INC_HEADER
+
+namespace capu
+{
+ class StringUtils
+ {
+#define STRINGUTILS_INC_MEMBER
+#include "arch/StringUtils.inc"
+#undef STRINGUTILS_INC_MEMBER
+
+ public:
+ /**
+ * Static method to copy a String of length dstSize from src to dst
+ * @param dst destination buffer
+ * @param dstSize number of chars to be copied
+ * @param src source buffer
+ */
+ inline static void Strncpy(char* dst, uint_t dstSize, const char* src);
+
+ /**
+ * Static method to write a C string according to the given format into the array pointed by buffer.
+ * After the format parameter, the function expects at least as many additional arguments as specified in format.
+ * @param buffer which contains the string
+ * @param bufferSize size of the buffer
+ * @param format the format of the string
+ * @param arguments
+ */
+ inline static void Sprintf(char* buffer, uint_t bufferSize, const char* format, ...);
+
+ /**
+ * Static method to write a C string according to the given format into the array pointed by buffer.
+ * The arguments specified in the format have to be passed by the values parameter.
+ * @param buffer which contains the string
+ * @param bufferSize size of the buffer
+ * @param format the format of the string
+ * @param values arguments for the format
+ */
+ inline static void Vsprintf(char* buffer, uint_t bufferSize, const char* format, va_list values);
+
+ /**
+ * Static method to count the bytes according to the given format
* The arguments specified in the format have to be passed by the values parameter.
- * @param buffer which contains the string
- * @param bufferSize size of the buffer
* @param format the format of the string
* @param values arguments for the format
*/
- inline static void Vsprintf(char* buffer, uint32_t bufferSize, const char* format, va_list values);
-
- /**
- * Static method to return the length of the given String
- * @param str the string
- * @return length of the string
- */
- inline static uint32_t Strlen(const char* str);
-
+ inline static int32_t Vscprintf(const char* format, va_list values);
+
/**
- * Static method to compare two C strings.
- * @param str1 first string
- * @param str2 second string
- * @return 0 if both strings are equal
- * > 0 if the first character which does not match has a greater value in str1
- * < 0 otherwise
- */
- inline static int32_t Strcmp(const char* str1, const char* str2);
-
- };
-
-#define STRINGUTILS_INC_IMPL
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_IMPL
-
-}
-#endif
-
+ * Static method to return the length of the given String
+ * @param str the string
+ * @return length of the string
+ */
+ inline static uint_t Strlen(const char* str);
+
+ /**
+ * Static method to compare two C strings.
+ * @param str1 first string
+ * @param str2 second string
+ * @return 0 if both strings are equal
+ * > 0 if the first character which does not match has a greater value in str1
+ * < 0 otherwise
+ */
+ inline static int_t Strcmp(const char* str1, const char* str2);
+
+ };
+
+#define STRINGUTILS_INC_IMPL
+#include "arch/StringUtils.inc"
+#undef STRINGUTILS_INC_IMPL
+
+}
+#endif
+
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h Thu Aug 2 14:40:08 2012
@@ -1,75 +1,75 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __THREAD_H__
-#define __THREAD_H__
-
-#define THREAD_INC_HEADER
-#include "arch/Thread.inc"
-#undef THREAD_INC_HEADER
-
-#include "capu/Error.h"
-
-namespace capu
-{
-
- class Thread
- {
-
-#define THREAD_INC_MEMBER
-#include "arch/Thread.inc"
-#undef THREAD_INC_MEMBER
-
- public:
- /**
- * Constructor
- * Creates a thread which will execute the given function
- * @param func function object that will be executed
- * @param arguments
- */
- template <typename T>
- inline Thread(T* object,void* args=NULL);
-
- /**
- * Destructor
- */
- inline ~Thread();
-
- /**
- * Waits the thread completeness
- * @return CAPU_OK if thread is currently waiting for completeness
- * CAPU_ERROR otherwise
- */
- inline status_t join();
-
- /**
- * Suspend the current thread for specific amount of time
- * @return CAPU_OK if thread is currently suspended
- * CAPU_ERROR otherwise
- */
- static inline status_t Sleep(uint32_t millis);
-
- };
-
-#define THREAD_INC_IMPL
- #include "arch/Thread.inc"
-#undef THREAD_INC_IMPL
-
-}
-
-#endif /* Thread_H */
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __THREAD_H__
+#define __THREAD_H__
+
+#define THREAD_INC_HEADER
+#include "arch/Thread.inc"
+#undef THREAD_INC_HEADER
+
+#include "capu/Error.h"
+#include "capu/util/Runnable.h"
+
+namespace capu
+{
+
+ class Thread
+ {
+
+#define THREAD_INC_MEMBER
+#include "arch/Thread.inc"
+#undef THREAD_INC_MEMBER
+
+ public:
+ /**
+ * Constructor
+ * Creates a thread which will execute the given function
+ * @param func function object that will be executed
+ * @param arguments
+ */
+ inline Thread(Runnable* object,void* args=NULL);
+
+ /**
+ * Destructor
+ */
+ inline ~Thread();
+
+ /**
+ * Waits the thread completeness
+ * @return CAPU_OK if thread is currently waiting for completeness
+ * CAPU_ERROR otherwise
+ */
+ inline status_t join();
+
+ /**
+ * Suspend the current thread for specific amount of time
+ * @return CAPU_OK if thread is currently suspended
+ * CAPU_ERROR otherwise
+ */
+ static inline status_t Sleep(uint32_t millis);
+
+ };
+
+#define THREAD_INC_IMPL
+ #include "arch/Thread.inc"
+#undef THREAD_INC_IMPL
+
+}
+
+#endif /* Thread_H */
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h Thu Aug 2 14:40:08 2012
@@ -16,27 +16,32 @@
* limitations under the License.
*/
-#ifndef __COMPARATOR_H__
-#define __COMPARATOR_H__
+#ifndef __TIME_H__
+#define __TIME_H__
#include "capu/Config.h"
-namespace capu {
+#define TIME_INC_HEADER
+#include "arch/Time.inc"
+#undef TIME_INC_HEADER
+
+namespace capu
+{
+ class Time
+ {
+ #define TIME_INC_MEMBER
+ #include "arch/Time.inc"
+ #undef TIME_INC_MEMBER
+ public:
- class Comparator {
-
- public:
- template <class T>
- bool_t operator () (const T &x, const T &y) const {
- return x == y;
- }
-
- bool_t operator () (const char* x, const char* y) const {
- return (strcmp(x,y) == 0);
- }
+ inline static uint32_t GetMilliseconds();
};
-}
-#endif /* COMPARATOR_H */
+#define TIME_INC_IMPL
+ #include "arch/Time.inc"
+#undef TIME_INC_IMPL
+
+}
+#endif
Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h?rev=1368491&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h Thu Aug 2 14:40:08 2012
@@ -0,0 +1,158 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UDPSOCKET_H__
+#define __UDPSOCKET_H__
+
+#define UDPSOCKET_INC_HEADER
+#include "arch/UdpSocket.inc"
+#undef UDPSOCKET_INC_HEADER
+
+#include "capu/Error.h"
+
+namespace capu {
+
+ class UdpSocket{
+#define UDPSOCKET_INC_MEMBER
+#include "arch/UdpSocket.inc"
+#undef UDPSOCKET_INC_MEMBER
+
+ public:
+
+ struct SocketAddrInfo
+ {
+ uint16_t port;
+ char addr[16];
+ };
+
+ /**
+ * Default Constructor
+ */
+ inline UdpSocket();
+
+ /**
+ * Destructor
+ */
+ inline ~UdpSocket();
+
+ /**
+ *
+ * @param port indicates port number
+ * @param address to bind if it is not given it accepts all connection from any address
+ * @return CAPU_OK if the server socket is successfully bound
+ * CAPU_SOCKET_EADDR if the addr is faulty
+ * CAPU_ERROR if the socket is already bound
+ * CAPU_EINVAL if the port is equal to 0
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ */
+ inline status_t bind(uint16_t port, const char *addr = NULL);
+
+ /**
+ * Send the messages
+ * @param buffer the content of message that will be sent to destination
+ * @param length the length of message that will be sent to destination
+ * @param receiverAddr the destination
+ * @return CAPU_OK if the sent is successful
+ * CAPU_EINVAL if the buffer is NULL
+ * CAPU_SOCKET_EADDR if the given address is not resolved.
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr);
+
+ /**
+ * Send the messages
+ * @param buffer the content of message that will be sent to destination
+ * @param length the length of message that will be sent to destination
+ * @param receiverAddr the destination address
+ * @param receiverPort the destination port
+ * @return CAPU_OK if the sent is successful
+ * CAPU_EINVAL if the buffer is NULL
+ * CAPU_SOCKET_EADDR if the given address is not resolved.
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort);
+
+ /**
+ * Receive message
+ * @param buffer buffer that will be used to store incoming message
+ * @param length buffer size
+ * @param numBytes number of bytes on socket
+ * @param sender out parameter for the socket address of the sender
+ * @return CAPU_OK if the receive is successfully executed
+ * CAPU_TIMEOUT if there has been a timeout
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t receive(unsigned char *buffer, int32_t length, int32_t& numBytes, SocketAddrInfo* sender);
+
+ /**
+ * close the socket
+ * @return CAPU_OK if the socket is correctly closed
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t close();
+
+
+ /**
+ * Sets the maximum socket buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead)
+ * Set the receive buffer size
+ * Sets buffer size information.
+ * @return CAPU_OK if the buffer is successfully set for both receive and send operations
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t setBufferSize(int32_t bufferSize);
+
+ /**
+ * Set Timeout
+ * Sets the timeout value that specifies the maximum amount of time an input function waits until it completes
+ * @return CAPU_OK if the Timeout for receive operation is successfully set
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t setTimeout(int32_t timeout);
+
+ /**
+ * get the send and receive buffer size
+ * gets buffer size information.
+ * @return CAPU_OK if the buffer is successfully set for both receive and send operations
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t getBufferSize(int32_t& bufferSize);
+
+ /**
+ * Get Timeout
+ * @return CAPU_OK if the Timeout for receive operation is successfully set
+ * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
+ * CAPU_ERROR otherwise
+ */
+ inline status_t getTimeout(int32_t& timeout);
+ };
+
+
+#define UDPSOCKET_INC_IMPL
+#include "arch/UdpSocket.inc"
+#undef UDPSOCKET_INC_IMPL
+}
+
+#endif /* __UDPSOCKET_H__ */
+
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc Thu Aug 2 14:40:08 2012
@@ -1,24 +1,42 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ARCH_LINUX
-#include "Linux/AtomicOperation.inc"
-#elif ARCH_WIN32
-#include "Win32/AtomicOperation.inc"
-#endif
-
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(OS_LINUX)
+ #if defined(ARCH_X86_32)
+ #include "Linux_X86_32/AtomicOperation.inc"
+ #elif defined(ARCH_X86_64)
+ #include "Linux_X86_64/AtomicOperation.inc"
+ #elif defined(ARCH_ARMV7L)
+ #include "Linux_ARM_V7L/AtomicOperation.inc"
+ #endif
+#elif defined(OS_WINDOWS)
+ #if defined(ARCH_X86_32)
+ #include "Windows_X86_32/AtomicOperation.inc"
+ #elif defined(ARCH_X86_64)
+ #include "Windows_X86_64/AtomicOperation.inc"
+ #endif
+#elif defined(OS_INTEGRITY)
+ #if defined(ARCH_ARMV7L)
+ #include "Integrity_ARM_V7L/AtomicOperation.inc"
+ #endif
+#elif defined(OS_QNX)
+ #if defined(ARCH_X86_32)
+ #include "Linux_X86_32/AtomicOperation.inc"
+ #endif
+#endif
+
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc Thu Aug 2 14:40:08 2012
@@ -1,24 +1,28 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ARCH_LINUX
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(OS_LINUX)
#include "Linux/CondVar.inc"
-#elif ARCH_WIN32
- #include "Win32/CondVar.inc"
-#endif
-
+#elif defined(OS_WINDOWS)
+ #include "Windows/CondVar.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/CondVar.inc"
+#elif defined(OS_QNX)
+ #include "Linux/CondVar.inc"
+#endif
+
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc Thu Aug 2 14:40:08 2012
@@ -16,9 +16,13 @@
* limitations under the License.
*/
-#ifdef ARCH_LINUX
-#include "Linux/AtomicOperation.inc"
-#elif ARCH_WIN32
-#include "Win32/AtomicOperation.inc"
+#if defined(OS_LINUX)
+ #include "Linux/Debug.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/Debug.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/Debug.inc"
+#elif defined(OS_QNX)
+ #include "Linux/Debug.inc"
#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc Thu Aug 2 14:40:08 2012
@@ -17,6 +17,7 @@
*/
#ifdef ATOMIC_OPERATION_INC_HEADER
+#include "INTEGRITY.h"
#endif
#ifdef ATOMIC_OPERATION_INC_MEMBER
@@ -24,19 +25,15 @@
#ifdef ATOMIC_OPERATION_INC_IMPL
inline void AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; xaddl %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
+ Address tmp;
+ AtomicModify((Address*)mem, &tmp, 0, (Address)(&summand));
}
inline void AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; subl %1, %0"
- : /* no output */
- : "m" (mem), "r" (subtrahend)
- : "memory", "cc");
+ Address tmp;
+ int32_t subValue = -subtrahend;
+ AtomicModify((Address*)mem, &tmp, 0, (Address)(&subtrahend));
+
}
inline void AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc Thu Aug 2 14:40:08 2012
@@ -1,78 +1,105 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* $Id$
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to you under the Apache License, Version
+* 2.0 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifdef CONDVAR_INC_HEADER
+#include <pthread.h>
+#include <time.h>
+#include <errno.h>
+#endif
+
+#ifdef CONDVAR_INC_MEMBER
+private:
+ pthread_cond_t mCond;
+ pthread_condattr_t mCondAttr;
+#endif
+
+#ifdef CONDVAR_INC_IMPL
+ inline CondVar::CondVar()
+ {
+ pthread_condattr_init(&mCondAttr);
+ pthread_cond_init(&mCond,&mCondAttr);
+ }
+ inline CondVar::~CondVar()
+ {
+ pthread_cond_destroy(&mCond);
+ pthread_condattr_destroy(&mCondAttr);
+ }
+ inline status_t CondVar::signal()
+ {
+ if(pthread_cond_signal(&mCond) == 0)
+ {
+ return CAPU_OK;
+ }
+ else
+ {
+ return CAPU_ERROR;
+ }
+ }
+ inline status_t CondVar::broadcast()
+ {
+ if(pthread_cond_broadcast(&mCond) == 0)
+ {
+ return CAPU_OK;
+ }
+ else
+ {
+ return CAPU_ERROR;
+ }
+ }
+ inline status_t CondVar::wait(Mutex *mutex, uint32_t millisec)
+ {
+ if(mutex == NULL)
+ {
+ return CAPU_EINVAL;
+ }
+ if(millisec != 0)
+ {
+ timespec _time;
+ if(clock_gettime(CLOCK_REALTIME, &_time) < 0)
+ {
+ return CAPU_ERROR;
+ }
+ _time.tv_sec += (millisec/1000);
+ _time.tv_nsec += ((millisec%1000)* 1000000);
+ int32_t ret = pthread_cond_timedwait(&mCond, &mutex->mLock, &_time);
-#ifdef CONDVAR_INC_HEADER
-#include <pthread.h>
-#endif
-
-#ifdef CONDVAR_INC_MEMBER
-private:
- pthread_cond_t mCond;
- pthread_condattr_t mCondAttr;
-#endif
-
-#ifdef CONDVAR_INC_IMPL
- inline CondVar::CondVar()
- {
- pthread_condattr_init(&mCondAttr);
- pthread_cond_init(&mCond,&mCondAttr);
- }
- inline CondVar::~CondVar()
- {
- pthread_cond_destroy(&mCond);
- pthread_condattr_destroy(&mCondAttr);
- }
- inline status_t CondVar::signal()
- {
- if(pthread_cond_signal(&mCond)==0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
- inline status_t CondVar::broadcast()
- {
- if(pthread_cond_broadcast(&mCond)==0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
- inline status_t CondVar::wait(Mutex *mutex)
- {
- if(mutex == NULL)
- {
- return CAPU_EINVAL;
- }
- if (pthread_cond_wait(&mCond, &mutex->mLock)==0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
-#endif
+ switch(ret)
+ {
+ case 0:
+ return CAPU_OK;
+ case ETIMEDOUT:
+ return CAPU_ETIMEOUT;
+ default:
+ return CAPU_ERROR;
+ }
+ }
+ else
+ {
+ if(pthread_cond_wait(&mCond, &mutex->mLock) == 0)
+ {
+ return CAPU_OK;
+ }
+ else
+ {
+ return CAPU_ERROR;
+ }
+ }
+ }
+#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc Thu Aug 2 14:40:08 2012
@@ -16,30 +16,25 @@
* limitations under the License.
*/
-#ifdef BUILD_CHECK_MEMORY
-#ifdef ARCH_WIN32
-#include "vld.h"
+#ifdef DEBUG_INC_HEADER
+#include <assert.h>
#endif
+
+#ifdef DEBUG_INC_MEMBER
+public:
+
+
+private:
#endif
-#include <iostream>
-#include "gtest/gtest.h"
+#ifdef DEBUG_INC_IMPL
-GTEST_API_ int main(int argc, char **argv) {
- std::cout << "Running main() from capu-test\n";
-
- bool insideIde = false;
- if(argc > 1) {
- insideIde = true;
- }
-
- testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
-
- if(insideIde) {
- printf("press <enter> to exit.\n");
- getchar();
- }
+ inline void Debug::Assert(bool condition)
+{
+ #ifndef NDEBUG
+ assert(condition);
+ #else
+ #endif
+};
- return result;
-}
+#endif
Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc?rev=1368491&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc Thu Aug 2 14:40:08 2012
@@ -0,0 +1,153 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifdef MATH_INC_HEADER
+#include <cmath>
+#endif
+
+#ifdef MATH_INC_MEMBER
+public:
+static const float_t PI_f;
+static const double_t PI_d;
+#endif
+
+#ifdef MATH_INC_IMPL
+inline float_t Math::Ceil(float_t val) {
+ return ceilf(val);
+}
+
+inline double_t Math::Ceil(double_t val) {
+ return ceil(val);
+}
+
+inline float_t Floor(float_t val)
+{
+ return floorf(val);
+}
+
+inline double_t Floor(double_t val)
+{
+ return floor(val);
+}
+
+
+inline float_t Math::Abs(float_t val) {
+ return fabs(val);
+}
+
+inline double_t Math::Abs(double_t val) {
+ return abs(val);
+}
+
+inline int_t Abs(int_t val)
+{
+ return abs(val);
+}
+
+inline float_t Math::Sqrt(float_t val) {
+ return sqrtf(val);
+}
+
+inline double_t Math::Sqrt(double_t val) {
+ return sqrt(val);
+}
+
+inline float_t Math::Pow2(float_t val) {
+ return val * val;
+}
+
+inline double_t Math::Pow2(double_t val) {
+ return val * val;
+}
+
+inline float_t Math::Cos(float_t val) {
+ return cosf(val);
+}
+
+inline float_t Pow(float_t val, float_t exponent)
+{
+ return powf(val, exponent);
+}
+
+inline double_t Por(double_t val, double_t exponent)
+{
+ return pow(val, exponent);
+}
+
+inline double_t Math::Cos(double_t val) {
+ return cos(val);
+}
+
+inline float_t Math::Sin(float_t val) {
+ return sinf(val);
+}
+
+inline double_t Math::Sin(double_t val) {
+ return sin(val);
+}
+
+inline float_t Math::Tan(float_t val) {
+ return tanf(val);
+}
+
+inline double_t Math::Tan(double_t val) {
+ return tan(val);
+}
+
+inline float_t Math::ArcCos(float_t val) {
+ return acosf(val);
+}
+
+inline double_t Math::ArcCos(double_t val) {
+ return acos(val);
+}
+
+inline float_t Math::ArcSin(float_t val) {
+ return asinf(val);
+}
+
+inline double_t Math::ArcSin(double_t val) {
+ return asin(val);
+}
+
+inline float_t Math::ArcTan(float_t val) {
+ return atanf(val);
+}
+
+inline double_t Math::ArcTan(double_t val) {
+ return atan(val);
+}
+
+inline float_t Math::Rad2Deg(float_t val) {
+ return val * (180.f / PI_f);
+}
+
+inline double_t Math::Rad2Deg(double_t val) {
+ return val * (180.0 / PI_d);
+}
+
+inline float_t Math::Deg2Rad(float_t val) {
+ return val * (PI_f / 180.f);
+}
+
+inline double_t Math::Deg2Rad(double_t val) {
+ return val * (PI_d / 180.0);
+}
+
+#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc Thu Aug 2 14:40:08 2012
@@ -1,6 +1,6 @@
/* $Id$
-*
* Licensed to the Apache Software Foundation (ASF) under one or more
+*
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version
@@ -16,30 +16,35 @@
* limitations under the License.
*/
-#ifdef BUILD_CHECK_MEMORY
-#ifdef ARCH_WIN32
-#include "vld.h"
+#ifdef MEMORY_INC_HEADER
+#include "capu/Config.h"
#endif
+
+#ifdef MEMORY_INC_MEMBER
#endif
-#include <iostream>
-#include "gtest/gtest.h"
+#ifdef MEMORY_INC_IMPL
-GTEST_API_ int main(int argc, char **argv) {
- std::cout << "Running main() from capu-test\n";
-
- bool insideIde = false;
- if(argc > 1) {
- insideIde = true;
- }
-
- testing::InitGoogleTest(&argc, argv);
- int result = RUN_ALL_TESTS();
-
- if(insideIde) {
- printf("press <enter> to exit.\n");
- getchar();
- }
+inline
+void Memory::Set(void* dst, int32_t val, uint_t size)
+{
+ memset(dst, val, size);
+}
- return result;
+inline
+void Memory::Copy(void* dst, const void* src, uint_t size)
+{
+ memcpy(dst, src, size);
}
+
+inline
+void Memory::Move(void* dst, const void* src, uint_t size)
+{
+ memmove(dst, src, size);
+}
+
+int32_t Memory::Compare(const void* ptr1, const void* ptr2, uint_t num)
+{
+ return memcmp(ptr1, ptr2, num);
+}
+#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc Thu Aug 2 14:40:08 2012
@@ -83,7 +83,7 @@ inline status_t Socket::receive(unsigned
if (res == -1) {
numBytes = 0;
if (errno == EAGAIN)
- return CAPU_TIMEOUT;
+ return CAPU_ETIMEOUT;
else
return CAPU_ERROR;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc Thu Aug 2 14:40:08 2012
@@ -1,59 +1,65 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef STRINGUTILS_INC_HEADER
-#include "capu/Config.h"
-#include <stdarg.h>
-#endif
-
-#ifdef STRINGUTILS_INC_MEMBER
-private:
-#endif
-
-#ifdef STRINGUTILS_INC_IMPL
-
- inline void StringUtils::Strncpy(char* dst, uint32_t dstSize, const char* src)
- {
- strncpy(dst, src, dstSize);
- }
-
- inline uint32_t StringUtils::Strlen(const char* str)
- {
- return strlen(str);
- }
-
- inline int32_t StringUtils::Strcmp(const char* str1, const char* str2)
- {
- return strcmp(str1, str2);
- }
-
- inline void StringUtils::Vsprintf(char* buffer, uint32_t bufferSize,const char* format, va_list values)
- {
- vsnprintf(buffer, bufferSize, format, values);
- }
+/* $Id$
+*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to you under the Apache License, Version
+* 2.0 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifdef STRINGUTILS_INC_HEADER
+#include "capu/Config.h"
+#include <stdarg.h>
+#endif
+
+#ifdef STRINGUTILS_INC_MEMBER
+private:
+#endif
+
+#ifdef STRINGUTILS_INC_IMPL
+
+ inline void StringUtils::Strncpy(char* dst, uint_t dstSize, const char* src)
+ {
+ strncpy(dst, src, dstSize);
+ }
+
+ inline uint_t StringUtils::Strlen(const char* str)
+ {
+ return strlen(str);
+ }
+
+ inline int_t StringUtils::Strcmp(const char* str1, const char* str2)
+ {
+ return strcmp(str1, str2);
+ }
+
+ inline void StringUtils::Vsprintf(char* buffer, uint_t bufferSize,const char* format, va_list values)
+ {
+ vsnprintf(buffer, bufferSize, format, values);
+ }
+
- inline void StringUtils::Sprintf(char* buffer, uint32_t bufferSize, const char* format, ...)
- {
- va_list argptr;
- va_start(argptr,format);
- StringUtils::Vsprintf(buffer, bufferSize, format, argptr);
- va_end(argptr);
+ inline int32_t StringUtils::Vscprintf(const char* format, va_list values) {
+ char c;
+ return vsnprintf(&c, 1, format, values);
}
-
-
-#endif
+
+ inline void StringUtils::Sprintf(char* buffer, uint_t bufferSize, const char* format, ...)
+ {
+ va_list argptr;
+ va_start(argptr,format);
+ StringUtils::Vsprintf(buffer, bufferSize, format, argptr);
+ va_end(argptr);
+ }
+
+
+#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc Thu Aug 2 14:40:08 2012
@@ -1,96 +1,92 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef THREAD_INC_HEADER
-#include <pthread.h>
-#include <unistd.h>
-#endif
-
-#ifdef THREAD_INC_MEMBER
-private:
- pthread_t mThread;
- pthread_attr_t mAttr;
-
- template <typename T>
- static void * run(void* param);
-
- template <class K>
- class ThreadParam
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef THREAD_INC_HEADER
+#include <pthread.h>
+#include <unistd.h>
+#endif
+
+#ifdef THREAD_INC_MEMBER
+private:
+ pthread_t mThread;
+ pthread_attr_t mAttr;
+
+ static void * run(void* param)
{
- public:
- K* object;
- void* param;
- };
-
-#endif
-
-#ifdef THREAD_INC_IMPL
-
-template <typename T>
-void * Thread::run(void* param)
-{
- ThreadParam<T>* args= (ThreadParam<T>*) param;
- (*args->object)(args->param);
- delete args;
- pthread_exit(NULL);
-}
-
-template <typename T>
-inline Thread::Thread(T *object,void* args)
-{
- pthread_attr_init(&mAttr);
- pthread_attr_setdetachstate(&mAttr,PTHREAD_CREATE_JOINABLE);
- if (object == NULL)
- {
- return;
- }
- ThreadParam<T> *param = new ThreadParam<T>();
- param->object=object;
- param->param=args;
- pthread_create(&mThread,&mAttr,Thread::run<T>,param);
-}
-
-inline Thread::~Thread()
-{
- join();
- pthread_attr_destroy(&mAttr);
-}
-
-inline status_t Thread::join ()
-{
- if (mThread == 0) {
- return CAPU_ERROR;
- }
- if(pthread_join(mThread,NULL) == 0) {
- mThread = 0;
- return CAPU_OK;
- }
- else {
- return CAPU_ERROR;
+ ThreadParam* args= (ThreadParam*) param;
+ (*args->object)(args->param);
+ delete args;
+ pthread_exit(NULL);
}
-}
-
-inline status_t Thread::Sleep(uint32_t millis)
-{
- if(usleep(millis*1000)==0)
- return CAPU_OK;
- else
- return CAPU_ERROR;
-}
-
-#endif
+
+ class ThreadParam
+ {
+ public:
+/* ~ThreadParam()
+ {
+ if(object != NULL)
+ delete object;
+ }*/
+ Runnable* object;
+ void* param;
+ };
+
+#endif
+
+#ifdef THREAD_INC_IMPL
+
+inline Thread::Thread(Runnable *object,void* args)
+{
+ pthread_attr_init(&mAttr);
+ pthread_attr_setdetachstate(&mAttr,PTHREAD_CREATE_JOINABLE);
+ if (object == NULL)
+ {
+ return;
+ }
+ ThreadParam *param = new ThreadParam();
+ param->object=object;
+ param->param=args;
+ pthread_create(&mThread, &mAttr, Thread::run, param);
+}
+
+inline Thread::~Thread()
+{
+ join();
+ pthread_attr_destroy(&mAttr);
+}
+
+inline status_t Thread::join ()
+{
+ if (mThread == 0) {
+ return CAPU_ERROR;
+ }
+ if(pthread_join(mThread, NULL) == 0) {
+ mThread = 0;
+ return CAPU_OK;
+ }
+ return CAPU_ERROR;
+}
+
+inline status_t Thread::Sleep(uint32_t millis)
+{
+ if(usleep(millis*1000)==0)
+ return CAPU_OK;
+ return CAPU_ERROR;
+}
+
+#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc Thu Aug 2 14:40:08 2012
@@ -15,14 +15,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef TIME_INC_HEADER
+#include <time.h>
+#endif
-
-
-#ifdef ARCH_LINUX
-#include "Linux/Socket.inc"
-#elif ARCH_WIN32
-#include "Win32/Socket.inc"
+#ifdef TIME_INC_MEMBER
#endif
+#ifdef TIME_INC_IMPL
+inline
+uint32_t Time::GetMilliseconds()
+{
+ timespec time;
+ clock_gettime(CLOCK_REALTIME, &time);
+ return static_cast<uint32_t>(((static_cast<uint64_t>(time.tv_sec) * 1000000000) + time.tv_nsec) / 1000000);
+}
+#endif
\ No newline at end of file
Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc?rev=1368491&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc Thu Aug 2 14:40:08 2012
@@ -0,0 +1,224 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef UDPSOCKET_INC_HEADER
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#include "capu/os/StringUtils.h"
+#endif
+
+#ifdef UDPSOCKET_INC_MEMBER
+public:
+private:
+ int32_t mSocket;
+ int32_t mAddressFamily;
+ int32_t mSocketType;
+ bool_t mIsBound;
+#endif
+
+#ifdef UDPSOCKET_INC_IMPL
+inline UdpSocket::UdpSocket() {
+ //create the socket which is used to connect the server
+ mAddressFamily = AF_INET;
+ mSocketType = SOCK_DGRAM;
+ mSocket = socket(mAddressFamily, mSocketType, 0);
+ if (mSocket != -1) {
+ int32_t optval = 1;
+ setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
+ }
+ mIsBound = false;
+}
+
+inline UdpSocket::~UdpSocket() {
+ close();
+}
+
+inline status_t UdpSocket::bind(uint16_t port, const char *addr) {
+ if (port == 0) {
+ return CAPU_EINVAL;
+ }
+
+ if (mIsBound) {
+ return CAPU_ERROR;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ struct sockaddr_in mServerAddress;
+ memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
+ mServerAddress.sin_family = AF_INET;
+ if (addr == NULL)
+ mServerAddress.sin_addr.s_addr = INADDR_ANY;
+ else if (inet_aton(addr, &mServerAddress.sin_addr) == 0)
+ return CAPU_SOCKET_EADDR;
+ mServerAddress.sin_port = htons(port);
+
+ int32_t res = ::bind(mSocket, (sockaddr *) &mServerAddress, sizeof (struct sockaddr_in));
+ if (res < 0) {
+ printf("%d\n", errno);
+ return CAPU_SOCKET_EBIND;
+ }
+
+ mIsBound = true;
+ return CAPU_OK;
+}
+
+
+inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort) {
+ if ((buffer == NULL) || (length < 0)) {
+ return CAPU_EINVAL;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ struct hostent *receiverAddrIp = gethostbyname(receiverAddr);
+ if (receiverAddrIp == NULL) {
+ return CAPU_SOCKET_EADDR;
+ }
+ struct sockaddr_in receiverSockAddr;
+ receiverSockAddr.sin_family = AF_INET;
+ memcpy((char *) &receiverSockAddr.sin_addr.s_addr, (char *) receiverAddrIp->h_addr_list[0], receiverAddrIp->h_length);
+ receiverSockAddr.sin_port = htons(receiverPort);
+
+
+ int32_t result = sendto(mSocket,(char*)buffer, length, 0, (sockaddr*)&receiverSockAddr, sizeof(receiverSockAddr));
+ if(result == -1)
+ {
+ return CAPU_ERROR;
+ }
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr) {
+ return send(buffer, length, receiverAddr.addr, receiverAddr.port);
+}
+
+inline status_t UdpSocket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes, SocketAddrInfo* sender) {
+ if ((buffer == NULL) || (length < 0)) {
+ return CAPU_EINVAL;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ sockaddr remoteSocketAddr;
+ socklen_t remoteSocketAddrSize = sizeof(remoteSocketAddr);
+
+ int32_t result = recvfrom(mSocket, (char*)buffer, length, 0, &remoteSocketAddr, &remoteSocketAddrSize);
+ if (result == -1) {
+ numBytes = 0;
+ if (errno == EAGAIN) {
+ return CAPU_ETIMEOUT;
+ } else {
+ return CAPU_ERROR;
+ }
+ }else{
+ if(sender != 0)
+ {
+ sender->port = ntohs(((sockaddr_in*)&remoteSocketAddr)->sin_port);
+ char* addr = inet_ntoa(((sockaddr_in*)&remoteSocketAddr)->sin_addr);
+ StringUtils::Strncpy(sender->addr, sizeof(sender->addr), addr);
+ }
+ }
+ numBytes = result;
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::close() {
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ } else {
+ if (::close(mSocket) < 0)
+ return CAPU_SOCKET_ECLOSE;
+ mSocket = -1;
+ return CAPU_OK;
+ }
+}
+
+inline status_t UdpSocket::setBufferSize(int32_t bufferSize) {
+ if (bufferSize < 0) {
+ return CAPU_EINVAL;
+ }
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::setTimeout(int32_t timeout) {
+ if (mSocket == -1)
+ return CAPU_SOCKET_ESOCKET;
+
+ struct timeval soTimeout;
+ soTimeout.tv_sec = timeout;
+ soTimeout.tv_usec = 0;
+
+ if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
+ return CAPU_ERROR;
+ }
+ if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::getBufferSize(int32_t& bufferSize) {
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ socklen_t len = sizeof (bufferSize);
+ if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::getTimeout(int32_t& timeout) {
+ if (mSocket == -1)
+ return CAPU_SOCKET_ESOCKET;
+
+ struct timeval soTimeout;
+ socklen_t len = sizeof(soTimeout);
+
+ if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == -1) {
+ return CAPU_ERROR;
+ }
+
+ timeout = soTimeout.tv_sec;
+
+ return CAPU_OK;
+}
+#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc Thu Aug 2 14:40:08 2012
@@ -24,26 +24,36 @@
#ifdef ATOMIC_OPERATION_INC_IMPL
inline void AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; xaddl %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
+ __asm__ volatile (
+ "1: ldrex r0, [%0] \n\t" //load mem into r0
+ "add r0, r0, %1 \n\t" //add summand to r0 and store result in r0
+ "strex r1, r0, [%0] \n\t" //store result from register back to mem
+ "cmp r1, #0 \n\t" //check if we have had exclusive access
+ "bne 1b" //if there was no exclusive access, try it again
+ : /* no output register needed */
+ : "r" (&mem), "r"(summand)
+ : "r0" , "r1"
+ );
}
inline void AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; subl %1, %0"
- : /* no output */
- : "m" (mem), "r" (subtrahend)
- : "memory", "cc");
+ __asm__ volatile (
+ "2: ldrex r0, [%0] \n\t" //load mem into r0
+ "sub r0, r0, %1 \n\t" //subs subthrahend from r0 and store result in r0
+ "strex r1, r0, [%0] \n\t" //store result from register back to mem
+ "cmp r1, #0 \n\t" //check if we have had exclusive access
+ "bne 2b" //if there was no exclusive access, try it again
+ : /* no output register needed */
+ : "r" (&mem), "r"(subtrahend)
+ : "r0" , "r1"
+ );
}
-inline void AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
+inline void AtomicOperation::AtomicInc32(volatile uint32_t &mem){
AtomicAdd32(mem, 1);
}
-inline void AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
+inline void AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
AtomicSub32(mem, 1);
}
#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
(empty)
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/AtomicOperation.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc Thu Aug 2 14:40:08 2012
@@ -25,7 +25,7 @@
#ifdef ATOMIC_OPERATION_INC_IMPL
inline void AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; xaddl %0,%1"
+ asm volatile ("lock; xadd %0,%1"
: "=r" (summand), "=m" (mem)
: "0" (summand), "m" (mem)
: "memory", "cc");
@@ -33,7 +33,7 @@ inline void AtomicOperation::AtomicAdd32
inline void AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; subl %1, %0"
+ asm volatile ("lock; sub %1, %0"
: /* no output */
: "m" (mem), "r" (subtrahend)
: "memory", "cc");
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc Thu Aug 2 14:40:08 2012
@@ -16,8 +16,12 @@
* limitations under the License.
*/
-#ifdef ARCH_LINUX
-#include "Linux/NumericLimits.inc"
-#elif ARCH_WIN32
-#include "Win32/NumericLimits.inc"
+#if defined(OS_LINUX)
+ #include "Linux/Math.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/Math.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/Math.inc"
+#elif defined(OS_QNX)
+ #include "Linux/Math.inc"
#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc Thu Aug 2 14:40:08 2012
@@ -16,8 +16,12 @@
* limitations under the License.
*/
-#ifdef ARCH_LINUX
-#include "Linux/Mutex.inc"
-#elif ARCH_WIN32
-#include "Win32/Mutex.inc"
+#if defined(OS_LINUX)
+ #include "Linux/Memory.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/Memory.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/Memory.inc"
+#elif defined(OS_QNX)
+ #include "Linux/Memory.inc"
#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc Thu Aug 2 14:40:08 2012
@@ -1,23 +1,27 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ARCH_LINUX
-#include "Linux/Mutex.inc"
-#elif ARCH_WIN32
-#include "Win32/Mutex.inc"
-#endif
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(OS_LINUX)
+ #include "Linux/Mutex.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/Mutex.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/Mutex.inc"
+#elif defined(OS_QNX)
+ #include "Linux/Mutex.inc"
+#endif
\ No newline at end of file
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc Thu Aug 2 14:40:08 2012
@@ -16,8 +16,12 @@
* limitations under the License.
*/
-#ifdef ARCH_LINUX
-#include "Linux/NumericLimits.inc"
-#elif ARCH_WIN32
-#include "Win32/NumericLimits.inc"
+#if defined(OS_LINUX)
+ #include "Linux/NumericLimits.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/NumericLimits.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/NumericLimits.inc"
+#elif defined(OS_QNX)
+ #include "Linux/NumericLimits.inc"
#endif
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc Thu Aug 2 14:40:08 2012
@@ -20,11 +20,13 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <sys/time.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
+#include <stdio.h>
#endif
#ifdef SOCKET_INC_MEMBER
@@ -83,7 +85,7 @@ inline status_t Socket::receive(unsigned
if (res == -1) {
numBytes = 0;
if (errno == EAGAIN)
- return CAPU_TIMEOUT;
+ return CAPU_ETIMEOUT;
else
return CAPU_ERROR;
}
@@ -194,7 +196,7 @@ inline status_t Socket::setTimeout(int32
return CAPU_SOCKET_ESOCKET;
struct timeval _timeout;
- _timeout.tv_sec = timeout;
+ _timeout.tv_sec = timeout + 1;
_timeout.tv_usec = 0;
if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, sizeof (_timeout)) < 0)
@@ -225,10 +227,11 @@ inline status_t Socket::getLingerOption(
if (getsockopt(mSocket, SOL_SOCKET, SO_LINGER, &so_linger, &len) < 0)
return CAPU_ERROR;
_linger = so_linger.l_linger;
- if (so_linger.l_onoff == 1)
+ if (so_linger.l_onoff > 0)
isLinger = true;
else
isLinger = false;
+
return CAPU_OK;
}
@@ -239,8 +242,8 @@ inline status_t Socket::getNoDelay(bool_
socklen_t len = sizeof (opt);
if (getsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, &opt, &len) < 0)
return CAPU_ERROR;
-
- if (opt == 1)
+
+ if (opt > 0)
noDelay = true;
else
noDelay = false;
@@ -258,7 +261,7 @@ inline status_t Socket::getKeepAlive(boo
if (getsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, &opt, &len) < 0)
return CAPU_ERROR;
- if (opt == 1)
+ if (opt > 0)
keepAlive = true;
else
keepAlive = false;
@@ -276,7 +279,6 @@ inline status_t Socket::getTimeout(int32
if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, &len) < 0)
return CAPU_ERROR;
-
timeout = _timeout.tv_sec;
return CAPU_OK;
Copied: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc (from r1368489, incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc?p2=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc&p1=incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc&r1=1368489&r2=1368491&rev=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc Thu Aug 2 14:40:08 2012
@@ -18,6 +18,7 @@
#ifdef STRINGUTILS_INC_HEADER
#include "capu/Config.h"
+#include <string.h>
#include <stdarg.h>
#endif
@@ -27,27 +28,27 @@ private:
#ifdef STRINGUTILS_INC_IMPL
- inline void StringUtils::Strncpy(char* dst, uint32_t dstSize, const char* src)
+ inline void StringUtils::Strncpy(char* dst, uint_t dstSize, const char* src)
{
strncpy(dst, src, dstSize);
}
- inline uint32_t StringUtils::Strlen(const char* str)
+ inline uint_t StringUtils::Strlen(const char* str)
{
return strlen(str);
}
- inline int32_t StringUtils::Strcmp(const char* str1, const char* str2)
+ inline int_t StringUtils::Strcmp(const char* str1, const char* str2)
{
return strcmp(str1, str2);
}
- inline void StringUtils::Vsprintf(char* buffer, uint32_t bufferSize,const char* format, va_list values)
+ inline void StringUtils::Vsprintf(char* buffer, uint_t bufferSize,const char* format, va_list values)
{
vsnprintf(buffer, bufferSize, format, values);
}
- inline void StringUtils::Sprintf(char* buffer, uint32_t bufferSize, const char* format, ...)
+ inline void StringUtils::Sprintf(char* buffer, uint_t bufferSize, const char* format, ...)
{
va_list argptr;
va_start(argptr,format);
Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc?rev=1368491&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc Thu Aug 2 14:40:08 2012
@@ -0,0 +1,225 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef UDPSOCKET_INC_HEADER
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#include "capu/os/StringUtils.h"
+#endif
+
+#ifdef UDPSOCKET_INC_MEMBER
+public:
+private:
+ int32_t mSocket;
+ int32_t mAddressFamily;
+ int32_t mSocketType;
+ bool_t mIsBound;
+#endif
+
+#ifdef UDPSOCKET_INC_IMPL
+inline UdpSocket::UdpSocket() {
+ //create the socket which is used to connect the server
+ mAddressFamily = AF_INET;
+ mSocketType = SOCK_DGRAM;
+ mSocket = socket(mAddressFamily, mSocketType, 0);
+ if (mSocket != -1) {
+ int32_t optval = 1;
+ setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
+ }
+ mIsBound = false;
+}
+
+inline UdpSocket::~UdpSocket() {
+ close();
+}
+
+inline status_t UdpSocket::bind(uint16_t port, const char *addr) {
+ if (port == 0) {
+ return CAPU_EINVAL;
+ }
+
+ if (mIsBound) {
+ return CAPU_ERROR;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ struct sockaddr_in mServerAddress;
+ memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
+ mServerAddress.sin_family = AF_INET;
+ if (addr == NULL)
+ mServerAddress.sin_addr.s_addr = INADDR_ANY;
+ else if (inet_aton(addr, &mServerAddress.sin_addr) == 0)
+ return CAPU_SOCKET_EADDR;
+ mServerAddress.sin_port = htons(port);
+
+ int32_t res = ::bind(mSocket, (sockaddr *) &mServerAddress, sizeof (struct sockaddr_in));
+ if (res < 0) {
+ printf("%d\n", errno);
+ return CAPU_SOCKET_EBIND;
+ }
+
+ mIsBound = true;
+ return CAPU_OK;
+}
+
+
+inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort) {
+ if ((buffer == NULL) || (length < 0)) {
+ return CAPU_EINVAL;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ struct hostent *receiverAddrIp = gethostbyname(receiverAddr);
+ if (receiverAddrIp == NULL) {
+ return CAPU_SOCKET_EADDR;
+ }
+ struct sockaddr_in receiverSockAddr;
+ receiverSockAddr.sin_family = AF_INET;
+ memcpy((char *) &receiverSockAddr.sin_addr.s_addr, (char *) receiverAddrIp->h_addr_list[0], receiverAddrIp->h_length);
+ receiverSockAddr.sin_port = htons(receiverPort);
+
+
+ int32_t result = sendto(mSocket,(char*)buffer, length, 0, (sockaddr*)&receiverSockAddr, sizeof(receiverSockAddr));
+ if(result == -1)
+ {
+ return CAPU_ERROR;
+ }
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr) {
+ return send(buffer, length, receiverAddr.addr, receiverAddr.port);
+}
+
+inline status_t UdpSocket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes, SocketAddrInfo* sender) {
+ if ((buffer == NULL) || (length < 0)) {
+ return CAPU_EINVAL;
+ }
+
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ sockaddr remoteSocketAddr;
+ socklen_t remoteSocketAddrSize = sizeof(remoteSocketAddr);
+
+ int32_t result = recvfrom(mSocket, (char*)buffer, length, 0, &remoteSocketAddr, &remoteSocketAddrSize);
+ if (result == -1) {
+ numBytes = 0;
+ if (errno == EAGAIN) {
+ return CAPU_ETIMEOUT;
+ } else {
+ return CAPU_ERROR;
+ }
+ }else{
+ if(sender != 0)
+ {
+ sender->port = ntohs(((sockaddr_in*)&remoteSocketAddr)->sin_port);
+ char* addr = inet_ntoa(((sockaddr_in*)&remoteSocketAddr)->sin_addr);
+ StringUtils::Strncpy(sender->addr, sizeof(sender->addr), addr);
+ }
+ }
+ numBytes = result;
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::close() {
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ } else {
+ if (::close(mSocket) < 0)
+ return CAPU_SOCKET_ECLOSE;
+ mSocket = -1;
+ return CAPU_OK;
+ }
+}
+
+inline status_t UdpSocket::setBufferSize(int32_t bufferSize) {
+ if (bufferSize < 0) {
+ return CAPU_EINVAL;
+ }
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::setTimeout(int32_t timeout) {
+ if (mSocket == -1)
+ return CAPU_SOCKET_ESOCKET;
+
+ struct timeval soTimeout;
+ soTimeout.tv_sec = timeout + 1;
+ soTimeout.tv_usec = 0;
+
+ if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
+ return CAPU_ERROR;
+ }
+ if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::getBufferSize(int32_t& bufferSize) {
+ if (mSocket == -1) {
+ return CAPU_SOCKET_ESOCKET;
+ }
+
+ socklen_t len = sizeof (bufferSize);
+ if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == -1) {
+ return CAPU_ERROR;
+ }
+
+ return CAPU_OK;
+}
+
+inline status_t UdpSocket::getTimeout(int32_t& timeout) {
+ if (mSocket == -1)
+ return CAPU_SOCKET_ESOCKET;
+
+ struct timeval soTimeout;
+ socklen_t len = sizeof(soTimeout);
+
+ if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == -1) {
+ return CAPU_ERROR;
+ }
+
+ timeout = soTimeout.tv_sec;
+
+ return CAPU_OK;
+}
+#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc Thu Aug 2 14:40:08 2012
@@ -16,8 +16,12 @@
* limitations under the License.
*/
-#ifdef ARCH_LINUX
-#include "Linux/ServerSocket.inc"
-#elif ARCH_WIN32
-#include "Win32/ServerSocket.inc"
-#endif
+ #if defined(OS_LINUX)
+ #include "Linux/ServerSocket.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/ServerSocket.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/ServerSocket.inc"
+#elif defined(OS_QNX)
+ #include "Linux/ServerSocket.inc"
+#endif
\ No newline at end of file
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc Thu Aug 2 14:40:08 2012
@@ -16,13 +16,14 @@
* limitations under the License.
*/
-
-
-#ifdef ARCH_LINUX
-#include "Linux/Socket.inc"
-#elif ARCH_WIN32
-#include "Win32/Socket.inc"
+#if defined(OS_LINUX)
+ #include "Linux/Socket.inc"
+#elif defined(OS_WINDOWS)
+ #include "Windows/Socket.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/Socket.inc"
+#elif defined(OS_QNX)
+ #include "Qnx/Socket.inc"
#endif
-
Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc?rev=1368491&r1=1368490&r2=1368491&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc Thu Aug 2 14:40:08 2012
@@ -1,25 +1,27 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-#ifdef ARCH_LINUX
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined(OS_LINUX)
#include "Linux/StringUtils.inc"
-#elif ARCH_WIN32
- #include "Win32/StringUtils.inc"
-#endif
+#elif defined(OS_WINDOWS)
+ #include "Windows/StringUtils.inc"
+#elif defined(OS_INTEGRITY)
+ #include "Linux/StringUtils.inc"
+#elif defined(OS_QNX)
+ #include "Qnx/StringUtils.inc"
+#endif
\ No newline at end of file