- Standard package.
- OSD package.
- Aspect package.
- Xw package.
// =======================================================================
Aspect_DisplayConnection::Aspect_DisplayConnection()
{
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
OSD_Environment anEnv ("DISPLAY");
myDisplayName = anEnv.Value();
Init();
// =======================================================================
Aspect_DisplayConnection::~Aspect_DisplayConnection()
{
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
if (myDisplay != NULL)
{
XCloseDisplay (myDisplay);
#endif
}
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
// =======================================================================
// function : Aspect_DisplayConnection
// purpose :
#include <TCollection_AsciiString.hxx>
#include <NCollection_DataMap.hxx>
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
#include <X11/Xlib.h>
#endif
//! Destructor. Close opened connection.
Standard_EXPORT ~Aspect_DisplayConnection();
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
//! Constructor. Creates connection with display specified in theDisplayName.
//! Display name should be in format "hostname:number" or "hostname:number.screen_number", where:
//! hostname - Specifies the name of the host machine on which the display is physically attached.
#ifndef __Aspect_WNTXWD_HXX
# define __Aspect_WNTXWD_HXX
-#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
# include <X11/XWDFile.h>
# else
TCollection_AsciiString aBuffer;
myPath.SystemName ( aBuffer );
if (!stat ( aBuffer.ToCString(), &buffer )) {
- decode = localtime(&buffer.st_ctime);
- result.SetValues (
- decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
+ time_t aTime = (time_t)buffer.st_ctime;
+ decode = localtime (&aTime);
+ result.SetValues (decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
decode->tm_hour, decode->tm_min, decode->tm_sec , 0,0);
}
else
TCollection_AsciiString aBuffer;
myPath.SystemName ( aBuffer );
if (!stat ( aBuffer.ToCString(), &buffer )) {
- decode = localtime(&buffer.st_atime);
- result.SetValues (
- decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
+ time_t aTime = (time_t)buffer.st_ctime;
+ decode = localtime (&aTime);
+ result.SetValues (decode->tm_mon+1, decode->tm_mday, decode->tm_year+1900,
decode->tm_hour, decode->tm_min, decode->tm_sec, 0,0 );
}
else
#ifdef linux
#include <fenv.h>
-#include <fpu_control.h>
static Standard_Boolean fFltExceptions = Standard_False;
#endif
#include <locale.h>
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__ANDROID__)
#include <malloc.h>
#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1)
#include <mm_malloc.h>
{
#if defined(_MSC_VER)
return _aligned_malloc (theSize, theAlign);
+#elif defined(__ANDROID__)
+ return memalign (theAlign, theSize);
#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1)
- return _mm_malloc (theSize, theAlign);
+ return _mm_malloc (theSize, theAlign);
#else
void* aPtr;
if (posix_memalign (&aPtr, theAlign, theSize))
{
#if defined(_MSC_VER)
_aligned_free (thePtrAligned);
+#elif defined(__ANDROID__)
+ free (thePtrAligned);
#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1)
_mm_free (thePtrAligned);
#else
#ifndef _Standard_Atomic_HeaderFile
#define _Standard_Atomic_HeaderFile
+#if defined(__ANDROID__)
+ #include <sys/atomics.h>
+#endif
+
//! Increments atomically integer variable pointed by theValue
//! and returns resulting incremented value.
inline int Standard_Atomic_Increment (volatile int* theValue);
return OSAtomicDecrement32Barrier (theValue);
}
+#elif defined(__ANDROID__)
+// Atomic operations that were exported by the C library didn't
+// provide any memory barriers, which created potential issues on
+// multi-core devices. Starting from ndk version r7b they are defined as
+// inlined calls to GCC sync builtins, which always provide a full barrier.
+// It is strongly recommended to use newer versions of ndk.
+
+int Standard_Atomic_Increment (volatile int* theValue)
+{
+ return __atomic_inc (theValue);
+}
+
+int Standard_Atomic_Decrement (volatile int* theValue)
+{
+ return __atomic_dec (theValue);
+}
+
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64))
// use x86 / x86_64 inline assembly (compatibility with alien compilers / old GCC)
#include <locale.h>
-//! "xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension
-//! and become part of POSIX since '2008.
-//! Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L)
-//! since POSIX didn't declared such identifier.
-//! We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler.
-#if defined(__APPLE__) || defined(_GNU_SOURCE) || defined(HAVE_XLOCALE_H)
- #include <xlocale.h>
- #ifndef HAVE_XLOCALE_H
+#ifndef HAVE_XLOCALE_H
+ //! "xlocale.h" available in Mac OS X and glibc (Linux) for a long time as an extension
+ //! and become part of POSIX since '2008.
+ //! Notice that this is impossible to test (_POSIX_C_SOURCE >= 200809L)
+ //! since POSIX didn't declared such identifier.
+ #if defined(__APPLE__)
+ #define HAVE_XLOCALE_H
+ #endif
+
+ //! We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler.
+ #if defined(_GNU_SOURCE) && !defined(__ANDROID__)
#define HAVE_XLOCALE_H
#endif
+#endif // ifndef HAVE_LOCALE_H
+
+#ifdef HAVE_XLOCALE_H
+ #include <xlocale.h>
#endif
//! This class intended to temporary switch C locale and logically equivalent to setlocale(LC_ALL, "C").
// So we switch to C locale temporarily
#define SAVE_TL() Standard_CLocaleSentry aLocaleSentry;
#ifndef HAVE_XLOCALE_H
- #error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
+ // glibc version for android platform use locale-independent implementation of
+ // strtod, strtol, strtoll functions. For other system with locale-depended
+ // implementations problems may appear if "C" locale is not set explicitly.
+ #ifndef __ANDROID__
+ #error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
+ #endif
#define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr)
#endif
#define vprintf_l(theLocale, theFormat, theArgPtr) vprintf(theFormat, theArgPtr)
#include <Xw_Window.hxx>
-#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
#include <Aspect_Convert.hxx>
#include <Aspect_WindowDefinitionError.hxx>
#ifndef _Xw_Window_H__
#define _Xw_Window_H__
-#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
+#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__)
#include <Aspect_Window.hxx>