* Introduced new header directory "config", which ATM contains HaikuConfig.h
and types.h. The idea is to provide a basic architecture/compiler abstraction by defining types and macros that allow the posix/ and os/ headers to be mostly architecture/compiler agnostic. * Adjusted the posix/ and os/ headers accordingly. * <SupportDefs.h>: Introduced B_PRI* and B_SCN* macros similar to the PRI* and SCN* macros defined in <inttypes.h>, just for the BeOS/Haiku [u]int* types and some POSIX types (e.g. off_t, dev_t, ino_t) that don't have POSIX macros. Also the B_PRI* and B_SCN* macros are available unconditionally, unlike the <inttypes.h> macros, which require __STDC_FORMAT_MACROS to be defined in C++ mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34214 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+15
-13
@@ -38,6 +38,10 @@
|
||||
// NOTE : This does NOT conform to the draft standard and is likely to change
|
||||
#include <alloc.h>
|
||||
|
||||
#ifdef __HAIKU__
|
||||
# include <config/types.h>
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
class istream; class ostream;
|
||||
|
||||
@@ -61,12 +65,10 @@ extern void __length_error (const char *);
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(__BEOS__) || defined(__HAIKU__))
|
||||
// Needed for atomic_add():
|
||||
typedef long int32;
|
||||
typedef volatile long vint32;
|
||||
extern "C" int32 atomic_add(vint32* value, int32 addvalue);
|
||||
#endif /* __BEOS__ */
|
||||
#ifdef __HAIKU__
|
||||
extern "C" __haiku_int32 atomic_add(volatile __haiku_int32* value,
|
||||
__haiku_int32 addvalue);
|
||||
#endif /* __HAIKU__ */
|
||||
|
||||
template <class charT, class traits = string_char_traits<charT>,
|
||||
class Allocator = alloc >
|
||||
@@ -79,9 +81,9 @@ private:
|
||||
|
||||
charT* data () { return reinterpret_cast<charT *>(this + 1); }
|
||||
charT& operator[] (size_t s) { return data () [s]; }
|
||||
#if (defined(__BEOS__) || defined(__HAIKU__))
|
||||
charT* grab () { if (selfish) return clone (); atomic_add((vint32*) &ref, 1); return data (); }
|
||||
void release() { if (atomic_add((int32*) &ref, -1) == 1) delete this; }
|
||||
#ifdef __HAIKU__
|
||||
charT* grab () { if (selfish) return clone (); atomic_add((volatile __haiku_int32*) &ref, 1); return data (); }
|
||||
void release() { if (atomic_add((__haiku_int32*) &ref, -1) == 1) delete this; }
|
||||
#else
|
||||
charT* grab () { if (selfish) return clone (); ++ref; return data (); }
|
||||
#if defined __i486__ || defined __i586__ || defined __i686__
|
||||
@@ -89,8 +91,8 @@ private:
|
||||
{
|
||||
size_t __val;
|
||||
// This opcode exists as a .byte instead of as a mnemonic for the
|
||||
// benefit of SCO OpenServer 5. The system assembler (which is
|
||||
// essentially required on this target) can't assemble xaddl in
|
||||
// benefit of SCO OpenServer 5. The system assembler (which is
|
||||
// essentially required on this target) can't assemble xaddl in
|
||||
//COFF mode.
|
||||
asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)
|
||||
: "=a" (__val)
|
||||
@@ -119,7 +121,7 @@ private:
|
||||
#else
|
||||
void release () { if (--ref == 0) delete this; }
|
||||
#endif
|
||||
#endif /* __BEOS__ */
|
||||
#endif /* __HAIKU__ */
|
||||
inline static void * operator new (size_t, size_t);
|
||||
inline static void operator delete (void *);
|
||||
inline static Rep* create (size_t);
|
||||
@@ -221,7 +223,7 @@ public:
|
||||
|
||||
void push_back(charT __c)
|
||||
{ append(1, __c); }
|
||||
|
||||
|
||||
basic_string& assign (const basic_string& str, size_type pos = 0,
|
||||
size_type n = npos)
|
||||
{ return replace (0, npos, str, pos, n); }
|
||||
|
||||
Reference in New Issue
Block a user