diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..857d6c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio cache/options directory +.vs/ + +# Visual C++ cache files +ipch/ +xr_build/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ \ No newline at end of file diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Include/Vcl/dstring.h b/CBuilder6_stk_additional/Borland/CBuilder6/Include/Vcl/dstring.h new file mode 100644 index 00000000..d2d64ba1 --- /dev/null +++ b/CBuilder6_stk_additional/Borland/CBuilder6/Include/Vcl/dstring.h @@ -0,0 +1,387 @@ +// DSTRING.H - Support for delphi strings in C++ +// (AnsiString and template SmallString) +// $Revision: 1.35.1.0.1.0 $ +// $Date: 25 Jan 2002 12:54:18 $ +// +// Copyright (c) 1997, 2002 Borland Software Corporation + +#ifndef DSTRING_H +#define DSTRING_H + +#pragma delphiheader begin + +#include +#include + + +namespace System +{ + class TVarRec; + class RTL_DELPHIRETURN Currency; + class RTL_DELPHIRETURN WideString; + + ///////////////////////////////////////////////////////////////////////////// + // AnsiString: String class compatible with Delphi's Native 'string' type + ///////////////////////////////////////////////////////////////////////////// + class RTL_DELPHIRETURN AnsiString + { + friend AnsiString __fastcall operator +(const char*, const AnsiString& rhs); + public: + // the TStringFloatFormat enum is used by FloatToStrF + enum TStringFloatFormat + {sffGeneral, sffExponent, sffFixed, sffNumber, sffCurrency}; + static AnsiString __fastcall StringOfChar(char ch, int count); + static AnsiString __fastcall LoadStr(int ident); + static AnsiString __fastcall LoadStr(HINSTANCE hInstance, int ident); + static AnsiString __fastcall FmtLoadStr(int ident, const TVarRec *args, + int size); + + AnsiString& __fastcall LoadString(HINSTANCE hInstance, int ident); + + // Delphi style 'Format' + // + static AnsiString __fastcall Format(const AnsiString& format, + const TVarRec *args, int size); + + // C style 'sprintf' (NOTE: Target buffer is the string) + // + AnsiString& __cdecl sprintf(const char* format, ...); // Returns *this + int __cdecl printf(const char* format, ...); // Returns formatted length + int __cdecl vprintf(const char* format, va_list); // Returns formatted length + + + // Like above, but appends to the string rather than overwrite + AnsiString& __cdecl cat_sprintf(const char* format, ...); // Returns *this + int __cdecl cat_printf(const char* format, ...); // Returns formatted length + int __cdecl cat_vprintf(const char* format, va_list); // Returns formatted length + + static AnsiString __fastcall FormatFloat(const AnsiString& format, + const long double& value); + static AnsiString __fastcall FloatToStrF(long double value, + TStringFloatFormat format, int precision, int digits); + static AnsiString __fastcall IntToHex(int value, int digits); + static AnsiString __fastcall CurrToStr(Currency value); + static AnsiString __fastcall CurrToStrF(Currency value, + TStringFloatFormat format, int digits); + + // Constructors + __fastcall AnsiString(): Data(0) {} + __fastcall AnsiString(const char* src); + __fastcall AnsiString(const AnsiString& src); +// __fastcall AnsiString(const char* src, unsigned char len); + __fastcall AnsiString(const char* src, unsigned int len); + __fastcall AnsiString(const wchar_t* src); + __fastcall AnsiString(char src); + __fastcall AnsiString(short); + __fastcall AnsiString(unsigned short); + __fastcall AnsiString(int src); + __fastcall AnsiString(unsigned int); + __fastcall AnsiString(long); + __fastcall AnsiString(unsigned long); + __fastcall AnsiString(__int64); + __fastcall AnsiString(unsigned __int64); + __fastcall AnsiString(double src); + __fastcall AnsiString(const WideString &src); + + // Destructor + __fastcall ~AnsiString(); + + // Assignments + AnsiString& __fastcall operator =(const AnsiString& rhs); + AnsiString& __fastcall operator +=(const AnsiString& rhs); + + // Comparisons + bool __fastcall operator ==(const AnsiString& rhs) const; + bool __fastcall operator !=(const AnsiString& rhs) const; + bool __fastcall operator <(const AnsiString& rhs) const; + bool __fastcall operator >(const AnsiString& rhs) const; + bool __fastcall operator <=(const AnsiString& rhs) const; + bool __fastcall operator >=(const AnsiString& rhs) const; + int __fastcall AnsiCompare(const AnsiString& rhs) const; + int __fastcall AnsiCompareIC(const AnsiString& rhs) const; //ignorecase + + // Accessing character at specified index + + char __fastcall operator [](const int idx) const + { + ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ?? + return Data[idx-1]; + } + +#if defined(ANSISTRING_USE_PROXY_FOR_SUBSCRIPT) + + // The use of a proxy class optimizes the case where Unique() must be called + // when accessing the string via the subscript operator. However, the use of + // of the proxy class has some drawbacks. First, it breaks code that apply + // operators to the return value. For example, &MyString[i]. Second, it + // fails in cases where a implicit conversion was relied upon. For example, + // callFuncThatTakesAnObjectWithACharCtr(MyString[i]); + // In that case, two implicit conversions would be required... + // The first issue can be remedied by enhancing the proxy class to support + // all valid operators. The second issue can be lessened but not completely + // eliminated. Hence, the use of the PROXY class is not the default! + // + private: + class TCharProxy; + friend TCharProxy; + class TCharProxy + { + public: + TCharProxy(AnsiString& strRef, int index) : m_Ref(strRef), m_Index(index) {} + TCharProxy& operator=(char c) { m_Ref.Unique(); m_Ref.Data[m_Index-1] = c; return *this; } + operator char() const { return m_Ref.Data[m_Index-1]; } + + protected: + AnsiString& m_Ref; + int m_Index; + }; + + public: + TCharProxy __fastcall operator [](const int idx) + { + ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ?? + return TCharProxy(*this, idx); + } + +#else + + char& __fastcall operator [](const int idx) + { + ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ?? + Unique(); // Ensure we're not ref-counted + return Data[idx-1]; + } + +#endif + + // Concatenation + AnsiString __fastcall operator +(const AnsiString& rhs) const; + + // C string operator + char* __fastcall c_str() const { return (Data)? Data: "";} + + // Read access to raw Data ptr. Will be NULL for an empty string. + const void* __fastcall data() const { return Data; } + + // Query attributes of string + int __fastcall Length() const; + bool __fastcall IsEmpty() const { return Data == NULL; } + + // Make string unique (refcnt == 1) + AnsiString& __fastcall Unique(); + + // Modify string + AnsiString& __fastcall Insert(const AnsiString& str, int index); + AnsiString& __fastcall Delete(int index, int count); + AnsiString& __fastcall SetLength(int newLength); + + int __fastcall Pos(const AnsiString& subStr) const; + AnsiString __fastcall LowerCase() const; + AnsiString __fastcall UpperCase() const; + AnsiString __fastcall Trim() const; + AnsiString __fastcall TrimLeft() const; + AnsiString __fastcall TrimRight() const; + AnsiString __fastcall SubString(int index, int count) const; + + int __fastcall ToInt() const; + int __fastcall ToIntDef(int defaultValue) const; + double __fastcall ToDouble() const; + + // Convert to Unicode + int __fastcall WideCharBufSize() const; + wchar_t* __fastcall WideChar(wchar_t* dest, int destSize) const; + + // MBCS support + enum TStringMbcsByteType + {mbSingleByte, mbLeadByte, mbTrailByte}; + + TStringMbcsByteType __fastcall ByteType(int index) const; + bool __fastcall IsLeadByte(int index) const; + bool __fastcall IsTrailByte(int index) const; + bool __fastcall IsDelimiter(const AnsiString& delimiters, int index) const; + bool __fastcall IsPathDelimiter(int index) const; + int __fastcall LastDelimiter(const AnsiString& delimiters) const; + int __fastcall AnsiPos(const AnsiString& subStr) const; + char* __fastcall AnsiLastChar() const; + + protected: + void __cdecl ThrowIfOutOfRange(int idx) const; +// void ThrowIfOutOfRange(int idx) const; + +// protected: +// void < __cdecl > ThrowIfOutOfRange(int idx) const; + + struct StrRec { + int allocSiz; + int refCnt; + int length; + }; + + const StrRec &GetRec() const; + StrRec &GetRec(); + + private: + // assert(offsetof(AnsiString, Data) == 0); + char *Data; + }; + + extern AnsiString __fastcall operator +(const char*, const AnsiString&); + +#if defined(VCL_IOSTREAM) + // see + ostream& operator << (ostream& os, const AnsiString& arg); + istream& operator >> (istream& is, AnsiString& arg); +#endif + +#if !defined(__CODEGUARD__) + + // Codeguard is not very happy about our "reverse indexing" of the + // Data pointer. We'll address this by violating the ODR: when + // Codeguard compile checks are enabled, these methods will not be + // inlined. When building dstring.cpp, __DSTRING_INLINE will be + // defined to generate out-of-line implementations of these methods. + + #if !defined(__DSTRING_INLINE) + #define __DSTRING_INLINE inline + #endif + + __DSTRING_INLINE const AnsiString::StrRec &AnsiString::GetRec() const + { + return reinterpret_cast(Data)[-1]; + } + + __DSTRING_INLINE AnsiString::StrRec &AnsiString::GetRec() + { + return reinterpret_cast(Data)[-1]; + } + + __DSTRING_INLINE int __fastcall AnsiString::Length() const + { + return (Data)? GetRec().length : 0; + } + +#undef __DSTRING_INLINE +#endif // !defined(__CODEGUARD__) + + ///////////////////////////////////////////////////////////////////////////// + // SmallStringBase + ///////////////////////////////////////////////////////////////////////////// + template class SmallStringBase + { + protected: + unsigned char Len; + char Data[sz]; + }; + + + ///////////////////////////////////////////////////////////////////////////// + // SmallString + ///////////////////////////////////////////////////////////////////////////// + template class SmallString : SmallStringBase + { + + public: + __fastcall SmallString() { Len = 0; } + __fastcall SmallString(const SmallString& src); + __fastcall SmallString(const char* src); + + __fastcall SmallString(const AnsiString& src) + { + long len = src.Length(); + Len = (unsigned char)((len > sz)? sz: len); + strncpy(Data, src.c_str(), Len); + } + + char& __fastcall operator [](const unsigned char idx) + {return Data[idx-1];} + + SmallString& __fastcall operator =(const SmallString& rhs); + + __fastcall operator AnsiString() const; + }; + + // used when SmallStrings are in unions (can't have a ctor) + // must cast DummySmallString to SmallString to do anything useful + + template __fastcall + SmallString::SmallString(const char* src) + { + long len = strlen(src); + Len = (unsigned char)((len > sz)? sz: len); + strncpy(Data, src, Len); + } + + template __fastcall + SmallString::SmallString(const SmallString& src) + { + Len = src.Len; + for (int i = 0; i < Len; i++) + Data[i] = src.Data[i]; + } + + template SmallString& __fastcall + SmallString::operator =(const SmallString& rhs) + { + if (this != &rhs) + { + Len = rhs.Len; + for (int i = 0; i < Len; i++) + Data[i] = rhs.Data[i]; + } + return *this; + } + + template + inline __fastcall SmallString::operator AnsiString() const + { + return AnsiString(Data, Len); + } + +#if defined(VCL_IOSTREAM) + // see sysclass.h + template + ostream& operator <<(ostream& os, const SmallString& arg); + + template + istream& operator >>(istream& is, SmallString& arg); +#endif + +} +using namespace System; + +// The following is provided for backward compatibility. +// Otherwise, the new IntToStr(__int64) causes ambiguity for old code +// that used other integral types. +// +namespace Sysutils +{ + extern PACKAGE AnsiString __fastcall IntToStr(int Value)/* overload */; + extern PACKAGE AnsiString __fastcall IntToStr(__int64 Value)/* overload */; +} + +#pragma option push -w-inl + +inline AnsiString __fastcall IntToStr(bool value) +{ + return Sysutils::IntToStr(int(value)); +} +inline AnsiString __fastcall IntToStr(unsigned int value) +{ + return Sysutils::IntToStr(int(value)); +} +inline AnsiString __fastcall IntToStr(long value) +{ + return Sysutils::IntToStr(int(value)); +} +inline AnsiString __fastcall IntToStr(unsigned long value) +{ + return Sysutils::IntToStr(int(value)); +} + +#pragma option pop + +#pragma delphiheader end. + +#endif // DSTRING_H + + diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.bpl new file mode 100644 index 00000000..e4f4fef4 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.tds new file mode 100644 index 00000000..7c56eac0 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.~bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.~bpl new file mode 100644 index 00000000..0ddf8bac Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/ElPackB6.~bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.bpl new file mode 100644 index 00000000..25958ff1 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.tds new file mode 100644 index 00000000..5438043e Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.~bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.~bpl new file mode 100644 index 00000000..6fe17889 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/bcbshlctrls.~bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclelpB6.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclelpB6.tds new file mode 100644 index 00000000..f7235dd7 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclelpB6.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.bpl new file mode 100644 index 00000000..68c3834b Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.tds new file mode 100644 index 00000000..c5541419 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/dclusr60.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.bpl new file mode 100644 index 00000000..18ddc03f Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.tds new file mode 100644 index 00000000..bc7e50fa Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpkdbB6.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.bpl new file mode 100644 index 00000000..542b647f Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.tds b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.tds new file mode 100644 index 00000000..047c9c60 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.tds differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.~bpl b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.~bpl new file mode 100644 index 00000000..cd09c124 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/Bpl/elpproB6.~bpl differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.bpi new file mode 100644 index 00000000..e287c0b3 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.lib new file mode 100644 index 00000000..bf53ba38 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/ElPackB6.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/FreeImageb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/FreeImageb.lib new file mode 100644 index 00000000..b6b030d4 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/FreeImageb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMb.lib new file mode 100644 index 00000000..c044500f Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMdllb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMdllb.lib new file mode 100644 index 00000000..f7b5eb63 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/MagicFMdllb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/OpenAL32b.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/OpenAL32b.lib new file mode 100644 index 00000000..ee6a7d63 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/OpenAL32b.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/_oggb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/_oggb.lib new file mode 100644 index 00000000..b424e32a Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/_oggb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.bpi new file mode 100644 index 00000000..6970483f Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.lib new file mode 100644 index 00000000..7336899d Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bcbshlctrls.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bugtrapb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bugtrapb.lib new file mode 100644 index 00000000..86954d1e Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/bugtrapb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.bpi new file mode 100644 index 00000000..3e48b900 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.lib new file mode 100644 index 00000000..184ed7ca Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dclusr.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinput8b.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinput8b.lib new file mode 100644 index 00000000..c59caa24 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinput8b.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinputb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinputb.lib new file mode 100644 index 00000000..d58feea3 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dinputb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dsoundb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dsoundb.lib new file mode 100644 index 00000000..74fe47b5 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dsoundb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dxtb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dxtb.lib new file mode 100644 index 00000000..e14df988 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/dxtb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/eaxb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/eaxb.lib new file mode 100644 index 00000000..cc903565 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/eaxb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.bpi new file mode 100644 index 00000000..120f7f00 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.lib new file mode 100644 index 00000000..6d4d52ba Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editor.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.bpi new file mode 100644 index 00000000..b117145c Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.lib new file mode 100644 index 00000000..9f72c774 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/editorB.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.bpi new file mode 100644 index 00000000..d05ee8d8 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.lib new file mode 100644 index 00000000..acbf080c Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpkdbB6.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.bpi b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.bpi new file mode 100644 index 00000000..1fd41628 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.bpi differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.lib new file mode 100644 index 00000000..524ade34 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/elpproB6.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etools.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etools.lib new file mode 100644 index 00000000..e5b19372 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etools.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etoolsb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etoolsb.lib new file mode 100644 index 00000000..e5b19372 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/etoolsb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/lwob.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/lwob.lib new file mode 100644 index 00000000..f3afa112 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/lwob.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/new/oggb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/new/oggb.lib new file mode 100644 index 00000000..3f1f3829 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/new/oggb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/oggb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/oggb.lib new file mode 100644 index 00000000..3f1f3829 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/oggb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/dxtb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/dxtb.lib new file mode 100644 index 00000000..a32244fa Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/dxtb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/eaxb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/eaxb.lib new file mode 100644 index 00000000..e2e5454d Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/eaxb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/lwob.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/lwob.lib new file mode 100644 index 00000000..865d9af8 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/old_working/lwob.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/theorab.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/theorab.lib new file mode 100644 index 00000000..0615eb8a Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/theorab.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/vorbisfileb.lib b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/vorbisfileb.lib new file mode 100644 index 00000000..26be49d7 Binary files /dev/null and b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/LIB/vorbisfileb.lib differ diff --git a/CBuilder6_stk_additional/Borland/CBuilder6/Projects/test.txt b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/test.txt new file mode 100644 index 00000000..2dbdc8d5 --- /dev/null +++ b/CBuilder6_stk_additional/Borland/CBuilder6/Projects/test.txt @@ -0,0 +1,11 @@ +C:\Program Files (x86)\Borland\CBuilder6\Projects;..\..\common\NvMender2003;..\..;..\..\Layers\xrRenderDX9;..\..\Layers\xrRender\blenders; +..\..\Layers\xrRender;..\..\Layers\xrRenderPC_R1;..\..\xrEngine\xrRender_R1;..\..\xrEngine\xrCPU_Pipe;..\..\xrEngine\xrRender;..\..\xrRender_R1; +..\..\xrEngine\blenders;..\..\xrCDB;..\..\xrCPU_Pipe;Engine\Blenders;..\..\xrRender;..\..\xrEngine;$(DXSDK_DIR)\Include;WildMagic;Editor;Engine; +$(BCB)\include;$(BCB)\include\vcl;$(COMPONENTS)\AlexMX;$(COMPONENTS)\ElPack\Code\Source;$(BCB)\Include\Mfc;$(CORE_DIR);..\xrEProps;$(XIPH_DIR); +$(MAGIC_SW_DIR);$(SDK_DIR)\include\freeimage;$(ETOOLS_DIR) + +..\..\common\NvMender2003;..\..;..\..\Layers\xrRenderDX9;..\..\Layers\xrRender\blenders;C:\Program Files (x86)\Borland\CBuilder6\Projects; +..\..\Layers\xrRender;..\..\Layers\xrRenderPC_R1;..\..\xrRender_R1;..\..\xrCPU_Pipe;..\..\xrRender;WildMagic;Editor;Engine\blenders; +..\..\xrEngine\xrRender_R1;..\..\xrEngine\blenders;..\..\xrCDB;..\..\xrEngine\xrCPU_Pipe;..\..\xrEngine\xrRender; +..\..\xrEngine;Engine;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(COMPONENTS)\AlexMX;$(COMPONENTS)\ElPack\Code;$(BCB)\Lib\Psdk; +x:\stalker_addon\libraries;X:\stalker_addon\sources\sdk\components\ElPack\Code\Source \ No newline at end of file diff --git a/CBuilder6_stk_additional/soclibs_backup/ElPackB6.bpi b/CBuilder6_stk_additional/soclibs_backup/ElPackB6.bpi new file mode 100644 index 00000000..e287c0b3 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/ElPackB6.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/ElPackB6.lib b/CBuilder6_stk_additional/soclibs_backup/ElPackB6.lib new file mode 100644 index 00000000..bf53ba38 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/ElPackB6.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/FreeImageb.lib b/CBuilder6_stk_additional/soclibs_backup/FreeImageb.lib new file mode 100644 index 00000000..b6b030d4 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/FreeImageb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/MagicFMdll.lib b/CBuilder6_stk_additional/soclibs_backup/MagicFMdll.lib new file mode 100644 index 00000000..5a14c4bd Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/MagicFMdll.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/OpenAL32b.lib b/CBuilder6_stk_additional/soclibs_backup/OpenAL32b.lib new file mode 100644 index 00000000..ee6a7d63 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/OpenAL32b.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.bpi b/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.bpi new file mode 100644 index 00000000..6970483f Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.lib b/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.lib new file mode 100644 index 00000000..7336899d Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/bcbshlctrls.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/dclusr.bpi b/CBuilder6_stk_additional/soclibs_backup/dclusr.bpi new file mode 100644 index 00000000..3e48b900 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/dclusr.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/dclusr.lib b/CBuilder6_stk_additional/soclibs_backup/dclusr.lib new file mode 100644 index 00000000..184ed7ca Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/dclusr.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/dinputb.lib b/CBuilder6_stk_additional/soclibs_backup/dinputb.lib new file mode 100644 index 00000000..1eb3e9e9 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/dinputb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/dsoundb.lib b/CBuilder6_stk_additional/soclibs_backup/dsoundb.lib new file mode 100644 index 00000000..5ee6428a Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/dsoundb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/eaxb.lib b/CBuilder6_stk_additional/soclibs_backup/eaxb.lib new file mode 100644 index 00000000..e2e5454d Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/eaxb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/editor.bpi b/CBuilder6_stk_additional/soclibs_backup/editor.bpi new file mode 100644 index 00000000..120f7f00 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/editor.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/editor.lib b/CBuilder6_stk_additional/soclibs_backup/editor.lib new file mode 100644 index 00000000..6d4d52ba Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/editor.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/editorB.bpi b/CBuilder6_stk_additional/soclibs_backup/editorB.bpi new file mode 100644 index 00000000..7393ad0d Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/editorB.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/editorB.lib b/CBuilder6_stk_additional/soclibs_backup/editorB.lib new file mode 100644 index 00000000..dcaeecbe Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/editorB.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.bpi b/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.bpi new file mode 100644 index 00000000..d05ee8d8 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.lib b/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.lib new file mode 100644 index 00000000..acbf080c Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/elpkdbB6.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/elpproB6.bpi b/CBuilder6_stk_additional/soclibs_backup/elpproB6.bpi new file mode 100644 index 00000000..1fd41628 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/elpproB6.bpi differ diff --git a/CBuilder6_stk_additional/soclibs_backup/elpproB6.lib b/CBuilder6_stk_additional/soclibs_backup/elpproB6.lib new file mode 100644 index 00000000..524ade34 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/elpproB6.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/etools.lib b/CBuilder6_stk_additional/soclibs_backup/etools.lib new file mode 100644 index 00000000..e5b19372 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/etools.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/magicfmdllb.lib b/CBuilder6_stk_additional/soclibs_backup/magicfmdllb.lib new file mode 100644 index 00000000..35ee1a09 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/magicfmdllb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/oggb.lib b/CBuilder6_stk_additional/soclibs_backup/oggb.lib new file mode 100644 index 00000000..217779ad Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/oggb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/theorab.lib b/CBuilder6_stk_additional/soclibs_backup/theorab.lib new file mode 100644 index 00000000..35ee1a09 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/theorab.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/vorbisfileb.lib b/CBuilder6_stk_additional/soclibs_backup/vorbisfileb.lib new file mode 100644 index 00000000..5bd6f3e5 Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/vorbisfileb.lib differ diff --git a/CBuilder6_stk_additional/soclibs_backup/vorbisfileb_.lib b/CBuilder6_stk_additional/soclibs_backup/vorbisfileb_.lib new file mode 100644 index 00000000..2a4206aa Binary files /dev/null and b/CBuilder6_stk_additional/soclibs_backup/vorbisfileb_.lib differ diff --git a/SDK/boost_1_30_0/boost/function/function_template.hpp b/SDK/boost_1_30_0/boost/function/function_template.hpp index d0e569a9..6680613f 100644 --- a/SDK/boost_1_30_0/boost/function/function_template.hpp +++ b/SDK/boost_1_30_0/boost/function/function_template.hpp @@ -469,7 +469,7 @@ namespace boost { template void assign_to(FunctionObj f, detail::function::function_obj_tag) { - if (!detail::function::has_empty_target(addressof(f))) { + if (!detail::function::has_empty_target(boost::addressof(f))) { typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< FunctionObj, diff --git a/SDK/dxSDK/Include/D3D10.h b/SDK/dxSDK/Include/D3D10.h new file mode 100644 index 00000000..53d30c36 --- /dev/null +++ b/SDK/dxSDK/Include/D3D10.h @@ -0,0 +1,6740 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0499 */ +/* Compiler settings for d3d10.idl: + Oicf, W1, Zp8, env=Win64 (32b run) + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10_h__ +#define __d3d10_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10DeviceChild_FWD_DEFINED__ +#define __ID3D10DeviceChild_FWD_DEFINED__ +typedef interface ID3D10DeviceChild ID3D10DeviceChild; +#endif /* __ID3D10DeviceChild_FWD_DEFINED__ */ + + +#ifndef __ID3D10DepthStencilState_FWD_DEFINED__ +#define __ID3D10DepthStencilState_FWD_DEFINED__ +typedef interface ID3D10DepthStencilState ID3D10DepthStencilState; +#endif /* __ID3D10DepthStencilState_FWD_DEFINED__ */ + + +#ifndef __ID3D10BlendState_FWD_DEFINED__ +#define __ID3D10BlendState_FWD_DEFINED__ +typedef interface ID3D10BlendState ID3D10BlendState; +#endif /* __ID3D10BlendState_FWD_DEFINED__ */ + + +#ifndef __ID3D10RasterizerState_FWD_DEFINED__ +#define __ID3D10RasterizerState_FWD_DEFINED__ +typedef interface ID3D10RasterizerState ID3D10RasterizerState; +#endif /* __ID3D10RasterizerState_FWD_DEFINED__ */ + + +#ifndef __ID3D10Resource_FWD_DEFINED__ +#define __ID3D10Resource_FWD_DEFINED__ +typedef interface ID3D10Resource ID3D10Resource; +#endif /* __ID3D10Resource_FWD_DEFINED__ */ + + +#ifndef __ID3D10Buffer_FWD_DEFINED__ +#define __ID3D10Buffer_FWD_DEFINED__ +typedef interface ID3D10Buffer ID3D10Buffer; +#endif /* __ID3D10Buffer_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture1D_FWD_DEFINED__ +#define __ID3D10Texture1D_FWD_DEFINED__ +typedef interface ID3D10Texture1D ID3D10Texture1D; +#endif /* __ID3D10Texture1D_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture2D_FWD_DEFINED__ +#define __ID3D10Texture2D_FWD_DEFINED__ +typedef interface ID3D10Texture2D ID3D10Texture2D; +#endif /* __ID3D10Texture2D_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture3D_FWD_DEFINED__ +#define __ID3D10Texture3D_FWD_DEFINED__ +typedef interface ID3D10Texture3D ID3D10Texture3D; +#endif /* __ID3D10Texture3D_FWD_DEFINED__ */ + + +#ifndef __ID3D10View_FWD_DEFINED__ +#define __ID3D10View_FWD_DEFINED__ +typedef interface ID3D10View ID3D10View; +#endif /* __ID3D10View_FWD_DEFINED__ */ + + +#ifndef __ID3D10ShaderResourceView_FWD_DEFINED__ +#define __ID3D10ShaderResourceView_FWD_DEFINED__ +typedef interface ID3D10ShaderResourceView ID3D10ShaderResourceView; +#endif /* __ID3D10ShaderResourceView_FWD_DEFINED__ */ + + +#ifndef __ID3D10RenderTargetView_FWD_DEFINED__ +#define __ID3D10RenderTargetView_FWD_DEFINED__ +typedef interface ID3D10RenderTargetView ID3D10RenderTargetView; +#endif /* __ID3D10RenderTargetView_FWD_DEFINED__ */ + + +#ifndef __ID3D10DepthStencilView_FWD_DEFINED__ +#define __ID3D10DepthStencilView_FWD_DEFINED__ +typedef interface ID3D10DepthStencilView ID3D10DepthStencilView; +#endif /* __ID3D10DepthStencilView_FWD_DEFINED__ */ + + +#ifndef __ID3D10VertexShader_FWD_DEFINED__ +#define __ID3D10VertexShader_FWD_DEFINED__ +typedef interface ID3D10VertexShader ID3D10VertexShader; +#endif /* __ID3D10VertexShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10GeometryShader_FWD_DEFINED__ +#define __ID3D10GeometryShader_FWD_DEFINED__ +typedef interface ID3D10GeometryShader ID3D10GeometryShader; +#endif /* __ID3D10GeometryShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10PixelShader_FWD_DEFINED__ +#define __ID3D10PixelShader_FWD_DEFINED__ +typedef interface ID3D10PixelShader ID3D10PixelShader; +#endif /* __ID3D10PixelShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10InputLayout_FWD_DEFINED__ +#define __ID3D10InputLayout_FWD_DEFINED__ +typedef interface ID3D10InputLayout ID3D10InputLayout; +#endif /* __ID3D10InputLayout_FWD_DEFINED__ */ + + +#ifndef __ID3D10SamplerState_FWD_DEFINED__ +#define __ID3D10SamplerState_FWD_DEFINED__ +typedef interface ID3D10SamplerState ID3D10SamplerState; +#endif /* __ID3D10SamplerState_FWD_DEFINED__ */ + + +#ifndef __ID3D10Asynchronous_FWD_DEFINED__ +#define __ID3D10Asynchronous_FWD_DEFINED__ +typedef interface ID3D10Asynchronous ID3D10Asynchronous; +#endif /* __ID3D10Asynchronous_FWD_DEFINED__ */ + + +#ifndef __ID3D10Query_FWD_DEFINED__ +#define __ID3D10Query_FWD_DEFINED__ +typedef interface ID3D10Query ID3D10Query; +#endif /* __ID3D10Query_FWD_DEFINED__ */ + + +#ifndef __ID3D10Predicate_FWD_DEFINED__ +#define __ID3D10Predicate_FWD_DEFINED__ +typedef interface ID3D10Predicate ID3D10Predicate; +#endif /* __ID3D10Predicate_FWD_DEFINED__ */ + + +#ifndef __ID3D10Counter_FWD_DEFINED__ +#define __ID3D10Counter_FWD_DEFINED__ +typedef interface ID3D10Counter ID3D10Counter; +#endif /* __ID3D10Counter_FWD_DEFINED__ */ + + +#ifndef __ID3D10Device_FWD_DEFINED__ +#define __ID3D10Device_FWD_DEFINED__ +typedef interface ID3D10Device ID3D10Device; +#endif /* __ID3D10Device_FWD_DEFINED__ */ + + +#ifndef __ID3D10Multithread_FWD_DEFINED__ +#define __ID3D10Multithread_FWD_DEFINED__ +typedef interface ID3D10Multithread ID3D10Multithread; +#endif /* __ID3D10Multithread_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10_0000_0000 */ +/* [local] */ + +#ifndef _D3D10_CONSTANTS +#define _D3D10_CONSTANTS +#define D3D10_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) + +#define D3D10_32BIT_INDEX_STRIP_CUT_VALUE ( 0xffffffff ) + +#define D3D10_8BIT_INDEX_STRIP_CUT_VALUE ( 0xff ) + +#define D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT ( 9 ) + +#define D3D10_CLIP_OR_CULL_DISTANCE_COUNT ( 8 ) + +#define D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT ( 2 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT ( 14 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT ( 15 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT ( 15 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT ( 64 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT ( 128 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT ( 128 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT ( 16 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT ( 16 ) + +#define D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT ( 32 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COUNT ( 4096 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST ( 3 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS ( 3 ) + +#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX ( 10 ) + +#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN ( -10 ) + +#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE ( -8 ) + +#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE ( 7 ) + +#define D3D10_DEFAULT_BLEND_FACTOR_ALPHA ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_BLUE ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_GREEN ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_RED ( 1.0f ) +#define D3D10_DEFAULT_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D10_DEFAULT_DEPTH_BIAS ( 0 ) + +#define D3D10_DEFAULT_DEPTH_BIAS_CLAMP ( 0.0f ) +#define D3D10_DEFAULT_MAX_ANISOTROPY ( 16.0f ) +#define D3D10_DEFAULT_MIP_LOD_BIAS ( 0.0f ) +#define D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX ( 0 ) + +#define D3D10_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D10_DEFAULT_SCISSOR_ENDX ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_ENDY ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_STARTX ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_STARTY ( 0 ) + +#define D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS ( 0.0f ) +#define D3D10_DEFAULT_STENCIL_READ_MASK ( 0xff ) + +#define D3D10_DEFAULT_STENCIL_REFERENCE ( 0 ) + +#define D3D10_DEFAULT_STENCIL_WRITE_MASK ( 0xff ) + +#define D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_HEIGHT ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_MAX_DEPTH ( 0.0f ) +#define D3D10_DEFAULT_VIEWPORT_MIN_DEPTH ( 0.0f ) +#define D3D10_DEFAULT_VIEWPORT_TOPLEFTX ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_TOPLEFTY ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_WIDTH ( 0 ) + +#define D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D10_FLOAT32_MAX ( 3.402823466e+38f ) +#define D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR ( 2.4f ) +#define D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR ( 1.0f ) +#define D3D10_FLOAT_TO_SRGB_OFFSET ( 0.055f ) +#define D3D10_FLOAT_TO_SRGB_SCALE_1 ( 12.92f ) +#define D3D10_FLOAT_TO_SRGB_SCALE_2 ( 1.055f ) +#define D3D10_FLOAT_TO_SRGB_THRESHOLD ( 0.0031308f ) +#define D3D10_FTOI_INSTRUCTION_MAX_INPUT ( 2147483647.999f ) +#define D3D10_FTOI_INSTRUCTION_MIN_INPUT ( -2147483648.999f ) +#define D3D10_FTOU_INSTRUCTION_MAX_INPUT ( 4294967295.999f ) +#define D3D10_FTOU_INSTRUCTION_MIN_INPUT ( 0.0f ) +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT ( 1 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_GS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_INPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_GS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_GS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_GS_INPUT_REGISTER_VERTICES ( 6 ) + +#define D3D10_GS_OUTPUT_ELEMENTS ( 32 ) + +#define D3D10_GS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY ( 0 ) + +#define D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT ( 1 ) + +#define D3D10_IA_INSTANCE_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT ( 32 ) + +#define D3D10_IA_PRIMITIVE_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_VERTEX_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 16 ) + +#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 64 ) + +#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 16 ) + +#define D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT ( 0xffffffff ) + +#define D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER ( 0xffffffff ) + +#define D3D10_LINEAR_GAMMA ( 1.0f ) +#define D3D10_MAX_BORDER_COLOR_COMPONENT ( 1.0f ) +#define D3D10_MAX_DEPTH ( 1.0f ) +#define D3D10_MAX_MAXANISOTROPY ( 16 ) + +#define D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT ( 32 ) + +#define D3D10_MAX_POSITION_VALUE ( 3.402823466e+34f ) +#define D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) + +#define D3D10_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D10_MIN_DEPTH ( 0.0f ) +#define D3D10_MIN_MAXANISOTROPY ( 0 ) + +#define D3D10_MIP_LOD_BIAS_MAX ( 15.99f ) +#define D3D10_MIP_LOD_BIAS_MIN ( -16.0f ) +#define D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT ( 6 ) + +#define D3D10_MIP_LOD_RANGE_BIT_COUNT ( 8 ) + +#define D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH ( 1.4f ) +#define D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT ( 0 ) + +#define D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 13 ) + +#define D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 ) + +#define D3D10_PS_FRONTFACING_DEFAULT_VALUE ( 0xffffffff ) + +#define D3D10_PS_FRONTFACING_FALSE_VALUE ( 0 ) + +#define D3D10_PS_FRONTFACING_TRUE_VALUE ( 0xffffffff ) + +#define D3D10_PS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_PS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_PS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.0f ) +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT ( 1 ) + +#define D3D10_PS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_OUTPUT_REGISTER_COUNT ( 8 ) + +#define D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) +#define D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) + +#define D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ( 8192 ) + +#define D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT ( 1024 ) + +#define D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D10_REQ_MAXANISOTROPY ( 16 ) + +#define D3D10_REQ_MIP_LEVELS ( 14 ) + +#define D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES ( 2048 ) + +#define D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH ( 8192 ) + +#define D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES ( 128 ) + +#define D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP ( 20 ) + +#define D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION ( 512 ) + +#define D3D10_REQ_TEXTURE1D_U_DIMENSION ( 8192 ) + +#define D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION ( 512 ) + +#define D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION ( 8192 ) + +#define D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ( 2048 ) + +#define D3D10_REQ_TEXTURECUBE_DIMENSION ( 8192 ) + +#define D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL ( 0 ) + +#define D3D10_SHADER_MAJOR_VERSION ( 4 ) + +#define D3D10_SHADER_MINOR_VERSION ( 0 ) + +#define D3D10_SHIFT_INSTRUCTION_PAD_VALUE ( 0 ) + +#define D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT ( 5 ) + +#define D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ( 8 ) + +#define D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) + +#define D3D10_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP ( 0xffffffff ) + +#define D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) + +#define D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) + +#define D3D10_SRGB_GAMMA ( 2.2f ) +#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 ( 12.92f ) +#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 ( 1.055f ) +#define D3D10_SRGB_TO_FLOAT_EXPONENT ( 2.4f ) +#define D3D10_SRGB_TO_FLOAT_OFFSET ( 0.055f ) +#define D3D10_SRGB_TO_FLOAT_THRESHOLD ( 0.04045f ) +#define D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP ( 0.5f ) +#define D3D10_STANDARD_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED ( 64 ) + +#define D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE ( 4 ) + +#define D3D10_STANDARD_PIXEL_COMPONENT_COUNT ( 128 ) + +#define D3D10_STANDARD_PIXEL_ELEMENT_COUNT ( 32 ) + +#define D3D10_STANDARD_VECTOR_SIZE ( 4 ) + +#define D3D10_STANDARD_VERTEX_ELEMENT_COUNT ( 16 ) + +#define D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT ( 64 ) + +#define D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT ( 6 ) + +#define D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT ( 18 ) + +#define D3D10_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) + +#define D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) + +#define D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) + +#define D3D10_VIEWPORT_BOUNDS_MAX ( 16383 ) + +#define D3D10_VIEWPORT_BOUNDS_MIN ( -16384 ) + +#define D3D10_VS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_VS_INPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_VS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_VS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_VS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_VS_OUTPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT ( 10 ) + +#define D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D_MAJOR_VERSION ( 10 ) + +#define D3D_MINOR_VERSION ( 0 ) + +#define D3D_SPEC_DATE_DAY ( 8 ) + +#define D3D_SPEC_DATE_MONTH ( 8 ) + +#define D3D_SPEC_DATE_YEAR ( 2006 ) + +#define D3D_SPEC_VERSION ( 1.050005 ) +#endif +#if !defined( __d3d10_1_h__ ) && !(D3D10_HEADER_MINOR_VERSION >= 1) +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT +#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT +#endif +#define _FACD3D10 ( 0x879 ) + +#define _FACD3D10DEBUG ( ( _FACD3D10 + 1 ) ) + +#define MAKE_D3D10_HRESULT( code ) MAKE_HRESULT( 1, _FACD3D10, code ) +#define MAKE_D3D10_STATUS( code ) MAKE_HRESULT( 0, _FACD3D10, code ) +#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D10_HRESULT(1) +#define D3D10_ERROR_FILE_NOT_FOUND MAKE_D3D10_HRESULT(2) +#if __SAL_H_FULL_VER < 140050727 +#undef __in_range +#undef __in_xcount_opt +#define __in_range(x, y) +#define __in_xcount_opt(x) +#endif +typedef +enum D3D10_INPUT_CLASSIFICATION + { D3D10_INPUT_PER_VERTEX_DATA = 0, + D3D10_INPUT_PER_INSTANCE_DATA = 1 + } D3D10_INPUT_CLASSIFICATION; + +#define D3D10_APPEND_ALIGNED_ELEMENT ( 0xffffffff ) + +typedef struct D3D10_INPUT_ELEMENT_DESC + { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D10_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; + } D3D10_INPUT_ELEMENT_DESC; + +typedef +enum D3D10_FILL_MODE + { D3D10_FILL_WIREFRAME = 2, + D3D10_FILL_SOLID = 3 + } D3D10_FILL_MODE; + +typedef +enum D3D10_PRIMITIVE_TOPOLOGY + { D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = 1, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST = 2, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13 + } D3D10_PRIMITIVE_TOPOLOGY; + +typedef +enum D3D10_PRIMITIVE + { D3D10_PRIMITIVE_UNDEFINED = 0, + D3D10_PRIMITIVE_POINT = 1, + D3D10_PRIMITIVE_LINE = 2, + D3D10_PRIMITIVE_TRIANGLE = 3, + D3D10_PRIMITIVE_LINE_ADJ = 6, + D3D10_PRIMITIVE_TRIANGLE_ADJ = 7 + } D3D10_PRIMITIVE; + +typedef +enum D3D10_CULL_MODE + { D3D10_CULL_NONE = 1, + D3D10_CULL_FRONT = 2, + D3D10_CULL_BACK = 3 + } D3D10_CULL_MODE; + +typedef struct D3D10_SO_DECLARATION_ENTRY + { + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; + } D3D10_SO_DECLARATION_ENTRY; + +typedef struct D3D10_VIEWPORT + { + INT TopLeftX; + INT TopLeftY; + UINT Width; + UINT Height; + FLOAT MinDepth; + FLOAT MaxDepth; + } D3D10_VIEWPORT; + +typedef +enum D3D10_RESOURCE_DIMENSION + { D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D10_RESOURCE_DIMENSION_BUFFER = 1, + D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4 + } D3D10_RESOURCE_DIMENSION; + +typedef +enum D3D10_SRV_DIMENSION + { D3D10_SRV_DIMENSION_UNKNOWN = 0, + D3D10_SRV_DIMENSION_BUFFER = 1, + D3D10_SRV_DIMENSION_TEXTURE1D = 2, + D3D10_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D10_SRV_DIMENSION_TEXTURE2D = 4, + D3D10_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D10_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D10_SRV_DIMENSION_TEXTURE3D = 8, + D3D10_SRV_DIMENSION_TEXTURECUBE = 9 + } D3D10_SRV_DIMENSION; + +typedef +enum D3D10_DSV_DIMENSION + { D3D10_DSV_DIMENSION_UNKNOWN = 0, + D3D10_DSV_DIMENSION_TEXTURE1D = 1, + D3D10_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D10_DSV_DIMENSION_TEXTURE2D = 3, + D3D10_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D10_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY = 6 + } D3D10_DSV_DIMENSION; + +typedef +enum D3D10_RTV_DIMENSION + { D3D10_RTV_DIMENSION_UNKNOWN = 0, + D3D10_RTV_DIMENSION_BUFFER = 1, + D3D10_RTV_DIMENSION_TEXTURE1D = 2, + D3D10_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D10_RTV_DIMENSION_TEXTURE2D = 4, + D3D10_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D10_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D10_RTV_DIMENSION_TEXTURE3D = 8 + } D3D10_RTV_DIMENSION; + +typedef +enum D3D10_USAGE + { D3D10_USAGE_DEFAULT = 0, + D3D10_USAGE_IMMUTABLE = 1, + D3D10_USAGE_DYNAMIC = 2, + D3D10_USAGE_STAGING = 3 + } D3D10_USAGE; + +typedef +enum D3D10_BIND_FLAG + { D3D10_BIND_VERTEX_BUFFER = 0x1L, + D3D10_BIND_INDEX_BUFFER = 0x2L, + D3D10_BIND_CONSTANT_BUFFER = 0x4L, + D3D10_BIND_SHADER_RESOURCE = 0x8L, + D3D10_BIND_STREAM_OUTPUT = 0x10L, + D3D10_BIND_RENDER_TARGET = 0x20L, + D3D10_BIND_DEPTH_STENCIL = 0x40L + } D3D10_BIND_FLAG; + +typedef +enum D3D10_CPU_ACCESS_FLAG + { D3D10_CPU_ACCESS_WRITE = 0x10000L, + D3D10_CPU_ACCESS_READ = 0x20000L + } D3D10_CPU_ACCESS_FLAG; + +typedef +enum D3D10_RESOURCE_MISC_FLAG + { D3D10_RESOURCE_MISC_GENERATE_MIPS = 0x1L, + D3D10_RESOURCE_MISC_SHARED = 0x2L, + D3D10_RESOURCE_MISC_TEXTURECUBE = 0x4L + } D3D10_RESOURCE_MISC_FLAG; + +typedef +enum D3D10_MAP + { D3D10_MAP_READ = 1, + D3D10_MAP_WRITE = 2, + D3D10_MAP_READ_WRITE = 3, + D3D10_MAP_WRITE_DISCARD = 4, + D3D10_MAP_WRITE_NO_OVERWRITE = 5 + } D3D10_MAP; + +typedef +enum D3D10_MAP_FLAG + { D3D10_MAP_FLAG_DO_NOT_WAIT = 0x100000L + } D3D10_MAP_FLAG; + +typedef +enum D3D10_RAISE_FLAG + { D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L + } D3D10_RAISE_FLAG; + +typedef +enum D3D10_CLEAR_FLAG + { D3D10_CLEAR_DEPTH = 0x1L, + D3D10_CLEAR_STENCIL = 0x2L + } D3D10_CLEAR_FLAG; + +typedef RECT D3D10_RECT; + +typedef struct D3D10_BOX + { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; + } D3D10_BOX; + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10DeviceChild_INTERFACE_DEFINED__ +#define __ID3D10DeviceChild_INTERFACE_DEFINED__ + +/* interface ID3D10DeviceChild */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DeviceChild; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C00-342C-4106-A19F-4F2704F689F0") + ID3D10DeviceChild : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE GetDevice( + /* */ + __out ID3D10Device **ppDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DeviceChildVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DeviceChild * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DeviceChild * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DeviceChild * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DeviceChild * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DeviceChild * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DeviceChild * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DeviceChild * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10DeviceChildVtbl; + + interface ID3D10DeviceChild + { + CONST_VTBL struct ID3D10DeviceChildVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DeviceChild_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DeviceChild_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DeviceChild_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DeviceChild_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DeviceChild_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DeviceChild_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0001 */ +/* [local] */ + +typedef +enum D3D10_COMPARISON_FUNC + { D3D10_COMPARISON_NEVER = 1, + D3D10_COMPARISON_LESS = 2, + D3D10_COMPARISON_EQUAL = 3, + D3D10_COMPARISON_LESS_EQUAL = 4, + D3D10_COMPARISON_GREATER = 5, + D3D10_COMPARISON_NOT_EQUAL = 6, + D3D10_COMPARISON_GREATER_EQUAL = 7, + D3D10_COMPARISON_ALWAYS = 8 + } D3D10_COMPARISON_FUNC; + +typedef +enum D3D10_DEPTH_WRITE_MASK + { D3D10_DEPTH_WRITE_MASK_ZERO = 0, + D3D10_DEPTH_WRITE_MASK_ALL = 1 + } D3D10_DEPTH_WRITE_MASK; + +typedef +enum D3D10_STENCIL_OP + { D3D10_STENCIL_OP_KEEP = 1, + D3D10_STENCIL_OP_ZERO = 2, + D3D10_STENCIL_OP_REPLACE = 3, + D3D10_STENCIL_OP_INCR_SAT = 4, + D3D10_STENCIL_OP_DECR_SAT = 5, + D3D10_STENCIL_OP_INVERT = 6, + D3D10_STENCIL_OP_INCR = 7, + D3D10_STENCIL_OP_DECR = 8 + } D3D10_STENCIL_OP; + +typedef struct D3D10_DEPTH_STENCILOP_DESC + { + D3D10_STENCIL_OP StencilFailOp; + D3D10_STENCIL_OP StencilDepthFailOp; + D3D10_STENCIL_OP StencilPassOp; + D3D10_COMPARISON_FUNC StencilFunc; + } D3D10_DEPTH_STENCILOP_DESC; + +typedef struct D3D10_DEPTH_STENCIL_DESC + { + BOOL DepthEnable; + D3D10_DEPTH_WRITE_MASK DepthWriteMask; + D3D10_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D10_DEPTH_STENCILOP_DESC FrontFace; + D3D10_DEPTH_STENCILOP_DESC BackFace; + } D3D10_DEPTH_STENCIL_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D10DepthStencilState_INTERFACE_DEFINED__ +#define __ID3D10DepthStencilState_INTERFACE_DEFINED__ + +/* interface ID3D10DepthStencilState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DepthStencilState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2B4B1CC8-A4AD-41f8-8322-CA86FC3EC675") + ID3D10DepthStencilState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_DEPTH_STENCIL_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DepthStencilStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DepthStencilState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DepthStencilState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DepthStencilState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DepthStencilState * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DepthStencilState * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DepthStencilState * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DepthStencilState * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10DepthStencilState * This, + /* */ + __out D3D10_DEPTH_STENCIL_DESC *pDesc); + + END_INTERFACE + } ID3D10DepthStencilStateVtbl; + + interface ID3D10DepthStencilState + { + CONST_VTBL struct ID3D10DepthStencilStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DepthStencilState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DepthStencilState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DepthStencilState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DepthStencilState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DepthStencilState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DepthStencilState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DepthStencilState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10DepthStencilState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DepthStencilState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_BLEND + { D3D10_BLEND_ZERO = 1, + D3D10_BLEND_ONE = 2, + D3D10_BLEND_SRC_COLOR = 3, + D3D10_BLEND_INV_SRC_COLOR = 4, + D3D10_BLEND_SRC_ALPHA = 5, + D3D10_BLEND_INV_SRC_ALPHA = 6, + D3D10_BLEND_DEST_ALPHA = 7, + D3D10_BLEND_INV_DEST_ALPHA = 8, + D3D10_BLEND_DEST_COLOR = 9, + D3D10_BLEND_INV_DEST_COLOR = 10, + D3D10_BLEND_SRC_ALPHA_SAT = 11, + D3D10_BLEND_BLEND_FACTOR = 14, + D3D10_BLEND_INV_BLEND_FACTOR = 15, + D3D10_BLEND_SRC1_COLOR = 16, + D3D10_BLEND_INV_SRC1_COLOR = 17, + D3D10_BLEND_SRC1_ALPHA = 18, + D3D10_BLEND_INV_SRC1_ALPHA = 19 + } D3D10_BLEND; + +typedef +enum D3D10_BLEND_OP + { D3D10_BLEND_OP_ADD = 1, + D3D10_BLEND_OP_SUBTRACT = 2, + D3D10_BLEND_OP_REV_SUBTRACT = 3, + D3D10_BLEND_OP_MIN = 4, + D3D10_BLEND_OP_MAX = 5 + } D3D10_BLEND_OP; + +typedef +enum D3D10_COLOR_WRITE_ENABLE + { D3D10_COLOR_WRITE_ENABLE_RED = 1, + D3D10_COLOR_WRITE_ENABLE_GREEN = 2, + D3D10_COLOR_WRITE_ENABLE_BLUE = 4, + D3D10_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D10_COLOR_WRITE_ENABLE_ALL = ( ( ( D3D10_COLOR_WRITE_ENABLE_RED | D3D10_COLOR_WRITE_ENABLE_GREEN ) | D3D10_COLOR_WRITE_ENABLE_BLUE ) | D3D10_COLOR_WRITE_ENABLE_ALPHA ) + } D3D10_COLOR_WRITE_ENABLE; + +typedef struct D3D10_BLEND_DESC + { + BOOL AlphaToCoverageEnable; + BOOL BlendEnable[ 8 ]; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask[ 8 ]; + } D3D10_BLEND_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10BlendState_INTERFACE_DEFINED__ +#define __ID3D10BlendState_INTERFACE_DEFINED__ + +/* interface ID3D10BlendState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10BlendState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EDAD8D19-8A35-4d6d-8566-2EA276CDE161") + ID3D10BlendState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_BLEND_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BlendStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10BlendState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10BlendState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10BlendState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10BlendState * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10BlendState * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10BlendState * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10BlendState * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10BlendState * This, + /* */ + __out D3D10_BLEND_DESC *pDesc); + + END_INTERFACE + } ID3D10BlendStateVtbl; + + interface ID3D10BlendState + { + CONST_VTBL struct ID3D10BlendStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10BlendState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10BlendState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10BlendState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10BlendState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10BlendState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10BlendState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10BlendState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10BlendState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10BlendState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0003 */ +/* [local] */ + +typedef struct D3D10_RASTERIZER_DESC + { + D3D10_FILL_MODE FillMode; + D3D10_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + } D3D10_RASTERIZER_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D10RasterizerState_INTERFACE_DEFINED__ +#define __ID3D10RasterizerState_INTERFACE_DEFINED__ + +/* interface ID3D10RasterizerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10RasterizerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A2A07292-89AF-4345-BE2E-C53D9FBB6E9F") + ID3D10RasterizerState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_RASTERIZER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10RasterizerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10RasterizerState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10RasterizerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10RasterizerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10RasterizerState * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10RasterizerState * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10RasterizerState * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10RasterizerState * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10RasterizerState * This, + /* */ + __out D3D10_RASTERIZER_DESC *pDesc); + + END_INTERFACE + } ID3D10RasterizerStateVtbl; + + interface ID3D10RasterizerState + { + CONST_VTBL struct ID3D10RasterizerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10RasterizerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10RasterizerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10RasterizerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10RasterizerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10RasterizerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10RasterizerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10RasterizerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10RasterizerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10RasterizerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0004 */ +/* [local] */ + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +inline UINT D3D10CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels ) +{ return MipSlice + ArraySlice * MipLevels; } +#endif +typedef struct D3D10_SUBRESOURCE_DATA + { + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; + } D3D10_SUBRESOURCE_DATA; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_s_ifspec; + +#ifndef __ID3D10Resource_INTERFACE_DEFINED__ +#define __ID3D10Resource_INTERFACE_DEFINED__ + +/* interface ID3D10Resource */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Resource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C01-342C-4106-A19F-4F2704F689F0") + ID3D10Resource : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetType( + /* */ + __out D3D10_RESOURCE_DIMENSION *rType) = 0; + + virtual void STDMETHODCALLTYPE SetEvictionPriority( + /* */ + __in UINT EvictionPriority) = 0; + + virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ResourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Resource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Resource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Resource * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Resource * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Resource * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Resource * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Resource * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Resource * This, + /* */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Resource * This, + /* */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Resource * This); + + END_INTERFACE + } ID3D10ResourceVtbl; + + interface ID3D10Resource + { + CONST_VTBL struct ID3D10ResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Resource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Resource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Resource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Resource_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Resource_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Resource_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Resource_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Resource_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Resource_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Resource_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Resource_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0005 */ +/* [local] */ + +typedef struct D3D10_BUFFER_DESC + { + UINT ByteWidth; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_BUFFER_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_BUFFER_DESC : public D3D10_BUFFER_DESC +{ + CD3D10_BUFFER_DESC() + {} + explicit CD3D10_BUFFER_DESC( const D3D10_BUFFER_DESC& o ) : + D3D10_BUFFER_DESC( o ) + {} + explicit CD3D10_BUFFER_DESC( + UINT byteWidth, + UINT bindFlags, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0 ) + { + ByteWidth = byteWidth; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags ; + MiscFlags = miscFlags; + } + ~CD3D10_BUFFER_DESC() {} + operator const D3D10_BUFFER_DESC&() const { return *this; } +}; +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_s_ifspec; + +#ifndef __ID3D10Buffer_INTERFACE_DEFINED__ +#define __ID3D10Buffer_INTERFACE_DEFINED__ + +/* interface ID3D10Buffer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Buffer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C02-342C-4106-A19F-4F2704F689F0") + ID3D10Buffer : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out void **ppData) = 0; + + virtual void STDMETHODCALLTYPE Unmap( void) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_BUFFER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BufferVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Buffer * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Buffer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Buffer * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Buffer * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Buffer * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Buffer * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Buffer * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Buffer * This, + /* */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Buffer * This, + /* */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Buffer * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Buffer * This, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out void **ppData); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Buffer * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Buffer * This, + /* */ + __out D3D10_BUFFER_DESC *pDesc); + + END_INTERFACE + } ID3D10BufferVtbl; + + interface ID3D10Buffer + { + CONST_VTBL struct ID3D10BufferVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Buffer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Buffer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Buffer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Buffer_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Buffer_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Buffer_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Buffer_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Buffer_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Buffer_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Buffer_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Buffer_Map(This,MapType,MapFlags,ppData) \ + ( (This)->lpVtbl -> Map(This,MapType,MapFlags,ppData) ) + +#define ID3D10Buffer_Unmap(This) \ + ( (This)->lpVtbl -> Unmap(This) ) + +#define ID3D10Buffer_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Buffer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0006 */ +/* [local] */ + +typedef struct D3D10_TEXTURE1D_DESC + { + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE1D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE1D_DESC : public D3D10_TEXTURE1D_DESC +{ + CD3D10_TEXTURE1D_DESC() + {} + explicit CD3D10_TEXTURE1D_DESC( const D3D10_TEXTURE1D_DESC& o ) : + D3D10_TEXTURE1D_DESC( o ) + {} + explicit CD3D10_TEXTURE1D_DESC( + DXGI_FORMAT format, + UINT width, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags= 0, + UINT miscFlags = 0 ) + { + Width = width; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE1D_DESC() {} + operator const D3D10_TEXTURE1D_DESC&() const { return *this; } +}; +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_s_ifspec; + +#ifndef __ID3D10Texture1D_INTERFACE_DEFINED__ +#define __ID3D10Texture1D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture1D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture1D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C03-342C-4106-A19F-4F2704F689F0") + ID3D10Texture1D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out void **ppData) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_TEXTURE1D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture1DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture1D * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture1D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture1D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture1D * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture1D * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture1D * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture1D * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture1D * This, + /* */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture1D * This, + /* */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture1D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture1D * This, + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out void **ppData); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture1D * This, + /* */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture1D * This, + /* */ + __out D3D10_TEXTURE1D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture1DVtbl; + + interface ID3D10Texture1D + { + CONST_VTBL struct ID3D10Texture1DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture1D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture1D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture1D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture1D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture1D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture1D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture1D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture1D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture1D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture1D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture1D_Map(This,Subresource,MapType,MapFlags,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,ppData) ) + +#define ID3D10Texture1D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture1D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture1D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0007 */ +/* [local] */ + +typedef struct D3D10_TEXTURE2D_DESC + { + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE2D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE2D_DESC : public D3D10_TEXTURE2D_DESC +{ + CD3D10_TEXTURE2D_DESC() + {} + explicit CD3D10_TEXTURE2D_DESC( const D3D10_TEXTURE2D_DESC& o ) : + D3D10_TEXTURE2D_DESC( o ) + {} + explicit CD3D10_TEXTURE2D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE2D_DESC() {} + operator const D3D10_TEXTURE2D_DESC&() const { return *this; } +}; +#endif +typedef struct D3D10_MAPPED_TEXTURE2D + { + void *pData; + UINT RowPitch; + } D3D10_MAPPED_TEXTURE2D; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_s_ifspec; + +#ifndef __ID3D10Texture2D_INTERFACE_DEFINED__ +#define __ID3D10Texture2D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture2D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture2D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C04-342C-4106-A19F-4F2704F689F0") + ID3D10Texture2D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_TEXTURE2D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture2DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture2D * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture2D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture2D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture2D * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture2D * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture2D * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture2D * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture2D * This, + /* */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture2D * This, + /* */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture2D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture2D * This, + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture2D * This, + /* */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture2D * This, + /* */ + __out D3D10_TEXTURE2D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture2DVtbl; + + interface ID3D10Texture2D + { + CONST_VTBL struct ID3D10Texture2DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture2D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture2D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture2D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture2D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture2D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture2D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture2D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture2D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture2D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture2D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture2D_Map(This,Subresource,MapType,MapFlags,pMappedTex2D) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex2D) ) + +#define ID3D10Texture2D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture2D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture2D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0008 */ +/* [local] */ + +typedef struct D3D10_TEXTURE3D_DESC + { + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE3D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE3D_DESC : public D3D10_TEXTURE3D_DESC +{ + CD3D10_TEXTURE3D_DESC() + {} + explicit CD3D10_TEXTURE3D_DESC( const D3D10_TEXTURE3D_DESC& o ) : + D3D10_TEXTURE3D_DESC( o ) + {} + explicit CD3D10_TEXTURE3D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + Depth = depth; + MipLevels = mipLevels; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE3D_DESC() {} + operator const D3D10_TEXTURE3D_DESC&() const { return *this; } +}; +#endif +typedef struct D3D10_MAPPED_TEXTURE3D + { + void *pData; + UINT RowPitch; + UINT DepthPitch; + } D3D10_MAPPED_TEXTURE3D; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_s_ifspec; + +#ifndef __ID3D10Texture3D_INTERFACE_DEFINED__ +#define __ID3D10Texture3D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture3D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture3D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C05-342C-4106-A19F-4F2704F689F0") + ID3D10Texture3D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_TEXTURE3D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture3DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture3D * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture3D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture3D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture3D * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture3D * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture3D * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture3D * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture3D * This, + /* */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture3D * This, + /* */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture3D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture3D * This, + /* */ + __in UINT Subresource, + /* */ + __in D3D10_MAP MapType, + /* */ + __in UINT MapFlags, + /* */ + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture3D * This, + /* */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture3D * This, + /* */ + __out D3D10_TEXTURE3D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture3DVtbl; + + interface ID3D10Texture3D + { + CONST_VTBL struct ID3D10Texture3DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture3D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture3D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture3D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture3D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture3D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture3D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture3D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture3D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture3D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture3D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture3D_Map(This,Subresource,MapType,MapFlags,pMappedTex3D) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex3D) ) + +#define ID3D10Texture3D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture3D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture3D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0009 */ +/* [local] */ + +typedef +enum D3D10_TEXTURECUBE_FACE + { D3D10_TEXTURECUBE_FACE_POSITIVE_X = 0, + D3D10_TEXTURECUBE_FACE_NEGATIVE_X = 1, + D3D10_TEXTURECUBE_FACE_POSITIVE_Y = 2, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Y = 3, + D3D10_TEXTURECUBE_FACE_POSITIVE_Z = 4, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Z = 5 + } D3D10_TEXTURECUBE_FACE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_s_ifspec; + +#ifndef __ID3D10View_INTERFACE_DEFINED__ +#define __ID3D10View_INTERFACE_DEFINED__ + +/* interface ID3D10View */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10View; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C902B03F-60A7-49BA-9936-2A3AB37A7E33") + ID3D10View : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetResource( + /* */ + __out ID3D10Resource **ppResource) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10View * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10View * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10View * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10View * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10View * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10View * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10View * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10View * This, + /* */ + __out ID3D10Resource **ppResource); + + END_INTERFACE + } ID3D10ViewVtbl; + + interface ID3D10View + { + CONST_VTBL struct ID3D10ViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10View_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10View_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10View_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10View_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10View_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10View_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10View_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10View_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10View_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0010 */ +/* [local] */ + +typedef struct D3D10_BUFFER_SRV + { + UINT ElementOffset; + UINT ElementWidth; + } D3D10_BUFFER_SRV; + +typedef struct D3D10_TEX1D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX1D_SRV; + +typedef struct D3D10_TEX1D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_SRV; + +typedef struct D3D10_TEX2D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX2D_SRV; + +typedef struct D3D10_TEX2D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_SRV; + +typedef struct D3D10_TEX3D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX3D_SRV; + +typedef struct D3D10_TEXCUBE_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEXCUBE_SRV; + +typedef struct D3D10_TEX2DMS_SRV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_SRV; + +typedef struct D3D10_TEX2DMS_ARRAY_SRV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_SRV; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION ViewDimension; + union + { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + } ; + } D3D10_SHADER_RESOURCE_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_s_ifspec; + +#ifndef __ID3D10ShaderResourceView_INTERFACE_DEFINED__ +#define __ID3D10ShaderResourceView_INTERFACE_DEFINED__ + +/* interface ID3D10ShaderResourceView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10ShaderResourceView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C07-342C-4106-A19F-4F2704F689F0") + ID3D10ShaderResourceView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ShaderResourceViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10ShaderResourceView * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10ShaderResourceView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10ShaderResourceView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10ShaderResourceView * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10ShaderResourceView * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10ShaderResourceView * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10ShaderResourceView * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10ShaderResourceView * This, + /* */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10ShaderResourceView * This, + /* */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10ShaderResourceViewVtbl; + + interface ID3D10ShaderResourceView + { + CONST_VTBL struct ID3D10ShaderResourceViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10ShaderResourceView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10ShaderResourceView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10ShaderResourceView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10ShaderResourceView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10ShaderResourceView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10ShaderResourceView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10ShaderResourceView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10ShaderResourceView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10ShaderResourceView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10ShaderResourceView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0011 */ +/* [local] */ + +typedef struct D3D10_BUFFER_RTV + { + UINT ElementOffset; + UINT ElementWidth; + } D3D10_BUFFER_RTV; + +typedef struct D3D10_TEX1D_RTV + { + UINT MipSlice; + } D3D10_TEX1D_RTV; + +typedef struct D3D10_TEX1D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_RTV; + +typedef struct D3D10_TEX2D_RTV + { + UINT MipSlice; + } D3D10_TEX2D_RTV; + +typedef struct D3D10_TEX2DMS_RTV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_RTV; + +typedef struct D3D10_TEX2D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_RTV; + +typedef struct D3D10_TEX2DMS_ARRAY_RTV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_RTV; + +typedef struct D3D10_TEX3D_RTV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D10_TEX3D_RTV; + +typedef struct D3D10_RENDER_TARGET_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_RTV_DIMENSION ViewDimension; + union + { + D3D10_BUFFER_RTV Buffer; + D3D10_TEX1D_RTV Texture1D; + D3D10_TEX1D_ARRAY_RTV Texture1DArray; + D3D10_TEX2D_RTV Texture2D; + D3D10_TEX2D_ARRAY_RTV Texture2DArray; + D3D10_TEX2DMS_RTV Texture2DMS; + D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D10_TEX3D_RTV Texture3D; + } ; + } D3D10_RENDER_TARGET_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_s_ifspec; + +#ifndef __ID3D10RenderTargetView_INTERFACE_DEFINED__ +#define __ID3D10RenderTargetView_INTERFACE_DEFINED__ + +/* interface ID3D10RenderTargetView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10RenderTargetView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C08-342C-4106-A19F-4F2704F689F0") + ID3D10RenderTargetView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_RENDER_TARGET_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10RenderTargetViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10RenderTargetView * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10RenderTargetView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10RenderTargetView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10RenderTargetView * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10RenderTargetView * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10RenderTargetView * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10RenderTargetView * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10RenderTargetView * This, + /* */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10RenderTargetView * This, + /* */ + __out D3D10_RENDER_TARGET_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10RenderTargetViewVtbl; + + interface ID3D10RenderTargetView + { + CONST_VTBL struct ID3D10RenderTargetViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10RenderTargetView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10RenderTargetView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10RenderTargetView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10RenderTargetView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10RenderTargetView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10RenderTargetView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10RenderTargetView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10RenderTargetView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10RenderTargetView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10RenderTargetView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0012 */ +/* [local] */ + +typedef struct D3D10_TEX1D_DSV + { + UINT MipSlice; + } D3D10_TEX1D_DSV; + +typedef struct D3D10_TEX1D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_DSV; + +typedef struct D3D10_TEX2D_DSV + { + UINT MipSlice; + } D3D10_TEX2D_DSV; + +typedef struct D3D10_TEX2D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_DSV; + +typedef struct D3D10_TEX2DMS_DSV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_DSV; + +typedef struct D3D10_TEX2DMS_ARRAY_DSV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_DSV; + +typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_DSV_DIMENSION ViewDimension; + union + { + D3D10_TEX1D_DSV Texture1D; + D3D10_TEX1D_ARRAY_DSV Texture1DArray; + D3D10_TEX2D_DSV Texture2D; + D3D10_TEX2D_ARRAY_DSV Texture2DArray; + D3D10_TEX2DMS_DSV Texture2DMS; + D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray; + } ; + } D3D10_DEPTH_STENCIL_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_s_ifspec; + +#ifndef __ID3D10DepthStencilView_INTERFACE_DEFINED__ +#define __ID3D10DepthStencilView_INTERFACE_DEFINED__ + +/* interface ID3D10DepthStencilView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DepthStencilView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C09-342C-4106-A19F-4F2704F689F0") + ID3D10DepthStencilView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DepthStencilViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DepthStencilView * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DepthStencilView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DepthStencilView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DepthStencilView * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DepthStencilView * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DepthStencilView * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DepthStencilView * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10DepthStencilView * This, + /* */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10DepthStencilView * This, + /* */ + __out D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10DepthStencilViewVtbl; + + interface ID3D10DepthStencilView + { + CONST_VTBL struct ID3D10DepthStencilViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DepthStencilView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DepthStencilView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DepthStencilView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DepthStencilView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DepthStencilView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DepthStencilView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DepthStencilView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10DepthStencilView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10DepthStencilView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DepthStencilView_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10VertexShader_INTERFACE_DEFINED__ +#define __ID3D10VertexShader_INTERFACE_DEFINED__ + +/* interface ID3D10VertexShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10VertexShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0A-342C-4106-A19F-4F2704F689F0") + ID3D10VertexShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10VertexShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10VertexShader * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10VertexShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10VertexShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10VertexShader * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10VertexShader * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10VertexShader * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10VertexShader * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10VertexShaderVtbl; + + interface ID3D10VertexShader + { + CONST_VTBL struct ID3D10VertexShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10VertexShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10VertexShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10VertexShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10VertexShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10VertexShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10VertexShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10VertexShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10VertexShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10GeometryShader_INTERFACE_DEFINED__ +#define __ID3D10GeometryShader_INTERFACE_DEFINED__ + +/* interface ID3D10GeometryShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10GeometryShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6316BE88-54CD-4040-AB44-20461BC81F68") + ID3D10GeometryShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10GeometryShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10GeometryShader * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10GeometryShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10GeometryShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10GeometryShader * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10GeometryShader * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10GeometryShader * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10GeometryShader * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10GeometryShaderVtbl; + + interface ID3D10GeometryShader + { + CONST_VTBL struct ID3D10GeometryShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10GeometryShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10GeometryShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10GeometryShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10GeometryShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10GeometryShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10GeometryShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10GeometryShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10GeometryShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10PixelShader_INTERFACE_DEFINED__ +#define __ID3D10PixelShader_INTERFACE_DEFINED__ + +/* interface ID3D10PixelShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10PixelShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4968B601-9D00-4cde-8346-8E7F675819B6") + ID3D10PixelShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10PixelShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10PixelShader * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10PixelShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10PixelShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10PixelShader * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10PixelShader * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10PixelShader * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10PixelShader * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10PixelShaderVtbl; + + interface ID3D10PixelShader + { + CONST_VTBL struct ID3D10PixelShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10PixelShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10PixelShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10PixelShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10PixelShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10PixelShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10PixelShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10PixelShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10PixelShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10InputLayout_INTERFACE_DEFINED__ +#define __ID3D10InputLayout_INTERFACE_DEFINED__ + +/* interface ID3D10InputLayout */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10InputLayout; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0B-342C-4106-A19F-4F2704F689F0") + ID3D10InputLayout : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10InputLayoutVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10InputLayout * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10InputLayout * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10InputLayout * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10InputLayout * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10InputLayout * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10InputLayout * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10InputLayout * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10InputLayoutVtbl; + + interface ID3D10InputLayout + { + CONST_VTBL struct ID3D10InputLayoutVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10InputLayout_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10InputLayout_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10InputLayout_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10InputLayout_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10InputLayout_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10InputLayout_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10InputLayout_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10InputLayout_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0017 */ +/* [local] */ + +typedef +enum D3D10_FILTER + { D3D10_FILTER_MIN_MAG_MIP_POINT = 0, + D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D10_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D10_FILTER_ANISOTROPIC = 0x55, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D10_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D10_FILTER_TEXT_1BIT = 0x80000000 + } D3D10_FILTER; + +typedef +enum D3D10_FILTER_TYPE + { D3D10_FILTER_TYPE_POINT = 0, + D3D10_FILTER_TYPE_LINEAR = 1 + } D3D10_FILTER_TYPE; + +#define D3D10_FILTER_TYPE_MASK ( 0x3 ) + +#define D3D10_MIN_FILTER_SHIFT ( 4 ) + +#define D3D10_MAG_FILTER_SHIFT ( 2 ) + +#define D3D10_MIP_FILTER_SHIFT ( 0 ) + +#define D3D10_COMPARISON_FILTERING_BIT ( 0x80 ) + +#define D3D10_ANISOTROPIC_FILTERING_BIT ( 0x40 ) + +#define D3D10_TEXT_1BIT_BIT ( 0x80000000 ) + +#define D3D10_ENCODE_BASIC_FILTER( min, mag, mip, bComparison ) \ + ( D3D10_FILTER ) ( \ + ( ( bComparison ) ? D3D10_COMPARISON_FILTERING_BIT : 0 ) | \ + ( ( min & D3D10_FILTER_TYPE_MASK ) << D3D10_MIN_FILTER_SHIFT ) | \ + ( ( mag & D3D10_FILTER_TYPE_MASK ) << D3D10_MAG_FILTER_SHIFT ) | \ + ( ( mip & D3D10_FILTER_TYPE_MASK ) << D3D10_MIP_FILTER_SHIFT ) ) +#define D3D10_ENCODE_ANISOTROPIC_FILTER( bComparison ) \ + ( D3D10_FILTER ) ( \ + D3D10_ANISOTROPIC_FILTERING_BIT | \ + D3D10_ENCODE_BASIC_FILTER( D3D10_FILTER_TYPE_LINEAR, \ + D3D10_FILTER_TYPE_LINEAR, \ + D3D10_FILTER_TYPE_LINEAR, \ + bComparison ) ) +#define D3D10_DECODE_MIN_FILTER( d3d10Filter ) \ + (D3D10_FILTER_TYPE) \ + ( ( d3d10Filter >> D3D10_MIN_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) +#define D3D10_DECODE_MAG_FILTER( d3d10Filter ) \ + (D3D10_FILTER_TYPE) \ + ( ( d3d10Filter >> D3D10_MAG_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) +#define D3D10_DECODE_MIP_FILTER( d3d10Filter ) \ + (D3D10_FILTER_TYPE) \ + ( ( d3d10Filter >> D3D10_MIP_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) +#define D3D10_DECODE_IS_COMPARISON_FILTER( d3d10Filter ) \ + ( d3d10Filter & D3D10_COMPARISON_FILTERING_BIT ) +#define D3D10_DECODE_IS_ANISOTROPIC_FILTER( d3d10Filter ) \ + ( ( d3d10Filter & D3D10_ANISOTROPIC_FILTERING_BIT ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIN_FILTER( d3d10Filter ) ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MAG_FILTER( d3d10Filter ) ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIP_FILTER( d3d10Filter ) ) ) +#define D3D10_DECODE_IS_TEXT_1BIT_FILTER( d3d10Filter ) \ + ( d3d10Filter == D3D10_TEXT_1BIT_BIT ) +typedef +enum D3D10_TEXTURE_ADDRESS_MODE + { D3D10_TEXTURE_ADDRESS_WRAP = 1, + D3D10_TEXTURE_ADDRESS_MIRROR = 2, + D3D10_TEXTURE_ADDRESS_CLAMP = 3, + D3D10_TEXTURE_ADDRESS_BORDER = 4, + D3D10_TEXTURE_ADDRESS_MIRROR_ONCE = 5 + } D3D10_TEXTURE_ADDRESS_MODE; + +typedef struct D3D10_SAMPLER_DESC + { + D3D10_FILTER Filter; + D3D10_TEXTURE_ADDRESS_MODE AddressU; + D3D10_TEXTURE_ADDRESS_MODE AddressV; + D3D10_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D10_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[ 4 ]; + FLOAT MinLOD; + FLOAT MaxLOD; + } D3D10_SAMPLER_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_s_ifspec; + +#ifndef __ID3D10SamplerState_INTERFACE_DEFINED__ +#define __ID3D10SamplerState_INTERFACE_DEFINED__ + +/* interface ID3D10SamplerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10SamplerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0C-342C-4106-A19F-4F2704F689F0") + ID3D10SamplerState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_SAMPLER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10SamplerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10SamplerState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10SamplerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10SamplerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10SamplerState * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10SamplerState * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10SamplerState * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10SamplerState * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10SamplerState * This, + /* */ + __out D3D10_SAMPLER_DESC *pDesc); + + END_INTERFACE + } ID3D10SamplerStateVtbl; + + interface ID3D10SamplerState + { + CONST_VTBL struct ID3D10SamplerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10SamplerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10SamplerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10SamplerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10SamplerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10SamplerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10SamplerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10SamplerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10SamplerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10SamplerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0018 */ +/* [local] */ + +typedef +enum D3D10_FORMAT_SUPPORT + { D3D10_FORMAT_SUPPORT_BUFFER = 0x1, + D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D10_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D10_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D10_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D10_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D10_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D10_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D10_FORMAT_SUPPORT_MIP = 0x1000, + D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D10_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D10_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D10_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D10_FORMAT_SUPPORT_SHADER_GATHER = 0x800000 + } D3D10_FORMAT_SUPPORT; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_s_ifspec; + +#ifndef __ID3D10Asynchronous_INTERFACE_DEFINED__ +#define __ID3D10Asynchronous_INTERFACE_DEFINED__ + +/* interface ID3D10Asynchronous */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Asynchronous; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0D-342C-4106-A19F-4F2704F689F0") + ID3D10Asynchronous : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE Begin( void) = 0; + + virtual void STDMETHODCALLTYPE End( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetData( + /* */ + __out_bcount_opt(DataSize) void *pData, + /* */ + __in UINT DataSize, + /* */ + __in UINT GetDataFlags) = 0; + + virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10AsynchronousVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Asynchronous * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Asynchronous * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Asynchronous * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Asynchronous * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Asynchronous * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Asynchronous * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Asynchronous * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Asynchronous * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Asynchronous * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Asynchronous * This, + /* */ + __out_bcount_opt(DataSize) void *pData, + /* */ + __in UINT DataSize, + /* */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Asynchronous * This); + + END_INTERFACE + } ID3D10AsynchronousVtbl; + + interface ID3D10Asynchronous + { + CONST_VTBL struct ID3D10AsynchronousVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Asynchronous_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Asynchronous_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Asynchronous_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Asynchronous_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Asynchronous_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Asynchronous_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Asynchronous_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Asynchronous_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Asynchronous_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Asynchronous_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Asynchronous_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Asynchronous_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0019 */ +/* [local] */ + +typedef +enum D3D10_ASYNC_GETDATA_FLAG + { D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1 + } D3D10_ASYNC_GETDATA_FLAG; + +typedef +enum D3D10_QUERY + { D3D10_QUERY_EVENT = 0, + D3D10_QUERY_OCCLUSION = ( D3D10_QUERY_EVENT + 1 ) , + D3D10_QUERY_TIMESTAMP = ( D3D10_QUERY_OCCLUSION + 1 ) , + D3D10_QUERY_TIMESTAMP_DISJOINT = ( D3D10_QUERY_TIMESTAMP + 1 ) , + D3D10_QUERY_PIPELINE_STATISTICS = ( D3D10_QUERY_TIMESTAMP_DISJOINT + 1 ) , + D3D10_QUERY_OCCLUSION_PREDICATE = ( D3D10_QUERY_PIPELINE_STATISTICS + 1 ) , + D3D10_QUERY_SO_STATISTICS = ( D3D10_QUERY_OCCLUSION_PREDICATE + 1 ) , + D3D10_QUERY_SO_OVERFLOW_PREDICATE = ( D3D10_QUERY_SO_STATISTICS + 1 ) + } D3D10_QUERY; + +typedef +enum D3D10_QUERY_MISC_FLAG + { D3D10_QUERY_MISC_PREDICATEHINT = 0x1 + } D3D10_QUERY_MISC_FLAG; + +typedef struct D3D10_QUERY_DESC + { + D3D10_QUERY Query; + UINT MiscFlags; + } D3D10_QUERY_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_s_ifspec; + +#ifndef __ID3D10Query_INTERFACE_DEFINED__ +#define __ID3D10Query_INTERFACE_DEFINED__ + +/* interface ID3D10Query */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Query; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0E-342C-4106-A19F-4F2704F689F0") + ID3D10Query : public ID3D10Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_QUERY_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10QueryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Query * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Query * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Query * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Query * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Query * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Query * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Query * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Query * This, + /* */ + __out_bcount_opt(DataSize) void *pData, + /* */ + __in UINT DataSize, + /* */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Query * This, + /* */ + __out D3D10_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D10QueryVtbl; + + interface ID3D10Query + { + CONST_VTBL struct ID3D10QueryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Query_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Query_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Query_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Query_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Query_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Query_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Query_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Query_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Query_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Query_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Query_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Query_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Query_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Predicate_INTERFACE_DEFINED__ +#define __ID3D10Predicate_INTERFACE_DEFINED__ + +/* interface ID3D10Predicate */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Predicate; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C10-342C-4106-A19F-4F2704F689F0") + ID3D10Predicate : public ID3D10Query + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10PredicateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Predicate * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Predicate * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Predicate * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Predicate * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Predicate * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Predicate * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Predicate * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Predicate * This, + /* */ + __out_bcount_opt(DataSize) void *pData, + /* */ + __in UINT DataSize, + /* */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Predicate * This, + /* */ + __out D3D10_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D10PredicateVtbl; + + interface ID3D10Predicate + { + CONST_VTBL struct ID3D10PredicateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Predicate_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Predicate_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Predicate_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Predicate_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Predicate_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Predicate_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Predicate_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Predicate_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Predicate_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Predicate_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Predicate_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Predicate_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Predicate_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0021 */ +/* [local] */ + +typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT + { + UINT64 Frequency; + BOOL Disjoint; + } D3D10_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS + { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + } D3D10_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D10_QUERY_DATA_SO_STATISTICS + { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; + } D3D10_QUERY_DATA_SO_STATISTICS; + +typedef +enum D3D10_COUNTER + { D3D10_COUNTER_GPU_IDLE = 0, + D3D10_COUNTER_VERTEX_PROCESSING = ( D3D10_COUNTER_GPU_IDLE + 1 ) , + D3D10_COUNTER_GEOMETRY_PROCESSING = ( D3D10_COUNTER_VERTEX_PROCESSING + 1 ) , + D3D10_COUNTER_PIXEL_PROCESSING = ( D3D10_COUNTER_GEOMETRY_PROCESSING + 1 ) , + D3D10_COUNTER_OTHER_GPU_PROCESSING = ( D3D10_COUNTER_PIXEL_PROCESSING + 1 ) , + D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_OTHER_GPU_PROCESSING + 1 ) , + D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION + 1 ) , + D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION + 1 ) , + D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_VS_MEMORY_LIMITED = ( D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_VS_COMPUTATION_LIMITED = ( D3D10_COUNTER_VS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_GS_MEMORY_LIMITED = ( D3D10_COUNTER_VS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_GS_COMPUTATION_LIMITED = ( D3D10_COUNTER_GS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_PS_MEMORY_LIMITED = ( D3D10_COUNTER_GS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_PS_COMPUTATION_LIMITED = ( D3D10_COUNTER_PS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE = ( D3D10_COUNTER_PS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE = ( D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE + 1 ) , + D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 + } D3D10_COUNTER; + +typedef +enum D3D10_COUNTER_TYPE + { D3D10_COUNTER_TYPE_FLOAT32 = 0, + D3D10_COUNTER_TYPE_UINT16 = ( D3D10_COUNTER_TYPE_FLOAT32 + 1 ) , + D3D10_COUNTER_TYPE_UINT32 = ( D3D10_COUNTER_TYPE_UINT16 + 1 ) , + D3D10_COUNTER_TYPE_UINT64 = ( D3D10_COUNTER_TYPE_UINT32 + 1 ) + } D3D10_COUNTER_TYPE; + +typedef struct D3D10_COUNTER_DESC + { + D3D10_COUNTER Counter; + UINT MiscFlags; + } D3D10_COUNTER_DESC; + +typedef struct D3D10_COUNTER_INFO + { + D3D10_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; + } D3D10_COUNTER_INFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_s_ifspec; + +#ifndef __ID3D10Counter_INTERFACE_DEFINED__ +#define __ID3D10Counter_INTERFACE_DEFINED__ + +/* interface ID3D10Counter */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Counter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C11-342C-4106-A19F-4F2704F689F0") + ID3D10Counter : public ID3D10Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* */ + __out D3D10_COUNTER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10CounterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Counter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Counter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Counter * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Counter * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Counter * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Counter * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Counter * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Counter * This, + /* */ + __out_bcount_opt(DataSize) void *pData, + /* */ + __in UINT DataSize, + /* */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Counter * This, + /* */ + __out D3D10_COUNTER_DESC *pDesc); + + END_INTERFACE + } ID3D10CounterVtbl; + + interface ID3D10Counter + { + CONST_VTBL struct ID3D10CounterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Counter_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Counter_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Counter_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Counter_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Counter_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Counter_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Counter_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Counter_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Counter_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Counter_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Counter_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Counter_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Counter_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Device_INTERFACE_DEFINED__ +#define __ID3D10Device_INTERFACE_DEFINED__ + +/* interface ID3D10Device */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Device; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0F-342C-4106-A19F-4F2704F689F0") + ID3D10Device : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE VSSetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSSetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSSetShader( + /* */ + __in_opt ID3D10PixelShader *pPixelShader) = 0; + + virtual void STDMETHODCALLTYPE PSSetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSSetShader( + /* */ + __in_opt ID3D10VertexShader *pVertexShader) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexed( + /* */ + __in UINT IndexCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation) = 0; + + virtual void STDMETHODCALLTYPE Draw( + /* */ + __in UINT VertexCount, + /* */ + __in UINT StartVertexLocation) = 0; + + virtual void STDMETHODCALLTYPE PSSetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IASetInputLayout( + /* */ + __in_opt ID3D10InputLayout *pInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IASetVertexBuffers( + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* */ + __in_ecount(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IASetIndexBuffer( + /* */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT Offset) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexedInstanced( + /* */ + __in UINT IndexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation, + /* */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE DrawInstanced( + /* */ + __in UINT VertexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartVertexLocation, + /* */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE GSSetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSSetShader( + /* */ + __in_opt ID3D10GeometryShader *pShader) = 0; + + virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( + /* */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology) = 0; + + virtual void STDMETHODCALLTYPE VSSetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSSetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + /* */ + __in_opt ID3D10Predicate *pPredicate, + /* */ + __in BOOL PredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSSetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSSetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMSetRenderTargets( + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* */ + __in_opt ID3D10DepthStencilView *pDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMSetBlendState( + /* */ + __in_opt ID3D10BlendState *pBlendState, + /* */ + __in const FLOAT BlendFactor[ 4 ], + /* */ + __in UINT SampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMSetDepthStencilState( + /* */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* */ + __in UINT StencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOSetTargets( + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE DrawAuto( void) = 0; + + virtual void STDMETHODCALLTYPE RSSetState( + /* */ + __in_opt ID3D10RasterizerState *pRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSSetViewports( + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSSetScissorRects( + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE CopySubresourceRegion( + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in UINT DstX, + /* */ + __in UINT DstY, + /* */ + __in UINT DstZ, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in_opt const D3D10_BOX *pSrcBox) = 0; + + virtual void STDMETHODCALLTYPE CopyResource( + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in ID3D10Resource *pSrcResource) = 0; + + virtual void STDMETHODCALLTYPE UpdateSubresource( + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in_opt const D3D10_BOX *pDstBox, + /* */ + __in const void *pSrcData, + /* */ + __in UINT SrcRowPitch, + /* */ + __in UINT SrcDepthPitch) = 0; + + virtual void STDMETHODCALLTYPE ClearRenderTargetView( + /* */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* */ + __in const FLOAT ColorRGBA[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE ClearDepthStencilView( + /* */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* */ + __in UINT ClearFlags, + /* */ + __in FLOAT Depth, + /* */ + __in UINT8 Stencil) = 0; + + virtual void STDMETHODCALLTYPE GenerateMips( + /* */ + __in ID3D10ShaderResourceView *pShaderResourceView) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresource( + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in DXGI_FORMAT Format) = 0; + + virtual void STDMETHODCALLTYPE VSGetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSGetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSGetShader( + /* */ + __out ID3D10PixelShader **ppPixelShader) = 0; + + virtual void STDMETHODCALLTYPE PSGetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSGetShader( + /* */ + __out ID3D10VertexShader **ppVertexShader) = 0; + + virtual void STDMETHODCALLTYPE PSGetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IAGetInputLayout( + /* */ + __out ID3D10InputLayout **ppInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IAGetVertexBuffers( + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IAGetIndexBuffer( + /* */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* */ + __out_opt DXGI_FORMAT *Format, + /* */ + __out_opt UINT *Offset) = 0; + + virtual void STDMETHODCALLTYPE GSGetConstantBuffers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSGetShader( + /* */ + __out ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( + /* */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology) = 0; + + virtual void STDMETHODCALLTYPE VSGetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSGetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE GetPredication( + /* */ + __out_opt ID3D10Predicate **ppPredicate, + /* */ + __out_opt BOOL *pPredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSGetShaderResources( + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSGetSamplers( + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMGetRenderTargets( + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMGetBlendState( + /* */ + __out_opt ID3D10BlendState **ppBlendState, + /* */ + __out_opt FLOAT BlendFactor[ 4 ], + /* */ + __out_opt UINT *pSampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMGetDepthStencilState( + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* */ + __out_opt UINT *pStencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOGetTargets( + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE RSGetState( + /* */ + __out ID3D10RasterizerState **ppRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSGetViewports( + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* */ + __out_ecount_opt(NumViewports) D3D10_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSGetScissorRects( + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* */ + __out_ecount_opt(NumRects) D3D10_RECT *pRects) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExceptionMode( + UINT RaiseFlags) = 0; + + virtual UINT STDMETHODCALLTYPE GetExceptionMode( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData) = 0; + + virtual void STDMETHODCALLTYPE ClearState( void) = 0; + + virtual void STDMETHODCALLTYPE Flush( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBuffer( + /* */ + __in const D3D10_BUFFER_DESC *pDesc, + /* */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out_opt ID3D10Buffer **ppBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( + /* */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture1D **ppTexture1D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( + /* */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture2D **ppTexture2D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( + /* */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture3D **ppTexture3D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10ShaderResourceView **ppSRView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10RenderTargetView **ppRTView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( + /* */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* */ + __in const void *pShaderBytecodeWithInputSignature, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10InputLayout **ppInputLayout) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVertexShader( + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10VertexShader **ppVertexShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShader( + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* */ + __in UINT OutputStreamStride, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePixelShader( + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10PixelShader **ppPixelShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBlendState( + /* */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* */ + __out_opt ID3D10BlendState **ppBlendState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( + /* */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( + /* */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* */ + __out_opt ID3D10RasterizerState **ppRasterizerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( + /* */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* */ + __out_opt ID3D10SamplerState **ppSamplerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateQuery( + /* */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* */ + __out_opt ID3D10Query **ppQuery) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePredicate( + /* */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* */ + __out_opt ID3D10Predicate **ppPredicate) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCounter( + /* */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* */ + __out_opt ID3D10Counter **ppCounter) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( + /* */ + __in DXGI_FORMAT Format, + /* */ + __out UINT *pFormatSupport) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT SampleCount, + /* */ + __out UINT *pNumQualityLevels) = 0; + + virtual void STDMETHODCALLTYPE CheckCounterInfo( + /* */ + __out D3D10_COUNTER_INFO *pCounterInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckCounter( + /* */ + __in const D3D10_COUNTER_DESC *pDesc, + /* */ + __out D3D10_COUNTER_TYPE *pType, + /* */ + __out UINT *pActiveCounters, + /* */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* */ + __inout_opt UINT *pNameLength, + /* */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* */ + __inout_opt UINT *pUnitsLength, + /* */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* */ + __inout_opt UINT *pDescriptionLength) = 0; + + virtual UINT STDMETHODCALLTYPE GetCreationFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( + /* */ + __in HANDLE hResource, + /* */ + __in REFIID ReturnedInterface, + /* */ + __out_opt void **ppResource) = 0; + + virtual void STDMETHODCALLTYPE SetTextFilterSize( + /* */ + __in UINT Width, + /* */ + __in UINT Height) = 0; + + virtual void STDMETHODCALLTYPE GetTextFilterSize( + /* */ + __out_opt UINT *pWidth, + /* */ + __out_opt UINT *pHeight) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Device * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Device * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D10Device * This, + /* */ + __in_opt ID3D10PixelShader *pPixelShader); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D10Device * This, + /* */ + __in_opt ID3D10VertexShader *pVertexShader); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D10Device * This, + /* */ + __in UINT IndexCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D10Device * This, + /* */ + __in UINT VertexCount, + /* */ + __in UINT StartVertexLocation); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D10Device * This, + /* */ + __in_opt ID3D10InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* */ + __in_ecount(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D10Device * This, + /* */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D10Device * This, + /* */ + __in UINT IndexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation, + /* */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D10Device * This, + /* */ + __in UINT VertexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartVertexLocation, + /* */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D10Device * This, + /* */ + __in_opt ID3D10GeometryShader *pShader); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D10Device * This, + /* */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D10Device * This, + /* */ + __in_opt ID3D10Predicate *pPredicate, + /* */ + __in BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* */ + __in_opt ID3D10DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D10Device * This, + /* */ + __in_opt ID3D10BlendState *pBlendState, + /* */ + __in const FLOAT BlendFactor[ 4 ], + /* */ + __in UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D10Device * This, + /* */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* */ + __in UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D10Device * This, + /* */ + __in_opt ID3D10RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D10Device * This, + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D10Device * This, + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in UINT DstX, + /* */ + __in UINT DstY, + /* */ + __in UINT DstZ, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in_opt const D3D10_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in ID3D10Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in_opt const D3D10_BOX *pDstBox, + /* */ + __in const void *pSrcData, + /* */ + __in UINT SrcRowPitch, + /* */ + __in UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D10Device * This, + /* */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* */ + __in const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D10Device * This, + /* */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* */ + __in UINT ClearFlags, + /* */ + __in FLOAT Depth, + /* */ + __in UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D10Device * This, + /* */ + __in ID3D10ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D10Device * This, + /* */ + __out ID3D10PixelShader **ppPixelShader); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D10Device * This, + /* */ + __out ID3D10VertexShader **ppVertexShader); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D10Device * This, + /* */ + __out ID3D10InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D10Device * This, + /* */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* */ + __out_opt DXGI_FORMAT *Format, + /* */ + __out_opt UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D10Device * This, + /* */ + __out ID3D10GeometryShader **ppGeometryShader); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D10Device * This, + /* */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D10Device * This, + /* */ + __out_opt ID3D10Predicate **ppPredicate, + /* */ + __out_opt BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D10Device * This, + /* */ + __out_opt ID3D10BlendState **ppBlendState, + /* */ + __out_opt FLOAT BlendFactor[ 4 ], + /* */ + __out_opt UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D10Device * This, + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* */ + __out_opt UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D10Device * This, + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D10Device * This, + /* */ + __out ID3D10RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D10Device * This, + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* */ + __out_ecount_opt(NumViewports) D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D10Device * This, + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* */ + __out_ecount_opt(NumRects) D3D10_RECT *pRects); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D10Device * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Device * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Device * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Device * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D10Device * This, + /* */ + __in const D3D10_BUFFER_DESC *pDesc, + /* */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out_opt ID3D10Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D10Device * This, + /* */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D10Device * This, + /* */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D10Device * This, + /* */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D10Device * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D10Device * This, + /* */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* */ + __in const void *pShaderBytecodeWithInputSignature, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D10Device * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D10Device * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D10Device * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* */ + __in UINT OutputStreamStride, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D10Device * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D10Device * This, + /* */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* */ + __out_opt ID3D10BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D10Device * This, + /* */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D10Device * This, + /* */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* */ + __out_opt ID3D10RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D10Device * This, + /* */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* */ + __out_opt ID3D10SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D10Device * This, + /* */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* */ + __out_opt ID3D10Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D10Device * This, + /* */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* */ + __out_opt ID3D10Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D10Device * This, + /* */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* */ + __out_opt ID3D10Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D10Device * This, + /* */ + __in DXGI_FORMAT Format, + /* */ + __out UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D10Device * This, + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT SampleCount, + /* */ + __out UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D10Device * This, + /* */ + __out D3D10_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D10Device * This, + /* */ + __in const D3D10_COUNTER_DESC *pDesc, + /* */ + __out D3D10_COUNTER_TYPE *pType, + /* */ + __out UINT *pActiveCounters, + /* */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* */ + __inout_opt UINT *pNameLength, + /* */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* */ + __inout_opt UINT *pUnitsLength, + /* */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* */ + __inout_opt UINT *pDescriptionLength); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D10Device * This, + /* */ + __in HANDLE hResource, + /* */ + __in REFIID ReturnedInterface, + /* */ + __out_opt void **ppResource); + + void ( STDMETHODCALLTYPE *SetTextFilterSize )( + ID3D10Device * This, + /* */ + __in UINT Width, + /* */ + __in UINT Height); + + void ( STDMETHODCALLTYPE *GetTextFilterSize )( + ID3D10Device * This, + /* */ + __out_opt UINT *pWidth, + /* */ + __out_opt UINT *pHeight); + + END_INTERFACE + } ID3D10DeviceVtbl; + + interface ID3D10Device + { + CONST_VTBL struct ID3D10DeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Device_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Device_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Device_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Device_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_PSSetShader(This,pPixelShader) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) + +#define ID3D10Device_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_VSSetShader(This,pVertexShader) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) + +#define ID3D10Device_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D10Device_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D10Device_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D10Device_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_GSSetShader(This,pShader) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader) ) + +#define ID3D10Device_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D10Device_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D10Device_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D10Device_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D10Device_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D10Device_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D10Device_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D10Device_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D10Device_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D10Device_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D10Device_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D10Device_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D10Device_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D10Device_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D10Device_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_PSGetShader(This,ppPixelShader) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) + +#define ID3D10Device_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_VSGetShader(This,ppVertexShader) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) + +#define ID3D10Device_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D10Device_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_GSGetShader(This,ppGeometryShader) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) + +#define ID3D10Device_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D10Device_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D10Device_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D10Device_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D10Device_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D10Device_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D10Device_RSGetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device_RSGetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D10Device_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D10Device_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + +#define ID3D10Device_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Device_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Device_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D10Device_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D10Device_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D10Device_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D10Device_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D10Device_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D10Device_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D10Device_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D10Device_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D10Device_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D10Device_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) + +#define ID3D10Device_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) + +#define ID3D10Device_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) + +#define ID3D10Device_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) + +#define ID3D10Device_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D10Device_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D10Device_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D10Device_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D10Device_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D10Device_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D10Device_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D10Device_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D10Device_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D10Device_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D10Device_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D10Device_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D10Device_SetTextFilterSize(This,Width,Height) \ + ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) + +#define ID3D10Device_GetTextFilterSize(This,pWidth,pHeight) \ + ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Device_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Multithread_INTERFACE_DEFINED__ +#define __ID3D10Multithread_INTERFACE_DEFINED__ + +/* interface ID3D10Multithread */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Multithread; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E00-342C-4106-A19F-4F2704F689F0") + ID3D10Multithread : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE Enter( void) = 0; + + virtual void STDMETHODCALLTYPE Leave( void) = 0; + + virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected( + /* */ + __in BOOL bMTProtect) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10MultithreadVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Multithread * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Multithread * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Multithread * This); + + void ( STDMETHODCALLTYPE *Enter )( + ID3D10Multithread * This); + + void ( STDMETHODCALLTYPE *Leave )( + ID3D10Multithread * This); + + BOOL ( STDMETHODCALLTYPE *SetMultithreadProtected )( + ID3D10Multithread * This, + /* */ + __in BOOL bMTProtect); + + BOOL ( STDMETHODCALLTYPE *GetMultithreadProtected )( + ID3D10Multithread * This); + + END_INTERFACE + } ID3D10MultithreadVtbl; + + interface ID3D10Multithread + { + CONST_VTBL struct ID3D10MultithreadVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Multithread_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Multithread_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Multithread_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Multithread_Enter(This) \ + ( (This)->lpVtbl -> Enter(This) ) + +#define ID3D10Multithread_Leave(This) \ + ( (This)->lpVtbl -> Leave(This) ) + +#define ID3D10Multithread_SetMultithreadProtected(This,bMTProtect) \ + ( (This)->lpVtbl -> SetMultithreadProtected(This,bMTProtect) ) + +#define ID3D10Multithread_GetMultithreadProtected(This) \ + ( (This)->lpVtbl -> GetMultithreadProtected(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Multithread_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0024 */ +/* [local] */ + +typedef +enum D3D10_CREATE_DEVICE_FLAG + { D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D10_CREATE_DEVICE_DEBUG = 0x2, + D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8 + } D3D10_CREATE_DEVICE_FLAG; + + +#define D3D10_SDK_VERSION ( 29 ) + +#if !defined( D3D10_IGNORE_SDK_LAYERS ) +#include "d3d10sdklayers.h" +#endif +#include "d3d10misc.h" +#include "d3d10shader.h" +#include "d3d10effect.h" +DEFINE_GUID(IID_ID3D10DeviceChild,0x9B7E4C00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10DepthStencilState,0x2B4B1CC8,0xA4AD,0x41f8,0x83,0x22,0xCA,0x86,0xFC,0x3E,0xC6,0x75); +DEFINE_GUID(IID_ID3D10BlendState,0xEDAD8D19,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); +DEFINE_GUID(IID_ID3D10RasterizerState,0xA2A07292,0x89AF,0x4345,0xBE,0x2E,0xC5,0x3D,0x9F,0xBB,0x6E,0x9F); +DEFINE_GUID(IID_ID3D10Resource,0x9B7E4C01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Buffer,0x9B7E4C02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture1D,0x9B7E4C03,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture2D,0x9B7E4C04,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture3D,0x9B7E4C05,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10View,0xC902B03F,0x60A7,0x49BA,0x99,0x36,0x2A,0x3A,0xB3,0x7A,0x7E,0x33); +DEFINE_GUID(IID_ID3D10ShaderResourceView,0x9B7E4C07,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10RenderTargetView,0x9B7E4C08,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10DepthStencilView,0x9B7E4C09,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10VertexShader,0x9B7E4C0A,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10GeometryShader,0x6316BE88,0x54CD,0x4040,0xAB,0x44,0x20,0x46,0x1B,0xC8,0x1F,0x68); +DEFINE_GUID(IID_ID3D10PixelShader,0x4968B601,0x9D00,0x4cde,0x83,0x46,0x8E,0x7F,0x67,0x58,0x19,0xB6); +DEFINE_GUID(IID_ID3D10InputLayout,0x9B7E4C0B,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10SamplerState,0x9B7E4C0C,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Asynchronous,0x9B7E4C0D,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Query,0x9B7E4C0E,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Predicate,0x9B7E4C10,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Counter,0x9B7E4C11,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Device,0x9B7E4C0F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Multithread,0x9B7E4E00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/D3D10_1.h b/SDK/dxSDK/Include/D3D10_1.h new file mode 100644 index 00000000..3d3879c3 --- /dev/null +++ b/SDK/dxSDK/Include/D3D10_1.h @@ -0,0 +1,1793 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0499 */ +/* Compiler settings for d3d10_1.idl: + Oicf, W1, Zp8, env=Win64 (32b run) + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10_1_h__ +#define __d3d10_1_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10BlendState1_FWD_DEFINED__ +#define __ID3D10BlendState1_FWD_DEFINED__ +typedef interface ID3D10BlendState1 ID3D10BlendState1; +#endif /* __ID3D10BlendState1_FWD_DEFINED__ */ + + +#ifndef __ID3D10ShaderResourceView1_FWD_DEFINED__ +#define __ID3D10ShaderResourceView1_FWD_DEFINED__ +typedef interface ID3D10ShaderResourceView1 ID3D10ShaderResourceView1; +#endif /* __ID3D10ShaderResourceView1_FWD_DEFINED__ */ + + +#ifndef __ID3D10Device1_FWD_DEFINED__ +#define __ID3D10Device1_FWD_DEFINED__ +typedef interface ID3D10Device1 ID3D10Device1; +#endif /* __ID3D10Device1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10_1_0000_0000 */ +/* [local] */ + +#if defined( __d3d10_h__ ) && !defined( D3D10_ARBITRARY_HEADER_ORDERING ) +#error d3d10.h is included before d3d10_1.h, and it will confuse tools that honor SAL annotations. \ +If possibly targeting d3d10.1, include d3d10_1.h instead of d3d10.h, or ensure d3d10_1.h is included before d3d10.h +#endif +#ifndef _D3D10_1_CONSTANTS +#define _D3D10_1_CONSTANTS +#define D3D10_1_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D10_1_GS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 32 ) + +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 128 ) + +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 32 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT ( 1 ) + +#define D3D10_1_SHADER_MAJOR_VERSION ( 4 ) + +#define D3D10_1_SHADER_MINOR_VERSION ( 1 ) + +#define D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) + +#define D3D10_1_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) + +#define D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) + +#define D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT ( 32 ) + +#define D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D10_1_VS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_1_VS_OUTPUT_REGISTER_COUNT ( 32 ) + +#endif +#include "d3d10.h" // + +typedef +enum D3D10_FEATURE_LEVEL1 + { D3D10_FEATURE_LEVEL_10_0 = 0xa000, + D3D10_FEATURE_LEVEL_10_1 = 0xa100 + } D3D10_FEATURE_LEVEL1; + +typedef struct D3D10_RENDER_TARGET_BLEND_DESC1 + { + BOOL BlendEnable; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask; + } D3D10_RENDER_TARGET_BLEND_DESC1; + +typedef struct D3D10_BLEND_DESC1 + { + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D10_RENDER_TARGET_BLEND_DESC1 RenderTarget[ 8 ]; + } D3D10_BLEND_DESC1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10BlendState1_INTERFACE_DEFINED__ +#define __ID3D10BlendState1_INTERFACE_DEFINED__ + +/* interface ID3D10BlendState1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10BlendState1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EDAD8D99-8A35-4d6d-8566-2EA276CDE161") + ID3D10BlendState1 : public ID3D10BlendState + { + public: + virtual void STDMETHODCALLTYPE GetDesc1( + /* */ + __out D3D10_BLEND_DESC1 *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BlendState1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10BlendState1 * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10BlendState1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10BlendState1 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10BlendState1 * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10BlendState1 * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10BlendState1 * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10BlendState1 * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10BlendState1 * This, + /* */ + __out D3D10_BLEND_DESC *pDesc); + + void ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D10BlendState1 * This, + /* */ + __out D3D10_BLEND_DESC1 *pDesc); + + END_INTERFACE + } ID3D10BlendState1Vtbl; + + interface ID3D10BlendState1 + { + CONST_VTBL struct ID3D10BlendState1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10BlendState1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10BlendState1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10BlendState1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10BlendState1_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10BlendState1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10BlendState1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10BlendState1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10BlendState1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#define ID3D10BlendState1_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10BlendState1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0001 */ +/* [local] */ + +typedef struct D3D10_TEXCUBE_ARRAY_SRV1 + { + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; + } D3D10_TEXCUBE_ARRAY_SRV1; + +typedef +enum D3D10_SRV_DIMENSION1 + { D3D10_1_SRV_DIMENSION_UNKNOWN = 0, + D3D10_1_SRV_DIMENSION_BUFFER = 1, + D3D10_1_SRV_DIMENSION_TEXTURE1D = 2, + D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D10_1_SRV_DIMENSION_TEXTURE2D = 4, + D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D10_1_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D10_1_SRV_DIMENSION_TEXTURE3D = 8, + D3D10_1_SRV_DIMENSION_TEXTURECUBE = 9, + D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = 10 + } D3D10_SRV_DIMENSION1; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC1 + { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION1 ViewDimension; + union + { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + D3D10_TEXCUBE_ARRAY_SRV1 TextureCubeArray; + } ; + } D3D10_SHADER_RESOURCE_VIEW_DESC1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ +#define __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ + +/* interface ID3D10ShaderResourceView1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10ShaderResourceView1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C87-342C-4106-A19F-4F2704F689F0") + ID3D10ShaderResourceView1 : public ID3D10ShaderResourceView + { + public: + virtual void STDMETHODCALLTYPE GetDesc1( + /* */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ShaderResourceView1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10ShaderResourceView1 * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10ShaderResourceView1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10ShaderResourceView1 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10ShaderResourceView1 * This, + /* */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10ShaderResourceView1 * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10ShaderResourceView1 * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10ShaderResourceView1 * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10ShaderResourceView1 * This, + /* */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10ShaderResourceView1 * This, + /* */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); + + void ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D10ShaderResourceView1 * This, + /* */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc); + + END_INTERFACE + } ID3D10ShaderResourceView1Vtbl; + + interface ID3D10ShaderResourceView1 + { + CONST_VTBL struct ID3D10ShaderResourceView1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10ShaderResourceView1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10ShaderResourceView1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10ShaderResourceView1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10ShaderResourceView1_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10ShaderResourceView1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10ShaderResourceView1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10ShaderResourceView1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10ShaderResourceView1_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10ShaderResourceView1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#define ID3D10ShaderResourceView1_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS + { D3D10_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D10_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe + } D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10Device1_INTERFACE_DEFINED__ +#define __ID3D10Device1_INTERFACE_DEFINED__ + +/* interface ID3D10Device1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Device1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C8F-342C-4106-A19F-4F2704F689F0") + ID3D10Device1 : public ID3D10Device + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + /* */ + __out_opt ID3D10ShaderResourceView1 **ppSRView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( + /* */ + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + /* */ + __out_opt ID3D10BlendState1 **ppBlendState) = 0; + + virtual D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE GetFeatureLevel( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Device1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Device1 * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Device1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10PixelShader *pPixelShader); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10VertexShader *pVertexShader); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D10Device1 * This, + /* */ + __in UINT IndexCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D10Device1 * This, + /* */ + __in UINT VertexCount, + /* */ + __in UINT StartVertexLocation); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* */ + __in_ecount(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D10Device1 * This, + /* */ + __in UINT IndexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartIndexLocation, + /* */ + __in INT BaseVertexLocation, + /* */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D10Device1 * This, + /* */ + __in UINT VertexCountPerInstance, + /* */ + __in UINT InstanceCount, + /* */ + __in UINT StartVertexLocation, + /* */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10GeometryShader *pShader); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D10Device1 * This, + /* */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10Predicate *pPredicate, + /* */ + __in BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* */ + __in_opt ID3D10DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10BlendState *pBlendState, + /* */ + __in const FLOAT BlendFactor[ 4 ], + /* */ + __in UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* */ + __in UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D10Device1 * This, + /* */ + __in_opt ID3D10RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D10Device1 * This, + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D10Device1 * This, + /* */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in UINT DstX, + /* */ + __in UINT DstY, + /* */ + __in UINT DstZ, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in_opt const D3D10_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in ID3D10Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in_opt const D3D10_BOX *pDstBox, + /* */ + __in const void *pSrcData, + /* */ + __in UINT SrcRowPitch, + /* */ + __in UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D10Device1 * This, + /* */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* */ + __in const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D10Device1 * This, + /* */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* */ + __in UINT ClearFlags, + /* */ + __in FLOAT Depth, + /* */ + __in UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D10Device1 * This, + /* */ + __in ID3D10ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pDstResource, + /* */ + __in UINT DstSubresource, + /* */ + __in ID3D10Resource *pSrcResource, + /* */ + __in UINT SrcSubresource, + /* */ + __in DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D10Device1 * This, + /* */ + __out ID3D10PixelShader **ppPixelShader); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D10Device1 * This, + /* */ + __out ID3D10VertexShader **ppVertexShader); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D10Device1 * This, + /* */ + __out ID3D10InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D10Device1 * This, + /* */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* */ + __out_opt DXGI_FORMAT *Format, + /* */ + __out_opt UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D10Device1 * This, + /* */ + __out ID3D10GeometryShader **ppGeometryShader); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D10Device1 * This, + /* */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D10Device1 * This, + /* */ + __out_opt ID3D10Predicate **ppPredicate, + /* */ + __out_opt BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D10Device1 * This, + /* */ + __out_opt ID3D10BlendState **ppBlendState, + /* */ + __out_opt FLOAT BlendFactor[ 4 ], + /* */ + __out_opt UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D10Device1 * This, + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* */ + __out_opt UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D10Device1 * This, + /* */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D10Device1 * This, + /* */ + __out ID3D10RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D10Device1 * This, + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* */ + __out_ecount_opt(NumViewports) D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D10Device1 * This, + /* */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* */ + __out_ecount_opt(NumRects) D3D10_RECT *pRects); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D10Device1 * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Device1 * This, + /* */ + __in REFGUID guid, + /* */ + __inout UINT *pDataSize, + /* */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Device1 * This, + /* */ + __in REFGUID guid, + /* */ + __in UINT DataSize, + /* */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Device1 * This, + /* */ + __in REFGUID guid, + /* */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D10Device1 * This, + /* */ + __in const D3D10_BUFFER_DESC *pDesc, + /* */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out_opt ID3D10Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D10Device1 * This, + /* */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D10Device1 * This, + /* */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D10Device1 * This, + /* */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* */ + __out ID3D10Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D10Device1 * This, + /* */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* */ + __in const void *pShaderBytecodeWithInputSignature, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D10Device1 * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D10Device1 * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D10Device1 * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* */ + __in UINT OutputStreamStride, + /* */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D10Device1 * This, + /* */ + __in const void *pShaderBytecode, + /* */ + __in SIZE_T BytecodeLength, + /* */ + __out_opt ID3D10PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D10Device1 * This, + /* */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* */ + __out_opt ID3D10BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D10Device1 * This, + /* */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D10Device1 * This, + /* */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* */ + __out_opt ID3D10RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D10Device1 * This, + /* */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* */ + __out_opt ID3D10SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D10Device1 * This, + /* */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* */ + __out_opt ID3D10Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D10Device1 * This, + /* */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* */ + __out_opt ID3D10Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D10Device1 * This, + /* */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* */ + __out_opt ID3D10Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D10Device1 * This, + /* */ + __in DXGI_FORMAT Format, + /* */ + __out UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D10Device1 * This, + /* */ + __in DXGI_FORMAT Format, + /* */ + __in UINT SampleCount, + /* */ + __out UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D10Device1 * This, + /* */ + __out D3D10_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D10Device1 * This, + /* */ + __in const D3D10_COUNTER_DESC *pDesc, + /* */ + __out D3D10_COUNTER_TYPE *pType, + /* */ + __out UINT *pActiveCounters, + /* */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* */ + __inout_opt UINT *pNameLength, + /* */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* */ + __inout_opt UINT *pUnitsLength, + /* */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* */ + __inout_opt UINT *pDescriptionLength); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D10Device1 * This, + /* */ + __in HANDLE hResource, + /* */ + __in REFIID ReturnedInterface, + /* */ + __out_opt void **ppResource); + + void ( STDMETHODCALLTYPE *SetTextFilterSize )( + ID3D10Device1 * This, + /* */ + __in UINT Width, + /* */ + __in UINT Height); + + void ( STDMETHODCALLTYPE *GetTextFilterSize )( + ID3D10Device1 * This, + /* */ + __out_opt UINT *pWidth, + /* */ + __out_opt UINT *pHeight); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView1 )( + ID3D10Device1 * This, + /* */ + __in ID3D10Resource *pResource, + /* */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + /* */ + __out_opt ID3D10ShaderResourceView1 **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState1 )( + ID3D10Device1 * This, + /* */ + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + /* */ + __out_opt ID3D10BlendState1 **ppBlendState); + + D3D10_FEATURE_LEVEL1 ( STDMETHODCALLTYPE *GetFeatureLevel )( + ID3D10Device1 * This); + + END_INTERFACE + } ID3D10Device1Vtbl; + + interface ID3D10Device1 + { + CONST_VTBL struct ID3D10Device1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Device1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Device1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Device1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Device1_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_PSSetShader(This,pPixelShader) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) + +#define ID3D10Device1_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_VSSetShader(This,pVertexShader) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) + +#define ID3D10Device1_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D10Device1_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D10Device1_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D10Device1_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device1_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device1_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_GSSetShader(This,pShader) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader) ) + +#define ID3D10Device1_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D10Device1_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D10Device1_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D10Device1_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D10Device1_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D10Device1_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device1_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D10Device1_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D10Device1_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device1_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device1_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D10Device1_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D10Device1_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D10Device1_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D10Device1_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D10Device1_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D10Device1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D10Device1_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_PSGetShader(This,ppPixelShader) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) + +#define ID3D10Device1_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_VSGetShader(This,ppVertexShader) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) + +#define ID3D10Device1_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D10Device1_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device1_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device1_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_GSGetShader(This,ppGeometryShader) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) + +#define ID3D10Device1_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D10Device1_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D10Device1_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D10Device1_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D10Device1_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D10Device1_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device1_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D10Device1_RSGetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device1_RSGetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device1_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D10Device1_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D10Device1_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + +#define ID3D10Device1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Device1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Device1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D10Device1_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D10Device1_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D10Device1_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D10Device1_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D10Device1_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D10Device1_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D10Device1_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device1_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D10Device1_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D10Device1_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D10Device1_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) + +#define ID3D10Device1_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) + +#define ID3D10Device1_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) + +#define ID3D10Device1_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) + +#define ID3D10Device1_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device1_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D10Device1_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D10Device1_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D10Device1_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D10Device1_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D10Device1_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D10Device1_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D10Device1_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D10Device1_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D10Device1_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D10Device1_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D10Device1_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D10Device1_SetTextFilterSize(This,Width,Height) \ + ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) + +#define ID3D10Device1_GetTextFilterSize(This,pWidth,pHeight) \ + ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) + + +#define ID3D10Device1_CreateShaderResourceView1(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView1(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device1_CreateBlendState1(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState1(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device1_GetFeatureLevel(This) \ + ( (This)->lpVtbl -> GetFeatureLevel(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Device1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0003 */ +/* [local] */ + +#define D3D10_1_SDK_VERSION ( ( 0 + 0x20 ) ) + +#include "d3d10_1shader.h" + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDevice1 +// ------------------ +// +// pAdapter +// If NULL, D3D10CreateDevice1 will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice1 will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDeviceAndSwapChain1. +// HardwareLevel +// Any of those documented for D3D10CreateDeviceAndSwapChain1. +// SDKVersion +// SDK version. Use the D3D10_1_SDK_VERSION macro. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice1 +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE1)(IDXGIAdapter *, + D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, ID3D10Device1**); + +HRESULT WINAPI D3D10CreateDevice1( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + D3D10_FEATURE_LEVEL1 HardwareLevel, + UINT SDKVersion, + ID3D10Device1 **ppDevice); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDeviceAndSwapChain1 +// ------------------------------ +// +// ppAdapter +// If NULL, D3D10CreateDevice1 will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice1 will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice1. +// HardwareLevel +// Any of: +// D3D10_CREATE_LEVEL_10_0 +// D3D10_CREATE_LEVEL_10_1 +// SDKVersion +// SDK version. Use the D3D10_1_SDK_VERSION macro. +// pSwapChainDesc +// Swap chain description, may be NULL. +// ppSwapChain +// Pointer to returned interface. May be NULL. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice1 +// IDXGIFactory::CreateSwapChain +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)(IDXGIAdapter *, + D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device1 **); + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + D3D10_FEATURE_LEVEL1 HardwareLevel, + UINT SDKVersion, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device1 **ppDevice); +DEFINE_GUID(IID_ID3D10BlendState1,0xEDAD8D99,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); +DEFINE_GUID(IID_ID3D10ShaderResourceView1,0x9B7E4C87,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Device1,0x9B7E4C8F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/D3D10_1shader.h b/SDK/dxSDK/Include/D3D10_1shader.h new file mode 100644 index 00000000..f07501a5 --- /dev/null +++ b/SDK/dxSDK/Include/D3D10_1shader.h @@ -0,0 +1,299 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10_1Shader.h +// Content: D3D10.1 Shader Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10_1SHADER_H__ +#define __D3D10_1SHADER_H__ + +#include "d3d10shader.h" + +//---------------------------------------------------------------------------- +// Shader debugging structures +//---------------------------------------------------------------------------- + +typedef enum _D3D10_SHADER_DEBUG_REGTYPE +{ + D3D10_SHADER_DEBUG_REG_INPUT, + D3D10_SHADER_DEBUG_REG_OUTPUT, + D3D10_SHADER_DEBUG_REG_CBUFFER, + D3D10_SHADER_DEBUG_REG_TBUFFER, + D3D10_SHADER_DEBUG_REG_TEMP, + D3D10_SHADER_DEBUG_REG_TEMPARRAY, + D3D10_SHADER_DEBUG_REG_TEXTURE, + D3D10_SHADER_DEBUG_REG_SAMPLER, + D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER, + D3D10_SHADER_DEBUG_REG_LITERAL, + D3D10_SHADER_DEBUG_REG_UNUSED, + D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_REGTYPE; + +typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE +{ + D3D10_SHADER_DEBUG_SCOPE_GLOBAL, + D3D10_SHADER_DEBUG_SCOPE_BLOCK, + D3D10_SHADER_DEBUG_SCOPE_FORLOOP, + D3D10_SHADER_DEBUG_SCOPE_STRUCT, + D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS, + D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK, + D3D10_SHADER_DEBUG_SCOPE_NAMESPACE, + D3D10_SHADER_DEBUG_SCOPE_ANNOTATION, + D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_SCOPETYPE; + +typedef enum _D3D10_SHADER_DEBUG_VARTYPE +{ + D3D10_SHADER_DEBUG_VAR_VARIABLE, + D3D10_SHADER_DEBUG_VAR_FUNCTION, + D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_VARTYPE; + +///////////////////////////////////////////////////////////////////// +// These are the serialized structures that get written to the file +///////////////////////////////////////////////////////////////////// + +typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO +{ + UINT File; // offset into file list + UINT Line; // line # + UINT Column; // column # + + UINT TokenLength; + UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore +} D3D10_SHADER_DEBUG_TOKEN_INFO; + +// Variable list +typedef struct _D3D10_SHADER_DEBUG_VAR_INFO +{ + // Index into token list for declaring identifier + UINT TokenId; + D3D10_SHADER_VARIABLE_TYPE Type; + // register and component for this variable, only valid/necessary for arrays + UINT Register; + UINT Component; + // gives the original variable that declared this variable + UINT ScopeVar; + // this variable's offset in its ScopeVar + UINT ScopeVarOffset; +} D3D10_SHADER_DEBUG_VAR_INFO; + +typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO +{ + // index into array of variables of variable to initialize + UINT Var; + // input, cbuffer, tbuffer + D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet; + // set to cbuffer or tbuffer slot, geometry shader input primitive #, + // identifying register for indexable temp, or -1 + UINT InitialBank; + // -1 if temp, otherwise gives register in register set + UINT InitialRegister; + // -1 if temp, otherwise gives component + UINT InitialComponent; + // initial value if literal + UINT InitialValue; +} D3D10_SHADER_DEBUG_INPUT_INFO; + +typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO +{ + // Index into variable token + UINT TokenId; + + D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces) + D3D10_SHADER_VARIABLE_CLASS Class; + UINT Rows; // number of rows (matrices) + UINT Columns; // number of columns (vectors and matrices) + + // In an array of structures, one struct member scope is provided, and + // you'll have to add the array stride times the index to the variable + // index you find, then find that variable in this structure's list of + // variables. + + // gives a scope to look up struct members. -1 if not a struct + UINT StructMemberScope; + + // number of array indices + UINT uArrayIndices; // a[3][2][1] has 3 indices + // maximum array index for each index + // offset to UINT[uArrayIndices] in UINT datastore + UINT ArrayElements; // a[3][2][1] has {3, 2, 1} + // how many variables each array index moves + // offset to UINT[uArrayIndices] in UINT datastore + UINT ArrayStrides; // a[3][2][1] has {2, 1, 1} + + UINT uVariables; + // index of the first variable, later variables are offsets from this one + UINT uFirstVariable; +} D3D10_SHADER_DEBUG_SCOPEVAR_INFO; + +// scope data, this maps variable names to debug variables (useful for the watch window) +typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO +{ + D3D10_SHADER_DEBUG_SCOPETYPE ScopeType; + UINT Name; // offset to name of scope in strings list + UINT uNameLen; // length of name string + UINT uVariables; + UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list +} D3D10_SHADER_DEBUG_SCOPE_INFO; + +// instruction outputs +typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR +{ + // index variable being written to, if -1 it's not going to a variable + UINT Var; + // range data that the compiler expects to be true + UINT uValueMin, uValueMax; + INT iValueMin, iValueMax; + FLOAT fValueMin, fValueMax; + + BOOL bNaNPossible, bInfPossible; +} D3D10_SHADER_DEBUG_OUTPUTVAR; + +typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO +{ + // Only temp, indexable temp, and output are valid here + D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet; + // -1 means no output + UINT OutputReg; + // if a temp array, identifier for which one + UINT TempArrayReg; + // -1 means masked out + UINT OutputComponents[4]; + D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4]; + // when indexing the output, get the value of this register, then add + // that to uOutputReg. If uIndexReg is -1, then there is no index. + // find the variable whose register is the sum (by looking in the ScopeVar) + // and component matches, then set it. This should only happen for indexable + // temps and outputs. + UINT IndexReg; + UINT IndexComp; +} D3D10_SHADER_DEBUG_OUTPUTREG_INFO; + +// per instruction data +typedef struct _D3D10_SHADER_DEBUG_INST_INFO +{ + UINT Id; // Which instruction this is in the bytecode + UINT Opcode; // instruction type + + // 0, 1, or 2 + UINT uOutputs; + + // up to two outputs per instruction + D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2]; + + // index into the list of tokens for this instruction's token + UINT TokenId; + + // how many function calls deep this instruction is + UINT NestingLevel; + + // list of scopes from outer-most to inner-most + // Number of scopes + UINT Scopes; + UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array + + // list of variables accessed by this instruction + // Number of variables + UINT AccessedVars; + UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array +} D3D10_SHADER_DEBUG_INST_INFO; + +typedef struct _D3D10_SHADER_DEBUG_FILE_INFO +{ + UINT FileName; // Offset to LPCSTR for file name + UINT FileNameLen; // Length of file name + UINT FileData; // Offset to LPCSTR of length FileLen + UINT FileLen; // Length of file +} D3D10_SHADER_DEBUG_FILE_INFO; + +typedef struct _D3D10_SHADER_DEBUG_INFO +{ + UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO) + UINT Creator; // Offset to LPCSTR for compiler version + UINT EntrypointName; // Offset to LPCSTR for Entry point name + UINT ShaderTarget; // Offset to LPCSTR for shader target + UINT CompileFlags; // flags used to compile + UINT Files; // number of included files + UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files] + UINT Instructions; // number of instructions + UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions] + UINT Variables; // number of variables + UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables] + UINT InputVariables; // number of variables to initialize before running + UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables] + UINT Tokens; // number of tokens to initialize + UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens] + UINT Scopes; // number of scopes + UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes] + UINT ScopeVariables; // number of variables declared + UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes] + UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset + UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset +} D3D10_SHADER_DEBUG_INFO; + +//---------------------------------------------------------------------------- +// ID3D10ShaderReflection1: +//---------------------------------------------------------------------------- + +// +// Interface definitions +// + +typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1; +typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1; + +// {C3457783-A846-47CE-9520-CEA6F66E7447} +DEFINE_GUID(IID_ID3D10ShaderReflection1, +0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflection1 + +DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetMovInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetMovcInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetConversionInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetBitwiseInstructionCount)(THIS_ UINT* pCount) PURE; + + STDMETHOD(GetGSInputPrimitive)(THIS_ D3D10_PRIMITIVE* pPrim) PURE; + STDMETHOD(IsLevel9Shader)(THIS_ BOOL* pbLevel9Shader) PURE; + STDMETHOD(IsSampleFrequencyShader)(THIS_ BOOL* pbSampleFrequency) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10_1SHADER_H__ + diff --git a/SDK/dxSDK/Include/D3D10effect.h b/SDK/dxSDK/Include/D3D10effect.h new file mode 100644 index 00000000..670b4112 --- /dev/null +++ b/SDK/dxSDK/Include/D3D10effect.h @@ -0,0 +1,1465 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Effect.h +// Content: D3D10 Stateblock/Effect Types & APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10EFFECT_H__ +#define __D3D10EFFECT_H__ + +#include "d3d10.h" + +////////////////////////////////////////////////////////////////////////////// +// File contents: +// +// 1) Stateblock enums, structs, interfaces, flat APIs +// 2) Effect enums, structs, interfaces, flat APIs +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_DEVICE_STATE_TYPES: +// +// Used in ID3D10StateBlockMask function calls +// +//---------------------------------------------------------------------------- + +typedef enum _D3D10_DEVICE_STATE_TYPES +{ + + D3D10_DST_SO_BUFFERS=1, // Single-value state (atomical gets/sets) + D3D10_DST_OM_RENDER_TARGETS, // Single-value state (atomical gets/sets) + D3D10_DST_OM_DEPTH_STENCIL_STATE, // Single-value state + D3D10_DST_OM_BLEND_STATE, // Single-value state + + D3D10_DST_VS, // Single-value state + D3D10_DST_VS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_VS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_VS_CONSTANT_BUFFERS, // Count: + + D3D10_DST_GS, // Single-value state + D3D10_DST_GS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_GS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_GS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + + D3D10_DST_PS, // Single-value state + D3D10_DST_PS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_PS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_PS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + + D3D10_DST_IA_VERTEX_BUFFERS, // Count: D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_IA_INDEX_BUFFER, // Single-value state + D3D10_DST_IA_INPUT_LAYOUT, // Single-value state + D3D10_DST_IA_PRIMITIVE_TOPOLOGY, // Single-value state + + D3D10_DST_RS_VIEWPORTS, // Single-value state (atomical gets/sets) + D3D10_DST_RS_SCISSOR_RECTS, // Single-value state (atomical gets/sets) + D3D10_DST_RS_RASTERIZER_STATE, // Single-value state + + D3D10_DST_PREDICATION, // Single-value state +} D3D10_DEVICE_STATE_TYPES; + +//---------------------------------------------------------------------------- +// D3D10_DEVICE_STATE_TYPES: +// +// Used in ID3D10StateBlockMask function calls +// +//---------------------------------------------------------------------------- + +#ifndef D3D10_BYTES_FROM_BITS +#define D3D10_BYTES_FROM_BITS(x) (((x) + 7) / 8) +#endif // D3D10_BYTES_FROM_BITS + +typedef struct _D3D10_STATE_BLOCK_MASK +{ + BYTE VS; + BYTE VSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE VSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE VSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE GS; + BYTE GSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE GSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE GSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE PS; + BYTE PSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE PSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE PSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE IAVertexBuffers[D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE IAIndexBuffer; + BYTE IAInputLayout; + BYTE IAPrimitiveTopology; + + BYTE OMRenderTargets; + BYTE OMDepthStencilState; + BYTE OMBlendState; + + BYTE RSViewports; + BYTE RSScissorRects; + BYTE RSRasterizerState; + + BYTE SOBuffers; + + BYTE Predication; +} D3D10_STATE_BLOCK_MASK; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10StateBlock ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10StateBlock ID3D10StateBlock; +typedef interface ID3D10StateBlock *LPD3D10STATEBLOCK; + +// {0803425A-57F5-4dd6-9465-A87570834A08} +DEFINE_GUID(IID_ID3D10StateBlock, +0x803425a, 0x57f5, 0x4dd6, 0x94, 0x65, 0xa8, 0x75, 0x70, 0x83, 0x4a, 0x8); + +#undef INTERFACE +#define INTERFACE ID3D10StateBlock + +DECLARE_INTERFACE_(ID3D10StateBlock, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + STDMETHOD(ReleaseAllDeviceObjects)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ ID3D10Device **ppDevice) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10_STATE_BLOCK_MASK and manipulation functions +// ------------------------------------------------- +// +// These functions exist to facilitate working with the D3D10_STATE_BLOCK_MASK +// structure. +// +// D3D10_STATE_BLOCK_MASK *pResult or *pMask +// The state block mask to operate on +// +// D3D10_STATE_BLOCK_MASK *pA, *pB +// The source state block masks for the binary union/intersect/difference +// operations. +// +// D3D10_DEVICE_STATE_TYPES StateType +// The specific state type to enable/disable/query +// +// UINT RangeStart, RangeLength, Entry +// The specific bit or range of bits for a given state type to operate on. +// Consult the comments for D3D10_DEVICE_STATE_TYPES and +// D3D10_STATE_BLOCK_MASK for information on the valid bit ranges for +// each state. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10StateBlockMaskUnion(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskIntersect(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskDifference(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskEnableCapture(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); +HRESULT WINAPI D3D10StateBlockMaskDisableCapture(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); +HRESULT WINAPI D3D10StateBlockMaskEnableAll(D3D10_STATE_BLOCK_MASK *pMask); +HRESULT WINAPI D3D10StateBlockMaskDisableAll(D3D10_STATE_BLOCK_MASK *pMask); +BOOL WINAPI D3D10StateBlockMaskGetSetting(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT Entry); + +//---------------------------------------------------------------------------- +// D3D10CreateStateBlock +// --------------------- +// +// Creates a state block object based on the mask settings specified +// in a D3D10_STATE_BLOCK_MASK structure. +// +// ID3D10Device *pDevice +// The device interface to associate with this state block +// +// D3D10_STATE_BLOCK_MASK *pStateBlockMask +// A bit mask whose settings are used to generate a state block +// object. +// +// ID3D10StateBlock **ppStateBlock +// The resulting state block object. This object will save/restore +// only those pieces of state that were set in the state block +// bit mask +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *pDevice, D3D10_STATE_BLOCK_MASK *pStateBlockMask, ID3D10StateBlock **ppStateBlock); + +#ifdef __cplusplus +} +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10_COMPILE & D3D10_EFFECT flags: +// ------------------------------------- +// +// These flags are passed in when creating an effect, and affect +// either compilation behavior or runtime effect behavior +// +// D3D10_EFFECT_COMPILE_CHILD_EFFECT +// Compile this .fx file to a child effect. Child effects have no initializers +// for any shared values as these are initialied in the master effect (pool). +// +// D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS +// By default, performance mode is enabled. Performance mode disallows +// mutable state objects by preventing non-literal expressions from appearing in +// state object definitions. Specifying this flag will disable the mode and allow +// for mutable state objects. +// +// D3D10_EFFECT_SINGLE_THREADED +// Do not attempt to synchronize with other threads loading effects into the +// same pool. +// +//---------------------------------------------------------------------------- + +#define D3D10_EFFECT_COMPILE_CHILD_EFFECT (1 << 0) +#define D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS (1 << 1) +#define D3D10_EFFECT_SINGLE_THREADED (1 << 3) + + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_VARIABLE flags: +// ---------------------------- +// +// These flags describe an effect variable (global or annotation), +// and are returned in D3D10_EFFECT_VARIABLE_DESC::Flags. +// +// D3D10_EFFECT_VARIABLE_POOLED +// Indicates that the this variable or constant buffer resides +// in an effect pool. If this flag is not set, then the variable resides +// in a standalone effect (if ID3D10Effect::GetPool returns NULL) +// or a child effect (if ID3D10Effect::GetPool returns non-NULL) +// +// D3D10_EFFECT_VARIABLE_ANNOTATION +// Indicates that this is an annotation on a technique, pass, or global +// variable. Otherwise, this is a global variable. Annotations cannot +// be shared. +// +// D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT +// Indicates that the variable has been explicitly bound using the +// register keyword. +//---------------------------------------------------------------------------- + +#define D3D10_EFFECT_VARIABLE_POOLED (1 << 0) +#define D3D10_EFFECT_VARIABLE_ANNOTATION (1 << 1) +#define D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT (1 << 2) + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectType ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_TYPE_DESC: +// +// Retrieved by ID3D10EffectType::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_TYPE_DESC +{ + LPCSTR TypeName; // Name of the type + // (e.g. "float4" or "MyStruct") + + D3D10_SHADER_VARIABLE_CLASS Class; // (e.g. scalar, vector, object, etc.) + D3D10_SHADER_VARIABLE_TYPE Type; // (e.g. float, texture, vertexshader, etc.) + + UINT Elements; // Number of elements in this type + // (0 if not an array) + UINT Members; // Number of members + // (0 if not a structure) + UINT Rows; // Number of rows in this type + // (0 if not a numeric primitive) + UINT Columns; // Number of columns in this type + // (0 if not a numeric primitive) + + UINT PackedSize; // Number of bytes required to represent + // this data type, when tightly packed + UINT UnpackedSize; // Number of bytes occupied by this data + // type, when laid out in a constant buffer + UINT Stride; // Number of bytes to seek between elements, + // when laid out in a constant buffer +} D3D10_EFFECT_TYPE_DESC; + +typedef interface ID3D10EffectType ID3D10EffectType; +typedef interface ID3D10EffectType *LPD3D10EFFECTTYPE; + +// {4E9E1DDC-CD9D-4772-A837-00180B9B88FD} +DEFINE_GUID(IID_ID3D10EffectType, +0x4e9e1ddc, 0xcd9d, 0x4772, 0xa8, 0x37, 0x0, 0x18, 0xb, 0x9b, 0x88, 0xfd); + +#undef INTERFACE +#define INTERFACE ID3D10EffectType + +DECLARE_INTERFACE(ID3D10EffectType) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_TYPE_DESC *pDesc) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeBySemantic)(THIS_ LPCSTR Semantic) PURE; + STDMETHOD_(LPCSTR, GetMemberName)(THIS_ UINT Index) PURE; + STDMETHOD_(LPCSTR, GetMemberSemantic)(THIS_ UINT Index) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectVariable ////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_VARIABLE_DESC: +// +// Retrieved by ID3D10EffectVariable::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_VARIABLE_DESC +{ + LPCSTR Name; // Name of this variable, annotation, + // or structure member + LPCSTR Semantic; // Semantic string of this variable + // or structure member (NULL for + // annotations or if not present) + + UINT Flags; // D3D10_EFFECT_VARIABLE_* flags + UINT Annotations; // Number of annotations on this variable + // (always 0 for annotations) + + UINT BufferOffset; // Offset into containing cbuffer or tbuffer + // (always 0 for annotations or variables + // not in constant buffers) + + UINT ExplicitBindPoint; // Used if the variable has been explicitly bound + // using the register keyword. Check Flags for + // D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT; +} D3D10_EFFECT_VARIABLE_DESC; + +typedef interface ID3D10EffectVariable ID3D10EffectVariable; +typedef interface ID3D10EffectVariable *LPD3D10EFFECTVARIABLE; + +// {AE897105-00E6-45bf-BB8E-281DD6DB8E1B} +DEFINE_GUID(IID_ID3D10EffectVariable, +0xae897105, 0xe6, 0x45bf, 0xbb, 0x8e, 0x28, 0x1d, 0xd6, 0xdb, 0x8e, 0x1b); + +#undef INTERFACE +#define INTERFACE ID3D10EffectVariable + +// Forward defines +typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; +typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; +typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; +typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; +typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; +typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; +typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; +typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; +typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; +typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; +typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; +typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; +typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; + +DECLARE_INTERFACE(ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectScalarVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; +typedef interface ID3D10EffectScalarVariable *LPD3D10EFFECTSCALARVARIABLE; + +// {00E48F7B-D2C8-49e8-A86C-022DEE53431F} +DEFINE_GUID(IID_ID3D10EffectScalarVariable, +0xe48f7b, 0xd2c8, 0x49e8, 0xa8, 0x6c, 0x2, 0x2d, 0xee, 0x53, 0x43, 0x1f); + +#undef INTERFACE +#define INTERFACE ID3D10EffectScalarVariable + +DECLARE_INTERFACE_(ID3D10EffectScalarVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetFloat)(THIS_ float Value) PURE; + STDMETHOD(GetFloat)(THIS_ float *pValue) PURE; + + STDMETHOD(SetFloatArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetInt)(THIS_ int Value) PURE; + STDMETHOD(GetInt)(THIS_ int *pValue) PURE; + + STDMETHOD(SetIntArray)(THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ int *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetBool)(THIS_ BOOL Value) PURE; + STDMETHOD(GetBool)(THIS_ BOOL *pValue) PURE; + + STDMETHOD(SetBoolArray)(THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectVectorVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; +typedef interface ID3D10EffectVectorVariable *LPD3D10EFFECTVECTORVARIABLE; + +// {62B98C44-1F82-4c67-BCD0-72CF8F217E81} +DEFINE_GUID(IID_ID3D10EffectVectorVariable, +0x62b98c44, 0x1f82, 0x4c67, 0xbc, 0xd0, 0x72, 0xcf, 0x8f, 0x21, 0x7e, 0x81); + +#undef INTERFACE +#define INTERFACE ID3D10EffectVectorVariable + +DECLARE_INTERFACE_(ID3D10EffectVectorVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetBoolVector) (THIS_ BOOL *pData) PURE; + STDMETHOD(SetIntVector) (THIS_ int *pData) PURE; + STDMETHOD(SetFloatVector)(THIS_ float *pData) PURE; + + STDMETHOD(GetBoolVector) (THIS_ BOOL *pData) PURE; + STDMETHOD(GetIntVector) (THIS_ int *pData) PURE; + STDMETHOD(GetFloatVector)(THIS_ float *pData) PURE; + + STDMETHOD(SetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(SetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(SetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectMatrixVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; +typedef interface ID3D10EffectMatrixVariable *LPD3D10EFFECTMATRIXVARIABLE; + +// {50666C24-B82F-4eed-A172-5B6E7E8522E0} +DEFINE_GUID(IID_ID3D10EffectMatrixVariable, +0x50666c24, 0xb82f, 0x4eed, 0xa1, 0x72, 0x5b, 0x6e, 0x7e, 0x85, 0x22, 0xe0); + +#undef INTERFACE +#define INTERFACE ID3D10EffectMatrixVariable + +DECLARE_INTERFACE_(ID3D10EffectMatrixVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetMatrix)(THIS_ float *pData) PURE; + STDMETHOD(GetMatrix)(THIS_ float *pData) PURE; + + STDMETHOD(SetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetMatrixTranspose)(THIS_ float *pData) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ float *pData) PURE; + + STDMETHOD(SetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectStringVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; +typedef interface ID3D10EffectStringVariable *LPD3D10EFFECTSTRINGVARIABLE; + +// {71417501-8DF9-4e0a-A78A-255F9756BAFF} +DEFINE_GUID(IID_ID3D10EffectStringVariable, +0x71417501, 0x8df9, 0x4e0a, 0xa7, 0x8a, 0x25, 0x5f, 0x97, 0x56, 0xba, 0xff); + +#undef INTERFACE +#define INTERFACE ID3D10EffectStringVariable + +DECLARE_INTERFACE_(ID3D10EffectStringVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetString)(THIS_ LPCSTR *ppString) PURE; + STDMETHOD(GetStringArray)(THIS_ LPCSTR *ppStrings, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectShaderResourceVariable //////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; +typedef interface ID3D10EffectShaderResourceVariable *LPD3D10EFFECTSHADERRESOURCEVARIABLE; + +// {C0A7157B-D872-4b1d-8073-EFC2ACD4B1FC} +DEFINE_GUID(IID_ID3D10EffectShaderResourceVariable, +0xc0a7157b, 0xd872, 0x4b1d, 0x80, 0x73, 0xef, 0xc2, 0xac, 0xd4, 0xb1, 0xfc); + + +#undef INTERFACE +#define INTERFACE ID3D10EffectShaderResourceVariable + +DECLARE_INTERFACE_(ID3D10EffectShaderResourceVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetResource)(THIS_ ID3D10ShaderResourceView *pResource) PURE; + STDMETHOD(GetResource)(THIS_ ID3D10ShaderResourceView **ppResource) PURE; + + STDMETHOD(SetResourceArray)(THIS_ ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetResourceArray)(THIS_ ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectRenderTargetViewVariable ////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; +typedef interface ID3D10EffectRenderTargetViewVariable *LPD3D10EFFECTRENDERTARGETVIEWVARIABLE; + +// {28CA0CC3-C2C9-40bb-B57F-67B737122B17} +DEFINE_GUID(IID_ID3D10EffectRenderTargetViewVariable, +0x28ca0cc3, 0xc2c9, 0x40bb, 0xb5, 0x7f, 0x67, 0xb7, 0x37, 0x12, 0x2b, 0x17); + +#undef INTERFACE +#define INTERFACE ID3D10EffectRenderTargetViewVariable + +DECLARE_INTERFACE_(ID3D10EffectRenderTargetViewVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetRenderTarget)(THIS_ ID3D10RenderTargetView *pResource) PURE; + STDMETHOD(GetRenderTarget)(THIS_ ID3D10RenderTargetView **ppResource) PURE; + + STDMETHOD(SetRenderTargetArray)(THIS_ ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRenderTargetArray)(THIS_ ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectDepthStencilViewVariable ////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; +typedef interface ID3D10EffectDepthStencilViewVariable *LPD3D10EFFECTDEPTHSTENCILVIEWVARIABLE; + +// {3E02C918-CC79-4985-B622-2D92AD701623} +DEFINE_GUID(IID_ID3D10EffectDepthStencilViewVariable, +0x3e02c918, 0xcc79, 0x4985, 0xb6, 0x22, 0x2d, 0x92, 0xad, 0x70, 0x16, 0x23); + +#undef INTERFACE +#define INTERFACE ID3D10EffectDepthStencilViewVariable + +DECLARE_INTERFACE_(ID3D10EffectDepthStencilViewVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetDepthStencil)(THIS_ ID3D10DepthStencilView *pResource) PURE; + STDMETHOD(GetDepthStencil)(THIS_ ID3D10DepthStencilView **ppResource) PURE; + + STDMETHOD(SetDepthStencilArray)(THIS_ ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetDepthStencilArray)(THIS_ ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectConstantBuffer //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; +typedef interface ID3D10EffectConstantBuffer *LPD3D10EFFECTCONSTANTBUFFER; + +// {56648F4D-CC8B-4444-A5AD-B5A3D76E91B3} +DEFINE_GUID(IID_ID3D10EffectConstantBuffer, +0x56648f4d, 0xcc8b, 0x4444, 0xa5, 0xad, 0xb5, 0xa3, 0xd7, 0x6e, 0x91, 0xb3); + +#undef INTERFACE +#define INTERFACE ID3D10EffectConstantBuffer + +DECLARE_INTERFACE_(ID3D10EffectConstantBuffer, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetConstantBuffer)(THIS_ ID3D10Buffer *pConstantBuffer) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ ID3D10Buffer **ppConstantBuffer) PURE; + + STDMETHOD(SetTextureBuffer)(THIS_ ID3D10ShaderResourceView *pTextureBuffer) PURE; + STDMETHOD(GetTextureBuffer)(THIS_ ID3D10ShaderResourceView **ppTextureBuffer) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectShaderVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_SHADER_DESC: +// +// Retrieved by ID3D10EffectShaderVariable::GetShaderDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_SHADER_DESC +{ + CONST BYTE *pInputSignature; // Passed into CreateInputLayout, + // valid on VS and GS only + + BOOL IsInline; // Is this an anonymous shader variable + // resulting from an inline shader assignment? + + + // -- The following fields are not valid after Optimize() -- + CONST BYTE *pBytecode; // Shader bytecode + UINT BytecodeLength; + + LPCSTR SODecl; // Stream out declaration string (for GS with SO) + + UINT NumInputSignatureEntries; // Number of entries in the input signature + UINT NumOutputSignatureEntries; // Number of entries in the output signature +} D3D10_EFFECT_SHADER_DESC; + + +typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; +typedef interface ID3D10EffectShaderVariable *LPD3D10EFFECTSHADERVARIABLE; + +// {80849279-C799-4797-8C33-0407A07D9E06} +DEFINE_GUID(IID_ID3D10EffectShaderVariable, +0x80849279, 0xc799, 0x4797, 0x8c, 0x33, 0x4, 0x7, 0xa0, 0x7d, 0x9e, 0x6); + +#undef INTERFACE +#define INTERFACE ID3D10EffectShaderVariable + +DECLARE_INTERFACE_(ID3D10EffectShaderVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetShaderDesc)(THIS_ UINT ShaderIndex, D3D10_EFFECT_SHADER_DESC *pDesc) PURE; + + STDMETHOD(GetVertexShader)(THIS_ UINT ShaderIndex, ID3D10VertexShader **ppVS) PURE; + STDMETHOD(GetGeometryShader)(THIS_ UINT ShaderIndex, ID3D10GeometryShader **ppGS) PURE; + STDMETHOD(GetPixelShader)(THIS_ UINT ShaderIndex, ID3D10PixelShader **ppPS) PURE; + + STDMETHOD(GetInputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectBlendVariable ///////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; +typedef interface ID3D10EffectBlendVariable *LPD3D10EFFECTBLENDVARIABLE; + +// {1FCD2294-DF6D-4eae-86B3-0E9160CFB07B} +DEFINE_GUID(IID_ID3D10EffectBlendVariable, +0x1fcd2294, 0xdf6d, 0x4eae, 0x86, 0xb3, 0xe, 0x91, 0x60, 0xcf, 0xb0, 0x7b); + +#undef INTERFACE +#define INTERFACE ID3D10EffectBlendVariable + +DECLARE_INTERFACE_(ID3D10EffectBlendVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetBlendState)(THIS_ UINT Index, ID3D10BlendState **ppBlendState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_BLEND_DESC *pBlendDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectDepthStencilVariable ////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; +typedef interface ID3D10EffectDepthStencilVariable *LPD3D10EFFECTDEPTHSTENCILVARIABLE; + +// {AF482368-330A-46a5-9A5C-01C71AF24C8D} +DEFINE_GUID(IID_ID3D10EffectDepthStencilVariable, +0xaf482368, 0x330a, 0x46a5, 0x9a, 0x5c, 0x1, 0xc7, 0x1a, 0xf2, 0x4c, 0x8d); + +#undef INTERFACE +#define INTERFACE ID3D10EffectDepthStencilVariable + +DECLARE_INTERFACE_(ID3D10EffectDepthStencilVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetDepthStencilState)(THIS_ UINT Index, ID3D10DepthStencilState **ppDepthStencilState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectRasterizerVariable //////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; +typedef interface ID3D10EffectRasterizerVariable *LPD3D10EFFECTRASTERIZERVARIABLE; + +// {21AF9F0E-4D94-4ea9-9785-2CB76B8C0B34} +DEFINE_GUID(IID_ID3D10EffectRasterizerVariable, +0x21af9f0e, 0x4d94, 0x4ea9, 0x97, 0x85, 0x2c, 0xb7, 0x6b, 0x8c, 0xb, 0x34); + +#undef INTERFACE +#define INTERFACE ID3D10EffectRasterizerVariable + +DECLARE_INTERFACE_(ID3D10EffectRasterizerVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetRasterizerState)(THIS_ UINT Index, ID3D10RasterizerState **ppRasterizerState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_RASTERIZER_DESC *pRasterizerDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectSamplerVariable /////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; +typedef interface ID3D10EffectSamplerVariable *LPD3D10EFFECTSAMPLERVARIABLE; + +// {6530D5C7-07E9-4271-A418-E7CE4BD1E480} +DEFINE_GUID(IID_ID3D10EffectSamplerVariable, +0x6530d5c7, 0x7e9, 0x4271, 0xa4, 0x18, 0xe7, 0xce, 0x4b, 0xd1, 0xe4, 0x80); + +#undef INTERFACE +#define INTERFACE ID3D10EffectSamplerVariable + +DECLARE_INTERFACE_(ID3D10EffectSamplerVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetSampler)(THIS_ UINT Index, ID3D10SamplerState **ppSampler) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_SAMPLER_DESC *pSamplerDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectPass ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_PASS_DESC: +// +// Retrieved by ID3D10EffectPass::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_PASS_DESC +{ + LPCSTR Name; // Name of this pass (NULL if not anonymous) + UINT Annotations; // Number of annotations on this pass + + BYTE *pIAInputSignature; // Signature from VS or GS (if there is no VS) + // or NULL if neither exists + SIZE_T IAInputSignatureSize; // Singature size in bytes + + UINT StencilRef; // Specified in SetDepthStencilState() + UINT SampleMask; // Specified in SetBlendState() + FLOAT BlendFactor[4]; // Specified in SetBlendState() +} D3D10_PASS_DESC; + +//---------------------------------------------------------------------------- +// D3D10_PASS_SHADER_DESC: +// +// Retrieved by ID3D10EffectPass::Get**ShaderDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_PASS_SHADER_DESC +{ + ID3D10EffectShaderVariable *pShaderVariable; // The variable that this shader came from. + // If this is an inline shader assignment, + // the returned interface will be an + // anonymous shader variable, which is + // not retrievable any other way. It's + // name in the variable description will + // be "$Anonymous". + // If there is no assignment of this type in + // the pass block, pShaderVariable != NULL, + // but pShaderVariable->IsValid() == FALSE. + + UINT ShaderIndex; // The element of pShaderVariable (if an array) + // or 0 if not applicable +} D3D10_PASS_SHADER_DESC; + +typedef interface ID3D10EffectPass ID3D10EffectPass; +typedef interface ID3D10EffectPass *LPD3D10EFFECTPASS; + +// {5CFBEB89-1A06-46e0-B282-E3F9BFA36A54} +DEFINE_GUID(IID_ID3D10EffectPass, +0x5cfbeb89, 0x1a06, 0x46e0, 0xb2, 0x82, 0xe3, 0xf9, 0xbf, 0xa3, 0x6a, 0x54); + +#undef INTERFACE +#define INTERFACE ID3D10EffectPass + +DECLARE_INTERFACE(ID3D10EffectPass) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_PASS_DESC *pDesc) PURE; + + STDMETHOD(GetVertexShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + STDMETHOD(GetGeometryShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + STDMETHOD(GetPixelShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(Apply)(THIS_ UINT Flags) PURE; + + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectTechnique ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_TECHNIQUE_DESC: +// +// Retrieved by ID3D10EffectTechnique::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_TECHNIQUE_DESC +{ + LPCSTR Name; // Name of this technique (NULL if not anonymous) + UINT Passes; // Number of passes contained within + UINT Annotations; // Number of annotations on this technique +} D3D10_TECHNIQUE_DESC; + +typedef interface ID3D10EffectTechnique ID3D10EffectTechnique; +typedef interface ID3D10EffectTechnique *LPD3D10EFFECTTECHNIQUE; + +// {DB122CE8-D1C9-4292-B237-24ED3DE8B175} +DEFINE_GUID(IID_ID3D10EffectTechnique, +0xdb122ce8, 0xd1c9, 0x4292, 0xb2, 0x37, 0x24, 0xed, 0x3d, 0xe8, 0xb1, 0x75); + +#undef INTERFACE +#define INTERFACE ID3D10EffectTechnique + +DECLARE_INTERFACE(ID3D10EffectTechnique) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_TECHNIQUE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectPass*, GetPassByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectPass*, GetPassByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10Effect ////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_DESC: +// +// Retrieved by ID3D10Effect::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_DESC +{ + //TODO: do we need these? + //LPCSTR Creator; + //UINT Version; + + BOOL IsChildEffect; // TRUE if this is a child effect, + // FALSE if this is standalone or an effect pool. + + UINT ConstantBuffers; // Number of constant buffers in this effect, + // excluding the effect pool. + UINT SharedConstantBuffers; // Number of constant buffers shared in this + // effect's pool. + + UINT GlobalVariables; // Number of global variables in this effect, + // excluding the effect pool. + UINT SharedGlobalVariables; // Number of global variables shared in this + // effect's pool. + + UINT Techniques; // Number of techniques in this effect, + // excluding the effect pool. +} D3D10_EFFECT_DESC; + +typedef interface ID3D10Effect ID3D10Effect; +typedef interface ID3D10Effect *LPD3D10EFFECT; + +// {51B0CA8B-EC0B-4519-870D-8EE1CB5017C7} +DEFINE_GUID(IID_ID3D10Effect, +0x51b0ca8b, 0xec0b, 0x4519, 0x87, 0xd, 0x8e, 0xe1, 0xcb, 0x50, 0x17, 0xc7); + +#undef INTERFACE +#define INTERFACE ID3D10Effect + +DECLARE_INTERFACE_(ID3D10Effect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(BOOL, IsPool)(THIS) PURE; + + // Managing D3D Device + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; + + // New Reflection APIs + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetVariableBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(Optimize)(THIS) PURE; + STDMETHOD_(BOOL, IsOptimized)(THIS) PURE; + +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectPool ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectPool ID3D10EffectPool; +typedef interface ID3D10EffectPool *LPD3D10EFFECTPOOL; + +// {9537AB04-3250-412e-8213-FCD2F8677933} +DEFINE_GUID(IID_ID3D10EffectPool, +0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + +#undef INTERFACE +#define INTERFACE ID3D10EffectPool + +DECLARE_INTERFACE_(ID3D10EffectPool, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(ID3D10Effect*, AsEffect)(THIS) PURE; + + // No public methods +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10CreateEffectFromXXXX: +// -------------------------- +// Creates an effect from a binary effect or file +// +// Parameters: +// +// [in] +// +// TODO: Unicode support +// TODO: Support for binary (and not just ASCII) +// +// pFileName +// Name of the ASCII (uncompiled) or binary (compiled) Effect file to load +// +// hModule +// Handle to the module containing the resource to compile from +// pResourceName +// Name of the resource within hModule to compile from +// +// pData +// Blob of effect data, either ASCII (uncompiled) or binary (compiled) +// DataLength +// Length of the data blob +// +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// HLSLFlags +// Compilation flags pertaining to shaders and data types, honored by +// the HLSL compiler +// FXFlags +// Compilation flags pertaining to Effect compilation, honored +// by the Effect compiler +// pDevice +// Pointer to the D3D10 device on which to create Effect resources +// pEffectPool +// Pointer to an Effect pool to share variables with or NULL +// +// [out] +// +// ppEffect +// Address of the newly created Effect interface +// ppEffectPool +// Address of the newly created Effect pool interface +// ppErrors +// If non-NULL, address of a buffer with error messages that occurred +// during parsing or compilation +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CompileEffectFromMemory(void *pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, UINT HLSLFlags, UINT FXFlags, + ID3D10Blob **ppCompiledEffect, ID3D10Blob **ppErrors); + +HRESULT WINAPI D3D10CreateEffectFromMemory(void *pData, SIZE_T DataLength, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3D10Effect **ppEffect); + +HRESULT WINAPI D3D10CreateEffectPoolFromMemory(void *pData, SIZE_T DataLength, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool **ppEffectPool); + + +//---------------------------------------------------------------------------- +// D3D10DisassembleEffect: +// ----------------------- +// Takes an effect interface, and returns a buffer containing text assembly. +// +// Parameters: +// pEffect +// Pointer to the runtime effect interface. +// EnableColorCode +// Emit HTML tags for color coding the output? +// ppDisassembly +// Returns a buffer containing the disassembled effect. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10DisassembleEffect(ID3D10Effect *pEffect, BOOL EnableColorCode, ID3D10Blob **ppDisassembly); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10EFFECT_H__ + + diff --git a/SDK/dxSDK/Include/D3D10shader.h b/SDK/dxSDK/Include/D3D10shader.h new file mode 100644 index 00000000..276a412a --- /dev/null +++ b/SDK/dxSDK/Include/D3D10shader.h @@ -0,0 +1,701 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Shader.h +// Content: D3D10 Shader Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10SHADER_H__ +#define __D3D10SHADER_H__ + +#include "d3d10.h" + +//--------------------------------------------------------------------------- +// D3D10_TX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3D10Fill[]TX functions +//--------------------------------------------------------------------------- +#define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) + + +//---------------------------------------------------------------------------- +// D3D10SHADER flags: +// ----------------- +// D3D10_SHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3D10_SHADER_SKIP_VALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3D10_SHADER_SKIP_OPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3D10_SHADER_PACK_MATRIX_ROW_MAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3D10_SHADER_PARTIAL_PRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3D10_SHADER_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3D10_SHADER_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3D10_SHADER_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +// D3D10_SHADER_ENABLE_STRICTNESS +// By default, the HLSL/Effect compilers are not strict on deprecated syntax. +// Specifying this flag enables the strict mode. Deprecated syntax may be +// removed in a future release, and enabling syntax is a good way to make sure +// your shaders comply to the latest spec. +// +// D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY +// This enables older shaders to compile to 4_0 targets. +// +//---------------------------------------------------------------------------- + +#define D3D10_SHADER_DEBUG (1 << 0) +#define D3D10_SHADER_SKIP_VALIDATION (1 << 1) +#define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) +#define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) +#define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) +#define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) +#define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) +#define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) +#define D3D10_SHADER_NO_PRESHADER (1 << 8) +#define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) +#define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) +#define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) +#define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) +#define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) + + +// optimization level flags +#define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) +#define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 +#define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) +#define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) + + + + +//---------------------------------------------------------------------------- +// D3D10_SHADER_MACRO: +// ---------- +// Preprocessor macro definition. The application pass in a NULL-terminated +// array of this structure to various D3D10 APIs. This enables the application +// to #define tokens at runtime, before the file is parsed. +//---------------------------------------------------------------------------- + +typedef struct _D3D10_SHADER_MACRO +{ + LPCSTR Name; + LPCSTR Definition; + +} D3D10_SHADER_MACRO, *LPD3D10_SHADER_MACRO; + + +//---------------------------------------------------------------------------- +// D3D10_SHADER_VARIABLE_CLASS: +//---------------------------------------------------------------------------- + +typedef enum _D3D10_SHADER_VARIABLE_CLASS +{ + D3D10_SVC_SCALAR, + D3D10_SVC_VECTOR, + D3D10_SVC_MATRIX_ROWS, + D3D10_SVC_MATRIX_COLUMNS, + D3D10_SVC_OBJECT, + D3D10_SVC_STRUCT, + + // force 32-bit size enum + D3D10_SVC_FORCE_DWORD = 0x7fffffff + +} D3D10_SHADER_VARIABLE_CLASS, *LPD3D10_SHADER_VARIABLE_CLASS; + +typedef enum _D3D10_SHADER_VARIABLE_FLAGS +{ + D3D10_SVF_USERPACKED = 1, + D3D10_SVF_USED = 2, + + // force 32-bit size enum + D3D10_SVF_FORCE_DWORD = 0x7fffffff + +} D3D10_SHADER_VARIABLE_FLAGS, *LPD3D10_SHADER_VARIABLE_FLAGS; + +//---------------------------------------------------------------------------- +// D3D10_SHADER_VARIABLE_TYPE: +//---------------------------------------------------------------------------- +typedef enum _D3D10_SHADER_VARIABLE_TYPE +{ + D3D10_SVT_VOID = 0, + D3D10_SVT_BOOL = 1, + D3D10_SVT_INT = 2, + D3D10_SVT_FLOAT = 3, + D3D10_SVT_STRING = 4, + D3D10_SVT_TEXTURE = 5, + D3D10_SVT_TEXTURE1D = 6, + D3D10_SVT_TEXTURE2D = 7, + D3D10_SVT_TEXTURE3D = 8, + D3D10_SVT_TEXTURECUBE = 9, + D3D10_SVT_SAMPLER = 10, + D3D10_SVT_PIXELSHADER = 15, + D3D10_SVT_VERTEXSHADER = 16, + D3D10_SVT_UINT = 19, + D3D10_SVT_UINT8 = 20, + D3D10_SVT_GEOMETRYSHADER = 21, + D3D10_SVT_RASTERIZER = 22, + D3D10_SVT_DEPTHSTENCIL = 23, + D3D10_SVT_BLEND = 24, + D3D10_SVT_BUFFER = 25, + D3D10_SVT_CBUFFER = 26, + D3D10_SVT_TBUFFER = 27, + D3D10_SVT_TEXTURE1DARRAY = 28, + D3D10_SVT_TEXTURE2DARRAY = 29, + D3D10_SVT_RENDERTARGETVIEW = 30, + D3D10_SVT_DEPTHSTENCILVIEW = 31, + + D3D10_SVT_TEXTURE2DMS = 32, + D3D10_SVT_TEXTURE2DMSARRAY = 33, + + D3D10_SVT_TEXTURECUBEARRAY = 34, + + // force 32-bit size enum + D3D10_SVT_FORCE_DWORD = 0x7fffffff + +} D3D10_SHADER_VARIABLE_TYPE, *LPD3D10_SHADER_VARIABLE_TYPE; + +typedef enum _D3D10_SHADER_INPUT_FLAGS +{ + D3D10_SIF_USERPACKED = 1, + D3D10_SIF_COMPARISON_SAMPLER = 2, // is this a comparison sampler? + D3D10_SIF_TEXTURE_COMPONENT_0 = 4, // this 2-bit value encodes c - 1, where c + D3D10_SIF_TEXTURE_COMPONENT_1 = 8, // is the number of components in the texture + D3D10_SIF_TEXTURE_COMPONENTS = 12, + + // force 32-bit size enum + D3D10_SIF_FORCE_DWORD = 0x7fffffff +} D3D10_SHADER_INPUT_FLAGS, *LPD3D10_SHADER_INPUT_FLAGS; + +//---------------------------------------------------------------------------- +// D3D10_SHADER_INPUT_TYPE +//---------------------------------------------------------------------------- +typedef enum _D3D10_SHADER_INPUT_TYPE +{ + D3D10_SIT_CBUFFER, + D3D10_SIT_TBUFFER, + D3D10_SIT_TEXTURE, + D3D10_SIT_SAMPLER, +} D3D10_SHADER_INPUT_TYPE, *LPD3D10_SHADER_INPUT_TYPE; + +typedef enum _D3D10_SHADER_CBUFFER_FLAGS +{ + D3D10_CBF_USERPACKED = 1, + + // force 32-bit size enum + D3D10_CBF_FORCE_DWORD = 0x7fffffff +} D3D10_SHADER_CBUFFER_FLAGS, *LPD3D10_SHADER_CBUFFER_FLAGS; + +typedef enum _D3D10_CBUFFER_TYPE +{ + D3D10_CT_CBUFFER, + D3D10_CT_TBUFFER, +} D3D10_CBUFFER_TYPE, *LPD3D10_CBUFFER_TYPE; + +typedef enum D3D10_NAME +{ + D3D10_NAME_UNDEFINED = 0, + + // Names meaningful to both HLSL and hardware + D3D10_NAME_POSITION = 1, + D3D10_NAME_CLIP_DISTANCE = 2, + D3D10_NAME_CULL_DISTANCE = 3, + D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = 4, + D3D10_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D10_NAME_VERTEX_ID = 6, + D3D10_NAME_PRIMITIVE_ID = 7, + D3D10_NAME_INSTANCE_ID = 8, + D3D10_NAME_IS_FRONT_FACE = 9, + D3D10_NAME_SAMPLE_INDEX = 10, + + // Names meaningful to HLSL only + D3D10_NAME_TARGET = 64, + D3D10_NAME_DEPTH = 65, + D3D10_NAME_COVERAGE = 66, +} D3D10_NAME; + +typedef enum D3D10_RESOURCE_RETURN_TYPE +{ + D3D10_RETURN_TYPE_UNORM = 1, + D3D10_RETURN_TYPE_SNORM = 2, + D3D10_RETURN_TYPE_SINT = 3, + D3D10_RETURN_TYPE_UINT = 4, + D3D10_RETURN_TYPE_FLOAT = 5, + D3D10_RETURN_TYPE_MIXED = 6, +} D3D10_RESOURCE_RETURN_TYPE; + +typedef enum D3D10_REGISTER_COMPONENT_TYPE +{ + D3D10_REGISTER_COMPONENT_UNKNOWN = 0, + D3D10_REGISTER_COMPONENT_UINT32 = 1, + D3D10_REGISTER_COMPONENT_SINT32 = 2, + D3D10_REGISTER_COMPONENT_FLOAT32 = 3 +} D3D10_REGISTER_COMPONENT_TYPE; + + +//---------------------------------------------------------------------------- +// D3D10_INCLUDE_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3D10_INCLUDE_TYPE +{ + D3D10_INCLUDE_LOCAL, + D3D10_INCLUDE_SYSTEM, + + // force 32-bit size enum + D3D10_INCLUDE_FORCE_DWORD = 0x7fffffff + +} D3D10_INCLUDE_TYPE, *LPD3D10_INCLUDE_TYPE; + + +//---------------------------------------------------------------------------- +// ID3D10Include: +// ------------- +// This interface is intended to be implemented by the application, and can +// be used by various D3D10 APIs. This enables application-specific handling +// of #include directives in source files. +// +// Open() +// Opens an include file. If successful, it should fill in ppData and +// pBytes. The data pointer returned must remain valid until Close is +// subsequently called. +// Close() +// Closes an include file. If Open was successful, Close is guaranteed +// to be called before the API using this interface returns. +//---------------------------------------------------------------------------- + +typedef interface ID3D10Include ID3D10Include; +typedef interface ID3D10Include *LPD3D10INCLUDE; + +#undef INTERFACE +#define INTERFACE ID3D10Include + +DECLARE_INTERFACE(ID3D10Include) +{ + STDMETHOD(Open)(THIS_ D3D10_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; + STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3D10ShaderReflection: +//---------------------------------------------------------------------------- + +// +// Structure definitions +// + +typedef struct _D3D10_SHADER_DESC +{ + UINT Version; // Shader version + LPCSTR Creator; // Creator string + UINT Flags; // Shader compilation/parse flags + + UINT ConstantBuffers; // Number of constant buffers + UINT BoundResources; // Number of bound resources + UINT InputParameters; // Number of parameters in the input signature + UINT OutputParameters; // Number of parameters in the output signature + + UINT InstructionCount; // Number of emitted instructions + UINT TempRegisterCount; // Number of temporary registers used + UINT TempArrayCount; // Number of temporary arrays used + UINT DefCount; // Number of constant defines + UINT DclCount; // Number of declarations (input + output) + UINT TextureNormalInstructions; // Number of non-categorized texture instructions + UINT TextureLoadInstructions; // Number of texture load instructions + UINT TextureCompInstructions; // Number of texture comparison instructions + UINT TextureBiasInstructions; // Number of texture bias instructions + UINT TextureGradientInstructions; // Number of texture gradient instructions + UINT FloatInstructionCount; // Number of floating point arithmetic instructions used + UINT IntInstructionCount; // Number of signed integer arithmetic instructions used + UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used + UINT StaticFlowControlCount; // Number of static flow control instructions used + UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used + UINT MacroInstructionCount; // Number of macro instructions used + UINT ArrayInstructionCount; // Number of array instructions used + UINT CutInstructionCount; // Number of cut instructions used + UINT EmitInstructionCount; // Number of emit instructions used + D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology + UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count +} D3D10_SHADER_DESC; + +typedef struct _D3D10_SHADER_BUFFER_DESC +{ + LPCSTR Name; // Name of the constant buffer + D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer + UINT Variables; // Number of member variables + UINT Size; // Size of CB (in bytes) + UINT uFlags; // Buffer description flags +} D3D10_SHADER_BUFFER_DESC; + +typedef struct _D3D10_SHADER_VARIABLE_DESC +{ + LPCSTR Name; // Name of the variable + UINT StartOffset; // Offset in constant buffer's backing store + UINT Size; // Size of variable (in bytes) + UINT uFlags; // Variable flags + LPVOID DefaultValue; // Raw pointer to default value +} D3D10_SHADER_VARIABLE_DESC; + +typedef struct _D3D10_SHADER_TYPE_DESC +{ + D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) + D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) + UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) + UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) + UINT Elements; // Number of elements (0 if not an array) + UINT Members; // Number of members (0 if not a structure) + UINT Offset; // Offset from the start of structure (0 if not a structure member) +} D3D10_SHADER_TYPE_DESC; + +typedef struct _D3D10_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; // Name of the resource + D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) + UINT BindPoint; // Starting bind point + UINT BindCount; // Number of contiguous bind points (for arrays) + + UINT uFlags; // Input binding flags + D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) + D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) + UINT NumSamples; // Number of samples (0 if not MS texture) +} D3D10_SHADER_INPUT_BIND_DESC; + +typedef struct _D3D10_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; // Name of the semantic + UINT SemanticIndex; // Index of the semantic + UINT Register; // Number of member variables + D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable + D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) + BYTE Mask; // Mask to indicate which components of the register + // are used (combination of D3D10_COMPONENT_MASK values) + BYTE ReadWriteMask; // Mask to indicate whether a given component is + // never written (if this is an output signature) or + // always read (if this is an input signature). + // (combination of D3D10_COMPONENT_MASK values) + +} D3D10_SIGNATURE_PARAMETER_DESC; + + +// +// Interface definitions +// + +typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; +typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; + +// {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} +DEFINE_GUID(IID_ID3D10ShaderReflectionType, +0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionType + +DECLARE_INTERFACE(ID3D10ShaderReflectionType) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; +}; + +typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; +typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; + +// {1BF63C95-2650-405d-99C1-3636BD1DA0A1} +DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, +0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionVariable + +DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; +}; + +typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; +typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; + +// {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} +DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, +0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionConstantBuffer + +DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; +}; + +typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; +typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; + +// {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} +DEFINE_GUID(IID_ID3D10ShaderReflection, +0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflection + +DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3D10CompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. The D3D10 entry +// point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". +// Flags +// See D3D10_SHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs); + +//---------------------------------------------------------------------------- +// D3D10DisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// BytecodeLength +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10DisassembleShader(CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly); + + +//---------------------------------------------------------------------------- +// D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: +// ----------------------------------------------------- +// Returns the name of the HLSL profile best suited to a given device. +// +// Parameters: +// pDevice +// Pointer to the device in question +//---------------------------------------------------------------------------- + +LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *pDevice); + +LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *pDevice); + +LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *pDevice); + +//---------------------------------------------------------------------------- +// D3D10ReflectShader: +// ------------------ +// Creates a shader reflection object that can be used to retrieve information +// about a compiled shader +// +// Parameters: +// pShaderBytecode +// Pointer to a compiled shader (same pointer that is passed into +// ID3D10Device::CreateShader) +// BytecodeLength +// Length of the shader bytecode buffer +// ppReflector +// [out] Returns a ID3D10ShaderReflection object that can be used to +// retrieve shader resource and constant buffer information +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10ReflectShader(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector); + +//---------------------------------------------------------------------------- +// D3D10PreprocessShader +// --------------------- +// Creates a shader reflection object that can be used to retrieve information +// about a compiled shader +// +// Parameters: +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pFileName +// Source file name (used for error output) +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// ppShaderText +// Returns a buffer containing a single large string that represents +// the resulting formatted token stream +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs); + +////////////////////////////////////////////////////////////////////////// +// +// Shader blob manipulation routines +// --------------------------------- +// +// void *pShaderBytecode - a buffer containing the result of an HLSL +// compilation. Typically this opaque buffer contains several +// discrete sections including the shader executable code, the input +// signature, and the output signature. This can typically be retrieved +// by calling ID3D10Blob::GetBufferPointer() on the returned blob +// from HLSL's compile APIs. +// +// UINT BytecodeLength - the length of pShaderBytecode. This can +// typically be retrieved by calling ID3D10Blob::GetBufferSize() +// on the returned blob from HLSL's compile APIs. +// +// ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that +// contains only the signature portions of the original bytecode. +// This is a copy; the original bytecode is not modified. You may +// specify NULL for this parameter to have the bytecode validated +// for the presence of the corresponding signatures without actually +// copying them and creating a new blob. +// +// Returns E_INVALIDARG if any required parameters are NULL +// Returns E_FAIL is the bytecode is corrupt or missing signatures +// Returns S_OK on success +// +////////////////////////////////////////////////////////////////////////// + +HRESULT WINAPI D3D10GetInputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT WINAPI D3D10GetOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); + +//---------------------------------------------------------------------------- +// D3D10GetShaderDebugInfo: +// ----------------------- +// Gets shader debug info. Debug info is generated by D3D10CompileShader and is +// embedded in the body of the shader. +// +// Parameters: +// pShaderBytecode +// Pointer to the function bytecode +// BytecodeLength +// Length of the shader bytecode buffer +// ppDebugInfo +// Buffer used to return debug info. For information about the layout +// of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10GetShaderDebugInfo(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10SHADER_H__ + diff --git a/SDK/dxSDK/Include/D3DX10.h b/SDK/dxSDK/Include/D3DX10.h new file mode 100644 index 00000000..5cdcd51d --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10.h @@ -0,0 +1,72 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10.h +// Content: D3DX10 utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX10_INTERNAL__ +#error Incorrect D3DX10 header used +#endif + +#ifndef __D3DX10_H__ +#define __D3DX10_H__ + + +// Defines +#include +#include + +#define D3DX10_DEFAULT ((UINT) -1) +#define D3DX10_FROM_FILE ((UINT) -3) +#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3) + +#ifndef D3DX10INLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DX10INLINE __forceinline + #else + #define D3DX10INLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DX10INLINE inline + #else + #define D3DX10INLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d10.h" +#include "d3dx10.h" +#include "d3dx10math.h" +#include "d3dx10core.h" +#include "d3dx10tex.h" +#include "d3dx10mesh.h" +#include "d3dx10async.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DX10_ERR { + D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900), + D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT(2901), + D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902), + D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903), + D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904), + D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT(2905), + D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906), + D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907), + D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX10_H__ + diff --git a/SDK/dxSDK/Include/D3DX10core.h b/SDK/dxSDK/Include/D3DX10core.h new file mode 100644 index 00000000..93a9ba03 --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10core.h @@ -0,0 +1,509 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10core.h +// Content: D3DX10 core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10CORE_H__ +#define __D3DX10CORE_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DX10_DLL_W L"d3dx10_35.dll" +#define D3DX10_DLL_A "d3dx10_35.dll" + +#ifdef UNICODE + #define D3DX10_DLL D3DX10_DLL_W +#else + #define D3DX10_DLL D3DX10_DLL_A +#endif + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3DX10_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DX10CheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DX10CreateVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + + +#define D3DX10_SDK_VERSION 35 + + +/////////////////////////////////////////////////////////////////////////// +// D3DX10CreateDevice +// D3DX10CreateDeviceAndSwapChain +// D3DX10GetFeatureLevel1 +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3DX10CreateDevice(IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + ID3D10Device **ppDevice); + +HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device **ppDevice); + +typedef interface ID3D10Device1 ID3D10Device1; +HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *pDevice, ID3D10Device1 **ppDevice1); + + +#ifdef D3D10_DEBUG +BOOL WINAPI D3DX10DebugMute(BOOL Mute); +#endif +HRESULT WINAPI D3DX10CheckVersion(UINT D3DSdkVersion, UINT D3DX10SdkVersion); +UINT WINAPI D3DX10GetDriverLevel(ID3D10Device *pDevice); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// D3DX10_SPRITE flags: +// ----------------- +// D3DX10_SPRITE_SAVE_STATE +// Specifies device state should be saved and restored in Begin/End. +// D3DX10SPRITE_SORT_TEXTURE +// Sprites are sorted by texture prior to drawing. This is recommended when +// drawing non-overlapping sprites of uniform depth. For example, drawing +// screen-aligned text with ID3DX10Font. +// D3DX10SPRITE_SORT_DEPTH_FRONT_TO_BACK +// Sprites are sorted by depth front-to-back prior to drawing. This is +// recommended when drawing opaque sprites of varying depths. +// D3DX10SPRITE_SORT_DEPTH_BACK_TO_FRONT +// Sprites are sorted by depth back-to-front prior to drawing. This is +// recommended when drawing transparent sprites of varying depths. +// D3DX10SPRITE_ADDREF_TEXTURES +// AddRef/Release all textures passed in to DrawSpritesBuffered +////////////////////////////////////////////////////////////////////////////// + +typedef enum _D3DX10_SPRITE_FLAG +{ + D3DX10_SPRITE_SORT_TEXTURE = 0x01, + D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT = 0x02, + D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK = 0x04, + D3DX10_SPRITE_SAVE_STATE = 0x08, + D3DX10_SPRITE_ADDREF_TEXTURES = 0x10, +} D3DX10_SPRITE_FLAG; + +typedef struct _D3DX10_SPRITE +{ + D3DXMATRIX matWorld; + + D3DXVECTOR2 TexCoord; + D3DXVECTOR2 TexSize; + + D3DXCOLOR ColorModulate; + + ID3D10ShaderResourceView *pTexture; + UINT TextureIndex; +} D3DX10_SPRITE; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10Sprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites. +// +// Draw - +// Draws a sprite +// +// Flush - +// Forces all batched sprites to submitted to the device. +// +// End - +// Restores device state to how it was when Begin was called. +// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DX10Sprite ID3DX10Sprite; +typedef interface ID3DX10Sprite *LPD3DX10SPRITE; + + +// {BA0B762D-8D28-43ec-B9DC-2F84443B0614} +DEFINE_GUID(IID_ID3DX10Sprite, +0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); + + +#undef INTERFACE +#define INTERFACE ID3DX10Sprite + +DECLARE_INTERFACE_(ID3DX10Sprite, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Sprite + STDMETHOD(Begin)(THIS_ UINT flags) PURE; + + STDMETHOD(DrawSpritesBuffered)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites) PURE; + STDMETHOD(Flush)(THIS) PURE; + + STDMETHOD(DrawSpritesImmediate)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites, UINT cbSprite, UINT flags) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(GetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; + STDMETHOD(SetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; + STDMETHOD(GetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; + STDMETHOD(SetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; + + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateSprite( + ID3D10Device* pDevice, + UINT cDeviceBufferSize, + LPD3DX10SPRITE* ppSprite); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10ThreadPump: +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DX10DataLoader + +DECLARE_INTERFACE(ID3DX10DataLoader) +{ + STDMETHOD(Load)(THIS) PURE; + STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE ID3DX10DataProcessor + +DECLARE_INTERFACE(ID3DX10DataProcessor) +{ + STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; + STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +// {C93FECFA-6967-478a-ABBC-402D90621FCB} +DEFINE_GUID(IID_ID3DX10ThreadPump, +0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); + +#undef INTERFACE +#define INTERFACE ID3DX10ThreadPump + +DECLARE_INTERFACE_(ID3DX10ThreadPump, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10ThreadPump + STDMETHOD(AddWorkItem)(THIS_ ID3DX10DataLoader *pDataLoader, ID3DX10DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; + STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; + + STDMETHOD(WaitForAllItems)(THIS) PURE; + STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); + + STDMETHOD(PurgeAllItems)(THIS) PURE; + STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; + +}; + +HRESULT WINAPI D3DX10CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX10ThreadPump **ppThreadPump); + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10Font: +// ---------- +// Font objects contain the textures and resources needed to render a specific +// font on a specific device. +// +// GetGlyphData - +// Returns glyph cache data, for a given glyph. +// +// PreloadCharacters/PreloadGlyphs/PreloadText - +// Preloads glyphs into the glyph cache textures. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// If pSprite is NULL, an internal sprite object will be used. +// +////////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DX10_FONT_DESCA +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + CHAR FaceName[LF_FACESIZE]; + +} D3DX10_FONT_DESCA, *LPD3DX10_FONT_DESCA; + +typedef struct _D3DX10_FONT_DESCW +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + WCHAR FaceName[LF_FACESIZE]; + +} D3DX10_FONT_DESCW, *LPD3DX10_FONT_DESCW; + +#ifdef UNICODE +typedef D3DX10_FONT_DESCW D3DX10_FONT_DESC; +typedef LPD3DX10_FONT_DESCW LPD3DX10_FONT_DESC; +#else +typedef D3DX10_FONT_DESCA D3DX10_FONT_DESC; +typedef LPD3DX10_FONT_DESCA LPD3DX10_FONT_DESC; +#endif + + +typedef interface ID3DX10Font ID3DX10Font; +typedef interface ID3DX10Font *LPD3DX10FONT; + + +// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} +DEFINE_GUID(IID_ID3DX10Font, +0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); + + +#undef INTERFACE +#define INTERFACE ID3DX10Font + +DECLARE_INTERFACE_(ID3DX10Font, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Font + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; + STDMETHOD(GetDescA)(THIS_ D3DX10_FONT_DESCA *pDesc) PURE; + STDMETHOD(GetDescW)(THIS_ D3DX10_FONT_DESCW *pDesc) PURE; + STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; + STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; + + STDMETHOD_(HDC, GetDC)(THIS) PURE; + STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, ID3D10ShaderResourceView** ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; + + STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; + STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; + + STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DX10SPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DX10SPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; + +#ifdef __cplusplus +#ifdef UNICODE + HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCW *pDesc) { return GetDescW(pDesc); } + HRESULT WINAPI_INLINE PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } +#else + HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCA *pDesc) { return GetDescA(pDesc); } + HRESULT WINAPI_INLINE PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } +#endif +#endif //__cplusplus +}; + +#ifndef GetTextMetrics +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif +#endif + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DX10CreateFontA( + ID3D10Device* pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + UINT CharSet, + UINT OutputPrecision, + UINT Quality, + UINT PitchAndFamily, + LPCSTR pFaceName, + LPD3DX10FONT* ppFont); + +HRESULT WINAPI + D3DX10CreateFontW( + ID3D10Device* pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + UINT CharSet, + UINT OutputPrecision, + UINT Quality, + UINT PitchAndFamily, + LPCWSTR pFaceName, + LPD3DX10FONT* ppFont); + +#ifdef UNICODE +#define D3DX10CreateFont D3DX10CreateFontW +#else +#define D3DX10CreateFont D3DX10CreateFontA +#endif + + +HRESULT WINAPI + D3DX10CreateFontIndirectA( + ID3D10Device* pDevice, + CONST D3DX10_FONT_DESCA* pDesc, + LPD3DX10FONT* ppFont); + +HRESULT WINAPI + D3DX10CreateFontIndirectW( + ID3D10Device* pDevice, + CONST D3DX10_FONT_DESCW* pDesc, + LPD3DX10FONT* ppFont); + +#ifdef UNICODE +#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectW +#else +#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectA +#endif + +HRESULT WINAPI D3DX10UnsetAllDeviceObjects(ID3D10Device *pDevice); + +////////////////////////////////////////////////////////////////////////////// +// D3DX10ReflectShader +// ---------- +// Shader code contains metadata that can be inspected via the +// reflection APIs. +// +// Parameters: +// ppReflector - +// Returns a reflection API interface for the given shader code. +// +////////////////////////////////////////////////////////////////////////////// + +HRESULT WINAPI + D3DX10ReflectShader( + CONST void *pShaderBytecode, + SIZE_T BytecodeLength, + interface ID3D10ShaderReflection1 **ppReflector); + +//---------------------------------------------------------------------------- +// D3DX10DisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// BytecodeLength +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10DisassembleShader( + CONST void *pShader, + SIZE_T BytecodeLength, + BOOL EnableColorCode, + LPCSTR pComments, + interface ID3D10Blob** ppDisassembly); + +//---------------------------------------------------------------------------- +// D3DX10DisassembleEffect: +// ----------------------- +// Takes an effect interface, and returns a buffer containing text assembly. +// +// Parameters: +// pEffect +// Pointer to the runtime effect interface. +// EnableColorCode +// Emit HTML tags for color coding the output? +// ppDisassembly +// Returns a buffer containing the disassembled effect. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10DisassembleEffect( + interface ID3D10Effect *pEffect, + BOOL EnableColorCode, + interface ID3D10Blob **ppDisassembly); + +#ifdef __cplusplus +} +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// + +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) + +#endif //__D3DX10CORE_H__ + diff --git a/SDK/dxSDK/Include/D3DX10math.h b/SDK/dxSDK/Include/D3DX10math.h new file mode 100644 index 00000000..e2567aff --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10math.h @@ -0,0 +1,1858 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: D3DX10math.h +// Content: D3DX10 math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "D3DX10.h" + +// D3DX10 and D3DX9 math look the same. You can include either one into your project. +// We are intentionally using the header define from D3DX9 math to prevent double-inclusion. +#ifndef __D3DX9MATH_H__ +#define __D3DX9MATH_H__ + +#include +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning + +//=========================================================================== +// +// Type definitions from D3D9 +// +//=========================================================================== + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI (3.14159265358979323846) +#define D3DX_1BYPI ( 1.0 / D3DX_PI ) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0)) +#define D3DXToDegree( radian ) ((radian) * (180.0 / D3DX_PI)) + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +#define D3DX_16F_DIG 3 // # of decimal digits of precision +#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 +#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa +#define D3DX_16F_MAX 6.550400e+004 // max value +#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent +#define D3DX_16F_MAX_EXP 15 // max binary exponent +#define D3DX_16F_MIN 6.1035156e-5f // min positive value +#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent +#define D3DX_16F_MIN_EXP (-14) // min binary exponent +#define D3DX_16F_RADIX 2 // exponent radix +#define D3DX_16F_ROUNDS 1 // addition rounding: near +#define D3DX_16F_SIGN_MASK 0x8000 +#define D3DX_16F_EXP_MASK 0x7C00 +#define D3DX_16F_FRAC_MASK 0x03FF + +typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus +public: + D3DXFLOAT16() {}; + D3DXFLOAT16( FLOAT ); + D3DXFLOAT16( CONST D3DXFLOAT16& ); + + // casting + operator FLOAT (); + + // binary operators + BOOL operator == ( CONST D3DXFLOAT16& ) const; + BOOL operator != ( CONST D3DXFLOAT16& ) const; + +protected: +#endif //__cplusplus + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( CONST D3DXFLOAT16 * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +typedef struct D3DXVECTOR2_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR2_16F() {}; + D3DXVECTOR2_16F( CONST FLOAT * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR2_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR2_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y; + +} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F; + + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( CONST D3DXFLOAT16 * ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR3_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR3_16F() {}; + D3DXVECTOR3_16F( CONST FLOAT * ); + D3DXVECTOR3_16F( CONST D3DVECTOR& ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR3_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR3_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z; + +} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F; + + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( CONST D3DXFLOAT16* ); + D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR4_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR4_16F() {}; + D3DXVECTOR4_16F( CONST FLOAT * ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16* ); + D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR4_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR4_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z, w; + +} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( CONST D3DXFLOAT16 * ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {}; + _D3DXMATRIXA16( CONST FLOAT * ); + _D3DXMATRIXA16( CONST D3DMATRIX& ); + _D3DXMATRIXA16( CONST D3DXFLOAT16 * ); + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + // new operators + void* operator new ( size_t ); + void* operator new[] ( size_t ); + + // delete operators + void operator delete ( void* ); // These are NOT virtual; Do not + void operator delete[] ( void* ); // cast to D3DXMATRIX and delete. + + // assignment operators + _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& ); + +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + + + +#if _MSC_VER >= 1300 // VC7 +#define D3DX_ALIGN16 __declspec(align(16)) +#else +#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing. +#endif + +typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; + + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {}; + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( CONST D3DXFLOAT16 * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {}; + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( CONST D3DXFLOAT16* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXPLANE& operator *= ( FLOAT ); + D3DXPLANE& operator /= ( FLOAT ); + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + D3DXPLANE operator * ( FLOAT ) const; + D3DXPLANE operator / ( FLOAT ) const; + + friend D3DXPLANE operator * ( FLOAT, CONST D3DXPLANE& ); + + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {}; + D3DXCOLOR( UINT argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DXFLOAT16 * ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator UINT () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Converts an array 32-bit floats to 16-bit floats +D3DXFLOAT16* WINAPI D3DXFloat32To16Array + ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); + +// Converts an array 16-bit floats to 32-bit floats +FLOAT* WINAPI D3DXFloat16To32Array + ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform Array (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + + + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + + +// Transform Array (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector Array from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3ProjectArray + ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + +// Project vector Array from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +// Transform vector array by matrix. +D3DXVECTOR4* WINAPI D3DXVec4TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixDeterminant + ( CONST D3DXMATRIX *pM ); + +HRESULT WINAPI D3DXMatrixDecompose + ( D3DXVECTOR3 *pOutScale, D3DXQUATERNION *pOutRotation, + D3DXVECTOR3 *pOutTranslation, CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation2D + ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, + FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, + FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransformArray + ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {C7885BA7-F990-4fe7-922D-8515E477DD85} +DEFINE_GUID(IID_ID3DXMatrixStack, +0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + UINT Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +//============================================================================ +// +// Basic Spherical Harmonic math routines +// +//============================================================================ + +#define D3DXSH_MINORDER 2 +#define D3DXSH_MAXORDER 6 + +//============================================================================ +// +// D3DXSHEvalDirection: +// -------------------- +// Evaluates the Spherical Harmonic basis functions +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction to evaluate in - assumed to be normalized +// +//============================================================================ + +FLOAT* WINAPI D3DXSHEvalDirection + ( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir ); + +//============================================================================ +// +// D3DXSHRotate: +// -------------------- +// Rotates SH vector by a rotation matrix +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pMatrix +// Matrix used for rotation - rotation sub matrix should be orthogonal +// and have a unit determinant. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHRotate + ( FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHRotateZ: +// -------------------- +// Rotates the SH vector in the Z axis by an angle +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// Angle +// Angle in radians to rotate around the Z axis. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + + +FLOAT* WINAPI D3DXSHRotateZ + ( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHAdd: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i] + pB[i]; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Input SH coeffs (second vector.) +// +//============================================================================ + +FLOAT* WINAPI D3DXSHAdd + ( FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHScale: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i]*Scale; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pIn +// Input SH coeffs. +// Scale +// Scale factor. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHScale + ( FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale ); + +//============================================================================ +// +// D3DXSHDot: +// -------------------- +// Computes the dot product of two SH vectors +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT WINAPI D3DXSHDot + ( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHMultiply[O]: +// -------------------- +// Computes the product of two functions represented using SH (f and g), where: +// pOut[i] = int(y_i(s) * f(s) * g(s)), where y_i(s) is the ith SH basis +// function, f(s) and g(s) are SH functions (sum_i(y_i(s)*c_i)). The order O +// determines the lengths of the arrays, where there should always be O^2 +// coefficients. In general the product of two SH functions of order O generates +// and SH function of order 2*O - 1, but we truncate the result. This means +// that the product commutes (f*g == g*f) but doesn't associate +// (f*(g*h) != (f*g)*h. +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// pF +// Input SH coeffs for first function. +// pG +// Second set of input SH coeffs. +// +//============================================================================ + +__out_ecount(4) FLOAT* WINAPI D3DXSHMultiply2(__out_ecount(4) FLOAT *pOut,__in_ecount(4) CONST FLOAT *pF,__in_ecount(4) CONST FLOAT *pG); +__out_ecount(9) FLOAT* WINAPI D3DXSHMultiply3(__out_ecount(9) FLOAT *pOut,__in_ecount(9) CONST FLOAT *pF,__in_ecount(9) CONST FLOAT *pG); +__out_ecount(16) FLOAT* WINAPI D3DXSHMultiply4(__out_ecount(16) FLOAT *pOut,__in_ecount(16) CONST FLOAT *pF,__in_ecount(16) CONST FLOAT *pG); +__out_ecount(25) FLOAT* WINAPI D3DXSHMultiply5(__out_ecount(25) FLOAT *pOut,__in_ecount(25) CONST FLOAT *pF,__in_ecount(25) CONST FLOAT *pG); +__out_ecount(36) FLOAT* WINAPI D3DXSHMultiply6(__out_ecount(36) FLOAT *pOut,__in_ecount(36) CONST FLOAT *pF,__in_ecount(36) CONST FLOAT *pG); + + +//============================================================================ +// +// Basic Spherical Harmonic lighting routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHEvalDirectionalLight: +// -------------------- +// Evaluates a directional light and returns spectral SH data. The output +// vector is computed so that if the intensity of R/G/B is unit the resulting +// exit radiance of a point directly under the light on a diffuse object with +// an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut +// has to be specified, while pGout and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalDirectionalLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalSphericalLight: +// -------------------- +// Evaluates a spherical light and returns spectral SH data. There is no +// normalization of the intensity of the light like there is for directional +// lights, care has to be taken when specifiying the intensities. This will +// compute 3 spectral samples, pROut has to be specified, while pGout and +// pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pPos +// Position of light - reciever is assumed to be at the origin. +// Radius +// Radius of the spherical light source. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalSphericalLight + ( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalConeLight: +// -------------------- +// Evaluates a light that is a cone of constant intensity and returns spectral +// SH data. The output vector is computed so that if the intensity of R/G/B is +// unit the resulting exit radiance of a point directly under the light oriented +// in the cone direction on a diffuse object with an albedo of 1 would be 1.0. +// This will compute 3 spectral samples, pROut has to be specified, while pGout +// and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// Radius +// Radius of cone in radians. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalConeLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalHemisphereLight: +// -------------------- +// Evaluates a light that is a linear interpolant between two colors over the +// sphere. The interpolant is linear along the axis of the two points, not +// over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in +// Z, not in the azimuthal angle.) The resulting spherical lighting function +// is normalized so that a point on a perfectly diffuse surface with no +// shadowing and a normal pointed in the direction pDir would result in exit +// radiance with a value of 1 if the top color was white and the bottom color +// was black. This is a very simple model where Top represents the intensity +// of the "sky" and Bottom represents the intensity of the "ground". +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Axis of the hemisphere. +// Top +// Color of the upper hemisphere. +// Bottom +// Color of the lower hemisphere. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalHemisphereLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +// Math intersection functions + +BOOL WINAPI D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + + +/////////////////////////////////////////////////////////////////////////// +// CPU Optimization: +/////////////////////////////////////////////////////////////////////////// + +//------------------------------------------------------------------------- +// D3DX_CPU_OPTIMIZATION flags: +// ---------------------------- +// D3DX_NOT_OPTIMIZED Use Intel Pentium optimizations +// D3DX_3DNOW_OPTIMIZED Use AMD 3DNow optimizations +// D3DX_SSE_OPTIMIZED Use Intel Pentium III SSE optimizations +// D3DX_SSE2_OPTIMIZED Use Intel Pentium IV SSE2 optimizations +//------------------------------------------------------------------------- + + +typedef enum _D3DX_CPU_OPTIMIZATION +{ + D3DX_NOT_OPTIMIZED = 0, + D3DX_3DNOW_OPTIMIZED, + D3DX_SSE2_OPTIMIZED, + D3DX_SSE_OPTIMIZED +} D3DX_CPU_OPTIMIZATION; + + +//------------------------------------------------------------------------- +// D3DXCpuOptimizations: +// --------------------- +// Enables or disables CPU optimizations. Returns the type of CPU, which +// was detected, and for which optimizations exist. +// +// Parameters: +// Enable +// TRUE to enable CPU optimizations. FALSE to disable. +//------------------------------------------------------------------------- + +D3DX_CPU_OPTIMIZATION WINAPI + D3DXCpuOptimizations(BOOL Enable); + +#ifdef __cplusplus +} +#endif + + +#include "D3DX10math.inl" + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif // __D3DX9MATH_H__ + diff --git a/SDK/dxSDK/Include/D3DX10math.inl b/SDK/dxSDK/Include/D3DX10math.inl new file mode 100644 index 00000000..56f11638 --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10math.inl @@ -0,0 +1,2228 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10math.inl +// Content: D3DX10 math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DXMATH_INL__ +#define __D3DXMATH_INL__ + + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// Float16 +//-------------------------- + +D3DX10INLINE +D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) +{ + D3DXFloat32To16Array(this, &f, 1); +} + +D3DX10INLINE +D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) +{ + value = f.value; +} + +// casting +D3DX10INLINE +D3DXFLOAT16::operator FLOAT () +{ + FLOAT f; + D3DXFloat16To32Array(&f, this, 1); + return f; +} + +// binary operators +D3DX10INLINE BOOL +D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const +{ + // At least one is NaN + if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) + || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) + return false; + // +/- Zero + else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) + return true; + else + return value == f.value; +} + +D3DX10INLINE BOOL +D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const +{ + // At least one is NaN + if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) + || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) + return true; + // +/- Zero + else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) + return false; + else + return value != f.value; +} + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 2); +} + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DX10INLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + +D3DX10INLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DX10INLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DX10INLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 2); +} + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); +} + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DX10INLINE +D3DXVECTOR2_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const +{ + return x == v.x && y == v.y; +} + +D3DX10INLINE BOOL +D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const +{ + return x != v.x || y != v.y; +} + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 3); +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DX10INLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DX10INLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DX10INLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DX10INLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 3); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) +{ + D3DXFloat32To16Array(&x, &v.x, 1); + D3DXFloat32To16Array(&y, &v.y, 1); + D3DXFloat32To16Array(&z, &v.z, 1); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); + *((WORD *) &z) = *((WORD *) &pf[2]); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DX10INLINE +D3DXVECTOR3_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DX10INLINE BOOL +D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + +D3DX10INLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DX10INLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DX10INLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); + *((UINT *) &z) = *((UINT *) &pf[2]); +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXVECTOR4_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DX10INLINE BOOL +D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&_11, pf, 16); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DX10INLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DX10INLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DX10INLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DX10INLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DX10INLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DX10INLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Aligned Matrices +//-------------------------- + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : + D3DXMATRIX( f ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : + D3DXMATRIX( m ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : + D3DXMATRIX( f ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) +{ +} + +#ifndef SIZE_MAX +#define SIZE_MAX ((SIZE_T)-1) +#endif + +D3DX10INLINE void* +_D3DXMATRIXA16::operator new( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DX10INLINE void* +_D3DXMATRIXA16::operator new[]( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DX10INLINE void +_D3DXMATRIXA16::operator delete(void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DX10INLINE void +_D3DXMATRIXA16::operator delete[](void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DX10INLINE _D3DXMATRIXA16& +_D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) +{ + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DX10INLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DX10INLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DX10INLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&a, pf, 4); +} + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DX10INLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DX10INLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// assignment operators +D3DX10INLINE D3DXPLANE& +D3DXPLANE::operator *= ( FLOAT f ) +{ + a *= f; + b *= f; + c *= f; + d *= f; + return *this; +} + +D3DX10INLINE D3DXPLANE& +D3DXPLANE::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + a *= fInv; + b *= fInv; + c *= fInv; + d *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator * ( FLOAT f ) const +{ + return D3DXPLANE(a * f, b * f, c * f, d * f); +} + +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); +} + +D3DX10INLINE D3DXPLANE +operator * (FLOAT f, CONST D3DXPLANE& p ) +{ + return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); +} + +D3DX10INLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DX10INLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( UINT dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&r, pf, 4); +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DX10INLINE +D3DXCOLOR::operator UINT () const +{ + UINT dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (UINT) (r * 255.0f + 0.5f); + UINT dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (UINT) (g * 255.0f + 0.5f); + UINT dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (UINT) (b * 255.0f + 0.5f); + UINT dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (UINT) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | (dwB << 0); +} + + +D3DX10INLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DX10INLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + +// assignment operators +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DX10INLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DX10INLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DX10INLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DX10INLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DX10INLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DX10INLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DX10INLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DX10INLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DX10INLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DX10INLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DX10INLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX10_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DX10INLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX10_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DX10INLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DX10INLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DX10INLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX10_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DX10INLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX10_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DX10INLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DX10INLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DX10INLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DX10INLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DX10INLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + +D3DX10INLINE D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pP) + return NULL; +#endif + + pOut->a = pP->a * s; + pOut->b = pP->b * s; + pOut->c = pP->c * s; + pOut->d = pP->d * s; + return pOut; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DX10INLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DXMATH_INL__ + diff --git a/SDK/dxSDK/Include/D3DX10mesh.h b/SDK/dxSDK/Include/D3DX10mesh.h new file mode 100644 index 00000000..e5fed8fc --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10mesh.h @@ -0,0 +1,286 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10mesh.h +// Content: D3DX10 mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10MESH_H__ +#define __D3DX10MESH_H__ + +// {7ED943DD-52E8-40b5-A8D8-76685C406330} +DEFINE_GUID(IID_ID3DX10BaseMesh, +0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); + +// {04B0D117-1041-46b1-AA8A-3952848BA22E} +DEFINE_GUID(IID_ID3DX10MeshBuffer, +0x4b0d117, 0x1041, 0x46b1, 0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e); + +// {4020E5C2-1403-4929-883F-E2E849FAC195} +DEFINE_GUID(IID_ID3DX10Mesh, +0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); + +// {8875769A-D579-4088-AAEB-534D1AD84E96} +DEFINE_GUID(IID_ID3DX10PMesh, +0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); + +// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +DEFINE_GUID(IID_ID3DX10SPMesh, +0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); + +// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +DEFINE_GUID(IID_ID3DX10PatchMesh, +0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); + + +// Mesh options - lower 3 bytes only, upper byte used by _D3DX10MESHOPT option flags +enum _D3DX10_MESH { + D3DX10_MESH_32_BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DX10_MESH_GS_ADJACENCY = 0x004, // If set, mesh contains GS adjacency info. Not valid on input. + +}; + +typedef struct _D3DX10_ATTRIBUTE_RANGE +{ + UINT AttribId; + UINT FaceStart; + UINT FaceCount; + UINT VertexStart; + UINT VertexCount; +} D3DX10_ATTRIBUTE_RANGE; + +typedef D3DX10_ATTRIBUTE_RANGE* LPD3DX10_ATTRIBUTE_RANGE; + +typedef enum _D3DX10_MESH_DISCARD_FLAGS +{ + D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = 0x01, + D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = 0x02, + D3DX10_MESH_DISCARD_POINTREPS = 0x04, + D3DX10_MESH_DISCARD_ADJACENCY = 0x08, + D3DX10_MESH_DISCARD_DEVICE_BUFFERS = 0x10, + +} D3DX10_MESH_DISCARD_FLAGS; + +typedef struct _D3DX10_WELD_EPSILONS +{ + FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT BlendWeights; + FLOAT Normal; + FLOAT PSize; + FLOAT Specular; + FLOAT Diffuse; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; + FLOAT TessFactor; +} D3DX10_WELD_EPSILONS; + +typedef D3DX10_WELD_EPSILONS* LPD3DX10_WELD_EPSILONS; + +typedef struct _D3DX10_INTERSECT_INFO +{ + UINT FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DX10_INTERSECT_INFO, *LPD3DX10_INTERSECT_INFO; + +// ID3DX10MeshBuffer is used by D3DX10Mesh vertex and index buffers +#undef INTERFACE +#define INTERFACE ID3DX10MeshBuffer + +DECLARE_INTERFACE_(ID3DX10MeshBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10MeshBuffer + STDMETHOD(Map)(THIS_ void **ppData, SIZE_T *pSize) PURE; + STDMETHOD(Unmap)(THIS) PURE; + STDMETHOD_(SIZE_T, GetSize)(THIS) PURE; +}; + +// D3DX10 Mesh interfaces +#undef INTERFACE +#define INTERFACE ID3DX10Mesh + +DECLARE_INTERFACE_(ID3DX10Mesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Mesh + STDMETHOD_(UINT, GetFaceCount)(THIS) PURE; + STDMETHOD_(UINT, GetVertexCount)(THIS) PURE; + STDMETHOD_(UINT, GetVertexBufferCount)(THIS) PURE; + STDMETHOD_(UINT, GetFlags)(THIS) PURE; + STDMETHOD(GetVertexDescription)(THIS_ CONST D3D10_INPUT_ELEMENT_DESC **ppDesc, UINT *pDeclCount) PURE; + + STDMETHOD(SetVertexData)(THIS_ UINT iBuffer, CONST void *pData) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ UINT iBuffer, ID3DX10MeshBuffer **ppVertexBuffer) PURE; + + STDMETHOD(SetIndexData)(THIS_ CONST void *pData, UINT cIndices) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ ID3DX10MeshBuffer **ppIndexBuffer) PURE; + + STDMETHOD(SetAttributeData)(THIS_ CONST UINT *pData) PURE; + STDMETHOD(GetAttributeBuffer)(THIS_ ID3DX10MeshBuffer **ppAttributeBuffer) PURE; + + STDMETHOD(SetAttributeTable)(THIS_ CONST D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT cAttribTableSize) PURE; + STDMETHOD(GetAttributeTable)(THIS_ D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT *pAttribTableSize) PURE; + + STDMETHOD(GenerateAdjacencyAndPointReps)(THIS_ FLOAT Epsilon) PURE; + STDMETHOD(GenerateGSAdjacency)(THIS) PURE; + + STDMETHOD(SetAdjacencyData)(THIS_ CONST UINT *pAdjacency) PURE; + STDMETHOD(GetAdjacencyBuffer)(THIS_ ID3DX10MeshBuffer **ppAdjacency) PURE; + + STDMETHOD(SetPointRepData)(THIS_ CONST UINT *pPointReps) PURE; + STDMETHOD(GetPointRepBuffer)(THIS_ ID3DX10MeshBuffer **ppPointReps) PURE; + + STDMETHOD(Discard)(THIS_ D3DX10_MESH_DISCARD_FLAGS dwDiscard) PURE; + STDMETHOD(CloneMesh)(THIS_ UINT Flags, LPCSTR pPosSemantic, CONST D3D10_INPUT_ELEMENT_DESC *pDesc, UINT DeclCount, ID3DX10Mesh** ppCloneMesh) PURE; + + STDMETHOD(Optimize)(THIS_ UINT Flags, UINT * pFaceRemap, LPD3D10BLOB *ppVertexRemap) PURE; + STDMETHOD(GenerateAttributeBufferFromTable)(THIS) PURE; + + STDMETHOD(Intersect)(THIS_ D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir, + UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); + STDMETHOD(IntersectSubset)(THIS_ UINT AttribId, D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir, + UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); + + // ID3DX10Mesh - Device functions + STDMETHOD(CommitToDevice)(THIS) PURE; + STDMETHOD(DrawSubset)(THIS_ UINT AttribId) PURE; + STDMETHOD(DrawSubsetInstanced)(THIS_ UINT AttribId, UINT InstanceCount, UINT StartInstanceLocation) PURE; + + STDMETHOD(GetDeviceVertexBuffer)(THIS_ UINT iBuffer, ID3D10Buffer **ppVertexBuffer) PURE; + STDMETHOD(GetDeviceIndexBuffer)(THIS_ ID3D10Buffer **ppIndexBuffer) PURE; +}; + + +// Flat API +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateMesh( + ID3D10Device *pDevice, + CONST D3D10_INPUT_ELEMENT_DESC *pDeclaration, + UINT DeclCount, + LPCSTR pPositionSemantic, + UINT VertexCount, + UINT FaceCount, + UINT Options, + ID3DX10Mesh **ppMesh); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +// ID3DX10Mesh::Optimize options - upper byte only, lower 3 bytes used from _D3DX10MESH option flags +enum _D3DX10_MESHOPT { + D3DX10_MESHOPT_COMPACT = 0x01000000, + D3DX10_MESHOPT_ATTR_SORT = 0x02000000, + D3DX10_MESHOPT_VERTEX_CACHE = 0x04000000, + D3DX10_MESHOPT_STRIP_REORDER = 0x08000000, + D3DX10_MESHOPT_IGNORE_VERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DX10_MESHOPT_DO_NOT_SPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting + D3DX10_MESHOPT_DEVICE_INDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards + + // D3DX10_MESHOPT_SHAREVB has been removed, please use D3DX10MESH_VB_SHARE instead + +}; + + +////////////////////////////////////////////////////////////////////////// +// ID3DXSkinInfo +////////////////////////////////////////////////////////////////////////// + +// {420BD604-1C76-4a34-A466-E45D0658A32C} +DEFINE_GUID(IID_ID3DX10SkinInfo, +0x420bd604, 0x1c76, 0x4a34, 0xa4, 0x66, 0xe4, 0x5d, 0x6, 0x58, 0xa3, 0x2c); + +// scaling modes for ID3DX10SkinInfo::Compact() & ID3DX10SkinInfo::UpdateMesh() +#define D3DX10_SKININFO_NO_SCALING 0 +#define D3DX10_SKININFO_SCALE_TO_1 1 +#define D3DX10_SKININFO_SCALE_TO_TOTAL 2 + +typedef struct _D3DX10_SKINNING_CHANNEL +{ + UINT SrcOffset; + UINT DestOffset; + BOOL IsNormal; +} D3DX10_SKINNING_CHANNEL; + +#undef INTERFACE +#define INTERFACE ID3DX10SkinInfo + +typedef struct ID3DX10SkinInfo *LPD3DX10SKININFO; + +DECLARE_INTERFACE_(ID3DX10SkinInfo, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(UINT , GetNumVertices)(THIS) PURE; + STDMETHOD_(UINT , GetNumBones)(THIS) PURE; + STDMETHOD_(UINT , GetMaxBoneInfluences)(THIS) PURE; + + STDMETHOD(AddVertices)(THIS_ UINT Count) PURE; + STDMETHOD(RemapVertices)(THIS_ UINT NewVertexCount, UINT *pVertexRemap) PURE; + + STDMETHOD(AddBones)(THIS_ UINT Count) PURE; + STDMETHOD(RemoveBone)(THIS_ UINT Index) PURE; + STDMETHOD(RemapBones)(THIS_ UINT NewBoneCount, UINT *pBoneRemap) PURE; + + STDMETHOD(AddBoneInfluences)(THIS_ UINT BoneIndex, UINT InfluenceCount, UINT *pIndices, float *pWeights) PURE; + STDMETHOD(ClearBoneInfluences)(THIS_ UINT BoneIndex) PURE; + STDMETHOD_(UINT , GetBoneInfluenceCount)(THIS_ UINT BoneIndex) PURE; + STDMETHOD(GetBoneInfluences)(THIS_ UINT BoneIndex, UINT Offset, UINT Count, UINT *pDestIndices, float *pDestWeights) PURE; + STDMETHOD(FindBoneInfluenceIndex)(THIS_ UINT BoneIndex, UINT VertexIndex, UINT *pInfluenceIndex) PURE; + STDMETHOD(SetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float Weight) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float *pWeight) PURE; + + STDMETHOD(Compact)(THIS_ UINT MaxPerVertexInfluences, UINT ScaleMode, float MinWeight) PURE; + STDMETHOD(DoSoftwareSkinning)(UINT StartVertex, UINT VertexCount, void *pSrcVertices, UINT SrcStride, void *pDestVertices, UINT DestStride, D3DXMATRIX *pBoneMatrices, D3DXMATRIX *pInverseTransposeBoneMatrices, D3DX10_SKINNING_CHANNEL *pChannelDescs, UINT NumChannels) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateSkinInfo(LPD3DX10SKININFO* ppSkinInfo); + +#ifdef __cplusplus +} +#endif //__cplusplus + +typedef struct _D3DX10_ATTRIBUTE_WEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; +} D3DX10_ATTRIBUTE_WEIGHTS, *LPD3DX10_ATTRIBUTE_WEIGHTS; + +#endif //__D3DX10MESH_H__ + + diff --git a/SDK/dxSDK/Include/D3DX10tex.h b/SDK/dxSDK/Include/D3DX10tex.h new file mode 100644 index 00000000..a6d8bb95 --- /dev/null +++ b/SDK/dxSDK/Include/D3DX10tex.h @@ -0,0 +1,766 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10tex.h +// Content: D3DX10 texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10TEX_H__ +#define __D3DX10TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX10_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX10_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX10_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX10_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX10_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX10_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX10_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR +// Same as specifying D3DX10_FILTER_MIRROR_U | D3DX10_FILTER_MIRROR_V | +// D3DX10_FILTER_MIRROR_V +// D3DX10_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX10_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX10_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX10_FILTER_SRGB +// Same as specifying D3DX10_FILTER_SRGB_IN | D3DX10_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_FILTER_FLAG +{ + D3DX10_FILTER_NONE = (1 << 0), + D3DX10_FILTER_POINT = (2 << 0), + D3DX10_FILTER_LINEAR = (3 << 0), + D3DX10_FILTER_TRIANGLE = (4 << 0), + D3DX10_FILTER_BOX = (5 << 0), + + D3DX10_FILTER_MIRROR_U = (1 << 16), + D3DX10_FILTER_MIRROR_V = (2 << 16), + D3DX10_FILTER_MIRROR_W = (4 << 16), + D3DX10_FILTER_MIRROR = (7 << 16), + + D3DX10_FILTER_DITHER = (1 << 19), + D3DX10_FILTER_DITHER_DIFFUSION= (2 << 19), + + D3DX10_FILTER_SRGB_IN = (1 << 21), + D3DX10_FILTER_SRGB_OUT = (2 << 21), + D3DX10_FILTER_SRGB = (3 << 21), +} D3DX10_FILTER_FLAG; + +//---------------------------------------------------------------------------- +// D3DX10_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DX10ComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX10_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX10_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX10_NORMALMAP_MIRROR +// Same as specifying D3DX10_NORMALMAP_MIRROR_U | D3DX10_NORMALMAP_MIRROR_V +// D3DX10_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX10_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_NORMALMAP_FLAG +{ + D3DX10_NORMALMAP_MIRROR_U = (1 << 16), + D3DX10_NORMALMAP_MIRROR_V = (2 << 16), + D3DX10_NORMALMAP_MIRROR = (3 << 16), + D3DX10_NORMALMAP_INVERTSIGN = (8 << 16), + D3DX10_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16), +} D3DX10_NORMALMAP_FLAG; + +//---------------------------------------------------------------------------- +// D3DX10_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX10_CHANNEL_RED +// Indicates the red channel should be used +// D3DX10_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX10_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX10_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX10_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_CHANNEL_FLAG +{ + D3DX10_CHANNEL_RED = (1 << 0), + D3DX10_CHANNEL_BLUE = (1 << 1), + D3DX10_CHANNEL_GREEN = (1 << 2), + D3DX10_CHANNEL_ALPHA = (1 << 3), + D3DX10_CHANNEL_LUMINANCE = (1 << 4), +} D3DX10_CHANNEL_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_FILE_FORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_IMAGE_FILE_FORMAT +{ + D3DX10_IFF_BMP = 0, + D3DX10_IFF_JPG = 1, + D3DX10_IFF_PNG = 3, + D3DX10_IFF_DDS = 4, + D3DX10_IFF_TIFF = 10, + D3DX10_IFF_GIF = 11, + D3DX10_IFF_WMP = 12, + D3DX10_IFF_FORCE_DWORD = 0x7fffffff + +} D3DX10_IMAGE_FILE_FORMAT; + + +//---------------------------------------------------------------------------- +// D3DX10_SAVE_TEXTURE_FLAG: +// --------------------- +// This enum is used to support texture saving options. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_SAVE_TEXTURE_FLAG +{ + D3DX10_STF_USEINPUTBLOB = 0x0001, +} D3DX10_SAVE_TEXTURE_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// ArraySize +// Array size in textures +// MipLevels +// Number of mip levels in original image +// MiscFlags +// Miscellaneous flags +// Format +// D3D format which most closely describes the data in original image +// ResourceDimension +// D3D10_RESOURCE_DIMENSION representing the dimension of texture stored in the file. +// D3D10_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D +// ImageFileFormat +// D3DX10_IMAGE_FILE_FORMAT representing the format of the image file. +//---------------------------------------------------------------------------- + +typedef struct D3DX10_IMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT ArraySize; + UINT MipLevels; + UINT MiscFlags; + DXGI_FORMAT Format; + D3D10_RESOURCE_DIMENSION ResourceDimension; + D3DX10_IMAGE_FILE_FORMAT ImageFileFormat; +} D3DX10_IMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_LOAD_INFO: +// --------------- +// This structure can be optionally passed in to texture loader APIs to +// control how textures get loaded. Pass in D3DX10_DEFAULT for any of these +// to have D3DX automatically pick defaults based on the source file. +// +// Width +// Rescale texture to Width texels wide +// Height +// Rescale texture to Height texels high +// Depth +// Rescale texture to Depth texels deep +// FirstMipLevel +// First mip level to load +// MipLevels +// Number of mip levels to load after the first level +// Usage +// D3D10_USAGE flag for the new texture +// BindFlags +// D3D10 Bind flags for the new texture +// CpuAccessFlags +// D3D10 CPU Access flags for the new texture +// MiscFlags +// Reserved. Must be 0 +// Format +// Resample texture to the specified format +// Filter +// Filter the texture using the specified filter (only when resampling) +// MipFilter +// Filter the texture mip levels using the specified filter (only if +// generating mips) +// pSrcInfo +// (optional) pointer to a D3DX10_IMAGE_INFO structure that will get +// populated with source image information +//---------------------------------------------------------------------------- + + +typedef struct D3DX10_IMAGE_LOAD_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT FirstMipLevel; + UINT MipLevels; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CpuAccessFlags; + UINT MiscFlags; + DXGI_FORMAT Format; + UINT Filter; + UINT MipFilter; + D3DX10_IMAGE_INFO* pSrcInfo; + +#ifdef __cplusplus + D3DX10_IMAGE_LOAD_INFO() + { + Width = D3DX10_DEFAULT; + Height = D3DX10_DEFAULT; + Depth = D3DX10_DEFAULT; + FirstMipLevel = D3DX10_DEFAULT; + MipLevels = D3DX10_DEFAULT; + Usage = (D3D10_USAGE) D3DX10_DEFAULT; + BindFlags = D3DX10_DEFAULT; + CpuAccessFlags = D3DX10_DEFAULT; + MiscFlags = D3DX10_DEFAULT; + Format = DXGI_FORMAT_FROM_FILE; + Filter = D3DX10_DEFAULT; + MipFilter = D3DX10_DEFAULT; + pSrcInfo = NULL; + } +#endif + +} D3DX10_IMAGE_LOAD_INFO; + +//------------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource/Memory: +// ------------------------------ +// Fills in a D3DX10_IMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name. +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pPump +// Optional pointer to a thread pump object to use. +// pSrcInfo +// Pointer to a D3DX10_IMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//------------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10GetImageInfoFromFileA( + LPCSTR pSrcFile, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10GetImageInfoFromFileW( + LPCWSTR pSrcFile, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileW +#else +#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DX10GetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10GetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceW +#else +#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DX10GetImageInfoFromMemory( + LPCVOID pSrcData, + SIZE_T SrcDataSize, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10CreateTextureFromFile/Resource/Memory: +// D3DX10CreateShaderResourceViewFromFile/Resource/Memory: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pLoadInfo +// Optional pointer to a D3DX10_IMAGE_LOAD_INFO structure that +// contains additional loader parameters. +// pPump +// Optional pointer to a thread pump object to use. +// ppTexture +// [out] Created texture object. +// ppShaderResourceView +// [out] Shader resource view object created. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromFileA( + ID3D10Device* pDevice, + LPCSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromFileW( + ID3D10Device* pDevice, + LPCWSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileW +#else +#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileA +#endif + +HRESULT WINAPI + D3DX10CreateTextureFromFileA( + ID3D10Device* pDevice, + LPCSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromFileW( + ID3D10Device* pDevice, + LPCWSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileW +#else +#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileA +#endif + + +// FromResource (resources in dll/exes) + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromResourceA( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromResourceW( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceW +#else +#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceA +#endif + +HRESULT WINAPI + D3DX10CreateTextureFromResourceA( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromResourceW( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceW +#else +#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromMemory( + ID3D10Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromMemory( + ID3D10Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10_TEXTURE_LOAD_INFO: +// ------------------------ +// +//---------------------------------------------------------------------------- + +typedef struct _D3DX10_TEXTURE_LOAD_INFO +{ + D3D10_BOX *pSrcBox; + D3D10_BOX *pDstBox; + UINT SrcFirstMip; + UINT DstFirstMip; + UINT NumMips; + UINT SrcFirstElement; + UINT DstFirstElement; + UINT NumElements; + UINT Filter; + UINT MipFilter; + +#ifdef __cplusplus + _D3DX10_TEXTURE_LOAD_INFO() + { + pSrcBox = NULL; + pDstBox = NULL; + SrcFirstMip = 0; + DstFirstMip = 0; + NumMips = D3DX10_DEFAULT; + SrcFirstElement = 0; + DstFirstElement = 0; + NumElements = D3DX10_DEFAULT; + Filter = D3DX10_DEFAULT; + MipFilter = D3DX10_DEFAULT; + } +#endif + +} D3DX10_TEXTURE_LOAD_INFO; + + +//---------------------------------------------------------------------------- +// D3DX10LoadTextureFromTexture: +// ---------------------------- +// Load a texture from a texture. +// +// Parameters: +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DX10LoadTextureFromTexture( + ID3D10Resource *pSrcTexture, + D3DX10_TEXTURE_LOAD_INFO *pLoadInfo, + ID3D10Resource *pDstTexture); + + +//---------------------------------------------------------------------------- +// D3DX10FilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// MipFilter +// D3DX10_FILTER flags controlling how each miplevel is filtered. +// Or D3DX10_DEFAULT for D3DX10_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10FilterTexture( + ID3D10Resource *pTexture, + UINT SrcLevel, + UINT MipFilter); + + +//---------------------------------------------------------------------------- +// D3DX10SaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SaveTextureToFileA( + ID3D10Resource *pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPCSTR pDestFile); + +HRESULT WINAPI + D3DX10SaveTextureToFileW( + ID3D10Resource *pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPCWSTR pDestFile); + +#ifdef UNICODE +#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileW +#else +#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DX10SaveTextureToMemory: +// ---------------------- +// Save a texture to a blob. +// +// Parameters: +// pSrcTexture +// Source texture, containing the image to be saved +// DestFormat +// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving. +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// Flags +// optional flags +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SaveTextureToMemory( + ID3D10Resource* pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPD3D10BLOB* ppDestBuf, + UINT Flags); + + +//---------------------------------------------------------------------------- +// D3DX10ComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pSrcTexture +// Pointer to the source heightmap texture +// Flags +// D3DX10_NORMALMAP flags +// Channel +// D3DX10_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +// pDestTexture +// Pointer to the destination texture +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10ComputeNormalMap( + ID3D10Texture2D *pSrcTexture, + UINT Flags, + UINT Channel, + FLOAT Amplitude, + ID3D10Texture2D *pDestTexture); + + +//---------------------------------------------------------------------------- +// D3DX10SHProjectCubeMap: +// ---------------------- +// Projects a function represented in a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SHProjectCubeMap( + __in_range(2,6) UINT Order, + ID3D10Texture2D *pCubeMap, + __out_ecount(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX10TEX_H__ + diff --git a/SDK/dxSDK/Include/DXGI.h b/SDK/dxSDK/Include/DXGI.h new file mode 100644 index 00000000..8d9d83e8 --- /dev/null +++ b/SDK/dxSDK/Include/DXGI.h @@ -0,0 +1,1804 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0499 */ +/* Compiler settings for dxgi.idl: + Oicf, W1, Zp8, env=Win64 (32b run) + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxgi_h__ +#define __dxgi_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXGIObject_FWD_DEFINED__ +#define __IDXGIObject_FWD_DEFINED__ +typedef interface IDXGIObject IDXGIObject; +#endif /* __IDXGIObject_FWD_DEFINED__ */ + + +#ifndef __IDXGIDeviceSubObject_FWD_DEFINED__ +#define __IDXGIDeviceSubObject_FWD_DEFINED__ +typedef interface IDXGIDeviceSubObject IDXGIDeviceSubObject; +#endif /* __IDXGIDeviceSubObject_FWD_DEFINED__ */ + + +#ifndef __IDXGIResource_FWD_DEFINED__ +#define __IDXGIResource_FWD_DEFINED__ +typedef interface IDXGIResource IDXGIResource; +#endif /* __IDXGIResource_FWD_DEFINED__ */ + + +#ifndef __IDXGISurface_FWD_DEFINED__ +#define __IDXGISurface_FWD_DEFINED__ +typedef interface IDXGISurface IDXGISurface; +#endif /* __IDXGISurface_FWD_DEFINED__ */ + + +#ifndef __IDXGIAdapter_FWD_DEFINED__ +#define __IDXGIAdapter_FWD_DEFINED__ +typedef interface IDXGIAdapter IDXGIAdapter; +#endif /* __IDXGIAdapter_FWD_DEFINED__ */ + + +#ifndef __IDXGIOutput_FWD_DEFINED__ +#define __IDXGIOutput_FWD_DEFINED__ +typedef interface IDXGIOutput IDXGIOutput; +#endif /* __IDXGIOutput_FWD_DEFINED__ */ + + +#ifndef __IDXGISwapChain_FWD_DEFINED__ +#define __IDXGISwapChain_FWD_DEFINED__ +typedef interface IDXGISwapChain IDXGISwapChain; +#endif /* __IDXGISwapChain_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory_FWD_DEFINED__ +#define __IDXGIFactory_FWD_DEFINED__ +typedef interface IDXGIFactory IDXGIFactory; +#endif /* __IDXGIFactory_FWD_DEFINED__ */ + + +#ifndef __IDXGIDevice_FWD_DEFINED__ +#define __IDXGIDevice_FWD_DEFINED__ +typedef interface IDXGIDevice IDXGIDevice; +#endif /* __IDXGIDevice_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "dxgitype.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxgi_0000_0000 */ +/* [local] */ + +#define DXGI_CPU_ACCESS_NONE ( 0 ) +#define DXGI_CPU_ACCESS_DYNAMIC ( 1 ) +#define DXGI_CPU_ACCESS_READ_WRITE ( 2 ) +#define DXGI_CPU_ACCESS_SCRATCH ( 3 ) +#define DXGI_CPU_ACCESS_FIELD 15 +#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) ) +#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) ) +#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) ) +#define DXGI_USAGE_SHARED ( 1L << (3 + 4) ) +#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) ) +#define DXGI_USAGE_DISCARD_ON_PRESENT ( 1L << (5 + 4) ) +typedef UINT DXGI_USAGE; + +typedef struct DXGI_FRAME_STATISTICS + { + UINT PresentCount; + UINT PresentRefreshCount; + UINT SyncRefreshCount; + LARGE_INTEGER SyncQPCTime; + LARGE_INTEGER SyncGPUTime; + } DXGI_FRAME_STATISTICS; + +typedef struct DXGI_MAPPED_RECT + { + INT Pitch; + BYTE *pBits; + } DXGI_MAPPED_RECT; + +#ifdef __midl +typedef struct _LUID + { + DWORD LowPart; + LONG HighPart; + } LUID; + +typedef struct _LUID *PLUID; + +#endif +typedef struct DXGI_ADAPTER_DESC + { + WCHAR Description[ 128 ]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; + } DXGI_ADAPTER_DESC; + +#if !defined(HMONITOR_DECLARED) && !defined(HMONITOR) && (WINVER < 0x0500) +#define HMONITOR_DECLARED +#if 0 +typedef HANDLE HMONITOR; + +#endif +DECLARE_HANDLE(HMONITOR); +#endif +typedef struct DXGI_OUTPUT_DESC + { + WCHAR DeviceName[ 32 ]; + RECT DesktopCoordinates; + BOOL AttachedToDesktop; + DXGI_MODE_ROTATION Rotation; + HMONITOR Monitor; + } DXGI_OUTPUT_DESC; + +typedef struct DXGI_SHARED_RESOURCE + { + HANDLE Handle; + } DXGI_SHARED_RESOURCE; + +#define DXGI_RESOURCE_PRIORITY_MINIMUM ( 0x28000000 ) + +#define DXGI_RESOURCE_PRIORITY_LOW ( 0x50000000 ) + +#define DXGI_RESOURCE_PRIORITY_NORMAL ( 0x78000000 ) + +#define DXGI_RESOURCE_PRIORITY_HIGH ( 0xa0000000 ) + +#define DXGI_RESOURCE_PRIORITY_MAXIMUM ( 0xc8000000 ) + +typedef +enum DXGI_RESIDENCY + { DXGI_RESIDENCY_FULLY_RESIDENT = 1, + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3 + } DXGI_RESIDENCY; + +typedef struct DXGI_SURFACE_DESC + { + UINT Width; + UINT Height; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + } DXGI_SURFACE_DESC; + +typedef +enum DXGI_SWAP_EFFECT + { DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1 + } DXGI_SWAP_EFFECT; + +typedef +enum DXGI_SWAP_CHAIN_FLAG + { DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2 + } DXGI_SWAP_CHAIN_FLAG; + +typedef struct DXGI_SWAP_CHAIN_DESC + { + DXGI_MODE_DESC BufferDesc; + DXGI_SAMPLE_DESC SampleDesc; + DXGI_USAGE BufferUsage; + UINT BufferCount; + HWND OutputWindow; + BOOL Windowed; + DXGI_SWAP_EFFECT SwapEffect; + UINT Flags; + } DXGI_SWAP_CHAIN_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_s_ifspec; + +#ifndef __IDXGIObject_INTERFACE_DEFINED__ +#define __IDXGIObject_INTERFACE_DEFINED__ + +/* interface IDXGIObject */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("aec22fb8-76f3-4639-9be0-28eb43a67a2e") + IDXGIObject : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetParent( + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIObject * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIObject * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIObject * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIObject * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIObject * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIObject * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + END_INTERFACE + } IDXGIObjectVtbl; + + interface IDXGIObject + { + CONST_VTBL struct IDXGIObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIObject_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIObject_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIObject_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIObject_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIObject_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIDeviceSubObject_INTERFACE_DEFINED__ +#define __IDXGIDeviceSubObject_INTERFACE_DEFINED__ + +/* interface IDXGIDeviceSubObject */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDeviceSubObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3d3e0379-f9de-4d58-bb6c-18d62992f1a6") + IDXGIDeviceSubObject : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDevice( + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppDevice) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIDeviceSubObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDeviceSubObject * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDeviceSubObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDeviceSubObject * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDeviceSubObject * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDeviceSubObject * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDeviceSubObject * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDeviceSubObject * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGIDeviceSubObject * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppDevice); + + END_INTERFACE + } IDXGIDeviceSubObjectVtbl; + + interface IDXGIDeviceSubObject + { + CONST_VTBL struct IDXGIDeviceSubObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDeviceSubObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDeviceSubObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDeviceSubObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDeviceSubObject_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDeviceSubObject_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDeviceSubObject_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDeviceSubObject_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDeviceSubObject_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDeviceSubObject_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIResource_INTERFACE_DEFINED__ +#define __IDXGIResource_INTERFACE_DEFINED__ + +/* interface IDXGIResource */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIResource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("035f3ab4-482e-4e50-b41f-8a7f8bd8960b") + IDXGIResource : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSharedHandle( + /* [out] */ HANDLE *pSharedHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetUsage( + /* [out] */ DXGI_USAGE *pUsage) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( + /* [in] */ UINT EvictionPriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority( + /* [retval][out] */ UINT *pEvictionPriority) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIResourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIResource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIResource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIResource * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIResource * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIResource * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIResource * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIResource * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGIResource * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetSharedHandle )( + IDXGIResource * This, + /* [out] */ HANDLE *pSharedHandle); + + HRESULT ( STDMETHODCALLTYPE *GetUsage )( + IDXGIResource * This, + /* [out] */ DXGI_USAGE *pUsage); + + HRESULT ( STDMETHODCALLTYPE *SetEvictionPriority )( + IDXGIResource * This, + /* [in] */ UINT EvictionPriority); + + HRESULT ( STDMETHODCALLTYPE *GetEvictionPriority )( + IDXGIResource * This, + /* [retval][out] */ UINT *pEvictionPriority); + + END_INTERFACE + } IDXGIResourceVtbl; + + interface IDXGIResource + { + CONST_VTBL struct IDXGIResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIResource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIResource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIResource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIResource_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIResource_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIResource_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIResource_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIResource_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGIResource_GetSharedHandle(This,pSharedHandle) \ + ( (This)->lpVtbl -> GetSharedHandle(This,pSharedHandle) ) + +#define IDXGIResource_GetUsage(This,pUsage) \ + ( (This)->lpVtbl -> GetUsage(This,pUsage) ) + +#define IDXGIResource_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define IDXGIResource_GetEvictionPriority(This,pEvictionPriority) \ + ( (This)->lpVtbl -> GetEvictionPriority(This,pEvictionPriority) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIResource_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0003 */ +/* [local] */ + +#define DXGI_MAP_READ ( 1UL ) + +#define DXGI_MAP_WRITE ( 2UL ) + +#define DXGI_MAP_DISCARD ( 4UL ) + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0003_v0_0_s_ifspec; + +#ifndef __IDXGISurface_INTERFACE_DEFINED__ +#define __IDXGISurface_INTERFACE_DEFINED__ + +/* interface IDXGISurface */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("cafcb56c-6ac3-4889-bf47-9e23bbd260ec") + IDXGISurface : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [out] */ DXGI_SURFACE_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE Map( + /* [out] */ DXGI_MAPPED_RECT *pLockedRect, + /* [in] */ UINT MapFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Unmap( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGISurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISurface * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISurface * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISurface * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISurface * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISurface * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISurface * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISurface * This, + /* [out] */ DXGI_SURFACE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *Map )( + IDXGISurface * This, + /* [out] */ DXGI_MAPPED_RECT *pLockedRect, + /* [in] */ UINT MapFlags); + + HRESULT ( STDMETHODCALLTYPE *Unmap )( + IDXGISurface * This); + + END_INTERFACE + } IDXGISurfaceVtbl; + + interface IDXGISurface + { + CONST_VTBL struct IDXGISurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISurface_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISurface_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISurface_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISurface_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISurface_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISurface_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISurface_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISurface_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISurface_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISurface_Map(This,pLockedRect,MapFlags) \ + ( (This)->lpVtbl -> Map(This,pLockedRect,MapFlags) ) + +#define IDXGISurface_Unmap(This) \ + ( (This)->lpVtbl -> Unmap(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISurface_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0004 */ +/* [local] */ + + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_s_ifspec; + +#ifndef __IDXGIAdapter_INTERFACE_DEFINED__ +#define __IDXGIAdapter_INTERFACE_DEFINED__ + +/* interface IDXGIAdapter */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIAdapter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2411e7e1-12ac-4ccf-bd14-9798e8534dc0") + IDXGIAdapter : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumOutputs( + /* [in] */ UINT Output, + /* [out][in] */ IDXGIOutput **ppOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [out] */ DXGI_ADAPTER_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( + /* [in] */ REFGUID InterfaceName, + /* [out] */ LARGE_INTEGER *pUMDVersion) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIAdapterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIAdapter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIAdapter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIAdapter * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIAdapter * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIAdapter * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIAdapter * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIAdapter * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumOutputs )( + IDXGIAdapter * This, + /* [in] */ UINT Output, + /* [out][in] */ IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIAdapter * This, + /* [out] */ DXGI_ADAPTER_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *CheckInterfaceSupport )( + IDXGIAdapter * This, + /* [in] */ REFGUID InterfaceName, + /* [out] */ LARGE_INTEGER *pUMDVersion); + + END_INTERFACE + } IDXGIAdapterVtbl; + + interface IDXGIAdapter + { + CONST_VTBL struct IDXGIAdapterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIAdapter_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIAdapter_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIAdapter_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIAdapter_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIAdapter_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIAdapter_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIAdapter_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIAdapter_EnumOutputs(This,Output,ppOutput) \ + ( (This)->lpVtbl -> EnumOutputs(This,Output,ppOutput) ) + +#define IDXGIAdapter_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIAdapter_CheckInterfaceSupport(This,InterfaceName,pUMDVersion) \ + ( (This)->lpVtbl -> CheckInterfaceSupport(This,InterfaceName,pUMDVersion) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIAdapter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0005 */ +/* [local] */ + +#define DXGI_ENUM_MODES_INTERLACED ( 1UL ) + +#define DXGI_ENUM_MODES_SCALING ( 2UL ) + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0005_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0005_v0_0_s_ifspec; + +#ifndef __IDXGIOutput_INTERFACE_DEFINED__ +#define __IDXGIOutput_INTERFACE_DEFINED__ + +/* interface IDXGIOutput */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIOutput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ae02eedb-c735-4690-8d52-5a8dc20213aa") + IDXGIOutput : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [out] */ DXGI_OUTPUT_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [out][in] */ UINT *pNumModes, + /* [out] */ DXGI_MODE_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( + /* [in] */ const DXGI_MODE_DESC *pModeToMatch, + /* [out] */ DXGI_MODE_DESC *pClosestMatch, + /* [in] */ IUnknown *pConcernedDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitForVBlank( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE TakeOwnership( + /* [in] */ IUnknown *pDevice, + BOOL Exclusive) = 0; + + virtual void STDMETHODCALLTYPE ReleaseOwnership( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( + /* [out] */ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGammaControl( + /* [in] */ const DXGI_GAMMA_CONTROL *pArray) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGammaControl( + /* [out] */ DXGI_GAMMA_CONTROL *pArray) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( + /* [in] */ IDXGISurface *pScanoutSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( + /* [in] */ IDXGISurface *pDestination) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + /* [out] */ DXGI_FRAME_STATISTICS *pStats) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIOutputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIOutput * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIOutput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIOutput * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIOutput * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIOutput * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIOutput * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIOutput * This, + /* [out] */ DXGI_OUTPUT_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList )( + IDXGIOutput * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [out][in] */ UINT *pNumModes, + /* [out] */ DXGI_MODE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode )( + IDXGIOutput * This, + /* [in] */ const DXGI_MODE_DESC *pModeToMatch, + /* [out] */ DXGI_MODE_DESC *pClosestMatch, + /* [in] */ IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *WaitForVBlank )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *TakeOwnership )( + IDXGIOutput * This, + /* [in] */ IUnknown *pDevice, + BOOL Exclusive); + + void ( STDMETHODCALLTYPE *ReleaseOwnership )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControlCapabilities )( + IDXGIOutput * This, + /* [out] */ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps); + + HRESULT ( STDMETHODCALLTYPE *SetGammaControl )( + IDXGIOutput * This, + /* [in] */ const DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControl )( + IDXGIOutput * This, + /* [out] */ DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *SetDisplaySurface )( + IDXGIOutput * This, + /* [in] */ IDXGISurface *pScanoutSurface); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData )( + IDXGIOutput * This, + /* [in] */ IDXGISurface *pDestination); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGIOutput * This, + /* [out] */ DXGI_FRAME_STATISTICS *pStats); + + END_INTERFACE + } IDXGIOutputVtbl; + + interface IDXGIOutput + { + CONST_VTBL struct IDXGIOutputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIOutput_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIOutput_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIOutput_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIOutput_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIOutput_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIOutput_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIOutput_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIOutput_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIOutput_GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput_FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput_WaitForVBlank(This) \ + ( (This)->lpVtbl -> WaitForVBlank(This) ) + +#define IDXGIOutput_TakeOwnership(This,pDevice,Exclusive) \ + ( (This)->lpVtbl -> TakeOwnership(This,pDevice,Exclusive) ) + +#define IDXGIOutput_ReleaseOwnership(This) \ + ( (This)->lpVtbl -> ReleaseOwnership(This) ) + +#define IDXGIOutput_GetGammaControlCapabilities(This,pGammaCaps) \ + ( (This)->lpVtbl -> GetGammaControlCapabilities(This,pGammaCaps) ) + +#define IDXGIOutput_SetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> SetGammaControl(This,pArray) ) + +#define IDXGIOutput_GetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> GetGammaControl(This,pArray) ) + +#define IDXGIOutput_SetDisplaySurface(This,pScanoutSurface) \ + ( (This)->lpVtbl -> SetDisplaySurface(This,pScanoutSurface) ) + +#define IDXGIOutput_GetDisplaySurfaceData(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData(This,pDestination) ) + +#define IDXGIOutput_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIOutput_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0006 */ +/* [local] */ + +#define DXGI_MAX_SWAP_CHAIN_BUFFERS ( 16 ) +#define DXGI_PRESENT_TEST 0x00000001UL +#define DXGI_PRESENT_DO_NOT_SEQUENCE 0x00000002UL +#define DXGI_PRESENT_RESTART 0x00000004UL + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_s_ifspec; + +#ifndef __IDXGISwapChain_INTERFACE_DEFINED__ +#define __IDXGISwapChain_INTERFACE_DEFINED__ + +/* interface IDXGISwapChain */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISwapChain; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a") + IDXGISwapChain : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE Present( + /* [in] */ UINT SyncInterval, + /* [in] */ UINT Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBuffer( + /* [in] */ UINT Buffer, + /* [in] */ REFIID riid, + /* [out][in] */ void **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( + /* [in] */ BOOL Fullscreen, + /* [in] */ IDXGIOutput *pTarget) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( + /* [out] */ BOOL *pFullscreen, + /* [out] */ IDXGIOutput **ppTarget) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [out] */ DXGI_SWAP_CHAIN_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResizeBuffers( + /* [in] */ UINT BufferCount, + /* [in] */ UINT Width, + /* [in] */ UINT Height, + /* [in] */ DXGI_FORMAT NewFormat, + /* [in] */ UINT SwapChainFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResizeTarget( + /* [in] */ const DXGI_MODE_DESC *pNewTargetParameters) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( + IDXGIOutput **ppOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + /* [out] */ DXGI_FRAME_STATISTICS *pStats) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( + /* [out] */ UINT *pLastPresentCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGISwapChainVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISwapChain * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISwapChain * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISwapChain * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISwapChain * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISwapChain * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISwapChain * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISwapChain * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISwapChain * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *Present )( + IDXGISwapChain * This, + /* [in] */ UINT SyncInterval, + /* [in] */ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetBuffer )( + IDXGISwapChain * This, + /* [in] */ UINT Buffer, + /* [in] */ REFIID riid, + /* [out][in] */ void **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *SetFullscreenState )( + IDXGISwapChain * This, + /* [in] */ BOOL Fullscreen, + /* [in] */ IDXGIOutput *pTarget); + + HRESULT ( STDMETHODCALLTYPE *GetFullscreenState )( + IDXGISwapChain * This, + /* [out] */ BOOL *pFullscreen, + /* [out] */ IDXGIOutput **ppTarget); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISwapChain * This, + /* [out] */ DXGI_SWAP_CHAIN_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *ResizeBuffers )( + IDXGISwapChain * This, + /* [in] */ UINT BufferCount, + /* [in] */ UINT Width, + /* [in] */ UINT Height, + /* [in] */ DXGI_FORMAT NewFormat, + /* [in] */ UINT SwapChainFlags); + + HRESULT ( STDMETHODCALLTYPE *ResizeTarget )( + IDXGISwapChain * This, + /* [in] */ const DXGI_MODE_DESC *pNewTargetParameters); + + HRESULT ( STDMETHODCALLTYPE *GetContainingOutput )( + IDXGISwapChain * This, + IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGISwapChain * This, + /* [out] */ DXGI_FRAME_STATISTICS *pStats); + + HRESULT ( STDMETHODCALLTYPE *GetLastPresentCount )( + IDXGISwapChain * This, + /* [out] */ UINT *pLastPresentCount); + + END_INTERFACE + } IDXGISwapChainVtbl; + + interface IDXGISwapChain + { + CONST_VTBL struct IDXGISwapChainVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISwapChain_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISwapChain_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISwapChain_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISwapChain_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISwapChain_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISwapChain_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISwapChain_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISwapChain_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISwapChain_Present(This,SyncInterval,Flags) \ + ( (This)->lpVtbl -> Present(This,SyncInterval,Flags) ) + +#define IDXGISwapChain_GetBuffer(This,Buffer,riid,ppSurface) \ + ( (This)->lpVtbl -> GetBuffer(This,Buffer,riid,ppSurface) ) + +#define IDXGISwapChain_SetFullscreenState(This,Fullscreen,pTarget) \ + ( (This)->lpVtbl -> SetFullscreenState(This,Fullscreen,pTarget) ) + +#define IDXGISwapChain_GetFullscreenState(This,pFullscreen,ppTarget) \ + ( (This)->lpVtbl -> GetFullscreenState(This,pFullscreen,ppTarget) ) + +#define IDXGISwapChain_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISwapChain_ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) \ + ( (This)->lpVtbl -> ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) ) + +#define IDXGISwapChain_ResizeTarget(This,pNewTargetParameters) \ + ( (This)->lpVtbl -> ResizeTarget(This,pNewTargetParameters) ) + +#define IDXGISwapChain_GetContainingOutput(This,ppOutput) \ + ( (This)->lpVtbl -> GetContainingOutput(This,ppOutput) ) + +#define IDXGISwapChain_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + +#define IDXGISwapChain_GetLastPresentCount(This,pLastPresentCount) \ + ( (This)->lpVtbl -> GetLastPresentCount(This,pLastPresentCount) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISwapChain_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0007 */ +/* [local] */ + +#define DXGI_MWA_NO_WINDOW_CHANGES ( 1 << 0 ) +#define DXGI_MWA_NO_ALT_ENTER ( 1 << 1 ) +#define DXGI_MWA_NO_PRINT_SCREEN ( 1 << 2 ) +#define DXGI_MWA_VALID ( 0x7 ) + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_s_ifspec; + +#ifndef __IDXGIFactory_INTERFACE_DEFINED__ +#define __IDXGIFactory_INTERFACE_DEFINED__ + +/* interface IDXGIFactory */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7b7166ec-21c7-44ae-b21a-c9ae321ae369") + IDXGIFactory : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumAdapters( + /* [in] */ UINT Adapter, + /* [out] */ IDXGIAdapter **ppAdapter) = 0; + + virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( + HWND WindowHandle, + UINT Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( + HWND *pWindowHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( + IUnknown *pDevice, + DXGI_SWAP_CHAIN_DESC *pDesc, + IDXGISwapChain **ppSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( + /* [in] */ HMODULE Module, + /* [out] */ IDXGIAdapter **ppAdapter) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory * This, + /* [in] */ UINT Adapter, + /* [out] */ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory * This, + HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory * This, + IUnknown *pDevice, + DXGI_SWAP_CHAIN_DESC *pDesc, + IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory * This, + /* [in] */ HMODULE Module, + /* [out] */ IDXGIAdapter **ppAdapter); + + END_INTERFACE + } IDXGIFactoryVtbl; + + interface IDXGIFactory + { + CONST_VTBL struct IDXGIFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0008 */ +/* [local] */ + +HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **ppFactory); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_s_ifspec; + +#ifndef __IDXGIDevice_INTERFACE_DEFINED__ +#define __IDXGIDevice_INTERFACE_DEFINED__ + +/* interface IDXGIDevice */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("54ec77fa-1377-44e6-8c32-88fd5f44c84c") + IDXGIDevice : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAdapter( + /* [out] */ IDXGIAdapter **pAdapter) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + /* [in] */ const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [in] */ const DXGI_SHARED_RESOURCE *pSharedResource, + /* [out] */ IDXGISurface **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency( + /* [size_is][in] */ IUnknown *const *ppResources, + /* [size_is][out] */ DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority( + /* [in] */ INT Priority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority( + /* [retval][out] */ INT *pPriority) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIDeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDevice * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDevice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDevice * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDevice * This, + /* [in] */ REFGUID Name, + /* [in] */ UINT DataSize, + /* [in] */ const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDevice * This, + /* [in] */ REFGUID Name, + /* [in] */ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDevice * This, + /* [in] */ REFGUID Name, + /* [out][in] */ UINT *pDataSize, + /* [out] */ void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDevice * This, + /* [in] */ REFIID riid, + /* [retval][out] */ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetAdapter )( + IDXGIDevice * This, + /* [out] */ IDXGIAdapter **pAdapter); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXGIDevice * This, + /* [in] */ const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [in] */ const DXGI_SHARED_RESOURCE *pSharedResource, + /* [out] */ IDXGISurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *QueryResourceResidency )( + IDXGIDevice * This, + /* [size_is][in] */ IUnknown *const *ppResources, + /* [size_is][out] */ DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources); + + HRESULT ( STDMETHODCALLTYPE *SetGPUThreadPriority )( + IDXGIDevice * This, + /* [in] */ INT Priority); + + HRESULT ( STDMETHODCALLTYPE *GetGPUThreadPriority )( + IDXGIDevice * This, + /* [retval][out] */ INT *pPriority); + + END_INTERFACE + } IDXGIDeviceVtbl; + + interface IDXGIDevice + { + CONST_VTBL struct IDXGIDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDevice_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDevice_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDevice_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDevice_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDevice_GetAdapter(This,pAdapter) \ + ( (This)->lpVtbl -> GetAdapter(This,pAdapter) ) + +#define IDXGIDevice_CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) \ + ( (This)->lpVtbl -> CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) ) + +#define IDXGIDevice_QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) \ + ( (This)->lpVtbl -> QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) ) + +#define IDXGIDevice_SetGPUThreadPriority(This,Priority) \ + ( (This)->lpVtbl -> SetGPUThreadPriority(This,Priority) ) + +#define IDXGIDevice_GetGPUThreadPriority(This,pPriority) \ + ( (This)->lpVtbl -> GetGPUThreadPriority(This,pPriority) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDevice_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0009 */ +/* [local] */ + +#ifdef __cplusplus +#endif /*__cplusplus*/ +DEFINE_GUID(IID_IDXGIObject,0xaec22fb8,0x76f3,0x4639,0x9b,0xe0,0x28,0xeb,0x43,0xa6,0x7a,0x2e); +DEFINE_GUID(IID_IDXGIDeviceSubObject,0x3d3e0379,0xf9de,0x4d58,0xbb,0x6c,0x18,0xd6,0x29,0x92,0xf1,0xa6); +DEFINE_GUID(IID_IDXGIResource,0x035f3ab4,0x482e,0x4e50,0xb4,0x1f,0x8a,0x7f,0x8b,0xd8,0x96,0x0b); +DEFINE_GUID(IID_IDXGISurface,0xcafcb56c,0x6ac3,0x4889,0xbf,0x47,0x9e,0x23,0xbb,0xd2,0x60,0xec); +DEFINE_GUID(IID_IDXGIAdapter,0x2411e7e1,0x12ac,0x4ccf,0xbd,0x14,0x97,0x98,0xe8,0x53,0x4d,0xc0); +DEFINE_GUID(IID_IDXGIOutput,0xae02eedb,0xc735,0x4690,0x8d,0x52,0x5a,0x8d,0xc2,0x02,0x13,0xaa); +DEFINE_GUID(IID_IDXGISwapChain,0x310d36a0,0xd2e7,0x4c0a,0xaa,0x04,0x6a,0x9d,0x23,0xb8,0x88,0x6a); +DEFINE_GUID(IID_IDXGIFactory,0x7b7166ec,0x21c7,0x44ae,0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69); +DEFINE_GUID(IID_IDXGIDevice,0x54ec77fa,0x1377,0x44e6,0x8c,0x32,0x88,0xfd,0x5f,0x44,0xc8,0x4c); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/DXGIType.h b/SDK/dxSDK/Include/DXGIType.h new file mode 100644 index 00000000..f6dd3141 --- /dev/null +++ b/SDK/dxSDK/Include/DXGIType.h @@ -0,0 +1,261 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0499 */ +/* Compiler settings for dxgitype.idl: + Oicf, W1, Zp8, env=Win64 (32b run) + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + + +#ifndef __dxgitype_h__ +#define __dxgitype_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxgitype_0000_0000 */ +/* [local] */ + +#define _FACDXGI 0x87a +#define MAKE_DXGI_HRESULT( code ) MAKE_HRESULT( 1, _FACDXGI, code ) +#define MAKE_DXGI_STATUS( code ) MAKE_HRESULT( 0, _FACDXGI, code ) +#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1 ) +#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2 ) +#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4 ) +#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5 ) +#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6 ) +#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7 ) +#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8 ) +#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT( 1 ) +#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT( 2 ) +#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT( 3 ) +#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT( 4 ) +#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT( 5 ) +#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT( 6 ) +#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT( 7 ) +#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT( 10 ) +#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT( 11 ) +#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT( 12 ) +#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT( 32 ) +#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT( 33 ) +#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT( 34 ) +#define DXGI_FORMAT_DEFINED 1 +typedef +enum DXGI_FORMAT + { DXGI_FORMAT_UNKNOWN = 0, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + DXGI_FORMAT_R11G11B10_FLOAT = 26, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + DXGI_FORMAT_R1_UNORM = 66, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + DXGI_FORMAT_FORCE_UINT = 0xffffffffUL + } DXGI_FORMAT; + +typedef struct DXGI_RGB + { + float Red; + float Green; + float Blue; + } DXGI_RGB; + +typedef struct DXGI_GAMMA_CONTROL + { + DXGI_RGB Scale; + DXGI_RGB Offset; + DXGI_RGB GammaCurve[ 1025 ]; + } DXGI_GAMMA_CONTROL; + +typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES + { + BOOL ScaleAndOffsetSupported; + float MaxConvertedValue; + float MinConvertedValue; + UINT NumGammaControlPoints; + float ControlPointPositions[ 1025 ]; + } DXGI_GAMMA_CONTROL_CAPABILITIES; + +typedef struct DXGI_RATIONAL + { + UINT Numerator; + UINT Denominator; + } DXGI_RATIONAL; + +typedef +enum DXGI_MODE_SCANLINE_ORDER + { DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3 + } DXGI_MODE_SCANLINE_ORDER; + +typedef +enum DXGI_MODE_SCALING + { DXGI_MODE_SCALING_UNSPECIFIED = 0, + DXGI_MODE_SCALING_CENTERED = 1, + DXGI_MODE_SCALING_STRETCHED = 2 + } DXGI_MODE_SCALING; + +typedef +enum DXGI_MODE_ROTATION + { DXGI_MODE_ROTATION_UNSPECIFIED = 0, + DXGI_MODE_ROTATION_IDENTITY = 1, + DXGI_MODE_ROTATION_ROTATE90 = 2, + DXGI_MODE_ROTATION_ROTATE180 = 3, + DXGI_MODE_ROTATION_ROTATE270 = 4 + } DXGI_MODE_ROTATION; + +typedef struct DXGI_MODE_DESC + { + UINT Width; + UINT Height; + DXGI_RATIONAL RefreshRate; + DXGI_FORMAT Format; + DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; + DXGI_MODE_SCALING Scaling; + } DXGI_MODE_DESC; + +typedef struct DXGI_SAMPLE_DESC + { + UINT Count; + UINT Quality; + } DXGI_SAMPLE_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgitype_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgitype_0000_0000_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/DxErr.h b/SDK/dxSDK/Include/DxErr.h new file mode 100644 index 00000000..c44f607d --- /dev/null +++ b/SDK/dxSDK/Include/DxErr.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR_H_ +#define _DXERR_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString +// +// Desc: Converts a DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorStringA(HRESULT hr); +const WCHAR* WINAPI DXGetErrorStringW(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString DXGetErrorStringW +#else +#define DXGetErrorString DXGetErrorStringA +#endif + + +// +// DXGetErrorDescription +// +// Desc: Returns a string description of a DirectX HRESULT +// +// Args: HRESULT hr Can be any error code from +// XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescriptionA(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescriptionW(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription DXGetErrorDescriptionW +#else + #define DXGetErrorDescription DXGetErrorDescriptionA +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_MSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR_H_ diff --git a/SDK/dxSDK/Include/PIXPlugin.h b/SDK/dxSDK/Include/PIXPlugin.h new file mode 100644 index 00000000..9c249afc --- /dev/null +++ b/SDK/dxSDK/Include/PIXPlugin.h @@ -0,0 +1,120 @@ +//================================================================================================== +// PIXPlugin.h +// +// Microsoft PIX Plugin Header +// +// Copyright (c) Microsoft Corporation, All rights reserved +//================================================================================================== + +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + + +//================================================================================================== +// PIX_PLUGIN_SYSTEM_VERSION - Indicates version of the plugin interface the plugin is built with. +//================================================================================================== +#define PIX_PLUGIN_SYSTEM_VERSION 0x101 + + +//================================================================================================== +// PIXCOUNTERID - A unique identifier for each PIX plugin counter. +//================================================================================================== +typedef int PIXCOUNTERID; + + +//================================================================================================== +// PIXCOUNTERDATATYPE - Indicates what type of data the counter produces. +//================================================================================================== +enum PIXCOUNTERDATATYPE +{ + PCDT_RESERVED, + PCDT_FLOAT, + PCDT_INT, + PCDT_INT64, + PCDT_STRING, +}; + + +//================================================================================================== +// PIXPLUGININFO - This structure is filled out by PIXGetPluginInfo and passed back to PIX. +//================================================================================================== +struct PIXPLUGININFO +{ + // Filled in by caller: + HINSTANCE hinst; + + // Filled in by PIXGetPluginInfo: + WCHAR* pstrPluginName; // Name of plugin + int iPluginVersion; // Version of this particular plugin + int iPluginSystemVersion; // Version of PIX's plugin system this plugin was designed for +}; + + +//================================================================================================== +// PIXCOUNTERINFO - This structure is filled out by PIXGetCounterInfo and passed back to PIX +// to allow PIX to determine information about the counters in the plugin. +//================================================================================================== +struct PIXCOUNTERINFO +{ + PIXCOUNTERID counterID; // Used to uniquely ID this counter + WCHAR* pstrName; // String name of the counter + PIXCOUNTERDATATYPE pcdtDataType; // Data type returned by this counter +}; + + +//================================================================================================== +// PIXGetPluginInfo - This returns basic information about this plugin to PIX. +//================================================================================================== +BOOL WINAPI PIXGetPluginInfo( PIXPLUGININFO* pPIXPluginInfo ); + + +//================================================================================================== +// PIXGetCounterInfo - This returns an array of PIXCOUNTERINFO structs to PIX. +// These PIXCOUNTERINFOs allow PIX to enumerate the counters contained +// in this plugin. +//================================================================================================== +BOOL WINAPI PIXGetCounterInfo( DWORD* pdwReturnCounters, PIXCOUNTERINFO** ppCounterInfoList ); + + +//================================================================================================== +// PIXGetCounterDesc - This is called by PIX to request a description of the indicated counter. +//================================================================================================== +BOOL WINAPI PIXGetCounterDesc( PIXCOUNTERID id, WCHAR** ppstrCounterDesc ); + + +//================================================================================================== +// PIXBeginExperiment - This called by PIX once per counter when instrumentation starts. +//================================================================================================== +BOOL WINAPI PIXBeginExperiment( PIXCOUNTERID id, const WCHAR* pstrApplication ); + + +//================================================================================================== +// PIXEndFrame - This is called by PIX once per counter at the end of each frame to gather the +// counter value for that frame. Note that the pointer to the return data must +// continue to point to valid counter data until the next call to PIXEndFrame (or +// PIXEndExperiment) for the same counter. So do not set *ppReturnData to the same +// pointer for multiple counters, or point to a local variable that will go out of +// scope. See the sample PIX plugin for an example of how to structure a plugin +// properly. +//================================================================================================== +BOOL WINAPI PIXEndFrame( PIXCOUNTERID id, UINT iFrame, DWORD* pdwReturnBytes, BYTE** ppReturnData ); + + +//================================================================================================== +// PIXEndExperiment - This is called by PIX once per counter when instrumentation ends. +//================================================================================================== +BOOL WINAPI PIXEndExperiment( PIXCOUNTERID id ); + + +#ifdef __cplusplus +}; +#endif + +//================================================================================================== +// eof: PIXPlugin.h +//================================================================================================== + diff --git a/SDK/dxSDK/Include/X3DAudio.h b/SDK/dxSDK/Include/X3DAudio.h new file mode 100644 index 00000000..0e2effad --- /dev/null +++ b/SDK/dxSDK/Include/X3DAudio.h @@ -0,0 +1,309 @@ +/*-========================================================================-_ + | - X3DAUDIO - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |VERSION: 1.2 MODEL: Unmanaged User-mode | + |CONTRACT: N / A EXCEPT: No Exceptions | + |PARENT: N / A MINREQ: Win2000, Xenon | + |PROJECT: X3DAudio DIALECT: MS Visual C++ 7.0 | + |>------------------------------------------------------------------------<| + | DUTY: Cross-platform stand-alone 3D audio math library | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. USE THE DEBUG X3DAUDIO DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS! + Here's how: + Copy X3DAudioD1_X.dll to where your application exists. + The dll can be found in the DXSDK under Utilities\Bin\x86\ (or x64). + Rename X3DAudioD1_X.dll to X3DAudio1_X.dll to use the debug version. + + Only parameters required by DSP settings being calculated as + stipulated by the calculation control flags are validated. + + 2. Definition of terms: + LFE: Low Frequency Effect -- always omnidirectional. + LPF: Low Pass Filter, divided into two classifications: + Direct -- Applied to the direct signal path, + used for obstruction/occlusion effect. + Reverb -- Applied to the reverb signal path, + used for occlusion effect only. + + 3. Volume level is expressed as a linear amplitude scaler: + 1.0f represents no attenuation applied to the original signal, + 0.5f denotes an attenuation of 6dB, and 0.0f results in silence. + Amplification (volume > 1.0f) is also allowed, and is not clamped. + + 4. X3DAudio uses a left-handed Cartesian coordinate system with values + on the x-axis increasing from left to right, on the y-axis from + bottom to top, and on the z-axis from near to far. + Azimuths are measured clockwise from a given reference direction. + + Distance measurement is with respect to user-defined world units. + Applications may provide coordinates using any system of measure + as all non-normalized calculations are scale invariant, with such + operations natively occurring in the user-defined world unit space. + Metric constants are supplied only as a convenience. + Distance is calculated using the Euclidean norm formula. + + 5. Only real values are permissible with functions using 32-bit + float parameters -- NAN and infinite values are not accepted. + All computation occurs in 32-bit precision mode. */ + + +#ifndef __X3DAUDIO_H__ +#define __X3DAUDIO_H__ +//---------------------------------------------------// + #include // general windows types + #if defined(_XBOX) // for D3DVECTOR + #include + #endif + #include + + // speaker geometry configuration flags, specifies assignment of channels to speaker positions, defined as per WAVEFORMATEXTENSIBLE.dwChannelMask + #if !defined(_SPEAKER_POSITIONS_) + #define _SPEAKER_POSITIONS_ + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 // bit mask locations reserved for future use + #define SPEAKER_ALL 0x80000000 // used to specify that any possible permutation of speaker configurations + #endif + + // standard speaker geometry configurations, used with X3DAudioInitialize + #if !defined(SPEAKER_STEREO) + #define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) + #define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY) + #define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) + #define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER) + #define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) + #define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) + #endif + + // xenon speaker geometry configuration, used with X3DAudioInitialize + #if defined(_XBOX) + #define SPEAKER_XBOX SPEAKER_5POINT1 + #endif + + + #define X3DAUDIO_HANDLE_BYTESIZE 20 // size of instance handle in bytes + + // float math constants + #define X3DAUDIO_PI 3.141592654f + #define X3DAUDIO_2PI 6.283185307f + + // speed of sound in meters per second for dry air at approximately 20C, used with X3DAudioInitialize + #define X3DAUDIO_SPEED_OF_SOUND 343.5f + + // calculation control flags, used with X3DAudioCalculate + #define X3DAUDIO_CALCULATE_MATRIX 0x00000001 // enable matrix coefficient table calculation + #define X3DAUDIO_CALCULATE_DELAY 0x00000002 // enable delay time array calculation (stereo final mix only) + #define X3DAUDIO_CALCULATE_LPF_DIRECT 0x00000004 // enable LPF direct-path coefficient calculation + #define X3DAUDIO_CALCULATE_LPF_REVERB 0x00000008 // enable LPF reverb-path coefficient calculation + #define X3DAUDIO_CALCULATE_REVERB 0x00000010 // enable reverb send level calculation + #define X3DAUDIO_CALCULATE_DOPPLER 0x00000020 // enable doppler shift factor calculation + #define X3DAUDIO_CALCULATE_EMITTER_ANGLE 0x00000040 // enable emitter-to-listener interior angle calculation + + #define X3DAUDIO_CALCULATE_ZEROCENTER 0x00010000 // do not position to front center speaker, center destination channel will be zero in returned matrix coefficient table, used only for matrix calculations and only for final mix formats that have a front center channel + + +//-------------------------------------------------------------// + // function storage-class attribute and calltype + #if defined(_XBOX) || defined(X3DAUDIOSTATIC) + #define X3DAUDIO_API_(type) EXTERN_C type STDAPICALLTYPE + #else + #if defined(X3DEXPORT) + #define X3DAUDIO_API_(type) EXTERN_C __declspec(dllexport) type STDAPICALLTYPE + #else + #define X3DAUDIO_API_(type) EXTERN_C __declspec(dllimport) type STDAPICALLTYPE + #endif + #endif + #define X3DAUDIO_IMP_(type) type STDMETHODCALLTYPE + + +//-----------------------------------------------------// + // primitive types + typedef float FLOAT32; // 32-bit IEEE float + typedef D3DVECTOR X3DAUDIO_VECTOR; // float 3D vector + + // instance handle to precalculated constants + typedef BYTE X3DAUDIO_HANDLE[X3DAUDIO_HANDLE_BYTESIZE]; + + + // Distance curve point: + // Defines a DSP setting at a given normalized distance. + typedef struct X3DAUDIO_DISTANCE_CURVE_POINT + { + FLOAT32 Distance; // normalized distance, must be within [0.0f, 1.0f] + FLOAT32 DSPSetting; // DSP control setting + } X3DAUDIO_DISTANCE_CURVE_POINT, *LPX3DAUDIO_DISTANCE_CURVE_POINT; + + // Distance curve: + // A piecewise curve made up of linear segments used to + // define DSP behaviour with respect to normalized distance. + // + // Note that curve point distances are normalized within [0.0f, 1.0f]. + // X3DAUDIO_EMITTER.CurveDistanceScaler must be used to scale the + // normalized distances to user-defined world units. + // For distances beyond CurveDistanceScaler * 1.0f, + // pPoints[PointCount-1].DSPSetting is used as the DSP setting. + // + // All distance curve spans must be such that: + // pPoints[k-1].DSPSetting + ((pPoints[k].DSPSetting-pPoints[k-1].DSPSetting) / (pPoints[k].Distance-pPoints[k-1].Distance)) * (pPoints[k].Distance-pPoints[k-1].Distance) != NAN or infinite values + // For all points in the distance curve where 1 <= k < PointCount. + typedef struct X3DAUDIO_DISTANCE_CURVE + { + X3DAUDIO_DISTANCE_CURVE_POINT* pPoints; // distance curve point array, must have at least PointCount elements with no duplicates and be sorted in ascending order with respect to Distance + UINT32 PointCount; // number of distance curve points, must be >= 2 as all distance curves must have at least two endpoints, defining DSP settings at 0.0f and 1.0f normalized distance + } X3DAUDIO_DISTANCE_CURVE, *LPX3DAUDIO_DISTANCE_CURVE; + static const X3DAUDIO_DISTANCE_CURVE_POINT X3DAudioDefault_LinearCurvePoints[2] = { 0.0f, 1.0f, 1.0f, 0.0f }; + static const X3DAUDIO_DISTANCE_CURVE X3DAudioDefault_LinearCurve = { (X3DAUDIO_DISTANCE_CURVE_POINT*)&X3DAudioDefault_LinearCurvePoints[0], 2 }; + + // Cone: + // Specifies directionality for an emitter by modifying DSP behaviour + // with respect to the emitter and/or listener front orientation. + // This is modeled using two sound cones: an inner cone and an outer cone. + // On/within the inner cone, DSP settings are scaled by the inner values. + // On/beyond the outer cone, DSP settings are scaled by the outer values. + // If on both the cones, DSP settings are scaled by the inner values only. + // Between the two cones, the scaler is linearly interpolated between the + // inner and outer values. Set both cone angles to 0 or X3DAUDIO_2PI for + // omnidirectionality using only the outer or inner values respectively. + typedef struct X3DAUDIO_CONE + { + FLOAT32 InnerAngle; // inner cone angle in radians, must be within [0.0f, X3DAUDIO_2PI] + FLOAT32 OuterAngle; // outer cone angle in radians, must be within [InnerAngle, X3DAUDIO_2PI] + + FLOAT32 InnerVolume; // volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used + FLOAT32 OuterVolume; // volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used + FLOAT32 InnerLPF; // LPF (both direct and reverb paths) coefficient scaler on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used + FLOAT32 OuterLPF; // LPF (both direct and reverb paths) coefficient scaler on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used + FLOAT32 InnerReverb; // reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used + FLOAT32 OuterReverb; // reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used + } X3DAUDIO_CONE, *LPX3DAUDIO_CONE; + static const X3DAUDIO_CONE X3DAudioDefault_DirectionalCone = { X3DAUDIO_PI/2, X3DAUDIO_PI, 1.0f, 0.708f, 1.0f, 0.75f, 0.708f, 1.0f }; + + + // Listener: + // Defines a point of 3D audio reception. + // + // The cone is directed by the listener's front orientation. + typedef struct X3DAUDIO_LISTENER + { + X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for matrix and delay calculations, must be orthonormal with OrientTop when used + X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used + + X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity + X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position + + X3DAUDIO_CONE* pCone; // sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality + } X3DAUDIO_LISTENER, *LPX3DAUDIO_LISTENER; + + // Emitter: + // Defines a 3D audio source, divided into two classifications: + // + // Single-point -- For use with single-channel sounds. + // Positioned at the emitter base, i.e. the channel radius + // and azimuth are ignored if the number of channels == 1. + // + // May be omnidirectional or directional using a cone. + // The cone originates from the emitter base position, + // and is directed by the emitter's front orientation. + // + // Multi-point -- For use with multi-channel sounds. + // Each non-LFE channel is positioned using an + // azimuth along the channel radius with respect to the + // front orientation vector in the plane orthogonal to the + // top orientation vector. An azimuth of X3DAUDIO_2PI + // specifies a channel is a LFE. Such channels are + // positioned at the emitter base and are calculated + // with respect to pLFECurve only, never pVolumeCurve. + // + // Multi-point emitters are always omnidirectional, + // i.e. the cone is ignored if the number of channels > 1. + // + // Note that many properties are shared among all channel points, + // locking certain behaviour with respect to the emitter base position. + // For example, doppler shift is always calculated with respect to the + // emitter base position and so is constant for all its channel points. + // Distance curve calculations are also with respect to the emitter base + // position, with the curves being calculated independently of each other. + // For instance, volume and LFE calculations do not affect one another. + typedef struct X3DAUDIO_EMITTER + { + X3DAUDIO_CONE* pCone; // sound cone, used only with single-channel emitters for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality + X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for emitter angle calculations or with multi-channel emitters for matrix calculations or single-channel emitters with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used + X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only with multi-channel emitters for matrix calculations, must be orthonormal with OrientFront when used + + X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity + X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position + + FLOAT32 InnerRadius; // inner radius, must be within [0.0f, FLT_MAX] + FLOAT32 InnerRadiusAngle; // inner radius angle, must be within [0.0f, X3DAUDIO_PI/4.0) + + UINT32 ChannelCount; // number of sound channels, must be > 0 + FLOAT32 ChannelRadius; // channel radius, used only with multi-channel emitters for matrix calculations, must be >= 0.0f when used + FLOAT32* pChannelAzimuths; // channel azimuth array, used only with multi-channel emitters for matrix calculations, contains positions of each channel expressed in radians along the channel radius with respect to the front orientation vector in the plane orthogonal to the top orientation vector, or X3DAUDIO_2PI to specify a LFE channel, must have at least ChannelCount elements, all within [0.0f, X3DAUDIO_2PI] when used + + X3DAUDIO_DISTANCE_CURVE* pVolumeCurve; // volume level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law with distances <= 1.0f clamped to no attenuation, CurveDistanceScaler is ignored when this parameter is NULL + X3DAUDIO_DISTANCE_CURVE* pLFECurve; // LFE level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law with distances <= 1.0f clamped to no attenuation, CurveDistanceScaler is ignored when this parameters is NULL + X3DAUDIO_DISTANCE_CURVE* pLPFDirectCurve; // LPF direct-path coefficient distance curve, used only for LPF direct-path calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.75f] + X3DAUDIO_DISTANCE_CURVE* pLPFReverbCurve; // LPF reverb-path coefficient distance curve, used only for LPF reverb-path calculations, NULL specifies the default curve: [0.0f,0.75f], [1.0f,0.75f] + X3DAUDIO_DISTANCE_CURVE* pReverbCurve; // reverb send level distance curve, used only for reverb calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.0f] + + FLOAT32 CurveDistanceScaler; // curve distance scaler, used to scale normalized distance curves to user-defined world units and/or exaggerate their effect, does not affect any other calculations, must be within [FLT_MIN, FLT_MAX] when used + FLOAT32 DopplerScaler; // doppler shift scaler, used to exaggerate doppler shift effect, does not affect any other calculations, must be within [0.0f, FLT_MAX] when used + } X3DAUDIO_EMITTER, *LPX3DAUDIO_EMITTER; + + + // DSP settings: + // Receives results from a call to X3DAudioCalculate() to be sent + // to the low-level audio rendering API for 3D signal processing. + // + // The user is responsible for allocating the matrix coefficient table, + // delay time array, and initializing the channel counts when used. + typedef struct X3DAUDIO_DSP_SETTINGS + { + FLOAT32* pMatrixCoefficients; // [in] matrix coefficient table, receives an array representing the volume level used to send from source channel S to destination channel D, stored as pMatrixCoefficients[SrcChannelCount * D + S], must have at least SrcChannelCount*DstChannelCount elements + FLOAT32* pDelayTimes; // [in] delay time array, receives delays for each destination channel in milliseconds, must have at least DstChannelCount elements (stereo final mix only) + UINT32 SrcChannelCount; // [in] number of source channels, must equal number of channels on respective emitter + UINT32 DstChannelCount; // [in] number of destination channels, must equal number of channels on the final mix + + FLOAT32 LPFDirectCoefficient; // [out] LPF direct-path coefficient + FLOAT32 LPFReverbCoefficient; // [out] LPF reverb-path coefficient + FLOAT32 ReverbLevel; // [out] reverb send level + FLOAT32 DopplerFactor; // [out] doppler shift factor, scales resampler ratio for doppler shift effect, where the effective frequency = DopplerFactor * original frequency + FLOAT32 EmitterToListenerAngle; // [out] emitter-to-listener interior angle, expressed in radians with respect to the emitter's front orientation + + FLOAT32 EmitterToListenerDistance; // [out] distance in user-defined world units from the emitter base to listener position, always calculated + FLOAT32 EmitterVelocityComponent; // [out] component of emitter velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler + FLOAT32 ListenerVelocityComponent; // [out] component of listener velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler + } X3DAUDIO_DSP_SETTINGS, *LPX3DAUDIO_DSP_SETTINGS; + + +//-------------------------------------------------------// + // sets all global 3D audio constants + X3DAUDIO_API_(void) X3DAudioInitialize (UINT32 SpeakerChannelMask, FLOAT32 SpeedOfSound, X3DAUDIO_HANDLE Instance); + + // calculates DSP settings with respect to 3D parameters + X3DAUDIO_API_(void) X3DAudioCalculate (const X3DAUDIO_HANDLE Instance, const X3DAUDIO_LISTENER* pListener, const X3DAUDIO_EMITTER* pEmitter, UINT32 Flags, X3DAUDIO_DSP_SETTINGS* pDSPSettings); + + +#endif // __X3DAUDIO_H__ +//---------------------------------<-EOF->----------------------------------// diff --git a/SDK/dxSDK/Include/XInput.h b/SDK/dxSDK/Include/XInput.h new file mode 100644 index 00000000..63f54600 --- /dev/null +++ b/SDK/dxSDK/Include/XInput.h @@ -0,0 +1,258 @@ +/*************************************************************************** +* * +* XInput.h -- This module defines XBOX controller APIs * +* and constansts for the Windows platform. * +* * +* Copyright (c) Microsoft Corp. All rights reserved. * +* * +***************************************************************************/ +#ifndef _XINPUT_H_ +#define _XINPUT_H_ + +#include + +// Current name of the DLL shipped in the same SDK as this header. +// The name reflects the current version +#define XINPUT_DLL_A "xinput1_3.dll" +#define XINPUT_DLL_W L"xinput1_3.dll" +#ifdef UNICODE + #define XINPUT_DLL XINPUT_DLL_W +#else + #define XINPUT_DLL XINPUT_DLL_A +#endif + +// +// Device types available in XINPUT_CAPABILITIES +// +#define XINPUT_DEVTYPE_GAMEPAD 0x01 + +// +// Device subtypes available in XINPUT_CAPABILITIES +// +#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 +#define XINPUT_DEVSUBTYPE_WHEEL 0x02 +#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 +#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 +#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 +#define XINPUT_DEVSUBTYPE_GUITAR 0x06 +#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 + +// +// Flags for XINPUT_CAPABILITIES +// +#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004 + +// +// Constants for gamepad buttons +// +#define XINPUT_GAMEPAD_DPAD_UP 0x0001 +#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 +#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 +#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 +#define XINPUT_GAMEPAD_START 0x0010 +#define XINPUT_GAMEPAD_BACK 0x0020 +#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 +#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 +#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 +#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 +#define XINPUT_GAMEPAD_A 0x1000 +#define XINPUT_GAMEPAD_B 0x2000 +#define XINPUT_GAMEPAD_X 0x4000 +#define XINPUT_GAMEPAD_Y 0x8000 + + +// +// Gamepad thresholds +// +#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849 +#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 +#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30 + +// +// Flags to pass to XInputGetCapabilities +// +#define XINPUT_FLAG_GAMEPAD 0x00000001 + +// +// Devices that support batteries +// +#define BATTERY_DEVTYPE_GAMEPAD 0x00 +#define BATTERY_DEVTYPE_HEADSET 0x01 + +// +// Flags for battery status level +// +#define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected +#define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery +#define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source +#define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source +#define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type + +// These are only valid for wireless, connected devices, with known battery types +// The amount of use time remaining depends on the type of device. +#define BATTERY_LEVEL_EMPTY 0x00 +#define BATTERY_LEVEL_LOW 0x01 +#define BATTERY_LEVEL_MEDIUM 0x02 +#define BATTERY_LEVEL_FULL 0x03 + +// User index definitions +#define XUSER_MAX_COUNT 4 + +#define XUSER_INDEX_ANY 0x000000FF + + +// +// Codes returned for the gamepad keystroke +// + +#define VK_PAD_A 0x5800 +#define VK_PAD_B 0x5801 +#define VK_PAD_X 0x5802 +#define VK_PAD_Y 0x5803 +#define VK_PAD_RSHOULDER 0x5804 +#define VK_PAD_LSHOULDER 0x5805 +#define VK_PAD_LTRIGGER 0x5806 +#define VK_PAD_RTRIGGER 0x5807 + +#define VK_PAD_DPAD_UP 0x5810 +#define VK_PAD_DPAD_DOWN 0x5811 +#define VK_PAD_DPAD_LEFT 0x5812 +#define VK_PAD_DPAD_RIGHT 0x5813 +#define VK_PAD_START 0x5814 +#define VK_PAD_BACK 0x5815 +#define VK_PAD_LTHUMB_PRESS 0x5816 +#define VK_PAD_RTHUMB_PRESS 0x5817 + +#define VK_PAD_LTHUMB_UP 0x5820 +#define VK_PAD_LTHUMB_DOWN 0x5821 +#define VK_PAD_LTHUMB_RIGHT 0x5822 +#define VK_PAD_LTHUMB_LEFT 0x5823 +#define VK_PAD_LTHUMB_UPLEFT 0x5824 +#define VK_PAD_LTHUMB_UPRIGHT 0x5825 +#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 +#define VK_PAD_LTHUMB_DOWNLEFT 0x5827 + +#define VK_PAD_RTHUMB_UP 0x5830 +#define VK_PAD_RTHUMB_DOWN 0x5831 +#define VK_PAD_RTHUMB_RIGHT 0x5832 +#define VK_PAD_RTHUMB_LEFT 0x5833 +#define VK_PAD_RTHUMB_UPLEFT 0x5834 +#define VK_PAD_RTHUMB_UPRIGHT 0x5835 +#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 +#define VK_PAD_RTHUMB_DOWNLEFT 0x5837 + +// +// Flags used in XINPUT_KEYSTROKE +// +#define XINPUT_KEYSTROKE_KEYDOWN 0x0001 +#define XINPUT_KEYSTROKE_KEYUP 0x0002 +#define XINPUT_KEYSTROKE_REPEAT 0x0004 + +// +// Structures used by XInput APIs +// +typedef struct _XINPUT_GAMEPAD +{ + WORD wButtons; + BYTE bLeftTrigger; + BYTE bRightTrigger; + SHORT sThumbLX; + SHORT sThumbLY; + SHORT sThumbRX; + SHORT sThumbRY; +} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD; + +typedef struct _XINPUT_STATE +{ + DWORD dwPacketNumber; + XINPUT_GAMEPAD Gamepad; +} XINPUT_STATE, *PXINPUT_STATE; + +typedef struct _XINPUT_VIBRATION +{ + WORD wLeftMotorSpeed; + WORD wRightMotorSpeed; +} XINPUT_VIBRATION, *PXINPUT_VIBRATION; + +typedef struct _XINPUT_CAPABILITIES +{ + BYTE Type; + BYTE SubType; + WORD Flags; + XINPUT_GAMEPAD Gamepad; + XINPUT_VIBRATION Vibration; +} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES; + +typedef struct _XINPUT_BATTERY_INFORMATION +{ + BYTE BatteryType; + BYTE BatteryLevel; +} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION; + +typedef struct _XINPUT_KEYSTROKE +{ + WORD VirtualKey; + WCHAR Unicode; + WORD Flags; + BYTE UserIndex; + BYTE HidCode; +} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE; + +// +// XInput APIs +// +#ifdef __cplusplus +extern "C" { +#endif + +DWORD WINAPI XInputGetState +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + XINPUT_STATE* pState // [out] Receives the current state +); + +DWORD WINAPI XInputSetState +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller +); + +DWORD WINAPI XInputGetCapabilities +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + DWORD dwFlags, // [in] Input flags that identify the device type + XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities +); + +void WINAPI XInputEnable +( + BOOL enable // [in] Indicates whether xinput is enabled or disabled. +); + +DWORD WINAPI XInputGetDSoundAudioDeviceGuids +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + GUID* pDSoundRenderGuid, // [out] DSound device ID for render + GUID* pDSoundCaptureGuid // [out] DSound device ID for capture +); + +DWORD WINAPI XInputGetBatteryInformation +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + BYTE devType, // [in] Which device on this user index + XINPUT_BATTERY_INFORMATION* pBatteryInformation // [out] Contains the level and types of batteries +); + +DWORD WINAPI XInputGetKeystroke +( + DWORD dwUserIndex, // [in] Index of the gamer associated with the device + DWORD dwReserved, // [in] Reserved for future use + PXINPUT_KEYSTROKE pKeystroke // [out] Pointer to an XINPUT_KEYSTROKE structure that receives an input event. +); + +#ifdef __cplusplus +} +#endif + +#endif //_XINPUT_H_ + diff --git a/SDK/dxSDK/Include/audiodefs.h b/SDK/dxSDK/Include/audiodefs.h new file mode 100644 index 00000000..dc2b867f --- /dev/null +++ b/SDK/dxSDK/Include/audiodefs.h @@ -0,0 +1,209 @@ +/*************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: audiodefs.h + * Content: Basic constants and data types for audio work. + * + ***************************************************************************/ + +#ifndef __AUDIODEFS_INCLUDED__ +#define __AUDIODEFS_INCLUDED__ + +#include // For WORD, DWORD, etc. + +#pragma pack(push, 1) // Pack structures to 1-byte boundaries + + +/************************************************************************** + * + * WAVEFORMATEX: Base structure for many audio formats. Format-specific + * extensions can be defined for particular formats by using a non-zero + * cbSize value and adding extra fields to the end of this structure. + * + ***************************************************************************/ + +#ifndef _WAVEFORMATEX_ + + #define _WAVEFORMATEX_ + typedef struct tWAVEFORMATEX + { + WORD wFormatTag; // Integer identifier of the format + WORD nChannels; // Number of audio channels + DWORD nSamplesPerSec; // Audio sample rate + DWORD nAvgBytesPerSec; // Bytes per second (possibly approximate) + WORD nBlockAlign; // Size in bytes of a sample block (all channels) + WORD wBitsPerSample; // Size in bits of a single per-channel sample + WORD cbSize; // Bytes of extra data appended to this struct + } WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; + typedef const WAVEFORMATEX *LPCWAVEFORMATEX; + +#endif + + +/************************************************************************** + * + * WAVEFORMATEXTENSIBLE: Extended version of WAVEFORMATEX that should be + * used as a basis for all new audio formats. The format tag is replaced + * with a GUID, allowing new formats to be defined without registering a + * format tag with Microsoft. There are also new fields that can be used + * to specify the spatial positions for each channel and the bit packing + * used for wide samples (e.g. 24-bit PCM samples in 32-bit containers). + * + ***************************************************************************/ + +#ifndef _WAVEFORMATEXTENSIBLE_ + + #define _WAVEFORMATEXTENSIBLE_ + typedef struct + { + WAVEFORMATEX Format; // Base WAVEFORMATEX data + union + { + WORD wValidBitsPerSample; // Valid bits in each sample container + WORD wSamplesPerBlock; // Samples per block of audio data; valid + // if wBitsPerSample=0 (but rarely used). + WORD wReserved; // Zero if neither case above applies. + } Samples; + DWORD dwChannelMask; // Positions of the audio channels + GUID SubFormat; // Format identifier GUID + } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE, *LPPWAVEFORMATEXTENSIBLE; + typedef const WAVEFORMATEXTENSIBLE* LPCWAVEFORMATEXTENSIBLE; + +#endif + + +/************************************************************************** + * + * Define the most common wave format tags used in WAVEFORMATEX formats. + * Note that including the mmreg.h header after this one may cause build + * problems; this cannot be avoided, since mmreg.h defines these macros + * without preprocessor guards. + * + ***************************************************************************/ + +#ifndef WAVE_FORMAT_PCM + // If WAVE_FORMAT_PCM is not defined, we need to define some legacy types + // for compatibility with the Windows mmreg.h / mmsystem.h header files. + + // Old general format structure (information common to all formats) + typedef struct waveformat_tag + { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + } WAVEFORMAT, *PWAVEFORMAT, NEAR *NPWAVEFORMAT, FAR *LPWAVEFORMAT; + + // Specific format structure for PCM data + typedef struct pcmwaveformat_tag + { + WAVEFORMAT wf; + WORD wBitsPerSample; + } PCMWAVEFORMAT, *PPCMWAVEFORMAT, NEAR *NPPCMWAVEFORMAT, FAR *LPPCMWAVEFORMAT; + + #define WAVE_FORMAT_PCM 0x0001 // Pulse code modulation +#endif + +#ifndef WAVE_FORMAT_ADPCM + #define WAVE_FORMAT_ADPCM 0x0002 // Adaptive differental PCM +#endif + +#ifndef WAVE_FORMAT_IEEE_FLOAT + #define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point +#endif + +#ifndef WAVE_FORMAT_MPEGLAYER3 + #define WAVE_FORMAT_MPEGLAYER3 0x0055 // ISO/MPEG Layer3 +#endif + +#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF + #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 // Dolby Audio Codec 3 over S/PDIF +#endif + +#ifndef WAVE_FORMAT_WMASPDIF + #define WAVE_FORMAT_WMASPDIF 0x0164 // Windows Media Audio over S/PDIF +#endif + +#ifndef WAVE_FORMAT_EXTENSIBLE + #define WAVE_FORMAT_EXTENSIBLE 0xFFFE // All WAVEFORMATEXTENSIBLE formats +#endif + + +/************************************************************************** + * + * Define the most common wave format GUIDs used in WAVEFORMATEXTENSIBLE + * formats. Note that including the Windows ksmedia.h header after this + * one will cause build problems; this cannot be avoided, since ksmedia.h + * defines these macros without preprocessor guards. + * + ***************************************************************************/ + +#ifdef __cplusplus // uuid() and __uuidof() are only available in C++ + + #ifndef KSDATAFORMAT_SUBTYPE_PCM + struct __declspec(uuid("00000001-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_PCM_STRUCT; + #define KSDATAFORMAT_SUBTYPE_PCM __uuidof(KSDATAFORMAT_SUBTYPE_PCM_STRUCT) + #endif + + #ifndef KSDATAFORMAT_SUBTYPE_ADPCM + struct __declspec(uuid("00000002-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT; + #define KSDATAFORMAT_SUBTYPE_ADPCM __uuidof(KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT) + #endif + + #ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT + struct __declspec(uuid("00000003-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT; + #define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT __uuidof(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT) + #endif + +#endif + + +/************************************************************************** + * + * Speaker positions used in the WAVEFORMATEXTENSIBLE dwChannelMask field. + * + ***************************************************************************/ + +#ifndef SPEAKER_FRONT_LEFT + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 + #define SPEAKER_ALL 0x80000000 + #define _SPEAKER_POSITIONS_ +#endif + +#ifndef SPEAKER_STEREO + #define SPEAKER_MONO (SPEAKER_FRONT_CENTER) + #define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) + #define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY) + #define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) + #define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER) + #define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) + #define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) +#endif + + +#pragma pack(pop) + +#endif // #ifndef __AUDIODEFS_INCLUDED__ diff --git a/SDK/dxSDK/Include/comdecl.h b/SDK/dxSDK/Include/comdecl.h new file mode 100644 index 00000000..2ae9a961 --- /dev/null +++ b/SDK/dxSDK/Include/comdecl.h @@ -0,0 +1,59 @@ +// comdecl.h: Macros to facilitate COM interface and GUID declarations. +// Copyright (c) Microsoft Corporation. All rights reserved. + +#ifndef _COMDECL_H_ +#define _COMDECL_H_ + +#ifndef _XBOX + #include // For standard COM interface macros +#else + #pragma warning(push) + #pragma warning(disable:4061) + #include // Required by xobjbase.h + #include // Special definitions for Xbox build + #pragma warning(pop) +#endif + +// The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to +// be declared and defined in such a way that clients can obtain the GUIDs using +// either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names. +// If using the latter approach, the client can also choose whether to get the +// GUID definitions by defining the INITGUID preprocessor constant or by linking +// to a GUID library. This works in either C or C++. + +#ifdef __cplusplus + + #define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x)) + #ifdef INITGUID + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \ + EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className) + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \ + EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName) + + #else // INITGUID + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \ + EXTERN_C const GUID CLSID_##className + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \ + EXTERN_C const GUID IID_##interfaceName + + #endif // INITGUID + +#else // __cplusplus + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + +#endif // __cplusplus + +#endif // #ifndef _COMDECL_H_ diff --git a/SDK/dxSDK/Include/d3d.h b/SDK/dxSDK/Include/d3d.h new file mode 100644 index 00000000..eea7dff4 --- /dev/null +++ b/SDK/dxSDK/Include/d3d.h @@ -0,0 +1,1688 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D_H_ +#define _D3D_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +// include this file content only if compiling for <=DX7 interfaces +#if(DIRECT3D_VERSION < 0x0800) + + +#include + +#define COM_NO_WINDOWS_H +#include + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) +DEFINE_GUID( IID_IDirect3D, 0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3D2, 0x6aae1ec1,0x662a,0x11d0,0x88,0x9d,0x00,0xaa,0x00,0xbb,0xb7,0x6a); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3D3, 0xbb223240,0xe72b,0x11d0,0xa9,0xb4,0x00,0xaa,0x00,0xc0,0x99,0x3e); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3D7, 0xf5049e77,0x4861,0x11d2,0xa4,0x7,0x0,0xa0,0xc9,0x6,0x29,0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DRampDevice, 0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DRGBDevice, 0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DHALDevice, 0x84E63dE0,0x46AA,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DMMXDevice, 0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 ); +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DRefDevice, 0x50936643, 0x13e9, 0x11d1, 0x89, 0xaa, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +DEFINE_GUID( IID_IDirect3DNullDevice, 0x8767df22, 0xbacc, 0x11d1, 0x89, 0x69, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DTnLHalDevice, 0xf5049e78, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Internal Guid to distinguish requested MMX from MMX being used as an RGB rasterizer + */ + +DEFINE_GUID( IID_IDirect3DDevice, 0x64108800,0x957d,0X11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DDevice2, 0x93281501, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DDevice3, 0xb0ab3b60, 0x33d7, 0x11d1, 0xa9, 0x81, 0x0, 0xc0, 0x4f, 0xd7, 0xb1, 0x74); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DDevice7, 0xf5049e79, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +DEFINE_GUID( IID_IDirect3DTexture, 0x2CDCD9E0,0x25A0,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DTexture2, 0x93281502, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +DEFINE_GUID( IID_IDirect3DLight, 0x4417C142,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); + +DEFINE_GUID( IID_IDirect3DMaterial, 0x4417C144,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DMaterial2, 0x93281503, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DMaterial3, 0xca9c46f4, 0xd3c5, 0x11d1, 0xb7, 0x5a, 0x0, 0x60, 0x8, 0x52, 0xb3, 0x12); +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +DEFINE_GUID( IID_IDirect3DExecuteBuffer,0x4417C145,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DViewport, 0x4417C146,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +#if(DIRECT3D_VERSION >= 0x0500) +DEFINE_GUID( IID_IDirect3DViewport2, 0x93281500, 0x8cf8, 0x11d0, 0x89, 0xab, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x29); +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DViewport3, 0xb0ab3b61, 0x33d7, 0x11d1, 0xa9, 0x81, 0x0, 0xc0, 0x4f, 0xd7, 0xb1, 0x74); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0600) +DEFINE_GUID( IID_IDirect3DVertexBuffer, 0x7a503555, 0x4a83, 0x11d1, 0xa5, 0xdb, 0x0, 0xa0, 0xc9, 0x3, 0x67, 0xf8); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +DEFINE_GUID( IID_IDirect3DVertexBuffer7, 0xf5049e7d, 0x4861, 0x11d2, 0xa4, 0x7, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0xa8); +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#endif + +#ifdef __cplusplus +struct IDirect3D; +struct IDirect3DDevice; +struct IDirect3DLight; +struct IDirect3DMaterial; +struct IDirect3DExecuteBuffer; +struct IDirect3DTexture; +struct IDirect3DViewport; +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +struct IDirect3D2; +struct IDirect3DDevice2; +struct IDirect3DMaterial2; +struct IDirect3DTexture2; +struct IDirect3DViewport2; +typedef struct IDirect3D2 *LPDIRECT3D2; +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +struct IDirect3D3; +struct IDirect3DDevice3; +struct IDirect3DMaterial3; +struct IDirect3DViewport3; +struct IDirect3DVertexBuffer; +typedef struct IDirect3D3 *LPDIRECT3D3; +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +struct IDirect3D7; +struct IDirect3DDevice7; +struct IDirect3DVertexBuffer7; +typedef struct IDirect3D7 *LPDIRECT3D7; +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#else + +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct IDirect3D2 *LPDIRECT3D2; +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +typedef struct IDirect3D3 *LPDIRECT3D3; +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct IDirect3D7 *LPDIRECT3D7; +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif + +#include "d3dtypes.h" +#include "d3dcaps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Direct3D interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3D + +DECLARE_INTERFACE_(IDirect3D, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D methods ***/ + STDMETHOD(Initialize)(THIS_ REFCLSID) PURE; + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,IUnknown*) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL*,IUnknown*) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT*,IUnknown*) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; +}; + +typedef struct IDirect3D *LPDIRECT3D; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#else +#define IDirect3D_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D_AddRef(p) (p)->AddRef() +#define IDirect3D_Release(p) (p)->Release() +#define IDirect3D_Initialize(p,a) (p)->Initialize(a) +#define IDirect3D_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D_FindDevice(p,a,b) (p)->FindDevice(a,b) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3D2 + +DECLARE_INTERFACE_(IDirect3D2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D2 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,IUnknown*) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL2*,IUnknown*) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT2*,IUnknown*) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE,LPDIRECT3DDEVICE2*) PURE; +}; + +typedef struct IDirect3D2 *LPDIRECT3D2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D2_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#else +#define IDirect3D2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D2_AddRef(p) (p)->AddRef() +#define IDirect3D2_Release(p) (p)->Release() +#define IDirect3D2_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D2_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D2_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D2_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D2_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3D3 + +DECLARE_INTERFACE_(IDirect3D3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D3 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK,LPVOID) PURE; + STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*,LPUNKNOWN) PURE; + STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL3*,LPUNKNOWN) PURE; + STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT3*,LPUNKNOWN) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH,LPD3DFINDDEVICERESULT) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE4,LPDIRECT3DDEVICE3*,LPUNKNOWN) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER*,DWORD,LPUNKNOWN) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; + +typedef struct IDirect3D3 *LPDIRECT3D3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D3_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->lpVtbl->CreateLight(p,a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->lpVtbl->CreateMaterial(p,a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->lpVtbl->CreateViewport(p,a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->lpVtbl->FindDevice(p,a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->lpVtbl->CreateDevice(p,a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +#define IDirect3D3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D3_AddRef(p) (p)->AddRef() +#define IDirect3D3_Release(p) (p)->Release() +#define IDirect3D3_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D3_CreateLight(p,a,b) (p)->CreateLight(a,b) +#define IDirect3D3_CreateMaterial(p,a,b) (p)->CreateMaterial(a,b) +#define IDirect3D3_CreateViewport(p,a,b) (p)->CreateViewport(a,b) +#define IDirect3D3_FindDevice(p,a,b) (p)->FindDevice(a,b) +#define IDirect3D3_CreateDevice(p,a,b,c,d) (p)->CreateDevice(a,b,c,d) +#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) (p)->CreateVertexBuffer(a,b,c,d) +#define IDirect3D3_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D3_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3D7 + +DECLARE_INTERFACE_(IDirect3D7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D7 methods ***/ + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK7,LPVOID) PURE; + STDMETHOD(CreateDevice)(THIS_ REFCLSID,LPDIRECTDRAWSURFACE7,LPDIRECT3DDEVICE7*) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER7*,DWORD) PURE; + STDMETHOD(EnumZBufferFormats)(THIS_ REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(EvictManagedTextures)(THIS) PURE; +}; + +typedef struct IDirect3D7 *LPDIRECT3D7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D7_EnumDevices(p,a,b) (p)->lpVtbl->EnumDevices(p,a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->lpVtbl->EnumZBufferFormats(p,a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->lpVtbl->EvictManagedTextures(p) +#else +#define IDirect3D7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D7_AddRef(p) (p)->AddRef() +#define IDirect3D7_Release(p) (p)->Release() +#define IDirect3D7_EnumDevices(p,a,b) (p)->EnumDevices(a,b) +#define IDirect3D7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirect3D7_CreateVertexBuffer(p,a,b,c) (p)->CreateVertexBuffer(a,b,c) +#define IDirect3D7_EnumZBufferFormats(p,a,b,c) (p)->EnumZBufferFormats(a,b,c) +#define IDirect3D7_EvictManagedTextures(p) (p)->EvictManagedTextures() +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ +/* + * Direct3D Device interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DDevice + +DECLARE_INTERFACE_(IDirect3DDevice, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D,LPGUID,LPD3DDEVICEDESC) PURE; + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE,LPDIRECT3DTEXTURE) PURE; + STDMETHOD(CreateExecuteBuffer)(THIS_ LPD3DEXECUTEBUFFERDESC,LPDIRECT3DEXECUTEBUFFER*,IUnknown*) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(Execute)(THIS_ LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT,LPDIRECT3DVIEWPORT*,DWORD) PURE; + STDMETHOD(Pick)(THIS_ LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD,LPD3DRECT) PURE; + STDMETHOD(GetPickRecords)(THIS_ LPDWORD,LPD3DPICKRECORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(CreateMatrix)(THIS_ LPD3DMATRIXHANDLE) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DMATRIXHANDLE,const LPD3DMATRIX) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DMATRIXHANDLE,LPD3DMATRIX) PURE; + STDMETHOD(DeleteMatrix)(THIS_ D3DMATRIXHANDLE) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D*) PURE; +}; + +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->lpVtbl->CreateExecuteBuffer(p,a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->lpVtbl->Execute(p,a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->lpVtbl->Pick(p,a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->lpVtbl->GetPickRecords(p,a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->lpVtbl->CreateMatrix(p,a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->lpVtbl->SetMatrix(p,a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->lpVtbl->GetMatrix(p,a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->lpVtbl->DeleteMatrix(p,a) +#define IDirect3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#else +#define IDirect3DDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice_AddRef(p) (p)->AddRef() +#define IDirect3DDevice_Release(p) (p)->Release() +#define IDirect3DDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirect3DDevice_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice_CreateExecuteBuffer(p,a,b,c) (p)->CreateExecuteBuffer(a,b,c) +#define IDirect3DDevice_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice_Execute(p,a,b,c) (p)->Execute(a,b,c) +#define IDirect3DDevice_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice_Pick(p,a,b,c,d) (p)->Pick(a,b,c,d) +#define IDirect3DDevice_GetPickRecords(p,a,b) (p)->GetPickRecords(a,b) +#define IDirect3DDevice_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice_CreateMatrix(p,a) (p)->CreateMatrix(a) +#define IDirect3DDevice_SetMatrix(p,a,b) (p)->SetMatrix(a,b) +#define IDirect3DDevice_GetMatrix(p,a,b) (p)->GetMatrix(a,b) +#define IDirect3DDevice_DeleteMatrix(p,a) (p)->DeleteMatrix(a) +#define IDirect3DDevice_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice_EndScene(p) (p)->EndScene() +#define IDirect3DDevice_GetDirect3D(p,a) (p)->GetDirect3D(a) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DDevice2 + +DECLARE_INTERFACE_(IDirect3DDevice2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice2 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(SwapTextureHandles)(THIS_ LPDIRECT3DTEXTURE2,LPDIRECT3DTEXTURE2) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT2,LPDIRECT3DVIEWPORT2*,DWORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D2*) PURE; + STDMETHOD(SetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2) PURE; + STDMETHOD(GetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT2 *) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD(Begin)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,DWORD) PURE; + STDMETHOD(BeginIndexed)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(Vertex)(THIS_ LPVOID) PURE; + STDMETHOD(Index)(THIS_ WORD) PURE; + STDMETHOD(End)(THIS_ DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetLightState)(THIS_ D3DLIGHTSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetLightState)(THIS_ D3DLIGHTSTATETYPE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,D3DVERTEXTYPE,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; +}; + +typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->lpVtbl->SwapTextureHandles(p,a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice2_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice2_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice2_SetCurrentViewport(p,a) (p)->lpVtbl->SetCurrentViewport(p,a) +#define IDirect3DDevice2_GetCurrentViewport(p,a) (p)->lpVtbl->GetCurrentViewport(p,a) +#define IDirect3DDevice2_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice2_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice2_Begin(p,a,b,c) (p)->lpVtbl->Begin(p,a,b,c) +#define IDirect3DDevice2_BeginIndexed(p,a,b,c,d,e) (p)->lpVtbl->BeginIndexed(p,a,b,c,d,e) +#define IDirect3DDevice2_Vertex(p,a) (p)->lpVtbl->Vertex(p,a) +#define IDirect3DDevice2_Index(p,a) (p)->lpVtbl->Index(p,a) +#define IDirect3DDevice2_End(p,a) (p)->lpVtbl->End(p,a) +#define IDirect3DDevice2_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice2_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice2_GetLightState(p,a,b) (p)->lpVtbl->GetLightState(p,a,b) +#define IDirect3DDevice2_SetLightState(p,a,b) (p)->lpVtbl->SetLightState(p,a,b) +#define IDirect3DDevice2_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice2_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice2_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice2_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice2_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice2_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice2_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#else +#define IDirect3DDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice2_AddRef(p) (p)->AddRef() +#define IDirect3DDevice2_Release(p) (p)->Release() +#define IDirect3DDevice2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice2_SwapTextureHandles(p,a,b) (p)->SwapTextureHandles(a,b) +#define IDirect3DDevice2_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice2_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice2_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice2_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice2_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice2_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice2_EndScene(p) (p)->EndScene() +#define IDirect3DDevice2_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice2_SetCurrentViewport(p,a) (p)->SetCurrentViewport(a) +#define IDirect3DDevice2_GetCurrentViewport(p,a) (p)->GetCurrentViewport(a) +#define IDirect3DDevice2_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice2_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice2_Begin(p,a,b,c) (p)->Begin(a,b,c) +#define IDirect3DDevice2_BeginIndexed(p,a,b,c,d,e) (p)->BeginIndexed(a,b,c,d,e) +#define IDirect3DDevice2_Vertex(p,a) (p)->Vertex(a) +#define IDirect3DDevice2_Index(p,a) (p)->Index(a) +#define IDirect3DDevice2_End(p,a) (p)->End(a) +#define IDirect3DDevice2_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice2_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice2_GetLightState(p,a,b) (p)->GetLightState(a,b) +#define IDirect3DDevice2_SetLightState(p,a,b) (p)->SetLightState(a,b) +#define IDirect3DDevice2_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice2_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice2_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice2_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice2_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice2_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice2_GetClipStatus(p,a) (p)->GetClipStatus(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DDevice3 + +DECLARE_INTERFACE_(IDirect3DDevice3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice3 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC,LPD3DDEVICEDESC) PURE; + STDMETHOD(GetStats)(THIS_ LPD3DSTATS) PURE; + STDMETHOD(AddViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(DeleteViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(NextViewport)(THIS_ LPDIRECT3DVIEWPORT3,LPDIRECT3DVIEWPORT3*,DWORD) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D3*) PURE; + STDMETHOD(SetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT3) PURE; + STDMETHOD(GetCurrentViewport)(THIS_ LPDIRECT3DVIEWPORT3 *) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE4,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE4 *) PURE; + STDMETHOD(Begin)(THIS_ D3DPRIMITIVETYPE,DWORD,DWORD) PURE; + STDMETHOD(BeginIndexed)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(Vertex)(THIS_ LPVOID) PURE; + STDMETHOD(Index)(THIS_ WORD) PURE; + STDMETHOD(End)(THIS_ DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetLightState)(THIS_ D3DLIGHTSTATETYPE,LPDWORD) PURE; + STDMETHOD(SetLightState)(THIS_ D3DLIGHTSTATETYPE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(DrawPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER,DWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(ComputeSphereVisibility)(THIS_ LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD,LPDIRECT3DTEXTURE2 *) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD,LPDIRECT3DTEXTURE2) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,DWORD) PURE; + STDMETHOD(ValidateDevice)(THIS_ LPDWORD) PURE; +}; + +typedef struct IDirect3DDevice3 *LPDIRECT3DDEVICE3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirect3DDevice3_GetStats(p,a) (p)->lpVtbl->GetStats(p,a) +#define IDirect3DDevice3_AddViewport(p,a) (p)->lpVtbl->AddViewport(p,a) +#define IDirect3DDevice3_DeleteViewport(p,a) (p)->lpVtbl->DeleteViewport(p,a) +#define IDirect3DDevice3_NextViewport(p,a,b,c) (p)->lpVtbl->NextViewport(p,a,b,c) +#define IDirect3DDevice3_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice3_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice3_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice3_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice3_SetCurrentViewport(p,a) (p)->lpVtbl->SetCurrentViewport(p,a) +#define IDirect3DDevice3_GetCurrentViewport(p,a) (p)->lpVtbl->GetCurrentViewport(p,a) +#define IDirect3DDevice3_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice3_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice3_Begin(p,a,b,c) (p)->lpVtbl->Begin(p,a,b,c) +#define IDirect3DDevice3_BeginIndexed(p,a,b,c,d,e) (p)->lpVtbl->BeginIndexed(p,a,b,c,d,e) +#define IDirect3DDevice3_Vertex(p,a) (p)->lpVtbl->Vertex(p,a) +#define IDirect3DDevice3_Index(p,a) (p)->lpVtbl->Index(p,a) +#define IDirect3DDevice3_End(p,a) (p)->lpVtbl->End(p,a) +#define IDirect3DDevice3_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice3_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice3_GetLightState(p,a,b) (p)->lpVtbl->GetLightState(p,a,b) +#define IDirect3DDevice3_SetLightState(p,a,b) (p)->lpVtbl->SetLightState(p,a,b) +#define IDirect3DDevice3_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice3_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice3_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice3_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice3_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice3_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice3_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveStrided(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) +#define IDirect3DDevice3_DrawPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice3_ComputeSphereVisibility(p,a,b,c,d,e) (p)->lpVtbl->ComputeSphereVisibility(p,a,b,c,d,e) +#define IDirect3DDevice3_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice3_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice3_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice3_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice3_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#else +#define IDirect3DDevice3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice3_AddRef(p) (p)->AddRef() +#define IDirect3DDevice3_Release(p) (p)->Release() +#define IDirect3DDevice3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirect3DDevice3_GetStats(p,a) (p)->GetStats(a) +#define IDirect3DDevice3_AddViewport(p,a) (p)->AddViewport(a) +#define IDirect3DDevice3_DeleteViewport(p,a) (p)->DeleteViewport(a) +#define IDirect3DDevice3_NextViewport(p,a,b,c) (p)->NextViewport(a,b,c) +#define IDirect3DDevice3_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice3_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice3_EndScene(p) (p)->EndScene() +#define IDirect3DDevice3_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice3_SetCurrentViewport(p,a) (p)->SetCurrentViewport(a) +#define IDirect3DDevice3_GetCurrentViewport(p,a) (p)->GetCurrentViewport(a) +#define IDirect3DDevice3_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice3_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice3_Begin(p,a,b,c) (p)->Begin(a,b,c) +#define IDirect3DDevice3_BeginIndexed(p,a,b,c,d,e) (p)->BeginIndexed(a,b,c,d,e) +#define IDirect3DDevice3_Vertex(p,a) (p)->Vertex(a) +#define IDirect3DDevice3_Index(p,a) (p)->Index(a) +#define IDirect3DDevice3_End(p,a) (p)->End(a) +#define IDirect3DDevice3_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice3_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice3_GetLightState(p,a,b) (p)->GetLightState(a,b) +#define IDirect3DDevice3_SetLightState(p,a,b) (p)->SetLightState(a,b) +#define IDirect3DDevice3_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice3_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice3_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice3_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice3_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice3_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice3_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->DrawPrimitiveStrided(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveStrided(a,b,c,d,e,f,g) +#define IDirect3DDevice3_DrawPrimitiveVB(p,a,b,c,d,e) (p)->DrawPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice3_DrawIndexedPrimitiveVB(p,a,b,c,d,e) (p)->DrawIndexedPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice3_ComputeSphereVisibility(p,a,b,c,d,e) (p)->ComputeSphereVisibility(a,b,c,d,e) +#define IDirect3DDevice3_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice3_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice3_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice3_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice3_ValidateDevice(p,a) (p)->ValidateDevice(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3DDevice7 + +DECLARE_INTERFACE_(IDirect3DDevice7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice7 methods ***/ + STDMETHOD(GetCaps)(THIS_ LPD3DDEVICEDESC7) PURE; + STDMETHOD(EnumTextureFormats)(THIS_ LPD3DENUMPIXELFORMATSCALLBACK,LPVOID) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ LPDIRECT3D7*) PURE; + STDMETHOD(SetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7,DWORD) PURE; + STDMETHOD(GetRenderTarget)(THIS_ LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT7) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,LPD3DMATRIX) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT7) PURE; + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL7) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL7) PURE; + STDMETHOD(SetLight)(THIS_ DWORD,LPD3DLIGHT7) PURE; + STDMETHOD(GetLight)(THIS_ DWORD,LPD3DLIGHT7) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE,DWORD) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE,LPDWORD) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ LPDWORD) PURE; + STDMETHOD(PreLoad)(THIS_ LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(SetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(GetClipStatus)(THIS_ LPD3DCLIPSTATUS) PURE; + STDMETHOD(DrawPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveStrided)(THIS_ D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,DWORD) PURE; + STDMETHOD(DrawIndexedPrimitiveVB)(THIS_ D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,LPWORD,DWORD,DWORD) PURE; + STDMETHOD(ComputeSphereVisibility)(THIS_ LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD,LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD,LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD,D3DTEXTURESTAGESTATETYPE,DWORD) PURE; + STDMETHOD(ValidateDevice)(THIS_ LPDWORD) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE,LPDWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECTDRAWSURFACE7,LPPOINT,LPDIRECTDRAWSURFACE7,LPRECT,DWORD) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD,BOOL) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD,BOOL*) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD,D3DVALUE*) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD,D3DVALUE*) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD,LPVOID,DWORD) PURE; +}; + +typedef struct IDirect3DDevice7 *LPDIRECT3DDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice7_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirect3DDevice7_EnumTextureFormats(p,a,b) (p)->lpVtbl->EnumTextureFormats(p,a,b) +#define IDirect3DDevice7_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice7_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice7_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice7_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice7_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice7_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice7_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice7_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice7_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice7_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice7_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice7_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice7_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice7_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice7_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice7_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice7_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice7_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice7_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice7_PreLoad(p,a) (p)->lpVtbl->PreLoad(p,a) +#define IDirect3DDevice7_DrawPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice7_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice7_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveStrided(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_DrawPrimitiveVB(p,a,b,c,d,e) (p)->lpVtbl->DrawPrimitiveVB(p,a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) (p)->lpVtbl->DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) +#define IDirect3DDevice7_ComputeSphereVisibility(p,a,b,c,d,e) (p)->lpVtbl->ComputeSphereVisibility(p,a,b,c,d,e) +#define IDirect3DDevice7_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice7_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice7_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice7_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice7_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice7_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice7_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice7_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice7_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice7_Load(p,a,b,c,d,e) (p)->lpVtbl->Load(p,a,b,c,d,e) +#define IDirect3DDevice7_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice7_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice7_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice7_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice7_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#else +#define IDirect3DDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice7_AddRef(p) (p)->AddRef() +#define IDirect3DDevice7_Release(p) (p)->Release() +#define IDirect3DDevice7_GetCaps(p,a) (p)->GetCaps(a) +#define IDirect3DDevice7_EnumTextureFormats(p,a,b) (p)->EnumTextureFormats(a,b) +#define IDirect3DDevice7_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice7_EndScene(p) (p)->EndScene() +#define IDirect3DDevice7_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice7_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice7_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice7_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice7_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice7_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice7_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice7_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice7_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice7_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice7_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice7_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice7_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice7_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice7_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice7_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice7_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice7_PreLoad(p,a) (p)->PreLoad(a) +#define IDirect3DDevice7_DrawPrimitive(p,a,b,c,d,e) (p)->DrawPrimitive(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitive(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitive(a,b,c,d,e,f,g) +#define IDirect3DDevice7_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice7_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice7_DrawPrimitiveStrided(p,a,b,c,d,e) (p)->DrawPrimitiveStrided(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveStrided(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveStrided(a,b,c,d,e,f,g) +#define IDirect3DDevice7_DrawPrimitiveVB(p,a,b,c,d,e) (p)->DrawPrimitiveVB(a,b,c,d,e) +#define IDirect3DDevice7_DrawIndexedPrimitiveVB(p,a,b,c,d,e,f,g) (p)->DrawIndexedPrimitiveVB(a,b,c,d,e,f,g) +#define IDirect3DDevice7_ComputeSphereVisibility(p,a,b,c,d,e) (p)->ComputeSphereVisibility(a,b,c,d,e) +#define IDirect3DDevice7_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice7_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice7_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice7_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice7_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice7_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice7_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice7_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice7_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice7_Load(p,a,b,c,d,e) (p)->Load(a,b,c,d,e) +#define IDirect3DDevice7_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice7_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice7_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice7_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice7_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Execute Buffer interface + */ +#undef INTERFACE +#define INTERFACE IDirect3DExecuteBuffer + +DECLARE_INTERFACE_(IDirect3DExecuteBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DExecuteBuffer methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE,LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD(Lock)(THIS_ LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(SetExecuteData)(THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(GetExecuteData)(THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(Validate)(THIS_ LPDWORD,LPD3DVALIDATECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Optimize)(THIS_ DWORD) PURE; +}; + +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DExecuteBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->lpVtbl->Lock(p,a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->lpVtbl->SetExecuteData(p,a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->lpVtbl->GetExecuteData(p,a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->lpVtbl->Validate(p,a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->lpVtbl->Optimize(p,a) +#else +#define IDirect3DExecuteBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->AddRef() +#define IDirect3DExecuteBuffer_Release(p) (p)->Release() +#define IDirect3DExecuteBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirect3DExecuteBuffer_Lock(p,a) (p)->Lock(a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->Unlock() +#define IDirect3DExecuteBuffer_SetExecuteData(p,a) (p)->SetExecuteData(a) +#define IDirect3DExecuteBuffer_GetExecuteData(p,a) (p)->GetExecuteData(a) +#define IDirect3DExecuteBuffer_Validate(p,a,b,c,d) (p)->Validate(a,b,c,d) +#define IDirect3DExecuteBuffer_Optimize(p,a) (p)->Optimize(a) +#endif + +/* + * Light interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DLight + +DECLARE_INTERFACE_(IDirect3DLight, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DLight methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetLight)(THIS_ LPD3DLIGHT) PURE; + STDMETHOD(GetLight)(THIS_ LPD3DLIGHT) PURE; +}; + +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DLight_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DLight_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DLight_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DLight_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DLight_SetLight(p,a) (p)->lpVtbl->SetLight(p,a) +#define IDirect3DLight_GetLight(p,a) (p)->lpVtbl->GetLight(p,a) +#else +#define IDirect3DLight_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DLight_AddRef(p) (p)->AddRef() +#define IDirect3DLight_Release(p) (p)->Release() +#define IDirect3DLight_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DLight_SetLight(p,a) (p)->SetLight(a) +#define IDirect3DLight_GetLight(p,a) (p)->GetLight(a) +#endif + +/* + * Material interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DMaterial + +DECLARE_INTERFACE_(IDirect3DMaterial, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE,LPD3DMATERIALHANDLE) PURE; + STDMETHOD(Reserve)(THIS) PURE; + STDMETHOD(Unreserve)(THIS) PURE; +}; + +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DMaterial_Reserve(p) (p)->lpVtbl->Reserve(p) +#define IDirect3DMaterial_Unreserve(p) (p)->lpVtbl->Unreserve(p) +#else +#define IDirect3DMaterial_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial_Release(p) (p)->Release() +#define IDirect3DMaterial_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DMaterial_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DMaterial_Reserve(p) (p)->Reserve() +#define IDirect3DMaterial_Unreserve(p) (p)->Unreserve() +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DMaterial2 + +DECLARE_INTERFACE_(IDirect3DMaterial2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial2 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2,LPD3DMATERIALHANDLE) PURE; +}; + +typedef struct IDirect3DMaterial2 *LPDIRECT3DMATERIAL2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +#define IDirect3DMaterial2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial2_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial2_Release(p) (p)->Release() +#define IDirect3DMaterial2_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial2_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DMaterial3 + +DECLARE_INTERFACE_(IDirect3DMaterial3, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DMaterial3 methods ***/ + STDMETHOD(SetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial)(THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE3,LPD3DMATERIALHANDLE) PURE; +}; + +typedef struct IDirect3DMaterial3 *LPDIRECT3DMATERIAL3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#else +#define IDirect3DMaterial3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DMaterial3_AddRef(p) (p)->AddRef() +#define IDirect3DMaterial3_Release(p) (p)->Release() +#define IDirect3DMaterial3_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DMaterial3_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DMaterial3_GetHandle(p,a,b) (p)->GetHandle(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Texture interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DTexture + +DECLARE_INTERFACE_(IDirect3DTexture, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DTexture methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3DDEVICE,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE,LPD3DTEXTUREHANDLE) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE) PURE; + STDMETHOD(Unload)(THIS) PURE; +}; + +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirect3DTexture_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DTexture_PaletteChanged(p,a,b) (p)->lpVtbl->PaletteChanged(p,a,b) +#define IDirect3DTexture_Load(p,a) (p)->lpVtbl->Load(p,a) +#define IDirect3DTexture_Unload(p) (p)->lpVtbl->Unload(p) +#else +#define IDirect3DTexture_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture_AddRef(p) (p)->AddRef() +#define IDirect3DTexture_Release(p) (p)->Release() +#define IDirect3DTexture_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirect3DTexture_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DTexture_PaletteChanged(p,a,b) (p)->PaletteChanged(a,b) +#define IDirect3DTexture_Load(p,a) (p)->Load(a) +#define IDirect3DTexture_Unload(p) (p)->Unload() +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DTexture2 + +DECLARE_INTERFACE_(IDirect3DTexture2, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DTexture2 methods ***/ + STDMETHOD(GetHandle)(THIS_ LPDIRECT3DDEVICE2,LPD3DTEXTUREHANDLE) PURE; + STDMETHOD(PaletteChanged)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Load)(THIS_ LPDIRECT3DTEXTURE2) PURE; +}; + +typedef struct IDirect3DTexture2 *LPDIRECT3DTEXTURE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->lpVtbl->GetHandle(p,a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->lpVtbl->PaletteChanged(p,a,b) +#define IDirect3DTexture2_Load(p,a) (p)->lpVtbl->Load(p,a) +#else +#define IDirect3DTexture2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture2_AddRef(p) (p)->AddRef() +#define IDirect3DTexture2_Release(p) (p)->Release() +#define IDirect3DTexture2_GetHandle(p,a,b) (p)->GetHandle(a,b) +#define IDirect3DTexture2_PaletteChanged(p,a,b) (p)->PaletteChanged(a,b) +#define IDirect3DTexture2_Load(p,a) (p)->Load(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* + * Viewport interfaces + */ +#undef INTERFACE +#define INTERFACE IDirect3DViewport + +DECLARE_INTERFACE_(IDirect3DViewport, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; +}; + +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#else +#define IDirect3DViewport_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport_AddRef(p) (p)->AddRef() +#define IDirect3DViewport_Release(p) (p)->Release() +#define IDirect3DViewport_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#endif + +#if(DIRECT3D_VERSION >= 0x0500) +#undef INTERFACE +#define INTERFACE IDirect3DViewport2 + +DECLARE_INTERFACE_(IDirect3DViewport2, IDirect3DViewport) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; +}; + +typedef struct IDirect3DViewport2 *LPDIRECT3DVIEWPORT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport2_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#define IDirect3DViewport2_GetViewport2(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->lpVtbl->SetViewport2(p,a) +#else +#define IDirect3DViewport2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport2_AddRef(p) (p)->AddRef() +#define IDirect3DViewport2_Release(p) (p)->Release() +#define IDirect3DViewport2_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport2_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport2_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport2_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport2_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport2_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport2_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport2_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport2_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport2_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport2_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport2_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport2_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#define IDirect3DViewport2_GetViewport2(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport2_SetViewport2(p,a) (p)->SetViewport2(a) +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +#undef INTERFACE +#define INTERFACE IDirect3DViewport3 + +DECLARE_INTERFACE_(IDirect3DViewport3, IDirect3DViewport2) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DViewport2 methods ***/ + STDMETHOD(Initialize)(THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport)(THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices)(THIS_ DWORD,LPD3DTRANSFORMDATA,DWORD,LPDWORD) PURE; + STDMETHOD(LightElements)(THIS_ DWORD,LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground)(THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground)(THIS_ LPD3DMATERIALHANDLE,LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE*,LPBOOL) PURE; + STDMETHOD(Clear)(THIS_ DWORD,LPD3DRECT,DWORD) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight)(THIS_ LPDIRECT3DLIGHT,LPDIRECT3DLIGHT*,DWORD) PURE; + STDMETHOD(GetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetViewport2)(THIS_ LPD3DVIEWPORT2) PURE; + STDMETHOD(SetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(GetBackgroundDepth2)(THIS_ LPDIRECTDRAWSURFACE4*,LPBOOL) PURE; + STDMETHOD(Clear2)(THIS_ DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD) PURE; +}; + +typedef struct IDirect3DViewport3 *LPDIRECT3DVIEWPORT3; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DViewport3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport3_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->lpVtbl->TransformVertices(p,a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->lpVtbl->LightElements(p,a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->lpVtbl->SetBackground(p,a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->lpVtbl->GetBackground(p,a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->lpVtbl->SetBackgroundDepth(p,a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->lpVtbl->GetBackgroundDepth(p,a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->lpVtbl->Clear(p,a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->lpVtbl->AddLight(p,a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->lpVtbl->DeleteLight(p,a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->lpVtbl->NextLight(p,a,b,c) +#define IDirect3DViewport3_GetViewport2(p,a) (p)->lpVtbl->GetViewport2(p,a) +#define IDirect3DViewport3_SetViewport2(p,a) (p)->lpVtbl->SetViewport2(p,a) +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->lpVtbl->SetBackgroundDepth2(p,a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->lpVtbl->GetBackgroundDepth2(p,a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->lpVtbl->Clear2(p,a,b,c,d,e,f) +#else +#define IDirect3DViewport3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DViewport3_AddRef(p) (p)->AddRef() +#define IDirect3DViewport3_Release(p) (p)->Release() +#define IDirect3DViewport3_Initialize(p,a) (p)->Initialize(a) +#define IDirect3DViewport3_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DViewport3_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DViewport3_TransformVertices(p,a,b,c,d) (p)->TransformVertices(a,b,c,d) +#define IDirect3DViewport3_LightElements(p,a,b) (p)->LightElements(a,b) +#define IDirect3DViewport3_SetBackground(p,a) (p)->SetBackground(a) +#define IDirect3DViewport3_GetBackground(p,a,b) (p)->GetBackground(a,b) +#define IDirect3DViewport3_SetBackgroundDepth(p,a) (p)->SetBackgroundDepth(a) +#define IDirect3DViewport3_GetBackgroundDepth(p,a,b) (p)->GetBackgroundDepth(a,b) +#define IDirect3DViewport3_Clear(p,a,b,c) (p)->Clear(a,b,c) +#define IDirect3DViewport3_AddLight(p,a) (p)->AddLight(a) +#define IDirect3DViewport3_DeleteLight(p,a) (p)->DeleteLight(a) +#define IDirect3DViewport3_NextLight(p,a,b,c) (p)->NextLight(a,b,c) +#define IDirect3DViewport3_GetViewport2(p,a) (p)->GetViewport2(a) +#define IDirect3DViewport3_SetViewport2(p,a) (p)->SetViewport2(a) +#define IDirect3DViewport3_SetBackgroundDepth2(p,a) (p)->SetBackgroundDepth2(a) +#define IDirect3DViewport3_GetBackgroundDepth2(p,a,b) (p)->GetBackgroundDepth2(a,b) +#define IDirect3DViewport3_Clear2(p,a,b,c,d,e,f) (p)->Clear2(a,b,c,d,e,f) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer + +DECLARE_INTERFACE_(IDirect3DVertexBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexBuffer methods ***/ + STDMETHOD(Lock)(THIS_ DWORD,LPVOID*,LPDWORD) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(ProcessVertices)(THIS_ DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER,DWORD,LPDIRECT3DDEVICE3,DWORD) PURE; + STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC) PURE; + STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE3,DWORD) PURE; +}; + +typedef struct IDirect3DVertexBuffer *LPDIRECT3DVERTEXBUFFER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer_Lock(p,a,b,c) (p)->lpVtbl->Lock(p,a,b,c) +#define IDirect3DVertexBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer_ProcessVertices(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer_GetVertexBufferDesc(p,a) (p)->lpVtbl->GetVertexBufferDesc(p,a) +#define IDirect3DVertexBuffer_Optimize(p,a,b) (p)->lpVtbl->Optimize(p,a,b) +#else +#define IDirect3DVertexBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer_Release(p) (p)->Release() +#define IDirect3DVertexBuffer_Lock(p,a,b,c) (p)->Lock(a,b,c) +#define IDirect3DVertexBuffer_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer_ProcessVertices(p,a,b,c,d,e,f,g) (p)->ProcessVertices(a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer_GetVertexBufferDesc(p,a) (p)->GetVertexBufferDesc(a) +#define IDirect3DVertexBuffer_Optimize(p,a,b) (p)->Optimize(a,b) +#endif +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer7 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer7, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexBuffer7 methods ***/ + STDMETHOD(Lock)(THIS_ DWORD,LPVOID*,LPDWORD) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(ProcessVertices)(THIS_ DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER7,DWORD,LPDIRECT3DDEVICE7,DWORD) PURE; + STDMETHOD(GetVertexBufferDesc)(THIS_ LPD3DVERTEXBUFFERDESC) PURE; + STDMETHOD(Optimize)(THIS_ LPDIRECT3DDEVICE7,DWORD) PURE; + STDMETHOD(ProcessVerticesStrided)(THIS_ DWORD,DWORD,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPDIRECT3DDEVICE7,DWORD) PURE; +}; + +typedef struct IDirect3DVertexBuffer7 *LPDIRECT3DVERTEXBUFFER7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer7_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer7_Lock(p,a,b,c) (p)->lpVtbl->Lock(p,a,b,c) +#define IDirect3DVertexBuffer7_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer7_ProcessVertices(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer7_GetVertexBufferDesc(p,a) (p)->lpVtbl->GetVertexBufferDesc(p,a) +#define IDirect3DVertexBuffer7_Optimize(p,a,b) (p)->lpVtbl->Optimize(p,a,b) +#define IDirect3DVertexBuffer7_ProcessVerticesStrided(p,a,b,c,d,e,f,g) (p)->lpVtbl->ProcessVerticesStrided(p,a,b,c,d,e,f,g) +#else +#define IDirect3DVertexBuffer7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer7_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer7_Release(p) (p)->Release() +#define IDirect3DVertexBuffer7_Lock(p,a,b,c) (p)->Lock(a,b,c) +#define IDirect3DVertexBuffer7_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer7_ProcessVertices(p,a,b,c,d,e,f,g) (p)->ProcessVertices(a,b,c,d,e,f,g) +#define IDirect3DVertexBuffer7_GetVertexBufferDesc(p,a) (p)->GetVertexBufferDesc(a) +#define IDirect3DVertexBuffer7_Optimize(p,a,b) (p)->Optimize(a,b) +#define IDirect3DVertexBuffer7_ProcessVerticesStrided(p,a,b,c,d,e,f,g) (p)->ProcessVerticesStrided(a,b,c,d,e,f,g) +#endif +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +/**************************************************************************** + * + * Flags for IDirect3DDevice::NextViewport + * + ****************************************************************************/ + +/* + * Return the next viewport + */ +#define D3DNEXT_NEXT 0x00000001l + +/* + * Return the first viewport + */ +#define D3DNEXT_HEAD 0x00000002l + +/* + * Return the last viewport + */ +#define D3DNEXT_TAIL 0x00000004l + + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + +/* + * Wait until the device is ready to draw the primitive + * This will cause DP to not return DDERR_WASSTILLDRAWING + */ +#define D3DDP_WAIT 0x00000001l +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if (DIRECT3D_VERSION == 0x0500) +/* + * Hint that it is acceptable to render the primitive out of order. + */ +#define D3DDP_OUTOFORDER 0x00000002l +#endif + + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Hint that the primitives have been clipped by the application. + */ +#define D3DDP_DONOTCLIP 0x00000004l + +/* + * Hint that the extents need not be updated. + */ +#define D3DDP_DONOTUPDATEEXTENTS 0x00000008l +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +/* + * Hint that the lighting should not be applied on vertices. + */ + +#define D3DDP_DONOTLIGHT 0x00000010l + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Direct3D Errors + * DirectDraw error codes are used when errors not specified here. + */ +#define D3D_OK DD_OK +#define D3DERR_BADMAJORVERSION MAKE_DDHRESULT(700) +#define D3DERR_BADMINORVERSION MAKE_DDHRESULT(701) + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * An invalid device was requested by the application. + */ +#define D3DERR_INVALID_DEVICE MAKE_DDHRESULT(705) +#define D3DERR_INITFAILED MAKE_DDHRESULT(706) + +/* + * SetRenderTarget attempted on a device that was + * QI'd off the render target. + */ +#define D3DERR_DEVICEAGGREGATED MAKE_DDHRESULT(707) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_EXECUTE_CREATE_FAILED MAKE_DDHRESULT(710) +#define D3DERR_EXECUTE_DESTROY_FAILED MAKE_DDHRESULT(711) +#define D3DERR_EXECUTE_LOCK_FAILED MAKE_DDHRESULT(712) +#define D3DERR_EXECUTE_UNLOCK_FAILED MAKE_DDHRESULT(713) +#define D3DERR_EXECUTE_LOCKED MAKE_DDHRESULT(714) +#define D3DERR_EXECUTE_NOT_LOCKED MAKE_DDHRESULT(715) + +#define D3DERR_EXECUTE_FAILED MAKE_DDHRESULT(716) +#define D3DERR_EXECUTE_CLIPPED_FAILED MAKE_DDHRESULT(717) + +#define D3DERR_TEXTURE_NO_SUPPORT MAKE_DDHRESULT(720) +#define D3DERR_TEXTURE_CREATE_FAILED MAKE_DDHRESULT(721) +#define D3DERR_TEXTURE_DESTROY_FAILED MAKE_DDHRESULT(722) +#define D3DERR_TEXTURE_LOCK_FAILED MAKE_DDHRESULT(723) +#define D3DERR_TEXTURE_UNLOCK_FAILED MAKE_DDHRESULT(724) +#define D3DERR_TEXTURE_LOAD_FAILED MAKE_DDHRESULT(725) +#define D3DERR_TEXTURE_SWAP_FAILED MAKE_DDHRESULT(726) +#define D3DERR_TEXTURE_LOCKED MAKE_DDHRESULT(727) +#define D3DERR_TEXTURE_NOT_LOCKED MAKE_DDHRESULT(728) +#define D3DERR_TEXTURE_GETSURF_FAILED MAKE_DDHRESULT(729) + +#define D3DERR_MATRIX_CREATE_FAILED MAKE_DDHRESULT(730) +#define D3DERR_MATRIX_DESTROY_FAILED MAKE_DDHRESULT(731) +#define D3DERR_MATRIX_SETDATA_FAILED MAKE_DDHRESULT(732) +#define D3DERR_MATRIX_GETDATA_FAILED MAKE_DDHRESULT(733) +#define D3DERR_SETVIEWPORTDATA_FAILED MAKE_DDHRESULT(734) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INVALIDCURRENTVIEWPORT MAKE_DDHRESULT(735) +#define D3DERR_INVALIDPRIMITIVETYPE MAKE_DDHRESULT(736) +#define D3DERR_INVALIDVERTEXTYPE MAKE_DDHRESULT(737) +#define D3DERR_TEXTURE_BADSIZE MAKE_DDHRESULT(738) +#define D3DERR_INVALIDRAMPTEXTURE MAKE_DDHRESULT(739) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_MATERIAL_CREATE_FAILED MAKE_DDHRESULT(740) +#define D3DERR_MATERIAL_DESTROY_FAILED MAKE_DDHRESULT(741) +#define D3DERR_MATERIAL_SETDATA_FAILED MAKE_DDHRESULT(742) +#define D3DERR_MATERIAL_GETDATA_FAILED MAKE_DDHRESULT(743) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INVALIDPALETTE MAKE_DDHRESULT(744) + +#define D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY MAKE_DDHRESULT(745) +#define D3DERR_ZBUFF_NEEDS_VIDEOMEMORY MAKE_DDHRESULT(746) +#define D3DERR_SURFACENOTINVIDMEM MAKE_DDHRESULT(747) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_LIGHT_SET_FAILED MAKE_DDHRESULT(750) +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_LIGHTHASVIEWPORT MAKE_DDHRESULT(751) +#define D3DERR_LIGHTNOTINTHISVIEWPORT MAKE_DDHRESULT(752) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#define D3DERR_SCENE_IN_SCENE MAKE_DDHRESULT(760) +#define D3DERR_SCENE_NOT_IN_SCENE MAKE_DDHRESULT(761) +#define D3DERR_SCENE_BEGIN_FAILED MAKE_DDHRESULT(762) +#define D3DERR_SCENE_END_FAILED MAKE_DDHRESULT(763) + +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DERR_INBEGIN MAKE_DDHRESULT(770) +#define D3DERR_NOTINBEGIN MAKE_DDHRESULT(771) +#define D3DERR_NOVIEWPORTS MAKE_DDHRESULT(772) +#define D3DERR_VIEWPORTDATANOTSET MAKE_DDHRESULT(773) +#define D3DERR_VIEWPORTHASNODEVICE MAKE_DDHRESULT(774) +#define D3DERR_NOCURRENTVIEWPORT MAKE_DDHRESULT(775) +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DERR_INVALIDVERTEXFORMAT MAKE_DDHRESULT(2048) + +/* + * Attempted to CreateTexture on a surface that had a color key + */ +#define D3DERR_COLORKEYATTACHED MAKE_DDHRESULT(2050) + +#define D3DERR_VERTEXBUFFEROPTIMIZED MAKE_DDHRESULT(2060) +#define D3DERR_VBUF_CREATE_FAILED MAKE_DDHRESULT(2061) +#define D3DERR_VERTEXBUFFERLOCKED MAKE_DDHRESULT(2062) +#define D3DERR_VERTEXBUFFERUNLOCKFAILED MAKE_DDHRESULT(2063) + +#define D3DERR_ZBUFFER_NOTPRESENT MAKE_DDHRESULT(2070) +#define D3DERR_STENCILBUFFER_NOTPRESENT MAKE_DDHRESULT(2071) + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_DDHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_DDHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_DDHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_DDHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_DDHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_DDHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_DDHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_DDHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_DDHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_DDHRESULT(2082) +#define D3DERR_TOOMANYPRIMITIVES MAKE_DDHRESULT(2083) +#define D3DERR_INVALIDMATRIX MAKE_DDHRESULT(2084) +#define D3DERR_TOOMANYVERTICES MAKE_DDHRESULT(2085) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_DDHRESULT(2086) + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DERR_INVALIDSTATEBLOCK MAKE_DDHRESULT(2100) +#define D3DERR_INBEGINSTATEBLOCK MAKE_DDHRESULT(2101) +#define D3DERR_NOTINBEGINSTATEBLOCK MAKE_DDHRESULT(2102) +#endif /* DIRECT3D_VERSION >= 0x0700 */ + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION < 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/SDK/dxSDK/Include/d3d10misc.h b/SDK/dxSDK/Include/d3d10misc.h new file mode 100644 index 00000000..13c86f8a --- /dev/null +++ b/SDK/dxSDK/Include/d3d10misc.h @@ -0,0 +1,174 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Misc.h +// Content: D3D10 Device Creation APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10MISC_H__ +#define __D3D10MISC_H__ + +#include "d3d10.h" + +/////////////////////////////////////////////////////////////////////////// +// ID3D10Blob: +// ------------ +// The buffer object is used by D3D10 to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10Blob ID3D10Blob; +typedef interface ID3D10Blob *LPD3D10BLOB; + +// {8BA5FB08-5195-40e2-AC58-0D989C3A0102} +DEFINE_GUID(IID_ID3D10Blob, +0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); + +#undef INTERFACE +#define INTERFACE ID3D10Blob + +DECLARE_INTERFACE_(ID3D10Blob, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3D10Blob + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(SIZE_T, GetBufferSize)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3D10_DRIVER_TYPE +// ---------------- +// +// This identifier is used to determine the implementation of Direct3D10 +// to be used. +// +// Pass one of these values to D3D10CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +typedef enum D3D10_DRIVER_TYPE +{ + D3D10_DRIVER_TYPE_HARDWARE = 0, + D3D10_DRIVER_TYPE_REFERENCE = 1, + D3D10_DRIVER_TYPE_NULL = 2, + D3D10_DRIVER_TYPE_SOFTWARE = 3, +} D3D10_DRIVER_TYPE; + +DEFINE_GUID(GUID_DeviceType, +0xd722fb4d, 0x7a68, 0x437a, 0xb2, 0x0c, 0x58, 0x04, 0xee, 0x24, 0x94, 0xa6); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDevice +// ------------------ +// +// pAdapter +// If NULL, D3D10CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice. +// SDKVersion +// SDK version. Use the D3D10_SDK_VERSION macro. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3D10CreateDevice( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + UINT SDKVersion, + ID3D10Device **ppDevice); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDeviceAndSwapChain +// ------------------------------ +// +// ppAdapter +// If NULL, D3D10CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice. +// SDKVersion +// SDK version. Use the D3D10_SDK_VERSION macro. +// pSwapChainDesc +// Swap chain description, may be NULL. +// ppSwapChain +// Pointer to returned interface. May be NULL. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice +// IDXGIFactory::CreateSwapChain +// +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3D10CreateDeviceAndSwapChain( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + UINT SDKVersion, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device **ppDevice); + + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateBlob: +// ----------------- +// Creates a Buffer of n Bytes +////////////////////////////////////////////////////////////////////////// + +HRESULT WINAPI D3D10CreateBlob(SIZE_T NumBytes, LPD3D10BLOB *ppBuffer); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10EFFECT_H__ + + diff --git a/SDK/dxSDK/Include/d3d10sdklayers.h b/SDK/dxSDK/Include/d3d10sdklayers.h new file mode 100644 index 00000000..22ef1e0a --- /dev/null +++ b/SDK/dxSDK/Include/d3d10sdklayers.h @@ -0,0 +1,1294 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0499 */ +/* Compiler settings for d3d10sdklayers.idl: + Oicf, W1, Zp8, env=Win64 (32b run) + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10sdklayers_h__ +#define __d3d10sdklayers_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10Debug_FWD_DEFINED__ +#define __ID3D10Debug_FWD_DEFINED__ +typedef interface ID3D10Debug ID3D10Debug; +#endif /* __ID3D10Debug_FWD_DEFINED__ */ + + +#ifndef __ID3D10SwitchToRef_FWD_DEFINED__ +#define __ID3D10SwitchToRef_FWD_DEFINED__ +typedef interface ID3D10SwitchToRef ID3D10SwitchToRef; +#endif /* __ID3D10SwitchToRef_FWD_DEFINED__ */ + + +#ifndef __ID3D10InfoQueue_FWD_DEFINED__ +#define __ID3D10InfoQueue_FWD_DEFINED__ +typedef interface ID3D10InfoQueue ID3D10InfoQueue; +#endif /* __ID3D10InfoQueue_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0000 */ +/* [local] */ + +#define D3D10_SDK_LAYERS_VERSION ( 11 ) + +#define D3D10_DEBUG_FEATURE_FLUSH_PER_RENDER_OP ( 0x1 ) + +#define D3D10_DEBUG_FEATURE_FINISH_PER_RENDER_OP ( 0x2 ) + +#define D3D10_DEBUG_FEATURE_PRESENT_PER_RENDER_OP ( 0x4 ) + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10Debug_INTERFACE_DEFINED__ +#define __ID3D10Debug_INTERFACE_DEFINED__ + +/* interface ID3D10Debug */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Debug; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E01-342C-4106-A19F-4F2704F689F0") + ID3D10Debug : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( + UINT Mask) = 0; + + virtual UINT STDMETHODCALLTYPE GetFeatureMask( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPresentPerRenderOpDelay( + UINT Milliseconds) = 0; + + virtual UINT STDMETHODCALLTYPE GetPresentPerRenderOpDelay( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSwapChain( + /* */ + __in_opt IDXGISwapChain *pSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSwapChain( + /* */ + __out IDXGISwapChain **ppSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE Validate( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DebugVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Debug * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Debug * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D10Debug * This, + UINT Mask); + + UINT ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetPresentPerRenderOpDelay )( + ID3D10Debug * This, + UINT Milliseconds); + + UINT ( STDMETHODCALLTYPE *GetPresentPerRenderOpDelay )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetSwapChain )( + ID3D10Debug * This, + /* */ + __in_opt IDXGISwapChain *pSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSwapChain )( + ID3D10Debug * This, + /* */ + __out IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *Validate )( + ID3D10Debug * This); + + END_INTERFACE + } ID3D10DebugVtbl; + + interface ID3D10Debug + { + CONST_VTBL struct ID3D10DebugVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Debug_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Debug_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Debug_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Debug_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D10Debug_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D10Debug_SetPresentPerRenderOpDelay(This,Milliseconds) \ + ( (This)->lpVtbl -> SetPresentPerRenderOpDelay(This,Milliseconds) ) + +#define ID3D10Debug_GetPresentPerRenderOpDelay(This) \ + ( (This)->lpVtbl -> GetPresentPerRenderOpDelay(This) ) + +#define ID3D10Debug_SetSwapChain(This,pSwapChain) \ + ( (This)->lpVtbl -> SetSwapChain(This,pSwapChain) ) + +#define ID3D10Debug_GetSwapChain(This,ppSwapChain) \ + ( (This)->lpVtbl -> GetSwapChain(This,ppSwapChain) ) + +#define ID3D10Debug_Validate(This) \ + ( (This)->lpVtbl -> Validate(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Debug_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10SwitchToRef_INTERFACE_DEFINED__ +#define __ID3D10SwitchToRef_INTERFACE_DEFINED__ + +/* interface ID3D10SwitchToRef */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10SwitchToRef; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E02-342C-4106-A19F-4F2704F689F0") + ID3D10SwitchToRef : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE SetUseRef( + BOOL UseRef) = 0; + + virtual BOOL STDMETHODCALLTYPE GetUseRef( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10SwitchToRefVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10SwitchToRef * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10SwitchToRef * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10SwitchToRef * This); + + BOOL ( STDMETHODCALLTYPE *SetUseRef )( + ID3D10SwitchToRef * This, + BOOL UseRef); + + BOOL ( STDMETHODCALLTYPE *GetUseRef )( + ID3D10SwitchToRef * This); + + END_INTERFACE + } ID3D10SwitchToRefVtbl; + + interface ID3D10SwitchToRef + { + CONST_VTBL struct ID3D10SwitchToRefVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10SwitchToRef_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10SwitchToRef_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10SwitchToRef_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10SwitchToRef_SetUseRef(This,UseRef) \ + ( (This)->lpVtbl -> SetUseRef(This,UseRef) ) + +#define ID3D10SwitchToRef_GetUseRef(This) \ + ( (This)->lpVtbl -> GetUseRef(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10SwitchToRef_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_MESSAGE_CATEGORY + { D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D10_MESSAGE_CATEGORY_MISCELLANEOUS = ( D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED + 1 ) , + D3D10_MESSAGE_CATEGORY_INITIALIZATION = ( D3D10_MESSAGE_CATEGORY_MISCELLANEOUS + 1 ) , + D3D10_MESSAGE_CATEGORY_CLEANUP = ( D3D10_MESSAGE_CATEGORY_INITIALIZATION + 1 ) , + D3D10_MESSAGE_CATEGORY_COMPILATION = ( D3D10_MESSAGE_CATEGORY_CLEANUP + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_CREATION = ( D3D10_MESSAGE_CATEGORY_COMPILATION + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_SETTING = ( D3D10_MESSAGE_CATEGORY_STATE_CREATION + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_GETTING = ( D3D10_MESSAGE_CATEGORY_STATE_SETTING + 1 ) , + D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = ( D3D10_MESSAGE_CATEGORY_STATE_GETTING + 1 ) , + D3D10_MESSAGE_CATEGORY_EXECUTION = ( D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1 ) + } D3D10_MESSAGE_CATEGORY; + +typedef +enum D3D10_MESSAGE_SEVERITY + { D3D10_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D10_MESSAGE_SEVERITY_ERROR = ( D3D10_MESSAGE_SEVERITY_CORRUPTION + 1 ) , + D3D10_MESSAGE_SEVERITY_WARNING = ( D3D10_MESSAGE_SEVERITY_ERROR + 1 ) , + D3D10_MESSAGE_SEVERITY_INFO = ( D3D10_MESSAGE_SEVERITY_WARNING + 1 ) + } D3D10_MESSAGE_SEVERITY; + +typedef +enum D3D10_MESSAGE_ID + { D3D10_MESSAGE_ID_UNKNOWN = 0, + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_UNKNOWN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_STRING_FROM_APPLICATION = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_THIS = ( D3D10_MESSAGE_ID_STRING_FROM_APPLICATION + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 = ( D3D10_MESSAGE_ID_CORRUPTED_THIS + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 + 1 ) , + D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING + 1 ) , + D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = ( D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = ( D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED + 1 ) , + D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE + 1 ) , + D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = ( D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT + 1 ) , + D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR + 1 ) , + D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = ( D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_REF_THREADING_MODE = ( D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE + 1 ) , + D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_THREADING_MODE + 1 ) , + D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION = ( D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = ( D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE + 1 ) , + D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY = ( D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER + 1 ) , + D3D10_MESSAGE_ID_REF_INFO = ( D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_REF_INFO + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = ( D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY + 1 ) , + D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEPREDICATE_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATEPREDICATE_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC = ( D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN + 1 ) , + D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = ( D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = ( D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE + 1 ) , + D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = ( D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE + 1 ) , + D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION + 1 ) , + D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = ( D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = ( D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH + 1 ) + } D3D10_MESSAGE_ID; + +typedef struct D3D10_MESSAGE + { + D3D10_MESSAGE_CATEGORY Category; + D3D10_MESSAGE_SEVERITY Severity; + D3D10_MESSAGE_ID ID; + const char *pDescription; + SIZE_T DescriptionByteLength; + } D3D10_MESSAGE; + +typedef struct D3D10_INFO_QUEUE_FILTER_DESC + { + UINT NumCategories; + D3D10_MESSAGE_CATEGORY *pCategoryList; + UINT NumSeverities; + D3D10_MESSAGE_SEVERITY *pSeverityList; + UINT NumIDs; + D3D10_MESSAGE_ID *pIDList; + } D3D10_INFO_QUEUE_FILTER_DESC; + +typedef struct D3D10_INFO_QUEUE_FILTER + { + D3D10_INFO_QUEUE_FILTER_DESC AllowList; + D3D10_INFO_QUEUE_FILTER_DESC DenyList; + } D3D10_INFO_QUEUE_FILTER; + +#define D3D10_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10InfoQueue_INTERFACE_DEFINED__ +#define __ID3D10InfoQueue_INTERFACE_DEFINED__ + +/* interface ID3D10InfoQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10InfoQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1b940b17-2642-4d1f-ab1f-b99bad0c395f") + ID3D10InfoQueue : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetMessageCountLimit( + /* */ + __in UINT64 MessageCountLimit) = 0; + + virtual void STDMETHODCALLTYPE ClearStoredMessages( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMessage( + /* */ + __in UINT64 MessageIndex, + /* */ + __out_bcount_opt(*pMessageByteLength) D3D10_MESSAGE *pMessage, + /* */ + __inout SIZE_T *pMessageByteLength) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesAllowedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDeniedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessages( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessagesAllowedByRetrievalFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDiscardedByMessageCountLimit( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetMessageCountLimit( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddStorageFilterEntries( + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFilter( + /* */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushStorageFilter( + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopStorageFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetStorageFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRetrievalFilterEntries( + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRetrievalFilter( + /* */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushRetrievalFilter( + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopRetrievalFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetRetrievalFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddMessage( + /* */ + __in D3D10_MESSAGE_CATEGORY Category, + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in D3D10_MESSAGE_ID ID, + /* */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddApplicationMessage( + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnCategory( + /* */ + __in D3D10_MESSAGE_CATEGORY Category, + /* */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnSeverity( + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnID( + /* */ + __in D3D10_MESSAGE_ID ID, + /* */ + __in BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnCategory( + /* */ + __in D3D10_MESSAGE_CATEGORY Category) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnSeverity( + /* */ + __in D3D10_MESSAGE_SEVERITY Severity) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnID( + /* */ + __in D3D10_MESSAGE_ID ID) = 0; + + virtual void STDMETHODCALLTYPE SetMuteDebugOutput( + /* */ + __in BOOL bMute) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMuteDebugOutput( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10InfoQueueVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10InfoQueue * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10InfoQueue * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( + ID3D10InfoQueue * This, + /* */ + __in UINT64 MessageCountLimit); + + void ( STDMETHODCALLTYPE *ClearStoredMessages )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *GetMessage )( + ID3D10InfoQueue * This, + /* */ + __in UINT64 MessageIndex, + /* */ + __out_bcount_opt(*pMessageByteLength) D3D10_MESSAGE *pMessage, + /* */ + __inout SIZE_T *pMessageByteLength); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( + ID3D10InfoQueue * This, + /* */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopStorageFilter )( + ID3D10InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( + ID3D10InfoQueue * This, + /* */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopRetrievalFilter )( + ID3D10InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddMessage )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_CATEGORY Category, + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in D3D10_MESSAGE_ID ID, + /* */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_CATEGORY Category, + /* */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_ID ID, + /* */ + __in BOOL bEnable); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_CATEGORY Category); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_SEVERITY Severity); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( + ID3D10InfoQueue * This, + /* */ + __in D3D10_MESSAGE_ID ID); + + void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( + ID3D10InfoQueue * This, + /* */ + __in BOOL bMute); + + BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( + ID3D10InfoQueue * This); + + END_INTERFACE + } ID3D10InfoQueueVtbl; + + interface ID3D10InfoQueue + { + CONST_VTBL struct ID3D10InfoQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10InfoQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10InfoQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10InfoQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) + +#define ID3D10InfoQueue_ClearStoredMessages(This) \ + ( (This)->lpVtbl -> ClearStoredMessages(This) ) + +#define ID3D10InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) + +#define ID3D10InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) + +#define ID3D10InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) + +#define ID3D10InfoQueue_GetNumStoredMessages(This) \ + ( (This)->lpVtbl -> GetNumStoredMessages(This) ) + +#define ID3D10InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) + +#define ID3D10InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) + +#define ID3D10InfoQueue_GetMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetMessageCountLimit(This) ) + +#define ID3D10InfoQueue_AddStorageFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) + +#define ID3D10InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D10InfoQueue_ClearStorageFilter(This) \ + ( (This)->lpVtbl -> ClearStorageFilter(This) ) + +#define ID3D10InfoQueue_PushEmptyStorageFilter(This) \ + ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) + +#define ID3D10InfoQueue_PushCopyOfStorageFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) + +#define ID3D10InfoQueue_PushStorageFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) + +#define ID3D10InfoQueue_PopStorageFilter(This) \ + ( (This)->lpVtbl -> PopStorageFilter(This) ) + +#define ID3D10InfoQueue_GetStorageFilterStackSize(This) \ + ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) + +#define ID3D10InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) + +#define ID3D10InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D10InfoQueue_ClearRetrievalFilter(This) \ + ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushEmptyRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushCopyOfRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushRetrievalFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) + +#define ID3D10InfoQueue_PopRetrievalFilter(This) \ + ( (This)->lpVtbl -> PopRetrievalFilter(This) ) + +#define ID3D10InfoQueue_GetRetrievalFilterStackSize(This) \ + ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) + +#define ID3D10InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) + +#define ID3D10InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) + +#define ID3D10InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) + +#define ID3D10InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) + +#define ID3D10InfoQueue_SetBreakOnID(This,ID,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) + +#define ID3D10InfoQueue_GetBreakOnCategory(This,Category) \ + ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) + +#define ID3D10InfoQueue_GetBreakOnSeverity(This,Severity) \ + ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) + +#define ID3D10InfoQueue_GetBreakOnID(This,ID) \ + ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) + +#define ID3D10InfoQueue_SetMuteDebugOutput(This,bMute) \ + ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) + +#define ID3D10InfoQueue_GetMuteDebugOutput(This) \ + ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10InfoQueue_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0003 */ +/* [local] */ + +#define D3D10_REGKEY_PATH __TEXT("Software\\Microsoft\\Direct3D") +#define D3D10_MUTE_DEBUG_OUTPUT __TEXT("MuteDebugOutput") +#define D3D10_ENABLE_BREAK_ON_MESSAGE __TEXT("EnableBreakOnMessage") +#define D3D10_INFOQUEUE_STORAGE_FILTER_OVERRIDE __TEXT("InfoQueueStorageFilterOverride") +#define D3D10_MUTE_CATEGORY __TEXT("Mute_CATEGORY_%s") +#define D3D10_MUTE_SEVERITY __TEXT("Mute_SEVERITY_%s") +#define D3D10_MUTE_ID_STRING __TEXT("Mute_ID_%s") +#define D3D10_MUTE_ID_DECIMAL __TEXT("Mute_ID_%d") +#define D3D10_UNMUTE_SEVERITY_INFO __TEXT("Unmute_SEVERITY_INFO") +#define D3D10_BREAKON_CATEGORY __TEXT("BreakOn_CATEGORY_%s") +#define D3D10_BREAKON_SEVERITY __TEXT("BreakOn_SEVERITY_%s") +#define D3D10_BREAKON_ID_STRING __TEXT("BreakOn_ID_%s") +#define D3D10_BREAKON_ID_DECIMAL __TEXT("BreakOn_ID_%d") +#define D3D10_APPSIZE_STRING __TEXT("Size") +#define D3D10_APPNAME_STRING __TEXT("Name") +DEFINE_GUID(IID_ID3D10Debug,0x9B7E4E01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10SwitchToRef,0x9B7E4E02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10InfoQueue,0x1b940b17,0x2642,0x4d1f,0xab,0x1f,0xb9,0x9b,0xad,0x0c,0x39,0x5f); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/d3d8.h b/SDK/dxSDK/Include/d3d8.h new file mode 100644 index 00000000..adf91ebf --- /dev/null +++ b/SDK/dxSDK/Include/d3d8.h @@ -0,0 +1,1279 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D8_H_ +#define _D3D8_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + + +/* This identifier is passed to Direct3DCreate8 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate8 will fail. + * (The number itself has no meaning.)*/ + +#define D3D_SDK_VERSION 220 + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D8 */ +/* {1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512} */ +DEFINE_GUID(IID_IDirect3D8, 0x1dd9e8da, 0x1c77, 0x4d40, 0xb0, 0xcf, 0x98, 0xfe, 0xfd, 0xff, 0x95, 0x12); + +/* IID_IDirect3DDevice8 */ +/* {7385E5DF-8FE8-41D5-86B6-D7B48547B6CF} */ +DEFINE_GUID(IID_IDirect3DDevice8, 0x7385e5df, 0x8fe8, 0x41d5, 0x86, 0xb6, 0xd7, 0xb4, 0x85, 0x47, 0xb6, 0xcf); + +/* IID_IDirect3DResource8 */ +/* {1B36BB7B-09B7-410a-B445-7D1430D7B33F} */ +DEFINE_GUID(IID_IDirect3DResource8, 0x1b36bb7b, 0x9b7, 0x410a, 0xb4, 0x45, 0x7d, 0x14, 0x30, 0xd7, 0xb3, 0x3f); + +/* IID_IDirect3DBaseTexture8 */ +/* {B4211CFA-51B9-4a9f-AB78-DB99B2BB678E} */ +DEFINE_GUID(IID_IDirect3DBaseTexture8, 0xb4211cfa, 0x51b9, 0x4a9f, 0xab, 0x78, 0xdb, 0x99, 0xb2, 0xbb, 0x67, 0x8e); + +/* IID_IDirect3DTexture8 */ +/* {E4CDD575-2866-4f01-B12E-7EECE1EC9358} */ +DEFINE_GUID(IID_IDirect3DTexture8, 0xe4cdd575, 0x2866, 0x4f01, 0xb1, 0x2e, 0x7e, 0xec, 0xe1, 0xec, 0x93, 0x58); + +/* IID_IDirect3DCubeTexture8 */ +/* {3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750} */ +DEFINE_GUID(IID_IDirect3DCubeTexture8, 0x3ee5b968, 0x2aca, 0x4c34, 0x8b, 0xb5, 0x7e, 0x0c, 0x3d, 0x19, 0xb7, 0x50); + +/* IID_IDirect3DVolumeTexture8 */ +/* {4B8AAAFA-140F-42ba-9131-597EAFAA2EAD} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture8, 0x4b8aaafa, 0x140f, 0x42ba, 0x91, 0x31, 0x59, 0x7e, 0xaf, 0xaa, 0x2e, 0xad); + +/* IID_IDirect3DVertexBuffer8 */ +/* {8AEEEAC7-05F9-44d4-B591-000B0DF1CB95} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer8, 0x8aeeeac7, 0x05f9, 0x44d4, 0xb5, 0x91, 0x00, 0x0b, 0x0d, 0xf1, 0xcb, 0x95); + +/* IID_IDirect3DIndexBuffer8 */ +/* {0E689C9A-053D-44a0-9D92-DB0E3D750F86} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer8, 0x0e689c9a, 0x053d, 0x44a0, 0x9d, 0x92, 0xdb, 0x0e, 0x3d, 0x75, 0x0f, 0x86); + +/* IID_IDirect3DSurface8 */ +/* {B96EEBCA-B326-4ea5-882F-2FF5BAE021DD} */ +DEFINE_GUID(IID_IDirect3DSurface8, 0xb96eebca, 0xb326, 0x4ea5, 0x88, 0x2f, 0x2f, 0xf5, 0xba, 0xe0, 0x21, 0xdd); + +/* IID_IDirect3DVolume8 */ +/* {BD7349F5-14F1-42e4-9C79-972380DB40C0} */ +DEFINE_GUID(IID_IDirect3DVolume8, 0xbd7349f5, 0x14f1, 0x42e4, 0x9c, 0x79, 0x97, 0x23, 0x80, 0xdb, 0x40, 0xc0); + +/* IID_IDirect3DSwapChain8 */ +/* {928C088B-76B9-4C6B-A536-A590853876CD} */ +DEFINE_GUID(IID_IDirect3DSwapChain8, 0x928c088b, 0x76b9, 0x4c6b, 0xa5, 0x36, 0xa5, 0x90, 0x85, 0x38, 0x76, 0xcd); + +#endif + +#ifdef __cplusplus + +interface IDirect3D8; +interface IDirect3DDevice8; + +interface IDirect3DResource8; +interface IDirect3DBaseTexture8; +interface IDirect3DTexture8; +interface IDirect3DVolumeTexture8; +interface IDirect3DCubeTexture8; + +interface IDirect3DVertexBuffer8; +interface IDirect3DIndexBuffer8; + +interface IDirect3DSurface8; +interface IDirect3DVolume8; + +interface IDirect3DSwapChain8; + +#endif + + +typedef interface IDirect3D8 IDirect3D8; +typedef interface IDirect3DDevice8 IDirect3DDevice8; +typedef interface IDirect3DResource8 IDirect3DResource8; +typedef interface IDirect3DBaseTexture8 IDirect3DBaseTexture8; +typedef interface IDirect3DTexture8 IDirect3DTexture8; +typedef interface IDirect3DVolumeTexture8 IDirect3DVolumeTexture8; +typedef interface IDirect3DCubeTexture8 IDirect3DCubeTexture8; +typedef interface IDirect3DVertexBuffer8 IDirect3DVertexBuffer8; +typedef interface IDirect3DIndexBuffer8 IDirect3DIndexBuffer8; +typedef interface IDirect3DSurface8 IDirect3DSurface8; +typedef interface IDirect3DVolume8 IDirect3DVolume8; +typedef interface IDirect3DSwapChain8 IDirect3DSwapChain8; + +#include "d3d8types.h" +#include "d3d8caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D8 object. This object supports + * enumeration and allows the creation of Direct3DDevice8 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D8 * WINAPI Direct3DCreate8(UINT SDKVersion); + + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D8 + +DECLARE_INTERFACE_(IDirect3D8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D8 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER8* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE CheckType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL Windowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS8* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice8** ppReturnedDeviceInterface) PURE; +}; + +typedef struct IDirect3D8 *LPDIRECT3D8, *PDIRECT3D8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D8_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->lpVtbl->GetAdapterModeCount(p,a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->lpVtbl->EnumAdapterModes(p,a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D8_AddRef(p) (p)->AddRef() +#define IDirect3D8_Release(p) (p)->Release() +#define IDirect3D8_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D8_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D8_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D8_GetAdapterModeCount(p,a) (p)->GetAdapterModeCount(a) +#define IDirect3D8_EnumAdapterModes(p,a,b,c) (p)->EnumAdapterModes(a,b,c) +#define IDirect3D8_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D8_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D8_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D8_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->CheckDeviceMultiSampleType(a,b,c,d,e) +#define IDirect3D8_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D8_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D8_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D8_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice8 + +DECLARE_INTERFACE_(IDirect3DDevice8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice8 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(ResourceManagerDiscardBytes)(THIS_ DWORD Bytes) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D8** ppD3D8) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS8* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface8* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CreateImageSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface) PURE; + STDMETHOD(CopyRects)(THIS_ IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture) PURE; + STDMETHOD(GetFrontBuffer)(THIS_ IDirect3DSurface8* pDestSurface) PURE; + STDMETHOD(SetRenderTarget)(THIS_ IDirect3DSurface8* pRenderTarget,IDirect3DSurface8* pNewZStencil) PURE; + STDMETHOD(GetRenderTarget)(THIS_ IDirect3DSurface8** ppRenderTarget) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface8** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT8* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL8* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT8*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT8*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken) PURE; + STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,DWORD* pToken) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS8* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture8* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage) PURE; + STDMETHOD(SetVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle) PURE; + STDMETHOD(SetPixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle) PURE; + STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle) PURE; + STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount) PURE; + STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; +}; + +typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->lpVtbl->ResourceManagerDiscardBytes(p,a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->lpVtbl->GetGammaRamp(p,a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->lpVtbl->CreateImageSurface(p,a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->lpVtbl->CopyRects(p,a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->lpVtbl->GetFrontBuffer(p,a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->lpVtbl->GetRenderTarget(p,a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice8_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice8_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->lpVtbl->ApplyStateBlock(p,a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->lpVtbl->CaptureStateBlock(p,a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->lpVtbl->DeleteStateBlock(p,a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->lpVtbl->GetInfo(p,a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->lpVtbl->DeleteVertexShader(p,a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->lpVtbl->GetVertexShaderDeclaration(p,a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->lpVtbl->GetVertexShaderFunction(p,a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->lpVtbl->SetStreamSource(p,a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->lpVtbl->GetStreamSource(p,a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->lpVtbl->SetIndices(p,a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->lpVtbl->DeletePixelShader(p,a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstant(p,a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->lpVtbl->GetPixelShaderFunction(p,a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#else +#define IDirect3DDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice8_AddRef(p) (p)->AddRef() +#define IDirect3DDevice8_Release(p) (p)->Release() +#define IDirect3DDevice8_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice8_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice8_ResourceManagerDiscardBytes(p,a) (p)->ResourceManagerDiscardBytes(a) +#define IDirect3DDevice8_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice8_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice8_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DDevice8_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice8_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice8_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice8_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice8_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice8_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DDevice8_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DDevice8_SetGammaRamp(p,a,b) (p)->SetGammaRamp(a,b) +#define IDirect3DDevice8_GetGammaRamp(p,a) (p)->GetGammaRamp(a) +#define IDirect3DDevice8_CreateTexture(p,a,b,c,d,e,f,g) (p)->CreateTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice8_CreateVolumeTexture(p,a,b,c,d,e,f,g,h) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_CreateCubeTexture(p,a,b,c,d,e,f) (p)->CreateCubeTexture(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateVertexBuffer(p,a,b,c,d,e) (p)->CreateVertexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateIndexBuffer(p,a,b,c,d,e) (p)->CreateIndexBuffer(a,b,c,d,e) +#define IDirect3DDevice8_CreateRenderTarget(p,a,b,c,d,e,f) (p)->CreateRenderTarget(a,b,c,d,e,f) +#define IDirect3DDevice8_CreateDepthStencilSurface(p,a,b,c,d,e) (p)->CreateDepthStencilSurface(a,b,c,d,e) +#define IDirect3DDevice8_CreateImageSurface(p,a,b,c,d) (p)->CreateImageSurface(a,b,c,d) +#define IDirect3DDevice8_CopyRects(p,a,b,c,d,e) (p)->CopyRects(a,b,c,d,e) +#define IDirect3DDevice8_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice8_GetFrontBuffer(p,a) (p)->GetFrontBuffer(a) +#define IDirect3DDevice8_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice8_GetRenderTarget(p,a) (p)->GetRenderTarget(a) +#define IDirect3DDevice8_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice8_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice8_EndScene(p) (p)->EndScene() +#define IDirect3DDevice8_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice8_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice8_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice8_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice8_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice8_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice8_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice8_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice8_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice8_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice8_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice8_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice8_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice8_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice8_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice8_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice8_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice8_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice8_ApplyStateBlock(p,a) (p)->ApplyStateBlock(a) +#define IDirect3DDevice8_CaptureStateBlock(p,a) (p)->CaptureStateBlock(a) +#define IDirect3DDevice8_DeleteStateBlock(p,a) (p)->DeleteStateBlock(a) +#define IDirect3DDevice8_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice8_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice8_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice8_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice8_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice8_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice8_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice8_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice8_GetInfo(p,a,b,c) (p)->GetInfo(a,b,c) +#define IDirect3DDevice8_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice8_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice8_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice8_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice8_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice8_DrawIndexedPrimitive(p,a,b,c,d,e) (p)->DrawIndexedPrimitive(a,b,c,d,e) +#define IDirect3DDevice8_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice8_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice8_ProcessVertices(p,a,b,c,d,e) (p)->ProcessVertices(a,b,c,d,e) +#define IDirect3DDevice8_CreateVertexShader(p,a,b,c,d) (p)->CreateVertexShader(a,b,c,d) +#define IDirect3DDevice8_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice8_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice8_DeleteVertexShader(p,a) (p)->DeleteVertexShader(a) +#define IDirect3DDevice8_SetVertexShaderConstant(p,a,b,c) (p)->SetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderConstant(p,a,b,c) (p)->GetVertexShaderConstant(a,b,c) +#define IDirect3DDevice8_GetVertexShaderDeclaration(p,a,b,c) (p)->GetVertexShaderDeclaration(a,b,c) +#define IDirect3DDevice8_GetVertexShaderFunction(p,a,b,c) (p)->GetVertexShaderFunction(a,b,c) +#define IDirect3DDevice8_SetStreamSource(p,a,b,c) (p)->SetStreamSource(a,b,c) +#define IDirect3DDevice8_GetStreamSource(p,a,b,c) (p)->GetStreamSource(a,b,c) +#define IDirect3DDevice8_SetIndices(p,a,b) (p)->SetIndices(a,b) +#define IDirect3DDevice8_GetIndices(p,a,b) (p)->GetIndices(a,b) +#define IDirect3DDevice8_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice8_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice8_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice8_DeletePixelShader(p,a) (p)->DeletePixelShader(a) +#define IDirect3DDevice8_SetPixelShaderConstant(p,a,b,c) (p)->SetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderConstant(p,a,b,c) (p)->GetPixelShaderConstant(a,b,c) +#define IDirect3DDevice8_GetPixelShaderFunction(p,a,b,c) (p)->GetPixelShaderFunction(a,b,c) +#define IDirect3DDevice8_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice8_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice8_DeletePatch(p,a) (p)->DeletePatch(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain8 + +DECLARE_INTERFACE_(IDirect3DSwapChain8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain8 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) PURE; +}; + +typedef struct IDirect3DSwapChain8 *LPDIRECT3DSWAPCHAIN8, *PDIRECT3DSWAPCHAIN8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#else +#define IDirect3DSwapChain8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain8_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain8_Release(p) (p)->Release() +#define IDirect3DSwapChain8_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DSwapChain8_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource8 + +DECLARE_INTERFACE_(IDirect3DResource8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource8 *LPDIRECT3DRESOURCE8, *PDIRECT3DRESOURCE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource8_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource8_AddRef(p) (p)->AddRef() +#define IDirect3DResource8_Release(p) (p)->Release() +#define IDirect3DResource8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource8_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource8_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource8_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture8 + +DECLARE_INTERFACE_(IDirect3DBaseTexture8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture8 *LPDIRECT3DBASETEXTURE8, *PDIRECT3DBASETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#else +#define IDirect3DBaseTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture8_Release(p) (p)->Release() +#define IDirect3DBaseTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture8_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture8_GetLevelCount(p) (p)->GetLevelCount() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture8 + +DECLARE_INTERFACE_(IDirect3DTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface8** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DTexture8 *LPDIRECT3DTEXTURE8, *PDIRECT3DTEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DTexture8_Release(p) (p)->Release() +#define IDirect3DTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture8_GetType(p) (p)->GetType() +#define IDirect3DTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture8_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture8_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture8_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture8_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture8 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume8** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; + +typedef struct IDirect3DVolumeTexture8 *LPDIRECT3DVOLUMETEXTURE8, *PDIRECT3DVOLUMETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture8_Release(p) (p)->Release() +#define IDirect3DVolumeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture8_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture8_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture8_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture8_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture8_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture8 + +DECLARE_INTERFACE_(IDirect3DCubeTexture8, IDirect3DBaseTexture8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DCubeTexture8 *LPDIRECT3DCUBETEXTURE8, *PDIRECT3DCUBETEXTURE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture8_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture8_Release(p) (p)->Release() +#define IDirect3DCubeTexture8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture8_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture8_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture8_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture8_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture8_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture8_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture8_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture8_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture8_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture8_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture8_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer8 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DVertexBuffer8 *LPDIRECT3DVERTEXBUFFER8, *PDIRECT3DVERTEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer8_Release(p) (p)->Release() +#define IDirect3DVertexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer8 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer8, IDirect3DResource8) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DIndexBuffer8 *LPDIRECT3DINDEXBUFFER8, *PDIRECT3DINDEXBUFFER8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer8_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer8_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer8_Release(p) (p)->Release() +#define IDirect3DIndexBuffer8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer8_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer8_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer8_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer8_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer8_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer8_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer8_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface8 + +DECLARE_INTERFACE_(IDirect3DSurface8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSurface8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; +}; + +typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#else +#define IDirect3DSurface8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface8_AddRef(p) (p)->AddRef() +#define IDirect3DSurface8_Release(p) (p)->Release() +#define IDirect3DSurface8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface8_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface8_UnlockRect(p) (p)->UnlockRect() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume8 + +DECLARE_INTERFACE_(IDirect3DVolume8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume8 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice8** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; +}; + +typedef struct IDirect3DVolume8 *LPDIRECT3DVOLUME8, *PDIRECT3DVOLUME8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume8_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume8_AddRef(p) (p)->AddRef() +#define IDirect3DVolume8_Release(p) (p)->Release() +#define IDirect3DVolume8_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume8_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume8_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume8_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume8_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume8_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume8_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume8_UnlockBox(p) (p)->UnlockBox() +#endif + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D8 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D8 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for + * the current mode only. + * + ****************************************************************************/ + +#define D3DCURRENT_DISPLAY_MODE 0x00EFFFFFL + +/**************************************************************************** + * + * Flags for IDirect3D8::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L + + +/**************************************************************************** + * + * Parameter for IDirect3D8::CreateDevice's iAdapter + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D8::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_NO_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice8::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D_H_ */ + diff --git a/SDK/dxSDK/Include/d3d8caps.h b/SDK/dxSDK/Include/d3d8caps.h new file mode 100644 index 00000000..6af8e6c4 --- /dev/null +++ b/SDK/dxSDK/Include/d3d8caps.h @@ -0,0 +1,364 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8CAPS_H +#define _D3D8CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DCAPS8 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture8's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture8's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture8's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float MaxPixelShaderValue; // max value of pixel shader arithmetic component + +} D3DCAPS8; + +// +// BIT DEFINES FOR D3DCAPS8 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_NO2DDURING3DSCENE 0x00000002L +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANRENDERWINDOWED 0x00080000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE 0x00800000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +// +// SourceBlendCaps, DestBlendCaps +// +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// Device can use non-POW2 textures if: +// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage +// 2) D3DRS_WRAP(N) is zero for this texture's coordinates +// 3) mip mapping is not enabled (use magnification filter only) +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ + +// +// TextureFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L + +// +// TextureOpCaps +// +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_NO_VSDT_UBYTE4 0x00000080L /* device does not support D3DVSDT_UBYTE4 */ + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8CAPS_H_ */ + diff --git a/SDK/dxSDK/Include/d3d8types.h b/SDK/dxSDK/Include/d3d8types.h new file mode 100644 index 00000000..5d622af4 --- /dev/null +++ b/SDK/dxSDK/Include/d3d8types.h @@ -0,0 +1,1684 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d8types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3D8TYPES_H_ +#define _D3D8TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0800 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX8 interfaces +#if(DIRECT3D_VERSION >= 0x0800) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT8 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT8; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS8 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS8 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS8; + +typedef struct _D3DMATERIAL8 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL8; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT8 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT8; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRS_ZBIAS = 47, /* LONG Z bias */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_SOFTWAREVERTEXPROCESSING = 153, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_PATCHSEGMENTS = 164, // Number of segments per edge when drawing patches + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONORDER = 172, // NPatch position interpolation order. D3DORDER_LINEAR or D3DORDER_CUBIC (default) + D3DRS_NORMALORDER = 173, // NPatch normal interpolation order. D3DORDER_LINEAR (default) or D3DORDER_QUADRATIC + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L +#define D3DWRAP_W 0x00000004L + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage texture processing. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* float Mipmap LOD bias */ + D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_ADDRESSW = 25, /* D3DTEXTUREADDRESS for W coordinate */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +typedef enum _D3DTEXTUREOP +{ + // Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + + // Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + + // Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DTSS_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_FLATCUBIC = 4, // cubic + D3DTEXF_GAUSSIANCUBIC = 5, // different cubic kernel + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_LASTBETA_UBYTE4 0x1000 + +#define D3DFVF_RESERVED2 0xE000 // 4 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +/* + +Vertex Shader Declaration + +The declaration portion of a vertex shader defines the static external +interface of the shader. The information in the declaration includes: + +- Assignments of vertex shader input registers to data streams. These +assignments bind a specific vertex register to a single component within a +vertex stream. A vertex stream element is identified by a byte offset +within the stream and a type. The type specifies the arithmetic data type +plus the dimensionality (1, 2, 3, or 4 values). Stream data which is +less than 4 values are always expanded out to 4 values with zero or more +0.F values and one 1.F value. + +- Assignment of vertex shader input registers to implicit data from the +primitive tessellator. This controls the loading of vertex data which is +not loaded from a stream, but rather is generated during primitive +tessellation prior to the vertex shader. + +- Loading data into the constant memory at the time a shader is set as the +current shader. Each token specifies values for one or more contiguous 4 +DWORD constant registers. This allows the shader to update an arbitrary +subset of the constant memory, overwriting the device state (which +contains the current values of the constant memory). Note that these +values can be subsequently overwritten (between DrawPrimitive calls) +during the time a shader is bound to a device via the +SetVertexShaderConstant method. + + +Declaration arrays are single-dimensional arrays of DWORDs composed of +multiple tokens each of which is one or more DWORDs. The single-DWORD +token value 0xFFFFFFFF is a special token used to indicate the end of the +declaration array. The single DWORD token value 0x00000000 is a NOP token +with is ignored during the declaration parsing. Note that 0x00000000 is a +valid value for DWORDs following the first DWORD for multiple word tokens. + +[31:29] TokenType + 0x0 - NOP (requires all DWORD bits to be zero) + 0x1 - stream selector + 0x2 - stream data definition (map to vertex input memory) + 0x3 - vertex input memory from tessellator + 0x4 - constant memory from shader + 0x5 - extension + 0x6 - reserved + 0x7 - end-of-array (requires all DWORD bits to be 1) + +NOP Token (single DWORD token) + [31:29] 0x0 + [28:00] 0x0 + +Stream Selector (single DWORD token) + [31:29] 0x1 + [28] indicates whether this is a tessellator stream + [27:04] 0x0 + [03:00] stream selector (0..15) + +Stream Data Definition (single DWORD token) + Vertex Input Register Load + [31:29] 0x2 + [28] 0x0 + [27:20] 0x0 + [19:16] type (dimensionality and data type) + [15:04] 0x0 + [03:00] vertex register address (0..15) + Data Skip (no register load) + [31:29] 0x2 + [28] 0x1 + [27:20] 0x0 + [19:16] count of DWORDS to skip over (0..15) + [15:00] 0x0 + Vertex Input Memory from Tessellator Data (single DWORD token) + [31:29] 0x3 + [28] indicates whether data is normals or u/v + [27:24] 0x0 + [23:20] vertex register address (0..15) + [19:16] type (dimensionality) + [15:04] 0x0 + [03:00] vertex register address (0..15) + +Constant Memory from Shader (multiple DWORD token) + [31:29] 0x4 + [28:25] count of 4*DWORD constants to load (0..15) + [24:07] 0x0 + [06:00] constant memory address (0..95) + +Extension Token (single or multiple DWORD token) + [31:29] 0x5 + [28:24] count of additional DWORDs in token (0..31) + [23:00] extension-specific information + +End-of-array token (single DWORD token) + [31:29] 0x7 + [28:00] 0x1fffffff + +The stream selector token must be immediately followed by a contiguous set of stream data definition tokens. This token sequence fully defines that stream, including the set of elements within the stream, the order in which the elements appear, the type of each element, and the vertex register into which to load an element. +Streams are allowed to include data which is not loaded into a vertex register, thus allowing data which is not used for this shader to exist in the vertex stream. This skipped data is defined only by a count of DWORDs to skip over, since the type information is irrelevant. +The token sequence: +Stream Select: stream=0 +Stream Data Definition (Load): type=FLOAT3; register=3 +Stream Data Definition (Load): type=FLOAT3; register=4 +Stream Data Definition (Skip): count=2 +Stream Data Definition (Load): type=FLOAT2; register=7 + +defines stream zero to consist of 4 elements, 3 of which are loaded into registers and the fourth skipped over. Register 3 is loaded with the first three DWORDs in each vertex interpreted as FLOAT data. Register 4 is loaded with the 4th, 5th, and 6th DWORDs interpreted as FLOAT data. The next two DWORDs (7th and 8th) are skipped over and not loaded into any vertex input register. Register 7 is loaded with the 9th and 10th DWORDS interpreted as FLOAT data. +Placing of tokens other than NOPs between the Stream Selector and Stream Data Definition tokens is disallowed. + +*/ + +typedef enum _D3DVSD_TOKENTYPE +{ + D3DVSD_TOKEN_NOP = 0, // NOP or extension + D3DVSD_TOKEN_STREAM, // stream selector + D3DVSD_TOKEN_STREAMDATA, // stream data definition (map to vertex input memory) + D3DVSD_TOKEN_TESSELLATOR, // vertex input memory from tessellator + D3DVSD_TOKEN_CONSTMEM, // constant memory from shader + D3DVSD_TOKEN_EXT, // extension + D3DVSD_TOKEN_END = 7, // end-of-array (requires all DWORD bits to be 1) + D3DVSD_FORCE_DWORD = 0x7fffffff,// force 32-bit size enum +} D3DVSD_TOKENTYPE; + +#define D3DVSD_TOKENTYPESHIFT 29 +#define D3DVSD_TOKENTYPEMASK (7 << D3DVSD_TOKENTYPESHIFT) + +#define D3DVSD_STREAMNUMBERSHIFT 0 +#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) + +#define D3DVSD_DATALOADTYPESHIFT 28 +#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) + +#define D3DVSD_DATATYPESHIFT 16 +#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) + +#define D3DVSD_SKIPCOUNTSHIFT 16 +#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) + +#define D3DVSD_VERTEXREGSHIFT 0 +#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) + +#define D3DVSD_VERTEXREGINSHIFT 20 +#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) + +#define D3DVSD_CONSTCOUNTSHIFT 25 +#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) + +#define D3DVSD_CONSTADDRESSSHIFT 0 +#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) + +#define D3DVSD_CONSTRSSHIFT 16 +#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) + +#define D3DVSD_EXTCOUNTSHIFT 24 +#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) + +#define D3DVSD_EXTINFOSHIFT 0 +#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) + +#define D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK) + +// macros for generation of CreateVertexShader Declaration token array + +// Set current stream +// _StreamNumber [0..(MaxStreams-1)] stream to get data from +// +#define D3DVSD_STREAM( _StreamNumber ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber)) + +// Set tessellator stream +// +#define D3DVSD_STREAMTESSSHIFT 28 +#define D3DVSD_STREAMTESSMASK (1 << D3DVSD_STREAMTESSSHIFT) +#define D3DVSD_STREAM_TESS( ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (D3DVSD_STREAMTESSMASK)) + +// bind single vertex register to vertex element from vertex stream +// +// _VertexRegister [0..15] address of the vertex register +// _Type [D3DVSDT_*] dimensionality and arithmetic data type + +#define D3DVSD_REG( _VertexRegister, _Type ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | \ + ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Skip _DWORDCount DWORDs in vertex +// +#define D3DVSD_SKIP( _DWORDCount ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | \ + ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT)) + +// load data into vertex shader constant memory +// +// _ConstantAddress [0..95] - address of constant array to begin filling data +// _Count [0..15] - number of constant vectors to load (4 DWORDs each) +// followed by 4*_Count DWORDS of data +// +#define D3DVSD_CONST( _ConstantAddress, _Count ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | \ + ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress)) + +// enable tessellator generated normals +// +// _VertexRegisterIn [0..15] address of vertex register whose input stream +// will be used in normal computation +// _VertexRegisterOut [0..15] address of vertex register to output the normal to +// +#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | \ + ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | \ + ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut)) + +// enable tessellator generated surface parameters +// +// _VertexRegister [0..15] address of vertex register to output parameters +// +#define D3DVSD_TESSUV( _VertexRegister ) \ + (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | \ + ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister)) + +// Generates END token +// +#define D3DVSD_END() 0xFFFFFFFF + +// Generates NOP token +#define D3DVSD_NOP() 0x00000000 + +// bit declarations for _Type fields +#define D3DVSDT_FLOAT1 0x00 // 1D float expanded to (value, 0., 0., 1.) +#define D3DVSDT_FLOAT2 0x01 // 2D float expanded to (value, value, 0., 1.) +#define D3DVSDT_FLOAT3 0x02 // 3D float expanded to (value, value, value, 1.) +#define D3DVSDT_FLOAT4 0x03 // 4D float +#define D3DVSDT_D3DCOLOR 0x04 // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) +#define D3DVSDT_UBYTE4 0x05 // 4D unsigned byte +#define D3DVSDT_SHORT2 0x06 // 2D signed short expanded to (value, value, 0., 1.) +#define D3DVSDT_SHORT4 0x07 // 4D signed short + +// assignments of vertex input registers for fixed function vertex shader +// +#define D3DVSDE_POSITION 0 +#define D3DVSDE_BLENDWEIGHT 1 +#define D3DVSDE_BLENDINDICES 2 +#define D3DVSDE_NORMAL 3 +#define D3DVSDE_PSIZE 4 +#define D3DVSDE_DIFFUSE 5 +#define D3DVSDE_SPECULAR 6 +#define D3DVSDE_TEXCOORD0 7 +#define D3DVSDE_TEXCOORD1 8 +#define D3DVSDE_TEXCOORD2 9 +#define D3DVSDE_TEXCOORD3 10 +#define D3DVSDE_TEXCOORD4 11 +#define D3DVSDE_TEXCOORD5 12 +#define D3DVSDE_TEXCOORD6 13 +#define D3DVSDE_TEXCOORD7 14 +#define D3DVSDE_POSITION2 15 +#define D3DVSDE_NORMAL2 16 + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, // PS/VS + D3DSIO_MOV , // PS/VS + D3DSIO_ADD , // PS/VS + D3DSIO_SUB , // PS + D3DSIO_MAD , // PS/VS + D3DSIO_MUL , // PS/VS + D3DSIO_RCP , // VS + D3DSIO_RSQ , // VS + D3DSIO_DP3 , // PS/VS + D3DSIO_DP4 , // PS/VS + D3DSIO_MIN , // VS + D3DSIO_MAX , // VS + D3DSIO_SLT , // VS + D3DSIO_SGE , // VS + D3DSIO_EXP , // VS + D3DSIO_LOG , // VS + D3DSIO_LIT , // VS + D3DSIO_DST , // VS + D3DSIO_LRP , // PS + D3DSIO_FRC , // VS + D3DSIO_M4x4 , // VS + D3DSIO_M4x3 , // VS + D3DSIO_M3x4 , // VS + D3DSIO_M3x3 , // VS + D3DSIO_M3x2 , // VS + + D3DSIO_TEXCOORD = 64, // PS + D3DSIO_TEXKILL , // PS + D3DSIO_TEX , // PS + D3DSIO_TEXBEM , // PS + D3DSIO_TEXBEML , // PS + D3DSIO_TEXREG2AR , // PS + D3DSIO_TEXREG2GB , // PS + D3DSIO_TEXM3x2PAD , // PS + D3DSIO_TEXM3x2TEX , // PS + D3DSIO_TEXM3x3PAD , // PS + D3DSIO_TEXM3x3TEX , // PS + D3DSIO_TEXM3x3DIFF , // PS + D3DSIO_TEXM3x3SPEC , // PS + D3DSIO_TEXM3x3VSPEC , // PS + D3DSIO_EXPP , // VS + D3DSIO_LOGP , // VS + D3DSIO_CND , // PS + D3DSIO_DEF , // PS + D3DSIO_TEXREG2RGB , // PS + D3DSIO_TEXDP3TEX , // PS + D3DSIO_TEXM3x2DEPTH , // PS + D3DSIO_TEXDP3 , // PS + D3DSIO_TEXM3x3 , // PS + D3DSIO_TEXDEPTH , // PS + D3DSIO_CMP , // PS + D3DSIO_BEM , // PS + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +// +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +// +// Parameter Token Bit Definitions +// +#define D3DSP_REGNUM_MASK 0x00001FFF + +// destination parameter write mask +#define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red) +#define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green) +#define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue) +#define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha) +#define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components + +// destination parameter modifiers +#define D3DSP_DSTMOD_SHIFT 20 +#define D3DSP_DSTMOD_MASK 0x00F00000 + +typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE +{ + D3DSPDM_NONE = 0<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0800) */ +#endif /* _D3D8TYPES(P)_H_ */ + diff --git a/SDK/dxSDK/Include/d3d9.h b/SDK/dxSDK/Include/d3d9.h new file mode 100644 index 00000000..757d0ce2 --- /dev/null +++ b/SDK/dxSDK/Include/d3d9.h @@ -0,0 +1,2582 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D9_H_ +#define _D3D9_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + + +/* This identifier is passed to Direct3DCreate9 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. + * (The number itself has no meaning.)*/ + +#ifdef D3D_DEBUG_INFO +#define D3D_SDK_VERSION (32 | 0x80000000) +#define D3D9b_SDK_VERSION (31 | 0x80000000) + +#else +#define D3D_SDK_VERSION 32 +#define D3D9b_SDK_VERSION 31 +#endif + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D9 */ +/* {81BDCBCA-64D4-426d-AE8D-AD0147F4275C} */ +DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); + +/* IID_IDirect3DDevice9 */ +// {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB} */ +DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); + +/* IID_IDirect3DResource9 */ +// {05EEC05D-8F7D-4362-B999-D1BAF357C704} +DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); + +/* IID_IDirect3DBaseTexture9 */ +/* {580CA87E-1D3C-4d54-991D-B7D3E3C298CE} */ +DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); + +/* IID_IDirect3DTexture9 */ +/* {85C31227-3DE5-4f00-9B3A-F11AC38C18B5} */ +DEFINE_GUID(IID_IDirect3DTexture9, 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5); + +/* IID_IDirect3DCubeTexture9 */ +/* {FFF32F81-D953-473a-9223-93D652ABA93F} */ +DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); + +/* IID_IDirect3DVolumeTexture9 */ +/* {2518526C-E789-4111-A7B9-47EF328D13E6} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture9, 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6); + +/* IID_IDirect3DVertexBuffer9 */ +/* {B64BB1B5-FD70-4df6-BF91-19D0A12455E3} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer9, 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3); + +/* IID_IDirect3DIndexBuffer9 */ +/* {7C9DD65E-D3F7-4529-ACEE-785830ACDE35} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); + +/* IID_IDirect3DSurface9 */ +/* {0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B} */ +DEFINE_GUID(IID_IDirect3DSurface9, 0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b); + +/* IID_IDirect3DVolume9 */ +/* {24F416E6-1F67-4aa7-B88E-D33F6F3128A1} */ +DEFINE_GUID(IID_IDirect3DVolume9, 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1); + +/* IID_IDirect3DSwapChain9 */ +/* {794950F2-ADFC-458a-905E-10A10B0B503B} */ +DEFINE_GUID(IID_IDirect3DSwapChain9, 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b); + +/* IID_IDirect3DVertexDeclaration9 */ +/* {DD13C59C-36FA-4098-A8FB-C7ED39DC8546} */ +DEFINE_GUID(IID_IDirect3DVertexDeclaration9, 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46); + +/* IID_IDirect3DVertexShader9 */ +/* {EFC5557E-6265-4613-8A94-43857889EB36} */ +DEFINE_GUID(IID_IDirect3DVertexShader9, 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36); + +/* IID_IDirect3DPixelShader9 */ +/* {6D3BDBDC-5B02-4415-B852-CE5E8BCCB289} */ +DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); + +/* IID_IDirect3DStateBlock9 */ +/* {B07C4FE5-310D-4ba8-A23C-4F0F206F218B} */ +DEFINE_GUID(IID_IDirect3DStateBlock9, 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b); + +/* IID_IDirect3DQuery9 */ +/* {d9771460-a695-4f26-bbd3-27b840b541cc} */ +DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); + + +/* IID_HelperName */ +/* {E4A36723-FDFE-4b22-B146-3C04C07F4CC8} */ +DEFINE_GUID(IID_HelperName, 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x4, 0xc0, 0x7f, 0x4c, 0xc8); + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* IID_IDirect3D9Ex */ +/* {02177241-69FC-400C-8FF1-93A44DF6861D} */ +DEFINE_GUID(IID_IDirect3D9Ex, 0x02177241, 0x69FC, 0x400C, 0x8F, 0xF1, 0x93, 0xA4, 0x4D, 0xF6, 0x86, 0x1D); + +/* IID_IDirect3DDevice9Ex */ +// {B18B10CE-2649-405a-870F-95F777D4313A} +DEFINE_GUID(IID_IDirect3DDevice9Ex, 0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a); + +/* IID_IDirect3DSwapChain9Ex */ +/* {91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303} */ +DEFINE_GUID(IID_IDirect3DSwapChain9Ex, 0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3); + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#endif + +#ifdef __cplusplus + +#ifndef DECLSPEC_UUID +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID(x) __declspec(uuid(x)) +#else +#define DECLSPEC_UUID(x) +#endif +#endif + +interface DECLSPEC_UUID("81BDCBCA-64D4-426d-AE8D-AD0147F4275C") IDirect3D9; +interface DECLSPEC_UUID("D0223B96-BF7A-43fd-92BD-A43B0D82B9EB") IDirect3DDevice9; + +interface DECLSPEC_UUID("B07C4FE5-310D-4ba8-A23C-4F0F206F218B") IDirect3DStateBlock9; +interface DECLSPEC_UUID("05EEC05D-8F7D-4362-B999-D1BAF357C704") IDirect3DResource9; +interface DECLSPEC_UUID("DD13C59C-36FA-4098-A8FB-C7ED39DC8546") IDirect3DVertexDeclaration9; +interface DECLSPEC_UUID("EFC5557E-6265-4613-8A94-43857889EB36") IDirect3DVertexShader9; +interface DECLSPEC_UUID("6D3BDBDC-5B02-4415-B852-CE5E8BCCB289") IDirect3DPixelShader9; +interface DECLSPEC_UUID("580CA87E-1D3C-4d54-991D-B7D3E3C298CE") IDirect3DBaseTexture9; +interface DECLSPEC_UUID("85C31227-3DE5-4f00-9B3A-F11AC38C18B5") IDirect3DTexture9; +interface DECLSPEC_UUID("2518526C-E789-4111-A7B9-47EF328D13E6") IDirect3DVolumeTexture9; +interface DECLSPEC_UUID("FFF32F81-D953-473a-9223-93D652ABA93F") IDirect3DCubeTexture9; + +interface DECLSPEC_UUID("B64BB1B5-FD70-4df6-BF91-19D0A12455E3") IDirect3DVertexBuffer9; +interface DECLSPEC_UUID("7C9DD65E-D3F7-4529-ACEE-785830ACDE35") IDirect3DIndexBuffer9; + +interface DECLSPEC_UUID("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B") IDirect3DSurface9; +interface DECLSPEC_UUID("24F416E6-1F67-4aa7-B88E-D33F6F3128A1") IDirect3DVolume9; + +interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapChain9; +interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9; + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +interface DECLSPEC_UUID("02177241-69FC-400C-8FF1-93A44DF6861D") IDirect3D9Ex; +interface DECLSPEC_UUID("B18B10CE-2649-405a-870F-95F777D4313A") IDirect3DDevice9Ex; +interface DECLSPEC_UUID("91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303") IDirect3DSwapChain9Ex; + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#if defined(_COM_SMARTPTR_TYPEDEF) +_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DStateBlock9, __uuidof(IDirect3DStateBlock9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DResource9, __uuidof(IDirect3DResource9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexDeclaration9, __uuidof(IDirect3DVertexDeclaration9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexShader9, __uuidof(IDirect3DVertexShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DPixelShader9, __uuidof(IDirect3DPixelShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DBaseTexture9, __uuidof(IDirect3DBaseTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DTexture9, __uuidof(IDirect3DTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolumeTexture9, __uuidof(IDirect3DVolumeTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DCubeTexture9, __uuidof(IDirect3DCubeTexture9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexBuffer9, __uuidof(IDirect3DVertexBuffer9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DIndexBuffer9, __uuidof(IDirect3DIndexBuffer9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSurface9, __uuidof(IDirect3DSurface9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9)); + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +_COM_SMARTPTR_TYPEDEF(IDirect3D9Ex, __uuidof(IDirect3D9Ex)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Ex, __uuidof(IDirect3DDevice9Ex)); +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9Ex, __uuidof(IDirect3DSwapChain9Ex)); + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#endif + +#endif + + +typedef interface IDirect3D9 IDirect3D9; +typedef interface IDirect3DDevice9 IDirect3DDevice9; +typedef interface IDirect3DStateBlock9 IDirect3DStateBlock9; +typedef interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9; +typedef interface IDirect3DVertexShader9 IDirect3DVertexShader9; +typedef interface IDirect3DPixelShader9 IDirect3DPixelShader9; +typedef interface IDirect3DResource9 IDirect3DResource9; +typedef interface IDirect3DBaseTexture9 IDirect3DBaseTexture9; +typedef interface IDirect3DTexture9 IDirect3DTexture9; +typedef interface IDirect3DVolumeTexture9 IDirect3DVolumeTexture9; +typedef interface IDirect3DCubeTexture9 IDirect3DCubeTexture9; +typedef interface IDirect3DVertexBuffer9 IDirect3DVertexBuffer9; +typedef interface IDirect3DIndexBuffer9 IDirect3DIndexBuffer9; +typedef interface IDirect3DSurface9 IDirect3DSurface9; +typedef interface IDirect3DVolume9 IDirect3DVolume9; +typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9; +typedef interface IDirect3DQuery9 IDirect3DQuery9; + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +typedef interface IDirect3D9Ex IDirect3D9Ex; +typedef interface IDirect3DDevice9Ex IDirect3DDevice9Ex; +typedef interface IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex; + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#include "d3d9types.h" +#include "d3d9caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D9 object. This object supports + * enumeration and allows the creation of Direct3DDevice9 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion); + +/* + * Stubs for graphics profiling. + */ + +int WINAPI D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName ); +int WINAPI D3DPERF_EndEvent( void ); +void WINAPI D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName ); +void WINAPI D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName ); +BOOL WINAPI D3DPERF_QueryRepeatFrame( void ); + +void WINAPI D3DPERF_SetOptions( DWORD dwOptions ); +DWORD WINAPI D3DPERF_GetStatus( void ); + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9 + +DECLARE_INTERFACE_(IDirect3D9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Version; + #endif +}; + +typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9_AddRef(p) (p)->AddRef() +#define IDirect3D9_Release(p) (p)->Release() +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D9_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + +/* SwapChain */ + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9 + +DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; + + #ifdef D3D_DEBUG_INFO + D3DDEVICE_CREATION_PARAMETERS CreationParameters; + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + D3DCAPS9 Caps; + + UINT AvailableTextureMem; + UINT SwapChains; + UINT Textures; + UINT VertexBuffers; + UINT IndexBuffers; + UINT VertexShaders; + UINT PixelShaders; + + D3DVIEWPORT9 Viewport; + D3DMATRIX ProjectionMatrix; + D3DMATRIX ViewMatrix; + D3DMATRIX WorldMatrix; + D3DMATRIX TextureMatrices[8]; + + DWORD FVF; + UINT VertexSize; + DWORD VertexShaderVersion; + DWORD PixelShaderVersion; + BOOL SoftwareVertexProcessing; + + D3DMATERIAL9 Material; + D3DLIGHT9 Lights[16]; + BOOL LightsEnabled[16]; + + D3DGAMMARAMP GammaRamp; + RECT ScissorRect; + BOOL DialogBoxMode; + #endif +}; + +typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#else +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9_Release(p) (p)->Release() +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DStateBlock9 + +DECLARE_INTERFACE_(IDirect3DStateBlock9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DStateBlock9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DStateBlock9 *LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) +#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) +#else +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->AddRef() +#define IDirect3DStateBlock9_Release(p) (p)->Release() +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DStateBlock9_Capture(p) (p)->Capture() +#define IDirect3DStateBlock9_Apply(p) (p)->Apply() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9 + +DECLARE_INTERFACE_(IDirect3DSwapChain9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + + #ifdef D3D_DEBUG_INFO + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSwapChain9 *LPDIRECT3DSWAPCHAIN9, *PDIRECT3DSWAPCHAIN9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#else +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9_Release(p) (p)->Release() +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource9 + +DECLARE_INTERFACE_(IDirect3DResource9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource9_AddRef(p) (p)->AddRef() +#define IDirect3DResource9_Release(p) (p)->Release() +#define IDirect3DResource9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource9_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource9_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource9_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexDeclaration9 + +DECLARE_INTERFACE_(IDirect3DVertexDeclaration9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexDeclaration9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9* pElement,UINT* pNumElements) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexDeclaration9 *LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) +#else +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexDeclaration9_Release(p) (p)->Release() +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->GetDeclaration(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexShader9 + +DECLARE_INTERFACE_(IDirect3DVertexShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexShader9 *LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexShader9_Release(p) (p)->Release() +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DPixelShader9 + +DECLARE_INTERFACE_(IDirect3DPixelShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DPixelShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DPixelShader9 *LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->AddRef() +#define IDirect3DPixelShader9_Release(p) (p)->Release() +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture9 + +DECLARE_INTERFACE_(IDirect3DBaseTexture9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture9 *LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#else +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture9_Release(p) (p)->Release() +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture9_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture9 + +DECLARE_INTERFACE_(IDirect3DTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DTexture9 *LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DTexture9_Release(p) (p)->Release() +#define IDirect3DTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture9_GetType(p) (p)->GetType() +#define IDirect3DTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture9 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume9** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture9_Release(p) (p)->Release() +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture9_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture9 + +DECLARE_INTERFACE_(IDirect3DCubeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface9** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DCubeTexture9 *LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCUBETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture9_Release(p) (p)->Release() +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture9_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer9 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + DWORD FVF; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexBuffer9 *LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer9_Release(p) (p)->Release() +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer9 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DIndexBuffer9 *LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer9_Release(p) (p)->Release() +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface9 + +DECLARE_INTERFACE_(IDirect3DSurface9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; + STDMETHOD(GetDC)(THIS_ HDC *phdc) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + D3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + DWORD Priority; + UINT LockCount; + UINT DCCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSurface9 *LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#else +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface9_AddRef(p) (p)->AddRef() +#define IDirect3DSurface9_Release(p) (p)->Release() +#define IDirect3DSurface9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DSurface9_GetPriority(p) (p)->GetPriority() +#define IDirect3DSurface9_PreLoad(p) (p)->PreLoad() +#define IDirect3DSurface9_GetType(p) (p)->GetType() +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->UnlockRect() +#define IDirect3DSurface9_GetDC(p,a) (p)->GetDC(a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->ReleaseDC(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume9 + +DECLARE_INTERFACE_(IDirect3DVolume9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolume9 *LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume9_AddRef(p) (p)->AddRef() +#define IDirect3DVolume9_Release(p) (p)->Release() +#define IDirect3DVolume9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->UnlockBox() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DQuery9 + +DECLARE_INTERFACE_(IDirect3DQuery9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DQuery9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD_(D3DQUERYTYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, GetDataSize)(THIS) PURE; + STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE; + STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE; + + #ifdef D3D_DEBUG_INFO + D3DQUERYTYPE Type; + DWORD DataSize; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) +#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) +#else +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DQuery9_AddRef(p) (p)->AddRef() +#define IDirect3DQuery9_Release(p) (p)->Release() +#define IDirect3DQuery9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DQuery9_GetType(p) (p)->GetType() +#define IDirect3DQuery9_GetDataSize(p) (p)->GetDataSize() +#define IDirect3DQuery9_Issue(p,a) (p)->Issue(a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->GetData(a,b,c) +#endif + + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D9 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D9 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L +#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200L +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX 0x00000400L + +// This flag causes the D3D runtime not to alter the focus +// window in any way. Use with caution- the burden of supporting +// focus management events (alt-tab, etc.) falls on the +// application, and appropriate responses (switching display +// mode, etc.) should be coded. +#define D3DCREATE_NOWINDOWCHANGES 0x00000800L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +// Disable multithreading for software vertex processing +#define D3DCREATE_DISABLE_PSGP_THREADING 0x00002000L +// This flag enables present statistics on device. +#define D3DCREATE_ENABLE_PRESENTSTATS 0x00004000L +// This flag disables printscreen support in the runtime for this device +#define D3DCREATE_DISABLE_PRINTSCREEN 0x00008000L + +#define D3DCREATE_SCREENSAVER 0x10000000L + + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + + +/**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's Adapter argument + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************/ + +/* + * The D3DENUM_WHQL_LEVEL value has been retired for 9Ex and future versions, + * but it needs to be defined here for compatibility with DX9 and earlier versions. + * See the DirectX SDK for sample code on discovering driver signatures. + */ +#define D3DENUM_WHQL_LEVEL 0x00000002L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* NO_DRIVERVERSION will not fill out the DriverVersion field, nor will the + DriverVersion be incorporated into the DeviceIdentifier GUID. WINNT only */ +#define D3DENUM_NO_DRIVERVERSION 0x00000004L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX9 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/**************************************************************************** + * + * Maximum number of back-buffers supported when apps use CreateDeviceEx + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX_EX 30L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************/ + +#define D3DPRESENT_DONOTWAIT 0x00000001L +#define D3DPRESENT_LINEAR_CONTENT 0x00000002L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPRESENT_DONOTFLIP 0x00000004L +#define D3DPRESENT_FLIPRESTART 0x00000008L +#define D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR 0x00000010L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + +#define D3DERR_DEVICEREMOVED MAKE_D3DHRESULT(2160) +#define S_NOT_RESIDENT MAKE_D3DSTATUS(2165) +#define S_RESIDENT_IN_SHARED_MEMORY MAKE_D3DSTATUS(2166) +#define S_PRESENT_MODE_CHANGED MAKE_D3DSTATUS(2167) +#define S_PRESENT_OCCLUDED MAKE_D3DSTATUS(2168) +#define D3DERR_DEVICEHUNG MAKE_D3DHRESULT(2164) + + +/********************* +/* D3D9Ex interfaces +/*********************/ + +HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**); + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9Ex + +DECLARE_INTERFACE_(IDirect3D9Ex, IDirect3D9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; + STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter ) PURE; + STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter,UINT Mode,D3DDISPLAYMODEEX* pMode) PURE; + STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; + STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX* pFullscreenDisplayMode,IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE; + STDMETHOD(GetAdapterLUID)(THIS_ UINT Adapter,LUID * pLUID) PURE; +}; + +typedef struct IDirect3D9Ex *LPDIRECT3D9EX, *PDIRECT3D9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b) +#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c) +#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g) +#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b) +#else +#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9Ex_AddRef(p) (p)->AddRef() +#define IDirect3D9Ex_Release(p) (p)->Release() +#define IDirect3D9Ex_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->GetAdapterModeCountEx(a,b) +#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->EnumAdapterModesEx(a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->GetAdapterDisplayModeEx(a,b,c) +#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->CreateDeviceEx(a,b,c,d,e,f,g) +#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->GetAdapterLUID(a,b) +#endif + + + + + + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9Ex + +DECLARE_INTERFACE_(IDirect3DDevice9Ex, IDirect3DDevice9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; + STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns) PURE; + STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset) PURE; + STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority) PURE; + STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE; + STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE; + STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources) PURE; + STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE; + STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency) PURE; + STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow) PURE; + STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE; + STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; +}; + +typedef struct IDirect3DDevice9Ex *LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d) +#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a) +#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b) +#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a) +#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b) +#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c) +#else +#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9Ex_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9Ex_Release(p) (p)->Release() +#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9Ex_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9Ex_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9Ex_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->SetConvolutionMonoKernel(a,b,c,d) +#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->ComposeRects(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->PresentEx(a,b,c,d,e) +#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->GetGPUThreadPriority(a) +#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->SetGPUThreadPriority(a) +#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->WaitForVBlank(a) +#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->CheckResourceResidency(a,b) +#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->SetMaximumFrameLatency(a) +#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->GetMaximumFrameLatency(a) +#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->CheckDeviceState(a) +#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateRenderTargetEx(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->CreateOffscreenPlainSurfaceEx(a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateDepthStencilSurfaceEx(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->ResetEx(a,b) +#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->GetDisplayModeEx(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9Ex + +DECLARE_INTERFACE_(IDirect3DSwapChain9Ex, IDirect3DSwapChain9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount) PURE; + STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics) PURE; + STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; +}; + +typedef struct IDirect3DSwapChain9Ex *LPDIRECT3DSWAPCHAIN9EX, *PDIRECT3DSWAPCHAIN9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a) +#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b) +#else +#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9Ex_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9Ex_Release(p) (p)->Release() +#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->GetLastPresentCount(a) +#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->GetPresentStats(a) +#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->GetDisplayModeEx(a,b) +#endif + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _D3D_H_ */ + diff --git a/SDK/dxSDK/Include/d3d9caps.h b/SDK/dxSDK/Include/d3d9caps.h new file mode 100644 index 00000000..a7df08aa --- /dev/null +++ b/SDK/dxSDK/Include/d3d9caps.h @@ -0,0 +1,512 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9CAPS_H +#define _d3d9CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DVSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; +} D3DVSHADERCAPS2_0; + +#define D3DVS20CAPS_PREDICATION (1<<0) + +#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DVS20_MAX_NUMTEMPS 32 +#define D3DVS20_MIN_NUMTEMPS 12 +#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 + +typedef struct _D3DPSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; + INT NumInstructionSlots; +} D3DPSHADERCAPS2_0; + +#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0) +#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1) +#define D3DPS20CAPS_PREDICATION (1<<2) +#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3) +#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4) + +#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMTEMPS 32 +#define D3DPS20_MIN_NUMTEMPS 12 +#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 +#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 + +#define D3DMIN30SHADERINSTRUCTIONS 512 +#define D3DMAX30SHADERINSTRUCTIONS 32768 + +typedef struct _D3DCAPS9 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders + + // Here are the DX9 specific ones + DWORD DevCaps2; + + float MaxNpatchTessellationLevel; + DWORD Reserved5; + + UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group + UINT AdapterOrdinalInGroup; // ordinal inside the adapter group + UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master) + DWORD DeclTypes; // Data types, supported in vertex declarations + DWORD NumSimultaneousRTs; // Will be at least 1 + DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect + D3DVSHADERCAPS2_0 VS20Caps; + D3DPSHADERCAPS2_0 PS20Caps; + DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders + DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed + DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed + DWORD MaxVertexShader30InstructionSlots; + DWORD MaxPixelShader30InstructionSlots; +} D3DCAPS9; + +// +// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L +#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DCAPS2_CANSHARERESOURCE 0x80000000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// Indicates that the device can perform a gamma correction from +// a windowed back buffer containing linear content to the sRGB desktop. +#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L + +#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */ +#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */ + + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ +#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */ +#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */ +#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices + use the specular alpha channel to store fog factor) */ +#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */ +#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */ +#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */ +#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */ + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000L /* Indicates device can perform conversion to sRGB after blending. */ + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L +#define D3DLINECAPS_ANTIALIAS 0x00000020L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L +#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L +#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L +#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +// +// SourceBlendCaps, DestBlendCaps +// +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L +#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */ + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPBLENDCAPS_SRCCOLOR2 0x00004000L +#define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// Device can use non-POW2 textures if: +// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage +// 2) D3DRS_WRAP(N) is zero for this texture's coordinates +// 3) mip mapping is not enabled (use magnification filter only) +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation + in programmable and fixed function pixel shaders */ + +// +// TextureFilterCaps, StretchRectFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L +#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */ + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L +#define D3DSTENCILCAPS_TWOSIDED 0x00000100L + +// +// TextureOpCaps +// +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */ +#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local + viewer mode */ + +// +// DevCaps2 +// +#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */ +#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/ +#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/ +#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */ +#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */ + +// +// DeclTypes +// +#define D3DDTCAPS_UBYTE4 0x00000001L +#define D3DDTCAPS_UBYTE4N 0x00000002L +#define D3DDTCAPS_SHORT2N 0x00000004L +#define D3DDTCAPS_SHORT4N 0x00000008L +#define D3DDTCAPS_USHORT2N 0x00000010L +#define D3DDTCAPS_USHORT4N 0x00000020L +#define D3DDTCAPS_UDEC3 0x00000040L +#define D3DDTCAPS_DEC3N 0x00000080L +#define D3DDTCAPS_FLOAT16_2 0x00000100L +#define D3DDTCAPS_FLOAT16_4 0x00000200L + + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9CAPS_H_ */ + diff --git a/SDK/dxSDK/Include/d3d9types.h b/SDK/dxSDK/Include/d3d9types.h new file mode 100644 index 00000000..9080e299 --- /dev/null +++ b/SDK/dxSDK/Include/d3d9types.h @@ -0,0 +1,2012 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9TYPES_H_ +#define _d3d9TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT9 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT9; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS9 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS9 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS9; + +typedef struct _D3DMATERIAL9 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL9; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT9 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT9; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ + D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + D3DBLEND_SRCCOLOR2 = 16, + D3DBLEND_INVSRCCOLOR2 = 17, + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */ + D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */ + D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */ + D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */ + D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */ + D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */ + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */ + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */ + D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Maximum number of simultaneous render targets D3D supports +#define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4 + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L +#define D3DWRAP_W 0x00000004L + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage processing of fixed function pixel processing + * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ + + + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +/* + * State enumerants for per-sampler texture processing. + */ +typedef enum _D3DSAMPLERSTATETYPE +{ + D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */ + D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */ + D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */ + D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */ + D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */ + D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */ + D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */ + D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0, + no correction required.) else correct for + Gamma = 2.2 */ + D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this + indicates which element index to use. Default = 0. */ + D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. + Only valid for D3DDMAPSAMPLER sampler */ + D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSAMPLERSTATETYPE; + +/* Special sampler which is used in the tesselator */ +#define D3DDMAPSAMPLER 256 + +// Samplers used in vertex shaders +#define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) +#define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) +#define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) +#define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) + +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 +#define D3DTSS_TCI_SPHEREMAP 0x00040000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +typedef enum _D3DTEXTUREOP +{ + // Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + + // Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + + // Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_CONSTANT 0x00000006 // select texture stage constant +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DSAMP_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent + D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x400E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e +#define D3DFVF_XYZW 0x4002 + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_LASTBETA_UBYTE4 0x1000 +#define D3DFVF_LASTBETA_D3DCOLOR 0x8000 + +#define D3DFVF_RESERVED2 0x6000 // 2 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +// Vertex shader declaration + +// Vertex element semantics +// +typedef enum _D3DDECLUSAGE +{ + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT, // 1 + D3DDECLUSAGE_BLENDINDICES, // 2 + D3DDECLUSAGE_NORMAL, // 3 + D3DDECLUSAGE_PSIZE, // 4 + D3DDECLUSAGE_TEXCOORD, // 5 + D3DDECLUSAGE_TANGENT, // 6 + D3DDECLUSAGE_BINORMAL, // 7 + D3DDECLUSAGE_TESSFACTOR, // 8 + D3DDECLUSAGE_POSITIONT, // 9 + D3DDECLUSAGE_COLOR, // 10 + D3DDECLUSAGE_FOG, // 11 + D3DDECLUSAGE_DEPTH, // 12 + D3DDECLUSAGE_SAMPLE, // 13 +} D3DDECLUSAGE; + +#define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE +#define MAXD3DDECLUSAGEINDEX 15 +#define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element + +typedef enum _D3DDECLMETHOD +{ + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, // Normal + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, // Lookup a displacement map + D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map +} D3DDECLMETHOD; + +#define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED + +// Declarations for _Type fields +// +typedef enum _D3DDECLTYPE +{ + D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 = 3, // 4D float + D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte + D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.) + D3DDECLTYPE_SHORT4 = 7, // 4D signed short + +// The following types are valid only with vertex shaders >= 2.0 + + + D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) + D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) + D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) + D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) + D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) + D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values + D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. +} D3DDECLTYPE; + +#define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED + +typedef struct _D3DVERTEXELEMENT9 +{ + WORD Stream; // Stream index + WORD Offset; // Offset in the stream in bytes + BYTE Type; // Data type + BYTE Method; // Processing method + BYTE Usage; // Semantics + BYTE UsageIndex; // Semantic index +} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; + +// This is used to initialize the last vertex element in a vertex declaration +// array +// +#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0} + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + +//--------------------------------------------------------------------- +// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter +//--------------------------------------------------------------------- +#define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) +#define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) + + + +//--------------------------------------------------------------------- +// +// The internal format of Pixel Shader (PS) & Vertex Shader (VS) +// Instruction Tokens is defined in the Direct3D Device Driver Kit +// +//--------------------------------------------------------------------- + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +#define D3DSI_INSTLENGTH_MASK 0x0F000000 +#define D3DSI_INSTLENGTH_SHIFT 24 + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, + D3DSIO_MOV , + D3DSIO_ADD , + D3DSIO_SUB , + D3DSIO_MAD , + D3DSIO_MUL , + D3DSIO_RCP , + D3DSIO_RSQ , + D3DSIO_DP3 , + D3DSIO_DP4 , + D3DSIO_MIN , + D3DSIO_MAX , + D3DSIO_SLT , + D3DSIO_SGE , + D3DSIO_EXP , + D3DSIO_LOG , + D3DSIO_LIT , + D3DSIO_DST , + D3DSIO_LRP , + D3DSIO_FRC , + D3DSIO_M4x4 , + D3DSIO_M4x3 , + D3DSIO_M3x4 , + D3DSIO_M3x3 , + D3DSIO_M3x2 , + D3DSIO_CALL , + D3DSIO_CALLNZ , + D3DSIO_LOOP , + D3DSIO_RET , + D3DSIO_ENDLOOP , + D3DSIO_LABEL , + D3DSIO_DCL , + D3DSIO_POW , + D3DSIO_CRS , + D3DSIO_SGN , + D3DSIO_ABS , + D3DSIO_NRM , + D3DSIO_SINCOS , + D3DSIO_REP , + D3DSIO_ENDREP , + D3DSIO_IF , + D3DSIO_IFC , + D3DSIO_ELSE , + D3DSIO_ENDIF , + D3DSIO_BREAK , + D3DSIO_BREAKC , + D3DSIO_MOVA , + D3DSIO_DEFB , + D3DSIO_DEFI , + + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL , + D3DSIO_TEX , + D3DSIO_TEXBEM , + D3DSIO_TEXBEML , + D3DSIO_TEXREG2AR , + D3DSIO_TEXREG2GB , + D3DSIO_TEXM3x2PAD , + D3DSIO_TEXM3x2TEX , + D3DSIO_TEXM3x3PAD , + D3DSIO_TEXM3x3TEX , + D3DSIO_RESERVED0 , + D3DSIO_TEXM3x3SPEC , + D3DSIO_TEXM3x3VSPEC , + D3DSIO_EXPP , + D3DSIO_LOGP , + D3DSIO_CND , + D3DSIO_DEF , + D3DSIO_TEXREG2RGB , + D3DSIO_TEXDP3TEX , + D3DSIO_TEXM3x2DEPTH , + D3DSIO_TEXDP3 , + D3DSIO_TEXM3x3 , + D3DSIO_TEXDEPTH , + D3DSIO_CMP , + D3DSIO_BEM , + D3DSIO_DP2ADD , + D3DSIO_DSX , + D3DSIO_DSY , + D3DSIO_TEXLDD , + D3DSIO_SETP , + D3DSIO_TEXLDL , + D3DSIO_BREAKP , + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +//--------------------------------------------------------------------- +// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 +// +#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f +#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f + +//--------------------------------------------------------------------- +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +//--------------------------------------------------------------------- +// Opcode specific controls + +#define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 +#define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 + +// ps_2_0 texld controls +#define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) +#define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) + +// Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) +typedef enum _D3DSHADER_COMPARISON +{ + // < = > + D3DSPC_RESERVED0= 0, // 0 0 0 + D3DSPC_GT = 1, // 0 0 1 + D3DSPC_EQ = 2, // 0 1 0 + D3DSPC_GE = 3, // 0 1 1 + D3DSPC_LT = 4, // 1 0 0 + D3DSPC_NE = 5, // 1 0 1 + D3DSPC_LE = 6, // 1 1 0 + D3DSPC_RESERVED1= 7 // 1 1 1 +} D3DSHADER_COMPARISON; + +// Comparison is part of instruction opcode token: +#define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT +#define D3DSHADER_COMPARISON_MASK (0x7<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9TYPES(P)_H_ */ + diff --git a/SDK/dxSDK/Include/d3dcaps.h b/SDK/dxSDK/Include/d3dcaps.h new file mode 100644 index 00000000..6066c7ab --- /dev/null +++ b/SDK/dxSDK/Include/d3dcaps.h @@ -0,0 +1,601 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dcaps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3DCAPS_H +#define _D3DCAPS_H + +/* + * Pull in DirectDraw include file automatically: + */ +#include "ddraw.h" + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +/* Description of capabilities of transform */ + +typedef struct _D3DTRANSFORMCAPS { + DWORD dwSize; + DWORD dwCaps; +} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS; + +#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */ + +/* Description of capabilities of lighting */ + +typedef struct _D3DLIGHTINGCAPS { + DWORD dwSize; + DWORD dwCaps; /* Lighting caps */ + DWORD dwLightingModel; /* Lighting model - RGB or mono */ + DWORD dwNumLights; /* Number of lights that can be handled */ +} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS; + +#define D3DLIGHTINGMODEL_RGB 0x00000001L +#define D3DLIGHTINGMODEL_MONO 0x00000002L + +#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */ +#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */ +#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */ +#if(DIRECT3D_VERSION < 0x700) +#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */ +#endif +#if(DIRECT3D_VERSION < 0x500) +#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */ +#endif + +/* Description of capabilities for each primitive type */ + +typedef struct _D3DPrimCaps { + DWORD dwSize; + DWORD dwMiscCaps; /* Capability flags */ + DWORD dwRasterCaps; + DWORD dwZCmpCaps; + DWORD dwSrcBlendCaps; + DWORD dwDestBlendCaps; + DWORD dwAlphaCmpCaps; + DWORD dwShadeCaps; + DWORD dwTextureCaps; + DWORD dwTextureFilterCaps; + DWORD dwTextureBlendCaps; + DWORD dwTextureAddressCaps; + DWORD dwStippleWidth; /* maximum width and height of */ + DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */ +} D3DPRIMCAPS, *LPD3DPRIMCAPS; + +/* D3DPRIMCAPS dwMiscCaps */ + +#define D3DPMISCCAPS_MASKPLANES 0x00000001L +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CONFORMANT 0x00000008L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L + +/* D3DPRIMCAPS dwRasterCaps */ + +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ROP2 0x00000002L +#define D3DPRASTERCAPS_XOR 0x00000004L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L +#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_STIPPLE 0x00000200L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L +#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L +#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBIAS 0x00004000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */ + +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */ + +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L + +/* D3DPRIMCAPS dwShadeCaps */ + +#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L +#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L +#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L +#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L + +#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L +#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L +#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L +#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L + +#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L +#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L +#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L +#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L + +#define D3DPSHADECAPS_FOGFLAT 0x00040000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L +#define D3DPSHADECAPS_FOGPHONG 0x00100000L + +/* D3DPRIMCAPS dwTextureCaps */ + +/* + * Perspective-correct texturing is supported + */ +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L + +/* + * Power-of-2 texture dimensions are required + */ +#define D3DPTEXTURECAPS_POW2 0x00000002L + +/* + * Alpha in texture pixels is supported + */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L + +/* + * Color-keyed textures are supported + */ +#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L + +/* + * obsolete, see D3DPTADDRESSCAPS_BORDER + */ +#define D3DPTEXTURECAPS_BORDER 0x00000010L + +/* + * Only square textures are supported + */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L + +#if(DIRECT3D_VERSION >= 0x0600) +/* + * Texture indices are not scaled by the texture size prior + * to interpolation. + */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L + +/* + * Device can draw alpha from texture palettes + */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L + +/* + * Device can use non-POW2 textures if: + * 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage + * 2) D3DRS_WRAP(N) is zero for this texture's coordinates + * 3) mip mapping is not enabled (use magnification filter only) + */ +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L + +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) + +// 0x00000200L unused + +/* + * Device can divide transformed texture coordinates by the + * COUNTth texture coordinate (can do D3DTTFF_PROJECTED) + */ +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L + +/* + * Device can do cubemap textures + */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L + +#define D3DPTEXTURECAPS_COLORKEYBLEND 0x00001000L +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* D3DPRIMCAPS dwTextureFilterCaps */ + +#define D3DPTFILTERCAPS_NEAREST 0x00000001L +#define D3DPTFILTERCAPS_LINEAR 0x00000002L +#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L +#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L +#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L +#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L + +#if(DIRECT3D_VERSION >= 0x0600) +/* Device3 Min Filter */ +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L + +/* Device3 Mip Filter */ +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L + +/* Device3 Mag Filter */ +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* D3DPRIMCAPS dwTextureBlendCaps */ + +#define D3DPTBLENDCAPS_DECAL 0x00000001L +#define D3DPTBLENDCAPS_MODULATE 0x00000002L +#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L +#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L +#define D3DPTBLENDCAPS_DECALMASK 0x00000010L +#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L +#define D3DPTBLENDCAPS_COPY 0x00000040L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPTBLENDCAPS_ADD 0x00000080L +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* D3DPRIMCAPS dwTextureAddressCaps */ +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +/* D3DDEVICEDESC dwStencilCaps */ + +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L + +/* D3DDEVICEDESC dwTextureOpCaps */ + +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L + +/* D3DDEVICEDESC dwFVFCaps flags */ + +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Description for a device. + * This is used to describe a device that is to be created or to query + * the current device. + */ +typedef struct _D3DDeviceDesc { + DWORD dwSize; /* Size of D3DDEVICEDESC structure */ + DWORD dwFlags; /* Indicates which fields have valid data */ + D3DCOLORMODEL dcmColorModel; /* Color model of device */ + DWORD dwDevCaps; /* Capabilities of device */ + D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ + BOOL bClipping; /* Device can do 3D clipping */ + D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ + D3DPRIMCAPS dpcLineCaps; + D3DPRIMCAPS dpcTriCaps; + DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ + DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ + DWORD dwMaxBufferSize; /* Maximum execute buffer size */ + DWORD dwMaxVertexCount; /* Maximum vertex count */ +#if(DIRECT3D_VERSION >= 0x0500) + // *** New fields for DX5 *** // + + // Width and height caps are 0 for legacy HALs. + DWORD dwMinTextureWidth, dwMinTextureHeight; + DWORD dwMaxTextureWidth, dwMaxTextureHeight; + DWORD dwMinStippleWidth, dwMaxStippleWidth; + DWORD dwMinStippleHeight, dwMaxStippleHeight; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + // New fields for DX6 + DWORD dwMaxTextureRepeat; + DWORD dwMaxTextureAspectRatio; + DWORD dwMaxAnisotropy; + + // Guard band that the rasterizer can accommodate + // Screen-space vertices inside this space but outside the viewport + // will get clipped properly. + D3DVALUE dvGuardBandLeft; + D3DVALUE dvGuardBandTop; + D3DVALUE dvGuardBandRight; + D3DVALUE dvGuardBandBottom; + + D3DVALUE dvExtentsAdjust; + DWORD dwStencilCaps; + + DWORD dwFVFCaps; + DWORD dwTextureOpCaps; + WORD wMaxTextureBlendStages; + WORD wMaxSimultaneousTextures; +#endif /* DIRECT3D_VERSION >= 0x0600 */ +} D3DDEVICEDESC, *LPD3DDEVICEDESC; + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DDeviceDesc7 { + DWORD dwDevCaps; /* Capabilities of device */ + D3DPRIMCAPS dpcLineCaps; + D3DPRIMCAPS dpcTriCaps; + DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ + DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ + + DWORD dwMinTextureWidth, dwMinTextureHeight; + DWORD dwMaxTextureWidth, dwMaxTextureHeight; + + DWORD dwMaxTextureRepeat; + DWORD dwMaxTextureAspectRatio; + DWORD dwMaxAnisotropy; + + D3DVALUE dvGuardBandLeft; + D3DVALUE dvGuardBandTop; + D3DVALUE dvGuardBandRight; + D3DVALUE dvGuardBandBottom; + + D3DVALUE dvExtentsAdjust; + DWORD dwStencilCaps; + + DWORD dwFVFCaps; + DWORD dwTextureOpCaps; + WORD wMaxTextureBlendStages; + WORD wMaxSimultaneousTextures; + + DWORD dwMaxActiveLights; + D3DVALUE dvMaxVertexW; + GUID deviceGUID; + + WORD wMaxUserClipPlanes; + WORD wMaxVertexBlendMatrices; + + DWORD dwVertexProcessingCaps; + + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwReserved4; +} D3DDEVICEDESC7, *LPD3DDEVICEDESC7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC)) +#define D3DDEVICEDESC7SIZE (sizeof(D3DDEVICEDESC7)) + +typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK)(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID); + +#if(DIRECT3D_VERSION >= 0x0700) +typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK7)(LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID); +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* D3DDEVICEDESC dwFlags indicating valid fields */ + +#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */ +#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */ +#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */ +#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */ +#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */ +#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */ +#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */ +#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */ +#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */ +#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */ +#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */ + +/* D3DDEVICEDESC dwDevCaps flags */ + +#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */ + /* for post-transform vertex data */ +#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z */ +#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z */ +#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */ + +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#if(DIRECT3D_VERSION >= 0x0500) +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ + +/* + * These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field + */ + +/* device can do texgen */ +#define D3DVTXPCAPS_TEXGEN 0x00000001L +/* device can do IDirect3DDevice7 colormaterialsource ops */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L +/* device can do vertex fog */ +#define D3DVTXPCAPS_VERTEXFOG 0x00000004L +/* device can do directional lights */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L +/* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L +/* device can do local viewer */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */ +#define D3DFDS_GUID 0x00000002L /* Match guid */ +#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */ +#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */ +#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */ +#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */ +#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */ +#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */ +#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */ +#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */ +#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */ +#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */ +#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */ +#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */ +#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */ +#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */ + +/* + * FindDevice arguments + */ +typedef struct _D3DFINDDEVICESEARCH { + DWORD dwSize; + DWORD dwFlags; + BOOL bHardware; + D3DCOLORMODEL dcmColorModel; + GUID guid; + DWORD dwCaps; + D3DPRIMCAPS dpcPrimCaps; +} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH; + +typedef struct _D3DFINDDEVICERESULT { + DWORD dwSize; + GUID guid; /* guid which matched */ + D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */ + D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */ +} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT; + +/* + * Description of execute buffer. + */ +typedef struct _D3DExecuteBufferDesc { + DWORD dwSize; /* size of this structure */ + DWORD dwFlags; /* flags indicating which fields are valid */ + DWORD dwCaps; /* capabilities of execute buffer */ + DWORD dwBufferSize; /* size of execute buffer data */ + LPVOID lpData; /* pointer to actual data */ +} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC; + +/* D3DEXECUTEBUFFER dwFlags indicating valid fields */ + +#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */ +#define D3DDEB_CAPS 0x00000002l /* caps valid */ +#define D3DDEB_LPDATA 0x00000004l /* lpData valid */ + +/* D3DEXECUTEBUFFER dwCaps */ + +#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */ +#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */ +#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY) + +#if(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DDEVINFO_TEXTUREMANAGER { + BOOL bThrashing; /* indicates if thrashing */ + DWORD dwApproxBytesDownloaded; /* Approximate number of bytes downloaded by texture manager */ + DWORD dwNumEvicts; /* number of textures evicted */ + DWORD dwNumVidCreates; /* number of textures created in video memory */ + DWORD dwNumTexturesUsed; /* number of textures used */ + DWORD dwNumUsedTexInVid; /* number of used textures present in video memory */ + DWORD dwWorkingSet; /* number of textures in video memory */ + DWORD dwWorkingSetBytes; /* number of bytes in video memory */ + DWORD dwTotalManaged; /* total number of managed textures */ + DWORD dwTotalBytes; /* total number of bytes of managed textures */ + DWORD dwLastPri; /* priority of last texture evicted */ +} D3DDEVINFO_TEXTUREMANAGER, *LPD3DDEVINFO_TEXTUREMANAGER; + +typedef struct _D3DDEVINFO_TEXTURING { + DWORD dwNumLoads; /* counts Load() API calls */ + DWORD dwApproxBytesLoaded; /* Approximate number bytes loaded via Load() */ + DWORD dwNumPreLoads; /* counts PreLoad() API calls */ + DWORD dwNumSet; /* counts SetTexture() API calls */ + DWORD dwNumCreates; /* counts texture creates */ + DWORD dwNumDestroys; /* counts texture destroys */ + DWORD dwNumSetPriorities; /* counts SetPriority() API calls */ + DWORD dwNumSetLODs; /* counts SetLOD() API calls */ + DWORD dwNumLocks; /* counts number of texture locks */ + DWORD dwNumGetDCs; /* counts number of GetDCs to textures */ +} D3DDEVINFO_TEXTURING, *LPD3DDEVINFO_TEXTURING; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#pragma pack() + + +#endif /* _D3DCAPS_H_ */ + diff --git a/SDK/dxSDK/Include/d3drm.h b/SDK/dxSDK/Include/d3drm.h new file mode 100644 index 00000000..143c0e05 --- /dev/null +++ b/SDK/dxSDK/Include/d3drm.h @@ -0,0 +1,342 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRM_H__ +#define __D3DRM_H__ + +#include "ddraw.h" + +#ifdef __cplusplus +struct IDirect3DRM; +#endif + +typedef struct IDirect3DRM *LPDIRECT3DRM; + +#include "d3drmobj.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRM2, 0x4516ecc8, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRM3, 0x4516ec83, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +WIN_TYPES(IDirect3DRM, DIRECT3DRM); +WIN_TYPES(IDirect3DRM2, DIRECT3DRM2); +WIN_TYPES(IDirect3DRM3, DIRECT3DRM3); + +/* + * Direct3DRM Object Class (for CoCreateInstance()) + */ +DEFINE_GUID(CLSID_CDirect3DRM, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + + +/* Create a Direct3DRM API */ +STDAPI Direct3DRMCreate(LPDIRECT3DRM FAR *lplpDirect3DRM); + +#undef INTERFACE +#define INTERFACE IDirect3DRM + +DECLARE_INTERFACE_(IDirect3DRM, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev, + LPDIRECT3DRMDEVICE * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMVISUAL * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HRSRC rs, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID, + LPDIRECT3DRMFRAME + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRM2 + +DECLARE_INTERFACE_(IDirect3DRM2, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME2 *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER2 *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE2 *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE2 *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE2 * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev, + LPDIRECT3DRMDEVICE2 * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE2 *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE2 *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMVISUAL * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE2 *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType, LPDIRECT3DRMTEXTURE2 *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID, + LPDIRECT3DRMFRAME + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; + + STDMETHOD(CreateProgressiveMesh)(THIS_ LPDIRECT3DRMPROGRESSIVEMESH *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRM3 + +DECLARE_INTERFACE_(IDirect3DRM3, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME3, LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER3 *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION2 *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET2 *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL2 *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE3 *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, DWORD dwFlags, LPDIRECT3DRMDEVICE3 * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev, + LPDIRECT3DRMDEVICE3 * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE3 *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE3 *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPUNKNOWN, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMSHADOW2 * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE3, LPDIRECT3DRMFRAME3, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT2 * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME3, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType, LPDIRECT3DRMTEXTURE3 *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURE3CALLBACK, LPVOID, + LPDIRECT3DRMFRAME3 + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; + + STDMETHOD(CreateProgressiveMesh)(THIS_ LPDIRECT3DRMPROGRESSIVEMESH *) PURE; + + /* Used with IDirect3DRMObject2 */ + STDMETHOD(RegisterClient) (THIS_ REFGUID rguid, LPDWORD lpdwID) PURE; + STDMETHOD(UnregisterClient) (THIS_ REFGUID rguid) PURE; + + STDMETHOD(CreateClippedVisual) (THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMCLIPPEDVISUAL *) PURE; + STDMETHOD(SetOptions) (THIS_ DWORD); + STDMETHOD(GetOptions) (THIS_ LPDWORD); +}; + +#define D3DRM_OK DD_OK +#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781) +#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782) +#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783) +#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784) +#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785) +#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786) +#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787) +#define D3DRMERR_BADFILE MAKE_DDHRESULT(788) +#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789) +#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790) +#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791) +#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792) +#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793) +#define D3DRMERR_LIBRARYNOTFOUND MAKE_DDHRESULT(794) +#define D3DRMERR_INVALIDLIBRARY MAKE_DDHRESULT(795) +#define D3DRMERR_PENDING MAKE_DDHRESULT(796) +#define D3DRMERR_NOTENOUGHDATA MAKE_DDHRESULT(797) +#define D3DRMERR_REQUESTTOOLARGE MAKE_DDHRESULT(798) +#define D3DRMERR_REQUESTTOOSMALL MAKE_DDHRESULT(799) +#define D3DRMERR_CONNECTIONLOST MAKE_DDHRESULT(800) +#define D3DRMERR_LOADABORTED MAKE_DDHRESULT(801) +#define D3DRMERR_NOINTERNET MAKE_DDHRESULT(802) +#define D3DRMERR_BADCACHEFILE MAKE_DDHRESULT(803) +#define D3DRMERR_BOXNOTSET MAKE_DDHRESULT(804) +#define D3DRMERR_BADPMDATA MAKE_DDHRESULT(805) +#define D3DRMERR_CLIENTNOTREGISTERED MAKE_DDHRESULT(806) +#define D3DRMERR_NOTCREATEDFROMDDS MAKE_DDHRESULT(807) +#define D3DRMERR_NOSUCHKEY MAKE_DDHRESULT(808) +#define D3DRMERR_INCOMPATABLEKEY MAKE_DDHRESULT(809) +#define D3DRMERR_ELEMENTINUSE MAKE_DDHRESULT(810) +#define D3DRMERR_TEXTUREFORMATNOTFOUND MAKE_DDHRESULT(811) +#define D3DRMERR_NOTAGGREGATED MAKE_DDHRESULT(812) + +#ifdef __cplusplus +}; +#endif + +#endif /* _D3DRMAPI_H_ */ + + diff --git a/SDK/dxSDK/Include/d3drmdef.h b/SDK/dxSDK/Include/d3drmdef.h new file mode 100644 index 00000000..9da4b18a --- /dev/null +++ b/SDK/dxSDK/Include/d3drmdef.h @@ -0,0 +1,695 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMDEFS_H__ +#define __D3DRMDEFS_H__ + +#include +#include "d3dtypes.h" + +#ifdef WIN32 +#define D3DRMAPI __stdcall +#else +#define D3DRMAPI +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef TRUE +#define FALSE 0 +#define TRUE 1 +#endif + +typedef struct _D3DRMVECTOR4D +{ D3DVALUE x, y, z, w; +} D3DRMVECTOR4D, *LPD3DRMVECTOR4D; + +typedef D3DVALUE D3DRMMATRIX4D[4][4]; + +typedef struct _D3DRMQUATERNION +{ D3DVALUE s; + D3DVECTOR v; +} D3DRMQUATERNION, *LPD3DRMQUATERNION; + +typedef struct _D3DRMRAY +{ D3DVECTOR dvDir; + D3DVECTOR dvPos; +} D3DRMRAY, *LPD3DRMRAY; + +typedef struct _D3DRMBOX +{ D3DVECTOR min, max; +} D3DRMBOX, *LPD3DRMBOX; + +typedef void (*D3DRMWRAPCALLBACK) + (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID); + +typedef enum _D3DRMLIGHTTYPE +{ D3DRMLIGHT_AMBIENT, + D3DRMLIGHT_POINT, + D3DRMLIGHT_SPOT, + D3DRMLIGHT_DIRECTIONAL, + D3DRMLIGHT_PARALLELPOINT +} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE; + +typedef enum _D3DRMSHADEMODE { + D3DRMSHADE_FLAT = 0, + D3DRMSHADE_GOURAUD = 1, + D3DRMSHADE_PHONG = 2, + + D3DRMSHADE_MASK = 7, + D3DRMSHADE_MAX = 8 +} D3DRMSHADEMODE, *LPD3DRMSHADEMODE; + +typedef enum _D3DRMLIGHTMODE { + D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX, + D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX, + + D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX, + D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX +} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE; + +typedef enum _D3DRMFILLMODE { + D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX, + D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX, + D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX, + + D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX, + D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX +} D3DRMFILLMODE, *LPD3DRMFILLMODE; + +typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY; + +#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME) +#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID) +#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID) + +#define D3DRMRENDERMODE_BLENDEDTRANSPARENCY 1 +#define D3DRMRENDERMODE_SORTEDTRANSPARENCY 2 +#define D3DRMRENDERMODE_LIGHTINMODELSPACE 8 +#define D3DRMRENDERMODE_VIEWDEPENDENTSPECULAR 16 +#define D3DRMRENDERMODE_DISABLESORTEDALPHAZWRITE 32 + +typedef enum _D3DRMTEXTUREQUALITY +{ D3DRMTEXTURE_NEAREST, /* choose nearest texel */ + D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */ + D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */ + D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */ + D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */ + D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */ +} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY; + +/* + * Texture flags + */ +#define D3DRMTEXTURE_FORCERESIDENT 0x00000001 /* texture should be kept in video memory */ +#define D3DRMTEXTURE_STATIC 0x00000002 /* texture will not change */ +#define D3DRMTEXTURE_DOWNSAMPLEPOINT 0x00000004 /* point filtering should be used when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLEBILINEAR 0x00000008 /* bilinear filtering should be used when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLEREDUCEDEPTH 0x00000010 /* reduce bit depth when downsampling */ +#define D3DRMTEXTURE_DOWNSAMPLENONE 0x00000020 /* texture should never be downsampled */ +#define D3DRMTEXTURE_CHANGEDPIXELS 0x00000040 /* pixels have changed */ +#define D3DRMTEXTURE_CHANGEDPALETTE 0x00000080 /* palette has changed */ +#define D3DRMTEXTURE_INVALIDATEONLY 0x00000100 /* dirty regions are invalid */ + +/* + * Shadow flags + */ +#define D3DRMSHADOW_TRUEALPHA 0x00000001 /* shadow should render without artifacts when true alpha is on */ + +typedef enum _D3DRMCOMBINETYPE +{ D3DRMCOMBINE_REPLACE, + D3DRMCOMBINE_BEFORE, + D3DRMCOMBINE_AFTER +} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE; + +typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL; + +typedef enum _D3DRMPALETTEFLAGS +{ D3DRMPALETTE_FREE, /* renderer may use this entry freely */ + D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */ + D3DRMPALETTE_RESERVED /* may not be used by renderer */ +} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS; + +typedef struct _D3DRMPALETTEENTRY +{ unsigned char red; /* 0 .. 255 */ + unsigned char green; /* 0 .. 255 */ + unsigned char blue; /* 0 .. 255 */ + unsigned char flags; /* one of D3DRMPALETTEFLAGS */ +} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY; + +typedef struct _D3DRMIMAGE +{ int width, height; /* width and height in pixels */ + int aspectx, aspecty; /* aspect ratio for non-square pixels */ + int depth; /* bits per pixel */ + int rgb; /* if false, pixels are indices into a + palette otherwise, pixels encode + RGB values. */ + int bytes_per_line; /* number of bytes of memory for a + scanline. This must be a multiple + of 4. */ + void* buffer1; /* memory to render into (first buffer). */ + void* buffer2; /* second rendering buffer for double + buffering, set to NULL for single + buffering. */ + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + unsigned long alpha_mask; /* if rgb is true, these are masks for + the red, green and blue parts of a + pixel. Otherwise, these are masks + for the significant bits of the + red, green and blue elements in the + palette. For instance, most SVGA + displays use 64 intensities of red, + green and blue, so the masks should + all be set to 0xfc. */ + int palette_size; /* number of entries in palette */ + D3DRMPALETTEENTRY* palette; /* description of the palette (only if + rgb is false). Must be (1< /* Use Windows header files */ +#define VIRTUAL +#include "d3drmdef.h" + +#include "d3d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The methods for IUnknown + */ +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirect3DRMObject + */ +#define IDIRECT3DRMOBJECT_METHODS(kind) \ + STDMETHOD(Clone) (THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD(AddDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(DeleteDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(SetAppData) (THIS_ DWORD data) kind; \ + STDMETHOD_(DWORD, GetAppData) (THIS) kind; \ + STDMETHOD(SetName) (THIS_ LPCSTR) kind; \ + STDMETHOD(GetName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind; \ + STDMETHOD(GetClassName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind + + +#define WIN_TYPES(itype, ptype) \ + typedef interface itype FAR *LP##ptype, FAR **LPLP##ptype + +WIN_TYPES(IDirect3DRMObject, DIRECT3DRMOBJECT); +WIN_TYPES(IDirect3DRMObject2, DIRECT3DRMOBJECT2); +WIN_TYPES(IDirect3DRMDevice, DIRECT3DRMDEVICE); +WIN_TYPES(IDirect3DRMDevice2, DIRECT3DRMDEVICE2); +WIN_TYPES(IDirect3DRMDevice3, DIRECT3DRMDEVICE3); +WIN_TYPES(IDirect3DRMViewport, DIRECT3DRMVIEWPORT); +WIN_TYPES(IDirect3DRMViewport2, DIRECT3DRMVIEWPORT2); +WIN_TYPES(IDirect3DRMFrame, DIRECT3DRMFRAME); +WIN_TYPES(IDirect3DRMFrame2, DIRECT3DRMFRAME2); +WIN_TYPES(IDirect3DRMFrame3, DIRECT3DRMFRAME3); +WIN_TYPES(IDirect3DRMVisual, DIRECT3DRMVISUAL); +WIN_TYPES(IDirect3DRMMesh, DIRECT3DRMMESH); +WIN_TYPES(IDirect3DRMMeshBuilder, DIRECT3DRMMESHBUILDER); +WIN_TYPES(IDirect3DRMMeshBuilder2, DIRECT3DRMMESHBUILDER2); +WIN_TYPES(IDirect3DRMMeshBuilder3, DIRECT3DRMMESHBUILDER3); +WIN_TYPES(IDirect3DRMFace, DIRECT3DRMFACE); +WIN_TYPES(IDirect3DRMFace2, DIRECT3DRMFACE2); +WIN_TYPES(IDirect3DRMLight, DIRECT3DRMLIGHT); +WIN_TYPES(IDirect3DRMTexture, DIRECT3DRMTEXTURE); +WIN_TYPES(IDirect3DRMTexture2, DIRECT3DRMTEXTURE2); +WIN_TYPES(IDirect3DRMTexture3, DIRECT3DRMTEXTURE3); +WIN_TYPES(IDirect3DRMWrap, DIRECT3DRMWRAP); +WIN_TYPES(IDirect3DRMMaterial, DIRECT3DRMMATERIAL); +WIN_TYPES(IDirect3DRMMaterial2, DIRECT3DRMMATERIAL2); +WIN_TYPES(IDirect3DRMInterpolator, DIRECT3DRMINTERPOLATOR); +WIN_TYPES(IDirect3DRMAnimation, DIRECT3DRMANIMATION); +WIN_TYPES(IDirect3DRMAnimation2, DIRECT3DRMANIMATION2); +WIN_TYPES(IDirect3DRMAnimationSet, DIRECT3DRMANIMATIONSET); +WIN_TYPES(IDirect3DRMAnimationSet2, DIRECT3DRMANIMATIONSET2); +WIN_TYPES(IDirect3DRMUserVisual, DIRECT3DRMUSERVISUAL); +WIN_TYPES(IDirect3DRMShadow, DIRECT3DRMSHADOW); +WIN_TYPES(IDirect3DRMShadow2, DIRECT3DRMSHADOW2); +WIN_TYPES(IDirect3DRMArray, DIRECT3DRMARRAY); +WIN_TYPES(IDirect3DRMObjectArray, DIRECT3DRMOBJECTARRAY); +WIN_TYPES(IDirect3DRMDeviceArray, DIRECT3DRMDEVICEARRAY); +WIN_TYPES(IDirect3DRMFaceArray, DIRECT3DRMFACEARRAY); +WIN_TYPES(IDirect3DRMViewportArray, DIRECT3DRMVIEWPORTARRAY); +WIN_TYPES(IDirect3DRMFrameArray, DIRECT3DRMFRAMEARRAY); +WIN_TYPES(IDirect3DRMAnimationArray, DIRECT3DRMANIMATIONARRAY); +WIN_TYPES(IDirect3DRMVisualArray, DIRECT3DRMVISUALARRAY); +WIN_TYPES(IDirect3DRMPickedArray, DIRECT3DRMPICKEDARRAY); +WIN_TYPES(IDirect3DRMPicked2Array, DIRECT3DRMPICKED2ARRAY); +WIN_TYPES(IDirect3DRMLightArray, DIRECT3DRMLIGHTARRAY); +WIN_TYPES(IDirect3DRMProgressiveMesh, DIRECT3DRMPROGRESSIVEMESH); +WIN_TYPES(IDirect3DRMClippedVisual, DIRECT3DRMCLIPPEDVISUAL); + +/* + * Direct3DRM Object classes + */ +DEFINE_GUID(CLSID_CDirect3DRMDevice, 0x4fa3568e, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewport, 0x4fa3568f, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrame, 0x4fa35690, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMesh, 0x4fa35691, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshBuilder, 0x4fa35692, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFace, 0x4fa35693, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMLight, 0x4fa35694, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTexture, 0x4fa35695, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMWrap, 0x4fa35696, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMaterial, 0x4fa35697, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4fa35698, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator, +0xde9eaa1, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator, +0xde9eaa2, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator, +0xde9eaa3, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator, +0xde9eaa6, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator, +0xde9eaa7, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator, +0xde9eaa8, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh, 0x4516ec40, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(CLSID_CDirect3DRMClippedVisual, 0x5434e72d, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); + + +/* + * Direct3DRM Object interfaces + */ +DEFINE_GUID(IID_IDirect3DRMObject, 0xeb16cb00, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMObject2, 0x4516ec7c, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice, 0xe9e19280, 0x6e05, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMDevice2, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDevice3, 0x549f498b, 0xbfeb, 0x11d1, 0x8e, 0xd8, 0x0, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMViewport, 0xeb16cb02, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport2, 0x4a1b1be6, 0xbfed, 0x11d1, 0x8e, 0xd8, 0x0, 0xa0, 0xc9, 0x67, 0xa4, 0x82); +DEFINE_GUID(IID_IDirect3DRMFrame, 0xeb16cb03, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame2, 0xc3dfbd60, 0x3988, 0x11d0, 0x9e, 0xc2, 0x0, 0x0, 0xc0, 0x29, 0x1a, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFrame3, 0xff6b7f70, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMVisual, 0xeb16cb04, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMesh, 0xa3a80d01, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0xa3a80d02, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder2, 0x4516ec77, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder3, 0x4516ec82, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMFace, 0xeb16cb07, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFace2, 0x4516ec81, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMLight, 0xeb16cb08, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture, 0xeb16cb09, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); +DEFINE_GUID(IID_IDirect3DRMTexture3, 0xff6b7f73, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMWrap, 0xeb16cb0a, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial, 0xeb16cb0b, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial2, 0xff6b7f75, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimation, 0xeb16cb0d, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimation2, 0xff6b7f77, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMAnimationSet, 0xeb16cb0e, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationSet2, 0xff6b7f79, 0xa40e, 0x11d1, 0x91, 0xf9, 0x0, 0x0, 0xf8, 0x75, 0x8e, 0x66); +DEFINE_GUID(IID_IDirect3DRMObjectArray, 0x242f6bc2, 0x3849, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMDeviceArray, 0xeb16cb10, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewportArray, 0xeb16cb11, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrameArray, 0xeb16cb12, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMVisualArray, 0xeb16cb13, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMLightArray, 0xeb16cb14, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMPickedArray, 0xeb16cb16, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFaceArray, 0xeb16cb17, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationArray, +0xd5f1cae0, 0x4bd7, 0x11d1, 0xb9, 0x74, 0x0, 0x60, 0x8, 0x3e, 0x45, 0xf3); +DEFINE_GUID(IID_IDirect3DRMUserVisual, 0x59163de0, 0x6d43, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow, 0xaf359780, 0x6ba3, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow2, 0x86b44e25, 0x9c82, 0x11d1, 0xbb, 0xb, 0x0, 0xa0, 0xc9, 0x81, 0xa0, 0xa6); +DEFINE_GUID(IID_IDirect3DRMInterpolator, 0x242f6bc1, 0x3849, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMProgressiveMesh, 0x4516ec79, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMPicked2Array, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); +DEFINE_GUID(IID_IDirect3DRMClippedVisual, 0x5434e733, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); + +typedef void (__cdecl *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg); +typedef void (__cdecl *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta); +typedef void (__cdecl *D3DRMFRAME3MOVECALLBACK)(LPDIRECT3DRMFRAME3 obj, LPVOID arg, D3DVALUE delta); +typedef void (__cdecl *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT); +typedef void (__cdecl *D3DRMDEVICE3UPDATECALLBACK)(LPDIRECT3DRMDEVICE3 obj, LPVOID arg, int, LPD3DRECT); +typedef int (__cdecl *D3DRMUSERVISUALCALLBACK) + ( LPDIRECT3DRMUSERVISUAL obj, LPVOID arg, D3DRMUSERVISUALREASON reason, + LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view + ); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURECALLBACK) + (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE *); +typedef HRESULT (__cdecl *D3DRMLOADTEXTURE3CALLBACK) + (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE3 *); +typedef void (__cdecl *D3DRMLOADCALLBACK) + (LPDIRECT3DRMOBJECT object, REFIID objectguid, LPVOID arg); + +typedef HRESULT (__cdecl *D3DRMDOWNSAMPLECALLBACK) + (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, + LPDIRECTDRAWSURFACE pDDSSrc, LPDIRECTDRAWSURFACE pDDSDst); +typedef HRESULT (__cdecl *D3DRMVALIDATIONCALLBACK) + (LPDIRECT3DRMTEXTURE3 lpDirect3DRMTexture, LPVOID pArg, + DWORD dwFlags, DWORD dwcRects, LPRECT pRects); + + +typedef struct _D3DRMPICKDESC +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR vPosition; + +} D3DRMPICKDESC, *LPD3DRMPICKDESC; + +typedef struct _D3DRMPICKDESC2 +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR dvPosition; + D3DVALUE tu; + D3DVALUE tv; + D3DVECTOR dvNormal; + D3DCOLOR dcColor; + +} D3DRMPICKDESC2, *LPD3DRMPICKDESC2; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObject + +/* + * Base class + */ +DECLARE_INTERFACE_(IDirect3DRMObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObject2 + +DECLARE_INTERFACE_(IDirect3DRMObject2, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + /* + * IDirect3DRMObject2 methods + */ + STDMETHOD(AddDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK lpFunc, LPVOID pvArg) PURE; + STDMETHOD(Clone)(THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj) PURE; \ + STDMETHOD(DeleteDestroyCallback)(THIS_ D3DRMOBJECTCALLBACK lpFunc, LPVOID pvArg) PURE; \ + STDMETHOD(GetClientData)(THIS_ DWORD dwID, LPVOID* lplpvData) PURE; + STDMETHOD(GetDirect3DRM)(THIS_ LPDIRECT3DRM* lplpDirect3DRM) PURE; + STDMETHOD(GetName)(THIS_ LPDWORD lpdwSize, LPSTR lpName) PURE; + STDMETHOD(SetClientData)(THIS_ DWORD dwID, LPVOID lpvData, DWORD dwFlags) PURE; + STDMETHOD(SetName)(THIS_ LPCSTR lpName) PURE; + STDMETHOD(GetAge)(THIS_ DWORD dwFlags, LPDWORD pdwAge) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisual + +DECLARE_INTERFACE_(IDirect3DRMVisual, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice + +DECLARE_INTERFACE_(IDirect3DRMDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice2 + +DECLARE_INTERFACE_(IDirect3DRMDevice2, IDirect3DRMDevice) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; + + /* + * IDirect3DRMDevice2 methods + */ + STDMETHOD(InitFromD3D2)(THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE lpDDSBack) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD dwFlags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ LPDIRECT3DDEVICE2 *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice3 + +DECLARE_INTERFACE_(IDirect3DRMDevice3, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMDEVICE3UPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMDEVICE3UPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; + + /* + * IDirect3DRMDevice2 methods + */ + STDMETHOD(InitFromD3D2)(THIS_ LPDIRECT3D2 lpD3D, LPDIRECT3DDEVICE2 lpD3DDev) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, LPDIRECTDRAWSURFACE lpDDSBack, DWORD dwFlags) PURE; + STDMETHOD(SetRenderMode)(THIS_ DWORD dwFlags) PURE; + STDMETHOD_(DWORD, GetRenderMode)(THIS) PURE; + STDMETHOD(GetDirect3DDevice2)(THIS_ LPDIRECT3DDEVICE2 *) PURE; + + /* + * IDirect3DRMDevice3 methods + */ + STDMETHOD(FindPreferredTextureFormat)(THIS_ DWORD dwBitDepths, DWORD dwFlags, LPDDPIXELFORMAT lpDDPF) PURE; + STDMETHOD(RenderStateChange)(THIS_ D3DRENDERSTATETYPE drsType, DWORD dwVal, DWORD dwFlags) PURE; + STDMETHOD(LightStateChange)(THIS_ D3DLIGHTSTATETYPE drsType, DWORD dwVal, DWORD dwFlags) PURE; + STDMETHOD(GetStateChangeOptions)(THIS_ DWORD dwStateClass, DWORD dwStateNum, LPDWORD pdwFlags) PURE; + STDMETHOD(SetStateChangeOptions)(THIS_ DWORD dwStateClass, DWORD dwStateNum, DWORD dwFlags) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewport + +DECLARE_INTERFACE_(IDirect3DRMViewport, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMViewport methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMFRAME camera, + DWORD xpos, DWORD ypos, DWORD width, DWORD height + ) PURE; + STDMETHOD(Clear)(THIS) PURE; + STDMETHOD(Render)(THIS_ LPDIRECT3DRMFRAME) PURE; + + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + + STDMETHOD(GetCamera)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DRMDEVICE *) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, LPDIRECT3DRMPICKEDARRAY *return_visuals) PURE; + + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ LPDIRECT3DVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewport2 +DECLARE_INTERFACE_(IDirect3DRMViewport2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMViewport2 methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMDEVICE3 dev, LPDIRECT3DRMFRAME3 camera, + DWORD xpos, DWORD ypos, DWORD width, DWORD height + ) PURE; + STDMETHOD(Clear)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Render)(THIS_ LPDIRECT3DRMFRAME3) PURE; + + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + + STDMETHOD(GetCamera)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DRMDEVICE3 *) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, LPDIRECT3DRMPICKEDARRAY *return_visuals) PURE; + + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ LPDIRECT3DVIEWPORT *) PURE; + STDMETHOD(TransformVectors)(THIS_ DWORD dwNumVectors, + LPD3DRMVECTOR4D lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DRMVECTOR4D lpSrcVectors) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame + +DECLARE_INTERFACE_(IDirect3DRMFrame, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDIRECT3DRMVISUALARRAY *visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME target, LPDIRECT3DRMFRAME reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame2 + +DECLARE_INTERFACE_(IDirect3DRMFrame2, IDirect3DRMFrame) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDIRECT3DRMVISUALARRAY *visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME target, LPDIRECT3DRMFRAME reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + + /* + * IDirect3DRMFrame2 methods + */ + STDMETHOD(AddMoveCallback2)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg, DWORD dwFlags) PURE; + STDMETHOD(GetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ LPD3DVECTOR dir, LPD3DVECTOR up); + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ LPD3DRMBOX) PURE; + + STDMETHOD(SetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetQuaternion)(THIS_ LPDIRECT3DRMFRAME reference, D3DRMQUATERNION *q) PURE; + + STDMETHOD(RayPick)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DRMRAY ray, DWORD dwFlags, LPDIRECT3DRMPICKED2ARRAY *return_visuals) PURE; + STDMETHOD(Save)(THIS_ LPCSTR filename, D3DRMXOFFORMAT d3dFormat, + D3DRMSAVEOPTIONS d3dSaveFlags); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame3 + +DECLARE_INTERFACE_(IDirect3DRMFrame3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame3 methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME3 child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK, VOID *arg, DWORD dwFlags) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPUNKNOWN) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME3 *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(GetTransform)(THIS_ LPDIRECT3DRMFRAME3 reference, + D3DRMMATRIX4D rmMatrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDWORD lpdwCount, LPUNKNOWN *) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME3 target, LPDIRECT3DRMFRAME3 reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAME3MOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPUNKNOWN) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME3 reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(GetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD_(BOOL, GetBoxEnable)(THIS) PURE; + STDMETHOD(GetAxes)(THIS_ LPD3DVECTOR dir, LPD3DVECTOR up); + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; + STDMETHOD_(BOOL, GetInheritAxes)(THIS); + STDMETHOD(GetHierarchyBox)(THIS_ LPD3DRMBOX) PURE; + + STDMETHOD(SetBox)(THIS_ LPD3DRMBOX) PURE; + STDMETHOD(SetBoxEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetAxes)(THIS_ D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz); + STDMETHOD(SetInheritAxes)(THIS_ BOOL inherit_from_parent); + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetQuaternion)(THIS_ LPDIRECT3DRMFRAME3 reference, D3DRMQUATERNION *q) PURE; + + STDMETHOD(RayPick)(THIS_ LPDIRECT3DRMFRAME3 reference, LPD3DRMRAY ray, DWORD dwFlags, LPDIRECT3DRMPICKED2ARRAY *return_visuals) PURE; + STDMETHOD(Save)(THIS_ LPCSTR filename, D3DRMXOFFORMAT d3dFormat, + D3DRMSAVEOPTIONS d3dSaveFlags); + STDMETHOD(TransformVectors)(THIS_ LPDIRECT3DRMFRAME3 reference, + DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(InverseTransformVectors)(THIS_ LPDIRECT3DRMFRAME3 reference, + DWORD dwNumVectors, + LPD3DVECTOR lpDstVectors, + LPD3DVECTOR lpSrcVectors) PURE; + STDMETHOD(SetTraversalOptions)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetTraversalOptions)(THIS_ LPDWORD lpdwFlags) PURE; + STDMETHOD(SetSceneFogMethod)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetSceneFogMethod)(THIS_ LPDWORD lpdwFlags) PURE; + STDMETHOD(SetMaterialOverride)(THIS_ LPD3DRMMATERIALOVERRIDE) PURE; + STDMETHOD(GetMaterialOverride)(THIS_ LPD3DRMMATERIALOVERRIDE) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMesh + +DECLARE_INTERFACE_(IDirect3DRMMesh, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMesh methods + */ + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(AddGroup)(THIS_ unsigned vCount, unsigned fCount, unsigned vPerFace, unsigned *fData, D3DRMGROUPINDEX *returnId) PURE; + STDMETHOD(SetVertices)(THIS_ D3DRMGROUPINDEX id, unsigned index, unsigned count, D3DRMVERTEX *values) PURE; + STDMETHOD(SetGroupColor)(THIS_ D3DRMGROUPINDEX id, D3DCOLOR value) PURE; + STDMETHOD(SetGroupColorRGB)(THIS_ D3DRMGROUPINDEX id, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetGroupMapping)(THIS_ D3DRMGROUPINDEX id, D3DRMMAPPING value) PURE; + STDMETHOD(SetGroupQuality)(THIS_ D3DRMGROUPINDEX id, D3DRMRENDERQUALITY value) PURE; + STDMETHOD(SetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL value) PURE; + STDMETHOD(SetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE value) PURE; + + STDMETHOD_(unsigned, GetGroupCount)(THIS) PURE; + STDMETHOD(GetGroup)(THIS_ D3DRMGROUPINDEX id, unsigned *vCount, unsigned *fCount, unsigned *vPerFace, DWORD *fDataSize, unsigned *fData) PURE; + STDMETHOD(GetVertices)(THIS_ D3DRMGROUPINDEX id, DWORD index, DWORD count, D3DRMVERTEX *returnPtr) PURE; + STDMETHOD_(D3DCOLOR, GetGroupColor)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMMAPPING, GetGroupMapping)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetGroupQuality)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD(GetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL *returnPtr) PURE; + STDMETHOD(GetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE *returnPtr) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMProgressiveMesh + +DECLARE_INTERFACE_(IDirect3DRMProgressiveMesh, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMProgressiveMesh methods + */ + STDMETHOD(Load) (THIS_ LPVOID lpObjLocation, LPVOID lpObjId, + D3DRMLOADOPTIONS dloLoadflags, D3DRMLOADTEXTURECALLBACK lpCallback, + LPVOID lpArg) PURE; + STDMETHOD(GetLoadStatus) (THIS_ LPD3DRMPMESHLOADSTATUS lpStatus) PURE; + STDMETHOD(SetMinRenderDetail) (THIS_ D3DVALUE d3dVal) PURE; + STDMETHOD(Abort) (THIS_ DWORD dwFlags) PURE; + + STDMETHOD(GetFaceDetail) (THIS_ LPDWORD lpdwCount) PURE; + STDMETHOD(GetVertexDetail) (THIS_ LPDWORD lpdwCount) PURE; + STDMETHOD(SetFaceDetail) (THIS_ DWORD dwCount) PURE; + STDMETHOD(SetVertexDetail) (THIS_ DWORD dwCount) PURE; + STDMETHOD(GetFaceDetailRange) (THIS_ LPDWORD lpdwMin, LPDWORD lpdwMax) PURE; + STDMETHOD(GetVertexDetailRange) (THIS_ LPDWORD lpdwMin, LPDWORD lpdwMax) PURE; + STDMETHOD(GetDetail) (THIS_ D3DVALUE *lpdvVal) PURE; + STDMETHOD(SetDetail) (THIS_ D3DVALUE d3dVal) PURE; + + STDMETHOD(RegisterEvents) (THIS_ HANDLE hEvent, DWORD dwFlags, DWORD dwReserved) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *lplpD3DRMMesh) PURE; + STDMETHOD(Duplicate) (THIS_ LPDIRECT3DRMPROGRESSIVEMESH *lplpD3DRMPMesh) PURE; + STDMETHOD(GetBox) (THIS_ LPD3DRMBOX lpBBox) PURE; + STDMETHOD(SetQuality) (THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(GetQuality) (THIS_ LPD3DRMRENDERQUALITY lpdwquality) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMShadow + +DECLARE_INTERFACE_(IDirect3DRMShadow, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMShadow methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMVISUAL visual, LPDIRECT3DRMLIGHT light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz + ) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMShadow2 + +DECLARE_INTERFACE_(IDirect3DRMShadow2, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMShadow methods + */ + STDMETHOD(Init) + ( THIS_ LPUNKNOWN pUNK, LPDIRECT3DRMLIGHT light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz + ) PURE; + + /* + * IDirect3DRMShadow2 methods + */ + STDMETHOD(GetVisual)(THIS_ LPDIRECT3DRMVISUAL *) PURE; + STDMETHOD(SetVisual)(THIS_ LPUNKNOWN pUNK, DWORD) PURE; + STDMETHOD(GetLight)(THIS_ LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(SetLight)(THIS_ LPDIRECT3DRMLIGHT, DWORD) PURE; + STDMETHOD(GetPlane)(THIS_ LPD3DVALUE px, LPD3DVALUE py, LPD3DVALUE pz, + LPD3DVALUE nx, LPD3DVALUE ny, LPD3DVALUE nz) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, DWORD) PURE; + STDMETHOD(GetOptions)(THIS_ LPDWORD) PURE; + STDMETHOD(SetOptions)(THIS_ DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFace + +DECLARE_INTERFACE_(IDirect3DRMFace, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFace methods + */ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL *) PURE; + + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFace2 + +DECLARE_INTERFACE_(IDirect3DRMFace2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFace methods + */ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE3 *) PURE; + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2 *) PURE; + + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetVertices) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE*) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder2 + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder2, IDirect3DRMMeshBuilder) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetVertices) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE*) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; + + /* + * IDirect3DRMMeshBuilder2 methods + */ + STDMETHOD(GenerateNormals2)(THIS_ D3DVALUE crease, DWORD dwFlags) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, LPDIRECT3DRMFACE*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder3 + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder3 methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS_ D3DVALUE crease, DWORD dwFlags) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER3, DWORD dwFlags) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME3) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE2) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE3) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL2) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetGeometry) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; + STDMETHOD(GetFace)(THIS_ DWORD index, LPDIRECT3DRMFACE2 *) PURE; + STDMETHOD(GetVertex)(THIS_ DWORD dwIndex, LPD3DVECTOR lpVector) PURE; + STDMETHOD(GetNormal)(THIS_ DWORD dwIndex, LPD3DVECTOR lpVector) PURE; + STDMETHOD(DeleteVertices)(THIS_ DWORD dwIndexFirst, DWORD dwCount) PURE; + STDMETHOD(DeleteNormals)(THIS_ DWORD dwIndexFirst, DWORD dwCount) PURE; + STDMETHOD(DeleteFace)(THIS_ LPDIRECT3DRMFACE2) PURE; + STDMETHOD(Empty)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Optimize)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(AddFacesIndexed)(THIS_ DWORD dwFlags, DWORD *lpdwvIndices, DWORD *dwIndexFirst, DWORD *dwCount) PURE; + STDMETHOD(CreateSubMesh)(THIS_ LPUNKNOWN *) PURE; + STDMETHOD(GetParentMesh)(THIS_ DWORD, LPUNKNOWN *) PURE; + STDMETHOD(GetSubMeshes)(THIS_ LPDWORD lpdwCount, LPUNKNOWN *) PURE; + STDMETHOD(DeleteSubMesh)(THIS_ LPUNKNOWN) PURE; + STDMETHOD(Enable)(THIS_ DWORD) PURE; + STDMETHOD(GetEnable)(THIS_ DWORD *) PURE; + STDMETHOD(AddTriangles)(THIS_ DWORD dwFlags, DWORD dwFormat, + DWORD dwVertexCount, LPVOID lpvData) PURE; + STDMETHOD(SetVertices)(THIS_ DWORD dwIndexFirst, DWORD dwCount, LPD3DVECTOR) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD dwIndexFirst, LPDWORD lpdwCount, LPD3DVECTOR) PURE; + STDMETHOD(SetNormals)(THIS_ DWORD dwIndexFirst, DWORD dwCount, LPD3DVECTOR) PURE; + STDMETHOD(GetNormals)(THIS_ DWORD dwIndexFirst, LPDWORD lpdwCount, LPD3DVECTOR) PURE; + STDMETHOD_(int, GetNormalCount)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLight + +DECLARE_INTERFACE_(IDirect3DRMLight, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMLight methods + */ + STDMETHOD(SetType)(THIS_ D3DRMLIGHTTYPE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetRange)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUmbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetPenumbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetConstantAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetLinearAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetQuadraticAttenuation)(THIS_ D3DVALUE) PURE; + + STDMETHOD_(D3DVALUE, GetRange)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetUmbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetPenumbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetConstantAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetLinearAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetQuadraticAttenuation)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD_(D3DRMLIGHTTYPE, GetType)(THIS) PURE; + + STDMETHOD(SetEnableFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(GetEnableFrame)(THIS_ LPDIRECT3DRMFRAME*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture + +DECLARE_INTERFACE_(IDirect3DRMTexture, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture2 + +DECLARE_INTERFACE_(IDirect3DRMTexture2, IDirect3DRMTexture) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + + /* + * IDirect3DRMTexture2 methods + */ + STDMETHOD(InitFromImage)(THIS_ LPD3DRMIMAGE) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture3 + +DECLARE_INTERFACE_(IDirect3DRMTexture3, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture3 methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ DWORD dwFlags, DWORD dwcRects, LPRECT pRects) PURE; + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; + STDMETHOD(InitFromImage)(THIS_ LPD3DRMIMAGE) PURE; + STDMETHOD(InitFromResource2)(THIS_ HMODULE hModule, LPCTSTR strName, LPCTSTR strType) PURE; + STDMETHOD(GenerateMIPMap)(THIS_ DWORD) PURE; + STDMETHOD(GetSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE* lplpDDS) PURE; + STDMETHOD(SetCacheOptions)(THIS_ LONG lImportance, DWORD dwFlags) PURE; + STDMETHOD(GetCacheOptions)(THIS_ LPLONG lplImportance, LPDWORD lpdwFlags) PURE; + STDMETHOD(SetDownsampleCallback)(THIS_ D3DRMDOWNSAMPLECALLBACK pCallback, LPVOID pArg) PURE; + STDMETHOD(SetValidationCallback)(THIS_ D3DRMVALIDATIONCALLBACK pCallback, LPVOID pArg) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMWrap + +DECLARE_INTERFACE_(IDirect3DRMWrap, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWrap methods + */ + STDMETHOD(Init) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME ref, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv + ) PURE; + STDMETHOD(Apply)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(ApplyRelative)(THIS_ LPDIRECT3DRMFRAME frame, LPDIRECT3DRMOBJECT) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMaterial + +DECLARE_INTERFACE_(IDirect3DRMMaterial, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMaterial methods + */ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMMaterial2 + +DECLARE_INTERFACE_(IDirect3DRMMaterial2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMaterial2 methods + */ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetAmbient)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(SetAmbient)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimation + +DECLARE_INTERFACE_(IDirect3DRMAnimation, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimation methods + */ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ LPDIRECT3DRMFRAME frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimation2 + +DECLARE_INTERFACE_(IDirect3DRMAnimation2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimation2 methods + */ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ LPDIRECT3DRMFRAME3 frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; + STDMETHOD(GetFrame)(THIS_ LPDIRECT3DRMFRAME3 *lpD3DFrame) PURE; + STDMETHOD(DeleteKeyByID)(THIS_ DWORD dwID) PURE; + STDMETHOD(AddKey)(THIS_ LPD3DRMANIMATIONKEY lpKey) PURE; + STDMETHOD(ModifyKey)(THIS_ LPD3DRMANIMATIONKEY lpKey) PURE; + STDMETHOD(GetKeys)(THIS_ D3DVALUE dvTimeMin, + D3DVALUE dvTimeMax, LPDWORD lpdwNumKeys, + LPD3DRMANIMATIONKEY lpKey); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationSet + +DECLARE_INTERFACE_(IDirect3DRMAnimationSet, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimationSet methods + */ + STDMETHOD(AddAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg, LPDIRECT3DRMFRAME parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationSet2 + +DECLARE_INTERFACE_(IDirect3DRMAnimationSet2, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimationSet2 methods + */ + STDMETHOD(AddAnimation)(THIS_ LPDIRECT3DRMANIMATION2 aid) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURE3CALLBACK, LPVOID lpArg, LPDIRECT3DRMFRAME3 parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ LPDIRECT3DRMANIMATION2 aid) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + STDMETHOD(GetAnimations)(THIS_ LPDIRECT3DRMANIMATIONARRAY *) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirect3DRMUserVisual + +DECLARE_INTERFACE_(IDirect3DRMUserVisual, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMUserVisual methods + */ + STDMETHOD(Init)(THIS_ D3DRMUSERVISUALCALLBACK fn, void *arg) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMArray + +DECLARE_INTERFACE_(IDirect3DRMArray, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /* No GetElement method as it would get overloaded + * in derived classes, and overloading is + * a no-no in COM + */ +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObjectArray + +DECLARE_INTERFACE_(IDirect3DRMObjectArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMOBJECT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDeviceArray + +DECLARE_INTERFACE_(IDirect3DRMDeviceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrameArray + +DECLARE_INTERFACE_(IDirect3DRMFrameArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFRAME *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewportArray + +DECLARE_INTERFACE_(IDirect3DRMViewportArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisualArray + +DECLARE_INTERFACE_(IDirect3DRMVisualArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationArray + +DECLARE_INTERFACE_(IDirect3DRMAnimationArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMANIMATION2 *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMPickedArray + +DECLARE_INTERFACE_(IDirect3DRMPickedArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetPick)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *, LPDIRECT3DRMFRAMEARRAY *, LPD3DRMPICKDESC) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLightArray + +DECLARE_INTERFACE_(IDirect3DRMLightArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMLIGHT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFaceArray + +DECLARE_INTERFACE_(IDirect3DRMFaceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFACE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMPicked2Array + +DECLARE_INTERFACE_(IDirect3DRMPicked2Array, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetPick)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *, LPDIRECT3DRMFRAMEARRAY *, LPD3DRMPICKDESC2) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMInterpolator + +DECLARE_INTERFACE_(IDirect3DRMInterpolator, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMInterpolator methods + */ + STDMETHOD(AttachObject)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(GetAttachedObjects)(THIS_ LPDIRECT3DRMOBJECTARRAY *) PURE; + STDMETHOD(DetachObject)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(SetIndex)(THIS_ D3DVALUE) PURE; + STDMETHOD_(D3DVALUE, GetIndex)(THIS) PURE; + STDMETHOD(Interpolate)(THIS_ D3DVALUE, LPDIRECT3DRMOBJECT, D3DRMINTERPOLATIONOPTIONS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMClippedVisual + +DECLARE_INTERFACE_(IDirect3DRMClippedVisual, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMClippedVisual methods + */ + STDMETHOD(Init) (THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(AddPlane) (THIS_ LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD, LPDWORD) PURE; + STDMETHOD(DeletePlane)(THIS_ DWORD, DWORD) PURE; + STDMETHOD(GetPlaneIDs)(THIS_ LPDWORD, LPDWORD, DWORD) PURE; + STDMETHOD(GetPlane) (THIS_ DWORD, LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD) PURE; + STDMETHOD(SetPlane) (THIS_ DWORD, LPDIRECT3DRMFRAME3, LPD3DVECTOR, LPD3DVECTOR, DWORD) PURE; +}; + +#ifdef __cplusplus +}; +#endif +#endif /* _D3DRMOBJ_H_ */ + diff --git a/SDK/dxSDK/Include/d3drmwin.h b/SDK/dxSDK/Include/d3drmwin.h new file mode 100644 index 00000000..d051ef48 --- /dev/null +++ b/SDK/dxSDK/Include/d3drmwin.h @@ -0,0 +1,50 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMWIN_H__ +#define __D3DRMWIN_H__ + +#ifndef WIN32 +#define WIN32 +#endif + +#include "d3drm.h" + +#include "ddraw.h" +#include "d3d.h" + +/* + * GUIDS used by Direct3DRM Windows interface + */ +DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); + +WIN_TYPES(IDirect3DRMWinDevice, DIRECT3DRMWINDEVICE); + +#undef INTERFACE +#define INTERFACE IDirect3DRMWinDevice + +DECLARE_INTERFACE_(IDirect3DRMWinDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWinDevice methods + */ + + /* Repaint the window with the last frame which was rendered. */ + STDMETHOD(HandlePaint)(THIS_ HDC hdc) PURE; + + /* Respond to a WM_ACTIVATE message. */ + STDMETHOD(HandleActivate)(THIS_ WORD wparam) PURE; +}; + + +#endif + diff --git a/SDK/dxSDK/Include/d3dtypes.h b/SDK/dxSDK/Include/d3dtypes.h new file mode 100644 index 00000000..79490418 --- /dev/null +++ b/SDK/dxSDK/Include/d3dtypes.h @@ -0,0 +1,2119 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dtypes.h + * Content: Direct3D types include file + * + ***************************************************************************/ + +#ifndef _D3DTYPES_H_ +#define _D3DTYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0700 +#endif + +#if (DIRECT3D_VERSION >= 0x0800) +#pragma message("should not include d3dtypes.h when compiling for DX8 or newer interfaces") +#endif + +#include + +#include +#include "ddraw.h" + +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + + +/* D3DVALUE is the fundamental Direct3D fractional data type */ + +#define D3DVALP(val, prec) ((float)(val)) +#define D3DVAL(val) ((float)(val)) + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are + * other types in this header that are also shared. The last of these + * shared defines in this file will set DX_SHARED_DEFINES. + */ +typedef float D3DVALUE, *LPD3DVALUE; + +#endif /* DX_SHARED_DEFINES */ + +#define D3DDivide(a, b) (float)((double) (a) / (double) (b)) +#define D3DMultiply(a, b) ((a) * (b)) + +typedef LONG D3DFIXED; + +#ifndef RGB_MAKE +/* + * Format of CI colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | color index | fraction | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define CI_GETALPHA(ci) ((ci) >> 24) +#define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff) +#define CI_GETFRACTION(ci) ((ci) & 0xff) +#define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80) +#define CI_MASKALPHA(ci) ((ci) & 0xffffff) +#define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f)) + +/* + * Format of RGBA colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGBA_GETALPHA(rgb) ((rgb) >> 24) +#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGBA_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) + +/* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs + * The float values must be in the range 0..1 + */ +#define D3DRGB(r, g, b) \ + (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +#define D3DRGBA(r, g, b, a) \ + ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ + | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ + ) + +/* + * Format of RGB colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ignored | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGB_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff)) +#define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b))) +#define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff)) +#define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000)) + +#endif + +/* + * Flags for Enumerate functions + */ + +/* + * Stop the enumeration + */ +#define D3DENUMRET_CANCEL DDENUMRET_CANCEL + +/* + * Continue the enumeration + */ +#define D3DENUMRET_OK DDENUMRET_OK + +typedef HRESULT (CALLBACK* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset); +typedef HRESULT (CALLBACK* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); +typedef HRESULT (CALLBACK* LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext); + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). We don't set DX_SHARED_DEFINES here as there are + * other types in this header that are also shared. The last of these + * shared defines in this file will set DX_SHARED_DEFINES. + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif +typedef DWORD *LPD3DCOLOR; + +#endif /* DX_SHARED_DEFINES */ + +typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE; +typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE; +typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE; + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + union { + D3DVALUE r; + D3DVALUE dvR; + }; + union { + D3DVALUE g; + D3DVALUE dvG; + }; + union { + D3DVALUE b; + D3DVALUE dvB; + }; + union { + D3DVALUE a; + D3DVALUE dvA; + }; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif +typedef struct _D3DCOLORVALUE *LPD3DCOLORVALUE; + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + union { + LONG x1; + LONG lX1; + }; + union { + LONG y1; + LONG lY1; + }; + union { + LONG x2; + LONG lX2; + }; + union { + LONG y2; + LONG lY2; + }; +} D3DRECT; +#define D3DRECT_DEFINED +#endif +typedef struct _D3DRECT *LPD3DRECT; + +#ifndef DX_SHARED_DEFINES + +/* + * This definition is shared with other DirectX components whose header files + * might already have defined it. Therefore, we don't define this type if + * someone else already has (as indicated by the definition of + * DX_SHARED_DEFINES). + */ + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + union { + D3DVALUE x; + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + +public: + + // ===================================== + // Constructors + // ===================================== + + _D3DVECTOR() { } + _D3DVECTOR(D3DVALUE f); + _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z); + _D3DVECTOR(const D3DVALUE f[3]); + + // ===================================== + // Access grants + // ===================================== + + const D3DVALUE&operator[](int i) const; + D3DVALUE&operator[](int i); + + // ===================================== + // Assignment operators + // ===================================== + + _D3DVECTOR& operator += (const _D3DVECTOR& v); + _D3DVECTOR& operator -= (const _D3DVECTOR& v); + _D3DVECTOR& operator *= (const _D3DVECTOR& v); + _D3DVECTOR& operator /= (const _D3DVECTOR& v); + _D3DVECTOR& operator *= (D3DVALUE s); + _D3DVECTOR& operator /= (D3DVALUE s); + + // ===================================== + // Unary operators + // ===================================== + + friend _D3DVECTOR operator + (const _D3DVECTOR& v); + friend _D3DVECTOR operator - (const _D3DVECTOR& v); + + + // ===================================== + // Binary operators + // ===================================== + + // Addition and subtraction + friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + // Scalar multiplication and division + friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s); + friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v); + friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s); + // Memberwise multiplication and division + friend _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Vector dominance + friend int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Bitwise equality + friend int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Length-related functions + friend D3DVALUE SquareMagnitude (const _D3DVECTOR& v); + friend D3DVALUE Magnitude (const _D3DVECTOR& v); + + // Returns vector with same direction and unit length + friend _D3DVECTOR Normalize (const _D3DVECTOR& v); + + // Return min/max component of the input vector + friend D3DVALUE Min (const _D3DVECTOR& v); + friend D3DVALUE Max (const _D3DVECTOR& v); + + // Return memberwise min/max of input vectors + friend _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + + // Dot and cross product + friend D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + friend _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2); + +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif +typedef struct _D3DVECTOR *LPD3DVECTOR; + +/* + * As this is the last of the shared defines to be defined we now set + * D3D_SHARED_DEFINES to flag that fact that this header has defined these + * types. + */ +#define DX_SHARED_DEFINES + +#endif /* DX_SHARED_DEFINES */ + +/* + * Vertex data types supported in an ExecuteBuffer. + */ + +/* + * Homogeneous vertices + */ + +typedef struct _D3DHVERTEX { + DWORD dwFlags; /* Homogeneous clipping flags */ + union { + D3DVALUE hx; + D3DVALUE dvHX; + }; + union { + D3DVALUE hy; + D3DVALUE dvHY; + }; + union { + D3DVALUE hz; + D3DVALUE dvHZ; + }; +} D3DHVERTEX, *LPD3DHVERTEX; + +/* + * Transformed/lit vertices + */ +typedef struct _D3DTLVERTEX { + union { + D3DVALUE sx; /* Screen coordinates */ + D3DVALUE dvSX; + }; + union { + D3DVALUE sy; + D3DVALUE dvSY; + }; + union { + D3DVALUE sz; + D3DVALUE dvSZ; + }; + union { + D3DVALUE rhw; /* Reciprocal of homogeneous w */ + D3DVALUE dvRHW; + }; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DTLVERTEX() { } + _D3DTLVERTEX(const D3DVECTOR& v, float _rhw, + D3DCOLOR _color, D3DCOLOR _specular, + float _tu, float _tv) + { sx = v.x; sy = v.y; sz = v.z; rhw = _rhw; + color = _color; specular = _specular; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTLVERTEX, *LPD3DTLVERTEX; + +/* + * Untransformed/lit vertices + */ +typedef struct _D3DLVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + DWORD dwReserved; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DLVERTEX() { } + _D3DLVERTEX(const D3DVECTOR& v, + D3DCOLOR _color, D3DCOLOR _specular, + float _tu, float _tv) + { x = v.x; y = v.y; z = v.z; dwReserved = 0; + color = _color; specular = _specular; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DLVERTEX, *LPD3DLVERTEX; + +/* + * Untransformed/unlit vertices + */ + +typedef struct _D3DVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + union { + D3DVALUE nx; /* Normal */ + D3DVALUE dvNX; + }; + union { + D3DVALUE ny; + D3DVALUE dvNY; + }; + union { + D3DVALUE nz; + D3DVALUE dvNZ; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + _D3DVERTEX() { } + _D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv) + { x = v.x; y = v.y; z = v.z; + nx = n.x; ny = n.y; nz = n.z; + tu = _tu; tv = _tv; + } +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DVERTEX, *LPD3DVERTEX; + + +/* + * Matrix, viewport, and tranformation structures and definitions. + */ + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + union { + struct { +#endif + +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DVALUE _11, _12, _13, _14; + D3DVALUE _21, _22, _23, _24; + D3DVALUE _31, _32, _33, _34; + D3DVALUE _41, _42, _43, _44; + +#if(DIRECT3D_VERSION >= 0x0500) +#if (defined __cplusplus) && (defined D3D_OVERLOADS) + }; + D3DVALUE m[4][4]; + }; + _D3DMATRIX() { } + _D3DMATRIX( D3DVALUE _m00, D3DVALUE _m01, D3DVALUE _m02, D3DVALUE _m03, + D3DVALUE _m10, D3DVALUE _m11, D3DVALUE _m12, D3DVALUE _m13, + D3DVALUE _m20, D3DVALUE _m21, D3DVALUE _m22, D3DVALUE _m23, + D3DVALUE _m30, D3DVALUE _m31, D3DVALUE _m32, D3DVALUE _m33 + ) + { + m[0][0] = _m00; m[0][1] = _m01; m[0][2] = _m02; m[0][3] = _m03; + m[1][0] = _m10; m[1][1] = _m11; m[1][2] = _m12; m[1][3] = _m13; + m[2][0] = _m20; m[2][1] = _m21; m[2][2] = _m22; m[2][3] = _m23; + m[3][0] = _m30; m[3][1] = _m31; m[3][2] = _m32; m[3][3] = _m33; + } + + D3DVALUE& operator()(int iRow, int iColumn) { return m[iRow][iColumn]; } + const D3DVALUE& operator()(int iRow, int iColumn) const { return m[iRow][iColumn]; } +#if(DIRECT3D_VERSION >= 0x0600) + friend _D3DMATRIX operator* (const _D3DMATRIX&, const _D3DMATRIX&); +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#endif +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif +typedef struct _D3DMATRIX *LPD3DMATRIX; + +#if (defined __cplusplus) && (defined D3D_OVERLOADS) +#include "d3dvec.inl" +#endif + +typedef struct _D3DVIEWPORT { + DWORD dwSize; + DWORD dwX; + DWORD dwY; /* Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Dimensions */ + D3DVALUE dvScaleX; /* Scale homogeneous to screen */ + D3DVALUE dvScaleY; /* Scale homogeneous to screen */ + D3DVALUE dvMaxX; /* Min/max homogeneous x coord */ + D3DVALUE dvMaxY; /* Min/max homogeneous y coord */ + D3DVALUE dvMinZ; + D3DVALUE dvMaxZ; /* Min/max homogeneous z coord */ +} D3DVIEWPORT, *LPD3DVIEWPORT; + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct _D3DVIEWPORT2 { + DWORD dwSize; + DWORD dwX; + DWORD dwY; /* Viewport Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Viewport Dimensions */ + D3DVALUE dvClipX; /* Top left of clip volume */ + D3DVALUE dvClipY; + D3DVALUE dvClipWidth; /* Clip Volume Dimensions */ + D3DVALUE dvClipHeight; + D3DVALUE dvMinZ; /* Min/max of clip Volume */ + D3DVALUE dvMaxZ; +} D3DVIEWPORT2, *LPD3DVIEWPORT2; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0700) +typedef struct _D3DVIEWPORT7 { + DWORD dwX; + DWORD dwY; /* Viewport Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Viewport Dimensions */ + D3DVALUE dvMinZ; /* Min/max of clip Volume */ + D3DVALUE dvMaxZ; +} D3DVIEWPORT7, *LPD3DVIEWPORT7; +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Values for clip fields. + */ + +#if(DIRECT3D_VERSION >= 0x0700) + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#define D3DCLIP_LEFT 0x00000001L +#define D3DCLIP_RIGHT 0x00000002L +#define D3DCLIP_TOP 0x00000004L +#define D3DCLIP_BOTTOM 0x00000008L +#define D3DCLIP_FRONT 0x00000010L +#define D3DCLIP_BACK 0x00000020L +#define D3DCLIP_GEN0 0x00000040L +#define D3DCLIP_GEN1 0x00000080L +#define D3DCLIP_GEN2 0x00000100L +#define D3DCLIP_GEN3 0x00000200L +#define D3DCLIP_GEN4 0x00000400L +#define D3DCLIP_GEN5 0x00000800L + +/* + * Values for d3d status. + */ +#define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT +#define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT +#define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP +#define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM +#define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT +#define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK +#define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0 +#define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1 +#define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2 +#define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3 +#define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4 +#define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5 + +#define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000L +#define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000L +#define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000L +#define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000L +#define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000L +#define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000L +#define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000L +#define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000L +#define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000L +#define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000L +#define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000L +#define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000L +#define D3DSTATUS_ZNOTVISIBLE 0x01000000L +/* Do not use 0x80000000 for any status flags in future as it is reserved */ + +#define D3DSTATUS_CLIPUNIONALL ( \ + D3DSTATUS_CLIPUNIONLEFT | \ + D3DSTATUS_CLIPUNIONRIGHT | \ + D3DSTATUS_CLIPUNIONTOP | \ + D3DSTATUS_CLIPUNIONBOTTOM | \ + D3DSTATUS_CLIPUNIONFRONT | \ + D3DSTATUS_CLIPUNIONBACK | \ + D3DSTATUS_CLIPUNIONGEN0 | \ + D3DSTATUS_CLIPUNIONGEN1 | \ + D3DSTATUS_CLIPUNIONGEN2 | \ + D3DSTATUS_CLIPUNIONGEN3 | \ + D3DSTATUS_CLIPUNIONGEN4 | \ + D3DSTATUS_CLIPUNIONGEN5 \ + ) + +#define D3DSTATUS_CLIPINTERSECTIONALL ( \ + D3DSTATUS_CLIPINTERSECTIONLEFT | \ + D3DSTATUS_CLIPINTERSECTIONRIGHT | \ + D3DSTATUS_CLIPINTERSECTIONTOP | \ + D3DSTATUS_CLIPINTERSECTIONBOTTOM | \ + D3DSTATUS_CLIPINTERSECTIONFRONT | \ + D3DSTATUS_CLIPINTERSECTIONBACK | \ + D3DSTATUS_CLIPINTERSECTIONGEN0 | \ + D3DSTATUS_CLIPINTERSECTIONGEN1 | \ + D3DSTATUS_CLIPINTERSECTIONGEN2 | \ + D3DSTATUS_CLIPINTERSECTIONGEN3 | \ + D3DSTATUS_CLIPINTERSECTIONGEN4 | \ + D3DSTATUS_CLIPINTERSECTIONGEN5 \ + ) + +#define D3DSTATUS_DEFAULT ( \ + D3DSTATUS_CLIPINTERSECTIONALL | \ + D3DSTATUS_ZNOTVISIBLE) + + +/* + * Options for direct transform calls + */ +#define D3DTRANSFORM_CLIPPED 0x00000001l +#define D3DTRANSFORM_UNCLIPPED 0x00000002l + +typedef struct _D3DTRANSFORMDATA { + DWORD dwSize; + LPVOID lpIn; /* Input vertices */ + DWORD dwInSize; /* Stride of input vertices */ + LPVOID lpOut; /* Output vertices */ + DWORD dwOutSize; /* Stride of output vertices */ + LPD3DHVERTEX lpHOut; /* Output homogeneous vertices */ + DWORD dwClip; /* Clipping hint */ + DWORD dwClipIntersection; + DWORD dwClipUnion; /* Union of all clip flags */ + D3DRECT drExtent; /* Extent of transformed vertices */ +} D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA; + +/* + * Structure defining position and direction properties for lighting. + */ +typedef struct _D3DLIGHTINGELEMENT { + D3DVECTOR dvPosition; /* Lightable point in model space */ + D3DVECTOR dvNormal; /* Normalised unit vector */ +} D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT; + +/* + * Structure defining material properties for lighting. + */ +typedef struct _D3DMATERIAL { + DWORD dwSize; + union { + D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE dcvDiffuse; + }; + union { + D3DCOLORVALUE ambient; /* Ambient color RGB */ + D3DCOLORVALUE dcvAmbient; + }; + union { + D3DCOLORVALUE specular; /* Specular 'shininess' */ + D3DCOLORVALUE dcvSpecular; + }; + union { + D3DCOLORVALUE emissive; /* Emissive color RGB */ + D3DCOLORVALUE dcvEmissive; + }; + union { + D3DVALUE power; /* Sharpness if specular highlight */ + D3DVALUE dvPower; + }; + D3DTEXTUREHANDLE hTexture; /* Handle to texture map */ + DWORD dwRampSize; +} D3DMATERIAL, *LPD3DMATERIAL; + +#if(DIRECT3D_VERSION >= 0x0700) + +typedef struct _D3DMATERIAL7 { + union { + D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE dcvDiffuse; + }; + union { + D3DCOLORVALUE ambient; /* Ambient color RGB */ + D3DCOLORVALUE dcvAmbient; + }; + union { + D3DCOLORVALUE specular; /* Specular 'shininess' */ + D3DCOLORVALUE dcvSpecular; + }; + union { + D3DCOLORVALUE emissive; /* Emissive color RGB */ + D3DCOLORVALUE dcvEmissive; + }; + union { + D3DVALUE power; /* Sharpness if specular highlight */ + D3DVALUE dvPower; + }; +} D3DMATERIAL7, *LPD3DMATERIAL7; + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, +// Note: The following light type (D3DLIGHT_PARALLELPOINT) +// is no longer supported from D3D for DX7 onwards. + D3DLIGHT_PARALLELPOINT = 4, +#if(DIRECT3D_VERSION < 0x0500) // For backward compatible headers + D3DLIGHT_GLSPOT = 5, +#endif + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +#else +typedef enum _D3DLIGHTTYPE D3DLIGHTTYPE; +#define D3DLIGHT_PARALLELPOINT (D3DLIGHTTYPE)4 +#define D3DLIGHT_GLSPOT (D3DLIGHTTYPE)5 + +#endif //(DIRECT3D_VERSION < 0x0800) + +/* + * Structure defining a light source and its properties. + */ +typedef struct _D3DLIGHT { + DWORD dwSize; + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvColor; /* Color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ +} D3DLIGHT, *LPD3DLIGHT; + +#if(DIRECT3D_VERSION >= 0x0700) + +typedef struct _D3DLIGHT7 { + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvDiffuse; /* Diffuse color of light */ + D3DCOLORVALUE dcvSpecular; /* Specular color of light */ + D3DCOLORVALUE dcvAmbient; /* Ambient color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ +} D3DLIGHT7, *LPD3DLIGHT7; + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Structure defining a light source and its properties. + */ + +/* flags bits */ +#define D3DLIGHT_ACTIVE 0x00000001 +#define D3DLIGHT_NO_SPECULAR 0x00000002 +#define D3DLIGHT_ALL (D3DLIGHT_ACTIVE | D3DLIGHT_NO_SPECULAR) + +/* maximum valid light range */ +#define D3DLIGHT_RANGE_MAX ((float)sqrt(FLT_MAX)) + +typedef struct _D3DLIGHT2 { + DWORD dwSize; + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvColor; /* Color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ + DWORD dwFlags; +} D3DLIGHT2, *LPD3DLIGHT2; + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +typedef struct _D3DLIGHTDATA { + DWORD dwSize; + LPD3DLIGHTINGELEMENT lpIn; /* Input positions and normals */ + DWORD dwInSize; /* Stride of input elements */ + LPD3DTLVERTEX lpOut; /* Output colors */ + DWORD dwOutSize; /* Stride of output colors */ +} D3DLIGHTDATA, *LPD3DLIGHTDATA; + +#if(DIRECT3D_VERSION >= 0x0500) +/* + * Before DX5, these values were in an enum called + * D3DCOLORMODEL. This was not correct, since they are + * bit flags. A driver can surface either or both flags + * in the dcmColorModel member of D3DDEVICEDESC. + */ +#define D3DCOLOR_MONO 1 +#define D3DCOLOR_RGB 2 + +typedef DWORD D3DCOLORMODEL; +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#if(DIRECT3D_VERSION >= 0x0600) +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Execute buffers are allocated via Direct3D. These buffers may then + * be filled by the application with instructions to execute along with + * vertex data. + */ + +/* + * Supported op codes for execute instructions. + */ +typedef enum _D3DOPCODE { + D3DOP_POINT = 1, + D3DOP_LINE = 2, + D3DOP_TRIANGLE = 3, + D3DOP_MATRIXLOAD = 4, + D3DOP_MATRIXMULTIPLY = 5, + D3DOP_STATETRANSFORM = 6, + D3DOP_STATELIGHT = 7, + D3DOP_STATERENDER = 8, + D3DOP_PROCESSVERTICES = 9, + D3DOP_TEXTURELOAD = 10, + D3DOP_EXIT = 11, + D3DOP_BRANCHFORWARD = 12, + D3DOP_SPAN = 13, + D3DOP_SETSTATUS = 14, +#if(DIRECT3D_VERSION >= 0x0500) + D3DOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DOPCODE; + +typedef struct _D3DINSTRUCTION { + BYTE bOpcode; /* Instruction opcode */ + BYTE bSize; /* Size of each instruction data unit */ + WORD wCount; /* Count of instruction data units to follow */ +} D3DINSTRUCTION, *LPD3DINSTRUCTION; + +/* + * Structure for texture loads + */ +typedef struct _D3DTEXTURELOAD { + D3DTEXTUREHANDLE hDestTexture; + D3DTEXTUREHANDLE hSrcTexture; +} D3DTEXTURELOAD, *LPD3DTEXTURELOAD; + +/* + * Structure for picking + */ +typedef struct _D3DPICKRECORD { + BYTE bOpcode; + BYTE bPad; + DWORD dwOffset; + D3DVALUE dvZ; +} D3DPICKRECORD, *LPD3DPICKRECORD; + +/* + * The following defines the rendering states which can be set in the + * execute buffer. + */ + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREFILTER { + D3DFILTER_NEAREST = 1, + D3DFILTER_LINEAR = 2, + D3DFILTER_MIPNEAREST = 3, + D3DFILTER_MIPLINEAR = 4, + D3DFILTER_LINEARMIPNEAREST = 5, + D3DFILTER_LINEARMIPLINEAR = 6, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFILTER_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREFILTER; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, +#if(DIRECT3D_VERSION >= 0x0500) + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DBLEND; + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREBLEND { + D3DTBLEND_DECAL = 1, + D3DTBLEND_MODULATE = 2, + D3DTBLEND_DECALALPHA = 3, + D3DTBLEND_MODULATEALPHA = 4, + D3DTBLEND_DECALMASK = 5, + D3DTBLEND_MODULATEMASK = 6, + D3DTBLEND_COPY = 7, +#if(DIRECT3D_VERSION >= 0x0500) + D3DTBLEND_ADD = 8, + D3DTBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREBLEND; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, +#if(DIRECT3D_VERSION >= 0x0500) + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, +#if(DIRECT3D_VERSION >= 0x0500) + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DCMPFUNC; + +#if(DIRECT3D_VERSION >= 0x0600) +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, +#if(DIRECT3D_VERSION >= 0x0500) + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DFOGMODE; + +#if(DIRECT3D_VERSION >= 0x0600) +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0500) +typedef enum _D3DANTIALIASMODE { + D3DANTIALIAS_NONE = 0, + D3DANTIALIAS_SORTDEPENDENT = 1, + D3DANTIALIAS_SORTINDEPENDENT = 2, + D3DANTIALIAS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DANTIALIASMODE; + +// Vertex types supported by Direct3D +typedef enum _D3DVERTEXTYPE { + D3DVT_VERTEX = 1, + D3DVT_LVERTEX = 2, + D3DVT_TLVERTEX = 3, + D3DVT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DVERTEXTYPE; + +#if(DIRECT3D_VERSION < 0x0800) + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +#endif //(DIRECT3D_VERSION < 0x0800) + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +/* + * Amount to add to a state to generate the override for that state. + */ +#define D3DSTATE_OVERRIDE_BIAS 256 + +/* + * A state which sets the override flag for the specified state type. + */ +#define D3DSTATE_OVERRIDE(type) (D3DRENDERSTATETYPE)(((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS)) + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTRANSFORMSTATE_WORLD = 1, + D3DTRANSFORMSTATE_VIEW = 2, + D3DTRANSFORMSTATE_PROJECTION = 3, +#if(DIRECT3D_VERSION >= 0x0700) + D3DTRANSFORMSTATE_WORLD1 = 4, // 2nd matrix to blend + D3DTRANSFORMSTATE_WORLD2 = 5, // 3rd matrix to blend + D3DTRANSFORMSTATE_WORLD3 = 6, // 4th matrix to blend + D3DTRANSFORMSTATE_TEXTURE0 = 16, + D3DTRANSFORMSTATE_TEXTURE1 = 17, + D3DTRANSFORMSTATE_TEXTURE2 = 18, + D3DTRANSFORMSTATE_TEXTURE3 = 19, + D3DTRANSFORMSTATE_TEXTURE4 = 20, + D3DTRANSFORMSTATE_TEXTURE5 = 21, + D3DTRANSFORMSTATE_TEXTURE6 = 22, + D3DTRANSFORMSTATE_TEXTURE7 = 23, +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DTRANSFORMSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DTRANSFORMSTATETYPE; + +#else + +// +// legacy transform state names +// +typedef enum _D3DTRANSFORMSTATETYPE D3DTRANSFORMSTATETYPE; +#define D3DTRANSFORMSTATE_WORLD (D3DTRANSFORMSTATETYPE)1 +#define D3DTRANSFORMSTATE_VIEW (D3DTRANSFORMSTATETYPE)2 +#define D3DTRANSFORMSTATE_PROJECTION (D3DTRANSFORMSTATETYPE)3 +#define D3DTRANSFORMSTATE_WORLD1 (D3DTRANSFORMSTATETYPE)4 +#define D3DTRANSFORMSTATE_WORLD2 (D3DTRANSFORMSTATETYPE)5 +#define D3DTRANSFORMSTATE_WORLD3 (D3DTRANSFORMSTATETYPE)6 +#define D3DTRANSFORMSTATE_TEXTURE0 (D3DTRANSFORMSTATETYPE)16 +#define D3DTRANSFORMSTATE_TEXTURE1 (D3DTRANSFORMSTATETYPE)17 +#define D3DTRANSFORMSTATE_TEXTURE2 (D3DTRANSFORMSTATETYPE)18 +#define D3DTRANSFORMSTATE_TEXTURE3 (D3DTRANSFORMSTATETYPE)19 +#define D3DTRANSFORMSTATE_TEXTURE4 (D3DTRANSFORMSTATETYPE)20 +#define D3DTRANSFORMSTATE_TEXTURE5 (D3DTRANSFORMSTATETYPE)21 +#define D3DTRANSFORMSTATE_TEXTURE6 (D3DTRANSFORMSTATETYPE)22 +#define D3DTRANSFORMSTATE_TEXTURE7 (D3DTRANSFORMSTATETYPE)23 + +#endif //(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DLIGHTSTATETYPE { + D3DLIGHTSTATE_MATERIAL = 1, + D3DLIGHTSTATE_AMBIENT = 2, + D3DLIGHTSTATE_COLORMODEL = 3, + D3DLIGHTSTATE_FOGMODE = 4, + D3DLIGHTSTATE_FOGSTART = 5, + D3DLIGHTSTATE_FOGEND = 6, + D3DLIGHTSTATE_FOGDENSITY = 7, +#if(DIRECT3D_VERSION >= 0x0600) + D3DLIGHTSTATE_COLORVERTEX = 8, +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DLIGHTSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DLIGHTSTATETYPE; + +#if(DIRECT3D_VERSION < 0x0800) + +typedef enum _D3DRENDERSTATETYPE { + D3DRENDERSTATE_ANTIALIAS = 2, /* D3DANTIALIASMODE */ + D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4, /* TRUE for perspective correction */ + D3DRENDERSTATE_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRENDERSTATE_FILLMODE = 8, /* D3DFILL_MODE */ + D3DRENDERSTATE_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRENDERSTATE_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRENDERSTATE_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRENDERSTATE_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRENDERSTATE_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRENDERSTATE_SRCBLEND = 19, /* D3DBLEND */ + D3DRENDERSTATE_DESTBLEND = 20, /* D3DBLEND */ + D3DRENDERSTATE_CULLMODE = 22, /* D3DCULL */ + D3DRENDERSTATE_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRENDERSTATE_ALPHAREF = 24, /* D3DFIXED */ + D3DRENDERSTATE_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRENDERSTATE_DITHERENABLE = 26, /* TRUE to enable dithering */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DRENDERSTATE_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRENDERSTATE_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRENDERSTATE_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRENDERSTATE_STIPPLEDALPHA = 33, /* TRUE to enable stippled alpha (RGB device only) */ + D3DRENDERSTATE_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRENDERSTATE_FOGTABLEMODE = 35, /* D3DFOGMODE */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DRENDERSTATE_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRENDERSTATE_FOGEND = 37, /* Fog end */ + D3DRENDERSTATE_FOGDENSITY = 38, /* Fog density */ +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_EDGEANTIALIAS = 40, /* TRUE to enable edge antialiasing */ + D3DRENDERSTATE_COLORKEYENABLE = 41, /* TRUE to enable source colorkeyed textures */ + D3DRENDERSTATE_ZBIAS = 47, /* LONG Z bias */ + D3DRENDERSTATE_RANGEFOGENABLE = 48, /* Enables range-based fog */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + D3DRENDERSTATE_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRENDERSTATE_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRENDERSTATE_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRENDERSTATE_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRENDERSTATE_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRENDERSTATE_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRENDERSTATE_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRENDERSTATE_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRENDERSTATE_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0600) + + /* + * 128 values [128, 255] are reserved for texture coordinate wrap flags. + * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using + * a flags word preserves forward compatibility with texture coordinates + * that are >2D. + */ + D3DRENDERSTATE_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRENDERSTATE_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRENDERSTATE_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRENDERSTATE_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRENDERSTATE_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRENDERSTATE_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRENDERSTATE_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRENDERSTATE_WRAP7 = 135, /* wrap for 8th texture coord. set */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DRENDERSTATE_CLIPPING = 136, + D3DRENDERSTATE_LIGHTING = 137, + D3DRENDERSTATE_EXTENTS = 138, + D3DRENDERSTATE_AMBIENT = 139, + D3DRENDERSTATE_FOGVERTEXMODE = 140, + D3DRENDERSTATE_COLORVERTEX = 141, + D3DRENDERSTATE_LOCALVIEWER = 142, + D3DRENDERSTATE_NORMALIZENORMALS = 143, + D3DRENDERSTATE_COLORKEYBLENDENABLE = 144, + D3DRENDERSTATE_DIFFUSEMATERIALSOURCE = 145, + D3DRENDERSTATE_SPECULARMATERIALSOURCE = 146, + D3DRENDERSTATE_AMBIENTMATERIALSOURCE = 147, + D3DRENDERSTATE_EMISSIVEMATERIALSOURCE = 148, + D3DRENDERSTATE_VERTEXBLEND = 151, + D3DRENDERSTATE_CLIPPLANEENABLE = 152, + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +// +// retired renderstates - not supported for DX7 interfaces +// + D3DRENDERSTATE_TEXTUREHANDLE = 1, /* Texture handle for legacy interfaces (Texture,Texture2) */ + D3DRENDERSTATE_TEXTUREADDRESS = 3, /* D3DTEXTUREADDRESS */ + D3DRENDERSTATE_WRAPU = 5, /* TRUE for wrapping in u */ + D3DRENDERSTATE_WRAPV = 6, /* TRUE for wrapping in v */ + D3DRENDERSTATE_MONOENABLE = 11, /* TRUE to enable mono rasterization */ + D3DRENDERSTATE_ROP2 = 12, /* ROP2 */ + D3DRENDERSTATE_PLANEMASK = 13, /* DWORD physical plane mask */ + D3DRENDERSTATE_TEXTUREMAG = 17, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_TEXTUREMIN = 18, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_TEXTUREMAPBLEND = 21, /* D3DTEXTUREBLEND */ + D3DRENDERSTATE_SUBPIXEL = 31, /* TRUE to enable subpixel correction */ + D3DRENDERSTATE_SUBPIXELX = 32, /* TRUE to enable correction in X only */ + D3DRENDERSTATE_STIPPLEENABLE = 39, /* TRUE to enable stippling */ +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_BORDERCOLOR = 43, /* Border color for texturing w/border */ + D3DRENDERSTATE_TEXTUREADDRESSU = 44, /* Texture addressing mode for U coordinate */ + D3DRENDERSTATE_TEXTUREADDRESSV = 45, /* Texture addressing mode for V coordinate */ + D3DRENDERSTATE_MIPMAPLODBIAS = 46, /* D3DVALUE Mipmap LOD bias */ + D3DRENDERSTATE_ANISOTROPY = 49, /* Max. anisotropy. 1 = no anisotropy */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ + D3DRENDERSTATE_FLUSHBATCH = 50, /* Explicit flush for DP batching (DX5 Only) */ +#if(DIRECT3D_VERSION >= 0x0600) + D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51, /* BOOL enable sort-independent transparency */ +#endif /* DIRECT3D_VERSION >= 0x0600 */ + D3DRENDERSTATE_STIPPLEPATTERN00 = 64, /* Stipple pattern 01... */ + D3DRENDERSTATE_STIPPLEPATTERN01 = 65, + D3DRENDERSTATE_STIPPLEPATTERN02 = 66, + D3DRENDERSTATE_STIPPLEPATTERN03 = 67, + D3DRENDERSTATE_STIPPLEPATTERN04 = 68, + D3DRENDERSTATE_STIPPLEPATTERN05 = 69, + D3DRENDERSTATE_STIPPLEPATTERN06 = 70, + D3DRENDERSTATE_STIPPLEPATTERN07 = 71, + D3DRENDERSTATE_STIPPLEPATTERN08 = 72, + D3DRENDERSTATE_STIPPLEPATTERN09 = 73, + D3DRENDERSTATE_STIPPLEPATTERN10 = 74, + D3DRENDERSTATE_STIPPLEPATTERN11 = 75, + D3DRENDERSTATE_STIPPLEPATTERN12 = 76, + D3DRENDERSTATE_STIPPLEPATTERN13 = 77, + D3DRENDERSTATE_STIPPLEPATTERN14 = 78, + D3DRENDERSTATE_STIPPLEPATTERN15 = 79, + D3DRENDERSTATE_STIPPLEPATTERN16 = 80, + D3DRENDERSTATE_STIPPLEPATTERN17 = 81, + D3DRENDERSTATE_STIPPLEPATTERN18 = 82, + D3DRENDERSTATE_STIPPLEPATTERN19 = 83, + D3DRENDERSTATE_STIPPLEPATTERN20 = 84, + D3DRENDERSTATE_STIPPLEPATTERN21 = 85, + D3DRENDERSTATE_STIPPLEPATTERN22 = 86, + D3DRENDERSTATE_STIPPLEPATTERN23 = 87, + D3DRENDERSTATE_STIPPLEPATTERN24 = 88, + D3DRENDERSTATE_STIPPLEPATTERN25 = 89, + D3DRENDERSTATE_STIPPLEPATTERN26 = 90, + D3DRENDERSTATE_STIPPLEPATTERN27 = 91, + D3DRENDERSTATE_STIPPLEPATTERN28 = 92, + D3DRENDERSTATE_STIPPLEPATTERN29 = 93, + D3DRENDERSTATE_STIPPLEPATTERN30 = 94, + D3DRENDERSTATE_STIPPLEPATTERN31 = 95, + +// +// retired renderstate names - the values are still used under new naming conventions +// + D3DRENDERSTATE_FOGTABLESTART = 36, /* Fog table start */ + D3DRENDERSTATE_FOGTABLEEND = 37, /* Fog table end */ + D3DRENDERSTATE_FOGTABLEDENSITY = 38, /* Fog table density */ + +#if(DIRECT3D_VERSION >= 0x0500) + D3DRENDERSTATE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +#endif /* DIRECT3D_VERSION >= 0x0500 */ +} D3DRENDERSTATETYPE; + +#else + +typedef enum _D3DRENDERSTATETYPE D3DRENDERSTATETYPE; + +// +// legacy renderstate names +// +#define D3DRENDERSTATE_TEXTUREPERSPECTIVE (D3DRENDERSTATETYPE)4 +#define D3DRENDERSTATE_ZENABLE (D3DRENDERSTATETYPE)7 +#define D3DRENDERSTATE_FILLMODE (D3DRENDERSTATETYPE)8 +#define D3DRENDERSTATE_SHADEMODE (D3DRENDERSTATETYPE)9 +#define D3DRENDERSTATE_LINEPATTERN (D3DRENDERSTATETYPE)10 +#define D3DRENDERSTATE_ZWRITEENABLE (D3DRENDERSTATETYPE)14 +#define D3DRENDERSTATE_ALPHATESTENABLE (D3DRENDERSTATETYPE)15 +#define D3DRENDERSTATE_LASTPIXEL (D3DRENDERSTATETYPE)16 +#define D3DRENDERSTATE_SRCBLEND (D3DRENDERSTATETYPE)19 +#define D3DRENDERSTATE_DESTBLEND (D3DRENDERSTATETYPE)20 +#define D3DRENDERSTATE_CULLMODE (D3DRENDERSTATETYPE)22 +#define D3DRENDERSTATE_ZFUNC (D3DRENDERSTATETYPE)23 +#define D3DRENDERSTATE_ALPHAREF (D3DRENDERSTATETYPE)24 +#define D3DRENDERSTATE_ALPHAFUNC (D3DRENDERSTATETYPE)25 +#define D3DRENDERSTATE_DITHERENABLE (D3DRENDERSTATETYPE)26 +#define D3DRENDERSTATE_ALPHABLENDENABLE (D3DRENDERSTATETYPE)27 +#define D3DRENDERSTATE_FOGENABLE (D3DRENDERSTATETYPE)28 +#define D3DRENDERSTATE_SPECULARENABLE (D3DRENDERSTATETYPE)29 +#define D3DRENDERSTATE_ZVISIBLE (D3DRENDERSTATETYPE)30 +#define D3DRENDERSTATE_STIPPLEDALPHA (D3DRENDERSTATETYPE)33 +#define D3DRENDERSTATE_FOGCOLOR (D3DRENDERSTATETYPE)34 +#define D3DRENDERSTATE_FOGTABLEMODE (D3DRENDERSTATETYPE)35 +#define D3DRENDERSTATE_FOGSTART (D3DRENDERSTATETYPE)36 +#define D3DRENDERSTATE_FOGEND (D3DRENDERSTATETYPE)37 +#define D3DRENDERSTATE_FOGDENSITY (D3DRENDERSTATETYPE)38 +#define D3DRENDERSTATE_EDGEANTIALIAS (D3DRENDERSTATETYPE)40 +#define D3DRENDERSTATE_ZBIAS (D3DRENDERSTATETYPE)47 +#define D3DRENDERSTATE_RANGEFOGENABLE (D3DRENDERSTATETYPE)48 +#define D3DRENDERSTATE_STENCILENABLE (D3DRENDERSTATETYPE)52 +#define D3DRENDERSTATE_STENCILFAIL (D3DRENDERSTATETYPE)53 +#define D3DRENDERSTATE_STENCILZFAIL (D3DRENDERSTATETYPE)54 +#define D3DRENDERSTATE_STENCILPASS (D3DRENDERSTATETYPE)55 +#define D3DRENDERSTATE_STENCILFUNC (D3DRENDERSTATETYPE)56 +#define D3DRENDERSTATE_STENCILREF (D3DRENDERSTATETYPE)57 +#define D3DRENDERSTATE_STENCILMASK (D3DRENDERSTATETYPE)58 +#define D3DRENDERSTATE_STENCILWRITEMASK (D3DRENDERSTATETYPE)59 +#define D3DRENDERSTATE_TEXTUREFACTOR (D3DRENDERSTATETYPE)60 +#define D3DRENDERSTATE_WRAP0 (D3DRENDERSTATETYPE)128 +#define D3DRENDERSTATE_WRAP1 (D3DRENDERSTATETYPE)129 +#define D3DRENDERSTATE_WRAP2 (D3DRENDERSTATETYPE)130 +#define D3DRENDERSTATE_WRAP3 (D3DRENDERSTATETYPE)131 +#define D3DRENDERSTATE_WRAP4 (D3DRENDERSTATETYPE)132 +#define D3DRENDERSTATE_WRAP5 (D3DRENDERSTATETYPE)133 +#define D3DRENDERSTATE_WRAP6 (D3DRENDERSTATETYPE)134 +#define D3DRENDERSTATE_WRAP7 (D3DRENDERSTATETYPE)135 + +#define D3DRENDERSTATE_CLIPPING (D3DRENDERSTATETYPE)136 +#define D3DRENDERSTATE_LIGHTING (D3DRENDERSTATETYPE)137 +#define D3DRENDERSTATE_EXTENTS (D3DRENDERSTATETYPE)138 +#define D3DRENDERSTATE_AMBIENT (D3DRENDERSTATETYPE)139 +#define D3DRENDERSTATE_FOGVERTEXMODE (D3DRENDERSTATETYPE)140 +#define D3DRENDERSTATE_COLORVERTEX (D3DRENDERSTATETYPE)141 +#define D3DRENDERSTATE_LOCALVIEWER (D3DRENDERSTATETYPE)142 +#define D3DRENDERSTATE_NORMALIZENORMALS (D3DRENDERSTATETYPE)143 +#define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144 +#define D3DRENDERSTATE_DIFFUSEMATERIALSOURCE (D3DRENDERSTATETYPE)145 +#define D3DRENDERSTATE_SPECULARMATERIALSOURCE (D3DRENDERSTATETYPE)146 +#define D3DRENDERSTATE_AMBIENTMATERIALSOURCE (D3DRENDERSTATETYPE)147 +#define D3DRENDERSTATE_EMISSIVEMATERIALSOURCE (D3DRENDERSTATETYPE)148 +#define D3DRENDERSTATE_VERTEXBLEND (D3DRENDERSTATETYPE)151 +#define D3DRENDERSTATE_CLIPPLANEENABLE (D3DRENDERSTATETYPE)152 + +// +// retired renderstates - not supported for DX7 interfaces +// +#define D3DRENDERSTATE_TEXTUREHANDLE (D3DRENDERSTATETYPE)1 +#define D3DRENDERSTATE_ANTIALIAS (D3DRENDERSTATETYPE)2 +#define D3DRENDERSTATE_TEXTUREADDRESS (D3DRENDERSTATETYPE)3 +#define D3DRENDERSTATE_WRAPU (D3DRENDERSTATETYPE)5 +#define D3DRENDERSTATE_WRAPV (D3DRENDERSTATETYPE)6 +#define D3DRENDERSTATE_MONOENABLE (D3DRENDERSTATETYPE)11 +#define D3DRENDERSTATE_ROP2 (D3DRENDERSTATETYPE)12 +#define D3DRENDERSTATE_PLANEMASK (D3DRENDERSTATETYPE)13 +#define D3DRENDERSTATE_TEXTUREMAG (D3DRENDERSTATETYPE)17 +#define D3DRENDERSTATE_TEXTUREMIN (D3DRENDERSTATETYPE)18 +#define D3DRENDERSTATE_TEXTUREMAPBLEND (D3DRENDERSTATETYPE)21 +#define D3DRENDERSTATE_SUBPIXEL (D3DRENDERSTATETYPE)31 +#define D3DRENDERSTATE_SUBPIXELX (D3DRENDERSTATETYPE)32 +#define D3DRENDERSTATE_STIPPLEENABLE (D3DRENDERSTATETYPE)39 +#define D3DRENDERSTATE_OLDALPHABLENDENABLE (D3DRENDERSTATETYPE)42 +#define D3DRENDERSTATE_BORDERCOLOR (D3DRENDERSTATETYPE)43 +#define D3DRENDERSTATE_TEXTUREADDRESSU (D3DRENDERSTATETYPE)44 +#define D3DRENDERSTATE_TEXTUREADDRESSV (D3DRENDERSTATETYPE)45 +#define D3DRENDERSTATE_MIPMAPLODBIAS (D3DRENDERSTATETYPE)46 +#define D3DRENDERSTATE_ANISOTROPY (D3DRENDERSTATETYPE)49 +#define D3DRENDERSTATE_FLUSHBATCH (D3DRENDERSTATETYPE)50 +#define D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT (D3DRENDERSTATETYPE)51 +#define D3DRENDERSTATE_STIPPLEPATTERN00 (D3DRENDERSTATETYPE)64 +#define D3DRENDERSTATE_STIPPLEPATTERN01 (D3DRENDERSTATETYPE)65 +#define D3DRENDERSTATE_STIPPLEPATTERN02 (D3DRENDERSTATETYPE)66 +#define D3DRENDERSTATE_STIPPLEPATTERN03 (D3DRENDERSTATETYPE)67 +#define D3DRENDERSTATE_STIPPLEPATTERN04 (D3DRENDERSTATETYPE)68 +#define D3DRENDERSTATE_STIPPLEPATTERN05 (D3DRENDERSTATETYPE)69 +#define D3DRENDERSTATE_STIPPLEPATTERN06 (D3DRENDERSTATETYPE)70 +#define D3DRENDERSTATE_STIPPLEPATTERN07 (D3DRENDERSTATETYPE)71 +#define D3DRENDERSTATE_STIPPLEPATTERN08 (D3DRENDERSTATETYPE)72 +#define D3DRENDERSTATE_STIPPLEPATTERN09 (D3DRENDERSTATETYPE)73 +#define D3DRENDERSTATE_STIPPLEPATTERN10 (D3DRENDERSTATETYPE)74 +#define D3DRENDERSTATE_STIPPLEPATTERN11 (D3DRENDERSTATETYPE)75 +#define D3DRENDERSTATE_STIPPLEPATTERN12 (D3DRENDERSTATETYPE)76 +#define D3DRENDERSTATE_STIPPLEPATTERN13 (D3DRENDERSTATETYPE)77 +#define D3DRENDERSTATE_STIPPLEPATTERN14 (D3DRENDERSTATETYPE)78 +#define D3DRENDERSTATE_STIPPLEPATTERN15 (D3DRENDERSTATETYPE)79 +#define D3DRENDERSTATE_STIPPLEPATTERN16 (D3DRENDERSTATETYPE)80 +#define D3DRENDERSTATE_STIPPLEPATTERN17 (D3DRENDERSTATETYPE)81 +#define D3DRENDERSTATE_STIPPLEPATTERN18 (D3DRENDERSTATETYPE)82 +#define D3DRENDERSTATE_STIPPLEPATTERN19 (D3DRENDERSTATETYPE)83 +#define D3DRENDERSTATE_STIPPLEPATTERN20 (D3DRENDERSTATETYPE)84 +#define D3DRENDERSTATE_STIPPLEPATTERN21 (D3DRENDERSTATETYPE)85 +#define D3DRENDERSTATE_STIPPLEPATTERN22 (D3DRENDERSTATETYPE)86 +#define D3DRENDERSTATE_STIPPLEPATTERN23 (D3DRENDERSTATETYPE)87 +#define D3DRENDERSTATE_STIPPLEPATTERN24 (D3DRENDERSTATETYPE)88 +#define D3DRENDERSTATE_STIPPLEPATTERN25 (D3DRENDERSTATETYPE)89 +#define D3DRENDERSTATE_STIPPLEPATTERN26 (D3DRENDERSTATETYPE)90 +#define D3DRENDERSTATE_STIPPLEPATTERN27 (D3DRENDERSTATETYPE)91 +#define D3DRENDERSTATE_STIPPLEPATTERN28 (D3DRENDERSTATETYPE)92 +#define D3DRENDERSTATE_STIPPLEPATTERN29 (D3DRENDERSTATETYPE)93 +#define D3DRENDERSTATE_STIPPLEPATTERN30 (D3DRENDERSTATETYPE)94 +#define D3DRENDERSTATE_STIPPLEPATTERN31 (D3DRENDERSTATETYPE)95 + +// +// retired renderstates - not supported for DX8 interfaces +// +#define D3DRENDERSTATE_COLORKEYENABLE (D3DRENDERSTATETYPE)41 +#define D3DRENDERSTATE_COLORKEYBLENDENABLE (D3DRENDERSTATETYPE)144 + +// +// retired renderstate names - the values are still used under new naming conventions +// +#define D3DRENDERSTATE_BLENDENABLE (D3DRENDERSTATETYPE)27 +#define D3DRENDERSTATE_FOGTABLESTART (D3DRENDERSTATETYPE)36 +#define D3DRENDERSTATE_FOGTABLEEND (D3DRENDERSTATETYPE)37 +#define D3DRENDERSTATE_FOGTABLEDENSITY (D3DRENDERSTATETYPE)38 + +#endif //(DIRECT3D_VERSION < 0x0800) + + +#if(DIRECT3D_VERSION < 0x0800) + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + + +#if(DIRECT3D_VERSION >= 0x0500) +// For back-compatibility with legacy compilations +#define D3DRENDERSTATE_BLENDENABLE D3DRENDERSTATE_ALPHABLENDENABLE +#endif /* DIRECT3D_VERSION >= 0x0500 */ + +#if(DIRECT3D_VERSION >= 0x0600) + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION >= 0x0700) + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L +#define D3DWRAPCOORD_3 0x00000008L + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +#define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y)) + +typedef struct _D3DSTATE { + union { +#if(DIRECT3D_VERSION < 0x0800) + D3DTRANSFORMSTATETYPE dtstTransformStateType; +#endif //(DIRECT3D_VERSION < 0x0800) + D3DLIGHTSTATETYPE dlstLightStateType; + D3DRENDERSTATETYPE drstRenderStateType; + }; + union { + DWORD dwArg[1]; + D3DVALUE dvArg[1]; + }; +} D3DSTATE, *LPD3DSTATE; + + +/* + * Operation used to load matrices + * hDstMat = hSrcMat + */ +typedef struct _D3DMATRIXLOAD { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix; /* Source matrix */ +} D3DMATRIXLOAD, *LPD3DMATRIXLOAD; + +/* + * Operation used to multiply matrices + * hDstMat = hSrcMat1 * hSrcMat2 + */ +typedef struct _D3DMATRIXMULTIPLY { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix1; /* First source matrix */ + D3DMATRIXHANDLE hSrcMatrix2; /* Second source matrix */ +} D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY; + +/* + * Operation used to transform and light vertices. + */ +typedef struct _D3DPROCESSVERTICES { + DWORD dwFlags; /* Do we transform or light or just copy? */ + WORD wStart; /* Index to first vertex in source */ + WORD wDest; /* Index to first vertex in local buffer */ + DWORD dwCount; /* Number of vertices to be processed */ + DWORD dwReserved; /* Must be zero */ +} D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES; + +#define D3DPROCESSVERTICES_TRANSFORMLIGHT 0x00000000L +#define D3DPROCESSVERTICES_TRANSFORM 0x00000001L +#define D3DPROCESSVERTICES_COPY 0x00000002L +#define D3DPROCESSVERTICES_OPMASK 0x00000007L + +#define D3DPROCESSVERTICES_UPDATEEXTENTS 0x00000008L +#define D3DPROCESSVERTICES_NOCOLOR 0x00000010L + + +#if(DIRECT3D_VERSION >= 0x0600) + + +#if(DIRECT3D_VERSION < 0x0800) + +/* + * State enumerants for per-stage texture processing. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* D3DVALUE (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_ADDRESS = 12, /* D3DTEXTUREADDRESS for both coordinates */ + D3DTSS_ADDRESSU = 13, /* D3DTEXTUREADDRESS for U coordinate */ + D3DTSS_ADDRESSV = 14, /* D3DTEXTUREADDRESS for V coordinate */ + D3DTSS_BORDERCOLOR = 15, /* D3DCOLOR */ + D3DTSS_MAGFILTER = 16, /* D3DTEXTUREMAGFILTER filter to use for magnification */ + D3DTSS_MINFILTER = 17, /* D3DTEXTUREMINFILTER filter to use for minification */ + D3DTSS_MIPFILTER = 18, /* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification */ + D3DTSS_MIPMAPLODBIAS = 19, /* D3DVALUE Mipmap LOD bias */ + D3DTSS_MAXMIPLEVEL = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DTSS_MAXANISOTROPY = 21, /* DWORD maximum anisotropy */ + D3DTSS_BUMPENVLSCALE = 22, /* D3DVALUE scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* D3DVALUE offset for bump map luminance */ +#if(DIRECT3D_VERSION >= 0x0700) + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ +#endif /* DIRECT3D_VERSION >= 0x0700 */ + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +#if(DIRECT3D_VERSION >= 0x0700) +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DRENDERSTATE. + */ +typedef enum _D3DTEXTUREOP +{ +// Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + +// Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + +// Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + +// Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRENDERSTATE_TEXTUREFACTOR + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + +// Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + +// Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations + * set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color +#define D3DTA_CURRENT 0x00000001 // select result of previous stage +#define D3DTA_TEXTURE 0x00000002 // select texture color +#define D3DTA_TFACTOR 0x00000003 // select RENDERSTATE_TEXTUREFACTOR +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DTA_SPECULAR 0x00000004 // select specular color +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components + +#endif //(DIRECT3D_VERSION < 0x0800) + +/* + * IDirect3DTexture2 State Filter Types + */ +typedef enum _D3DTEXTUREMAGFILTER +{ + D3DTFG_POINT = 1, // nearest + D3DTFG_LINEAR = 2, // linear interpolation + D3DTFG_FLATCUBIC = 3, // cubic + D3DTFG_GAUSSIANCUBIC = 4, // different cubic kernel + D3DTFG_ANISOTROPIC = 5, // +#if(DIRECT3D_VERSION >= 0x0700) +#endif /* DIRECT3D_VERSION >= 0x0700 */ + D3DTFG_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMAGFILTER; + +typedef enum _D3DTEXTUREMINFILTER +{ + D3DTFN_POINT = 1, // nearest + D3DTFN_LINEAR = 2, // linear interpolation + D3DTFN_ANISOTROPIC = 3, // + D3DTFN_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMINFILTER; + +typedef enum _D3DTEXTUREMIPFILTER +{ + D3DTFP_NONE = 1, // mipmapping disabled (use MAG filter) + D3DTFP_POINT = 2, // nearest + D3DTFP_LINEAR = 3, // linear interpolation + D3DTFP_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREMIPFILTER; + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +/* + * Triangle flags + */ + +/* + * Tri strip and fan flags. + * START loads all three vertices + * EVEN and ODD load just v3 with even or odd culling + * START_FLAT contains a count from 0 to 29 that allows the + * whole strip or fan to be culled in one hit. + * e.g. for a quad len = 1 + */ +#define D3DTRIFLAG_START 0x00000000L +#define D3DTRIFLAG_STARTFLAT(len) (len) /* 0 < len < 30 */ +#define D3DTRIFLAG_ODD 0x0000001eL +#define D3DTRIFLAG_EVEN 0x0000001fL + +/* + * Triangle edge flags + * enable edges for wireframe or antialiasing + */ +#define D3DTRIFLAG_EDGEENABLE1 0x00000100L /* v0-v1 edge */ +#define D3DTRIFLAG_EDGEENABLE2 0x00000200L /* v1-v2 edge */ +#define D3DTRIFLAG_EDGEENABLE3 0x00000400L /* v2-v0 edge */ +#define D3DTRIFLAG_EDGEENABLETRIANGLE \ + (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3) + +/* + * Primitive structures and related defines. Vertex offsets are to types + * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX. + */ + +/* + * Triangle list primitive structure + */ +typedef struct _D3DTRIANGLE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; + union { + WORD v3; + WORD wV3; + }; + WORD wFlags; /* Edge (and other) flags */ +} D3DTRIANGLE, *LPD3DTRIANGLE; + +/* + * Line list structure. + * The instruction count defines the number of line segments. + */ +typedef struct _D3DLINE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; +} D3DLINE, *LPD3DLINE; + +/* + * Span structure + * Spans join a list of points with the same y value. + * If the y value changes, a new span is started. + */ +typedef struct _D3DSPAN { + WORD wCount; /* Number of spans */ + WORD wFirst; /* Index to first vertex */ +} D3DSPAN, *LPD3DSPAN; + +/* + * Point structure + */ +typedef struct _D3DPOINT { + WORD wCount; /* number of points */ + WORD wFirst; /* index to first vertex */ +} D3DPOINT, *LPD3DPOINT; + + +/* + * Forward branch structure. + * Mask is logically anded with the driver status mask + * if the result equals 'value', the branch is taken. + */ +typedef struct _D3DBRANCH { + DWORD dwMask; /* Bitmask against D3D status */ + DWORD dwValue; + BOOL bNegate; /* TRUE to negate comparison */ + DWORD dwOffset; /* How far to branch forward (0 for exit)*/ +} D3DBRANCH, *LPD3DBRANCH; + +/* + * Status used for set status instruction. + * The D3D status is initialised on device creation + * and is modified by all execute calls. + */ +typedef struct _D3DSTATUS { + DWORD dwFlags; /* Do we set extents or status */ + DWORD dwStatus; /* D3D status */ + D3DRECT drExtent; +} D3DSTATUS, *LPD3DSTATUS; + +#define D3DSETSTATUS_STATUS 0x00000001L +#define D3DSETSTATUS_EXTENTS 0x00000002L +#define D3DSETSTATUS_ALL (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS) + +#if(DIRECT3D_VERSION >= 0x0500) +typedef struct _D3DCLIPSTATUS { + DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */ + DWORD dwStatus; /* Clip status */ + float minx, maxx; /* X extents */ + float miny, maxy; /* Y extents */ + float minz, maxz; /* Z extents */ +} D3DCLIPSTATUS, *LPD3DCLIPSTATUS; + +#define D3DCLIPSTATUS_STATUS 0x00000001L +#define D3DCLIPSTATUS_EXTENTS2 0x00000002L +#define D3DCLIPSTATUS_EXTENTS3 0x00000004L + +#endif /* DIRECT3D_VERSION >= 0x0500 */ +/* + * Statistics structure + */ +typedef struct _D3DSTATS { + DWORD dwSize; + DWORD dwTrianglesDrawn; + DWORD dwLinesDrawn; + DWORD dwPointsDrawn; + DWORD dwSpansDrawn; + DWORD dwVerticesProcessed; +} D3DSTATS, *LPD3DSTATS; + +/* + * Execute options. + * When calling using D3DEXECUTE_UNCLIPPED all the primitives + * inside the buffer must be contained within the viewport. + */ +#define D3DEXECUTE_CLIPPED 0x00000001l +#define D3DEXECUTE_UNCLIPPED 0x00000002l + +typedef struct _D3DEXECUTEDATA { + DWORD dwSize; + DWORD dwVertexOffset; + DWORD dwVertexCount; + DWORD dwInstructionOffset; + DWORD dwInstructionLength; + DWORD dwHVertexOffset; + D3DSTATUS dsStatus; /* Status after execute */ +} D3DEXECUTEDATA, *LPD3DEXECUTEDATA; + +/* + * Palette flags. + * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw. + */ +#define D3DPAL_FREE 0x00 /* Renderer may use this entry freely */ +#define D3DPAL_READONLY 0x40 /* Renderer may not set this entry */ +#define D3DPAL_RESERVED 0x80 /* Renderer may not use this entry */ + + +#if(DIRECT3D_VERSION >= 0x0600) + +typedef struct _D3DVERTEXBUFFERDESC { + DWORD dwSize; + DWORD dwCaps; + DWORD dwFVF; + DWORD dwNumVertices; +} D3DVERTEXBUFFERDESC, *LPD3DVERTEXBUFFERDESC; + +#define D3DVBCAPS_SYSTEMMEMORY 0x00000800l +#define D3DVBCAPS_WRITEONLY 0x00010000l +#define D3DVBCAPS_OPTIMIZED 0x80000000l +#define D3DVBCAPS_DONOTCLIP 0x00000001l + +/* Vertex Operations for ProcessVertices */ +#define D3DVOP_LIGHT (1 << 10) +#define D3DVOP_TRANSFORM (1 << 0) +#define D3DVOP_CLIP (1 << 2) +#define D3DVOP_EXTENTS (1 << 3) + + +#if(DIRECT3D_VERSION < 0x0800) + +/* The maximum number of vertices user can pass to any d3d + drawing function or to create vertex buffer with +*/ +#define D3DMAXNUMVERTICES ((1<<16) - 1) +/* The maximum number of primitives user can pass to any d3d + drawing function. +*/ +#define D3DMAXNUMPRIMITIVES ((1<<16) - 1) + +#if(DIRECT3D_VERSION >= 0x0700) + +/* Bits for dwFlags in ProcessVertices call */ +#define D3DPV_DONOTCOPYDATA (1 << 0) + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#endif //(DIRECT3D_VERSION < 0x0800) + +//------------------------------------------------------------------- + +#if(DIRECT3D_VERSION < 0x0800) + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x00E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#if(DIRECT3D_VERSION >= 0x0700) +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e + +#endif /* DIRECT3D_VERSION >= 0x0700 */ +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_RESERVED1 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_RESERVED2 0xf000 // 4 reserved bits + +#else +#define D3DFVF_RESERVED1 0x020 +#endif //(DIRECT3D_VERSION < 0x0800) + +#define D3DFVF_VERTEX ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 ) +#define D3DFVF_LVERTEX ( D3DFVF_XYZ | D3DFVF_RESERVED1 | D3DFVF_DIFFUSE | \ + D3DFVF_SPECULAR | D3DFVF_TEX1 ) +#define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \ + D3DFVF_TEX1 ) + + +typedef struct _D3DDP_PTRSTRIDE +{ + LPVOID lpvData; + DWORD dwStride; +} D3DDP_PTRSTRIDE; + +#define D3DDP_MAXTEXCOORD 8 + +typedef struct _D3DDRAWPRIMITIVESTRIDEDDATA +{ + D3DDP_PTRSTRIDE position; + D3DDP_PTRSTRIDE normal; + D3DDP_PTRSTRIDE diffuse; + D3DDP_PTRSTRIDE specular; + D3DDP_PTRSTRIDE textureCoords[D3DDP_MAXTEXCOORD]; +} D3DDRAWPRIMITIVESTRIDEDDATA, *LPD3DDRAWPRIMITIVESTRIDEDDATA; +//--------------------------------------------------------------------- +// ComputeSphereVisibility return values +// +#define D3DVIS_INSIDE_FRUSTUM 0 +#define D3DVIS_INTERSECT_FRUSTUM 1 +#define D3DVIS_OUTSIDE_FRUSTUM 2 +#define D3DVIS_INSIDE_LEFT 0 +#define D3DVIS_INTERSECT_LEFT (1 << 2) +#define D3DVIS_OUTSIDE_LEFT (2 << 2) +#define D3DVIS_INSIDE_RIGHT 0 +#define D3DVIS_INTERSECT_RIGHT (1 << 4) +#define D3DVIS_OUTSIDE_RIGHT (2 << 4) +#define D3DVIS_INSIDE_TOP 0 +#define D3DVIS_INTERSECT_TOP (1 << 6) +#define D3DVIS_OUTSIDE_TOP (2 << 6) +#define D3DVIS_INSIDE_BOTTOM 0 +#define D3DVIS_INTERSECT_BOTTOM (1 << 8) +#define D3DVIS_OUTSIDE_BOTTOM (2 << 8) +#define D3DVIS_INSIDE_NEAR 0 +#define D3DVIS_INTERSECT_NEAR (1 << 10) +#define D3DVIS_OUTSIDE_NEAR (2 << 10) +#define D3DVIS_INSIDE_FAR 0 +#define D3DVIS_INTERSECT_FAR (1 << 12) +#define D3DVIS_OUTSIDE_FAR (2 << 12) + +#define D3DVIS_MASK_FRUSTUM (3 << 0) +#define D3DVIS_MASK_LEFT (3 << 2) +#define D3DVIS_MASK_RIGHT (3 << 4) +#define D3DVIS_MASK_TOP (3 << 6) +#define D3DVIS_MASK_BOTTOM (3 << 8) +#define D3DVIS_MASK_NEAR (3 << 10) +#define D3DVIS_MASK_FAR (3 << 12) + +#endif /* DIRECT3D_VERSION >= 0x0600 */ + +#if(DIRECT3D_VERSION < 0x0800) + +#if(DIRECT3D_VERSION >= 0x0700) + +// To be used with GetInfo() +#define D3DDEVINFOID_TEXTUREMANAGER 1 +#define D3DDEVINFOID_D3DTEXTUREMANAGER 2 +#define D3DDEVINFOID_TEXTURING 3 + +typedef enum _D3DSTATEBLOCKTYPE +{ + D3DSBT_ALL = 1, // capture all state + D3DSBT_PIXELSTATE = 2, // capture pixel state + D3DSBT_VERTEXSTATE = 3, // capture vertex state + D3DSBT_FORCE_DWORD = 0xffffffff +} D3DSTATEBLOCKTYPE; + +// The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state. +// +typedef enum _D3DVERTEXBLENDFLAGS +{ + D3DVBLEND_DISABLE = 0, // Disable vertex blending + D3DVBLEND_1WEIGHT = 1, // blend between 2 matrices + D3DVBLEND_2WEIGHTS = 2, // blend between 3 matrices + D3DVBLEND_3WEIGHTS = 3, // blend between 4 matrices +} D3DVERTEXBLENDFLAGS; + +typedef enum _D3DTEXTURETRANSFORMFLAGS { + D3DTTFF_DISABLE = 0, // texture coordinates are passed directly + D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords + D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords + D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords + D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords + D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element + D3DTTFF_FORCE_DWORD = 0x7fffffff, +} D3DTEXTURETRANSFORMFLAGS; + +// Macros to set texture coordinate format bits in the FVF id + +#define D3DFVF_TEXTUREFORMAT2 0 // Two floating point values +#define D3DFVF_TEXTUREFORMAT1 3 // One floating point value +#define D3DFVF_TEXTUREFORMAT3 1 // Three floating point values +#define D3DFVF_TEXTUREFORMAT4 2 // Four floating point values + +#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16)) +#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2) +#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16)) +#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16)) + + +#endif /* DIRECT3D_VERSION >= 0x0700 */ + +#else +// +// legacy vertex blend names +// +typedef enum _D3DVERTEXBLENDFLAGS D3DVERTEXBLENDFLAGS; +#define D3DVBLEND_DISABLE (D3DVERTEXBLENDFLAGS)0 +#define D3DVBLEND_1WEIGHT (D3DVERTEXBLENDFLAGS)1 +#define D3DVBLEND_2WEIGHTS (D3DVERTEXBLENDFLAGS)2 +#define D3DVBLEND_3WEIGHTS (D3DVERTEXBLENDFLAGS)3 + +#endif //(DIRECT3D_VERSION < 0x0800) + +#pragma pack() +#pragma warning(default:4201) + +#endif /* _D3DTYPES_H_ */ + diff --git a/SDK/dxSDK/Include/d3dvec.inl b/SDK/dxSDK/Include/d3dvec.inl new file mode 100644 index 00000000..ff7fdfea --- /dev/null +++ b/SDK/dxSDK/Include/d3dvec.inl @@ -0,0 +1,255 @@ + +/****************************************************************** + * * + * D3DVec.inl * + * * + * Float-valued 3D vector class for Direct3D. * + * * + * Copyright (c) Microsoft Corp. All rights reserved. * + * * + ******************************************************************/ + +#include + +// ===================================== +// Constructors +// ===================================== + +inline +_D3DVECTOR::_D3DVECTOR(D3DVALUE f) +{ + x = y = z = f; +} + +inline +_D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z) +{ + x = _x; y = _y; z = _z; +} + +inline +_D3DVECTOR::_D3DVECTOR(const D3DVALUE f[3]) +{ + x = f[0]; y = f[1]; z = f[2]; +} + +// ===================================== +// Access grants +// ===================================== + +inline const D3DVALUE& +_D3DVECTOR::operator[](int i) const +{ + return (&x)[i]; +} + +inline D3DVALUE& +_D3DVECTOR::operator[](int i) +{ + return (&x)[i]; +} + + +// ===================================== +// Assignment operators +// ===================================== + +inline _D3DVECTOR& +_D3DVECTOR::operator += (const _D3DVECTOR& v) +{ + x += v.x; y += v.y; z += v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator -= (const _D3DVECTOR& v) +{ + x -= v.x; y -= v.y; z -= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator *= (const _D3DVECTOR& v) +{ + x *= v.x; y *= v.y; z *= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator /= (const _D3DVECTOR& v) +{ + x /= v.x; y /= v.y; z /= v.z; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator *= (D3DVALUE s) +{ + x *= s; y *= s; z *= s; + return *this; +} + +inline _D3DVECTOR& +_D3DVECTOR::operator /= (D3DVALUE s) +{ + x /= s; y /= s; z /= s; + return *this; +} + +inline _D3DVECTOR +operator + (const _D3DVECTOR& v) +{ + return v; +} + +inline _D3DVECTOR +operator - (const _D3DVECTOR& v) +{ + return _D3DVECTOR(-v.x, -v.y, -v.z); +} + +inline _D3DVECTOR +operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z); +} + +inline _D3DVECTOR +operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z); +} + +inline _D3DVECTOR +operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x*v2.x, v1.y*v2.y, v1.z*v2.z); +} + +inline _D3DVECTOR +operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR(v1.x/v2.x, v1.y/v2.y, v1.z/v2.z); +} + +inline int +operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1[0] < v2[0] && v1[1] < v2[1] && v1[2] < v2[2]; +} + +inline int +operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2]; +} + +inline _D3DVECTOR +operator * (const _D3DVECTOR& v, D3DVALUE s) +{ + return _D3DVECTOR(s*v.x, s*v.y, s*v.z); +} + +inline _D3DVECTOR +operator * (D3DVALUE s, const _D3DVECTOR& v) +{ + return _D3DVECTOR(s*v.x, s*v.y, s*v.z); +} + +inline _D3DVECTOR +operator / (const _D3DVECTOR& v, D3DVALUE s) +{ + return _D3DVECTOR(v.x/s, v.y/s, v.z/s); +} + +inline int +operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1.x==v2.x && v1.y==v2.y && v1.z == v2.z; +} + +inline D3DVALUE +Magnitude (const _D3DVECTOR& v) +{ + return (D3DVALUE) sqrt(SquareMagnitude(v)); +} + +inline D3DVALUE +SquareMagnitude (const _D3DVECTOR& v) +{ + return v.x*v.x + v.y*v.y + v.z*v.z; +} + +inline _D3DVECTOR +Normalize (const _D3DVECTOR& v) +{ + return v / Magnitude(v); +} + +inline D3DVALUE +Min (const _D3DVECTOR& v) +{ + D3DVALUE ret = v.x; + if (v.y < ret) ret = v.y; + if (v.z < ret) ret = v.z; + return ret; +} + +inline D3DVALUE +Max (const _D3DVECTOR& v) +{ + D3DVALUE ret = v.x; + if (ret < v.y) ret = v.y; + if (ret < v.z) ret = v.z; + return ret; +} + +inline _D3DVECTOR +Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0], + v1[1] < v2[1] ? v1[1] : v2[1], + v1[2] < v2[2] ? v1[2] : v2[2]); +} + +inline _D3DVECTOR +Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return _D3DVECTOR( v1[0] > v2[0] ? v1[0] : v2[0], + v1[1] > v2[1] ? v1[1] : v2[1], + v1[2] > v2[2] ? v1[2] : v2[2]); +} + +inline D3DVALUE +DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + return v1.x*v2.x + v1.y * v2.y + v1.z*v2.z; +} + +inline _D3DVECTOR +CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2) +{ + _D3DVECTOR result; + + result[0] = v1[1] * v2[2] - v1[2] * v2[1]; + result[1] = v1[2] * v2[0] - v1[0] * v2[2]; + result[2] = v1[0] * v2[1] - v1[1] * v2[0]; + + return result; +} + +inline _D3DMATRIX +operator* (const _D3DMATRIX& a, const _D3DMATRIX& b) +{ + _D3DMATRIX ret; + for (int i=0; i<4; i++) { + for (int j=0; j<4; j++) { + ret(i, j) = 0.0f; + for (int k=0; k<4; k++) { + ret(i, j) += a(i, k) * b(k, j); + } + } + } + return ret; +} + diff --git a/SDK/dxSDK/Include/d3dx10async.h b/SDK/dxSDK/Include/d3dx10async.h new file mode 100644 index 00000000..edf2e5a5 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx10async.h @@ -0,0 +1,283 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DX10Async.h +// Content: D3DX10 Asynchronous Effect / Shader loaders / compilers +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX10ASYNC_H__ +#define __D3DX10ASYNC_H__ + +#include "d3dx10.h" + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DX10Compile: +// ------------------ +// Compiles an effect or shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_2_0", +// "ps_2_a", "ps_2_sw", "tx_1_0" +// Flags1 +// See D3D10_SHADER_xxx flags. +// Flags2 +// See D3D10_EFFECT_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CompileFromFile D3DX10CompileFromFileW +#else +#define D3DX10CompileFromFile D3DX10CompileFromFileA +#endif + +HRESULT WINAPI D3DX10CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CompileFromResource D3DX10CompileFromResourceW +#else +#define D3DX10CompileFromResource D3DX10CompileFromResourceA +#endif + +HRESULT WINAPI D3DX10CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +//---------------------------------------------------------------------------- +// D3DX10CreateEffectFromXXXX: +// -------------------------- +// Creates an effect from a binary effect or file +// +// Parameters: +// +// [in] +// +// +// pFileName +// Name of the ASCII (uncompiled) or binary (compiled) Effect file to load +// +// hModule +// Handle to the module containing the resource to compile from +// pResourceName +// Name of the resource within hModule to compile from +// +// pData +// Blob of effect data, either ASCII (uncompiled) or binary (compiled) +// DataLength +// Length of the data blob +// +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pProfile +// Profile to use when compiling the effect. +// HLSLFlags +// Compilation flags pertaining to shaders and data types, honored by +// the HLSL compiler +// FXFlags +// Compilation flags pertaining to Effect compilation, honored +// by the Effect compiler +// pDevice +// Pointer to the D3D10 device on which to create Effect resources +// pEffectPool +// Pointer to an Effect pool to share variables with or NULL +// +// [out] +// +// ppEffect +// Address of the newly created Effect interface +// ppEffectPool +// Address of the newly created Effect pool interface +// ppErrors +// If non-NULL, address of a buffer with error messages that occurred +// during parsing or compilation +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI D3DX10CreateEffectFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + + +#ifdef UNICODE +#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileW +#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceW +#else +#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileA +#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceA +#endif + +HRESULT WINAPI D3DX10CreateEffectPoolFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump, + ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump, + ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileW +#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceW +#else +#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileA +#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceA +#endif + +HRESULT WINAPI D3DX10PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileW +#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceW +#else +#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileA +#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceA +#endif + +//---------------------------------------------------------------------------- +// Async processors +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, + ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncEffectCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pPool, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncEffectPoolCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + + + +//---------------------------------------------------------------------------- +// D3DX10 Asynchronous texture I/O (advanced mode) +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); + +#ifdef UNICODE +#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderW +#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderW +#else +#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderA +#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderA +#endif + +HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *pImageInfo, ID3DX10DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX10CreateAsyncShaderResourceViewProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX10ASYNC_H__ + + diff --git a/SDK/dxSDK/Include/d3dx9.h b/SDK/dxSDK/Include/d3dx9.h new file mode 100644 index 00000000..822f0a81 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9.h @@ -0,0 +1,76 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9.h +// Content: D3DX utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX_INTERNAL__ +#error Incorrect D3DX header used +#endif + +#ifndef __D3DX9_H__ +#define __D3DX9_H__ + + +// Defines +#include + +#define D3DX_DEFAULT ((UINT) -1) +#define D3DX_DEFAULT_NONPOW2 ((UINT) -2) +#define D3DX_DEFAULT_FLOAT FLT_MAX +#define D3DX_FROM_FILE ((UINT) -3) +#define D3DFMT_FROM_FILE ((D3DFORMAT) -3) + +#ifndef D3DXINLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DXINLINE __forceinline + #else + #define D3DXINLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DXINLINE inline + #else + #define D3DXINLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d9.h" +#include "d3dx9math.h" +#include "d3dx9core.h" +#include "d3dx9xof.h" +#include "d3dx9mesh.h" +#include "d3dx9shader.h" +#include "d3dx9effect.h" +#include "d3dx9tex.h" +#include "d3dx9shape.h" +#include "d3dx9anim.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DXERR { + D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), + D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), + D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), + D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), + D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), + D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), + D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), + D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), + D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX9_H__ + diff --git a/SDK/dxSDK/Include/d3dx9anim.h b/SDK/dxSDK/Include/d3dx9anim.h new file mode 100644 index 00000000..fedb1dbe --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9anim.h @@ -0,0 +1,1114 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9anim.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9ANIM_H__ +#define __D3DX9ANIM_H__ + +// {698CFB3F-9289-4d95-9A57-33A94B5A65F9} +DEFINE_GUID(IID_ID3DXAnimationSet, +0x698cfb3f, 0x9289, 0x4d95, 0x9a, 0x57, 0x33, 0xa9, 0x4b, 0x5a, 0x65, 0xf9); + +// {FA4E8E3A-9786-407d-8B4C-5995893764AF} +DEFINE_GUID(IID_ID3DXKeyframedAnimationSet, +0xfa4e8e3a, 0x9786, 0x407d, 0x8b, 0x4c, 0x59, 0x95, 0x89, 0x37, 0x64, 0xaf); + +// {6CC2480D-3808-4739-9F88-DE49FACD8D4C} +DEFINE_GUID(IID_ID3DXCompressedAnimationSet, +0x6cc2480d, 0x3808, 0x4739, 0x9f, 0x88, 0xde, 0x49, 0xfa, 0xcd, 0x8d, 0x4c); + +// {AC8948EC-F86D-43e2-96DE-31FC35F96D9E} +DEFINE_GUID(IID_ID3DXAnimationController, +0xac8948ec, 0xf86d, 0x43e2, 0x96, 0xde, 0x31, 0xfc, 0x35, 0xf9, 0x6d, 0x9e); + + +//---------------------------------------------------------------------------- +// D3DXMESHDATATYPE: +// ----------------- +// This enum defines the type of mesh data present in a MeshData structure. +//---------------------------------------------------------------------------- +typedef enum _D3DXMESHDATATYPE { + D3DXMESHTYPE_MESH = 0x001, // Normal ID3DXMesh data + D3DXMESHTYPE_PMESH = 0x002, // Progressive Mesh - ID3DXPMesh + D3DXMESHTYPE_PATCHMESH = 0x003, // Patch Mesh - ID3DXPatchMesh + + D3DXMESHTYPE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXMESHDATATYPE; + +//---------------------------------------------------------------------------- +// D3DXMESHDATA: +// ------------- +// This struct encapsulates a the mesh data that can be present in a mesh +// container. The supported mesh types are pMesh, pPMesh, pPatchMesh. +// The valid way to access this is determined by the Type enum. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHDATA +{ + D3DXMESHDATATYPE Type; + + // current mesh data interface + union + { + LPD3DXMESH pMesh; + LPD3DXPMESH pPMesh; + LPD3DXPATCHMESH pPatchMesh; + }; +} D3DXMESHDATA, *LPD3DXMESHDATA; + +//---------------------------------------------------------------------------- +// D3DXMESHCONTAINER: +// ------------------ +// This struct encapsulates a mesh object in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHCONTAINER +{ + LPSTR Name; + + D3DXMESHDATA MeshData; + + LPD3DXMATERIAL pMaterials; + LPD3DXEFFECTINSTANCE pEffects; + DWORD NumMaterials; + DWORD *pAdjacency; + + LPD3DXSKININFO pSkinInfo; + + struct _D3DXMESHCONTAINER *pNextMeshContainer; +} D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER; + +//---------------------------------------------------------------------------- +// D3DXFRAME: +// ---------- +// This struct is the encapsulates a transform frame in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this +//---------------------------------------------------------------------------- +typedef struct _D3DXFRAME +{ + LPSTR Name; + D3DXMATRIX TransformationMatrix; + + LPD3DXMESHCONTAINER pMeshContainer; + + struct _D3DXFRAME *pFrameSibling; + struct _D3DXFRAME *pFrameFirstChild; +} D3DXFRAME, *LPD3DXFRAME; + + +//---------------------------------------------------------------------------- +// ID3DXAllocateHierarchy: +// ----------------------- +// This interface is implemented by the application to allocate/free frame and +// mesh container objects. Methods on this are called during loading and +// destroying frame hierarchies +//---------------------------------------------------------------------------- +typedef interface ID3DXAllocateHierarchy ID3DXAllocateHierarchy; +typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY; + +#undef INTERFACE +#define INTERFACE ID3DXAllocateHierarchy + +DECLARE_INTERFACE(ID3DXAllocateHierarchy) +{ + // ID3DXAllocateHierarchy + + //------------------------------------------------------------------------ + // CreateFrame: + // ------------ + // Requests allocation of a frame object. + // + // Parameters: + // Name + // Name of the frame to be created + // ppNewFrame + // Returns the created frame object + // + //------------------------------------------------------------------------ + STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, + LPD3DXFRAME *ppNewFrame) PURE; + + //------------------------------------------------------------------------ + // CreateMeshContainer: + // -------------------- + // Requests allocation of a mesh container object. + // + // Parameters: + // Name + // Name of the mesh + // pMesh + // Pointer to the mesh object if basic polygon data found + // pPMesh + // Pointer to the progressive mesh object if progressive mesh data found + // pPatchMesh + // Pointer to the patch mesh object if patch data found + // pMaterials + // Array of materials used in the mesh + // pEffectInstances + // Array of effect instances used in the mesh + // NumMaterials + // Num elements in the pMaterials array + // pAdjacency + // Adjacency array for the mesh + // pSkinInfo + // Pointer to the skininfo object if the mesh is skinned + // pBoneNames + // Array of names, one for each bone in the skinned mesh. + // The numberof bones can be found from the pSkinMesh object + // pBoneOffsetMatrices + // Array of matrices, one for each bone in the skinned mesh. + // + //------------------------------------------------------------------------ + STDMETHOD(CreateMeshContainer)(THIS_ + LPCSTR Name, + CONST D3DXMESHDATA *pMeshData, + CONST D3DXMATERIAL *pMaterials, + CONST D3DXEFFECTINSTANCE *pEffectInstances, + DWORD NumMaterials, + CONST DWORD *pAdjacency, + LPD3DXSKININFO pSkinInfo, + LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE; + + //------------------------------------------------------------------------ + // DestroyFrame: + // ------------- + // Requests de-allocation of a frame object. + // + // Parameters: + // pFrameToFree + // Pointer to the frame to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE; + + //------------------------------------------------------------------------ + // DestroyMeshContainer: + // --------------------- + // Requests de-allocation of a mesh container object. + // + // Parameters: + // pMeshContainerToFree + // Pointer to the mesh container object to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXLoadUserData: +// ------------------ +// This interface is implemented by the application to load user data in a .X file +// When user data is found, these callbacks will be used to allow the application +// to load the data. +//---------------------------------------------------------------------------- +typedef interface ID3DXLoadUserData ID3DXLoadUserData; +typedef interface ID3DXLoadUserData *LPD3DXLOADUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXLoadUserData + +DECLARE_INTERFACE(ID3DXLoadUserData) +{ + STDMETHOD(LoadTopLevelData)(LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadFrameChildData)(LPD3DXFRAME pFrame, + LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer, + LPD3DXFILEDATA pXofChildData) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXSaveUserData: +// ------------------ +// This interface is implemented by the application to save user data in a .X file +// The callbacks are called for all data saved. The user can then add any +// child data objects to the object provided to the callback. +//---------------------------------------------------------------------------- +typedef interface ID3DXSaveUserData ID3DXSaveUserData; +typedef interface ID3DXSaveUserData *LPD3DXSAVEUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXSaveUserData + +DECLARE_INTERFACE(ID3DXSaveUserData) +{ + STDMETHOD(AddFrameChildData)(CONST D3DXFRAME *pFrame, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofFrameData) PURE; + + STDMETHOD(AddMeshChildData)(CONST D3DXMESHCONTAINER *pMeshContainer, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofMeshData) PURE; + + // NOTE: this is called once per Save. All top level objects should be added using the + // provided interface. One call adds objects before the frame hierarchy, the other after + STDMETHOD(AddTopLevelDataObjectsPre)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + STDMETHOD(AddTopLevelDataObjectsPost)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + + // callbacks for the user to register and then save templates to the XFile + STDMETHOD(RegisterTemplates)(LPD3DXFILE pXFileApi) PURE; + STDMETHOD(SaveTemplates)(LPD3DXFILESAVEOBJECT pXofSave) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXCALLBACK_SEARCH_FLAGS: +// -------------------------- +// Flags that can be passed into ID3DXAnimationSet::GetCallback. +//---------------------------------------------------------------------------- +typedef enum _D3DXCALLBACK_SEARCH_FLAGS +{ + D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION = 0x01, // exclude callbacks at the initial position from the search + D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION = 0x02, // reverse the callback search direction + + D3DXCALLBACK_SEARCH_FORCE_DWORD = 0x7fffffff, +} D3DXCALLBACK_SEARCH_FLAGS; + +//---------------------------------------------------------------------------- +// ID3DXAnimationSet: +// ------------------ +// This interface implements an animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationSet ID3DXAnimationSet; +typedef interface ID3DXAnimationSet *LPD3DXANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationSet + +DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer +}; + + +//---------------------------------------------------------------------------- +// D3DXPLAYBACK_TYPE: +// ------------------ +// This enum defines the type of animation set loop modes. +//---------------------------------------------------------------------------- +typedef enum _D3DXPLAYBACK_TYPE +{ + D3DXPLAY_LOOP = 0, + D3DXPLAY_ONCE = 1, + D3DXPLAY_PINGPONG = 2, + + D3DXPLAY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPLAYBACK_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXKEY_VECTOR3: +// ---------------- +// This structure describes a vector key for use in keyframe animation. +// It specifies a vector Value at a given Time. This is used for scale and +// translation keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_VECTOR3 +{ + FLOAT Time; + D3DXVECTOR3 Value; +} D3DXKEY_VECTOR3, *LPD3DXKEY_VECTOR3; + + +//---------------------------------------------------------------------------- +// D3DXKEY_QUATERNION: +// ------------------- +// This structure describes a quaternion key for use in keyframe animation. +// It specifies a quaternion Value at a given Time. This is used for rotation +// keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_QUATERNION +{ + FLOAT Time; + D3DXQUATERNION Value; +} D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION; + + +//---------------------------------------------------------------------------- +// D3DXKEY_CALLBACK: +// ----------------- +// This structure describes an callback key for use in keyframe animation. +// It specifies a pointer to user data at a given Time. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_CALLBACK +{ + FLOAT Time; + LPVOID pCallbackData; +} D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK; + + +//---------------------------------------------------------------------------- +// D3DXCOMPRESSION_FLAGS: +// ---------------------- +// Flags that can be passed into ID3DXKeyframedAnimationSet::Compress. +//---------------------------------------------------------------------------- +typedef enum _D3DXCOMPRESSION_FLAGS +{ + D3DXCOMPRESS_DEFAULT = 0x00, + + D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff, +} D3DXCOMPRESSION_FLAGS; + + +//---------------------------------------------------------------------------- +// ID3DXKeyframedAnimationSet: +// --------------------------- +// This interface implements a compressable keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet; +typedef interface ID3DXKeyframedAnimationSet *LPD3DXKEYFRAMEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXKeyframedAnimationSet + +DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD_(UINT, GetNumScaleKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetScaleKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pScaleKeys) PURE; + STDMETHOD(GetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + STDMETHOD(SetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + + // Rotation keys + STDMETHOD_(UINT, GetNumRotationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetRotationKeys)(THIS_ UINT Animation, LPD3DXKEY_QUATERNION pRotationKeys) PURE; + STDMETHOD(GetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + STDMETHOD(SetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + + // Translation keys + STDMETHOD_(UINT, GetNumTranslationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetTranslationKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pTranslationKeys) PURE; + STDMETHOD(GetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + STDMETHOD(SetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; + STDMETHOD(GetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + STDMETHOD(SetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + + // Key removal methods. These are slow, and should not be used once the animation starts playing + STDMETHOD(UnregisterScaleKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterRotationKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterTranslationKey)(THIS_ UINT Animation, UINT Key) PURE; + + // One-time animaton SRT keyframe registration + STDMETHOD(RegisterAnimationSRTKeys)(THIS_ + LPCSTR pName, // Animation name + UINT NumScaleKeys, // Number of scale keys + UINT NumRotationKeys, // Number of rotation keys + UINT NumTranslationKeys, // Number of translation keys + CONST D3DXKEY_VECTOR3 *pScaleKeys, // Array of scale keys + CONST D3DXKEY_QUATERNION *pRotationKeys, // Array of rotation keys + CONST D3DXKEY_VECTOR3 *pTranslationKeys, // Array of translation keys + DWORD *pAnimationIndex) PURE; // Returns the animation index + + // Compression + STDMETHOD(Compress)(THIS_ + DWORD Flags, // Compression flags (use D3DXCOMPRESS_STRONG for better results) + FLOAT Lossiness, // Compression loss ratio in the [0, 1] range + LPD3DXFRAME pHierarchy, // Frame hierarchy (optional) + LPD3DXBUFFER *ppCompressedData) PURE; // Returns the compressed animation set + + STDMETHOD(UnregisterAnimation)(THIS_ UINT Index) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXCompressedAnimationSet: +// ---------------------------- +// This interface implements a compressed keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXCompressedAnimationSet ID3DXCompressedAnimationSet; +typedef interface ID3DXCompressedAnimationSet *LPD3DXCOMPRESSEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXCompressedAnimationSet + +DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD(GetCompressedData)(THIS_ LPD3DXBUFFER *ppCompressedData) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXPRIORITY_TYPE: +// ------------------ +// This enum defines the type of priority group that a track can be assigned to. +//---------------------------------------------------------------------------- +typedef enum _D3DXPRIORITY_TYPE { + D3DXPRIORITY_LOW = 0, // This track should be blended with all low priority tracks before mixed with the high priority result + D3DXPRIORITY_HIGH = 1, // This track should be blended with all high priority tracks before mixed with the low priority result + + D3DXPRIORITY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPRIORITY_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRACK_DESC: +// --------------- +// This structure describes the mixing information of an animation track. +// The mixing information consists of the current position, speed, and blending +// weight for the track. The Flags field also specifies whether the track is +// low or high priority. Tracks with the same priority are blended together +// and then the two resulting values are blended using the priority blend factor. +// A track also has an animation set (stored separately) associated with it. +//---------------------------------------------------------------------------- +typedef struct _D3DXTRACK_DESC +{ + D3DXPRIORITY_TYPE Priority; + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; +} D3DXTRACK_DESC, *LPD3DXTRACK_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENT_TYPE: +// --------------- +// This enum defines the type of events keyable via the animation controller. +//---------------------------------------------------------------------------- +typedef enum _D3DXEVENT_TYPE +{ + D3DXEVENT_TRACKSPEED = 0, + D3DXEVENT_TRACKWEIGHT = 1, + D3DXEVENT_TRACKPOSITION = 2, + D3DXEVENT_TRACKENABLE = 3, + D3DXEVENT_PRIORITYBLEND = 4, + + D3DXEVENT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXEVENT_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRANSITION_TYPE: +// -------------------- +// This enum defines the type of transtion performed on a event that +// transitions from one value to another. +//---------------------------------------------------------------------------- +typedef enum _D3DXTRANSITION_TYPE { + D3DXTRANSITION_LINEAR = 0x000, // Linear transition from one value to the next + D3DXTRANSITION_EASEINEASEOUT = 0x001, // Ease-In Ease-Out spline transtion from one value to the next + + D3DXTRANSITION_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXTRANSITION_TYPE; + +//---------------------------------------------------------------------------- +// D3DXEVENT_DESC: +// --------------- +// This structure describes a animation controller event. +// It gives the event's type, track (if the event is a track event), global +// start time, duration, transition method, and target value. +//---------------------------------------------------------------------------- +typedef struct _D3DXEVENT_DESC +{ + D3DXEVENT_TYPE Type; + UINT Track; + DOUBLE StartTime; + DOUBLE Duration; + D3DXTRANSITION_TYPE Transition; + union + { + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; + }; +} D3DXEVENT_DESC, *LPD3DXEVENT_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENTHANDLE: +// ---------------- +// Handle values used to efficiently reference animation controller events. +//---------------------------------------------------------------------------- +typedef DWORD D3DXEVENTHANDLE; +typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationCallbackHandler: +// ------------------------------ +// This interface is intended to be implemented by the application, and can +// be used to handle callbacks in animation sets generated when +// ID3DXAnimationController::AdvanceTime() is called. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationCallbackHandler ID3DXAnimationCallbackHandler; +typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationCallbackHandler + +DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) +{ + //---------------------------------------------------------------------------- + // ID3DXAnimationCallbackHandler::HandleCallback: + // ---------------------------------------------- + // This method gets called when a callback occurs for an animation set in one + // of the tracks during the ID3DXAnimationController::AdvanceTime() call. + // + // Parameters: + // Track + // Index of the track on which the callback occured. + // pCallbackData + // Pointer to user owned callback data. + // + //---------------------------------------------------------------------------- + STDMETHOD(HandleCallback)(THIS_ UINT Track, LPVOID pCallbackData) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationController: +// ------------------------- +// This interface implements the main animation functionality. It connects +// animation sets with the transform frames that are being animated. Allows +// mixing multiple animations for blended animations or for transistions +// It adds also has methods to modify blending parameters over time to +// enable smooth transistions and other effects. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationController ID3DXAnimationController; +typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationController + +DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Max sizes + STDMETHOD_(UINT, GetMaxNumAnimationOutputs)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE; + + // Animation output registration + STDMETHOD(RegisterAnimationOutput)(THIS_ + LPCSTR pName, + D3DXMATRIX *pMatrix, + D3DXVECTOR3 *pScale, + D3DXQUATERNION *pRotation, + D3DXVECTOR3 *pTranslation) PURE; + + // Animation set registration + STDMETHOD(RegisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(UnregisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + + STDMETHOD_(UINT, GetNumAnimationSets)(THIS) PURE; + STDMETHOD(GetAnimationSet)(THIS_ UINT Index, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + STDMETHOD(GetAnimationSetByName)(THIS_ LPCSTR szName, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + + // Global time + STDMETHOD(AdvanceTime)(THIS_ DOUBLE TimeDelta, LPD3DXANIMATIONCALLBACKHANDLER pCallbackHandler) PURE; + STDMETHOD(ResetTime)(THIS) PURE; + STDMETHOD_(DOUBLE, GetTime)(THIS) PURE; + + // Tracks + STDMETHOD(SetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(GetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET *ppAnimSet) PURE; + + STDMETHOD(SetTrackPriority)(THIS_ UINT Track, D3DXPRIORITY_TYPE Priority) PURE; + + STDMETHOD(SetTrackSpeed)(THIS_ UINT Track, FLOAT Speed) PURE; + STDMETHOD(SetTrackWeight)(THIS_ UINT Track, FLOAT Weight) PURE; + STDMETHOD(SetTrackPosition)(THIS_ UINT Track, DOUBLE Position) PURE; + STDMETHOD(SetTrackEnable)(THIS_ UINT Track, BOOL Enable) PURE; + + STDMETHOD(SetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + STDMETHOD(GetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + + // Priority blending + STDMETHOD(SetPriorityBlend)(THIS_ FLOAT BlendWeight) PURE; + STDMETHOD_(FLOAT, GetPriorityBlend)(THIS) PURE; + + // Event keying + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackSpeed)(THIS_ UINT Track, FLOAT NewSpeed, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackWeight)(THIS_ UINT Track, FLOAT NewWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackPosition)(THIS_ UINT Track, DOUBLE NewPosition, DOUBLE StartTime) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackEnable)(THIS_ UINT Track, BOOL NewEnable, DOUBLE StartTime) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, KeyPriorityBlend)(THIS_ FLOAT NewBlendWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + + // Event unkeying + STDMETHOD(UnkeyEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(UnkeyAllTrackEvents)(THIS_ UINT Track) PURE; + STDMETHOD(UnkeyAllPriorityBlends)(THIS) PURE; + + // Event enumeration + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentTrackEvent)(THIS_ UINT Track, D3DXEVENT_TYPE EventType) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentPriorityBlend)(THIS) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingTrackEvent)(THIS_ UINT Track, D3DXEVENTHANDLE hEvent) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingPriorityBlend)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(ValidateEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(GetEventDesc)(THIS_ D3DXEVENTHANDLE hEvent, LPD3DXEVENT_DESC pDesc) PURE; + + // Cloning + STDMETHOD(CloneAnimationController)(THIS_ + UINT MaxNumAnimationOutputs, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXLoadMeshHierarchyFromX: +// --------------------------- +// Loads the first frame hierarchy in a .X file. +// +// Parameters: +// Filename +// Name of the .X file +// MeshOptions +// Mesh creation options for meshes in the file (see d3dx9mesh.h) +// pD3DDevice +// D3D9 device on which meshes in the file are created in +// pAlloc +// Allocation interface used to allocate nodes of the frame hierarchy +// pUserDataLoader +// Application provided interface to allow loading of user data +// ppFrameHierarchy +// Returns root node pointer of the loaded frame hierarchy +// ppAnimController +// Returns pointer to an animation controller corresponding to animation +// in the .X file. This is created with default max tracks and events +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXA + ( + LPCSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXW + ( + LPCWSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +#ifdef UNICODE +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXW +#else +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXA +#endif + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXInMemory + ( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXSaveMeshHierarchyToFile: +// ---------------------------- +// Creates a .X file and saves the mesh hierarchy and corresponding animations +// in it +// +// Parameters: +// Filename +// Name of the .X file +// XFormat +// Format of the .X file (text or binary, compressed or not, etc) +// pFrameRoot +// Root node of the hierarchy to be saved +// pAnimController +// The animation controller whose animation sets are to be stored +// pUserDataSaver +// Application provided interface to allow adding of user data to +// data objects saved to .X file +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileA + ( + LPCSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimcontroller, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileW + ( + LPCWSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +#ifdef UNICODE +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileW +#else +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXFrameDestroy: +// ----------------- +// Destroys the subtree of frames under the root, including the root +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAlloc +// Allocation interface used to de-allocate nodes of the frame hierarchy +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameDestroy + ( + LPD3DXFRAME pFrameRoot, + LPD3DXALLOCATEHIERARCHY pAlloc + ); + +//---------------------------------------------------------------------------- +// D3DXFrameAppendChild: +// --------------------- +// Add a child frame to a frame +// +// Parameters: +// pFrameParent +// Pointer to the parent node +// pFrameChild +// Pointer to the child node +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameAppendChild + ( + LPD3DXFRAME pFrameParent, + CONST D3DXFRAME *pFrameChild + ); + +//---------------------------------------------------------------------------- +// D3DXFrameFind: +// -------------- +// Finds a frame with the given name. Returns NULL if no frame found. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// Name +// Name of frame to find +// +//---------------------------------------------------------------------------- +LPD3DXFRAME WINAPI +D3DXFrameFind + ( + CONST D3DXFRAME *pFrameRoot, + LPCSTR Name + ); + +//---------------------------------------------------------------------------- +// D3DXFrameRegisterNamedMatrices: +// ------------------------------- +// Finds all frames that have non-null names and registers each of those frame +// matrices to the given animation controller +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAnimController +// Pointer to the animation controller where the matrices are registered +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameRegisterNamedMatrices + ( + LPD3DXFRAME pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXFrameNumNamedMatrices: +// -------------------------- +// Counts number of frames in a subtree that have non-null names +// +// Parameters: +// pFrameRoot +// Pointer to the root node of the subtree +// Return Value: +// Count of frames +// +//---------------------------------------------------------------------------- +UINT WINAPI +D3DXFrameNumNamedMatrices + ( + CONST D3DXFRAME *pFrameRoot + ); + +//---------------------------------------------------------------------------- +// D3DXFrameCalculateBoundingSphere: +// --------------------------------- +// Computes the bounding sphere of all the meshes in the frame hierarchy. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pObjectCenter +// Returns the center of the bounding sphere +// pObjectRadius +// Returns the radius of the bounding sphere +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameCalculateBoundingSphere + ( + CONST D3DXFRAME *pFrameRoot, + LPD3DXVECTOR3 pObjectCenter, + FLOAT *pObjectRadius + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateKeyframedAnimationSet: +// -------------------------------- +// This function creates a compressable keyframed animations set interface. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// NumAnimations +// Number of SRT animations +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateKeyframedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + UINT NumAnimations, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXKEYFRAMEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateCompressedAnimationSet: +// -------------------------------- +// This function creates a compressed animations set interface from +// compressed data. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// pCompressedData +// Compressed animation SRT data +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateCompressedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + LPD3DXBUFFER pCompressedData, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXCOMPRESSEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateAnimationController: +// ------------------------------ +// This function creates an animation controller object. +// +// Parameters: +// MaxNumMatrices +// Maximum number of matrices that can be animated +// MaxNumAnimationSets +// Maximum number of animation sets that can be played +// MaxNumTracks +// Maximum number of animation sets that can be blended +// MaxNumEvents +// Maximum number of outstanding events that can be scheduled at any given time +// ppAnimController +// Returns the animation controller interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateAnimationController + ( + UINT MaxNumMatrices, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9ANIM_H__ + + diff --git a/SDK/dxSDK/Include/d3dx9core.h b/SDK/dxSDK/Include/d3dx9core.h new file mode 100644 index 00000000..33f43beb --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9core.h @@ -0,0 +1,753 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9CORE_H__ +#define __D3DX9CORE_H__ + + +/////////////////////////////////////////////////////////////////////////// +// D3DX_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DXCheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DXCheckVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + +#define D3DX_VERSION 0x0902 + +#define D3DX_SDK_VERSION 35 + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// D3DXDebugMute +// Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute) +// +// returns previous mute value +// +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXDebugMute(BOOL Mute); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// D3DXGetDriverLevel: +// Returns driver version information: +// +// 700 - DX7 level driver +// 800 - DX8 level driver +// 900 - DX9 level driver +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +UINT WINAPI + D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXBuffer: +// ------------ +// The buffer object is used by D3DX to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBuffer ID3DXBuffer; +typedef interface ID3DXBuffer *LPD3DXBUFFER; + +// {8BA5FB08-5195-40e2-AC58-0D989C3A0102} +DEFINE_GUID(IID_ID3DXBuffer, +0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); + +#undef INTERFACE +#define INTERFACE ID3DXBuffer + +DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBuffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; +}; + + + +////////////////////////////////////////////////////////////////////////////// +// D3DXSPRITE flags: +// ----------------- +// D3DXSPRITE_DONOTSAVESTATE +// Specifies device state is not to be saved and restored in Begin/End. +// D3DXSPRITE_DONOTMODIFY_RENDERSTATE +// Specifies device render state is not to be changed in Begin. The device +// is assumed to be in a valid state to draw vertices containing POSITION0, +// TEXCOORD0, and COLOR0 data. +// D3DXSPRITE_OBJECTSPACE +// The WORLD, VIEW, and PROJECTION transforms are NOT modified. The +// transforms currently set to the device are used to transform the sprites +// when the batch is drawn (at Flush or End). If this is not specified, +// WORLD, VIEW, and PROJECTION transforms are modified so that sprites are +// drawn in screenspace coordinates. +// D3DXSPRITE_BILLBOARD +// Rotates each sprite about its center so that it is facing the viewer. +// D3DXSPRITE_ALPHABLEND +// Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0). +// ID3DXFont expects this to be set when drawing text. +// D3DXSPRITE_SORT_TEXTURE +// Sprites are sorted by texture prior to drawing. This is recommended when +// drawing non-overlapping sprites of uniform depth. For example, drawing +// screen-aligned text with ID3DXFont. +// D3DXSPRITE_SORT_DEPTH_FRONTTOBACK +// Sprites are sorted by depth front-to-back prior to drawing. This is +// recommended when drawing opaque sprites of varying depths. +// D3DXSPRITE_SORT_DEPTH_BACKTOFRONT +// Sprites are sorted by depth back-to-front prior to drawing. This is +// recommended when drawing transparent sprites of varying depths. +// D3DXSPRITE_DO_NOT_ADDREF_TEXTURE +// Disables calling AddRef() on every draw, and Release() on Flush() for +// better performance. +////////////////////////////////////////////////////////////////////////////// + +#define D3DXSPRITE_DONOTSAVESTATE (1 << 0) +#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1) +#define D3DXSPRITE_OBJECTSPACE (1 << 2) +#define D3DXSPRITE_BILLBOARD (1 << 3) +#define D3DXSPRITE_ALPHABLEND (1 << 4) +#define D3DXSPRITE_SORT_TEXTURE (1 << 5) +#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6) +#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7) +#define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8) + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites. +// +// Draw - +// Draws a sprite. Before transformation, the sprite is the size of +// SrcRect, with its top-left corner specified by Position. The color +// and alpha channels are modulated by Color. +// +// Flush - +// Forces all batched sprites to submitted to the device. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXSprite ID3DXSprite; +typedef interface ID3DXSprite *LPD3DXSPRITE; + + +// {BA0B762D-7D28-43ec-B9DC-2F84443B0614} +DEFINE_GUID(IID_ID3DXSprite, +0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); + + +#undef INTERFACE +#define INTERFACE ID3DXSprite + +DECLARE_INTERFACE_(ID3DXSprite, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSprite + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE; + STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE; + + STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + + STDMETHOD(Begin)(THIS_ DWORD Flags) PURE; + STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE; + STDMETHOD(Flush)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateSprite( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXSPRITE* ppSprite); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render a specific +// font on a specific device. +// +// GetGlyphData - +// Returns glyph cache data, for a given glyph. +// +// PreloadCharacters/PreloadGlyphs/PreloadText - +// Preloads glyphs into the glyph cache textures. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// If pSprite is NULL, an internal sprite object will be used. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXFONT_DESCA +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + CHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCA, *LPD3DXFONT_DESCA; + +typedef struct _D3DXFONT_DESCW +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + WCHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCW, *LPD3DXFONT_DESCW; + +#ifdef UNICODE +typedef D3DXFONT_DESCW D3DXFONT_DESC; +typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC; +#else +typedef D3DXFONT_DESCA D3DXFONT_DESC; +typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC; +#endif + + +typedef interface ID3DXFont ID3DXFont; +typedef interface ID3DXFont *LPD3DXFONT; + + +// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} +DEFINE_GUID(IID_ID3DXFont, +0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); + + +#undef INTERFACE +#define INTERFACE ID3DXFont + +DECLARE_INTERFACE_(ID3DXFont, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXFont + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE; + STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE; + STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; + STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; + + STDMETHOD_(HDC, GetDC)(THIS) PURE; + STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; + + STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; + STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; + + STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + +#ifdef __cplusplus +#ifdef UNICODE + HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); } + HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } +#else + HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); } + HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } +#endif +#endif //__cplusplus +}; + +#ifndef GetTextMetrics +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif +#endif + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateFontA( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCSTR pFaceName, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontW( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCWSTR pFaceName, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFont D3DXCreateFontW +#else +#define D3DXCreateFont D3DXCreateFontA +#endif + + +HRESULT WINAPI + D3DXCreateFontIndirectA( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCA* pDesc, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontIndirectW( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCW* pDesc, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFontIndirect D3DXCreateFontIndirectW +#else +#define D3DXCreateFontIndirect D3DXCreateFontIndirectA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToSurface: +// --------------------- +// This object abstracts rendering to surfaces. These surfaces do not +// necessarily need to be render targets. If they are not, a compatible +// render target is used, and the result copied into surface at end scene. +// +// BeginScene, EndScene - +// Call BeginScene() and EndScene() at the beginning and ending of your +// scene. These calls will setup and restore render targets, viewports, +// etc.. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTS_DESC +{ + UINT Width; + UINT Height; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTS_DESC, *LPD3DXRTS_DESC; + + +typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; +typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; + + +// {6985F346-2C3D-43b3-BE8B-DAAE8A03D894} +DEFINE_GUID(IID_ID3DXRenderToSurface, +0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToSurface + +DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToSurface + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; + + STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToSurface( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRENDERTOSURFACE* ppRenderToSurface); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToEnvMap: +// -------------------- +// This object abstracts rendering to environment maps. These surfaces +// do not necessarily need to be render targets. If they are not, a +// compatible render target is used, and the result copied into the +// environment map at end scene. +// +// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - +// This function initiates the rendering of the environment map. As +// parameters, you pass the textures in which will get filled in with +// the resulting environment map. +// +// Face - +// Call this function to initiate the drawing of each face. For each +// environment map, you will call this six times.. once for each face +// in D3DCUBEMAP_FACES. +// +// End - +// This will restore all render targets, and if needed compose all the +// rendered faces into the environment map surfaces. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTE_DESC +{ + UINT Size; + UINT MipLevels; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTE_DESC, *LPD3DXRTE_DESC; + + +typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; +typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; + + +// {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E} +DEFINE_GUID(IID_ID3DXRenderToEnvMap, +0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToEnvMap + +DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToEnvMap + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; + + STDMETHOD(BeginCube)(THIS_ + LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE; + + STDMETHOD(BeginSphere)(THIS_ + LPDIRECT3DTEXTURE9 pTex) PURE; + + STDMETHOD(BeginHemisphere)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(BeginParabolic)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE; + STDMETHOD(End)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToEnvMap( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRenderToEnvMap* ppRenderToEnvMap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXLine: +// ------------ +// This object intends to provide an easy way to draw lines using D3D. +// +// Begin - +// Prepares device for drawing lines +// +// Draw - +// Draws a line strip in screen-space. +// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 +// +// DrawTransform - +// Draws a line in screen-space with a specified input transformation matrix. +// +// End - +// Restores device state to how it was when Begin was called. +// +// SetPattern - +// Applies a stipple pattern to the line. Input is one 32-bit +// DWORD which describes the stipple pattern. 1 is opaque, 0 is +// transparent. +// +// SetPatternScale - +// Stretches the stipple pattern in the u direction. Input is one +// floating-point value. 0.0f is no scaling, whereas 1.0f doubles +// the length of the stipple pattern. +// +// SetWidth - +// Specifies the thickness of the line in the v direction. Input is +// one floating-point value. +// +// SetAntialias - +// Toggles line antialiasing. Input is a BOOL. +// TRUE = Antialiasing on. +// FALSE = Antialiasing off. +// +// SetGLLines - +// Toggles non-antialiased OpenGL line emulation. Input is a BOOL. +// TRUE = OpenGL line emulation on. +// FALSE = OpenGL line emulation off. +// +// OpenGL line: Regular line: +// *\ *\ +// | \ / \ +// | \ *\ \ +// *\ \ \ \ +// \ \ \ \ +// \ * \ * +// \ | \ / +// \| * +// * +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + + +typedef interface ID3DXLine ID3DXLine; +typedef interface ID3DXLine *LPD3DXLINE; + + +// {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8} +DEFINE_GUID(IID_ID3DXLine, +0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8); + +#undef INTERFACE +#define INTERFACE ID3DXLine + +DECLARE_INTERFACE_(ID3DXLine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXLine + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(Begin)(THIS) PURE; + + STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList, + DWORD dwVertexListCount, D3DCOLOR Color) PURE; + + STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList, + DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, + D3DCOLOR Color) PURE; + + STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE; + STDMETHOD_(DWORD, GetPattern)(THIS) PURE; + + STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE; + STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE; + + STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE; + STDMETHOD_(FLOAT, GetWidth)(THIS) PURE; + + STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE; + STDMETHOD_(BOOL, GetAntialias)(THIS) PURE; + + STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE; + STDMETHOD_(BOOL, GetGLLines)(THIS) PURE; + + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateLine( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXLINE* ppLine); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9CORE_H__ + diff --git a/SDK/dxSDK/Include/d3dx9effect.h b/SDK/dxSDK/Include/d3dx9effect.h new file mode 100644 index 00000000..a3bcd307 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9effect.h @@ -0,0 +1,873 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9effect.h +// Content: D3DX effect types and Shaders +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9EFFECT_H__ +#define __D3DX9EFFECT_H__ + + +//---------------------------------------------------------------------------- +// D3DXFX_DONOTSAVESTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, device state is not saved or restored in Begin/End. +// D3DXFX_DONOTSAVESHADERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, shader device state is not saved or restored in Begin/End. +// This includes pixel/vertex shaders and shader constants +// D3DXFX_DONOTSAVESAMPLERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, sampler device state is not saved or restored in Begin/End. +// D3DXFX_NOT_CLONEABLE +// This flag is used as a parameter to the D3DXCreateEffect family of APIs. +// When this flag is specified, the effect will be non-cloneable and will not +// contain any shader binary data. +// Furthermore, GetPassDesc will not return shader function pointers. +// Setting this flag reduces effect memory usage by about 50%. +//---------------------------------------------------------------------------- + +#define D3DXFX_DONOTSAVESTATE (1 << 0) +#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1) +#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2) + +#define D3DXFX_NOT_CLONEABLE (1 << 11) +#define D3DXFX_LARGEADDRESSAWARE (1 << 17) + +//---------------------------------------------------------------------------- +// D3DX_PARAMETER_SHARED +// Indicates that the value of a parameter will be shared with all effects +// which share the same namespace. Changing the value in one effect will +// change it in all. +// +// D3DX_PARAMETER_LITERAL +// Indicates that the value of this parameter can be treated as literal. +// Literal parameters can be marked when the effect is compiled, and their +// cannot be changed after the effect is compiled. Shared parameters cannot +// be literal. +//---------------------------------------------------------------------------- + +#define D3DX_PARAMETER_SHARED (1 << 0) +#define D3DX_PARAMETER_LITERAL (1 << 1) +#define D3DX_PARAMETER_ANNOTATION (1 << 2) + +//---------------------------------------------------------------------------- +// D3DXEFFECT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXEFFECT_DESC +{ + LPCSTR Creator; // Creator string + UINT Parameters; // Number of parameters + UINT Techniques; // Number of techniques + UINT Functions; // Number of function entrypoints + +} D3DXEFFECT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPARAMETER_DESC +{ + LPCSTR Name; // Parameter name + LPCSTR Semantic; // Parameter semantic + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT Annotations; // Number of annotations + UINT StructMembers; // Number of structure member sub-parameters + DWORD Flags; // D3DX_PARAMETER_* flags + UINT Bytes; // Parameter size, in bytes + +} D3DXPARAMETER_DESC; + + +//---------------------------------------------------------------------------- +// D3DXTECHNIQUE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXTECHNIQUE_DESC +{ + LPCSTR Name; // Technique name + UINT Passes; // Number of passes + UINT Annotations; // Number of annotations + +} D3DXTECHNIQUE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPASS_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPASS_DESC +{ + LPCSTR Name; // Pass name + UINT Annotations; // Number of annotations + + CONST DWORD *pVertexShaderFunction; // Vertex shader function + CONST DWORD *pPixelShaderFunction; // Pixel shader function + +} D3DXPASS_DESC; + + +//---------------------------------------------------------------------------- +// D3DXFUNCTION_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXFUNCTION_DESC +{ + LPCSTR Name; // Function name + UINT Annotations; // Number of annotations + +} D3DXFUNCTION_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectPool /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectPool ID3DXEffectPool; +typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL; + +// {9537AB04-3250-412e-8213-FCD2F8677933} +DEFINE_GUID(IID_ID3DXEffectPool, +0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectPool + +DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // No public methods +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXBaseEffect /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBaseEffect ID3DXBaseEffect; +typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT; + +// {017C18AC-103F-4417-8C51-6BF6EF1E56BE} +DEFINE_GUID(IID_ID3DXBaseEffect, +0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe); + + +#undef INTERFACE +#define INTERFACE ID3DXBaseEffect + +DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Useful for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + +}; + + +//---------------------------------------------------------------------------- +// ID3DXEffectStateManager: +// ------------------------ +// This is a user implemented interface that can be used to manage device +// state changes made by an Effect. +//---------------------------------------------------------------------------- + +typedef interface ID3DXEffectStateManager ID3DXEffectStateManager; +typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER; + +// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} +DEFINE_GUID(IID_ID3DXEffectStateManager, +0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce); + +#undef INTERFACE +#define INTERFACE ID3DXEffectStateManager + +DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) +{ + // The user must correctly implement QueryInterface, AddRef, and Release. + + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // The following methods are called by the Effect when it wants to make + // the corresponding device call. Note that: + // 1. Users manage the state and are therefore responsible for making the + // the corresponding device calls themselves inside their callbacks. + // 2. Effects pay attention to the return values of the callbacks, and so + // users must pay attention to what they return in their callbacks. + + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffect ID3DXEffect; +typedef interface ID3DXEffect *LPD3DXEFFECT; + +// {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5} +DEFINE_GUID(IID_ID3DXEffect, +0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5); + +#undef INTERFACE +#define INTERFACE ID3DXEffect + +DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + + // Pool + STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE; + + // Selecting and setting a technique + STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE; + STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE; + STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE; + + // Using current technique + // Begin starts active technique + // BeginPass begins a pass + // CommitChanges updates changes to any set calls in the pass. This should be called before + // any DrawPrimitive call to d3d + // EndPass ends a pass + // End ends active technique + STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; + STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE; + STDMETHOD(CommitChanges)(THIS) PURE; + STDMETHOD(EndPass)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + // Managing D3D Device + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + + // Logging device calls + STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE; + STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE; + + // Parameter blocks + STDMETHOD(BeginParameterBlock)(THIS) PURE; + STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE; + STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; + STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; + + // Cloning + STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE; + + // Fast path for setting variables directly in ID3DXEffect + STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectCompiler /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectCompiler ID3DXEffectCompiler; +typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER; + +// {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} +DEFINE_GUID(IID_ID3DXEffectCompiler, +0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectCompiler + +DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + // Parameter sharing, specialization, and information + STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE; + STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE; + + // Compilation + STDMETHOD(CompileEffect)(THIS_ DWORD Flags, + LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE; + + STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags, + LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3DXCreateEffectPool: +// --------------------- +// Creates an effect pool. Pools are used for sharing parameters between +// multiple effects. For all effects within a pool, shared parameters of the +// same name all share the same value. +// +// Parameters: +// ppPool +// Returns the created pool. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectPool( + LPD3DXEFFECTPOOL* ppPool); + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// Flags +// See D3DXSHADER_xxx flags. +// pSkipConstants +// A list of semi-colon delimited variable names. The effect will +// not set these variables to the device when they are referenced +// by a shader. NOTE: the variables specified here must be +// register bound in the file and must not be used in expressions +// in passes or samplers or the file will not load. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppEffect +// Returns a buffer containing created effect. +// ppCompilationErrors +// Returns a buffer containing any error messages which occurred during +// compile. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW +#else +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW +#else +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffect( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +// +// Ex functions that accept pSkipConstants in addition to other parameters +// + +HRESULT WINAPI + D3DXCreateEffectFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW +#else +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW +#else +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +//---------------------------------------------------------------------------- +// D3DXCreateEffectCompiler: +// ------------------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppCompiler +// Returns a buffer containing created effect compiler. +// ppParseErrors +// Returns a buffer containing any error messages which occurred during +// parse. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW +#else +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW +#else +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompiler( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +//---------------------------------------------------------------------------- +// D3DXDisassembleEffect: +// ----------------------- +// +// Parameters: +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleEffect( + LPD3DXEFFECT pEffect, + BOOL EnableColorCode, + LPD3DXBUFFER *ppDisassembly); + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9EFFECT_H__ + + diff --git a/SDK/dxSDK/Include/d3dx9math.h b/SDK/dxSDK/Include/d3dx9math.h new file mode 100644 index 00000000..3fda0534 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9math.h @@ -0,0 +1,1796 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MATH_H__ +#define __D3DX9MATH_H__ + +#include +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI ((FLOAT) 3.141592654f) +#define D3DX_1BYPI ((FLOAT) 0.318309886f) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +#define D3DX_16F_DIG 3 // # of decimal digits of precision +#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 +#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa +#define D3DX_16F_MAX 6.550400e+004 // max value +#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent +#define D3DX_16F_MAX_EXP 15 // max binary exponent +#define D3DX_16F_MIN 6.1035156e-5f // min positive value +#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent +#define D3DX_16F_MIN_EXP (-14) // min binary exponent +#define D3DX_16F_RADIX 2 // exponent radix +#define D3DX_16F_ROUNDS 1 // addition rounding: near + + +typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus +public: + D3DXFLOAT16() {}; + D3DXFLOAT16( FLOAT ); + D3DXFLOAT16( CONST D3DXFLOAT16& ); + + // casting + operator FLOAT (); + + // binary operators + BOOL operator == ( CONST D3DXFLOAT16& ) const; + BOOL operator != ( CONST D3DXFLOAT16& ) const; + +protected: +#endif //__cplusplus + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( CONST D3DXFLOAT16 * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +typedef struct D3DXVECTOR2_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR2_16F() {}; + D3DXVECTOR2_16F( CONST FLOAT * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR2_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR2_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y; + +} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F; + + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( CONST D3DXFLOAT16 * ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR3_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR3_16F() {}; + D3DXVECTOR3_16F( CONST FLOAT * ); + D3DXVECTOR3_16F( CONST D3DVECTOR& ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR3_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR3_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z; + +} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F; + + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( CONST D3DXFLOAT16* ); + D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR4_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR4_16F() {}; + D3DXVECTOR4_16F( CONST FLOAT * ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16* ); + D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR4_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR4_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z, w; + +} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( CONST D3DXFLOAT16 * ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {} + _D3DXMATRIXA16( CONST FLOAT * ); + _D3DXMATRIXA16( CONST D3DMATRIX& ); + _D3DXMATRIXA16( CONST D3DXFLOAT16 * ); + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + // new operators + void* operator new ( size_t ); + void* operator new[] ( size_t ); + + // delete operators + void operator delete ( void* ); // These are NOT virtual; Do not + void operator delete[] ( void* ); // cast to D3DXMATRIX and delete. + + // assignment operators + _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& ); + +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + + + +#if _MSC_VER >= 1300 // VC7 +#define D3DX_ALIGN16 __declspec(align(16)) +#else +#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing. +#endif + +typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; + + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {} + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( CONST D3DXFLOAT16 * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {} + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( CONST D3DXFLOAT16* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXPLANE& operator *= ( FLOAT ); + D3DXPLANE& operator /= ( FLOAT ); + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + D3DXPLANE operator * ( FLOAT ) const; + D3DXPLANE operator / ( FLOAT ) const; + + friend D3DXPLANE operator * ( FLOAT, CONST D3DXPLANE& ); + + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {} + D3DXCOLOR( DWORD argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DXFLOAT16 * ); + D3DXCOLOR( CONST D3DCOLORVALUE& ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator DWORD () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + operator D3DCOLORVALUE* (); + operator CONST D3DCOLORVALUE* () const; + + operator D3DCOLORVALUE& (); + operator CONST D3DCOLORVALUE& () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Converts an array 32-bit floats to 16-bit floats +D3DXFLOAT16* WINAPI D3DXFloat32To16Array + ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); + +// Converts an array 16-bit floats to 32-bit floats +FLOAT* WINAPI D3DXFloat16To32Array + ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform Array (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + + + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + + +// Transform Array (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector Array from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3ProjectArray + ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + +// Project vector Array from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +// Transform vector array by matrix. +D3DXVECTOR4* WINAPI D3DXVec4TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixDeterminant + ( CONST D3DXMATRIX *pM ); + +HRESULT WINAPI D3DXMatrixDecompose + ( D3DXVECTOR3 *pOutScale, D3DXQUATERNION *pOutRotation, + D3DXVECTOR3 *pOutTranslation, CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation2D + ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, + FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, + FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransformArray + ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {C7885BA7-F990-4fe7-922D-8515E477DD85} +DEFINE_GUID(IID_ID3DXMatrixStack, +0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + DWORD Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +//=========================================================================== +// +// Spherical Harmonic Runtime Routines +// +// NOTE: +// * Most of these functions can take the same object as in and out parameters. +// The exceptions are the rotation functions. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//============================================================================ + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +//============================================================================ +// +// Basic Spherical Harmonic math routines +// +//============================================================================ + +#define D3DXSH_MINORDER 2 +#define D3DXSH_MAXORDER 6 + +//============================================================================ +// +// D3DXSHEvalDirection: +// -------------------- +// Evaluates the Spherical Harmonic basis functions +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction to evaluate in - assumed to be normalized +// +//============================================================================ + +FLOAT* WINAPI D3DXSHEvalDirection + ( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir ); + +//============================================================================ +// +// D3DXSHRotate: +// -------------------- +// Rotates SH vector by a rotation matrix +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pMatrix +// Matrix used for rotation - rotation sub matrix should be orthogonal +// and have a unit determinant. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHRotate + ( FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHRotateZ: +// -------------------- +// Rotates the SH vector in the Z axis by an angle +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// Angle +// Angle in radians to rotate around the Z axis. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + + +FLOAT* WINAPI D3DXSHRotateZ + ( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHAdd: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i] + pB[i]; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Input SH coeffs (second vector.) +// +//============================================================================ + +FLOAT* WINAPI D3DXSHAdd + ( FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHScale: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i]*Scale; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pIn +// Input SH coeffs. +// Scale +// Scale factor. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHScale + ( FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale ); + +//============================================================================ +// +// D3DXSHDot: +// -------------------- +// Computes the dot product of two SH vectors +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT WINAPI D3DXSHDot + ( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHMultiply[O]: +// -------------------- +// Computes the product of two functions represented using SH (f and g), where: +// pOut[i] = int(y_i(s) * f(s) * g(s)), where y_i(s) is the ith SH basis +// function, f(s) and g(s) are SH functions (sum_i(y_i(s)*c_i)). The order O +// determines the lengths of the arrays, where there should always be O^2 +// coefficients. In general the product of two SH functions of order O generates +// and SH function of order 2*O - 1, but we truncate the result. This means +// that the product commutes (f*g == g*f) but doesn't associate +// (f*(g*h) != (f*g)*h. +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// pF +// Input SH coeffs for first function. +// pG +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHMultiply2( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply3( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply4( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply5( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply6( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); + + +//============================================================================ +// +// Basic Spherical Harmonic lighting routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHEvalDirectionalLight: +// -------------------- +// Evaluates a directional light and returns spectral SH data. The output +// vector is computed so that if the intensity of R/G/B is unit the resulting +// exit radiance of a point directly under the light on a diffuse object with +// an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut +// has to be specified, while pGout and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalDirectionalLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalSphericalLight: +// -------------------- +// Evaluates a spherical light and returns spectral SH data. There is no +// normalization of the intensity of the light like there is for directional +// lights, care has to be taken when specifiying the intensities. This will +// compute 3 spectral samples, pROut has to be specified, while pGout and +// pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pPos +// Position of light - reciever is assumed to be at the origin. +// Radius +// Radius of the spherical light source. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalSphericalLight + ( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalConeLight: +// -------------------- +// Evaluates a light that is a cone of constant intensity and returns spectral +// SH data. The output vector is computed so that if the intensity of R/G/B is +// unit the resulting exit radiance of a point directly under the light oriented +// in the cone direction on a diffuse object with an albedo of 1 would be 1.0. +// This will compute 3 spectral samples, pROut has to be specified, while pGout +// and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// Radius +// Radius of cone in radians. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalConeLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalHemisphereLight: +// -------------------- +// Evaluates a light that is a linear interpolant between two colors over the +// sphere. The interpolant is linear along the axis of the two points, not +// over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in +// Z, not in the azimuthal angle.) The resulting spherical lighting function +// is normalized so that a point on a perfectly diffuse surface with no +// shadowing and a normal pointed in the direction pDir would result in exit +// radiance with a value of 1 if the top color was white and the bottom color +// was black. This is a very simple model where Top represents the intensity +// of the "sky" and Bottom represents the intensity of the "ground". +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Axis of the hemisphere. +// Top +// Color of the upper hemisphere. +// Bottom +// Color of the lower hemisphere. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalHemisphereLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// Basic Spherical Harmonic projection routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHProjectCubeMap: +// -------------------- +// Projects a function represented on a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHProjectCubeMap + ( UINT uOrder, LPDIRECT3DCUBETEXTURE9 pCubeMap, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + + +#ifdef __cplusplus +} +#endif + + +#include "d3dx9math.inl" + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif // __D3DX9MATH_H__ + diff --git a/SDK/dxSDK/Include/d3dx9math.inl b/SDK/dxSDK/Include/d3dx9math.inl new file mode 100644 index 00000000..a3652ed4 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9math.inl @@ -0,0 +1,2251 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.inl +// Content: D3DX math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9MATH_INL__ +#define __D3DX9MATH_INL__ + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// Float16 +//-------------------------- + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) +{ + D3DXFloat32To16Array(this, &f, 1); +} + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) +{ + value = f.value; +} + +// casting +D3DXINLINE +D3DXFLOAT16::operator FLOAT () +{ + FLOAT f; + D3DXFloat16To32Array(&f, this, 1); + return f; +} + +// binary operators +D3DXINLINE BOOL +D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const +{ + return value == f.value; +} + +D3DXINLINE BOOL +D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const +{ + return value != f.value; +} + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + + +// binary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + +D3DXINLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x); +} + +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x); +} + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DXINLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DXINLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DXINLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) +{ + D3DXFloat32To16Array(&x, &v.x, 1); + D3DXFloat32To16Array(&y, &v.y, 1); + D3DXFloat32To16Array(&z, &v.z, 1); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((WORD *) &z) = *((WORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((WORD *) &z) == *((WORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((WORD *) &z) != *((WORD *) &v.z); +} + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + +D3DXINLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DXINLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DXINLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((DWORD *) &z) = *((DWORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((DWORD *) &z) == *((DWORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((DWORD *) &z) != *((DWORD *) &v.z); +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&_11, pf, 16); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DXINLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DXINLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DXINLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DXINLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DXINLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DXINLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Aligned Matrices +//-------------------------- + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : + D3DXMATRIX( m ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) +{ +} + +#ifndef SIZE_MAX +#define SIZE_MAX ((SIZE_T)-1) +#endif + +D3DXINLINE void* +_D3DXMATRIXA16::operator new( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void* +_D3DXMATRIXA16::operator new[]( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete(void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete[](void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE _D3DXMATRIXA16& +_D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) +{ + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DXINLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DXINLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DXINLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&a, pf, 4); +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DXINLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DXINLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// assignment operators +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator *= ( FLOAT f ) +{ + a *= f; + b *= f; + c *= f; + d *= f; + return *this; +} + +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + a *= fInv; + b *= fInv; + c *= fInv; + d *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator * ( FLOAT f ) const +{ + return D3DXPLANE(a * f, b * f, c * f, d * f); +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); +} + +D3DXINLINE D3DXPLANE +operator * (FLOAT f, CONST D3DXPLANE& p ) +{ + return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); +} + +D3DXINLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DXINLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( DWORD dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&r, pf, 4); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DCOLORVALUE& c ) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DXINLINE +D3DXCOLOR::operator DWORD () const +{ + DWORD dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD) (r * 255.0f + 0.5f); + DWORD dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD) (g * 255.0f + 0.5f); + DWORD dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD) (b * 255.0f + 0.5f); + DWORD dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (DWORD) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | dwB; +} + + +D3DXINLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE * () +{ + return (D3DCOLORVALUE *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE * () const +{ + return (CONST D3DCOLORVALUE *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE& () +{ + return *((D3DCOLORVALUE *) &r); +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE& () const +{ + return *((CONST D3DCOLORVALUE *) &r); +} + + +// assignment operators +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DXINLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DXINLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DXINLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DXINLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DXINLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DXINLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DXINLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DXINLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DXINLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DXINLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DXINLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DXINLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DXINLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DXINLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DXINLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DXINLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + +D3DXINLINE D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pP) + return NULL; +#endif + + pOut->a = pP->a * s; + pOut->b = pP->b * s; + pOut->c = pP->c * s; + pOut->d = pP->d * s; + return pOut; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DX9MATH_INL__ + diff --git a/SDK/dxSDK/Include/d3dx9mesh.h b/SDK/dxSDK/Include/d3dx9mesh.h new file mode 100644 index 00000000..a009d9a0 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9mesh.h @@ -0,0 +1,3007 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MESH_H__ +#define __D3DX9MESH_H__ + +// {7ED943DD-52E8-40b5-A8D8-76685C406330} +DEFINE_GUID(IID_ID3DXBaseMesh, +0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); + +// {4020E5C2-1403-4929-883F-E2E849FAC195} +DEFINE_GUID(IID_ID3DXMesh, +0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); + +// {8875769A-D579-4088-AAEB-534D1AD84E96} +DEFINE_GUID(IID_ID3DXPMesh, +0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); + +// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +DEFINE_GUID(IID_ID3DXSPMesh, +0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); + +// {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} +DEFINE_GUID(IID_ID3DXSkinInfo, +0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4); + +// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +DEFINE_GUID(IID_ID3DXPatchMesh, +0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); + +//patch mesh can be quads or tris +typedef enum _D3DXPATCHMESHTYPE { + D3DXPATCHMESH_RECT = 0x001, + D3DXPATCHMESH_TRI = 0x002, + D3DXPATCHMESH_NPATCH = 0x003, + + D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPATCHMESHTYPE; + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +enum _D3DXMESH { + D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. + D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. + D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. + D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. + D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. + D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. + D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. + D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. + D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + + D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + + D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh + + // Helper options + D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + +}; + +//patch mesh options +enum _D3DXPATCHMESH { + D3DXPATCHMESH_DEFAULT = 000, +}; +// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh +enum _D3DXMESHSIMP +{ + D3DXMESHSIMP_VERTEX = 0x1, + D3DXMESHSIMP_FACE = 0x2, + +}; + +typedef enum _D3DXCLEANTYPE { + D3DXCLEAN_BACKFACING = 0x00000001, + D3DXCLEAN_BOWTIES = 0x00000002, + + // Helper options + D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning + D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING, + D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES, +} D3DXCLEANTYPE; + +enum _MAX_FVF_DECL_SIZE +{ + MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END +}; + +typedef enum _D3DXTANGENT +{ + D3DXTANGENT_WRAP_U = 0x01, + D3DXTANGENT_WRAP_V = 0x02, + D3DXTANGENT_WRAP_UV = 0x03, + D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x04, + D3DXTANGENT_DONT_ORTHOGONALIZE = 0x08, + D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x010, + D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x020, + D3DXTANGENT_WEIGHT_BY_AREA = 0x040, + D3DXTANGENT_WEIGHT_EQUAL = 0x080, + D3DXTANGENT_WIND_CW = 0x0100, + D3DXTANGENT_CALCULATE_NORMALS = 0x0200, + D3DXTANGENT_GENERATE_IN_PLACE = 0x0400, +} D3DXTANGENT; + +// D3DXIMT_WRAP_U means the texture wraps in the U direction +// D3DXIMT_WRAP_V means the texture wraps in the V direction +// D3DXIMT_WRAP_UV means the texture wraps in both directions +typedef enum _D3DXIMT +{ + D3DXIMT_WRAP_U = 0x01, + D3DXIMT_WRAP_V = 0x02, + D3DXIMT_WRAP_UV = 0x03, +} D3DXIMT; + +// These options are only valid for UVAtlasCreate and UVAtlasPartition, we may add more for UVAtlasPack if necessary +// D3DXUVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality +// D3DXUVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts. +// D3DXUVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast. +typedef enum _D3DXUVATLAS +{ + D3DXUVATLAS_DEFAULT = 0x00, + D3DXUVATLAS_GEODESIC_FAST = 0x01, + D3DXUVATLAS_GEODESIC_QUALITY = 0x02, +} D3DXUVATLAS; + +typedef struct ID3DXBaseMesh *LPD3DXBASEMESH; +typedef struct ID3DXMesh *LPD3DXMESH; +typedef struct ID3DXPMesh *LPD3DXPMESH; +typedef struct ID3DXSPMesh *LPD3DXSPMESH; +typedef struct ID3DXSkinInfo *LPD3DXSKININFO; +typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH; +typedef interface ID3DXTextureGutterHelper *LPD3DXTEXTUREGUTTERHELPER; +typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER; + + +typedef struct _D3DXATTRIBUTERANGE +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; +} D3DXATTRIBUTERANGE; + +typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; + +typedef struct _D3DXMATERIAL +{ + D3DMATERIAL9 MatD3D; + LPSTR pTextureFilename; +} D3DXMATERIAL; +typedef D3DXMATERIAL *LPD3DXMATERIAL; + +typedef enum _D3DXEFFECTDEFAULTTYPE +{ + D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string + D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) + D3DXEDT_DWORD = 0x3, // pValue points to a DWORD + + D3DXEDT_FORCEDWORD = 0x7fffffff +} D3DXEFFECTDEFAULTTYPE; + +typedef struct _D3DXEFFECTDEFAULT +{ + LPSTR pParamName; + D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue + DWORD NumBytes; // size in bytes of the data pointed to by pValue + LPVOID pValue; // data for the default of the effect +} D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT; + +typedef struct _D3DXEFFECTINSTANCE +{ + LPSTR pEffectFilename; + DWORD NumDefaults; + LPD3DXEFFECTDEFAULT pDefaults; +} D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE; + +typedef struct _D3DXATTRIBUTEWEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; +} D3DXATTRIBUTEWEIGHTS, *LPD3DXATTRIBUTEWEIGHTS; + +enum _D3DXWELDEPSILONSFLAGS +{ + D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed + + D3DXWELDEPSILONS_DONOTSPLIT = 0x8, // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) + // if this flag is not set, all vertices that are in separate attribute groups + // will remain split and not welded. Setting this flag can slow down software vertex processing + +}; + +typedef struct _D3DXWELDEPSILONS +{ + FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT BlendWeights; + FLOAT Normal; + FLOAT PSize; + FLOAT Specular; + FLOAT Diffuse; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; + FLOAT TessFactor; +} D3DXWELDEPSILONS; + +typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; + + +#undef INTERFACE +#define INTERFACE ID3DXBaseMesh + +DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXMesh + +DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXMesh + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE; + STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXPMesh + +DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXPMesh + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE; + STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE; + + STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + + STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE; + STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + + STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE; + + // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs + // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh + STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXSPMesh + +DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSPMesh + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE; + STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE; +}; + +#define UNUSED16 (0xffff) +#define UNUSED32 (0xffffffff) + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +enum _D3DXMESHOPT { + D3DXMESHOPT_COMPACT = 0x01000000, + D3DXMESHOPT_ATTRSORT = 0x02000000, + D3DXMESHOPT_VERTEXCACHE = 0x04000000, + D3DXMESHOPT_STRIPREORDER = 0x08000000, + D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting + D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards + + // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead + +}; + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +typedef struct _D3DXBONECOMBINATION +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; + DWORD* BoneId; +} D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION; + +// The following types of patch combinations are supported: +// Patch type Basis Degree +// Rect Bezier 2,3,5 +// Rect B-Spline 2,3,5 +// Rect Catmull-Rom 3 +// Tri Bezier 2,3,5 +// N-Patch N/A 3 + +typedef struct _D3DXPATCHINFO +{ + D3DXPATCHMESHTYPE PatchType; + D3DDEGREETYPE Degree; + D3DBASISTYPE Basis; +} D3DXPATCHINFO, *LPD3DXPATCHINFO; + +#undef INTERFACE +#define INTERFACE ID3DXPatchMesh + +DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPatchMesh + + // Return creation parameters + STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE; + + // Control mesh access + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + + // This function returns the size of the tessellated mesh given a tessellation level. + // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + // be set to TRUE and TessellationLevel should be the max tessellation. + // This will result in the max mesh size necessary for adaptive tessellation. + STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE; + + //GenerateAdjacency determines which patches are adjacent with provided tolerance + //this information is used internally to optimize tessellation + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE; + + //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + //has adjacency, the new mesh will also have adjacency + STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE; + + // Optimizes the patchmesh for efficient tessellation. This function is designed + // to perform one time optimization for patch meshes that need to be tessellated + // repeatedly by calling the Tessellate() method. The optimization performed is + // independent of the actual tessellation level used. + // Currently Flags is unused. + // If vertices are changed, Optimize must be called again + STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; + + //gets and sets displacement parameters + //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture, + D3DTEXTUREFILTERTYPE MinFilter, + D3DTEXTUREFILTERTYPE MagFilter, + D3DTEXTUREFILTERTYPE MipFilter, + D3DTEXTUREADDRESS Wrap, + DWORD dwLODBias) PURE; + + STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture, + D3DTEXTUREFILTERTYPE *MinFilter, + D3DTEXTUREFILTERTYPE *MagFilter, + D3DTEXTUREFILTERTYPE *MipFilter, + D3DTEXTUREADDRESS *Wrap, + DWORD *dwLODBias) PURE; + + // Performs the uniform tessellation based on the tessellation level. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE; + + // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + // adaptive tessellation amount. Each edge is tessellated to the average of the criterion + // at the 2 vertices it connects. + // MaxTessLevel specifies the upper limit for adaptive tesselation. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(TessellateAdaptive)(THIS_ + CONST D3DXVECTOR4 *pTrans, + DWORD dwMaxTessLevel, + DWORD dwMinTessLevel, + LPD3DXMESH pMesh) PURE; + +}; + +#undef INTERFACE +#define INTERFACE ID3DXSkinInfo + +DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Specify the which vertices do each bones influence and by how much + STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; + STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE; + STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE; + STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE; + STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE; + STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; + STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE; + + // This gets the max face influences based on a triangle mesh with the specified index buffer + STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE; + + // Set min bone influence. Bone influences that are smaller than this are ignored + STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE; + // Get min bone influence. + STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; + + // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer + STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this. + + // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer + STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this. + + // Clone a skin info object + STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE; + + // Update bone influence information to match vertices after they are reordered. This should be called + // if the target vertex buffer has been reordered externally. + STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE; + + // These methods enable the modification of the vertex layout of the vertices that will be skinned + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // Apply SW skinning based on current pose matrices to the target vertices. + STDMETHOD(UpdateSkinnedMesh)(THIS_ + CONST D3DXMATRIX* pBoneTransforms, + CONST D3DXMATRIX* pBoneInvTransposeTransforms, + LPCVOID pVerticesSrc, + PVOID pVerticesDst) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + // table that describes which bones affect which subsets of the mesh + STDMETHOD(ConvertToBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxFaceInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and indices + // and a bone combination table that describes which bones palettes affect which subsets of the mesh + STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + DWORD paletteSize, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxVertexInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateMesh( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateMeshFVF( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + DWORD FVF, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateSPMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + LPD3DXSPMESH* ppSMesh); + +// clean a mesh up for simplification, try to make manifold +HRESULT WINAPI + D3DXCleanMesh( + D3DXCLEANTYPE CleanType, + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + LPD3DXMESH* ppMeshOut, + DWORD* pAdjacencyOut, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXValidMesh( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacency, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXGeneratePMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXPMESH* ppPMesh); + +HRESULT WINAPI + D3DXSimplifyMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + +HRESULT WINAPI + D3DXComputeNormals( + LPD3DXBASEMESH pMesh, + CONST DWORD *pAdjacency); + +HRESULT WINAPI + D3DXCreateBuffer( + DWORD NumBytes, + LPD3DXBUFFER *ppBuffer); + + +HRESULT WINAPI + D3DXLoadMeshFromXA( + LPCSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXW( + LPCWSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +#ifdef UNICODE +#define D3DXLoadMeshFromX D3DXLoadMeshFromXW +#else +#define D3DXLoadMeshFromX D3DXLoadMeshFromXA +#endif + +HRESULT WINAPI + D3DXLoadMeshFromXInMemory( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXResource( + HMODULE Module, + LPCSTR Name, + LPCSTR Type, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXSaveMeshToXA( + LPCSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +HRESULT WINAPI + D3DXSaveMeshToXW( + LPCWSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +#ifdef UNICODE +#define D3DXSaveMeshToX D3DXSaveMeshToXW +#else +#define D3DXSaveMeshToX D3DXSaveMeshToXA +#endif + + +HRESULT WINAPI + D3DXCreatePMeshFromStream( + IStream *pStream, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD* pNumMaterials, + LPD3DXPMESH *ppPMesh); + +// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfo( + DWORD NumVertices, + CONST D3DVERTEXELEMENT9 *pDeclaration, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfoFVF( + DWORD NumVertices, + DWORD FVF, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +#ifdef __cplusplus +} + +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXLoadMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file +// If skinning info is not present, ppSkinInfo will be NULL +HRESULT WINAPI + D3DXLoadSkinMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER* ppAdjacency, + LPD3DXBUFFER* ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pMatOut, + LPD3DXSKININFO* ppSkinInfo, + LPD3DXMESH* ppMesh); + + +// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from +// the mesh and the bone combination table and populates a skin info object with that data. The bone +// names and initial bone transforms are not filled in the skin info object by this method. This works +// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to +// determine what type it is. +HRESULT WINAPI + D3DXCreateSkinInfoFromBlendedMesh( + LPD3DXBASEMESH pMesh, + DWORD NumBones, + CONST D3DXBONECOMBINATION *pBoneCombinationTable, + LPD3DXSKININFO* ppSkinInfo); + +HRESULT WINAPI + D3DXTessellateNPatches( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + FLOAT NumSegs, + BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppAdjacencyOut); + + +//generates implied outputdecl from input decl +//the decl generated from this should be used to generate the output decl for +//the tessellator subroutines. + +HRESULT WINAPI + D3DXGenerateOutputDecl( + D3DVERTEXELEMENT9 *pOutput, + CONST D3DVERTEXELEMENT9 *pInput); + +//loads patches from an XFileData +//since an X file can have up to 6 different patch meshes in it, +//returns them in an array - pNumPatches will contain the number of +//meshes in the actual file. +HRESULT WINAPI + D3DXLoadPatchMeshFromXof( + LPD3DXFILEDATA pXofObjMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + PDWORD pNumMaterials, + LPD3DXPATCHMESH *ppMesh); + +//computes the size a single rect patch. +HRESULT WINAPI + D3DXRectPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (4) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + +//computes the size of a single triangle patch +HRESULT WINAPI + D3DXTriPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (3) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + + +//tessellates a patch into a created mesh +//similar to D3D RT patch +HRESULT WINAPI + D3DXTessellateRectPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pdwInDecl, + CONST D3DRECTPATCH_INFO *pRectPatchInfo, + LPD3DXMESH pMesh); + + +HRESULT WINAPI + D3DXTessellateTriPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pInDecl, + CONST D3DTRIPATCH_INFO *pTriPatchInfo, + LPD3DXMESH pMesh); + + + +//creates an NPatch PatchMesh from a D3DXMESH +HRESULT WINAPI + D3DXCreateNPatchMesh( + LPD3DXMESH pMeshSysMem, + LPD3DXPATCHMESH *pPatchMesh); + + +//creates a patch mesh +HRESULT WINAPI + D3DXCreatePatchMesh( + CONST D3DXPATCHINFO *pInfo, //patch type + DWORD dwNumPatches, //number of patches + DWORD dwNumVertices, //number of control vertices + DWORD dwOptions, //options + CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXPATCHMESH *pPatchMesh); + + +//returns the number of degenerates in a patch mesh - +//text output put in string. +HRESULT WINAPI + D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, + DWORD *dwcDegenerateVertices, + DWORD *dwcDegeneratePatches, + LPD3DXBUFFER *ppErrorsAndWarnings); + +UINT WINAPI + D3DXGetFVFVertexSize(DWORD FVF); + +UINT WINAPI + D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream); + +UINT WINAPI + D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl); + +HRESULT WINAPI + D3DXDeclaratorFromFVF( + DWORD FVF, + D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]); + +HRESULT WINAPI + D3DXFVFFromDeclarator( + CONST D3DVERTEXELEMENT9 *pDeclarator, + DWORD *pFVF); + +HRESULT WINAPI + D3DXWeldVertices( + LPD3DXMESH pMesh, + DWORD Flags, + CONST D3DXWELDEPSILONS *pEpsilons, + CONST DWORD *pAdjacencyIn, + DWORD *pAdjacencyOut, + DWORD *pFaceRemap, + LPD3DXBUFFER *ppVertexRemap); + +typedef struct _D3DXINTERSECTINFO +{ + DWORD FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; + + +HRESULT WINAPI + D3DXIntersect( + LPD3DXBASEMESH pMesh, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + +HRESULT WINAPI + D3DXIntersectSubset( + LPD3DXBASEMESH pMesh, + DWORD AttribId, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + + +HRESULT WINAPI D3DXSplitMesh + ( + LPD3DXMESH pMeshIn, + CONST DWORD *pAdjacencyIn, + CONST DWORD MaxSize, + CONST DWORD Options, + DWORD *pMeshesOut, + LPD3DXBUFFER *ppMeshArrayOut, + LPD3DXBUFFER *ppAdjacencyArrayOut, + LPD3DXBUFFER *ppFaceRemapArrayOut, + LPD3DXBUFFER *ppVertRemapArrayOut + ); + +BOOL WINAPI D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + + +HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh, + DWORD dwOptions); + +HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh, + DWORD dwTextureInSemantic, + DWORD dwTextureInIndex, + DWORD dwUPartialOutSemantic, + DWORD dwUPartialOutIndex, + DWORD dwVPartialOutSemantic, + DWORD dwVPartialOutIndex, + DWORD dwNormalOutSemantic, + DWORD dwNormalOutIndex, + DWORD dwOptions, + CONST DWORD *pdwAdjacency, + FLOAT fPartialEdgeThreshold, + FLOAT fSingularPointThreshold, + FLOAT fNormalEdgeThreshold, + ID3DXMesh **ppMeshOut, + ID3DXBuffer **ppVertexMapping); + + +//D3DXComputeTangent +// +//Computes the Tangent vectors for the TexStage texture coordinates +//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL +//puts the binorm in BINORM[BinormIndex] also specified in the decl. +// +//If neither the binorm or the tangnet are in the meshes declaration, +//the function will fail. +// +//If a tangent or Binorm field is in the Decl, but the user does not +//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified +//in the TangentIndex or BinormIndex will cause it to ignore the specified +//semantic. +// +//Wrap should be specified if the texture coordinates wrap. + +HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, + DWORD TexStage, + DWORD TangentIndex, + DWORD BinormIndex, + DWORD Wrap, + CONST DWORD *pAdjacency); + +//============================================================================ +// +// UVAtlas apis +// +//============================================================================ +typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext); + +// This function creates atlases for meshes. There are two modes of operation, +// either based on the number of charts, or the maximum allowed stretch. If the +// maximum allowed stretch is 0, then each triangle will likely be in its own +// chart. + +// +// The parameters are as follows: +// pMesh - Input mesh to calculate an atlas for. This must have a position +// channel and at least a 2-d texture channel. +// uMaxChartNumber - The maximum number of charts required for the atlas. +// If this is 0, it will be parameterized based solely on +// stretch. +// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, +// if 1, then any amount of stretching is allowed. +// uWidth - The width of the texture the atlas will be used on. +// uHeight - The height of the texture the atlas will be used on. +// fGutter - The minimum distance, in texels between two charts on the atlas. +// this gets scaled by the width, so if fGutter is 2.5, and it is +// used on a 512x512 texture, then the minimum distance will be +// 2.5 / 512 in u-v space. +// dwTextureIndex - Specifies which texture coordinate to write to in the +// output mesh (which is cloned from the input mesh). Useful +// if your vertex has multiple texture coordinates. +// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating +// which triangles are adjacent to each other. +// pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating +// at each face, whether an edge is a false edge or not (using +// the same ordering as the adjacency data structure). If this +// is NULL, then it is assumed that there are no false edges. If +// not NULL, then a non-false edge is indicated by -1 and a false +// edge is indicated by any other value (it is not required, but +// it may be useful for the caller to use the original adjacency +// value). This allows you to parameterize a mesh of quads, and +// the edges down the middle of each quad will not be cut when +// parameterizing the mesh. +// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the +// integrated metric tensor for that face. This lets you control +// the way this triangle may be stretched in the atlas. The IMT +// passed in will be 3 floats (a,b,c) and specify a symmetric +// matrix (a b) that, given a vector (s,t), specifies the +// (b c) +// distance between a vector v1 and a vector v2 = v1 + (s,t) as +// sqrt((s, t) * M * (s, t)^T). +// In other words, this lets one specify the magnitude of the +// stretch in an arbitrary direction in u-v space. For example +// if a = b = c = 1, then this scales the vector (1,1) by 2, and +// the vector (1,-1) by 0. Note that this is multiplying the edge +// length by the square of the matrix, so if you want the face to +// stretch to twice its +// size with no shearing, the IMT value should be (2, 0, 2), which +// is just the identity matrix times 2. +// Note that this assumes you have an orientation for the triangle +// in some 2-D space. For D3DXUVAtlas, this space is created by +// letting S be the direction from the first to the second +// vertex, and T be the cross product between the normal and S. +// +// pStatusCallback - Since the atlas creation process can be very CPU intensive, +// this allows the programmer to specify a function to be called +// periodically, similarly to how it is done in the PRT simulation +// engine. +// fCallbackFrequency - This lets you specify how often the callback will be +// called. A decent default should be 0.0001f. +// pUserContext - a void pointer to be passed back to the callback function +// dwOptions - A combination of flags in the D3DXUVATLAS enum +// ppMeshOut - A pointer to a location to store a pointer for the newly created +// mesh. +// ppFacePartitioning - A pointer to a location to store a pointer for an array, +// one DWORD per face, giving the final partitioning +// created by the atlasing algorithm. +// ppVertexRemapArray - A pointer to a location to store a pointer for an array, +// one DWORD per vertex, giving the vertex it was copied +// from, if any vertices needed to be split. +// pfMaxStretchOut - A location to store the maximum stretch resulting from the +// atlasing algorithm. +// puNumChartsOut - A location to store the number of charts created, or if the +// maximum number of charts was too low, this gives the minimum +// number of charts needed to create an atlas. + +HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + CONST DWORD *pdwFalseEdgeAdjacency, + CONST FLOAT *pfIMTArray, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This has the same exact arguments as Create, except that it does not perform the +// final packing step. This method allows one to get a partitioning out, and possibly +// modify it before sending it to be repacked. Note that if you change the +// partitioning, you'll also need to calculate new texture coordinates for any faces +// that have switched charts. +// +// The partition result adjacency output parameter is meant to be passed to the +// UVAtlasPack function, this adjacency cuts edges that are between adjacent +// charts, and also can include cuts inside of a chart in order to make it +// equivalent to a disc. For example: +// +// _______ +// | ___ | +// | |_| | +// |_____| +// +// In order to make this equivalent to a disc, we would need to add a cut, and it +// Would end up looking like: +// _______ +// | ___ | +// | |_|_| +// |_____| +// +// The resulting partition adjacency parameter cannot be NULL, because it is +// required for the packing step. + + + +HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + CONST DWORD *pdwFalseEdgeAdjacency, + CONST FLOAT *pfIMTArray, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + LPD3DXBUFFER *ppPartitionResultAdjacency, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This takes the face partitioning result from Partition and packs it into an +// atlas of the given size. pdwPartitionResultAdjacency should be derived from +// the adjacency returned from the partition step. This value cannot be NULL +// because Pack needs to know where charts were cut in the partition step in +// order to find the edges of each chart. +// The options parameter is currently reserved. +HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + CONST DWORD *pdwPartitionResultAdjacency, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXBUFFER pFacePartitioning); + + +//============================================================================ +// +// IMT Calculation apis +// +// These functions all compute the Integrated Metric Tensor for use in the +// UVAtlas API. They all calculate the IMT with respect to the canonical +// triangle, where the coordinate system is set up so that the u axis goes +// from vertex 0 to 1 and the v axis is N x u. So, for example, the second +// vertex's canonical uv coordinates are (d,0) where d is the distance between +// vertices 0 and 1. This way the IMT does not depend on the parameterization +// of the mesh, and if the signal over the surface doesn't change, then +// the IMT doesn't need to be recalculated. +//============================================================================ + +// This callback is used by D3DXComputeIMTFromSignal. +// +// uv - The texture coordinate for the vertex. +// uPrimitiveID - Face ID of the triangle on which to compute the signal. +// uSignalDimension - The number of floats to store in pfSignalOut. +// pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. +// pfSignalOut - A pointer to where to store the signal data. +typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) + (CONST D3DXVECTOR2 *uv, + UINT uPrimitiveID, + UINT uSignalDimension, + VOID *pUserData, + FLOAT *pfSignalOut); + +// This function is used to calculate the IMT from per vertex data. It sets +// up a linear system over the triangle, solves for the jacobian J, then +// constructs the IMT from that (J^TJ). +// This function allows you to calculate the IMT based off of any value in a +// mesh (color, normal, etc) by specifying the correct stride of the array. +// The IMT computed will cause areas of the mesh that have similar values to +// take up less space in the texture. +// +// pMesh - The mesh to calculate the IMT for. +// pVertexSignal - A float array of size uSignalStride * v, where v is the +// number of vertices in the mesh. +// uSignalDimension - How many floats per vertex to use in calculating the IMT. +// uSignalStride - The number of bytes per vertex in the array. This must be +// a multiple of sizeof(float) +// ppIMTData - Where to store the buffer holding the IMT data + +HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal ( + LPD3DXMESH pMesh, + CONST FLOAT *pfVertexSignal, // uSignalDimension floats per vertex + UINT uSignalDimension, + UINT uSignalStride, // stride of signal in bytes + DWORD dwOptions, // reserved for future use + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is used to calculate the IMT from data that varies over the +// surface of the mesh (generally at a higher frequency than vertex data). +// This function requires the mesh to already be parameterized (so it already +// has texture coordinates). It allows the user to define a signal arbitrarily +// over the surface of the mesh. +// +// pMesh - The mesh to calculate the IMT for. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// uSignalDimension - How many components there are in the signal. +// fMaxUVDistance - The subdivision will continue until the distance between +// all vertices is at most fMaxUVDistance. +// dwOptions - reserved for future use +// pSignalCallback - The callback to use to get the signal. +// pUserData - A pointer that will be passed in to the callback. +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromSignal( + LPD3DXMESH pMesh, + DWORD dwTextureIndex, + UINT uSignalDimension, + FLOAT fMaxUVDistance, + DWORD dwOptions, // reserved for future use + LPD3DXIMTSIGNALCALLBACK pSignalCallback, + VOID *pUserData, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is used to calculate the IMT from texture data. Given a texture +// that maps over the surface of the mesh, the algorithm computes the IMT for +// each face. This will cause large areas that are very similar to take up less +// room when parameterized with UVAtlas. The texture is assumed to be +// interpolated over the mesh bilinearly. +// +// pMesh - The mesh to calculate the IMT for. +// pTexture - The texture to load data from. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// dwOptions - Combination of one or more D3DXIMT flags. +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromTexture ( + LPD3DXMESH pMesh, + LPDIRECT3DTEXTURE9 pTexture, + DWORD dwTextureIndex, + DWORD dwOptions, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is very similar to ComputeIMTFromTexture, but it uses a +// float array to pass in the data, and it can calculate higher dimensional +// values than 4. +// +// pMesh - The mesh to calculate the IMT for. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// pfFloatArray - a pointer to a float array of size +// uWidth*uHeight*uComponents +// uWidth - The width of the texture +// uHeight - The height of the texture +// uSignalDimension - The number of floats per texel in the signal +// uComponents - The number of floats in each texel +// dwOptions - Combination of one or more D3DXIMT flags +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal( + LPD3DXMESH pMesh, + DWORD dwTextureIndex, + FLOAT *pfTexelSignal, + UINT uWidth, + UINT uHeight, + UINT uSignalDimension, + UINT uComponents, + DWORD dwOptions, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +HRESULT WINAPI + D3DXConvertMeshSubsetToSingleStrip( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices); + +HRESULT WINAPI + D3DXConvertMeshSubsetToStrips( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices, + LPD3DXBUFFER *ppStripLengths, + DWORD *pNumStrips); + + +//============================================================================ +// +// D3DXOptimizeFaces: +// -------------------- +// Generate a face remapping for a triangle list that more effectively utilizes +// vertex caches. This optimization is identical to the one provided +// by ID3DXMesh::Optimize with the hardware independent option enabled. +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pFaceRemap +// Destination buffer to store face ordering +// The number stored for a given element is where in the new ordering +// the face will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeFaces( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pFaceRemap); + +//============================================================================ +// +// D3DXOptimizeVertices: +// -------------------- +// Generate a vertex remapping to optimize for in order use of vertices for +// a given set of indices. This is commonly used after applying the face +// remap generated by D3DXOptimizeFaces +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pVertexRemap +// Destination buffer to store vertex ordering +// The number stored for a given element is where in the new ordering +// the vertex will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeVertices( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pVertexRemap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +//=========================================================================== +// +// Data structures for Spherical Harmonic Precomputation +// +// +//============================================================================ + +typedef enum _D3DXSHCOMPRESSQUALITYTYPE { + D3DXSHCQUAL_FASTLOWQUALITY = 1, + D3DXSHCQUAL_SLOWHIGHQUALITY = 2, + D3DXSHCQUAL_FORCE_DWORD = 0x7fffffff +} D3DXSHCOMPRESSQUALITYTYPE; + +typedef enum _D3DXSHGPUSIMOPT { + D3DXSHGPUSIMOPT_SHADOWRES256 = 1, + D3DXSHGPUSIMOPT_SHADOWRES512 = 0, + D3DXSHGPUSIMOPT_SHADOWRES1024 = 2, + D3DXSHGPUSIMOPT_SHADOWRES2048 = 3, + + D3DXSHGPUSIMOPT_HIGHQUALITY = 4, + + D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff +} D3DXSHGPUSIMOPT; + +// for all properties that are colors the luminance is computed +// if the simulator is run with a single channel using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +typedef struct _D3DXSHMATERIAL { + D3DCOLORVALUE Diffuse; // Diffuse albedo of the surface. (Ignored if object is a Mirror) + BOOL bMirror; // Must be set to FALSE. bMirror == TRUE not currently supported + BOOL bSubSurf; // true if the object does subsurface scattering - can't do this and be a mirror + + // subsurface scattering parameters + FLOAT RelativeIndexOfRefraction; + D3DCOLORVALUE Absorption; + D3DCOLORVALUE ReducedScattering; + +} D3DXSHMATERIAL; + +// allocated in D3DXSHPRTCompSplitMeshSC +// vertices are duplicated into multiple super clusters but +// only have a valid status in one super cluster (fill in the rest) + +typedef struct _D3DXSHPRTSPLITMESHVERTDATA { + UINT uVertRemap; // vertex in original mesh this corresponds to + UINT uSubCluster; // cluster index relative to super cluster + UCHAR ucVertStatus; // 1 if vertex has valid data, 0 if it is "fill" +} D3DXSHPRTSPLITMESHVERTDATA; + +// used in D3DXSHPRTCompSplitMeshSC +// information for each super cluster that maps into face/vert arrays + +typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA { + UINT uVertStart; // initial index into remapped vertex array + UINT uVertLength; // number of vertices in this super cluster + + UINT uFaceStart; // initial index into face array + UINT uFaceLength; // number of faces in this super cluster + + UINT uClusterStart; // initial index into cluster array + UINT uClusterLength; // number of clusters in this super cluster +} D3DXSHPRTSPLITMESHCLUSTERDATA; + +// call back function for simulator +// return S_OK to keep running the simulator - anything else represents +// failure and the simulator will abort. + +typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext); + +// interfaces for PRT buffers/simulator + +// GUIDs +// {F1827E47-00A8-49cd-908C-9D11955F8728} +DEFINE_GUID(IID_ID3DXPRTBuffer, +0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28); + +// {A758D465-FE8D-45ad-9CF0-D01E56266A07} +DEFINE_GUID(IID_ID3DXPRTCompBuffer, +0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7); + +// {838F01EC-9729-4527-AADB-DF70ADE7FEA9} +DEFINE_GUID(IID_ID3DXTextureGutterHelper, +0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9); + +// {683A4278-CD5F-4d24-90AD-C4E1B6855D53} +DEFINE_GUID(IID_ID3DXPRTEngine, +0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53); + +// interface defenitions + +typedef interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper; +typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; + +#undef INTERFACE +#define INTERFACE ID3DXPRTBuffer + +// Buffer interface - contains "NumSamples" samples +// each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) +// Same interface is used for both Vertex and Pixel PRT buffers + +DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTBuffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // changes the number of samples allocated in the buffer + STDMETHOD(Resize)(THIS_ UINT NewSize) PURE; + + // ppData will point to the memory location where sample Start begins + // pointer is valid for at least NumSamples samples + STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE; + STDMETHOD(UnlockBuffer)(THIS) PURE; + + // every scalar in buffer is multiplied by Scale + STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE; + + // every scalar contains the sum of this and pBuffers values + // pBuffer must have the same storage class/dimensions + STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE; + + // GutterHelper (described below) will fill in the gutter + // regions of a texture by interpolating "internal" values + STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE; + STDMETHOD(ReleaseGH)(THIS) PURE; + + // Evaluates attached gutter helper on the contents of this buffer + STDMETHOD(EvalGH)(THIS) PURE; + + // extracts a given channel into texture pTexture + // NumCoefficients starting from StartCoefficient are copied + STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient, + UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE; + + // extracts NumCoefficients coefficients into mesh - only applicable on single channel + // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients + // should be Order^2 + STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; + +}; + +typedef interface ID3DXPRTCompBuffer ID3DXPRTCompBuffer; +typedef interface ID3DXPRTCompBuffer *LPD3DXPRTCOMPBUFFER; + +#undef INTERFACE +#define INTERFACE ID3DXPRTCompBuffer + +// compressed buffers stored a compressed version of a PRTBuffer + +DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DPRTCompBuffer + + // NumCoeffs and NumChannels are properties of input buffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // number of clusters, and PCA vectors per-cluster + STDMETHOD_(UINT, GetNumClusters)(THIS) PURE; + STDMETHOD_(UINT, GetNumPCA)(THIS) PURE; + + // normalizes PCA weights so that they are between [-1,1] + // basis vectors are modified to reflect this + STDMETHOD(NormalizeData)(THIS) PURE; + + // copies basis vectors for cluster "Cluster" into pClusterBasis + // (NumPCA+1)*NumCoeffs*NumChannels floats + STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE; + + // UINT per sample - which cluster it belongs to + STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE; + + // copies NumExtract PCA projection coefficients starting at StartPCA + // into pPCACoefficients - NumSamples*NumExtract floats copied + STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE; + + // copies NumPCA projection coefficients starting at StartPCA + // into pTexture - should be able to cope with signed formats + STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA, + LPDIRECT3DTEXTURE9 pTexture) PURE; + + // copies NumPCA projection coefficients into mesh pScene + // Usage is D3DDECLUSAGE where coefficients are to be stored + // UsageIndexStart is starting index + STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXTextureGutterHelper + +// ID3DXTextureGutterHelper will build and manage +// "gutter" regions in a texture - this will allow for +// bi-linear interpolation to not have artifacts when rendering +// It generates a map (in texture space) where each texel +// is in one of 3 states: +// 0 Invalid - not used at all +// 1 Inside triangle +// 2 Gutter texel +// 4 represents a gutter texel that will be computed during PRT +// For each Inside/Gutter texel it stores the face it +// belongs to and barycentric coordinates for the 1st two +// vertices of that face. Gutter vertices are assigned to +// the closest edge in texture space. +// +// When used with PRT this requires a unique parameterization +// of the model - every texel must correspond to a single point +// on the surface of the model and vice versa + +DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXTextureGutterHelper + + // dimensions of texture this is bound too + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + + // Applying gutters recomputes all of the gutter texels of class "2" + // based on texels of class "1" or "4" + + // Applies gutters to a raw float buffer - each texel is NumCoeffs floats + // Width and Height must match GutterHelper + STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height); + + // Applies gutters to pTexture + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture); + + // Applies gutters to a D3DXPRTBuffer + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer); + + // Resamples a texture from a mesh onto this gutterhelpers + // parameterization. It is assumed that the UV coordinates + // for this gutter helper are in TEXTURE 0 (usage/usage index) + // and the texture coordinates should all be within [0,1] for + // both sets. + // + // pTextureIn - texture represented using parameterization in pMeshIn + // pMeshIn - Mesh with texture coordinates that represent pTextureIn + // pTextureOut texture coordinates are assumed to be in + // TEXTURE 0 + // Usage - field in DECL for pMeshIn that stores texture coordinates + // for pTextureIn + // UsageIndex - which index for Usage above for pTextureIn + // pTextureOut- Resampled texture + // + // Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + STDMETHOD(ResampleTex)(THIS_ LPDIRECT3DTEXTURE9 pTextureIn, + LPD3DXMESH pMeshIn, + D3DDECLUSAGE Usage, UINT UsageIndex, + LPDIRECT3DTEXTURE9 pTextureOut); + + // the routines below provide access to the data structures + // used by the Apply functions + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + // pFaceData must be allocated by the user + STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + // pBaryData must be allocated by the user + STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + // pTexelData must be allocated by the user + STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + // pGutterData must be allocated by the user + STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE; + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE; +}; + + +typedef interface ID3DXPRTEngine ID3DXPRTEngine; +typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE; + +#undef INTERFACE +#define INTERFACE ID3DXPRTEngine + +// ID3DXPRTEngine is used to compute a PRT simulation +// Use the following steps to compute PRT for SH +// (1) create an interface (which includes a scene) +// (2) call SetSamplingInfo +// (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) +// (4) call ComputeDirectLightingSH +// (5) [optional] call ComputeBounce +// repeat step 5 for as many bounces as wanted. +// if you want to model subsurface scattering you +// need to call ComputeSS after direct lighting and +// each bounce. +// If you want to bake the albedo into the PRT signal, you +// must call MutliplyAlbedo, otherwise the user has to multiply +// the albedo themselves. Not multiplying the albedo allows you +// to model albedo variation at a finer scale then illumination, and +// can result in better compression results. +// Luminance values are computed from RGB values using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTEngine + + // This sets a material per attribute in the scene mesh and it is + // the only way to specify subsurface scattering parameters. if + // bSetAlbedo is FALSE, NumChannels must match the current + // configuration of the PRTEngine. If you intend to change + // NumChannels (through some other SetAlbedo function) it must + // happen before SetMeshMaterials is called. + // + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex + // albedo that might have been set before. FALSE won't clobber. + // fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube + // and scaled by this amount + STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, + UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE; + + // setting albedo per-vertex or per-texel over rides the albedos stored per mesh + // but it does not over ride any other settings + + // sets an albedo to be used per vertex - the albedo is represented as a float + // pDataIn input pointer (pointint to albedo of 1st sample) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // Stride - stride in bytes to get to next samples albedo + STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE; + + // represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) + // pAlbedoTexture - texture that stores the albedo (dimension arbitrary) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // pGH - optional gutter helper, otherwise one is constructed in computation routines and + // destroyed (if not attached to buffers) + STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture, + UINT NumChannels, + LPD3DXTEXTUREGUTTERHELPER pGH) PURE; + + // gets the per-vertex albedo + STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE; + + // If pixel PRT is being computed normals default to ones that are interpolated + // from the vertex normals. This specifies a texture that stores an object + // space normal map instead (must use a texture format that can represent signed values) + // pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE; + + // Copies per-vertex albedo from mesh + // pMesh - mesh that represents the scene. It must have the same + // properties as the mesh used to create the PRTEngine + // Usage - D3DDECLUSAGE to extract albedos from + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh, + D3DDECLUSAGE Usage, + UINT NumChannels) PURE; + + // Resamples the input buffer into the output buffer + // can be used to move between per-vertex and per-texel buffers. This can also be used + // to convert single channel buffers to 3-channel buffers and vice-versa. + STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE; + + // Returns the scene mesh - including modifications from adaptive spatial sampling + // The returned mesh only has positions, normals and texture coordinates (if defined) + // pD3DDevice - d3d device that will be used to allocate the mesh + // pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from + // if the face hasn't been subdivided this will be an identity mapping + // pVertRemap - each vertex contains 3 vertices that this is a linear combination of + // pVertWeights - weights for each of above indices (sum to 1.0f) + // ppMesh - mesh that will be allocated and filled + STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE; + + // Number of vertices currently allocated (includes new vertices from adaptive sampling) + STDMETHOD_(UINT, GetNumVerts)(THIS) PURE; + // Number of faces currently allocated (includes new faces) + STDMETHOD_(UINT, GetNumFaces)(THIS) PURE; + + // Sets the Minimum/Maximum intersection distances, this can be used to control + // maximum distance that objects can shadow/reflect light, and help with "bad" + // art that might have near features that you don't want to shadow. This does not + // apply for GPU simulations. + // fMin - minimum intersection distance, must be positive and less than fMax + // fMax - maximum intersection distance, if 0.0f use the previous value, otherwise + // must be strictly greater than fMin + STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE; + + // This will subdivide faces on a mesh so that adaptively simulations can + // use a more conservative threshold (it won't miss features.) + // MinEdgeLength - minimum edge length that will be generated, if 0.0f a + // reasonable default will be used + // MaxSubdiv - maximum level of subdivision, if 0 is specified a default + // value will be used (5) + STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE; + + // This sets to sampling information used by the simulator. Adaptive sampling + // parameters are currently ignored. + // NumRays - number of rays to shoot per sample + // UseSphere - if TRUE uses spherical samples, otherwise samples over + // the hemisphere. Should only be used with GPU and Vol computations + // UseCosine - if TRUE uses a cosine weighting - not used for Vol computations + // or if only the visiblity function is desired + // Adaptive - if TRUE adaptive sampling (angular) is used + // AdaptiveThresh - threshold used to terminate adaptive angular sampling + // ignored if adaptive sampling is not set + STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays, + BOOL UseSphere, + BOOL UseCosine, + BOOL Adaptive, + FLOAT AdaptiveThresh) PURE; + + // Methods that compute the direct lighting contribution for objects + // always represente light using spherical harmonics (SH) + // the albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated + // + // SHOrder - order of SH to use + // pDataOut - PRT buffer that is generated. Can be single channel + STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Adaptive variant of above function. This will refine the mesh + // generating new vertices/faces to approximate the PRT signal + // more faithfully. + // SHOrder - order of SH to use + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated. Can be single channel. + STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Function that computes the direct lighting contribution for objects + // light is always represented using spherical harmonics (SH) + // This is done on the GPU and is much faster then using the CPU. + // The albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated. + // ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. + // A reasonable default for both values is 0.005, but the user should + // experiment (ZAngleBias can be zero, ZBias should not be.) + // Callbacks should not use the Direct3D9Device the simulator is using. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // + // pD3DDevice - device used to run GPU simulator - must support PS2.0 + // and FP render targets + // Flags - parameters for the GPU simulator, combination of one or more + // D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and + // the defaults is 512 + // SHOrder - order of SH to use + // ZBias - bias in normal direction (for depth test) + // ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) + // pDataOut - PRT buffer that is filled in. Can be single channel + STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice, + UINT Flags, + UINT SHOrder, + FLOAT ZBias, + FLOAT ZAngleBias, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // Functions that computes subsurface scattering (using material properties) + // Albedo is not multiplied by result. This only works for per-vertex data + // use ResampleBuffer to move per-vertex data into a texture and back. + // + // pDataIn - input data (previous bounce) + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of ComputeSS. + // + // pDataIn - input data (previous bounce) + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // computes a single bounce of inter-reflected light + // works for SH based PRT or generic lighting + // Albedo is not multiplied by result + // + // pDataIn - previous bounces data + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of above function. + // + // pDataIn - previous bounces data, can be single channel + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Computes projection of distant SH radiance into a local SH radiance + // function. This models how direct lighting is attenuated by the + // scene and is a form of "neighborhood transfer." The result is + // a linear operator (matrix) at every sample point, if you multiply + // this matrix by the distant SH lighting coefficients you get an + // approximation of the local incident radiance function from + // direct lighting. These resulting lighting coefficients can + // than be projected into another basis or used with any rendering + // technique that uses spherical harmonics as input. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars + // per channel at each sample location. + // + // SHOrderIn - Order of the SH representation of distant lighting + // SHOrderOut - Order of the SH representation of local lighting + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn, + UINT SHOrderOut, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // At each sample location computes a linear operator (matrix) that maps + // the representation of source radiance (NumCoeffs in pSurfDataIn) + // into a local incident radiance function approximated with spherical + // harmonics. For example if a light map data is specified in pSurfDataIn + // the result is an SH representation of the flow of light at each sample + // point. If PRT data for an outdoor scene is used, each sample point + // contains a matrix that models how distant lighting bounces of the objects + // in the scene and arrives at the given sample point. Combined with + // ComputeVolumeSamplesDirectSH this gives the complete representation for + // how light arrives at each sample point parameterized by distant lighting. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars + // per channel at each sample location. + // + // pSurfDataIn - previous bounce data + // SHOrder - order of SH to generate projection with + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT SHOrder, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Computes direct lighting (SH) for a point not on the mesh + // with a given normal - cannot use texture buffers. + // + // SHOrder - order of SH to use + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // given the solution for PRT or light maps, computes transfer vector at arbitrary + // position/normal pairs in space + // + // pSurfDataIn - input data + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + // pDataTotal - optional buffer to sum results into - can be NULL + STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Frees temporary data structures that can be created for subsurface scattering + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeSSData)(THIS) PURE; + + // Frees temporary data structures that can be created for bounce simulations + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeBounceData)(THIS) PURE; + + // This computes the Local Deformable PRT (LDPRT) coefficients relative to the + // per sample normals that minimize error in a least squares sense with respect + // to the input PRT data set. These coefficients can be used with skinned/transformed + // normals to model global effects with dynamic objects. Shading normals can + // optionally be solved for - these normals (along with the LDPRT coefficients) can + // more accurately represent the PRT signal. The coefficients are for zonal + // harmonics oriented in the normal/shading normal direction. + // + // pDataIn - SH PRT dataset that is input + // SHOrder - Order of SH to compute conv coefficients for + // pNormOut - Optional array of vectors (passed in) that will be filled with + // "shading normals", LDPRT coefficients are optimized for + // these normals. This array must be the same size as the number of + // samples in pDataIn + // pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn, + UINT SHOrder, + D3DXVECTOR3 *pNormOut, + LPD3DXPRTBUFFER pDataOut) PURE; + + // scales all the samples associated with a given sub mesh + // can be useful when using subsurface scattering + // fScale - value to scale each vector in submesh by + STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE; + + // mutliplies each PRT vector by the albedo - can be used if you want to have the albedo + // burned into the dataset, often better not to do this. If this is not done the user + // must mutliply the albedo themselves when rendering - just multiply the albedo times + // the result of the PRT dot product. + // If pDataOut is a texture simulation result and there is an albedo texture it + // must be represented at the same resolution as the simulation buffer. You can use + // LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must + // be careful about how the gutters are handled. + // + // pDataOut - dataset that will get albedo pushed into it + STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE; + + // Sets a pointer to an optional call back function that reports back to the + // user percentage done and gives them the option of quitting + // pCB - pointer to call back function, return S_OK for the simulation + // to continue + // Frequency - 1/Frequency is roughly the number of times the call back + // will be invoked + // lpUserContext - will be passed back to the users call back + STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function + // takes into account settings from SetMinMaxIntersection. If the closest intersection + // is not needed this function is more efficient compared to the ClosestRayIntersection + // method. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + + STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an + // intersection the closest face that was intersected and its first two barycentric coordinates + // are returned. This function takes into account settings from SetMinMaxIntersection. + // This is a slower function compared to ShadowRayIntersects and should only be used where + // needed. The third vertices barycentric coordinates will be 1 - pU - pV. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + // pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh + // faces before the faces from pMesh + // pU - Barycentric coordinate for vertex 0 + // pV - Barycentric coordinate for vertex 1 + // pDist - Distance along ray where the intersection occured + + STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, + DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE; +}; + + +// API functions for creating interfaces + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//============================================================================ +// +// D3DXCreatePRTBuffer: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-vertex or volume buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// NumSamples +// Number of sample locations represented +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBuffer( + UINT NumSamples, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXCreatePRTBufferTex: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-pixel buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBufferTex( + UINT Width, + UINT Height, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXLoadPRTBufferFromFile: +// -------------------- +// Loads a PRT buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileW +#else +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileA +#endif + + +//============================================================================ +// +// D3DXSavePRTBufferToFile: +// -------------------- +// Saves a PRTBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileW +#else +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileA +#endif + + +//============================================================================ +// +// D3DXLoadPRTCompBufferFromFile: +// -------------------- +// Loads a PRTComp buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileW +#else +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA +#endif + +//============================================================================ +// +// D3DXSavePRTCompBufferToFile: +// -------------------- +// Saves a PRTCompBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileW +#else +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA +#endif + +//============================================================================ +// +// D3DXCreatePRTCompBuffer: +// -------------------- +// Compresses a PRT buffer (vertex or texel) +// +// Parameters: +// D3DXSHCOMPRESSQUALITYTYPE +// Quality of compression - low is faster (computes PCA per voronoi cluster) +// high is slower but better quality (clusters based on distance to affine subspace) +// NumClusters +// Number of clusters to compute +// NumPCA +// Number of basis vectors to compute +// pCB +// Optional Callback function +// lpUserContext +// Optional user context +// pBufferIn +// Buffer that will be compressed +// ppBufferOut +// Compressed buffer that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTCompBuffer( + D3DXSHCOMPRESSQUALITYTYPE Quality, + UINT NumClusters, + UINT NumPCA, + LPD3DXSHPRTSIMCB pCB, + LPVOID lpUserContext, + LPD3DXPRTBUFFER pBufferIn, + LPD3DXPRTCOMPBUFFER *ppBufferOut + ); + +//============================================================================ +// +// D3DXCreateTextureGutterHelper: +// -------------------- +// Generates a "GutterHelper" for a given set of meshes and texture +// resolution +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// pMesh +// Mesh that represents the scene +// GutterSize +// Number of texels to over rasterize in texture space +// this should be at least 1.0 +// ppBuffer +// GutterHelper that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreateTextureGutterHelper( + UINT Width, + UINT Height, + LPD3DXMESH pMesh, + FLOAT GutterSize, + LPD3DXTEXTUREGUTTERHELPER* ppBuffer); + + +//============================================================================ +// +// D3DXCreatePRTEngine: +// -------------------- +// Computes a PRTEngine which can efficiently generate PRT simulations +// of a scene +// +// Parameters: +// pMesh +// Mesh that represents the scene - must have an AttributeTable +// where vertices are in a unique attribute. +// pAdjacency +// Optional adjacency information +// ExtractUVs +// Set this to true if textures are going to be used for albedos +// or to store PRT vectors +// pBlockerMesh +// Optional mesh that just blocks the scene +// ppEngine +// PRTEngine that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTEngine( + LPD3DXMESH pMesh, + DWORD *pAdjacency, + BOOL ExtractUVs, + LPD3DXMESH pBlockerMesh, + LPD3DXPRTENGINE* ppEngine); + +//============================================================================ +// +// D3DXConcatenateMeshes: +// -------------------- +// Concatenates a group of meshes into one common mesh. This can optionaly transform +// each sub mesh or its texture coordinates. If no DECL is given it will +// generate a union of all of the DECL's of the sub meshes, promoting channels +// and types if neccesary. It will create an AttributeTable if possible, one can +// call OptimizeMesh with attribute sort and compacting enabled to ensure this. +// +// Parameters: +// ppMeshes +// Array of pointers to meshes that can store PRT vectors +// NumMeshes +// Number of meshes +// Options +// Passed through to D3DXCreateMesh +// pGeomXForms +// [optional] Each sub mesh is transformed by the corresponding +// matrix if this array is supplied +// pTextureXForms +// [optional] UV coordinates for each sub mesh are transformed +// by corresponding matrix if supplied +// pDecl +// [optional] Only information in this DECL is used when merging +// data +// pD3DDevice +// D3D device that is used to create the new mesh +// ppMeshOut +// Mesh that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXConcatenateMeshes( + LPD3DXMESH *ppMeshes, + UINT NumMeshes, + DWORD Options, + CONST D3DXMATRIX *pGeomXForms, + CONST D3DXMATRIX *pTextureXForms, + CONST D3DVERTEXELEMENT9 *pDecl, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH *ppMeshOut); + +//============================================================================ +// +// D3DXSHPRTCompSuperCluster: +// -------------------------- +// Used with compressed results of D3DXSHPRTSimulation. +// Generates "super clusters" - groups of clusters that can be drawn in +// the same draw call. A greedy algorithm that minimizes overdraw is used +// to group the clusters. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// pScene +// Mesh that represents composite scene passed to the simulator +// MaxNumClusters +// Maximum number of clusters allocated per super cluster +// NumClusters +// Number of clusters computed in the simulator +// pSuperClusterIDs +// Array of length NumClusters, contains index of super cluster +// that corresponding cluster was assigned to +// pNumSuperClusters +// Returns the number of super clusters allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSuperCluster( + UINT *pClusterIDs, + LPD3DXMESH pScene, + UINT MaxNumClusters, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT *pNumSuperClusters); + +//============================================================================ +// +// D3DXSHPRTCompSplitMeshSC: +// ------------------------- +// Used with compressed results of the vertex version of the PRT simulator. +// After D3DXSHRTCompSuperCluster has been called this function can be used +// to split the mesh into a group of faces/vertices per super cluster. +// Each super cluster contains all of the faces that contain any vertex +// classified in one of its clusters. All of the vertices connected to this +// set of faces are also included with the returned array ppVertStatus +// indicating whether or not the vertex belongs to the supercluster. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// NumVertices +// Number of vertices in original mesh +// NumClusters +// Number of clusters (input parameter to compression) +// pSuperClusterIDs +// Array of size NumClusters that will contain super cluster ID's (from +// D3DXSHCompSuerCluster) +// NumSuperClusters +// Number of superclusters allocated in D3DXSHCompSuerCluster +// pInputIB +// Raw index buffer for mesh - format depends on bInputIBIs32Bit +// InputIBIs32Bit +// Indicates whether the input index buffer is 32-bit (otherwise 16-bit +// is assumed) +// NumFaces +// Number of faces in the original mesh (pInputIB is 3 times this length) +// ppIBData +// LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. +// Format determined by bIBIs32Bit. Allocated by function +// pIBDataLength +// Length of ppIBData, assigned in function +// OutputIBIs32Bit +// Indicates whether the output index buffer is to be 32-bit (otherwise +// 16-bit is assumed) +// ppFaceRemap +// LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is +// *pIBDataLength/3. Optional paramter, allocated in function +// ppVertData +// LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength +// pVertDataLength +// Number of new vertices in split mesh. Assigned in function +// pSCClusterList +// Array of length NumClusters which pSCData indexes into (Cluster* fields) +// for each SC, contains clusters sorted by super cluster +// pSCData +// Structure per super cluster - contains indices into ppIBData, +// pSCClusterList and ppVertData +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSplitMeshSC( + UINT *pClusterIDs, + UINT NumVertices, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT NumSuperClusters, + LPVOID pInputIB, + BOOL InputIBIs32Bit, + UINT NumFaces, + LPD3DXBUFFER *ppIBData, + UINT *pIBDataLength, + BOOL OutputIBIs32Bit, + LPD3DXBUFFER *ppFaceRemap, + LPD3DXBUFFER *ppVertData, + UINT *pVertDataLength, + UINT *pSCClusterList, + D3DXSHPRTSPLITMESHCLUSTERDATA *pSCData); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +////////////////////////////////////////////////////////////////////////////// +// +// Definitions of .X file templates used by mesh load/save functions +// that are not RM standard +// +////////////////////////////////////////////////////////////////////////////// + +// {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} +DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader, +0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2); + +// {B8D65549-D7C9-4995-89CF-53A9A8B031E3} +DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, +0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3); + +// {A64C844A-E282-4756-8B80-250CDE04398C} +DEFINE_GUID(DXFILEOBJ_FaceAdjacency, +0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c); + +// {6F0D123B-BAD2-4167-A0D0-80224F25FABB} +DEFINE_GUID(DXFILEOBJ_SkinWeights, +0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb); + +// {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} +DEFINE_GUID(DXFILEOBJ_Patch, +0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6); + +// {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} +DEFINE_GUID(DXFILEOBJ_PatchMesh, +0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf); + +// {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} +DEFINE_GUID(DXFILEOBJ_PatchMesh9, +0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea); + +// {B6C3E656-EC8B-4b92-9B62-681659522947} +DEFINE_GUID(DXFILEOBJ_PMInfo, +0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47); + +// {917E0427-C61E-4a14-9C64-AFE65F9E9844} +DEFINE_GUID(DXFILEOBJ_PMAttributeRange, +0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44); + +// {574CCC14-F0B3-4333-822D-93E8A8A08E4C} +DEFINE_GUID(DXFILEOBJ_PMVSplitRecord, +0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c); + +// {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} +DEFINE_GUID(DXFILEOBJ_FVFData, +0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97); + +// {F752461C-1E23-48f6-B9F8-8350850F336F} +DEFINE_GUID(DXFILEOBJ_VertexElement, +0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f); + +// {BF22E553-292C-4781-9FEA-62BD554BDD93} +DEFINE_GUID(DXFILEOBJ_DeclData, +0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93); + +// {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} +DEFINE_GUID(DXFILEOBJ_EffectFloats, +0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d); + +// {D55B097E-BDB6-4c52-B03D-6051C89D0E42} +DEFINE_GUID(DXFILEOBJ_EffectString, +0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42); + +// {622C0ED0-956E-4da9-908A-2AF94F3CE716} +DEFINE_GUID(DXFILEOBJ_EffectDWord, +0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16); + +// {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} +DEFINE_GUID(DXFILEOBJ_EffectParamFloats, +0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b); + +// {1DBC4C88-94C1-46ee-9076-2C28818C9481} +DEFINE_GUID(DXFILEOBJ_EffectParamString, +0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81); + +// {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} +DEFINE_GUID(DXFILEOBJ_EffectParamDWord, +0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5); + +// {E331F7E4-0559-4cc2-8E99-1CEC1657928F} +DEFINE_GUID(DXFILEOBJ_EffectInstance, +0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f); + +// {9E415A43-7BA6-4a73-8743-B73D47E88476} +DEFINE_GUID(DXFILEOBJ_AnimTicksPerSecond, +0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76); + +// {7F9B00B3-F125-4890-876E-1CFFBF697C4D} +DEFINE_GUID(DXFILEOBJ_CompressedAnimationSet, +0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d); + +#pragma pack(push, 1) +typedef struct _XFILECOMPRESSEDANIMATIONSET +{ + DWORD CompressedBlockSize; + FLOAT TicksPerSec; + DWORD PlaybackType; + DWORD BufferLength; +} XFILECOMPRESSEDANIMATIONSET; +#pragma pack(pop) + +#define XSKINEXP_TEMPLATES \ + "xof 0303txt 0032\ + template XSkinMeshHeader \ + { \ + <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ + WORD nMaxSkinWeightsPerVertex; \ + WORD nMaxSkinWeightsPerFace; \ + WORD nBones; \ + } \ + template VertexDuplicationIndices \ + { \ + \ + DWORD nIndices; \ + DWORD nOriginalVertices; \ + array DWORD indices[nIndices]; \ + } \ + template FaceAdjacency \ + { \ + \ + DWORD nIndices; \ + array DWORD indices[nIndices]; \ + } \ + template SkinWeights \ + { \ + <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ + STRING transformNodeName; \ + DWORD nWeights; \ + array DWORD vertexIndices[nWeights]; \ + array float weights[nWeights]; \ + Matrix4x4 matrixOffset; \ + } \ + template Patch \ + { \ + \ + DWORD nControlIndices; \ + array DWORD controlIndices[nControlIndices]; \ + } \ + template PatchMesh \ + { \ + \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } \ + template PatchMesh9 \ + { \ + \ + DWORD Type; \ + DWORD Degree; \ + DWORD Basis; \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } " \ + "template EffectFloats \ + { \ + \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } \ + template EffectString \ + { \ + \ + STRING Value; \ + } \ + template EffectDWord \ + { \ + <622C0ED0-956E-4da9-908A-2AF94F3CE716> \ + DWORD Value; \ + } " \ + "template EffectParamFloats \ + { \ + <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \ + STRING ParamName; \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } " \ + "template EffectParamString \ + { \ + <1DBC4C88-94C1-46ee-9076-2C28818C9481> \ + STRING ParamName; \ + STRING Value; \ + } \ + template EffectParamDWord \ + { \ + \ + STRING ParamName; \ + DWORD Value; \ + } \ + template EffectInstance \ + { \ + \ + STRING EffectFilename; \ + [ ... ] \ + } " \ + "template AnimTicksPerSecond \ + { \ + <9E415A43-7BA6-4a73-8743-B73D47E88476> \ + DWORD AnimTicksPerSecond; \ + } \ + template CompressedAnimationSet \ + { \ + <7F9B00B3-F125-4890-876E-1C42BF697C4D> \ + DWORD CompressedBlockSize; \ + FLOAT TicksPerSec; \ + DWORD PlaybackType; \ + DWORD BufferLength; \ + array DWORD CompressedData[BufferLength]; \ + } " + +#define XEXTENSIONS_TEMPLATES \ + "xof 0303txt 0032\ + template FVFData \ + { \ + \ + DWORD dwFVF; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template VertexElement \ + { \ + \ + DWORD Type; \ + DWORD Method; \ + DWORD Usage; \ + DWORD UsageIndex; \ + } \ + template DeclData \ + { \ + \ + DWORD nElements; \ + array VertexElement Elements[nElements]; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template PMAttributeRange \ + { \ + <917E0427-C61E-4a14-9C64-AFE65F9E9844> \ + DWORD iFaceOffset; \ + DWORD nFacesMin; \ + DWORD nFacesMax; \ + DWORD iVertexOffset; \ + DWORD nVerticesMin; \ + DWORD nVerticesMax; \ + } \ + template PMVSplitRecord \ + { \ + <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \ + DWORD iFaceCLW; \ + DWORD iVlrOffset; \ + DWORD iCode; \ + } \ + template PMInfo \ + { \ + \ + DWORD nAttributes; \ + array PMAttributeRange attributeRanges[nAttributes]; \ + DWORD nMaxValence; \ + DWORD nMinLogicalVertices; \ + DWORD nMaxLogicalVertices; \ + DWORD nVSplits; \ + array PMVSplitRecord splitRecords[nVSplits]; \ + DWORD nAttributeMispredicts; \ + array DWORD attributeMispredicts[nAttributeMispredicts]; \ + } " + +#endif //__D3DX9MESH_H__ + + diff --git a/SDK/dxSDK/Include/d3dx9shader.h b/SDK/dxSDK/Include/d3dx9shader.h new file mode 100644 index 00000000..1e2cda28 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9shader.h @@ -0,0 +1,1177 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9shader.h +// Content: D3DX Shader APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHADER_H__ +#define __D3DX9SHADER_H__ + + +//--------------------------------------------------------------------------- +// D3DXTX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3DXFill[]TX functions +//--------------------------------------------------------------------------- +#define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) + + + +//---------------------------------------------------------------------------- +// D3DXSHADER flags: +// ----------------- +// D3DXSHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3DXSHADER_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3DXSHADER_SKIPOPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3DXSHADER_PACKMATRIX_ROWMAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3DXSHADER_PACKMATRIX_COLUMNMAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3DXSHADER_PARTIALPRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3DXSHADER_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3DXSHADER_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +//---------------------------------------------------------------------------- + +#define D3DXSHADER_DEBUG (1 << 0) +#define D3DXSHADER_SKIPVALIDATION (1 << 1) +#define D3DXSHADER_SKIPOPTIMIZATION (1 << 2) +#define D3DXSHADER_PACKMATRIX_ROWMAJOR (1 << 3) +#define D3DXSHADER_PACKMATRIX_COLUMNMAJOR (1 << 4) +#define D3DXSHADER_PARTIALPRECISION (1 << 5) +#define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT (1 << 6) +#define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT (1 << 7) +#define D3DXSHADER_NO_PRESHADER (1 << 8) +#define D3DXSHADER_AVOID_FLOW_CONTROL (1 << 9) +#define D3DXSHADER_PREFER_FLOW_CONTROL (1 << 10) +#define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) +#define D3DXSHADER_IEEE_STRICTNESS (1 << 13) +#define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL (1 << 16) + + +// optimization level flags +#define D3DXSHADER_OPTIMIZATION_LEVEL0 (1 << 14) +#define D3DXSHADER_OPTIMIZATION_LEVEL1 0 +#define D3DXSHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) +#define D3DXSHADER_OPTIMIZATION_LEVEL3 (1 << 15) + + + + +//---------------------------------------------------------------------------- +// D3DXHANDLE: +// ----------- +// Handle values used to efficiently reference shader and effect parameters. +// Strings can be used as handles. However, handles are not always strings. +//---------------------------------------------------------------------------- + +#ifndef D3DXFX_LARGEADDRESS_HANDLE +typedef LPCSTR D3DXHANDLE; +#else +typedef UINT_PTR D3DXHANDLE; +#endif +typedef D3DXHANDLE *LPD3DXHANDLE; + + +//---------------------------------------------------------------------------- +// D3DXMACRO: +// ---------- +// Preprocessor macro definition. The application pass in a NULL-terminated +// array of this structure to various D3DX APIs. This enables the application +// to #define tokens at runtime, before the file is parsed. +//---------------------------------------------------------------------------- + +typedef struct _D3DXMACRO +{ + LPCSTR Name; + LPCSTR Definition; + +} D3DXMACRO, *LPD3DXMACRO; + + +//---------------------------------------------------------------------------- +// D3DXSEMANTIC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXSEMANTIC +{ + UINT Usage; + UINT UsageIndex; + +} D3DXSEMANTIC, *LPD3DXSEMANTIC; + + + +//---------------------------------------------------------------------------- +// D3DXFRAGMENT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXFRAGMENT_DESC +{ + LPCSTR Name; + DWORD Target; + +} D3DXFRAGMENT_DESC, *LPD3DXFRAGMENT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXREGISTER_SET: +//---------------------------------------------------------------------------- + +typedef enum _D3DXREGISTER_SET +{ + D3DXRS_BOOL, + D3DXRS_INT4, + D3DXRS_FLOAT4, + D3DXRS_SAMPLER, + + // force 32-bit size enum + D3DXRS_FORCE_DWORD = 0x7fffffff + +} D3DXREGISTER_SET, *LPD3DXREGISTER_SET; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_CLASS: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_CLASS +{ + D3DXPC_SCALAR, + D3DXPC_VECTOR, + D3DXPC_MATRIX_ROWS, + D3DXPC_MATRIX_COLUMNS, + D3DXPC_OBJECT, + D3DXPC_STRUCT, + + // force 32-bit size enum + D3DXPC_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_TYPE +{ + D3DXPT_VOID, + D3DXPT_BOOL, + D3DXPT_INT, + D3DXPT_FLOAT, + D3DXPT_STRING, + D3DXPT_TEXTURE, + D3DXPT_TEXTURE1D, + D3DXPT_TEXTURE2D, + D3DXPT_TEXTURE3D, + D3DXPT_TEXTURECUBE, + D3DXPT_SAMPLER, + D3DXPT_SAMPLER1D, + D3DXPT_SAMPLER2D, + D3DXPT_SAMPLER3D, + D3DXPT_SAMPLERCUBE, + D3DXPT_PIXELSHADER, + D3DXPT_VERTEXSHADER, + D3DXPT_PIXELFRAGMENT, + D3DXPT_VERTEXFRAGMENT, + D3DXPT_UNSUPPORTED, + + // force 32-bit size enum + D3DXPT_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANTTABLE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANTTABLE_DESC +{ + LPCSTR Creator; // Creator string + DWORD Version; // Shader version + UINT Constants; // Number of constants + +} D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANT_DESC +{ + LPCSTR Name; // Constant name + + D3DXREGISTER_SET RegisterSet; // Register set + UINT RegisterIndex; // Register index + UINT RegisterCount; // Number of registers occupied + + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT StructMembers; // Number of structure member sub-parameters + + UINT Bytes; // Data size, in bytes + LPCVOID DefaultValue; // Pointer to default value + +} D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; + + + +//---------------------------------------------------------------------------- +// ID3DXConstantTable: +//---------------------------------------------------------------------------- + +typedef interface ID3DXConstantTable ID3DXConstantTable; +typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE; + +// {AB3C758F-093E-4356-B762-4DB18F1B3A01} +DEFINE_GUID(IID_ID3DXConstantTable, +0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1); + + +#undef INTERFACE +#define INTERFACE ID3DXConstantTable + +DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Buffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE; + STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXTextureShader: +//---------------------------------------------------------------------------- + +typedef interface ID3DXTextureShader ID3DXTextureShader; +typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; + +// {3E3D67F8-AA7A-405d-A857-BA01D4758426} +DEFINE_GUID(IID_ID3DXTextureShader, +0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); + +#undef INTERFACE +#define INTERFACE ID3DXTextureShader + +DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Gets + STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + + +//---------------------------------------------------------------------------- +// ID3DXFragmentLinker +//---------------------------------------------------------------------------- + +typedef interface ID3DXFragmentLinker ID3DXFragmentLinker; +typedef interface ID3DXFragmentLinker *LPD3DXFRAGMENTLINKER; + +// {1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6} +DEFINE_GUID(IID_ID3DXFragmentLinker, +0x1a2c0cc2, 0xe5b6, 0x4ebc, 0x9e, 0x8d, 0x39, 0xe, 0x5, 0x78, 0x11, 0xb6); + +#undef INTERFACE +#define INTERFACE ID3DXFragmentLinker + +DECLARE_INTERFACE_(ID3DXFragmentLinker, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXFragmentLinker + + // fragment access and information retrieval functions + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD_(UINT, GetNumberOfFragments)(THIS) PURE; + + STDMETHOD_(D3DXHANDLE, GetFragmentHandleByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFragmentHandleByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD(GetFragmentDesc)(THIS_ D3DXHANDLE Name, LPD3DXFRAGMENT_DESC FragDesc) PURE; + + // add the fragments in the buffer to the linker + STDMETHOD(AddFragments)(THIS_ CONST DWORD *Fragments) PURE; + + // Create a buffer containing the fragments. Suitable for saving to disk + STDMETHOD(GetAllFragments)(THIS_ LPD3DXBUFFER *ppBuffer) PURE; + STDMETHOD(GetFragment)(THIS_ D3DXHANDLE Name, LPD3DXBUFFER *ppBuffer) PURE; + + STDMETHOD(LinkShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPD3DXBUFFER *ppBuffer, LPD3DXBUFFER *ppErrorMsgs) PURE; + STDMETHOD(LinkVertexShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DVERTEXSHADER9 *pVShader, LPD3DXBUFFER *ppErrorMsgs) PURE; + STDMETHOD(LinkPixelShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DPIXELSHADER9 *pPShader, LPD3DXBUFFER *ppErrorMsgs) PURE; + + STDMETHOD(ClearCache)(THIS) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXINCLUDE_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXINCLUDE_TYPE +{ + D3DXINC_LOCAL, + D3DXINC_SYSTEM, + + // force 32-bit size enum + D3DXINC_FORCE_DWORD = 0x7fffffff + +} D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE; + + +//---------------------------------------------------------------------------- +// ID3DXInclude: +// ------------- +// This interface is intended to be implemented by the application, and can +// be used by various D3DX APIs. This enables application-specific handling +// of #include directives in source files. +// +// Open() +// Opens an include file. If successful, it should fill in ppData and +// pBytes. The data pointer returned must remain valid until Close is +// subsequently called. +// Close() +// Closes an include file. If Open was successful, Close is guaranteed +// to be called before the API using this interface returns. +//---------------------------------------------------------------------------- + +typedef interface ID3DXInclude ID3DXInclude; +typedef interface ID3DXInclude *LPD3DXINCLUDE; + +#undef INTERFACE +#define INTERFACE ID3DXInclude + +DECLARE_INTERFACE(ID3DXInclude) +{ + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; + STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles a shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXAssembleShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW +#else +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXAssembleShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW +#else +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXAssembleShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + + + +//---------------------------------------------------------------------------- +// D3DXCompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1", +// "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0" +// Flags +// See D3DXSHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3DXGetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCompileShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW +#else +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXCompileShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW +#else +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXCompileShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + + +//---------------------------------------------------------------------------- +// D3DXDisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// ShaderSizeInBytes +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleShader( + CONST DWORD* pShader, + BOOL EnableColorCode, + LPCSTR pComments, + LPD3DXBUFFER* ppDisassembly); + + +//---------------------------------------------------------------------------- +// D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile: +// ----------------------------------------------------- +// Returns the name of the HLSL profile best suited to a given device. +// +// Parameters: +// pDevice +// Pointer to the device in question +//---------------------------------------------------------------------------- + +LPCSTR WINAPI + D3DXGetPixelShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + +LPCSTR WINAPI + D3DXGetVertexShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + + +//---------------------------------------------------------------------------- +// D3DXFindShaderComment: +// ---------------------- +// Searches through a shader for a particular comment, denoted by a FourCC in +// the first DWORD of the comment. If the comment is not found, and no other +// error has occurred, S_FALSE is returned. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// FourCC +// FourCC used to identify the desired comment block. +// ppData +// Returns a pointer to the comment data (not including comment token +// and FourCC). Can be NULL. +// pSizeInBytes +// Returns the size of the comment data in bytes. Can be NULL. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFindShaderComment( + CONST DWORD* pFunction, + DWORD FourCC, + LPCVOID* ppData, + UINT* pSizeInBytes); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSize: +// ------------------ +// Returns the size of the shader byte-code, in bytes. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +UINT WINAPI + D3DXGetShaderSize( + CONST DWORD* pFunction); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderVersion: +// ----------------------- +// Returns the shader version of a given shader. Returns zero if the shader +// function is NULL. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +DWORD WINAPI + D3DXGetShaderVersion( + CONST DWORD* pFunction); + +//---------------------------------------------------------------------------- +// D3DXGetShaderSemantics: +// ----------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// pSemantics +// Pointer to an array of D3DXSEMANTIC structures. The function will +// fill this array with the semantics for each input element referenced +// inside the shader. This array is assumed to contain at least +// MAXD3DDECLLENGTH elements. +// pCount +// Returns the number of elements referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderInputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + +HRESULT WINAPI + D3DXGetShaderOutputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSamplers: +// ---------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// pFunction +// Pointer to the function DWORD stream +// pSamplers +// Pointer to an array of LPCSTRs. The function will fill this array +// with pointers to the sampler names contained within pFunction, for +// each sampler referenced inside the shader. This array is assumed to +// contain at least 16 elements. +// pCount +// Returns the number of samplers referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderSamplers( + CONST DWORD* pFunction, + LPCSTR* pSamplers, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderConstantTable: +// --------------------------- +// Gets shader constant table embedded inside shader. A constant table is +// generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in +// the body of the shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderConstantTable( + CONST DWORD* pFunction, + LPD3DXCONSTANTTABLE* ppConstantTable); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureShader: +// ------------------------ +// Creates a texture shader object, given the compiled shader. +// +// Parameters +// pFunction +// Pointer to the function DWORD stream +// ppTextureShader +// Returns a ID3DXTextureShader object which can be used to procedurally +// fill the contents of a texture using the D3DXFillTextureTX functions. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTextureShader( + CONST DWORD* pFunction, + LPD3DXTEXTURESHADER* ppTextureShader); + + + +//---------------------------------------------------------------------------- +// D3DXGatherFragments: +// ------------------- +// Assembles shader fragments into a buffer to be passed to a fragment linker. +// will generate shader fragments for all fragments in the file +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader fragments. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI +D3DXGatherFragmentsFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI +D3DXGatherFragmentsFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileW +#else +#define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileA +#endif + + +HRESULT WINAPI + D3DXGatherFragmentsFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXGatherFragmentsFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceW +#else +#define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceA +#endif + + +HRESULT WINAPI + D3DXGatherFragments( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + + + +//---------------------------------------------------------------------------- +// D3DXCreateFragmentLinker: +// ------------------------- +// Creates a fragment linker with a given cache size. The interface returned +// can be used to link together shader fragments. (both HLSL & ASM fragements) +// +// Parameters: +// pDevice +// Pointer to the device on which to create the shaders +// ShaderCacheSize +// Size of the shader cache +// ppFragmentLinker +// pointer to a memory location to put the created interface pointer +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateFragmentLinker( + LPDIRECT3DDEVICE9 pDevice, + UINT ShaderCacheSize, + LPD3DXFRAGMENTLINKER* ppFragmentLinker); + + +//---------------------------------------------------------------------------- +// D3DXPreprocessShader: +// --------------------- +// Runs the preprocessor on the specified shader or effect, but does +// not actually compile it. This is useful for evaluating the #includes +// and #defines in a shader and then emitting a reformatted token stream +// for debugging purposes or for generating a self-contained shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// ppShaderText +// Returns a buffer containing a single large string that represents +// the resulting formatted token stream +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXPreprocessShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXPreprocessShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileW +#else +#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileA +#endif + +HRESULT WINAPI + D3DXPreprocessShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXPreprocessShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceW +#else +#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceA +#endif + +HRESULT WINAPI + D3DXPreprocessShader( + LPCSTR pSrcData, + UINT SrcDataSize, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// Shader comment block layouts ////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXSHADER_CONSTANTTABLE: +// ------------------------- +// Shader constant information; included as an CTAB comment block inside +// shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct. +// Entries in the table are sorted by Name in ascending order. +//---------------------------------------------------------------------------- + +typedef struct _D3DXSHADER_CONSTANTTABLE +{ + DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE) + DWORD Creator; // LPCSTR offset + DWORD Version; // shader version + DWORD Constants; // number of constants + DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset + DWORD Flags; // flags shader was compiled with + DWORD Target; // LPCSTR offset + +} D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE; + + +typedef struct _D3DXSHADER_CONSTANTINFO +{ + DWORD Name; // LPCSTR offset + WORD RegisterSet; // D3DXREGISTER_SET + WORD RegisterIndex; // register number + WORD RegisterCount; // number of registers + WORD Reserved; // reserved + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + DWORD DefaultValue; // offset of default value + +} D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO; + + +typedef struct _D3DXSHADER_TYPEINFO +{ + WORD Class; // D3DXPARAMETER_CLASS + WORD Type; // D3DXPARAMETER_TYPE + WORD Rows; // number of rows (matrices) + WORD Columns; // number of columns (vectors and matrices) + WORD Elements; // array dimension + WORD StructMembers; // number of struct members + DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset + +} D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO; + + +typedef struct _D3DXSHADER_STRUCTMEMBERINFO +{ + DWORD Name; // LPCSTR offset + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + +} D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO; + + + +#endif //__D3DX9SHADER_H__ + diff --git a/SDK/dxSDK/Include/d3dx9shape.h b/SDK/dxSDK/Include/d3dx9shape.h new file mode 100644 index 00000000..4c230915 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9shape.h @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHAPES_H__ +#define __D3DX9SHAPES_H__ + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreatePolygon( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Length, + UINT Sides, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateBox( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Width, + FLOAT Height, + FLOAT Depth, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateCylinder( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius1, + FLOAT Radius2, + FLOAT Length, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateSphere( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTorus( + LPDIRECT3DDEVICE9 pDevice, + FLOAT InnerRadius, + FLOAT OuterRadius, + UINT Sides, + UINT Rings, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTeapot( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTextA( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +HRESULT WINAPI + D3DXCreateTextW( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCWSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +#ifdef UNICODE +#define D3DXCreateText D3DXCreateTextW +#else +#define D3DXCreateText D3DXCreateTextA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9SHAPES_H__ + diff --git a/SDK/dxSDK/Include/d3dx9tex.h b/SDK/dxSDK/Include/d3dx9tex.h new file mode 100644 index 00000000..c4b65103 --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9tex.h @@ -0,0 +1,1735 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9TEX_H__ +#define __D3DX9TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB +// Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +#define D3DX_FILTER_NONE (1 << 0) +#define D3DX_FILTER_POINT (2 << 0) +#define D3DX_FILTER_LINEAR (3 << 0) +#define D3DX_FILTER_TRIANGLE (4 << 0) +#define D3DX_FILTER_BOX (5 << 0) + +#define D3DX_FILTER_MIRROR_U (1 << 16) +#define D3DX_FILTER_MIRROR_V (2 << 16) +#define D3DX_FILTER_MIRROR_W (4 << 16) +#define D3DX_FILTER_MIRROR (7 << 16) + +#define D3DX_FILTER_DITHER (1 << 19) +#define D3DX_FILTER_DITHER_DIFFUSION (2 << 19) + +#define D3DX_FILTER_SRGB_IN (1 << 21) +#define D3DX_FILTER_SRGB_OUT (2 << 21) +#define D3DX_FILTER_SRGB (3 << 21) + + +//----------------------------------------------------------------------------- +// D3DX_SKIP_DDS_MIP_LEVELS is used to skip mip levels when loading a DDS file: +//----------------------------------------------------------------------------- + +#define D3DX_SKIP_DDS_MIP_LEVELS_MASK 0x1F +#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT 26 +#define D3DX_SKIP_DDS_MIP_LEVELS(levels, filter) ((((levels) & D3DX_SKIP_DDS_MIP_LEVELS_MASK) << D3DX_SKIP_DDS_MIP_LEVELS_SHIFT) | ((filter) == D3DX_DEFAULT ? D3DX_FILTER_BOX : (filter))) + + + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +#define D3DX_NORMALMAP_MIRROR_U (1 << 16) +#define D3DX_NORMALMAP_MIRROR_V (2 << 16) +#define D3DX_NORMALMAP_MIRROR (3 << 16) +#define D3DX_NORMALMAP_INVERTSIGN (8 << 16) +#define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) + + + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +#define D3DX_CHANNEL_RED (1 << 0) +#define D3DX_CHANNEL_BLUE (1 << 1) +#define D3DX_CHANNEL_GREEN (1 << 2) +#define D3DX_CHANNEL_ALPHA (1 << 3) +#define D3DX_CHANNEL_LUMINANCE (1 << 4) + + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum _D3DXIMAGE_FILEFORMAT +{ + D3DXIFF_BMP = 0, + D3DXIFF_JPG = 1, + D3DXIFF_TGA = 2, + D3DXIFF_PNG = 3, + D3DXIFF_DDS = 4, + D3DXIFF_PPM = 5, + D3DXIFF_DIB = 6, + D3DXIFF_HDR = 7, //high dynamic range formats + D3DXIFF_PFM = 8, // + D3DXIFF_FORCE_DWORD = 0x7fffffff + +} D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData); + +typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData); + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +typedef struct _D3DXIMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + D3DFORMAT Format; + D3DRESOURCETYPE ResourceType; + D3DXIMAGE_FILEFORMAT ImageFileFormat; + +} D3DXIMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +; +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetImageInfoFromFileA( + LPCSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromFileW( + LPCWSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW +#else +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW +#else +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromFileInMemory( + LPCVOID pSrcData, + UINT SrcDataSize, + D3DXIMAGE_INFO* pSrcInfo); + + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromFileA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromFileW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCWSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW +#else +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + +#ifdef UNICODE +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW +#else +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromFileInMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromSurface( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// -------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcPitch, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +HRESULT WINAPI + D3DXSaveSurfaceToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +#ifdef UNICODE +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW +#else +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFileInMemory: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// ppDestBuf +// address of pointer to d3dxbuffer for returning data bits +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromFileA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromFileW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCWSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW +#else +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA +#endif + + +HRESULT WINAPI + D3DXLoadVolumeFromResourceA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromResourceW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW +#else +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadVolumeFromFileInMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// ------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromVolume( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// ------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcRowPitch, + UINT SrcSlicePitch, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +HRESULT WINAPI + D3DXSaveVolumeToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +#ifdef UNICODE +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW +#else +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFileInMemory: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCheckTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckCubeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pSize, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckVolumeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pDepth, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels. these must be non-zero +// MipLevels +// number of mip levels desired. if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// Width, Height, Depth, Size +// Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from +// the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2, +// and the device supports NONPOW2 textures, the size will not be rounded. +// If D3DX_FROM_FILE, the size will be taken exactly as it is in the file, +// and the call will fail if this violates device capabilities. +// MipLevels +// Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. If D3DX_FROM_FILE, the size will be taken +// exactly as it is in the file, and the call will fail if this violates +// device capabilities. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. If D3DFMT_FROM_FILE, the format will be taken +// exactly as it is in the file, and the call will fail if the device does +// not support the given format. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX. +// Use the D3DX_SKIP_DDS_MIP_LEVELS macro to specify both a filter and the +// number of mip levels to skip when loading DDS files. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +// FromFile + +HRESULT WINAPI + D3DXCreateTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW +#else +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW +#else +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW +#else +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA +#endif + + +// FromResource + +HRESULT WINAPI + D3DXCreateTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW +#else +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW +#else +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW +#else +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA +#endif + + +// FromFileEx + +HRESULT WINAPI + D3DXCreateTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW +#else +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW +#else +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW +#else +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA +#endif + + +// FromResourceEx + +HRESULT WINAPI + D3DXCreateTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW +#else +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW +#else +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW +#else +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + +// FromFileInMemoryEx + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXSaveTextureToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +HRESULT WINAPI + D3DXSaveTextureToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +#ifdef UNICODE +#define D3DXSaveTextureToFile D3DXSaveTextureToFileW +#else +#define D3DXSaveTextureToFile D3DXSaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFileInMemory: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveTextureToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFilterTexture( + LPDIRECT3DBASETEXTURE9 pBaseTexture, + CONST PALETTEENTRY* pPalette, + UINT SrcLevel, + DWORD Filter); + +#define D3DXFilterCubeTexture D3DXFilterTexture +#define D3DXFilterVolumeTexture D3DXFilterTexture + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTexture( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXFILL2D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillCubeTexture( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillVolumeTexture( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +//--------------------------------------------------------------------------- +// D3DXFillTextureTX: +// ------------------ +// Uses a TX Shader target to function to fill each texel of each mip level +// of a given texture. The TX Shader target should be a compiled function +// taking 2 paramters and returning a float4 color. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pTextureShader +// Pointer to the texture shader to be used to fill in the texture +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTextureTX( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillCubeTextureTX( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillVolumeTextureTX( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXComputeNormalMap( + LPDIRECT3DTEXTURE9 pTexture, + LPDIRECT3DTEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette, + DWORD Flags, + DWORD Channel, + FLOAT Amplitude); + + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9TEX_H__ + diff --git a/SDK/dxSDK/Include/d3dx9xof.h b/SDK/dxSDK/Include/d3dx9xof.h new file mode 100644 index 00000000..c513f0fc --- /dev/null +++ b/SDK/dxSDK/Include/d3dx9xof.h @@ -0,0 +1,299 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9xof.h +// Content: D3DX .X File types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#if !defined( __D3DX9XOF_H__ ) +#define __D3DX9XOF_H__ + +#if defined( __cplusplus ) +extern "C" { +#endif // defined( __cplusplus ) + +//---------------------------------------------------------------------------- +// D3DXF_FILEFORMAT +// This flag is used to specify what file type to use when saving to disk. +// _BINARY, and _TEXT are mutually exclusive, while +// _COMPRESSED is an optional setting that works with all file types. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILEFORMAT; + +#define D3DXF_FILEFORMAT_BINARY 0 +#define D3DXF_FILEFORMAT_TEXT 1 +#define D3DXF_FILEFORMAT_COMPRESSED 2 + +//---------------------------------------------------------------------------- +// D3DXF_FILESAVEOPTIONS +// This flag is used to specify where to save the file to. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _TOFILE is paired with a filename (LPCSTR) +// _TOWFILE is paired with a filename (LPWSTR) +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILESAVEOPTIONS; + +#define D3DXF_FILESAVE_TOFILE 0x00L +#define D3DXF_FILESAVE_TOWFILE 0x01L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADOPTIONS +// This flag is used to specify where to load the file from. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _FROMFILE is paired with a filename (LPCSTR) +// _FROMWFILE is paired with a filename (LPWSTR) +// _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description. +// _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILELOADOPTIONS; + +#define D3DXF_FILELOAD_FROMFILE 0x00L +#define D3DXF_FILELOAD_FROMWFILE 0x01L +#define D3DXF_FILELOAD_FROMRESOURCE 0x02L +#define D3DXF_FILELOAD_FROMMEMORY 0x03L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADRESOURCE: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADRESOURCE +{ + HMODULE hModule; // Desc + LPCSTR lpName; // Desc + LPCSTR lpType; // Desc +} D3DXF_FILELOADRESOURCE; + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADMEMORY: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADMEMORY +{ + LPCVOID lpMemory; // Desc + SIZE_T dSize; // Desc +} D3DXF_FILELOADMEMORY; + +#if defined( _WIN32 ) && !defined( _NO_COM ) + +// {cef08cf9-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFile, +0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfa-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveObject, +0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfb-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveData, +0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfc-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileEnumObject, +0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfd-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileData, +0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +#endif // defined( _WIN32 ) && !defined( _NO_COM ) + +#if defined( __cplusplus ) +#if !defined( DECLSPEC_UUID ) +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) +#else // !( _MSC_VER >= 1100 ) +#define DECLSPEC_UUID( x ) +#endif // !( _MSC_VER >= 1100 ) +#endif // !defined( DECLSPEC_UUID ) + +interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) + ID3DXFile; +interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveObject; +interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveData; +interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" ) + ID3DXFileEnumObject; +interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" ) + ID3DXFileData; + +#if defined( _COM_SMARTPTR_TYPEDEF ) +_COM_SMARTPTR_TYPEDEF( ID3DXFile, + __uuidof( ID3DXFile ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject, + __uuidof( ID3DXFileSaveObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData, + __uuidof( ID3DXFileSaveData ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, + __uuidof( ID3DXFileEnumObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileData, + __uuidof( ID3DXFileData ) ); +#endif // defined( _COM_SMARTPTR_TYPEDEF ) +#endif // defined( __cplusplus ) + +typedef interface ID3DXFile ID3DXFile; +typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; +typedef interface ID3DXFileSaveData ID3DXFileSaveData; +typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; +typedef interface ID3DXFileData ID3DXFileData; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFile ///////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFile + +DECLARE_INTERFACE_( ID3DXFile, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS, + ID3DXFileEnumObject** ) PURE; + STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS, + D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE; + STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE; + STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveObject + +DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( Save )( THIS ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveData ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveData + +DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileEnumObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileEnumObject + +DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileData ///////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileData + +DECLARE_INTERFACE_( ID3DXFileData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE; + STDMETHOD( Unlock )( THIS ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD_( BOOL, IsReference )( THIS ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; +}; + +STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile ); + +/* + * DirectX File errors. + */ + +#define _FACD3DXF 0x876 + +#define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 ) +#define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 ) +#define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 ) +#define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 ) +#define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 ) +#define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 ) +#define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 ) +#define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 ) +#define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 ) +#define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 ) +#define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 ) +#define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 ) +#define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 ) +#define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 ) +#define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 ) +#define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 ) +#define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 ) +#define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 ) + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(ID3DXFile, D3DXFILE); +WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT); +WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT); +WIN_TYPES(ID3DXFileData, D3DXFILEDATA); +WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA); + +#if defined( __cplusplus ) +} // extern "C" +#endif // defined( __cplusplus ) + +#endif // !defined( __D3DX9XOF_H__ ) + + diff --git a/SDK/dxSDK/Include/ddraw.h b/SDK/dxSDK/Include/ddraw.h new file mode 100644 index 00000000..4b72177f --- /dev/null +++ b/SDK/dxSDK/Include/ddraw.h @@ -0,0 +1,5856 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************/ + +#ifndef __DDRAW_INCLUDED__ +#define __DDRAW_INCLUDED__ + +//Disable the nameless union warning when building internally +#undef ENABLE_NAMELESS_UNION_PRAGMA +#ifdef DIRECTX_REDIST +#define ENABLE_NAMELESS_UNION_PRAGMA +#endif + +#ifdef ENABLE_NAMELESS_UNION_PRAGMA +#pragma warning(disable:4201) +#endif + +/* + * If you wish an application built against the newest version of DirectDraw + * to run against an older DirectDraw run time then define DIRECTDRAW_VERSION + * to be the earlies version of DirectDraw you wish to run against. For, + * example if you wish an application to run against a DX 3 runtime define + * DIRECTDRAW_VERSION to be 0x0300. + */ +#ifndef DIRECTDRAW_VERSION +#define DIRECTDRAW_VERSION 0x0700 +#endif /* DIRECTDRAW_VERSION */ + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#define COM_NO_WINDOWS_H +#include +#else +#define IUnknown void +#if !defined( NT_BUILD_ENVIRONMENT ) && !defined(WINNT) + #define CO_E_NOTINITIALIZED 0x800401F0L +#endif +#endif + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +// +// For compilers that don't support nameless unions, do a +// +// #define NONAMELESSUNION +// +// before #include +// +#ifndef DUMMYUNIONNAMEN +#if defined(__cplusplus) || !defined(NONAMELESSUNION) +#define DUMMYUNIONNAMEN(n) +#else +#define DUMMYUNIONNAMEN(n) u##n +#endif +#endif + +#ifndef MAKEFOURCC + #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) +#endif //defined(MAKEFOURCC) + +/* + * FOURCC codes for DX compressed-texture pixel formats + */ +#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1')) +#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2')) +#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3')) +#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4')) +#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5')) + +/* + * GUIDS used by DirectDraw objects + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) + +DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDraw7, 0x3c305196,0x50db,0x11d3,0x9c,0xfe,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); +DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); +DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); +DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); +DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); +DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); +DEFINE_GUID( IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); + +#endif + +/*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*/ + +struct IDirectDraw; +struct IDirectDrawSurface; +struct IDirectDrawPalette; +struct IDirectDrawClipper; + +typedef struct IDirectDraw FAR *LPDIRECTDRAW; +typedef struct IDirectDraw2 FAR *LPDIRECTDRAW2; +typedef struct IDirectDraw4 FAR *LPDIRECTDRAW4; +typedef struct IDirectDraw7 FAR *LPDIRECTDRAW7; +typedef struct IDirectDrawSurface FAR *LPDIRECTDRAWSURFACE; +typedef struct IDirectDrawSurface2 FAR *LPDIRECTDRAWSURFACE2; +typedef struct IDirectDrawSurface3 FAR *LPDIRECTDRAWSURFACE3; +typedef struct IDirectDrawSurface4 FAR *LPDIRECTDRAWSURFACE4; +typedef struct IDirectDrawSurface7 FAR *LPDIRECTDRAWSURFACE7; +typedef struct IDirectDrawPalette FAR *LPDIRECTDRAWPALETTE; +typedef struct IDirectDrawClipper FAR *LPDIRECTDRAWCLIPPER; +typedef struct IDirectDrawColorControl FAR *LPDIRECTDRAWCOLORCONTROL; +typedef struct IDirectDrawGammaControl FAR *LPDIRECTDRAWGAMMACONTROL; + +typedef struct _DDFXROP FAR *LPDDFXROP; +typedef struct _DDSURFACEDESC FAR *LPDDSURFACEDESC; +typedef struct _DDSURFACEDESC2 FAR *LPDDSURFACEDESC2; +typedef struct _DDCOLORCONTROL FAR *LPDDCOLORCONTROL; + +/* + * API's + */ +#if (defined (WIN32) || defined( _WIN32 ) ) && !defined( _NO_COM ) +//#if defined( _WIN32 ) && !defined( _NO_ENUM ) + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID); + extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); + extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); + /* + * Protect against old SDKs + */ + #if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); + #endif + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKEXA)(GUID FAR *, LPSTR, LPSTR, LPVOID, HMONITOR); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKEXW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID, HMONITOR); + extern HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); + extern HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); + typedef HRESULT (WINAPI * LPDIRECTDRAWENUMERATEEXA)( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); + typedef HRESULT (WINAPI * LPDIRECTDRAWENUMERATEEXW)( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); + + #ifdef UNICODE + typedef LPDDENUMCALLBACKW LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateW + typedef LPDDENUMCALLBACKEXW LPDDENUMCALLBACKEX; + typedef LPDIRECTDRAWENUMERATEEXW LPDIRECTDRAWENUMERATEEX; + #define DirectDrawEnumerateEx DirectDrawEnumerateExW + #else + typedef LPDDENUMCALLBACKA LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateA + typedef LPDDENUMCALLBACKEXA LPDDENUMCALLBACKEX; + typedef LPDIRECTDRAWENUMERATEEXA LPDIRECTDRAWENUMERATEEX; + #define DirectDrawEnumerateEx DirectDrawEnumerateExA + #endif + extern HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateEx( GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); +#endif +/* + * Flags for DirectDrawEnumerateEx + * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to + * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx. + * By default, only the primary display device is enumerated. + * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES) + */ + +/* + * This flag causes enumeration of any GDI display devices which are part of + * the Windows Desktop + */ +#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L + +/* + * This flag causes enumeration of any GDI display devices which are not + * part of the Windows Desktop + */ +#define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002L + +/* + * This flag causes enumeration of non-display devices + */ +#define DDENUM_NONDISPLAYDEVICES 0x00000004L + + +#define REGSTR_KEY_DDHW_DESCRIPTION "Description" +#define REGSTR_KEY_DDHW_DRIVERNAME "DriverName" +#define REGSTR_PATH_DDHW "Hardware\\DirectDrawDrivers" + +#define DDCREATE_HARDWAREONLY 0x00000001l +#define DDCREATE_EMULATIONONLY 0x00000002l + +#if defined(WINNT) || !defined(WIN32) +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef __success(return >= 0) long HRESULT; +#endif // !_HRESULT_DEFINED +#endif + +//#ifndef WINNT +typedef HRESULT (FAR PASCAL * LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMMODESCALLBACK2)(LPDDSURFACEDESC2, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK2)(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); +//#endif + +/* + * Generic pixel format with 8-bit RGB and alpha components + */ +typedef struct _DDARGB +{ + BYTE blue; + BYTE green; + BYTE red; + BYTE alpha; +} DDARGB; + +typedef DDARGB FAR *LPDDARGB; + +/* + * This version of the structure remains for backwards source compatibility. + * The DDARGB structure is the one that should be used for all DirectDraw APIs. + */ +typedef struct _DDRGBA +{ + BYTE red; + BYTE green; + BYTE blue; + BYTE alpha; +} DDRGBA; + +typedef DDRGBA FAR *LPDDRGBA; + + +/* + * DDCOLORKEY + */ +typedef struct _DDCOLORKEY +{ + DWORD dwColorSpaceLowValue; // low boundary of color space that is to + // be treated as Color Key, inclusive + DWORD dwColorSpaceHighValue; // high boundary of color space that is + // to be treated as Color Key, inclusive +} DDCOLORKEY; + +typedef DDCOLORKEY FAR* LPDDCOLORKEY; + +/* + * DDBLTFX + * Used to pass override information to the DIRECTDRAWSURFACE callback Blt. + */ +typedef struct _DDBLTFX +{ + DWORD dwSize; // size of structure + DWORD dwDDFX; // FX operations + DWORD dwROP; // Win32 raster operations + DWORD dwDDROP; // Raster operations new for DirectDraw + DWORD dwRotationAngle; // Rotation angle for blt + DWORD dwZBufferOpCode; // ZBuffer compares + DWORD dwZBufferLow; // Low limit of Z buffer + DWORD dwZBufferHigh; // High limit of Z buffer + DWORD dwZBufferBaseDest; // Destination base value + DWORD dwZDestConstBitDepth; // Bit depth used to specify Z constant for destination + union + { + DWORD dwZDestConst; // Constant to use as Z buffer for dest + LPDIRECTDRAWSURFACE lpDDSZBufferDest; // Surface to use as Z buffer for dest + } DUMMYUNIONNAMEN(1); + DWORD dwZSrcConstBitDepth; // Bit depth used to specify Z constant for source + union + { + DWORD dwZSrcConst; // Constant to use as Z buffer for src + LPDIRECTDRAWSURFACE lpDDSZBufferSrc; // Surface to use as Z buffer for src + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Alpha for edge blending + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as Alpha Channel + } DUMMYUNIONNAMEN(3); + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as Alpha Channel + } DUMMYUNIONNAMEN(4); + union + { + DWORD dwFillColor; // color in RGB or Palettized + DWORD dwFillDepth; // depth value for z-buffer + DWORD dwFillPixel; // pixel value for RGBA or RGBZ + LPDIRECTDRAWSURFACE lpDDSPattern; // Surface to use as pattern + } DUMMYUNIONNAMEN(5); + DDCOLORKEY ddckDestColorkey; // DestColorkey override + DDCOLORKEY ddckSrcColorkey; // SrcColorkey override +} DDBLTFX; + +typedef DDBLTFX FAR* LPDDBLTFX; + + + +/* + * DDSCAPS + */ +typedef struct _DDSCAPS +{ + DWORD dwCaps; // capabilities of surface wanted +} DDSCAPS; + +typedef DDSCAPS FAR* LPDDSCAPS; + + +/* + * DDOSCAPS + */ +typedef struct _DDOSCAPS +{ + DWORD dwCaps; // capabilities of surface wanted +} DDOSCAPS; + +typedef DDOSCAPS FAR* LPDDOSCAPS; + +/* + * This structure is used internally by DirectDraw. + */ +typedef struct _DDSCAPSEX +{ + DWORD dwCaps2; + DWORD dwCaps3; + union + { + DWORD dwCaps4; + DWORD dwVolumeDepth; + } DUMMYUNIONNAMEN(1); +} DDSCAPSEX, FAR * LPDDSCAPSEX; + +/* + * DDSCAPS2 + */ +typedef struct _DDSCAPS2 +{ + DWORD dwCaps; // capabilities of surface wanted + DWORD dwCaps2; + DWORD dwCaps3; + union + { + DWORD dwCaps4; + DWORD dwVolumeDepth; + } DUMMYUNIONNAMEN(1); +} DDSCAPS2; + +typedef DDSCAPS2 FAR* LPDDSCAPS2; + +/* + * DDCAPS + */ +#define DD_ROP_SPACE (256/32) // space required to store ROP array +/* + * NOTE: Our choosen structure number scheme is to append a single digit to + * the end of the structure giving the version that structure is associated + * with. + */ + +/* + * This structure represents the DDCAPS structure released in DirectDraw 1.0. It is used internally + * by DirectDraw to interpret caps passed into ddraw by drivers written prior to the release of DirectDraw 2.0. + * New applications should use the DDCAPS structure defined below. + */ +typedef struct _DDCAPS_DX1 +{ + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMaxLiveVideoStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMinHwCodecStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwMaxHwCodecStretch; // OBSOLETE! This field remains for compatability reasons only + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved +} DDCAPS_DX1; + +typedef DDCAPS_DX1 FAR* LPDDCAPS_DX1; + +/* + * This structure is the DDCAPS structure as it was in version 2 and 3 of Direct X. + * It is present for back compatability. + */ +typedef struct _DDCAPS_DX3 +{ + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved + DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts + DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts + DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts + DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts + DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts + DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts + DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts + DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts + DWORD dwSSBCaps; // driver specific capabilities for System->System blts + DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts + DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts + DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts + DWORD dwReserved4; // reserved + DWORD dwReserved5; // reserved + DWORD dwReserved6; // reserved +} DDCAPS_DX3; +typedef DDCAPS_DX3 FAR* LPDDCAPS_DX3; + +/* + * This structure is the DDCAPS structure as it was in version 5 of Direct X. + * It is present for back compatability. + */ +typedef struct _DDCAPS_DX5 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +// Members added for DX5: +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +} DDCAPS_DX5; +typedef DDCAPS_DX5 FAR* LPDDCAPS_DX5; + +typedef struct _DDCAPS_DX6 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha caps +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +// Members added for DX6 release +/*16c*/ DDSCAPS2 ddsCaps; // Surface Caps +} DDCAPS_DX6; +typedef DDCAPS_DX6 FAR* LPDDCAPS_DX6; + +typedef struct _DDCAPS_DX7 +{ +/* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure +/* 4*/ DWORD dwCaps; // driver specific capabilities +/* 8*/ DWORD dwCaps2; // more driver specific capabilites +/* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface +/* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites +/* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities +/* 18*/ DWORD dwPalCaps; // palette capabilities +/* 1c*/ DWORD dwSVCaps; // stereo vision capabilities +/* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 +/* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 +/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 +/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 +/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 +/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 +/* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 +/* 3c*/ DWORD dwVidMemTotal; // total amount of video memory +/* 40*/ DWORD dwVidMemFree; // amount of free video memory +/* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays +/* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays +/* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes +/* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment +/* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size +/* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment +/* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size +/* 60*/ DWORD dwAlignStrideAlign; // stride alignment +/* 64*/ DWORD dwRops[DD_ROP_SPACE]; // ROPS supported +/* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 +/* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 +/* a0*/ DWORD dwReserved1; // reserved +/* a4*/ DWORD dwReserved2; // reserved +/* a8*/ DWORD dwReserved3; // reserved +/* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts +/* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts +/* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts +/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts +/* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts +/* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts +/* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts +/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts +/*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts +/*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts +/*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts +/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts +/*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports +/*134*/ DWORD dwCurrVideoPorts; // current number of video ports used +/*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts +/*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts +/*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts +/*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts +/*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts +/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE]; // ROPS supported for non-local->local blts +// Members added for DX6 release +/*16c*/ DDSCAPS2 ddsCaps; // Surface Caps +} DDCAPS_DX7; +typedef DDCAPS_DX7 FAR* LPDDCAPS_DX7; + + +#if DIRECTDRAW_VERSION <= 0x300 + typedef DDCAPS_DX3 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x500 + typedef DDCAPS_DX5 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x600 + typedef DDCAPS_DX6 DDCAPS; +#else + typedef DDCAPS_DX7 DDCAPS; +#endif + +typedef DDCAPS FAR* LPDDCAPS; + + + +/* + * DDPIXELFORMAT + */ +typedef struct _DDPIXELFORMAT +{ + DWORD dwSize; // size of structure + DWORD dwFlags; // pixel format flags + DWORD dwFourCC; // (FOURCC code) + union + { + DWORD dwRGBBitCount; // how many bits per pixel + DWORD dwYUVBitCount; // how many bits per pixel + DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits) + DWORD dwAlphaBitDepth; // how many bits for alpha channels + DWORD dwLuminanceBitCount; // how many bits per pixel + DWORD dwBumpBitCount; // how many bits per "buxel", total + DWORD dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture + // format list and if DDPF_D3DFORMAT is set + } DUMMYUNIONNAMEN(1); + union + { + DWORD dwRBitMask; // mask for red bit + DWORD dwYBitMask; // mask for Y bits + DWORD dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) + DWORD dwLuminanceBitMask; // mask for luminance bits + DWORD dwBumpDuBitMask; // mask for bump map U delta bits + DWORD dwOperations; // DDPF_D3DFORMAT Operations + } DUMMYUNIONNAMEN(2); + union + { + DWORD dwGBitMask; // mask for green bits + DWORD dwUBitMask; // mask for U bits + DWORD dwZBitMask; // mask for Z bits + DWORD dwBumpDvBitMask; // mask for bump map V delta bits + struct + { + WORD wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT + WORD wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT + } MultiSampleCaps; + + } DUMMYUNIONNAMEN(3); + union + { + DWORD dwBBitMask; // mask for blue bits + DWORD dwVBitMask; // mask for V bits + DWORD dwStencilBitMask; // mask for stencil bits + DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map + } DUMMYUNIONNAMEN(4); + union + { + DWORD dwRGBAlphaBitMask; // mask for alpha channel + DWORD dwYUVAlphaBitMask; // mask for alpha channel + DWORD dwLuminanceAlphaBitMask;// mask for alpha channel + DWORD dwRGBZBitMask; // mask for Z channel + DWORD dwYUVZBitMask; // mask for Z channel + } DUMMYUNIONNAMEN(5); +} DDPIXELFORMAT; + +typedef DDPIXELFORMAT FAR* LPDDPIXELFORMAT; + +/* + * DDOVERLAYFX + */ +typedef struct _DDOVERLAYFX +{ + DWORD dwSize; // size of structure + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Constant to use as alpha for edge blend + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as alpha channel for dest + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as alpha channel for dest + } DUMMYUNIONNAMEN(1); + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as alpha channel for src + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as alpha channel for src + } DUMMYUNIONNAMEN(2); + DDCOLORKEY dckDestColorkey; // DestColorkey override + DDCOLORKEY dckSrcColorkey; // DestColorkey override + DWORD dwDDFX; // Overlay FX + DWORD dwFlags; // flags +} DDOVERLAYFX; + +typedef DDOVERLAYFX FAR *LPDDOVERLAYFX; + + +/* + * DDBLTBATCH: BltBatch entry structure + */ +typedef struct _DDBLTBATCH +{ + LPRECT lprDest; + LPDIRECTDRAWSURFACE lpDDSSrc; + LPRECT lprSrc; + DWORD dwFlags; + LPDDBLTFX lpDDBltFx; +} DDBLTBATCH; + +typedef DDBLTBATCH FAR * LPDDBLTBATCH; + + +/* + * DDGAMMARAMP + */ +typedef struct _DDGAMMARAMP +{ + WORD red[256]; + WORD green[256]; + WORD blue[256]; +} DDGAMMARAMP; +typedef DDGAMMARAMP FAR * LPDDGAMMARAMP; + +/* + * This is the structure within which DirectDraw returns data about the current graphics driver and chipset + */ + +#define MAX_DDDEVICEID_STRING 512 + +typedef struct tagDDDEVICEIDENTIFIER +{ + /* + * These elements are for presentation to the user only. They should not be used to identify particular + * drivers, since this is unreliable and many different strings may be associated with the same + * device, and the same driver from different vendors. + */ + char szDriver[MAX_DDDEVICEID_STRING]; + char szDescription[MAX_DDDEVICEID_STRING]; + + /* + * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + * + * This version has the form: + * wProduct = HIWORD(liDriverVersion.HighPart) + * wVersion = LOWORD(liDriverVersion.HighPart) + * wSubVersion = HIWORD(liDriverVersion.LowPart) + * wBuild = LOWORD(liDriverVersion.LowPart) + */ +#ifdef _WIN32 + LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ +#else + DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ + DWORD dwDriverVersionHighPart; +#endif + + + /* + * These elements can be used to identify particular chipsets. Use with extreme caution. + * dwVendorId Identifies the manufacturer. May be zero if unknown. + * dwDeviceId Identifies the type of chipset. May be zero if unknown. + * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + * dwRevision Identifies the revision level of the chipset. May be zero if unknown. + */ + DWORD dwVendorId; + DWORD dwDeviceId; + DWORD dwSubSysId; + DWORD dwRevision; + + /* + * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + * reprofile the graphics subsystem. + * This element can also be used to identify particular problematic drivers. + */ + GUID guidDeviceIdentifier; +} DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; + +typedef struct tagDDDEVICEIDENTIFIER2 +{ + /* + * These elements are for presentation to the user only. They should not be used to identify particular + * drivers, since this is unreliable and many different strings may be associated with the same + * device, and the same driver from different vendors. + */ + char szDriver[MAX_DDDEVICEID_STRING]; + char szDescription[MAX_DDDEVICEID_STRING]; + + /* + * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + * + * This version has the form: + * wProduct = HIWORD(liDriverVersion.HighPart) + * wVersion = LOWORD(liDriverVersion.HighPart) + * wSubVersion = HIWORD(liDriverVersion.LowPart) + * wBuild = LOWORD(liDriverVersion.LowPart) + */ +#ifdef _WIN32 + LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ +#else + DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ + DWORD dwDriverVersionHighPart; +#endif + + + /* + * These elements can be used to identify particular chipsets. Use with extreme caution. + * dwVendorId Identifies the manufacturer. May be zero if unknown. + * dwDeviceId Identifies the type of chipset. May be zero if unknown. + * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + * dwRevision Identifies the revision level of the chipset. May be zero if unknown. + */ + DWORD dwVendorId; + DWORD dwDeviceId; + DWORD dwSubSysId; + DWORD dwRevision; + + /* + * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + * reprofile the graphics subsystem. + * This element can also be used to identify particular problematic drivers. + */ + GUID guidDeviceIdentifier; + + /* + * This element is used to determine the Windows Hardware Quality Lab (WHQL) + * certification level for this driver/device pair. + */ + DWORD dwWHQLLevel; + +} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2; + +/* + * Flags for the IDirectDraw4::GetDeviceIdentifier method + */ + +/* + * This flag causes GetDeviceIdentifier to return information about the host (typically 2D) adapter in a system equipped + * with a stacked secondary 3D adapter. Such an adapter appears to the application as if it were part of the + * host adapter, but is typically physcially located on a separate card. The stacked secondary's information is + * returned when GetDeviceIdentifier's dwFlags field is zero, since this most accurately reflects the qualities + * of the DirectDraw object involved. + */ +#define DDGDI_GETHOSTIDENTIFIER 0x00000001L + +/* + * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel + */ +#define GET_WHQL_YEAR( dwWHQLLevel ) \ + ( (dwWHQLLevel) / 0x10000 ) +#define GET_WHQL_MONTH( dwWHQLLevel ) \ + ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff ) +#define GET_WHQL_DAY( dwWHQLLevel ) \ + ( (dwWHQLLevel) & 0xff ) + + +/* + * callbacks + */ +typedef DWORD (FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, LPVOID lpContext ); +#ifdef STREAMING +typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); +#endif + + +/* + * INTERACES FOLLOW: + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface + */ + +/* + * IDirectDraw + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw +DECLARE_INTERFACE_( IDirectDraw, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->lpVtbl->SetDisplayMode(p, a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#else +#define IDirectDraw_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw_AddRef(p) (p)->AddRef() +#define IDirectDraw_Release(p) (p)->Release() +#define IDirectDraw_Compact(p) (p)->Compact() +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->SetDisplayMode(a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw2 +DECLARE_INTERFACE_( IDirectDraw2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw2_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw2_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#else +#define IDirectDraw2_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw2_AddRef(p) (p)->AddRef() +#define IDirectDraw2_Release(p) (p)->Release() +#define IDirectDraw2_Compact(p) (p)->Compact() +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw2_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw2_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw2_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw4 +DECLARE_INTERFACE_( IDirectDraw4, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4 FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4 FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE4 FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2, LPDWORD, LPDWORD) PURE; + /*** Added in the V4 Interface ***/ + STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE4 *) PURE; + STDMETHOD(RestoreAllSurfaces)(THIS) PURE; + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER, DWORD ) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw4_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw4_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw4_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw4_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw4_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw4_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw4_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw4_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw4_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw4_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw4_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw4_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw4_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw4_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw4_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw4_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw4_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw4_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw4_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw4_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw4_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw4_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw4_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw4_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#define IDirectDraw4_GetSurfaceFromDC(p, a, b) (p)->lpVtbl->GetSurfaceFromDC(p, a, b) +#define IDirectDraw4_RestoreAllSurfaces(p) (p)->lpVtbl->RestoreAllSurfaces(p) +#define IDirectDraw4_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirectDraw4_GetDeviceIdentifier(p,a,b) (p)->lpVtbl->GetDeviceIdentifier(p,a,b) +#else +#define IDirectDraw4_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw4_AddRef(p) (p)->AddRef() +#define IDirectDraw4_Release(p) (p)->Release() +#define IDirectDraw4_Compact(p) (p)->Compact() +#define IDirectDraw4_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw4_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw4_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw4_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw4_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw4_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw4_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw4_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw4_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw4_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw4_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw4_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw4_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw4_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw4_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw4_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw4_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw4_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw4_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw4_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#define IDirectDraw4_GetSurfaceFromDC(p, a, b) (p)->GetSurfaceFromDC(a, b) +#define IDirectDraw4_RestoreAllSurfaces(p) (p)->RestoreAllSurfaces() +#define IDirectDraw4_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirectDraw4_GetDeviceIdentifier(p,a,b) (p)->GetDeviceIdentifier(a,b) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw7 +DECLARE_INTERFACE_( IDirectDraw7, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7 FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7 FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK7 ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7 FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2, LPDWORD, LPDWORD) PURE; + /*** Added in the V4 Interface ***/ + STDMETHOD(GetSurfaceFromDC) (THIS_ HDC, LPDIRECTDRAWSURFACE7 *) PURE; + STDMETHOD(RestoreAllSurfaces)(THIS) PURE; + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2, DWORD ) PURE; + STDMETHOD(StartModeTest)(THIS_ LPSIZE, DWORD, DWORD ) PURE; + STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw7_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw7_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw7_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw7_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw7_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw7_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw7_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw7_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw7_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw7_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw7_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw7_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw7_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw7_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw7_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw7_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw7_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw7_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw7_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw7_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw7_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw7_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#define IDirectDraw7_GetSurfaceFromDC(p, a, b) (p)->lpVtbl->GetSurfaceFromDC(p, a, b) +#define IDirectDraw7_RestoreAllSurfaces(p) (p)->lpVtbl->RestoreAllSurfaces(p) +#define IDirectDraw7_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) (p)->lpVtbl->GetDeviceIdentifier(p,a,b) +#define IDirectDraw7_StartModeTest(p,a,b,c) (p)->lpVtbl->StartModeTest(p,a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) (p)->lpVtbl->EvaluateMode(p,a,b) +#else +#define IDirectDraw7_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDraw7_AddRef(p) (p)->AddRef() +#define IDirectDraw7_Release(p) (p)->Release() +#define IDirectDraw7_Compact(p) (p)->Compact() +#define IDirectDraw7_CreateClipper(p, a, b, c) (p)->CreateClipper(a, b, c) +#define IDirectDraw7_CreatePalette(p, a, b, c, d) (p)->CreatePalette(a, b, c, d) +#define IDirectDraw7_CreateSurface(p, a, b, c) (p)->CreateSurface(a, b, c) +#define IDirectDraw7_DuplicateSurface(p, a, b) (p)->DuplicateSurface(a, b) +#define IDirectDraw7_EnumDisplayModes(p, a, b, c, d) (p)->EnumDisplayModes(a, b, c, d) +#define IDirectDraw7_EnumSurfaces(p, a, b, c, d) (p)->EnumSurfaces(a, b, c, d) +#define IDirectDraw7_FlipToGDISurface(p) (p)->FlipToGDISurface() +#define IDirectDraw7_GetCaps(p, a, b) (p)->GetCaps(a, b) +#define IDirectDraw7_GetDisplayMode(p, a) (p)->GetDisplayMode(a) +#define IDirectDraw7_GetFourCCCodes(p, a, b) (p)->GetFourCCCodes(a, b) +#define IDirectDraw7_GetGDISurface(p, a) (p)->GetGDISurface(a) +#define IDirectDraw7_GetMonitorFrequency(p, a) (p)->GetMonitorFrequency(a) +#define IDirectDraw7_GetScanLine(p, a) (p)->GetScanLine(a) +#define IDirectDraw7_GetVerticalBlankStatus(p, a) (p)->GetVerticalBlankStatus(a) +#define IDirectDraw7_Initialize(p, a) (p)->Initialize(a) +#define IDirectDraw7_RestoreDisplayMode(p) (p)->RestoreDisplayMode() +#define IDirectDraw7_SetCooperativeLevel(p, a, b) (p)->SetCooperativeLevel(a, b) +#define IDirectDraw7_SetDisplayMode(p, a, b, c, d, e) (p)->SetDisplayMode(a, b, c, d, e) +#define IDirectDraw7_WaitForVerticalBlank(p, a, b) (p)->WaitForVerticalBlank(a, b) +#define IDirectDraw7_GetAvailableVidMem(p, a, b, c) (p)->GetAvailableVidMem(a, b, c) +#define IDirectDraw7_GetSurfaceFromDC(p, a, b) (p)->GetSurfaceFromDC(a, b) +#define IDirectDraw7_RestoreAllSurfaces(p) (p)->RestoreAllSurfaces() +#define IDirectDraw7_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) (p)->GetDeviceIdentifier(a,b) +#define IDirectDraw7_StartModeTest(p,a,b,c) (p)->lpVtbl->StartModeTest(a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) (p)->lpVtbl->EvaluateMode(a,b) +#endif + +#endif + + +/* + * IDirectDrawPalette + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawPalette +DECLARE_INTERFACE_( IDirectDrawPalette, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawPalette methods ***/ + STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE; + STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; + STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawPalette_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawPalette_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawPalette_GetCaps(p, a) (p)->lpVtbl->GetCaps(p, a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->lpVtbl->GetEntries(p, a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->lpVtbl->SetEntries(p, a, b, c, d) +#else +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawPalette_AddRef(p) (p)->AddRef() +#define IDirectDrawPalette_Release(p) (p)->Release() +#define IDirectDrawPalette_GetCaps(p, a) (p)->GetCaps(a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->GetEntries(a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->Initialize(a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->SetEntries(a, b, c, d) +#endif + +#endif + + +/* + * IDirectDrawClipper + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawClipper +DECLARE_INTERFACE_( IDirectDrawClipper, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawClipper methods ***/ + STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD) PURE; + STDMETHOD(GetHWnd)(THIS_ HWND FAR *) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD) PURE; + STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *) PURE; + STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE; + STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawClipper_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawClipper_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->lpVtbl->GetClipList(p, a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->lpVtbl->GetHWnd(p, a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->lpVtbl->IsClipListChanged(p, a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->lpVtbl->SetClipList(p, a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->lpVtbl->SetHWnd(p, a, b) +#else +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawClipper_AddRef(p) (p)->AddRef() +#define IDirectDrawClipper_Release(p) (p)->Release() +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->GetClipList(a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->GetHWnd(a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->Initialize(a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->IsClipListChanged(a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->SetClipList(a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->SetHWnd(a, b) +#endif + +#endif + +/* + * IDirectDrawSurface and related interfaces + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawSurface +DECLARE_INTERFACE_( IDirectDrawSurface, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#else +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface_Release(p) (p)->Release() +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface_Restore(p) (p)->Restore() +#define IDirectDrawSurface_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#endif + +/* + * IDirectDrawSurface2 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface2 +DECLARE_INTERFACE_( IDirectDrawSurface2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE2, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE2, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface2_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface2_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#else +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface2_Release(p) (p)->Release() +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface2_Restore(p) (p)->Restore() +#define IDirectDrawSurface2_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->PageUnlock(a) +#endif + +/* + * IDirectDrawSurface3 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface3 +DECLARE_INTERFACE_( IDirectDrawSurface3, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE3, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE3, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE3) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE3, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE3 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE3) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the V3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface3_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface3_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface3_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface3_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface3_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface3_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface3_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface3_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface3_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface3_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface3_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface3_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface3_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface3_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface3_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface3_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface3_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface3_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface3_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface3_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface3_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface3_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface3_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface3_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface3_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#else +#define IDirectDrawSurface3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface3_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface3_Release(p) (p)->Release() +#define IDirectDrawSurface3_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface3_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface3_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface3_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface3_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface3_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface3_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface3_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface3_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface3_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface3_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface3_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface3_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface3_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface3_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface3_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface3_Restore(p) (p)->Restore() +#define IDirectDrawSurface3_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface3_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface3_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface3_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface3_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface3_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface3_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#endif + +/* + * IDirectDrawSurface4 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface4 +DECLARE_INTERFACE_( IDirectDrawSurface4, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE4, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE4, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE4) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK2) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE4, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2, LPDIRECTDRAWSURFACE4 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC2) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC2,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPRECT) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE4) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the v3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2, DWORD) PURE; + /*** Added in the v4 interface ***/ + STDMETHOD(SetPrivateData)(THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID, LPVOID, LPDWORD) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID) PURE; + STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD) PURE; + STDMETHOD(ChangeUniquenessValue)(THIS) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface4_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface4_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface4_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface4_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface4_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface4_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface4_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface4_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface4_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface4_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface4_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface4_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface4_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface4_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface4_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface4_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface4_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface4_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface4_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface4_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface4_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface4_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface4_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface4_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface4_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface4_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface4_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirectDrawSurface4_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirectDrawSurface4_GetUniquenessValue(p, a) (p)->lpVtbl->GetUniquenessValue(p, a) +#define IDirectDrawSurface4_ChangeUniquenessValue(p) (p)->lpVtbl->ChangeUniquenessValue(p) +#else +#define IDirectDrawSurface4_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface4_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface4_Release(p) (p)->Release() +#define IDirectDrawSurface4_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface4_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface4_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface4_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface4_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface4_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface4_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface4_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface4_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface4_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface4_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface4_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface4_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface4_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface4_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface4_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface4_Restore(p) (p)->Restore() +#define IDirectDrawSurface4_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface4_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface4_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface4_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface4_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface4_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface4_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirectDrawSurface4_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirectDrawSurface4_GetUniquenessValue(p, a) (p)->GetUniquenessValue(a) +#define IDirectDrawSurface4_ChangeUniquenessValue(p) (p)->ChangeUniquenessValue() +#endif + +/* + * IDirectDrawSurface7 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface7 +DECLARE_INTERFACE_( IDirectDrawSurface7, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE7, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE7, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE7) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK7) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK7) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE7, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2, LPDIRECTDRAWSURFACE7 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC2) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC2,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPRECT) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE7,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE7) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; + /*** Added in the v3 interface ***/ + STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2, DWORD) PURE; + /*** Added in the v4 interface ***/ + STDMETHOD(SetPrivateData)(THIS_ REFGUID, LPVOID, DWORD, DWORD) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID, LPVOID, LPDWORD) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID) PURE; + STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD) PURE; + STDMETHOD(ChangeUniquenessValue)(THIS) PURE; + /*** Moved Texture7 methods here ***/ + STDMETHOD(SetPriority)(THIS_ DWORD) PURE; + STDMETHOD(GetPriority)(THIS_ LPDWORD) PURE; + STDMETHOD(SetLOD)(THIS_ DWORD) PURE; + STDMETHOD(GetLOD)(THIS_ LPDWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface7_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface7_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface7_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface7_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface7_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface7_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface7_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface7_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface7_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface7_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface7_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface7_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface7_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface7_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface7_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface7_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface7_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface7_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface7_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface7_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface7_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface7_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface7_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) (p)->lpVtbl->SetSurfaceDesc(p,a,b) +#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirectDrawSurface7_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirectDrawSurface7_GetUniquenessValue(p, a) (p)->lpVtbl->GetUniquenessValue(p, a) +#define IDirectDrawSurface7_ChangeUniquenessValue(p) (p)->lpVtbl->ChangeUniquenessValue(p) +#define IDirectDrawSurface7_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirectDrawSurface7_GetPriority(p,a) (p)->lpVtbl->GetPriority(p,a) +#define IDirectDrawSurface7_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirectDrawSurface7_GetLOD(p,a) (p)->lpVtbl->GetLOD(p,a) +#else +#define IDirectDrawSurface7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectDrawSurface7_AddRef(p) (p)->AddRef() +#define IDirectDrawSurface7_Release(p) (p)->Release() +#define IDirectDrawSurface7_AddAttachedSurface(p,a) (p)->AddAttachedSurface(a) +#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) (p)->AddOverlayDirtyRect(a) +#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) (p)->Blt(a,b,c,d,e) +#define IDirectDrawSurface7_BltBatch(p,a,b,c) (p)->BltBatch(a,b,c) +#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) (p)->BltFast(a,b,c,d,e) +#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) (p)->DeleteAttachedSurface(a,b) +#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) (p)->EnumAttachedSurfaces(a,b) +#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) (p)->EnumOverlayZOrders(a,b,c) +#define IDirectDrawSurface7_Flip(p,a,b) (p)->Flip(a,b) +#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) (p)->GetAttachedSurface(a,b) +#define IDirectDrawSurface7_GetBltStatus(p,a) (p)->GetBltStatus(a) +#define IDirectDrawSurface7_GetCaps(p,b) (p)->GetCaps(b) +#define IDirectDrawSurface7_GetClipper(p,a) (p)->GetClipper(a) +#define IDirectDrawSurface7_GetColorKey(p,a,b) (p)->GetColorKey(a,b) +#define IDirectDrawSurface7_GetDC(p,a) (p)->GetDC(a) +#define IDirectDrawSurface7_GetFlipStatus(p,a) (p)->GetFlipStatus(a) +#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) (p)->GetOverlayPosition(a,b) +#define IDirectDrawSurface7_GetPalette(p,a) (p)->GetPalette(a) +#define IDirectDrawSurface7_GetPixelFormat(p,a) (p)->GetPixelFormat(a) +#define IDirectDrawSurface7_GetSurfaceDesc(p,a) (p)->GetSurfaceDesc(a) +#define IDirectDrawSurface7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectDrawSurface7_IsLost(p) (p)->IsLost() +#define IDirectDrawSurface7_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirectDrawSurface7_ReleaseDC(p,a) (p)->ReleaseDC(a) +#define IDirectDrawSurface7_Restore(p) (p)->Restore() +#define IDirectDrawSurface7_SetClipper(p,a) (p)->SetClipper(a) +#define IDirectDrawSurface7_SetColorKey(p,a,b) (p)->SetColorKey(a,b) +#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) (p)->SetOverlayPosition(a,b) +#define IDirectDrawSurface7_SetPalette(p,a) (p)->SetPalette(a) +#define IDirectDrawSurface7_Unlock(p,b) (p)->Unlock(b) +#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) (p)->UpdateOverlay(a,b,c,d,e) +#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) (p)->UpdateOverlayDisplay(a) +#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) (p)->UpdateOverlayZOrder(a,b) +#define IDirectDrawSurface7_GetDDInterface(p,a) (p)->GetDDInterface(a) +#define IDirectDrawSurface7_PageLock(p,a) (p)->PageLock(a) +#define IDirectDrawSurface7_PageUnlock(p,a) (p)->PageUnlock(a) +#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) (p)->SetSurfaceDesc(a,b) +#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirectDrawSurface7_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirectDrawSurface7_GetUniquenessValue(p, a) (p)->GetUniquenessValue(a) +#define IDirectDrawSurface7_ChangeUniquenessValue(p) (p)->ChangeUniquenessValue() +#define IDirectDrawSurface7_SetPriority(p,a) (p)->SetPriority(a) +#define IDirectDrawSurface7_GetPriority(p,a) (p)->GetPriority(a) +#define IDirectDrawSurface7_SetLOD(p,a) (p)->SetLOD(a) +#define IDirectDrawSurface7_GetLOD(p,a) (p)->GetLOD(a) +#endif + + +/* + * IDirectDrawColorControl + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawColorControl +DECLARE_INTERFACE_( IDirectDrawColorControl, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawColorControl methods ***/ + STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawColorControl_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawColorControl_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawColorControl_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawColorControl_GetColorControls(p, a) (p)->lpVtbl->GetColorControls(p, a) +#define IDirectDrawColorControl_SetColorControls(p, a) (p)->lpVtbl->SetColorControls(p, a) +#else +#define IDirectDrawColorControl_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawColorControl_AddRef(p) (p)->AddRef() +#define IDirectDrawColorControl_Release(p) (p)->Release() +#define IDirectDrawColorControl_GetColorControls(p, a) (p)->GetColorControls(a) +#define IDirectDrawColorControl_SetColorControls(p, a) (p)->SetColorControls(a) +#endif + +#endif + + +/* + * IDirectDrawGammaControl + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawGammaControl +DECLARE_INTERFACE_( IDirectDrawGammaControl, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawGammaControl methods ***/ + STDMETHOD(GetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE; + STDMETHOD(SetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawGammaControl_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawGammaControl_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawGammaControl_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawGammaControl_GetGammaRamp(p, a, b) (p)->lpVtbl->GetGammaRamp(p, a, b) +#define IDirectDrawGammaControl_SetGammaRamp(p, a, b) (p)->lpVtbl->SetGammaRamp(p, a, b) +#else +#define IDirectDrawGammaControl_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IDirectDrawGammaControl_AddRef(p) (p)->AddRef() +#define IDirectDrawGammaControl_Release(p) (p)->Release() +#define IDirectDrawGammaControl_GetGammaRamp(p, a, b) (p)->GetGammaRamp(a, b) +#define IDirectDrawGammaControl_SetGammaRamp(p, a, b) (p)->SetGammaRamp(a, b) +#endif + +#endif + + + +#endif + + +/* + * DDSURFACEDESC + */ +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + union + { + LONG lPitch; // distance to start of next line (return value only) + DWORD dwLinearSize; // Formless late-allocated optimized surface size + } DUMMYUNIONNAMEN(1); + DWORD dwBackBufferCount; // number of back buffers requested + union + { + DWORD dwMipMapCount; // number of mip-map levels requested + DWORD dwZBufferBitDepth; // depth of Z buffer requested + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DDSCAPS ddsCaps; // direct draw surface capabilities +} DDSURFACEDESC; + +/* + * DDSURFACEDESC2 + */ +typedef struct _DDSURFACEDESC2 +{ + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + union + { + LONG lPitch; // distance to start of next line (return value only) + DWORD dwLinearSize; // Formless late-allocated optimized surface size + } DUMMYUNIONNAMEN(1); + union + { + DWORD dwBackBufferCount; // number of back buffers requested + DWORD dwDepth; // the depth if this is a volume texture + } DUMMYUNIONNAMEN(5); + union + { + DWORD dwMipMapCount; // number of mip-map levels requestde + // dwZBufferBitDepth removed, use ddpfPixelFormat one instead + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + DWORD dwSrcVBHandle; // The source used in VB::Optimize + } DUMMYUNIONNAMEN(2); + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + union + { + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces + } DUMMYUNIONNAMEN(3); + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + union + { + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DWORD dwFVF; // vertex format description of vertex buffers + } DUMMYUNIONNAMEN(4); + DDSCAPS2 ddsCaps; // direct draw surface capabilities + DWORD dwTextureStage; // stage in multitexture cascade +} DDSURFACEDESC2; + +/* + * ddsCaps field is valid. + */ +#define DDSD_CAPS 0x00000001l // default + +/* + * dwHeight field is valid. + */ +#define DDSD_HEIGHT 0x00000002l + +/* + * dwWidth field is valid. + */ +#define DDSD_WIDTH 0x00000004l + +/* + * lPitch is valid. + */ +#define DDSD_PITCH 0x00000008l + +/* + * dwBackBufferCount is valid. + */ +#define DDSD_BACKBUFFERCOUNT 0x00000020l + +/* + * dwZBufferBitDepth is valid. (shouldnt be used in DDSURFACEDESC2) + */ +#define DDSD_ZBUFFERBITDEPTH 0x00000040l + +/* + * dwAlphaBitDepth is valid. + */ +#define DDSD_ALPHABITDEPTH 0x00000080l + + +/* + * lpSurface is valid. + */ +#define DDSD_LPSURFACE 0x00000800l + +/* + * ddpfPixelFormat is valid. + */ +#define DDSD_PIXELFORMAT 0x00001000l + +/* + * ddckCKDestOverlay is valid. + */ +#define DDSD_CKDESTOVERLAY 0x00002000l + +/* + * ddckCKDestBlt is valid. + */ +#define DDSD_CKDESTBLT 0x00004000l + +/* + * ddckCKSrcOverlay is valid. + */ +#define DDSD_CKSRCOVERLAY 0x00008000l + +/* + * ddckCKSrcBlt is valid. + */ +#define DDSD_CKSRCBLT 0x00010000l + +/* + * dwMipMapCount is valid. + */ +#define DDSD_MIPMAPCOUNT 0x00020000l + + /* + * dwRefreshRate is valid + */ +#define DDSD_REFRESHRATE 0x00040000l + +/* + * dwLinearSize is valid + */ +#define DDSD_LINEARSIZE 0x00080000l + +/* + * dwTextureStage is valid + */ +#define DDSD_TEXTURESTAGE 0x00100000l +/* + * dwFVF is valid + */ +#define DDSD_FVF 0x00200000l +/* + * dwSrcVBHandle is valid + */ +#define DDSD_SRCVBHANDLE 0x00400000l + +/* + * dwDepth is valid + */ +#define DDSD_DEPTH 0x00800000l + +/* + * All input fields are valid. + */ +#define DDSD_ALL 0x00fff9eel + +/* + * DDOPTSURFACEDESC + */ +typedef struct _DDOPTSURFACEDESC +{ + DWORD dwSize; // size of the DDOPTSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DDSCAPS2 ddSCaps; // Common caps like: Memory type + DDOSCAPS ddOSCaps; // Common caps like: Memory type + GUID guid; // Compression technique GUID + DWORD dwCompressionRatio; // Compression ratio +} DDOPTSURFACEDESC; + +/* + * guid field is valid. + */ +#define DDOSD_GUID 0x00000001l + +/* + * dwCompressionRatio field is valid. + */ +#define DDOSD_COMPRESSION_RATIO 0x00000002l + +/* + * ddSCaps field is valid. + */ +#define DDOSD_SCAPS 0x00000004l + +/* + * ddOSCaps field is valid. + */ +#define DDOSD_OSCAPS 0x00000008l + +/* + * All input fields are valid. + */ +#define DDOSD_ALL 0x0000000fl + +/* + * The surface's optimized pixelformat is compressed + */ +#define DDOSDCAPS_OPTCOMPRESSED 0x00000001l + +/* + * The surface's optimized pixelformat is reordered + */ +#define DDOSDCAPS_OPTREORDERED 0x00000002l + +/* + * The opt surface is a monolithic mipmap + */ +#define DDOSDCAPS_MONOLITHICMIPMAP 0x00000004l + +/* + * The valid Surf caps: + * #define DDSCAPS_SYSTEMMEMORY 0x00000800l + * #define DDSCAPS_VIDEOMEMORY 0x00004000l + * #define DDSCAPS_LOCALVIDMEM 0x10000000l + * #define DDSCAPS_NONLOCALVIDMEM 0x20000000l + */ +#define DDOSDCAPS_VALIDSCAPS 0x30004800l + +/* + * The valid OptSurf caps + */ +#define DDOSDCAPS_VALIDOSCAPS 0x00000007l + + +/* + * DDCOLORCONTROL + */ +typedef struct _DDCOLORCONTROL +{ + DWORD dwSize; + DWORD dwFlags; + LONG lBrightness; + LONG lContrast; + LONG lHue; + LONG lSaturation; + LONG lSharpness; + LONG lGamma; + LONG lColorEnable; + DWORD dwReserved1; +} DDCOLORCONTROL; + + +/* + * lBrightness field is valid. + */ +#define DDCOLOR_BRIGHTNESS 0x00000001l + +/* + * lContrast field is valid. + */ +#define DDCOLOR_CONTRAST 0x00000002l + +/* + * lHue field is valid. + */ +#define DDCOLOR_HUE 0x00000004l + +/* + * lSaturation field is valid. + */ +#define DDCOLOR_SATURATION 0x00000008l + +/* + * lSharpness field is valid. + */ +#define DDCOLOR_SHARPNESS 0x00000010l + +/* + * lGamma field is valid. + */ +#define DDCOLOR_GAMMA 0x00000020l + +/* + * lColorEnable field is valid. + */ +#define DDCOLOR_COLORENABLE 0x00000040l + + + +/*============================================================================ + * + * Direct Draw Capability Flags + * + * These flags are used to describe the capabilities of a given Surface. + * All flags are bit flags. + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * This bit is reserved. It should not be specified. + */ +#define DDSCAPS_RESERVED1 0x00000001l + +/* + * Indicates that this surface contains alpha-only information. + * (To determine if a surface is RGBA/YUVA, the pixel format must be + * interrogated.) + */ +#define DDSCAPS_ALPHA 0x00000002l + +/* + * Indicates that this surface is a backbuffer. It is generally + * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. + * It indicates that this surface is THE back buffer of a surface + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately + * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. + * The other surfaces are identified as back buffers by the presence + * of the DDSCAPS_FLIP capability, their attachment order, and the + * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to + * a front buffer and/or back buffers to form a flipping surface + * structure after the CreateSurface call. See AddAttachments for + * a detailed description of the behaviors in this case. + */ +#define DDSCAPS_BACKBUFFER 0x00000004l + +/* + * Indicates a complex surface structure is being described. A + * complex surface structure results in the creation of more than + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by + * destroying the root. + */ +#define DDSCAPS_COMPLEX 0x00000008l + +/* + * Indicates that this surface is a part of a surface flipping structure. + * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the + * DDSURFACEDESC structure must be set to at least 1 in order for + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * must always be set with creating multiple surfaces through CreateSurface. + */ +#define DDSCAPS_FLIP 0x00000010l + +/* + * Indicates that this surface is THE front buffer of a surface flipping + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * capability bit is set. + * If this capability is sent to CreateSurface then a standalonw front buffer + * is created. This surface will not have the DDSCAPS_FLIP capability. + * It can be attached to other back buffers to form a flipping structure. + * See AddAttachments for a detailed description of the behaviors in this + * case. + */ +#define DDSCAPS_FRONTBUFFER 0x00000020l + +/* + * Indicates that this surface is any offscreen surface that is not an overlay, + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * to identify plain vanilla surfaces. + */ +#define DDSCAPS_OFFSCREENPLAIN 0x00000040l + +/* + * Indicates that this surface is an overlay. It may or may not be directly visible + * depending on whether or not it is currently being overlayed onto the primary + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * overlayed at the moment. + */ +#define DDSCAPS_OVERLAY 0x00000080l + +/* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + */ +#define DDSCAPS_PALETTE 0x00000100l + +/* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + */ +#define DDSCAPS_PRIMARYSURFACE 0x00000200l + + +/* + * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now + * obsolete. + */ +#define DDSCAPS_RESERVED3 0x00000400l +#define DDSCAPS_PRIMARYSURFACELEFT 0x00000000l + +/* + * Indicates that this surface memory was allocated in system memory + */ +#define DDSCAPS_SYSTEMMEMORY 0x00000800l + +/* + * Indicates that this surface can be used as a 3D texture. It does not + * indicate whether or not the surface is being used for that purpose. + */ +#define DDSCAPS_TEXTURE 0x00001000l + +/* + * Indicates that a surface may be a destination for 3D rendering. This + * bit must be set in order to query for a Direct3D Device Interface + * from this surface. + */ +#define DDSCAPS_3DDEVICE 0x00002000l + +/* + * Indicates that this surface exists in video memory. + */ +#define DDSCAPS_VIDEOMEMORY 0x00004000l + +/* + * Indicates that changes made to this surface are immediately visible. + * It is always set for the primary surface and is set for overlays while + * they are being overlayed and texture maps while they are being textured. + */ +#define DDSCAPS_VISIBLE 0x00008000l + +/* + * Indicates that only writes are permitted to the surface. Read accesses + * from the surface may or may not generate a protection fault, but the + * results of a read from this surface will not be meaningful. READ ONLY. + */ +#define DDSCAPS_WRITEONLY 0x00010000l + +/* + * Indicates that this surface is a z buffer. A z buffer does not contain + * displayable information. Instead it contains bit depth information that is + * used to determine which pixels are visible and which are obscured. + */ +#define DDSCAPS_ZBUFFER 0x00020000l + +/* + * Indicates surface will have a DC associated long term + */ +#define DDSCAPS_OWNDC 0x00040000l + +/* + * Indicates surface should be able to receive live video + */ +#define DDSCAPS_LIVEVIDEO 0x00080000l + +/* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + */ +#define DDSCAPS_HWCODEC 0x00100000l + +/* + * Surface is a ModeX surface. + * + */ +#define DDSCAPS_MODEX 0x00200000l + +/* + * Indicates surface is one level of a mip-map. This surface will + * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map. + * This can be done explicitly, by creating a number of surfaces and + * attaching them with AddAttachedSurface or by implicitly by CreateSurface. + * If this bit is set then DDSCAPS_TEXTURE must also be set. + */ +#define DDSCAPS_MIPMAP 0x00400000l + +/* + * This bit is reserved. It should not be specified. + */ +#define DDSCAPS_RESERVED2 0x00800000l + + +/* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + */ +#define DDSCAPS_ALLOCONLOAD 0x04000000l + +/* + * Indicates that the surface will recieve data from a video port. + */ +#define DDSCAPS_VIDEOPORT 0x08000000l + +/* + * Indicates that a video memory surface is resident in true, local video + * memory rather than non-local video memory. If this flag is specified then + * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_NONLOCALVIDMEM. + */ +#define DDSCAPS_LOCALVIDMEM 0x10000000l + +/* + * Indicates that a video memory surface is resident in non-local video + * memory rather than true, local video memory. If this flag is specified + * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_LOCALVIDMEM. + */ +#define DDSCAPS_NONLOCALVIDMEM 0x20000000l + +/* + * Indicates that this surface is a standard VGA mode surface, and not a + * ModeX surface. (This flag will never be set in combination with the + * DDSCAPS_MODEX flag). + */ +#define DDSCAPS_STANDARDVGAMODE 0x40000000l + +/* + * Indicates that this surface will be an optimized surface. This flag is + * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface + * will be created without any underlying video memory until loaded. + */ +#define DDSCAPS_OPTIMIZED 0x80000000l + + + +/* + * This bit is reserved + */ +#define DDSCAPS2_RESERVED4 0x00000002L +#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000000L + +/* + * Indicates to the driver that this surface will be locked very frequently + * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap + * set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_HINTDYNAMIC 0x00000004L + +/* + * Indicates to the driver that this surface can be re-ordered/retiled on + * load. This operation will not change the size of the texture. It is + * relatively fast and symmetrical, since the application may lock these + * bits (although it will take a performance hit when doing so). Surfaces + * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be + * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_HINTSTATIC 0x00000008L + +/* + * Indicates that the client would like this texture surface to be managed by the + * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have + * DDSCAPS_TEXTURE set. + */ +#define DDSCAPS2_TEXTUREMANAGE 0x00000010L + +/* + * These bits are reserved for internal use */ +#define DDSCAPS2_RESERVED1 0x00000020L +#define DDSCAPS2_RESERVED2 0x00000040L + +/* + * Indicates to the driver that this surface will never be locked again. + * The driver is free to optimize this surface via retiling and actual compression. + * All calls to Lock() or Blts from this surface will fail. Surfaces with this + * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC. + */ +#define DDSCAPS2_OPAQUE 0x00000080L + +/* + * Applications should set this bit at CreateSurface time to indicate that they + * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set. + */ +#define DDSCAPS2_HINTANTIALIASING 0x00000100L + + +/* + * This flag is used at CreateSurface time to indicate that this set of + * surfaces is a cubic environment map + */ +#define DDSCAPS2_CUBEMAP 0x00000200L + +/* + * These flags preform two functions: + * - At CreateSurface time, they define which of the six cube faces are + * required by the application. + * - After creation, each face in the cubemap will have exactly one of these + * bits set. + */ +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400L +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800L +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000L +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000L +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000L +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000L + +/* + * This macro may be used to specify all faces of a cube map at CreateSurface time + */ +#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ + DDSCAPS2_CUBEMAP_NEGATIVEX |\ + DDSCAPS2_CUBEMAP_POSITIVEY |\ + DDSCAPS2_CUBEMAP_NEGATIVEY |\ + DDSCAPS2_CUBEMAP_POSITIVEZ |\ + DDSCAPS2_CUBEMAP_NEGATIVEZ ) + + +/* + * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards + * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface + * constructs such as Cube Maps, wherein there are more than one mipmap surface attached + * to the root surface. + * This caps bit is ignored by CreateSurface + */ +#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000L + +/* This flag indicates that the texture should be managed by D3D only */ +#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000L + +/* This flag indicates that the managed surface can be safely lost */ +#define DDSCAPS2_DONOTPERSIST 0x00040000L + +/* indicates that this surface is part of a stereo flipping chain */ +#define DDSCAPS2_STEREOSURFACELEFT 0x00080000L + + +/* + * Indicates that the surface is a volume. + * Can be combined with DDSCAPS_MIPMAP to indicate a multi-level volume + */ +#define DDSCAPS2_VOLUME 0x00200000L + +/* + * Indicates that the surface may be locked multiple times by the application. + * This cap cannot be used with DDSCAPS2_OPAQUE. + */ +#define DDSCAPS2_NOTUSERLOCKABLE 0x00400000L + +/* + * Indicates that the vertex buffer data can be used to render points and + * point sprites. + */ +#define DDSCAPS2_POINTS 0x00800000L + +/* + * Indicates that the vertex buffer data can be used to render rt pactches. + */ +#define DDSCAPS2_RTPATCHES 0x01000000L + +/* + * Indicates that the vertex buffer data can be used to render n patches. + */ +#define DDSCAPS2_NPATCHES 0x02000000L + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS2_RESERVED3 0x04000000L + + +/* + * Indicates that the contents of the backbuffer do not have to be preserved + * the contents of the backbuffer after they are presented. + */ +#define DDSCAPS2_DISCARDBACKBUFFER 0x10000000L + +/* + * Indicates that all surfaces in this creation chain should be given an alpha channel. + * This flag will be set on primary surface chains that may have no explicit pixel format + * (and thus take on the format of the current display mode). + * The driver should infer that all these surfaces have a format having an alpha channel. + * (e.g. assume D3DFMT_A8R8G8B8 if the display mode is x888.) + */ +#define DDSCAPS2_ENABLEALPHACHANNEL 0x20000000L + +/* + * Indicates that all surfaces in this creation chain is extended primary surface format. + * This flag will be set on extended primary surface chains that always have explicit pixel + * format and the pixel format is typically GDI (Graphics Device Interface) couldn't handle, + * thus only used with fullscreen application. (e.g. D3DFMT_A2R10G10B10 format) + */ +#define DDSCAPS2_EXTENDEDFORMATPRIMARY 0x40000000L + +/* + * Indicates that all surfaces in this creation chain is additional primary surface. + * This flag will be set on primary surface chains which must present on the adapter + * id provided on dwCaps4. Typically this will be used to create secondary primary surface + * on DualView display adapter. + */ +#define DDSCAPS2_ADDITIONALPRIMARY 0x80000000L + +/* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate number of samples per pixel + * when multisampling + */ +#define DDSCAPS3_MULTISAMPLE_MASK 0x0000001FL + +/* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate the quality level of rendering + * for the current number of samples per pixel + */ +#define DDSCAPS3_MULTISAMPLE_QUALITY_MASK 0x000000E0L +#define DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT 5 + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS3_RESERVED1 0x00000100L + +/* + * This bit is reserved for internal use + */ +#define DDSCAPS3_RESERVED2 0x00000200L + +/* + * This indicates whether this surface has light-weight miplevels + */ +#define DDSCAPS3_LIGHTWEIGHTMIPMAP 0x00000400L + +/* + * This indicates that the mipsublevels for this surface are auto-generated + */ +#define DDSCAPS3_AUTOGENMIPMAP 0x00000800L + +/* + * This indicates that the mipsublevels for this surface are auto-generated + */ +#define DDSCAPS3_DMAP 0x00001000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* + * This indicates that this surface is to be shared by processes + */ +#define DDSCAPS3_CREATESHAREDRESOURCE 0x00002000L + +/* + * This indicates that this surface need to be initialized before being + * shared, this bit implies that this surface is read only after initialization + * absence of this bit implies that this surface allows both read and write + */ +#define DDSCAPS3_READONLYRESOURCE 0x00004000L + +/* + * This indicates that this surface is to share an existing video memory with + * another surface created with DDSCAPS3_CREATESHAREDRESOURCE, This bit is never + * used with DDSCAPS3_CREATESHAREDRESOURCE + */ +#define DDSCAPS3_OPENSHAREDRESOURCE 0x00008000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + + /**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Display hardware has 3D acceleration. + */ +#define DDCAPS_3D 0x00000001l + +/* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZEDEST 0x00000004l +/* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZESRC 0x00000010l + +/* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + */ +#define DDCAPS_ALIGNSTRIDE 0x00000020l + +/* + * Display hardware is capable of blt operations. + */ +#define DDCAPS_BLT 0x00000040l + +/* + * Display hardware is capable of asynchronous blt operations. + */ +#define DDCAPS_BLTQUEUE 0x00000080l + +/* + * Display hardware is capable of color space conversions during the blt operation. + */ +#define DDCAPS_BLTFOURCC 0x00000100l + +/* + * Display hardware is capable of stretching during blt operations. + */ +#define DDCAPS_BLTSTRETCH 0x00000200l + +/* + * Display hardware is shared with GDI. + */ +#define DDCAPS_GDI 0x00000400l + +/* + * Display hardware can overlay. + */ +#define DDCAPS_OVERLAY 0x00000800l + +/* + * Set if display hardware supports overlays but can not clip them. + */ +#define DDCAPS_OVERLAYCANTCLIP 0x00001000l + +/* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + */ +#define DDCAPS_OVERLAYFOURCC 0x00002000l + +/* + * Indicates that stretching can be done by the overlay hardware. + */ +#define DDCAPS_OVERLAYSTRETCH 0x00004000l + +/* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + */ +#define DDCAPS_PALETTE 0x00008000l + +/* + * Indicates that palette changes can be syncd with the veritcal refresh. + */ +#define DDCAPS_PALETTEVSYNC 0x00010000l + +/* + * Display hardware can return the current scan line. + */ +#define DDCAPS_READSCANLINE 0x00020000l + + +/* + * This flag used to bo DDCAPS_STEREOVIEW, which is now obsolete + */ +#define DDCAPS_RESERVED1 0x00040000l + +/* + * Display hardware is capable of generating a vertical blank interrupt. + */ +#define DDCAPS_VBI 0x00080000l + +/* + * Supports the use of z buffers with blt operations. + */ +#define DDCAPS_ZBLTS 0x00100000l + +/* + * Supports Z Ordering of overlays. + */ +#define DDCAPS_ZOVERLAYS 0x00200000l + +/* + * Supports color key + */ +#define DDCAPS_COLORKEY 0x00400000l + +/* + * Supports alpha surfaces + */ +#define DDCAPS_ALPHA 0x00800000l + +/* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + */ +#define DDCAPS_COLORKEYHWASSIST 0x01000000l + +/* + * no hardware support at all + */ +#define DDCAPS_NOHARDWARE 0x02000000l + +/* + * Display hardware is capable of color fill with bltter + */ +#define DDCAPS_BLTCOLORFILL 0x04000000l + +/* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + */ +#define DDCAPS_BANKSWITCHED 0x08000000l + +/* + * Display hardware is capable of depth filling Z-buffers with bltter + */ +#define DDCAPS_BLTDEPTHFILL 0x10000000l + +/* + * Display hardware is capable of clipping while bltting. + */ +#define DDCAPS_CANCLIP 0x20000000l + +/* + * Display hardware is capable of clipping while stretch bltting. + */ +#define DDCAPS_CANCLIPSTRETCHED 0x40000000l + +/* + * Display hardware is capable of bltting to or from system memory + */ +#define DDCAPS_CANBLTSYSMEM 0x80000000l + + + /**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************/ + +/* + * Display hardware is certified + */ +#define DDCAPS2_CERTIFIED 0x00000001l + +/* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + */ +#define DDCAPS2_NO2DDURING3DSCENE 0x00000002l + +/* + * Display hardware contains a video port + */ +#define DDCAPS2_VIDEOPORT 0x00000004l + +/* + * The overlay can be automatically flipped according to the video port + * VSYNCs, providing automatic doubled buffered display of video port + * data using an overlay + */ +#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008l + +/* + * Overlay can display each field of interlaced data individually while + * it is interleaved in memory without causing jittery artifacts. + */ +#define DDCAPS2_CANBOBINTERLEAVED 0x00000010l + +/* + * Overlay can display each field of interlaced data individually while + * it is not interleaved in memory without causing jittery artifacts. + */ +#define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020l + +/* + * The overlay surface contains color controls (brightness, sharpness, etc.) + */ +#define DDCAPS2_COLORCONTROLOVERLAY 0x00000040l + +/* + * The primary surface contains color controls (gamma, etc.) + */ +#define DDCAPS2_COLORCONTROLPRIMARY 0x00000080l + +/* + * RGBZ -> RGB supported for 16:16 RGB:Z + */ +#define DDCAPS2_CANDROPZ16BIT 0x00000100l + +/* + * Driver supports non-local video memory. + */ +#define DDCAPS2_NONLOCALVIDMEM 0x00000200l + +/* + * Dirver supports non-local video memory but has different capabilities for + * non-local video memory surfaces. If this bit is set then so must + * DDCAPS2_NONLOCALVIDMEM. + */ +#define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400l + +/* + * Driver neither requires nor prefers surfaces to be pagelocked when performing + * blts involving system memory surfaces + */ +#define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800l + +/* + * Driver can create surfaces which are wider than the primary surface + */ +#define DDCAPS2_WIDESURFACES 0x00001000l + +/* + * Driver supports bob without using a video port by handling the + * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip. + */ +#define DDCAPS2_CANFLIPODDEVEN 0x00002000l + +/* + * Driver supports bob using hardware + */ +#define DDCAPS2_CANBOBHARDWARE 0x00004000l + +/* + * Driver supports bltting any FOURCC surface to another surface of the same FOURCC + */ +#define DDCAPS2_COPYFOURCC 0x00008000l + + +/* + * Driver supports loadable gamma ramps for the primary surface + */ +#define DDCAPS2_PRIMARYGAMMA 0x00020000l + +/* + * Driver can render in windowed mode. + */ +#define DDCAPS2_CANRENDERWINDOWED 0x00080000l + +/* + * A calibrator is available to adjust the gamma ramp according to the + * physical display properties so that the result will be identical on + * all calibrated systems. + */ +#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000l + +/* + * Indicates that the driver will respond to DDFLIP_INTERVALn flags + */ +#define DDCAPS2_FLIPINTERVAL 0x00200000l + +/* + * Indicates that the driver will respond to DDFLIP_NOVSYNC + */ +#define DDCAPS2_FLIPNOVSYNC 0x00400000l + +/* + * Driver supports management of video memory, if this flag is ON, + * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + */ +#define DDCAPS2_CANMANAGETEXTURE 0x00800000l + +/* + * The Direct3D texture manager uses this cap to decide whether to put managed + * surfaces in non-local video memory. If the cap is set, the texture manager will + * put managed surfaces in non-local vidmem. Drivers that cannot texture from + * local vidmem SHOULD NOT set this cap. + */ +#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000l + +/* + * Indicates that the driver supports DX7 type of stereo in at least one mode (which may + * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher) + * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of + * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application + * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode. + */ +#define DDCAPS2_STEREO 0x02000000L + +/* + * This caps bit is intended for internal DirectDraw use. + * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set. + * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and + * all the assoicated system memory blt caps must be correct). + * -It implies that the system->video blt caps in DDCAPS also apply to system to + * nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops + * members of DDCAPS (DDCORECAPS) are filled in correctly. + * -Any blt from system to nonlocal memory that matches these caps bits will + * be passed to the driver. + * + * NOTE: This is intended to enable the driver itself to do efficient reordering + * of textures. This is NOT meant to imply that hardware can write into AGP memory. + * This operation is not currently supported. + */ +#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000L + +/* + * was DDCAPS2_PUREHAL + */ +#define DDCAPS2_RESERVED1 0x08000000L + +/* + * Driver supports management of video memory, if this flag is ON, + * driver manages the resource if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the resource if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + */ +#define DDCAPS2_CANMANAGERESOURCE 0x10000000L + +/* + * Driver supports dynamic textures. This will allow the application to set + * D3DUSAGE_DYNAMIC (DDSCAPS2_HINTDYNAMIC for drivers) at texture create time. + * Video memory dynamic textures WILL be lockable by applications. It is + * expected that these locks will be very efficient (which implies that the + * driver should always maintain a linear copy, a pointer to which can be + * quickly handed out to the application). + */ +#define DDCAPS2_DYNAMICTEXTURES 0x20000000L + +/* + * Driver supports auto-generation of mipmaps. + */ +#define DDCAPS2_CANAUTOGENMIPMAP 0x40000000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* + * Driver supports sharing of cross process resouces + */ +#define DDCAPS2_CANSHARERESOURCE 0x80000000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +/**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010l + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200l + +#if DIRECTDRAW_VERSION < 0x0600 +#endif //DIRECTDRAW_VERSION + + +/**************************************************************************** + * + * DIRECTDRAW FX CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Uses arithmetic operations to stretch and shrink surfaces during blt + * rather than pixel doubling techniques. Along the Y axis. + */ +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020l + +/* + * Uses arithmetic operations to stretch during blt + * rather than pixel doubling techniques. Along the Y axis. Only + * works for x1, x2, etc. + */ +#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010l + +/* + * Supports mirroring left to right in blt. + */ +#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040l + +/* + * Supports mirroring top to bottom in blt. + */ +#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080l + +/* + * Supports arbitrary rotation for blts. + */ +#define DDFXCAPS_BLTROTATION 0x00000100l + +/* + * Supports 90 degree rotations for blts. + */ +#define DDFXCAPS_BLTROTATION90 0x00000200l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKX 0x00000400l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKXN 0x00000800l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKY 0x00001000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKYN 0x00002000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHX 0x00004000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHXN 0x00008000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHY 0x00010000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHYN 0x00020000l + +/* + * Uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000l + +/* + * Uses arithmetic operations to stretch surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. Only works for x1, x2, etc. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKX 0x00080000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKY 0x00200000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000l + +/* + * DirectDraw supports mirroring of overlays across the vertical axis + */ +#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000l + +/* + * DirectDraw supports mirroring of overlays across the horizontal axis + */ +#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000l + +/* + * DirectDraw supports deinterlacing of overlay surfaces + */ +#define DDFXCAPS_OVERLAYDEINTERLACE 0x20000000l + +/* + * Driver can do alpha blending for blits. + */ +#define DDFXCAPS_BLTALPHA 0x00000001l + + +/* + * Driver can do surface-reconstruction filtering for warped blits. + */ +#define DDFXCAPS_BLTFILTER DDFXCAPS_BLTARITHSTRETCHY + +/* + * Driver can do alpha blending for overlays. + */ +#define DDFXCAPS_OVERLAYALPHA 0x00000004l + + +/* + * Driver can do surface-reconstruction filtering for warped overlays. + */ +#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY + +/**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************/ + +/* + * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete + */ + +#define DDSVCAPS_RESERVED1 0x00000001l + +/* + * This flag used to be DDSVCAPS_FLICKER, which is now obsolete + */ +#define DDSVCAPS_RESERVED2 0x00000002l + +/* + * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete + */ +#define DDSVCAPS_RESERVED3 0x00000004l + +/* + * This flag used to be DDSVCAPS_SPLIT, which is now obsolete + */ +#define DDSVCAPS_RESERVED4 0x00000008l + +/* + * The stereo view is accomplished with switching technology + */ + +#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010L + + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************/ + +/* + * Index is 4 bits. There are sixteen color entries in the palette table. + */ +#define DDPCAPS_4BIT 0x00000001l + +/* + * Index is onto a 8 bit color index. This field is only valid with the + * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target + * surface is in 8bpp. Each color entry is one byte long and is an index + * into destination surface's 8bpp palette. + */ +#define DDPCAPS_8BITENTRIES 0x00000002l + +/* + * Index is 8 bits. There are 256 color entries in the palette table. + */ +#define DDPCAPS_8BIT 0x00000004l + +/* + * Indicates that this DIRECTDRAWPALETTE should use the palette color array + * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE + * object. + * This flag is obsolete. DirectDraw always initializes the color array from + * the lpDDColorArray parameter. The definition remains for source-level + * compatibility. + */ +#define DDPCAPS_INITIALIZE 0x00000000l + +/* + * This palette is the one attached to the primary surface. Changing this + * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified + * and supported. + */ +#define DDPCAPS_PRIMARYSURFACE 0x00000010l + +/* + * This palette is the one attached to the primary surface left. Changing + * this table has immediate effect on the display for the left eye unless + * DDPSETPAL_VSYNC is specified and supported. + */ +#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020l + +/* + * This palette can have all 256 entries defined + */ +#define DDPCAPS_ALLOW256 0x00000040l + +/* + * This palette can have modifications to it synced with the monitors + * refresh rate. + */ +#define DDPCAPS_VSYNC 0x00000080l + +/* + * Index is 1 bit. There are two color entries in the palette table. + */ +#define DDPCAPS_1BIT 0x00000100l + +/* + * Index is 2 bit. There are four color entries in the palette table. + */ +#define DDPCAPS_2BIT 0x00000200l + +/* + * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value + */ +#define DDPCAPS_ALPHA 0x00000400l + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE SETENTRY CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE GETENTRY CONSTANTS + * + ****************************************************************************/ + +/* 0 is the only legal value */ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETPRIVATEDATA CONSTANTS + * + ****************************************************************************/ + +/* + * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData + * must be set to sizeof(IUnknown*). DirectDraw will call AddRef through this + * pointer and Release when the private data is destroyed. This includes when + * the surface or palette is destroyed before such priovate data is destroyed. + */ +#define DDSPD_IUNKNOWNPOINTER 0x00000001L + +/* + * Private data is only valid for the current state of the object, + * as determined by the uniqueness value. + */ +#define DDSPD_VOLATILE 0x00000002L + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETPALETTE CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAW BITDEPTH CONSTANTS + * + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The + * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual + * bit depths in a surface or for changing the display mode. + * + ****************************************************************************/ + +/* + * 1 bit per pixel. + */ +#define DDBD_1 0x00004000l + +/* + * 2 bits per pixel. + */ +#define DDBD_2 0x00002000l + +/* + * 4 bits per pixel. + */ +#define DDBD_4 0x00001000l + +/* + * 8 bits per pixel. + */ +#define DDBD_8 0x00000800l + +/* + * 16 bits per pixel. + */ +#define DDBD_16 0x00000400l + +/* + * 24 bits per pixel. + */ +#define DDBD_24 0X00000200l + +/* + * 32 bits per pixel. + */ +#define DDBD_32 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS + * + ****************************************************************************/ + +/* + * Set if the structure contains a color space. Not set if the structure + * contains a single color key. + */ +#define DDCKEY_COLORSPACE 0x00000001l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for blt operations. + */ +#define DDCKEY_DESTBLT 0x00000002l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for overlay operations. + */ +#define DDCKEY_DESTOVERLAY 0x00000004l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for blt operations. + */ +#define DDCKEY_SRCBLT 0x00000008l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for overlay operations. + */ +#define DDCKEY_SRCOVERLAY 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW COLOR KEY CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLT 0x00000001l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004l + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTYUV 0x00000008l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAY 0x00000010l + +/* + * Supports a color space as the color key for the destination for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020l + +/* + * Supports a color space as the color key for the destination for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040l + +/* + * Supports only one active destination color key value for visible overlay + * surfaces. + */ +#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100l + +/* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLT 0x00000200l + +/* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400l + +/* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800l + +/* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTYUV 0x00001000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAY 0x00002000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000l + +/* + * Supports only one active source color key value for visible + * overlay surfaces. + */ +#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000l + +/* + * there are no bandwidth trade-offs for using colorkey with an overlay + */ +#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000l + + +/**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************/ + +/* + * The surface has alpha channel information in the pixel format. + */ +#define DDPF_ALPHAPIXELS 0x00000001l + +/* + * The pixel format contains alpha only information + */ +#define DDPF_ALPHA 0x00000002l + +/* + * The FourCC code is valid. + */ +#define DDPF_FOURCC 0x00000004l + +/* + * The surface is 4-bit color indexed. + */ +#define DDPF_PALETTEINDEXED4 0x00000008l + +/* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + */ +#define DDPF_PALETTEINDEXEDTO8 0x00000010l + +/* + * The surface is 8-bit color indexed. + */ +#define DDPF_PALETTEINDEXED8 0x00000020l + +/* + * The RGB data in the pixel format structure is valid. + */ +#define DDPF_RGB 0x00000040l + +/* + * The surface will accept pixel data in the format specified + * and compress it during the write. + */ +#define DDPF_COMPRESSED 0x00000080l + +/* + * The surface will accept RGB data and translate it during + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB + * flag will be set. + */ +#define DDPF_RGBTOYUV 0x00000100l + +/* + * pixel format is YUV - YUV data in pixel format struct is valid + */ +#define DDPF_YUV 0x00000200l + +/* + * pixel format is a z buffer only surface + */ +#define DDPF_ZBUFFER 0x00000400l + +/* + * The surface is 1-bit color indexed. + */ +#define DDPF_PALETTEINDEXED1 0x00000800l + +/* + * The surface is 2-bit color indexed. + */ +#define DDPF_PALETTEINDEXED2 0x00001000l + +/* + * The surface contains Z information in the pixels + */ +#define DDPF_ZPIXELS 0x00002000l + +/* + * The surface contains stencil information along with Z + */ +#define DDPF_STENCILBUFFER 0x00004000l + +/* + * Premultiplied alpha format -- the color components have been + * premultiplied by the alpha component. + */ +#define DDPF_ALPHAPREMULT 0x00008000l + + +/* + * Luminance data in the pixel format is valid. + * Use this flag for luminance-only or luminance+alpha surfaces, + * the bit depth is then ddpf.dwLuminanceBitCount. + */ +#define DDPF_LUMINANCE 0x00020000l + +/* + * Luminance data in the pixel format is valid. + * Use this flag when hanging luminance off bumpmap surfaces, + * the bit mask for the luminance portion of the pixel is then + * ddpf.dwBumpLuminanceBitMask + */ +#define DDPF_BUMPLUMINANCE 0x00040000l + +/* + * Bump map dUdV data in the pixel format is valid. + */ +#define DDPF_BUMPDUDV 0x00080000l + + +/*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate all of the surfaces that meet the search criterion. + */ +#define DDENUMSURFACES_ALL 0x00000001l + +/* + * A search hit is a surface that matches the surface description. + */ +#define DDENUMSURFACES_MATCH 0x00000002l + +/* + * A search hit is a surface that does not match the surface description. + */ +#define DDENUMSURFACES_NOMATCH 0x00000004l + +/* + * Enumerate the first surface that can be created which meets the search criterion. + */ +#define DDENUMSURFACES_CANBECREATED 0x00000008l + +/* + * Enumerate the surfaces that already exist that meet the search criterion. + */ +#define DDENUMSURFACES_DOESEXIST 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW SETDISPLAYMODE FLAGS + * + ****************************************************************************/ + +/* + * The desired mode is a standard VGA mode + */ +#define DDSDM_STANDARDVGAMODE 0x00000001l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMDISPLAYMODES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether + * the refresh rate is taken into account when determining if a mode is unique. + */ +#define DDEDM_REFRESHRATES 0x00000001l + +/* + * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA + * modes such as mode 0x13 in addition to the usual ModeX modes (which are always + * enumerated if the application has previously called SetCooperativeLevel with the + * DDSCL_ALLOWMODEX flag set). + */ +#define DDEDM_STANDARDVGAMODES 0x00000002L + + +/**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************/ + +/* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + */ +#define DDSCL_FULLSCREEN 0x00000001l + +/* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + */ +#define DDSCL_ALLOWREBOOT 0x00000002l + +/* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + */ +#define DDSCL_NOWINDOWCHANGES 0x00000004l + +/* + * app wants to work as a regular Windows application + */ +#define DDSCL_NORMAL 0x00000008l + +/* + * app wants exclusive access + */ +#define DDSCL_EXCLUSIVE 0x00000010l + + +/* + * app can deal with non-windows display modes + */ +#define DDSCL_ALLOWMODEX 0x00000040l + +/* + * this window will receive the focus messages + */ +#define DDSCL_SETFOCUSWINDOW 0x00000080l + +/* + * this window is associated with the DDRAW object and will + * cover the screen in fullscreen mode + */ +#define DDSCL_SETDEVICEWINDOW 0x00000100l + +/* + * app wants DDRAW to create a window to be associated with the + * DDRAW object + */ +#define DDSCL_CREATEDEVICEWINDOW 0x00000200l + +/* + * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D + * take the global crtisec more frequently. + */ +#define DDSCL_MULTITHREADED 0x00000400l + +/* + * App specifies that it would like to keep the FPU set up for optimal Direct3D + * performance (single precision and exceptions disabled) so Direct3D + * does not need to explicitly set the FPU each time. This is assumed by + * default in DirectX 7. See also DDSCL_FPUPRESERVE + */ +#define DDSCL_FPUSETUP 0x00000800l + +/* + * App specifies that it needs either double precision FPU or FPU exceptions + * enabled. This makes Direct3D explicitly set the FPU state eah time it is + * called. Setting the flag will reduce Direct3D performance. The flag is + * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP + */ +#define DDSCL_FPUPRESERVE 0x00001000l + + +/**************************************************************************** + * + * DIRECTDRAW BLT FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + */ +#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + */ +#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel + * for the edges of the image that border the color key colors. + */ +#define DDBLT_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Do this blt asynchronously through the FIFO in the order received. If + * there is no room in the hardware FIFO fail the call. + */ +#define DDBLT_ASYNC 0x00000200l + +/* + * Uses the dwFillColor field in the DDBLTFX structure as the RGB color + * to fill the destination rectangle on the destination surface with. + */ +#define DDBLT_COLORFILL 0x00000400l + +/* + * Uses the dwDDFX field in the DDBLTFX structure to specify the effects + * to use for the blt. + */ +#define DDBLT_DDFX 0x00000800l + +/* + * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS + * that are not part of the Win32 API. + */ +#define DDBLT_DDROPS 0x00001000l + +/* + * Use the color key associated with the destination surface. + */ +#define DDBLT_KEYDEST 0x00002000l + +/* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + */ +#define DDBLT_KEYDESTOVERRIDE 0x00004000l + +/* + * Use the color key associated with the source surface. + */ +#define DDBLT_KEYSRC 0x00008000l + +/* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + */ +#define DDBLT_KEYSRCOVERRIDE 0x00010000l + +/* + * Use the dwROP field in the DDBLTFX structure for the raster operation + * for this blt. These ROPs are the same as the ones defined in the Win32 API. + */ +#define DDBLT_ROP 0x00020000l + +/* + * Use the dwRotationAngle field in the DDBLTFX structure as the angle + * (specified in 1/100th of a degree) to rotate the surface. + */ +#define DDBLT_ROTATIONANGLE 0x00040000l + +/* + * Z-buffered blt using the z-buffers attached to the source and destination + * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the + * z-buffer opcode. + */ +#define DDBLT_ZBUFFER 0x00080000l + +/* + * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the destination. + */ +#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000l + +/* + * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the destination. + */ +#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000l + +/* + * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the source. + */ +#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000l + +/* + * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the source. + */ +#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000l + +/* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + */ +#define DDBLT_WAIT 0x01000000l + +/* + * Uses the dwFillDepth field in the DDBLTFX structure as the depth value + * to fill the destination rectangle on the destination Z-buffer surface + * with. + */ +#define DDBLT_DEPTHFILL 0x02000000l + + +/* + * Return immediately (with DDERR_WASSTILLDRAWING) if the device is not + * ready to schedule the blt at the time Blt() is called. + */ +#define DDBLT_DONOTWAIT 0x08000000l + +/* + * These flags indicate a presentation blt (i.e. a blt + * that moves surface contents from an offscreen back buffer to the primary + * surface). The driver is not allowed to "queue" more than three such blts. + * The "end" of the presentation blt is indicated, since the + * blt may be clipped, in which case the runtime will call the driver with + * several blts. All blts (even if not clipped) are tagged with DDBLT_PRESENTATION + * and the last (even if not clipped) additionally with DDBLT_LAST_PRESENTATION. + * Thus the true rule is that the driver must not schedule a DDBLT_PRESENTATION + * blt if there are 3 or more DDBLT_PRESENTLAST blts in the hardware pipe. + * If there are such blts in the pipe, the driver should return DDERR_WASSTILLDRAWING + * until the oldest queued DDBLT_LAST_PRESENTATION blts has been retired (i.e. the + * pixels have been actually written to the primary surface). Once the oldest blt + * has been retired, the driver is free to schedule the current blt. + * The goal is to provide a mechanism whereby the device's hardware queue never + * gets more than 3 frames ahead of the frames being generated by the application. + * When excessive queueing occurs, applications become unusable because the application + * visibly lags user input, and such problems make windowed interactive applications impossible. + * Some drivers may not have sufficient knowledge of their hardware's FIFO to know + * when a certain blt has been retired. Such drivers should code cautiously, and + * simply not allow any frames to be queued at all. DDBLT_LAST_PRESENTATION should cause + * such drivers to return DDERR_WASSTILLDRAWING until the accelerator is completely + * finished- exactly as if the application had called Lock on the source surface + * before calling Blt. + * In other words, the driver is allowed and encouraged to + * generate as much latency as it can, but never more than 3 frames worth. + * Implementation detail: Drivers should count blts against the SOURCE surface, not + * against the primary surface. This enables multiple parallel windowed application + * to function more optimally. + * This flag is passed only to DX8 or higher drivers. + * + * APPLICATIONS DO NOT SET THESE FLAGS. THEY ARE SET BY THE DIRECTDRAW RUNTIME. + * + */ +#define DDBLT_PRESENTATION 0x10000000l +#define DDBLT_LAST_PRESENTATION 0x20000000l + +/* + * If DDBLT_EXTENDED_FLAGS is set, then the driver should re-interpret + * other flags according to the definitions that follow. + * For example, bit 0 (0x00000001L) means DDBLT_ALPHADEST, unless + * DDBLT_EXTENDED_FLAGS is also set, in which case bit 0 means + * DDBLT_EXTENDED_LINEAR_CONTENT. + * Only DirectX9 and higher drivers will be given extended blt flags. + * Only flags explicitly mentioned here should be re-interpreted. + * All other flags retain their original meanings. + * + * List of re-interpreted flags: + * + * Bit Hex value New meaning old meaning + * --------------------------------------------------------------- + * 2 0x00000004 DDBLT_EXTENDED_LINEAR_CONTENT DDBLT_ALPHADESTNEG + * 4 0x00000010 DDBLT_EXTENDED_PRESENTATION_STRETCHFACTOR DDBLT_ALPHAEDGEBLEND + * + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. + */ +#define DDBLT_EXTENDED_FLAGS 0x40000000l + +/* + * EXTENDED FLAG. SEE DEFINITION OF DDBLT_EXTENDED_FLAGS. + * This flag indidcates that the source surface contains content in a + * linear color space. The driver may perform gamma correction to the + * desktop color space (i.e. sRGB, gamma 2.2) as part of this blt. + * If the device can perform such a conversion as part of the copy, + * the driver should also set D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. Use IDirect3DSwapChain9::Present + * and specify D3DPRESENT_LINEAR_CONTENT in order to use this functionality. + */ +#define DDBLT_EXTENDED_LINEAR_CONTENT 0x00000004l + + +/**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************/ + +#define DDBLTFAST_NOCOLORKEY 0x00000000 +#define DDBLTFAST_SRCCOLORKEY 0x00000001 +#define DDBLTFAST_DESTCOLORKEY 0x00000002 +#define DDBLTFAST_WAIT 0x00000010 +#define DDBLTFAST_DONOTWAIT 0x00000020 + +/**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************/ + +#define DDFLIP_WAIT 0x00000001L + +/* + * Indicates that the target surface contains the even field of video data. + * This flag is only valid with an overlay surface. + */ +#define DDFLIP_EVEN 0x00000002L + +/* + * Indicates that the target surface contains the odd field of video data. + * This flag is only valid with an overlay surface. + */ +#define DDFLIP_ODD 0x00000004L + +/* + * Causes DirectDraw to perform the physical flip immediately and return + * to the application. Typically, what was the front buffer but is now the back + * buffer will still be visible (depending on timing) until the next vertical + * retrace. Subsequent operations involving the two flipped surfaces will + * not check to see if the physical flip has finished (i.e. will not return + * DDERR_WASSTILLDRAWING for that reason (but may for other reasons)). + * This allows an application to perform Flips at a higher frequency than the + * monitor refresh rate, but may introduce visible artifacts. + * Only effective if DDCAPS2_FLIPNOVSYNC is set. If that bit is not set, + * DDFLIP_NOVSYNC has no effect. + */ +#define DDFLIP_NOVSYNC 0x00000008L + + +/* + * Flip Interval Flags. These flags indicate how many vertical retraces to wait between + * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each + * surface involved in the flip until the specified number of vertical retraces has + * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set, + * DDFLIP_INTERVALn has no effect. + */ + +/* + * DirectDraw will flip on every other vertical sync + */ +#define DDFLIP_INTERVAL2 0x02000000L + + +/* + * DirectDraw will flip on every third vertical sync + */ +#define DDFLIP_INTERVAL3 0x03000000L + + +/* + * DirectDraw will flip on every fourth vertical sync + */ +#define DDFLIP_INTERVAL4 0x04000000L + +/* + * DirectDraw will flip and display a main stereo surface + */ +#define DDFLIP_STEREO 0x00000010L + +/* + * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT. + */ +#define DDFLIP_DONOTWAIT 0x00000020L + + +/**************************************************************************** + * + * DIRECTDRAW SURFACE OVERLAY FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for the + * destination overlay. + */ +#define DDOVER_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + */ +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + */ +#define DDOVER_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + */ +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha + * channel for the edges of the image that border the color key colors. + */ +#define DDOVER_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the source alpha channel for this overlay. + */ +#define DDOVER_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + */ +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + */ +#define DDOVER_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + */ +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Turn this overlay off. + */ +#define DDOVER_HIDE 0x00000200l + +/* + * Use the color key associated with the destination surface. + */ +#define DDOVER_KEYDEST 0x00000400l + +/* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + */ +#define DDOVER_KEYDESTOVERRIDE 0x00000800l + +/* + * Use the color key associated with the source surface. + */ +#define DDOVER_KEYSRC 0x00001000l + +/* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + */ +#define DDOVER_KEYSRCOVERRIDE 0x00002000l + +/* + * Turn this overlay on. + */ +#define DDOVER_SHOW 0x00004000l + +/* + * Add a dirty rect to an emulated overlayed surface. + */ +#define DDOVER_ADDDIRTYRECT 0x00008000l + +/* + * Redraw all dirty rects on an emulated overlayed surface. + */ +#define DDOVER_REFRESHDIRTYRECTS 0x00010000l + +/* + * Redraw the entire surface on an emulated overlayed surface. + */ +#define DDOVER_REFRESHALL 0x00020000l + + +/* + * Use the overlay FX flags to define special overlay FX + */ +#define DDOVER_DDFX 0x00080000l + +/* + * Autoflip the overlay when ever the video port autoflips + */ +#define DDOVER_AUTOFLIP 0x00100000l + +/* + * Display each field of video port data individually without + * causing any jittery artifacts + */ +#define DDOVER_BOB 0x00200000l + +/* + * Indicates that bob/weave decisions should not be overridden by other + * interfaces. + */ +#define DDOVER_OVERRIDEBOBWEAVE 0x00400000l + +/* + * Indicates that the surface memory is composed of interleaved fields. + */ +#define DDOVER_INTERLEAVED 0x00800000l + +/* + * Indicates that bob will be performed using hardware rather than + * software or emulated. + */ +#define DDOVER_BOBHARDWARE 0x01000000l + +/* + * Indicates that overlay FX structure contains valid ARGB scaling factors. + */ +#define DDOVER_ARGBSCALEFACTORS 0x02000000l + +/* + * Indicates that ARGB scaling factors can be degraded to fit driver capabilities. + */ +#define DDOVER_DEGRADEARGBSCALING 0x04000000l + + +#ifdef COMBOX_SANDBOX +#define DX_LONGHORN_PRESERVEDC +#endif + +#ifdef DX_LONGHORN_PRESERVEDC + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETSURFACEDESC FLAGS + * + ****************************************************************************/ + +/* + * The default. The GDI DC will be tore down. + */ +#define DDSETSURFACEDESC_RECREATEDC 0x00000000L // default + +/* + * The default. The GDI DC will be kept. + */ +#define DDSETSURFACEDESC_PRESERVEDC 0x00000001L + + +#endif // DX_LONGHORN_PRESERVEDC + +/**************************************************************************** + * + * DIRECTDRAWSURFACE LOCK FLAGS + * + ****************************************************************************/ + +/* + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a + * pointer to the top of the surface is returned. + */ +#define DDLOCK_SURFACEMEMORYPTR 0x00000000L // default + +/* + * Set to indicate that Lock should wait until it can obtain a valid memory + * pointer before returning. If this bit is set, Lock will never return + * DDERR_WASSTILLDRAWING. + */ +#define DDLOCK_WAIT 0x00000001L + +/* + * Set if an event handle is being passed to Lock. Lock will trigger the event + * when it can return the surface memory pointer requested. + */ +#define DDLOCK_EVENT 0x00000002L + +/* + * Indicates that the surface being locked will only be read from. + */ +#define DDLOCK_READONLY 0x00000010L + +/* + * Indicates that the surface being locked will only be written to + */ +#define DDLOCK_WRITEONLY 0x00000020L + + +/* + * Indicates that a system wide lock should not be taken when this surface + * is locked. This has several advantages (cursor responsiveness, ability + * to call more Windows functions, easier debugging) when locking video + * memory surfaces. However, an application specifying this flag must + * comply with a number of conditions documented in the help file. + * Furthermore, this flag cannot be specified when locking the primary. + */ +#define DDLOCK_NOSYSLOCK 0x00000800L + +/* + * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices + * that were referred to in Draw*PrimtiveVB calls since the start of the + * frame (or the last lock without this flag) will be modified during the + * lock. This can be useful when one is only appending data to the vertex + * buffer + */ +#define DDLOCK_NOOVERWRITE 0x00001000L + +/* + * Indicates that no assumptions will be made about the contents of the + * surface or vertex buffer during this lock. + * This enables two things: + * - Direct3D or the driver may provide an alternative memory + * area as the vertex buffer. This is useful when one plans to clear the + * contents of the vertex buffer and fill in new data. + * - Drivers sometimes store surface data in a re-ordered format. + * When the application locks the surface, the driver is forced to un-re-order + * the surface data before allowing the application to see the surface contents. + * This flag is a hint to the driver that it can skip the un-re-ordering process + * since the application plans to overwrite every single pixel in the surface + * or locked rectangle (and so erase any un-re-ordered pixels anyway). + * Applications should always set this flag when they intend to overwrite the entire + * surface or locked rectangle. + */ +#define DDLOCK_DISCARDCONTENTS 0x00002000L + /* + * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS + */ +#define DDLOCK_OKTOSWAP 0x00002000L + +/* + * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT. + */ +#define DDLOCK_DONOTWAIT 0x00004000L + +/* + * This indicates volume texture lock with front and back specified. + */ +#define DDLOCK_HASVOLUMETEXTUREBOXRECT 0x00008000L + +/* + * This indicates that the driver should not update dirty rect information for this lock. + */ +#define DDLOCK_NODIRTYUPDATE 0x00010000L + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGELOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE BLT FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this blt. + */ +#define DDBLTFX_ARITHSTRETCHY 0x00000001l + +/* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + */ +#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + */ +#define DDBLTFX_MIRRORUPDOWN 0x00000004l + +/* + * Schedule this blt to avoid tearing. + */ +#define DDBLTFX_NOTEARING 0x00000008l + +/* + * Do this blt rotating the surface one hundred and eighty degrees. + */ +#define DDBLTFX_ROTATE180 0x00000010l + +/* + * Do this blt rotating the surface two hundred and seventy degrees. + */ +#define DDBLTFX_ROTATE270 0x00000020l + +/* + * Do this blt rotating the surface ninety degrees. + */ +#define DDBLTFX_ROTATE90 0x00000040l + +/* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + */ +#define DDBLTFX_ZBUFFERRANGE 0x00000080l + +/* + * Do this z blt adding the dwZBufferBaseDest to each of the sources z values + * before comparing it with the desting z values. + */ +#define DDBLTFX_ZBUFFERBASEDEST 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + */ +#define DDOVERFX_ARITHSTRETCHY 0x00000001l + +/* + * Mirror the overlay across the vertical axis + */ +#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Mirror the overlay across the horizontal axis + */ +#define DDOVERFX_MIRRORUPDOWN 0x00000004l + +/* + * Deinterlace the overlay, if possible + */ +#define DDOVERFX_DEINTERLACE 0x00000008l + + +/**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************/ + +/* + * return when the vertical blank interval begins + */ +#define DDWAITVB_BLOCKBEGIN 0x00000001l + +/* + * set up an event to trigger when the vertical blank begins + */ +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002l + +/* + * return when the vertical blank interval ends and display begins + */ +#define DDWAITVB_BLOCKEND 0x00000004l + +/**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to flip now? + */ +#define DDGFS_CANFLIP 0x00000001l + +/* + * is the last flip finished? + */ +#define DDGFS_ISFLIPDONE 0x00000002l + +/**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to blt now? + */ +#define DDGBS_CANBLT 0x00000001l + +/* + * is the blt to the surface finished? + */ +#define DDGBS_ISBLTDONE 0x00000002l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Enumerate overlays back to front. + */ +#define DDENUMOVERLAYZ_BACKTOFRONT 0x00000000l + +/* + * Enumerate overlays front to back + */ +#define DDENUMOVERLAYZ_FRONTTOBACK 0x00000001l + +/**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Send overlay to front + */ +#define DDOVERZ_SENDTOFRONT 0x00000000l + +/* + * Send overlay to back + */ +#define DDOVERZ_SENDTOBACK 0x00000001l + +/* + * Move Overlay forward + */ +#define DDOVERZ_MOVEFORWARD 0x00000002l + +/* + * Move Overlay backward + */ +#define DDOVERZ_MOVEBACKWARD 0x00000003l + +/* + * Move Overlay in front of relative surface + */ +#define DDOVERZ_INSERTINFRONTOF 0x00000004l + +/* + * Move Overlay in back of relative surface + */ +#define DDOVERZ_INSERTINBACKOF 0x00000005l + + +/**************************************************************************** + * + * DIRECTDRAW SETGAMMARAMP FLAGS + * + ****************************************************************************/ + +/* + * Request calibrator to adjust the gamma ramp according to the physical + * properties of the display so that the result should appear identical + * on all systems. + */ +#define DDSGR_CALIBRATE 0x00000001L + + +/**************************************************************************** + * + * DIRECTDRAW STARTMODETEST FLAGS + * + ****************************************************************************/ + +/* + * Indicates that the mode being tested has passed + */ +#define DDSMT_ISTESTREQUIRED 0x00000001L + + +/**************************************************************************** + * + * DIRECTDRAW EVALUATEMODE FLAGS + * + ****************************************************************************/ + +/* + * Indicates that the mode being tested has passed + */ +#define DDEM_MODEPASSED 0x00000001L + +/* + * Indicates that the mode being tested has failed + */ +#define DDEM_MODEFAILED 0x00000002L + + +/*=========================================================================== + * + * + * DIRECTDRAW RETURN CODES + * + * The return values from DirectDraw Commands and Surface that return an HRESULT + * are codes from DirectDraw concerning the results of the action + * requested by DirectDraw. + * + *==========================================================================*/ + +/* + * Status is OK + * + * Issued by: DirectDraw Commands and all callbacks + */ +#define DD_OK S_OK +#define DD_FALSE S_FALSE + +/**************************************************************************** + * + * DIRECTDRAW ENUMCALLBACK RETURN VALUES + * + * EnumCallback returns are used to control the flow of the DIRECTDRAW and + * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * enumeration callback routines. + * + ****************************************************************************/ + +/* + * stop the enumeration + */ +#define DDENUMRET_CANCEL 0 + +/* + * continue the enumeration + */ +#define DDENUMRET_OK 1 + +/**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +/* + * This object is already initialized + */ +#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) + +/* + * This surface can not be attached to the requested surface. + */ +#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) + +/* + * This surface can not be detached from the requested surface. + */ +#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) + +/* + * Support is currently not available. + */ +#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) + +/* + * An exception was encountered while performing the requested operation + */ +#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) + +/* + * Generic failure. + */ +#define DDERR_GENERIC E_FAIL + +/* + * Height of rectangle provided is not a multiple of reqd alignment + */ +#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) + +/* + * Unable to match primary surface creation request with existing + * primary surface. + */ +#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) + +/* + * One or more of the caps bits passed to the callback are incorrect. + */ +#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) + +/* + * DirectDraw does not support provided Cliplist. + */ +#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) + +/* + * DirectDraw does not support the requested mode + */ +#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) + +/* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + */ +#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) + +/* + * One or more of the parameters passed to the callback function are + * incorrect. + */ +#define DDERR_INVALIDPARAMS E_INVALIDARG + +/* + * pixel format was invalid as specified + */ +#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) + +/* + * Rectangle provided was invalid. + */ +#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) + +/* + * Operation could not be carried out because one or more surfaces are locked + */ +#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) + +/* + * There is no 3D present. + */ +#define DDERR_NO3D MAKE_DDHRESULT( 170 ) + +/* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + */ +#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) + +/* + * Operation could not be carried out because there is no stereo + * hardware present or available. + */ +#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) + +/* + * Operation could not be carried out because there is no hardware + * present which supports stereo surfaces + */ +#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) + + + +/* + * no clip list available + */ +#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) + +/* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + */ +#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) + +/* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + */ +#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) + +/* + * Surface doesn't currently have a color key + */ +#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) + +/* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + */ +#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) + +/* + * No DirectDraw support possible with current display driver + */ +#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) + +/* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + */ +#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) + +/* + * Flipping visible surfaces is not supported. + */ +#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) + +/* + * There is no GDI present. + */ +#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) + +/* + * Operation could not be carried out because there is no hardware present + * or available. + */ +#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) + +/* + * Requested item was not found + */ +#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) + +/* + * Operation could not be carried out because there is no overlay hardware + * present or available. + */ +#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) + +/* + * Operation could not be carried out because the source and destination + * rectangles are on the same surface and overlap each other. + */ +#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) + +/* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + */ +#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) + +/* + * Operation could not be carried out because there is no rotation hardware + * present or available. + */ +#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) + +/* + * Operation could not be carried out because there is no hardware support + * for stretching + */ +#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) + +/* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + */ +#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) + +/* + * DirectDrawSurface is not in 4 bit color index palette and the requested + * operation requires 4 bit color index palette. + */ +#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) + +/* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + */ +#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) + +/* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + */ +#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) + +/* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + */ +#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) + +/* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + */ +#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) + +/* + * Overlay surfaces could not be z layered based on their BltOrder because + * the hardware does not support z layering of overlays. + */ +#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) + +/* + * The hardware needed for the requested operation has already been + * allocated. + */ +#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) + +/* + * hardware does not support clipped overlays + */ +#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) + +/* + * Can only have ony color key active at one time for overlays + */ +#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) + +/* + * Access to this palette is being refused because the palette is already + * locked by another thread. + */ +#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) + +/* + * No src color key specified for this operation. + */ +#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) + +/* + * This surface is already attached to the surface it is being attached to. + */ +#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) + +/* + * This surface is already a dependency of the surface it is being made a + * dependency of. + */ +#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) + +/* + * Access to this surface is being refused because the surface is already + * locked by another thread. + */ +#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) + +/* + * Access to this surface is being refused because no driver exists + * which can supply a pointer to the surface. + * This is most likely to happen when attempting to lock the primary + * surface when no DCI provider is present. + * Will also happen on attempts to lock an optimized surface. + */ +#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) + +/* + * Access to Surface refused because Surface is obscured. + */ +#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) + +/* + * Access to this surface is being refused because the surface is gone. + * The DIRECTDRAWSURFACE object representing this surface should + * have Restore called on it. + */ +#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) + +/* + * The requested surface is not attached. + */ +#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) + +/* + * Height requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) + +/* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + */ +#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) + +/* + * Width requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) + +/* + * Action not supported. + */ +#define DDERR_UNSUPPORTED E_NOTIMPL + +/* + * Pixel format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) + +/* + * Bitmask in the pixel format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) + +/* + * The specified stream contains invalid data + */ +#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) + +/* + * vertical blank is in progress + */ +#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) + +/* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + */ +#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) + + +/* + * The specified surface type requires specification of the COMPLEX flag + */ +#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) + + +/* + * Rectangle provided was not horizontally aligned on reqd. boundary + */ +#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) + +/* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + */ +#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) + +/* + * A DirectDraw object representing this driver has already been created + * for this process. + */ +#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) + +/* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + */ +#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) + +/* + * this process already has created a primary surface + */ +#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) + +/* + * software emulation not available. + */ +#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) + +/* + * region passed to Clipper::GetClipList is too small. + */ +#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) + +/* + * an attempt was made to set a clip list for a clipper objec that + * is already monitoring an hwnd. + */ +#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) + +/* + * No clipper object attached to surface object + */ +#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) + +/* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + */ +#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) + +/* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + */ +#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) + +/* + * The CooperativeLevel HWND has already been set. + * It can not be reset while the process has surfaces or palettes created. + */ +#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) + +/* + * No palette object attached to this surface. + */ +#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) + +/* + * No hardware support for 16 or 256 color palettes. + */ +#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) + +/* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + */ +#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) + +/* + * No blter. + */ +#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) + +/* + * No DirectDraw ROP hardware. + */ +#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) + +/* + * returned when GetOverlayPosition is called on a hidden overlay + */ +#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) + +/* + * returned when GetOverlayPosition is called on a overlay that UpdateOverlay + * has never been called on to establish a destionation. + */ +#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) + +/* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + */ +#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) + +/* + * returned when an overlay member is called for a non-overlay surface + */ +#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) + +/* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + */ +#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) + +/* + * An attempt has been made to flip a surface that is not flippable. + */ +#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) + +/* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + */ +#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) + +/* + * Surface was not locked. An attempt to unlock a surface that was not + * locked at all, or by this process, has been attempted. + */ +#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) + +/* + * Windows can not create any more DCs, or a DC was requested for a paltte-indexed + * surface when the surface had no palette AND the display mode was not palette-indexed + * (in this case DirectDraw cannot select a proper palette into the DC) + */ +#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) + +/* + * No DC was ever created for this surface. + */ +#define DDERR_NODC MAKE_DDHRESULT( 586 ) + +/* + * This surface can not be restored because it was created in a different + * mode. + */ +#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) + +/* + * This surface can not be restored because it is an implicitly created + * surface. + */ +#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) + +/* + * The surface being used is not a palette-based surface + */ +#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) + + +/* + * The display is currently in an unsupported mode + */ +#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) + +/* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + */ +#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) + +/* + * The requested action could not be performed because the surface was of + * the wrong type. + */ +#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) + + +/* + * Device does not support optimized surfaces, therefore no video memory optimized surfaces + */ +#define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) + +/* + * Surface is an optimized surface, but has not yet been allocated any memory + */ +#define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) + +/* + * Attempt was made to create or set a device window without first setting + * the focus window + */ +#define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) + +/* + * Attempt was made to set a palette on a mipmap sublevel + */ +#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) + +/* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + */ +#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) + +/* + * An attempt was made to allocate non-local video memory from a device + * that does not support non-local video memory. + */ +#define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) + +/* + * The attempt to page lock a surface failed. + */ +#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) + + +/* + * The attempt to page unlock a surface failed. + */ +#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) + +/* + * An attempt was made to page unlock a surface with no outstanding page locks. + */ +#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) + +/* + * There is more data available than the specified buffer size could hold + */ +#define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) + +/* + * The data has expired and is therefore no longer valid. + */ +#define DDERR_EXPIRED MAKE_DDHRESULT( 691 ) + +/* + * The mode test has finished executing. + */ +#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) + +/* + * The mode test has switched to a new mode. + */ +#define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) + +/* + * D3D has not yet been initialized. + */ +#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) + +/* + * The video port is not active + */ +#define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) + +/* + * The monitor does not have EDID data. + */ +#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) + +/* + * The driver does not enumerate display mode refresh rates. + */ +#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) + +/* + * Surfaces created by one direct draw device cannot be used directly by + * another direct draw device. + */ +#define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) + + + +/* + * An attempt was made to invoke an interface member of a DirectDraw object + * created by CoCreateInstance() before it was initialized. + */ +#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED + + +/* Alpha bit depth constants */ + + +#ifdef __cplusplus +}; +#endif + +#ifdef ENABLE_NAMELESS_UNION_PRAGMA +#pragma warning(default:4201) +#endif + +#endif //__DDRAW_INCLUDED__ + + diff --git a/SDK/dxSDK/Include/dinput.h b/SDK/dxSDK/Include/dinput.h new file mode 100644 index 00000000..5aac2563 --- /dev/null +++ b/SDK/dxSDK/Include/dinput.h @@ -0,0 +1,4417 @@ +/**************************************************************************** + * + * Copyright (C) 1996-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************/ + +#ifndef __DINPUT_INCLUDED__ +#define __DINPUT_INCLUDED__ + +#ifndef DIJ_RINGZERO + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#endif + +#endif /* DIJ_RINGZERO */ + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/* + * To build applications for older versions of DirectInput + * + * #define DIRECTINPUT_VERSION [ 0x0300 | 0x0500 | 0x0700 ] + * + * before #include . By default, #include + * will produce a DirectX 8-compatible header file. + * + */ + +#define DIRECTINPUT_HEADER_VERSION 0x0800 +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * Class IDs + * + ****************************************************************************/ + +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice8,0x25E609E5,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +/**************************************************************************** + * + * Predefined object types + * + ****************************************************************************/ + +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RxAxis, 0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis, 0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Slider, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Unknown, 0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************/ + +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Joystick ,0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm, 0x6F1D2B80,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2,0x6F1D2B81,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm, 0x6F1D2B82,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6F1D2B83,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined force feedback effects + * + ****************************************************************************/ + +DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Square, 0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************/ + +#if(DIRECTINPUT_VERSION >= 0x0500) + +/**************************************************************************** + * + * IDirectInputEffect + * + ****************************************************************************/ + +#define DIEFT_ALL 0x00000000 + +#define DIEFT_CONSTANTFORCE 0x00000001 +#define DIEFT_RAMPFORCE 0x00000002 +#define DIEFT_PERIODIC 0x00000003 +#define DIEFT_CONDITION 0x00000004 +#define DIEFT_CUSTOMFORCE 0x00000005 +#define DIEFT_HARDWARE 0x000000FF +#define DIEFT_FFATTACK 0x00000200 +#define DIEFT_FFFADE 0x00000400 +#define DIEFT_SATURATION 0x00000800 +#define DIEFT_POSNEGCOEFFICIENTS 0x00001000 +#define DIEFT_POSNEGSATURATION 0x00002000 +#define DIEFT_DEADBAND 0x00004000 +#define DIEFT_STARTDELAY 0x00008000 +#define DIEFT_GETTYPE(n) LOBYTE(n) + +#define DI_DEGREES 100 +#define DI_FFNOMINALMAX 10000 +#define DI_SECONDS 1000000 + +typedef struct DICONSTANTFORCE { + LONG lMagnitude; +} DICONSTANTFORCE, *LPDICONSTANTFORCE; +typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE; + +typedef struct DIRAMPFORCE { + LONG lStart; + LONG lEnd; +} DIRAMPFORCE, *LPDIRAMPFORCE; +typedef const DIRAMPFORCE *LPCDIRAMPFORCE; + +typedef struct DIPERIODIC { + DWORD dwMagnitude; + LONG lOffset; + DWORD dwPhase; + DWORD dwPeriod; +} DIPERIODIC, *LPDIPERIODIC; +typedef const DIPERIODIC *LPCDIPERIODIC; + +typedef struct DICONDITION { + LONG lOffset; + LONG lPositiveCoefficient; + LONG lNegativeCoefficient; + DWORD dwPositiveSaturation; + DWORD dwNegativeSaturation; + LONG lDeadBand; +} DICONDITION, *LPDICONDITION; +typedef const DICONDITION *LPCDICONDITION; + +typedef struct DICUSTOMFORCE { + DWORD cChannels; + DWORD dwSamplePeriod; + DWORD cSamples; + LPLONG rglForceData; +} DICUSTOMFORCE, *LPDICUSTOMFORCE; +typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; + + +typedef struct DIENVELOPE { + DWORD dwSize; /* sizeof(DIENVELOPE) */ + DWORD dwAttackLevel; + DWORD dwAttackTime; /* Microseconds */ + DWORD dwFadeLevel; + DWORD dwFadeTime; /* Microseconds */ +} DIENVELOPE, *LPDIENVELOPE; +typedef const DIENVELOPE *LPCDIENVELOPE; + + +/* This structure is defined for DirectX 5.0 compatibility */ +typedef struct DIEFFECT_DX5 { + DWORD dwSize; /* sizeof(DIEFFECT_DX5) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +} DIEFFECT_DX5, *LPDIEFFECT_DX5; +typedef const DIEFFECT_DX5 *LPCDIEFFECT_DX5; + +typedef struct DIEFFECT { + DWORD dwSize; /* sizeof(DIEFFECT) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +#if(DIRECTINPUT_VERSION >= 0x0600) + DWORD dwStartDelay; /* Microseconds */ +#endif /* DIRECTINPUT_VERSION >= 0x0600 */ +} DIEFFECT, *LPDIEFFECT; +typedef DIEFFECT DIEFFECT_DX6; +typedef LPDIEFFECT LPDIEFFECT_DX6; +typedef const DIEFFECT *LPCDIEFFECT; + + +#if(DIRECTINPUT_VERSION >= 0x0700) +#ifndef DIJ_RINGZERO +typedef struct DIFILEEFFECT{ + DWORD dwSize; + GUID GuidEffect; + LPCDIEFFECT lpDiEffect; + CHAR szFriendlyName[MAX_PATH]; +}DIFILEEFFECT, *LPDIFILEEFFECT; +typedef const DIFILEEFFECT *LPCDIFILEEFFECT; +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT , LPVOID); +#endif /* DIJ_RINGZERO */ +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#define DIEFF_OBJECTIDS 0x00000001 +#define DIEFF_OBJECTOFFSETS 0x00000002 +#define DIEFF_CARTESIAN 0x00000010 +#define DIEFF_POLAR 0x00000020 +#define DIEFF_SPHERICAL 0x00000040 + +#define DIEP_DURATION 0x00000001 +#define DIEP_SAMPLEPERIOD 0x00000002 +#define DIEP_GAIN 0x00000004 +#define DIEP_TRIGGERBUTTON 0x00000008 +#define DIEP_TRIGGERREPEATINTERVAL 0x00000010 +#define DIEP_AXES 0x00000020 +#define DIEP_DIRECTION 0x00000040 +#define DIEP_ENVELOPE 0x00000080 +#define DIEP_TYPESPECIFICPARAMS 0x00000100 +#if(DIRECTINPUT_VERSION >= 0x0600) +#define DIEP_STARTDELAY 0x00000200 +#define DIEP_ALLPARAMS_DX5 0x000001FF +#define DIEP_ALLPARAMS 0x000003FF +#else /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_ALLPARAMS 0x000001FF +#endif /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_START 0x20000000 +#define DIEP_NORESTART 0x40000000 +#define DIEP_NODOWNLOAD 0x80000000 +#define DIEB_NOTRIGGER 0xFFFFFFFF + +#define DIES_SOLO 0x00000001 +#define DIES_NODOWNLOAD 0x80000000 + +#define DIEGES_PLAYING 0x00000001 +#define DIEGES_EMULATED 0x00000002 + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputEffect + +DECLARE_INTERFACE_(IDirectInputEffect, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE; + STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE; + STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE; + STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Stop)(THIS) PURE; + STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(Download)(THIS) PURE; + STDMETHOD(Unload)(THIS) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; +}; + +typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b) +#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->lpVtbl->GetEffectStatus(p,a) +#define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p) +#define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p) +#define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#else +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffect_AddRef(p) (p)->AddRef() +#define IDirectInputEffect_Release(p) (p)->Release() +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b) +#define IDirectInputEffect_Stop(p) (p)->Stop() +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->GetEffectStatus(a) +#define IDirectInputEffect_Download(p) (p)->Download() +#define IDirectInputEffect_Unload(p) (p)->Unload() +#define IDirectInputEffect_Escape(p,a) (p)->Escape(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +/**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************/ + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 + +#else +#define DI8DEVCLASS_ALL 0 +#define DI8DEVCLASS_DEVICE 1 +#define DI8DEVCLASS_POINTER 2 +#define DI8DEVCLASS_KEYBOARD 3 +#define DI8DEVCLASS_GAMECTRL 4 + +#define DI8DEVTYPE_DEVICE 0x11 +#define DI8DEVTYPE_MOUSE 0x12 +#define DI8DEVTYPE_KEYBOARD 0x13 +#define DI8DEVTYPE_JOYSTICK 0x14 +#define DI8DEVTYPE_GAMEPAD 0x15 +#define DI8DEVTYPE_DRIVING 0x16 +#define DI8DEVTYPE_FLIGHT 0x17 +#define DI8DEVTYPE_1STPERSON 0x18 +#define DI8DEVTYPE_DEVICECTRL 0x19 +#define DI8DEVTYPE_SCREENPOINTER 0x1A +#define DI8DEVTYPE_REMOTE 0x1B +#define DI8DEVTYPE_SUPPLEMENTAL 0x1C +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define DIDEVTYPE_HID 0x00010000 + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_UNKNOWN 0 +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define DIDEVTYPEJOYSTICK_UNKNOWN 1 +#define DIDEVTYPEJOYSTICK_TRADITIONAL 2 +#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3 +#define DIDEVTYPEJOYSTICK_GAMEPAD 4 +#define DIDEVTYPEJOYSTICK_RUDDER 5 +#define DIDEVTYPEJOYSTICK_WHEEL 6 +#define DIDEVTYPEJOYSTICK_HEADTRACKER 7 + +#else +#define DI8DEVTYPEMOUSE_UNKNOWN 1 +#define DI8DEVTYPEMOUSE_TRADITIONAL 2 +#define DI8DEVTYPEMOUSE_FINGERSTICK 3 +#define DI8DEVTYPEMOUSE_TOUCHPAD 4 +#define DI8DEVTYPEMOUSE_TRACKBALL 5 +#define DI8DEVTYPEMOUSE_ABSOLUTE 6 + +#define DI8DEVTYPEKEYBOARD_UNKNOWN 0 +#define DI8DEVTYPEKEYBOARD_PCXT 1 +#define DI8DEVTYPEKEYBOARD_OLIVETTI 2 +#define DI8DEVTYPEKEYBOARD_PCAT 3 +#define DI8DEVTYPEKEYBOARD_PCENH 4 +#define DI8DEVTYPEKEYBOARD_NOKIA1050 5 +#define DI8DEVTYPEKEYBOARD_NOKIA9140 6 +#define DI8DEVTYPEKEYBOARD_NEC98 7 +#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DI8DEVTYPEKEYBOARD_NEC98106 9 +#define DI8DEVTYPEKEYBOARD_JAPAN106 10 +#define DI8DEVTYPEKEYBOARD_JAPANAX 11 +#define DI8DEVTYPEKEYBOARD_J3100 12 + +#define DI8DEVTYPE_LIMITEDGAMESUBTYPE 1 + +#define DI8DEVTYPEJOYSTICK_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEJOYSTICK_STANDARD 2 + +#define DI8DEVTYPEGAMEPAD_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEGAMEPAD_STANDARD 2 +#define DI8DEVTYPEGAMEPAD_TILT 3 + +#define DI8DEVTYPEDRIVING_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEDRIVING_COMBINEDPEDALS 2 +#define DI8DEVTYPEDRIVING_DUALPEDALS 3 +#define DI8DEVTYPEDRIVING_THREEPEDALS 4 +#define DI8DEVTYPEDRIVING_HANDHELD 5 + +#define DI8DEVTYPEFLIGHT_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEFLIGHT_STICK 2 +#define DI8DEVTYPEFLIGHT_YOKE 3 +#define DI8DEVTYPEFLIGHT_RC 4 + +#define DI8DEVTYPE1STPERSON_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPE1STPERSON_UNKNOWN 2 +#define DI8DEVTYPE1STPERSON_SIXDOF 3 +#define DI8DEVTYPE1STPERSON_SHOOTER 4 + +#define DI8DEVTYPESCREENPTR_UNKNOWN 2 +#define DI8DEVTYPESCREENPTR_LIGHTGUN 3 +#define DI8DEVTYPESCREENPTR_LIGHTPEN 4 +#define DI8DEVTYPESCREENPTR_TOUCH 5 + +#define DI8DEVTYPEREMOTE_UNKNOWN 2 + +#define DI8DEVTYPEDEVICECTRL_UNKNOWN 2 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION 3 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4 + +#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN 2 +#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER 3 +#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER 4 +#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER 5 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE 6 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTER 7 +#define DI8DEVTYPESUPPLEMENTAL_THROTTLE 8 +#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE 9 +#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS 10 +#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS 11 +#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS 12 +#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS 13 +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* This structure is defined for DirectX 3.0 compatibility */ +typedef struct DIDEVCAPS_DX3 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVCAPS, *LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 +#define DIDC_EMULATED 0x00000004 +#define DIDC_POLLEDDATAFORMAT 0x00000008 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDC_FORCEFEEDBACK 0x00000100 +#define DIDC_FFATTACK 0x00000200 +#define DIDC_FFFADE 0x00000400 +#define DIDC_SATURATION 0x00000800 +#define DIDC_POSNEGCOEFFICIENTS 0x00001000 +#define DIDC_POSNEGSATURATION 0x00002000 +#define DIDC_DEADBAND 0x00004000 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#define DIDC_STARTDELAY 0x00008000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDC_ALIAS 0x00010000 +#define DIDC_PHANTOM 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIDC_HIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIDFT_ALL 0x00000000 + +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 + +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C + +#define DIDFT_POV 0x00000010 +#define DIDFT_COLLECTION 0x00000040 +#define DIDFT_NODATA 0x00000080 + +#define DIDFT_ANYINSTANCE 0x00FFFF00 +#define DIDFT_INSTANCEMASK DIDFT_ANYINSTANCE +#define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +#define DIDFT_FFACTUATOR 0x01000000 +#define DIDFT_FFEFFECTTRIGGER 0x02000000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDFT_OUTPUT 0x10000000 +#define DIDFT_VENDORDEFINED 0x04000000 +#define DIDFT_ALIAS 0x08000000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif + +#define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +#define DIDFT_NOCOLLECTION 0x00FFFF00 + +#ifndef DIJ_RINGZERO + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +#ifdef __cplusplus +extern "C" { +#endif +extern const DIDATAFORMAT c_dfDIMouse; + +#if(DIRECTINPUT_VERSION >= 0x0700) +extern const DIDATAFORMAT c_dfDIMouse2; +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +extern const DIDATAFORMAT c_dfDIKeyboard; + +#if(DIRECTINPUT_VERSION >= 0x0500) +extern const DIDATAFORMAT c_dfDIJoystick; +extern const DIDATAFORMAT c_dfDIJoystick2; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#ifdef __cplusplus +}; +#endif + + +#if DIRECTINPUT_VERSION > 0x0700 + +typedef struct _DIACTIONA { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONA, *LPDIACTIONA ; +typedef struct _DIACTIONW { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCWSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONW, *LPDIACTIONW ; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPDIACTIONW LPDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPDIACTIONA LPDIACTION; +#endif // UNICODE + +typedef const DIACTIONA *LPCDIACTIONA; +typedef const DIACTIONW *LPCDIACTIONW; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPCDIACTIONW LPCDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPCDIACTIONA LPCDIACTION; +#endif // UNICODE +typedef const DIACTION *LPCDIACTION; + + +#define DIA_FORCEFEEDBACK 0x00000001 +#define DIA_APPMAPPED 0x00000002 +#define DIA_APPNOMAP 0x00000004 +#define DIA_NORANGE 0x00000008 +#define DIA_APPFIXED 0x00000010 + +#define DIAH_UNMAPPED 0x00000000 +#define DIAH_USERCONFIG 0x00000001 +#define DIAH_APPREQUESTED 0x00000002 +#define DIAH_HWAPP 0x00000004 +#define DIAH_HWDEFAULT 0x00000008 +#define DIAH_DEFAULT 0x00000020 +#define DIAH_ERROR 0x80000000 + +typedef struct _DIACTIONFORMATA { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONA rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + CHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATA, *LPDIACTIONFORMATA; +typedef struct _DIACTIONFORMATW { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONW rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + WCHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATW, *LPDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPDIACTIONFORMATW LPDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPDIACTIONFORMATA LPDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMATA *LPCDIACTIONFORMATA; +typedef const DIACTIONFORMATW *LPCDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPCDIACTIONFORMATW LPCDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPCDIACTIONFORMATA LPCDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMAT *LPCDIACTIONFORMAT; + +#define DIAFTS_NEWDEVICELOW 0xFFFFFFFF +#define DIAFTS_NEWDEVICEHIGH 0xFFFFFFFF +#define DIAFTS_UNUSEDDEVICELOW 0x00000000 +#define DIAFTS_UNUSEDDEVICEHIGH 0x00000000 + +#define DIDBAM_DEFAULT 0x00000000 +#define DIDBAM_PRESERVE 0x00000001 +#define DIDBAM_INITIALIZE 0x00000002 +#define DIDBAM_HWDEFAULTS 0x00000004 + +#define DIDSAM_DEFAULT 0x00000000 +#define DIDSAM_NOUSER 0x00000001 +#define DIDSAM_FORCESAVE 0x00000002 + +#define DICD_DEFAULT 0x00000000 +#define DICD_EDIT 0x00000001 + +/* + * The following definition is normally defined in d3dtypes.h + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +typedef struct _DICOLORSET{ + DWORD dwSize; + D3DCOLOR cTextFore; + D3DCOLOR cTextHighlight; + D3DCOLOR cCalloutLine; + D3DCOLOR cCalloutHighlight; + D3DCOLOR cBorder; + D3DCOLOR cControlFill; + D3DCOLOR cHighlightFill; + D3DCOLOR cAreaFill; +} DICOLORSET, *LPDICOLORSET; +typedef const DICOLORSET *LPCDICOLORSET; + + +typedef struct _DICONFIGUREDEVICESPARAMSA{ + DWORD dwSize; + DWORD dwcUsers; + LPSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATA lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSA, *LPDICONFIGUREDEVICESPARAMSA; +typedef struct _DICONFIGUREDEVICESPARAMSW{ + DWORD dwSize; + DWORD dwcUsers; + LPWSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATW lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSW, *LPDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSW LPDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSA LPDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMSA *LPCDICONFIGUREDEVICESPARAMSA; +typedef const DICONFIGUREDEVICESPARAMSW *LPCDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSW LPCDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSA LPCDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMS *LPCDICONFIGUREDEVICESPARAMS; + + +#define DIDIFT_CONFIGURATION 0x00000001 +#define DIDIFT_OVERLAY 0x00000002 + +#define DIDAL_CENTERED 0x00000000 +#define DIDAL_LEFTALIGNED 0x00000001 +#define DIDAL_RIGHTALIGNED 0x00000002 +#define DIDAL_MIDDLE 0x00000000 +#define DIDAL_TOPALIGNED 0x00000004 +#define DIDAL_BOTTOMALIGNED 0x00000008 + +typedef struct _DIDEVICEIMAGEINFOA { + CHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOA, *LPDIDEVICEIMAGEINFOA; +typedef struct _DIDEVICEIMAGEINFOW { + WCHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOW, *LPDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOW LPDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOA LPDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOA *LPCDIDEVICEIMAGEINFOA; +typedef const DIDEVICEIMAGEINFOW *LPCDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOW LPCDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOA LPCDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFO *LPCDIDEVICEIMAGEINFO; + +typedef struct _DIDEVICEIMAGEINFOHEADERA { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOA lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERA, *LPDIDEVICEIMAGEINFOHEADERA; +typedef struct _DIDEVICEIMAGEINFOHEADERW { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOW lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERW, *LPDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERW LPDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERA LPDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADERA *LPCDIDEVICEIMAGEINFOHEADERA; +typedef const DIDEVICEIMAGEINFOHEADERW *LPCDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERW LPCDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERA LPCDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADER *LPCDIDEVICEIMAGEINFOHEADER; + +#endif /* DIRECTINPUT_VERSION > 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEOBJECTINSTANCE_DX3A { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A; +typedef struct DIDEVICEOBJECTINSTANCE_DX3W { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCE_DX3W DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3W LPDIDEVICEOBJECTINSTANCE_DX3; +#else +typedef DIDEVICEOBJECTINSTANCE_DX3A DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3A LPDIDEVICEOBJECTINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A; +typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W; +typedef const DIDEVICEOBJECTINSTANCE_DX3 *LPCDIDEVICEOBJECTINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; +#else +typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW +#else +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA +#endif // !UNICODE + +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDOI_FFACTUATOR 0x00000001 +#define DIDOI_FFEFFECTTRIGGER 0x00000002 +#define DIDOI_POLLED 0x00008000 +#define DIDOI_ASPECTPOSITION 0x00000100 +#define DIDOI_ASPECTVELOCITY 0x00000200 +#define DIDOI_ASPECTACCEL 0x00000300 +#define DIDOI_ASPECTFORCE 0x00000400 +#define DIDOI_ASPECTMASK 0x00000F00 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDOI_GUIDISUSAGE 0x00010000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER, *LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPH_BYUSAGE 3 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIMAKEUSAGEDWORD(UsagePage, Usage) \ + (DWORD)MAKELONG(Usage, UsagePage) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef struct DIPROPPOINTER { + DIPROPHEADER diph; + UINT_PTR uData; +} DIPROPPOINTER, *LPDIPROPPOINTER; +typedef const DIPROPPOINTER *LPCDIPROPPOINTER; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +#if(DIRECTINPUT_VERSION >= 0x050a) +typedef struct DIPROPCAL { + DIPROPHEADER diph; + LONG lMin; + LONG lCenter; + LONG lMax; +} DIPROPCAL, *LPDIPROPCAL; +typedef const DIPROPCAL *LPCDIPROPCAL; + +typedef struct DIPROPCALPOV { + DIPROPHEADER diph; + LONG lMin[5]; + LONG lMax[5]; +} DIPROPCALPOV, *LPDIPROPCALPOV; +typedef const DIPROPCALPOV *LPCDIPROPCALPOV; + +typedef struct DIPROPGUIDANDPATH { + DIPROPHEADER diph; + GUID guidClass; + WCHAR wszPath[MAX_PATH]; +} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; +typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; + +typedef struct DIPROPSTRING { + DIPROPHEADER diph; + WCHAR wsz[MAX_PATH]; +} DIPROPSTRING, *LPDIPROPSTRING; +typedef const DIPROPSTRING *LPCDIPROPSTRING; + +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define MAXCPOINTSNUM 8 + +typedef struct _CPOINT +{ + LONG lP; // raw value + DWORD dwLog; // logical_value / max_logical_value * 10000 +} CPOINT, *PCPOINT; + +typedef struct DIPROPCPOINTS { + DIPROPHEADER diph; + DWORD dwCPointsNum; + CPOINT cp[MAXCPOINTSNUM]; +} DIPROPCPOINTS, *LPDIPROPCPOINTS; +typedef const DIPROPCPOINTS *LPCDIPROPCPOINTS; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif + +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) + +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) + +#define DIPROP_RANGE MAKEDIPROP(4) + +#define DIPROP_DEADZONE MAKEDIPROP(5) + +#define DIPROP_SATURATION MAKEDIPROP(6) + +#define DIPROP_FFGAIN MAKEDIPROP(7) + +#define DIPROP_FFLOAD MAKEDIPROP(8) + +#define DIPROP_AUTOCENTER MAKEDIPROP(9) + +#define DIPROPAUTOCENTER_OFF 0 +#define DIPROPAUTOCENTER_ON 1 + +#define DIPROP_CALIBRATIONMODE MAKEDIPROP(10) + +#define DIPROPCALIBRATIONMODE_COOKED 0 +#define DIPROPCALIBRATIONMODE_RAW 1 + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPROP_CALIBRATION MAKEDIPROP(11) + +#define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +#define DIPROP_INSTANCENAME MAKEDIPROP(13) + +#define DIPROP_PRODUCTNAME MAKEDIPROP(14) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x05b2) +#define DIPROP_JOYSTICKID MAKEDIPROP(15) + +#define DIPROP_GETPORTDISPLAYNAME MAKEDIPROP(16) + +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIPROP_PHYSICALRANGE MAKEDIPROP(18) + +#define DIPROP_LOGICALRANGE MAKEDIPROP(19) +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIPROP_KEYNAME MAKEDIPROP(20) + +#define DIPROP_CPOINTS MAKEDIPROP(21) + +#define DIPROP_APPDATA MAKEDIPROP(22) + +#define DIPROP_SCANCODE MAKEDIPROP(23) + +#define DIPROP_VIDPID MAKEDIPROP(24) + +#define DIPROP_USERNAME MAKEDIPROP(25) + +#define DIPROP_TYPENAME MAKEDIPROP(26) +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +typedef struct DIDEVICEOBJECTDATA_DX3 { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA_DX3, *LPDIDEVICEOBJECTDATA_DX3; +typedef const DIDEVICEOBJECTDATA_DX3 *LPCDIDEVICEOBJECTDATA_DX; + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +#if(DIRECTINPUT_VERSION >= 0x0800) + UINT_PTR uAppData; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; +typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA; + +#define DIGDD_PEEK 0x00000001 + +#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ + ((int)((dwSequence1) - (dwSequence2)) cmp 0) +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 +#define DISCL_NOWINKEY 0x00000010 + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEINSTANCE_DX3A { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A; +typedef struct DIDEVICEINSTANCE_DX3W { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEINSTANCE_DX3W DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3W LPDIDEVICEINSTANCE_DX3; +#else +typedef DIDEVICEINSTANCE_DX3A DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3A LPDIDEVICEINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A; +typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W; +typedef const DIDEVICEINSTANCE_DX3 *LPCDIDEVICEINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; +#endif // UNICODE + +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE; +#endif // UNICODE +typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceW + +DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceA + +DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif +typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#else +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice_AddRef(p) (p)->AddRef() +#define IDirectInputDevice_Release(p) (p)->Release() +#define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice_Acquire(p) (p)->Acquire() +#define IDirectInputDevice_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + + +#if(DIRECTINPUT_VERSION >= 0x0500) + +#define DISFFC_RESET 0x00000001 +#define DISFFC_STOPALL 0x00000002 +#define DISFFC_PAUSE 0x00000004 +#define DISFFC_CONTINUE 0x00000008 +#define DISFFC_SETACTUATORSON 0x00000010 +#define DISFFC_SETACTUATORSOFF 0x00000020 + +#define DIGFFS_EMPTY 0x00000001 +#define DIGFFS_STOPPED 0x00000002 +#define DIGFFS_PAUSED 0x00000004 +#define DIGFFS_ACTUATORSON 0x00000010 +#define DIGFFS_ACTUATORSOFF 0x00000020 +#define DIGFFS_POWERON 0x00000040 +#define DIGFFS_POWEROFF 0x00000080 +#define DIGFFS_SAFETYSWITCHON 0x00000100 +#define DIGFFS_SAFETYSWITCHOFF 0x00000200 +#define DIGFFS_USERFFSWITCHON 0x00000400 +#define DIGFFS_USERFFSWITCHOFF 0x00000800 +#define DIGFFS_DEVICELOST 0x80000000 + +#ifndef DIJ_RINGZERO + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; +#ifdef UNICODE +typedef DIEFFECTINFOW DIEFFECTINFO; +typedef LPDIEFFECTINFOW LPDIEFFECTINFO; +#else +typedef DIEFFECTINFOA DIEFFECTINFO; +typedef LPDIEFFECTINFOA LPDIEFFECTINFO; +#endif // UNICODE +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; +typedef const DIEFFECTINFO *LPCDIEFFECTINFO; + +#define DISDD_CONTINUE 0x00000001 + +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); +#ifdef UNICODE +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKW +#else +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2W + +DECLARE_INTERFACE_(IDirectInputDevice2W, IDirectInputDeviceW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2A + +DECLARE_INTERFACE_(IDirectInputDevice2A, IDirectInputDeviceA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A; + +#ifdef UNICODE +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2W +#define IDirectInputDevice2 IDirectInputDevice2W +#define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl +#else +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2A +#define IDirectInputDevice2 IDirectInputDevice2A +#define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl +#endif +typedef struct IDirectInputDevice2 *LPDIRECTINPUTDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#else +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice2_AddRef(p) (p)->AddRef() +#define IDirectInputDevice2_Release(p) (p)->Release() +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice2_Acquire(p) (p)->Acquire() +#define IDirectInputDevice2_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice2_Poll(p) (p)->Poll() +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIFEF_DEFAULT 0x00000000 +#define DIFEF_INCLUDENONSTANDARD 0x00000001 +#define DIFEF_MODIFYIFNEEDED 0x00000010 + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7W + +DECLARE_INTERFACE_(IDirectInputDevice7W, IDirectInputDevice2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7W *LPDIRECTINPUTDEVICE7W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7A + +DECLARE_INTERFACE_(IDirectInputDevice7A, IDirectInputDevice2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7A *LPDIRECTINPUTDEVICE7A; + +#ifdef UNICODE +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7W +#define IDirectInputDevice7 IDirectInputDevice7W +#define IDirectInputDevice7Vtbl IDirectInputDevice7WVtbl +#else +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7A +#define IDirectInputDevice7 IDirectInputDevice7A +#define IDirectInputDevice7Vtbl IDirectInputDevice7AVtbl +#endif +typedef struct IDirectInputDevice7 *LPDIRECTINPUTDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice7_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice7_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice7_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#else +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice7_AddRef(p) (p)->AddRef() +#define IDirectInputDevice7_Release(p) (p)->Release() +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice7_Acquire(p) (p)->Acquire() +#define IDirectInputDevice7_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice7_Poll(p) (p)->Poll() +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8W + +DECLARE_INTERFACE_(IDirectInputDevice8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW) PURE; +}; + +typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8A + +DECLARE_INTERFACE_(IDirectInputDevice8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERA) PURE; +}; + +typedef struct IDirectInputDevice8A *LPDIRECTINPUTDEVICE8A; + +#ifdef UNICODE +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8W +#define IDirectInputDevice8 IDirectInputDevice8W +#define IDirectInputDevice8Vtbl IDirectInputDevice8WVtbl +#else +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8A +#define IDirectInputDevice8 IDirectInputDevice8A +#define IDirectInputDevice8Vtbl IDirectInputDevice8AVtbl +#endif +typedef struct IDirectInputDevice8 *LPDIRECTINPUTDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice8_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->lpVtbl->SetActionMap(p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->lpVtbl->GetImageInfo(p,a) +#else +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice8_AddRef(p) (p)->AddRef() +#define IDirectInputDevice8_Release(p) (p)->Release() +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice8_Acquire(p) (p)->Acquire() +#define IDirectInputDevice8_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice8_Poll(p) (p)->Poll() +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->BuildActionMap(a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->SetActionMap(a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->GetImageInfo(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +/**************************************************************************** + * + * Mouse + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct _DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE, *LPDIMOUSESTATE; + +#if DIRECTINPUT_VERSION >= 0x0700 +typedef struct _DIMOUSESTATE2 { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[8]; +} DIMOUSESTATE2, *LPDIMOUSESTATE2; +#endif + + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) +#if (DIRECTINPUT_VERSION >= 0x0700) +#define DIMOFS_BUTTON4 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) +#define DIMOFS_BUTTON5 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) +#define DIMOFS_BUTTON6 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) +#define DIMOFS_BUTTON7 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) +#endif +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Keyboard + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* /? on Brazilian keyboard */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Joystick + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct DIJOYSTATE { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[32]; /* 32 buttons */ +} DIJOYSTATE, *LPDIJOYSTATE; + +typedef struct DIJOYSTATE2 { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[128]; /* 128 buttons */ + LONG lVX; /* x-axis velocity */ + LONG lVY; /* y-axis velocity */ + LONG lVZ; /* z-axis velocity */ + LONG lVRx; /* x-axis angular velocity */ + LONG lVRy; /* y-axis angular velocity */ + LONG lVRz; /* z-axis angular velocity */ + LONG rglVSlider[2]; /* extra axes velocities */ + LONG lAX; /* x-axis acceleration */ + LONG lAY; /* y-axis acceleration */ + LONG lAZ; /* z-axis acceleration */ + LONG lARx; /* x-axis angular acceleration */ + LONG lARy; /* y-axis angular acceleration */ + LONG lARz; /* z-axis angular acceleration */ + LONG rglASlider[2]; /* extra axes accelerations */ + LONG lFX; /* x-axis force */ + LONG lFY; /* y-axis force */ + LONG lFZ; /* z-axis force */ + LONG lFRx; /* x-axis torque */ + LONG lFRy; /* y-axis torque */ + LONG lFRz; /* z-axis torque */ + LONG rglFSlider[2]; /* extra axes forces */ +} DIJOYSTATE2, *LPDIJOYSTATE2; + +#define DIJOFS_X FIELD_OFFSET(DIJOYSTATE, lX) +#define DIJOFS_Y FIELD_OFFSET(DIJOYSTATE, lY) +#define DIJOFS_Z FIELD_OFFSET(DIJOYSTATE, lZ) +#define DIJOFS_RX FIELD_OFFSET(DIJOYSTATE, lRx) +#define DIJOFS_RY FIELD_OFFSET(DIJOYSTATE, lRy) +#define DIJOFS_RZ FIELD_OFFSET(DIJOYSTATE, lRz) +#define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ + (n) * sizeof(LONG)) +#define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ + (n) * sizeof(DWORD)) +#define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +#define DIJOFS_BUTTON0 DIJOFS_BUTTON(0) +#define DIJOFS_BUTTON1 DIJOFS_BUTTON(1) +#define DIJOFS_BUTTON2 DIJOFS_BUTTON(2) +#define DIJOFS_BUTTON3 DIJOFS_BUTTON(3) +#define DIJOFS_BUTTON4 DIJOFS_BUTTON(4) +#define DIJOFS_BUTTON5 DIJOFS_BUTTON(5) +#define DIJOFS_BUTTON6 DIJOFS_BUTTON(6) +#define DIJOFS_BUTTON7 DIJOFS_BUTTON(7) +#define DIJOFS_BUTTON8 DIJOFS_BUTTON(8) +#define DIJOFS_BUTTON9 DIJOFS_BUTTON(9) +#define DIJOFS_BUTTON10 DIJOFS_BUTTON(10) +#define DIJOFS_BUTTON11 DIJOFS_BUTTON(11) +#define DIJOFS_BUTTON12 DIJOFS_BUTTON(12) +#define DIJOFS_BUTTON13 DIJOFS_BUTTON(13) +#define DIJOFS_BUTTON14 DIJOFS_BUTTON(14) +#define DIJOFS_BUTTON15 DIJOFS_BUTTON(15) +#define DIJOFS_BUTTON16 DIJOFS_BUTTON(16) +#define DIJOFS_BUTTON17 DIJOFS_BUTTON(17) +#define DIJOFS_BUTTON18 DIJOFS_BUTTON(18) +#define DIJOFS_BUTTON19 DIJOFS_BUTTON(19) +#define DIJOFS_BUTTON20 DIJOFS_BUTTON(20) +#define DIJOFS_BUTTON21 DIJOFS_BUTTON(21) +#define DIJOFS_BUTTON22 DIJOFS_BUTTON(22) +#define DIJOFS_BUTTON23 DIJOFS_BUTTON(23) +#define DIJOFS_BUTTON24 DIJOFS_BUTTON(24) +#define DIJOFS_BUTTON25 DIJOFS_BUTTON(25) +#define DIJOFS_BUTTON26 DIJOFS_BUTTON(26) +#define DIJOFS_BUTTON27 DIJOFS_BUTTON(27) +#define DIJOFS_BUTTON28 DIJOFS_BUTTON(28) +#define DIJOFS_BUTTON29 DIJOFS_BUTTON(29) +#define DIJOFS_BUTTON30 DIJOFS_BUTTON(30) +#define DIJOFS_BUTTON31 DIJOFS_BUTTON(31) + + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * IDirectInput + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW +#else +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDICONFIGUREDEVICESCALLBACK)(IUnknown FAR *, LPVOID); + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000001 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIEDFL_FORCEFEEDBACK 0x00000100 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIEDFL_INCLUDEALIASES 0x00010000 +#define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDFL_INCLUDEHIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA, LPDIRECTINPUTDEVICE8A, DWORD, DWORD, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBW +#else +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBA +#endif // !UNICODE +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBS_MAPPEDPRI1 0x00000001 +#define DIEDBS_MAPPEDPRI2 0x00000002 +#define DIEDBS_RECENTDEVICE 0x00000010 +#define DIEDBS_NEWDEVICE 0x00000020 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBSFL_ATTACHEDONLY 0x00000000 +#define DIEDBSFL_THISUSER 0x00000010 +#define DIEDBSFL_FORCEFEEDBACK DIEDFL_FORCEFEEDBACK +#define DIEDBSFL_AVAILABLEDEVICES 0x00001000 +#define DIEDBSFL_MULTIMICEKEYBOARDS 0x00002000 +#define DIEDBSFL_NONGAMINGDEVICES 0x00004000 +#define DIEDBSFL_VALID 0x00007110 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#undef INTERFACE +#define INTERFACE IDirectInputW + +DECLARE_INTERFACE_(IDirectInputW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputW *LPDIRECTINPUTW; + +#undef INTERFACE +#define INTERFACE IDirectInputA + +DECLARE_INTERFACE_(IDirectInputA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputA *LPDIRECTINPUTA; + +#ifdef UNICODE +#define IID_IDirectInput IID_IDirectInputW +#define IDirectInput IDirectInputW +#define IDirectInputVtbl IDirectInputWVtbl +#else +#define IID_IDirectInput IID_IDirectInputA +#define IDirectInput IDirectInputA +#define IDirectInputVtbl IDirectInputAVtbl +#endif +typedef struct IDirectInput *LPDIRECTINPUT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#else +#define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput_AddRef(p) (p)->AddRef() +#define IDirectInput_Release(p) (p)->Release() +#define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b) +#endif + +#undef INTERFACE +#define INTERFACE IDirectInput2W + +DECLARE_INTERFACE_(IDirectInput2W, IDirectInputW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2W *LPDIRECTINPUT2W; + +#undef INTERFACE +#define INTERFACE IDirectInput2A + +DECLARE_INTERFACE_(IDirectInput2A, IDirectInputA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2A *LPDIRECTINPUT2A; + +#ifdef UNICODE +#define IID_IDirectInput2 IID_IDirectInput2W +#define IDirectInput2 IDirectInput2W +#define IDirectInput2Vtbl IDirectInput2WVtbl +#else +#define IID_IDirectInput2 IID_IDirectInput2A +#define IDirectInput2 IDirectInput2A +#define IDirectInput2Vtbl IDirectInput2AVtbl +#endif +typedef struct IDirectInput2 *LPDIRECTINPUT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#else +#define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput2_AddRef(p) (p)->AddRef() +#define IDirectInput2_Release(p) (p)->Release() +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#endif + + +#undef INTERFACE +#define INTERFACE IDirectInput7W + +DECLARE_INTERFACE_(IDirectInput7W, IDirectInput2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + + /*** IDirectInput7W methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7W *LPDIRECTINPUT7W; + +#undef INTERFACE +#define INTERFACE IDirectInput7A + +DECLARE_INTERFACE_(IDirectInput7A, IDirectInput2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + + /*** IDirectInput7A methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7A *LPDIRECTINPUT7A; + +#ifdef UNICODE +#define IID_IDirectInput7 IID_IDirectInput7W +#define IDirectInput7 IDirectInput7W +#define IDirectInput7Vtbl IDirectInput7WVtbl +#else +#define IID_IDirectInput7 IID_IDirectInput7A +#define IDirectInput7 IDirectInput7A +#define IDirectInput7Vtbl IDirectInput7AVtbl +#endif +typedef struct IDirectInput7 *LPDIRECTINPUT7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d) +#else +#define IDirectInput7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput7_AddRef(p) (p)->AddRef() +#define IDirectInput7_Release(p) (p)->Release() +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->CreateDeviceEx(a,b,c,d) +#endif + +#if(DIRECTINPUT_VERSION >= 0x0800) +#undef INTERFACE +#define INTERFACE IDirectInput8W + +DECLARE_INTERFACE_(IDirectInput8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8W *LPDIRECTINPUT8W; + +#undef INTERFACE +#define INTERFACE IDirectInput8A + +DECLARE_INTERFACE_(IDirectInput8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8A *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR,LPDIACTIONFORMATA,LPDIENUMDEVICESBYSEMANTICSCBA,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSA,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8A *LPDIRECTINPUT8A; + +#ifdef UNICODE +#define IID_IDirectInput8 IID_IDirectInput8W +#define IDirectInput8 IDirectInput8W +#define IDirectInput8Vtbl IDirectInput8WVtbl +#else +#define IID_IDirectInput8 IID_IDirectInput8A +#define IDirectInput8 IDirectInput8A +#define IDirectInput8Vtbl IDirectInput8AVtbl +#endif +typedef struct IDirectInput8 *LPDIRECTINPUT8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d) +#else +#define IDirectInput8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput8_AddRef(p) (p)->AddRef() +#define IDirectInput8_Release(p) (p)->Release() +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->EnumDevicesBySemantics(a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->ConfigureDevices(a,b,c,d) +#endif +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if DIRECTINPUT_VERSION > 0x0700 + +extern HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#else +extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); +extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); +#ifdef UNICODE +#define DirectInputCreate DirectInputCreateW +#else +#define DirectInputCreate DirectInputCreateA +#endif // !UNICODE + +extern HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#endif /* DIRECTINPUT_VERSION > 0x700 */ + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +/* + * The operation completed successfully. + */ +#define DI_OK S_OK + +/* + * The device exists but is not currently attached. + */ +#define DI_NOTATTACHED S_FALSE + +/* + * The device buffer overflowed. Some input was lost. + */ +#define DI_BUFFEROVERFLOW S_FALSE + +/* + * The change in device properties had no effect. + */ +#define DI_PROPNOEFFECT S_FALSE + +/* + * The operation had no effect. + */ +#define DI_NOEFFECT S_FALSE + +/* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + */ +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but the effect was not + * downloaded because the device is not exclusively acquired + * or because the DIEP_NODOWNLOAD flag was passed. + */ +#define DI_DOWNLOADSKIPPED ((HRESULT)0x00000003L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but in order to change + * the parameters, the effect needed to be restarted. + */ +#define DI_EFFECTRESTARTED ((HRESULT)0x00000004L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but some of them were + * beyond the capabilities of the device and were truncated. + */ +#define DI_TRUNCATED ((HRESULT)0x00000008L) + +/* + * The settings have been successfully applied but could not be + * persisted. + */ +#define DI_SETTINGSNOTSAVED ((HRESULT)0x0000000BL) + +/* + * Equal to DI_EFFECTRESTARTED | DI_TRUNCATED. + */ +#define DI_TRUNCATEDANDRESTARTED ((HRESULT)0x0000000CL) + +/* + * A SUCCESS code indicating that settings cannot be modified. + */ +#define DI_WRITEPROTECT ((HRESULT)0x00000013L) + +/* + * The application requires a newer version of DirectInput. + */ +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) + +/* + * The application was written for an unsupported prerelease version + * of DirectInput. + */ +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) + +/* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + */ +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) + +/* + * The device or device instance or effect is not registered with DirectInput. + */ +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG + +/* + * The requested object does not exist. + */ +#define DIERR_NOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * The requested object does not exist. + */ +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + */ +#define DIERR_INVALIDPARAM E_INVALIDARG + +/* + * The specified interface is not supported by the object + */ +#define DIERR_NOINTERFACE E_NOINTERFACE + +/* + * An undetermined error occured inside the DInput subsystem + */ +#define DIERR_GENERIC E_FAIL + +/* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * The function called is not supported at this time + */ +#define DIERR_UNSUPPORTED E_NOTIMPL + +/* + * This object has not been initialized + */ +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) + +/* + * This object is already initialized + */ +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) + +/* + * This object does not support aggregation + */ +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED + +/* + * Access to the device has been lost. It must be re-acquired. + */ +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) + +/* + * The operation cannot be performed while the device is acquired. + */ +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) + +/* + * The operation cannot be performed unless the device is acquired. + */ +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) + +/* + * The specified property cannot be changed. + */ +#define DIERR_READONLY E_ACCESSDENIED + +/* + * The device already has an event notification associated with it. + */ +#define DIERR_HANDLEEXISTS E_ACCESSDENIED + +/* + * Data is not yet available. + */ +#ifndef E_PENDING +#define E_PENDING 0x8000000AL +#endif + +/* + * Unable to IDirectInputJoyConfig_Acquire because the user + * does not have sufficient privileges to change the joystick + * configuration. + */ +#define DIERR_INSUFFICIENTPRIVS 0x80040200L + +/* + * The device is full. + */ +#define DIERR_DEVICEFULL 0x80040201L + +/* + * Not all the requested information fit into the buffer. + */ +#define DIERR_MOREDATA 0x80040202L + +/* + * The effect is not downloaded. + */ +#define DIERR_NOTDOWNLOADED 0x80040203L + +/* + * The device cannot be reinitialized because there are still effects + * attached to it. + */ +#define DIERR_HASEFFECTS 0x80040204L + +/* + * The operation cannot be performed unless the device is acquired + * in DISCL_EXCLUSIVE mode. + */ +#define DIERR_NOTEXCLUSIVEACQUIRED 0x80040205L + +/* + * The effect could not be downloaded because essential information + * is missing. For example, no axes have been associated with the + * effect, or no type-specific information has been created. + */ +#define DIERR_INCOMPLETEEFFECT 0x80040206L + +/* + * Attempted to read buffered device data from a device that is + * not buffered. + */ +#define DIERR_NOTBUFFERED 0x80040207L + +/* + * An attempt was made to modify parameters of an effect while it is + * playing. Not all hardware devices support altering the parameters + * of an effect while it is playing. + */ +#define DIERR_EFFECTPLAYING 0x80040208L + +/* + * The operation could not be completed because the device is not + * plugged in. + */ +#define DIERR_UNPLUGGED 0x80040209L + +/* + * SendDeviceData failed because more information was requested + * to be sent than can be sent to the device. Some devices have + * restrictions on how much data can be sent to them. (For example, + * there might be a limit on the number of buttons that can be + * pressed at once.) + */ +#define DIERR_REPORTFULL 0x8004020AL + + +/* + * A mapper file function failed because reading or writing the user or IHV + * settings file failed. + */ +#define DIERR_MAPFILEFAIL 0x8004020BL + + +/*--- DINPUT Mapper Definitions: New for Dx8 ---*/ + + +/*--- Keyboard + Physical Keyboard Device ---*/ + +#define DIKEYBOARD_ESCAPE 0x81000401 +#define DIKEYBOARD_1 0x81000402 +#define DIKEYBOARD_2 0x81000403 +#define DIKEYBOARD_3 0x81000404 +#define DIKEYBOARD_4 0x81000405 +#define DIKEYBOARD_5 0x81000406 +#define DIKEYBOARD_6 0x81000407 +#define DIKEYBOARD_7 0x81000408 +#define DIKEYBOARD_8 0x81000409 +#define DIKEYBOARD_9 0x8100040A +#define DIKEYBOARD_0 0x8100040B +#define DIKEYBOARD_MINUS 0x8100040C /* - on main keyboard */ +#define DIKEYBOARD_EQUALS 0x8100040D +#define DIKEYBOARD_BACK 0x8100040E /* backspace */ +#define DIKEYBOARD_TAB 0x8100040F +#define DIKEYBOARD_Q 0x81000410 +#define DIKEYBOARD_W 0x81000411 +#define DIKEYBOARD_E 0x81000412 +#define DIKEYBOARD_R 0x81000413 +#define DIKEYBOARD_T 0x81000414 +#define DIKEYBOARD_Y 0x81000415 +#define DIKEYBOARD_U 0x81000416 +#define DIKEYBOARD_I 0x81000417 +#define DIKEYBOARD_O 0x81000418 +#define DIKEYBOARD_P 0x81000419 +#define DIKEYBOARD_LBRACKET 0x8100041A +#define DIKEYBOARD_RBRACKET 0x8100041B +#define DIKEYBOARD_RETURN 0x8100041C /* Enter on main keyboard */ +#define DIKEYBOARD_LCONTROL 0x8100041D +#define DIKEYBOARD_A 0x8100041E +#define DIKEYBOARD_S 0x8100041F +#define DIKEYBOARD_D 0x81000420 +#define DIKEYBOARD_F 0x81000421 +#define DIKEYBOARD_G 0x81000422 +#define DIKEYBOARD_H 0x81000423 +#define DIKEYBOARD_J 0x81000424 +#define DIKEYBOARD_K 0x81000425 +#define DIKEYBOARD_L 0x81000426 +#define DIKEYBOARD_SEMICOLON 0x81000427 +#define DIKEYBOARD_APOSTROPHE 0x81000428 +#define DIKEYBOARD_GRAVE 0x81000429 /* accent grave */ +#define DIKEYBOARD_LSHIFT 0x8100042A +#define DIKEYBOARD_BACKSLASH 0x8100042B +#define DIKEYBOARD_Z 0x8100042C +#define DIKEYBOARD_X 0x8100042D +#define DIKEYBOARD_C 0x8100042E +#define DIKEYBOARD_V 0x8100042F +#define DIKEYBOARD_B 0x81000430 +#define DIKEYBOARD_N 0x81000431 +#define DIKEYBOARD_M 0x81000432 +#define DIKEYBOARD_COMMA 0x81000433 +#define DIKEYBOARD_PERIOD 0x81000434 /* . on main keyboard */ +#define DIKEYBOARD_SLASH 0x81000435 /* / on main keyboard */ +#define DIKEYBOARD_RSHIFT 0x81000436 +#define DIKEYBOARD_MULTIPLY 0x81000437 /* * on numeric keypad */ +#define DIKEYBOARD_LMENU 0x81000438 /* left Alt */ +#define DIKEYBOARD_SPACE 0x81000439 +#define DIKEYBOARD_CAPITAL 0x8100043A +#define DIKEYBOARD_F1 0x8100043B +#define DIKEYBOARD_F2 0x8100043C +#define DIKEYBOARD_F3 0x8100043D +#define DIKEYBOARD_F4 0x8100043E +#define DIKEYBOARD_F5 0x8100043F +#define DIKEYBOARD_F6 0x81000440 +#define DIKEYBOARD_F7 0x81000441 +#define DIKEYBOARD_F8 0x81000442 +#define DIKEYBOARD_F9 0x81000443 +#define DIKEYBOARD_F10 0x81000444 +#define DIKEYBOARD_NUMLOCK 0x81000445 +#define DIKEYBOARD_SCROLL 0x81000446 /* Scroll Lock */ +#define DIKEYBOARD_NUMPAD7 0x81000447 +#define DIKEYBOARD_NUMPAD8 0x81000448 +#define DIKEYBOARD_NUMPAD9 0x81000449 +#define DIKEYBOARD_SUBTRACT 0x8100044A /* - on numeric keypad */ +#define DIKEYBOARD_NUMPAD4 0x8100044B +#define DIKEYBOARD_NUMPAD5 0x8100044C +#define DIKEYBOARD_NUMPAD6 0x8100044D +#define DIKEYBOARD_ADD 0x8100044E /* + on numeric keypad */ +#define DIKEYBOARD_NUMPAD1 0x8100044F +#define DIKEYBOARD_NUMPAD2 0x81000450 +#define DIKEYBOARD_NUMPAD3 0x81000451 +#define DIKEYBOARD_NUMPAD0 0x81000452 +#define DIKEYBOARD_DECIMAL 0x81000453 /* . on numeric keypad */ +#define DIKEYBOARD_OEM_102 0x81000456 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIKEYBOARD_F11 0x81000457 +#define DIKEYBOARD_F12 0x81000458 +#define DIKEYBOARD_F13 0x81000464 /* (NEC PC98) */ +#define DIKEYBOARD_F14 0x81000465 /* (NEC PC98) */ +#define DIKEYBOARD_F15 0x81000466 /* (NEC PC98) */ +#define DIKEYBOARD_KANA 0x81000470 /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C1 0x81000473 /* /? on Brazilian keyboard */ +#define DIKEYBOARD_CONVERT 0x81000479 /* (Japanese keyboard) */ +#define DIKEYBOARD_NOCONVERT 0x8100047B /* (Japanese keyboard) */ +#define DIKEYBOARD_YEN 0x8100047D /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C2 0x8100047E /* Numpad . on Brazilian keyboard */ +#define DIKEYBOARD_NUMPADEQUALS 0x8100048D /* = on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_PREVTRACK 0x81000490 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIKEYBOARD_AT 0x81000491 /* (NEC PC98) */ +#define DIKEYBOARD_COLON 0x81000492 /* (NEC PC98) */ +#define DIKEYBOARD_UNDERLINE 0x81000493 /* (NEC PC98) */ +#define DIKEYBOARD_KANJI 0x81000494 /* (Japanese keyboard) */ +#define DIKEYBOARD_STOP 0x81000495 /* (NEC PC98) */ +#define DIKEYBOARD_AX 0x81000496 /* (Japan AX) */ +#define DIKEYBOARD_UNLABELED 0x81000497 /* (J3100) */ +#define DIKEYBOARD_NEXTTRACK 0x81000499 /* Next Track */ +#define DIKEYBOARD_NUMPADENTER 0x8100049C /* Enter on numeric keypad */ +#define DIKEYBOARD_RCONTROL 0x8100049D +#define DIKEYBOARD_MUTE 0x810004A0 /* Mute */ +#define DIKEYBOARD_CALCULATOR 0x810004A1 /* Calculator */ +#define DIKEYBOARD_PLAYPAUSE 0x810004A2 /* Play / Pause */ +#define DIKEYBOARD_MEDIASTOP 0x810004A4 /* Media Stop */ +#define DIKEYBOARD_VOLUMEDOWN 0x810004AE /* Volume - */ +#define DIKEYBOARD_VOLUMEUP 0x810004B0 /* Volume + */ +#define DIKEYBOARD_WEBHOME 0x810004B2 /* Web home */ +#define DIKEYBOARD_NUMPADCOMMA 0x810004B3 /* , on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_DIVIDE 0x810004B5 /* / on numeric keypad */ +#define DIKEYBOARD_SYSRQ 0x810004B7 +#define DIKEYBOARD_RMENU 0x810004B8 /* right Alt */ +#define DIKEYBOARD_PAUSE 0x810004C5 /* Pause */ +#define DIKEYBOARD_HOME 0x810004C7 /* Home on arrow keypad */ +#define DIKEYBOARD_UP 0x810004C8 /* UpArrow on arrow keypad */ +#define DIKEYBOARD_PRIOR 0x810004C9 /* PgUp on arrow keypad */ +#define DIKEYBOARD_LEFT 0x810004CB /* LeftArrow on arrow keypad */ +#define DIKEYBOARD_RIGHT 0x810004CD /* RightArrow on arrow keypad */ +#define DIKEYBOARD_END 0x810004CF /* End on arrow keypad */ +#define DIKEYBOARD_DOWN 0x810004D0 /* DownArrow on arrow keypad */ +#define DIKEYBOARD_NEXT 0x810004D1 /* PgDn on arrow keypad */ +#define DIKEYBOARD_INSERT 0x810004D2 /* Insert on arrow keypad */ +#define DIKEYBOARD_DELETE 0x810004D3 /* Delete on arrow keypad */ +#define DIKEYBOARD_LWIN 0x810004DB /* Left Windows key */ +#define DIKEYBOARD_RWIN 0x810004DC /* Right Windows key */ +#define DIKEYBOARD_APPS 0x810004DD /* AppMenu key */ +#define DIKEYBOARD_POWER 0x810004DE /* System Power */ +#define DIKEYBOARD_SLEEP 0x810004DF /* System Sleep */ +#define DIKEYBOARD_WAKE 0x810004E3 /* System Wake */ +#define DIKEYBOARD_WEBSEARCH 0x810004E5 /* Web Search */ +#define DIKEYBOARD_WEBFAVORITES 0x810004E6 /* Web Favorites */ +#define DIKEYBOARD_WEBREFRESH 0x810004E7 /* Web Refresh */ +#define DIKEYBOARD_WEBSTOP 0x810004E8 /* Web Stop */ +#define DIKEYBOARD_WEBFORWARD 0x810004E9 /* Web Forward */ +#define DIKEYBOARD_WEBBACK 0x810004EA /* Web Back */ +#define DIKEYBOARD_MYCOMPUTER 0x810004EB /* My Computer */ +#define DIKEYBOARD_MAIL 0x810004EC /* Mail */ +#define DIKEYBOARD_MEDIASELECT 0x810004ED /* Media Select */ + + +/*--- MOUSE + Physical Mouse Device ---*/ + +#define DIMOUSE_XAXISAB (0x82000200 |DIMOFS_X ) /* X Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_YAXISAB (0x82000200 |DIMOFS_Y ) /* Y Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_XAXIS (0x82000300 |DIMOFS_X ) /* X Axis */ +#define DIMOUSE_YAXIS (0x82000300 |DIMOFS_Y ) /* Y Axis */ +#define DIMOUSE_WHEEL (0x82000300 |DIMOFS_Z ) /* Z Axis */ +#define DIMOUSE_BUTTON0 (0x82000400 |DIMOFS_BUTTON0) /* Button 0 */ +#define DIMOUSE_BUTTON1 (0x82000400 |DIMOFS_BUTTON1) /* Button 1 */ +#define DIMOUSE_BUTTON2 (0x82000400 |DIMOFS_BUTTON2) /* Button 2 */ +#define DIMOUSE_BUTTON3 (0x82000400 |DIMOFS_BUTTON3) /* Button 3 */ +#define DIMOUSE_BUTTON4 (0x82000400 |DIMOFS_BUTTON4) /* Button 4 */ +#define DIMOUSE_BUTTON5 (0x82000400 |DIMOFS_BUTTON5) /* Button 5 */ +#define DIMOUSE_BUTTON6 (0x82000400 |DIMOFS_BUTTON6) /* Button 6 */ +#define DIMOUSE_BUTTON7 (0x82000400 |DIMOFS_BUTTON7) /* Button 7 */ + + +/*--- VOICE + Physical Dplay Voice Device ---*/ + +#define DIVOICE_CHANNEL1 0x83000401 +#define DIVOICE_CHANNEL2 0x83000402 +#define DIVOICE_CHANNEL3 0x83000403 +#define DIVOICE_CHANNEL4 0x83000404 +#define DIVOICE_CHANNEL5 0x83000405 +#define DIVOICE_CHANNEL6 0x83000406 +#define DIVOICE_CHANNEL7 0x83000407 +#define DIVOICE_CHANNEL8 0x83000408 +#define DIVOICE_TEAM 0x83000409 +#define DIVOICE_ALL 0x8300040A +#define DIVOICE_RECORDMUTE 0x8300040B +#define DIVOICE_PLAYBACKMUTE 0x8300040C +#define DIVOICE_TRANSMIT 0x8300040D + +#define DIVOICE_VOICECOMMAND 0x83000410 + + +/*--- Driving Simulator - Racing + Vehicle control is primary objective ---*/ +#define DIVIRTUAL_DRIVING_RACE 0x01000000 +#define DIAXIS_DRIVINGR_STEER 0x01008A01 /* Steering */ +#define DIAXIS_DRIVINGR_ACCELERATE 0x01039202 /* Accelerate */ +#define DIAXIS_DRIVINGR_BRAKE 0x01041203 /* Brake-Axis */ +#define DIBUTTON_DRIVINGR_SHIFTUP 0x01000C01 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGR_SHIFTDOWN 0x01000C02 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGR_VIEW 0x01001C03 /* Cycle through view options */ +#define DIBUTTON_DRIVINGR_MENU 0x010004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGR_ACCEL_AND_BRAKE 0x01014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGR_GLANCE 0x01004601 /* Look around */ +#define DIBUTTON_DRIVINGR_BRAKE 0x01004C04 /* Brake-button */ +#define DIBUTTON_DRIVINGR_DASHBOARD 0x01004405 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGR_AIDS 0x01004406 /* Driver correction aids */ +#define DIBUTTON_DRIVINGR_MAP 0x01004407 /* Display Driving Map */ +#define DIBUTTON_DRIVINGR_BOOST 0x01004408 /* Turbo Boost */ +#define DIBUTTON_DRIVINGR_PIT 0x01004409 /* Pit stop notification */ +#define DIBUTTON_DRIVINGR_ACCELERATE_LINK 0x0103D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGR_STEER_LEFT_LINK 0x0100CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGR_STEER_RIGHT_LINK 0x0100CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK 0x0107C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK 0x0107C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGR_DEVICE 0x010044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGR_PAUSE 0x010044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Combat + Combat from within a vehicle is primary objective ---*/ +#define DIVIRTUAL_DRIVING_COMBAT 0x02000000 +#define DIAXIS_DRIVINGC_STEER 0x02008A01 /* Steering */ +#define DIAXIS_DRIVINGC_ACCELERATE 0x02039202 /* Accelerate */ +#define DIAXIS_DRIVINGC_BRAKE 0x02041203 /* Brake-axis */ +#define DIBUTTON_DRIVINGC_FIRE 0x02000C01 /* Fire */ +#define DIBUTTON_DRIVINGC_WEAPONS 0x02000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGC_TARGET 0x02000C03 /* Select next available target */ +#define DIBUTTON_DRIVINGC_MENU 0x020004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGC_ACCEL_AND_BRAKE 0x02014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGC_GLANCE 0x02004601 /* Look around */ +#define DIBUTTON_DRIVINGC_SHIFTUP 0x02004C04 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGC_SHIFTDOWN 0x02004C05 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGC_DASHBOARD 0x02004406 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGC_AIDS 0x02004407 /* Driver correction aids */ +#define DIBUTTON_DRIVINGC_BRAKE 0x02004C08 /* Brake-button */ +#define DIBUTTON_DRIVINGC_FIRESECONDARY 0x02004C09 /* Alternative fire button */ +#define DIBUTTON_DRIVINGC_ACCELERATE_LINK 0x0203D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGC_STEER_LEFT_LINK 0x0200CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGC_STEER_RIGHT_LINK 0x0200CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK 0x0207C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK 0x0207C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGC_DEVICE 0x020044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGC_PAUSE 0x020044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Tank + Combat from withing a tank is primary objective ---*/ +#define DIVIRTUAL_DRIVING_TANK 0x03000000 +#define DIAXIS_DRIVINGT_STEER 0x03008A01 /* Turn tank left / right */ +#define DIAXIS_DRIVINGT_BARREL 0x03010202 /* Raise / lower barrel */ +#define DIAXIS_DRIVINGT_ACCELERATE 0x03039203 /* Accelerate */ +#define DIAXIS_DRIVINGT_ROTATE 0x03020204 /* Turn barrel left / right */ +#define DIBUTTON_DRIVINGT_FIRE 0x03000C01 /* Fire */ +#define DIBUTTON_DRIVINGT_WEAPONS 0x03000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGT_TARGET 0x03000C03 /* Selects next available target */ +#define DIBUTTON_DRIVINGT_MENU 0x030004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_DRIVINGT_GLANCE 0x03004601 /* Look around */ +#define DIAXIS_DRIVINGT_BRAKE 0x03045205 /* Brake-axis */ +#define DIAXIS_DRIVINGT_ACCEL_AND_BRAKE 0x03014A06 /* Some devices combine accelerate and brake in a single axis */ +#define DIBUTTON_DRIVINGT_VIEW 0x03005C04 /* Cycle through view options */ +#define DIBUTTON_DRIVINGT_DASHBOARD 0x03005C05 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGT_BRAKE 0x03004C06 /* Brake-button */ +#define DIBUTTON_DRIVINGT_FIRESECONDARY 0x03004C07 /* Alternative fire button */ +#define DIBUTTON_DRIVINGT_ACCELERATE_LINK 0x0303D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGT_STEER_LEFT_LINK 0x0300CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGT_STEER_RIGHT_LINK 0x0300CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGT_BARREL_UP_LINK 0x030144E0 /* Fallback Barrel up button */ +#define DIBUTTON_DRIVINGT_BARREL_DOWN_LINK 0x030144E8 /* Fallback Barrel down button */ +#define DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK 0x030244E4 /* Fallback Rotate left button */ +#define DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK 0x030244EC /* Fallback Rotate right button */ +#define DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK 0x0307C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK 0x0307C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGT_DEVICE 0x030044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGT_PAUSE 0x030044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Civilian + Plane control is the primary objective ---*/ +#define DIVIRTUAL_FLYING_CIVILIAN 0x04000000 +#define DIAXIS_FLYINGC_BANK 0x04008A01 /* Roll ship left / right */ +#define DIAXIS_FLYINGC_PITCH 0x04010A02 /* Nose up / down */ +#define DIAXIS_FLYINGC_THROTTLE 0x04039203 /* Throttle */ +#define DIBUTTON_FLYINGC_VIEW 0x04002401 /* Cycle through view options */ +#define DIBUTTON_FLYINGC_DISPLAY 0x04002402 /* Select next dashboard / heads up display option */ +#define DIBUTTON_FLYINGC_GEAR 0x04002C03 /* Gear up / down */ +#define DIBUTTON_FLYINGC_MENU 0x040004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGC_GLANCE 0x04004601 /* Look around */ +#define DIAXIS_FLYINGC_BRAKE 0x04046A04 /* Apply Brake */ +#define DIAXIS_FLYINGC_RUDDER 0x04025205 /* Yaw ship left/right */ +#define DIAXIS_FLYINGC_FLAPS 0x04055A06 /* Flaps */ +#define DIBUTTON_FLYINGC_FLAPSUP 0x04006404 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGC_FLAPSDOWN 0x04006405 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGC_BRAKE_LINK 0x04046CE0 /* Fallback brake button */ +#define DIBUTTON_FLYINGC_FASTER_LINK 0x0403D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGC_SLOWER_LINK 0x0403D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGC_GLANCE_LEFT_LINK 0x0407C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK 0x0407C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGC_GLANCE_UP_LINK 0x0407C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGC_GLANCE_DOWN_LINK 0x0407C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGC_DEVICE 0x040044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGC_PAUSE 0x040044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Military + Aerial combat is the primary objective ---*/ +#define DIVIRTUAL_FLYING_MILITARY 0x05000000 +#define DIAXIS_FLYINGM_BANK 0x05008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGM_PITCH 0x05010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGM_THROTTLE 0x05039203 /* Throttle - faster / slower */ +#define DIBUTTON_FLYINGM_FIRE 0x05000C01 /* Fire */ +#define DIBUTTON_FLYINGM_WEAPONS 0x05000C02 /* Select next weapon */ +#define DIBUTTON_FLYINGM_TARGET 0x05000C03 /* Selects next available target */ +#define DIBUTTON_FLYINGM_MENU 0x050004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGM_GLANCE 0x05004601 /* Look around */ +#define DIBUTTON_FLYINGM_COUNTER 0x05005C04 /* Activate counter measures */ +#define DIAXIS_FLYINGM_RUDDER 0x05024A04 /* Rudder - Yaw ship left/right */ +#define DIAXIS_FLYINGM_BRAKE 0x05046205 /* Brake-axis */ +#define DIBUTTON_FLYINGM_VIEW 0x05006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGM_DISPLAY 0x05006406 /* Select next dashboard option */ +#define DIAXIS_FLYINGM_FLAPS 0x05055206 /* Flaps */ +#define DIBUTTON_FLYINGM_FLAPSUP 0x05005407 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGM_FLAPSDOWN 0x05005408 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGM_FIRESECONDARY 0x05004C09 /* Alternative fire button */ +#define DIBUTTON_FLYINGM_GEAR 0x0500640A /* Gear up / down */ +#define DIBUTTON_FLYINGM_BRAKE_LINK 0x050464E0 /* Fallback brake button */ +#define DIBUTTON_FLYINGM_FASTER_LINK 0x0503D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGM_SLOWER_LINK 0x0503D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGM_GLANCE_LEFT_LINK 0x0507C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK 0x0507C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGM_GLANCE_UP_LINK 0x0507C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGM_GLANCE_DOWN_LINK 0x0507C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGM_DEVICE 0x050044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGM_PAUSE 0x050044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Combat Helicopter + Combat from helicopter is primary objective ---*/ +#define DIVIRTUAL_FLYING_HELICOPTER 0x06000000 +#define DIAXIS_FLYINGH_BANK 0x06008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGH_PITCH 0x06010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGH_COLLECTIVE 0x06018A03 /* Collective - Blade pitch/power */ +#define DIBUTTON_FLYINGH_FIRE 0x06001401 /* Fire */ +#define DIBUTTON_FLYINGH_WEAPONS 0x06001402 /* Select next weapon */ +#define DIBUTTON_FLYINGH_TARGET 0x06001403 /* Selects next available target */ +#define DIBUTTON_FLYINGH_MENU 0x060004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGH_GLANCE 0x06004601 /* Look around */ +#define DIAXIS_FLYINGH_TORQUE 0x06025A04 /* Torque - Rotate ship around left / right axis */ +#define DIAXIS_FLYINGH_THROTTLE 0x0603DA05 /* Throttle */ +#define DIBUTTON_FLYINGH_COUNTER 0x06005404 /* Activate counter measures */ +#define DIBUTTON_FLYINGH_VIEW 0x06006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGH_GEAR 0x06006406 /* Gear up / down */ +#define DIBUTTON_FLYINGH_FIRESECONDARY 0x06004C07 /* Alternative fire button */ +#define DIBUTTON_FLYINGH_FASTER_LINK 0x0603DCE0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGH_SLOWER_LINK 0x0603DCE8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGH_GLANCE_LEFT_LINK 0x0607C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK 0x0607C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGH_GLANCE_UP_LINK 0x0607C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGH_GLANCE_DOWN_LINK 0x0607C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGH_DEVICE 0x060044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGH_PAUSE 0x060044FC /* Start / Pause / Restart game */ + +/*--- Space Simulator - Combat + Space Simulator with weapons ---*/ +#define DIVIRTUAL_SPACESIM 0x07000000 +#define DIAXIS_SPACESIM_LATERAL 0x07008201 /* Move ship left / right */ +#define DIAXIS_SPACESIM_MOVE 0x07010202 /* Move ship forward/backward */ +#define DIAXIS_SPACESIM_THROTTLE 0x07038203 /* Throttle - Engine speed */ +#define DIBUTTON_SPACESIM_FIRE 0x07000401 /* Fire */ +#define DIBUTTON_SPACESIM_WEAPONS 0x07000402 /* Select next weapon */ +#define DIBUTTON_SPACESIM_TARGET 0x07000403 /* Selects next available target */ +#define DIBUTTON_SPACESIM_MENU 0x070004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SPACESIM_GLANCE 0x07004601 /* Look around */ +#define DIAXIS_SPACESIM_CLIMB 0x0701C204 /* Climb - Pitch ship up/down */ +#define DIAXIS_SPACESIM_ROTATE 0x07024205 /* Rotate - Turn ship left/right */ +#define DIBUTTON_SPACESIM_VIEW 0x07004404 /* Cycle through view options */ +#define DIBUTTON_SPACESIM_DISPLAY 0x07004405 /* Select next dashboard / heads up display option */ +#define DIBUTTON_SPACESIM_RAISE 0x07004406 /* Raise ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_LOWER 0x07004407 /* Lower ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_GEAR 0x07004408 /* Gear up / down */ +#define DIBUTTON_SPACESIM_FIRESECONDARY 0x07004409 /* Alternative fire button */ +#define DIBUTTON_SPACESIM_LEFT_LINK 0x0700C4E4 /* Fallback move left button */ +#define DIBUTTON_SPACESIM_RIGHT_LINK 0x0700C4EC /* Fallback move right button */ +#define DIBUTTON_SPACESIM_FORWARD_LINK 0x070144E0 /* Fallback move forward button */ +#define DIBUTTON_SPACESIM_BACKWARD_LINK 0x070144E8 /* Fallback move backwards button */ +#define DIBUTTON_SPACESIM_FASTER_LINK 0x0703C4E0 /* Fallback throttle up button */ +#define DIBUTTON_SPACESIM_SLOWER_LINK 0x0703C4E8 /* Fallback throttle down button */ +#define DIBUTTON_SPACESIM_TURN_LEFT_LINK 0x070244E4 /* Fallback turn left button */ +#define DIBUTTON_SPACESIM_TURN_RIGHT_LINK 0x070244EC /* Fallback turn right button */ +#define DIBUTTON_SPACESIM_GLANCE_LEFT_LINK 0x0707C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK 0x0707C4EC /* Fallback Glance Right button */ +#define DIBUTTON_SPACESIM_GLANCE_UP_LINK 0x0707C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_SPACESIM_GLANCE_DOWN_LINK 0x0707C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_SPACESIM_DEVICE 0x070044FE /* Show input device and controls */ +#define DIBUTTON_SPACESIM_PAUSE 0x070044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person + Hand to Hand combat is primary objective ---*/ +#define DIVIRTUAL_FIGHTING_HAND2HAND 0x08000000 +#define DIAXIS_FIGHTINGH_LATERAL 0x08008201 /* Sidestep left/right */ +#define DIAXIS_FIGHTINGH_MOVE 0x08010202 /* Move forward/backward */ +#define DIBUTTON_FIGHTINGH_PUNCH 0x08000401 /* Punch */ +#define DIBUTTON_FIGHTINGH_KICK 0x08000402 /* Kick */ +#define DIBUTTON_FIGHTINGH_BLOCK 0x08000403 /* Block */ +#define DIBUTTON_FIGHTINGH_CROUCH 0x08000404 /* Crouch */ +#define DIBUTTON_FIGHTINGH_JUMP 0x08000405 /* Jump */ +#define DIBUTTON_FIGHTINGH_SPECIAL1 0x08000406 /* Apply first special move */ +#define DIBUTTON_FIGHTINGH_SPECIAL2 0x08000407 /* Apply second special move */ +#define DIBUTTON_FIGHTINGH_MENU 0x080004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FIGHTINGH_SELECT 0x08004408 /* Select special move */ +#define DIHATSWITCH_FIGHTINGH_SLIDE 0x08004601 /* Look around */ +#define DIBUTTON_FIGHTINGH_DISPLAY 0x08004409 /* Shows next on-screen display option */ +#define DIAXIS_FIGHTINGH_ROTATE 0x08024203 /* Rotate - Turn body left/right */ +#define DIBUTTON_FIGHTINGH_DODGE 0x0800440A /* Dodge */ +#define DIBUTTON_FIGHTINGH_LEFT_LINK 0x0800C4E4 /* Fallback left sidestep button */ +#define DIBUTTON_FIGHTINGH_RIGHT_LINK 0x0800C4EC /* Fallback right sidestep button */ +#define DIBUTTON_FIGHTINGH_FORWARD_LINK 0x080144E0 /* Fallback forward button */ +#define DIBUTTON_FIGHTINGH_BACKWARD_LINK 0x080144E8 /* Fallback backward button */ +#define DIBUTTON_FIGHTINGH_DEVICE 0x080044FE /* Show input device and controls */ +#define DIBUTTON_FIGHTINGH_PAUSE 0x080044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person Shooting + Navigation and combat are primary objectives ---*/ +#define DIVIRTUAL_FIGHTING_FPS 0x09000000 +#define DIAXIS_FPS_ROTATE 0x09008201 /* Rotate character left/right */ +#define DIAXIS_FPS_MOVE 0x09010202 /* Move forward/backward */ +#define DIBUTTON_FPS_FIRE 0x09000401 /* Fire */ +#define DIBUTTON_FPS_WEAPONS 0x09000402 /* Select next weapon */ +#define DIBUTTON_FPS_APPLY 0x09000403 /* Use item */ +#define DIBUTTON_FPS_SELECT 0x09000404 /* Select next inventory item */ +#define DIBUTTON_FPS_CROUCH 0x09000405 /* Crouch/ climb down/ swim down */ +#define DIBUTTON_FPS_JUMP 0x09000406 /* Jump/ climb up/ swim up */ +#define DIAXIS_FPS_LOOKUPDOWN 0x09018203 /* Look up / down */ +#define DIBUTTON_FPS_STRAFE 0x09000407 /* Enable strafing while active */ +#define DIBUTTON_FPS_MENU 0x090004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FPS_GLANCE 0x09004601 /* Look around */ +#define DIBUTTON_FPS_DISPLAY 0x09004408 /* Shows next on-screen display option/ map */ +#define DIAXIS_FPS_SIDESTEP 0x09024204 /* Sidestep */ +#define DIBUTTON_FPS_DODGE 0x09004409 /* Dodge */ +#define DIBUTTON_FPS_GLANCEL 0x0900440A /* Glance Left */ +#define DIBUTTON_FPS_GLANCER 0x0900440B /* Glance Right */ +#define DIBUTTON_FPS_FIRESECONDARY 0x0900440C /* Alternative fire button */ +#define DIBUTTON_FPS_ROTATE_LEFT_LINK 0x0900C4E4 /* Fallback rotate left button */ +#define DIBUTTON_FPS_ROTATE_RIGHT_LINK 0x0900C4EC /* Fallback rotate right button */ +#define DIBUTTON_FPS_FORWARD_LINK 0x090144E0 /* Fallback forward button */ +#define DIBUTTON_FPS_BACKWARD_LINK 0x090144E8 /* Fallback backward button */ +#define DIBUTTON_FPS_GLANCE_UP_LINK 0x0901C4E0 /* Fallback look up button */ +#define DIBUTTON_FPS_GLANCE_DOWN_LINK 0x0901C4E8 /* Fallback look down button */ +#define DIBUTTON_FPS_STEP_LEFT_LINK 0x090244E4 /* Fallback step left button */ +#define DIBUTTON_FPS_STEP_RIGHT_LINK 0x090244EC /* Fallback step right button */ +#define DIBUTTON_FPS_DEVICE 0x090044FE /* Show input device and controls */ +#define DIBUTTON_FPS_PAUSE 0x090044FC /* Start / Pause / Restart game */ + +/*--- Fighting - Third Person action + Perspective of camera is behind the main character ---*/ +#define DIVIRTUAL_FIGHTING_THIRDPERSON 0x0A000000 +#define DIAXIS_TPS_TURN 0x0A020201 /* Turn left/right */ +#define DIAXIS_TPS_MOVE 0x0A010202 /* Move forward/backward */ +#define DIBUTTON_TPS_RUN 0x0A000401 /* Run or walk toggle switch */ +#define DIBUTTON_TPS_ACTION 0x0A000402 /* Action Button */ +#define DIBUTTON_TPS_SELECT 0x0A000403 /* Select next weapon */ +#define DIBUTTON_TPS_USE 0x0A000404 /* Use inventory item currently selected */ +#define DIBUTTON_TPS_JUMP 0x0A000405 /* Character Jumps */ +#define DIBUTTON_TPS_MENU 0x0A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_TPS_GLANCE 0x0A004601 /* Look around */ +#define DIBUTTON_TPS_VIEW 0x0A004406 /* Select camera view */ +#define DIBUTTON_TPS_STEPLEFT 0x0A004407 /* Character takes a left step */ +#define DIBUTTON_TPS_STEPRIGHT 0x0A004408 /* Character takes a right step */ +#define DIAXIS_TPS_STEP 0x0A00C203 /* Character steps left/right */ +#define DIBUTTON_TPS_DODGE 0x0A004409 /* Character dodges or ducks */ +#define DIBUTTON_TPS_INVENTORY 0x0A00440A /* Cycle through inventory */ +#define DIBUTTON_TPS_TURN_LEFT_LINK 0x0A0244E4 /* Fallback turn left button */ +#define DIBUTTON_TPS_TURN_RIGHT_LINK 0x0A0244EC /* Fallback turn right button */ +#define DIBUTTON_TPS_FORWARD_LINK 0x0A0144E0 /* Fallback forward button */ +#define DIBUTTON_TPS_BACKWARD_LINK 0x0A0144E8 /* Fallback backward button */ +#define DIBUTTON_TPS_GLANCE_UP_LINK 0x0A07C4E0 /* Fallback look up button */ +#define DIBUTTON_TPS_GLANCE_DOWN_LINK 0x0A07C4E8 /* Fallback look down button */ +#define DIBUTTON_TPS_GLANCE_LEFT_LINK 0x0A07C4E4 /* Fallback glance up button */ +#define DIBUTTON_TPS_GLANCE_RIGHT_LINK 0x0A07C4EC /* Fallback glance right button */ +#define DIBUTTON_TPS_DEVICE 0x0A0044FE /* Show input device and controls */ +#define DIBUTTON_TPS_PAUSE 0x0A0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Role Playing + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_ROLEPLAYING 0x0B000000 +#define DIAXIS_STRATEGYR_LATERAL 0x0B008201 /* sidestep - left/right */ +#define DIAXIS_STRATEGYR_MOVE 0x0B010202 /* move forward/backward */ +#define DIBUTTON_STRATEGYR_GET 0x0B000401 /* Acquire item */ +#define DIBUTTON_STRATEGYR_APPLY 0x0B000402 /* Use selected item */ +#define DIBUTTON_STRATEGYR_SELECT 0x0B000403 /* Select nextitem */ +#define DIBUTTON_STRATEGYR_ATTACK 0x0B000404 /* Attack */ +#define DIBUTTON_STRATEGYR_CAST 0x0B000405 /* Cast Spell */ +#define DIBUTTON_STRATEGYR_CROUCH 0x0B000406 /* Crouch */ +#define DIBUTTON_STRATEGYR_JUMP 0x0B000407 /* Jump */ +#define DIBUTTON_STRATEGYR_MENU 0x0B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_STRATEGYR_GLANCE 0x0B004601 /* Look around */ +#define DIBUTTON_STRATEGYR_MAP 0x0B004408 /* Cycle through map options */ +#define DIBUTTON_STRATEGYR_DISPLAY 0x0B004409 /* Shows next on-screen display option */ +#define DIAXIS_STRATEGYR_ROTATE 0x0B024203 /* Turn body left/right */ +#define DIBUTTON_STRATEGYR_LEFT_LINK 0x0B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYR_RIGHT_LINK 0x0B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYR_FORWARD_LINK 0x0B0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYR_BACK_LINK 0x0B0144E8 /* Fallback move backward button */ +#define DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK 0x0B0244E4 /* Fallback turn body left button */ +#define DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK 0x0B0244EC /* Fallback turn body right button */ +#define DIBUTTON_STRATEGYR_DEVICE 0x0B0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYR_PAUSE 0x0B0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Turn based + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_TURN 0x0C000000 +#define DIAXIS_STRATEGYT_LATERAL 0x0C008201 /* Sidestep left/right */ +#define DIAXIS_STRATEGYT_MOVE 0x0C010202 /* Move forward/backwards */ +#define DIBUTTON_STRATEGYT_SELECT 0x0C000401 /* Select unit or object */ +#define DIBUTTON_STRATEGYT_INSTRUCT 0x0C000402 /* Cycle through instructions */ +#define DIBUTTON_STRATEGYT_APPLY 0x0C000403 /* Apply selected instruction */ +#define DIBUTTON_STRATEGYT_TEAM 0x0C000404 /* Select next team / cycle through all */ +#define DIBUTTON_STRATEGYT_TURN 0x0C000405 /* Indicate turn over */ +#define DIBUTTON_STRATEGYT_MENU 0x0C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_STRATEGYT_ZOOM 0x0C004406 /* Zoom - in / out */ +#define DIBUTTON_STRATEGYT_MAP 0x0C004407 /* cycle through map options */ +#define DIBUTTON_STRATEGYT_DISPLAY 0x0C004408 /* shows next on-screen display options */ +#define DIBUTTON_STRATEGYT_LEFT_LINK 0x0C00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYT_RIGHT_LINK 0x0C00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYT_FORWARD_LINK 0x0C0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYT_BACK_LINK 0x0C0144E8 /* Fallback move back button */ +#define DIBUTTON_STRATEGYT_DEVICE 0x0C0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYT_PAUSE 0x0C0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hunting + Hunting ---*/ +#define DIVIRTUAL_SPORTS_HUNTING 0x0D000000 +#define DIAXIS_HUNTING_LATERAL 0x0D008201 /* sidestep left/right */ +#define DIAXIS_HUNTING_MOVE 0x0D010202 /* move forward/backwards */ +#define DIBUTTON_HUNTING_FIRE 0x0D000401 /* Fire selected weapon */ +#define DIBUTTON_HUNTING_AIM 0x0D000402 /* Select aim/move */ +#define DIBUTTON_HUNTING_WEAPON 0x0D000403 /* Select next weapon */ +#define DIBUTTON_HUNTING_BINOCULAR 0x0D000404 /* Look through Binoculars */ +#define DIBUTTON_HUNTING_CALL 0x0D000405 /* Make animal call */ +#define DIBUTTON_HUNTING_MAP 0x0D000406 /* View Map */ +#define DIBUTTON_HUNTING_SPECIAL 0x0D000407 /* Special game operation */ +#define DIBUTTON_HUNTING_MENU 0x0D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HUNTING_GLANCE 0x0D004601 /* Look around */ +#define DIBUTTON_HUNTING_DISPLAY 0x0D004408 /* show next on-screen display option */ +#define DIAXIS_HUNTING_ROTATE 0x0D024203 /* Turn body left/right */ +#define DIBUTTON_HUNTING_CROUCH 0x0D004409 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_HUNTING_JUMP 0x0D00440A /* Jump/ Climb up / Swim up */ +#define DIBUTTON_HUNTING_FIRESECONDARY 0x0D00440B /* Alternative fire button */ +#define DIBUTTON_HUNTING_LEFT_LINK 0x0D00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HUNTING_RIGHT_LINK 0x0D00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HUNTING_FORWARD_LINK 0x0D0144E0 /* Fallback move forward button */ +#define DIBUTTON_HUNTING_BACK_LINK 0x0D0144E8 /* Fallback move back button */ +#define DIBUTTON_HUNTING_ROTATE_LEFT_LINK 0x0D0244E4 /* Fallback turn body left button */ +#define DIBUTTON_HUNTING_ROTATE_RIGHT_LINK 0x0D0244EC /* Fallback turn body right button */ +#define DIBUTTON_HUNTING_DEVICE 0x0D0044FE /* Show input device and controls */ +#define DIBUTTON_HUNTING_PAUSE 0x0D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Fishing + Catching Fish is primary objective ---*/ +#define DIVIRTUAL_SPORTS_FISHING 0x0E000000 +#define DIAXIS_FISHING_LATERAL 0x0E008201 /* sidestep left/right */ +#define DIAXIS_FISHING_MOVE 0x0E010202 /* move forward/backwards */ +#define DIBUTTON_FISHING_CAST 0x0E000401 /* Cast line */ +#define DIBUTTON_FISHING_TYPE 0x0E000402 /* Select cast type */ +#define DIBUTTON_FISHING_BINOCULAR 0x0E000403 /* Look through Binocular */ +#define DIBUTTON_FISHING_BAIT 0x0E000404 /* Select type of Bait */ +#define DIBUTTON_FISHING_MAP 0x0E000405 /* View Map */ +#define DIBUTTON_FISHING_MENU 0x0E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FISHING_GLANCE 0x0E004601 /* Look around */ +#define DIBUTTON_FISHING_DISPLAY 0x0E004406 /* Show next on-screen display option */ +#define DIAXIS_FISHING_ROTATE 0x0E024203 /* Turn character left / right */ +#define DIBUTTON_FISHING_CROUCH 0x0E004407 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_FISHING_JUMP 0x0E004408 /* Jump/ Climb up / Swim up */ +#define DIBUTTON_FISHING_LEFT_LINK 0x0E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FISHING_RIGHT_LINK 0x0E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FISHING_FORWARD_LINK 0x0E0144E0 /* Fallback move forward button */ +#define DIBUTTON_FISHING_BACK_LINK 0x0E0144E8 /* Fallback move back button */ +#define DIBUTTON_FISHING_ROTATE_LEFT_LINK 0x0E0244E4 /* Fallback turn body left button */ +#define DIBUTTON_FISHING_ROTATE_RIGHT_LINK 0x0E0244EC /* Fallback turn body right button */ +#define DIBUTTON_FISHING_DEVICE 0x0E0044FE /* Show input device and controls */ +#define DIBUTTON_FISHING_PAUSE 0x0E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Batting + Batter control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_BAT 0x0F000000 +#define DIAXIS_BASEBALLB_LATERAL 0x0F008201 /* Aim left / right */ +#define DIAXIS_BASEBALLB_MOVE 0x0F010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLB_SELECT 0x0F000401 /* cycle through swing options */ +#define DIBUTTON_BASEBALLB_NORMAL 0x0F000402 /* normal swing */ +#define DIBUTTON_BASEBALLB_POWER 0x0F000403 /* swing for the fence */ +#define DIBUTTON_BASEBALLB_BUNT 0x0F000404 /* bunt */ +#define DIBUTTON_BASEBALLB_STEAL 0x0F000405 /* Base runner attempts to steal a base */ +#define DIBUTTON_BASEBALLB_BURST 0x0F000406 /* Base runner invokes burst of speed */ +#define DIBUTTON_BASEBALLB_SLIDE 0x0F000407 /* Base runner slides into base */ +#define DIBUTTON_BASEBALLB_CONTACT 0x0F000408 /* Contact swing */ +#define DIBUTTON_BASEBALLB_MENU 0x0F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLB_NOSTEAL 0x0F004409 /* Base runner goes back to a base */ +#define DIBUTTON_BASEBALLB_BOX 0x0F00440A /* Enter or exit batting box */ +#define DIBUTTON_BASEBALLB_LEFT_LINK 0x0F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLB_RIGHT_LINK 0x0F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLB_FORWARD_LINK 0x0F0144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLB_BACK_LINK 0x0F0144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLB_DEVICE 0x0F0044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLB_PAUSE 0x0F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Pitching + Pitcher control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_PITCH 0x10000000 +#define DIAXIS_BASEBALLP_LATERAL 0x10008201 /* Aim left / right */ +#define DIAXIS_BASEBALLP_MOVE 0x10010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLP_SELECT 0x10000401 /* cycle through pitch selections */ +#define DIBUTTON_BASEBALLP_PITCH 0x10000402 /* throw pitch */ +#define DIBUTTON_BASEBALLP_BASE 0x10000403 /* select base to throw to */ +#define DIBUTTON_BASEBALLP_THROW 0x10000404 /* throw to base */ +#define DIBUTTON_BASEBALLP_FAKE 0x10000405 /* Fake a throw to a base */ +#define DIBUTTON_BASEBALLP_MENU 0x100004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLP_WALK 0x10004406 /* Throw intentional walk / pitch out */ +#define DIBUTTON_BASEBALLP_LOOK 0x10004407 /* Look at runners on bases */ +#define DIBUTTON_BASEBALLP_LEFT_LINK 0x1000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLP_RIGHT_LINK 0x1000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLP_FORWARD_LINK 0x100144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLP_BACK_LINK 0x100144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLP_DEVICE 0x100044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLP_PAUSE 0x100044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Fielding + Fielder control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_FIELD 0x11000000 +#define DIAXIS_BASEBALLF_LATERAL 0x11008201 /* Aim left / right */ +#define DIAXIS_BASEBALLF_MOVE 0x11010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLF_NEAREST 0x11000401 /* Switch to fielder nearest to the ball */ +#define DIBUTTON_BASEBALLF_THROW1 0x11000402 /* Make conservative throw */ +#define DIBUTTON_BASEBALLF_THROW2 0x11000403 /* Make aggressive throw */ +#define DIBUTTON_BASEBALLF_BURST 0x11000404 /* Invoke burst of speed */ +#define DIBUTTON_BASEBALLF_JUMP 0x11000405 /* Jump to catch ball */ +#define DIBUTTON_BASEBALLF_DIVE 0x11000406 /* Dive to catch ball */ +#define DIBUTTON_BASEBALLF_MENU 0x110004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLF_SHIFTIN 0x11004407 /* Shift the infield positioning */ +#define DIBUTTON_BASEBALLF_SHIFTOUT 0x11004408 /* Shift the outfield positioning */ +#define DIBUTTON_BASEBALLF_AIM_LEFT_LINK 0x1100C4E4 /* Fallback aim left button */ +#define DIBUTTON_BASEBALLF_AIM_RIGHT_LINK 0x1100C4EC /* Fallback aim right button */ +#define DIBUTTON_BASEBALLF_FORWARD_LINK 0x110144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLF_BACK_LINK 0x110144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLF_DEVICE 0x110044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLF_PAUSE 0x110044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE 0x12000000 +#define DIAXIS_BBALLO_LATERAL 0x12008201 /* left / right */ +#define DIAXIS_BBALLO_MOVE 0x12010202 /* up / down */ +#define DIBUTTON_BBALLO_SHOOT 0x12000401 /* shoot basket */ +#define DIBUTTON_BBALLO_DUNK 0x12000402 /* dunk basket */ +#define DIBUTTON_BBALLO_PASS 0x12000403 /* throw pass */ +#define DIBUTTON_BBALLO_FAKE 0x12000404 /* fake shot or pass */ +#define DIBUTTON_BBALLO_SPECIAL 0x12000405 /* apply special move */ +#define DIBUTTON_BBALLO_PLAYER 0x12000406 /* select next player */ +#define DIBUTTON_BBALLO_BURST 0x12000407 /* invoke burst */ +#define DIBUTTON_BBALLO_CALL 0x12000408 /* call for ball / pass to me */ +#define DIBUTTON_BBALLO_MENU 0x120004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLO_GLANCE 0x12004601 /* scroll view */ +#define DIBUTTON_BBALLO_SCREEN 0x12004409 /* Call for screen */ +#define DIBUTTON_BBALLO_PLAY 0x1200440A /* Call for specific offensive play */ +#define DIBUTTON_BBALLO_JAB 0x1200440B /* Initiate fake drive to basket */ +#define DIBUTTON_BBALLO_POST 0x1200440C /* Perform post move */ +#define DIBUTTON_BBALLO_TIMEOUT 0x1200440D /* Time Out */ +#define DIBUTTON_BBALLO_SUBSTITUTE 0x1200440E /* substitute one player for another */ +#define DIBUTTON_BBALLO_LEFT_LINK 0x1200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLO_RIGHT_LINK 0x1200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLO_FORWARD_LINK 0x120144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLO_BACK_LINK 0x120144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLO_DEVICE 0x120044FE /* Show input device and controls */ +#define DIBUTTON_BBALLO_PAUSE 0x120044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE 0x13000000 +#define DIAXIS_BBALLD_LATERAL 0x13008201 /* left / right */ +#define DIAXIS_BBALLD_MOVE 0x13010202 /* up / down */ +#define DIBUTTON_BBALLD_JUMP 0x13000401 /* jump to block shot */ +#define DIBUTTON_BBALLD_STEAL 0x13000402 /* attempt to steal ball */ +#define DIBUTTON_BBALLD_FAKE 0x13000403 /* fake block or steal */ +#define DIBUTTON_BBALLD_SPECIAL 0x13000404 /* apply special move */ +#define DIBUTTON_BBALLD_PLAYER 0x13000405 /* select next player */ +#define DIBUTTON_BBALLD_BURST 0x13000406 /* invoke burst */ +#define DIBUTTON_BBALLD_PLAY 0x13000407 /* call for specific defensive play */ +#define DIBUTTON_BBALLD_MENU 0x130004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLD_GLANCE 0x13004601 /* scroll view */ +#define DIBUTTON_BBALLD_TIMEOUT 0x13004408 /* Time Out */ +#define DIBUTTON_BBALLD_SUBSTITUTE 0x13004409 /* substitute one player for another */ +#define DIBUTTON_BBALLD_LEFT_LINK 0x1300C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLD_RIGHT_LINK 0x1300C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLD_FORWARD_LINK 0x130144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLD_BACK_LINK 0x130144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLD_DEVICE 0x130044FE /* Show input device and controls */ +#define DIBUTTON_BBALLD_PAUSE 0x130044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Play + Play selection ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_FIELD 0x14000000 +#define DIBUTTON_FOOTBALLP_PLAY 0x14000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLP_SELECT 0x14000402 /* select play */ +#define DIBUTTON_FOOTBALLP_HELP 0x14000403 /* Bring up pop-up help */ +#define DIBUTTON_FOOTBALLP_MENU 0x140004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLP_DEVICE 0x140044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLP_PAUSE 0x140044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - QB + Offense: Quarterback / Kicker ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_QBCK 0x15000000 +#define DIAXIS_FOOTBALLQ_LATERAL 0x15008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLQ_MOVE 0x15010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLQ_SELECT 0x15000401 /* Select */ +#define DIBUTTON_FOOTBALLQ_SNAP 0x15000402 /* snap ball - start play */ +#define DIBUTTON_FOOTBALLQ_JUMP 0x15000403 /* jump over defender */ +#define DIBUTTON_FOOTBALLQ_SLIDE 0x15000404 /* Dive/Slide */ +#define DIBUTTON_FOOTBALLQ_PASS 0x15000405 /* throws pass to receiver */ +#define DIBUTTON_FOOTBALLQ_FAKE 0x15000406 /* pump fake pass or fake kick */ +#define DIBUTTON_FOOTBALLQ_MENU 0x150004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLQ_FAKESNAP 0x15004407 /* Fake snap */ +#define DIBUTTON_FOOTBALLQ_MOTION 0x15004408 /* Send receivers in motion */ +#define DIBUTTON_FOOTBALLQ_AUDIBLE 0x15004409 /* Change offensive play at line of scrimmage */ +#define DIBUTTON_FOOTBALLQ_LEFT_LINK 0x1500C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLQ_RIGHT_LINK 0x1500C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLQ_FORWARD_LINK 0x150144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLQ_BACK_LINK 0x150144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLQ_DEVICE 0x150044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLQ_PAUSE 0x150044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Offense + Offense - Runner ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE 0x16000000 +#define DIAXIS_FOOTBALLO_LATERAL 0x16008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLO_MOVE 0x16010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLO_JUMP 0x16000401 /* jump or hurdle over defender */ +#define DIBUTTON_FOOTBALLO_LEFTARM 0x16000402 /* holds out left arm */ +#define DIBUTTON_FOOTBALLO_RIGHTARM 0x16000403 /* holds out right arm */ +#define DIBUTTON_FOOTBALLO_THROW 0x16000404 /* throw pass or lateral ball to another runner */ +#define DIBUTTON_FOOTBALLO_SPIN 0x16000405 /* Spin to avoid defenders */ +#define DIBUTTON_FOOTBALLO_MENU 0x160004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLO_JUKE 0x16004406 /* Use special move to avoid defenders */ +#define DIBUTTON_FOOTBALLO_SHOULDER 0x16004407 /* Lower shoulder to run over defenders */ +#define DIBUTTON_FOOTBALLO_TURBO 0x16004408 /* Speed burst past defenders */ +#define DIBUTTON_FOOTBALLO_DIVE 0x16004409 /* Dive over defenders */ +#define DIBUTTON_FOOTBALLO_ZOOM 0x1600440A /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLO_SUBSTITUTE 0x1600440B /* substitute one player for another */ +#define DIBUTTON_FOOTBALLO_LEFT_LINK 0x1600C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLO_RIGHT_LINK 0x1600C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLO_FORWARD_LINK 0x160144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLO_BACK_LINK 0x160144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLO_DEVICE 0x160044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLO_PAUSE 0x160044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE 0x17000000 +#define DIAXIS_FOOTBALLD_LATERAL 0x17008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLD_MOVE 0x17010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLD_PLAY 0x17000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLD_SELECT 0x17000402 /* select player closest to the ball */ +#define DIBUTTON_FOOTBALLD_JUMP 0x17000403 /* jump to intercept or block */ +#define DIBUTTON_FOOTBALLD_TACKLE 0x17000404 /* tackler runner */ +#define DIBUTTON_FOOTBALLD_FAKE 0x17000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_FOOTBALLD_SUPERTACKLE 0x17000406 /* Initiate special tackle */ +#define DIBUTTON_FOOTBALLD_MENU 0x170004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLD_SPIN 0x17004407 /* Spin to beat offensive line */ +#define DIBUTTON_FOOTBALLD_SWIM 0x17004408 /* Swim to beat the offensive line */ +#define DIBUTTON_FOOTBALLD_BULLRUSH 0x17004409 /* Bull rush the offensive line */ +#define DIBUTTON_FOOTBALLD_RIP 0x1700440A /* Rip the offensive line */ +#define DIBUTTON_FOOTBALLD_AUDIBLE 0x1700440B /* Change defensive play at the line of scrimmage */ +#define DIBUTTON_FOOTBALLD_ZOOM 0x1700440C /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLD_SUBSTITUTE 0x1700440D /* substitute one player for another */ +#define DIBUTTON_FOOTBALLD_LEFT_LINK 0x1700C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLD_RIGHT_LINK 0x1700C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLD_FORWARD_LINK 0x170144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLD_BACK_LINK 0x170144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLD_DEVICE 0x170044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLD_PAUSE 0x170044FC /* Start / Pause / Restart game */ + +/*--- Sports - Golf + ---*/ +#define DIVIRTUAL_SPORTS_GOLF 0x18000000 +#define DIAXIS_GOLF_LATERAL 0x18008201 /* Move / Aim: left / right */ +#define DIAXIS_GOLF_MOVE 0x18010202 /* Move / Aim: up / down */ +#define DIBUTTON_GOLF_SWING 0x18000401 /* swing club */ +#define DIBUTTON_GOLF_SELECT 0x18000402 /* cycle between: club / swing strength / ball arc / ball spin */ +#define DIBUTTON_GOLF_UP 0x18000403 /* increase selection */ +#define DIBUTTON_GOLF_DOWN 0x18000404 /* decrease selection */ +#define DIBUTTON_GOLF_TERRAIN 0x18000405 /* shows terrain detail */ +#define DIBUTTON_GOLF_FLYBY 0x18000406 /* view the hole via a flyby */ +#define DIBUTTON_GOLF_MENU 0x180004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_GOLF_SCROLL 0x18004601 /* scroll view */ +#define DIBUTTON_GOLF_ZOOM 0x18004407 /* Zoom view in / out */ +#define DIBUTTON_GOLF_TIMEOUT 0x18004408 /* Call for time out */ +#define DIBUTTON_GOLF_SUBSTITUTE 0x18004409 /* substitute one player for another */ +#define DIBUTTON_GOLF_LEFT_LINK 0x1800C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_GOLF_RIGHT_LINK 0x1800C4EC /* Fallback sidestep right button */ +#define DIBUTTON_GOLF_FORWARD_LINK 0x180144E0 /* Fallback move forward button */ +#define DIBUTTON_GOLF_BACK_LINK 0x180144E8 /* Fallback move back button */ +#define DIBUTTON_GOLF_DEVICE 0x180044FE /* Show input device and controls */ +#define DIBUTTON_GOLF_PAUSE 0x180044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_OFFENSE 0x19000000 +#define DIAXIS_HOCKEYO_LATERAL 0x19008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYO_MOVE 0x19010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYO_SHOOT 0x19000401 /* Shoot */ +#define DIBUTTON_HOCKEYO_PASS 0x19000402 /* pass the puck */ +#define DIBUTTON_HOCKEYO_BURST 0x19000403 /* invoke speed burst */ +#define DIBUTTON_HOCKEYO_SPECIAL 0x19000404 /* invoke special move */ +#define DIBUTTON_HOCKEYO_FAKE 0x19000405 /* hold down to fake pass or kick */ +#define DIBUTTON_HOCKEYO_MENU 0x190004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYO_SCROLL 0x19004601 /* scroll view */ +#define DIBUTTON_HOCKEYO_ZOOM 0x19004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYO_STRATEGY 0x19004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYO_TIMEOUT 0x19004408 /* Call for time out */ +#define DIBUTTON_HOCKEYO_SUBSTITUTE 0x19004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYO_LEFT_LINK 0x1900C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYO_RIGHT_LINK 0x1900C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYO_FORWARD_LINK 0x190144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYO_BACK_LINK 0x190144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYO_DEVICE 0x190044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYO_PAUSE 0x190044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_DEFENSE 0x1A000000 +#define DIAXIS_HOCKEYD_LATERAL 0x1A008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYD_MOVE 0x1A010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYD_PLAYER 0x1A000401 /* control player closest to the puck */ +#define DIBUTTON_HOCKEYD_STEAL 0x1A000402 /* attempt steal */ +#define DIBUTTON_HOCKEYD_BURST 0x1A000403 /* speed burst or body check */ +#define DIBUTTON_HOCKEYD_BLOCK 0x1A000404 /* block puck */ +#define DIBUTTON_HOCKEYD_FAKE 0x1A000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_HOCKEYD_MENU 0x1A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYD_SCROLL 0x1A004601 /* scroll view */ +#define DIBUTTON_HOCKEYD_ZOOM 0x1A004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYD_STRATEGY 0x1A004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYD_TIMEOUT 0x1A004408 /* Call for time out */ +#define DIBUTTON_HOCKEYD_SUBSTITUTE 0x1A004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYD_LEFT_LINK 0x1A00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYD_RIGHT_LINK 0x1A00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYD_FORWARD_LINK 0x1A0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYD_BACK_LINK 0x1A0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYD_DEVICE 0x1A0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYD_PAUSE 0x1A0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Goalie + Goal tending ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_GOALIE 0x1B000000 +#define DIAXIS_HOCKEYG_LATERAL 0x1B008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYG_MOVE 0x1B010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYG_PASS 0x1B000401 /* pass puck */ +#define DIBUTTON_HOCKEYG_POKE 0x1B000402 /* poke / check / hack */ +#define DIBUTTON_HOCKEYG_STEAL 0x1B000403 /* attempt steal */ +#define DIBUTTON_HOCKEYG_BLOCK 0x1B000404 /* block puck */ +#define DIBUTTON_HOCKEYG_MENU 0x1B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYG_SCROLL 0x1B004601 /* scroll view */ +#define DIBUTTON_HOCKEYG_ZOOM 0x1B004405 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYG_STRATEGY 0x1B004406 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYG_TIMEOUT 0x1B004407 /* Call for time out */ +#define DIBUTTON_HOCKEYG_SUBSTITUTE 0x1B004408 /* substitute one player for another */ +#define DIBUTTON_HOCKEYG_LEFT_LINK 0x1B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYG_RIGHT_LINK 0x1B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYG_FORWARD_LINK 0x1B0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYG_BACK_LINK 0x1B0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYG_DEVICE 0x1B0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYG_PAUSE 0x1B0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Mountain Biking + ---*/ +#define DIVIRTUAL_SPORTS_BIKING_MOUNTAIN 0x1C000000 +#define DIAXIS_BIKINGM_TURN 0x1C008201 /* left / right */ +#define DIAXIS_BIKINGM_PEDAL 0x1C010202 /* Pedal faster / slower / brake */ +#define DIBUTTON_BIKINGM_JUMP 0x1C000401 /* jump over obstacle */ +#define DIBUTTON_BIKINGM_CAMERA 0x1C000402 /* switch camera view */ +#define DIBUTTON_BIKINGM_SPECIAL1 0x1C000403 /* perform first special move */ +#define DIBUTTON_BIKINGM_SELECT 0x1C000404 /* Select */ +#define DIBUTTON_BIKINGM_SPECIAL2 0x1C000405 /* perform second special move */ +#define DIBUTTON_BIKINGM_MENU 0x1C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BIKINGM_SCROLL 0x1C004601 /* scroll view */ +#define DIBUTTON_BIKINGM_ZOOM 0x1C004406 /* Zoom view in / out */ +#define DIAXIS_BIKINGM_BRAKE 0x1C044203 /* Brake axis */ +#define DIBUTTON_BIKINGM_LEFT_LINK 0x1C00C4E4 /* Fallback turn left button */ +#define DIBUTTON_BIKINGM_RIGHT_LINK 0x1C00C4EC /* Fallback turn right button */ +#define DIBUTTON_BIKINGM_FASTER_LINK 0x1C0144E0 /* Fallback pedal faster button */ +#define DIBUTTON_BIKINGM_SLOWER_LINK 0x1C0144E8 /* Fallback pedal slower button */ +#define DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK 0x1C0444E8 /* Fallback brake button */ +#define DIBUTTON_BIKINGM_DEVICE 0x1C0044FE /* Show input device and controls */ +#define DIBUTTON_BIKINGM_PAUSE 0x1C0044FC /* Start / Pause / Restart game */ + +/*--- Sports: Skiing / Snowboarding / Skateboarding + ---*/ +#define DIVIRTUAL_SPORTS_SKIING 0x1D000000 +#define DIAXIS_SKIING_TURN 0x1D008201 /* left / right */ +#define DIAXIS_SKIING_SPEED 0x1D010202 /* faster / slower */ +#define DIBUTTON_SKIING_JUMP 0x1D000401 /* Jump */ +#define DIBUTTON_SKIING_CROUCH 0x1D000402 /* crouch down */ +#define DIBUTTON_SKIING_CAMERA 0x1D000403 /* switch camera view */ +#define DIBUTTON_SKIING_SPECIAL1 0x1D000404 /* perform first special move */ +#define DIBUTTON_SKIING_SELECT 0x1D000405 /* Select */ +#define DIBUTTON_SKIING_SPECIAL2 0x1D000406 /* perform second special move */ +#define DIBUTTON_SKIING_MENU 0x1D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SKIING_GLANCE 0x1D004601 /* scroll view */ +#define DIBUTTON_SKIING_ZOOM 0x1D004407 /* Zoom view in / out */ +#define DIBUTTON_SKIING_LEFT_LINK 0x1D00C4E4 /* Fallback turn left button */ +#define DIBUTTON_SKIING_RIGHT_LINK 0x1D00C4EC /* Fallback turn right button */ +#define DIBUTTON_SKIING_FASTER_LINK 0x1D0144E0 /* Fallback increase speed button */ +#define DIBUTTON_SKIING_SLOWER_LINK 0x1D0144E8 /* Fallback decrease speed button */ +#define DIBUTTON_SKIING_DEVICE 0x1D0044FE /* Show input device and controls */ +#define DIBUTTON_SKIING_PAUSE 0x1D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_OFFENSE 0x1E000000 +#define DIAXIS_SOCCERO_LATERAL 0x1E008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERO_MOVE 0x1E010202 /* Move / Aim: up / down */ +#define DIAXIS_SOCCERO_BEND 0x1E018203 /* Bend to soccer shot/pass */ +#define DIBUTTON_SOCCERO_SHOOT 0x1E000401 /* Shoot the ball */ +#define DIBUTTON_SOCCERO_PASS 0x1E000402 /* Pass */ +#define DIBUTTON_SOCCERO_FAKE 0x1E000403 /* Fake */ +#define DIBUTTON_SOCCERO_PLAYER 0x1E000404 /* Select next player */ +#define DIBUTTON_SOCCERO_SPECIAL1 0x1E000405 /* Apply special move */ +#define DIBUTTON_SOCCERO_SELECT 0x1E000406 /* Select special move */ +#define DIBUTTON_SOCCERO_MENU 0x1E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERO_GLANCE 0x1E004601 /* scroll view */ +#define DIBUTTON_SOCCERO_SUBSTITUTE 0x1E004407 /* Substitute one player for another */ +#define DIBUTTON_SOCCERO_SHOOTLOW 0x1E004408 /* Shoot the ball low */ +#define DIBUTTON_SOCCERO_SHOOTHIGH 0x1E004409 /* Shoot the ball high */ +#define DIBUTTON_SOCCERO_PASSTHRU 0x1E00440A /* Make a thru pass */ +#define DIBUTTON_SOCCERO_SPRINT 0x1E00440B /* Sprint / turbo boost */ +#define DIBUTTON_SOCCERO_CONTROL 0x1E00440C /* Obtain control of the ball */ +#define DIBUTTON_SOCCERO_HEAD 0x1E00440D /* Attempt to head the ball */ +#define DIBUTTON_SOCCERO_LEFT_LINK 0x1E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERO_RIGHT_LINK 0x1E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERO_FORWARD_LINK 0x1E0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERO_BACK_LINK 0x1E0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERO_DEVICE 0x1E0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERO_PAUSE 0x1E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_DEFENSE 0x1F000000 +#define DIAXIS_SOCCERD_LATERAL 0x1F008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERD_MOVE 0x1F010202 /* Move / Aim: up / down */ +#define DIBUTTON_SOCCERD_BLOCK 0x1F000401 /* Attempt to block shot */ +#define DIBUTTON_SOCCERD_STEAL 0x1F000402 /* Attempt to steal ball */ +#define DIBUTTON_SOCCERD_FAKE 0x1F000403 /* Fake a block or a steal */ +#define DIBUTTON_SOCCERD_PLAYER 0x1F000404 /* Select next player */ +#define DIBUTTON_SOCCERD_SPECIAL 0x1F000405 /* Apply special move */ +#define DIBUTTON_SOCCERD_SELECT 0x1F000406 /* Select special move */ +#define DIBUTTON_SOCCERD_SLIDE 0x1F000407 /* Attempt a slide tackle */ +#define DIBUTTON_SOCCERD_MENU 0x1F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERD_GLANCE 0x1F004601 /* scroll view */ +#define DIBUTTON_SOCCERD_FOUL 0x1F004408 /* Initiate a foul / hard-foul */ +#define DIBUTTON_SOCCERD_HEAD 0x1F004409 /* Attempt a Header */ +#define DIBUTTON_SOCCERD_CLEAR 0x1F00440A /* Attempt to clear the ball down the field */ +#define DIBUTTON_SOCCERD_GOALIECHARGE 0x1F00440B /* Make the goalie charge out of the box */ +#define DIBUTTON_SOCCERD_SUBSTITUTE 0x1F00440C /* Substitute one player for another */ +#define DIBUTTON_SOCCERD_LEFT_LINK 0x1F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERD_RIGHT_LINK 0x1F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERD_FORWARD_LINK 0x1F0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERD_BACK_LINK 0x1F0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERD_DEVICE 0x1F0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERD_PAUSE 0x1F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Racquet + Tennis - Table-Tennis - Squash ---*/ +#define DIVIRTUAL_SPORTS_RACQUET 0x20000000 +#define DIAXIS_RACQUET_LATERAL 0x20008201 /* Move / Aim: left / right */ +#define DIAXIS_RACQUET_MOVE 0x20010202 /* Move / Aim: up / down */ +#define DIBUTTON_RACQUET_SWING 0x20000401 /* Swing racquet */ +#define DIBUTTON_RACQUET_BACKSWING 0x20000402 /* Swing backhand */ +#define DIBUTTON_RACQUET_SMASH 0x20000403 /* Smash shot */ +#define DIBUTTON_RACQUET_SPECIAL 0x20000404 /* Special shot */ +#define DIBUTTON_RACQUET_SELECT 0x20000405 /* Select special shot */ +#define DIBUTTON_RACQUET_MENU 0x200004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_RACQUET_GLANCE 0x20004601 /* scroll view */ +#define DIBUTTON_RACQUET_TIMEOUT 0x20004406 /* Call for time out */ +#define DIBUTTON_RACQUET_SUBSTITUTE 0x20004407 /* Substitute one player for another */ +#define DIBUTTON_RACQUET_LEFT_LINK 0x2000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_RACQUET_RIGHT_LINK 0x2000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_RACQUET_FORWARD_LINK 0x200144E0 /* Fallback move forward button */ +#define DIBUTTON_RACQUET_BACK_LINK 0x200144E8 /* Fallback move back button */ +#define DIBUTTON_RACQUET_DEVICE 0x200044FE /* Show input device and controls */ +#define DIBUTTON_RACQUET_PAUSE 0x200044FC /* Start / Pause / Restart game */ + +/*--- Arcade- 2D + Side to Side movement ---*/ +#define DIVIRTUAL_ARCADE_SIDE2SIDE 0x21000000 +#define DIAXIS_ARCADES_LATERAL 0x21008201 /* left / right */ +#define DIAXIS_ARCADES_MOVE 0x21010202 /* up / down */ +#define DIBUTTON_ARCADES_THROW 0x21000401 /* throw object */ +#define DIBUTTON_ARCADES_CARRY 0x21000402 /* carry object */ +#define DIBUTTON_ARCADES_ATTACK 0x21000403 /* attack */ +#define DIBUTTON_ARCADES_SPECIAL 0x21000404 /* apply special move */ +#define DIBUTTON_ARCADES_SELECT 0x21000405 /* select special move */ +#define DIBUTTON_ARCADES_MENU 0x210004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADES_VIEW 0x21004601 /* scroll view left / right / up / down */ +#define DIBUTTON_ARCADES_LEFT_LINK 0x2100C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADES_RIGHT_LINK 0x2100C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADES_FORWARD_LINK 0x210144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADES_BACK_LINK 0x210144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADES_VIEW_UP_LINK 0x2107C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADES_VIEW_DOWN_LINK 0x2107C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADES_VIEW_LEFT_LINK 0x2107C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADES_VIEW_RIGHT_LINK 0x2107C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADES_DEVICE 0x210044FE /* Show input device and controls */ +#define DIBUTTON_ARCADES_PAUSE 0x210044FC /* Start / Pause / Restart game */ + +/*--- Arcade - Platform Game + Character moves around on screen ---*/ +#define DIVIRTUAL_ARCADE_PLATFORM 0x22000000 +#define DIAXIS_ARCADEP_LATERAL 0x22008201 /* Left / right */ +#define DIAXIS_ARCADEP_MOVE 0x22010202 /* Up / down */ +#define DIBUTTON_ARCADEP_JUMP 0x22000401 /* Jump */ +#define DIBUTTON_ARCADEP_FIRE 0x22000402 /* Fire */ +#define DIBUTTON_ARCADEP_CROUCH 0x22000403 /* Crouch */ +#define DIBUTTON_ARCADEP_SPECIAL 0x22000404 /* Apply special move */ +#define DIBUTTON_ARCADEP_SELECT 0x22000405 /* Select special move */ +#define DIBUTTON_ARCADEP_MENU 0x220004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADEP_VIEW 0x22004601 /* Scroll view */ +#define DIBUTTON_ARCADEP_FIRESECONDARY 0x22004406 /* Alternative fire button */ +#define DIBUTTON_ARCADEP_LEFT_LINK 0x2200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADEP_RIGHT_LINK 0x2200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADEP_FORWARD_LINK 0x220144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADEP_BACK_LINK 0x220144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADEP_VIEW_UP_LINK 0x2207C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADEP_VIEW_DOWN_LINK 0x2207C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADEP_VIEW_LEFT_LINK 0x2207C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADEP_VIEW_RIGHT_LINK 0x2207C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADEP_DEVICE 0x220044FE /* Show input device and controls */ +#define DIBUTTON_ARCADEP_PAUSE 0x220044FC /* Start / Pause / Restart game */ + +/*--- CAD - 2D Object Control + Controls to select and move objects in 2D ---*/ +#define DIVIRTUAL_CAD_2DCONTROL 0x23000000 +#define DIAXIS_2DCONTROL_LATERAL 0x23008201 /* Move view left / right */ +#define DIAXIS_2DCONTROL_MOVE 0x23010202 /* Move view up / down */ +#define DIAXIS_2DCONTROL_INOUT 0x23018203 /* Zoom - in / out */ +#define DIBUTTON_2DCONTROL_SELECT 0x23000401 /* Select Object */ +#define DIBUTTON_2DCONTROL_SPECIAL1 0x23000402 /* Do first special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL 0x23000403 /* Select special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL2 0x23000404 /* Do second special operation */ +#define DIBUTTON_2DCONTROL_MENU 0x230004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_2DCONTROL_HATSWITCH 0x23004601 /* Hat switch */ +#define DIAXIS_2DCONTROL_ROTATEZ 0x23024204 /* Rotate view clockwise / counterclockwise */ +#define DIBUTTON_2DCONTROL_DISPLAY 0x23004405 /* Shows next on-screen display options */ +#define DIBUTTON_2DCONTROL_DEVICE 0x230044FE /* Show input device and controls */ +#define DIBUTTON_2DCONTROL_PAUSE 0x230044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D object control + Controls to select and move objects within a 3D environment ---*/ +#define DIVIRTUAL_CAD_3DCONTROL 0x24000000 +#define DIAXIS_3DCONTROL_LATERAL 0x24008201 /* Move view left / right */ +#define DIAXIS_3DCONTROL_MOVE 0x24010202 /* Move view up / down */ +#define DIAXIS_3DCONTROL_INOUT 0x24018203 /* Zoom - in / out */ +#define DIBUTTON_3DCONTROL_SELECT 0x24000401 /* Select Object */ +#define DIBUTTON_3DCONTROL_SPECIAL1 0x24000402 /* Do first special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL 0x24000403 /* Select special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL2 0x24000404 /* Do second special operation */ +#define DIBUTTON_3DCONTROL_MENU 0x240004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_3DCONTROL_HATSWITCH 0x24004601 /* Hat switch */ +#define DIAXIS_3DCONTROL_ROTATEX 0x24034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_3DCONTROL_ROTATEY 0x2402C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_3DCONTROL_ROTATEZ 0x24024206 /* Rotate view left / right */ +#define DIBUTTON_3DCONTROL_DISPLAY 0x24004405 /* Show next on-screen display options */ +#define DIBUTTON_3DCONTROL_DEVICE 0x240044FE /* Show input device and controls */ +#define DIBUTTON_3DCONTROL_PAUSE 0x240044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Navigation - Fly through + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_FLYBY 0x25000000 +#define DIAXIS_CADF_LATERAL 0x25008201 /* move view left / right */ +#define DIAXIS_CADF_MOVE 0x25010202 /* move view up / down */ +#define DIAXIS_CADF_INOUT 0x25018203 /* in / out */ +#define DIBUTTON_CADF_SELECT 0x25000401 /* Select Object */ +#define DIBUTTON_CADF_SPECIAL1 0x25000402 /* do first special operation */ +#define DIBUTTON_CADF_SPECIAL 0x25000403 /* Select special operation */ +#define DIBUTTON_CADF_SPECIAL2 0x25000404 /* do second special operation */ +#define DIBUTTON_CADF_MENU 0x250004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADF_HATSWITCH 0x25004601 /* Hat switch */ +#define DIAXIS_CADF_ROTATEX 0x25034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADF_ROTATEY 0x2502C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADF_ROTATEZ 0x25024206 /* Rotate view left / right */ +#define DIBUTTON_CADF_DISPLAY 0x25004405 /* shows next on-screen display options */ +#define DIBUTTON_CADF_DEVICE 0x250044FE /* Show input device and controls */ +#define DIBUTTON_CADF_PAUSE 0x250044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Model Control + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_MODEL 0x26000000 +#define DIAXIS_CADM_LATERAL 0x26008201 /* move view left / right */ +#define DIAXIS_CADM_MOVE 0x26010202 /* move view up / down */ +#define DIAXIS_CADM_INOUT 0x26018203 /* in / out */ +#define DIBUTTON_CADM_SELECT 0x26000401 /* Select Object */ +#define DIBUTTON_CADM_SPECIAL1 0x26000402 /* do first special operation */ +#define DIBUTTON_CADM_SPECIAL 0x26000403 /* Select special operation */ +#define DIBUTTON_CADM_SPECIAL2 0x26000404 /* do second special operation */ +#define DIBUTTON_CADM_MENU 0x260004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADM_HATSWITCH 0x26004601 /* Hat switch */ +#define DIAXIS_CADM_ROTATEX 0x26034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADM_ROTATEY 0x2602C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADM_ROTATEZ 0x26024206 /* Rotate view left / right */ +#define DIBUTTON_CADM_DISPLAY 0x26004405 /* shows next on-screen display options */ +#define DIBUTTON_CADM_DEVICE 0x260044FE /* Show input device and controls */ +#define DIBUTTON_CADM_PAUSE 0x260044FC /* Start / Pause / Restart game */ + +/*--- Control - Media Equipment + Remote ---*/ +#define DIVIRTUAL_REMOTE_CONTROL 0x27000000 +#define DIAXIS_REMOTE_SLIDER 0x27050201 /* Slider for adjustment: volume / color / bass / etc */ +#define DIBUTTON_REMOTE_MUTE 0x27000401 /* Set volume on current device to zero */ +#define DIBUTTON_REMOTE_SELECT 0x27000402 /* Next/previous: channel/ track / chapter / picture / station */ +#define DIBUTTON_REMOTE_PLAY 0x27002403 /* Start or pause entertainment on current device */ +#define DIBUTTON_REMOTE_CUE 0x27002404 /* Move through current media */ +#define DIBUTTON_REMOTE_REVIEW 0x27002405 /* Move through current media */ +#define DIBUTTON_REMOTE_CHANGE 0x27002406 /* Select next device */ +#define DIBUTTON_REMOTE_RECORD 0x27002407 /* Start recording the current media */ +#define DIBUTTON_REMOTE_MENU 0x270004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_REMOTE_SLIDER2 0x27054202 /* Slider for adjustment: volume */ +#define DIBUTTON_REMOTE_TV 0x27005C08 /* Select TV */ +#define DIBUTTON_REMOTE_CABLE 0x27005C09 /* Select cable box */ +#define DIBUTTON_REMOTE_CD 0x27005C0A /* Select CD player */ +#define DIBUTTON_REMOTE_VCR 0x27005C0B /* Select VCR */ +#define DIBUTTON_REMOTE_TUNER 0x27005C0C /* Select tuner */ +#define DIBUTTON_REMOTE_DVD 0x27005C0D /* Select DVD player */ +#define DIBUTTON_REMOTE_ADJUST 0x27005C0E /* Enter device adjustment menu */ +#define DIBUTTON_REMOTE_DIGIT0 0x2700540F /* Digit 0 */ +#define DIBUTTON_REMOTE_DIGIT1 0x27005410 /* Digit 1 */ +#define DIBUTTON_REMOTE_DIGIT2 0x27005411 /* Digit 2 */ +#define DIBUTTON_REMOTE_DIGIT3 0x27005412 /* Digit 3 */ +#define DIBUTTON_REMOTE_DIGIT4 0x27005413 /* Digit 4 */ +#define DIBUTTON_REMOTE_DIGIT5 0x27005414 /* Digit 5 */ +#define DIBUTTON_REMOTE_DIGIT6 0x27005415 /* Digit 6 */ +#define DIBUTTON_REMOTE_DIGIT7 0x27005416 /* Digit 7 */ +#define DIBUTTON_REMOTE_DIGIT8 0x27005417 /* Digit 8 */ +#define DIBUTTON_REMOTE_DIGIT9 0x27005418 /* Digit 9 */ +#define DIBUTTON_REMOTE_DEVICE 0x270044FE /* Show input device and controls */ +#define DIBUTTON_REMOTE_PAUSE 0x270044FC /* Start / Pause / Restart game */ + +/*--- Control- Web + Help or Browser ---*/ +#define DIVIRTUAL_BROWSER_CONTROL 0x28000000 +#define DIAXIS_BROWSER_LATERAL 0x28008201 /* Move on screen pointer */ +#define DIAXIS_BROWSER_MOVE 0x28010202 /* Move on screen pointer */ +#define DIBUTTON_BROWSER_SELECT 0x28000401 /* Select current item */ +#define DIAXIS_BROWSER_VIEW 0x28018203 /* Move view up/down */ +#define DIBUTTON_BROWSER_REFRESH 0x28000402 /* Refresh */ +#define DIBUTTON_BROWSER_MENU 0x280004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BROWSER_SEARCH 0x28004403 /* Use search tool */ +#define DIBUTTON_BROWSER_STOP 0x28004404 /* Cease current update */ +#define DIBUTTON_BROWSER_HOME 0x28004405 /* Go directly to "home" location */ +#define DIBUTTON_BROWSER_FAVORITES 0x28004406 /* Mark current site as favorite */ +#define DIBUTTON_BROWSER_NEXT 0x28004407 /* Select Next page */ +#define DIBUTTON_BROWSER_PREVIOUS 0x28004408 /* Select Previous page */ +#define DIBUTTON_BROWSER_HISTORY 0x28004409 /* Show/Hide History */ +#define DIBUTTON_BROWSER_PRINT 0x2800440A /* Print current page */ +#define DIBUTTON_BROWSER_DEVICE 0x280044FE /* Show input device and controls */ +#define DIBUTTON_BROWSER_PAUSE 0x280044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Giant Walking Robot + Walking tank with weapons ---*/ +#define DIVIRTUAL_DRIVING_MECHA 0x29000000 +#define DIAXIS_MECHA_STEER 0x29008201 /* Turns mecha left/right */ +#define DIAXIS_MECHA_TORSO 0x29010202 /* Tilts torso forward/backward */ +#define DIAXIS_MECHA_ROTATE 0x29020203 /* Turns torso left/right */ +#define DIAXIS_MECHA_THROTTLE 0x29038204 /* Engine Speed */ +#define DIBUTTON_MECHA_FIRE 0x29000401 /* Fire */ +#define DIBUTTON_MECHA_WEAPONS 0x29000402 /* Select next weapon group */ +#define DIBUTTON_MECHA_TARGET 0x29000403 /* Select closest enemy available target */ +#define DIBUTTON_MECHA_REVERSE 0x29000404 /* Toggles throttle in/out of reverse */ +#define DIBUTTON_MECHA_ZOOM 0x29000405 /* Zoom in/out targeting reticule */ +#define DIBUTTON_MECHA_JUMP 0x29000406 /* Fires jump jets */ +#define DIBUTTON_MECHA_MENU 0x290004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_MECHA_CENTER 0x29004407 /* Center torso to legs */ +#define DIHATSWITCH_MECHA_GLANCE 0x29004601 /* Look around */ +#define DIBUTTON_MECHA_VIEW 0x29004408 /* Cycle through view options */ +#define DIBUTTON_MECHA_FIRESECONDARY 0x29004409 /* Alternative fire button */ +#define DIBUTTON_MECHA_LEFT_LINK 0x2900C4E4 /* Fallback steer left button */ +#define DIBUTTON_MECHA_RIGHT_LINK 0x2900C4EC /* Fallback steer right button */ +#define DIBUTTON_MECHA_FORWARD_LINK 0x290144E0 /* Fallback tilt torso forward button */ +#define DIBUTTON_MECHA_BACK_LINK 0x290144E8 /* Fallback tilt toroso backward button */ +#define DIBUTTON_MECHA_ROTATE_LEFT_LINK 0x290244E4 /* Fallback rotate toroso right button */ +#define DIBUTTON_MECHA_ROTATE_RIGHT_LINK 0x290244EC /* Fallback rotate torso left button */ +#define DIBUTTON_MECHA_FASTER_LINK 0x2903C4E0 /* Fallback increase engine speed */ +#define DIBUTTON_MECHA_SLOWER_LINK 0x2903C4E8 /* Fallback decrease engine speed */ +#define DIBUTTON_MECHA_DEVICE 0x290044FE /* Show input device and controls */ +#define DIBUTTON_MECHA_PAUSE 0x290044FC /* Start / Pause / Restart game */ + +/* + * "ANY" semantics can be used as a last resort to get mappings for actions + * that match nothing in the chosen virtual genre. These semantics will be + * mapped at a lower priority that virtual genre semantics. Also, hardware + * vendors will not be able to provide sensible mappings for these unless + * they provide application specific mappings. + */ +#define DIAXIS_ANY_X_1 0xFF00C201 +#define DIAXIS_ANY_X_2 0xFF00C202 +#define DIAXIS_ANY_Y_1 0xFF014201 +#define DIAXIS_ANY_Y_2 0xFF014202 +#define DIAXIS_ANY_Z_1 0xFF01C201 +#define DIAXIS_ANY_Z_2 0xFF01C202 +#define DIAXIS_ANY_R_1 0xFF024201 +#define DIAXIS_ANY_R_2 0xFF024202 +#define DIAXIS_ANY_U_1 0xFF02C201 +#define DIAXIS_ANY_U_2 0xFF02C202 +#define DIAXIS_ANY_V_1 0xFF034201 +#define DIAXIS_ANY_V_2 0xFF034202 +#define DIAXIS_ANY_A_1 0xFF03C201 +#define DIAXIS_ANY_A_2 0xFF03C202 +#define DIAXIS_ANY_B_1 0xFF044201 +#define DIAXIS_ANY_B_2 0xFF044202 +#define DIAXIS_ANY_C_1 0xFF04C201 +#define DIAXIS_ANY_C_2 0xFF04C202 +#define DIAXIS_ANY_S_1 0xFF054201 +#define DIAXIS_ANY_S_2 0xFF054202 + +#define DIAXIS_ANY_1 0xFF004201 +#define DIAXIS_ANY_2 0xFF004202 +#define DIAXIS_ANY_3 0xFF004203 +#define DIAXIS_ANY_4 0xFF004204 + +#define DIPOV_ANY_1 0xFF004601 +#define DIPOV_ANY_2 0xFF004602 +#define DIPOV_ANY_3 0xFF004603 +#define DIPOV_ANY_4 0xFF004604 + +#define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) + + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUT_INCLUDED__ */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************/ + +#ifdef _INC_MMSYSTEM +#ifndef MMNOJOY + +#ifndef __VJOYDX_INCLUDED__ +#define __VJOYDX_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + */ +#define JOY_PASSDRIVERDATA 0x10000000l + +/* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + */ +WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); + +#ifndef DIJ_RINGZERO +/* + * Invoke the joystick control panel directly, using the passed window handle + * as the parent of the dialog. This API is only supported for compatibility + * purposes; new applications should use the RunControlPanel method of a + * device interface for a game controller. + * The API is called by using the function pointer returned by + * GetProcAddress( hCPL, TEXT("ShowJoyCPL") ) where hCPL is a HMODULE returned + * by LoadLibrary( TEXT("joy.cpl") ). The typedef is provided to allow + * declaration and casting of an appropriately typed variable. + */ +void WINAPI ShowJoyCPL( HWND hWnd ); +typedef void (WINAPI* LPFNSHOWJOYCPL)( HWND hWnd ); +#endif /* DIJ_RINGZERO */ + + +/* + * Hardware Setting indicating that the device is a headtracker + */ +#define JOY_HWS_ISHEADTRACKER 0x02000000l + +/* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + */ +#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l + +/* + * Hardware Setting indicating that the driver needs a standard + * gameport in order to communicate with the device. + */ +#define JOY_HWS_ISANALOGPORTDRIVER 0x08000000l + +/* + * Hardware Setting indicating that VJoyD should not load this + * driver, it will be loaded externally and will register with + * VJoyD of it's own accord. + */ +#define JOY_HWS_AUTOLOAD 0x10000000l + +/* + * Hardware Setting indicating that the driver acquires any + * resources needed without needing a devnode through VJoyD. + */ +#define JOY_HWS_NODEVNODE 0x20000000l + + +/* + * Hardware Setting indicating that the device is a gameport bus + */ +#define JOY_HWS_ISGAMEPORTBUS 0x80000000l +#define JOY_HWS_GAMEPORTBUSBUSY 0x00000001l + +/* + * Usage Setting indicating that the settings are volatile and + * should be removed if still present on a reboot. + */ +#define JOY_US_VOLATILE 0x00000008L + +#ifdef __cplusplus +}; +#endif + +#endif /* __VJOYDX_INCLUDED__ */ + +#endif /* not MMNOJOY */ +#endif /* _INC_MMSYSTEM */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#ifdef _INC_MMDDK +#ifndef MMNOJOYDEV + +#ifndef __VJOYDXD_INCLUDED__ +#define __VJOYDXD_INCLUDED__ +/* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + */ +#define JOY_OEMPOLL_PASSDRIVERDATA 7 + +#endif /* __VJOYDXD_INCLUDED__ */ + +#endif /* not MMNOJOYDEV */ +#endif /* _INC_MMDDK */ + +#endif /* DIJ_RINGZERO */ + diff --git a/SDK/dxSDK/Include/dinputd.h b/SDK/dxSDK/Include/dinputd.h new file mode 100644 index 00000000..f5343538 --- /dev/null +++ b/SDK/dxSDK/Include/dinputd.h @@ -0,0 +1,755 @@ +/**************************************************************************** + * + * Copyright (C) 1995-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinputd.h + * Content: DirectInput include file for device driver implementors + * + ****************************************************************************/ +#ifndef __DINPUTD_INCLUDED__ +#define __DINPUTD_INCLUDED__ + +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +DEFINE_GUID(IID_IDirectInputEffectDriver, 0x02538130,0x898F,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(IID_IDirectInputJoyConfig, 0x1DE12AB1,0xC9F5,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputPIDDriver, 0xEEC6993A,0xB3FD,0x11D2,0xA9,0x16,0x00,0xC0,0x4F,0xB9,0x86,0x38); + +DEFINE_GUID(IID_IDirectInputJoyConfig8, 0xeb0d7dfa,0x1990,0x4f27,0xb4,0xd6,0xed,0xf2,0xee,0xc4,0xa4,0x4c); + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputEffectDriver + * + ****************************************************************************/ + +typedef struct DIOBJECTATTRIBUTES { + DWORD dwFlags; + WORD wUsagePage; + WORD wUsage; +} DIOBJECTATTRIBUTES, *LPDIOBJECTATTRIBUTES; +typedef const DIOBJECTATTRIBUTES *LPCDIOBJECTATTRIBUTES; + +typedef struct DIFFOBJECTATTRIBUTES { + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; +} DIFFOBJECTATTRIBUTES, *LPDIFFOBJECTATTRIBUTES; +typedef const DIFFOBJECTATTRIBUTES *LPCDIFFOBJECTATTRIBUTES; + +typedef struct DIOBJECTCALIBRATION { + LONG lMin; + LONG lCenter; + LONG lMax; +} DIOBJECTCALIBRATION, *LPDIOBJECTCALIBRATION; +typedef const DIOBJECTCALIBRATION *LPCDIOBJECTCALIBRATION; + +typedef struct DIPOVCALIBRATION { + LONG lMin[5]; + LONG lMax[5]; +} DIPOVCALIBRATION, *LPDIPOVCALIBRATION; +typedef const DIPOVCALIBRATION *LPCDIPOVCALIBRATION; + +typedef struct DIEFFECTATTRIBUTES { + DWORD dwEffectId; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + DWORD dwCoords; +} DIEFFECTATTRIBUTES, *LPDIEFFECTATTRIBUTES; +typedef const DIEFFECTATTRIBUTES *LPCDIEFFECTATTRIBUTES; + +typedef struct DIFFDEVICEATTRIBUTES { + DWORD dwFlags; + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; +} DIFFDEVICEATTRIBUTES, *LPDIFFDEVICEATTRIBUTES; +typedef const DIFFDEVICEATTRIBUTES *LPCDIFFDEVICEATTRIBUTES; + +typedef struct DIDRIVERVERSIONS { + DWORD dwSize; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +} DIDRIVERVERSIONS, *LPDIDRIVERVERSIONS; +typedef const DIDRIVERVERSIONS *LPCDIDRIVERVERSIONS; + +typedef struct DIDEVICESTATE { + DWORD dwSize; + DWORD dwState; + DWORD dwLoad; +} DIDEVICESTATE, *LPDIDEVICESTATE; + +#define DEV_STS_EFFECT_RUNNING DIEGES_PLAYING + +#ifndef DIJ_RINGZERO + +typedef struct DIHIDFFINITINFO { + DWORD dwSize; + LPWSTR pwszDeviceInterface; + GUID GuidInstance; +} DIHIDFFINITINFO, *LPDIHIDFFINITINFO; + +#undef INTERFACE +#define INTERFACE IDirectInputEffectDriver + +DECLARE_INTERFACE_(IDirectInputEffectDriver, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffectDriver methods ***/ + STDMETHOD(DeviceID)(THIS_ DWORD,DWORD,DWORD,DWORD,LPVOID) PURE; + STDMETHOD(GetVersions)(THIS_ LPDIDRIVERVERSIONS) PURE; + STDMETHOD(Escape)(THIS_ DWORD,DWORD,LPDIEFFESCAPE) PURE; + STDMETHOD(SetGain)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ DWORD,LPDIDEVICESTATE) PURE; + STDMETHOD(DownloadEffect)(THIS_ DWORD,DWORD,LPDWORD,LPCDIEFFECT,DWORD) PURE; + STDMETHOD(DestroyEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(StartEffect)(THIS_ DWORD,DWORD,DWORD,DWORD) PURE; + STDMETHOD(StopEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetEffectStatus)(THIS_ DWORD,DWORD,LPDWORD) PURE; +}; + +typedef struct IDirectInputEffectDriver *LPDIRECTINPUTEFFECTDRIVER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffectDriver_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->lpVtbl->DeviceID(p,a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->lpVtbl->GetVersions(p,a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->lpVtbl->Escape(p,a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->lpVtbl->SetGain(p,a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->lpVtbl->SendForceFeedbackCommand(p,a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->lpVtbl->GetForceFeedbackState(p,a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->lpVtbl->DownloadEffect(p,a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->lpVtbl->DestroyEffect(p,a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->lpVtbl->StartEffect(p,a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->lpVtbl->StopEffect(p,a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->lpVtbl->GetEffectStatus(p,a,b,c) +#else +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->AddRef() +#define IDirectInputEffectDriver_Release(p) (p)->Release() +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->DeviceID(a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->GetVersions(a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->Escape(a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->SetGain(a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->SendForceFeedbackCommand(a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->GetForceFeedbackState(a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->DownloadEffect(a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->DestroyEffect(a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->StartEffect(a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->StopEffect(a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->GetEffectStatus(a,b,c) +#endif + + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputJoyConfig + * + ****************************************************************************/ + +/**************************************************************************** + * + * Definitions copied from the DDK + * + ****************************************************************************/ + +#ifndef JOY_HW_NONE + +/* pre-defined joystick types */ +#define JOY_HW_NONE 0 +#define JOY_HW_CUSTOM 1 +#define JOY_HW_2A_2B_GENERIC 2 +#define JOY_HW_2A_4B_GENERIC 3 +#define JOY_HW_2B_GAMEPAD 4 +#define JOY_HW_2B_FLIGHTYOKE 5 +#define JOY_HW_2B_FLIGHTYOKETHROTTLE 6 +#define JOY_HW_3A_2B_GENERIC 7 +#define JOY_HW_3A_4B_GENERIC 8 +#define JOY_HW_4B_GAMEPAD 9 +#define JOY_HW_4B_FLIGHTYOKE 10 +#define JOY_HW_4B_FLIGHTYOKETHROTTLE 11 +#define JOY_HW_TWO_2A_2B_WITH_Y 12 +#define JOY_HW_LASTENTRY 13 + + +/* calibration flags */ +#define JOY_ISCAL_XY 0x00000001l /* XY are calibrated */ +#define JOY_ISCAL_Z 0x00000002l /* Z is calibrated */ +#define JOY_ISCAL_R 0x00000004l /* R is calibrated */ +#define JOY_ISCAL_U 0x00000008l /* U is calibrated */ +#define JOY_ISCAL_V 0x00000010l /* V is calibrated */ +#define JOY_ISCAL_POV 0x00000020l /* POV is calibrated */ + +/* point of view constants */ +#define JOY_POV_NUMDIRS 4 +#define JOY_POVVAL_FORWARD 0 +#define JOY_POVVAL_BACKWARD 1 +#define JOY_POVVAL_LEFT 2 +#define JOY_POVVAL_RIGHT 3 + +/* Specific settings for joystick hardware */ +#define JOY_HWS_HASZ 0x00000001l /* has Z info? */ +#define JOY_HWS_HASPOV 0x00000002l /* point of view hat present */ +#define JOY_HWS_POVISBUTTONCOMBOS 0x00000004l /* pov done through combo of buttons */ +#define JOY_HWS_POVISPOLL 0x00000008l /* pov done through polling */ +#define JOY_HWS_ISYOKE 0x00000010l /* joystick is a flight yoke */ +#define JOY_HWS_ISGAMEPAD 0x00000020l /* joystick is a game pad */ +#define JOY_HWS_ISCARCTRL 0x00000040l /* joystick is a car controller */ +/* X defaults to J1 X axis */ +#define JOY_HWS_XISJ1Y 0x00000080l /* X is on J1 Y axis */ +#define JOY_HWS_XISJ2X 0x00000100l /* X is on J2 X axis */ +#define JOY_HWS_XISJ2Y 0x00000200l /* X is on J2 Y axis */ +/* Y defaults to J1 Y axis */ +#define JOY_HWS_YISJ1X 0x00000400l /* Y is on J1 X axis */ +#define JOY_HWS_YISJ2X 0x00000800l /* Y is on J2 X axis */ +#define JOY_HWS_YISJ2Y 0x00001000l /* Y is on J2 Y axis */ +/* Z defaults to J2 Y axis */ +#define JOY_HWS_ZISJ1X 0x00002000l /* Z is on J1 X axis */ +#define JOY_HWS_ZISJ1Y 0x00004000l /* Z is on J1 Y axis */ +#define JOY_HWS_ZISJ2X 0x00008000l /* Z is on J2 X axis */ +/* POV defaults to J2 Y axis, if it is not button based */ +#define JOY_HWS_POVISJ1X 0x00010000l /* pov done through J1 X axis */ +#define JOY_HWS_POVISJ1Y 0x00020000l /* pov done through J1 Y axis */ +#define JOY_HWS_POVISJ2X 0x00040000l /* pov done through J2 X axis */ +/* R defaults to J2 X axis */ +#define JOY_HWS_HASR 0x00080000l /* has R (4th axis) info */ +#define JOY_HWS_RISJ1X 0x00100000l /* R done through J1 X axis */ +#define JOY_HWS_RISJ1Y 0x00200000l /* R done through J1 Y axis */ +#define JOY_HWS_RISJ2Y 0x00400000l /* R done through J2 X axis */ +/* U & V for future hardware */ +#define JOY_HWS_HASU 0x00800000l /* has U (5th axis) info */ +#define JOY_HWS_HASV 0x01000000l /* has V (6th axis) info */ + +/* Usage settings */ +#define JOY_US_HASRUDDER 0x00000001l /* joystick configured with rudder */ +#define JOY_US_PRESENT 0x00000002l /* is joystick actually present? */ +#define JOY_US_ISOEM 0x00000004l /* joystick is an OEM defined type */ + +/* reserved for future use -> as link to next possible dword */ +#define JOY_US_RESERVED 0x80000000l /* reserved */ + + +/* Settings for TypeInfo Flags1 */ +#define JOYTYPE_ZEROGAMEENUMOEMDATA 0x00000001l /* Zero GameEnum's OEM data field */ +#define JOYTYPE_NOAUTODETECTGAMEPORT 0x00000002l /* Device does not support Autodetect gameport*/ +#define JOYTYPE_NOHIDDIRECT 0x00000004l /* Do not use HID directly for this device */ +#define JOYTYPE_ANALOGCOMPAT 0x00000008l /* Expose the analog compatible ID */ +#define JOYTYPE_DEFAULTPROPSHEET 0x80000000l /* CPL overrides custom property sheet */ + +/* Settings for TypeInfo Flags2 */ +#define JOYTYPE_DEVICEHIDE 0x00010000l /* Hide unclassified devices */ +#define JOYTYPE_MOUSEHIDE 0x00020000l /* Hide mice */ +#define JOYTYPE_KEYBHIDE 0x00040000l /* Hide keyboards */ +#define JOYTYPE_GAMEHIDE 0x00080000l /* Hide game controllers */ +#define JOYTYPE_HIDEACTIVE 0x00100000l /* Hide flags are active */ +#define JOYTYPE_INFOMASK 0x00E00000l /* Mask for type specific info */ +#define JOYTYPE_INFODEFAULT 0x00000000l /* Use default axis mappings */ +#define JOYTYPE_INFOYYPEDALS 0x00200000l /* Use Y as a combined pedals axis */ +#define JOYTYPE_INFOZYPEDALS 0x00400000l /* Use Z for accelerate, Y for brake */ +#define JOYTYPE_INFOYRPEDALS 0x00600000l /* Use Y for accelerate, R for brake */ +#define JOYTYPE_INFOZRPEDALS 0x00800000l /* Use Z for accelerate, R for brake */ +#define JOYTYPE_INFOZISSLIDER 0x00200000l /* Use Z as a slider */ +#define JOYTYPE_INFOZISZ 0x00400000l /* Use Z as Z axis */ +#define JOYTYPE_ENABLEINPUTREPORT 0x01000000l /* Enable initial input reports */ + +/* struct for storing x,y, z, and rudder values */ +typedef struct joypos_tag { + DWORD dwX; + DWORD dwY; + DWORD dwZ; + DWORD dwR; + DWORD dwU; + DWORD dwV; +} JOYPOS, FAR *LPJOYPOS; + +/* struct for storing ranges */ +typedef struct joyrange_tag { + JOYPOS jpMin; + JOYPOS jpMax; + JOYPOS jpCenter; +} JOYRANGE,FAR *LPJOYRANGE; + +/* + * dwTimeout - value at which to timeout joystick polling + * jrvRanges - range of values app wants returned for axes + * jpDeadZone - area around center to be considered + * as "dead". specified as a percentage + * (0-100). Only X & Y handled by system driver + */ +typedef struct joyreguservalues_tag { + DWORD dwTimeOut; + JOYRANGE jrvRanges; + JOYPOS jpDeadZone; +} JOYREGUSERVALUES, FAR *LPJOYREGUSERVALUES; + +typedef struct joyreghwsettings_tag { + DWORD dwFlags; + DWORD dwNumButtons; +} JOYREGHWSETTINGS, FAR *LPJOYHWSETTINGS; + +/* range of values returned by the hardware (filled in by calibration) */ +/* + * jrvHardware - values returned by hardware + * dwPOVValues - POV values returned by hardware + * dwCalFlags - what has been calibrated + */ +typedef struct joyreghwvalues_tag { + JOYRANGE jrvHardware; + DWORD dwPOVValues[JOY_POV_NUMDIRS]; + DWORD dwCalFlags; +} JOYREGHWVALUES, FAR *LPJOYREGHWVALUES; + +/* hardware configuration */ +/* + * hws - hardware settings + * dwUsageSettings - usage settings + * hwv - values returned by hardware + * dwType - type of joystick + * dwReserved - reserved for OEM drivers + */ +typedef struct joyreghwconfig_tag { + JOYREGHWSETTINGS hws; + DWORD dwUsageSettings; + JOYREGHWVALUES hwv; + DWORD dwType; + DWORD dwReserved; +} JOYREGHWCONFIG, FAR *LPJOYREGHWCONFIG; + +/* joystick calibration info structure */ +typedef struct joycalibrate_tag { + UINT wXbase; + UINT wXdelta; + UINT wYbase; + UINT wYdelta; + UINT wZbase; + UINT wZdelta; +} JOYCALIBRATE; +typedef JOYCALIBRATE FAR *LPJOYCALIBRATE; + +#endif + +#ifndef DIJ_RINGZERO + +#define MAX_JOYSTRING 256 +typedef BOOL (FAR PASCAL * LPDIJOYTYPECALLBACK)(LPCWSTR, LPVOID); + +#ifndef MAX_JOYSTICKOEMVXDNAME +#define MAX_JOYSTICKOEMVXDNAME 260 +#endif + +#define DITC_REGHWSETTINGS 0x00000001 +#define DITC_CLSIDCONFIG 0x00000002 +#define DITC_DISPLAYNAME 0x00000004 +#define DITC_CALLOUT 0x00000008 +#define DITC_HARDWAREID 0x00000010 +#define DITC_FLAGS1 0x00000020 +#define DITC_FLAGS2 0x00000040 +#define DITC_MAPFILE 0x00000080 + + + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYTYPEINFO_DX5 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +} DIJOYTYPEINFO_DX5, *LPDIJOYTYPEINFO_DX5; +typedef const DIJOYTYPEINFO_DX5 *LPCDIJOYTYPEINFO_DX5; + +/* This structure is defined for DirectX 6.1 compatibility */ +typedef struct DIJOYTYPEINFO_DX6 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +} DIJOYTYPEINFO_DX6, *LPDIJOYTYPEINFO_DX6; +typedef const DIJOYTYPEINFO_DX6 *LPCDIJOYTYPEINFO_DX6; + +typedef struct DIJOYTYPEINFO { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +#if(DIRECTINPUT_VERSION >= 0x0800) + DWORD dwFlags2; + WCHAR wszMapFile[MAX_JOYSTRING]; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ +} DIJOYTYPEINFO, *LPDIJOYTYPEINFO; +typedef const DIJOYTYPEINFO *LPCDIJOYTYPEINFO; +#define DIJC_GUIDINSTANCE 0x00000001 +#define DIJC_REGHWCONFIGTYPE 0x00000002 +#define DIJC_GAIN 0x00000004 +#define DIJC_CALLOUT 0x00000008 +#define DIJC_WDMGAMEPORT 0x00000010 + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYCONFIG_DX5 { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +} DIJOYCONFIG_DX5, *LPDIJOYCONFIG_DX5; +typedef const DIJOYCONFIG_DX5 *LPCDIJOYCONFIG_DX5; + +typedef struct DIJOYCONFIG { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + GUID guidGameport; +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + } DIJOYCONFIG, *LPDIJOYCONFIG; +typedef const DIJOYCONFIG *LPCDIJOYCONFIG; + + +#define DIJU_USERVALUES 0x00000001 +#define DIJU_GLOBALDRIVER 0x00000002 +#define DIJU_GAMEPORTEMULATOR 0x00000004 + +typedef struct DIJOYUSERVALUES { + DWORD dwSize; + JOYREGUSERVALUES ruv; + WCHAR wszGlobalDriver[MAX_JOYSTRING]; + WCHAR wszGameportEmulator[MAX_JOYSTRING]; +} DIJOYUSERVALUES, *LPDIJOYUSERVALUES; +typedef const DIJOYUSERVALUES *LPCDIJOYUSERVALUES; + +DEFINE_GUID(GUID_KeyboardClass, 0x4D36E96B,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MediaClass, 0x4D36E96C,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MouseClass, 0x4D36E96F,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_HIDClass, 0x745A17A0,0x74D3,0x11D0,0xB6,0xFE,0x00,0xA0,0xC9,0x0F,0x57,0xDA); + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig + +DECLARE_INTERFACE_(IDirectInputJoyConfig, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenConfigKey)(THIS_ UINT,DWORD,PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig *LPDIRECTINPUTJOYCONFIG; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->lpVtbl->SetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->lpVtbl->OpenConfigKey(p,a,b,c) +#else +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig_Release(p) (p)->Release() +#define IDirectInputJoyConfig_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->SetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->OpenConfigKey(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig8 + +DECLARE_INTERFACE_(IDirectInputJoyConfig8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig8 methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD,LPWSTR) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenAppStatusKey)(THIS_ PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig8 *LPDIRECTINPUTJOYCONFIG8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->lpVtbl->SetTypeInfo(p,a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->lpVtbl->OpenAppStatusKey(p,a) +#else +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig8_Release(p) (p)->Release() +#define IDirectInputJoyConfig8_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig8_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->SetTypeInfo(a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->OpenAppStatusKey(a) +#endif + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Notification Messages + * + ****************************************************************************/ + +/* RegisterWindowMessage with this to get DirectInput notification messages */ +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGA "DIRECTINPUT_NOTIFICATION_MSGSTRING" +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGW L"DIRECTINPUT_NOTIFICATION_MSGSTRING" + +#ifdef UNICODE +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGW +#else +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGA +#endif + +#define DIMSGWP_NEWAPPSTART 0x00000001 +#define DIMSGWP_DX8APPSTART 0x00000002 +#define DIMSGWP_DX8MAPPERAPPSTART 0x00000003 + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIAPPIDFLAG_NOTIME 0x00000001 +#define DIAPPIDFLAG_NOSIZE 0x00000002 + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGA "AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPA "MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA "MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONA "Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEA "Name" +#define DIRECTINPUT_REGSTR_VAL_IDA "Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERA "UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTA "MostRecentStart" + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGW L"AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPW L"MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW L"MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONW L"Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEW L"Name" +#define DIRECTINPUT_REGSTR_VAL_IDW L"Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERW L"UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTW L"MostRecentStart" + +#ifdef UNICODE +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGW +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPW +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONW +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEW +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDW +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERW +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTW +#else +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGA +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPA +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONA +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEA +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDA +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERA +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTA +#endif + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +#define DIERR_NOMOREITEMS \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NO_MORE_ITEMS) + +/* + * Device driver-specific codes. + */ + +#define DIERR_DRIVERFIRST 0x80040300L +#define DIERR_DRIVERLAST 0x800403FFL + +/* + * Unless the specific driver has been precisely identified, no meaning + * should be attributed to these values other than that the driver + * originated the error. However, to illustrate the types of error that + * may be causing the failure, the PID force feedback driver distributed + * with DirectX 7 could return the following errors: + * + * DIERR_DRIVERFIRST + 1 + * The requested usage was not found. + * DIERR_DRIVERFIRST + 2 + * The parameter block couldn't be downloaded to the device. + * DIERR_DRIVERFIRST + 3 + * PID initialization failed. + * DIERR_DRIVERFIRST + 4 + * The provided values couldn't be scaled. + */ + + +/* + * Device installer errors. + */ + +/* + * Registry entry or DLL for class installer invalid + * or class installer not found. + */ +#define DIERR_INVALIDCLASSINSTALLER 0x80040400L + +/* + * The user cancelled the install operation. + */ +#define DIERR_CANCELLED 0x80040401L + +/* + * The INF file for the selected device could not be + * found or is invalid or is damaged. + */ +#define DIERR_BADINF 0x80040402L + +/**************************************************************************** + * + * Map files + * + ****************************************************************************/ + +/* + * Delete particular data from default map file. + */ +#define DIDIFT_DELETE 0x01000000 + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUTD_INCLUDED__ */ diff --git a/SDK/dxSDK/Include/dls1.h b/SDK/dxSDK/Include/dls1.h new file mode 100644 index 00000000..fc88a317 --- /dev/null +++ b/SDK/dxSDK/Include/dls1.h @@ -0,0 +1,267 @@ +/*==========================================================================; +// +// dls1.h +// +// +// Description: +// +// Interface defines and structures for the Instrument Collection Form +// RIFF DLS. +// +// +// Written by Sonic Foundry 1996. Released for public use. +// +//=========================================================================*/ + +#ifndef _INC_DLS1 +#define _INC_DLS1 + +/*////////////////////////////////////////////////////////////////////////// +// +// +// Layout of an instrument collection: +// +// +// RIFF [] 'DLS ' [dlid,colh,INSTLIST,WAVEPOOL,INFOLIST] +// +// INSTLIST +// LIST [] 'lins' +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// LIST [] 'ins ' [dlid,insh,RGNLIST,ARTLIST,INFOLIST] +// +// RGNLIST +// LIST [] 'lrgn' +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// LIST [] 'rgn ' [rgnh,wsmp,wlnk,ARTLIST] +// +// ARTLIST +// LIST [] 'lart' +// 'art1' level 1 Articulation connection graph +// 'art2' level 2 Articulation connection graph +// '3rd1' Possible 3rd party articulation structure 1 +// '3rd2' Possible 3rd party articulation structure 2 .... and so on +// +// WAVEPOOL +// ptbl [] [pool table] +// LIST [] 'wvpl' +// [path], +// [path], +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// LIST [] 'wave' [dlid,RIFFWAVE] +// +// INFOLIST +// LIST [] 'INFO' +// 'icmt' 'One of those crazy comments.' +// 'icop' 'Copyright (C) 1996 Sonic Foundry' +// +/////////////////////////////////////////////////////////////////////////*/ + + +/*///////////////////////////////////////////////////////////////////////// +// FOURCC's used in the DLS file +/////////////////////////////////////////////////////////////////////////*/ + +#define FOURCC_DLS mmioFOURCC('D','L','S',' ') +#define FOURCC_DLID mmioFOURCC('d','l','i','d') +#define FOURCC_COLH mmioFOURCC('c','o','l','h') +#define FOURCC_WVPL mmioFOURCC('w','v','p','l') +#define FOURCC_PTBL mmioFOURCC('p','t','b','l') +#define FOURCC_PATH mmioFOURCC('p','a','t','h') +#define FOURCC_wave mmioFOURCC('w','a','v','e') +#define FOURCC_LINS mmioFOURCC('l','i','n','s') +#define FOURCC_INS mmioFOURCC('i','n','s',' ') +#define FOURCC_INSH mmioFOURCC('i','n','s','h') +#define FOURCC_LRGN mmioFOURCC('l','r','g','n') +#define FOURCC_RGN mmioFOURCC('r','g','n',' ') +#define FOURCC_RGNH mmioFOURCC('r','g','n','h') +#define FOURCC_LART mmioFOURCC('l','a','r','t') +#define FOURCC_ART1 mmioFOURCC('a','r','t','1') +#define FOURCC_WLNK mmioFOURCC('w','l','n','k') +#define FOURCC_WSMP mmioFOURCC('w','s','m','p') +#define FOURCC_VERS mmioFOURCC('v','e','r','s') + +/*///////////////////////////////////////////////////////////////////////// +// Articulation connection graph definitions +/////////////////////////////////////////////////////////////////////////*/ + +/* Generic Sources */ +#define CONN_SRC_NONE 0x0000 +#define CONN_SRC_LFO 0x0001 +#define CONN_SRC_KEYONVELOCITY 0x0002 +#define CONN_SRC_KEYNUMBER 0x0003 +#define CONN_SRC_EG1 0x0004 +#define CONN_SRC_EG2 0x0005 +#define CONN_SRC_PITCHWHEEL 0x0006 + +/* Midi Controllers 0-127 */ +#define CONN_SRC_CC1 0x0081 +#define CONN_SRC_CC7 0x0087 +#define CONN_SRC_CC10 0x008a +#define CONN_SRC_CC11 0x008b + +/* Generic Destinations */ +#define CONN_DST_NONE 0x0000 +#define CONN_DST_ATTENUATION 0x0001 +#define CONN_DST_PITCH 0x0003 +#define CONN_DST_PAN 0x0004 + +/* LFO Destinations */ +#define CONN_DST_LFO_FREQUENCY 0x0104 +#define CONN_DST_LFO_STARTDELAY 0x0105 + +/* EG1 Destinations */ +#define CONN_DST_EG1_ATTACKTIME 0x0206 +#define CONN_DST_EG1_DECAYTIME 0x0207 +#define CONN_DST_EG1_RELEASETIME 0x0209 +#define CONN_DST_EG1_SUSTAINLEVEL 0x020a + +/* EG2 Destinations */ +#define CONN_DST_EG2_ATTACKTIME 0x030a +#define CONN_DST_EG2_DECAYTIME 0x030b +#define CONN_DST_EG2_RELEASETIME 0x030d +#define CONN_DST_EG2_SUSTAINLEVEL 0x030e + +#define CONN_TRN_NONE 0x0000 +#define CONN_TRN_CONCAVE 0x0001 + +typedef struct _DLSID { + ULONG ulData1; + USHORT usData2; + USHORT usData3; + BYTE abData4[8]; +} DLSID, FAR *LPDLSID; + +typedef struct _DLSVERSION { + DWORD dwVersionMS; + DWORD dwVersionLS; +}DLSVERSION, FAR *LPDLSVERSION; + + +typedef struct _CONNECTION { + USHORT usSource; + USHORT usControl; + USHORT usDestination; + USHORT usTransform; + LONG lScale; + }CONNECTION, FAR *LPCONNECTION; + + +/* Level 1 Articulation Data */ + +typedef struct _CONNECTIONLIST { + ULONG cbSize; /* size of the connection list structure */ + ULONG cConnections; /* count of connections in the list */ + } CONNECTIONLIST, FAR *LPCONNECTIONLIST; + + + +/*///////////////////////////////////////////////////////////////////////// +// Generic type defines for regions and instruments +/////////////////////////////////////////////////////////////////////////*/ + +typedef struct _RGNRANGE { + USHORT usLow; + USHORT usHigh; +}RGNRANGE, FAR * LPRGNRANGE; + +#define F_INSTRUMENT_DRUMS 0x80000000 + +typedef struct _MIDILOCALE { + ULONG ulBank; + ULONG ulInstrument; +}MIDILOCALE, FAR *LPMIDILOCALE; + +/*///////////////////////////////////////////////////////////////////////// +// Header structures found in an DLS file for collection, instruments, and +// regions. +/////////////////////////////////////////////////////////////////////////*/ + +#define F_RGN_OPTION_SELFNONEXCLUSIVE 0x0001 + +typedef struct _RGNHEADER { + RGNRANGE RangeKey; /* Key range */ + RGNRANGE RangeVelocity; /* Velocity Range */ + USHORT fusOptions; /* Synthesis options for this range */ + USHORT usKeyGroup; /* Key grouping for non simultaneous play */ + /* 0 = no group, 1 up is group */ + /* for Level 1 only groups 1-15 are allowed */ +}RGNHEADER, FAR *LPRGNHEADER; + +typedef struct _INSTHEADER { + ULONG cRegions; /* Count of regions in this instrument */ + MIDILOCALE Locale; /* Intended MIDI locale of this instrument */ +}INSTHEADER, FAR *LPINSTHEADER; + +typedef struct _DLSHEADER { + ULONG cInstruments; /* Count of instruments in the collection */ +}DLSHEADER, FAR *LPDLSHEADER; + +/*//////////////////////////////////////////////////////////////////////////// +// definitions for the Wave link structure +////////////////////////////////////////////////////////////////////////////*/ + +/* **** For level 1 only WAVELINK_CHANNEL_MONO is valid **** */ +/* ulChannel allows for up to 32 channels of audio with each bit position */ +/* specifiying a channel of playback */ + +#define WAVELINK_CHANNEL_LEFT 0x0001l +#define WAVELINK_CHANNEL_RIGHT 0x0002l + +#define F_WAVELINK_PHASE_MASTER 0x0001 + +typedef struct _WAVELINK { /* any paths or links are stored right after struct */ + USHORT fusOptions; /* options flags for this wave */ + USHORT usPhaseGroup; /* Phase grouping for locking channels */ + ULONG ulChannel; /* channel placement */ + ULONG ulTableIndex; /* index into the wave pool table, 0 based */ +}WAVELINK, FAR *LPWAVELINK; + +#define POOL_CUE_NULL 0xffffffffl + +typedef struct _POOLCUE { + ULONG ulOffset; /* Offset to the entry in the list */ +}POOLCUE, FAR *LPPOOLCUE; + +typedef struct _POOLTABLE { + ULONG cbSize; /* size of the pool table structure */ + ULONG cCues; /* count of cues in the list */ + } POOLTABLE, FAR *LPPOOLTABLE; + +/*//////////////////////////////////////////////////////////////////////////// +// Structures for the "wsmp" chunk +////////////////////////////////////////////////////////////////////////////*/ + +#define F_WSMP_NO_TRUNCATION 0x0001l +#define F_WSMP_NO_COMPRESSION 0x0002l + + +typedef struct _rwsmp { + ULONG cbSize; + USHORT usUnityNote; /* MIDI Unity Playback Note */ + SHORT sFineTune; /* Fine Tune in log tuning */ + LONG lAttenuation; /* Overall Attenuation to be applied to data */ + ULONG fulOptions; /* Flag options */ + ULONG cSampleLoops; /* Count of Sample loops, 0 loops is one shot */ + } WSMPL, FAR *LPWSMPL; + + +/* This loop type is a normal forward playing loop which is continually */ +/* played until the envelope reaches an off threshold in the release */ +/* portion of the volume envelope */ + +#define WLOOP_TYPE_FORWARD 0 + +typedef struct _rloop { + ULONG cbSize; + ULONG ulType; /* Loop Type */ + ULONG ulStart; /* Start of loop in samples */ + ULONG ulLength; /* Length of loop in samples */ +} WLOOP, FAR *LPWLOOP; + +#endif /*_INC_DLS1 */ + diff --git a/SDK/dxSDK/Include/dls2.h b/SDK/dxSDK/Include/dls2.h new file mode 100644 index 00000000..30cec23a --- /dev/null +++ b/SDK/dxSDK/Include/dls2.h @@ -0,0 +1,130 @@ +/* + + dls2.h + + Description: + + Interface defines and structures for the DLS2 extensions of DLS. + + + Written by Microsoft 1998. Released for public use. + +*/ + +#ifndef _INC_DLS2 +#define _INC_DLS2 + +/* + FOURCC's used in the DLS2 file, in addition to DLS1 chunks +*/ + +#define FOURCC_RGN2 mmioFOURCC('r','g','n','2') +#define FOURCC_LAR2 mmioFOURCC('l','a','r','2') +#define FOURCC_ART2 mmioFOURCC('a','r','t','2') +#define FOURCC_CDL mmioFOURCC('c','d','l',' ') +#define FOURCC_DLID mmioFOURCC('d','l','i','d') + +/* + Articulation connection graph definitions. These are in addition to + the definitions in the DLS1 header. +*/ + +/* Generic Sources (in addition to DLS1 sources. */ +#define CONN_SRC_POLYPRESSURE 0x0007 /* Polyphonic Pressure */ +#define CONN_SRC_CHANNELPRESSURE 0x0008 /* Channel Pressure */ +#define CONN_SRC_VIBRATO 0x0009 /* Vibrato LFO */ +#define CONN_SRC_MONOPRESSURE 0x000a /* MIDI Mono pressure */ + + +/* Midi Controllers */ +#define CONN_SRC_CC91 0x00db /* Reverb Send */ +#define CONN_SRC_CC93 0x00dd /* Chorus Send */ + + +/* Generic Destinations */ +#define CONN_DST_GAIN 0x0001 /* Same as CONN_DST_ ATTENUATION, but more appropriate terminology. */ +#define CONN_DST_KEYNUMBER 0x0005 /* Key Number Generator */ + +/* Audio Channel Output Destinations */ +#define CONN_DST_LEFT 0x0010 /* Left Channel Send */ +#define CONN_DST_RIGHT 0x0011 /* Right Channel Send */ +#define CONN_DST_CENTER 0x0012 /* Center Channel Send */ +#define CONN_DST_LEFTREAR 0x0013 /* Left Rear Channel Send */ +#define CONN_DST_RIGHTREAR 0x0014 /* Right Rear Channel Send */ +#define CONN_DST_LFE_CHANNEL 0x0015 /* LFE Channel Send */ +#define CONN_DST_CHORUS 0x0080 /* Chorus Send */ +#define CONN_DST_REVERB 0x0081 /* Reverb Send */ + +/* Vibrato LFO Destinations */ +#define CONN_DST_VIB_FREQUENCY 0x0114 /* Vibrato Frequency */ +#define CONN_DST_VIB_STARTDELAY 0x0115 /* Vibrato Start Delay */ + +/* EG1 Destinations */ +#define CONN_DST_EG1_DELAYTIME 0x020B /* EG1 Delay Time */ +#define CONN_DST_EG1_HOLDTIME 0x020C /* EG1 Hold Time */ +#define CONN_DST_EG1_SHUTDOWNTIME 0x020D /* EG1 Shutdown Time */ + + +/* EG2 Destinations */ +#define CONN_DST_EG2_DELAYTIME 0x030F /* EG2 Delay Time */ +#define CONN_DST_EG2_HOLDTIME 0x0310 /* EG2 Hold Time */ + + +/* Filter Destinations */ +#define CONN_DST_FILTER_CUTOFF 0x0500 /* Filter Cutoff Frequency */ +#define CONN_DST_FILTER_Q 0x0501 /* Filter Resonance */ + + +/* Transforms */ +#define CONN_TRN_CONVEX 0x0002 /* Convex Transform */ +#define CONN_TRN_SWITCH 0x0003 /* Switch Transform */ + + +/* Conditional chunk operators */ + #define DLS_CDL_AND 0x0001 /* X = X & Y */ + #define DLS_CDL_OR 0x0002 /* X = X | Y */ + #define DLS_CDL_XOR 0x0003 /* X = X ^ Y */ + #define DLS_CDL_ADD 0x0004 /* X = X + Y */ + #define DLS_CDL_SUBTRACT 0x0005 /* X = X - Y */ + #define DLS_CDL_MULTIPLY 0x0006 /* X = X * Y */ + #define DLS_CDL_DIVIDE 0x0007 /* X = X / Y */ + #define DLS_CDL_LOGICAL_AND 0x0008 /* X = X && Y */ + #define DLS_CDL_LOGICAL_OR 0x0009 /* X = X || Y */ + #define DLS_CDL_LT 0x000A /* X = (X < Y) */ + #define DLS_CDL_LE 0x000B /* X = (X <= Y) */ + #define DLS_CDL_GT 0x000C /* X = (X > Y) */ + #define DLS_CDL_GE 0x000D /* X = (X >= Y) */ + #define DLS_CDL_EQ 0x000E /* X = (X == Y) */ + #define DLS_CDL_NOT 0x000F /* X = !X */ + #define DLS_CDL_CONST 0x0010 /* 32-bit constant */ + #define DLS_CDL_QUERY 0x0011 /* 32-bit value returned from query */ + #define DLS_CDL_QUERYSUPPORTED 0x0012 /* Test to see if query is supported by synth */ + +/* + Loop and release +*/ + +#define WLOOP_TYPE_RELEASE 1 + +/* + WaveLink chunk +*/ + +#define F_WAVELINK_MULTICHANNEL 0x0002 + + +/* + DLSID queries for +*/ + +DEFINE_GUID(DLSID_GMInHardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_GSInHardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_XGInHardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_SupportsDLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_SupportsDLS2, 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(DLSID_SampleMemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(DLSID_ManufacturersID, 0xb03e1181, 0x8095, 0x11d2, 0xa1, 0xef, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); +DEFINE_GUID(DLSID_ProductID, 0xb03e1182, 0x8095, 0x11d2, 0xa1, 0xef, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); +DEFINE_GUID(DLSID_SamplePlaybackRate, 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); + +#endif /* _INC_DLS2 */ diff --git a/SDK/dxSDK/Include/dmdls.h b/SDK/dxSDK/Include/dmdls.h new file mode 100644 index 00000000..c5072681 --- /dev/null +++ b/SDK/dxSDK/Include/dmdls.h @@ -0,0 +1,199 @@ +/************************************************************************ +* * +* dmdls.h -- DLS download definitions for DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMDLS_ +#define _DMDLS_ + +#include "dls1.h" + +typedef long PCENT; /* Pitch cents */ +typedef long GCENT; /* Gain cents */ +typedef long TCENT; /* Time cents */ +typedef long PERCENT; /* Per.. cent! */ + +typedef LONGLONG REFERENCE_TIME; +typedef REFERENCE_TIME *LPREFERENCE_TIME; + +#ifndef MAKE_FOURCC +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) + + +typedef DWORD FOURCC; /* a four character code */ +#endif + +typedef struct _DMUS_DOWNLOADINFO +{ + DWORD dwDLType; /* Instrument or Wave */ + DWORD dwDLId; /* Unique identifier to tag this download. */ + DWORD dwNumOffsetTableEntries; /* Number of index in the offset address table. */ + DWORD cbSize; /* Total size of this memory chunk. */ +} DMUS_DOWNLOADINFO; + +#define DMUS_DOWNLOADINFO_INSTRUMENT 1 +#define DMUS_DOWNLOADINFO_WAVE 2 +#define DMUS_DOWNLOADINFO_INSTRUMENT2 3 /* New version for better DLS2 support. */ + +/* Support for oneshot and streaming wave data + */ +#define DMUS_DOWNLOADINFO_WAVEARTICULATION 4 /* Wave articulation data */ +#define DMUS_DOWNLOADINFO_STREAMINGWAVE 5 /* One chunk of a streaming */ +#define DMUS_DOWNLOADINFO_ONESHOTWAVE 6 + +#define DMUS_DEFAULT_SIZE_OFFSETTABLE 1 + +/* Flags for DMUS_INSTRUMENT's ulFlags member */ + +#define DMUS_INSTRUMENT_GM_INSTRUMENT (1 << 0) + +typedef struct _DMUS_OFFSETTABLE +{ + ULONG ulOffsetTable[DMUS_DEFAULT_SIZE_OFFSETTABLE]; +} DMUS_OFFSETTABLE; + +typedef struct _DMUS_INSTRUMENT +{ + ULONG ulPatch; + ULONG ulFirstRegionIdx; + ULONG ulGlobalArtIdx; /* If zero the instrument does not have an articulation */ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the instrument */ + ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the instrument */ + ULONG ulFlags; +} DMUS_INSTRUMENT; + +typedef struct _DMUS_REGION +{ + RGNRANGE RangeKey; + RGNRANGE RangeVelocity; + USHORT fusOptions; + USHORT usKeyGroup; + ULONG ulRegionArtIdx; /* If zero the region does not have an articulation */ + ULONG ulNextRegionIdx; /* If zero no more regions */ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the region */ + WAVELINK WaveLink; + WSMPL WSMP; /* If WSMP.cSampleLoops > 1 then a WLOOP is included */ + WLOOP WLOOP[1]; +} DMUS_REGION; + +typedef struct _DMUS_LFOPARAMS +{ + PCENT pcFrequency; + TCENT tcDelay; + GCENT gcVolumeScale; + PCENT pcPitchScale; + GCENT gcMWToVolume; + PCENT pcMWToPitch; +} DMUS_LFOPARAMS; + +typedef struct _DMUS_VEGPARAMS +{ + TCENT tcAttack; + TCENT tcDecay; + PERCENT ptSustain; + TCENT tcRelease; + TCENT tcVel2Attack; + TCENT tcKey2Decay; +} DMUS_VEGPARAMS; + +typedef struct _DMUS_PEGPARAMS +{ + TCENT tcAttack; + TCENT tcDecay; + PERCENT ptSustain; + TCENT tcRelease; + TCENT tcVel2Attack; + TCENT tcKey2Decay; + PCENT pcRange; +} DMUS_PEGPARAMS; + +typedef struct _DMUS_MSCPARAMS +{ + PERCENT ptDefaultPan; +} DMUS_MSCPARAMS; + +typedef struct _DMUS_ARTICPARAMS +{ + DMUS_LFOPARAMS LFO; + DMUS_VEGPARAMS VolEG; + DMUS_PEGPARAMS PitchEG; + DMUS_MSCPARAMS Misc; +} DMUS_ARTICPARAMS; + +typedef struct _DMUS_ARTICULATION /* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT format. */ +{ + ULONG ulArt1Idx; /* DLS Level 1 articulation chunk */ + ULONG ulFirstExtCkIdx; /* 3rd party extenstion chunks associated with the articulation */ +} DMUS_ARTICULATION; + +typedef struct _DMUS_ARTICULATION2 /* Articulation chunk for DMUS_DOWNLOADINFO_INSTRUMENT2 format. */ +{ + ULONG ulArtIdx; /* DLS Level 1/2 articulation chunk */ + ULONG ulFirstExtCkIdx; /* 3rd party extenstion chunks associated with the articulation */ + ULONG ulNextArtIdx; /* Additional articulation chunks */ +} DMUS_ARTICULATION2; + +#define DMUS_MIN_DATA_SIZE 4 +/* The actual number is determined by cbSize of struct _DMUS_EXTENSIONCHUNK */ + +typedef struct _DMUS_EXTENSIONCHUNK +{ + ULONG cbSize; /* Size of extension chunk */ + ULONG ulNextExtCkIdx; /* If zero no more 3rd party entenstion chunks */ + FOURCC ExtCkID; + BYTE byExtCk[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */ +} DMUS_EXTENSIONCHUNK; + +/* The actual number is determined by cbSize of struct _DMUS_COPYRIGHT */ + +typedef struct _DMUS_COPYRIGHT +{ + ULONG cbSize; /* Size of copyright information */ + BYTE byCopyright[DMUS_MIN_DATA_SIZE]; /* The actual number that follows is determined by cbSize */ +} DMUS_COPYRIGHT; + +typedef struct _DMUS_WAVEDATA +{ + ULONG cbSize; + BYTE byData[DMUS_MIN_DATA_SIZE]; +} DMUS_WAVEDATA; + +typedef struct _DMUS_WAVE +{ + ULONG ulFirstExtCkIdx; /* If zero no 3rd party entenstion chunks associated with the wave */ + ULONG ulCopyrightIdx; /* If zero no Copyright information associated with the wave */ + ULONG ulWaveDataIdx; /* Location of actual wave data. */ + WAVEFORMATEX WaveformatEx; +} DMUS_WAVE; + +typedef struct _DMUS_NOTERANGE *LPDMUS_NOTERANGE; +typedef struct _DMUS_NOTERANGE +{ + DWORD dwLowNote; /* Sets the low note for the range of MIDI note events to which the instrument responds.*/ + DWORD dwHighNote; /* Sets the high note for the range of MIDI note events to which the instrument responds.*/ +} DMUS_NOTERANGE; + +typedef struct _DMUS_WAVEARTDL +{ + ULONG ulDownloadIdIdx; /* Download ID's of each buffer */ + ULONG ulBus; /* Playback bus */ + ULONG ulBuffers; /* Buffers */ + ULONG ulMasterDLId; /* Download ID of master voice of slave group */ + USHORT usOptions; /* Same as DLS2 region options */ +} DMUS_WAVEARTDL, + *LPDMUS_WAVEARTDL; + +typedef struct _DMUS_WAVEDL +{ + ULONG cbWaveData; /* Bytes of wave data */ +} DMUS_WAVEDL, + *LPDMUS_WAVEDL; + +#endif + + diff --git a/SDK/dxSDK/Include/dmerror.h b/SDK/dxSDK/Include/dmerror.h new file mode 100644 index 00000000..a0a61ffc --- /dev/null +++ b/SDK/dxSDK/Include/dmerror.h @@ -0,0 +1,843 @@ +/************************************************************************ +* * +* dmerror.h -- Error codes returned by DirectMusic API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMERROR_ +#define _DMERROR_ + +#define FACILITY_DIRECTMUSIC 0x878 /* Shared with DirectSound */ +#define DMUS_ERRBASE 0x1000 /* Make error codes human readable in hex */ + +#ifndef MAKE_HRESULT +#define MAKE_HRESULT(sev,fac,code) \ + ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) +#endif + +#define MAKE_DMHRESULTSUCCESS(code) MAKE_HRESULT(0, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) +#define MAKE_DMHRESULTERROR(code) MAKE_HRESULT(1, FACILITY_DIRECTMUSIC, (DMUS_ERRBASE + (code))) + +/* DMUS_S_PARTIALLOAD + * + * The object could only load partially. This can happen if some components are + * not registered properly, such as embedded tracks and tools. This can also happen + * if some content is missing. For example, if a segment uses a DLS collection that + * is not in the loader's current search directory. + */ +#define DMUS_S_PARTIALLOAD MAKE_DMHRESULTSUCCESS(0x091) + +/* DMUS_S_PARTIALDOWNLOAD + * + * Return value from IDirectMusicBand::Download() which indicates that + * some of the instruments safely downloaded, but others failed. This usually + * occurs when some instruments are on PChannels not supported by the performance + * or port. + */ +#define DMUS_S_PARTIALDOWNLOAD MAKE_DMHRESULTSUCCESS(0x092) + +/* DMUS_S_REQUEUE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should cue the PMsg again automatically. + */ +#define DMUS_S_REQUEUE MAKE_DMHRESULTSUCCESS(0x200) + +/* DMUS_S_FREE + * + * Return value from IDirectMusicTool::ProcessPMsg() which indicates to the + * performance that it should free the PMsg automatically. + */ +#define DMUS_S_FREE MAKE_DMHRESULTSUCCESS(0x201) + +/* DMUS_S_END + * + * Return value from IDirectMusicTrack::Play() which indicates to the + * segment that the track has no more data after mtEnd. + */ +#define DMUS_S_END MAKE_DMHRESULTSUCCESS(0x202) + +/* DMUS_S_STRING_TRUNCATED + * + * Returned string has been truncated to fit the buffer size. + */ +#define DMUS_S_STRING_TRUNCATED MAKE_DMHRESULTSUCCESS(0x210) + +/* DMUS_S_LAST_TOOL + * + * Returned from IDirectMusicGraph::StampPMsg(), this indicates that the PMsg + * is already stamped with the last tool in the graph. The returned PMsg's + * tool pointer is now NULL. + */ +#define DMUS_S_LAST_TOOL MAKE_DMHRESULTSUCCESS(0x211) + +/* DMUS_S_OVER_CHORD + * + * Returned from IDirectMusicPerformance::MusicToMIDI(), this indicates + * that no note has been calculated because the music value has the note + * at a position higher than the top note of the chord. This applies only + * to DMUS_PLAYMODE_NORMALCHORD play mode. This success code indicates + * that the caller should not do anything with the note. It is not meant + * to be played against this chord. + */ +#define DMUS_S_OVER_CHORD MAKE_DMHRESULTSUCCESS(0x212) + +/* DMUS_S_UP_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is below 0, + * so it has been bumped up one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + */ +#define DMUS_S_UP_OCTAVE MAKE_DMHRESULTSUCCESS(0x213) + +/* DMUS_S_DOWN_OCTAVE + * + * Returned from IDirectMusicPerformance::MIDIToMusic(), and + * IDirectMusicPerformance::MusicToMIDI(), this indicates + * that the note conversion generated a note value that is above 127, + * so it has been bumped down one or more octaves to be in the proper + * MIDI range of 0 through 127. + * Note that this is valid for MIDIToMusic() when using play modes + * DMUS_PLAYMODE_FIXEDTOCHORD and DMUS_PLAYMODE_FIXEDTOKEY, both of + * which store MIDI values in wMusicValue. With MusicToMIDI(), it is + * valid for all play modes. + * Ofcourse, DMUS_PLAYMODE_FIXED will never return this success code. + */ +#define DMUS_S_DOWN_OCTAVE MAKE_DMHRESULTSUCCESS(0x214) + +/* DMUS_S_NOBUFFERCONTROL + * + * Although the audio output from the port will be routed to the + * same device as the given DirectSound buffer, buffer controls + * such as pan and volume will not affect the output. + * + */ +#define DMUS_S_NOBUFFERCONTROL MAKE_DMHRESULTSUCCESS(0x215) + +/* DMUS_S_GARBAGE_COLLECTED + * + * The requested operation was not performed because during CollectGarbage + * the loader determined that the object had been released. + */ +#define DMUS_S_GARBAGE_COLLECTED MAKE_DMHRESULTSUCCESS(0x216) + +/* DMUS_E_DRIVER_FAILED + * + * An unexpected error was returned from a device driver, indicating + * possible failure of the driver or hardware. + */ +#define DMUS_E_DRIVER_FAILED MAKE_DMHRESULTERROR(0x0101) + +/* DMUS_E_PORTS_OPEN + * + * The requested operation cannot be performed while there are + * instantiated ports in any process in the system. + */ +#define DMUS_E_PORTS_OPEN MAKE_DMHRESULTERROR(0x0102) + +/* DMUS_E_DEVICE_IN_USE + * + * The requested device is already in use (possibly by a non-DirectMusic + * client) and cannot be opened again. + */ +#define DMUS_E_DEVICE_IN_USE MAKE_DMHRESULTERROR(0x0103) + +/* DMUS_E_INSUFFICIENTBUFFER + * + * Buffer is not large enough for requested operation. + */ +#define DMUS_E_INSUFFICIENTBUFFER MAKE_DMHRESULTERROR(0x0104) + +/* DMUS_E_BUFFERNOTSET + * + * No buffer was prepared for the download data. + */ +#define DMUS_E_BUFFERNOTSET MAKE_DMHRESULTERROR(0x0105) + +/* DMUS_E_BUFFERNOTAVAILABLE + * + * Download failed due to inability to access or create download buffer. + */ +#define DMUS_E_BUFFERNOTAVAILABLE MAKE_DMHRESULTERROR(0x0106) + +/* DMUS_E_NOTADLSCOL + * + * Error parsing DLS collection. File is corrupt. + */ +#define DMUS_E_NOTADLSCOL MAKE_DMHRESULTERROR(0x0108) + +/* DMUS_E_INVALIDOFFSET + * + * Wave chunks in DLS collection file are at incorrect offsets. + */ +#define DMUS_E_INVALIDOFFSET MAKE_DMHRESULTERROR(0x0109) + +/* DMUS_E_ALREADY_LOADED + * + * Second attempt to load a DLS collection that is currently open. + */ +#define DMUS_E_ALREADY_LOADED MAKE_DMHRESULTERROR(0x0111) + +/* DMUS_E_INVALIDPOS + * + * Error reading wave data from DLS collection. Indicates bad file. + */ +#define DMUS_E_INVALIDPOS MAKE_DMHRESULTERROR(0x0113) + +/* DMUS_E_INVALIDPATCH + * + * There is no instrument in the collection that matches patch number. + */ +#define DMUS_E_INVALIDPATCH MAKE_DMHRESULTERROR(0x0114) + +/* DMUS_E_CANNOTSEEK + * + * The IStream* doesn't support Seek(). + */ +#define DMUS_E_CANNOTSEEK MAKE_DMHRESULTERROR(0x0115) + +/* DMUS_E_CANNOTWRITE + * + * The IStream* doesn't support Write(). + */ +#define DMUS_E_CANNOTWRITE MAKE_DMHRESULTERROR(0x0116) + +/* DMUS_E_CHUNKNOTFOUND + * + * The RIFF parser doesn't contain a required chunk while parsing file. + */ +#define DMUS_E_CHUNKNOTFOUND MAKE_DMHRESULTERROR(0x0117) + +/* DMUS_E_INVALID_DOWNLOADID + * + * Invalid download id was used in the process of creating a download buffer. + */ +#define DMUS_E_INVALID_DOWNLOADID MAKE_DMHRESULTERROR(0x0119) + +/* DMUS_E_NOT_DOWNLOADED_TO_PORT + * + * Tried to unload an object that was not downloaded or previously unloaded. + */ +#define DMUS_E_NOT_DOWNLOADED_TO_PORT MAKE_DMHRESULTERROR(0x0120) + +/* DMUS_E_ALREADY_DOWNLOADED + * + * Buffer was already downloaded to synth. + */ +#define DMUS_E_ALREADY_DOWNLOADED MAKE_DMHRESULTERROR(0x0121) + +/* DMUS_E_UNKNOWN_PROPERTY + * + * The specified property item was not recognized by the target object. + */ +#define DMUS_E_UNKNOWN_PROPERTY MAKE_DMHRESULTERROR(0x0122) + +/* DMUS_E_SET_UNSUPPORTED + * + * The specified property item may not be set on the target object. + */ +#define DMUS_E_SET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0123) + +/* DMUS_E_GET_UNSUPPORTED + * + * The specified property item may not be retrieved from the target object. + */ +#define DMUS_E_GET_UNSUPPORTED MAKE_DMHRESULTERROR(0x0124) + +/* DMUS_E_NOTMONO + * + * Wave chunk has more than one interleaved channel. DLS format requires MONO. + */ +#define DMUS_E_NOTMONO MAKE_DMHRESULTERROR(0x0125) + +/* DMUS_E_BADARTICULATION + * + * Invalid articulation chunk in DLS collection. + */ +#define DMUS_E_BADARTICULATION MAKE_DMHRESULTERROR(0x0126) + +/* DMUS_E_BADINSTRUMENT + * + * Invalid instrument chunk in DLS collection. + */ +#define DMUS_E_BADINSTRUMENT MAKE_DMHRESULTERROR(0x0127) + +/* DMUS_E_BADWAVELINK + * + * Wavelink chunk in DLS collection points to invalid wave. + */ +#define DMUS_E_BADWAVELINK MAKE_DMHRESULTERROR(0x0128) + +/* DMUS_E_NOARTICULATION + * + * Articulation missing from instrument in DLS collection. + */ +#define DMUS_E_NOARTICULATION MAKE_DMHRESULTERROR(0x0129) + +/* DMUS_E_NOTPCM + * + * Downoaded DLS wave is not in PCM format. +*/ +#define DMUS_E_NOTPCM MAKE_DMHRESULTERROR(0x012A) + +/* DMUS_E_BADWAVE + * + * Bad wave chunk in DLS collection + */ +#define DMUS_E_BADWAVE MAKE_DMHRESULTERROR(0x012B) + +/* DMUS_E_BADOFFSETTABLE + * + * Offset Table for download buffer has errors. + */ +#define DMUS_E_BADOFFSETTABLE MAKE_DMHRESULTERROR(0x012C) + +/* DMUS_E_UNKNOWNDOWNLOAD + * + * Attempted to download unknown data type. + */ +#define DMUS_E_UNKNOWNDOWNLOAD MAKE_DMHRESULTERROR(0x012D) + +/* DMUS_E_NOSYNTHSINK + * + * The operation could not be completed because no sink was connected to + * the synthesizer. + */ +#define DMUS_E_NOSYNTHSINK MAKE_DMHRESULTERROR(0x012E) + +/* DMUS_E_ALREADYOPEN + * + * An attempt was made to open the software synthesizer while it was already + * open. + * ASSERT? + */ +#define DMUS_E_ALREADYOPEN MAKE_DMHRESULTERROR(0x012F) + +/* DMUS_E_ALREADYCLOSE + * + * An attempt was made to close the software synthesizer while it was already + * open. + * ASSERT? + */ +#define DMUS_E_ALREADYCLOSED MAKE_DMHRESULTERROR(0x0130) + +/* DMUS_E_SYNTHNOTCONFIGURED + * + * The operation could not be completed because the software synth has not + * yet been fully configured. + * ASSERT? + */ +#define DMUS_E_SYNTHNOTCONFIGURED MAKE_DMHRESULTERROR(0x0131) + +/* DMUS_E_SYNTHACTIVE + * + * The operation cannot be carried out while the synthesizer is active. + */ +#define DMUS_E_SYNTHACTIVE MAKE_DMHRESULTERROR(0x0132) + +/* DMUS_E_CANNOTREAD + * + * An error occurred while attempting to read from the IStream* object. + */ +#define DMUS_E_CANNOTREAD MAKE_DMHRESULTERROR(0x0133) + +/* DMUS_E_DMUSIC_RELEASED + * + * The operation cannot be performed because the final instance of the + * DirectMusic object was released. Ports cannot be used after final + * release of the DirectMusic object. + */ +#define DMUS_E_DMUSIC_RELEASED MAKE_DMHRESULTERROR(0x0134) + +/* DMUS_E_BUFFER_EMPTY + * + * There was no data in the referenced buffer. + */ +#define DMUS_E_BUFFER_EMPTY MAKE_DMHRESULTERROR(0x0135) + +/* DMUS_E_BUFFER_FULL + * + * There is insufficient space to insert the given event into the buffer. + */ +#define DMUS_E_BUFFER_FULL MAKE_DMHRESULTERROR(0x0136) + +/* DMUS_E_PORT_NOT_CAPTURE + * + * The given operation could not be carried out because the port is a + * capture port. + */ +#define DMUS_E_PORT_NOT_CAPTURE MAKE_DMHRESULTERROR(0x0137) + +/* DMUS_E_PORT_NOT_RENDER + * + * The given operation could not be carried out because the port is a + * render port. + */ +#define DMUS_E_PORT_NOT_RENDER MAKE_DMHRESULTERROR(0x0138) + +/* DMUS_E_DSOUND_NOT_SET + * + * The port could not be created because no DirectSound has been specified. + * Specify a DirectSound interface via the IDirectMusic::SetDirectSound + * method; pass NULL to have DirectMusic manage usage of DirectSound. + */ +#define DMUS_E_DSOUND_NOT_SET MAKE_DMHRESULTERROR(0x0139) + +/* DMUS_E_ALREADY_ACTIVATED + * + * The operation cannot be carried out while the port is active. + */ +#define DMUS_E_ALREADY_ACTIVATED MAKE_DMHRESULTERROR(0x013A) + +/* DMUS_E_INVALIDBUFFER + * + * Invalid DirectSound buffer was handed to port. + */ +#define DMUS_E_INVALIDBUFFER MAKE_DMHRESULTERROR(0x013B) + +/* DMUS_E_WAVEFORMATNOTSUPPORTED + * + * Invalid buffer format was handed to the synth sink. + */ +#define DMUS_E_WAVEFORMATNOTSUPPORTED MAKE_DMHRESULTERROR(0x013C) + +/* DMUS_E_SYNTHINACTIVE + * + * The operation cannot be carried out while the synthesizer is inactive. + */ +#define DMUS_E_SYNTHINACTIVE MAKE_DMHRESULTERROR(0x013D) + +/* DMUS_E_DSOUND_ALREADY_SET + * + * IDirectMusic::SetDirectSound has already been called. It may not be + * changed while in use. + */ +#define DMUS_E_DSOUND_ALREADY_SET MAKE_DMHRESULTERROR(0x013E) + +/* DMUS_E_INVALID_EVENT + * + * The given event is invalid (either it is not a valid MIDI message + * or it makes use of running status). The event cannot be packed + * into the buffer. + */ +#define DMUS_E_INVALID_EVENT MAKE_DMHRESULTERROR(0x013F) + +/* DMUS_E_UNSUPPORTED_STREAM + * + * The IStream* object does not contain data supported by the loading object. + */ +#define DMUS_E_UNSUPPORTED_STREAM MAKE_DMHRESULTERROR(0x0150) + +/* DMUS_E_ALREADY_INITED + * + * The object has already been initialized. + */ +#define DMUS_E_ALREADY_INITED MAKE_DMHRESULTERROR(0x0151) + +/* DMUS_E_INVALID_BAND + * + * The file does not contain a valid band. + */ +#define DMUS_E_INVALID_BAND MAKE_DMHRESULTERROR(0x0152) + +/* DMUS_E_TRACK_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a track header as the first chunk, + * and therefore can not be read by the segment object. + */ +#define DMUS_E_TRACK_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0155) + +/* DMUS_E_TOOL_HDR_NOT_FIRST_CK + * + * The IStream* object's data does not have a tool header as the first chunk, + * and therefore can not be read by the graph object. + */ +#define DMUS_E_TOOL_HDR_NOT_FIRST_CK MAKE_DMHRESULTERROR(0x0156) + +/* DMUS_E_INVALID_TRACK_HDR + * + * The IStream* object's data contains an invalid track header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the segment object. + */ +#define DMUS_E_INVALID_TRACK_HDR MAKE_DMHRESULTERROR(0x0157) + +/* DMUS_E_INVALID_TOOL_HDR + * + * The IStream* object's data contains an invalid tool header (ckid is 0 and + * fccType is NULL,) and therefore can not be read by the graph object. + */ +#define DMUS_E_INVALID_TOOL_HDR MAKE_DMHRESULTERROR(0x0158) + +/* DMUS_E_ALL_TOOLS_FAILED + * + * The graph object was unable to load all tools from the IStream* object data. + * This may be due to errors in the stream, or the tools being incorrectly + * registered on the client. + */ +#define DMUS_E_ALL_TOOLS_FAILED MAKE_DMHRESULTERROR(0x0159) + +/* DMUS_E_ALL_TRACKS_FAILED + * + * The segment object was unable to load all tracks from the IStream* object data. + * This may be due to errors in the stream, or the tracks being incorrectly + * registered on the client. + */ +#define DMUS_E_ALL_TRACKS_FAILED MAKE_DMHRESULTERROR(0x0160) + +/* DMUS_E_NOT_FOUND + * + * The requested item was not contained by the object. + */ +#define DMUS_E_NOT_FOUND MAKE_DMHRESULTERROR(0x0161) + +/* DMUS_E_NOT_INIT + * + * A required object is not initialized or failed to initialize. + */ +#define DMUS_E_NOT_INIT MAKE_DMHRESULTERROR(0x0162) + +/* DMUS_E_TYPE_DISABLED + * + * The requested parameter type is currently disabled. Parameter types may + * be enabled and disabled by certain calls to SetParam(). + */ +#define DMUS_E_TYPE_DISABLED MAKE_DMHRESULTERROR(0x0163) + +/* DMUS_E_TYPE_UNSUPPORTED + * + * The requested parameter type is not supported on the object. + */ +#define DMUS_E_TYPE_UNSUPPORTED MAKE_DMHRESULTERROR(0x0164) + +/* DMUS_E_TIME_PAST + * + * The time is in the past, and the operation can not succeed. + */ +#define DMUS_E_TIME_PAST MAKE_DMHRESULTERROR(0x0165) + +/* DMUS_E_TRACK_NOT_FOUND + * + * The requested track is not contained by the segment. + */ +#define DMUS_E_TRACK_NOT_FOUND MAKE_DMHRESULTERROR(0x0166) + +/* DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT + * + * The track does not support clock time playback or getparam. + */ +#define DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT MAKE_DMHRESULTERROR(0x0167) + +/* DMUS_E_NO_MASTER_CLOCK + * + * There is no master clock in the performance. Be sure to call + * IDirectMusicPerformance::Init(). + */ +#define DMUS_E_NO_MASTER_CLOCK MAKE_DMHRESULTERROR(0x0170) + +/* DMUS_E_LOADER_NOCLASSID + * + * The class id field is required and missing in the DMUS_OBJECTDESC. + */ +#define DMUS_E_LOADER_NOCLASSID MAKE_DMHRESULTERROR(0x0180) + +/* DMUS_E_LOADER_BADPATH + * + * The requested file path is invalid. + */ +#define DMUS_E_LOADER_BADPATH MAKE_DMHRESULTERROR(0x0181) + +/* DMUS_E_LOADER_FAILEDOPEN + * + * File open failed - either file doesn't exist or is locked. + */ +#define DMUS_E_LOADER_FAILEDOPEN MAKE_DMHRESULTERROR(0x0182) + +/* DMUS_E_LOADER_FORMATNOTSUPPORTED + * + * Search data type is not supported. + */ +#define DMUS_E_LOADER_FORMATNOTSUPPORTED MAKE_DMHRESULTERROR(0x0183) + +/* DMUS_E_LOADER_FAILEDCREATE + * + * Unable to find or create object. + */ +#define DMUS_E_LOADER_FAILEDCREATE MAKE_DMHRESULTERROR(0x0184) + +/* DMUS_E_LOADER_OBJECTNOTFOUND + * + * Object was not found. + */ +#define DMUS_E_LOADER_OBJECTNOTFOUND MAKE_DMHRESULTERROR(0x0185) + +/* DMUS_E_LOADER_NOFILENAME + * + * The file name is missing from the DMUS_OBJECTDESC. + */ +#define DMUS_E_LOADER_NOFILENAME MAKE_DMHRESULTERROR(0x0186) + +/* DMUS_E_INVALIDFILE + * + * The file requested is not a valid file. + */ +#define DMUS_E_INVALIDFILE MAKE_DMHRESULTERROR(0x0200) + +/* DMUS_E_ALREADY_EXISTS + * + * The tool is already contained in the graph. Create a new instance. + */ +#define DMUS_E_ALREADY_EXISTS MAKE_DMHRESULTERROR(0x0201) + +/* DMUS_E_OUT_OF_RANGE + * + * Value is out of range, for instance the requested length is longer than + * the segment. + */ +#define DMUS_E_OUT_OF_RANGE MAKE_DMHRESULTERROR(0x0202) + +/* DMUS_E_SEGMENT_INIT_FAILED + * + * Segment initialization failed, most likely due to a critical memory situation. + */ +#define DMUS_E_SEGMENT_INIT_FAILED MAKE_DMHRESULTERROR(0x0203) + +/* DMUS_E_ALREADY_SENT + * + * The DMUS_PMSG has already been sent to the performance object via + * IDirectMusicPerformance::SendPMsg(). + */ +#define DMUS_E_ALREADY_SENT MAKE_DMHRESULTERROR(0x0204) + +/* DMUS_E_CANNOT_FREE + * + * The DMUS_PMSG was either not allocated by the performance via + * IDirectMusicPerformance::AllocPMsg(), or it was already freed via + * IDirectMusicPerformance::FreePMsg(). + */ +#define DMUS_E_CANNOT_FREE MAKE_DMHRESULTERROR(0x0205) + +/* DMUS_E_CANNOT_OPEN_PORT + * + * The default system port could not be opened. + */ +#define DMUS_E_CANNOT_OPEN_PORT MAKE_DMHRESULTERROR(0x0206) + +/* DMUS_E_CANNOT_CONVERT + * + * A call to MIDIToMusic() or MusicToMIDI() resulted in an error because + * the requested conversion could not happen. This usually occurs when the + * provided DMUS_CHORD_KEY structure has an invalid chord or scale pattern. + */ +#define DMUS_E_CANNOT_CONVERT MAKE_DMHRESULTERROR(0x0207) +/* misspelling in previous versions of DirectX preserved for backward compatibility */ +#define DMUS_E_CONNOT_CONVERT DMUS_E_CANNOT_CONVERT + +/* DMUS_E_DESCEND_CHUNK_FAIL + * + * DMUS_E_DESCEND_CHUNK_FAIL is returned when the end of the file + * was reached before the desired chunk was found. + */ +#define DMUS_E_DESCEND_CHUNK_FAIL MAKE_DMHRESULTERROR(0x0210) + +/* DMUS_E_NOT_LOADED + * + * An attempt to use this object failed because it first needs to + * be loaded. + */ +#define DMUS_E_NOT_LOADED MAKE_DMHRESULTERROR(0x0211) + +/* DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE + * + * The activeX scripting engine for the script's language is not compatible with + * DirectMusic. + * + */ +#define DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE MAKE_DMHRESULTERROR(0x0213) + +/* DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE + * + * A varient was used that had a type that is not supported by DirectMusic. + * + */ +#define DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE MAKE_DMHRESULTERROR(0x0214) + +/* DMUS_E_SCRIPT_ERROR_IN_SCRIPT + * + * An error was encountered while parsing or executing the script. + * The pErrorInfo parameter (if supplied) was filled with information about the error. + */ +#define DMUS_E_SCRIPT_ERROR_IN_SCRIPT MAKE_DMHRESULTERROR(0x0215) + +/* DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 + * + * Loading of oleaut32.dll failed. VBScript and other activeX scripting languages + * require use of oleaut32.dll. On platforms where oleaut32.dll is not present, only + * the DirectMusicScript language, which doesn't require oleaut32.dll can be used. + */ +#define DMUS_E_SCRIPT_CANTLOAD_OLEAUT32 MAKE_DMHRESULTERROR(0x0216) + +/* DMUS_E_SCRIPT_LOADSCRIPT_ERROR + * + * An error occured while parsing a script loaded using LoadScript. The script that + * was loaded contains an error. + */ +#define DMUS_E_SCRIPT_LOADSCRIPT_ERROR MAKE_DMHRESULTERROR(0x0217) + +/* DMUS_E_SCRIPT_INVALID_FILE + * + * The script file is invalid. + */ +#define DMUS_E_SCRIPT_INVALID_FILE MAKE_DMHRESULTERROR(0x0218) + +/* DMUS_E_INVALID_SCRIPTTRACK + * + * The file contains an invalid script track. + */ +#define DMUS_E_INVALID_SCRIPTTRACK MAKE_DMHRESULTERROR(0x0219) + +/* DMUS_E_SCRIPT_VARIABLE_NOT_FOUND + * + * The script does not contain a variable with the specified name. + */ +#define DMUS_E_SCRIPT_VARIABLE_NOT_FOUND MAKE_DMHRESULTERROR(0x021A) + +/* DMUS_E_SCRIPT_ROUTINE_NOT_FOUND + * + * The script does not contain a routine with the specified name. + */ +#define DMUS_E_SCRIPT_ROUTINE_NOT_FOUND MAKE_DMHRESULTERROR(0x021B) + +/* DMUS_E_SCRIPT_CONTENT_READONLY + * + * Scripts variables for content referenced or embedded in a script cannot be set. + */ +#define DMUS_E_SCRIPT_CONTENT_READONLY MAKE_DMHRESULTERROR(0x021C) + +/* DMUS_E_SCRIPT_NOT_A_REFERENCE + * + * Attempt was made to set a script's variable by reference to a value that was + * not an object type. + */ +#define DMUS_E_SCRIPT_NOT_A_REFERENCE MAKE_DMHRESULTERROR(0x021D) + +/* DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED + * + * Attempt was made to set a script's variable by value to an object that does + * not support a default value property. + */ +#define DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED MAKE_DMHRESULTERROR(0x021E) + +/* DMUS_E_INVALID_SEGMENTTRIGGERTRACK + * + * The file contains an invalid segment trigger track. + */ +#define DMUS_E_INVALID_SEGMENTTRIGGERTRACK MAKE_DMHRESULTERROR(0x0220) + +/* DMUS_E_INVALID_LYRICSTRACK + * + * The file contains an invalid lyrics track. + */ +#define DMUS_E_INVALID_LYRICSTRACK MAKE_DMHRESULTERROR(0x0221) + +/* DMUS_E_INVALID_PARAMCONTROLTRACK + * + * The file contains an invalid parameter control track. + */ +#define DMUS_E_INVALID_PARAMCONTROLTRACK MAKE_DMHRESULTERROR(0x0222) + +/* DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR + * + * A script written in AudioVBScript could not be read because it contained a statement that + * is not allowed by the AudioVBScript language. + */ +#define DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR MAKE_DMHRESULTERROR(0x0223) + +/* DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR + * + * A script routine written in AudioVBScript failed because an invalid operation occurred. For example, + * adding the number 3 to a segment object would produce this error. So would attempting to call a routine + * that doesn't exist. + */ +#define DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR MAKE_DMHRESULTERROR(0x0224) + +/* DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE + * + * A script routine written in AudioVBScript failed because a function outside of a script failed to complete. + * For example, a call to PlaySegment that fails to play because of low memory would return this error. + */ +#define DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE MAKE_DMHRESULTERROR(0x0225) + +/* DMUS_E_AUDIOPATHS_NOT_VALID + * + * The Performance has set up some PChannels using the AssignPChannel command, which + * makes it not capable of supporting audio paths. + */ +#define DMUS_E_AUDIOPATHS_NOT_VALID MAKE_DMHRESULTERROR(0x0226) + +/* DMUS_E_AUDIOPATHS_IN_USE + * + * This is the inverse of the previous error. + * The Performance has set up some audio paths, which makes is incompatible + * with the calls to allocate pchannels, etc. + */ +#define DMUS_E_AUDIOPATHS_IN_USE MAKE_DMHRESULTERROR(0x0227) + +/* DMUS_E_NO_AUDIOPATH_CONFIG + * + * A segment was asked for its embedded audio path configuration, + * but there isn't any. + */ +#define DMUS_E_NO_AUDIOPATH_CONFIG MAKE_DMHRESULTERROR(0x0228) + +/* DMUS_E_AUDIOPATH_INACTIVE + * + * An audiopath is inactive, perhaps because closedown was called. + */ +#define DMUS_E_AUDIOPATH_INACTIVE MAKE_DMHRESULTERROR(0x0229) + +/* DMUS_E_AUDIOPATH_NOBUFFER + * + * An audiopath failed to create because a requested buffer could not be created. + */ +#define DMUS_E_AUDIOPATH_NOBUFFER MAKE_DMHRESULTERROR(0x022A) + +/* DMUS_E_AUDIOPATH_NOPORT + * + * An audiopath could not be used for playback because it lacked port assignments. + */ +#define DMUS_E_AUDIOPATH_NOPORT MAKE_DMHRESULTERROR(0x022B) + +/* DMUS_E_NO_AUDIOPATH + * + * Attempt was made to play segment in audiopath mode and there was no audiopath. + */ +#define DMUS_E_NO_AUDIOPATH MAKE_DMHRESULTERROR(0x022C) + +/* DMUS_E_INVALIDCHUNK + * + * Invalid data was found in a RIFF file chunk. + */ +#define DMUS_E_INVALIDCHUNK MAKE_DMHRESULTERROR(0x022D) + +/* DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER + * + * Attempt was made to create an audiopath that sends to a global effects buffer which did not exist. + */ +#define DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER MAKE_DMHRESULTERROR(0x022E) + +/* DMUS_E_INVALID_CONTAINER_OBJECT + * + * The file does not contain a valid container object. + */ +#define DMUS_E_INVALID_CONTAINER_OBJECT MAKE_DMHRESULTERROR(0x022F) + +#endif diff --git a/SDK/dxSDK/Include/dmksctrl.h b/SDK/dxSDK/Include/dmksctrl.h new file mode 100644 index 00000000..f53e714b --- /dev/null +++ b/SDK/dxSDK/Include/dmksctrl.h @@ -0,0 +1,166 @@ +/************************************************************************ +* * +* dmksctrl.h -- Definition of IKsControl * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +* This header file contains the definition of IKsControl, which * +* duplicates definitions from ks.h and ksproxy.h. Your code should * +* include ks.h and ksproxy.h directly if you have them (they are * +* provided in the Windows 98 DDK and will be in the Windows NT 5 * +* SDK). * +* * +************************************************************************/ + +#ifndef _DMKSCTRL_ +#define _DMKSCTRL_ + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) /* Disable warnings on anonymous unions */ + +#include + +#include + +#if !defined(_NTRTL_) + #ifndef DEFINE_GUIDEX + #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name + #endif /* !defined(DEFINE_GUIDEX) */ + + #ifndef STATICGUIDOF + #define STATICGUIDOF(guid) STATIC_##guid + #endif /* !defined(STATICGUIDOF) */ +#endif /* !defined(_NTRTL_) */ + +#ifndef STATIC_IID_IKsControl +#define STATIC_IID_IKsControl\ + 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 +#endif /* STATIC_IID_IKsControl */ + +/* + * Warning: This will prevent the rest of ks.h from being pulled in if ks.h is + * included after dmksctrl.h. Make sure you do not include both headers in + * the same source file. + */ +#ifndef _KS_ +#define _KS_ + +#if (defined(_MSC_EXTENSIONS) || defined(__cplusplus)) && !defined(CINTERFACE) +typedef struct { + union { + struct { + GUID Set; + ULONG Id; + ULONG Flags; + }; + LONGLONG Alignment; + }; +} KSIDENTIFIER, *PKSIDENTIFIER; +#else +typedef struct { + union { + struct { + GUID Set; + ULONG Id; + ULONG Flags; + } Data; + LONGLONG Alignment; + }; +} KSIDENTIFIER, *PKSIDENTIFIER; +#endif + +typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY, KSMETHOD, *PKSMETHOD, KSEVENT, *PKSEVENT; + +#define KSMETHOD_TYPE_NONE 0x00000000 +#define KSMETHOD_TYPE_READ 0x00000001 +#define KSMETHOD_TYPE_WRITE 0x00000002 +#define KSMETHOD_TYPE_MODIFY 0x00000003 +#define KSMETHOD_TYPE_SOURCE 0x00000004 + +#define KSMETHOD_TYPE_SEND 0x00000001 +#define KSMETHOD_TYPE_SETSUPPORT 0x00000100 +#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200 + +#define KSPROPERTY_TYPE_GET 0x00000001 +#define KSPROPERTY_TYPE_SET 0x00000002 +#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100 +#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200 +#define KSPROPERTY_TYPE_RELATIONS 0x00000400 +#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800 +#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000 +#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000 +#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000 +#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000 +#define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000 + +#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000 +#endif /* _KS_ */ + +#ifndef _IKsControl_ +#define _IKsControl_ + +#ifdef DECLARE_INTERFACE_ + + +#undef INTERFACE +#define INTERFACE IKsControl +DECLARE_INTERFACE_(IKsControl, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*IKsControl*/ + STDMETHOD(KsProperty)( + THIS_ + IN PKSPROPERTY Property, + IN ULONG PropertyLength, + IN OUT LPVOID PropertyData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD(KsMethod)( + THIS_ + IN PKSMETHOD Method, + IN ULONG MethodLength, + IN OUT LPVOID MethodData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD(KsEvent)( + THIS_ + IN PKSEVENT Event OPTIONAL, + IN ULONG EventLength, + IN OUT LPVOID EventData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; +}; + +#endif /* DECLARE_INTERFACE_ */ +#endif /* _IKsControl_ */ + +#include + +DEFINE_GUID(IID_IKsControl, 0x28F54685, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96); + +/* These formats are in ksmedia.h + */ +#ifndef _KSMEDIA_ + +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_MIDI, 0x1D262760L, 0xE957, 0x11CF, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00); +DEFINE_GUID(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1); + +#endif + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + +#endif /* _DMKSCTRL */ + + + diff --git a/SDK/dxSDK/Include/dmplugin.h b/SDK/dxSDK/Include/dmplugin.h new file mode 100644 index 00000000..3f3e1414 --- /dev/null +++ b/SDK/dxSDK/Include/dmplugin.h @@ -0,0 +1,280 @@ +/************************************************************************ +* * +* dmplugin.h -- This module contains the API for plugins for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMPLUGIN_ +#define _DMPLUGIN_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +interface IDirectMusicTrack; +interface IDirectMusicTool; +interface IDirectMusicTool8; +interface IDirectMusicTrack8; +interface IDirectMusicPerformance; +interface IDirectMusicPerformance8; +interface IDirectMusicSegment; +interface IDirectMusicSegment8; +interface IDirectMusicSegmentState; +interface IDirectMusicSegmentState8; +interface IDirectMusicGraph; +#ifndef __cplusplus +typedef interface IDirectMusicTrack IDirectMusicTrack; +typedef interface IDirectMusicTool IDirectMusicTool; +typedef interface IDirectMusicTool8 IDirectMusicTool8; +typedef interface IDirectMusicTrack8 IDirectMusicTrack8; +typedef interface IDirectMusicPerformance IDirectMusicPerformance; +typedef interface IDirectMusicPerformance8 IDirectMusicPerformance8; +typedef interface IDirectMusicSegment IDirectMusicSegment; +typedef interface IDirectMusicSegment8 IDirectMusicSegment8; +typedef interface IDirectMusicSegmentState IDirectMusicSegmentState; +typedef interface IDirectMusicSegmentState8 IDirectMusicSegmentState8; +typedef interface IDirectMusicGraph IDirectMusicGraph; +#endif + +typedef struct _DMUS_PMSG DMUS_PMSG; +typedef long MUSIC_TIME; + +/* Registry location for tools */ +#define DMUS_REGSTR_PATH_TOOLS "Software\\Microsoft\\DirectMusic\\Tools" + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool */ +#undef INTERFACE +#define INTERFACE IDirectMusicTool +DECLARE_INTERFACE_(IDirectMusicTool, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTool */ + STDMETHOD(Init) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(GetMsgDeliveryType) (THIS_ DWORD* pdwDeliveryType ) PURE; + STDMETHOD(GetMediaTypeArraySize)(THIS_ DWORD* pdwNumElements ) PURE; + STDMETHOD(GetMediaTypes) (THIS_ DWORD** padwMediaTypes, + DWORD dwNumElements) PURE; + STDMETHOD(ProcessPMsg) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG) PURE; + STDMETHOD(Flush) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG, + REFERENCE_TIME rtTime) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTool8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicTool8 +DECLARE_INTERFACE_(IDirectMusicTool8, IDirectMusicTool) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTool */ + STDMETHOD(Init) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(GetMsgDeliveryType) (THIS_ DWORD* pdwDeliveryType ) PURE; + STDMETHOD(GetMediaTypeArraySize)(THIS_ DWORD* pdwNumElements ) PURE; + STDMETHOD(GetMediaTypes) (THIS_ DWORD** padwMediaTypes, + DWORD dwNumElements) PURE; + STDMETHOD(ProcessPMsg) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG) PURE; + STDMETHOD(Flush) (THIS_ IDirectMusicPerformance* pPerf, + DMUS_PMSG* pPMSG, + REFERENCE_TIME rtTime) PURE; + /* IDirectMusicTool8 */ + STDMETHOD(Clone) (THIS_ IDirectMusicTool ** ppTool) PURE; +}; + + +/* The following flags are sent in the IDirectMusicTrack::Play() method */ +/* inside the dwFlags parameter */ +typedef enum enumDMUS_TRACKF_FLAGS +{ + DMUS_TRACKF_SEEK = 1, /* set on a seek */ + DMUS_TRACKF_LOOP = 2, /* set on a loop (repeat) */ + DMUS_TRACKF_START = 4, /* set on first call to Play */ + DMUS_TRACKF_FLUSH = 8, /* set when this call is in response to a flush on the perfomance */ + DMUS_TRACKF_DIRTY = 0x10, /* set when the track should consider any cached values from a previous call to GetParam to be invalidated */ + /* The following flags are DX8 only. */ + DMUS_TRACKF_NOTIFY_OFF = 0x20, /* tells track not to send notifications. */ + DMUS_TRACKF_PLAY_OFF = 0x40, /* tells track not to play anything (but can still send notifications.) */ + DMUS_TRACKF_LOOPEND = 0x80, /* set when the end of range is also a loop end. */ + DMUS_TRACKF_STOP = 0x100, /* set when the end of range is also end of playing this segment. */ + DMUS_TRACKF_RECOMPOSE = 0x200, /* set to indicate the track should compose. */ + DMUS_TRACKF_CLOCK = 0x400, /* set when time parameters are in reference (clock) time. Only valid for PlayEx(). */ +} DMUS_TRACKF_FLAGS; + +/* The following flags are sent in the IDirectMusicTrack8::GetParamEx() and SetParamEx() methods */ +/* inside the dwFlags parameter */ +#define DMUS_TRACK_PARAMF_CLOCK 0x01 /* set when the time is measured is in reference (clock) time */ + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTrack */ +#undef INTERFACE +#define INTERFACE IDirectMusicTrack +DECLARE_INTERFACE_(IDirectMusicTrack, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTrack */ + STDMETHOD(Init) (THIS_ IDirectMusicSegment* pSegment) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState* pSegmentState, + IDirectMusicPerformance* pPerformance, + void** ppStateData, + DWORD dwVirtualTrackID, + DWORD dwFlags) PURE; + STDMETHOD(EndPlay) (THIS_ void* pStateData) PURE; + STDMETHOD(Play) (THIS_ void* pStateData, + MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + MUSIC_TIME mtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(IsParamSupported) (THIS_ REFGUID rguidType) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicTrack** ppTrack) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicTrack8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicTrack8 +DECLARE_INTERFACE_(IDirectMusicTrack8, IDirectMusicTrack) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicTrack */ + STDMETHOD(Init) (THIS_ IDirectMusicSegment* pSegment) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState* pSegmentState, + IDirectMusicPerformance* pPerformance, + void** ppStateData, + DWORD dwVirtualTrackID, + DWORD dwFlags) PURE; + STDMETHOD(EndPlay) (THIS_ void* pStateData) PURE; + STDMETHOD(Play) (THIS_ void* pStateData, + MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + MUSIC_TIME mtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(IsParamSupported) (THIS_ REFGUID rguidType) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicTrack** ppTrack) PURE; + /* IDirectMusicTrack8 */ + STDMETHOD(PlayEx) (THIS_ void* pStateData, + REFERENCE_TIME rtStart, + REFERENCE_TIME rtEnd, + REFERENCE_TIME rtOffset, + DWORD dwFlags, + IDirectMusicPerformance* pPerf, + IDirectMusicSegmentState* pSegSt, + DWORD dwVirtualID) PURE; + STDMETHOD(GetParamEx) (THIS_ REFGUID rguidType, /* Command type. */ + REFERENCE_TIME rtTime, /* Time, in ref time if dwFlags == DMUS_TRACK_PARAMF_CLOCK. Otherwise, music time. */ + REFERENCE_TIME* prtNext, /* Time of next parameter, relative to rtTime, in music or clock time units. */ + void* pParam, /* Pointer to the parameter data. */ + void * pStateData, /* State data for track instance. */ + DWORD dwFlags) PURE; /* Control flags. */ + STDMETHOD(SetParamEx) (THIS_ REFGUID rguidType, + REFERENCE_TIME rtTime, + void* pParam, /* Pointer to the parameter data. */ + void * pStateData, /* State data for track instance. */ + DWORD dwFlags) PURE; /* Control flags. */ + STDMETHOD(Compose) (THIS_ IUnknown* pContext, /* Context for composition */ + DWORD dwTrackGroup, + IDirectMusicTrack** ppResultTrack) PURE; + STDMETHOD(Join) (THIS_ IDirectMusicTrack* pNewTrack, + MUSIC_TIME mtJoin, + IUnknown* pContext, /* Context for joining */ + DWORD dwTrackGroup, + IDirectMusicTrack** ppResultTrack) PURE; +}; + +/* CLSID's */ +DEFINE_GUID(CLSID_DirectMusicTempoTrack,0xd2ac2885, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSeqTrack,0xd2ac2886, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSysExTrack,0xd2ac2887, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicTimeSigTrack,0xd2ac2888, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordTrack,0xd2ac288b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicCommandTrack,0xd2ac288c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicStyleTrack,0xd2ac288d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicMotifTrack,0xd2ac288e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSignPostTrack,0xf17e8672, 0xc3b4, 0x11d1, 0x87, 0xb, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicBandTrack,0xd2ac2894, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMapTrack,0xd2ac2896, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicMuteTrack,0xd2ac2898, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* New CLSID's for DX8 */ +DEFINE_GUID(CLSID_DirectMusicScriptTrack,0x4108fa85, 0x3586, 0x11d3, 0x8b, 0xd7, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {4108FA85-3586-11d3-8BD7-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicMarkerTrack,0x55a8fd00, 0x4288, 0x11d3, 0x9b, 0xd1, 0x8a, 0xd, 0x61, 0xc8, 0x88, 0x35); +DEFINE_GUID(CLSID_DirectMusicSegmentTriggerTrack, 0xbae4d665, 0x4ea1, 0x11d3, 0x8b, 0xda, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {BAE4D665-4EA1-11d3-8BDA-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicLyricsTrack, 0x995c1cf5, 0x54ff, 0x11d3, 0x8b, 0xda, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {995C1CF5-54FF-11d3-8BDA-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicParamControlTrack, 0x4be0537b, 0x5c19, 0x11d3, 0x8b, 0xdc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {4BE0537B-5C19-11d3-8BDC-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicWaveTrack,0xeed36461, 0x9ea5, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* IID's */ +DEFINE_GUID(IID_IDirectMusicTrack, 0xf96029a1, 0x4282, 0x11d2, 0x87, 0x17, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicTool,0xd2ac28ba, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Interface IDs for DX8 */ +/* changed interfaces (GUID only) */ +DEFINE_GUID(IID_IDirectMusicTool8, 0xe674303, 0x3b05, 0x11d3, 0x9b, 0xd1, 0xf9, 0xe7, 0xf0, 0xa0, 0x15, 0x36); +DEFINE_GUID(IID_IDirectMusicTrack8, 0xe674304, 0x3b05, 0x11d3, 0x9b, 0xd1, 0xf9, 0xe7, 0xf0, 0xa0, 0x15, 0x36); + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMPLUGIN_ */ diff --git a/SDK/dxSDK/Include/dmusbuff.h b/SDK/dxSDK/Include/dmusbuff.h new file mode 100644 index 00000000..54884538 --- /dev/null +++ b/SDK/dxSDK/Include/dmusbuff.h @@ -0,0 +1,41 @@ +/*************************************************************************** +* * +* DMusBuff.h -- This module defines the buffer format for DirectMusic * +* Shared file between user mode and kernel mode components * +* * +* Copyright (c) 1998, Microsoft Corp. All rights reserved. * +* * +***************************************************************************/ + +#ifndef _DMusBuff_ +#define _DMusBuff_ + +/* Format of DirectMusic events in a buffer + * + * A buffer contains 1 or more events, each with the following header. + * Immediately following the header is the event data. The header+data + * size is rounded to the nearest quadword (8 bytes). + */ + +#include /* Do not pad at end - that's where the data is */ +typedef struct _DMUS_EVENTHEADER *LPDMUS_EVENTHEADER; +typedef struct _DMUS_EVENTHEADER +{ + DWORD cbEvent; /* Unrounded bytes in event */ + DWORD dwChannelGroup; /* Channel group of event */ + REFERENCE_TIME rtDelta; /* Delta from start time of entire buffer */ + DWORD dwFlags; /* Flags DMUS_EVENT_xxx */ +} DMUS_EVENTHEADER; +#include + +#define DMUS_EVENT_STRUCTURED 0x00000001 /* Unstructured data (SysEx, etc.) */ + +/* The number of bytes to allocate for an event with 'cb' data bytes. + */ +#define QWORD_ALIGN(x) (((x) + 7) & ~7) +#define DMUS_EVENT_SIZE(cb) QWORD_ALIGN(sizeof(DMUS_EVENTHEADER) + cb) + + +#endif /* _DMusBuff_ */ + + diff --git a/SDK/dxSDK/Include/dmusicc.h b/SDK/dxSDK/Include/dmusicc.h new file mode 100644 index 00000000..0d0afb22 --- /dev/null +++ b/SDK/dxSDK/Include/dmusicc.h @@ -0,0 +1,784 @@ +/************************************************************************ +* * +* dmusicc.h -- This module defines the DirectMusic core API's * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICC_ +#define _DMUSICC_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#include "dls1.h" +#include "dmerror.h" +#include "dmdls.h" +#include "dsound.h" +#include "dmusbuff.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ULONGLONG SAMPLE_TIME; +typedef ULONGLONG SAMPLE_POSITION; +typedef SAMPLE_TIME *LPSAMPLE_TIME; + +#define DMUS_MAX_DESCRIPTION 128 +#define DMUS_MAX_DRIVER 128 + +typedef struct _DMUS_BUFFERDESC *LPDMUS_BUFFERDESC; +typedef struct _DMUS_BUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + GUID guidBufferFormat; + DWORD cbBuffer; +} DMUS_BUFFERDESC; + +/* DMUS_EFFECT_ flags are used in the dwEffectFlags fields of both DMUS_PORTCAPS + * and DMUS_PORTPARAMS. + */ +#define DMUS_EFFECT_NONE 0x00000000 +#define DMUS_EFFECT_REVERB 0x00000001 +#define DMUS_EFFECT_CHORUS 0x00000002 +#define DMUS_EFFECT_DELAY 0x00000004 + +/* For DMUS_PORTCAPS dwClass + */ +#define DMUS_PC_INPUTCLASS (0) +#define DMUS_PC_OUTPUTCLASS (1) + +/* For DMUS_PORTCAPS dwFlags + */ +#define DMUS_PC_DLS (0x00000001) // Supports DLS downloading and DLS level 1. +#define DMUS_PC_EXTERNAL (0x00000002) // External MIDI module. +#define DMUS_PC_SOFTWARESYNTH (0x00000004) // Software synthesizer. +#define DMUS_PC_MEMORYSIZEFIXED (0x00000008) // Memory size is fixed. +#define DMUS_PC_GMINHARDWARE (0x00000010) // GM sound set is built in, no need to download. +#define DMUS_PC_GSINHARDWARE (0x00000020) // GS sound set is built in. +#define DMUS_PC_XGINHARDWARE (0x00000040) // XG sound set is built in. +#define DMUS_PC_DIRECTSOUND (0x00000080) // Connects to DirectSound via a DirectSound buffer. +#define DMUS_PC_SHAREABLE (0x00000100) // Synth can be actively shared by multiple apps at once. +#define DMUS_PC_DLS2 (0x00000200) // Supports DLS2 instruments. +#define DMUS_PC_AUDIOPATH (0x00000400) // Multiple outputs can be connected to DirectSound for audiopaths. +#define DMUS_PC_WAVE (0x00000800) // Supports streaming and one shot waves. + +#define DMUS_PC_SYSTEMMEMORY (0x7FFFFFFF) // Sample memory is system memory. + + +typedef struct _DMUS_PORTCAPS +{ + DWORD dwSize; + DWORD dwFlags; + GUID guidPort; + DWORD dwClass; + DWORD dwType; + DWORD dwMemorySize; + DWORD dwMaxChannelGroups; + DWORD dwMaxVoices; + DWORD dwMaxAudioChannels; + DWORD dwEffectFlags; + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; +} DMUS_PORTCAPS; + +typedef DMUS_PORTCAPS *LPDMUS_PORTCAPS; + +/* Values for DMUS_PORTCAPS dwType. This field indicates the underlying + * driver type of the port. + */ +#define DMUS_PORT_WINMM_DRIVER (0) +#define DMUS_PORT_USER_MODE_SYNTH (1) +#define DMUS_PORT_KERNEL_MODE (2) + +/* These flags (set in dwValidParams) indicate which other members of the */ +/* DMUS_PORTPARAMS are valid. */ +/* */ +#define DMUS_PORTPARAMS_VOICES 0x00000001 +#define DMUS_PORTPARAMS_CHANNELGROUPS 0x00000002 +#define DMUS_PORTPARAMS_AUDIOCHANNELS 0x00000004 +#define DMUS_PORTPARAMS_SAMPLERATE 0x00000008 +#define DMUS_PORTPARAMS_EFFECTS 0x00000020 +#define DMUS_PORTPARAMS_SHARE 0x00000040 +#define DMUS_PORTPARAMS_FEATURES 0x00000080 /* DirectX 8.0 and above */ + +typedef struct _DMUS_PORTPARAMS +{ + DWORD dwSize; + DWORD dwValidParams; + DWORD dwVoices; + DWORD dwChannelGroups; + DWORD dwAudioChannels; + DWORD dwSampleRate; + DWORD dwEffectFlags; + BOOL fShare; +} DMUS_PORTPARAMS7; + +typedef struct _DMUS_PORTPARAMS8 +{ + DWORD dwSize; + DWORD dwValidParams; + DWORD dwVoices; + DWORD dwChannelGroups; + DWORD dwAudioChannels; + DWORD dwSampleRate; + DWORD dwEffectFlags; + BOOL fShare; + DWORD dwFeatures; +} DMUS_PORTPARAMS8; + +#define DMUS_PORT_FEATURE_AUDIOPATH 0x00000001 /* Supports audiopath connection to DirectSound buffers. */ +#define DMUS_PORT_FEATURE_STREAMING 0x00000002 /* Supports streaming waves through the synth. */ + + +typedef DMUS_PORTPARAMS8 DMUS_PORTPARAMS; +typedef DMUS_PORTPARAMS *LPDMUS_PORTPARAMS; + +typedef struct _DMUS_SYNTHSTATS *LPDMUS_SYNTHSTATS; +typedef struct _DMUS_SYNTHSTATS8 *LPDMUS_SYNTHSTATS8; +typedef struct _DMUS_SYNTHSTATS +{ + DWORD dwSize; /* Size in bytes of the structure */ + DWORD dwValidStats; /* Flags indicating which fields below are valid. */ + DWORD dwVoices; /* Average number of voices playing. */ + DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */ + DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */ + DWORD dwLostNotes; /* Number of notes lost in 1 second. */ + DWORD dwFreeMemory; /* Free memory in bytes */ + long lPeakVolume; /* Decibel level * 100. */ +} DMUS_SYNTHSTATS; + +typedef struct _DMUS_SYNTHSTATS8 +{ + DWORD dwSize; /* Size in bytes of the structure */ + DWORD dwValidStats; /* Flags indicating which fields below are valid. */ + DWORD dwVoices; /* Average number of voices playing. */ + DWORD dwTotalCPU; /* Total CPU usage as percent * 100. */ + DWORD dwCPUPerVoice; /* CPU per voice as percent * 100. */ + DWORD dwLostNotes; /* Number of notes lost in 1 second. */ + DWORD dwFreeMemory; /* Free memory in bytes */ + long lPeakVolume; /* Decibel level * 100. */ + DWORD dwSynthMemUse; /* Memory used by synth wave data */ +} DMUS_SYNTHSTATS8; + +#define DMUS_SYNTHSTATS_VOICES (1 << 0) +#define DMUS_SYNTHSTATS_TOTAL_CPU (1 << 1) +#define DMUS_SYNTHSTATS_CPU_PER_VOICE (1 << 2) +#define DMUS_SYNTHSTATS_LOST_NOTES (1 << 3) +#define DMUS_SYNTHSTATS_PEAK_VOLUME (1 << 4) +#define DMUS_SYNTHSTATS_FREE_MEMORY (1 << 5) + +#define DMUS_SYNTHSTATS_SYSTEMMEMORY DMUS_PC_SYSTEMMEMORY + +typedef struct _DMUS_WAVES_REVERB_PARAMS +{ + float fInGain; /* Input gain in dB (to avoid output overflows) */ + float fReverbMix; /* Reverb mix in dB. 0dB means 100% wet reverb (no direct signal) + Negative values gives less wet signal. + The coeficients are calculated so that the overall output level stays + (approximately) constant regardless of the ammount of reverb mix. */ + float fReverbTime; /* The reverb decay time, in milliseconds. */ + float fHighFreqRTRatio; /* The ratio of the high frequencies to the global reverb time. + Unless very 'splashy-bright' reverbs are wanted, this should be set to + a value < 1.0. + For example if dRevTime==1000ms and dHighFreqRTRatio=0.1 than the + decay time for high frequencies will be 100ms.*/ + +} DMUS_WAVES_REVERB_PARAMS; + +/* Note: Default values for Reverb are: + fInGain = 0.0dB (no change in level) + fReverbMix = -10.0dB (a reasonable reverb mix) + fReverbTime = 1000.0ms (one second global reverb time) + fHighFreqRTRatio = 0.001 (the ratio of the high frequencies to the global reverb time) +*/ + +typedef enum +{ + DMUS_CLOCK_SYSTEM = 0, + DMUS_CLOCK_WAVE = 1 +} DMUS_CLOCKTYPE; + +#define DMUS_CLOCKF_GLOBAL 0x00000001 + +typedef struct _DMUS_CLOCKINFO7 *LPDMUS_CLOCKINFO7; +typedef struct _DMUS_CLOCKINFO7 +{ + DWORD dwSize; + DMUS_CLOCKTYPE ctType; + GUID guidClock; /* Identifies this time source */ + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; +} DMUS_CLOCKINFO7; + +typedef struct _DMUS_CLOCKINFO8 *LPDMUS_CLOCKINFO8; +typedef struct _DMUS_CLOCKINFO8 +{ + DWORD dwSize; + DMUS_CLOCKTYPE ctType; + GUID guidClock; /* Identifies this time source */ + WCHAR wszDescription[DMUS_MAX_DESCRIPTION]; + DWORD dwFlags; +} DMUS_CLOCKINFO8; + +typedef DMUS_CLOCKINFO8 DMUS_CLOCKINFO; +typedef DMUS_CLOCKINFO *LPDMUS_CLOCKINFO; + +/* Default bus identifiers + * + * The first 17 are direct mappings to the destinations defined in both + * the MMA DLS Level 2 specification and the Microsoft Multi-Channel audio + * specification. + */ +#define DSBUSID_FIRST_SPKR_LOC 0 +#define DSBUSID_FRONT_LEFT 0 +#define DSBUSID_LEFT 0 /* Front left is also just left */ +#define DSBUSID_FRONT_RIGHT 1 +#define DSBUSID_RIGHT 1 /* Ditto front right */ +#define DSBUSID_FRONT_CENTER 2 +#define DSBUSID_LOW_FREQUENCY 3 +#define DSBUSID_BACK_LEFT 4 +#define DSBUSID_BACK_RIGHT 5 +#define DSBUSID_FRONT_LEFT_OF_CENTER 6 +#define DSBUSID_FRONT_RIGHT_OF_CENTER 7 +#define DSBUSID_BACK_CENTER 8 +#define DSBUSID_SIDE_LEFT 9 +#define DSBUSID_SIDE_RIGHT 10 +#define DSBUSID_TOP_CENTER 11 +#define DSBUSID_TOP_FRONT_LEFT 12 +#define DSBUSID_TOP_FRONT_CENTER 13 +#define DSBUSID_TOP_FRONT_RIGHT 14 +#define DSBUSID_TOP_BACK_LEFT 15 +#define DSBUSID_TOP_BACK_CENTER 16 +#define DSBUSID_TOP_BACK_RIGHT 17 +#define DSBUSID_LAST_SPKR_LOC 17 + +#define DSBUSID_IS_SPKR_LOC(id) ( ((id) >= DSBUSID_FIRST_SPKR_LOC) && ((id) <= DSBUSID_LAST_SPKR_LOC) ) + +/* These bus identifiers are for the standard DLS effect sends + */ +#define DSBUSID_REVERB_SEND 64 +#define DSBUSID_CHORUS_SEND 65 + +/* Dynamic bus identifiers start here. See the documentation for how + * synthesizers map the output of voices to static and dynamic + * bus identifiers. + */ +#define DSBUSID_DYNAMIC_0 512 + +/* Null bus, used to identify busses that have no function mapping. +*/ +#define DSBUSID_NULL 0xFFFFFFFF + +interface IDirectMusic; +interface IDirectMusic8; +interface IDirectMusicBuffer; +interface IDirectMusicPort; +interface IDirectMusicThru; +interface IReferenceClock; + +#ifndef __cplusplus + +typedef interface IDirectMusic IDirectMusic; +typedef interface IDirectMusic8 IDirectMusic8; +typedef interface IDirectMusicPort IDirectMusicPort; +typedef interface IDirectMusicBuffer IDirectMusicBuffer; +typedef interface IDirectMusicThru IDirectMusicThru; +typedef interface IReferenceClock IReferenceClock; + +#endif /* C++ */ + +typedef IDirectMusic *LPDIRECTMUSIC; +typedef IDirectMusic8 *LPDIRECTMUSIC8; +typedef IDirectMusicPort *LPDIRECTMUSICPORT; +typedef IDirectMusicBuffer *LPDIRECTMUSICBUFFER; + +#undef INTERFACE +#define INTERFACE IDirectMusic +DECLARE_INTERFACE_(IDirectMusic, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusic */ + STDMETHOD(EnumPort) (THIS_ DWORD dwIndex, + LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc, + LPDIRECTMUSICBUFFER *ppBuffer, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort, + LPDMUS_PORTPARAMS pPortParams, + LPDIRECTMUSICPORT *ppPort, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex, + LPDMUS_CLOCKINFO lpClockInfo) PURE; + STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock, + IReferenceClock **ppReferenceClock) PURE; + STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusic8 +DECLARE_INTERFACE_(IDirectMusic8, IDirectMusic) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusic */ + STDMETHOD(EnumPort) (THIS_ DWORD dwIndex, + LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(CreateMusicBuffer) (THIS_ LPDMUS_BUFFERDESC pBufferDesc, + LPDIRECTMUSICBUFFER *ppBuffer, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(CreatePort) (THIS_ REFCLSID rclsidPort, + LPDMUS_PORTPARAMS pPortParams, + LPDIRECTMUSICPORT *ppPort, + LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(EnumMasterClock) (THIS_ DWORD dwIndex, + LPDMUS_CLOCKINFO lpClockInfo) PURE; + STDMETHOD(GetMasterClock) (THIS_ LPGUID pguidClock, + IReferenceClock **ppReferenceClock) PURE; + STDMETHOD(SetMasterClock) (THIS_ REFGUID rguidClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(GetDefaultPort) (THIS_ LPGUID pguidPort) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + /* IDirectMusic8 */ + STDMETHOD(SetExternalMasterClock) + (THIS_ IReferenceClock *pClock) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusicBuffer +DECLARE_INTERFACE_(IDirectMusicBuffer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicBuffer */ + STDMETHOD(Flush) (THIS) PURE; + STDMETHOD(TotalTime) (THIS_ LPREFERENCE_TIME prtTime) PURE; + + STDMETHOD(PackStructured) (THIS_ REFERENCE_TIME rt, + DWORD dwChannelGroup, + DWORD dwChannelMessage) PURE; + + STDMETHOD(PackUnstructured) (THIS_ REFERENCE_TIME rt, + DWORD dwChannelGroup, + DWORD cb, + LPBYTE lpb) PURE; + + STDMETHOD(ResetReadPtr) (THIS) PURE; + STDMETHOD(GetNextEvent) (THIS_ LPREFERENCE_TIME prt, + LPDWORD pdwChannelGroup, + LPDWORD pdwLength, + LPBYTE *ppData) PURE; + + STDMETHOD(GetRawBufferPtr) (THIS_ LPBYTE *ppData) PURE; + STDMETHOD(GetStartTime) (THIS_ LPREFERENCE_TIME prt) PURE; + STDMETHOD(GetUsedBytes) (THIS_ LPDWORD pcb) PURE; + STDMETHOD(GetMaxBytes) (THIS_ LPDWORD pcb) PURE; + STDMETHOD(GetBufferFormat) (THIS_ LPGUID pGuidFormat) PURE; + + STDMETHOD(SetStartTime) (THIS_ REFERENCE_TIME rt) PURE; + STDMETHOD(SetUsedBytes) (THIS_ DWORD cb) PURE; +}; + +typedef IDirectMusicBuffer IDirectMusicBuffer8; +typedef IDirectMusicBuffer8 *LPDIRECTMUSICBUFFER8; + +#undef INTERFACE +#define INTERFACE IDirectMusicInstrument +DECLARE_INTERFACE_(IDirectMusicInstrument, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicInstrument */ + STDMETHOD(GetPatch) (THIS_ DWORD* pdwPatch) PURE; + STDMETHOD(SetPatch) (THIS_ DWORD dwPatch) PURE; +}; + +typedef IDirectMusicInstrument IDirectMusicInstrument8; +typedef IDirectMusicInstrument8 *LPDIRECTMUSICINSTRUMENT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicDownloadedInstrument +DECLARE_INTERFACE_(IDirectMusicDownloadedInstrument, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicDownloadedInstrument */ + /* None at this time */ +}; + +typedef IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument8; +typedef IDirectMusicDownloadedInstrument8 *LPDIRECTMUSICDOWNLOADEDINSTRUMENT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicCollection +DECLARE_INTERFACE_(IDirectMusicCollection, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicCollection */ + STDMETHOD(GetInstrument) (THIS_ DWORD dwPatch, + IDirectMusicInstrument** ppInstrument) PURE; + STDMETHOD(EnumInstrument) (THIS_ DWORD dwIndex, + DWORD* pdwPatch, + LPWSTR pwszName, + DWORD dwNameLen) PURE; +}; + +typedef IDirectMusicCollection IDirectMusicCollection8; +typedef IDirectMusicCollection8 *LPDIRECTMUSICCOLLECTION8; + +#undef INTERFACE +#define INTERFACE IDirectMusicDownload +DECLARE_INTERFACE_(IDirectMusicDownload , IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicDownload */ + STDMETHOD(GetBuffer) (THIS_ void** ppvBuffer, + DWORD* pdwSize) PURE; +}; + +typedef IDirectMusicDownload IDirectMusicDownload8; +typedef IDirectMusicDownload8 *LPDIRECTMUSICDOWNLOAD8; + +#undef INTERFACE +#define INTERFACE IDirectMusicPortDownload +DECLARE_INTERFACE_(IDirectMusicPortDownload, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPortDownload */ + STDMETHOD(GetBuffer) (THIS_ DWORD dwDLId, + IDirectMusicDownload** ppIDMDownload) PURE; + STDMETHOD(AllocateBuffer) (THIS_ DWORD dwSize, + IDirectMusicDownload** ppIDMDownload) PURE; + STDMETHOD(GetDLId) (THIS_ DWORD* pdwStartDLId, + DWORD dwCount) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; + STDMETHOD(Download) (THIS_ IDirectMusicDownload* pIDMDownload) PURE; + STDMETHOD(Unload) (THIS_ IDirectMusicDownload* pIDMDownload) PURE; +}; + +typedef IDirectMusicPortDownload IDirectMusicPortDownload8; +typedef IDirectMusicPortDownload8 *LPDIRECTMUSICPORTDOWNLOAD8; + +/* Standard values for voice priorities. Numerically higher priorities are higher in priority. + * These priorities are used to set the voice priority for all voices on a channel. They are + * used in the dwPriority parameter of IDirectMusicPort::GetPriority and returned in the + * lpwPriority parameter of pdwPriority. + * + * These priorities are shared with DirectSound. + */ + +#ifndef _DIRECTAUDIO_PRIORITIES_DEFINED_ +#define _DIRECTAUDIO_PRIORITIES_DEFINED_ + +#define DAUD_CRITICAL_VOICE_PRIORITY (0xF0000000) +#define DAUD_HIGH_VOICE_PRIORITY (0xC0000000) +#define DAUD_STANDARD_VOICE_PRIORITY (0x80000000) +#define DAUD_LOW_VOICE_PRIORITY (0x40000000) +#define DAUD_PERSIST_VOICE_PRIORITY (0x10000000) + +/* These are the default priorities assigned if not overridden. By default priorities are + * equal across channel groups (e.g. channel 5 on channel group 1 has the same priority as + * channel 5 on channel group 2). + * + * In accordance with DLS level 1, channel 10 has the highest priority, followed by 1 through 16 + * except for 10. + */ +#define DAUD_CHAN1_VOICE_PRIORITY_OFFSET (0x0000000E) +#define DAUD_CHAN2_VOICE_PRIORITY_OFFSET (0x0000000D) +#define DAUD_CHAN3_VOICE_PRIORITY_OFFSET (0x0000000C) +#define DAUD_CHAN4_VOICE_PRIORITY_OFFSET (0x0000000B) +#define DAUD_CHAN5_VOICE_PRIORITY_OFFSET (0x0000000A) +#define DAUD_CHAN6_VOICE_PRIORITY_OFFSET (0x00000009) +#define DAUD_CHAN7_VOICE_PRIORITY_OFFSET (0x00000008) +#define DAUD_CHAN8_VOICE_PRIORITY_OFFSET (0x00000007) +#define DAUD_CHAN9_VOICE_PRIORITY_OFFSET (0x00000006) +#define DAUD_CHAN10_VOICE_PRIORITY_OFFSET (0x0000000F) +#define DAUD_CHAN11_VOICE_PRIORITY_OFFSET (0x00000005) +#define DAUD_CHAN12_VOICE_PRIORITY_OFFSET (0x00000004) +#define DAUD_CHAN13_VOICE_PRIORITY_OFFSET (0x00000003) +#define DAUD_CHAN14_VOICE_PRIORITY_OFFSET (0x00000002) +#define DAUD_CHAN15_VOICE_PRIORITY_OFFSET (0x00000001) +#define DAUD_CHAN16_VOICE_PRIORITY_OFFSET (0x00000000) + + +#define DAUD_CHAN1_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN1_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN2_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN2_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN3_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN3_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN4_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN4_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN5_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN5_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN6_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN6_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN7_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN7_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN8_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN8_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN9_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN9_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN10_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN10_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN11_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN11_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN12_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN12_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN13_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN13_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN14_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN14_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN15_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN15_VOICE_PRIORITY_OFFSET) +#define DAUD_CHAN16_DEF_VOICE_PRIORITY (DAUD_STANDARD_VOICE_PRIORITY | DAUD_CHAN16_VOICE_PRIORITY_OFFSET) + +#endif /* _DIRECTAUDIO_PRIORITIES_DEFINED_ */ + + +#undef INTERFACE +#define INTERFACE IDirectMusicPort +DECLARE_INTERFACE_(IDirectMusicPort, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPort */ + /* */ + STDMETHOD(PlayBuffer) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE; + STDMETHOD(SetReadNotificationHandle) (THIS_ HANDLE hEvent) PURE; + STDMETHOD(Read) (THIS_ LPDIRECTMUSICBUFFER pBuffer) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument *pInstrument, + IDirectMusicDownloadedInstrument **ppDownloadedInstrument, + DMUS_NOTERANGE *pNoteRanges, + DWORD dwNumNoteRanges) PURE; + STDMETHOD(UnloadInstrument) (THIS_ IDirectMusicDownloadedInstrument *pDownloadedInstrument) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetCaps) (THIS_ LPDMUS_PORTCAPS pPortCaps) PURE; + STDMETHOD(DeviceIoControl) (THIS_ DWORD dwIoControlCode, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesReturned, + LPOVERLAPPED lpOverlapped) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwChannelGroups) PURE; + STDMETHOD(GetNumChannelGroups) (THIS_ LPDWORD pdwChannelGroups) PURE; + STDMETHOD(Activate) (THIS_ BOOL fActive) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize, LPDWORD pdwBufferSize) PURE; +}; + +typedef IDirectMusicPort IDirectMusicPort8; +typedef IDirectMusicPort8 *LPDIRECTMUSICPORT8; + +#undef INTERFACE +#define INTERFACE IDirectMusicThru +DECLARE_INTERFACE_(IDirectMusicThru, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicThru + */ + STDMETHOD(ThruChannel) (THIS_ DWORD dwSourceChannelGroup, + DWORD dwSourceChannel, + DWORD dwDestinationChannelGroup, + DWORD dwDestinationChannel, + LPDIRECTMUSICPORT pDestinationPort) PURE; +}; + +typedef IDirectMusicThru IDirectMusicThru8; +typedef IDirectMusicThru8 *LPDIRECTMUSICTHRU8; + +#ifndef __IReferenceClock_INTERFACE_DEFINED__ +#define __IReferenceClock_INTERFACE_DEFINED__ + +DEFINE_GUID(IID_IReferenceClock,0x56a86897,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); + +#undef INTERFACE +#define INTERFACE IReferenceClock +DECLARE_INTERFACE_(IReferenceClock, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IReferenceClock */ + /* */ + + /* get the time now */ + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE; + + /* ask for an async notification that a time has elapsed */ + STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME baseTime, /* base time */ + REFERENCE_TIME streamTime, /* stream offset time */ + HANDLE hEvent, /* advise via this event */ + DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */ + + /* ask for an async periodic notification that a time has elapsed */ + STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME startTime, /* starting at this time */ + REFERENCE_TIME periodTime, /* time between notifications */ + HANDLE hSemaphore, /* advise via a semaphore */ + DWORD * pdwAdviseCookie) PURE; /* where your cookie goes */ + + /* cancel a request for notification */ + STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE; +}; + +#endif /* __IReferenceClock_INTERFACE_DEFINED__ */ + +DEFINE_GUID(CLSID_DirectMusic,0x636b9f10,0x0c7d,0x11d1,0x95,0xb2,0x00,0x20,0xaf,0xdc,0x74,0x21); +DEFINE_GUID(CLSID_DirectMusicCollection,0x480ff4b0, 0x28b2, 0x11d1, 0xbe, 0xf7, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef); +DEFINE_GUID(CLSID_DirectMusicSynth,0x58C2B4D0,0x46E7,0x11D1,0x89,0xAC,0x00,0xA0,0xC9,0x05,0x41,0x29); + +DEFINE_GUID(IID_IDirectMusic,0x6536115a,0x7b2d,0x11d2,0xba,0x18,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicBuffer,0xd2ac2878, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicPort, 0x08f2d8c9,0x37c2,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12); +DEFINE_GUID(IID_IDirectMusicThru, 0xced153e7, 0x3606, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(IID_IDirectMusicPortDownload,0xd2ac287a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicDownload,0xd2ac287b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicCollection,0xd2ac287c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicInstrument,0xd2ac287d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicDownloadedInstrument,0xd2ac287e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + + +/* Alternate interface ID for IID_IDirectMusic, available in DX7 release and after. */ +DEFINE_GUID(IID_IDirectMusic2,0x6fc2cae1, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +DEFINE_GUID(IID_IDirectMusic8,0x2d3629f7,0x813d,0x4939,0x85,0x08,0xf0,0x5c,0x6b,0x75,0xfd,0x97); + +#define IID_IDirectMusicThru8 IID_IDirectMusicThru +#define IID_IDirectMusicPortDownload8 IID_IDirectMusicPortDownload +#define IID_IDirectMusicDownload8 IID_IDirectMusicDownload +#define IID_IDirectMusicCollection8 IID_IDirectMusicCollection +#define IID_IDirectMusicInstrument8 IID_IDirectMusicInstrument +#define IID_IDirectMusicDownloadedInstrument8 IID_IDirectMusicDownloadedInstrument +#define IID_IDirectMusicPort8 IID_IDirectMusicPort + + +/* Property Query GUID_DMUS_PROP_GM_Hardware - Local GM set, no need to download + * Property Query GUID_DMUS_PROP_GS_Hardware - Local GS set, no need to download + * Property Query GUID_DMUS_PROP_XG_Hardware - Local XG set, no need to download + * Property Query GUID_DMUS_PROP_DLS1 - Support DLS level 1 + * Property Query GUID_DMUS_PROP_INSTRUMENT2 - Support new INSTRUMENT2 download format + * Property Query GUID_DMUS_PROP_XG_Capable - Support minimum requirements of XG + * Property Query GUID_DMUS_PROP_GS_Capable - Support minimum requirements of GS + * Property Query GUID_DMUS_PROP_SynthSink_DSOUND - Synthsink talks to DirectSound + * Property Query GUID_DMUS_PROP_SynthSink_WAVE - Synthsink talks to Wave device + * + * Item 0: Supported + * Returns a DWORD which is non-zero if the feature is supported + */ +DEFINE_GUID(GUID_DMUS_PROP_GM_Hardware, 0x178f2f24, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_GS_Hardware, 0x178f2f25, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_XG_Hardware, 0x178f2f26, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_XG_Capable, 0x6496aba1, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_GS_Capable, 0x6496aba2, 0x61b0, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_DLS1, 0x178f2f27, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_DLS2, 0xf14599e5, 0x4689, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(GUID_DMUS_PROP_INSTRUMENT2, 0x865fd372, 0x9f67, 0x11d2, 0x87, 0x2a, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_DSOUND,0xaa97844, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SynthSink_WAVE,0xaa97845, 0xc877, 0x11d1, 0x87, 0xc, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_DMUS_PROP_SampleMemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); +DEFINE_GUID(GUID_DMUS_PROP_SamplePlaybackRate, 0x2a91f713, 0xa4bf, 0x11d2, 0xbb, 0xdf, 0x0, 0x60, 0x8, 0x33, 0xdb, 0xd8); + +/* Property Get/Set GUID_DMUS_PROP_WriteLatency + * + * Item 0: Synth buffer write latency, in milliseconds + * Get/Set SynthSink latency, the average time after the play head that the next buffer gets written. + */ +DEFINE_GUID(GUID_DMUS_PROP_WriteLatency,0x268a0fa0, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Get/Set GUID_DMUS_PROP_WritePeriod + * + * Item 0: Synth buffer write period, in milliseconds + * Get/Set SynthSink buffer write period, time span between successive writes. + */ +DEFINE_GUID(GUID_DMUS_PROP_WritePeriod,0x268a0fa1, 0x60f2, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Get GUID_DMUS_PROP_MemorySize + * + * Item 0: Memory size + * Returns a DWORD containing the total number of bytes of sample RAM + */ +DEFINE_GUID(GUID_DMUS_PROP_MemorySize, 0x178f2f28, 0xc364, 0x11d1, 0xa7, 0x60, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_WavesReverb + * + * Item 0: DMUS_WAVES_REVERB structure + * Sets reverb parameters + */ +DEFINE_GUID(GUID_DMUS_PROP_WavesReverb,0x4cb5622, 0x32e5, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Set GUID_DMUS_PROP_Effects + * + * Item 0: DWORD with effects flags. + * Get/Set effects bits, same as dwEffectFlags in DMUS_PORTPARAMS and DMUS_PORTCAPS: + * DMUS_EFFECT_NONE + * DMUS_EFFECT_REVERB + * DMUS_EFFECT_CHORUS + */ +DEFINE_GUID(GUID_DMUS_PROP_Effects, 0xcda8d611, 0x684a, 0x11d2, 0x87, 0x1e, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Property Set GUID_DMUS_PROP_LegacyCaps + * + * Item 0: The MIDINCAPS or MIDIOUTCAPS which describes the port's underlying WinMM device. This property is only supported + * by ports which wrap WinMM devices. + */ + +DEFINE_GUID(GUID_DMUS_PROP_LegacyCaps,0xcfa7cdc2, 0x00a1, 0x11d2, 0xaa, 0xd5, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_Volume + * + * Item 0: A long which contains an offset, in 1/100 dB, to be added to the final volume + * + */ +DEFINE_GUID(GUID_DMUS_PROP_Volume, 0xfedfae25L, 0xe46e, 0x11d1, 0xaa, 0xce, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Min and Max values for setting volume with GUID_DMUS_PROP_Volume */ + +#define DMUS_VOLUME_MAX 2000 /* +20 dB */ +#define DMUS_VOLUME_MIN -20000 /* -200 dB */ + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICC_ */ diff --git a/SDK/dxSDK/Include/dmusicf.h b/SDK/dxSDK/Include/dmusicf.h new file mode 100644 index 00000000..920b2fcc --- /dev/null +++ b/SDK/dxSDK/Include/dmusicf.h @@ -0,0 +1,2199 @@ +/************************************************************************ +* * +* dmusicf.h -- This module defines the DirectMusic file formats * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICF_ +#define _DMUSICF_ + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +interface IDirectMusicCollection; +#ifndef __cplusplus +typedef interface IDirectMusicCollection IDirectMusicCollection; +#endif + +/* Common chunks */ + +#define DMUS_FOURCC_GUID_CHUNK mmioFOURCC('g','u','i','d') +#define DMUS_FOURCC_INFO_LIST mmioFOURCC('I','N','F','O') +#define DMUS_FOURCC_UNFO_LIST mmioFOURCC('U','N','F','O') +#define DMUS_FOURCC_UNAM_CHUNK mmioFOURCC('U','N','A','M') +#define DMUS_FOURCC_UART_CHUNK mmioFOURCC('U','A','R','T') +#define DMUS_FOURCC_UCOP_CHUNK mmioFOURCC('U','C','O','P') +#define DMUS_FOURCC_USBJ_CHUNK mmioFOURCC('U','S','B','J') +#define DMUS_FOURCC_UCMT_CHUNK mmioFOURCC('U','C','M','T') +#define DMUS_FOURCC_CATEGORY_CHUNK mmioFOURCC('c','a','t','g') +#define DMUS_FOURCC_VERSION_CHUNK mmioFOURCC('v','e','r','s') + +/* The following structures are used by the Tracks, and are the packed structures */ +/* that are passed to the Tracks inside the IStream. */ + + +typedef struct _DMUS_IO_SEQ_ITEM +{ + MUSIC_TIME mtTime; + MUSIC_TIME mtDuration; + DWORD dwPChannel; + short nOffset; + BYTE bStatus; + BYTE bByte1; + BYTE bByte2; +} DMUS_IO_SEQ_ITEM; + + +typedef struct _DMUS_IO_CURVE_ITEM +{ + MUSIC_TIME mtStart; + MUSIC_TIME mtDuration; + MUSIC_TIME mtResetDuration; + DWORD dwPChannel; + short nOffset; + short nStartValue; + short nEndValue; + short nResetValue; + BYTE bType; + BYTE bCurveShape; + BYTE bCCData; + BYTE bFlags; + /* Following was added for DirectX8. */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */ +} DMUS_IO_CURVE_ITEM; + + +typedef struct _DMUS_IO_TEMPO_ITEM +{ + MUSIC_TIME lTime; + double dblTempo; +} DMUS_IO_TEMPO_ITEM; + + +typedef struct _DMUS_IO_SYSEX_ITEM +{ + MUSIC_TIME mtTime; + DWORD dwPChannel; + DWORD dwSysExLength; +} DMUS_IO_SYSEX_ITEM; + +typedef DMUS_CHORD_KEY DMUS_CHORD_PARAM; /* DMUS_CHORD_KEY defined in dmusici.h */ + +typedef struct _DMUS_RHYTHM_PARAM +{ + DMUS_TIMESIGNATURE TimeSig; + DWORD dwRhythmPattern; +} DMUS_RHYTHM_PARAM; + +typedef struct _DMUS_TEMPO_PARAM +{ + MUSIC_TIME mtTime; + double dblTempo; +} DMUS_TEMPO_PARAM; + + +typedef struct _DMUS_MUTE_PARAM +{ + DWORD dwPChannel; + DWORD dwPChannelMap; + BOOL fMute; +} DMUS_MUTE_PARAM; + +/* Style chunks */ + +#define DMUS_FOURCC_STYLE_FORM mmioFOURCC('D','M','S','T') +#define DMUS_FOURCC_STYLE_CHUNK mmioFOURCC('s','t','y','h') +#define DMUS_FOURCC_PART_LIST mmioFOURCC('p','a','r','t') +#define DMUS_FOURCC_PART_CHUNK mmioFOURCC('p','r','t','h') +#define DMUS_FOURCC_NOTE_CHUNK mmioFOURCC('n','o','t','e') +#define DMUS_FOURCC_CURVE_CHUNK mmioFOURCC('c','r','v','e') +#define DMUS_FOURCC_MARKER_CHUNK mmioFOURCC('m','r','k','r') +#define DMUS_FOURCC_RESOLUTION_CHUNK mmioFOURCC('r','s','l','n') +#define DMUS_FOURCC_ANTICIPATION_CHUNK mmioFOURCC('a','n','p','n') +#define DMUS_FOURCC_PATTERN_LIST mmioFOURCC('p','t','t','n') +#define DMUS_FOURCC_PATTERN_CHUNK mmioFOURCC('p','t','n','h') +#define DMUS_FOURCC_RHYTHM_CHUNK mmioFOURCC('r','h','t','m') +#define DMUS_FOURCC_PARTREF_LIST mmioFOURCC('p','r','e','f') +#define DMUS_FOURCC_PARTREF_CHUNK mmioFOURCC('p','r','f','c') +#define DMUS_FOURCC_STYLE_PERS_REF_LIST mmioFOURCC('p','r','r','f') +#define DMUS_FOURCC_MOTIFSETTINGS_CHUNK mmioFOURCC('m','t','f','s') + +/* Flags used by variations: these make up the DWORDs in dwVariationChoices. */ + +/* These flags determine the types of chords supported by a given variation in DirectMusic */ +/* mode. The first seven flags (bits 1-7) are set if the variation supports major chords */ +/* rooted in scale positions, so, e.g., if bits 1, 2, and 4 are set, the variation */ +/* supports major chords rooted in the tonic, second, and fourth scale positions. The */ +/* next seven flags serve the same purpose, but for minor chords, and the following seven */ +/* flags serve the same purpose for chords that are not major or minor (e.g., SUS 4 */ +/* chords). Bits 22, 23, and 24 are set if the variation supports chords rooted in the */ +/* scale, chords rooted sharp of scale tones, and chords rooted flat of scale tones, */ +/* respectively. For example, to support a C# minor chord in the scale of C Major, */ +/* bits 8 (for tonic minor) and 24 (for sharp) need to be set. Bits 25, 26, an 27 handle */ +/* chords that are triads, 6th or 7th chords, and chords with extensions, respectively. */ +/* bits 28 and 29 handle chords that are followed by tonic and dominant chords, */ +/* respectively. */ +#define DMUS_VARIATIONF_MAJOR 0x0000007F /* Seven positions in the scale - major chords. */ +#define DMUS_VARIATIONF_MINOR 0x00003F80 /* Seven positions in the scale - minor chords. */ +#define DMUS_VARIATIONF_OTHER 0x001FC000 /* Seven positions in the scale - other chords. */ +#define DMUS_VARIATIONF_ROOT_SCALE 0x00200000 /* Handles chord roots in the scale. */ +#define DMUS_VARIATIONF_ROOT_FLAT 0x00400000 /* Handles flat chord roots (based on scale notes). */ +#define DMUS_VARIATIONF_ROOT_SHARP 0x00800000 /* Handles sharp chord roots (based on scale notes). */ +#define DMUS_VARIATIONF_TYPE_TRIAD 0x01000000 /* Handles simple chords - triads. */ +#define DMUS_VARIATIONF_TYPE_6AND7 0x02000000 /* Handles simple chords - 6 and 7. */ +#define DMUS_VARIATIONF_TYPE_COMPLEX 0x04000000 /* Handles complex chords. */ +#define DMUS_VARIATIONF_DEST_TO1 0x08000000 /* Handles transitions to 1 chord. */ +#define DMUS_VARIATIONF_DEST_TO5 0x10000000 /* Handles transitions to 5 chord. */ +#define DMUS_VARIATIONF_DEST_OTHER 0x40000000 /* Handles transitions to chords other than 1 . */ + +/* legacy mask for variation modes */ +#define DMUS_VARIATIONF_MODES 0xE0000000 +/* Bits 29 and 31 of the variation flags are the Mode bits. If both are 0, it's IMA. */ +/* If bit 29 is 1, it's Direct Music. */ +#define DMUS_VARIATIONF_MODES_EX (0x20000000 | 0x80000000) +#define DMUS_VARIATIONF_IMA25_MODE 0x00000000 +#define DMUS_VARIATIONF_DMUS_MODE 0x20000000 + +/* Set this if the part uses marker events */ +#define DMUS_PARTF_USE_MARKERS 0x1 +/* Set this if the part is allowed to switch only on chord-aligned markers */ +#define DMUS_PARTF_ALIGN_CHORDS 0x2 + +/* These specify if the marker event signals whether to stop a variation or start a +pattern/variation (or both), and whether new variations must align with a chord */ +#define DMUS_MARKERF_START 0x1 +#define DMUS_MARKERF_STOP 0x2 +#define DMUS_MARKERF_CHORD_ALIGN 0x4 + +/* if this flag is set, variation settings in a playing pattern-based track's state data will +persist in the track after it stops playing */ +#define DMUS_PATTERNF_PERSIST_CONTROL 0x1 + +/* These specify possible values for DMUS_IO_PARTREF.bRandomVariation + all but DMUS_VARIATIONT_SEQUENTIAL and DMUS_VARIATIONT_RANDOM are DirectX8. */ +typedef enum enumDMUS_VARIATIONT_TYPES +{ + DMUS_VARIATIONT_SEQUENTIAL = 0, /* Play sequential starting with variation 1. */ + DMUS_VARIATIONT_RANDOM = 1, /* Play randomly. */ + DMUS_VARIATIONT_RANDOM_START = 2, /* Play sequential starting with a random variation. */ + DMUS_VARIATIONT_NO_REPEAT = 3, /* Play randomly, but don't play the same variation twice. */ + DMUS_VARIATIONT_RANDOM_ROW = 4 /* Play randomly as a row: don't repeat any variation until all have played. */ +} DMUS_VARIATIONT_TYPES; + +/* These specify possible values for DMUS_IO_PATTERN.wEmbellishment (DirectX8) */ +typedef enum enumDMUS_EMBELLISHT_TYPES +{ + DMUS_EMBELLISHT_NORMAL = 0, + DMUS_EMBELLISHT_FILL = 1, + DMUS_EMBELLISHT_BREAK = 2, + DMUS_EMBELLISHT_INTRO = 4, + DMUS_EMBELLISHT_END = 8, + DMUS_EMBELLISHT_MOTIF = 16, + DMUS_EMBELLISHT_ALL = 0xFFFF +} DMUS_EMBELLISHT_TYPES; + +#pragma pack(2) + +typedef struct _DMUS_IO_TIMESIG +{ + /* Time signatures define how many beats per measure, which note receives */ + /* the beat, and the grid resolution. */ + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_IO_TIMESIG; + +typedef struct _DMUS_IO_STYLE +{ + DMUS_IO_TIMESIG timeSig; /* Styles have a default Time Signature */ + double dblTempo; +} DMUS_IO_STYLE; + +typedef struct _DMUS_IO_VERSION +{ + DWORD dwVersionMS; /* Version # high-order 32 bits */ + DWORD dwVersionLS; /* Version # low-order 32 bits */ +} DMUS_IO_VERSION; + +typedef struct _DMUS_IO_PATTERN +{ + DMUS_IO_TIMESIG timeSig; /* Patterns can override the Style's Time sig. */ + BYTE bGrooveBottom; /* bottom of groove range */ + BYTE bGrooveTop; /* top of groove range */ + WORD wEmbellishment; /* Fill, Break, Intro, End, Normal, Motif */ + WORD wNbrMeasures; /* length in measures */ + BYTE bDestGrooveBottom; /* bottom of groove range for next pattern */ + BYTE bDestGrooveTop; /* top of groove range for next pattern */ + DWORD dwFlags; /* various flags */ +} DMUS_IO_PATTERN; + +typedef struct _DMUS_IO_STYLEPART +{ + DMUS_IO_TIMESIG timeSig; /* can override pattern's */ + DWORD dwVariationChoices[32]; /* MOAW choice bitfield */ + GUID guidPartID; /* identifies the part */ + WORD wNbrMeasures; /* length of the Part */ + BYTE bPlayModeFlags; /* see PLAYMODE flags */ + BYTE bInvertUpper; /* inversion upper limit */ + BYTE bInvertLower; /* inversion lower limit */ + BYTE bPad[3]; /* for DWORD alignment */ + DWORD dwFlags; /* various flags */ +} DMUS_IO_STYLEPART; + +typedef struct _DMUS_IO_PARTREF +{ + GUID guidPartID; /* unique ID for matching up with parts */ + WORD wLogicalPartID; /* corresponds to port/device/midi channel OBSOLETE */ + BYTE bVariationLockID; /* parts with the same ID lock variations. */ + /* high bit is used to identify master Part */ + BYTE bSubChordLevel; /* tells which sub chord level this part wants */ + BYTE bPriority; /* 256 priority levels. Parts with lower priority */ + /* aren't played first when a device runs out of */ + /* notes */ + BYTE bRandomVariation; /* when set, matching variations play in random order */ + /* when clear, matching variations play sequentially */ + WORD wPad; /* not used */ + DWORD dwPChannel; /* replaces wLogicalPartID */ +} DMUS_IO_PARTREF; + +typedef struct _DMUS_IO_STYLENOTE +{ + MUSIC_TIME mtGridStart; /* when this note occurs */ + DWORD dwVariation; /* variation bits */ + MUSIC_TIME mtDuration; /* how long this note lasts */ + short nTimeOffset; /* offset from mtGridStart */ + WORD wMusicValue; /* Position in scale. */ + BYTE bVelocity; /* Note velocity. */ + BYTE bTimeRange; /* Range to randomize start time. */ + BYTE bDurRange; /* Range to randomize duration. */ + BYTE bVelRange; /* Range to randomize velocity. */ + BYTE bInversionID; /* Identifies inversion group to which this note belongs */ + BYTE bPlayModeFlags; /* Can override part */ + /* Following exists only under DirectX8 and on */ + BYTE bNoteFlags; /* values from DMUS_NOTEF_FLAGS */ +} DMUS_IO_STYLENOTE; + +typedef struct _DMUS_IO_STYLECURVE +{ + MUSIC_TIME mtGridStart; /* when this curve occurs */ + DWORD dwVariation; /* variation bits */ + MUSIC_TIME mtDuration; /* how long this curve lasts */ + MUSIC_TIME mtResetDuration;/* how long after the end of the curve to reset the curve */ + short nTimeOffset; /* offset from mtGridStart */ + short nStartValue; /* curve's start value */ + short nEndValue; /* curve's end value */ + short nResetValue; /* the value to which to reset the curve */ + BYTE bEventType; /* type of curve */ + BYTE bCurveShape; /* shape of curve */ + BYTE bCCData; /* CC# */ + BYTE bFlags; /* Bit 1=TRUE means to send nResetValue. Otherwise, don't. + Other bits are reserved. */ + /* Following was added for DirectX8. */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.) */ +} DMUS_IO_STYLECURVE; + +typedef struct _DMUS_IO_STYLEMARKER +{ + MUSIC_TIME mtGridStart; /* when this marker occurs */ + DWORD dwVariation; /* variation bits */ + WORD wMarkerFlags; /* how the marker is used */ +} DMUS_IO_STYLEMARKER; + +typedef struct _DMUS_IO_STYLERESOLUTION +{ + DWORD dwVariation; /* variation bits */ + WORD wMusicValue; /* Position in scale. */ + BYTE bInversionID; /* Identifies inversion group to which this note belongs */ + BYTE bPlayModeFlags; /* Can override part */ +} DMUS_IO_STYLERESOLUTION; + +typedef struct _DMUS_IO_STYLE_ANTICIPATION +{ + MUSIC_TIME mtGridStart; /* when this anticipation occurs */ + DWORD dwVariation; /* variation bits */ + short nTimeOffset; /* offset from mtGridStart */ + BYTE bTimeRange; /* Range to randomize start time. */ +} DMUS_IO_STYLE_ANTICIPATION; + +typedef struct _DMUS_IO_MOTIFSETTINGS +{ + DWORD dwRepeats; /* Number of repeats. By default, 0. */ + MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */ + MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */ + MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than mtLoopStart. Or, 0, indicating loop full motif. */ + DWORD dwResolution; /* Default resolution. */ +} DMUS_IO_MOTIFSETTINGS; + +#pragma pack() + + +/* +RIFF +( + 'DMST' // Style + // Style header chunk + // Every Style has a GUID + [] // Name, author, copyright info., comments + [] // version chunk + ... // Array of parts in the Style, used by patterns + ... // Array of patterns in the Style + ... // Array of bands in the Style + []...// Optional array of chord map references in the Style +) + + // + styh + ( + + ) + + // + guid + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'part' + // Part header chunk + [] // Name, author, copyright info., comments + [] // Optional chunk containing an array of notes in Part + [] // Optional chunk containing an array of curves in Part + [] // Optional chunk containing an array of markers in Part + [] // Optional chunk containing an array of variation resolutions in Part + [] // Optional chunk containing an array of resolution anticipations in Part + ) + + // + prth + ( + + ) + + // + 'note' + ( + // sizeof DMUS_IO_STYLENOTE:DWORD + ... + ) + + // + 'crve' + ( + // sizeof DMUS_IO_STYLECURVE:DWORD + ... + ) + + // + 'mrkr' + ( + // sizeof DMUS_IO_STYLEMARKER:DWORD + ... + ) + + // + 'rsln' + ( + // sizeof DMUS_IO_STYLERESOLUTION:DWORD + ... + ) + + // + 'anpn' + ( + // sizeof DMUS_IO_STYLE_ANTICIPATION:DWORD + ... + ) + + // + LIST + ( + 'pttn' + // Pattern header chunk + // Chunk containing an array of rhythms for chord matching + [] // Name, author, copyright info., comments + [] // Motif settings chunk + [] // Optional band to be associated with the pattern (for motifs) + ... // Array of part reference id's + ) + + // + ptnh + ( + + ) + + // + 'rhtm' + ( + // DWORD's representing rhythms for chord matching based on number + // of measures in the pattern + ) + + + // pref-list + LIST + ( + 'pref' + // part ref chunk + ) + + // + prfc + ( + + ) + + // + mtfs + ( + + ) + + // + LIST + ( + 'prrf' + ... // Array of Chordmap references + ) +*/ + +/* Pattern chunk, for use in Pattern tracks */ + +#define DMUS_FOURCC_PATTERN_FORM mmioFOURCC('D','M','P','T') + +/* +RIFF +( + 'DMPT' // Pattern + // Style header chunk + // The pattern, in single pattern format (includes DMUS_FOURCC_PART_LIST chunks) +) +*/ + + +/* Chord and command file formats */ + +/* These specify possible values for DMUS_IO_COMMAND.bRepeatMode (DirectX8) */ +typedef enum enumDMUS_PATTERNT_TYPES +{ + DMUS_PATTERNT_RANDOM = 0, /* Play randomly. (DirectX7 behavior) */ + DMUS_PATTERNT_REPEAT = 1, /* Repeat last pattern. */ + DMUS_PATTERNT_SEQUENTIAL = 2, /* Play sequential starting with first matching pattern. */ + DMUS_PATTERNT_RANDOM_START = 3, /* Play sequential starting with a random pattern. */ + DMUS_PATTERNT_NO_REPEAT = 4, /* Play randomly, but don't play the same pattern twice. */ + DMUS_PATTERNT_RANDOM_ROW = 5 /* Play randomly as a row: don't repeat any pattern until all have played. */ +} DMUS_PATTERNT_TYPES; + + +#define DMUS_FOURCC_CHORDTRACK_LIST mmioFOURCC('c','o','r','d') +#define DMUS_FOURCC_CHORDTRACKHEADER_CHUNK mmioFOURCC('c','r','d','h') +#define DMUS_FOURCC_CHORDTRACKBODY_CHUNK mmioFOURCC('c','r','d','b') + +#define DMUS_FOURCC_COMMANDTRACK_CHUNK mmioFOURCC('c','m','n','d') + +typedef struct _DMUS_IO_CHORD +{ + WCHAR wszName[16]; /* Name of the chord */ + MUSIC_TIME mtTime; /* Time of this chord */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bFlags; /* Various flags */ +} DMUS_IO_CHORD; + +typedef struct _DMUS_IO_SUBCHORD +{ + DWORD dwChordPattern; /* Notes in the subchord */ + DWORD dwScalePattern; /* Notes in the scale */ + DWORD dwInversionPoints; /* Where inversions can occur */ + DWORD dwLevels; /* Which levels are supported by this subchord */ + BYTE bChordRoot; /* Root of the subchord */ + BYTE bScaleRoot; /* Root of the scale */ +} DMUS_IO_SUBCHORD; + +typedef struct _DMUS_IO_COMMAND +{ + MUSIC_TIME mtTime; /* Time of this command */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bCommand; /* Command type (see #defines below) */ + BYTE bGrooveLevel; /* Groove level (0 if command is not a groove) */ + BYTE bGrooveRange; /* Groove range */ + BYTE bRepeatMode; /* Used to control selection of patterns with same groove level */ +} DMUS_IO_COMMAND; + + +/* + + // + LIST + ( + 'cord' + + ... // Chord body chunks + ) + + // + crdh + ( + // Scale: dword (upper 8 bits for root, lower 24 for scale) + ) + + // + crdb + ( + // sizeof DMUS_IO_CHORD:dword + + // # of DMUS_IO_SUBCHORDS:dword + // sizeof DMUS_IO_SUBCHORDS:dword + // a number of + ) + + + // + 'cmnd' + ( + //sizeof DMUS_IO_COMMAND: DWORD + ... + ) + +*/ + +/* File io for DirectMusic Tool and ToolGraph objects +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_TOOLGRAPH_FORM mmioFOURCC('D','M','T','G') +#define DMUS_FOURCC_TOOL_LIST mmioFOURCC('t','o','l','l') +#define DMUS_FOURCC_TOOL_FORM mmioFOURCC('D','M','T','L') +#define DMUS_FOURCC_TOOL_CHUNK mmioFOURCC('t','o','l','h') + +/* io structures: */ + +typedef struct _DMUS_IO_TOOL_HEADER +{ + GUID guidClassID; /* Class id of tool. */ + long lIndex; /* Position in graph. */ + DWORD cPChannels; /* Number of items in channels array. */ + FOURCC ckid; /* chunk ID of tool's data chunk if 0 fccType valid. */ + FOURCC fccType; /* list type if NULL ckid valid. */ + DWORD dwPChannels[1]; /* Array of PChannels, size determined by cPChannels. */ +} DMUS_IO_TOOL_HEADER; + +/* +RIFF +( + 'DMTG' // DirectMusic ToolGraph chunk + [] // GUID for ToolGraph + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Tools +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'toll' // Array of tools + ... // Each tool is encapsulated in a RIFF chunk + ) + +// Tools are embedded in a graph. Theoretically, they can be saved as individual files too. +RIFF +( + 'DMTL' + + [] // Tool data. Must be a RIFF readable chunk. +) + + // // Tool header chunk + ( + 'tolh' + // Tool header + ) +*/ + +/* The AudioPath file carries everything for describing a specific audio path, + including Tool Graph and Buffer Descriptor. + This can even be used for configuring a complete performance. +*/ + +#define DMUS_FOURCC_AUDIOPATH_FORM mmioFOURCC('D','M','A','P') + +/* +RIFF +( + 'DMAP' // DirectMusic AudioPath chunk + [] // GUID for this Audio Path configuration + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional ToolGraph + [] // Optional list of port configurations + []...// Optional array of DirectSound buffer descriptors +) +*/ + +#define DMUS_FOURCC_PORTCONFIGS_LIST mmioFOURCC('p','c','s','l') +#define DMUS_FOURCC_PORTCONFIG_LIST mmioFOURCC('p','c','f','l') +#define DMUS_FOURCC_PORTCONFIG_ITEM mmioFOURCC('p','c','f','h') +#define DMUS_FOURCC_PORTPARAMS_ITEM mmioFOURCC('p','p','r','h') +#define DMUS_FOURCC_DSBUFFER_LIST mmioFOURCC('d','b','f','l') +#define DMUS_FOURCC_DSBUFFATTR_ITEM mmioFOURCC('d','d','a','h') +#define DMUS_FOURCC_PCHANNELS_LIST mmioFOURCC('p','c','h','l') +#define DMUS_FOURCC_PCHANNELS_ITEM mmioFOURCC('p','c','h','h') + +typedef struct _DMUS_IO_PORTCONFIG_HEADER +{ + GUID guidPort; /* GUID of requested port. */ + DWORD dwPChannelBase; /* PChannel that this should start on. */ + DWORD dwPChannelCount; /* How many channels. */ + DWORD dwFlags; /* Various flags. */ +} DMUS_IO_PORTCONFIG_HEADER; + +#define DMUS_PORTCONFIGF_DRUMSON10 1 /* This port configured for drums on channel 10. */ +#define DMUS_PORTCONFIGF_USEDEFAULT 2 /* Use the default port. */ + +/* Each portconfig has one or more pchannel to buffer mappings. Each buffer + is identified by a guid. Each pchannel can map to one or more buffers. + This is defined with one or more DMUS_IO_PCHANNELTOBUFFER_HEADER + structures. Each defines a range of PChannels and the set of buffers + that they connect to. +*/ + +typedef struct _DMUS_IO_PCHANNELTOBUFFER_HEADER +{ + DWORD dwPChannelBase; /* PChannel that this should start on. */ + DWORD dwPChannelCount; /* How many PChannels. */ + DWORD dwBufferCount; /* How many buffers do these connect to. */ + DWORD dwFlags; /* Various flags. Currently reserved for future use. Must be 0. */ +} DMUS_IO_PCHANNELTOBUFFER_HEADER; + +/* Each buffer is represented by an DSBC form. This is wrapped by the + DMUS_IO_BUFFER_ATTRIBUTES_HEADER which identifies how to use the + buffer. In particular, it indicates whether this gets dynamically duplicated + or all references to this should share the same instance. + To resolve references, the unique GUID of the buffer is also stored + in this structure. +*/ + +typedef struct _DMUS_IO_BUFFER_ATTRIBUTES_HEADER +{ + GUID guidBufferID; /* Each buffer config has a unique ID. */ + DWORD dwFlags; /* Various flags. */ +} DMUS_IO_BUFFER_ATTRIBUTES_HEADER; + +/* DMUS_IO_BUFFER_ATTRIBUTES_HEADER.dwFlags: */ +#define DMUS_BUFFERF_SHARED 1 /* Share this with other audio paths, instead of creating unique copies. */ +#define DMUS_BUFFERF_DEFINED 2 /* Use one of the standard predefined buffers (see GUID_Buffer... in dmusici.h.) */ +#define DMUS_BUFFERF_MIXIN 8 /* This is a mixin buffer. */ + +/* + +LIST +( + 'pcsl' // Array of port configurations + ... // One or more port configurations, each in a list chunk +) + +LIST +( + 'pcfl' // List container for one port configuration. + // Portconfig header chunk. + // Port params, to be used to create the port. + []...// Optional array of DirectSound buffer descriptors + [] // Optional list of pchannel to buffer assignments + +) + + // // Port config header chunk + ( + 'pcfh' + // Port config header + ) + + // // Port params header chunk + ( + 'pprh' + // Port params header + ) + +LIST +( + 'pchl' // List container for one or more pchannel to buffer assignments. + ... // One or more pchannel to buffer assignment headers and data. + + // + ( + 'pchh' + // Description of PChannels + ... // Array of GUIDs defining the buffers they all connect to. + ) +) + +LIST +( + 'dbfl' // List container for one buffer and buffer attributes header. + // Buffer attributes header. + [] // Buffer configuration. Not required when header uses a predefined buffer type. + + // + ( + 'ddah' + // Buffer attributes. + ) +) +*/ + +/* File io for DirectMusic Band Track object */ + + +/* RIFF ids: */ +#define DMUS_FOURCC_BANDTRACK_FORM mmioFOURCC('D','M','B','T') +#define DMUS_FOURCC_BANDTRACK_CHUNK mmioFOURCC('b','d','t','h') +#define DMUS_FOURCC_BANDS_LIST mmioFOURCC('l','b','d','l') +#define DMUS_FOURCC_BAND_LIST mmioFOURCC('l','b','n','d') +#define DMUS_FOURCC_BANDITEM_CHUNK mmioFOURCC('b','d','i','h') +#define DMUS_FOURCC_BANDITEM_CHUNK2 mmioFOURCC('b','d','2','h') + +/* io structures */ +typedef struct _DMUS_IO_BAND_TRACK_HEADER +{ + BOOL bAutoDownload; /* Determines if Auto-Download is enabled. */ +} DMUS_IO_BAND_TRACK_HEADER; + +typedef struct _DMUS_IO_BAND_ITEM_HEADER +{ + MUSIC_TIME lBandTime; /* Position in track list. */ +} DMUS_IO_BAND_ITEM_HEADER; + +typedef struct _DMUS_IO_BAND_ITEM_HEADER2 +{ + MUSIC_TIME lBandTimeLogical; /* Position in track list. Time in the music with which band change is associated. */ + MUSIC_TIME lBandTimePhysical; /* Precise time band change will take effect. Should be close to logical time. */ +} DMUS_IO_BAND_ITEM_HEADER2; + +/* +RIFF +( + 'DMBT' // DirectMusic Band Track form-type + [] // Band track header + [] // GUID for band track + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Band items +) + + // + 'bdth' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbdl' + ... // Array of bands, each encapsulated in a list chunk + ) + + // + LIST + ( + 'lbnd' + or // bdih is a legacy format. bd2h is preferred for new content. + // Band + ) + + // or // band item header + ( + or // Band item header + ) +*/ + + +/* File io for DirectMusic Band object +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_BAND_FORM mmioFOURCC('D','M','B','D') +#define DMUS_FOURCC_INSTRUMENTS_LIST mmioFOURCC('l','b','i','l') +#define DMUS_FOURCC_INSTRUMENT_LIST mmioFOURCC('l','b','i','n') +#define DMUS_FOURCC_INSTRUMENT_CHUNK mmioFOURCC('b','i','n','s') + +/* Flags for DMUS_IO_INSTRUMENT + */ +#define DMUS_IO_INST_PATCH (1 << 0) /* dwPatch is valid. */ +#define DMUS_IO_INST_BANKSELECT (1 << 1) /* dwPatch contains a valid Bank Select MSB and LSB part */ +#define DMUS_IO_INST_ASSIGN_PATCH (1 << 3) /* dwAssignPatch is valid */ +#define DMUS_IO_INST_NOTERANGES (1 << 4) /* dwNoteRanges is valid */ +#define DMUS_IO_INST_PAN (1 << 5) /* bPan is valid */ +#define DMUS_IO_INST_VOLUME (1 << 6 ) /* bVolume is valid */ +#define DMUS_IO_INST_TRANSPOSE (1 << 7) /* nTranspose is valid */ +#define DMUS_IO_INST_GM (1 << 8) /* Instrument is from GM collection */ +#define DMUS_IO_INST_GS (1 << 9) /* Instrument is from GS collection */ +#define DMUS_IO_INST_XG (1 << 10) /* Instrument is from XG collection */ +#define DMUS_IO_INST_CHANNEL_PRIORITY (1 << 11) /* dwChannelPriority is valid */ +#define DMUS_IO_INST_USE_DEFAULT_GM_SET (1 << 12) /* Always use the default GM set for this patch, */ + /* don't rely on the synth caps stating GM or GS in hardware. */ +#define DMUS_IO_INST_PITCHBENDRANGE (1 << 13) /* nPitchBendRange is valid */ + +/* io structures */ +typedef struct _DMUS_IO_INSTRUMENT +{ + DWORD dwPatch; /* MSB, LSB and Program change to define instrument */ + DWORD dwAssignPatch; /* MSB, LSB and Program change to assign to instrument when downloading */ + DWORD dwNoteRanges[4]; /* 128 bits; one for each MIDI note instrument needs to able to play */ + DWORD dwPChannel; /* PChannel instrument plays on */ + DWORD dwFlags; /* DMUS_IO_INST_ flags */ + BYTE bPan; /* Pan for instrument */ + BYTE bVolume; /* Volume for instrument */ + short nTranspose; /* Number of semitones to transpose notes */ + DWORD dwChannelPriority; /* Channel priority */ + short nPitchBendRange; /* Number of semitones shifted by pitch bend */ +} DMUS_IO_INSTRUMENT; + +/* +// bands can be embedded in other forms +RIFF +( + 'DMBD' // DirectMusic Band chunk + [] // GUID for band + [] // Optional version info + [] // Name, author, copyright info., comments + // List of Instruments +) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'lbil' // Array of instruments + ... // Each instrument is encapsulated in a list + ) + + // + LIST + ( + 'lbin' + + [] // Optional reference to DLS Collection file. + ) + + // // Instrument chunk + ( + 'bins' + // Instrument header + ) +*/ + +/* This RIFF id and io struct have been added to allow wave files (and the wave object) to + differentiate between streaming and one-shot waves, and to give a prefetch for streaming + waves */ + +#define DMUS_FOURCC_WAVEHEADER_CHUNK mmioFOURCC('w','a','v','h') + +typedef struct _DMUS_IO_WAVE_HEADER +{ + REFERENCE_TIME rtReadAhead; /* How far ahead in the stream wave data will be read (in REFERENCE_TIME). Ignored for one-shot waves. */ + DWORD dwFlags; /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */ +} DMUS_IO_WAVE_HEADER; + + +/* File io for Wave track */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_WAVETRACK_LIST mmioFOURCC('w','a','v','t') +#define DMUS_FOURCC_WAVETRACK_CHUNK mmioFOURCC('w','a','t','h') +#define DMUS_FOURCC_WAVEPART_LIST mmioFOURCC('w','a','v','p') +#define DMUS_FOURCC_WAVEPART_CHUNK mmioFOURCC('w','a','p','h') +#define DMUS_FOURCC_WAVEITEM_LIST mmioFOURCC('w','a','v','i') +#define DMUS_FOURCC_WAVE_LIST mmioFOURCC('w','a','v','e') +#define DMUS_FOURCC_WAVEITEM_CHUNK mmioFOURCC('w','a','i','h') + +/* This flag is included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, the track will get its + variations from a pattern track, via GetParam(GUID_Variations). */ +#define DMUS_WAVETRACKF_SYNC_VAR 0x1 +/* This is also included in DMUS_IO_WAVE_TRACK_HEADER.dwFlags. If set, variation control + information will persist from one playback instance to the next.*/ +#define DMUS_WAVETRACKF_PERSIST_CONTROL 0x2 + +typedef struct _DMUS_IO_WAVE_TRACK_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB, to be applied to all waves. Note: All gain values should be negative. */ + DWORD dwFlags; /* Flags, including whether this track syncs to a pattern track for its variations. */ +} DMUS_IO_WAVE_TRACK_HEADER; + +typedef struct _DMUS_IO_WAVE_PART_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB, to be applied to all waves in wave part. Note: All gain values should be negative. */ + DWORD dwVariations; /* Variation mask for which of 32 variations */ + DWORD dwPChannel; /* PChannel */ + DWORD dwLockToPart; /* Part ID to lock to. */ + DWORD dwFlags; /* Flags, including stuff for managing how variations are chosen (in low-order nibble) */ + DWORD dwIndex; /* Index for distinguishing multiple parts on the same PChannel*/ +} DMUS_IO_WAVE_PART_HEADER; + +typedef struct _DMUS_IO_WAVE_ITEM_HEADER +{ + long lVolume; /* Gain, in 1/100th of dB. Note: All gain values should be negative. */ + long lPitch; /* Pitch offset in 1/100th of a semitone. */ + DWORD dwVariations; /* Variation flags for which of 32 variations this wave belongs to. */ + REFERENCE_TIME rtTime; /* Start time, in REFERENCE_TIME, if clock time track, or MUSIC_TIME for music time track. */ + REFERENCE_TIME rtStartOffset; /* Distance into wave to start playback, in reference time units. */ + REFERENCE_TIME rtReserved; /* Reserved field. */ + REFERENCE_TIME rtDuration; /* Duration, in REFERENCE_TIME or MUSIC_TIME, depending on track timing format. */ + MUSIC_TIME mtLogicalTime; /* If in music track format, this indicates the musical boundary where this belongs. Otherwise, ignored. */ + DWORD dwLoopStart; /* Start point for a looping wave. */ + DWORD dwLoopEnd; /* End point for a looping wave. */ + DWORD dwFlags; /* Various flags, including whether this is a streaming wave and whether it can be invalidated. */ + WORD wVolumeRange; /* Random range for volume. */ + WORD wPitchRange; /* Random range for pitch. */ +} DMUS_IO_WAVE_ITEM_HEADER; + +/* +LIST +{ + 'wavt' // Wave track chunk + // Wave track header + ... // Array of Wave Parts +} + // + 'wath' + { + + } + + // + LIST + { + 'wavp' + // Wave Part Header + // List of wave items + } + + // + 'waph' + { + + } + + // + LIST + { + 'wavi' + ... // Array of waves; each wave is encapsulated in a list + } + + // + LIST + { + 'wave' + // Wave item header + // Reference to wave object + } + + // + 'waih' + { + + } + +*/ + +/* File io for DirectMusic Container file. This embeds a set of related files. And, + in turn, it can be embedded within a segment or script file. +*/ + +#define DMUS_FOURCC_CONTAINER_FORM mmioFOURCC('D','M','C','N') +#define DMUS_FOURCC_CONTAINER_CHUNK mmioFOURCC('c','o','n','h') +#define DMUS_FOURCC_CONTAINED_ALIAS_CHUNK mmioFOURCC('c','o','b','a') +#define DMUS_FOURCC_CONTAINED_OBJECT_CHUNK mmioFOURCC('c','o','b','h') +#define DMUS_FOURCC_CONTAINED_OBJECTS_LIST mmioFOURCC('c','o','s','l') +#define DMUS_FOURCC_CONTAINED_OBJECT_LIST mmioFOURCC('c','o','b','l') + +typedef struct _DMUS_IO_CONTAINER_HEADER +{ + DWORD dwFlags; /* Flags. */ +} DMUS_IO_CONTAINER_HEADER; + +#define DMUS_CONTAINER_NOLOADS (1 << 1) /* Contained items are not loaded when the container is loaded. + Entries will be created in the loader (via SetObject) but + the actual objects will not be created until they are + specifically loaded at a later time. */ + +typedef struct _DMUS_IO_CONTAINED_OBJECT_HEADER +{ + GUID guidClassID; /* Class id of object. */ + DWORD dwFlags; /* Flags, for example DMUS_CONTAINED_OBJF_KEEP. */ + FOURCC ckid; /* chunk ID of track's data chunk if 0 fccType valid. */ + FOURCC fccType; /* list type if NULL ckid valid */ + /* Note that LIST:DMRF may be used for ckid and fccType in order to reference an + object instead of embedding it within the container. */ +} DMUS_IO_CONTAINED_OBJECT_HEADER; + +#define DMUS_CONTAINED_OBJF_KEEP 1 /* Keep the object cached in the loader after the container is released. */ + +/* +RIFF +( + 'DMCN' // DirectMusic Container chunk + // Container header chunk + [] // GUID for container + [] // Optional version info + [] // Name, author, copyright info., comments + // List of objects. +) + + // + 'conh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + LIST + ( + 'cosl' // Array of embedded objects. + ... // Each object is encapsulated in a LIST chunk + ) + + // // Encapsulates one object + LIST + ( + 'cobl' + [] // Alias. An alternative name by which this object is known + // within the container. + // Required header, includes CLASS ID for object. + [] or // Object data of the type specified in . + // If DMRF, it is a reference of where to find the object. + // Otherwise, it could be any RIFF readable chunk in the + // exact same format as a file. The object will load + // itself from this data. + ) + + // + 'coba' + ( + // Alias, stored as NULL terminated string of WCHARs + ) + + // + 'cobh' + ( + + ) +*/ + +/* File io for DirectMusic Segment object */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_SEGMENT_FORM mmioFOURCC('D','M','S','G') +#define DMUS_FOURCC_SEGMENT_CHUNK mmioFOURCC('s','e','g','h') +#define DMUS_FOURCC_TRACK_LIST mmioFOURCC('t','r','k','l') +#define DMUS_FOURCC_TRACK_FORM mmioFOURCC('D','M','T','K') +#define DMUS_FOURCC_TRACK_CHUNK mmioFOURCC('t','r','k','h') +#define DMUS_FOURCC_TRACK_EXTRAS_CHUNK mmioFOURCC('t','r','k','x') + +/* io structures:*/ + +typedef struct _DMUS_IO_SEGMENT_HEADER +{ + DWORD dwRepeats; /* Number of repeats. By default, 0. */ + MUSIC_TIME mtLength; /* Length, in music time. */ + MUSIC_TIME mtPlayStart; /* Start of playback. By default, 0. */ + MUSIC_TIME mtLoopStart; /* Start of looping portion. By default, 0. */ + MUSIC_TIME mtLoopEnd; /* End of loop. Must be greater than dwPlayStart. Or, 0, indicating loop full segment. */ + DWORD dwResolution; /* Default resolution. */ + /* Following added for DirectX8: */ + REFERENCE_TIME rtLength; /* Length, in reference time (overrides music time length.) */ + DWORD dwFlags; + DWORD dwReserved; /* Reserved. */ + /* Added for DirectX9: */ + REFERENCE_TIME rtLoopStart; /* Clock time loop start. */ + REFERENCE_TIME rtLoopEnd; /* Clock time loop end. */ + REFERENCE_TIME rtPlayStart; /* Start of playback in clock time. */ +} DMUS_IO_SEGMENT_HEADER; + +#define DMUS_SEGIOF_REFLENGTH 1 /* Use the time in rtLength for the segment length. */ +#define DMUS_SEGIOF_CLOCKTIME 2 /* This is a clock time segment. */ + +typedef struct _DMUS_IO_TRACK_HEADER +{ + GUID guidClassID; /* Class id of track. */ + DWORD dwPosition; /* Position in track list. */ + DWORD dwGroup; /* Group bits for track. */ + FOURCC ckid; /* chunk ID of track's data chunk. */ + FOURCC fccType; /* list type if ckid is RIFF or LIST */ +} DMUS_IO_TRACK_HEADER; + +/* Additional parameters for the track header chunk, introduced in DirectX8 and + on, are stored in a separate chunk. */ + +typedef struct _DMUS_IO_TRACK_EXTRAS_HEADER +{ + DWORD dwFlags; /* DirectX8 Added flags for control tracks. */ + DWORD dwPriority; /* Priority for composition. */ +} DMUS_IO_TRACK_EXTRAS_HEADER; + +/* +RIFF +( + 'DMSG' // DirectMusic Segment chunk + // Segment header chunk + [] // GUID for segment + [] // Optional version info + [] // Name, author, copyright info., comments + [] // Optional container of objects embedded in file. Must precede tracklist. + // List of Tracks + [] // Optional ToolGraph + [] // Optional Audio Path +) + + // + 'segh' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + LIST + ( + 'trkl' // Array of tracks + ... // Each track is encapsulated in a RIFF chunk + ) + + // // Tracks can be embedded in a segment or stored as separate files. + RIFF + ( + 'DMTK' + + [] // Optional track flags. + [] // Optional GUID for track object instance (not to be confused with Class id in track header) + [] // Optional version info + [] // Optional name, author, copyright info., comments + [] // Track data. Must be a RIFF readable chunk. + ) + + // // Track header chunk + ( + 'trkh' + // Track header + ) + + // // Track flags chunk + ( + 'trkx' + // DirectX8 Track flags header + ) +*/ + +/* File io for DirectMusic reference chunk. + This is used to embed a reference to an object. +*/ + +/* RIFF ids: */ + +#define DMUS_FOURCC_REF_LIST mmioFOURCC('D','M','R','F') +#define DMUS_FOURCC_REF_CHUNK mmioFOURCC('r','e','f','h') +#define DMUS_FOURCC_DATE_CHUNK mmioFOURCC('d','a','t','e') +#define DMUS_FOURCC_NAME_CHUNK mmioFOURCC('n','a','m','e') +#define DMUS_FOURCC_FILE_CHUNK mmioFOURCC('f','i','l','e') + +typedef struct _DMUS_IO_REFERENCE +{ + GUID guidClassID; /* Class id is always required. */ + DWORD dwValidData; /* Flags. */ +} DMUS_IO_REFERENCE; + +/* +LIST +( + 'DMRF' // DirectMusic Reference chunk + // Reference header chunk + [] // Optional object GUID. + [] // Optional file date. + [] // Optional name. + [] // Optional file name. + [] // Optional category name. + [] // Optional version info. +) + + // + 'refh' + ( + + ) + + // + 'guid' + ( + + ) + + // + date + ( + + ) + + // + name + ( + // Name, stored as NULL terminated string of WCHARs + ) + + // + file + ( + // File name, stored as NULL terminated string of WCHARs + ) + + // + catg + ( + // Category name, stored as NULL terminated string of WCHARs + ) + + // + vers + ( + + ) +*/ + +/* Chord Maps */ + +/* runtime chunks */ +#define DMUS_FOURCC_CHORDMAP_FORM mmioFOURCC('D','M','P','R') +#define DMUS_FOURCC_IOCHORDMAP_CHUNK mmioFOURCC('p','e','r','h') +#define DMUS_FOURCC_SUBCHORD_CHUNK mmioFOURCC('c','h','d','t') +#define DMUS_FOURCC_CHORDENTRY_CHUNK mmioFOURCC('c','h','e','h') +#define DMUS_FOURCC_SUBCHORDID_CHUNK mmioFOURCC('s','b','c','n') +#define DMUS_FOURCC_IONEXTCHORD_CHUNK mmioFOURCC('n','c','r','d') +#define DMUS_FOURCC_NEXTCHORDSEQ_CHUNK mmioFOURCC('n','c','s','q') +#define DMUS_FOURCC_IOSIGNPOST_CHUNK mmioFOURCC('s','p','s','h') +#define DMUS_FOURCC_CHORDNAME_CHUNK mmioFOURCC('I','N','A','M') + +/* runtime list chunks */ +#define DMUS_FOURCC_CHORDENTRY_LIST mmioFOURCC('c','h','o','e') +#define DMUS_FOURCC_CHORDMAP_LIST mmioFOURCC('c','m','a','p') +#define DMUS_FOURCC_CHORD_LIST mmioFOURCC('c','h','r','d') +#define DMUS_FOURCC_CHORDPALETTE_LIST mmioFOURCC('c','h','p','l') +#define DMUS_FOURCC_CADENCE_LIST mmioFOURCC('c','a','d','e') +#define DMUS_FOURCC_SIGNPOSTITEM_LIST mmioFOURCC('s','p','s','t') + +#define DMUS_FOURCC_SIGNPOST_LIST mmioFOURCC('s','p','s','q') + +/* values for dwChord field of DMUS_IO_PERS_SIGNPOST */ +/* DMUS_SIGNPOSTF_ flags are also used in templates (DMUS_IO_SIGNPOST) */ +#define DMUS_SIGNPOSTF_A 1 +#define DMUS_SIGNPOSTF_B 2 +#define DMUS_SIGNPOSTF_C 4 +#define DMUS_SIGNPOSTF_D 8 +#define DMUS_SIGNPOSTF_E 0x10 +#define DMUS_SIGNPOSTF_F 0x20 +#define DMUS_SIGNPOSTF_LETTER (DMUS_SIGNPOSTF_A | DMUS_SIGNPOSTF_B | DMUS_SIGNPOSTF_C | DMUS_SIGNPOSTF_D | DMUS_SIGNPOSTF_E | DMUS_SIGNPOSTF_F) +#define DMUS_SIGNPOSTF_1 0x100 +#define DMUS_SIGNPOSTF_2 0x200 +#define DMUS_SIGNPOSTF_3 0x400 +#define DMUS_SIGNPOSTF_4 0x800 +#define DMUS_SIGNPOSTF_5 0x1000 +#define DMUS_SIGNPOSTF_6 0x2000 +#define DMUS_SIGNPOSTF_7 0x4000 +#define DMUS_SIGNPOSTF_ROOT (DMUS_SIGNPOSTF_1 | DMUS_SIGNPOSTF_2 | DMUS_SIGNPOSTF_3 | DMUS_SIGNPOSTF_4 | DMUS_SIGNPOSTF_5 | DMUS_SIGNPOSTF_6 | DMUS_SIGNPOSTF_7) +#define DMUS_SIGNPOSTF_CADENCE 0x8000 + +/* values for dwFlags field of DMUS_IO_CHORDMAP */ +#define DMUS_CHORDMAPF_VERSION8 1 /* Chordmap is version 8 or above. */ + +/* values for dwChord field of DMUS_IO_PERS_SIGNPOST */ +#define DMUS_SPOSTCADENCEF_1 2 /* Use the first cadence chord. */ +#define DMUS_SPOSTCADENCEF_2 4 /* Use the second cadence chord. */ + +/* run time data structs */ +typedef struct _DMUS_IO_CHORDMAP +{ + WCHAR wszLoadName[20]; + DWORD dwScalePattern; + DWORD dwFlags; /* Various flags. Only lower 16 bits are significant. */ +} DMUS_IO_CHORDMAP; + +typedef struct _DMUS_IO_CHORDMAP_SUBCHORD +{ + DWORD dwChordPattern; + DWORD dwScalePattern; + DWORD dwInvertPattern; + BYTE bChordRoot; + BYTE bScaleRoot; + WORD wCFlags; + DWORD dwLevels; /* parts or which subchord levels this chord supports */ +} DMUS_IO_CHORDMAP_SUBCHORD; + +/* Legacy name... */ +typedef DMUS_IO_CHORDMAP_SUBCHORD DMUS_IO_PERS_SUBCHORD; + +typedef struct _DMUS_IO_CHORDENTRY +{ + DWORD dwFlags; + WORD wConnectionID; /* replaces runtime "pointer to this" */ +} DMUS_IO_CHORDENTRY; + +typedef struct _DMUS_IO_NEXTCHORD +{ + DWORD dwFlags; + WORD nWeight; + WORD wMinBeats; + WORD wMaxBeats; + WORD wConnectionID; /* points to an ioChordEntry */ +} DMUS_IO_NEXTCHORD; + +typedef struct _DMUS_IO_CHORDMAP_SIGNPOST +{ + DWORD dwChords; /* 1bit per group */ + DWORD dwFlags; +} DMUS_IO_CHORDMAP_SIGNPOST; + +/* Legacy name... */ +typedef DMUS_IO_CHORDMAP_SIGNPOST DMUS_IO_PERS_SIGNPOST; + +/* +RIFF +( + 'DMPR' + // Chord map header chunk + [] // guid chunk + [] // version chunk (two DWORDS) + [] // Unfo chunk + // subchord database + // chord palette + // chord map + // signpost list + ) + + ::= LIST('cmap' ) + + ::= LIST('choe' + // chord entry data + // chord definition + // connecting(next) chords + ) + + ::= LIST('chrd' + // name of chord in wide char format + // list of subchords composing chord + ) + + ::= LIST('chpl' + ... // chord definition + ) + + ::== LIST('spsq' ... ) + + ::= LIST('spst' + + + [] + ) + + ::= LIST('cade' ...) + + ::= perh() + + ::= chdt( + ... ) + + ::= cheh() + + ::= sbcn( ...) + + ::= ncsq( + ...) + + ::= spsh() + +*/ + +/* File io for DirectMusic Script object */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_SCRIPT_FORM mmioFOURCC('D','M','S','C') +#define DMUS_FOURCC_SCRIPT_CHUNK mmioFOURCC('s','c','h','d') +#define DMUS_FOURCC_SCRIPTVERSION_CHUNK mmioFOURCC('s','c','v','e') +#define DMUS_FOURCC_SCRIPTLANGUAGE_CHUNK mmioFOURCC('s','c','l','a') +#define DMUS_FOURCC_SCRIPTSOURCE_CHUNK mmioFOURCC('s','c','s','r') + +/* io structures:*/ + +typedef struct _DMUS_IO_SCRIPT_HEADER +{ + DWORD dwFlags; /* DMUS_SCRIPTIOF_ flags */ +} DMUS_IO_SCRIPT_HEADER; + +#define DMUS_SCRIPTIOF_LOAD_ALL_CONTENT (1 << 0) + /* If set, when the script loads it will also load all the content in its container. */ +#define DMUS_SCRIPTIOF_DOWNLOAD_ALL_SEGMENTS (1 << 1) + /* If set and LOAD_ALL_CONTENT is also set, when the script initializes it will also download all the segments in its container. + If set and LOAD_ALL_CONTENT is not set, when the script calls segment.Load on a segment then the segment will also be downloaded. + If not set, the script must manually download and unload by calling segment.DownloadSoundData and segment.UnloadSoundData. */ + +/* +RIFF +( + 'DMSC' // DirectMusic Script chunk + // Script header chunk + [] // GUID for script + [] // Optional version info + [] // Name, author, copyright info., comments + // Version of DirectMusic this script was authored to run against + // Container of content referenced by the script. + // ActiveX scripting language in which the script is written + or // The script's source code. + // If scsr-ck, the source is embedding in the chunk. + // If DMRF, it is a reference of where to find a text file with the source. + // Class id (guidClassID in DMUS_IO_REFERENCE) must be GUID_NULL because + // this text file is not a DirectMusic object in its own right. +) + + // + 'schd' + ( + + ) + + // + 'guid' + ( + + ) + + // + vers + ( + + ) + + // + scve + ( + + ) + + 'scla' + ( + // Language name, stored as NULL terminated string of WCHARs + ) + + 'scsr' + ( + // Source code, stored as NULL terminated string of WCHARs + ) +*/ + +/* Signpost tracks */ + +#define DMUS_FOURCC_SIGNPOST_TRACK_CHUNK mmioFOURCC( 's', 'g', 'n', 'p' ) + + +typedef struct _DMUS_IO_SIGNPOST +{ + MUSIC_TIME mtTime; + DWORD dwChords; + WORD wMeasure; +} DMUS_IO_SIGNPOST; + +/* + + // + 'sgnp' + ( + //sizeof DMUS_IO_SIGNPOST: DWORD + ... + ) + +*/ + +#define DMUS_FOURCC_MUTE_CHUNK mmioFOURCC('m','u','t','e') + +typedef struct _DMUS_IO_MUTE +{ + MUSIC_TIME mtTime; + DWORD dwPChannel; + DWORD dwPChannelMap; +} DMUS_IO_MUTE; + +/* + + // + 'mute' + ( + //sizeof DMUS_IO_MUTE:DWORD + ... + ) + + +*/ + +/* Used for both style and chord map tracks */ + +#define DMUS_FOURCC_TIME_STAMP_CHUNK mmioFOURCC('s', 't', 'm', 'p') + +/* Style tracks */ + +#define DMUS_FOURCC_STYLE_TRACK_LIST mmioFOURCC('s', 't', 't', 'r') +#define DMUS_FOURCC_STYLE_REF_LIST mmioFOURCC('s', 't', 'r', 'f') + +/* + + // + LIST('sttr' + ( + ... // Array of Style references + ) + + // + LIST('strf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*/ + +/* Chord map tracks */ + +#define DMUS_FOURCC_PERS_TRACK_LIST mmioFOURCC('p', 'f', 't', 'r') +#define DMUS_FOURCC_PERS_REF_LIST mmioFOURCC('p', 'f', 'r', 'f') + +/* + + // + LIST('pftr' + ( + ... // Array of Chord map references + ) + + // + LIST('pfrf' + ( + + + ) + + // + 'stmp' + ( + // time:DWORD + ) + +*/ + +#define DMUS_FOURCC_TEMPO_TRACK mmioFOURCC('t','e','t','r') + +/* + // tempo array + 'tetr' + ( + // sizeof DMUS_IO_TEMPO_ITEM: DWORD + ... + ) + */ + +#define DMUS_FOURCC_SEQ_TRACK mmioFOURCC('s','e','q','t') +#define DMUS_FOURCC_SEQ_LIST mmioFOURCC('e','v','t','l') +#define DMUS_FOURCC_CURVE_LIST mmioFOURCC('c','u','r','l') + +/* + // sequence track + 'seqt' + ( + // sequence array + 'evtl' + ( + // sizeof DMUS_IO_SEQ_ITEM: DWORD + ... + ) + // curve array + 'curl' + ( + // sizeof DMUS_IO_CURVE_ITEM: DWORD + ... + ) + ) +*/ + +#define DMUS_FOURCC_SYSEX_TRACK mmioFOURCC('s','y','e','x') + +/* + // sysex track + 'syex' + ( + { + + ... // Array of bytes, length defined in the DMUS_IO_SYSEXITEM structure + }... + ) +*/ + +#define DMUS_FOURCC_TIMESIGNATURE_TRACK mmioFOURCC('t','i','m','s') + +typedef struct _DMUS_IO_TIMESIGNATURE_ITEM +{ + MUSIC_TIME lTime; + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_IO_TIMESIGNATURE_ITEM; + +/* DirectX6 time signature track + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) +*/ + +/* DirectX8 Time signature track. The track has been updated from DirectX7 to support a list of + RIFF chunks. This will allow the time signature track to expand in the future. +*/ + +#define DMUS_FOURCC_TIMESIGTRACK_LIST mmioFOURCC('T','I','M','S') +#define DMUS_FOURCC_TIMESIG_CHUNK DMUS_FOURCC_TIMESIGNATURE_TRACK + +/* +LIST +( + 'TIMS' // Time Signature Track list-type + // Chunk containing an array of time signatures +) + + 'tims' + ( + // size of DMUS_IO_TIMESIGNATURE_ITEM : DWORD + ... + ) + +*/ + +/* DirectX8 Marker track. This is used to store valid start points and other + flow control parameters that may come later. For example, if we want + to implement more sophisticated looping and branching constructs, they + would live in this track. +*/ + +#define DMUS_FOURCC_MARKERTRACK_LIST mmioFOURCC('M','A','R','K') +#define DMUS_FOURCC_VALIDSTART_CHUNK mmioFOURCC('v','a','l','s') +#define DMUS_FOURCC_PLAYMARKER_CHUNK mmioFOURCC('p','l','a','y') + +/* io structures */ +typedef struct _DMUS_IO_VALID_START +{ + MUSIC_TIME mtTime; /* Time of a legal start. */ +} DMUS_IO_VALID_START; + +typedef struct _DMUS_IO_PLAY_MARKER +{ + MUSIC_TIME mtTime; /* Time of a next legal play point marker. */ +} DMUS_IO_PLAY_MARKER; + +/* +LIST +( + 'MARK' // Marker Track list-type + [] // Chunk containing an array of start points + [] // Chunk containing an array of play start markers +) + + 'vals' + ( + // size of DMUS_IO_VALID_START : DWORD + ... + ) + + 'play' + ( + // size of DMUS_IO_PLAY_MARKER : DWORD + ... + ) + +*/ + +/* segment trigger tracks */ + +/* RIFF ids: */ +#define DMUS_FOURCC_SEGTRACK_LIST mmioFOURCC('s','e','g','t') +#define DMUS_FOURCC_SEGTRACK_CHUNK mmioFOURCC('s','g','t','h') +#define DMUS_FOURCC_SEGMENTS_LIST mmioFOURCC('l','s','g','l') +#define DMUS_FOURCC_SEGMENT_LIST mmioFOURCC('l','s','e','g') +#define DMUS_FOURCC_SEGMENTITEM_CHUNK mmioFOURCC('s','g','i','h') +#define DMUS_FOURCC_SEGMENTITEMNAME_CHUNK mmioFOURCC('s','n','a','m') + +/* io structures */ +typedef struct _DMUS_IO_SEGMENT_TRACK_HEADER +{ + DWORD dwFlags; /* Reserved leave as 0. */ +} DMUS_IO_SEGMENT_TRACK_HEADER; + +typedef struct _DMUS_IO_SEGMENT_ITEM_HEADER +{ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ + DWORD dwPlayFlags; /* Flags for PlaySegment(). */ + DWORD dwFlags; /* Flags. */ +} DMUS_IO_SEGMENT_ITEM_HEADER; + +/* values for dwflags field of DMUS_IO_SEGMENT_ITEM_HEADER */ +#define DMUS_SEGMENTTRACKF_MOTIF 1 /* interpret DMRF as link to style, and use snam as the name of a motif within the style */ + +/* +LIST +( + 'segt' // DirectMusic Segment Trigger Track form-type + [] // Segment track header + // List of Segment Lists +) + + // + 'sgth' + ( + + ) + + // + LIST + ( + 'lsgl' // Array of segments + ... // Each segment is encapsulated in a list (that way it can still be riff parsed.) + ) + + // + LIST + ( + 'lseg' + + // Link to a segment or style file. + [] // Name field. Used with DMUS_SEGMENTTRACKF_MOTIF flag. + ) + + // // segment item header + ( + // Segment item header + ) + + // + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Script track. */ + +/* RIFF ids: */ +#define DMUS_FOURCC_SCRIPTTRACK_LIST mmioFOURCC('s','c','r','t') +#define DMUS_FOURCC_SCRIPTTRACKEVENTS_LIST mmioFOURCC('s','c','r','l') +#define DMUS_FOURCC_SCRIPTTRACKEVENT_LIST mmioFOURCC('s','c','r','e') +#define DMUS_FOURCC_SCRIPTTRACKEVENTHEADER_CHUNK mmioFOURCC('s','c','r','h') +#define DMUS_FOURCC_SCRIPTTRACKEVENTNAME_CHUNK mmioFOURCC('s','c','r','n') + +/* Flags for DMUS_IO_SCRIPTTRACK_TIMING + */ +#define DMUS_IO_SCRIPTTRACKF_PREPARE (1 << 0) /* Fire event in advance of time stamp, at Prepare time. This is the default because it leaves the script time to change the music happening at the target time. */ +#define DMUS_IO_SCRIPTTRACKF_QUEUE (1 << 1) /* Fire event just before time stamp, at Queue time. */ +#define DMUS_IO_SCRIPTTRACKF_ATTIME (1 << 2) /* Fire event right at the time stamp. */ + +typedef struct _DMUS_IO_SCRIPTTRACK_EVENTHEADER +{ + DWORD dwFlags; /* various bits (see DMUS_IO_SCRIPTTRACKF_*) */ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ +} DMUS_IO_SCRIPTTRACK_EVENTHEADER; + +/* + // Script Track + + // + LIST + ( + // List of script events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + + // Routine name + ) + + 'scrh' + ( + + ) + + 'scrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Lyrics/Notification track. */ + +/* RIFF ids: */ +#define DMUS_FOURCC_LYRICSTRACK_LIST mmioFOURCC('l','y','r','t') +#define DMUS_FOURCC_LYRICSTRACKEVENTS_LIST mmioFOURCC('l','y','r','l') +#define DMUS_FOURCC_LYRICSTRACKEVENT_LIST mmioFOURCC('l','y','r','e') +#define DMUS_FOURCC_LYRICSTRACKEVENTHEADER_CHUNK mmioFOURCC('l','y','r','h') +#define DMUS_FOURCC_LYRICSTRACKEVENTTEXT_CHUNK mmioFOURCC('l','y','r','n') + +typedef struct _DMUS_IO_LYRICSTRACK_EVENTHEADER +{ + DWORD dwFlags; /* Reserved leave as 0. */ + DWORD dwTimingFlags; /* Combination DMUS_PMSGF_TOOL_* flags. Determines the precise timing of when the notification happens. Invalid with the flag DMUS_PMSGF_REFTIME, DMUS_PMSGF_MUSICTIME, DMUS_PMSGF_TOOL_FLUSH, or DMUS_PMSGF_LOCKTOREFTIME. */ + MUSIC_TIME lTimeLogical; /* Position in track list. Time in the music with which the event is associated. */ + MUSIC_TIME lTimePhysical; /* Precise time event will be triggered. Should be close to logical time. */ +} DMUS_IO_LYRICSTRACK_EVENTHEADER; + +/* + // Lyrics/Notification Track + + // + LIST + ( + // List of notification events + ) + + // + LIST + ( + ... // Array of event descriptions + ) + + // + LIST + ( + // Event header chunk + // Notification text + ) + + 'lyrh' + ( + + ) + + 'lyrn' + ( + // Name, stored as NULL terminated string of WCHARs + ) +*/ + +/* Parameter control track */ + +/* RIFF ids: */ +#define DMUS_FOURCC_PARAMCONTROLTRACK_TRACK_LIST mmioFOURCC('p','r','m','t') +#define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_LIST mmioFOURCC('p','r','o','l') +#define DMUS_FOURCC_PARAMCONTROLTRACK_OBJECT_CHUNK mmioFOURCC('p','r','o','h') +#define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_LIST mmioFOURCC('p','r','p','l') +#define DMUS_FOURCC_PARAMCONTROLTRACK_PARAM_CHUNK mmioFOURCC('p','r','p','h') +#define DMUS_FOURCC_PARAMCONTROLTRACK_CURVES_CHUNK mmioFOURCC('p','r','c','c') + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER +{ + DWORD dwFlags; /* Reserved. Must be zero. */ + GUID guidTimeFormat; /* Time format to set the object to. Must be GUID_TIME_REFERNCE or GUID_TIME_MUSIC from medparam.h. */ + /* Path for finding the object. These fields correspond to the first five parameters of IDirectMusicSegmentState::GetObjectInPath. */ + DWORD dwPChannel; + DWORD dwStage; + DWORD dwBuffer; + GUID guidObject; + DWORD dwIndex; +} DMUS_IO_PARAMCONTROLTRACK_OBJECTHEADER; + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER +{ + DWORD dwFlags; /* Reserved. Must be zero. */ + DWORD dwIndex; /* Index number of the parameter on the object */ +} DMUS_IO_PARAMCONTROLTRACK_PARAMHEADER; + +typedef struct _DMUS_IO_PARAMCONTROLTRACK_CURVEINFO +{ + MUSIC_TIME mtStartTime; + MUSIC_TIME mtEndTime; + float fltStartValue; + float fltEndValue; + DWORD dwCurveType; /* One of the items from the MP_CURVE_TYPE enum in medparam.h */ + DWORD dwFlags; /* A combination of the MPF_ENVLP_* constants in medparam.h */ +} DMUS_IO_PARAMCONTROLTRACK_CURVEINFO; + +/* + // + LIST + ( + ... // one for each object + ) + + // + LIST + ( + // object header chunk + ... // one for each parameter + ) + + // + proh + ( + + ) + + // + LIST + ( + // parameter header chunk + // chunk containing an array of curves + ) + + // + prph + ( + + ) + + // + prcc + ( + // sizeof DMUS_IO_PARAMCONTROLTRACK_CURVEINFO:DWORD + ... // curves, sorted in order of mtTime + ) +*/ + +#if (DIRECTSOUND_VERSION >= 0x0800) + +/* DirectSoundBufferConfig FX Map */ + +/* RIFF ids: */ + +#define DMUS_FOURCC_DSBC_FORM mmioFOURCC('D','S','B','C') +#define DMUS_FOURCC_DSBD_CHUNK mmioFOURCC('d','s','b','d') +#define DMUS_FOURCC_BSID_CHUNK mmioFOURCC('b','s','i','d') +#define DMUS_FOURCC_DS3D_CHUNK mmioFOURCC('d','s','3','d') +#define DMUS_FOURCC_DSBC_LIST mmioFOURCC('f','x','l','s') +#define DMUS_FOURCC_DSFX_FORM mmioFOURCC('D','S','F','X') +#define DMUS_FOURCC_DSFX_CHUNK mmioFOURCC('f','x','h','r') +#define DMUS_FOURCC_DSFX_DATA mmioFOURCC('d','a','t','a') + +/* io structures */ + +typedef struct _DSOUND_IO_DSBUFFERDESC +{ + DWORD dwFlags; /* DirectSound buffer creation flags */ + WORD nChannels; /* No. of channels (rest of buffer format is determined by owning sink) */ + LONG lVolume; /* Initial pan; only used if CTRLVOLUME is specified */ + LONG lPan; /* Initial pan; only used if CTRLPAN is specified */ + DWORD dwReserved; /* Reserved - must be 0 */ +} DSOUND_IO_DSBUFFERDESC; + +typedef struct _DSOUND_IO_DSBUSID +{ + DWORD busid[1]; /* Array size determined from chunk size */ +} DSOUND_IO_DSBUSID; + +typedef struct _DSOUND_IO_3D +{ + GUID guid3DAlgorithm; /* GUID identifying the 3D algorithm to use (defined in dsound.h) */ + DS3DBUFFER ds3d; /* Initial 3D parameters */ +} DSOUND_IO_3D; + +typedef struct _DSOUND_IO_DXDMO_HEADER +{ + DWORD dwEffectFlags; /* Effect creation flags - equivalent to DSEFFECTDESC::dwFlags */ + GUID guidDSFXClass; /* GUID identifying the effect to use - corresponds to a COM CLSID */ + GUID guidReserved; /* Reserved - must be the null GUID */ + GUID guidSendBuffer; /* GUID identifying the buffer to send to if this is a send effect */ + DWORD dwReserved; /* Reserved - must be 0 */ +} DSOUND_IO_DXDMO_HEADER; + +typedef struct _DSOUND_IO_DXDMO_DATA +{ + DWORD data[1]; /* Array size determined by the DMO involved */ +} DSOUND_IO_DXDMO_DATA; + +/* +RIFF +( + 'DSBC' // DirectSoundBufferConfig chunk + [] // GUID identifier for this DirectSoundBufferConfig + [] // Optional version info + [] // Name, author, copyright info., comments + // DirectSound Buffer descriptor chunk + [] // Optional bus id array + [] // Optional 3d Parameters + [] // Optional list of FX descriptors +) + + // + 'guid' + ( + + ) + + // + 'vers' + ( + + ) + + // + 'dsbd' + ( + // Creation parameters and initial settings for the buffer + ) + + // + 'bsid' + ( + // The size of DSOUND_IO_DSBUSID is determined by the chunk size + ) + + // + 'ds3d' + ( + // Initial 3D buffer parameters: position, etc. + ) + + // + LIST + ( + 'fxls' // Array of DMO creation parameter blocks + ... // Each DMO is encapsulated in a RIFF chunk + ) + +// // DMOs can be embedded in a buffer configuration or stored as separate files +RIFF +( + 'DSFX' + // FX header chunk + [] // FX initial settings chunk +) + + // + 'fxhr' + ( + + ) + + // + 'data' + ( + // Opaque data block used by the DMO to load itself. + // For our standard included DMOs, this is simply the structure accepted by + // the DMO's SetAllParameters() method - e.g. struct DSFXChorus for Chorus. + ) +*/ + +#endif + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICF_ */ diff --git a/SDK/dxSDK/Include/dmusici.h b/SDK/dxSDK/Include/dmusici.h new file mode 100644 index 00000000..65bf7f6e --- /dev/null +++ b/SDK/dxSDK/Include/dmusici.h @@ -0,0 +1,1883 @@ +/************************************************************************ +* * +* dmusici.h -- This module contains the API for the * +* DirectMusic performance layer * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICI_ +#define _DMUSICI_ + +#include + +#define COM_NO_WINDOWS_H +#include + +#include +#include +/* plugin (track and tool) interfaces. This #include will eventually go away. */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef WORD TRANSITION_TYPE; +typedef __int64 REFERENCE_TIME; +typedef long MUSIC_TIME; + +#define MT_MIN 0x80000000 /* Minimum music time value. */ +#define MT_MAX 0x7FFFFFFF /* Maximum music time value. */ + +#define DMUS_PPQ 768 /* parts per quarter note */ + +interface IDirectMusicTrack; +interface IDirectMusicPerformance; +interface IDirectMusicPerformance8; +interface IDirectMusicTool; +interface IDirectMusicSegment; +interface IDirectMusicSegment8; +interface IDirectMusicSegmentState; +interface IDirectMusicSegmentState8; +interface IDirectMusicGraph; +interface IDirectMusicBuffer; +interface IDirectMusicInstrument; +interface IDirectMusicDownloadedInstrument; +interface IDirectMusicBand; +interface IDirectMusicChordMap; +interface IDirectMusicLoader; +interface IDirectMusicLoader8; +interface IDirectMusicScript; +interface IDirectMusicObject; +interface IDirectMusicStyle8; +interface IDirectMusicPatternTrack; +interface IDirectMusicContainer; +interface IDirectMusicTool8; +interface IDirectMusicTrack8; +interface IDirectMusicAudioPath; +#ifndef __cplusplus +typedef interface IDirectMusicTrack IDirectMusicTrack; +typedef interface IDirectMusicPerformance IDirectMusicPerformance; +typedef interface IDirectMusicPerformance8 IDirectMusicPerformance8; +typedef interface IDirectMusicTool IDirectMusicTool; +typedef interface IDirectMusicSegment IDirectMusicSegment; +typedef interface IDirectMusicSegment8 IDirectMusicSegment8; +typedef interface IDirectMusicSegmentState IDirectMusicSegmentState; +typedef interface IDirectMusicSegmentState8 IDirectMusicSegmentState8; +typedef interface IDirectMusicGraph IDirectMusicGraph; +typedef interface IDirectMusicBuffer IDirectMusicBuffer; +typedef interface IDirectMusicInstrument IDirectMusicInstrument; +typedef interface IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument; +typedef interface IDirectMusicBand IDirectMusicBand; +typedef interface IDirectMusicChordMap IDirectMusicChordMap; +typedef interface IDirectMusicObject IDirectMusicObject; +typedef interface IDirectMusicLoader IDirectMusicLoader; +typedef interface IDirectMusicLoader8 IDirectMusicLoader8; +typedef interface IDirectMusicScript IDirectMusicScript; +typedef interface IDirectMusicStyle8 IDirectMusicStyle8; +typedef interface IDirectMusicPatternTrack IDirectMusicPatternTrack; +typedef interface IDirectMusicContainer IDirectMusicContainer; +typedef interface IDirectMusicTool8 IDirectMusicTool8; +typedef interface IDirectMusicTrack8 IDirectMusicTrack8; +typedef interface IDirectMusicAudioPath IDirectMusicAudioPath; +#endif + +typedef enum enumDMUS_STYLET_TYPES +{ + DMUS_STYLET_PATTERN = 0, + DMUS_STYLET_MOTIF = 1, +} DMUS_STYLET_TYPES; + + +typedef enum enumDMUS_COMMANDT_TYPES +{ + DMUS_COMMANDT_GROOVE = 0, + DMUS_COMMANDT_FILL = 1, + DMUS_COMMANDT_INTRO = 2, + DMUS_COMMANDT_BREAK = 3, + DMUS_COMMANDT_END = 4, + DMUS_COMMANDT_ENDANDINTRO = 5 +} DMUS_COMMANDT_TYPES; + +typedef enum enumDMUS_SHAPET_TYPES +{ + DMUS_SHAPET_FALLING = 0, + DMUS_SHAPET_LEVEL = 1, + DMUS_SHAPET_LOOPABLE = 2, + DMUS_SHAPET_LOUD = 3, + DMUS_SHAPET_QUIET = 4, + DMUS_SHAPET_PEAKING = 5, + DMUS_SHAPET_RANDOM = 6, + DMUS_SHAPET_RISING = 7, + DMUS_SHAPET_SONG = 8 +} DMUS_SHAPET_TYPES; + +typedef enum enumDMUS_COMPOSEF_FLAGS +{ + DMUS_COMPOSEF_NONE = 0, + DMUS_COMPOSEF_ALIGN = 0x1, + DMUS_COMPOSEF_OVERLAP = 0x2, + DMUS_COMPOSEF_IMMEDIATE = 0x4, + DMUS_COMPOSEF_GRID = 0x8, + DMUS_COMPOSEF_BEAT = 0x10, + DMUS_COMPOSEF_MEASURE = 0x20, + DMUS_COMPOSEF_AFTERPREPARETIME = 0x40, + DMUS_COMPOSEF_VALID_START_BEAT = 0x80, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any beat. */ + DMUS_COMPOSEF_VALID_START_GRID = 0x100, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any grid. */ + DMUS_COMPOSEF_VALID_START_TICK = 0x200, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur any time. */ + DMUS_COMPOSEF_SEGMENTEND = 0x400, /* Play the transition at the end of the current segment. */ + DMUS_COMPOSEF_MARKER = 0x800, /* Play the transition at the next marker in the current segment. */ + DMUS_COMPOSEF_MODULATE = 0x1000, + DMUS_COMPOSEF_LONG = 0x2000, + DMUS_COMPOSEF_ENTIRE_TRANSITION = 0x4000, /* play the entire transition pattern */ + DMUS_COMPOSEF_1BAR_TRANSITION = 0x8000, /* play one bar of the transition pattern */ + DMUS_COMPOSEF_ENTIRE_ADDITION = 0x10000, /* play the additional pattern in its entirety */ + DMUS_COMPOSEF_1BAR_ADDITION = 0x20000, /* play one bar of the additional pattern */ + DMUS_COMPOSEF_VALID_START_MEASURE = 0x40000, /* In conjunction with DMUS_COMPOSEF_ALIGN, allows the switch to occur on any bar. */ + DMUS_COMPOSEF_DEFAULT = 0x80000, /* Use segment's default boundary */ + DMUS_COMPOSEF_NOINVALIDATE = 0x100000, /* Play without invalidating the currently playing segment(s) */ + DMUS_COMPOSEF_USE_AUDIOPATH = 0x200000, /* Uses the audio paths that are embedded in the segments */ + DMUS_COMPOSEF_INVALIDATE_PRI = 0x400000 /* Invalidate only the current primary seg state */ +} DMUS_COMPOSEF_FLAGS; + +#define DMUS_PMSG_PART \ + DWORD dwSize; \ + REFERENCE_TIME rtTime; /* real time (in 100 nanosecond increments) */ \ + MUSIC_TIME mtTime; /* music time */ \ + DWORD dwFlags; /* various bits (see DMUS_PMSGF_FLAGS enumeration) */ \ + DWORD dwPChannel; /* Performance Channel. The Performance can */ \ + /* use this to determine the port/channel. */ \ + DWORD dwVirtualTrackID; /* virtual track ID */ \ + IDirectMusicTool* pTool; /* tool interface pointer */ \ + IDirectMusicGraph* pGraph; /* tool graph interface pointer */ \ + DWORD dwType; /* PMSG type (see DMUS_PMSGT_TYPES defines) */ \ + DWORD dwVoiceID; /* unique voice id which allows synthesizers to */ \ + /* identify a specific event. For DirectX 6.0, */ \ + /* this field should always be 0. */ \ + DWORD dwGroupID; /* Track group id */ \ + IUnknown* punkUser; /* user com pointer, auto released upon PMSG free */ + +/* every DMUS_PMSG is based off of this structure. The Performance needs + to access these members consistently in every PMSG that goes through it. */ +typedef struct _DMUS_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + +} DMUS_PMSG; + +#define DMUS_PCHANNEL_BROADCAST_PERFORMANCE 0xFFFFFFFF /* PMsg is sent on all PChannels of the performance. */ +#define DMUS_PCHANNEL_BROADCAST_AUDIOPATH 0xFFFFFFFE /* PMsg is sent on all PChannels of the audio path. */ +#define DMUS_PCHANNEL_BROADCAST_SEGMENT 0xFFFFFFFD /* PMsg is sent on all PChannels of the segment. */ +#define DMUS_PCHANNEL_BROADCAST_GROUPS 0xFFFFFFFC /* A duplicate PMsg is for each Channels Groups in the performance. */ + +/* The DMUS_PATH constants are used in conjunction with GetObjectInPath to find a requested + interface at a particular stage in the audio path. +*/ +#define DMUS_PATH_SEGMENT 0x1000 /* Get the segment itself (from a segment state.) */ +#define DMUS_PATH_SEGMENT_TRACK 0x1100 /* Look in Track List of Segment. */ +#define DMUS_PATH_SEGMENT_GRAPH 0x1200 /* Get the segment's tool graph. */ +#define DMUS_PATH_SEGMENT_TOOL 0x1300 /* Look in Tool Graph of Segment. */ +#define DMUS_PATH_AUDIOPATH 0x2000 /* Get the audiopath itself (from a segment state.) */ +#define DMUS_PATH_AUDIOPATH_GRAPH 0x2200 /* Get the audiopath's tool graph. */ +#define DMUS_PATH_AUDIOPATH_TOOL 0x2300 /* Look in Tool Graph of Audio Path. */ +#define DMUS_PATH_PERFORMANCE 0x3000 /* Access the performance. */ +#define DMUS_PATH_PERFORMANCE_GRAPH 0x3200 /* Get the performance's tool graph. */ +#define DMUS_PATH_PERFORMANCE_TOOL 0x3300 /* Look in Tool Graph of Performance. */ +#define DMUS_PATH_PORT 0x4000 /* Access the synth. */ +#define DMUS_PATH_BUFFER 0x6000 /* Look in DirectSoundBuffer. */ +#define DMUS_PATH_BUFFER_DMO 0x6100 /* Access a DMO in the buffer. */ +#define DMUS_PATH_MIXIN_BUFFER 0x7000 /* Look in a global mixin buffer. */ +#define DMUS_PATH_MIXIN_BUFFER_DMO 0x7100 /* Access a DMO in a global mixin buffer. */ +#define DMUS_PATH_PRIMARY_BUFFER 0x8000 /* Access the primary buffer. */ + +/* To ignore PChannels when calling GetObjectInPath(), use the DMUS_PCHANNEL_ALL constant. */ +#define DMUS_PCHANNEL_ALL 0xFFFFFFFB + +/* The DMUS_APATH types are used in conjunction with CreateStandardAudioPath to + build default path types. _SHARED_ means the same buffer is shared across multiple + instantiations of the audiopath type. _DYNAMIC_ means a unique buffer is created + every time. +*/ + +#define DMUS_APATH_SHARED_STEREOPLUSREVERB 1 /* A standard music set up with stereo outs and reverb. */ +#define DMUS_APATH_DYNAMIC_3D 6 /* An audio path with one dynamic bus from the synth feeding to a dynamic 3d buffer. Does not send to env reverb. */ +#define DMUS_APATH_DYNAMIC_MONO 7 /* An audio path with one dynamic bus from the synth feeding to a dynamic mono buffer. */ +#define DMUS_APATH_DYNAMIC_STEREO 8 /* An audio path with two dynamic buses from the synth feeding to a dynamic stereo buffer. */ + +typedef struct _DMUS_AUDIOPARAMS +{ + DWORD dwSize; /* Size of this structure. */ + BOOL fInitNow; /* If true, the sink and synth are created immediately and results returned in this structure. */ + DWORD dwValidData; /* Flags indicating which fields below are valid. */ + DWORD dwFeatures; /* Required DMUS_AUDIOF features. */ + DWORD dwVoices; /* Required number of voices. */ + DWORD dwSampleRate; /* Sample rate of synths and sink. */ + CLSID clsidDefaultSynth; /* Class ID of default synthesizer. */ +} DMUS_AUDIOPARAMS; + +/* dwFeatures flags. These indicate which features are required for the audio environment. */ +#define DMUS_AUDIOF_3D 0x1 /* Require 3D buffers. */ +#define DMUS_AUDIOF_ENVIRON 0x2 /* Require environmental modeling. */ +#define DMUS_AUDIOF_EAX 0x4 /* Require use of EAX effects. */ +#define DMUS_AUDIOF_DMOS 0x8 /* Require use of additional DMOs. */ +#define DMUS_AUDIOF_STREAMING 0x10 /* Require support for streaming waves. */ +#define DMUS_AUDIOF_BUFFERS 0x20 /* Require support for multiple buffers (all above cases need this.) */ +#define DMUS_AUDIOF_ALL 0x3F /* Requires everything. */ + +/* dwValidData flags. These indicate which fields in DMUS_AUDIOPARAMS have been filled in. If fInitNow is set, these also return what was allocated. */ +#define DMUS_AUDIOPARAMS_FEATURES 0x00000001 +#define DMUS_AUDIOPARAMS_VOICES 0x00000002 +#define DMUS_AUDIOPARAMS_SAMPLERATE 0x00000004 +#define DMUS_AUDIOPARAMS_DEFAULTSYNTH 0x00000008 + +/* DMUS_PMSGF_FLAGS fill the DMUS_PMSG's dwFlags member */ +typedef enum enumDMUS_PMSGF_FLAGS +{ + DMUS_PMSGF_REFTIME = 1, /* if rtTime is valid */ + DMUS_PMSGF_MUSICTIME = 2, /* if mtTime is valid */ + DMUS_PMSGF_TOOL_IMMEDIATE = 4, /* if PMSG should be processed immediately */ + DMUS_PMSGF_TOOL_QUEUE = 8, /* if PMSG should be processed a little early, at Queue time */ + DMUS_PMSGF_TOOL_ATTIME = 0x10, /* if PMSG should be processed at the time stamp */ + DMUS_PMSGF_TOOL_FLUSH = 0x20, /* if PMSG is being flushed */ + DMUS_PMSGF_LOCKTOREFTIME = 0x40, /* if rtTime can not be overriden by a tempo change. */ + DMUS_PMSGF_DX8 = 0x80 /* if the message has DX8 or later extensions. */ + /* The values of DMUS_TIME_RESOLVE_FLAGS may also be used inside the */ + /* DMUS_PMSG's dwFlags member. */ +} DMUS_PMSGF_FLAGS; + +/* DMUS_PMSGT_TYPES fill the DMUS_PMSG's dwType member */ +typedef enum enumDMUS_PMSGT_TYPES +{ + DMUS_PMSGT_MIDI = 0, /* MIDI short message */ + DMUS_PMSGT_NOTE = 1, /* Interactive Music Note */ + DMUS_PMSGT_SYSEX = 2, /* MIDI long message (system exclusive message) */ + DMUS_PMSGT_NOTIFICATION = 3, /* Notification message */ + DMUS_PMSGT_TEMPO = 4, /* Tempo message */ + DMUS_PMSGT_CURVE = 5, /* Control change / pitch bend, etc. curve */ + DMUS_PMSGT_TIMESIG = 6, /* Time signature */ + DMUS_PMSGT_PATCH = 7, /* Patch changes */ + DMUS_PMSGT_TRANSPOSE = 8, /* Transposition messages */ + DMUS_PMSGT_CHANNEL_PRIORITY = 9, /* Channel priority */ + DMUS_PMSGT_STOP = 10, /* Stop message */ + DMUS_PMSGT_DIRTY = 11, /* Tells Tools that cache GetParam() info to refresh */ + DMUS_PMSGT_WAVE = 12, /* Carries control information for playing a wave. */ + DMUS_PMSGT_LYRIC = 13, /* Lyric message from lyric track. */ + DMUS_PMSGT_SCRIPTLYRIC = 14, /* Lyric message sent by a script with the Trace function. */ + DMUS_PMSGT_USER = 255 /* User message */ +} DMUS_PMSGT_TYPES; + +/* DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment, and other API */ +typedef enum enumDMUS_SEGF_FLAGS +{ + DMUS_SEGF_REFTIME = 1<<6, /* 0x40 Time parameter is in reference time */ + DMUS_SEGF_SECONDARY = 1<<7, /* 0x80 Secondary segment */ + DMUS_SEGF_QUEUE = 1<<8, /* 0x100 Queue at the end of the primary segment queue (primary only) */ + DMUS_SEGF_CONTROL = 1<<9, /* 0x200 Play as a control track (secondary segments only) */ + DMUS_SEGF_AFTERPREPARETIME = 1<<10, /* 0x400 Play after the prepare time (See IDirectMusicPerformance::GetPrepareTime) */ + DMUS_SEGF_GRID = 1<<11, /* 0x800 Play on grid boundary */ + DMUS_SEGF_BEAT = 1<<12, /* 0x1000 Play on beat boundary */ + DMUS_SEGF_MEASURE = 1<<13, /* 0x2000 Play on measure boundary */ + DMUS_SEGF_DEFAULT = 1<<14, /* 0x4000 Use segment's default boundary */ + DMUS_SEGF_NOINVALIDATE = 1<<15, /* 0x8000 Play without invalidating the currently playing segment(s) */ + DMUS_SEGF_ALIGN = 1<<16, /* 0x10000 Align segment with requested boundary, but switch at first valid point */ + DMUS_SEGF_VALID_START_BEAT = 1<<17, /* 0x20000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any beat. */ + DMUS_SEGF_VALID_START_GRID = 1<<18, /* 0x40000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any grid. */ + DMUS_SEGF_VALID_START_TICK = 1<<19, /* 0x80000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur any time. */ + DMUS_SEGF_AUTOTRANSITION = 1<<20, /* 0x100000 Compose and play a transition segment, using the transition template. */ + DMUS_SEGF_AFTERQUEUETIME = 1<<21, /* 0x200000 Make sure to play after the queue time. This is default for primary segments */ + DMUS_SEGF_AFTERLATENCYTIME = 1<<22, /* 0x400000 Make sure to play after the latency time. This is true for all segments, so this is a nop */ + DMUS_SEGF_SEGMENTEND = 1<<23, /* 0x800000 Play at the next end of segment. */ + DMUS_SEGF_MARKER = 1<<24, /* 0x1000000 Play at next marker in the primary segment. If there are no markers, default to any other resolution requests. */ + DMUS_SEGF_TIMESIG_ALWAYS = 1<<25, /* 0x2000000 Even if there is no primary segment, align start time with current time signature. */ + DMUS_SEGF_USE_AUDIOPATH = 1<<26, /* 0x4000000 Uses the audio path that is embedded in the segment. */ + DMUS_SEGF_VALID_START_MEASURE = 1<<27, /* 0x8000000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any bar. */ + DMUS_SEGF_INVALIDATE_PRI = 1<<28 /* 0x10000000 invalidate only the current primary seg state */ +} DMUS_SEGF_FLAGS; + +#define DMUS_SEG_REPEAT_INFINITE 0xFFFFFFFF /* For IDirectMusicSegment::SetRepeat*/ +#define DMUS_SEG_ALLTRACKS 0x80000000 /* For IDirectMusicSegment::SetParam() and SetTrackConfig() - selects all tracks instead on nth index. */ +#define DMUS_SEG_ANYTRACK 0x80000000 /* For IDirectMusicSegment::GetParam() - checks each track until it finds one that returns data (not DMUS_E_NOT_FOUND.) */ + + +/* DMUS_TIME_RESOLVE_FLAGS correspond to IDirectMusicPerformance::GetResolvedTime, and can */ +/* also be used interchangeably with the corresponding DMUS_SEGF_FLAGS, since their values */ +/* are intentionally the same */ +typedef enum enumDMUS_TIME_RESOLVE_FLAGS +{ + DMUS_TIME_RESOLVE_AFTERPREPARETIME = DMUS_SEGF_AFTERPREPARETIME, + DMUS_TIME_RESOLVE_AFTERQUEUETIME = DMUS_SEGF_AFTERQUEUETIME, + DMUS_TIME_RESOLVE_AFTERLATENCYTIME = DMUS_SEGF_AFTERLATENCYTIME, + DMUS_TIME_RESOLVE_GRID = DMUS_SEGF_GRID, + DMUS_TIME_RESOLVE_BEAT = DMUS_SEGF_BEAT, + DMUS_TIME_RESOLVE_MEASURE = DMUS_SEGF_MEASURE, + DMUS_TIME_RESOLVE_MARKER = DMUS_SEGF_MARKER, + DMUS_TIME_RESOLVE_SEGMENTEND = DMUS_SEGF_SEGMENTEND, +} DMUS_TIME_RESOLVE_FLAGS; + +/* The following flags are sent inside the DMUS_CHORD_KEY.dwFlags parameter */ +typedef enum enumDMUS_CHORDKEYF_FLAGS +{ + DMUS_CHORDKEYF_SILENT = 1, /* is the chord silent? */ +} DMUS_CHORDKEYF_FLAGS; + +#define DMUS_MAXSUBCHORD 8 + +typedef struct _DMUS_SUBCHORD +{ + DWORD dwChordPattern; /* Notes in the subchord */ + DWORD dwScalePattern; /* Notes in the scale */ + DWORD dwInversionPoints; /* Where inversions can occur */ + DWORD dwLevels; /* Which levels are supported by this subchord */ + BYTE bChordRoot; /* Root of the subchord */ + BYTE bScaleRoot; /* Root of the scale */ +} DMUS_SUBCHORD; + +typedef struct _DMUS_CHORD_KEY +{ + WCHAR wszName[16]; /* Name of the chord */ + WORD wMeasure; /* Measure this falls on */ + BYTE bBeat; /* Beat this falls on */ + BYTE bSubChordCount; /* Number of chords in the list of subchords */ + DMUS_SUBCHORD SubChordList[DMUS_MAXSUBCHORD]; /* List of sub chords */ + DWORD dwScale; /* Scale underlying the entire chord */ + BYTE bKey; /* Key underlying the entire chord */ + BYTE bFlags; /* Miscelaneous flags */ +} DMUS_CHORD_KEY; + +/* DMUS_NOTE_PMSG */ +typedef struct _DMUS_NOTE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + MUSIC_TIME mtDuration; /* duration */ + WORD wMusicValue; /* Description of note in chord and key. */ + WORD wMeasure; /* Measure in which this note occurs */ + short nOffset; /* Offset from grid at which this note occurs */ + BYTE bBeat; /* Beat (in measure) at which this note occurs */ + BYTE bGrid; /* Grid offset from beat at which this note occurs */ + BYTE bVelocity; /* Note velocity */ + BYTE bFlags; /* see DMUS_NOTEF_FLAGS */ + BYTE bTimeRange; /* Range to randomize time. */ + BYTE bDurRange; /* Range to randomize duration. */ + BYTE bVelRange; /* Range to randomize velocity. */ + BYTE bPlayModeFlags; /* Play mode */ + BYTE bSubChordLevel; /* Which subchord level this note uses. */ + BYTE bMidiValue; /* The MIDI note value, converted from wMusicValue */ + char cTranspose; /* Transposition to add to midi note value after converted from wMusicValue. */ +} DMUS_NOTE_PMSG; + +typedef enum enumDMUS_NOTEF_FLAGS +{ + DMUS_NOTEF_NOTEON = 1, /* Set if this is a MIDI Note On. Otherwise, it is MIDI Note Off */ + /* DX8 flags: */ + DMUS_NOTEF_NOINVALIDATE = 2, /* Don't invalidate this note off. */ + DMUS_NOTEF_NOINVALIDATE_INSCALE = 4,/* Don't invalidate if still within the scale. */ + DMUS_NOTEF_NOINVALIDATE_INCHORD = 8,/* Don't invalidate if still within the chord. */ + DMUS_NOTEF_REGENERATE = 0x10, /* Regenerate the note on an invalidate. */ +} DMUS_NOTEF_FLAGS; + +/* The DMUS_PLAYMODE_FLAGS are used to determine how to convert wMusicValue + into the appropriate bMidiValue. +*/ + +typedef enum enumDMUS_PLAYMODE_FLAGS +{ + DMUS_PLAYMODE_KEY_ROOT = 1, /* Transpose on top of the key root. */ + DMUS_PLAYMODE_CHORD_ROOT = 2, /* Transpose on top of the chord root. */ + DMUS_PLAYMODE_SCALE_INTERVALS = 4, /* Use scale intervals from scale pattern. */ + DMUS_PLAYMODE_CHORD_INTERVALS = 8, /* Use chord intervals from chord pattern. */ + DMUS_PLAYMODE_NONE = 16, /* No mode. Indicates the parent part's mode should be used. */ +} DMUS_PLAYMODE_FLAGS; + +/* The following are playback modes that can be created by combining the DMUS_PLAYMODE_FLAGS + in various ways: +*/ + +/* Fixed. wMusicValue holds final MIDI note value. This is used for drums, sound effects, and sequenced + notes that should not be transposed by the chord or scale. +*/ +#define DMUS_PLAYMODE_FIXED 0 +/* In fixed to key, the musicvalue is again a fixed MIDI value, but it + is transposed on top of the key root. +*/ +#define DMUS_PLAYMODE_FIXEDTOKEY DMUS_PLAYMODE_KEY_ROOT +/* In fixed to chord, the musicvalue is also a fixed MIDI value, but it + is transposed on top of the chord root. +*/ +#define DMUS_PLAYMODE_FIXEDTOCHORD DMUS_PLAYMODE_CHORD_ROOT +/* In Pedalpoint, the key root is used and the notes only track the intervals in + the scale. The chord root and intervals are completely ignored. This is useful + for melodic lines that play relative to the key root. +*/ +#define DMUS_PLAYMODE_PEDALPOINT (DMUS_PLAYMODE_KEY_ROOT | DMUS_PLAYMODE_SCALE_INTERVALS) +/* In the Melodic mode, the chord root is used but the notes only track the intervals in + the scale. The key root and chord intervals are completely ignored. This is useful + for melodic lines that play relative to the chord root. +*/ +#define DMUS_PLAYMODE_MELODIC (DMUS_PLAYMODE_CHORD_ROOT | DMUS_PLAYMODE_SCALE_INTERVALS) +/* Normal chord mode is the prevalent playback mode. + The notes track the intervals in the chord, which is based on the chord root. + If there is a scale component to the MusicValue, the additional intervals + are pulled from the scale and added. + If the chord does not have an interval to match the chord component of + the MusicValue, the note is silent. +*/ +#define DMUS_PLAYMODE_NORMALCHORD (DMUS_PLAYMODE_CHORD_ROOT | DMUS_PLAYMODE_CHORD_INTERVALS) +/* If it is desirable to play a note that is above the top of the chord, the + always play mode (known as "purpleized" in a former life) finds a position + for the note by using intervals from the scale. Essentially, this mode is + a combination of the Normal and Melodic playback modes, where a failure + in Normal causes a second try in Melodic mode. +*/ +#define DMUS_PLAYMODE_ALWAYSPLAY (DMUS_PLAYMODE_MELODIC | DMUS_PLAYMODE_NORMALCHORD) + +/* These playmodes are new for dx8. */ +/* In PedalpointChord, the key root is used and the notes only track the intervals in + the chord. The chord root and scale intervals are completely ignored. This is useful + for chordal lines that play relative to the key root. +*/ +#define DMUS_PLAYMODE_PEDALPOINTCHORD (DMUS_PLAYMODE_KEY_ROOT | DMUS_PLAYMODE_CHORD_INTERVALS) + +/* For completeness, here's a mode that tries for pedalpointchord, but if it fails + uses scale intervals +*/ +#define DMUS_PLAYMODE_PEDALPOINTALWAYS (DMUS_PLAYMODE_PEDALPOINT | DMUS_PLAYMODE_PEDALPOINTCHORD) + + +/* Legacy names for modes... */ +#define DMUS_PLAYMODE_PURPLEIZED DMUS_PLAYMODE_ALWAYSPLAY +#define DMUS_PLAYMODE_SCALE_ROOT DMUS_PLAYMODE_KEY_ROOT +#define DMUS_PLAYMODE_FIXEDTOSCALE DMUS_PLAYMODE_FIXEDTOKEY + + +/* DMUS_MIDI_PMSG */ +typedef struct _DMUS_MIDI_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + BYTE bStatus; + BYTE bByte1; + BYTE bByte2; + BYTE bPad[1]; +} DMUS_MIDI_PMSG; + +/* DMUS_PATCH_PMSG */ +typedef struct _DMUS_PATCH_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + BYTE byInstrument; + BYTE byMSB; + BYTE byLSB; + BYTE byPad[1]; +} DMUS_PATCH_PMSG; + +/* DMUS_TRANSPOSE_PMSG */ +typedef struct _DMUS_TRANSPOSE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + short nTranspose; + /* Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.)*/ +} DMUS_TRANSPOSE_PMSG; + +/* DMUS_CHANNEL_PRIORITY_PMSG */ +typedef struct _DMUS_CHANNEL_PRIORITY_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + DWORD dwChannelPriority; +} DMUS_CHANNEL_PRIORITY_PMSG; + +/* DMUS_TEMPO_PMSG */ +typedef struct _DMUS_TEMPO_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + double dblTempo; /* the tempo */ +} DMUS_TEMPO_PMSG; + +#define DMUS_TEMPO_MAX 1000 +#define DMUS_TEMPO_MIN 1 + +#define DMUS_MASTERTEMPO_MAX 100.0f +#define DMUS_MASTERTEMPO_MIN 0.01f + +/* DMUS_SYSEX_PMSG */ +typedef struct _DMUS_SYSEX_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + DWORD dwLen; /* length of the data */ + BYTE abData[1]; /* array of data, length equal to dwLen */ +} DMUS_SYSEX_PMSG; + +/* DMUS_CURVE_PMSG */ +typedef struct _DMUS_CURVE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + MUSIC_TIME mtDuration; /* how long this curve lasts */ + MUSIC_TIME mtOriginalStart; /* must be set to either zero when this PMSG is created or to the original mtTime of the curve */ + MUSIC_TIME mtResetDuration; /* how long after the curve is finished to allow a flush or + invalidation to reset to the reset value, nResetValue */ + short nStartValue; /* curve's start value */ + short nEndValue; /* curve's end value */ + short nResetValue; /* curve's reset value, set when a flush or invalidation + occurs within mtDuration + mtResetDuration */ + WORD wMeasure; /* Measure in which this curve occurs */ + short nOffset; /* Offset from grid at which this curve occurs */ + BYTE bBeat; /* Beat (in measure) at which this curve occurs */ + BYTE bGrid; /* Grid offset from beat at which this curve occurs */ + BYTE bType; /* type of curve */ + BYTE bCurveShape; /* shape of curve */ + BYTE bCCData; /* CC# if this is a control change type */ + BYTE bFlags; /* Curve reset and start from current value flags. */ + /* Following exists only under DX8 and on (check dwFlags for DMUS_PMSGF_DX8) */ + WORD wParamType; /* RPN or NRPN parameter number. */ + WORD wMergeIndex; /* Allows multiple parameters to be merged (pitchbend, volume, and expression.)*/ +} DMUS_CURVE_PMSG; + +typedef enum enumDMUS_CURVE_FLAGS +{ + DMUS_CURVE_RESET = 1, /* When set, the nResetValue must be sent when the + time is reached or an invalidate occurs because + of a transition. If not set, the curve stays + permanently stuck at the new value. */ + DMUS_CURVE_START_FROM_CURRENT = 2/* Ignore Start, start the curve at the current value. + This only works for volume, expression, and pitchbend. */ +} DMUS_CURVE_FLAGS; + + +#define DMUS_CURVE_RESET 1 + +/* Curve shapes */ +enum +{ + DMUS_CURVES_LINEAR = 0, + DMUS_CURVES_INSTANT = 1, + DMUS_CURVES_EXP = 2, + DMUS_CURVES_LOG = 3, + DMUS_CURVES_SINE = 4 +}; +/* curve types */ +#define DMUS_CURVET_PBCURVE 0x03 /* Pitch bend curve. */ +#define DMUS_CURVET_CCCURVE 0x04 /* Control change curve. */ +#define DMUS_CURVET_MATCURVE 0x05 /* Mono aftertouch curve. */ +#define DMUS_CURVET_PATCURVE 0x06 /* Poly aftertouch curve. */ +#define DMUS_CURVET_RPNCURVE 0x07 /* RPN curve with curve type in wParamType. */ +#define DMUS_CURVET_NRPNCURVE 0x08 /* NRPN curve with curve type in wParamType. */ + +/* DMUS_TIMESIG_PMSG */ +typedef struct _DMUS_TIMESIG_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + /* Time signatures define how many beats per measure, which note receives */ + /* the beat, and the grid resolution. */ + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_TIMESIG_PMSG; + + + +/* notification type values */ +/* The following correspond to GUID_NOTIFICATION_SEGMENT */ +#define DMUS_NOTIFICATION_SEGSTART 0 +#define DMUS_NOTIFICATION_SEGEND 1 +#define DMUS_NOTIFICATION_SEGALMOSTEND 2 +#define DMUS_NOTIFICATION_SEGLOOP 3 +#define DMUS_NOTIFICATION_SEGABORT 4 +/* The following correspond to GUID_NOTIFICATION_PERFORMANCE */ +#define DMUS_NOTIFICATION_MUSICSTARTED 0 +#define DMUS_NOTIFICATION_MUSICSTOPPED 1 +#define DMUS_NOTIFICATION_MUSICALMOSTEND 2 +/* The following corresponds to GUID_NOTIFICATION_MEASUREANDBEAT */ +#define DMUS_NOTIFICATION_MEASUREBEAT 0 +/* The following corresponds to GUID_NOTIFICATION_CHORD */ +#define DMUS_NOTIFICATION_CHORD 0 +/* The following correspond to GUID_NOTIFICATION_COMMAND */ +#define DMUS_NOTIFICATION_GROOVE 0 +#define DMUS_NOTIFICATION_EMBELLISHMENT 1 +/* The following corresponds to GUID_NOTIFICATION_RECOMPOSE */ +#define DMUS_NOTIFICATION_RECOMPOSE 0 + +/* DMUS_NOTIFICATION_PMSG */ +typedef struct _DMUS_NOTIFICATION_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + GUID guidNotificationType; + DWORD dwNotificationOption; + DWORD dwField1; + DWORD dwField2; +} DMUS_NOTIFICATION_PMSG; + +/* DMUS_WAVE_PMSG */ +typedef struct _DMUS_WAVE_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + REFERENCE_TIME rtStartOffset; /* How far into the wave to start, in reference time units only. */ + REFERENCE_TIME rtDuration; /* Duration of the wave, in either reference time or music time. */ + long lOffset; /* Offset from actual time to logical time, in music or ref time. */ + long lVolume; /* Initial volume, in 100ths of a dB. */ + long lPitch; /* Initial pitch, in 100ths of a semitone. */ + BYTE bFlags; /* Flags, including DMUS_WAVEF_OFF... */ +} DMUS_WAVE_PMSG; + +#define DMUS_WAVEF_OFF 1 /* If wave is playing and this is the off message. */ +#define DMUS_WAVEF_STREAMING 2 /* If wave is streaming. */ +#define DMUS_WAVEF_NOINVALIDATE 4 /* Don't invalidate this wave. */ +#define DMUS_WAVEF_NOPREROLL 8 /* Don't preroll any wave data. */ +#define DMUS_WAVEF_IGNORELOOPS 0x20 /* Ignore segment looping. */ + +/* DMUS_LYRIC_PMSG */ +typedef struct _DMUS_LYRIC_PMSG +{ + /* begin DMUS_PMSG_PART */ + DMUS_PMSG_PART + /* end DMUS_PMSG_PART */ + + WCHAR wszString[1]; /* null-terminated Unicode lyric string (structure is actually larger than size 1) */ +} DMUS_LYRIC_PMSG; + +#define DMUS_MAX_NAME 64 /* Maximum object name length. */ +#define DMUS_MAX_CATEGORY 64 /* Maximum object category name length. */ +#define DMUS_MAX_FILENAME MAX_PATH + +typedef struct _DMUS_VERSION { + DWORD dwVersionMS; + DWORD dwVersionLS; +}DMUS_VERSION, FAR *LPDMUS_VERSION; + +/* Time Signature structure, used by IDirectMusicStyle */ +/* Also used as a parameter for GetParam() and SetParam */ +typedef struct _DMUS_TIMESIGNATURE +{ + MUSIC_TIME mtTime; + BYTE bBeatsPerMeasure; /* beats per measure (top of time sig) */ + BYTE bBeat; /* what note receives the beat (bottom of time sig.) */ + /* we can assume that 0 means 256th note */ + WORD wGridsPerBeat; /* grids per beat */ +} DMUS_TIMESIGNATURE; + +typedef struct _DMUS_VALID_START_PARAM +{ + MUSIC_TIME mtTime; /* Time of the first legal start + point after (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. */ +} DMUS_VALID_START_PARAM; + +typedef struct _DMUS_PLAY_MARKER_PARAM +{ + MUSIC_TIME mtTime; /* Time of the first legal segment play + marker before (or including) the requested time. + This is a returned value. + Time format is the relative offset from requested time. */ +} DMUS_PLAY_MARKER_PARAM; + +/* The DMUSOBJECTDESC structure is used to communicate everything you could */ +/* possibly use to describe a DirectMusic object. */ + +typedef struct _DMUS_OBJECTDESC +{ + DWORD dwSize; /* Size of this structure. */ + DWORD dwValidData; /* Flags indicating which fields below are valid. */ + GUID guidObject; /* Unique ID for this object. */ + GUID guidClass; /* GUID for the class of object. */ + FILETIME ftDate; /* Last edited date of object. */ + DMUS_VERSION vVersion; /* Version. */ + WCHAR wszName[DMUS_MAX_NAME]; /* Name of object. */ + WCHAR wszCategory[DMUS_MAX_CATEGORY]; /* Category for object (optional). */ + WCHAR wszFileName[DMUS_MAX_FILENAME]; /* File path. */ + LONGLONG llMemLength; /* Size of Memory data. */ + LPBYTE pbMemData; /* Memory pointer for data. */ + IStream * pStream; /* Stream with data. */ +} DMUS_OBJECTDESC; + +typedef DMUS_OBJECTDESC *LPDMUS_OBJECTDESC; + +/* Flags for dwValidData. When set, a flag indicates that the */ +/* corresponding field in DMUSOBJECTDESC holds valid data. */ + +#define DMUS_OBJ_OBJECT (1 << 0) /* Object GUID is valid. */ +#define DMUS_OBJ_CLASS (1 << 1) /* Class GUID is valid. */ +#define DMUS_OBJ_NAME (1 << 2) /* Name is valid. */ +#define DMUS_OBJ_CATEGORY (1 << 3) /* Category is valid. */ +#define DMUS_OBJ_FILENAME (1 << 4) /* File path is valid. */ +#define DMUS_OBJ_FULLPATH (1 << 5) /* Path is full path. */ +#define DMUS_OBJ_URL (1 << 6) /* Path is URL. */ +#define DMUS_OBJ_VERSION (1 << 7) /* Version is valid. */ +#define DMUS_OBJ_DATE (1 << 8) /* Date is valid. */ +#define DMUS_OBJ_LOADED (1 << 9) /* Object is currently loaded in memory. */ +#define DMUS_OBJ_MEMORY (1 << 10) /* Object is pointed to by pbMemData. */ +#define DMUS_OBJ_STREAM (1 << 11) /* Object is stored in pStream. */ + +/* The DMUS_SCRIPT_ERRORINFO structure describes an error that occurred in a script. + It is returned by methods in IDirectMusicScript. */ +typedef struct _DMUS_SCRIPT_ERRORINFO +{ + DWORD dwSize; /* Size of this structure. */ + HRESULT hr; + ULONG ulLineNumber; + LONG ichCharPosition; + WCHAR wszSourceFile[DMUS_MAX_FILENAME]; + WCHAR wszSourceComponent[DMUS_MAX_FILENAME]; + WCHAR wszDescription[DMUS_MAX_FILENAME]; + WCHAR wszSourceLineText[DMUS_MAX_FILENAME]; +} DMUS_SCRIPT_ERRORINFO; + +/* Track configuration flags, used with IDirectMusicSegment8::SetTrackConfig() */ + +#define DMUS_TRACKCONFIG_OVERRIDE_ALL 1 /* This track should get parameters from this segment before controlling and primary tracks. */ +#define DMUS_TRACKCONFIG_OVERRIDE_PRIMARY 2 /* This track should get parameters from this segment before the primary segment tracks. */ +#define DMUS_TRACKCONFIG_FALLBACK 4 /* This track should get parameters from this segment if the primary and controlling segments don't succeed. */ +#define DMUS_TRACKCONFIG_CONTROL_ENABLED 8 /* GetParam() enabled for this track. */ +#define DMUS_TRACKCONFIG_PLAY_ENABLED 0x10 /* Play() enabled for this track. */ +#define DMUS_TRACKCONFIG_NOTIFICATION_ENABLED 0x20 /* Notifications enabled for this track. */ +#define DMUS_TRACKCONFIG_PLAY_CLOCKTIME 0x40 /* This track plays in clock time, not music time. */ +#define DMUS_TRACKCONFIG_PLAY_COMPOSE 0x80 /* This track should regenerate data each time it starts playing. */ +#define DMUS_TRACKCONFIG_LOOP_COMPOSE 0x100 /* This track should regenerate data each time it repeats. */ +#define DMUS_TRACKCONFIG_COMPOSING 0x200 /* This track is used to compose other tracks. */ +#define DMUS_TRACKCONFIG_CONTROL_PLAY 0x10000 /* This track, when played in a controlling segment, overrides playback of primary segment tracks. */ +#define DMUS_TRACKCONFIG_CONTROL_NOTIFICATION 0x20000 /* This track, when played in a controlling segment, overrides notification of primary segment tracks. */ +/* Additional track config flags for composing transitions */ +#define DMUS_TRACKCONFIG_TRANS1_FROMSEGSTART 0x400 /* Get track info from start of From segment */ +#define DMUS_TRACKCONFIG_TRANS1_FROMSEGCURRENT 0x800 /* Get track info from current place in From segment */ +#define DMUS_TRACKCONFIG_TRANS1_TOSEGSTART 0x1000 /* Get track info from start of To segment */ +#define DMUS_TRACKCONFIG_DEFAULT (DMUS_TRACKCONFIG_CONTROL_ENABLED | DMUS_TRACKCONFIG_PLAY_ENABLED | DMUS_TRACKCONFIG_NOTIFICATION_ENABLED) + +/* Get/SetParam structs for commands */ +/* PARAM structures, used by GetParam() and SetParam() */ +typedef struct _DMUS_COMMAND_PARAM +{ + BYTE bCommand; + BYTE bGrooveLevel; + BYTE bGrooveRange; + BYTE bRepeatMode; +} DMUS_COMMAND_PARAM; + +typedef struct _DMUS_COMMAND_PARAM_2 +{ + MUSIC_TIME mtTime; + BYTE bCommand; + BYTE bGrooveLevel; + BYTE bGrooveRange; + BYTE bRepeatMode; +} DMUS_COMMAND_PARAM_2; + +typedef IDirectMusicObject __RPC_FAR *LPDMUS_OBJECT; +typedef IDirectMusicLoader __RPC_FAR *LPDMUS_LOADER; +typedef IDirectMusicBand __RPC_FAR *LPDMUS_BAND; + +#define DMUSB_LOADED (1 << 0) /* Set when band has been loaded */ +#define DMUSB_DEFAULT (1 << 1) /* Set when band is default band for a style */ + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicBand */ +#undef INTERFACE +#define INTERFACE IDirectMusicBand +DECLARE_INTERFACE_(IDirectMusicBand, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicBand */ + STDMETHOD(CreateSegment) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(Download) (THIS_ IDirectMusicPerformance* pPerformance) PURE; + STDMETHOD(Unload) (THIS_ IDirectMusicPerformance* pPerformance) PURE; +}; + +typedef IDirectMusicBand IDirectMusicBand8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicObject */ +#undef INTERFACE +#define INTERFACE IDirectMusicObject +DECLARE_INTERFACE_(IDirectMusicObject, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicObject */ + STDMETHOD(GetDescriptor) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetDescriptor) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(ParseDescriptor) (THIS_ LPSTREAM pStream, + LPDMUS_OBJECTDESC pDesc) PURE; +}; + +typedef IDirectMusicObject IDirectMusicObject8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader */ +#undef INTERFACE +#define INTERFACE IDirectMusicLoader +DECLARE_INTERFACE_(IDirectMusicLoader, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicLoader */ + STDMETHOD(GetObject) (THIS_ LPDMUS_OBJECTDESC pDesc, + REFIID riid, + LPVOID FAR *ppv) PURE; + STDMETHOD(SetObject) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetSearchDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzPath, + BOOL fClear) PURE; + STDMETHOD(ScanDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzFileExtension, + WCHAR *pwzScanFileName) PURE; + STDMETHOD(CacheObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ReleaseObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ClearCache) (THIS_ REFGUID rguidClass) PURE; + STDMETHOD(EnableCache) (THIS_ REFGUID rguidClass, + BOOL fEnable) PURE; + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicLoader8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicLoader8 +DECLARE_INTERFACE_(IDirectMusicLoader8, IDirectMusicLoader) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicLoader */ + STDMETHOD(GetObject) (THIS_ LPDMUS_OBJECTDESC pDesc, + REFIID riid, + LPVOID FAR *ppv) PURE; + STDMETHOD(SetObject) (THIS_ LPDMUS_OBJECTDESC pDesc) PURE; + STDMETHOD(SetSearchDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzPath, + BOOL fClear) PURE; + STDMETHOD(ScanDirectory) (THIS_ REFGUID rguidClass, + WCHAR *pwzFileExtension, + WCHAR *pwzScanFileName) PURE; + STDMETHOD(CacheObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ReleaseObject) (THIS_ IDirectMusicObject * pObject) PURE; + STDMETHOD(ClearCache) (THIS_ REFGUID rguidClass) PURE; + STDMETHOD(EnableCache) (THIS_ REFGUID rguidClass, + BOOL fEnable) PURE; + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc) PURE; + + /* IDirectMusicLoader8 */ + STDMETHOD_(void, CollectGarbage) (THIS) PURE; + STDMETHOD(ReleaseObjectByUnknown) (THIS_ IUnknown *pObject) PURE; + STDMETHOD(LoadObjectFromFile) (THIS_ REFGUID rguidClassID, + REFIID iidInterfaceID, + WCHAR *pwzFilePath, + void ** ppObject) PURE; +}; + +/* Stream object supports IDirectMusicGetLoader interface to access loader while file parsing. */ + +#undef INTERFACE +#define INTERFACE IDirectMusicGetLoader +DECLARE_INTERFACE_(IDirectMusicGetLoader, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicGetLoader */ + STDMETHOD(GetLoader) (THIS_ IDirectMusicLoader ** ppLoader) PURE; +}; + +typedef IDirectMusicGetLoader IDirectMusicGetLoader8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegment +DECLARE_INTERFACE_(IDirectMusicSegment, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegment */ + STDMETHOD(GetLength) (THIS_ MUSIC_TIME* pmtLength) PURE; + STDMETHOD(SetLength) (THIS_ MUSIC_TIME mtLength) PURE; + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(SetRepeats) (THIS_ DWORD dwRepeats) PURE; + STDMETHOD(GetDefaultResolution) (THIS_ DWORD* pdwResolution) PURE; + STDMETHOD(SetDefaultResolution) (THIS_ DWORD dwResolution) PURE; + STDMETHOD(GetTrack) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + IDirectMusicTrack** ppTrack) PURE; + STDMETHOD(GetTrackGroup) (THIS_ IDirectMusicTrack* pTrack, + DWORD* pdwGroupBits) PURE; + STDMETHOD(InsertTrack) (THIS_ IDirectMusicTrack* pTrack, + DWORD dwGroupBits) PURE; + STDMETHOD(RemoveTrack) (THIS_ IDirectMusicTrack* pTrack) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState** ppSegState, + IDirectMusicPerformance* pPerformance, + DWORD dwFlags) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetStartPoint) (THIS_ MUSIC_TIME mtStart) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(SetLoopPoints) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd) PURE; + STDMETHOD(GetLoopPoints) (THIS_ MUSIC_TIME* pmtStart, + MUSIC_TIME* pmtEnd) PURE; + STDMETHOD(SetPChannelsUsed) (THIS_ DWORD dwNumPChannels, + DWORD* paPChannels) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicSegment8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegment8 +DECLARE_INTERFACE_(IDirectMusicSegment8, IDirectMusicSegment) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegment */ + STDMETHOD(GetLength) (THIS_ MUSIC_TIME* pmtLength) PURE; + STDMETHOD(SetLength) (THIS_ MUSIC_TIME mtLength) PURE; + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(SetRepeats) (THIS_ DWORD dwRepeats) PURE; + STDMETHOD(GetDefaultResolution) (THIS_ DWORD* pdwResolution) PURE; + STDMETHOD(SetDefaultResolution) (THIS_ DWORD dwResolution) PURE; + STDMETHOD(GetTrack) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + IDirectMusicTrack** ppTrack) PURE; + STDMETHOD(GetTrackGroup) (THIS_ IDirectMusicTrack* pTrack, + DWORD* pdwGroupBits) PURE; + STDMETHOD(InsertTrack) (THIS_ IDirectMusicTrack* pTrack, + DWORD dwGroupBits) PURE; + STDMETHOD(RemoveTrack) (THIS_ IDirectMusicTrack* pTrack) PURE; + STDMETHOD(InitPlay) (THIS_ IDirectMusicSegmentState** ppSegState, + IDirectMusicPerformance* pPerformance, + DWORD dwFlags) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(Clone) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetStartPoint) (THIS_ MUSIC_TIME mtStart) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(SetLoopPoints) (THIS_ MUSIC_TIME mtStart, + MUSIC_TIME mtEnd) PURE; + STDMETHOD(GetLoopPoints) (THIS_ MUSIC_TIME* pmtStart, + MUSIC_TIME* pmtEnd) PURE; + STDMETHOD(SetPChannelsUsed) (THIS_ DWORD dwNumPChannels, + DWORD* paPChannels) PURE; + /* IDirectMusicSegment8 */ + STDMETHOD(SetTrackConfig) (THIS_ REFGUID rguidTrackClassID, /* Class ID of the type of track on which to set the configuration flags. */ + DWORD dwGroupBits, /* Group bits. */ + DWORD dwIndex, /* Nth track (or DMUS_SEG_ALLTRACKS) that matches class id and group id. */ + DWORD dwFlagsOn, /* DMUS_TRACKCONFIG_ flags to enable. */ + DWORD dwFlagsOff) PURE; /* DMUS_TRACKCONFIG_ flags to disable. */ + STDMETHOD(GetAudioPathConfig) (THIS_ IUnknown ** ppAudioPathConfig) PURE; + STDMETHOD(Compose) (THIS_ MUSIC_TIME mtTime, + IDirectMusicSegment* pFromSegment, + IDirectMusicSegment* pToSegment, + IDirectMusicSegment** ppComposedSegment) PURE; + STDMETHOD(Download) (THIS_ IUnknown *pAudioPath) PURE; + STDMETHOD(Unload) (THIS_ IUnknown *pAudioPath) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegmentState +DECLARE_INTERFACE_(IDirectMusicSegmentState, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegmentState */ + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(GetSegment ) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetStartTime) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(GetSeek) (THIS_ MUSIC_TIME* pmtSeek) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicSegmentState8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicSegmentState8 +DECLARE_INTERFACE_(IDirectMusicSegmentState8, IDirectMusicSegmentState) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSegmentState */ + STDMETHOD(GetRepeats) (THIS_ DWORD* pdwRepeats) PURE; + STDMETHOD(GetSegment ) (THIS_ IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetStartTime) (THIS_ MUSIC_TIME* pmtStart) PURE; + STDMETHOD(GetSeek) (THIS_ MUSIC_TIME* pmtSeek) PURE; + STDMETHOD(GetStartPoint) (THIS_ MUSIC_TIME* pmtStart) PURE; + + /* IDirectMusicSegmentState8 */ + STDMETHOD(SetTrackConfig) (THIS_ REFGUID rguidTrackClassID, /* Class ID of the type of track on which to set the configuration flags. */ + DWORD dwGroupBits, /* Group bits. */ + DWORD dwIndex, /* Nth track (or DMUS_SEG_ALLTRACKS) that matches class id and group id. */ + DWORD dwFlagsOn, /* DMUS_TRACKCONFIG_ flags to enable. */ + DWORD dwFlagsOff) PURE; /* DMUS_TRACKCONFIG_ flags to disable. */ + STDMETHOD(GetObjectInPath) (THIS_ DWORD dwPChannel, /* PChannel to search. */ + DWORD dwStage, /* Which stage in the path. */ + DWORD dwBuffer, /* Which buffer to address, if more than one. */ + REFGUID guidObject, /* ClassID of object. */ + DWORD dwIndex, /* Which object of that class. */ + REFGUID iidInterface,/* Requested COM interface. */ + void ** ppObject) PURE; /* Pointer to interface. */ +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicAudioPath */ +#undef INTERFACE +#define INTERFACE IDirectMusicAudioPath +DECLARE_INTERFACE_(IDirectMusicAudioPath, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicAudioPath */ + STDMETHOD(GetObjectInPath) (THIS_ DWORD dwPChannel, /* PChannel to search. */ + DWORD dwStage, /* Which stage in the path. */ + DWORD dwBuffer, /* Which buffer to address, if more than one. */ + REFGUID guidObject, /* ClassID of object. */ + DWORD dwIndex, /* Which object of that class. */ + REFGUID iidInterface,/* Requested COM interface. */ + void ** ppObject) PURE; /* Pointer to interface. */ + STDMETHOD(Activate) (THIS_ BOOL fActivate) PURE;/* True to activate, False to deactivate. */ + STDMETHOD(SetVolume) (THIS_ long lVolume, /* Gain, in 100ths of a dB. This must be negative (0 represents full volume.) */ + DWORD dwDuration) PURE;/* Duration of volume ramp in milliseconds. Note that 0 is more efficient. */ + STDMETHOD(ConvertPChannel) (THIS_ DWORD dwPChannelIn, /* Pchannel of source. */ + DWORD *pdwPChannelOut) PURE; /* Equivalent pchannel on performance. */ +}; + +typedef IDirectMusicAudioPath IDirectMusicAudioPath8; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance */ +#undef INTERFACE +#define INTERFACE IDirectMusicPerformance +DECLARE_INTERFACE_(IDirectMusicPerformance, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPerformance */ + STDMETHOD(Init) (THIS_ IDirectMusic** ppDirectMusic, + LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + STDMETHOD(PlaySegment) (THIS_ IDirectMusicSegment* pSegment, + DWORD dwFlags, + __int64 i64StartTime, + IDirectMusicSegmentState** ppSegmentState) PURE; + STDMETHOD(Stop) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegmentState, + MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetSegmentState) (THIS_ IDirectMusicSegmentState** ppSegmentState, + MUSIC_TIME mtTime) PURE; + STDMETHOD(SetPrepareTime) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetPrepareTime) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SetBumperLength) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetBumperLength) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SendPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(MusicToReferenceTime) (THIS_ MUSIC_TIME mtTime, + REFERENCE_TIME* prtTime) PURE; + STDMETHOD(ReferenceToMusicTime) (THIS_ REFERENCE_TIME rtTime, + MUSIC_TIME* pmtTime) PURE; + STDMETHOD(IsPlaying) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegState) PURE; + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME* prtNow, + MUSIC_TIME* pmtNow) PURE; + STDMETHOD(AllocPMsg) (THIS_ ULONG cb, + DMUS_PMSG** ppPMSG) PURE; + STDMETHOD(FreePMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(SetNotificationHandle)(THIS_ HANDLE hNotification, + REFERENCE_TIME rtMinimum) PURE; + STDMETHOD(GetNotificationPMsg) (THIS_ DMUS_NOTIFICATION_PMSG** ppNotificationPMsg) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType)(THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(AddPort) (THIS_ IDirectMusicPort* pPort) PURE; + STDMETHOD(RemovePort) (THIS_ IDirectMusicPort* pPort ) PURE; + STDMETHOD(AssignPChannelBlock) (THIS_ DWORD dwBlockNum, + IDirectMusicPort* pPort, + DWORD dwGroup ) PURE; + STDMETHOD(AssignPChannel) (THIS_ DWORD dwPChannel, + IDirectMusicPort* pPort, + DWORD dwGroup, + DWORD dwMChannel ) PURE; + STDMETHOD(PChannelInfo) (THIS_ DWORD dwPChannel, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument* pInst, + DWORD dwPChannel, + IDirectMusicDownloadedInstrument** ppDownInst, + DMUS_NOTERANGE* pNoteRanges, + DWORD dwNumNoteRanges, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(Invalidate) (THIS_ MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(GetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(SetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(GetLatencyTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(GetQueueTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(AdjustTime) (THIS_ REFERENCE_TIME rtAmount) PURE; + STDMETHOD(CloseDown) (THIS) PURE; + STDMETHOD(GetResolvedTime) (THIS_ REFERENCE_TIME rtTime, + REFERENCE_TIME* prtResolved, + DWORD dwTimeResolveFlags) PURE; + STDMETHOD(MIDIToMusic) (THIS_ BYTE bMIDIValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + WORD *pwMusicValue) PURE; + STDMETHOD(MusicToMIDI) (THIS_ WORD wMusicValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + BYTE *pbMIDIValue) PURE; + STDMETHOD(TimeToRhythm) (THIS_ MUSIC_TIME mtTime, + DMUS_TIMESIGNATURE *pTimeSig, + WORD *pwMeasure, + BYTE *pbBeat, + BYTE *pbGrid, + short *pnOffset) PURE; + STDMETHOD(RhythmToTime) (THIS_ WORD wMeasure, + BYTE bBeat, + BYTE bGrid, + short nOffset, + DMUS_TIMESIGNATURE *pTimeSig, + MUSIC_TIME *pmtTime) PURE; +}; + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicPerformance8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicPerformance8 +DECLARE_INTERFACE_(IDirectMusicPerformance8, IDirectMusicPerformance) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPerformance */ + STDMETHOD(Init) (THIS_ IDirectMusic** ppDirectMusic, + LPDIRECTSOUND pDirectSound, + HWND hWnd) PURE; + STDMETHOD(PlaySegment) (THIS_ IDirectMusicSegment* pSegment, + DWORD dwFlags, + __int64 i64StartTime, + IDirectMusicSegmentState** ppSegmentState) PURE; + STDMETHOD(Stop) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegmentState, + MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetSegmentState) (THIS_ IDirectMusicSegmentState** ppSegmentState, + MUSIC_TIME mtTime) PURE; + STDMETHOD(SetPrepareTime) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetPrepareTime) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SetBumperLength) (THIS_ DWORD dwMilliSeconds) PURE; + STDMETHOD(GetBumperLength) (THIS_ DWORD* pdwMilliSeconds) PURE; + STDMETHOD(SendPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(MusicToReferenceTime) (THIS_ MUSIC_TIME mtTime, + REFERENCE_TIME* prtTime) PURE; + STDMETHOD(ReferenceToMusicTime) (THIS_ REFERENCE_TIME rtTime, + MUSIC_TIME* pmtTime) PURE; + STDMETHOD(IsPlaying) (THIS_ IDirectMusicSegment* pSegment, + IDirectMusicSegmentState* pSegState) PURE; + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME* prtNow, + MUSIC_TIME* pmtNow) PURE; + STDMETHOD(AllocPMsg) (THIS_ ULONG cb, + DMUS_PMSG** ppPMSG) PURE; + STDMETHOD(FreePMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(GetGraph) (THIS_ IDirectMusicGraph** ppGraph) PURE; + STDMETHOD(SetGraph) (THIS_ IDirectMusicGraph* pGraph) PURE; + STDMETHOD(SetNotificationHandle)(THIS_ HANDLE hNotification, + REFERENCE_TIME rtMinimum) PURE; + STDMETHOD(GetNotificationPMsg) (THIS_ DMUS_NOTIFICATION_PMSG** ppNotificationPMsg) PURE; + STDMETHOD(AddNotificationType) (THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(RemoveNotificationType)(THIS_ REFGUID rguidNotificationType) PURE; + STDMETHOD(AddPort) (THIS_ IDirectMusicPort* pPort) PURE; + STDMETHOD(RemovePort) (THIS_ IDirectMusicPort* pPort ) PURE; + STDMETHOD(AssignPChannelBlock) (THIS_ DWORD dwBlockNum, + IDirectMusicPort* pPort, + DWORD dwGroup ) PURE; + STDMETHOD(AssignPChannel) (THIS_ DWORD dwPChannel, + IDirectMusicPort* pPort, + DWORD dwGroup, + DWORD dwMChannel ) PURE; + STDMETHOD(PChannelInfo) (THIS_ DWORD dwPChannel, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(DownloadInstrument) (THIS_ IDirectMusicInstrument* pInst, + DWORD dwPChannel, + IDirectMusicDownloadedInstrument** ppDownInst, + DMUS_NOTERANGE* pNoteRanges, + DWORD dwNumNoteRanges, + IDirectMusicPort** ppPort, + DWORD* pdwGroup, + DWORD* pdwMChannel ) PURE; + STDMETHOD(Invalidate) (THIS_ MUSIC_TIME mtTime, + DWORD dwFlags) PURE; + STDMETHOD(GetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + MUSIC_TIME* pmtNext, + void* pParam) PURE; + STDMETHOD(SetParam) (THIS_ REFGUID rguidType, + DWORD dwGroupBits, + DWORD dwIndex, + MUSIC_TIME mtTime, + void* pParam) PURE; + STDMETHOD(GetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(SetGlobalParam) (THIS_ REFGUID rguidType, + void* pParam, + DWORD dwSize) PURE; + STDMETHOD(GetLatencyTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(GetQueueTime) (THIS_ REFERENCE_TIME* prtTime) PURE; + STDMETHOD(AdjustTime) (THIS_ REFERENCE_TIME rtAmount) PURE; + STDMETHOD(CloseDown) (THIS) PURE; + STDMETHOD(GetResolvedTime) (THIS_ REFERENCE_TIME rtTime, + REFERENCE_TIME* prtResolved, + DWORD dwTimeResolveFlags) PURE; + STDMETHOD(MIDIToMusic) (THIS_ BYTE bMIDIValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + WORD *pwMusicValue) PURE; + STDMETHOD(MusicToMIDI) (THIS_ WORD wMusicValue, + DMUS_CHORD_KEY* pChord, + BYTE bPlayMode, + BYTE bChordLevel, + BYTE *pbMIDIValue) PURE; + STDMETHOD(TimeToRhythm) (THIS_ MUSIC_TIME mtTime, + DMUS_TIMESIGNATURE *pTimeSig, + WORD *pwMeasure, + BYTE *pbBeat, + BYTE *pbGrid, + short *pnOffset) PURE; + STDMETHOD(RhythmToTime) (THIS_ WORD wMeasure, + BYTE bBeat, + BYTE bGrid, + short nOffset, + DMUS_TIMESIGNATURE *pTimeSig, + MUSIC_TIME *pmtTime) PURE; + /* IDirectMusicPerformance8 */ + STDMETHOD(InitAudio) (THIS_ IDirectMusic** ppDirectMusic, /* Optional DirectMusic pointer. */ + IDirectSound** ppDirectSound, /* Optional DirectSound pointer. */ + HWND hWnd, /* HWND for DirectSound. */ + DWORD dwDefaultPathType, /* Requested default audio path type, also optional. */ + DWORD dwPChannelCount, /* Number of PChannels, if default audio path to be created. */ + DWORD dwFlags, /* DMUS_AUDIOF flags, if no pParams structure. */ + DMUS_AUDIOPARAMS *pParams) PURE; /* Optional initialization structure, defining required voices, buffers, etc. */ + STDMETHOD(PlaySegmentEx) (THIS_ IUnknown* pSource, /* Segment to play. */ + WCHAR *pwzSegmentName, /* Not supported in DX8. */ + IUnknown* pTransition, /* Optional template segment to compose transition with. */ + DWORD dwFlags, /* DMUS_SEGF_ flags. */ + __int64 i64StartTime, /* Time to start playback. */ + IDirectMusicSegmentState** ppSegmentState, /* Returned Segment State. */ + IUnknown *pFrom, /* Optional segmentstate or audiopath to replace. */ + IUnknown *pAudioPath) PURE; /* Optional audioPath to play on. */ + STDMETHOD(StopEx) (THIS_ IUnknown *pObjectToStop, /* Segstate, AudioPath, or Segment. */ + __int64 i64StopTime, + DWORD dwFlags) PURE; + STDMETHOD(ClonePMsg) (THIS_ DMUS_PMSG* pSourcePMSG, + DMUS_PMSG** ppCopyPMSG) PURE; + STDMETHOD(CreateAudioPath) (THIS_ IUnknown *pSourceConfig, /* Source configuration, from AudioPathConfig file. */ + BOOL fActivate, /* TRUE to activate on creation. */ + IDirectMusicAudioPath **ppNewPath) PURE; /* Returns created audiopath. */ + STDMETHOD(CreateStandardAudioPath)(THIS_ DWORD dwType, /* Type of path to create. */ + DWORD dwPChannelCount, /* How many PChannels to allocate for it. */ + BOOL fActivate, /* TRUE to activate on creation. */ + IDirectMusicAudioPath **ppNewPath) PURE; /* Returns created audiopath. */ + STDMETHOD(SetDefaultAudioPath) (THIS_ IDirectMusicAudioPath *pAudioPath) PURE; + STDMETHOD(GetDefaultAudioPath) (THIS_ IDirectMusicAudioPath **ppAudioPath) PURE; + STDMETHOD(GetParamEx) (THIS_ REFGUID rguidType, /* GetParam command ID. */ + DWORD dwTrackID, /* Virtual track ID of caller. */ + DWORD dwGroupBits, /* Group bits of caller. */ + DWORD dwIndex, /* Index to Nth parameter. */ + MUSIC_TIME mtTime, /* Time of requested parameter. */ + MUSIC_TIME* pmtNext, /* Returned delta to next parameter. */ + void* pParam) PURE; /* Data structure to fill with parameter. */ +}; + + + +/*//////////////////////////////////////////////////////////////////// +// IDirectMusicGraph */ +#undef INTERFACE +#define INTERFACE IDirectMusicGraph +DECLARE_INTERFACE_(IDirectMusicGraph, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicGraph */ + STDMETHOD(StampPMsg) (THIS_ DMUS_PMSG* pPMSG) PURE; + STDMETHOD(InsertTool) (THIS_ IDirectMusicTool* pTool, + DWORD* pdwPChannels, + DWORD cPChannels, + LONG lIndex) PURE; + STDMETHOD(GetTool) (THIS_ DWORD dwIndex, + IDirectMusicTool** ppTool) PURE; + STDMETHOD(RemoveTool) (THIS_ IDirectMusicTool* pTool) PURE; +}; + +typedef IDirectMusicGraph IDirectMusicGraph8; + + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle */ +#undef INTERFACE +#define INTERFACE IDirectMusicStyle +DECLARE_INTERFACE_(IDirectMusicStyle, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicStyle */ + STDMETHOD(GetBand) (THIS_ WCHAR* pwszName, + IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumBand) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetDefaultBand) (THIS_ IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumMotif) (THIS_ DWORD dwIndex, + WCHAR* pwszName) PURE; + STDMETHOD(GetMotif) (THIS_ WCHAR* pwszName, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetDefaultChordMap) (THIS_ IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(EnumChordMap) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetChordMap) (THIS_ WCHAR* pwszName, + IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(GetTimeSignature) (THIS_ DMUS_TIMESIGNATURE* pTimeSig) PURE; + STDMETHOD(GetEmbellishmentLength) (THIS_ DWORD dwType, + DWORD dwLevel, + DWORD* pdwMin, + DWORD* pdwMax) PURE; + STDMETHOD(GetTempo) (THIS_ double* pTempo) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicStyle8 */ +#undef INTERFACE +#define INTERFACE IDirectMusicStyle8 +DECLARE_INTERFACE_(IDirectMusicStyle8, IDirectMusicStyle) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicStyle */ + STDMETHOD(GetBand) (THIS_ WCHAR* pwszName, + IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumBand) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetDefaultBand) (THIS_ IDirectMusicBand** ppBand) PURE; + STDMETHOD(EnumMotif) (THIS_ DWORD dwIndex, + WCHAR* pwszName) PURE; + STDMETHOD(GetMotif) (THIS_ WCHAR* pwszName, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(GetDefaultChordMap) (THIS_ IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(EnumChordMap) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(GetChordMap) (THIS_ WCHAR* pwszName, + IDirectMusicChordMap** ppChordMap) PURE; + STDMETHOD(GetTimeSignature) (THIS_ DMUS_TIMESIGNATURE* pTimeSig) PURE; + STDMETHOD(GetEmbellishmentLength) (THIS_ DWORD dwType, + DWORD dwLevel, + DWORD* pdwMin, + DWORD* pdwMax) PURE; + STDMETHOD(GetTempo) (THIS_ double* pTempo) PURE; + + /* IDirectMusicStyle8 */ + STDMETHOD(EnumPattern) (THIS_ DWORD dwIndex, + DWORD dwPatternType, + WCHAR* pwszName) PURE; +}; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicChordMap */ +#undef INTERFACE +#define INTERFACE IDirectMusicChordMap +DECLARE_INTERFACE_(IDirectMusicChordMap, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicChordMap */ + STDMETHOD(GetScale) (THIS_ DWORD* pdwScale) PURE; +}; + +typedef IDirectMusicChordMap IDirectMusicChordMap8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicComposer */ +#undef INTERFACE +#define INTERFACE IDirectMusicComposer +DECLARE_INTERFACE_(IDirectMusicComposer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicComposer */ + STDMETHOD(ComposeSegmentFromTemplate) (THIS_ IDirectMusicStyle* pStyle, + IDirectMusicSegment* pTemplate, + WORD wActivity, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(ComposeSegmentFromShape) (THIS_ IDirectMusicStyle* pStyle, + WORD wNumMeasures, + WORD wShape, + WORD wActivity, + BOOL fIntro, + BOOL fEnd, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppSegment ) PURE; + STDMETHOD(ComposeTransition) (THIS_ IDirectMusicSegment* pFromSeg, + IDirectMusicSegment* pToSeg, + MUSIC_TIME mtTime, + WORD wCommand, + DWORD dwFlags, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppTransSeg) PURE; + STDMETHOD(AutoTransition) (THIS_ IDirectMusicPerformance* pPerformance, + IDirectMusicSegment* pToSeg, + WORD wCommand, + DWORD dwFlags, + IDirectMusicChordMap* pChordMap, + IDirectMusicSegment** ppTransSeg, + IDirectMusicSegmentState** ppToSegState, + IDirectMusicSegmentState** ppTransSegState) PURE; + STDMETHOD(ComposeTemplateFromShape) (THIS_ WORD wNumMeasures, + WORD wShape, + BOOL fIntro, + BOOL fEnd, + WORD wEndLength, + IDirectMusicSegment** ppTemplate) PURE; + STDMETHOD(ChangeChordMap) (THIS_ IDirectMusicSegment* pSegment, + BOOL fTrackScale, + IDirectMusicChordMap* pChordMap) PURE; +}; + +typedef IDirectMusicComposer IDirectMusicComposer8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicPatternTrack */ + +#undef INTERFACE +#define INTERFACE IDirectMusicPatternTrack +DECLARE_INTERFACE_(IDirectMusicPatternTrack, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicPatternTrack */ + STDMETHOD(CreateSegment) (THIS_ IDirectMusicStyle* pStyle, + IDirectMusicSegment** ppSegment) PURE; + STDMETHOD(SetVariation) (THIS_ IDirectMusicSegmentState* pSegState, + DWORD dwVariationFlags, + DWORD dwPart) PURE; + STDMETHOD(SetPatternByName) (THIS_ IDirectMusicSegmentState* pSegState, + WCHAR* wszName, + IDirectMusicStyle* pStyle, + DWORD dwPatternType, + DWORD* pdwLength) PURE; +}; + +typedef IDirectMusicPatternTrack IDirectMusicPatternTrack8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicScript */ + +#undef INTERFACE +#define INTERFACE IDirectMusicScript +DECLARE_INTERFACE_(IDirectMusicScript, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicScript */ + STDMETHOD(Init) (THIS_ IDirectMusicPerformance *pPerformance, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(CallRoutine) (THIS_ WCHAR *pwszRoutineName, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableVariant) (THIS_ WCHAR *pwszVariableName, + VARIANT varValue, + BOOL fSetRef, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableVariant) (THIS_ WCHAR *pwszVariableName, + VARIANT *pvarValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableNumber) (THIS_ WCHAR *pwszVariableName, + LONG lValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableNumber) (THIS_ WCHAR *pwszVariableName, + LONG *plValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(SetVariableObject) (THIS_ WCHAR *pwszVariableName, + IUnknown *punkValue, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(GetVariableObject) (THIS_ WCHAR *pwszVariableName, + REFIID riid, + LPVOID FAR *ppv, + DMUS_SCRIPT_ERRORINFO *pErrorInfo) PURE; + STDMETHOD(EnumRoutine) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; + STDMETHOD(EnumVariable) (THIS_ DWORD dwIndex, + WCHAR *pwszName) PURE; +}; + +typedef IDirectMusicScript IDirectMusicScript8; + +/*///////////////////////////////////////////////////////////////////// +// IDirectMusicContainer */ + +#undef INTERFACE +#define INTERFACE IDirectMusicContainer +DECLARE_INTERFACE_(IDirectMusicContainer, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicContainer */ + STDMETHOD(EnumObject) (THIS_ REFGUID rguidClass, + DWORD dwIndex, + LPDMUS_OBJECTDESC pDesc, + WCHAR *pwszAlias) PURE; +}; + +typedef IDirectMusicContainer IDirectMusicContainer8; + +/* CLSID's */ +DEFINE_GUID(CLSID_DirectMusicPerformance,0xd2ac2881, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSegment,0xd2ac2882, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicSegmentState,0xd2ac2883, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicGraph,0xd2ac2884, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicStyle,0xd2ac288a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicChordMap,0xd2ac288f, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicComposer,0xd2ac2890, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicLoader,0xd2ac2892, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicBand,0x79ba9e00, 0xb6ee, 0x11d1, 0x86, 0xbe, 0x0, 0xc0, 0x4f, 0xbf, 0x8f, 0xef); + +/* New CLSID's for DX8 */ +DEFINE_GUID(CLSID_DirectMusicPatternTrack,0xd2ac2897, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(CLSID_DirectMusicScript,0x810b5013, 0xe88d, 0x11d2, 0x8b, 0xc1, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); /* {810B5013-E88D-11d2-8BC1-00600893B1B6} */ +DEFINE_GUID(CLSID_DirectMusicContainer,0x9301e380, 0x1f22, 0x11d3, 0x82, 0x26, 0xd2, 0xfa, 0x76, 0x25, 0x5d, 0x47); +DEFINE_GUID(CLSID_DirectSoundWave,0x8a667154, 0xf9cb, 0x11d2, 0xad, 0x8a, 0x0, 0x60, 0xb0, 0x57, 0x5a, 0xbc); +DEFINE_GUID(CLSID_DirectMusicAudioPathConfig,0xee0b9ca0, 0xa81e, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* Special GUID for all object types. This is used by the loader. */ +DEFINE_GUID(GUID_DirectMusicAllTypes,0xd2ac2893, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Notification guids */ +DEFINE_GUID(GUID_NOTIFICATION_SEGMENT,0xd2ac2899, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_PERFORMANCE,0x81f75bc5, 0x4e5d, 0x11d2, 0xbc, 0xc7, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_NOTIFICATION_MEASUREANDBEAT,0xd2ac289a, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_CHORD,0xd2ac289b, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_COMMAND,0xd2ac289c, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_NOTIFICATION_RECOMPOSE, 0xd348372b, 0x945b, 0x45ae, 0xa5, 0x22, 0x45, 0xf, 0x12, 0x5b, 0x84, 0xa5); + +/* Track param type guids */ +/* Use to get/set a DMUS_COMMAND_PARAM param in the Command track */ +DEFINE_GUID(GUID_CommandParam,0xd2ac289d, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_COMMAND_PARAM_2 param in the Command track */ +DEFINE_GUID(GUID_CommandParam2, 0x28f97ef7, 0x9538, 0x11d2, 0x97, 0xa9, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Use to get/set a DMUS_COMMAND_PARAM_2 param to be used as the command following all commands in +the Command track (this information can't be saved) */ +DEFINE_GUID(GUID_CommandParamNext, 0x472afe7a, 0x281b, 0x11d3, 0x81, 0x7d, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Use to get/set a DMUS_CHORD_PARAM param in the Chord track */ +DEFINE_GUID(GUID_ChordParam,0xd2ac289e, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_RHYTHM_PARAM param in the Chord track */ +DEFINE_GUID(GUID_RhythmParam,0xd2ac289f, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set an IDirectMusicStyle param in the Style track */ +DEFINE_GUID(GUID_IDirectMusicStyle,0xd2ac28a1, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks */ +DEFINE_GUID(GUID_TimeSignature,0xd2ac28a4, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track */ +DEFINE_GUID(GUID_TempoParam,0xd2ac28a5, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get the next valid point in a segment at which it may start */ +DEFINE_GUID(GUID_Valid_Start_Time,0x7f6b1760, 0x1fdb, 0x11d3, 0x82, 0x26, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +/* Use to get the next point in the currently playing primary segment at which a new segment may start */ +DEFINE_GUID(GUID_Play_Marker,0xd8761a41, 0x801a, 0x11d3, 0x9b, 0xd1, 0xda, 0xf7, 0xe1, 0xc3, 0xd8, 0x34); + +/* Use to get (GetParam) or add (SetParam) bands in the Band track */ +DEFINE_GUID(GUID_BandParam,0x2bb1938, 0xcb8b, 0x11d2, 0x8b, 0xb9, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xb6); +typedef struct _DMUS_BAND_PARAM +{ + MUSIC_TIME mtTimePhysical; /* Note: If this is a clock-time track, then this field is interpreted in the track's internal time format, which is the number of milliseconds after the beginning of playback. */ + IDirectMusicBand *pBand; +} DMUS_BAND_PARAM; + +/* Obsolete -- doesn't distinguish physical and logical time. Use GUID_BandParam instead. */ +DEFINE_GUID(GUID_IDirectMusicBand,0xd2ac28ac, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set an IDirectMusicChordMap param in the ChordMap track */ +DEFINE_GUID(GUID_IDirectMusicChordMap,0xd2ac28ad, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Use to get/set a DMUS_MUTE_PARAM param in the Mute track */ +DEFINE_GUID(GUID_MuteParam,0xd2ac28af, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions. + Some of these guids (where noted) also apply to wave tracks. + */ +/* Download bands/waves for the IDirectMusicSegment */ +DEFINE_GUID(GUID_Download,0xd2ac28a7, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Unload bands/waves for the IDirectMusicSegment */ +DEFINE_GUID(GUID_Unload,0xd2ac28a8, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Connect segment's bands to an IDirectMusicCollection */ +DEFINE_GUID(GUID_ConnectToDLSCollection, 0x1db1ae6b, 0xe92e, 0x11d1, 0xa8, 0xc5, 0x0, 0xc0, 0x4f, 0xa3, 0x72, 0x6e); + +/* Enable/disable autodownloading of bands/waves */ +DEFINE_GUID(GUID_Enable_Auto_Download,0xd2ac28a9, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_Disable_Auto_Download,0xd2ac28aa, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Clear all bands */ +DEFINE_GUID(GUID_Clear_All_Bands,0xd2ac28ab, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file */ +DEFINE_GUID(GUID_StandardMIDIFile, 0x6621075, 0xe92e, 0x11d1, 0xa8, 0xc5, 0x0, 0xc0, 0x4f, 0xa3, 0x72, 0x6e); +/* For compatibility with beta releases... */ +#define GUID_IgnoreBankSelectForGM GUID_StandardMIDIFile + +/* Disable/enable param guids. Use these in SetParam calls to disable or enable sending + * specific PMsg types. + */ +DEFINE_GUID(GUID_DisableTimeSig, 0x45fc707b, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_EnableTimeSig, 0x45fc707c, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_DisableTempo, 0x45fc707d, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(GUID_EnableTempo, 0x45fc707e, 0x1db4, 0x11d2, 0xbc, 0xac, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); + +/* Used in SetParam calls for pattern-based tracks. A nonzero value seeds the random number +generator for variation selection; a value of zero reverts to the default behavior of +getting the seed from the system clock. +*/ +DEFINE_GUID(GUID_SeedVariations, 0x65b76fa5, 0xff37, 0x11d2, 0x81, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x6e, 0x58); + +/* Used to get the variations currently in effect across PChannels */ +DEFINE_GUID(GUID_Variations, 0x11f72cce, 0x26e6, 0x4ecd, 0xaf, 0x2e, 0xd6, 0x68, 0xe6, 0x67, 0x7, 0xd8); +typedef struct _DMUS_VARIATIONS_PARAM +{ + DWORD dwPChannelsUsed; /* number of PChannels in use */ + DWORD* padwPChannels; /* array of PChannels in use */ + DWORD* padwVariations; /* array of variations in effect for each PChannel */ +} DMUS_VARIATIONS_PARAM; + +/* Download bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance */ +DEFINE_GUID(GUID_DownloadToAudioPath,0x9f2c0341, 0xc5c4, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +/* Unload bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance */ +DEFINE_GUID(GUID_UnloadFromAudioPath,0x9f2c0342, 0xc5c4, 0x11d3, 0x9b, 0xd1, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + + +/* Global data guids */ +DEFINE_GUID(GUID_PerfMasterTempo,0xd2ac28b0, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfMasterVolume,0xd2ac28b1, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfMasterGrooveLevel,0xd2ac28b2, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(GUID_PerfAutoDownload, 0xfb09565b, 0x3631, 0x11d2, 0xbc, 0xb8, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); + +/* GUID for default GM/GS dls collection. */ +DEFINE_GUID(GUID_DefaultGMCollection, 0xf17e8673, 0xc3b4, 0x11d1, 0x87, 0xb, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* GUID to define default synth, placed in AudioPath configuration file. */ +DEFINE_GUID(GUID_Synth_Default,0x26bb9432, 0x45fe, 0x48d3, 0xa3, 0x75, 0x24, 0x72, 0xc5, 0xe3, 0xe7, 0x86); + +/* GUIDs to define default buffer configurations to place in AudioPath configuration file. */ +DEFINE_GUID(GUID_Buffer_Reverb,0x186cc541, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_EnvReverb,0x186cc542, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_Stereo,0x186cc545, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_3D_Dry,0x186cc546, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); +DEFINE_GUID(GUID_Buffer_Mono,0x186cc547, 0xdb29, 0x11d3, 0x9b, 0xd1, 0x0, 0x80, 0xc7, 0x15, 0xa, 0x74); + +/* IID's */ +DEFINE_GUID(IID_IDirectMusicLoader, 0x2ffaaca2, 0x5dca, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicGetLoader,0x68a04844, 0xd13d, 0x11d1, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicObject,0xd2ac28b5, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicSegment, 0xf96029a2, 0x4282, 0x11d2, 0x87, 0x17, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicSegmentState, 0xa3afdcc7, 0xd3ee, 0x11d1, 0xbc, 0x8d, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(IID_IDirectMusicPerformance,0x7d43d03, 0x6523, 0x11d2, 0x87, 0x1d, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicGraph,0x2befc277, 0x5497, 0x11d2, 0xbc, 0xcb, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xeb); +DEFINE_GUID(IID_IDirectMusicStyle,0xd2ac28bd, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicChordMap,0xd2ac28be, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicComposer,0xd2ac28bf, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); +DEFINE_GUID(IID_IDirectMusicBand,0xd2ac28c0, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Alternate interface IDs, available in DX7 release and after. */ +DEFINE_GUID(IID_IDirectMusicPerformance2,0x6fc2cae0, 0xbc78, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicSegment2, 0xd38894d1, 0xc052, 0x11d2, 0x87, 0x2f, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd); + +/* Interface IDs for DX8 */ +/* changed interfaces (GUID only) */ +DEFINE_GUID(IID_IDirectMusicLoader8, 0x19e7c08c, 0xa44, 0x4e6a, 0xa1, 0x16, 0x59, 0x5a, 0x7c, 0xd5, 0xde, 0x8c); +DEFINE_GUID(IID_IDirectMusicPerformance8, 0x679c4137, 0xc62e, 0x4147, 0xb2, 0xb4, 0x9d, 0x56, 0x9a, 0xcb, 0x25, 0x4c); +DEFINE_GUID(IID_IDirectMusicSegment8,0xc6784488, 0x41a3, 0x418f, 0xaa, 0x15, 0xb3, 0x50, 0x93, 0xba, 0x42, 0xd4); +DEFINE_GUID(IID_IDirectMusicSegmentState8, 0xa50e4730, 0xae4, 0x48a7, 0x98, 0x39, 0xbc, 0x4, 0xbf, 0xe0, 0x77, 0x72); +DEFINE_GUID(IID_IDirectMusicStyle8, 0xfd24ad8a, 0xa260, 0x453d, 0xbf, 0x50, 0x6f, 0x93, 0x84, 0xf7, 0x9, 0x85); +/* new interfaces (GUID + alias) */ +DEFINE_GUID(IID_IDirectMusicPatternTrack, 0x51c22e10, 0xb49f, 0x46fc, 0xbe, 0xc2, 0xe6, 0x28, 0x8f, 0xb9, 0xed, 0xe6); +#define IID_IDirectMusicPatternTrack8 IID_IDirectMusicPatternTrack +DEFINE_GUID(IID_IDirectMusicScript, 0x2252373a, 0x5814, 0x489b, 0x82, 0x9, 0x31, 0xfe, 0xde, 0xba, 0xf1, 0x37); /* {2252373A-5814-489b-8209-31FEDEBAF137} */ +#define IID_IDirectMusicScript8 IID_IDirectMusicScript +DEFINE_GUID(IID_IDirectMusicContainer, 0x9301e386, 0x1f22, 0x11d3, 0x82, 0x26, 0xd2, 0xfa, 0x76, 0x25, 0x5d, 0x47); +#define IID_IDirectMusicContainer8 IID_IDirectMusicContainer +DEFINE_GUID(IID_IDirectMusicAudioPath,0xc87631f5, 0x23be, 0x4986, 0x88, 0x36, 0x5, 0x83, 0x2f, 0xcc, 0x48, 0xf9); +#define IID_IDirectMusicAudioPath8 IID_IDirectMusicAudioPath +/* unchanged interfaces (alias only) */ +#define IID_IDirectMusicGetLoader8 IID_IDirectMusicGetLoader +#define IID_IDirectMusicChordMap8 IID_IDirectMusicChordMap +#define IID_IDirectMusicGraph8 IID_IDirectMusicGraph +#define IID_IDirectMusicBand8 IID_IDirectMusicBand +#define IID_IDirectMusicObject8 IID_IDirectMusicObject +#define IID_IDirectMusicComposer8 IID_IDirectMusicComposer + + +#ifdef __cplusplus +}; /* extern "C" */ +#endif + +#include + +#endif /* #ifndef _DMUSICI_ */ diff --git a/SDK/dxSDK/Include/dmusics.h b/SDK/dxSDK/Include/dmusics.h new file mode 100644 index 00000000..8f1e45d8 --- /dev/null +++ b/SDK/dxSDK/Include/dmusics.h @@ -0,0 +1,193 @@ +/************************************************************************ +* * +* dmusics.h -- Definitions for created a DirectMusic software synth * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +************************************************************************/ + +#ifndef _DMUSICS_ +#define _DMUSICS_ + +#include "dmusicc.h" + +/* Software synths are enumerated from under this registry key. + */ +#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths" + +interface IDirectMusicSynth; +interface IDirectMusicSynthSink; + +#ifndef __cplusplus +typedef interface IDirectMusicSynth IDirectMusicSynth; +typedef interface IDirectMusicSynthSink IDirectMusicSynthSink; +#endif + +#ifndef _DMUS_VOICE_STATE_DEFINED +#define _DMUS_VOICE_STATE_DEFINED + +typedef struct _DMUS_VOICE_STATE +{ + BOOL bExists; + SAMPLE_POSITION spPosition; +} DMUS_VOICE_STATE; + +#endif /* _DMUS_VOICE_STATE_DEFINED */ + +/* IDirectMusicSynth::Refresh + * + * This is the last buffer of the stream. It may be a partial block. + */ +#define REFRESH_F_LASTBUFFER 0x00000001 + +#undef INTERFACE +#define INTERFACE IDirectMusicSynth +DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynth */ + STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; + STDMETHOD(Download) (THIS_ LPHANDLE phDownload, + LPVOID pvData, + LPBOOL pbFree ) PURE; + STDMETHOD(Unload) (THIS_ HANDLE hDownload, + HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), + HANDLE hUserData ) PURE; + STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, + LPBYTE pbBuffer, + DWORD cbBuffer) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE; + STDMETHOD(Render) (THIS_ short *pBuffer, + DWORD dwLength, + LONGLONG llPosition) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwPriority) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, + LPDWORD pdwWaveFormatExSize) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; +}; + +#undef INTERFACE + +#define INTERFACE IDirectMusicSynth8 +DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynth */ + STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE; + STDMETHOD(Download) (THIS_ LPHANDLE phDownload, + LPVOID pvData, + LPBOOL pbFree ) PURE; + STDMETHOD(Unload) (THIS_ HANDLE hDownload, + HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), + HANDLE hUserData ) PURE; + STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, + LPBYTE pbBuffer, + DWORD cbBuffer) PURE; + STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE; + STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SetSynthSink) (THIS_ IDirectMusicSynthSink *pSynthSink) PURE; + STDMETHOD(Render) (THIS_ short *pBuffer, + DWORD dwLength, + LONGLONG llPosition) PURE; + STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwPriority) PURE; + STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwPriority) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, + LPDWORD pdwWaveFormatExSize) PURE; + STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE; + + /* IDirectMusicSynth8 */ + STDMETHOD(PlayVoice) (THIS_ REFERENCE_TIME rt, + DWORD dwVoiceId, + DWORD dwChannelGroup, + DWORD dwChannel, + DWORD dwDLId, + long prPitch, /* PREL not defined here */ + long vrVolume, /* VREL not defined here */ + SAMPLE_TIME stVoiceStart, + SAMPLE_TIME stLoopStart, + SAMPLE_TIME stLoopEnd) PURE; + + STDMETHOD(StopVoice) (THIS_ REFERENCE_TIME rt, + DWORD dwVoiceId ) PURE; + + STDMETHOD(GetVoiceState) (THIS_ DWORD dwVoice[], + DWORD cbVoice, + DMUS_VOICE_STATE dwVoiceState[] ) PURE; + STDMETHOD(Refresh) (THIS_ DWORD dwDownloadID, + DWORD dwFlags) PURE; + STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup, + DWORD dwChannel, + LPDWORD pdwBuses, + DWORD cBuses) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectMusicSynthSink +DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown) +{ + /* IUnknown */ + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectMusicSynthSink */ + STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE; + STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE; + STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE; + STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE; + STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime, + REFERENCE_TIME *prfTime) PURE; + STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, + LONGLONG *pllSampleTime) PURE; + STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, + LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE; + STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE; +}; + +DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); +DEFINE_GUID(IID_IDirectMusicSynth8,0x53cab625, 0x2711, 0x4c9f, 0x9d, 0xe7, 0x1b, 0x7f, 0x92, 0x5f, 0x6f, 0xc8); +DEFINE_GUID(IID_IDirectMusicSynthSink,0x9823663, 0x5c85, 0x11d2, 0xaf, 0xa6, 0x0, 0xaa, 0x0, 0x24, 0xd8, 0xb6); + +/* Property Set GUID_DMUS_PROP_SetSynthSink + * + * Item 0: An IUnknown on which the port can QueryInterface for a user-mode synth sink. + */ +DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink,0x0a3a5ba5, 0x37b6, 0x11d2, 0xb9, 0xf9, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +/* Property Set GUID_DMUS_PROP_SinkUsesDSound + * + * Item 0: A DWORD boolean indicating whether or not the sink requires an IDirectSound interface. The + * default is FALSE if this property item is not implemented by the sink. + */ +DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xbe208857, 0x8952, 0x11d2, 0xba, 0x1c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12); + +#endif diff --git a/SDK/dxSDK/Include/dpaddr.h b/SDK/dxSDK/Include/dpaddr.h new file mode 100644 index 00000000..6e3fccf6 --- /dev/null +++ b/SDK/dxSDK/Include/dpaddr.h @@ -0,0 +1,392 @@ +/*==========================================================================; + * + * Copyright (C) 2000-2002 Microsoft Corporation. All Rights Reserved. + * + * File: dpaddr.h + * Content: DirectPlayAddress include file + ***************************************************************************/ + +#ifndef __DIRECTPLAYADDRESS__ +#define __DIRECTPLAYADDRESS__ + +#include // for DECLARE_INTERFACE_ and HRESULT + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dplay8.h" + + + +/**************************************************************************** + * + * DirectPlay8Address CLSIDs + * + ****************************************************************************/ + +// {934A9523-A3CA-4bc5-ADA0-D6D95D979421} +DEFINE_GUID(CLSID_DirectPlay8Address, +0x934a9523, 0xa3ca, 0x4bc5, 0xad, 0xa0, 0xd6, 0xd9, 0x5d, 0x97, 0x94, 0x21); + + +/**************************************************************************** + * + * DirectPlay8Address Interface IIDs + * + ****************************************************************************/ + + +typedef REFIID DPNAREFIID; + +// {83783300-4063-4c8a-9DB3-82830A7FEB31} +DEFINE_GUID(IID_IDirectPlay8Address, +0x83783300, 0x4063, 0x4c8a, 0x9d, 0xb3, 0x82, 0x83, 0xa, 0x7f, 0xeb, 0x31); + +// {E5A0E990-2BAD-430b-87DA-A142CF75DE58} +DEFINE_GUID(IID_IDirectPlay8AddressIP, +0xe5a0e990, 0x2bad, 0x430b, 0x87, 0xda, 0xa1, 0x42, 0xcf, 0x75, 0xde, 0x58); + + + +/**************************************************************************** + * + * DirectPlay8Address Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlay8Address *PDIRECTPLAY8ADDRESS, *LPDIRECTPLAY8ADDRESS; +typedef struct IDirectPlay8AddressIP *PDIRECTPLAY8ADDRESSIP, *LPDIRECTPLAY8ADDRESSIP; + + +/**************************************************************************** + * + * DirectPlay8Address Forward Declarations For External Types + * + ****************************************************************************/ + +typedef struct sockaddr SOCKADDR; + +/**************************************************************************** + * + * DirectPlay8Address Constants + * + ****************************************************************************/ +// +// Asynchronous operation flags +// +#define DPNA_DATATYPE_STRING 0x00000001 +#define DPNA_DATATYPE_DWORD 0x00000002 +#define DPNA_DATATYPE_GUID 0x00000003 +#define DPNA_DATATYPE_BINARY 0x00000004 +#define DPNA_DATATYPE_STRING_ANSI 0x00000005 + +#define DPNA_DPNSVR_PORT 6073 + +#define DPNA_INDEX_INVALID 0xFFFFFFFF + +/**************************************************************************** + * + * DirectPlay8Address Address Elements + * + ****************************************************************************/ + +#define DPNA_SEPARATOR_KEYVALUE L'=' +#define DPNA_SEPARATOR_USERDATA L'#' +#define DPNA_SEPARATOR_COMPONENT L';' +#define DPNA_ESCAPECHAR L'%' + +// Header +#define DPNA_HEADER L"x-directplay:/" + +// key names for address components +#define DPNA_KEY_NAT_RESOLVER L"natresolver" +#define DPNA_KEY_NAT_RESOLVER_USER_STRING L"natresolveruserstring" +#define DPNA_KEY_APPLICATION_INSTANCE L"applicationinstance" +#define DPNA_KEY_DEVICE L"device" +#define DPNA_KEY_HOSTNAME L"hostname" +#define DPNA_KEY_PORT L"port" +#define DPNA_KEY_NAMEINFO L"nameinfo" +#define DPNA_KEY_PROCESSOR L"processor" +#define DPNA_KEY_PROGRAM L"program" +#define DPNA_KEY_PROVIDER L"provider" +#define DPNA_KEY_SCOPE L"scope" +#define DPNA_KEY_TRAVERSALMODE L"traversalmode" +#define DPNA_KEY_BAUD L"baud" +#define DPNA_KEY_FLOWCONTROL L"flowcontrol" +#define DPNA_KEY_PARITY L"parity" +#define DPNA_KEY_PHONENUMBER L"phonenumber" +#define DPNA_KEY_STOPBITS L"stopbits" + +// values for baud rate +#define DPNA_BAUD_RATE_9600 9600 +#define DPNA_BAUD_RATE_14400 14400 +#define DPNA_BAUD_RATE_19200 19200 +#define DPNA_BAUD_RATE_38400 38400 +#define DPNA_BAUD_RATE_56000 56000 +#define DPNA_BAUD_RATE_57600 57600 +#define DPNA_BAUD_RATE_115200 115200 + +// values for stop bits +#define DPNA_STOP_BITS_ONE L"1" +#define DPNA_STOP_BITS_ONE_FIVE L"1.5" +#define DPNA_STOP_BITS_TWO L"2" + +// values for parity +#define DPNA_PARITY_NONE L"NONE" +#define DPNA_PARITY_EVEN L"EVEN" +#define DPNA_PARITY_ODD L"ODD" +#define DPNA_PARITY_MARK L"MARK" +#define DPNA_PARITY_SPACE L"SPACE" + +// values for flow control +#define DPNA_FLOW_CONTROL_NONE L"NONE" +#define DPNA_FLOW_CONTROL_XONXOFF L"XONXOFF" +#define DPNA_FLOW_CONTROL_RTS L"RTS" +#define DPNA_FLOW_CONTROL_DTR L"DTR" +#define DPNA_FLOW_CONTROL_RTSDTR L"RTSDTR" +// values for traversal mode +#define DPNA_TRAVERSALMODE_NONE 0 +#define DPNA_TRAVERSALMODE_PORTREQUIRED 1 +#define DPNA_TRAVERSALMODE_PORTRECOMMENDED 2 +// Shortcut values +// +// These can be used instead of the corresponding CLSID_DP8SP_XXXX guids +// +#define DPNA_VALUE_TCPIPPROVIDER L"IP" +#define DPNA_VALUE_IPXPROVIDER L"IPX" +#define DPNA_VALUE_MODEMPROVIDER L"MODEM" +#define DPNA_VALUE_SERIALPROVIDER L"SERIAL" + +//// ANSI DEFINITIONS + +// Header +#define DPNA_HEADER_A "x-directplay:/" +#define DPNA_SEPARATOR_KEYVALUE_A '=' +#define DPNA_SEPARATOR_USERDATA_A '#' +#define DPNA_SEPARATOR_COMPONENT_A ';' +#define DPNA_ESCAPECHAR_A '%' + +// key names for address components +#define DPNA_KEY_NAT_RESOLVER_A "natresolver" +#define DPNA_KEY_NAT_RESOLVER_USER_STRING_A "natresolveruserstring" +#define DPNA_KEY_APPLICATION_INSTANCE_A "applicationinstance" +#define DPNA_KEY_DEVICE_A "device" +#define DPNA_KEY_HOSTNAME_A "hostname" +#define DPNA_KEY_PORT_A "port" +#define DPNA_KEY_NAMEINFO_A "nameinfo" +#define DPNA_KEY_PROCESSOR_A "processor" +#define DPNA_KEY_PROGRAM_A "program" +#define DPNA_KEY_PROVIDER_A "provider" +#define DPNA_KEY_SCOPE_A "scope" +#define DPNA_KEY_TRAVERSALMODE_A "traversalmode" +#define DPNA_KEY_BAUD_A "baud" +#define DPNA_KEY_FLOWCONTROL_A "flowcontrol" +#define DPNA_KEY_PARITY_A "parity" +#define DPNA_KEY_PHONENUMBER_A "phonenumber" +#define DPNA_KEY_STOPBITS_A "stopbits" + +// values for stop bits +#define DPNA_STOP_BITS_ONE_A "1" +#define DPNA_STOP_BITS_ONE_FIVE_A "1.5" +#define DPNA_STOP_BITS_TWO_A "2" + +// values for parity +#define DPNA_PARITY_NONE_A "NONE" +#define DPNA_PARITY_EVEN_A "EVEN" +#define DPNA_PARITY_ODD_A "ODD" +#define DPNA_PARITY_MARK_A "MARK" +#define DPNA_PARITY_SPACE_A "SPACE" + +// values for flow control +#define DPNA_FLOW_CONTROL_NONE_A "NONE" +#define DPNA_FLOW_CONTROL_XONXOFF_A "XONXOFF" +#define DPNA_FLOW_CONTROL_RTS_A "RTS" +#define DPNA_FLOW_CONTROL_DTR_A "DTR" +#define DPNA_FLOW_CONTROL_RTSDTR_A "RTSDTR" +// Shortcut values +// +// These can be used instead of the corresponding CLSID_DP8SP_XXXX guids +// +#define DPNA_VALUE_TCPIPPROVIDER_A "IP" +#define DPNA_VALUE_IPXPROVIDER_A "IPX" +#define DPNA_VALUE_MODEMPROVIDER_A "MODEM" +#define DPNA_VALUE_SERIALPROVIDER_A "SERIAL" + +/**************************************************************************** + * + * DirectPlay8Address Functions + * + ****************************************************************************/ + + +/* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 address objects. + * + * HRESULT WINAPI DirectPlay8AddressCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + + +/**************************************************************************** + * + * DirectPlay8Address Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for IDirectPlay8Address Generic Interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Address +DECLARE_INTERFACE_(IDirectPlay8Address,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DPNAREFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlay8Address methods ***/ + STDMETHOD(BuildFromURLW)(THIS_ WCHAR *pwszSourceURL ) PURE; + STDMETHOD(BuildFromURLA)(THIS_ CHAR *pszSourceURL ) PURE; + STDMETHOD(Duplicate)(THIS_ PDIRECTPLAY8ADDRESS *ppdpaNewAddress ) PURE; + STDMETHOD(SetEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE; + STDMETHOD(IsEqual)(THIS_ PDIRECTPLAY8ADDRESS pdpaAddress ) PURE; + STDMETHOD(Clear)(THIS ) PURE; + STDMETHOD(GetURLW)(THIS_ WCHAR *pwszURL, PDWORD pdwNumChars ) PURE; + STDMETHOD(GetURLA)(THIS_ CHAR *pszURL, PDWORD pdwNumChars) PURE; + STDMETHOD(GetSP)(THIS_ GUID *pguidSP ) PURE; + STDMETHOD(GetUserData)(THIS_ void *pvUserData, PDWORD pdwBufferSize) PURE; + STDMETHOD(SetSP)(THIS_ const GUID * const pguidSP ) PURE; + STDMETHOD(SetUserData)(THIS_ const void * const pvUserData, const DWORD dwDataSize) PURE; + STDMETHOD(GetNumComponents)(THIS_ PDWORD pdwNumComponents ) PURE; + STDMETHOD(GetComponentByName)(THIS_ const WCHAR * const pwszName, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE; + STDMETHOD(GetComponentByIndex)(THIS_ const DWORD dwComponentID, WCHAR * pwszName, PDWORD pdwNameLen, void *pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType ) PURE; + STDMETHOD(AddComponent)(THIS_ const WCHAR * const pwszName, const void * const lpvData, const DWORD dwDataSize, const DWORD dwDataType ) PURE; + STDMETHOD(GetDevice)(THIS_ GUID * ) PURE; + STDMETHOD(SetDevice)(THIS_ const GUID * const) PURE; + STDMETHOD(BuildFromDPADDRESS)( THIS_ LPVOID pvAddress, DWORD dwDataSize ) PURE; +}; + +// +// COM definition for IDirectPlay8AddressIP Generic Interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8AddressIP +DECLARE_INTERFACE_(IDirectPlay8AddressIP,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DPNAREFIID, PVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlay8AddressIP methods ***/ + + // Constructs a IDirectPlay8 TCP Address from a SOCKADDR structure + STDMETHOD(BuildFromSockAddr)(THIS_ const SOCKADDR * const ) PURE; + + // Constructs a TCP Address from a string (hostname) and port + STDMETHOD(BuildAddress)(THIS_ const WCHAR * const wszAddress, const USHORT usPort ) PURE; + + // Builds a local TCP Address + STDMETHOD(BuildLocalAddress)(THIS_ const GUID * const pguidAdapter, const USHORT usPort ) PURE; + + // Gets the address from the structure in SOCKADR format + STDMETHOD(GetSockAddress)(THIS_ SOCKADDR *, PDWORD ) PURE; + + // Gets the local afddress + STDMETHOD(GetLocalAddress)(THIS_ GUID *pguidAdapter, USHORT *pusPort ) PURE; + + // Gets the remote address + STDMETHOD(GetAddress)(THIS_ WCHAR *wszAddress, PDWORD pdwAddressLength, USHORT *psPort ) PURE; +}; + + +/**************************************************************************** + * + * IDirectPlay8 application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8Address_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Address_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Address_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Address_BuildFromURLW(p,a) (p)->lpVtbl->BuildFromURLW(p,a) +#define IDirectPlay8Address_BuildFromURLA(p,a) (p)->lpVtbl->BuildFromURLA(p,a) +#define IDirectPlay8Address_Duplicate(p,a) (p)->lpVtbl->Duplicate(p,a) +#define IDirectPlay8Address_SetEqual(p,a) (p)->lpVtbl->SetEqual(p,a) +#define IDirectPlay8Address_IsEqual(p,a) (p)->lpVtbl->IsEqual(p,a) +#define IDirectPlay8Address_Clear(p) (p)->lpVtbl->Clear(p) +#define IDirectPlay8Address_GetURLW(p,a,b) (p)->lpVtbl->GetURLW(p,a,b) +#define IDirectPlay8Address_GetURLA(p,a,b) (p)->lpVtbl->GetURLA(p,a,b) +#define IDirectPlay8Address_GetSP(p,a) (p)->lpVtbl->GetSP(p,a) +#define IDirectPlay8Address_GetUserData(p,a,b) (p)->lpVtbl->GetUserData(p,a,b) +#define IDirectPlay8Address_SetSP(p,a) (p)->lpVtbl->SetSP(p,a) +#define IDirectPlay8Address_SetUserData(p,a,b) (p)->lpVtbl->SetUserData(p,a,b) +#define IDirectPlay8Address_GetNumComponents(p,a) (p)->lpVtbl->GetNumComponents(p,a) +#define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->lpVtbl->GetComponentByName(p,a,b,c,d) +#define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->lpVtbl->GetComponentByIndex(p,a,b,c,d,e,f) +#define IDirectPlay8Address_AddComponent(p,a,b,c,d) (p)->lpVtbl->AddComponent(p,a,b,c,d) +#define IDirectPlay8Address_SetDevice(p,a) (p)->lpVtbl->SetDevice(p,a) +#define IDirectPlay8Address_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b) (p)->lpVtbl->BuildFromDirectPlay4Address(p,a,b) + +#define IDirectPlay8AddressIP_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8AddressIP_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8AddressIP_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8AddressIP_BuildFromSockAddr(p,a) (p)->lpVtbl->BuildFromSockAddr(p,a) +#define IDirectPlay8AddressIP_BuildAddress(p,a,b) (p)->lpVtbl->BuildAddress(p,a,b) +#define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b) (p)->lpVtbl->BuildLocalAddress(p,a,b) +#define IDirectPlay8AddressIP_GetSockAddress(p,a,b) (p)->lpVtbl->GetSockAddress(p,a,b) +#define IDirectPlay8AddressIP_GetLocalAddress(p,a,b) (p)->lpVtbl->GetLocalAddress(p,a,b) +#define IDirectPlay8AddressIP_GetAddress(p,a,b,c) (p)->lpVtbl->GetAddress(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8Address_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Address_AddRef(p) (p)->AddRef() +#define IDirectPlay8Address_Release(p) (p)->Release() +#define IDirectPlay8Address_BuildFromURLW(p,a) (p)->BuildFromURLW(a) +#define IDirectPlay8Address_BuildFromURLA(p,a) (p)->BuildFromURLA(a) +#define IDirectPlay8Address_Duplicate(p,a) (p)->Duplicate(a) +#define IDirectPlay8Address_SetEqual(p,a) (p)->SetEqual(a) +#define IDirectPlay8Address_IsEqual(p,a) (p)->IsEqual(a) +#define IDirectPlay8Address_Clear(p) (p)->Clear() +#define IDirectPlay8Address_GetURLW(p,a,b) (p)->GetURLW(a,b) +#define IDirectPlay8Address_GetURLA(p,a,b) (p)->GetURLA(a,b) +#define IDirectPlay8Address_GetSP(p,a) (p)->GetSP(a) +#define IDirectPlay8Address_GetUserData(p,a,b) (p)->GetUserData(a,b) +#define IDirectPlay8Address_SetSP(p,a) (p)->SetSP(a) +#define IDirectPlay8Address_SetUserData(p,a,b) (p)->SetUserData(a,b) +#define IDirectPlay8Address_GetNumComponents(p,a) (p)->GetNumComponents(a) +#define IDirectPlay8Address_GetComponentByName(p,a,b,c,d) (p)->GetComponentByName(a,b,c,d) +#define IDirectPlay8Address_GetComponentByIndex(p,a,b,c,d,e,f) (p)->GetComponentByIndex(a,b,c,d,e,f) +#define IDirectPlay8Address_AddComponent(p,a,b,c,d) (p)->AddComponent(a,b,c,d) +#define IDirectPlay8Address_SetDevice(p,a) (p)->SetDevice(a) +#define IDirectPlay8Address_GetDevice(p,a) (p)->GetDevice(a) +#define IDirectPlay8Address_BuildFromDirectPlay4Address(p,a,b) (p)->BuildFromDirectPlay4Address(a,b) + +#define IDirectPlay8AddressIP_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8AddressIP_AddRef(p) (p)->AddRef() +#define IDirectPlay8AddressIP_Release(p) (p)->Release() +#define IDirectPlay8AddressIP_BuildFromSockAddr(p,a) (p)->BuildFromSockAddr(a) +#define IDirectPlay8AddressIP_BuildAddress(p,a,b) (p)->BuildAddress(a,b) +#define IDirectPlay8AddressIP_BuildLocalAddress(p,a,b) (p)->BuildLocalAddress(a,b) +#define IDirectPlay8AddressIP_GetSockAddress(p,a,b) (p)->GetSockAddress(a,b) +#define IDirectPlay8AddressIP_GetLocalAddress(p,a,b) (p)->GetLocalAddress(a,b) +#define IDirectPlay8AddressIP_GetAddress(p,a,b,c) (p)->GetAddress(a,b,c) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/dplay.h b/SDK/dxSDK/Include/dplay.h new file mode 100644 index 00000000..d91c0a5e --- /dev/null +++ b/SDK/dxSDK/Include/dplay.h @@ -0,0 +1,2154 @@ +/*==========================================================================; + * + * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dplay.h + * Content: DirectPlay include file + * + ***************************************************************************/ + +#ifndef __DPLAY_INCLUDED__ +#define __DPLAY_INCLUDED__ + +#include // for DECLARE_INTERFACE and HRESULT + +/* avoid warnings in MSVC at Level4 */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) + + +/* + * Some types + */ + +#ifndef _WIN64 +#define DWORD_PTR DWORD +#endif + +typedef LPVOID (*LPRGLPVOID)[]; +typedef LPRGLPVOID PRGPVOID, LPRGPVOID, PRGLPVOID, PAPVOID, LPAPVOID, PALPVOID, LPALPVOID; + +#define VOL volatile +typedef VOID *VOL LPVOIDV; + + +#define _FACDP 0x877 +#define MAKE_DPHRESULT( code ) MAKE_HRESULT( 1, _FACDP, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GUIDS used by DirectPlay objects + */ +DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); +DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +DEFINE_GUID(IID_IDirectPlay3, 0x133efe40, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); +DEFINE_GUID(IID_IDirectPlay3A,0x133efe41, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +DEFINE_GUID(IID_IDirectPlay4, 0xab1c530, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +DEFINE_GUID(IID_IDirectPlay4A,0xab1c531, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + +// {D1EB6D20-8923-11d0-9D97-00A0C90A43CB} +DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20, 0x8923, 0x11d0, 0x9d, 0x97, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +/* + * GUIDS used by Service Providers shipped with DirectPlay + * Use these to identify Service Provider returned by EnumConnections + */ + +// GUID for IPX service provider +// {685BC400-9D2C-11cf-A9CD-00AA006886E3} +DEFINE_GUID(DPSPGUID_IPX, +0x685bc400, 0x9d2c, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); + +// GUID for TCP/IP service provider +// 36E95EE0-8577-11cf-960C-0080C7534E82 +DEFINE_GUID(DPSPGUID_TCPIP, +0x36E95EE0, 0x8577, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +// GUID for Serial service provider +// {0F1D6860-88D9-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_SERIAL, +0xf1d6860, 0x88d9, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// GUID for Modem service provider +// {44EAA760-CB68-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_MODEM, +0x44eaa760, 0xcb68, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/**************************************************************************** + * + * DirectPlay Structures + * + * Various structures used to invoke DirectPlay. + * + ****************************************************************************/ + +#ifndef IDIRECTPLAY2_OR_GREATER +typedef struct IDirectPlay FAR *LPDIRECTPLAY; +#else +typedef struct IUnknown FAR *LPDIRECTPLAY; +#endif + +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2; +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2A; +typedef struct IDirectPlay2 IDirectPlay2A; + +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3; +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3A; +typedef struct IDirectPlay3 IDirectPlay3A; + +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4; +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4A; +typedef struct IDirectPlay4 IDirectPlay4A; + +/* + * DPID + * DirectPlay player and group ID + */ +typedef DWORD DPID, FAR *LPDPID; + +/* + * DPID that system messages come from + */ +#define DPID_SYSMSG 0 + +/* + * DPID representing all players in the session + */ +#define DPID_ALLPLAYERS 0 + +/* + * DPID representing the server player + */ +#define DPID_SERVERPLAYER 1 + + +/* + * DPID representing the maxiumum ID in the range of DPID's reserved for + * use by DirectPlay. + */ +#define DPID_RESERVEDRANGE 100 + +/* + * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID) + */ +#define DPID_UNKNOWN 0xFFFFFFFF + +/* + * DPCAPS + * Used to obtain the capabilities of a DirectPlay object + */ +typedef struct +{ + DWORD dwSize; // Size of structure, in bytes + DWORD dwFlags; // DPCAPS_xxx flags + DWORD dwMaxBufferSize; // Maximum message size, in bytes, for this service provider + DWORD dwMaxQueueSize; // Obsolete. + DWORD dwMaxPlayers; // Maximum players/groups (local + remote) + DWORD dwHundredBaud; // Bandwidth in 100 bits per second units; + // i.e. 24 is 2400, 96 is 9600, etc. + DWORD dwLatency; // Estimated latency; 0 = unknown + DWORD dwMaxLocalPlayers; // Maximum # of locally created players allowed + DWORD dwHeaderLength; // Maximum header length, in bytes, on messages + // added by the service provider + DWORD dwTimeout; // Service provider's suggested timeout value + // This is how long DirectPlay will wait for + // responses to system messages +} DPCAPS, FAR *LPDPCAPS; + +/* + * This DirectPlay object is the session host. If the host exits the + * session, another application will become the host and receive a + * DPSYS_HOST system message. + */ +#define DPCAPS_ISHOST 0x00000002 + +/* + * The service provider bound to this DirectPlay object can optimize + * group messaging. + */ +#define DPCAPS_GROUPOPTIMIZED 0x00000008 + +/* + * The service provider bound to this DirectPlay object can optimize + * keep alives (see DPSESSION_KEEPALIVE) + */ +#define DPCAPS_KEEPALIVEOPTIMIZED 0x00000010 + +/* + * The service provider bound to this DirectPlay object can optimize + * guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDOPTIMIZED 0x00000020 + +/* + * This DirectPlay object supports guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDSUPPORTED 0x00000040 + +/* + * This DirectPlay object supports digital signing of messages. + */ +#define DPCAPS_SIGNINGSUPPORTED 0x00000080 + +/* + * This DirectPlay object supports encryption of messages. + */ +#define DPCAPS_ENCRYPTIONSUPPORTED 0x00000100 + +/* + * This DirectPlay player was created on this machine + */ +#define DPPLAYERCAPS_LOCAL 0x00000800 + +/* + * Current Open settings supports all forms of Cancel + */ +#define DPCAPS_ASYNCCANCELSUPPORTED 0x00001000 + +/* + * Current Open settings supports CancelAll, but not Cancel + */ +#define DPCAPS_ASYNCCANCELALLSUPPORTED 0x00002000 + +/* + * Current Open settings supports Send Timeouts for sends + */ +#define DPCAPS_SENDTIMEOUTSUPPORTED 0x00004000 + +/* + * Current Open settings supports send priority + */ +#define DPCAPS_SENDPRIORITYSUPPORTED 0x00008000 + +/* + * Current Open settings supports DPSEND_ASYNC flag + */ +#define DPCAPS_ASYNCSUPPORTED 0x00010000 + + +/* + * DPSESSIONDESC2 + * Used to describe the properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // DPSESSION_xxx flags + GUID guidInstance; // ID for the session instance + GUID guidApplication; // GUID of the DirectPlay application. + // GUID_NULL for all applications. + DWORD dwMaxPlayers; // Maximum # players allowed in session + DWORD dwCurrentPlayers; // Current # players in session (read only) + union + { // Name of the session + LPWSTR lpszSessionName; // Unicode + LPSTR lpszSessionNameA; // ANSI + }; + union + { // Password of the session (optional) + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + DWORD_PTR dwReserved1; // Reserved for future MS use. + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; // For use by the application + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC2, FAR *LPDPSESSIONDESC2; + +typedef DPSESSIONDESC2 * VOL LPDPSESSIONDESC2_V; + +/* + * LPCDPSESSIONDESC2 + * A constant pointer to DPSESSIONDESC2 + */ +typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2; + +/* + * Applications cannot create new players in this session. + */ +#define DPSESSION_NEWPLAYERSDISABLED 0x00000001 + +/* + * If the DirectPlay object that created the session, the host, + * quits, then the host will attempt to migrate to another + * DirectPlay object so that new players can continue to be created + * and new applications can join the session. + */ +#define DPSESSION_MIGRATEHOST 0x00000004 + +/* + * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom + * fields in player messages. This cuts two DWORD's off the message + * overhead. + */ +#define DPSESSION_NOMESSAGEID 0x00000008 + + +/* + * This flag tells DirectPlay to not allow any new applications to + * join the session. Applications already in the session can still + * create new players. + */ +#define DPSESSION_JOINDISABLED 0x00000020 + +/* + * This flag tells DirectPlay to detect when remote players + * exit abnormally (e.g. their computer or modem gets unplugged) + */ +#define DPSESSION_KEEPALIVE 0x00000040 + +/* + * This flag tells DirectPlay not to send a message to all players + * when a players remote data changes + */ +#define DPSESSION_NODATAMESSAGES 0x00000080 + +/* + * This flag indicates that the session belongs to a secure server + * and needs user authentication + */ +#define DPSESSION_SECURESERVER 0x00000100 + +/* + * This flag indicates that the session is private and requirs a password + * for EnumSessions as well as Open. + */ +#define DPSESSION_PRIVATE 0x00000200 + +/* + * This flag indicates that the session requires a password for joining. + */ +#define DPSESSION_PASSWORDREQUIRED 0x00000400 + +/* + * This flag tells DirectPlay to route all messages through the server + */ +#define DPSESSION_MULTICASTSERVER 0x00000800 + +/* + * This flag tells DirectPlay to only download information about the + * DPPLAYER_SERVERPLAYER. + */ +#define DPSESSION_CLIENTSERVER 0x00001000 + +/* + * This flag tells DirectPlay to use the protocol built into dplay + * for reliability and statistics all the time. When this bit is + * set, only other sessions with this bit set can join or be joined. + */ +#define DPSESSION_DIRECTPLAYPROTOCOL 0x00002000 + +/* + * This flag tells DirectPlay that preserving order of received + * packets is not important, when using reliable delivery. This + * will allow messages to be indicated out of order if preceding + * messages have not yet arrived. Otherwise DPLAY will wait for + * earlier messages before delivering later reliable messages. + */ +#define DPSESSION_NOPRESERVEORDER 0x00004000 + + +/* + * This flag tells DirectPlay to optimize communication for latency + */ +#define DPSESSION_OPTIMIZELATENCY 0x00008000 + +/* + * This flag allows lobby launched games that aren't voice enabled + * to get voice capabilities. + */ +#define DPSESSION_ALLOWVOICERETRO 0x00010000 + +/* + * This flag supresses transmission of session desc changes. + * DPSESSION_NODATAMESSAGES was supposed to do that, but SetSessionDesc + * was ignoring the flag and some apps depended on the broken behavior, this + * flag allows applications to get the right behaviour without breaking apps depending + * on old broken behavior. + */ +#define DPSESSION_NOSESSIONDESCMESSAGES 0x00020000 + +/* + * DPNAME + * Used to hold the name of a DirectPlay entity + * like a player or a group + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // The short or friendly name + LPWSTR lpszShortName; // Unicode + LPSTR lpszShortNameA; // ANSI + }; + union + { // The long or formal name + LPWSTR lpszLongName; // Unicode + LPSTR lpszLongNameA; // ANSI + }; + +} DPNAME, FAR *LPDPNAME; + +/* + * LPCDPNAME + * A constant pointer to DPNAME + */ +typedef const DPNAME FAR *LPCDPNAME; + +/* + * DPCREDENTIALS + * Used to hold the user name and password of a DirectPlay user + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // User name of the account + LPWSTR lpszUsername; // Unicode + LPSTR lpszUsernameA; // ANSI + }; + union + { // Password of the account + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + union + { // Domain name of the account + LPWSTR lpszDomain; // Unicode + LPSTR lpszDomainA; // ANSI + }; +} DPCREDENTIALS, FAR *LPDPCREDENTIALS; + +typedef const DPCREDENTIALS FAR *LPCDPCREDENTIALS; + +/* + * DPSECURITYDESC + * Used to describe the security properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // SSPI provider name + LPWSTR lpszSSPIProvider; // Unicode + LPSTR lpszSSPIProviderA; // ANSI + }; + union + { // CAPI provider name + LPWSTR lpszCAPIProvider; // Unicode + LPSTR lpszCAPIProviderA; // ANSI + }; + DWORD dwCAPIProviderType; // Crypto Service Provider type + DWORD dwEncryptionAlgorithm; // Encryption Algorithm type +} DPSECURITYDESC, FAR *LPDPSECURITYDESC; + +typedef const DPSECURITYDESC FAR *LPCDPSECURITYDESC; + +/* + * DPACCOUNTDESC + * Used to describe a user membership account + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // Account identifier + LPWSTR lpszAccountID; // Unicode + LPSTR lpszAccountIDA; // ANSI + }; +} DPACCOUNTDESC, FAR *LPDPACCOUNTDESC; + +typedef const DPACCOUNTDESC FAR *LPCDPACCOUNTDESC; + +/* + * LPCGUID + * A constant pointer to a guid + */ +typedef const GUID FAR *LPCGUID; + +/* + * DPLCONNECTION + * Used to hold all in the informaion needed to connect + * an application to a session or create a session + */ +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags specific to this structure + LPDPSESSIONDESC2 lpSessionDesc; // Pointer to session desc to use on connect + LPDPNAME lpPlayerName; // Pointer to Player name structure + GUID guidSP; // GUID of the DPlay SP to use + LPVOID lpAddress; // Address for service provider + DWORD dwAddressSize; // Size of address data +} DPLCONNECTION, FAR *LPDPLCONNECTION; + +/* + * LPCDPLCONNECTION + * A constant pointer to DPLCONNECTION + */ +typedef const DPLCONNECTION FAR *LPCDPLCONNECTION; + +/* + * DPCHAT + * Used to hold the a DirectPlay chat message + */ +typedef struct +{ + DWORD dwSize; + DWORD dwFlags; + union + { // Message string + LPWSTR lpszMessage; // Unicode + LPSTR lpszMessageA; // ANSI + }; +} DPCHAT, FAR * LPDPCHAT; + +/* + * SGBUFFER + * Scatter Gather Buffer used for SendEx + */ +typedef struct +{ + UINT len; // length of buffer data + PUCHAR pData; // pointer to buffer data +} SGBUFFER, *PSGBUFFER, FAR *LPSGBUFFER; + + +/**************************************************************************** + * + * Prototypes for DirectPlay callback functions + * + ****************************************************************************/ + +/* + * Callback for IDirectPlay2::EnumSessions + */ +typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)( + LPCDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, + DWORD dwFlags, + LPVOID lpContext ); + +/* + * This flag is set on the EnumSessions callback dwFlags parameter when + * the time out has occurred. There will be no session data for this + * callback. If *lpdwTimeOut is set to a non-zero value and the + * EnumSessionsCallback function returns TRUE then EnumSessions will + * continue waiting until the next timeout occurs. Timeouts are in + * milliseconds. + */ +#define DPESC_TIMEDOUT 0x00000001 + + +/* + * Callback for IDirectPlay2::EnumPlayers + * IDirectPlay2::EnumGroups + * IDirectPlay2::EnumGroupPlayers + */ +typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)( + DPID dpId, + DWORD dwPlayerType, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ); + + +/* + * Unicode callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for Unicode strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)( + LPGUID lpguidSP, + LPWSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * ANSI callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for ANSI strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)( + LPGUID lpguidSP, + LPSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * Callback for IDirectPlay3(A)::EnumConnections + */ +typedef BOOL (FAR PASCAL * LPDPENUMCONNECTIONSCALLBACK)( + LPCGUID lpguidSP, + LPVOID lpConnection, + DWORD dwConnectionSize, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext); + + +/* + * API's + */ + +#ifdef UNICODE +#define DirectPlayEnumerate DirectPlayEnumerateW +#else +#define DirectPlayEnumerate DirectPlayEnumerateA +#endif // UNICODE + +extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID ); +extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID ); +extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk); + +/**************************************************************************** + * + * IDirectPlay2 (and IDirectPlay2A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay2 +DECLARE_INTERFACE_( IDirectPlay2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay2 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay2_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay2_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) + +#else /* C++ */ + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay2_AddRef(p) (p)->AddRef() +#define IDirectPlay2_Release(p) (p)->Release() +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay2_Close(p) (p)->Close() +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay2_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay2_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay3 (and IDirectPlay3A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay3 +DECLARE_INTERFACE_( IDirectPlay3, IDirectPlay2 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay3 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay3_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay3_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay3_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) + +#else /* C++ */ + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay3_AddRef(p) (p)->AddRef() +#define IDirectPlay3_Release(p) (p)->Release() +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay3_Close(p) (p)->Close() +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay3_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay3_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay4 (and IDirectPlay4A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay4 +DECLARE_INTERFACE_( IDirectPlay4, IDirectPlay3 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; + /*** IDirectPlay4 methods ***/ + STDMETHOD(GetGroupOwner) (THIS_ DPID, LPDPID) PURE; + STDMETHOD(SetGroupOwner) (THIS_ DPID, DPID) PURE; + STDMETHOD(SendEx) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD, DWORD, DWORD, LPVOID, DWORD_PTR *) PURE; + STDMETHOD(GetMessageQueue) (THIS_ DPID, DPID, DWORD, LPDWORD, LPDWORD) PURE; + STDMETHOD(CancelMessage) (THIS_ DWORD, DWORD) PURE; + STDMETHOD(CancelPriority) (THIS_ DWORD, DWORD, DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayX interface macros (for IDirectPlay4 and beyond) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayX_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayX_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->lpVtbl->CancelMessage(p,a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->lpVtbl->CancelPriority(p,a,b,c) +#define IDirectPlayX_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->lpVtbl->GetMessageQueue(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlayX_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlayX_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->SendEx(p,a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->lpVtbl->GetGroupOwner(p,a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->lpVtbl->SetGroupOwner(p,a,b) + +#else /* C++ */ + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayX_AddRef(p) (p)->AddRef() +#define IDirectPlayX_Release(p) (p)->Release() +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->CancelMessage(a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->CancelPriority(a,b,c) +#define IDirectPlayX_Close(p) (p)->Close() +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->GetMessageQueue(a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlayX_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlayX_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->SendEx(a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->GetGroupOwner(a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->SetGroupOwner(a,b) + +#endif + +/**************************************************************************** + * + * EnumConnections API flags + * + ****************************************************************************/ + +/* + * Enumerate Service Providers + */ +#define DPCONNECTION_DIRECTPLAY 0x00000001 + +/* + * Enumerate Lobby Providers + */ +#define DPCONNECTION_DIRECTPLAYLOBBY 0x00000002 + + +/**************************************************************************** + * + * EnumPlayers API flags + * + ****************************************************************************/ + +/* + * Enumerate all players in the current session + */ +#define DPENUMPLAYERS_ALL 0x00000000 +#define DPENUMGROUPS_ALL DPENUMPLAYERS_ALL + + +/* + * Enumerate only local (created by this application) players + * or groups + */ +#define DPENUMPLAYERS_LOCAL 0x00000008 +#define DPENUMGROUPS_LOCAL DPENUMPLAYERS_LOCAL + +/* + * Enumerate only remote (non-local) players + * or groups + */ +#define DPENUMPLAYERS_REMOTE 0x00000010 +#define DPENUMGROUPS_REMOTE DPENUMPLAYERS_REMOTE + +/* + * Enumerate groups along with the players + */ +#define DPENUMPLAYERS_GROUP 0x00000020 + +/* + * Enumerate players or groups in another session + * (must supply lpguidInstance) + */ +#define DPENUMPLAYERS_SESSION 0x00000080 +#define DPENUMGROUPS_SESSION DPENUMPLAYERS_SESSION + +/* + * Enumerate server players + */ +#define DPENUMPLAYERS_SERVERPLAYER 0x00000100 + +/* + * Enumerate spectator players + */ +#define DPENUMPLAYERS_SPECTATOR 0x00000200 + +/* + * Enumerate shortcut groups + */ +#define DPENUMGROUPS_SHORTCUT 0x00000400 + +/* + * Enumerate staging area groups + */ +#define DPENUMGROUPS_STAGINGAREA 0x00000800 + +/* + * Enumerate hidden groups + */ +#define DPENUMGROUPS_HIDDEN 0x00001000 + +/* + * Enumerate the group's owner + */ +#define DPENUMPLAYERS_OWNER 0x00002000 + + +/**************************************************************************** + * + * CreatePlayer API flags + * + ****************************************************************************/ + +/* + * This flag indicates that this player should be designated + * the server player. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SERVERPLAYER DPENUMPLAYERS_SERVERPLAYER + +/* + * This flag indicates that this player should be designated + * a spectator. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SPECTATOR DPENUMPLAYERS_SPECTATOR + +/* + * This flag indicates that this player was created locally. + * (returned from GetPlayerFlags) + */ +#define DPPLAYER_LOCAL DPENUMPLAYERS_LOCAL + +/* + * This flag indicates that this player is the group's owner + * (Only returned in EnumGroupPlayers) + */ +#define DPPLAYER_OWNER DPENUMPLAYERS_OWNER + +/**************************************************************************** + * + * CreateGroup API flags + * + ****************************************************************************/ + + +/* + * This flag indicates that the StartSession can be called on the group. + * The app should specify this at CreateGroup, or CreateGroupInGroup. + */ +#define DPGROUP_STAGINGAREA DPENUMGROUPS_STAGINGAREA + +/* + * This flag indicates that this group was created locally. + * (returned from GetGroupFlags) + */ +#define DPGROUP_LOCAL DPENUMGROUPS_LOCAL + +/* + * This flag indicates that this group was created hidden. + */ +#define DPGROUP_HIDDEN DPENUMGROUPS_HIDDEN + + +/**************************************************************************** + * + * EnumSessions API flags + * + ****************************************************************************/ + +/* + * Enumerate sessions which can be joined + */ +#define DPENUMSESSIONS_AVAILABLE 0x00000001 + +/* + * Enumerate all sessions even if they can't be joined. + */ +#define DPENUMSESSIONS_ALL 0x00000002 + + +/* + * Start an asynchronous enum sessions + */ + #define DPENUMSESSIONS_ASYNC 0x00000010 + +/* + * Stop an asynchronous enum sessions + */ + #define DPENUMSESSIONS_STOPASYNC 0x00000020 + +/* + * Enumerate sessions even if they require a password + */ + #define DPENUMSESSIONS_PASSWORDREQUIRED 0x00000040 + +/* + * Return status about progress of enumeration instead of + * showing any status dialogs. + */ + #define DPENUMSESSIONS_RETURNSTATUS 0x00000080 + +/**************************************************************************** + * + * GetCaps and GetPlayerCaps API flags + * + ****************************************************************************/ + +/* + * The latency returned should be for guaranteed message sending. + * Default is non-guaranteed messaging. + */ +#define DPGETCAPS_GUARANTEED 0x00000001 + + +/**************************************************************************** + * + * GetGroupData, GetPlayerData API flags + * Remote and local Group/Player data is maintained separately. + * Default is DPGET_REMOTE. + * + ****************************************************************************/ + +/* + * Get the remote data (set by any DirectPlay object in + * the session using DPSET_REMOTE) + */ +#define DPGET_REMOTE 0x00000000 + +/* + * Get the local data (set by this DirectPlay object + * using DPSET_LOCAL) + */ +#define DPGET_LOCAL 0x00000001 + + +/**************************************************************************** + * + * Open API flags + * + ****************************************************************************/ + +/* + * Join the session that is described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_JOIN 0x00000001 + +/* + * Create a new session as described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_CREATE 0x00000002 + +/* + * Return status about progress of open instead of showing + * any status dialogs. + */ + #define DPOPEN_RETURNSTATUS DPENUMSESSIONS_RETURNSTATUS + + +/**************************************************************************** + * + * DPLCONNECTION flags + * + ****************************************************************************/ + +/* + * This application should create a new session as + * described by the DPSESIONDESC structure + */ +#define DPLCONNECTION_CREATESESSION DPOPEN_CREATE + +/* + * This application should join the session described by + * the DPSESIONDESC structure with the lpAddress data + */ +#define DPLCONNECTION_JOINSESSION DPOPEN_JOIN + +/**************************************************************************** + * + * Receive API flags + * Default is DPRECEIVE_ALL + * + ****************************************************************************/ + +/* + * Get the first message in the queue + */ +#define DPRECEIVE_ALL 0x00000001 + +/* + * Get the first message in the queue directed to a specific player + */ +#define DPRECEIVE_TOPLAYER 0x00000002 + +/* + * Get the first message in the queue from a specific player + */ +#define DPRECEIVE_FROMPLAYER 0x00000004 + +/* + * Get the message but don't remove it from the queue + */ +#define DPRECEIVE_PEEK 0x00000008 + + +/**************************************************************************** + * + * Send API flags + * + ****************************************************************************/ + +/* + * Send the message using a guaranteed send method. + * Default is non-guaranteed. + */ +#define DPSEND_GUARANTEED 0x00000001 + + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_HIGHPRIORITY 0x00000002 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_OPENSTREAM 0x00000008 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_CLOSESTREAM 0x00000010 + +/* + * Send the message digitally signed to ensure authenticity. + */ +#define DPSEND_SIGNED 0x00000020 + +/* + * Send the message with encryption to ensure privacy. + */ +#define DPSEND_ENCRYPTED 0x00000040 + +/* + * The message is a lobby system message + */ +#define DPSEND_LOBBYSYSTEMMESSAGE 0x00000080 + + +/* + * Send message asynchronously, must check caps + * before using this flag. It is always provided + * if the protocol flag is set. + */ +#define DPSEND_ASYNC 0x00000200 + +/* + * When an message is completed, don't tell me. + * by default the application is notified with a system message. + */ +#define DPSEND_NOSENDCOMPLETEMSG 0x00000400 + + +/* + * Maximum priority for sends available to applications + */ +#define DPSEND_MAX_PRI 0x0000FFFF +#define DPSEND_MAX_PRIORITY DPSEND_MAX_PRI + + +/**************************************************************************** + * + * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName, + * SetSessionDesc API flags. + * Default is DPSET_REMOTE. + * + ****************************************************************************/ + +/* + * Propagate the data to all players in the session + */ +#define DPSET_REMOTE 0x00000000 + +/* + * Do not propagate the data to other players + */ +#define DPSET_LOCAL 0x00000001 + +/* + * Used with DPSET_REMOTE, use guaranteed message send to + * propagate the data + */ +#define DPSET_GUARANTEED 0x00000002 + +/**************************************************************************** + * + * GetMessageQueue API flags. + * Default is DPMESSAGEQUEUE_SEND + * + ****************************************************************************/ + +/* + * Get Send Queue - requires Service Provider Support + */ +#define DPMESSAGEQUEUE_SEND 0x00000001 + +/* + * Get Receive Queue + */ +#define DPMESSAGEQUEUE_RECEIVE 0x00000002 + + +/**************************************************************************** + * + * Connect API flags + * + ****************************************************************************/ + + +/* + * Start an asynchronous connect which returns status codes + */ +#define DPCONNECT_RETURNSTATUS (DPENUMSESSIONS_RETURNSTATUS) + + +/**************************************************************************** + * + * DirectPlay system messages and message data structures + * + * All system message come 'From' player DPID_SYSMSG. To determine what type + * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check + * the dwType member against one of the following DPSYS_xxx constants. Once + * a match is found, cast the lpData to the corresponding of the DPMSG_xxx + * structures to access the data of the message. + * + ****************************************************************************/ + +/* + * A new player or group has been created in the session + * Use DPMSG_CREATEPLAYERORGROUP. Check dwPlayerType to see if it + * is a player or a group. + */ +#define DPSYS_CREATEPLAYERORGROUP 0x0003 + +/* + * A player has been deleted from the session + * Use DPMSG_DESTROYPLAYERORGROUP + */ +#define DPSYS_DESTROYPLAYERORGROUP 0x0005 + +/* + * A player has been added to a group + * Use DPMSG_ADDPLAYERTOGROUP + */ +#define DPSYS_ADDPLAYERTOGROUP 0x0007 + +/* + * A player has been removed from a group + * Use DPMSG_DELETEPLAYERFROMGROUP + */ +#define DPSYS_DELETEPLAYERFROMGROUP 0x0021 + +/* + * This DirectPlay object lost its connection with all the + * other players in the session. + * Use DPMSG_SESSIONLOST. + */ +#define DPSYS_SESSIONLOST 0x0031 + +/* + * The current host has left the session. + * This DirectPlay object is now the host. + * Use DPMSG_HOST. + */ +#define DPSYS_HOST 0x0101 + +/* + * The remote data associated with a player or + * group has changed. Check dwPlayerType to see + * if it is a player or a group + * Use DPMSG_SETPLAYERORGROUPDATA + */ +#define DPSYS_SETPLAYERORGROUPDATA 0x0102 + +/* + * The name of a player or group has changed. + * Check dwPlayerType to see if it is a player + * or a group. + * Use DPMSG_SETPLAYERORGROUPNAME + */ +#define DPSYS_SETPLAYERORGROUPNAME 0x0103 + +/* + * The session description has changed. + * Use DPMSG_SETSESSIONDESC + */ +#define DPSYS_SETSESSIONDESC 0x0104 + +/* + * A group has been added to a group + * Use DPMSG_ADDGROUPTOGROUP + */ +#define DPSYS_ADDGROUPTOGROUP 0x0105 + +/* + * A group has been removed from a group + * Use DPMSG_DELETEGROUPFROMGROUP + */ +#define DPSYS_DELETEGROUPFROMGROUP 0x0106 + +/* + * A secure player-player message has arrived. + * Use DPMSG_SECUREMESSAGE + */ +#define DPSYS_SECUREMESSAGE 0x0107 + +/* + * Start a new session. + * Use DPMSG_STARTSESSION + */ +#define DPSYS_STARTSESSION 0x0108 + +/* + * A chat message has arrived + * Use DPMSG_CHAT + */ +#define DPSYS_CHAT 0x0109 + +/* + * The owner of a group has changed + * Use DPMSG_SETGROUPOWNER + */ +#define DPSYS_SETGROUPOWNER 0x010A + +/* + * An async send has finished, failed or been cancelled + * Use DPMSG_SENDCOMPLETE + */ +#define DPSYS_SENDCOMPLETE 0x010d + + +/* + * Used in the dwPlayerType field to indicate if it applies to a group + * or a player + */ +#define DPPLAYERTYPE_GROUP 0x00000000 +#define DPPLAYERTYPE_PLAYER 0x00000001 + + +/* + * DPMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct +{ + DWORD dwType; // Message type +} DPMSG_GENERIC, FAR *LPDPMSG_GENERIC; + +/* + * DPMSG_CREATEPLAYERORGROUP + * System message generated when a new player or group + * created in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of the player or group + DWORD dwCurrentPlayers; // current # players & groups in session + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data + DPNAME dpnName; // structure with name info + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP; + +/* + * DPMSG_DESTROYPLAYERORGROUP + * System message generated when a player or group is being + * destroyed in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // player ID being deleted + LPVOID lpLocalData; // copy of players local data + DWORD dwLocalDataSize; // sizeof local data + LPVOID lpRemoteData; // copy of players remote data + DWORD dwRemoteDataSize; // sizeof remote data + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPNAME dpnName; // structure with name info + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP; + +/* + * DPMSG_ADDPLAYERTOGROUP + * System message generated when a player is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdGroup; // group ID being added to + DPID dpIdPlayer; // player ID being added +} DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP; + +/* + * DPMSG_DELETEPLAYERFROMGROUP + * System message generated when a player is being + * removed from a group + */ +typedef DPMSG_ADDPLAYERTOGROUP DPMSG_DELETEPLAYERFROMGROUP; +typedef DPMSG_DELETEPLAYERFROMGROUP FAR *LPDPMSG_DELETEPLAYERFROMGROUP; + +/* + * DPMSG_ADDGROUPTOGROUP + * System message generated when a group is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdParentGroup; // group ID being added to + DPID dpIdGroup; // group ID being added +} DPMSG_ADDGROUPTOGROUP, FAR *LPDPMSG_ADDGROUPTOGROUP; + +/* + * DPMSG_DELETEGROUPFROMGROUP + * System message generated when a GROUP is being + * removed from a group + */ +typedef DPMSG_ADDGROUPTOGROUP DPMSG_DELETEGROUPFROMGROUP; +typedef DPMSG_DELETEGROUPFROMGROUP FAR *LPDPMSG_DELETEGROUPFROMGROUP; + +/* + * DPMSG_SETPLAYERORGROUPDATA + * System message generated when remote data for a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data +} DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA; + +/* + * DPMSG_SETPLAYERORGROUPNAME + * System message generated when the name of a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + DPNAME dpnName; // structure with new name info +} DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME; + +/* + * DPMSG_SETSESSIONDESC + * System message generated when session desc has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPSESSIONDESC2 dpDesc; // Session desc +} DPMSG_SETSESSIONDESC, FAR *LPDPMSG_SETSESSIONDESC; + +/* + * DPMSG_HOST + * System message generated when the host has migrated to this + * DirectPlay object. + * + */ +typedef DPMSG_GENERIC DPMSG_HOST; +typedef DPMSG_HOST FAR *LPDPMSG_HOST; + +/* + * DPMSG_SESSIONLOST + * System message generated when the connection to the session is lost. + * + */ +typedef DPMSG_GENERIC DPMSG_SESSIONLOST; +typedef DPMSG_SESSIONLOST FAR *LPDPMSG_SESSIONLOST; + +/* + * DPMSG_SECUREMESSAGE + * System message generated when a player requests a secure send + */ +typedef struct +{ + DWORD dwType; // Message Type + DWORD dwFlags; // Signed/Encrypted + DPID dpIdFrom; // ID of Sending Player + LPVOID lpData; // Player message + DWORD dwDataSize; // Size of player message +} DPMSG_SECUREMESSAGE, FAR *LPDPMSG_SECUREMESSAGE; + +/* + * DPMSG_STARTSESSION + * System message containing all information required to + * start a new session + */ +typedef struct +{ + DWORD dwType; // Message type + LPDPLCONNECTION lpConn; // DPLCONNECTION structure +} DPMSG_STARTSESSION, FAR *LPDPMSG_STARTSESSION; + +/* + * DPMSG_CHAT + * System message containing a chat message + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwFlags; // Message flags + DPID idFromPlayer; // ID of the Sending Player + DPID idToPlayer; // ID of the To Player + DPID idToGroup; // ID of the To Group + LPDPCHAT lpChat; // Pointer to a structure containing the chat message +} DPMSG_CHAT, FAR *LPDPMSG_CHAT; + +/* + * DPMSG_SETGROUPOWNER + * System message generated when the owner of a group has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPID idGroup; // ID of the group + DPID idNewOwner; // ID of the player that is the new owner + DPID idOldOwner; // ID of the player that used to be the owner +} DPMSG_SETGROUPOWNER, FAR *LPDPMSG_SETGROUPOWNER; + +/* + * DPMSG_SENDCOMPLETE + * System message generated when finished with an Async Send message + * + * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't + * change this message w/o changing SENDPARMS. + */ +typedef struct +{ + DWORD dwType; + DPID idFrom; + DPID idTo; + DWORD dwFlags; + DWORD dwPriority; + DWORD dwTimeout; + LPVOID lpvContext; + DWORD dwMsgID; + HRESULT hr; + DWORD dwSendTime; +} DPMSG_SENDCOMPLETE, *LPDPMSG_SENDCOMPLETE; + +/**************************************************************************** + * + * DIRECTPLAY ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ +#define DP_OK S_OK +#define DPERR_ALREADYINITIALIZED MAKE_DPHRESULT( 5 ) +#define DPERR_ACCESSDENIED MAKE_DPHRESULT( 10 ) +#define DPERR_ACTIVEPLAYERS MAKE_DPHRESULT( 20 ) +#define DPERR_BUFFERTOOSMALL MAKE_DPHRESULT( 30 ) +#define DPERR_CANTADDPLAYER MAKE_DPHRESULT( 40 ) +#define DPERR_CANTCREATEGROUP MAKE_DPHRESULT( 50 ) +#define DPERR_CANTCREATEPLAYER MAKE_DPHRESULT( 60 ) +#define DPERR_CANTCREATESESSION MAKE_DPHRESULT( 70 ) +#define DPERR_CAPSNOTAVAILABLEYET MAKE_DPHRESULT( 80 ) +#define DPERR_EXCEPTION MAKE_DPHRESULT( 90 ) +#define DPERR_GENERIC E_FAIL +#define DPERR_INVALIDFLAGS MAKE_DPHRESULT( 120 ) +#define DPERR_INVALIDOBJECT MAKE_DPHRESULT( 130 ) +#define DPERR_INVALIDPARAM E_INVALIDARG +#define DPERR_INVALIDPARAMS DPERR_INVALIDPARAM +#define DPERR_INVALIDPLAYER MAKE_DPHRESULT( 150 ) +#define DPERR_INVALIDGROUP MAKE_DPHRESULT( 155 ) +#define DPERR_NOCAPS MAKE_DPHRESULT( 160 ) +#define DPERR_NOCONNECTION MAKE_DPHRESULT( 170 ) +#define DPERR_NOMEMORY E_OUTOFMEMORY +#define DPERR_OUTOFMEMORY DPERR_NOMEMORY +#define DPERR_NOMESSAGES MAKE_DPHRESULT( 190 ) +#define DPERR_NONAMESERVERFOUND MAKE_DPHRESULT( 200 ) +#define DPERR_NOPLAYERS MAKE_DPHRESULT( 210 ) +#define DPERR_NOSESSIONS MAKE_DPHRESULT( 220 ) +#define DPERR_PENDING E_PENDING +#define DPERR_SENDTOOBIG MAKE_DPHRESULT( 230 ) +#define DPERR_TIMEOUT MAKE_DPHRESULT( 240 ) +#define DPERR_UNAVAILABLE MAKE_DPHRESULT( 250 ) +#define DPERR_UNSUPPORTED E_NOTIMPL +#define DPERR_BUSY MAKE_DPHRESULT( 270 ) +#define DPERR_USERCANCEL MAKE_DPHRESULT( 280 ) +#define DPERR_NOINTERFACE E_NOINTERFACE +#define DPERR_CANNOTCREATESERVER MAKE_DPHRESULT( 290 ) +#define DPERR_PLAYERLOST MAKE_DPHRESULT( 300 ) +#define DPERR_SESSIONLOST MAKE_DPHRESULT( 310 ) +#define DPERR_UNINITIALIZED MAKE_DPHRESULT( 320 ) +#define DPERR_NONEWPLAYERS MAKE_DPHRESULT( 330 ) +#define DPERR_INVALIDPASSWORD MAKE_DPHRESULT( 340 ) +#define DPERR_CONNECTING MAKE_DPHRESULT( 350 ) +#define DPERR_CONNECTIONLOST MAKE_DPHRESULT( 360 ) +#define DPERR_UNKNOWNMESSAGE MAKE_DPHRESULT( 370 ) +#define DPERR_CANCELFAILED MAKE_DPHRESULT( 380 ) +#define DPERR_INVALIDPRIORITY MAKE_DPHRESULT( 390 ) +#define DPERR_NOTHANDLED MAKE_DPHRESULT( 400 ) +#define DPERR_CANCELLED MAKE_DPHRESULT( 410 ) +#define DPERR_ABORTED MAKE_DPHRESULT( 420 ) + + +#define DPERR_BUFFERTOOLARGE MAKE_DPHRESULT( 1000 ) +#define DPERR_CANTCREATEPROCESS MAKE_DPHRESULT( 1010 ) +#define DPERR_APPNOTSTARTED MAKE_DPHRESULT( 1020 ) +#define DPERR_INVALIDINTERFACE MAKE_DPHRESULT( 1030 ) +#define DPERR_NOSERVICEPROVIDER MAKE_DPHRESULT( 1040 ) +#define DPERR_UNKNOWNAPPLICATION MAKE_DPHRESULT( 1050 ) +#define DPERR_NOTLOBBIED MAKE_DPHRESULT( 1070 ) +#define DPERR_SERVICEPROVIDERLOADED MAKE_DPHRESULT( 1080 ) +#define DPERR_ALREADYREGISTERED MAKE_DPHRESULT( 1090 ) +#define DPERR_NOTREGISTERED MAKE_DPHRESULT( 1100 ) + +// +// Security related errors +// +#define DPERR_AUTHENTICATIONFAILED MAKE_DPHRESULT( 2000 ) +#define DPERR_CANTLOADSSPI MAKE_DPHRESULT( 2010 ) +#define DPERR_ENCRYPTIONFAILED MAKE_DPHRESULT( 2020 ) +#define DPERR_SIGNFAILED MAKE_DPHRESULT( 2030 ) +#define DPERR_CANTLOADSECURITYPACKAGE MAKE_DPHRESULT( 2040 ) +#define DPERR_ENCRYPTIONNOTSUPPORTED MAKE_DPHRESULT( 2050 ) +#define DPERR_CANTLOADCAPI MAKE_DPHRESULT( 2060 ) +#define DPERR_NOTLOGGEDIN MAKE_DPHRESULT( 2070 ) +#define DPERR_LOGONDENIED MAKE_DPHRESULT( 2080 ) + + +/**************************************************************************** + * + * dplay 1.0 obsolete structures + interfaces + * Included for compatibility only. New apps should + * use IDirectPlay2 + * + ****************************************************************************/ + +// define this to ignore obsolete interfaces and constants +#ifndef IDIRECTPLAY2_OR_GREATER + +#define DPOPEN_OPENSESSION DPOPEN_JOIN +#define DPOPEN_CREATESESSION DPOPEN_CREATE + +#define DPENUMSESSIONS_PREVIOUS 0x00000004 + +#define DPENUMPLAYERS_PREVIOUS 0x00000004 + +#define DPSEND_GUARANTEE DPSEND_GUARANTEED +#define DPSEND_TRYONCE 0x00000004 + +#define DPCAPS_NAMESERVICE 0x00000001 +#define DPCAPS_NAMESERVER DPCAPS_ISHOST +#define DPCAPS_GUARANTEED 0x00000004 + +#define DPLONGNAMELEN 52 +#define DPSHORTNAMELEN 20 +#define DPSESSIONNAMELEN 32 +#define DPPASSWORDLEN 16 +#define DPUSERRESERVED 16 + +#define DPSYS_ADDPLAYER 0x0003 +#define DPSYS_DELETEPLAYER 0x0005 + +#define DPSYS_DELETEGROUP 0x0020 +#define DPSYS_DELETEPLAYERFROMGRP 0x0021 +#define DPSYS_CONNECT 0x484b + +typedef struct +{ + DWORD dwType; + DWORD dwPlayerType; + DPID dpId; + char szLongName[DPLONGNAMELEN]; + char szShortName[DPSHORTNAMELEN]; + DWORD dwCurrentPlayers; +} DPMSG_ADDPLAYER; + +typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP; + +typedef struct +{ + DWORD dwType; + DPID dpIdGroup; + DPID dpIdPlayer; +} DPMSG_GROUPADD; + +typedef DPMSG_GROUPADD DPMSG_GROUPDELETE; +typedef struct +{ + DWORD dwType; + DPID dpId; +} DPMSG_DELETEPLAYER; + +typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)( + DPID dpId, + LPSTR lpFriendlyName, + LPSTR lpFormalName, + DWORD dwFlags, + LPVOID lpContext ); + +typedef struct +{ + DWORD dwSize; + GUID guidSession; + DWORD_PTR dwSession; + DWORD dwMaxPlayers; + DWORD dwCurrentPlayers; + DWORD dwFlags; + char szSessionName[DPSESSIONNAMELEN]; + char szUserField[DPUSERRESERVED]; + DWORD_PTR dwReserved1; + char szPassword[DPPASSWORDLEN]; + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC,*LPDPSESSIONDESC; + +typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)( + LPDPSESSIONDESC lpDPSessionDesc, + LPVOID lpContext, + LPDWORD lpdwTimeOut, + DWORD dwFlags); + +/* + * IDirectPlay + */ +#undef INTERFACE +#define INTERFACE IDirectPlay +DECLARE_INTERFACE_( IDirectPlay, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPSTR,LPSTR) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(EnableNewPlayers) (THIS_ BOOL) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID, LPDPCAPS) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(SaveSession) (THIS_ LPSTR) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPSTR,LPSTR) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->lpVtbl->CreateGroup(p,a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->lpVtbl->CreatePlayer(p,a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->lpVtbl->EnableNewPlayers(p,a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->lpVtbl->GetPlayerCaps(p,a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay_Open(p,a) (p)->lpVtbl->Open(p,a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->lpVtbl->SaveSession(p,a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay_Close(p) (p)->Close() +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->CreateGroup(a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->CreatePlayer(a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->EnableNewPlayers(a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->EnumGroupPlayers(a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->GetPlayerCaps(a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->GetPlayerName(a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay_Open(p,a) (p)->Open(a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->SaveSession(a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) + +#endif + +DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72); + +#endif // IDIRECTPLAY2_OR_GREATER + +/**************************************************************************** + * + * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay_Release(p) (p)->lpVtbl->Release(p) + +#else + +#define IDirectPlay_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay_AddRef(p) (p)->AddRef() +#define IDirectPlay_Release(p) (p)->Release() + +#endif // IDirectPlay interface macros + +#ifdef __cplusplus +}; +#endif + +/* restore warning settings */ +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif + diff --git a/SDK/dxSDK/Include/dplay8.h b/SDK/dxSDK/Include/dplay8.h new file mode 100644 index 00000000..c6799a9d --- /dev/null +++ b/SDK/dxSDK/Include/dplay8.h @@ -0,0 +1,1456 @@ +/*========================================================================== + * + * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved. + * + * File: DPlay8.h + * Content: DirectPlay8 include file + * + ***************************************************************************/ + +#ifndef __DIRECTPLAY8_H__ +#define __DIRECTPLAY8_H__ + +#include // for DECLARE_INTERFACE_ and HRESULT + +#include "dpaddr.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + + +/**************************************************************************** + * + * DirectPlay8 CLSIDs + * + ****************************************************************************/ + +// {743F1DC6-5ABA-429f-8BDF-C54D03253DC2} +DEFINE_GUID(CLSID_DirectPlay8Client, +0x743f1dc6, 0x5aba, 0x429f, 0x8b, 0xdf, 0xc5, 0x4d, 0x3, 0x25, 0x3d, 0xc2); + +// {DA825E1B-6830-43d7-835D-0B5AD82956A2} +DEFINE_GUID(CLSID_DirectPlay8Server, +0xda825e1b, 0x6830, 0x43d7, 0x83, 0x5d, 0xb, 0x5a, 0xd8, 0x29, 0x56, 0xa2); + +// {286F484D-375E-4458-A272-B138E2F80A6A} +DEFINE_GUID(CLSID_DirectPlay8Peer, +0x286f484d, 0x375e, 0x4458, 0xa2, 0x72, 0xb1, 0x38, 0xe2, 0xf8, 0xa, 0x6a); + + +// CLSIDs added for DirectX 9 + +// {FC47060E-6153-4b34-B975-8E4121EB7F3C} +DEFINE_GUID(CLSID_DirectPlay8ThreadPool, +0xfc47060e, 0x6153, 0x4b34, 0xb9, 0x75, 0x8e, 0x41, 0x21, 0xeb, 0x7f, 0x3c); + +// {E4C1D9A2-CBF7-48bd-9A69-34A55E0D8941} +DEFINE_GUID(CLSID_DirectPlay8NATResolver, +0xe4c1d9a2, 0xcbf7, 0x48bd, 0x9a, 0x69, 0x34, 0xa5, 0x5e, 0xd, 0x89, 0x41); + +/**************************************************************************** + * + * DirectPlay8 Interface IIDs + * + ****************************************************************************/ + +typedef REFIID DP8REFIID; + + +// {5102DACD-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Client, +0x5102dacd, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {5102DACE-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Server, +0x5102dace, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {5102DACF-241B-11d3-AEA7-006097B01411} +DEFINE_GUID(IID_IDirectPlay8Peer, +0x5102dacf, 0x241b, 0x11d3, 0xae, 0xa7, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// IIDs added for DirectX 9 + +// {0D22EE73-4A46-4a0d-89B2-045B4D666425} +DEFINE_GUID(IID_IDirectPlay8ThreadPool, +0xd22ee73, 0x4a46, 0x4a0d, 0x89, 0xb2, 0x4, 0x5b, 0x4d, 0x66, 0x64, 0x25); + +// {A9E213F2-9A60-486f-BF3B-53408B6D1CBB} +DEFINE_GUID(IID_IDirectPlay8NATResolver, +0xa9e213f2, 0x9a60, 0x486f, 0xbf, 0x3b, 0x53, 0x40, 0x8b, 0x6d, 0x1c, 0xbb); + +/**************************************************************************** + * + * DirectPlay8 Service Provider GUIDs + * + ****************************************************************************/ + + +// {53934290-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_IPX, +0x53934290, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {6D4A3650-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_MODEM, +0x6d4a3650, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {743B5D60-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_SERIAL, +0x743b5d60, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// {EBFE7BA0-628D-11D2-AE0F-006097B01411} +DEFINE_GUID(CLSID_DP8SP_TCPIP, +0xebfe7ba0, 0x628d, 0x11d2, 0xae, 0xf, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + + +// Service providers added for DirectX 9 + + +// {995513AF-3027-4b9a-956E-C772B3F78006} +DEFINE_GUID(CLSID_DP8SP_BLUETOOTH, +0x995513af, 0x3027, 0x4b9a, 0x95, 0x6e, 0xc7, 0x72, 0xb3, 0xf7, 0x80, 0x6); + + +/**************************************************************************** + * + * DirectPlay8 Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlay8Client *PDIRECTPLAY8CLIENT; + +typedef struct IDirectPlay8Server *PDIRECTPLAY8SERVER; + +typedef struct IDirectPlay8Peer *PDIRECTPLAY8PEER; + + +// Interface pointers added for DirectX 9 + +typedef struct IDirectPlay8ThreadPool *PDIRECTPLAY8THREADPOOL; + +typedef struct IDirectPlay8NATResolver *PDIRECTPLAY8NATRESOLVER; + +/**************************************************************************** + * + * DirectPlay8 Forward Declarations For External Types + * + ****************************************************************************/ + +typedef struct IDirectPlay8LobbiedApplication *PDNLOBBIEDAPPLICATION; +typedef struct IDirectPlay8Address IDirectPlay8Address; + +/**************************************************************************** + * + * DirectPlay8 Callback Functions + * + ****************************************************************************/ + +// +// Callback Function Type Definition +// +typedef HRESULT (WINAPI *PFNDPNMESSAGEHANDLER)(PVOID,DWORD,PVOID); + +/**************************************************************************** + * + * DirectPlay8 Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************/ + +// +// Player IDs. Used to uniquely identify a player in a session +// +typedef DWORD DPNID, *PDPNID; + +// +// Used as identifiers for operations +// +typedef DWORD DPNHANDLE, *PDPNHANDLE; + + + + +/**************************************************************************** + * + * DirectPlay8 Message Identifiers + * + ****************************************************************************/ + +#define DPN_MSGID_OFFSET 0xFFFF0000 +#define DPN_MSGID_ADD_PLAYER_TO_GROUP ( DPN_MSGID_OFFSET | 0x0001 ) +#define DPN_MSGID_APPLICATION_DESC ( DPN_MSGID_OFFSET | 0x0002 ) +#define DPN_MSGID_ASYNC_OP_COMPLETE ( DPN_MSGID_OFFSET | 0x0003 ) +#define DPN_MSGID_CLIENT_INFO ( DPN_MSGID_OFFSET | 0x0004 ) +#define DPN_MSGID_CONNECT_COMPLETE ( DPN_MSGID_OFFSET | 0x0005 ) +#define DPN_MSGID_CREATE_GROUP ( DPN_MSGID_OFFSET | 0x0006 ) +#define DPN_MSGID_CREATE_PLAYER ( DPN_MSGID_OFFSET | 0x0007 ) +#define DPN_MSGID_DESTROY_GROUP ( DPN_MSGID_OFFSET | 0x0008 ) +#define DPN_MSGID_DESTROY_PLAYER ( DPN_MSGID_OFFSET | 0x0009 ) +#define DPN_MSGID_ENUM_HOSTS_QUERY ( DPN_MSGID_OFFSET | 0x000a ) +#define DPN_MSGID_ENUM_HOSTS_RESPONSE ( DPN_MSGID_OFFSET | 0x000b ) +#define DPN_MSGID_GROUP_INFO ( DPN_MSGID_OFFSET | 0x000c ) +#define DPN_MSGID_HOST_MIGRATE ( DPN_MSGID_OFFSET | 0x000d ) +#define DPN_MSGID_INDICATE_CONNECT ( DPN_MSGID_OFFSET | 0x000e ) +#define DPN_MSGID_INDICATED_CONNECT_ABORTED ( DPN_MSGID_OFFSET | 0x000f ) +#define DPN_MSGID_PEER_INFO ( DPN_MSGID_OFFSET | 0x0010 ) +#define DPN_MSGID_RECEIVE ( DPN_MSGID_OFFSET | 0x0011 ) +#define DPN_MSGID_REMOVE_PLAYER_FROM_GROUP ( DPN_MSGID_OFFSET | 0x0012 ) +#define DPN_MSGID_RETURN_BUFFER ( DPN_MSGID_OFFSET | 0x0013 ) +#define DPN_MSGID_SEND_COMPLETE ( DPN_MSGID_OFFSET | 0x0014 ) +#define DPN_MSGID_SERVER_INFO ( DPN_MSGID_OFFSET | 0x0015 ) +#define DPN_MSGID_TERMINATE_SESSION ( DPN_MSGID_OFFSET | 0x0016 ) + +// Messages added for DirectX 9 +#define DPN_MSGID_CREATE_THREAD ( DPN_MSGID_OFFSET | 0x0017 ) +#define DPN_MSGID_DESTROY_THREAD ( DPN_MSGID_OFFSET | 0x0018 ) +#define DPN_MSGID_NAT_RESOLVER_QUERY ( DPN_MSGID_OFFSET | 0x0101 ) + +/**************************************************************************** + * + * DirectPlay8 Constants + * + ****************************************************************************/ + +#define DPNID_ALL_PLAYERS_GROUP 0 + +// +// DESTROY_GROUP reasons +// +#define DPNDESTROYGROUPREASON_NORMAL 0x0001 +#define DPNDESTROYGROUPREASON_AUTODESTRUCTED 0x0002 +#define DPNDESTROYGROUPREASON_SESSIONTERMINATED 0x0003 + +// +// DESTROY_PLAYER reasons +// +#define DPNDESTROYPLAYERREASON_NORMAL 0x0001 +#define DPNDESTROYPLAYERREASON_CONNECTIONLOST 0x0002 +#define DPNDESTROYPLAYERREASON_SESSIONTERMINATED 0x0003 +#define DPNDESTROYPLAYERREASON_HOSTDESTROYEDPLAYER 0x0004 + +#define DPN_MAX_APPDESC_RESERVEDDATA_SIZE 64 + + + +/**************************************************************************** + * + * DirectPlay8 Flags + * + ****************************************************************************/ + +// +// Asynchronous operation flags (for Async Ops) +// +#define DPNOP_SYNC 0x80000000 + +// +// Add player to group flags (for AddPlayerToGroup) +// +#define DPNADDPLAYERTOGROUP_SYNC DPNOP_SYNC + +// +// Cancel flags +// +#define DPNCANCEL_CONNECT 0x00000001 +#define DPNCANCEL_ENUM 0x00000002 +#define DPNCANCEL_SEND 0x00000004 +#define DPNCANCEL_ALL_OPERATIONS 0x00008000 +// Flags added for DirectX 9 +#define DPNCANCEL_PLAYER_SENDS 0x80000000 +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_HIGH (DPNCANCEL_PLAYER_SENDS | 0x00010000) +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_NORMAL (DPNCANCEL_PLAYER_SENDS | 0x00020000) +#define DPNCANCEL_PLAYER_SENDS_PRIORITY_LOW (DPNCANCEL_PLAYER_SENDS | 0x00040000) + +// +// Close flags (for Close, added for DirectX 9) +// +#define DPNCLOSE_IMMEDIATE 0x00000001 + +// +// Connect flags (for Connect) +// +#define DPNCONNECT_SYNC DPNOP_SYNC +#define DPNCONNECT_OKTOQUERYFORADDRESSING 0x0001 + +// +// Create group flags (for CreateGroup) +// +#define DPNCREATEGROUP_SYNC DPNOP_SYNC + +// +// Destroy group flags (for DestroyGroup) +// +#define DPNDESTROYGROUP_SYNC DPNOP_SYNC + +// +// Enumerate clients and groups flags (for EnumPlayersAndGroups) +// +#define DPNENUM_PLAYERS 0x0001 +#define DPNENUM_GROUPS 0x0010 + +// +// Enum hosts flags (for EnumHosts) +// +#define DPNENUMHOSTS_SYNC DPNOP_SYNC +#define DPNENUMHOSTS_OKTOQUERYFORADDRESSING 0x0001 +#define DPNENUMHOSTS_NOBROADCASTFALLBACK 0x0002 + +// +// Enum service provider flags (for EnumSP) +// +#define DPNENUMSERVICEPROVIDERS_ALL 0x0001 + +// +// GetLocalHostAddresses flags (added for DirectX 9) +// +#define DPNGETLOCALHOSTADDRESSES_COMBINED 0x0001 + +// +// Get send queue info flags (for GetSendQueueInfo) +// +#define DPNGETSENDQUEUEINFO_PRIORITY_NORMAL 0x0001 +#define DPNGETSENDQUEUEINFO_PRIORITY_HIGH 0x0002 +#define DPNGETSENDQUEUEINFO_PRIORITY_LOW 0x0004 + +// +// Group information flags (for Group Info) +// +#define DPNGROUP_AUTODESTRUCT 0x0001 + +// +// Host flags (for Host) +// +#define DPNHOST_OKTOQUERYFORADDRESSING 0x0001 + +// +// Set info +// +#define DPNINFO_NAME 0x0001 +#define DPNINFO_DATA 0x0002 + +// +// Initialize flags (for Initialize) +// +#define DPNINITIALIZE_DISABLEPARAMVAL 0x0001 +// Flags added for DirectX 9 +#define DPNINITIALIZE_HINT_LANSESSION 0x0002 +#define DPNINITIALIZE_DISABLELINKTUNING 0x0004 + + +// +// Register Lobby flags +// +#define DPNLOBBY_REGISTER 0x0001 +#define DPNLOBBY_UNREGISTER 0x0002 + +// +// Player information flags (for Player Info / Player Messages) +// +#define DPNPLAYER_LOCAL 0x0002 +#define DPNPLAYER_HOST 0x0004 + +// +// Receive indication flags (added for DirectX 9) +// +#define DPNRECEIVE_GUARANTEED 0x0001 +#define DPNRECEIVE_COALESCED 0x0002 + +// +// Remove player from group flags (for RemovePlayerFromGroup) +// +#define DPNREMOVEPLAYERFROMGROUP_SYNC DPNOP_SYNC + +// +// Send flags (for Send/SendTo) +// +#define DPNSEND_SYNC DPNOP_SYNC +#define DPNSEND_NOCOPY 0x0001 +#define DPNSEND_NOCOMPLETE 0x0002 +#define DPNSEND_COMPLETEONPROCESS 0x0004 +#define DPNSEND_GUARANTEED 0x0008 +#define DPNSEND_NONSEQUENTIAL 0x0010 +#define DPNSEND_NOLOOPBACK 0x0020 +#define DPNSEND_PRIORITY_LOW 0x0040 +#define DPNSEND_PRIORITY_HIGH 0x0080 +// Flag added for DirectX 9 +#define DPNSEND_COALESCE 0x0100 + +// +// Send complete indication flags (added for DirectX 9) +// +#define DPNSENDCOMPLETE_GUARANTEED 0x0001 +#define DPNSENDCOMPLETE_COALESCED 0x0002 + +// +// Session Flags (for DPN_APPLICATION_DESC) +// +#define DPNSESSION_CLIENT_SERVER 0x0001 +#define DPNSESSION_MIGRATE_HOST 0x0004 +#define DPNSESSION_NODPNSVR 0x0040 +#define DPNSESSION_REQUIREPASSWORD 0x0080 +// Flag added for DirectX 9 +#define DPNSESSION_NOENUMS 0x0100 +#define DPNSESSION_FAST_SIGNED 0x0200 +#define DPNSESSION_FULL_SIGNED 0x0400 + +// +// Set client info flags (for SetClientInfo) +// +#define DPNSETCLIENTINFO_SYNC DPNOP_SYNC + +// +// Set group info flags (for SetGroupInfo) +// +#define DPNSETGROUPINFO_SYNC DPNOP_SYNC + +// +// Set peer info flags (for SetPeerInfo) +// +#define DPNSETPEERINFO_SYNC DPNOP_SYNC + +// +// Set server info flags (for SetServerInfo) +// +#define DPNSETSERVERINFO_SYNC DPNOP_SYNC + +// +// SP capabilities flags +// +#define DPNSPCAPS_SUPPORTSDPNSVR 0x0001 +#define DPNSPCAPS_SUPPORTSDPNSRV DPNSPCAPS_SUPPORTSDPNSVR +#define DPNSPCAPS_SUPPORTSBROADCAST 0x0002 +#define DPNSPCAPS_SUPPORTSALLADAPTERS 0x0004 +// Flags added for DirectX 9 +#define DPNSPCAPS_SUPPORTSTHREADPOOL 0x0008 +#define DPNSPCAPS_NETWORKSIMULATOR 0x0010 + +// +// SP information flags (added for DirectX 9) +// +#define DPNSPINFO_NETWORKSIMULATORDEVICE 0x0001 + +/**************************************************************************** + * + * DirectPlay8 Structures (Non-Message) + * + ****************************************************************************/ + +// +// Application description +// +typedef struct _DPN_APPLICATION_DESC +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPNSESSION_...) + GUID guidInstance; // Instance GUID + GUID guidApplication; // Application GUID + DWORD dwMaxPlayers; // Maximum # of players allowed (0=no limit) + DWORD dwCurrentPlayers; // Current # of players allowed + WCHAR *pwszSessionName; // Name of the session + WCHAR *pwszPassword; // Password for the session + PVOID pvReservedData; + DWORD dwReservedDataSize; + PVOID pvApplicationReservedData; + DWORD dwApplicationReservedDataSize; +} DPN_APPLICATION_DESC, *PDPN_APPLICATION_DESC; + +// +// Generic Buffer Description +// +typedef struct _BUFFERDESC +{ + DWORD dwBufferSize; + BYTE * pBufferData; +} BUFFERDESC, DPN_BUFFER_DESC, *PDPN_BUFFER_DESC; + +typedef BUFFERDESC FAR * PBUFFERDESC; + +// +// DirectPlay8 capabilities +// +typedef struct _DPN_CAPS +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags + DWORD dwConnectTimeout; // ms before a connect request times out + DWORD dwConnectRetries; // # of times to attempt the connection + DWORD dwTimeoutUntilKeepAlive; // ms of inactivity before a keep alive is sent +} DPN_CAPS, *PDPN_CAPS; + +// +// Extended capabilities structures (added for DirectX 9) +// +typedef struct _DPN_CAPS_EX +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags + DWORD dwConnectTimeout; // ms before a connect request times out + DWORD dwConnectRetries; // # of times to attempt the connection + DWORD dwTimeoutUntilKeepAlive; // ms of inactivity before a keep alive is sent + DWORD dwMaxRecvMsgSize; // maximum size in bytes of message that can be received + DWORD dwNumSendRetries; // maximum number of send retries before link is considered dead + DWORD dwMaxSendRetryInterval; // maximum period in msec between send retries + DWORD dwDropThresholdRate; // percentage of dropped packets before throttling + DWORD dwThrottleRate; // percentage amount to reduce send window when throttling + DWORD dwNumHardDisconnectSends; // number of hard disconnect frames to send when close immediate flag is specified + DWORD dwMaxHardDisconnectPeriod; // maximum period between hard disconnect sends +} DPN_CAPS_EX, *PDPN_CAPS_EX; + +// +// Connection Statistics information +// +typedef struct _DPN_CONNECTION_INFO +{ + DWORD dwSize; + DWORD dwRoundTripLatencyMS; + DWORD dwThroughputBPS; + DWORD dwPeakThroughputBPS; + + DWORD dwBytesSentGuaranteed; + DWORD dwPacketsSentGuaranteed; + DWORD dwBytesSentNonGuaranteed; + DWORD dwPacketsSentNonGuaranteed; + + DWORD dwBytesRetried; // Guaranteed only + DWORD dwPacketsRetried; // Guaranteed only + DWORD dwBytesDropped; // Non Guaranteed only + DWORD dwPacketsDropped; // Non Guaranteed only + + DWORD dwMessagesTransmittedHighPriority; + DWORD dwMessagesTimedOutHighPriority; + DWORD dwMessagesTransmittedNormalPriority; + DWORD dwMessagesTimedOutNormalPriority; + DWORD dwMessagesTransmittedLowPriority; + DWORD dwMessagesTimedOutLowPriority; + + DWORD dwBytesReceivedGuaranteed; + DWORD dwPacketsReceivedGuaranteed; + DWORD dwBytesReceivedNonGuaranteed; + DWORD dwPacketsReceivedNonGuaranteed; + DWORD dwMessagesReceived; + +} DPN_CONNECTION_INFO, *PDPN_CONNECTION_INFO; + + +// +// Group information structure +// +typedef struct _DPN_GROUP_INFO +{ + DWORD dwSize; // size of this structure + DWORD dwInfoFlags; // information contained + PWSTR pwszName; // Unicode Name + PVOID pvData; // data block + DWORD dwDataSize; // size in BYTES of data block + DWORD dwGroupFlags; // group flags (DPNGROUP_...) +} DPN_GROUP_INFO, *PDPN_GROUP_INFO; + +// +// Player information structure +// +typedef struct _DPN_PLAYER_INFO +{ + DWORD dwSize; // size of this structure + DWORD dwInfoFlags; // information contained + PWSTR pwszName; // Unicode Name + PVOID pvData; // data block + DWORD dwDataSize; // size in BYTES of data block + DWORD dwPlayerFlags; // player flags (DPNPLAYER_...) +} DPN_PLAYER_INFO, *PDPN_PLAYER_INFO; + +typedef struct _DPN_SECURITY_CREDENTIALS DPN_SECURITY_CREDENTIALS, *PDPN_SECURITY_CREDENTIALS; +typedef struct _DPN_SECURITY_DESC DPN_SECURITY_DESC, *PDPN_SECURITY_DESC; + +// +// Service provider & adapter enumeration structure +// +typedef struct _DPN_SERVICE_PROVIDER_INFO +{ + DWORD dwFlags; + GUID guid; // SP Guid + WCHAR *pwszName; // Friendly Name + PVOID pvReserved; + DWORD dwReserved; +} DPN_SERVICE_PROVIDER_INFO, *PDPN_SERVICE_PROVIDER_INFO; + +// +// Service provider caps structure +// +typedef struct _DPN_SP_CAPS +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPNSPCAPS_...) + DWORD dwNumThreads; // # of worker threads to use + DWORD dwDefaultEnumCount; // default # of enum requests + DWORD dwDefaultEnumRetryInterval; // default ms between enum requests + DWORD dwDefaultEnumTimeout; // default enum timeout + DWORD dwMaxEnumPayloadSize; // maximum size in bytes for enum payload data + DWORD dwBuffersPerThread; // number of receive buffers per thread + DWORD dwSystemBufferSize; // amount of buffering to do in addition to posted receive buffers +} DPN_SP_CAPS, *PDPN_SP_CAPS; + + +/**************************************************************************** + * + * IDirectPlay8 message handler call back structures + * + ****************************************************************************/ + +// +// Add player to group structure for message handler +// (DPN_MSGID_ADD_PLAYER_TO_GROUP) +// +typedef struct _DPNMSG_ADD_PLAYER_TO_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value + DPNID dpnidPlayer; // DPNID of added player + PVOID pvPlayerContext; // Player context value +} DPNMSG_ADD_PLAYER_TO_GROUP, *PDPNMSG_ADD_PLAYER_TO_GROUP; + +// +// Async operation completion structure for message handler +// (DPN_MSGID_ASYNC_OP_COMPLETE) +// +typedef struct _DPNMSG_ASYNC_OP_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 async operation handle + PVOID pvUserContext; // User context supplied + HRESULT hResultCode; // HRESULT of operation +} DPNMSG_ASYNC_OP_COMPLETE, *PDPNMSG_ASYNC_OP_COMPLETE; + +// +// Client info structure for message handler +// (DPN_MSGID_CLIENT_INFO) +// +typedef struct _DPNMSG_CLIENT_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidClient; // DPNID of client + PVOID pvPlayerContext; // Player context value +} DPNMSG_CLIENT_INFO, *PDPNMSG_CLIENT_INFO; + +// +// Connect complete structure for message handler +// (DPN_MSGID_CONNECT_COMPLETE) +// +typedef struct _DPNMSG_CONNECT_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 Async operation handle + PVOID pvUserContext; // User context supplied at Connect + HRESULT hResultCode; // HRESULT of connection attempt + PVOID pvApplicationReplyData; // Connection reply data from Host/Server + DWORD dwApplicationReplyDataSize; // Size (in bytes) of pvApplicationReplyData + + // Fields added for DirectX 9 + DPNID dpnidLocal; // DPNID of local player +} DPNMSG_CONNECT_COMPLETE, *PDPNMSG_CONNECT_COMPLETE; + +// +// Create group structure for message handler +// (DPN_MSGID_CREATE_GROUP) +// +typedef struct _DPNMSG_CREATE_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of new group + DPNID dpnidOwner; // Owner of newgroup + PVOID pvGroupContext; // Group context value + + // Fields added for DirectX 9 + PVOID pvOwnerContext; // Owner context value +} DPNMSG_CREATE_GROUP, *PDPNMSG_CREATE_GROUP; + +// +// Create player structure for message handler +// (DPN_MSGID_CREATE_PLAYER) +// +typedef struct _DPNMSG_CREATE_PLAYER +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPlayer; // DPNID of new player + PVOID pvPlayerContext; // Player context value +} DPNMSG_CREATE_PLAYER, *PDPNMSG_CREATE_PLAYER; + +// +// Destroy group structure for message handler +// (DPN_MSGID_DESTROY_GROUP) +// +typedef struct _DPNMSG_DESTROY_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of destroyed group + PVOID pvGroupContext; // Group context value + DWORD dwReason; // Information only +} DPNMSG_DESTROY_GROUP, *PDPNMSG_DESTROY_GROUP; + +// +// Destroy player structure for message handler +// (DPN_MSGID_DESTROY_PLAYER) +// +typedef struct _DPNMSG_DESTROY_PLAYER +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPlayer; // DPNID of leaving player + PVOID pvPlayerContext; // Player context value + DWORD dwReason; // Information only +} DPNMSG_DESTROY_PLAYER, *PDPNMSG_DESTROY_PLAYER; + +// +// Enumeration request received structure for message handler +// (DPN_MSGID_ENUM_HOSTS_QUERY) +// +typedef struct _DPNMSG_ENUM_HOSTS_QUERY +{ + DWORD dwSize; // Size of this structure. + IDirectPlay8Address *pAddressSender; // Address of client who sent the request + IDirectPlay8Address *pAddressDevice; // Address of device request was received on + PVOID pvReceivedData; // Request data (set on client) + DWORD dwReceivedDataSize; // Request data size (set on client) + DWORD dwMaxResponseDataSize; // Max allowable size of enum response + PVOID pvResponseData; // Optional query repsonse (user set) + DWORD dwResponseDataSize; // Optional query response size (user set) + PVOID pvResponseContext; // Optional query response context (user set) +} DPNMSG_ENUM_HOSTS_QUERY, *PDPNMSG_ENUM_HOSTS_QUERY; + +// +// Enumeration response received structure for message handler +// (DPN_MSGID_ENUM_HOSTS_RESPONSE) +// +typedef struct _DPNMSG_ENUM_HOSTS_RESPONSE +{ + DWORD dwSize; // Size of this structure + IDirectPlay8Address *pAddressSender; // Address of host who responded + IDirectPlay8Address *pAddressDevice; // Device response was received on + const DPN_APPLICATION_DESC *pApplicationDescription; // Application description for the session + PVOID pvResponseData; // Optional response data (set on host) + DWORD dwResponseDataSize; // Optional response data size (set on host) + PVOID pvUserContext; // Context value supplied for enumeration + DWORD dwRoundTripLatencyMS; // Round trip latency in MS +} DPNMSG_ENUM_HOSTS_RESPONSE, *PDPNMSG_ENUM_HOSTS_RESPONSE; + +// +// Group info structure for message handler +// (DPN_MSGID_GROUP_INFO) +// +typedef struct _DPNMSG_GROUP_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value +} DPNMSG_GROUP_INFO, *PDPNMSG_GROUP_INFO; + +// +// Migrate host structure for message handler +// (DPN_MSGID_HOST_MIGRATE) +// +typedef struct _DPNMSG_HOST_MIGRATE +{ + DWORD dwSize; // Size of this structure + DPNID dpnidNewHost; // DPNID of new Host player + PVOID pvPlayerContext; // Player context value +} DPNMSG_HOST_MIGRATE, *PDPNMSG_HOST_MIGRATE; + +// +// Indicate connect structure for message handler +// (DPN_MSGID_INDICATE_CONNECT) +// +typedef struct _DPNMSG_INDICATE_CONNECT +{ + DWORD dwSize; // Size of this structure + PVOID pvUserConnectData; // Connecting player data + DWORD dwUserConnectDataSize; // Size (in bytes) of pvUserConnectData + PVOID pvReplyData; // Connection reply data + DWORD dwReplyDataSize; // Size (in bytes) of pvReplyData + PVOID pvReplyContext; // Buffer context for pvReplyData + PVOID pvPlayerContext; // Player context preset + IDirectPlay8Address *pAddressPlayer; // Address of connecting player + IDirectPlay8Address *pAddressDevice; // Address of device receiving connect attempt +} DPNMSG_INDICATE_CONNECT, *PDPNMSG_INDICATE_CONNECT; + +// +// Indicated connect aborted structure for message handler +// (DPN_MSGID_INDICATED_CONNECT_ABORTED) +// +typedef struct _DPNMSG_INDICATED_CONNECT_ABORTED +{ + DWORD dwSize; // Size of this structure + PVOID pvPlayerContext; // Player context preset from DPNMSG_INDICATE_CONNECT +} DPNMSG_INDICATED_CONNECT_ABORTED, *PDPNMSG_INDICATED_CONNECT_ABORTED; + +// +// Peer info structure for message handler +// (DPN_MSGID_PEER_INFO) +// +typedef struct _DPNMSG_PEER_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidPeer; // DPNID of peer + PVOID pvPlayerContext; // Player context value +} DPNMSG_PEER_INFO, *PDPNMSG_PEER_INFO; + +// +// Receive structure for message handler +// (DPN_MSGID_RECEIVE) +// +typedef struct _DPNMSG_RECEIVE +{ + DWORD dwSize; // Size of this structure + DPNID dpnidSender; // DPNID of sending player + PVOID pvPlayerContext; // Player context value of sending player + PBYTE pReceiveData; // Received data + DWORD dwReceiveDataSize; // Size (in bytes) of pReceiveData + DPNHANDLE hBufferHandle; // Buffer handle for pReceiveData + + // Fields added for DirectX 9 + DWORD dwReceiveFlags; // Flags describing how message was received +} DPNMSG_RECEIVE, *PDPNMSG_RECEIVE; + +// +// Remove player from group structure for message handler +// (DPN_MSGID_REMOVE_PLAYER_FROM_GROUP) +// +typedef struct _DPNMSG_REMOVE_PLAYER_FROM_GROUP +{ + DWORD dwSize; // Size of this structure + DPNID dpnidGroup; // DPNID of group + PVOID pvGroupContext; // Group context value + DPNID dpnidPlayer; // DPNID of deleted player + PVOID pvPlayerContext; // Player context value +} DPNMSG_REMOVE_PLAYER_FROM_GROUP, *PDPNMSG_REMOVE_PLAYER_FROM_GROUP; + +// +// Returned buffer structure for message handler +// (DPN_MSGID_RETURN_BUFFER) +// +typedef struct _DPNMSG_RETURN_BUFFER +{ + DWORD dwSize; // Size of this structure + HRESULT hResultCode; // Return value of operation + PVOID pvBuffer; // Buffer being returned + PVOID pvUserContext; // Context associated with buffer +} DPNMSG_RETURN_BUFFER, *PDPNMSG_RETURN_BUFFER; + +// +// Send complete structure for message handler +// (DPN_MSGID_SEND_COMPLETE) +// +typedef struct _DPNMSG_SEND_COMPLETE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hAsyncOp; // DirectPlay8 Async operation handle + PVOID pvUserContext; // User context supplied at Send/SendTo + HRESULT hResultCode; // HRESULT of send + DWORD dwSendTime; // Send time in ms + + // Fields added for DirectX 9 + DWORD dwFirstFrameRTT; // RTT of the first frame in the message + DWORD dwFirstFrameRetryCount; // Retry count of the first frame + DWORD dwSendCompleteFlags; // Flags describing how message was sent + DPN_BUFFER_DESC *pBuffers; // Pointer to array of buffers sent, if DirectPlay did not make a copy + DWORD dwNumBuffers; // Number of buffers in previous array +} DPNMSG_SEND_COMPLETE, *PDPNMSG_SEND_COMPLETE; + +// +// Server info structure for message handler +// (DPN_MSGID_SERVER_INFO) +// +typedef struct _DPNMSG_SERVER_INFO +{ + DWORD dwSize; // Size of this structure + DPNID dpnidServer; // DPNID of server + PVOID pvPlayerContext; // Player context value +} DPNMSG_SERVER_INFO, *PDPNMSG_SERVER_INFO; + +// +// Terminated session structure for message handler +// (DPN_MSGID_TERMINATE_SESSION) +// +typedef struct _DPNMSG_TERMINATE_SESSION +{ + DWORD dwSize; // Size of this structure + HRESULT hResultCode; // Reason + PVOID pvTerminateData; // Data passed from Host/Server + DWORD dwTerminateDataSize;// Size (in bytes) of pvTerminateData +} DPNMSG_TERMINATE_SESSION, *PDPNMSG_TERMINATE_SESSION; + + +// +// Message structures added for DirectX 9 +// + +// +// Create thread info structure for message handler +// (DPN_MSGID_CREATE_THREAD) +// +typedef struct _DPNMSG_CREATE_THREAD +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags describing this thread + DWORD dwProcessorNum; // Index of processor to which thread is bound + PVOID pvUserContext; // Thread context value +} DPNMSG_CREATE_THREAD, *PDPNMSG_CREATE_THREAD; + +// +// Destroy thread info structure for message handler +// (DPN_MSGID_DESTROY_THREAD) +// +typedef struct _DPNMSG_DESTROY_THREAD +{ + DWORD dwSize; // Size of this structure + DWORD dwProcessorNum; // Index of processor to which thread was bound + PVOID pvUserContext; // Thread context value +} DPNMSG_DESTROY_THREAD, *PDPNMSG_DESTROY_THREAD; + + +// +// Query-to-resolve-NAT-address structure for message handler +// (DPN_MSGID_NAT_RESOLVER_QUERY) +// +typedef struct _DPNMSG_NAT_RESOLVER_QUERY +{ + DWORD dwSize; // Size of this structure. + IDirectPlay8Address *pAddressSender; // Address of client that sent the query + IDirectPlay8Address *pAddressDevice; // Address of device on which query was received + WCHAR *pwszUserString; // User specified string, or NULL if none +} DPNMSG_NAT_RESOLVER_QUERY, *PDPNMSG_NAT_RESOLVER_QUERY; + +/**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************/ + + + +/* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 objects. + * + * extern HRESULT WINAPI DirectPlay8Create( const CLSID * pcIID, void **ppvInterface, IUnknown *pUnknown ); + * + */ + + +/**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for DirectPlay8 Client interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Client +DECLARE_INTERFACE_(IDirectPlay8Client,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Client methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider, const GUID *const pguidApplication, DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, PDWORD const pcbEnumData, PDWORD const pcReturned, const DWORD dwFlags) PURE; + STDMETHOD(EnumHosts) (THIS_ PDPN_APPLICATION_DESC const pApplicationDesc,IDirectPlay8Address *const pAddrHost,IDirectPlay8Address *const pDeviceInfo,PVOID const pUserEnumData,const DWORD dwUserEnumDataSize,const DWORD dwEnumCount,const DWORD dwRetryInterval,const DWORD dwTimeOut,PVOID const pvUserContext,DPNHANDLE *const pAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(Connect) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address *const pHostAddr,IDirectPlay8Address *const pDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,const void *const pvUserConnectData,const DWORD dwUserConnectDataSize,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetClientInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetServerInfo) (THIS_ DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetServerAddress) (THIS_ IDirectPlay8Address **const pAddress,const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP,DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; +}; + +// +// COM definition for DirectPlay8 Server interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Server +DECLARE_INTERFACE_(IDirectPlay8Server,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Server methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider,const GUID *const pguidApplication,DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer,PDWORD const pcbEnumData,PDWORD const pcReturned,const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ const DPNID dpnid,DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetServerInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetClientInfo) (THIS_ const DPNID dpnid,DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetClientAddress) (THIS_ const DPNID dpnid,IDirectPlay8Address **const pAddress,const DWORD dwFlags) PURE; + STDMETHOD(GetLocalHostAddresses) (THIS_ IDirectPlay8Address **const prgpAddress,DWORD *const pcAddress,const DWORD dwFlags) PURE; + STDMETHOD(SetApplicationDesc) (THIS_ const DPN_APPLICATION_DESC *const pad, const DWORD dwFlags) PURE; + STDMETHOD(Host) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address **const prgpDeviceInfo,const DWORD cDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,void *const pvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(SendTo) (THIS_ const DPNID dpnid,const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(CreateGroup) (THIS_ const DPN_GROUP_INFO *const pdpnGroupInfo,void *const pvGroupContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyGroup) (THIS_ const DPNID idGroup, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(AddPlayerToGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(RemovePlayerFromGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(SetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(EnumPlayersAndGroups) (THIS_ DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(EnumGroupMembers) (THIS_ const DPNID dpnid, DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(DestroyClient) (THIS_ const DPNID dpnidClient, const void *const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetPlayerContext) (THIS_ const DPNID dpnid,PVOID *const ppvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetGroupContext) (THIS_ const DPNID dpnid,PVOID *const ppvGroupContext,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP, DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ const DPNID dpnid, DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; +}; + +// +// COM definition for DirectPlay8 Peer interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8Peer +DECLARE_INTERFACE_(IDirectPlay8Peer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8Peer methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(EnumServiceProviders) (THIS_ const GUID *const pguidServiceProvider, const GUID *const pguidApplication, DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, DWORD *const pcbEnumData, DWORD *const pcReturned, const DWORD dwFlags) PURE; + STDMETHOD(CancelAsyncOperation) (THIS_ const DPNHANDLE hAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(Connect) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address *const pHostAddr,IDirectPlay8Address *const pDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,const void *const pvUserConnectData,const DWORD dwUserConnectDataSize,void *const pvPlayerContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(SendTo) (THIS_ const DPNID dpnid,const DPN_BUFFER_DESC *const prgBufferDesc,const DWORD cBufferDesc,const DWORD dwTimeOut,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetSendQueueInfo) (THIS_ const DPNID dpnid, DWORD *const pdwNumMsgs, DWORD *const pdwNumBytes, const DWORD dwFlags) PURE; + STDMETHOD(Host) (THIS_ const DPN_APPLICATION_DESC *const pdnAppDesc,IDirectPlay8Address **const prgpDeviceInfo,const DWORD cDeviceInfo,const DPN_SECURITY_DESC *const pdnSecurity,const DPN_SECURITY_CREDENTIALS *const pdnCredentials,void *const pvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetApplicationDesc) (THIS_ DPN_APPLICATION_DESC *const pAppDescBuffer, DWORD *const pcbDataSize, const DWORD dwFlags) PURE; + STDMETHOD(SetApplicationDesc) (THIS_ const DPN_APPLICATION_DESC *const pad, const DWORD dwFlags) PURE; + STDMETHOD(CreateGroup) (THIS_ const DPN_GROUP_INFO *const pdpnGroupInfo,void *const pvGroupContext,void *const pvAsyncContext,DPNHANDLE *const phAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyGroup) (THIS_ const DPNID idGroup, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(AddPlayerToGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(RemovePlayerFromGroup) (THIS_ const DPNID idGroup, const DPNID idClient, PVOID const pvAsyncContext, DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(SetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetGroupInfo) (THIS_ const DPNID dpnid,DPN_GROUP_INFO *const pdpnGroupInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(EnumPlayersAndGroups) (THIS_ DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(EnumGroupMembers) (THIS_ const DPNID dpnid, DPNID *const prgdpnid, DWORD *const pcdpnid, const DWORD dwFlags) PURE; + STDMETHOD(SetPeerInfo) (THIS_ const DPN_PLAYER_INFO *const pdpnPlayerInfo,PVOID const pvAsyncContext,DPNHANDLE *const phAsyncHandle, const DWORD dwFlags) PURE; + STDMETHOD(GetPeerInfo) (THIS_ const DPNID dpnid,DPN_PLAYER_INFO *const pdpnPlayerInfo,DWORD *const pdwSize,const DWORD dwFlags) PURE; + STDMETHOD(GetPeerAddress) (THIS_ const DPNID dpnid,IDirectPlay8Address **const ppAddress,const DWORD dwFlags) PURE; + STDMETHOD(GetLocalHostAddresses) (THIS_ IDirectPlay8Address **const prgpAddress,DWORD *const pcAddress,const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(EnumHosts) (THIS_ PDPN_APPLICATION_DESC const pApplicationDesc,IDirectPlay8Address *const pAddrHost,IDirectPlay8Address *const pDeviceInfo,PVOID const pUserEnumData,const DWORD dwUserEnumDataSize,const DWORD dwEnumCount,const DWORD dwRetryInterval,const DWORD dwTimeOut,PVOID const pvUserContext,DPNHANDLE *const pAsyncHandle,const DWORD dwFlags) PURE; + STDMETHOD(DestroyPeer) (THIS_ const DPNID dpnidClient, const void *const pvDestroyData, const DWORD dwDestroyDataSize, const DWORD dwFlags) PURE; + STDMETHOD(ReturnBuffer) (THIS_ const DPNHANDLE hBufferHandle,const DWORD dwFlags) PURE; + STDMETHOD(GetPlayerContext) (THIS_ const DPNID dpnid,PVOID *const ppvPlayerContext,const DWORD dwFlags) PURE; + STDMETHOD(GetGroupContext) (THIS_ const DPNID dpnid,PVOID *const ppvGroupContext,const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPN_CAPS *const pdpCaps,const DWORD dwFlags) PURE; + STDMETHOD(SetCaps) (THIS_ const DPN_CAPS *const pdpCaps, const DWORD dwFlags) PURE; + STDMETHOD(SetSPCaps) (THIS_ const GUID * const pguidSP, const DPN_SP_CAPS *const pdpspCaps, const DWORD dwFlags ) PURE; + STDMETHOD(GetSPCaps) (THIS_ const GUID * const pguidSP, DPN_SP_CAPS *const pdpspCaps,const DWORD dwFlags) PURE; + STDMETHOD(GetConnectionInfo) (THIS_ const DPNID dpnid, DPN_CONNECTION_INFO *const pdpConnectionInfo,const DWORD dwFlags) PURE; + STDMETHOD(RegisterLobby) (THIS_ const DPNHANDLE dpnHandle, struct IDirectPlay8LobbiedApplication *const pIDP8LobbiedApplication,const DWORD dwFlags) PURE; + STDMETHOD(TerminateSession) (THIS_ void *const pvTerminateData,const DWORD dwTerminateDataSize,const DWORD dwFlags) PURE; +}; + + + +// +// COM definition for DirectPlay8 Thread Pool interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8ThreadPool +DECLARE_INTERFACE_(IDirectPlay8ThreadPool,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8ThreadPool methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(GetThreadCount) (THIS_ const DWORD dwProcessorNum, DWORD *const pdwNumThreads, const DWORD dwFlags) PURE; + STDMETHOD(SetThreadCount) (THIS_ const DWORD dwProcessorNum, const DWORD dwNumThreads, const DWORD dwFlags) PURE; + STDMETHOD(DoWork) (THIS_ const DWORD dwAllowedTimeSlice, const DWORD dwFlags) PURE; +}; + + +// +// COM definition for DirectPlay8 NAT Resolver interface +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8NATResolver +DECLARE_INTERFACE_(IDirectPlay8NATResolver,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ DP8REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay8NATResolver methods ***/ + STDMETHOD(Initialize) (THIS_ PVOID const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ IDirectPlay8Address **const ppDevices, const DWORD dwNumDevices, const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(EnumDevices) (THIS_ DPN_SERVICE_PROVIDER_INFO *const pSPInfoBuffer, PDWORD const pdwBufferSize, PDWORD const pdwNumDevices, const DWORD dwFlags) PURE; + STDMETHOD(GetAddresses) (THIS_ IDirectPlay8Address **const ppAddresses, DWORD *const pdwNumAddresses, const DWORD dwFlags) PURE; +}; + + +/**************************************************************************** + * + * IDirectPlay8 application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8Client_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Client_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Client_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Client_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Client_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Client_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Client_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Client_Connect(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->Connect(p,a,b,c,d,e,f,g,h,i,j) +#define IDirectPlay8Client_Send(p,a,b,c,d,e,f) (p)->lpVtbl->Send(p,a,b,c,d,e,f) +#define IDirectPlay8Client_GetSendQueueInfo(p,a,b,c) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c) +#define IDirectPlay8Client_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Client_SetClientInfo(p,a,b,c,d) (p)->lpVtbl->SetClientInfo(p,a,b,c,d) +#define IDirectPlay8Client_GetServerInfo(p,a,b,c) (p)->lpVtbl->GetServerInfo(p,a,b,c) +#define IDirectPlay8Client_GetServerAddress(p,a,b) (p)->lpVtbl->GetServerAddress(p,a,b) +#define IDirectPlay8Client_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Client_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Client_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Client_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Client_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Client_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Client_GetConnectionInfo(p,a,b) (p)->lpVtbl->GetConnectionInfo(p,a,b) +#define IDirectPlay8Client_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) + +#define IDirectPlay8Server_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Server_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Server_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Server_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Server_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Server_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Server_GetSendQueueInfo(p,a,b,c,d) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Server_SetServerInfo(p,a,b,c,d) (p)->lpVtbl->SetServerInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetClientInfo(p,a,b,c,d) (p)->lpVtbl->GetClientInfo(p,a,b,c,d) +#define IDirectPlay8Server_GetClientAddress(p,a,b,c) (p)->lpVtbl->GetClientAddress(p,a,b,c) +#define IDirectPlay8Server_GetLocalHostAddresses(p,a,b,c) (p)->lpVtbl->GetLocalHostAddresses(p,a,b,c) +#define IDirectPlay8Server_SetApplicationDesc(p,a,b) (p)->lpVtbl->SetApplicationDesc(p,a,b) +#define IDirectPlay8Server_Host(p,a,b,c,d,e,f,g) (p)->lpVtbl->Host(p,a,b,c,d,e,f,g) +#define IDirectPlay8Server_SendTo(p,a,b,c,d,e,f,g) (p)->lpVtbl->SendTo(p,a,b,c,d,e,f,g) +#define IDirectPlay8Server_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_DestroyGroup(p,a,b,c,d) (p)->lpVtbl->DestroyGroup(p,a,b,c,d) +#define IDirectPlay8Server_AddPlayerToGroup(p,a,b,c,d,e) (p)->lpVtbl->AddPlayerToGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->lpVtbl->RemovePlayerFromGroup(p,a,b,c,d,e) +#define IDirectPlay8Server_SetGroupInfo(p,a,b,c,d,e) (p)->lpVtbl->SetGroupInfo(p,a,b,c,d,e) +#define IDirectPlay8Server_GetGroupInfo(p,a,b,c,d) (p)->lpVtbl->GetGroupInfo(p,a,b,c,d) +#define IDirectPlay8Server_EnumPlayersAndGroups(p,a,b,c) (p)->lpVtbl->EnumPlayersAndGroups(p,a,b,c) +#define IDirectPlay8Server_EnumGroupMembers(p,a,b,c,d) (p)->lpVtbl->EnumGroupMembers(p,a,b,c,d) +#define IDirectPlay8Server_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Server_DestroyClient(p,a,b,c,d) (p)->lpVtbl->DestroyClient(p,a,b,c,d) +#define IDirectPlay8Server_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Server_GetPlayerContext(p,a,b,c) (p)->lpVtbl->GetPlayerContext(p,a,b,c) +#define IDirectPlay8Server_GetGroupContext(p,a,b,c) (p)->lpVtbl->GetGroupContext(p,a,b,c) +#define IDirectPlay8Server_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Server_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Server_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Server_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Server_GetConnectionInfo(p,a,b,c) (p)->lpVtbl->GetConnectionInfo(p,a,b,c) +#define IDirectPlay8Server_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) + +#define IDirectPlay8Peer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8Peer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8Peer_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8Peer_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8Peer_EnumServiceProviders(p,a,b,c,d,e,f) (p)->lpVtbl->EnumServiceProviders(p,a,b,c,d,e,f) +#define IDirectPlay8Peer_CancelAsyncOperation(p,a,b) (p)->lpVtbl->CancelAsyncOperation(p,a,b) +#define IDirectPlay8Peer_Connect(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->Connect(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_SendTo(p,a,b,c,d,e,f,g) (p)->lpVtbl->SendTo(p,a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetSendQueueInfo(p,a,b,c,d) (p)->lpVtbl->GetSendQueueInfo(p,a,b,c,d) +#define IDirectPlay8Peer_Host(p,a,b,c,d,e,f,g) (p)->lpVtbl->Host(p,a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetApplicationDesc(p,a,b,c) (p)->lpVtbl->GetApplicationDesc(p,a,b,c) +#define IDirectPlay8Peer_SetApplicationDesc(p,a,b) (p)->lpVtbl->SetApplicationDesc(p,a,b) +#define IDirectPlay8Peer_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_DestroyGroup(p,a,b,c,d) (p)->lpVtbl->DestroyGroup(p,a,b,c,d) +#define IDirectPlay8Peer_AddPlayerToGroup(p,a,b,c,d,e) (p)->lpVtbl->AddPlayerToGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->lpVtbl->RemovePlayerFromGroup(p,a,b,c,d,e) +#define IDirectPlay8Peer_SetGroupInfo(p,a,b,c,d,e) (p)->lpVtbl->SetGroupInfo(p,a,b,c,d,e) +#define IDirectPlay8Peer_GetGroupInfo(p,a,b,c,d) (p)->lpVtbl->GetGroupInfo(p,a,b,c,d) +#define IDirectPlay8Peer_EnumPlayersAndGroups(p,a,b,c) (p)->lpVtbl->EnumPlayersAndGroups(p,a,b,c) +#define IDirectPlay8Peer_EnumGroupMembers(p,a,b,c,d) (p)->lpVtbl->EnumGroupMembers(p,a,b,c,d) +#define IDirectPlay8Peer_SetPeerInfo(p,a,b,c,d) (p)->lpVtbl->SetPeerInfo(p,a,b,c,d) +#define IDirectPlay8Peer_GetPeerInfo(p,a,b,c,d) (p)->lpVtbl->GetPeerInfo(p,a,b,c,d) +#define IDirectPlay8Peer_GetPeerAddress(p,a,b,c) (p)->lpVtbl->GetPeerAddress(p,a,b,c) +#define IDirectPlay8Peer_GetLocalHostAddresses(p,a,b,c) (p)->lpVtbl->GetLocalHostAddresses(p,a,b,c) +#define IDirectPlay8Peer_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8Peer_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_DestroyPeer(p,a,b,c,d) (p)->lpVtbl->DestroyPeer(p,a,b,c,d) +#define IDirectPlay8Peer_ReturnBuffer(p,a,b) (p)->lpVtbl->ReturnBuffer(p,a,b) +#define IDirectPlay8Peer_GetPlayerContext(p,a,b,c) (p)->lpVtbl->GetPlayerContext(p,a,b,c) +#define IDirectPlay8Peer_GetGroupContext(p,a,b,c) (p)->lpVtbl->GetGroupContext(p,a,b,c) +#define IDirectPlay8Peer_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay8Peer_SetCaps(p,a,b) (p)->lpVtbl->SetCaps(p,a,b) +#define IDirectPlay8Peer_SetSPCaps(p,a,b,c) (p)->lpVtbl->SetSPCaps(p,a,b,c) +#define IDirectPlay8Peer_GetSPCaps(p,a,b,c) (p)->lpVtbl->GetSPCaps(p,a,b,c) +#define IDirectPlay8Peer_GetConnectionInfo(p,a,b,c) (p)->lpVtbl->GetConnectionInfo(p,a,b,c) +#define IDirectPlay8Peer_RegisterLobby(p,a,b,c) (p)->lpVtbl->RegisterLobby(p,a,b,c) +#define IDirectPlay8Peer_TerminateSession(p,a,b,c) (p)->lpVtbl->TerminateSession(p,a,b,c) + +#define IDirectPlay8ThreadPool_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8ThreadPool_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8ThreadPool_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8ThreadPool_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8ThreadPool_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8ThreadPool_GetThreadCount(p,a,b,c) (p)->lpVtbl->GetThreadCount(p,a,b,c) +#define IDirectPlay8ThreadPool_SetThreadCount(p,a,b,c) (p)->lpVtbl->SetThreadCount(p,a,b,c) +#define IDirectPlay8ThreadPool_DoWork(p,a,b) (p)->lpVtbl->DoWork(p,a,b) + +#define IDirectPlay8NATResolver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8NATResolver_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8NATResolver_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8NATResolver_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8NATResolver_Start(p,a,b,c) (p)->lpVtbl->Start(p,a,b,c) +#define IDirectPlay8NATResolver_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8NATResolver_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectPlay8NATResolver_GetAddresses(p,a,b,c) (p)->lpVtbl->GetAddresses(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8Client_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Client_AddRef(p) (p)->AddRef() +#define IDirectPlay8Client_Release(p) (p)->Release() +#define IDirectPlay8Client_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Client_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Client_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->EnumHosts(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Client_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Client_Connect(p,a,b,c,d,e,f,g,h,i,j) (p)->Connect(a,b,c,d,e,f,g,h,i,j) +#define IDirectPlay8Client_Send(p,a,b,c,d,e,f) (p)->Send(a,b,c,d,e,f) +#define IDirectPlay8Client_GetSendQueueInfo(p,a,b,c) (p)->GetSendQueueInfo(a,b,c) +#define IDirectPlay8Client_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Client_SetClientInfo(p,a,b,c,d) (p)->SetClientInfo(a,b,c,d) +#define IDirectPlay8Client_GetServerInfo(p,a,b,c) (p)->GetServerInfo(a,b,c) +#define IDirectPlay8Client_GetServerAddress(p,a,b) (p)->GetServerAddress(a,b) +#define IDirectPlay8Client_Close(p,a) (p)->Close(a) +#define IDirectPlay8Client_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Client_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Client_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Client_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Client_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Client_GetConnectionInfo(p,a,b) (p)->GetConnectionInfo(a,b) +#define IDirectPlay8Client_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) + +#define IDirectPlay8Server_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Server_AddRef(p) (p)->AddRef() +#define IDirectPlay8Server_Release(p) (p)->Release() +#define IDirectPlay8Server_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Server_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Server_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Server_GetSendQueueInfo(p,a,b,c,d) (p)->GetSendQueueInfo(a,b,c,d) +#define IDirectPlay8Server_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Server_SetServerInfo(p,a,b,c,d) (p)->SetServerInfo(a,b,c,d) +#define IDirectPlay8Server_GetClientInfo(p,a,b,c,d) (p)->GetClientInfo(a,b,c,d) +#define IDirectPlay8Server_GetClientAddress(p,a,b,c) (p)->GetClientAddress(a,b,c) +#define IDirectPlay8Server_GetLocalHostAddresses(p,a,b,c) (p)->GetLocalHostAddresses(a,b,c) +#define IDirectPlay8Server_SetApplicationDesc(p,a,b) (p)->SetApplicationDesc(a,b) +#define IDirectPlay8Server_Host(p,a,b,c,d,e,f,g) (p)->Host(a,b,c,d,e,f,g) +#define IDirectPlay8Server_SendTo(p,a,b,c,d,e,f,g) (p)->SendTo(a,b,c,d,e,f,g) +#define IDirectPlay8Server_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay8Server_DestroyGroup(p,a,b,c,d) (p)->DestroyGroup(a,b,c,d) +#define IDirectPlay8Server_AddPlayerToGroup(p,a,b,c,d,e) (p)->AddPlayerToGroup(a,b,c,d,e) +#define IDirectPlay8Server_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->RemovePlayerFromGroup(a,b,c,d,e) +#define IDirectPlay8Server_SetGroupInfo(p,a,b,c,d,e) (p)->SetGroupInfo(a,b,c,d,e) +#define IDirectPlay8Server_GetGroupInfo(p,a,b,c,d) (p)->GetGroupInfo(a,b,c,d) +#define IDirectPlay8Server_EnumPlayersAndGroups(p,a,b,c) (p)->EnumPlayersAndGroups(a,b,c) +#define IDirectPlay8Server_EnumGroupMembers(p,a,b,c,d) (p)->EnumGroupMembers(a,b,c,d) +#define IDirectPlay8Server_Close(p,a) (p)->Close(a) +#define IDirectPlay8Server_DestroyClient(p,a,b,c,d) (p)->DestroyClient(a,b,c,d) +#define IDirectPlay8Server_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Server_GetPlayerContext(p,a,b,c) (p)->GetPlayerContext(a,b,c) +#define IDirectPlay8Server_GetGroupContext(p,a,b,c) (p)->GetGroupContext(a,b,c) +#define IDirectPlay8Server_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Server_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Server_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Server_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Server_GetConnectionInfo(p,a,b,c) (p)->GetConnectionInfo(a,b,c) +#define IDirectPlay8Server_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) + +#define IDirectPlay8Peer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8Peer_AddRef(p) (p)->AddRef() +#define IDirectPlay8Peer_Release(p) (p)->Release() +#define IDirectPlay8Peer_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8Peer_EnumServiceProviders(p,a,b,c,d,e,f) (p)->EnumServiceProviders(a,b,c,d,e,f) +#define IDirectPlay8Peer_CancelAsyncOperation(p,a,b) (p)->CancelAsyncOperation(a,b) +#define IDirectPlay8Peer_Connect(p,a,b,c,d,e,f,g,h,i,j,k) (p)->Connect(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_SendTo(p,a,b,c,d,e,f,g) (p)->SendTo(a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetSendQueueInfo(p,a,b,c,d) (p)->GetSendQueueInfo(a,b,c,d) +#define IDirectPlay8Peer_Host(p,a,b,c,d,e,f,g) (p)->Host(a,b,c,d,e,f,g) +#define IDirectPlay8Peer_GetApplicationDesc(p,a,b,c) (p)->GetApplicationDesc(a,b,c) +#define IDirectPlay8Peer_SetApplicationDesc(p,a,b) (p)->SetApplicationDesc(a,b) +#define IDirectPlay8Peer_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay8Peer_DestroyGroup(p,a,b,c,d) (p)->DestroyGroup(a,b,c,d) +#define IDirectPlay8Peer_AddPlayerToGroup(p,a,b,c,d,e) (p)->AddPlayerToGroup(a,b,c,d,e) +#define IDirectPlay8Peer_RemovePlayerFromGroup(p,a,b,c,d,e) (p)->RemovePlayerFromGroup(a,b,c,d,e) +#define IDirectPlay8Peer_SetGroupInfo(p,a,b,c,d,e) (p)->SetGroupInfo(a,b,c,d,e) +#define IDirectPlay8Peer_GetGroupInfo(p,a,b,c,d) (p)->GetGroupInfo(a,b,c,d) +#define IDirectPlay8Peer_EnumPlayersAndGroups(p,a,b,c) (p)->EnumPlayersAndGroups(a,b,c) +#define IDirectPlay8Peer_EnumGroupMembers(p,a,b,c,d) (p)->EnumGroupMembers(a,b,c,d) +#define IDirectPlay8Peer_SetPeerInfo(p,a,b,c,d) (p)->SetPeerInfo(a,b,c,d) +#define IDirectPlay8Peer_GetPeerInfo(p,a,b,c,d) (p)->GetPeerInfo(a,b,c,d) +#define IDirectPlay8Peer_GetPeerAddress(p,a,b,c) (p)->GetPeerAddress(a,b,c) +#define IDirectPlay8Peer_GetLocalHostAddresses(p,a,b,c) (p)->GetLocalHostAddresses(a,b,c) +#define IDirectPlay8Peer_Close(p,a) (p)->Close(a) +#define IDirectPlay8Peer_EnumHosts(p,a,b,c,d,e,f,g,h,i,j,k) (p)->EnumHosts(a,b,c,d,e,f,g,h,i,j,k) +#define IDirectPlay8Peer_DestroyPeer(p,a,b,c,d) (p)->DestroyPeer(a,b,c,d) +#define IDirectPlay8Peer_ReturnBuffer(p,a,b) (p)->ReturnBuffer(a,b) +#define IDirectPlay8Peer_GetPlayerContext(p,a,b,c) (p)->GetPlayerContext(a,b,c) +#define IDirectPlay8Peer_GetGroupContext(p,a,b,c) (p)->GetGroupContext(a,b,c) +#define IDirectPlay8Peer_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay8Peer_SetCaps(p,a,b) (p)->SetCaps(a,b) +#define IDirectPlay8Peer_SetSPCaps(p,a,b,c) (p)->SetSPCaps(a,b,c) +#define IDirectPlay8Peer_GetSPCaps(p,a,b,c) (p)->GetSPCaps(a,b,c) +#define IDirectPlay8Peer_GetConnectionInfo(p,a,b,c) (p)->GetConnectionInfo(a,b,c) +#define IDirectPlay8Peer_RegisterLobby(p,a,b,c) (p)->RegisterLobby(a,b,c) +#define IDirectPlay8Peer_TerminateSession(p,a,b,c) (p)->TerminateSession(a,b,c) + +#define IDirectPlay8ThreadPool_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8ThreadPool_AddRef(p) (p)->AddRef() +#define IDirectPlay8ThreadPool_Release(p) (p)->Release() +#define IDirectPlay8ThreadPool_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8ThreadPool_Close(p,a) (p)->Close(a) +#define IDirectPlay8ThreadPool_GetThreadCount(p,a,b,c) (p)->GetThreadCount(a,b,c) +#define IDirectPlay8ThreadPool_SetThreadCount(p,a,b,c) (p)->SetThreadCount(a,b,c) +#define IDirectPlay8ThreadPool_DoWork(p,a,b) (p)->DoWork(a,b) + +#define IDirectPlay8NATResolver_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8NATResolver_AddRef(p) (p)->AddRef() +#define IDirectPlay8NATResolver_Release(p) (p)->Release() +#define IDirectPlay8NATResolver_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8NATResolver_Start(p,a,b,c) (p)->Start(a,b,c) +#define IDirectPlay8NATResolver_Close(p,a) (p)->Close(a) +#define IDirectPlay8NATResolver_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectPlay8NATResolver_GetAddresses(p,a,b,c) (p)->GetAddresses(a,b,c) + +#endif + + + +/**************************************************************************** + * + * DIRECTPLAY8 ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _DPN_FACILITY_CODE 0x015 +#define _DPNHRESULT_BASE 0x8000 +#define MAKE_DPNHRESULT( code ) MAKE_HRESULT( 1, _DPN_FACILITY_CODE, ( code + _DPNHRESULT_BASE ) ) + +#define DPN_OK S_OK + +#define DPNSUCCESS_EQUAL MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x5 + _DPNHRESULT_BASE ) ) +#define DPNSUCCESS_NOPLAYERSINGROUP MAKE_HRESULT( 0, _DPN_FACILITY_CODE, ( 0x8 + _DPNHRESULT_BASE ) ) // added for DirectX 9 +#define DPNSUCCESS_NOTEQUAL MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0A + _DPNHRESULT_BASE ) ) +#define DPNSUCCESS_PENDING MAKE_HRESULT( 0, _DPN_FACILITY_CODE, (0x0e + _DPNHRESULT_BASE ) ) + +#define DPNERR_ABORTED MAKE_DPNHRESULT( 0x30 ) +#define DPNERR_ADDRESSING MAKE_DPNHRESULT( 0x40 ) +#define DPNERR_ALREADYCLOSING MAKE_DPNHRESULT( 0x50 ) +#define DPNERR_ALREADYCONNECTED MAKE_DPNHRESULT( 0x60 ) +#define DPNERR_ALREADYDISCONNECTING MAKE_DPNHRESULT( 0x70 ) +#define DPNERR_ALREADYINITIALIZED MAKE_DPNHRESULT( 0x80 ) +#define DPNERR_ALREADYREGISTERED MAKE_DPNHRESULT( 0x90 ) +#define DPNERR_BUFFERTOOSMALL MAKE_DPNHRESULT( 0x100 ) +#define DPNERR_CANNOTCANCEL MAKE_DPNHRESULT( 0x110 ) +#define DPNERR_CANTCREATEGROUP MAKE_DPNHRESULT( 0x120 ) +#define DPNERR_CANTCREATEPLAYER MAKE_DPNHRESULT( 0x130 ) +#define DPNERR_CANTLAUNCHAPPLICATION MAKE_DPNHRESULT( 0x140 ) +#define DPNERR_CONNECTING MAKE_DPNHRESULT( 0x150 ) +#define DPNERR_CONNECTIONLOST MAKE_DPNHRESULT( 0x160 ) +#define DPNERR_CONVERSION MAKE_DPNHRESULT( 0x170 ) +#define DPNERR_DATATOOLARGE MAKE_DPNHRESULT( 0x175 ) +#define DPNERR_DOESNOTEXIST MAKE_DPNHRESULT( 0x180 ) +#define DPNERR_DPNSVRNOTAVAILABLE MAKE_DPNHRESULT( 0x185 ) +#define DPNERR_DUPLICATECOMMAND MAKE_DPNHRESULT( 0x190 ) +#define DPNERR_ENDPOINTNOTRECEIVING MAKE_DPNHRESULT( 0x200 ) +#define DPNERR_ENUMQUERYTOOLARGE MAKE_DPNHRESULT( 0x210 ) +#define DPNERR_ENUMRESPONSETOOLARGE MAKE_DPNHRESULT( 0x220 ) +#define DPNERR_EXCEPTION MAKE_DPNHRESULT( 0x230 ) +#define DPNERR_GENERIC E_FAIL +#define DPNERR_GROUPNOTEMPTY MAKE_DPNHRESULT( 0x240 ) +#define DPNERR_HOSTING MAKE_DPNHRESULT( 0x250 ) +#define DPNERR_HOSTREJECTEDCONNECTION MAKE_DPNHRESULT( 0x260 ) +#define DPNERR_HOSTTERMINATEDSESSION MAKE_DPNHRESULT( 0x270 ) +#define DPNERR_INCOMPLETEADDRESS MAKE_DPNHRESULT( 0x280 ) +#define DPNERR_INVALIDADDRESSFORMAT MAKE_DPNHRESULT( 0x290 ) +#define DPNERR_INVALIDAPPLICATION MAKE_DPNHRESULT( 0x300 ) +#define DPNERR_INVALIDCOMMAND MAKE_DPNHRESULT( 0x310 ) +#define DPNERR_INVALIDDEVICEADDRESS MAKE_DPNHRESULT( 0x320 ) +#define DPNERR_INVALIDENDPOINT MAKE_DPNHRESULT( 0x330 ) +#define DPNERR_INVALIDFLAGS MAKE_DPNHRESULT( 0x340 ) +#define DPNERR_INVALIDGROUP MAKE_DPNHRESULT( 0x350 ) +#define DPNERR_INVALIDHANDLE MAKE_DPNHRESULT( 0x360 ) +#define DPNERR_INVALIDHOSTADDRESS MAKE_DPNHRESULT( 0x370 ) +#define DPNERR_INVALIDINSTANCE MAKE_DPNHRESULT( 0x380 ) +#define DPNERR_INVALIDINTERFACE MAKE_DPNHRESULT( 0x390 ) +#define DPNERR_INVALIDOBJECT MAKE_DPNHRESULT( 0x400 ) +#define DPNERR_INVALIDPARAM E_INVALIDARG +#define DPNERR_INVALIDPASSWORD MAKE_DPNHRESULT( 0x410 ) +#define DPNERR_INVALIDPLAYER MAKE_DPNHRESULT( 0x420 ) +#define DPNERR_INVALIDPOINTER E_POINTER +#define DPNERR_INVALIDPRIORITY MAKE_DPNHRESULT( 0x430 ) +#define DPNERR_INVALIDSTRING MAKE_DPNHRESULT( 0x440 ) +#define DPNERR_INVALIDURL MAKE_DPNHRESULT( 0x450 ) +#define DPNERR_INVALIDVERSION MAKE_DPNHRESULT( 0x460 ) +#define DPNERR_NOCAPS MAKE_DPNHRESULT( 0x470 ) +#define DPNERR_NOCONNECTION MAKE_DPNHRESULT( 0x480 ) +#define DPNERR_NOHOSTPLAYER MAKE_DPNHRESULT( 0x490 ) +#define DPNERR_NOINTERFACE E_NOINTERFACE +#define DPNERR_NOMOREADDRESSCOMPONENTS MAKE_DPNHRESULT( 0x500 ) +#define DPNERR_NORESPONSE MAKE_DPNHRESULT( 0x510 ) +#define DPNERR_NOTALLOWED MAKE_DPNHRESULT( 0x520 ) +#define DPNERR_NOTHOST MAKE_DPNHRESULT( 0x530 ) +#define DPNERR_NOTREADY MAKE_DPNHRESULT( 0x540 ) +#define DPNERR_NOTREGISTERED MAKE_DPNHRESULT( 0x550 ) +#define DPNERR_OUTOFMEMORY E_OUTOFMEMORY +#define DPNERR_PENDING DPNSUCCESS_PENDING +#define DPNERR_PLAYERALREADYINGROUP MAKE_DPNHRESULT( 0x560 ) +#define DPNERR_PLAYERLOST MAKE_DPNHRESULT( 0x570 ) +#define DPNERR_PLAYERNOTINGROUP MAKE_DPNHRESULT( 0x580 ) +#define DPNERR_PLAYERNOTREACHABLE MAKE_DPNHRESULT( 0x590 ) +#define DPNERR_SENDTOOLARGE MAKE_DPNHRESULT( 0x600 ) +#define DPNERR_SESSIONFULL MAKE_DPNHRESULT( 0x610 ) +#define DPNERR_TABLEFULL MAKE_DPNHRESULT( 0x620 ) +#define DPNERR_TIMEDOUT MAKE_DPNHRESULT( 0x630 ) +#define DPNERR_UNINITIALIZED MAKE_DPNHRESULT( 0x640 ) +#define DPNERR_UNSUPPORTED E_NOTIMPL +#define DPNERR_USERCANCEL MAKE_DPNHRESULT( 0x650 ) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/SDK/dxSDK/Include/dplobby.h b/SDK/dxSDK/Include/dplobby.h new file mode 100644 index 00000000..c91d3238 --- /dev/null +++ b/SDK/dxSDK/Include/dplobby.h @@ -0,0 +1,853 @@ +/*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dplobby.h + * Content: DirectPlayLobby include file + ***************************************************************************/ +#ifndef __DPLOBBY_INCLUDED__ +#define __DPLOBBY_INCLUDED__ + +#include "dplay.h" + +/* avoid warnings at Level 4 */ +#pragma warning(disable:4201) + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * GUIDS used by DirectPlay objects + */ + +/* {AF465C71-9588-11cf-A020-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); +/* {26C66A70-B367-11cf-A024-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); +/* {0194C220-A303-11d0-9C4F-00A0C905425E} */ +DEFINE_GUID(IID_IDirectPlayLobby2, 0x194c220, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); +/* {1BB4AF80-A303-11d0-9C4F-00A0C905425E} */ +DEFINE_GUID(IID_IDirectPlayLobby2A, 0x1bb4af80, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); +/* {2DB72490-652C-11d1-A7A8-0000F803ABFC} */ +DEFINE_GUID(IID_IDirectPlayLobby3, 0x2db72490, 0x652c, 0x11d1, 0xa7, 0xa8, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +/* {2DB72491-652C-11d1-A7A8-0000F803ABFC} */ +DEFINE_GUID(IID_IDirectPlayLobby3A, 0x2db72491, 0x652c, 0x11d1, 0xa7, 0xa8, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +/* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} */ +DEFINE_GUID(CLSID_DirectPlayLobby, 0x2fe8f810, 0xb2a5, 0x11d0, 0xa7, 0x87, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + + +/**************************************************************************** + * + * IDirectPlayLobby Structures + * + * Various structures used to invoke DirectPlayLobby. + * + ****************************************************************************/ + +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBY; +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBYA; +typedef struct IDirectPlayLobby IDirectPlayLobbyA; + +typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2; +typedef struct IDirectPlayLobby2 FAR *LPDIRECTPLAYLOBBY2A; +typedef struct IDirectPlayLobby2 IDirectPlayLobby2A; + +typedef struct IDirectPlayLobby3 FAR *LPDIRECTPLAYLOBBY3; +typedef struct IDirectPlayLobby3 FAR *LPDIRECTPLAYLOBBY3A; +typedef struct IDirectPlayLobby3 IDirectPlayLobby3A; + + +/* + * DPLAPPINFO + * Used to hold information about a registered DirectPlay + * application + */ +typedef struct DPLAPPINFO +{ + DWORD dwSize; // Size of this structure + GUID guidApplication; // GUID of the Application + union + { + LPSTR lpszAppNameA; // Pointer to the Application Name + LPWSTR lpszAppName; + }; + +} DPLAPPINFO, FAR *LPDPLAPPINFO; + +/* + * LPCDPLAPPINFO + * A constant pointer to DPLAPPINFO + */ +typedef const DPLAPPINFO FAR *LPCDPLAPPINFO; + +/* + * DPCOMPOUNDADDRESSELEMENT + * + * An array of these is passed to CreateCompoundAddresses() + */ +typedef struct DPCOMPOUNDADDRESSELEMENT +{ + GUID guidDataType; + DWORD dwDataSize; + LPVOID lpData; +} DPCOMPOUNDADDRESSELEMENT, FAR *LPDPCOMPOUNDADDRESSELEMENT; + +/* + * LPCDPCOMPOUNDADDRESSELEMENT + * A constant pointer to DPCOMPOUNDADDRESSELEMENT + */ +typedef const DPCOMPOUNDADDRESSELEMENT FAR *LPCDPCOMPOUNDADDRESSELEMENT; + +/* + * LPDPAPPLICATIONDESC + * Used to register a DirectPlay application + */ +typedef struct DPAPPLICATIONDESC +{ + DWORD dwSize; + DWORD dwFlags; + union + { + LPSTR lpszApplicationNameA; + LPWSTR lpszApplicationName; + }; + GUID guidApplication; + union + { + LPSTR lpszFilenameA; + LPWSTR lpszFilename; + }; + union + { + LPSTR lpszCommandLineA; + LPWSTR lpszCommandLine; + }; + union + { + LPSTR lpszPathA; + LPWSTR lpszPath; + }; + union + { + LPSTR lpszCurrentDirectoryA; + LPWSTR lpszCurrentDirectory; + }; + LPSTR lpszDescriptionA; + LPWSTR lpszDescriptionW; +} DPAPPLICATIONDESC, *LPDPAPPLICATIONDESC; + +/* + * LPDPAPPLICATIONDESC2 + * Used to register a DirectPlay application + */ +typedef struct DPAPPLICATIONDESC2 +{ + DWORD dwSize; + DWORD dwFlags; + union + { + LPSTR lpszApplicationNameA; + LPWSTR lpszApplicationName; + }; + GUID guidApplication; + union + { + LPSTR lpszFilenameA; + LPWSTR lpszFilename; + }; + union + { + LPSTR lpszCommandLineA; + LPWSTR lpszCommandLine; + }; + union + { + LPSTR lpszPathA; + LPWSTR lpszPath; + }; + union + { + LPSTR lpszCurrentDirectoryA; + LPWSTR lpszCurrentDirectory; + }; + LPSTR lpszDescriptionA; + LPWSTR lpszDescriptionW; + union + { + LPSTR lpszAppLauncherNameA; + LPWSTR lpszAppLauncherName; + }; +} DPAPPLICATIONDESC2, *LPDPAPPLICATIONDESC2; + + +/**************************************************************************** + * + * Enumeration Method Callback Prototypes + * + ****************************************************************************/ + +/* + * Callback for EnumAddress() + */ +typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)( + REFGUID guidDataType, + DWORD dwDataSize, + LPCVOID lpData, + LPVOID lpContext); + +/* + * Callback for EnumAddressTypes() + */ +typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)( + REFGUID guidDataType, + LPVOID lpContext, + DWORD dwFlags); + +/* + * Callback for EnumLocalApplications() + */ +typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)( + LPCDPLAPPINFO lpAppInfo, + LPVOID lpContext, + DWORD dwFlags); + + +/**************************************************************************** + * + * DirectPlayLobby API Prototypes + * + ****************************************************************************/ +#ifdef UNICODE +#define DirectPlayLobbyCreate DirectPlayLobbyCreateW +#else +#define DirectPlayLobbyCreate DirectPlayLobbyCreateA +#endif /* UNICODE */ + +extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD ); +extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD ); + + +/**************************************************************************** + * + * IDirectPlayLobby (and IDirectPlayLobbyA) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby +DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + +}; + +/**************************************************************************** + * + * IDirectPlayLobby2 (and IDirectPlayLobby2A) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby2 +DECLARE_INTERFACE_( IDirectPlayLobby2, IDirectPlayLobby ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + + /* IDirectPlayLobby2 Methods */ + STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT,DWORD,LPVOID,LPDWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayLobby3 (and IDirectPlayLobby3A) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby3 +DECLARE_INTERFACE_( IDirectPlayLobby3, IDirectPlayLobby ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + + /* IDirectPlayLobby2 Methods */ + STDMETHOD(CreateCompoundAddress)(THIS_ LPCDPCOMPOUNDADDRESSELEMENT,DWORD,LPVOID,LPDWORD) PURE; + + /* IDirectPlayLobby3 Methods */ + STDMETHOD(ConnectEx) (THIS_ DWORD, REFIID, LPVOID *, IUnknown FAR *) PURE; + STDMETHOD(RegisterApplication) (THIS_ DWORD, LPVOID) PURE; + STDMETHOD(UnregisterApplication)(THIS_ DWORD, REFGUID) PURE; + STDMETHOD(WaitForConnectionSettings)(THIS_ DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayLobby interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayLobby_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayLobby_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c) +#define IDirectPlayLobby_ConnectEx(p,a,b,c,d) (p)->lpVtbl->ConnectEx(p,a,b,c,d) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f) +#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->lpVtbl->CreateCompoundAddress(p,a,b,c,d) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->lpVtbl->EnumAddress(p,a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->lpVtbl->EnumLocalApplications(p,a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->lpVtbl->GetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e) +#define IDirectPlayLobby_RegisterApplication(p,a,b) (p)->lpVtbl->RegisterApplication(p,a,b) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->lpVtbl->RunApplication(p,a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c) +#define IDirectPlayLobby_UnregisterApplication(p,a,b) (p)->lpVtbl->UnregisterApplication(p,a,b) +#define IDirectPlayLobby_WaitForConnectionSettings(p,a) (p)->lpVtbl->WaitForConnectionSettings(p,a) + +#else /* C++ */ + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayLobby_AddRef(p) (p)->AddRef() +#define IDirectPlayLobby_Release(p) (p)->Release() +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->Connect(a,b,c) +#define IDirectPlayLobby_ConnectEx(p,a,b,c,d) (p)->ConnectEx(a,b,c,d) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->CreateAddress(a,b,c,d,e,f) +#define IDirectPlayLobby_CreateCompoundAddress(p,a,b,c,d) (p)->CreateCompoundAddress(a,b,c,d) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->EnumAddress(a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->EnumAddressTypes(a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->EnumLocalApplications(a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->GetConnectionSettings(a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->ReceiveLobbyMessage(a,b,c,d,e) +#define IDirectPlayLobby_RegisterApplication(p,a,b) (p)->RegisterApplication(a,b) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->RunApplication(a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->SendLobbyMessage(a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->SetLobbyMessageEvent(a,b,c) +#define IDirectPlayLobby_UnregisterApplication(p,a,b) (p)->UnregisterApplication(a,b) +#define IDirectPlayLobby_WaitForConnectionSettings(p,a) (p)->WaitForConnectionSettings(a) + +#endif + +/**************************************************************************** + * + * DirectPlayLobby Flags + * + ****************************************************************************/ + +/* + * This flag is used by IDirectPlayLobby->WaitForConnectionSettings to + * cancel a current wait that is in progress. + */ +#define DPLWAIT_CANCEL 0x00000001 + + +/* + * This is a message flag used by ReceiveLobbyMessage. It can be + * returned in the dwMessageFlags parameter to indicate a message from + * the system. + */ +#define DPLMSG_SYSTEM 0x00000001 + +/* + * This is a message flag used by ReceiveLobbyMessage and SendLobbyMessage. + * It is used to indicate that the message is a standard lobby message. + * DPLMSG_SETPROPERTY, DPLMSG_SETPROPERTYRESPONSE, DPLMSG_GETPROPERTY, + * DPLMSG_GETPROPERTYRESPONSE + */ +#define DPLMSG_STANDARD 0x00000002 + +/* + * Lobbyable Application registration flags + */ + +/* + * Applications registered with this flag will not show up when + * applications are enumerated in the lobby. This application + * will only be able to be launched by a lobby client that already + * knows about the application. + */ +#define DPLAPP_NOENUM 0x80000000 + +/* + * Applications registered with this flag want voice to automatically + * be enabled for their application. All players will be launched into + * an 'n'-way voice conference when the application is started. The + * user will be able to enable this flag for existing non-voice + * directplay applications. + */ +#define DPLAPP_AUTOVOICE 0x00000001 + +/* + * Applications that do their own voice conferencing should register with + * this flag to avoid allowing the user to enable other voice chat + * capabilites during the same session. This is to avoid users forcing + * the DPLAPP_AUTOVOICE flag for the application. + */ +#define DPLAPP_SELFVOICE 0x00000002 + +/**************************************************************************** + * + * DirectPlayLobby messages and message data structures + * + * All system messages have a dwMessageFlags value of DPLMSG_SYSTEM returned + * from a call to ReceiveLobbyMessage. + * + * All standard messages have a dwMessageFlags value of DPLMSG_STANDARD returned + * from a call to ReceiveLobbyMessage. + * + ****************************************************************************/ + +/* + * DPLMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct _DPLMSG_GENERIC +{ + DWORD dwType; // Message type +} DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC; + +/* + * DPLMSG_SYSTEMMESSAGE + * Generic message format for all system messages -- + * DPLSYS_CONNECTIONSETTINGSREAD, DPLSYS_DPLYCONNECTSUCCEEDED, + * DPLSYS_DPLAYCONNECTFAILED, DPLSYS_APPTERMINATED, DPLSYS_NEWCONNECTIONSETTINGS + */ +typedef struct _DPLMSG_SYSTEMMESSAGE +{ + DWORD dwType; // Message type + GUID guidInstance; // Instance GUID of the dplay session the message corresponds to +} DPLMSG_SYSTEMMESSAGE, FAR *LPDPLMSG_SYSTEMMESSAGE; + +/* + * DPLMSG_SETPROPERTY + * Standard message sent by an application to a lobby to set a + * property + */ +typedef struct _DPLMSG_SETPROPERTY +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID (DPL_NOCONFIRMATION if no confirmation desired) + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + DWORD dwDataSize; // Size of data + DWORD dwPropertyData[1]; // Buffer containing data +} DPLMSG_SETPROPERTY, FAR *LPDPLMSG_SETPROPERTY; + +#define DPL_NOCONFIRMATION 0 + +/* + * DPLMSG_SETPROPERTYRESPONSE + * Standard message returned by a lobby to confirm a + * DPLMSG_SETPROPERTY message. + */ +typedef struct _DPLMSG_SETPROPERTYRESPONSE +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + HRESULT hr; // Return Code +} DPLMSG_SETPROPERTYRESPONSE, FAR *LPDPLMSG_SETPROPERTYRESPONSE; + +/* + * DPLMSG_GETPROPERTY + * Standard message sent by an application to a lobby to request + * the current value of a property + */ +typedef struct _DPLMSG_GETPROPERTY +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID +} DPLMSG_GETPROPERTY, FAR *LPDPLMSG_GETPROPERTY; + +/* + * DPLMSG_GETPROPERTYRESPONSE + * Standard message returned by a lobby in response to a + * DPLMSG_GETPROPERTY message. + */ +typedef struct _DPLMSG_GETPROPERTYRESPONSE +{ + DWORD dwType; // Message type + DWORD dwRequestID; // Request ID + GUID guidPlayer; // Player GUID + GUID guidPropertyTag; // Property GUID + HRESULT hr; // Return Code + DWORD dwDataSize; // Size of data + DWORD dwPropertyData[1]; // Buffer containing data +} DPLMSG_GETPROPERTYRESPONSE, FAR *LPDPLMSG_GETPROPERTYRESPONSE; + +/* + * DPLMSG_NEWSESSIONHOST + * Standard message returned by a lobby in response to a + * the session host migrating to a new client + */ +typedef struct _DPLMSG_NEWSESSIONHOST +{ + DWORD dwType; // Message type + GUID guidInstance; // GUID Instance of the session +} DPLMSG_NEWSESSIONHOST, FAR *LPDPLMSG_NEWSESSIONHOST; + + +/****************************************** + * + * DirectPlay Lobby message dwType values + * + *****************************************/ + +/* + * The application has read the connection settings. + * It is now O.K. for the lobby client to release + * its IDirectPlayLobby interface. + */ +#define DPLSYS_CONNECTIONSETTINGSREAD 0x00000001 + +/* + * The application's call to DirectPlayConnect failed + */ +#define DPLSYS_DPLAYCONNECTFAILED 0x00000002 + +/* + * The application has created a DirectPlay session. + */ +#define DPLSYS_DPLAYCONNECTSUCCEEDED 0x00000003 + +/* + * The application has terminated. + */ +#define DPLSYS_APPTERMINATED 0x00000004 + +/* + * The message is a DPLMSG_SETPROPERTY message. + */ +#define DPLSYS_SETPROPERTY 0x00000005 + +/* + * The message is a DPLMSG_SETPROPERTYRESPONSE message. + */ +#define DPLSYS_SETPROPERTYRESPONSE 0x00000006 + +/* + * The message is a DPLMSG_GETPROPERTY message. + */ +#define DPLSYS_GETPROPERTY 0x00000007 + +/* + * The message is a DPLMSG_GETPROPERTYRESPONSE message. + */ +#define DPLSYS_GETPROPERTYRESPONSE 0x00000008 + +/* + * The message is a DPLMSG_NEWSESSIONHOST message. + */ +#define DPLSYS_NEWSESSIONHOST 0x00000009 + +/* + * New connection settings are available. + */ +#define DPLSYS_NEWCONNECTIONSETTINGS 0x0000000A + +/* + * The Lobby Client has released the DirectPlayLobby Interface + */ +#define DPLSYS_LOBBYCLIENTRELEASE 0x0000000B + +/**************************************************************************** + * + * DirectPlay defined property GUIDs and associated data structures + * + ****************************************************************************/ + +/* + * DPLPROPERTY_MessagesSupported + * + * Request whether the lobby supports standard. Lobby with respond with either + * TRUE or FALSE or may not respond at all. + * + * Property data is a single BOOL with TRUE or FALSE + */ +// {762CCDA1-D916-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_MessagesSupported, +0x762ccda1, 0xd916, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLPROPERTY_LobbyGuid + * + * Request the GUID that identifies the lobby software that the application + * is communicating with. + * + * Property data is a single GUID. + */ +// {F56920A0-D218-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_LobbyGuid, +0xf56920a0, 0xd218, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLPROPERTY_PlayerGuid + * + * Request the GUID that identifies the player on this machine for sending + * property data back to the lobby. + * + * Property data is the DPLDATA_PLAYERDATA structure + */ +// {B4319322-D20D-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_PlayerGuid, +0xb4319322, 0xd20d, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLDATA_PLAYERGUID + * + * Data structure to hold the GUID of the player and player creation flags + * from the lobby. + */ +typedef struct _DPLDATA_PLAYERGUID +{ + GUID guidPlayer; + DWORD dwPlayerFlags; +} DPLDATA_PLAYERGUID, FAR *LPDPLDATA_PLAYERGUID; + +/* + * DPLPROPERTY_PlayerScore + * + * Used to send an array of long integers to the lobby indicating the + * score of a player. + * + * Property data is the DPLDATA_PLAYERSCORE structure. + */ +// {48784000-D219-11d0-BA39-00C04FD7ED67} +DEFINE_GUID(DPLPROPERTY_PlayerScore, +0x48784000, 0xd219, 0x11d0, 0xba, 0x39, 0x0, 0xc0, 0x4f, 0xd7, 0xed, 0x67); + +/* + * DPLDATA_PLAYERSCORE + * + * Data structure to hold an array of long integers representing a player score. + * Application must allocate enough memory to hold all the scores. + */ +typedef struct _DPLDATA_PLAYERSCORE +{ + DWORD dwScoreCount; + LONG Score[1]; +} DPLDATA_PLAYERSCORE, FAR *LPDPLDATA_PLAYERSCORE; + +/**************************************************************************** + * + * DirectPlay Address ID's + * + ****************************************************************************/ + +/* DirectPlay Address + * + * A DirectPlay address consists of multiple chunks of data, each tagged + * with a GUID signifying the type of data in the chunk. The chunk also + * has a length so that unknown chunk types can be skipped. + * + * The EnumAddress() function is used to parse these address data chunks. + */ + +/* + * DPADDRESS + * + * Header for block of address data elements + */ +typedef struct _DPADDRESS +{ + GUID guidDataType; + DWORD dwDataSize; +} DPADDRESS; + +typedef DPADDRESS FAR *LPDPADDRESS; + +/* + * DPAID_TotalSize + * + * Chunk is a DWORD containing size of entire DPADDRESS structure + */ + +// {1318F560-912C-11d0-9DAA-00A0C90A43CB} +DEFINE_GUID(DPAID_TotalSize, +0x1318f560, 0x912c, 0x11d0, 0x9d, 0xaa, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +/* + * DPAID_ServiceProvider + * + * Chunk is a GUID describing the service provider that created the chunk. + * All addresses must contain this chunk. + */ + +// {07D916C0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ServiceProvider, +0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_LobbyProvider + * + * Chunk is a GUID describing the lobby provider that created the chunk. + * All addresses must contain this chunk. + */ + +// {59B95640-9667-11d0-A77D-0000F803ABFC} +DEFINE_GUID(DPAID_LobbyProvider, +0x59b95640, 0x9667, 0x11d0, 0xa7, 0x7d, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + +/* + * DPAID_Phone and DPAID_PhoneW + * + * Chunk is a string containing a phone number (i.e. "1-800-555-1212") + * in ANSI or UNICODE format + */ + +// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_Phone, +0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {BA5A7A70-9DBF-11d0-9CC1-00A0C905425E} +DEFINE_GUID(DPAID_PhoneW, +0xba5a7a70, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Modem and DPAID_ModemW + * + * Chunk is a string containing a modem name registered with TAPI + * in ANSI or UNICODE format + */ + +// {F6DCC200-A2FE-11d0-9C4F-00A0C905425E} +DEFINE_GUID(DPAID_Modem, +0xf6dcc200, 0xa2fe, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {01FD92E0-A2FF-11d0-9C4F-00A0C905425E} +DEFINE_GUID(DPAID_ModemW, +0x1fd92e0, 0xa2ff, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Inet and DPAID_InetW + * + * Chunk is a string containing a TCP/IP host name or an IP address + * (i.e. "dplay.microsoft.com" or "137.55.100.173") in ANSI or UNICODE format + */ + +// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_INet, +0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// {E63232A0-9DBF-11d0-9CC1-00A0C905425E} +DEFINE_GUID(DPAID_INetW, +0xe63232a0, 0x9dbf, 0x11d0, 0x9c, 0xc1, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_InetPort + * + * Chunk is the port number used for creating the apps TCP and UDP sockets. + * WORD value (i.e. 47624). + */ + +// {E4524541-8EA5-11d1-8A96-006097B01411} +DEFINE_GUID(DPAID_INetPort, +0xe4524541, 0x8ea5, 0x11d1, 0x8a, 0x96, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +#ifdef BIGMESSAGEDEFENSE +#endif + +/* + * DPCOMPORTADDRESS + * + * Used to specify com port settings. The constants that define baud rate, + * stop bits and parity are defined in WINBASE.H. The constants for flow + * control are given below. + */ + +#define DPCPA_NOFLOW 0 // no flow control +#define DPCPA_XONXOFFFLOW 1 // software flow control +#define DPCPA_RTSFLOW 2 // hardware flow control with RTS +#define DPCPA_DTRFLOW 3 // hardware flow control with DTR +#define DPCPA_RTSDTRFLOW 4 // hardware flow control with RTS and DTR + +typedef struct _DPCOMPORTADDRESS +{ + DWORD dwComPort; // COM port to use (1-4) + DWORD dwBaudRate; // baud rate (100-256k) + DWORD dwStopBits; // no. stop bits (1-2) + DWORD dwParity; // parity (none, odd, even, mark) + DWORD dwFlowControl; // flow control (none, xon/xoff, rts, dtr) +} DPCOMPORTADDRESS; + +typedef DPCOMPORTADDRESS FAR *LPDPCOMPORTADDRESS; + +/* + * DPAID_ComPort + * + * Chunk contains a DPCOMPORTADDRESS structure defining the serial port. + */ + +// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ComPort, +0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/**************************************************************************** + * + * dplobby 1.0 obsolete definitions + * Included for compatibility only. + * + ****************************************************************************/ +#define DPLAD_SYSTEM DPLMSG_SYSTEM + + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#pragma warning(default:4201) + +#endif /* __DPLOBBY_INCLUDED__ */ + diff --git a/SDK/dxSDK/Include/dplobby8.h b/SDK/dxSDK/Include/dplobby8.h new file mode 100644 index 00000000..e63a5aac --- /dev/null +++ b/SDK/dxSDK/Include/dplobby8.h @@ -0,0 +1,407 @@ +/*========================================================================== + * + * Copyright (C) 2000 Microsoft Corporation. All Rights Reserved. + * + * File: DPLobby.h + * Content: DirectPlay8 Lobby Include File + * + ***************************************************************************/ + +#ifndef __DPLOBBY_H__ +#define __DPLOBBY_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * DirectPlay8Lobby CLSIDs + * + ****************************************************************************/ + +// {667955AD-6B3B-43ca-B949-BC69B5BAFF7F} +DEFINE_GUID(CLSID_DirectPlay8LobbiedApplication, +0x667955ad, 0x6b3b, 0x43ca, 0xb9, 0x49, 0xbc, 0x69, 0xb5, 0xba, 0xff, 0x7f); + +// {3B2B6775-70B6-45af-8DEA-A209C69559F3} +DEFINE_GUID(CLSID_DirectPlay8LobbyClient, +0x3b2b6775, 0x70b6, 0x45af, 0x8d, 0xea, 0xa2, 0x9, 0xc6, 0x95, 0x59, 0xf3); + +/**************************************************************************** + * + * DirectPlay8Lobby Interface IIDs + * + ****************************************************************************/ + +// {819074A3-016C-11d3-AE14-006097B01411} +DEFINE_GUID(IID_IDirectPlay8LobbiedApplication, +0x819074a3, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +// {819074A2-016C-11d3-AE14-006097B01411} +DEFINE_GUID(IID_IDirectPlay8LobbyClient, +0x819074a2, 0x16c, 0x11d3, 0xae, 0x14, 0x0, 0x60, 0x97, 0xb0, 0x14, 0x11); + +/**************************************************************************** + * + * DirectPlay8Lobby Interface Pointer + * + ****************************************************************************/ + +typedef struct IDirectPlay8LobbiedApplication *PDIRECTPLAY8LOBBIEDAPPLICATION; +typedef struct IDirectPlay8LobbyClient *PDIRECTPLAY8LOBBYCLIENT; + +/**************************************************************************** + * + * DirectPlay8 Lobby Message IDs + * + ****************************************************************************/ + +#define DPL_MSGID_LOBBY 0x8000 +#define DPL_MSGID_RECEIVE (0x0001 | DPL_MSGID_LOBBY) +#define DPL_MSGID_CONNECT (0x0002 | DPL_MSGID_LOBBY) +#define DPL_MSGID_DISCONNECT (0x0003 | DPL_MSGID_LOBBY) +#define DPL_MSGID_SESSION_STATUS (0x0004 | DPL_MSGID_LOBBY) +#define DPL_MSGID_CONNECTION_SETTINGS (0x0005 | DPL_MSGID_LOBBY) + +/**************************************************************************** + * + * DirectPlay8Lobby Constants + * + ****************************************************************************/ + +// +// Specifies that operation should be performed on all open connections +// +#define DPLHANDLE_ALLCONNECTIONS 0xFFFFFFFF + +// +// The associated game session has suceeded in connecting / hosting +// +#define DPLSESSION_CONNECTED 0x0001 + +// The associated game session failed connecting / hosting +// +#define DPLSESSION_COULDNOTCONNECT 0x0002 + +// +// The associated game session has disconnected +// +#define DPLSESSION_DISCONNECTED 0x0003 + +// +// The associated game session has terminated +// +#define DPLSESSION_TERMINATED 0x0004 + +// +// The associated game session's host has migrated +// +#define DPLSESSION_HOSTMIGRATED 0x0005 + +// +// The associated game session's host has migrated to the local client +// +#define DPLSESSION_HOSTMIGRATEDHERE 0x0006 + + +/**************************************************************************** + * + * DirectPlay8 Lobby Flags + * + ****************************************************************************/ + +// +// Do not automatically make the lobby app unavailable when a connection is established +// +#define DPLAVAILABLE_ALLOWMULTIPLECONNECT 0x0001 + +// +// Launch a new instance of the application to connect to +// +#define DPLCONNECT_LAUNCHNEW 0x0001 + +// +// Launch a new instance of the application if one is not waiting +// +#define DPLCONNECT_LAUNCHNOTFOUND 0x0002 + +// +// When starting the associated game session, start it as a host +// +#define DPLCONNECTSETTINGS_HOST 0x0001 + +// +// Disable parameter validation +// +#define DPLINITIALIZE_DISABLEPARAMVAL 0x0001 + +/**************************************************************************** + * + * DirectPlay8Lobby Structures (Non-Message) + * + ****************************************************************************/ + +// +// Information on a registered game +// +typedef struct _DPL_APPLICATION_INFO { + GUID guidApplication; // GUID of the application + PWSTR pwszApplicationName; // Name of the application + DWORD dwNumRunning; // # of instances of this application running + DWORD dwNumWaiting; // # of instances of this application waiting + DWORD dwFlags; // Flags +} DPL_APPLICATION_INFO, *PDPL_APPLICATION_INFO; + +// +// Settings to be used for connecting / hosting a game session +// +typedef struct _DPL_CONNECTION_SETTINGS { + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Connection settings flags (DPLCONNECTSETTINGS_...) + DPN_APPLICATION_DESC dpnAppDesc; // Application desc for the associated DirectPlay session + IDirectPlay8Address *pdp8HostAddress; // Address of host to connect to + IDirectPlay8Address **ppdp8DeviceAddresses; // Address of device to connect from / host on + DWORD cNumDeviceAddresses; // # of addresses specified in ppdp8DeviceAddresses + PWSTR pwszPlayerName; // Name to give the player +} DPL_CONNECTION_SETTINGS, *PDPL_CONNECTION_SETTINGS; + +// +// Information for performing a lobby connect +// (ConnectApplication) +// +typedef struct _DPL_CONNECT_INFO { + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags (DPLCONNECT_...) + GUID guidApplication; // GUID of application to launch + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; + // Settings application should use + PVOID pvLobbyConnectData; // User defined data block + DWORD dwLobbyConnectDataSize; + // Size of user defined data block +} DPL_CONNECT_INFO, *PDPL_CONNECT_INFO; + +// +// Information for registering an application +// (RegisterApplication) +// +typedef struct _DPL_PROGRAM_DESC { + DWORD dwSize; + DWORD dwFlags; + GUID guidApplication; // Application GUID + PWSTR pwszApplicationName; // Unicode application name + PWSTR pwszCommandLine; // Unicode command line arguments + PWSTR pwszCurrentDirectory; // Unicode current directory + PWSTR pwszDescription; // Unicode application description + PWSTR pwszExecutableFilename; // Unicode filename of application executable + PWSTR pwszExecutablePath; // Unicode path of application executable + PWSTR pwszLauncherFilename; // Unicode filename of launcher executable + PWSTR pwszLauncherPath; // Unicode path of launcher executable +} DPL_PROGRAM_DESC, *PDPL_PROGRAM_DESC; + +/**************************************************************************** + * + * DirectPlay8 Lobby Message Structures + * + ****************************************************************************/ + +// +// A connection was established +// (DPL_MSGID_CONNECT) +// +typedef struct _DPL_MESSAGE_CONNECT +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hConnectId; // Handle of new connection + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; // Connection settings for this connection + PVOID pvLobbyConnectData; // User defined lobby data block + DWORD dwLobbyConnectDataSize; // Size of user defined lobby data block + PVOID pvConnectionContext; // Context value for this connection (user set) +} DPL_MESSAGE_CONNECT, *PDPL_MESSAGE_CONNECT; + +// +// Connection settings have been updated +// (DPL_MSGID_CONNECTION_SETTINGS) +// +typedef struct _DPL_MESSAGE_CONNECTION_SETTINGS +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection for these settings + PDPL_CONNECTION_SETTINGS pdplConnectionSettings; // Connection settings + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_CONNECTION_SETTINGS, *PDPL_MESSAGE_CONNECTION_SETTINGS; + +// +// A connection has been disconnected +// (DPL_MSGID_DISCONNECT) +// +typedef struct _DPL_MESSAGE_DISCONNECT +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hDisconnectId; // Handle of the connection that was terminated + HRESULT hrReason; // Reason the connection was broken + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_DISCONNECT, *PDPL_MESSAGE_DISCONNECT; + +// +// Data was received through a connection +// (DPL_MSGID_RECEIVE) +// +typedef struct _DPL_MESSAGE_RECEIVE +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection that is from + BYTE *pBuffer; // Contents of the message + DWORD dwBufferSize; // Size of the message context + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_RECEIVE, *PDPL_MESSAGE_RECEIVE; + +// +// Current status of the associated connection +// (DPL_MSGID_SESSION_STATUS) +// +typedef struct _DPL_MESSAGE_SESSION_STATUS +{ + DWORD dwSize; // Size of this structure + DPNHANDLE hSender; // Handle of the connection that this is from + DWORD dwStatus; // Status (DPLSESSION_...) + PVOID pvConnectionContext; // Context value for this connection +} DPL_MESSAGE_SESSION_STATUS, *PDPL_MESSAGE_SESSION_STATUS; + +/**************************************************************************** + * + * DirectPlay8Lobby Create + * + ****************************************************************************/ + +/* + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay8 lobby objects. + * + * extern HRESULT WINAPI DirectPlay8LobbyCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + +/**************************************************************************** + * + * DirectPlay8 Functions + * + ****************************************************************************/ + +// +// COM definition for DirectPlayLobbyClient +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8LobbyClient +DECLARE_INTERFACE_(IDirectPlay8LobbyClient,IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + // IDirectPlayLobbyClient methods + STDMETHOD(Initialize) (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,const DWORD dwFlags) PURE; + STDMETHOD(EnumLocalPrograms) (THIS_ GUID *const pGuidApplication,BYTE *const pEnumData,DWORD *const pdwEnumData,DWORD *const pdwItems, const DWORD dwFlags) PURE; + STDMETHOD(ConnectApplication) (THIS_ DPL_CONNECT_INFO *const pdplConnectionInfo,const PVOID pvConnectionContext,DPNHANDLE *const hApplication,const DWORD dwTimeOut,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE; + STDMETHOD(ReleaseApplication) (THIS_ const DPNHANDLE hConnection, const DWORD dwFlags ) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags ) PURE; + STDMETHOD(GetConnectionSettings) (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE; + STDMETHOD(SetConnectionSettings) (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE; +}; + + +// +// COM definition for DirectPlayLobbiedApplication +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDirectPlay8LobbiedApplication +DECLARE_INTERFACE_(IDirectPlay8LobbiedApplication,IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + // IDirectPlayLobbiedApplication methods + STDMETHOD(Initialize) (THIS_ const PVOID pvUserContext,const PFNDPNMESSAGEHANDLER pfn,DPNHANDLE * const pdpnhConnection, const DWORD dwFlags) PURE; + STDMETHOD(RegisterProgram) (THIS_ PDPL_PROGRAM_DESC pdplProgramDesc,const DWORD dwFlags) PURE; + STDMETHOD(UnRegisterProgram) (THIS_ GUID *pguidApplication,const DWORD dwFlags) PURE; + STDMETHOD(Send) (THIS_ const DPNHANDLE hConnection,BYTE *const pBuffer,const DWORD pBufferSize,const DWORD dwFlags) PURE; + STDMETHOD(SetAppAvailable) (THIS_ const BOOL fAvailable, const DWORD dwFlags ) PURE; + STDMETHOD(UpdateStatus) (THIS_ const DPNHANDLE hConnection, const DWORD dwStatus, const DWORD dwFlags ) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags ) PURE; + STDMETHOD(GetConnectionSettings) (THIS_ const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo, DWORD *pdwInfoSize, const DWORD dwFlags ) PURE; + STDMETHOD(SetConnectionSettings) (THIS_ const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo, const DWORD dwFlags ) PURE; +}; + + +/**************************************************************************** + * + * DirectPlayLobby Interface Macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay8LobbyClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8LobbyClient_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8LobbyClient_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8LobbyClient_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e) (p)->lpVtbl->EnumLocalPrograms(p,a,b,c,d,e) +#define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e) (p)->lpVtbl->ConnectApplication(p,a,b,c,d,e) +#define IDirectPlay8LobbyClient_Send(p,a,b,c,d) (p)->lpVtbl->Send(p,a,b,c,d) +#define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b) (p)->lpVtbl->ReleaseApplication(p,a,b) +#define IDirectPlay8LobbyClient_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d) +#define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) + +#define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay8LobbiedApplication_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay8LobbiedApplication_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d) (p)->lpVtbl->Initialize(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->lpVtbl->RegisterProgram(p,a,b) +#define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->lpVtbl->UnRegisterProgram(p,a,b) +#define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->lpVtbl->Send(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->lpVtbl->SetAppAvailable(p,a,b) +#define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->lpVtbl->UpdateStatus(p,a,b,c) +#define IDirectPlay8LobbiedApplication_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetConnectionSettings(p,a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay8LobbyClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8LobbyClient_AddRef(p) (p)->AddRef() +#define IDirectPlay8LobbyClient_Release(p) (p)->Release() +#define IDirectPlay8LobbyClient_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectPlay8LobbyClient_EnumLocalPrograms(p,a,b,c,d,e) (p)->EnumLocalPrograms(a,b,c,d,e) +#define IDirectPlay8LobbyClient_ConnectApplication(p,a,b,c,d,e) (p)->ConnectApplication(a,b,c,d,e) +#define IDirectPlay8LobbyClient_Send(p,a,b,c,d) (p)->Send(a,b,c,d) +#define IDirectPlay8LobbyClient_ReleaseApplication(p,a,b) (p)->ReleaseApplication(a,b) +#define IDirectPlay8LobbyClient_Close(p,a) (p)->Close(a) +#define IDirectPlay8LobbyClient_GetConnectionSettings(p,a,b,c,d) (p)->GetConnectionSettings(a,b,c,d) +#define IDirectPlay8LobbyClient_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) + +#define IDirectPlay8LobbiedApplication_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay8LobbiedApplication_AddRef(p) (p)->AddRef() +#define IDirectPlay8LobbiedApplication_Release(p) (p)->Release() +#define IDirectPlay8LobbiedApplication_Initialize(p,a,b,c,d) (p)->Initialize(a,b,c,d) +#define IDirectPlay8LobbiedApplication_RegisterProgram(p,a,b) (p)->RegisterProgram(a,b) +#define IDirectPlay8LobbiedApplication_UnRegisterProgram(p,a,b) (p)->UnRegisterProgram(a,b) +#define IDirectPlay8LobbiedApplication_Send(p,a,b,c,d) (p)->Send(a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetAppAvailable(p,a,b) (p)->SetAppAvailable(a,b) +#define IDirectPlay8LobbiedApplication_UpdateStatus(p,a,b,c) (p)->UpdateStatus(a,b,c) +#define IDirectPlay8LobbiedApplication_Close(p,a) (p)->Close(a) +#define IDirectPlay8LobbiedApplication_GetConnectionSettings(p,a,b,c,d) (p)->GetConnectionSettings(a,b,c,d) +#define IDirectPlay8LobbiedApplication_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __DPLOBBY_H__ + diff --git a/SDK/dxSDK/Include/dpnathlp.h b/SDK/dxSDK/Include/dpnathlp.h new file mode 100644 index 00000000..720e43ad --- /dev/null +++ b/SDK/dxSDK/Include/dpnathlp.h @@ -0,0 +1,318 @@ +/*************************************************************************** + * + * Copyright (C) 2001-2002 Microsoft Corporation. All Rights Reserved. + * + * File: dpnathlp.h + * + * Content: Header for using DirectPlayNATHelp interface. + * + * + * NOTE: This interface is deprecated and should no longer be used. + * + * + ***************************************************************************/ + + + +#ifndef __DPNATHLP_H__ +#define __DPNATHLP_H__ + + + +#include // for DECLARE_INTERFACE and HRESULT + + + +#ifndef DPNATHLP_EXPORTS +#define DPNATHLPAPI DECLSPEC_IMPORT +#else +#define DPNATHLPAPI +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper object class IDs + * + ****************************************************************************/ + +// {B9C2E9C4-68C1-4d42-A7A1-E76A26982AD6} +DEFINE_GUID(CLSID_DirectPlayNATHelpUPnP, +0xb9c2e9c4, 0x68c1, 0x4d42, 0xa7, 0xa1, 0xe7, 0x6a, 0x26, 0x98, 0x2a, 0xd6); + +// {963AB779-16A1-477c-A36D-CB5E711938F7} +DEFINE_GUID(CLSID_DirectPlayNATHelpPAST, +0x963ab779, 0x16a1, 0x477c, 0xa3, 0x6d, 0xcb, 0x5e, 0x71, 0x19, 0x38, 0xf7); + + +/**************************************************************************** + * + * DirectPlay NAT Helper interface ID + * + ****************************************************************************/ + +// {154940B6-2278-4a2f-9101-9BA9F431F603} +DEFINE_GUID(IID_IDirectPlayNATHelp, +0x154940b6, 0x2278, 0x4a2f, 0x91, 0x1, 0x9b, 0xa9, 0xf4, 0x31, 0xf6, 0x3); + +/**************************************************************************** + * + * DirectPlay NAT Helper interface pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlayNATHelp *PDIRECTPLAYNATHELP; + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper data types + * + ****************************************************************************/ + +// +// Handles used to identify specific port binding groups. If multiple ports +// are registered at the same time, the DPNHHANDLE refers to all ports. +// +typedef DWORD_PTR DPNHHANDLE, * PDPNHHANDLE; + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper constants + * + ****************************************************************************/ + +#define DPNH_MAX_SIMULTANEOUS_PORTS 16 // up to 16 ports may be specified in a single RegisterPorts call + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper API flags + * + ****************************************************************************/ + +// +// Flags that can be passed to Initialize +// +#define DPNHINITIALIZE_DISABLEGATEWAYSUPPORT 0x01 // disables Internet gateway traversal support (cannot be specified with DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT) +#define DPNHINITIALIZE_DISABLELOCALFIREWALLSUPPORT 0x02 // disables local firewall traversal support (cannot be specified with DPNHINITIALIZE_DISABLEGATEWAYSUPPORT) + +// +// Flags that can be passed to GetCaps. +// +#define DPNHGETCAPS_UPDATESERVERSTATUS 0x01 // automatically extend expiring leases and detect changes in server status + +// +// Flags that can be passed to RegisterPorts. +// +#define DPNHREGISTERPORTS_TCP 0x01 // request TCP ports instead of UDP +#define DPNHREGISTERPORTS_FIXEDPORTS 0x02 // asks the server to use the same port numbers on the public interface +#define DPNHREGISTERPORTS_SHAREDPORTS 0x04 // requests that the server allow the UDP fixed ports to be shared with other clients (must be specified with DPNHREGISTERPORTS_FIXEDPORTS and cannot be specified with DPNHREGISTERPORTS_TCP) + +// +// Flags that can be passed to GetRegisteredAddresses. +// +#define DPNHGETREGISTEREDADDRESSES_LOCALFIREWALLREMAPONLY 0x01 // retrieve the public address for the local firewall only, even if mapped on remote Internet gateway + +// +// Flags that can be passed to QueryAddress. +// +#define DPNHQUERYADDRESS_TCP 0x01 // request a TCP port instead of UDP +#define DPNHQUERYADDRESS_CACHEFOUND 0x02 // cache the discovered address if found +#define DPNHQUERYADDRESS_CACHENOTFOUND 0x04 // cache the fact that no address was found, if that is the case +#define DPNHQUERYADDRESS_CHECKFORPRIVATEBUTUNMAPPED 0x08 // determine if the address is behind the same Internet gateway, but not mapped on that Internet gateway + +/**************************************************************************** + * + * DirectPlay NAT Helper structure flags + * + ****************************************************************************/ + +// +// DPNHCAPS flags +// +#define DPNHCAPSFLAG_LOCALFIREWALLPRESENT 0x01 // at least one network connection has a local firewall present +#define DPNHCAPSFLAG_GATEWAYPRESENT 0x02 // at least one network connection has an Internet gateway present +#define DPNHCAPSFLAG_GATEWAYISLOCAL 0x04 // a detected Internet gateway is local (i.e. the public address is another network interface on the same machine) +#define DPNHCAPSFLAG_PUBLICADDRESSAVAILABLE 0x08 // at least one server has a valid public address for registered mappings +#define DPNHCAPSFLAG_NOTALLSUPPORTACTIVENOTIFY 0x10 // at least one available server does not support an active-notification mechanisms and must be polled + + + +/**************************************************************************** + * + * DirectPlay NAT Helper structures + * + ****************************************************************************/ + +typedef struct _DPNHCAPS +{ + DWORD dwSize; // size of this structure, must be filled in prior to calling GetCaps + DWORD dwFlags; // flags indicating capabilities of Internet gateway server(s) + DWORD dwNumRegisteredPorts; // number of ports currently registered, including multiple ports registered at the same time (so this may not be equal to the number of DPNHHANDLEs given out) + DWORD dwMinLeaseTimeRemaining; // approximate time remaining, in milliseconds, for the lease that will expire soonest + DWORD dwRecommendedGetCapsInterval; // recommended time, in milliseconds, after which GetCaps should be called again (with DPNHGETCAPS_UPDATESERVERSTATUS flag) +} DPNHCAPS, * PDPNHCAPS; + + + +/**************************************************************************** + * + * Address type flags (returned by GetRegisteredAddresses) + * + ****************************************************************************/ + +#define DPNHADDRESSTYPE_TCP 0x01 // the mappings are for TCP ports instead of UDP +#define DPNHADDRESSTYPE_FIXEDPORTS 0x02 // the mappings are for ports which are the same on the Internet gateway +#define DPNHADDRESSTYPE_SHAREDPORTS 0x04 // the mappings are for shared UDP fixed ports +#define DPNHADDRESSTYPE_LOCALFIREWALL 0x08 // the addresses are opened on a local firewall +#define DPNHADDRESSTYPE_GATEWAY 0x10 // the addresses are registered with an Internet gateway +#define DPNHADDRESSTYPE_GATEWAYISLOCAL 0x20 // the Internet gateway is local (i.e. the public address is another network interface on the same machine) + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper DLL exported functions + * + ****************************************************************************/ + +typedef HRESULT (WINAPI * PFN_DIRECTPLAYNATHELPCREATE)(const GUID * pIID, void ** ppvInterface); + + + + + +/**************************************************************************** + * + * DirectPlay NAT Helper application interfaces + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlayNATHelp +DECLARE_INTERFACE_(IDirectPlayNATHelp, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectPlayNATHelp methods ***/ + STDMETHOD(Initialize) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(Close) (THIS_ const DWORD dwFlags) PURE; + STDMETHOD(GetCaps) (THIS_ DPNHCAPS * const dpnhcaps, const DWORD dwFlags) PURE; + STDMETHOD(RegisterPorts) (THIS_ const SOCKADDR * const aLocalAddresses, const DWORD dwAddressesSize, const DWORD dwNumAddresses, const DWORD dwLeaseTime, DPNHHANDLE * const phRegisteredPorts, const DWORD dwFlags) PURE; + STDMETHOD(GetRegisteredAddresses) (THIS_ const DPNHHANDLE hRegisteredPorts, SOCKADDR * const paPublicAddresses, DWORD * const pdwPublicAddressesSize, DWORD * const pdwAddressTypeFlags, DWORD * const pdwLeaseTimeRemaining, const DWORD dwFlags) PURE; + STDMETHOD(DeregisterPorts) (THIS_ const DPNHHANDLE hRegisteredPorts, const DWORD dwFlags) PURE; + STDMETHOD(QueryAddress) (THIS_ const SOCKADDR * const pSourceAddress, const SOCKADDR * const pQueryAddress, SOCKADDR * const pResponseAddress, const int iAddressesSize, const DWORD dwFlags) PURE; + STDMETHOD(SetAlertEvent) (THIS_ const HANDLE hEvent, const DWORD dwFlags) PURE; + STDMETHOD(SetAlertIOCompletionPort) (THIS_ const HANDLE hIOCompletionPort, const DWORD dwCompletionKey, const DWORD dwNumConcurrentThreads, const DWORD dwFlags) PURE; + STDMETHOD(ExtendRegisteredPortsLease) (THIS_ const DPNHHANDLE hRegisteredPorts, const DWORD dwLeaseTime, const DWORD dwFlags) PURE; +}; + + +/**************************************************************************** + * + * DirectPlay NAT Helper application interface macros + * + ****************************************************************************/ + +#if (! defined(__cplusplus) || defined(CINTERFACE)) + +#define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayNATHelp_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayNATHelp_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayNATHelp_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlayNATHelp_Close(p,a) (p)->lpVtbl->Close(p,a) +#define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->lpVtbl->RegisterPorts(p,a,b,c,d,e,f) +#define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->lpVtbl->GetRegisteredAddresses(p,a,b,c,d,e,f) +#define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->lpVtbl->DeregisterPorts(p,a,b) +#define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->lpVtbl->QueryAddress(p,a,b,c,d,e) +#define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->lpVtbl->SetAlertEvent(p,a,b) +#define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->lpVtbl->SetAlertIOCompletionPort(p,a,b,c,d) +#define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->lpVtbl->ExtendRegisteredPortsLease(p,a,b,c) + + +#else // C++ + +#define IDirectPlayNATHelp_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayNATHelp_AddRef(p) (p)->AddRef() +#define IDirectPlayNATHelp_Release(p) (p)->Release() +#define IDirectPlayNATHelp_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlayNATHelp_Close(p,a) (p)->Close(a) +#define IDirectPlayNATHelp_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlayNATHelp_RegisterPorts(p,a,b,c,d,e,f) (p)->RegisterPorts(a,b,c,d,e,f) +#define IDirectPlayNATHelp_GetRegisteredAddresses(p,a,b,c,d,e,f) (p)->GetRegisteredAddresses(a,b,c,d,e,f) +#define IDirectPlayNATHelp_DeregisterPorts(p,a,b) (p)->DeregisterPorts(a,b) +#define IDirectPlayNATHelp_QueryAddress(p,a,b,c,d,e) (p)->QueryAddress(a,b,c,d,e) +#define IDirectPlayNATHelp_SetAlertEvent(p,a,b) (p)->SetAlertEvent(a,b) +#define IDirectPlayNATHelp_SetAlertIOCompletionPort(p,a,b,c,d) (p)->SetAlertIOCompletionPort(a,b,c,d) +#define IDirectPlayNATHelp_ExtendRegisteredPortsLease(p,a,b,c) (p)->ExtendRegisteredPortsLease(a,b,c) + + +#endif + + + +/**************************************************************************** + * + * DirectPlay NAT Helper return codes + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _DPNH_FACILITY_CODE 0x015 +#define _DPNH_HRESULT_BASE 0xF000 + +#define MAKE_DPNHSUCCESS(code) MAKE_HRESULT(0, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE)) +#define MAKE_DPNHFAILURE(code) MAKE_HRESULT(1, _DPNH_FACILITY_CODE, (code + _DPNH_HRESULT_BASE)) + + + +#define DPNH_OK S_OK + +#define DPNHSUCCESS_ADDRESSESCHANGED MAKE_DPNHSUCCESS(0x10) + +#define DPNHERR_ALREADYINITIALIZED MAKE_DPNHFAILURE(0x10) +#define DPNHERR_BUFFERTOOSMALL MAKE_DPNHFAILURE(0x20) +#define DPNHERR_GENERIC E_FAIL +#define DPNHERR_INVALIDFLAGS MAKE_DPNHFAILURE(0x30) +#define DPNHERR_INVALIDOBJECT MAKE_DPNHFAILURE(0x40) +#define DPNHERR_INVALIDPARAM E_INVALIDARG +#define DPNHERR_INVALIDPOINTER E_POINTER +#define DPNHERR_NOMAPPING MAKE_DPNHFAILURE(0x50) +#define DPNHERR_NOMAPPINGBUTPRIVATE MAKE_DPNHFAILURE(0x60) +#define DPNHERR_NOTINITIALIZED MAKE_DPNHFAILURE(0x70) +#define DPNHERR_OUTOFMEMORY E_OUTOFMEMORY +#define DPNHERR_PORTALREADYREGISTERED MAKE_DPNHFAILURE(0x80) +#define DPNHERR_PORTUNAVAILABLE MAKE_DPNHFAILURE(0x90) +#define DPNHERR_REENTRANT MAKE_DPNHFAILURE(0x95) +#define DPNHERR_SERVERNOTAVAILABLE MAKE_DPNHFAILURE(0xA0) +#define DPNHERR_UPDATESERVERSTATUS MAKE_DPNHFAILURE(0xC0) + +#ifdef __cplusplus +} +#endif + +#endif // __DPNATHLP_H__ + diff --git a/SDK/dxSDK/Include/dsconf.h b/SDK/dxSDK/Include/dsconf.h new file mode 100644 index 00000000..018f65a0 --- /dev/null +++ b/SDK/dxSDK/Include/dsconf.h @@ -0,0 +1,195 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsconf.h + * Content: DirectSound configuration interface include file + * + **************************************************************************/ + +#ifndef __DSCONF_INCLUDED__ +#define __DSCONF_INCLUDED__ + +#ifndef __DSOUND_INCLUDED__ +#error dsound.h not included +#endif // __DSOUND_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + +// DirectSound Private Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA} +DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +// +// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA} +// + +DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +typedef enum +{ + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8, +} DSPROPERTY_DIRECTSOUNDDEVICE; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef enum +{ + DIRECTSOUNDDEVICE_TYPE_EMULATED, + DIRECTSOUNDDEVICE_TYPE_VXD, + DIRECTSOUNDDEVICE_TYPE_WDM +} DIRECTSOUNDDEVICE_TYPE; + +typedef enum +{ + DIRECTSOUNDDEVICE_DATAFLOW_RENDER, + DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE +} DIRECTSOUNDDEVICE_DATAFLOW; + + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +{ + LPSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +{ + LPWSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA; + +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#endif // UNICODE + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +{ + GUID DeviceId; // DirectSound device id + CHAR DescriptionA[0x100]; // Device description (ANSI) + WCHAR DescriptionW[0x100]; // Device description (Unicode) + CHAR ModuleA[MAX_PATH]; // Device driver module (ANSI) + WCHAR ModuleW[MAX_PATH]; // Device driver module (Unicode) + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + ULONG WaveDeviceId; // Wave device id + ULONG Devnode; // Devnode (or DevInst) +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPSTR Description; // Device description + LPSTR Module; // Device driver module + LPSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPWSTR Description; // Device description + LPWSTR Module; // Device driver module + LPWSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, LPVOID); + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW +#else // UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __DSCONF_INCLUDED__ + diff --git a/SDK/dxSDK/Include/dsetup.h b/SDK/dxSDK/Include/dsetup.h new file mode 100644 index 00000000..58f79fbb --- /dev/null +++ b/SDK/dxSDK/Include/dsetup.h @@ -0,0 +1,286 @@ +/*========================================================================== + * + * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dsetup.h + * Content: DirectXSetup, error codes and flags + ***************************************************************************/ + +#ifndef __DSETUP_H__ +#define __DSETUP_H__ + +#include // windows stuff + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#else +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#define FOURCC_VERS mmioFOURCC('v','e','r','s') + +// DSETUP Error Codes, must remain compatible with previous setup. +#define DSETUPERR_SUCCESS_RESTART 1 +#define DSETUPERR_SUCCESS 0 +#define DSETUPERR_BADWINDOWSVERSION -1 +#define DSETUPERR_SOURCEFILENOTFOUND -2 +#define DSETUPERR_NOCOPY -5 +#define DSETUPERR_OUTOFDISKSPACE -6 +#define DSETUPERR_CANTFINDINF -7 +#define DSETUPERR_CANTFINDDIR -8 +#define DSETUPERR_INTERNAL -9 +#define DSETUPERR_UNKNOWNOS -11 +#define DSETUPERR_NEWERVERSION -14 +#define DSETUPERR_NOTADMIN -15 +#define DSETUPERR_UNSUPPORTEDPROCESSOR -16 +#define DSETUPERR_MISSINGCAB_MANAGEDDX -17 +#define DSETUPERR_NODOTNETFRAMEWORKINSTALLED -18 +#define DSETUPERR_CABDOWNLOADFAIL -19 +#define DSETUPERR_DXCOMPONENTFILEINUSE -20 +#define DSETUPERR_UNTRUSTEDCABINETFILE -21 + +// DSETUP flags. DirectX 5.0 apps should use these flags only. +#define DSETUP_DDRAWDRV 0x00000008 /* install DirectDraw Drivers */ +#define DSETUP_DSOUNDDRV 0x00000010 /* install DirectSound Drivers */ +#define DSETUP_DXCORE 0x00010000 /* install DirectX runtime */ +#define DSETUP_DIRECTX (DSETUP_DXCORE|DSETUP_DDRAWDRV|DSETUP_DSOUNDDRV) +#define DSETUP_MANAGEDDX 0x00004000 /* OBSOLETE. install managed DirectX */ +#define DSETUP_TESTINSTALL 0x00020000 /* just test install, don't do anything */ + +// These OBSOLETE flags are here for compatibility with pre-DX5 apps only. +// They are present to allow DX3 apps to be recompiled with DX5 and still work. +// DO NOT USE THEM for DX5. They will go away in future DX releases. +#define DSETUP_DDRAW 0x00000001 /* OBSOLETE. install DirectDraw */ +#define DSETUP_DSOUND 0x00000002 /* OBSOLETE. install DirectSound */ +#define DSETUP_DPLAY 0x00000004 /* OBSOLETE. install DirectPlay */ +#define DSETUP_DPLAYSP 0x00000020 /* OBSOLETE. install DirectPlay Providers */ +#define DSETUP_DVIDEO 0x00000040 /* OBSOLETE. install DirectVideo */ +#define DSETUP_D3D 0x00000200 /* OBSOLETE. install Direct3D */ +#define DSETUP_DINPUT 0x00000800 /* OBSOLETE. install DirectInput */ +#define DSETUP_DIRECTXSETUP 0x00001000 /* OBSOLETE. install DirectXSetup DLL's */ +#define DSETUP_NOUI 0x00002000 /* OBSOLETE. install DirectX with NO UI */ +#define DSETUP_PROMPTFORDRIVERS 0x10000000 /* OBSOLETE. prompt when replacing display/audio drivers */ +#define DSETUP_RESTOREDRIVERS 0x20000000 /* OBSOLETE. restore display/audio drivers */ + + +//****************************************************************** +// DirectX Setup Callback mechanism +//****************************************************************** + +// DSETUP Message Info Codes, passed to callback as Reason parameter. +#define DSETUP_CB_MSG_NOMESSAGE 0 +#define DSETUP_CB_MSG_INTERNAL_ERROR 10 +#define DSETUP_CB_MSG_BEGIN_INSTALL 13 +#define DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME 14 +#define DSETUP_CB_MSG_PROGRESS 18 +#define DSETUP_CB_MSG_WARNING_DISABLED_COMPONENT 19 + + +typedef struct _DSETUP_CB_PROGRESS +{ + DWORD dwPhase; + DWORD dwInPhaseMaximum; + DWORD dwInPhaseProgress; + DWORD dwOverallMaximum; + DWORD dwOverallProgress; +} DSETUP_CB_PROGRESS; + + +enum _DSETUP_CB_PROGRESS_PHASE +{ + DSETUP_INITIALIZING, + DSETUP_EXTRACTING, + DSETUP_COPYING, + DSETUP_FINALIZING +}; + + +#ifdef _WIN32 +// +// Data Structures +// +#ifndef UNICODE_ONLY + +typedef struct _DIRECTXREGISTERAPPA { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPA, *PDIRECTXREGISTERAPPA, *LPDIRECTXREGISTERAPPA; + +typedef struct _DIRECTXREGISTERAPP2A { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; + LPSTR lpszLauncherName; +} DIRECTXREGISTERAPP2A, *PDIRECTXREGISTERAPP2A, *LPDIRECTXREGISTERAPP2A; + +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY + +typedef struct _DIRECTXREGISTERAPPW { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPW, *PDIRECTXREGISTERAPPW, *LPDIRECTXREGISTERAPPW; + +typedef struct _DIRECTXREGISTERAPP2W { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; + LPWSTR lpszLauncherName; +} DIRECTXREGISTERAPP2W, *PDIRECTXREGISTERAPP2W, *LPDIRECTXREGISTERAPP2W; +#endif //!ANSI_ONLY +#ifdef UNICODE +typedef DIRECTXREGISTERAPPW DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPW PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPW LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2W DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2W PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2W LPDIRECTXREGISTERAPP2; +#else +typedef DIRECTXREGISTERAPPA DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPA PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPA LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2A DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2A PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2A LPDIRECTXREGISTERAPP2; +#endif // UNICODE + + +// +// API +// + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXSetupA( + HWND hWnd, + LPSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXSetupW( + HWND hWnd, + LPWSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetup DirectXSetupW +#else +#define DirectXSetup DirectXSetupA +#endif // !UNICODE + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXRegisterApplicationA( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXRegisterApplicationW( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXRegisterApplication DirectXRegisterApplicationW +#else +#define DirectXRegisterApplication DirectXRegisterApplicationA +#endif // !UNICODE + +INT +WINAPI +DirectXUnRegisterApplication( + HWND hWnd, + LPGUID lpGUID + ); + +// +// Function Pointers +// +#ifdef UNICODE +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPWSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#else +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#endif // UNICODE + +typedef DWORD (FAR PASCAL * DSETUP_CALLBACK)(DWORD Reason, + DWORD MsgType, /* Same as flags to MessageBox */ + LPSTR szMessage, + LPSTR szName, + void *pInfo); + +INT WINAPI DirectXSetupSetCallback(DSETUP_CALLBACK Callback); +INT WINAPI DirectXSetupGetVersion(DWORD *lpdwVersion, DWORD *lpdwMinorVersion); +INT WINAPI DirectXSetupShowEULA(HWND hWndParent); +#ifndef UNICODE_ONLY +UINT +WINAPI +DirectXSetupGetEULAA( + LPSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +UINT +WINAPI +DirectXSetupGetEULAW( + LPWSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetupGetEULA DirectXSetupGetEULAW +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPWSTR, UINT, WORD); +#else +#define DirectXSetupGetEULA DirectXSetupGetEULAA +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPSTR, UINT, WORD); +#endif // !UNICODE + +#endif // WIN32 + + +#ifdef __cplusplus +}; +#endif + +#endif + diff --git a/SDK/dxSDK/Include/dsound.h b/SDK/dxSDK/Include/dsound.h new file mode 100644 index 00000000..cb19cca8 --- /dev/null +++ b/SDK/dxSDK/Include/dsound.h @@ -0,0 +1,2369 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + **************************************************************************/ + +#define COM_NO_WINDOWS_H +#include +#include + +#ifndef DIRECTSOUND_VERSION +#define DIRECTSOUND_VERSION 0x0900 /* Version 9.0 */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#ifndef __DSOUND_INCLUDED__ +#define __DSOUND_INCLUDED__ + +/* Type definitions shared with Direct3D */ + +#ifndef DX_SHARED_DEFINES + +typedef float D3DVALUE, *LPD3DVALUE; + +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +#ifndef LPD3DCOLOR_DEFINED +typedef DWORD *LPD3DCOLOR; +#define LPD3DCOLOR_DEFINED +#endif + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef LPD3DVECTOR_DEFINED +typedef D3DVECTOR *LPD3DVECTOR; +#define LPD3DVECTOR_DEFINED +#endif + +#define DX_SHARED_DEFINES +#endif // DX_SHARED_DEFINES + +#define _FACDS 0x878 /* DirectSound's facility code */ +#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) + +// DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000} +DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +// DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B} +DEFINE_GUID(CLSID_DirectSound8, 0x3901cc3f, 0x84b5, 0x4fa4, 0xba, 0x35, 0xaa, 0x81, 0x72, 0xb8, 0xa0, 0x9b); + +// DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16} +DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +// DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1} +DEFINE_GUID(CLSID_DirectSoundCapture8, 0xe4bcac13, 0x7f99, 0x4908, 0x9a, 0x8e, 0x74, 0xe3, 0xbf, 0x24, 0xb6, 0xe1); + +// DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D} +DEFINE_GUID(CLSID_DirectSoundFullDuplex, 0xfea4300c, 0x7959, 0x4147, 0xb2, 0x6a, 0x23, 0x77, 0xb9, 0xe7, 0xa9, 0x1d); + + +// DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultPlayback, 0xdef00000, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultCapture, 0xdef00001, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoicePlayback, 0xdef00002, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoiceCapture, 0xdef00003, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + + +// +// Forward declarations for interfaces. +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +// + +#ifdef __cplusplus +struct IDirectSound; +struct IDirectSoundBuffer; +struct IDirectSound3DListener; +struct IDirectSound3DBuffer; +struct IDirectSoundCapture; +struct IDirectSoundCaptureBuffer; +struct IDirectSoundNotify; +#endif // __cplusplus + + +// +// DirectSound 8.0 interfaces. +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#ifdef __cplusplus +struct IDirectSound8; +struct IDirectSoundBuffer8; +struct IDirectSoundCaptureBuffer8; +struct IDirectSoundFXGargle; +struct IDirectSoundFXChorus; +struct IDirectSoundFXFlanger; +struct IDirectSoundFXEcho; +struct IDirectSoundFXDistortion; +struct IDirectSoundFXCompressor; +struct IDirectSoundFXParamEq; +struct IDirectSoundFXWavesReverb; +struct IDirectSoundFXI3DL2Reverb; +struct IDirectSoundCaptureFXAec; +struct IDirectSoundCaptureFXNoiseSuppress; +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +// IDirectSound8, IDirectSoundBuffer8 and IDirectSoundCaptureBuffer8 are the +// only DirectSound 7.0 interfaces with changed functionality in version 8.0. +// The other level 8 interfaces as equivalent to their level 7 counterparts: + +#define IDirectSoundCapture8 IDirectSoundCapture +#define IDirectSound3DListener8 IDirectSound3DListener +#define IDirectSound3DBuffer8 IDirectSound3DBuffer +#define IDirectSoundNotify8 IDirectSoundNotify +#define IDirectSoundFXGargle8 IDirectSoundFXGargle +#define IDirectSoundFXChorus8 IDirectSoundFXChorus +#define IDirectSoundFXFlanger8 IDirectSoundFXFlanger +#define IDirectSoundFXEcho8 IDirectSoundFXEcho +#define IDirectSoundFXDistortion8 IDirectSoundFXDistortion +#define IDirectSoundFXCompressor8 IDirectSoundFXCompressor +#define IDirectSoundFXParamEq8 IDirectSoundFXParamEq +#define IDirectSoundFXWavesReverb8 IDirectSoundFXWavesReverb +#define IDirectSoundFXI3DL2Reverb8 IDirectSoundFXI3DL2Reverb +#define IDirectSoundCaptureFXAec8 IDirectSoundCaptureFXAec +#define IDirectSoundCaptureFXNoiseSuppress8 IDirectSoundCaptureFXNoiseSuppress +#define IDirectSoundFullDuplex8 IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSound *LPDIRECTSOUND; +typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; +typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER; +typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER; +typedef struct IDirectSoundCapture *LPDIRECTSOUNDCAPTURE; +typedef struct IDirectSoundCaptureBuffer *LPDIRECTSOUNDCAPTUREBUFFER; +typedef struct IDirectSoundNotify *LPDIRECTSOUNDNOTIFY; + + +#if DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSoundFXGargle *LPDIRECTSOUNDFXGARGLE; +typedef struct IDirectSoundFXChorus *LPDIRECTSOUNDFXCHORUS; +typedef struct IDirectSoundFXFlanger *LPDIRECTSOUNDFXFLANGER; +typedef struct IDirectSoundFXEcho *LPDIRECTSOUNDFXECHO; +typedef struct IDirectSoundFXDistortion *LPDIRECTSOUNDFXDISTORTION; +typedef struct IDirectSoundFXCompressor *LPDIRECTSOUNDFXCOMPRESSOR; +typedef struct IDirectSoundFXParamEq *LPDIRECTSOUNDFXPARAMEQ; +typedef struct IDirectSoundFXWavesReverb *LPDIRECTSOUNDFXWAVESREVERB; +typedef struct IDirectSoundFXI3DL2Reverb *LPDIRECTSOUNDFXI3DL2REVERB; +typedef struct IDirectSoundCaptureFXAec *LPDIRECTSOUNDCAPTUREFXAEC; +typedef struct IDirectSoundCaptureFXNoiseSuppress *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS; +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +typedef struct IDirectSound8 *LPDIRECTSOUND8; +typedef struct IDirectSoundBuffer8 *LPDIRECTSOUNDBUFFER8; +typedef struct IDirectSound3DListener8 *LPDIRECTSOUND3DLISTENER8; +typedef struct IDirectSound3DBuffer8 *LPDIRECTSOUND3DBUFFER8; +typedef struct IDirectSoundCapture8 *LPDIRECTSOUNDCAPTURE8; +typedef struct IDirectSoundCaptureBuffer8 *LPDIRECTSOUNDCAPTUREBUFFER8; +typedef struct IDirectSoundNotify8 *LPDIRECTSOUNDNOTIFY8; +typedef struct IDirectSoundFXGargle8 *LPDIRECTSOUNDFXGARGLE8; +typedef struct IDirectSoundFXChorus8 *LPDIRECTSOUNDFXCHORUS8; +typedef struct IDirectSoundFXFlanger8 *LPDIRECTSOUNDFXFLANGER8; +typedef struct IDirectSoundFXEcho8 *LPDIRECTSOUNDFXECHO8; +typedef struct IDirectSoundFXDistortion8 *LPDIRECTSOUNDFXDISTORTION8; +typedef struct IDirectSoundFXCompressor8 *LPDIRECTSOUNDFXCOMPRESSOR8; +typedef struct IDirectSoundFXParamEq8 *LPDIRECTSOUNDFXPARAMEQ8; +typedef struct IDirectSoundFXWavesReverb8 *LPDIRECTSOUNDFXWAVESREVERB8; +typedef struct IDirectSoundFXI3DL2Reverb8 *LPDIRECTSOUNDFXI3DL2REVERB8; +typedef struct IDirectSoundCaptureFXAec8 *LPDIRECTSOUNDCAPTUREFXAEC8; +typedef struct IDirectSoundCaptureFXNoiseSuppress8 *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8; +typedef struct IDirectSoundFullDuplex8 *LPDIRECTSOUNDFULLDUPLEX8; + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IID definitions for the unchanged DirectSound 8.0 interfaces +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#define IID_IDirectSoundCapture8 IID_IDirectSoundCapture +#define IID_IDirectSound3DListener8 IID_IDirectSound3DListener +#define IID_IDirectSound3DBuffer8 IID_IDirectSound3DBuffer +#define IID_IDirectSoundNotify8 IID_IDirectSoundNotify +#define IID_IDirectSoundFXGargle8 IID_IDirectSoundFXGargle +#define IID_IDirectSoundFXChorus8 IID_IDirectSoundFXChorus +#define IID_IDirectSoundFXFlanger8 IID_IDirectSoundFXFlanger +#define IID_IDirectSoundFXEcho8 IID_IDirectSoundFXEcho +#define IID_IDirectSoundFXDistortion8 IID_IDirectSoundFXDistortion +#define IID_IDirectSoundFXCompressor8 IID_IDirectSoundFXCompressor +#define IID_IDirectSoundFXParamEq8 IID_IDirectSoundFXParamEq +#define IID_IDirectSoundFXWavesReverb8 IID_IDirectSoundFXWavesReverb +#define IID_IDirectSoundFXI3DL2Reverb8 IID_IDirectSoundFXI3DL2Reverb +#define IID_IDirectSoundCaptureFXAec8 IID_IDirectSoundCaptureFXAec +#define IID_IDirectSoundCaptureFXNoiseSuppress8 IID_IDirectSoundCaptureFXNoiseSuppress +#define IID_IDirectSoundFullDuplex8 IID_IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Compatibility typedefs +// + +#ifndef _LPCWAVEFORMATEX_DEFINED +#define _LPCWAVEFORMATEX_DEFINED +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#endif // _LPCWAVEFORMATEX_DEFINED + +#ifndef __LPCGUID_DEFINED__ +#define __LPCGUID_DEFINED__ +typedef const GUID *LPCGUID; +#endif // __LPCGUID_DEFINED__ + +typedef LPDIRECTSOUND *LPLPDIRECTSOUND; +typedef LPDIRECTSOUNDBUFFER *LPLPDIRECTSOUNDBUFFER; +typedef LPDIRECTSOUND3DLISTENER *LPLPDIRECTSOUND3DLISTENER; +typedef LPDIRECTSOUND3DBUFFER *LPLPDIRECTSOUND3DBUFFER; +typedef LPDIRECTSOUNDCAPTURE *LPLPDIRECTSOUNDCAPTURE; +typedef LPDIRECTSOUNDCAPTUREBUFFER *LPLPDIRECTSOUNDCAPTUREBUFFER; +typedef LPDIRECTSOUNDNOTIFY *LPLPDIRECTSOUNDNOTIFY; + +#if DIRECTSOUND_VERSION >= 0x0800 +typedef LPDIRECTSOUND8 *LPLPDIRECTSOUND8; +typedef LPDIRECTSOUNDBUFFER8 *LPLPDIRECTSOUNDBUFFER8; +typedef LPDIRECTSOUNDCAPTURE8 *LPLPDIRECTSOUNDCAPTURE8; +typedef LPDIRECTSOUNDCAPTUREBUFFER8 *LPLPDIRECTSOUNDCAPTUREBUFFER8; +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Structures +// + +typedef struct _DSCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwMinSecondarySampleRate; + DWORD dwMaxSecondarySampleRate; + DWORD dwPrimaryBuffers; + DWORD dwMaxHwMixingAllBuffers; + DWORD dwMaxHwMixingStaticBuffers; + DWORD dwMaxHwMixingStreamingBuffers; + DWORD dwFreeHwMixingAllBuffers; + DWORD dwFreeHwMixingStaticBuffers; + DWORD dwFreeHwMixingStreamingBuffers; + DWORD dwMaxHw3DAllBuffers; + DWORD dwMaxHw3DStaticBuffers; + DWORD dwMaxHw3DStreamingBuffers; + DWORD dwFreeHw3DAllBuffers; + DWORD dwFreeHw3DStaticBuffers; + DWORD dwFreeHw3DStreamingBuffers; + DWORD dwTotalHwMemBytes; + DWORD dwFreeHwMemBytes; + DWORD dwMaxContigFreeHwMemBytes; + DWORD dwUnlockTransferRateHwBuffers; + DWORD dwPlayCpuOverheadSwBuffers; + DWORD dwReserved1; + DWORD dwReserved2; +} DSCAPS, *LPDSCAPS; + +typedef const DSCAPS *LPCDSCAPS; + +typedef struct _DSBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwUnlockTransferRate; + DWORD dwPlayCpuOverhead; +} DSBCAPS, *LPDSBCAPS; + +typedef const DSBCAPS *LPCDSBCAPS; + +#if DIRECTSOUND_VERSION >= 0x0800 + + typedef struct _DSEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSFXClass; + DWORD_PTR dwReserved1; + DWORD_PTR dwReserved2; + } DSEFFECTDESC, *LPDSEFFECTDESC; + typedef const DSEFFECTDESC *LPCDSEFFECTDESC; + + #define DSFX_LOCHARDWARE 0x00000001 + #define DSFX_LOCSOFTWARE 0x00000002 + + enum + { + DSFXR_PRESENT, // 0 + DSFXR_LOCHARDWARE, // 1 + DSFXR_LOCSOFTWARE, // 2 + DSFXR_UNALLOCATED, // 3 + DSFXR_FAILED, // 4 + DSFXR_UNKNOWN, // 5 + DSFXR_SENDLOOP // 6 + }; + + typedef struct _DSCEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSCFXClass; + GUID guidDSCFXInstance; + DWORD dwReserved1; + DWORD dwReserved2; + } DSCEFFECTDESC, *LPDSCEFFECTDESC; + typedef const DSCEFFECTDESC *LPCDSCEFFECTDESC; + + #define DSCFX_LOCHARDWARE 0x00000001 + #define DSCFX_LOCSOFTWARE 0x00000002 + + #define DSCFXR_LOCHARDWARE 0x00000010 + #define DSCFXR_LOCSOFTWARE 0x00000020 + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct _DSBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0700 + GUID guid3DAlgorithm; +#endif +} DSBUFFERDESC, *LPDSBUFFERDESC; + +typedef const DSBUFFERDESC *LPCDSBUFFERDESC; + +// Older version of this structure: + +typedef struct _DSBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSBUFFERDESC1, *LPDSBUFFERDESC1; + +typedef const DSBUFFERDESC1 *LPCDSBUFFERDESC1; + +typedef struct _DS3DBUFFER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + DWORD dwInsideConeAngle; + DWORD dwOutsideConeAngle; + D3DVECTOR vConeOrientation; + LONG lConeOutsideVolume; + D3DVALUE flMinDistance; + D3DVALUE flMaxDistance; + DWORD dwMode; +} DS3DBUFFER, *LPDS3DBUFFER; + +typedef const DS3DBUFFER *LPCDS3DBUFFER; + +typedef struct _DS3DLISTENER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + D3DVECTOR vOrientFront; + D3DVECTOR vOrientTop; + D3DVALUE flDistanceFactor; + D3DVALUE flRolloffFactor; + D3DVALUE flDopplerFactor; +} DS3DLISTENER, *LPDS3DLISTENER; + +typedef const DS3DLISTENER *LPCDS3DLISTENER; + +typedef struct _DSCCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwFormats; + DWORD dwChannels; +} DSCCAPS, *LPDSCCAPS; + +typedef const DSCCAPS *LPCDSCCAPS; + +typedef struct _DSCBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSCBUFFERDESC1, *LPDSCBUFFERDESC1; + +typedef struct _DSCBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0800 + DWORD dwFXCount; + LPDSCEFFECTDESC lpDSCFXDesc; +#endif +} DSCBUFFERDESC, *LPDSCBUFFERDESC; + +typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC; + +typedef struct _DSCBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; +} DSCBCAPS, *LPDSCBCAPS; + +typedef const DSCBCAPS *LPCDSCBCAPS; + +typedef struct _DSBPOSITIONNOTIFY +{ + DWORD dwOffset; + HANDLE hEventNotify; +} DSBPOSITIONNOTIFY, *LPDSBPOSITIONNOTIFY; + +typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY; + +// +// DirectSound API +// + +typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID); +typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID); + +extern HRESULT WINAPI DirectSoundCreate(LPCGUID pcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext); +extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, LPVOID pContext); + +extern HRESULT WINAPI DirectSoundCaptureCreate(LPCGUID pcGuidDevice, LPDIRECTSOUNDCAPTURE *ppDSC, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext); +extern HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW pDSEnumCallback, LPVOID pContext); + +#if DIRECTSOUND_VERSION >= 0x0800 +extern HRESULT WINAPI DirectSoundCreate8(LPCGUID pcGuidDevice, LPDIRECTSOUND8 *ppDS8, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureCreate8(LPCGUID pcGuidDevice, LPDIRECTSOUNDCAPTURE8 *ppDSC8, LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundFullDuplexCreate(LPCGUID pcGuidCaptureDevice, LPCGUID pcGuidRenderDevice, + LPCDSCBUFFERDESC pcDSCBufferDesc, LPCDSBUFFERDESC pcDSBufferDesc, HWND hWnd, + DWORD dwLevel, LPDIRECTSOUNDFULLDUPLEX* ppDSFD, LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8, + LPDIRECTSOUNDBUFFER8 *ppDSBuffer8, LPUNKNOWN pUnkOuter); +#define DirectSoundFullDuplexCreate8 DirectSoundFullDuplexCreate + +extern HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest); +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#ifdef UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKW +#define DirectSoundEnumerate DirectSoundEnumerateW +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateW +#else // UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKA +#define DirectSoundEnumerate DirectSoundEnumerateA +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateA +#endif // UNICODE + +// +// IUnknown +// + +#if !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->lpVtbl->AddRef(p) +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->lpVtbl->Release(p) +#endif // IUnknown_Release +#else // !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->AddRef() +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->Release() +#endif // IUnknown_Release +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#ifndef __IReferenceClock_INTERFACE_DEFINED__ +#define __IReferenceClock_INTERFACE_DEFINED__ + +typedef LONGLONG REFERENCE_TIME; +typedef REFERENCE_TIME *LPREFERENCE_TIME; + +DEFINE_GUID(IID_IReferenceClock, 0x56a86897, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); + +#undef INTERFACE +#define INTERFACE IReferenceClock + +DECLARE_INTERFACE_(IReferenceClock, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IReferenceClock methods + STDMETHOD(GetTime) (THIS_ REFERENCE_TIME *pTime) PURE; + STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME rtBaseTime, REFERENCE_TIME rtStreamTime, + HANDLE hEvent, LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME rtStartTime, REFERENCE_TIME rtPeriodTime, + HANDLE hSemaphore, LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE; +}; + +#endif // __IReferenceClock_INTERFACE_DEFINED__ + +#ifndef IReferenceClock_QueryInterface + +#define IReferenceClock_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IReferenceClock_AddRef(p) IUnknown_AddRef(p) +#define IReferenceClock_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->lpVtbl->GetTime(p,a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->lpVtbl->AdviseTime(p,a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->lpVtbl->AdvisePeriodic(p,a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->lpVtbl->Unadvise(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->GetTime(a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->AdviseTime(a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->AdvisePeriodic(a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->Unadvise(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // IReferenceClock_QueryInterface + +// +// IDirectSound +// + +DEFINE_GUID(IID_IDirectSound, 0x279AFA83, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound + +DECLARE_INTERFACE_(IDirectSound, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSound_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) +#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectSound_Compact(p) (p)->Compact() +#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b) +#define IDirectSound_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound8 +// + +DEFINE_GUID(IID_IDirectSound8, 0xC50A7E93, 0xF395, 0x4834, 0x9E, 0xF6, 0x7F, 0xA9, 0x9D, 0xE5, 0x09, 0x66); + +#undef INTERFACE +#define INTERFACE IDirectSound8 + +DECLARE_INTERFACE_(IDirectSound8, IDirectSound) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ LPCDSBUFFERDESC pcDSBufferDesc, LPDIRECTSOUNDBUFFER *ppDSBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ LPDIRECTSOUNDBUFFER pDSBufferOriginal, LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; + + // IDirectSound8 methods + STDMETHOD(VerifyCertification) (THIS_ LPDWORD pdwCertified) PURE; +}; + +#define IDirectSound8_QueryInterface(p,a,b) IDirectSound_QueryInterface(p,a,b) +#define IDirectSound8_AddRef(p) IDirectSound_AddRef(p) +#define IDirectSound8_Release(p) IDirectSound_Release(p) +#define IDirectSound8_CreateSoundBuffer(p,a,b,c) IDirectSound_CreateSoundBuffer(p,a,b,c) +#define IDirectSound8_GetCaps(p,a) IDirectSound_GetCaps(p,a) +#define IDirectSound8_DuplicateSoundBuffer(p,a,b) IDirectSound_DuplicateSoundBuffer(p,a,b) +#define IDirectSound8_SetCooperativeLevel(p,a,b) IDirectSound_SetCooperativeLevel(p,a,b) +#define IDirectSound8_Compact(p) IDirectSound_Compact(p) +#define IDirectSound8_GetSpeakerConfig(p,a) IDirectSound_GetSpeakerConfig(p,a) +#define IDirectSound8_SetSpeakerConfig(p,a) IDirectSound_SetSpeakerConfig(p,a) +#define IDirectSound8_Initialize(p,a) IDirectSound_Initialize(p,a) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->lpVtbl->VerifyCertification(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->VerifyCertification(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer +// + +DEFINE_GUID(IID_IDirectSoundBuffer, 0x279AFA85, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer + +DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; +}; + +#define IDirectSoundBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) +#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a) +#define IDirectSoundBuffer_Stop(p) (p)->Stop() +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->Restore() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundBuffer8, 0x6825a449, 0x7524, 0x4d82, 0x92, 0x0f, 0x50, 0xe3, 0x6a, 0xb3, 0xab, 0x1e); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer8 + +DECLARE_INTERFACE_(IDirectSoundBuffer8, IDirectSoundBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCurrentPlayCursor, LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUND pDirectSound, LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; + + // IDirectSoundBuffer8 methods + STDMETHOD(SetFX) (THIS_ DWORD dwEffectsCount, LPDSEFFECTDESC pDSFXDesc, LPDWORD pdwResultCodes) PURE; + STDMETHOD(AcquireResources) (THIS_ DWORD dwFlags, DWORD dwEffectsCount, LPDWORD pdwResultCodes) PURE; + STDMETHOD(GetObjectInPath) (THIS_ REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject) PURE; +}; + +// Special GUID meaning "select all objects" for use in GetObjectInPath() +DEFINE_GUID(GUID_All_Objects, 0xaa114de5, 0xc262, 0x4169, 0xa1, 0xc8, 0x23, 0xd6, 0x98, 0xcc, 0x73, 0xb5); + +#define IDirectSoundBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundBuffer8_GetCaps(p,a) IDirectSoundBuffer_GetCaps(p,a) +#define IDirectSoundBuffer8_GetCurrentPosition(p,a,b) IDirectSoundBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer8_GetFormat(p,a,b,c) IDirectSoundBuffer_GetFormat(p,a,b,c) +#define IDirectSoundBuffer8_GetVolume(p,a) IDirectSoundBuffer_GetVolume(p,a) +#define IDirectSoundBuffer8_GetPan(p,a) IDirectSoundBuffer_GetPan(p,a) +#define IDirectSoundBuffer8_GetFrequency(p,a) IDirectSoundBuffer_GetFrequency(p,a) +#define IDirectSoundBuffer8_GetStatus(p,a) IDirectSoundBuffer_GetStatus(p,a) +#define IDirectSoundBuffer8_Initialize(p,a,b) IDirectSoundBuffer_Initialize(p,a,b) +#define IDirectSoundBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer8_Play(p,a,b,c) IDirectSoundBuffer_Play(p,a,b,c) +#define IDirectSoundBuffer8_SetCurrentPosition(p,a) IDirectSoundBuffer_SetCurrentPosition(p,a) +#define IDirectSoundBuffer8_SetFormat(p,a) IDirectSoundBuffer_SetFormat(p,a) +#define IDirectSoundBuffer8_SetVolume(p,a) IDirectSoundBuffer_SetVolume(p,a) +#define IDirectSoundBuffer8_SetPan(p,a) IDirectSoundBuffer_SetPan(p,a) +#define IDirectSoundBuffer8_SetFrequency(p,a) IDirectSoundBuffer_SetFrequency(p,a) +#define IDirectSoundBuffer8_Stop(p) IDirectSoundBuffer_Stop(p) +#define IDirectSoundBuffer8_Unlock(p,a,b,c,d) IDirectSoundBuffer_Unlock(p,a,b,c,d) +#define IDirectSoundBuffer8_Restore(p) IDirectSoundBuffer_Restore(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->lpVtbl->SetFX(p,a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->lpVtbl->AcquireResources(p,a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->SetFX(a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->AcquireResources(a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound3DListener +// + +DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DListener + +DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DListener methods + STDMETHOD(GetAllParameters) (THIS_ LPDS3DLISTENER pListener) PURE; + STDMETHOD(GetDistanceFactor) (THIS_ D3DVALUE* pflDistanceFactor) PURE; + STDMETHOD(GetDopplerFactor) (THIS_ D3DVALUE* pflDopplerFactor) PURE; + STDMETHOD(GetOrientation) (THIS_ D3DVECTOR* pvOrientFront, D3DVECTOR* pvOrientTop) PURE; + STDMETHOD(GetPosition) (THIS_ D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetRolloffFactor) (THIS_ D3DVALUE* pflRolloffFactor) PURE; + STDMETHOD(GetVelocity) (THIS_ D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ LPCDS3DLISTENER pcListener, DWORD dwApply) PURE; + STDMETHOD(SetDistanceFactor) (THIS_ D3DVALUE flDistanceFactor, DWORD dwApply) PURE; + STDMETHOD(SetDopplerFactor) (THIS_ D3DVALUE flDopplerFactor, DWORD dwApply) PURE; + STDMETHOD(SetOrientation) (THIS_ D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, + D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetRolloffFactor) (THIS_ D3DVALUE flRolloffFactor, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(CommitDeferredSettings) (THIS) PURE; +}; + +#define IDirectSound3DListener_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DListener_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DListener_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSound3DBuffer +// + +DEFINE_GUID(IID_IDirectSound3DBuffer, 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DBuffer + +DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DBuffer methods + STDMETHOD(GetAllParameters) (THIS_ LPDS3DBUFFER pDs3dBuffer) PURE; + STDMETHOD(GetConeAngles) (THIS_ LPDWORD pdwInsideConeAngle, LPDWORD pdwOutsideConeAngle) PURE; + STDMETHOD(GetConeOrientation) (THIS_ D3DVECTOR* pvOrientation) PURE; + STDMETHOD(GetConeOutsideVolume) (THIS_ LPLONG plConeOutsideVolume) PURE; + STDMETHOD(GetMaxDistance) (THIS_ D3DVALUE* pflMaxDistance) PURE; + STDMETHOD(GetMinDistance) (THIS_ D3DVALUE* pflMinDistance) PURE; + STDMETHOD(GetMode) (THIS_ LPDWORD pdwMode) PURE; + STDMETHOD(GetPosition) (THIS_ D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetVelocity) (THIS_ D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ LPCDS3DBUFFER pcDs3dBuffer, DWORD dwApply) PURE; + STDMETHOD(SetConeAngles) (THIS_ DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply) PURE; + STDMETHOD(SetConeOrientation) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetConeOutsideVolume) (THIS_ LONG lConeOutsideVolume, DWORD dwApply) PURE; + STDMETHOD(SetMaxDistance) (THIS_ D3DVALUE flMaxDistance, DWORD dwApply) PURE; + STDMETHOD(SetMinDistance) (THIS_ D3DVALUE flMinDistance, DWORD dwApply) PURE; + STDMETHOD(SetMode) (THIS_ DWORD dwMode, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; +}; + +#define IDirectSound3DBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->lpVtbl->SetConeOutsideVolume(p,a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->SetConeOutsideVolume(a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCapture +// + +DEFINE_GUID(IID_IDirectSoundCapture, 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCapture + +DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCapture methods + STDMETHOD(CreateCaptureBuffer) (THIS_ LPCDSCBUFFERDESC pcDSCBufferDesc, LPDIRECTSOUNDCAPTUREBUFFER *ppDSCBuffer, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ LPDSCCAPS pDSCCaps) PURE; + STDMETHOD(Initialize) (THIS_ LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSoundCapture_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCapture_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCapture_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCapture_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->CreateCaptureBuffer(a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCapture_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureBuffer +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer, 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCapturePosition, LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE pDirectSoundCapture, LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; +}; + +#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->lpVtbl->Start(p,a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->Start(a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->Stop() +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundCaptureBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer8, 0x990df4, 0xdbb, 0x4872, 0x83, 0x3e, 0x6d, 0x30, 0x3e, 0x80, 0xae, 0xb6); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer8 + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer8, IDirectSoundCaptureBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ LPDWORD pdwCapturePosition, LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ LPDIRECTSOUNDCAPTURE pDirectSoundCapture, LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, LPVOID *ppvAudioPtr1, LPDWORD pdwAudioBytes1, + LPVOID *ppvAudioPtr2, LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ LPVOID pvAudioPtr1, DWORD dwAudioBytes1, LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + + // IDirectSoundCaptureBuffer8 methods + STDMETHOD(GetObjectInPath) (THIS_ REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, LPVOID *ppObject) PURE; + STDMETHOD(GetFXStatus) (DWORD dwFXCount, LPDWORD pdwFXStatus) PURE; +}; + +#define IDirectSoundCaptureBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundCaptureBuffer8_GetCaps(p,a) IDirectSoundCaptureBuffer_GetCaps(p,a) +#define IDirectSoundCaptureBuffer8_GetCurrentPosition(p,a,b) IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer8_GetFormat(p,a,b,c) IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer8_GetStatus(p,a) IDirectSoundCaptureBuffer_GetStatus(p,a) +#define IDirectSoundCaptureBuffer8_Initialize(p,a,b) IDirectSoundCaptureBuffer_Initialize(p,a,b) +#define IDirectSoundCaptureBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer8_Start(p,a) IDirectSoundCaptureBuffer_Start(p,a) +#define IDirectSoundCaptureBuffer8_Stop(p) IDirectSoundCaptureBuffer_Stop(p)) +#define IDirectSoundCaptureBuffer8_Unlock(p,a,b,c,d) IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->lpVtbl->GetFXStatus(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->GetFXStatus(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundNotify +// + +DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundNotify + +DECLARE_INTERFACE_(IDirectSoundNotify, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundNotify methods + STDMETHOD(SetNotificationPositions) (THIS_ DWORD dwPositionNotifies, LPCDSBPOSITIONNOTIFY pcPositionNotifies) PURE; +}; + +#define IDirectSoundNotify_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundNotify_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundNotify_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->SetNotificationPositions(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IKsPropertySet +// + +#ifndef _IKsPropertySet_ +#define _IKsPropertySet_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IKsPropertySet; +#endif // __cplusplus + +typedef struct IKsPropertySet *LPKSPROPERTYSET; + +#define KSPROPERTY_SUPPORT_GET 0x00000001 +#define KSPROPERTY_SUPPORT_SET 0x00000002 + +DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93); + +#undef INTERFACE +#define INTERFACE IKsPropertySet + +DECLARE_INTERFACE_(IKsPropertySet, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IKsPropertySet methods + STDMETHOD(Get) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) PURE; + STDMETHOD(Set) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength) PURE; + STDMETHOD(QuerySupport) (THIS_ REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) PURE; +}; + +#define IKsPropertySet_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IKsPropertySet_AddRef(p) IUnknown_AddRef(p) +#define IKsPropertySet_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->lpVtbl->Get(p,a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->lpVtbl->Set(p,a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->Get(a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->Set(a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->QuerySupport(a,b,c) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IKsPropertySet_ + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundFXGargle +// + +DEFINE_GUID(IID_IDirectSoundFXGargle, 0xd616f352, 0xd622, 0x11ce, 0xaa, 0xc5, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3); + +typedef struct _DSFXGargle +{ + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // DSFXGARGLE_WAVE_xxx +} DSFXGargle, *LPDSFXGargle; + +#define DSFXGARGLE_WAVE_TRIANGLE 0 +#define DSFXGARGLE_WAVE_SQUARE 1 + +typedef const DSFXGargle *LPCDSFXGargle; + +#define DSFXGARGLE_RATEHZ_MIN 1 +#define DSFXGARGLE_RATEHZ_MAX 1000 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXGargle + +DECLARE_INTERFACE_(IDirectSoundFXGargle, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXGargle methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXGargle pcDsFxGargle) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXGargle pDsFxGargle) PURE; +}; + +#define IDirectSoundFXGargle_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXGargle_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXGargle_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXChorus +// + +DEFINE_GUID(IID_IDirectSoundFXChorus, 0x880842e3, 0x145f, 0x43e6, 0xa9, 0x34, 0xa7, 0x18, 0x06, 0xe5, 0x05, 0x47); + +typedef struct _DSFXChorus +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; // LFO shape; DSFXCHORUS_WAVE_xxx + FLOAT fDelay; + LONG lPhase; +} DSFXChorus, *LPDSFXChorus; + +typedef const DSFXChorus *LPCDSFXChorus; + +#define DSFXCHORUS_WAVE_TRIANGLE 0 +#define DSFXCHORUS_WAVE_SIN 1 + +#define DSFXCHORUS_WETDRYMIX_MIN 0.0f +#define DSFXCHORUS_WETDRYMIX_MAX 100.0f +#define DSFXCHORUS_DEPTH_MIN 0.0f +#define DSFXCHORUS_DEPTH_MAX 100.0f +#define DSFXCHORUS_FEEDBACK_MIN -99.0f +#define DSFXCHORUS_FEEDBACK_MAX 99.0f +#define DSFXCHORUS_FREQUENCY_MIN 0.0f +#define DSFXCHORUS_FREQUENCY_MAX 10.0f +#define DSFXCHORUS_DELAY_MIN 0.0f +#define DSFXCHORUS_DELAY_MAX 20.0f +#define DSFXCHORUS_PHASE_MIN 0 +#define DSFXCHORUS_PHASE_MAX 4 + +#define DSFXCHORUS_PHASE_NEG_180 0 +#define DSFXCHORUS_PHASE_NEG_90 1 +#define DSFXCHORUS_PHASE_ZERO 2 +#define DSFXCHORUS_PHASE_90 3 +#define DSFXCHORUS_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXChorus + +DECLARE_INTERFACE_(IDirectSoundFXChorus, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXChorus methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXChorus pcDsFxChorus) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXChorus pDsFxChorus) PURE; +}; + +#define IDirectSoundFXChorus_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXChorus_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXChorus_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXFlanger +// + +DEFINE_GUID(IID_IDirectSoundFXFlanger, 0x903e9878, 0x2c92, 0x4072, 0x9b, 0x2c, 0xea, 0x68, 0xf5, 0x39, 0x67, 0x83); + +typedef struct _DSFXFlanger +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; + FLOAT fDelay; + LONG lPhase; +} DSFXFlanger, *LPDSFXFlanger; + +typedef const DSFXFlanger *LPCDSFXFlanger; + +#define DSFXFLANGER_WAVE_TRIANGLE 0 +#define DSFXFLANGER_WAVE_SIN 1 + +#define DSFXFLANGER_WETDRYMIX_MIN 0.0f +#define DSFXFLANGER_WETDRYMIX_MAX 100.0f +#define DSFXFLANGER_FREQUENCY_MIN 0.0f +#define DSFXFLANGER_FREQUENCY_MAX 10.0f +#define DSFXFLANGER_DEPTH_MIN 0.0f +#define DSFXFLANGER_DEPTH_MAX 100.0f +#define DSFXFLANGER_PHASE_MIN 0 +#define DSFXFLANGER_PHASE_MAX 4 +#define DSFXFLANGER_FEEDBACK_MIN -99.0f +#define DSFXFLANGER_FEEDBACK_MAX 99.0f +#define DSFXFLANGER_DELAY_MIN 0.0f +#define DSFXFLANGER_DELAY_MAX 4.0f + +#define DSFXFLANGER_PHASE_NEG_180 0 +#define DSFXFLANGER_PHASE_NEG_90 1 +#define DSFXFLANGER_PHASE_ZERO 2 +#define DSFXFLANGER_PHASE_90 3 +#define DSFXFLANGER_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXFlanger + +DECLARE_INTERFACE_(IDirectSoundFXFlanger, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXFlanger methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXFlanger pcDsFxFlanger) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXFlanger pDsFxFlanger) PURE; +}; + +#define IDirectSoundFXFlanger_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXFlanger_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXFlanger_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXEcho +// + +DEFINE_GUID(IID_IDirectSoundFXEcho, 0x8bd28edf, 0x50db, 0x4e92, 0xa2, 0xbd, 0x44, 0x54, 0x88, 0xd1, 0xed, 0x42); + +typedef struct _DSFXEcho +{ + FLOAT fWetDryMix; + FLOAT fFeedback; + FLOAT fLeftDelay; + FLOAT fRightDelay; + LONG lPanDelay; +} DSFXEcho, *LPDSFXEcho; + +typedef const DSFXEcho *LPCDSFXEcho; + +#define DSFXECHO_WETDRYMIX_MIN 0.0f +#define DSFXECHO_WETDRYMIX_MAX 100.0f +#define DSFXECHO_FEEDBACK_MIN 0.0f +#define DSFXECHO_FEEDBACK_MAX 100.0f +#define DSFXECHO_LEFTDELAY_MIN 1.0f +#define DSFXECHO_LEFTDELAY_MAX 2000.0f +#define DSFXECHO_RIGHTDELAY_MIN 1.0f +#define DSFXECHO_RIGHTDELAY_MAX 2000.0f +#define DSFXECHO_PANDELAY_MIN 0 +#define DSFXECHO_PANDELAY_MAX 1 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXEcho + +DECLARE_INTERFACE_(IDirectSoundFXEcho, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXEcho methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXEcho pcDsFxEcho) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXEcho pDsFxEcho) PURE; +}; + +#define IDirectSoundFXEcho_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXEcho_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXEcho_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXDistortion +// + +DEFINE_GUID(IID_IDirectSoundFXDistortion, 0x8ecf4326, 0x455f, 0x4d8b, 0xbd, 0xa9, 0x8d, 0x5d, 0x3e, 0x9e, 0x3e, 0x0b); + +typedef struct _DSFXDistortion +{ + FLOAT fGain; + FLOAT fEdge; + FLOAT fPostEQCenterFrequency; + FLOAT fPostEQBandwidth; + FLOAT fPreLowpassCutoff; +} DSFXDistortion, *LPDSFXDistortion; + +typedef const DSFXDistortion *LPCDSFXDistortion; + +#define DSFXDISTORTION_GAIN_MIN -60.0f +#define DSFXDISTORTION_GAIN_MAX 0.0f +#define DSFXDISTORTION_EDGE_MIN 0.0f +#define DSFXDISTORTION_EDGE_MAX 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX 8000.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MIN 100.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MAX 8000.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MIN 100.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MAX 8000.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXDistortion + +DECLARE_INTERFACE_(IDirectSoundFXDistortion, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXDistortion methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXDistortion pcDsFxDistortion) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXDistortion pDsFxDistortion) PURE; +}; + +#define IDirectSoundFXDistortion_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXDistortion_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXDistortion_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXCompressor +// + +DEFINE_GUID(IID_IDirectSoundFXCompressor, 0x4bbd1154, 0x62f6, 0x4e2c, 0xa1, 0x5c, 0xd3, 0xb6, 0xc4, 0x17, 0xf7, 0xa0); + +typedef struct _DSFXCompressor +{ + FLOAT fGain; + FLOAT fAttack; + FLOAT fRelease; + FLOAT fThreshold; + FLOAT fRatio; + FLOAT fPredelay; +} DSFXCompressor, *LPDSFXCompressor; + +typedef const DSFXCompressor *LPCDSFXCompressor; + +#define DSFXCOMPRESSOR_GAIN_MIN -60.0f +#define DSFXCOMPRESSOR_GAIN_MAX 60.0f +#define DSFXCOMPRESSOR_ATTACK_MIN 0.01f +#define DSFXCOMPRESSOR_ATTACK_MAX 500.0f +#define DSFXCOMPRESSOR_RELEASE_MIN 50.0f +#define DSFXCOMPRESSOR_RELEASE_MAX 3000.0f +#define DSFXCOMPRESSOR_THRESHOLD_MIN -60.0f +#define DSFXCOMPRESSOR_THRESHOLD_MAX 0.0f +#define DSFXCOMPRESSOR_RATIO_MIN 1.0f +#define DSFXCOMPRESSOR_RATIO_MAX 100.0f +#define DSFXCOMPRESSOR_PREDELAY_MIN 0.0f +#define DSFXCOMPRESSOR_PREDELAY_MAX 4.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXCompressor + +DECLARE_INTERFACE_(IDirectSoundFXCompressor, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXCompressor methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXCompressor pcDsFxCompressor) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXCompressor pDsFxCompressor) PURE; +}; + +#define IDirectSoundFXCompressor_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXCompressor_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXCompressor_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXParamEq +// + +DEFINE_GUID(IID_IDirectSoundFXParamEq, 0xc03ca9fe, 0xfe90, 0x4204, 0x80, 0x78, 0x82, 0x33, 0x4c, 0xd1, 0x77, 0xda); + +typedef struct _DSFXParamEq +{ + FLOAT fCenter; + FLOAT fBandwidth; + FLOAT fGain; +} DSFXParamEq, *LPDSFXParamEq; + +typedef const DSFXParamEq *LPCDSFXParamEq; + +#define DSFXPARAMEQ_CENTER_MIN 80.0f +#define DSFXPARAMEQ_CENTER_MAX 16000.0f +#define DSFXPARAMEQ_BANDWIDTH_MIN 1.0f +#define DSFXPARAMEQ_BANDWIDTH_MAX 36.0f +#define DSFXPARAMEQ_GAIN_MIN -15.0f +#define DSFXPARAMEQ_GAIN_MAX 15.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXParamEq + +DECLARE_INTERFACE_(IDirectSoundFXParamEq, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXParamEq methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXParamEq pcDsFxParamEq) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXParamEq pDsFxParamEq) PURE; +}; + +#define IDirectSoundFXParamEq_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXParamEq_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXParamEq_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXI3DL2Reverb +// + +DEFINE_GUID(IID_IDirectSoundFXI3DL2Reverb, 0x4b166a6a, 0x0d66, 0x43f3, 0x80, 0xe3, 0xee, 0x62, 0x80, 0xde, 0xe1, 0xa4); + +typedef struct _DSFXI3DL2Reverb +{ + LONG lRoom; // [-10000, 0] default: -1000 mB + LONG lRoomHF; // [-10000, 0] default: 0 mB + FLOAT flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + FLOAT flDecayTime; // [0.1, 20.0] default: 1.49s + FLOAT flDecayHFRatio; // [0.1, 2.0] default: 0.83 + LONG lReflections; // [-10000, 1000] default: -2602 mB + FLOAT flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + LONG lReverb; // [-10000, 2000] default: 200 mB + FLOAT flReverbDelay; // [0.0, 0.1] default: 0.011 s + FLOAT flDiffusion; // [0.0, 100.0] default: 100.0 % + FLOAT flDensity; // [0.0, 100.0] default: 100.0 % + FLOAT flHFReference; // [20.0, 20000.0] default: 5000.0 Hz +} DSFXI3DL2Reverb, *LPDSFXI3DL2Reverb; + +typedef const DSFXI3DL2Reverb *LPCDSFXI3DL2Reverb; + +#define DSFX_I3DL2REVERB_ROOM_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOM_MAX 0 +#define DSFX_I3DL2REVERB_ROOM_DEFAULT (-1000) + +#define DSFX_I3DL2REVERB_ROOMHF_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOMHF_MAX 0 +#define DSFX_I3DL2REVERB_ROOMHF_DEFAULT (-100) + +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN 0.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX 10.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT 0.0f + +#define DSFX_I3DL2REVERB_DECAYTIME_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYTIME_MAX 20.0f +#define DSFX_I3DL2REVERB_DECAYTIME_DEFAULT 1.49f + +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MAX 2.0f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT 0.83f + +#define DSFX_I3DL2REVERB_REFLECTIONS_MIN (-10000) +#define DSFX_I3DL2REVERB_REFLECTIONS_MAX 1000 +#define DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT (-2602) + +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX 0.3f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT 0.007f + +#define DSFX_I3DL2REVERB_REVERB_MIN (-10000) +#define DSFX_I3DL2REVERB_REVERB_MAX 2000 +#define DSFX_I3DL2REVERB_REVERB_DEFAULT (200) + +#define DSFX_I3DL2REVERB_REVERBDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REVERBDELAY_MAX 0.1f +#define DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT 0.011f + +#define DSFX_I3DL2REVERB_DIFFUSION_MIN 0.0f +#define DSFX_I3DL2REVERB_DIFFUSION_MAX 100.0f +#define DSFX_I3DL2REVERB_DIFFUSION_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_DENSITY_MIN 0.0f +#define DSFX_I3DL2REVERB_DENSITY_MAX 100.0f +#define DSFX_I3DL2REVERB_DENSITY_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_HFREFERENCE_MIN 20.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_MAX 20000.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT 5000.0f + +#define DSFX_I3DL2REVERB_QUALITY_MIN 0 +#define DSFX_I3DL2REVERB_QUALITY_MAX 3 +#define DSFX_I3DL2REVERB_QUALITY_DEFAULT 2 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXI3DL2Reverb + +DECLARE_INTERFACE_(IDirectSoundFXI3DL2Reverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXI3DL2Reverb methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXI3DL2Reverb pcDsFxI3DL2Reverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXI3DL2Reverb pDsFxI3DL2Reverb) PURE; + STDMETHOD(SetPreset) (THIS_ DWORD dwPreset) PURE; + STDMETHOD(GetPreset) (THIS_ LPDWORD pdwPreset) PURE; + STDMETHOD(SetQuality) (THIS_ LONG lQuality) PURE; + STDMETHOD(GetQuality) (THIS_ LONG *plQuality) PURE; +}; + +#define IDirectSoundFXI3DL2Reverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXI3DL2Reverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXI3DL2Reverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->lpVtbl->SetPreset(p,a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->lpVtbl->GetPreset(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->SetPreset(a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->GetPreset(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXWavesReverb +// + +DEFINE_GUID(IID_IDirectSoundFXWavesReverb,0x46858c3a,0x0dc6,0x45e3,0xb7,0x60,0xd4,0xee,0xf1,0x6c,0xb3,0x25); + +typedef struct _DSFXWavesReverb +{ + FLOAT fInGain; // [-96.0,0.0] default: 0.0 dB + FLOAT fReverbMix; // [-96.0,0.0] default: 0.0 db + FLOAT fReverbTime; // [0.001,3000.0] default: 1000.0 ms + FLOAT fHighFreqRTRatio; // [0.001,0.999] default: 0.001 +} DSFXWavesReverb, *LPDSFXWavesReverb; + +typedef const DSFXWavesReverb *LPCDSFXWavesReverb; + +#define DSFX_WAVESREVERB_INGAIN_MIN -96.0f +#define DSFX_WAVESREVERB_INGAIN_MAX 0.0f +#define DSFX_WAVESREVERB_INGAIN_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_MIN -96.0f +#define DSFX_WAVESREVERB_REVERBMIX_MAX 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBTIME_MIN 0.001f +#define DSFX_WAVESREVERB_REVERBTIME_MAX 3000.0f +#define DSFX_WAVESREVERB_REVERBTIME_DEFAULT 1000.0f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN 0.001f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX 0.999f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT 0.001f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXWavesReverb + +DECLARE_INTERFACE_(IDirectSoundFXWavesReverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXWavesReverb methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSFXWavesReverb pcDsFxWavesReverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSFXWavesReverb pDsFxWavesReverb) PURE; +}; + +#define IDirectSoundFXWavesReverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXWavesReverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXWavesReverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureFXAec +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXAec, 0xad74143d, 0x903d, 0x4ab7, 0x80, 0x66, 0x28, 0xd3, 0x63, 0x03, 0x6d, 0x65); + +typedef struct _DSCFXAec +{ + BOOL fEnable; + BOOL fNoiseFill; + DWORD dwMode; +} DSCFXAec, *LPDSCFXAec; + +typedef const DSCFXAec *LPCDSCFXAec; + +// These match the AEC_MODE_* constants in the DDK's ksmedia.h file +#define DSCFX_AEC_MODE_PASS_THROUGH 0x0 +#define DSCFX_AEC_MODE_HALF_DUPLEX 0x1 +#define DSCFX_AEC_MODE_FULL_DUPLEX 0x2 + +// These match the AEC_STATUS_* constants in ksmedia.h +#define DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED 0x0 +#define DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED 0x1 +#define DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED 0x2 +#define DSCFX_AEC_STATUS_CURRENTLY_CONVERGED 0x8 + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXAec + +DECLARE_INTERFACE_(IDirectSoundCaptureFXAec, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXAec methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetStatus) (THIS_ PDWORD pdwStatus) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXAec_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXAec_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXAec_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundCaptureFXNoiseSuppress +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXNoiseSuppress, 0xed311e41, 0xfbae, 0x4175, 0x96, 0x25, 0xcd, 0x8, 0x54, 0xf6, 0x93, 0xca); + +typedef struct _DSCFXNoiseSuppress +{ + BOOL fEnable; +} DSCFXNoiseSuppress, *LPDSCFXNoiseSuppress; + +typedef const DSCFXNoiseSuppress *LPCDSCFXNoiseSuppress; + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXNoiseSuppress + +DECLARE_INTERFACE_(IDirectSoundCaptureFXNoiseSuppress, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXNoiseSuppress methods + STDMETHOD(SetAllParameters) (THIS_ LPCDSCFXNoiseSuppress pcDscFxNoiseSuppress) PURE; + STDMETHOD(GetAllParameters) (THIS_ LPDSCFXNoiseSuppress pDscFxNoiseSuppress) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXNoiseSuppress_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXNoiseSuppress_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXNoiseSuppress_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundFullDuplex +// + +#ifndef _IDirectSoundFullDuplex_ +#define _IDirectSoundFullDuplex_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +DEFINE_GUID(IID_IDirectSoundFullDuplex, 0xedcb4c7a, 0xdaab, 0x4216, 0xa4, 0x2e, 0x6c, 0x50, 0x59, 0x6d, 0xdc, 0x1d); + +#undef INTERFACE +#define INTERFACE IDirectSoundFullDuplex + +DECLARE_INTERFACE_(IDirectSoundFullDuplex, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID *) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFullDuplex methods + STDMETHOD(Initialize) (THIS_ LPCGUID pCaptureGuid, LPCGUID pRenderGuid, LPCDSCBUFFERDESC lpDscBufferDesc, LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8) PURE; +}; + +#define IDirectSoundFullDuplex_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFullDuplex_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFullDuplex_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->Initialize(p,a,b,c,d,e,f,g,h) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->Initialize(a,b,c,d,e,f,g,h) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IDirectSoundFullDuplex_ + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Return Codes +// + +// The function completed successfully +#define DS_OK S_OK + +// The call succeeded, but we had to substitute the 3D algorithm +#define DS_NO_VIRTUALIZATION MAKE_HRESULT(0, _FACDS, 10) + +// The call failed because resources (such as a priority level) +// were already being used by another caller +#define DSERR_ALLOCATED MAKE_DSHRESULT(10) + +// The control (vol, pan, etc.) requested by the caller is not available +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30) + +// An invalid parameter was passed to the returning function +#define DSERR_INVALIDPARAM E_INVALIDARG + +// This call is not valid for the current state of this object +#define DSERR_INVALIDCALL MAKE_DSHRESULT(50) + +// An undetermined error occurred inside the DirectSound subsystem +#define DSERR_GENERIC E_FAIL + +// The caller does not have the priority level required for the function to +// succeed +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) + +// Not enough free memory is available to complete the operation +#define DSERR_OUTOFMEMORY E_OUTOFMEMORY + +// The specified WAVE format is not supported +#define DSERR_BADFORMAT MAKE_DSHRESULT(100) + +// The function called is not supported at this time +#define DSERR_UNSUPPORTED E_NOTIMPL + +// No sound driver is available for use +#define DSERR_NODRIVER MAKE_DSHRESULT(120) +// This object is already initialized +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130) + +// This object does not support aggregation +#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +// The buffer memory has been lost, and must be restored +#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) + +// Another app has a higher priority level, preventing this call from +// succeeding +#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT(160) + +// This object has not been initialized +#define DSERR_UNINITIALIZED MAKE_DSHRESULT(170) + +// The requested COM interface is not available +#define DSERR_NOINTERFACE E_NOINTERFACE + +// Access is denied +#define DSERR_ACCESSDENIED E_ACCESSDENIED + +// Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds +#define DSERR_BUFFERTOOSMALL MAKE_DSHRESULT(180) + +// Attempt to use DirectSound 8 functionality on an older DirectSound object +#define DSERR_DS8_REQUIRED MAKE_DSHRESULT(190) + +// A circular loop of send effects was detected +#define DSERR_SENDLOOP MAKE_DSHRESULT(200) + +// The GUID specified in an audiopath file does not match a valid MIXIN buffer +#define DSERR_BADSENDBUFFERGUID MAKE_DSHRESULT(210) + +// The object requested was not found (numerically equal to DMUS_E_NOT_FOUND) +#define DSERR_OBJECTNOTFOUND MAKE_DSHRESULT(4449) + +// The effects requested could not be found on the system, or they were found +// but in the wrong order, or in the wrong hardware/software locations. +#define DSERR_FXUNAVAILABLE MAKE_DSHRESULT(220) + +// +// Flags +// + +#define DSCAPS_PRIMARYMONO 0x00000001 +#define DSCAPS_PRIMARYSTEREO 0x00000002 +#define DSCAPS_PRIMARY8BIT 0x00000004 +#define DSCAPS_PRIMARY16BIT 0x00000008 +#define DSCAPS_CONTINUOUSRATE 0x00000010 +#define DSCAPS_EMULDRIVER 0x00000020 +#define DSCAPS_CERTIFIED 0x00000040 +#define DSCAPS_SECONDARYMONO 0x00000100 +#define DSCAPS_SECONDARYSTEREO 0x00000200 +#define DSCAPS_SECONDARY8BIT 0x00000400 +#define DSCAPS_SECONDARY16BIT 0x00000800 + +#define DSSCL_NORMAL 0x00000001 +#define DSSCL_PRIORITY 0x00000002 +#define DSSCL_EXCLUSIVE 0x00000003 +#define DSSCL_WRITEPRIMARY 0x00000004 + +#define DSSPEAKER_DIRECTOUT 0x00000000 +#define DSSPEAKER_HEADPHONE 0x00000001 +#define DSSPEAKER_MONO 0x00000002 +#define DSSPEAKER_QUAD 0x00000003 +#define DSSPEAKER_STEREO 0x00000004 +#define DSSPEAKER_SURROUND 0x00000005 +#define DSSPEAKER_5POINT1 0x00000006 // obsolete 5.1 setting +#define DSSPEAKER_7POINT1 0x00000007 // obsolete 7.1 setting +#define DSSPEAKER_7POINT1_SURROUND 0x00000008 // correct 7.1 Home Theater setting +#define DSSPEAKER_7POINT1_WIDE DSSPEAKER_7POINT1 +#if (DIRECTSOUND_VERSION >= 0x1000) + #define DSSPEAKER_5POINT1_SURROUND 0x00000009 // correct 5.1 setting + #define DSSPEAKER_5POINT1_BACK DSSPEAKER_5POINT1 +#endif + +#define DSSPEAKER_GEOMETRY_MIN 0x00000005 // 5 degrees +#define DSSPEAKER_GEOMETRY_NARROW 0x0000000A // 10 degrees +#define DSSPEAKER_GEOMETRY_WIDE 0x00000014 // 20 degrees +#define DSSPEAKER_GEOMETRY_MAX 0x000000B4 // 180 degrees + +#define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +#define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +#define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) + +#define DSBCAPS_PRIMARYBUFFER 0x00000001 +#define DSBCAPS_STATIC 0x00000002 +#define DSBCAPS_LOCHARDWARE 0x00000004 +#define DSBCAPS_LOCSOFTWARE 0x00000008 +#define DSBCAPS_CTRL3D 0x00000010 +#define DSBCAPS_CTRLFREQUENCY 0x00000020 +#define DSBCAPS_CTRLPAN 0x00000040 +#define DSBCAPS_CTRLVOLUME 0x00000080 +#define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100 +#define DSBCAPS_CTRLFX 0x00000200 +#define DSBCAPS_STICKYFOCUS 0x00004000 +#define DSBCAPS_GLOBALFOCUS 0x00008000 +#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 +#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000 +#define DSBCAPS_LOCDEFER 0x00040000 +#if (DIRECTSOUND_VERSION >= 0x1000) + // Force GetCurrentPosition() to return a buffer's true play position; + // unmodified by aids to enhance backward compatibility. + #define DSBCAPS_TRUEPLAYPOSITION 0x00080000 +#endif + +#define DSBPLAY_LOOPING 0x00000001 +#define DSBPLAY_LOCHARDWARE 0x00000002 +#define DSBPLAY_LOCSOFTWARE 0x00000004 +#define DSBPLAY_TERMINATEBY_TIME 0x00000008 +#define DSBPLAY_TERMINATEBY_DISTANCE 0x000000010 +#define DSBPLAY_TERMINATEBY_PRIORITY 0x000000020 + +#define DSBSTATUS_PLAYING 0x00000001 +#define DSBSTATUS_BUFFERLOST 0x00000002 +#define DSBSTATUS_LOOPING 0x00000004 +#define DSBSTATUS_LOCHARDWARE 0x00000008 +#define DSBSTATUS_LOCSOFTWARE 0x00000010 +#define DSBSTATUS_TERMINATED 0x00000020 + +#define DSBLOCK_FROMWRITECURSOR 0x00000001 +#define DSBLOCK_ENTIREBUFFER 0x00000002 + +#define DSBFREQUENCY_ORIGINAL 0 +#define DSBFREQUENCY_MIN 100 +#if DIRECTSOUND_VERSION >= 0x0900 +#define DSBFREQUENCY_MAX 200000 +#else +#define DSBFREQUENCY_MAX 100000 +#endif + +#define DSBPAN_LEFT -10000 +#define DSBPAN_CENTER 0 +#define DSBPAN_RIGHT 10000 + +#define DSBVOLUME_MIN -10000 +#define DSBVOLUME_MAX 0 + +#define DSBSIZE_MIN 4 +#define DSBSIZE_MAX 0x0FFFFFFF +#define DSBSIZE_FX_MIN 150 // NOTE: Milliseconds, not bytes + +#define DSBNOTIFICATIONS_MAX 100000UL + +#define DS3DMODE_NORMAL 0x00000000 +#define DS3DMODE_HEADRELATIVE 0x00000001 +#define DS3DMODE_DISABLE 0x00000002 + +#define DS3D_IMMEDIATE 0x00000000 +#define DS3D_DEFERRED 0x00000001 + +#define DS3D_MINDISTANCEFACTOR FLT_MIN +#define DS3D_MAXDISTANCEFACTOR FLT_MAX +#define DS3D_DEFAULTDISTANCEFACTOR 1.0f + +#define DS3D_MINROLLOFFFACTOR 0.0f +#define DS3D_MAXROLLOFFFACTOR 10.0f +#define DS3D_DEFAULTROLLOFFFACTOR 1.0f + +#define DS3D_MINDOPPLERFACTOR 0.0f +#define DS3D_MAXDOPPLERFACTOR 10.0f +#define DS3D_DEFAULTDOPPLERFACTOR 1.0f + +#define DS3D_DEFAULTMINDISTANCE 1.0f +#define DS3D_DEFAULTMAXDISTANCE 1000000000.0f + +#define DS3D_MINCONEANGLE 0 +#define DS3D_MAXCONEANGLE 360 +#define DS3D_DEFAULTCONEANGLE 360 + +#define DS3D_DEFAULTCONEOUTSIDEVOLUME DSBVOLUME_MAX + +// IDirectSoundCapture attributes + +#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER +#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED +#define DSCCAPS_MULTIPLECAPTURE 0x00000001 + +// IDirectSoundCaptureBuffer attributes + +#define DSCBCAPS_WAVEMAPPED 0x80000000 + +#if DIRECTSOUND_VERSION >= 0x0800 +#define DSCBCAPS_CTRLFX 0x00000200 +#endif + + +#define DSCBLOCK_ENTIREBUFFER 0x00000001 + +#define DSCBSTATUS_CAPTURING 0x00000001 +#define DSCBSTATUS_LOOPING 0x00000002 + +#define DSCBSTART_LOOPING 0x00000001 + +#define DSBPN_OFFSETSTOP 0xFFFFFFFF + +#define DS_CERTIFIED 0x00000000 +#define DS_UNCERTIFIED 0x00000001 + + +// +// Flags for the I3DL2 effects +// + +// +// I3DL2 Material Presets +// + +enum +{ + DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_THINDOOR, + DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR, + DSFX_I3DL2_MATERIAL_PRESET_WOODWALL, + DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL, + DSFX_I3DL2_MATERIAL_PRESET_STONEWALL, + DSFX_I3DL2_MATERIAL_PRESET_CURTAIN +}; + +#define I3DL2_MATERIAL_PRESET_SINGLEWINDOW -2800,0.71f +#define I3DL2_MATERIAL_PRESET_DOUBLEWINDOW -5000,0.40f +#define I3DL2_MATERIAL_PRESET_THINDOOR -1800,0.66f +#define I3DL2_MATERIAL_PRESET_THICKDOOR -4400,0.64f +#define I3DL2_MATERIAL_PRESET_WOODWALL -4000,0.50f +#define I3DL2_MATERIAL_PRESET_BRICKWALL -5000,0.60f +#define I3DL2_MATERIAL_PRESET_STONEWALL -6000,0.68f +#define I3DL2_MATERIAL_PRESET_CURTAIN -1200,0.15f + +enum +{ + DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT, + DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC, + DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL, + DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM, + DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE, + DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA, + DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR, + DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR, + DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY, + DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST, + DSFX_I3DL2_ENVIRONMENT_PRESET_CITY, + DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS, + DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN, + DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT, + DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE, + DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER, + DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE +}; + +// +// I3DL2 Reverberation Presets Values +// + +#define I3DL2_ENVIRONMENT_PRESET_DEFAULT -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_GENERIC -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PADDEDCELL -1000,-6000, 0.0f, 0.17f, 0.10f, -1204, 0.001f, 207, 0.002f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ROOM -1000, -454, 0.0f, 0.40f, 0.83f, -1646, 0.002f, 53, 0.003f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_BATHROOM -1000,-1200, 0.0f, 1.49f, 0.54f, -370, 0.007f, 1030, 0.011f, 100.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LIVINGROOM -1000,-6000, 0.0f, 0.50f, 0.10f, -1376, 0.003f, -1104, 0.004f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONEROOM -1000, -300, 0.0f, 2.31f, 0.64f, -711, 0.012f, 83, 0.017f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_AUDITORIUM -1000, -476, 0.0f, 4.32f, 0.59f, -789, 0.020f, -289, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CONCERTHALL -1000, -500, 0.0f, 3.92f, 0.70f, -1230, 0.020f, -2, 0.029f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CAVE -1000, 0, 0.0f, 2.91f, 1.30f, -602, 0.015f, -302, 0.022f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ARENA -1000, -698, 0.0f, 7.24f, 0.33f, -1166, 0.020f, 16, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HANGAR -1000,-1000, 0.0f,10.05f, 0.23f, -602, 0.020f, 198, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY -1000,-4000, 0.0f, 0.30f, 0.10f, -1831, 0.002f, -1630, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HALLWAY -1000, -300, 0.0f, 1.49f, 0.59f, -1219, 0.007f, 441, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR -1000, -237, 0.0f, 2.70f, 0.79f, -1214, 0.013f, 395, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ALLEY -1000, -270, 0.0f, 1.49f, 0.86f, -1204, 0.007f, -4, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_FOREST -1000,-3300, 0.0f, 1.49f, 0.54f, -2560, 0.162f, -613, 0.088f, 79.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CITY -1000, -800, 0.0f, 1.49f, 0.67f, -2273, 0.007f, -2217, 0.011f, 50.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MOUNTAINS -1000,-2500, 0.0f, 1.49f, 0.21f, -2780, 0.300f, -2014, 0.100f, 27.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_QUARRY -1000,-1000, 0.0f, 1.49f, 0.83f,-10000, 0.061f, 500, 0.025f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLAIN -1000,-2000, 0.0f, 1.49f, 0.50f, -2466, 0.179f, -2514, 0.100f, 21.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PARKINGLOT -1000, 0, 0.0f, 1.65f, 1.50f, -1363, 0.008f, -1153, 0.012f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_SEWERPIPE -1000,-1000, 0.0f, 2.81f, 0.14f, 429, 0.014f, 648, 0.021f, 80.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_UNDERWATER -1000,-4000, 0.0f, 1.49f, 0.10f, -449, 0.007f, 1700, 0.011f, 100.0f, 100.0f, 5000.0f + +// +// Examples simulating 'musical' reverb presets +// +// Name Decay time Description +// Small Room 1.1s A small size room with a length of 5m or so. +// Medium Room 1.3s A medium size room with a length of 10m or so. +// Large Room 1.5s A large size room suitable for live performances. +// Medium Hall 1.8s A medium size concert hall. +// Large Hall 1.8s A large size concert hall suitable for a full orchestra. +// Plate 1.3s A plate reverb simulation. +// + +#define I3DL2_ENVIRONMENT_PRESET_SMALLROOM -1000, -600, 0.0f, 1.10f, 0.83f, -400, 0.005f, 500, 0.010f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM -1000, -600, 0.0f, 1.30f, 0.83f, -1000, 0.010f, -200, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEROOM -1000, -600, 0.0f, 1.50f, 0.83f, -1600, 0.020f, -1000, 0.040f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL -1000, -600, 0.0f, 1.80f, 0.70f, -1300, 0.015f, -800, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEHALL -1000, -600, 0.0f, 1.80f, 0.70f, -2000, 0.030f, -1400, 0.060f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLATE -1000, -200, 0.0f, 1.30f, 0.90f, 0, 0.002f, 0, 0.010f, 100.0f, 75.0f, 5000.0f + +// +// DirectSound3D Algorithms +// + +// Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000} +#define DS3DALG_DEFAULT GUID_NULL + +// No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_NO_VIRTUALIZATION, 0xc241333f, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_FULL, 0xc2413340, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_LIGHT, 0xc2413342, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// DirectSound Internal Effect Algorithms +// + + +// Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF} +DEFINE_GUID(GUID_DSFX_STANDARD_GARGLE, 0xdafd8210, 0x5711, 0x4b91, 0x9f, 0xe3, 0xf7, 0x5b, 0x7a, 0xe2, 0x79, 0xbf); + +// Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6} +DEFINE_GUID(GUID_DSFX_STANDARD_CHORUS, 0xefe6629c, 0x81f7, 0x4281, 0xbd, 0x91, 0xc9, 0xd6, 0x04, 0xa9, 0x5a, 0xf6); + +// Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98} +DEFINE_GUID(GUID_DSFX_STANDARD_FLANGER, 0xefca3d92, 0xdfd8, 0x4672, 0xa6, 0x03, 0x74, 0x20, 0x89, 0x4b, 0xad, 0x98); + +// Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D} +DEFINE_GUID(GUID_DSFX_STANDARD_ECHO, 0xef3e932c, 0xd40b, 0x4f51, 0x8c, 0xcf, 0x3f, 0x98, 0xf1, 0xb2, 0x9d, 0x5d); + +// Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21} +DEFINE_GUID(GUID_DSFX_STANDARD_DISTORTION, 0xef114c90, 0xcd1d, 0x484e, 0x96, 0xe5, 0x09, 0xcf, 0xaf, 0x91, 0x2a, 0x21); + +// Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57} +DEFINE_GUID(GUID_DSFX_STANDARD_COMPRESSOR, 0xef011f79, 0x4000, 0x406d, 0x87, 0xaf, 0xbf, 0xfb, 0x3f, 0xc3, 0x9d, 0x57); + +// Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231} +DEFINE_GUID(GUID_DSFX_STANDARD_PARAMEQ, 0x120ced89, 0x3bf4, 0x4173, 0xa1, 0x32, 0x3c, 0xb4, 0x06, 0xcf, 0x32, 0x31); + +// I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4} +DEFINE_GUID(GUID_DSFX_STANDARD_I3DL2REVERB, 0xef985e71, 0xd5c7, 0x42d4, 0xba, 0x4d, 0x2d, 0x07, 0x3e, 0x2e, 0x96, 0xf4); + +// Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C} +DEFINE_GUID(GUID_DSFX_WAVES_REVERB, 0x87fc0268, 0x9a55, 0x4360, 0x95, 0xaa, 0x00, 0x4a, 0x1d, 0x9d, 0xe2, 0x6c); + +// +// DirectSound Capture Effect Algorithms +// + + +// Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1} +// Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_AEC, 0xBF963D80L, 0xC559, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); + +// Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40} +DEFINE_GUID(GUID_DSCFX_MS_AEC, 0xcdebb919, 0x379a, 0x488a, 0x87, 0x65, 0xf5, 0x3c, 0xfd, 0x36, 0xde, 0x40); + +// System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810} +DEFINE_GUID(GUID_DSCFX_SYSTEM_AEC, 0x1c22c56d, 0x9879, 0x4f5b, 0xa3, 0x89, 0x27, 0x99, 0x6d, 0xdc, 0x28, 0x10); + +// Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5} +// Matches KSNODETYPE_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_NS, 0xe07f903f, 0x62fd, 0x4e60, 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5); + +// Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D} +DEFINE_GUID(GUID_DSCFX_MS_NS, 0x11c5c73b, 0x66e9, 0x4ba1, 0xa0, 0xba, 0xe8, 0x14, 0xc6, 0xee, 0xd9, 0x2d); + +// System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0} +DEFINE_GUID(GUID_DSCFX_SYSTEM_NS, 0x5ab0882e, 0x7274, 0x4516, 0x87, 0x7d, 0x4e, 0xee, 0x99, 0xba, 0x4f, 0xd0); + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#endif // __DSOUND_INCLUDED__ + + + +#ifdef __cplusplus +}; +#endif // __cplusplus + diff --git a/SDK/dxSDK/Include/dvoice.h b/SDK/dxSDK/Include/dvoice.h new file mode 100644 index 00000000..000ac511 --- /dev/null +++ b/SDK/dxSDK/Include/dvoice.h @@ -0,0 +1,857 @@ +/*==========================================================================; + * + * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved. + * + * File: dpvoice.h + * Content: DirectPlayVoice include file + ***************************************************************************/ + +#ifndef __DVOICE__ +#define __DVOICE__ + +#include // for DECLARE_INTERFACE and HRESULT +#include +#include +#include +#include "dsound.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/**************************************************************************** + * + * DirectPlayVoice CLSIDs + * + ****************************************************************************/ + + +// {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D} +DEFINE_GUID(CLSID_DirectPlayVoiceClient, +0xb9f3eb85, 0xb781, 0x4ac1, 0x8d, 0x90, 0x93, 0xa0, 0x5e, 0xe3, 0x7d, 0x7d); + +// {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3} +DEFINE_GUID(CLSID_DirectPlayVoiceServer, +0xd3f5b8e6, 0x9b78, 0x4a4c, 0x94, 0xea, 0xca, 0x23, 0x97, 0xb6, 0x63, 0xd3); + +// {0F0F094B-B01C-4091-A14D-DD0CD807711A} +DEFINE_GUID(CLSID_DirectPlayVoiceTest, +0xf0f094b, 0xb01c, 0x4091, 0xa1, 0x4d, 0xdd, 0xc, 0xd8, 0x7, 0x71, 0x1a); + +/**************************************************************************** + * + * DirectPlayVoice Interface IIDs + * + ****************************************************************************/ + + +// {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306} +DEFINE_GUID(IID_IDirectPlayVoiceClient, +0x1dfdc8ea, 0xbcf7, 0x41d6, 0xb2, 0x95, 0xab, 0x64, 0xb3, 0xb2, 0x33, 0x6); + +// {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9} +DEFINE_GUID(IID_IDirectPlayVoiceServer, +0xfaa1c173, 0x468, 0x43b6, 0x8a, 0x2a, 0xea, 0x8a, 0x4f, 0x20, 0x76, 0xc9); + +// {D26AF734-208B-41da-8224-E0CE79810BE1} +DEFINE_GUID(IID_IDirectPlayVoiceTest, +0xd26af734, 0x208b, 0x41da, 0x82, 0x24, 0xe0, 0xce, 0x79, 0x81, 0xb, 0xe1); + +/**************************************************************************** + * + * DirectPlayVoice Compression Type GUIDs + * + ****************************************************************************/ + +// MS-ADPCM 32.8 kbit/s +// +// {699B52C1-A885-46a8-A308-97172419ADC7} +DEFINE_GUID(DPVCTGUID_ADPCM, +0x699b52c1, 0xa885, 0x46a8, 0xa3, 0x8, 0x97, 0x17, 0x24, 0x19, 0xad, 0xc7); + +// Microsoft GSM 6.10 13 kbit/s +// +// {24768C60-5A0D-11d3-9BE4-525400D985E7} +DEFINE_GUID(DPVCTGUID_GSM, +0x24768c60, 0x5a0d, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7); + +// MS-PCM 64 kbit/s +// +// {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5} +DEFINE_GUID(DPVCTGUID_NONE, +0x8de12fd4, 0x7cb3, 0x48ce, 0xa7, 0xe8, 0x9c, 0x47, 0xa2, 0x2e, 0x8a, 0xc5); + +// Voxware SC03 3.2kbit/s +// +// {7D82A29B-2242-4f82-8F39-5D1153DF3E41} +DEFINE_GUID(DPVCTGUID_SC03, +0x7d82a29b, 0x2242, 0x4f82, 0x8f, 0x39, 0x5d, 0x11, 0x53, 0xdf, 0x3e, 0x41); + +// Voxware SC06 6.4kbit/s +// +// {53DEF900-7168-4633-B47F-D143916A13C7} +DEFINE_GUID(DPVCTGUID_SC06, +0x53def900, 0x7168, 0x4633, 0xb4, 0x7f, 0xd1, 0x43, 0x91, 0x6a, 0x13, 0xc7); + +// TrueSpeech(TM) 8.6 kbit/s +// +// {D7954361-5A0B-11d3-9BE4-525400D985E7} +DEFINE_GUID(DPVCTGUID_TRUESPEECH, +0xd7954361, 0x5a0b, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7); + +// Voxware VR12 1.4kbit/s +// +// {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D} +DEFINE_GUID(DPVCTGUID_VR12, +0xfe44a9fe, 0x8ed4, 0x48bf, 0x9d, 0x66, 0x1b, 0x1a, 0xdf, 0xf9, 0xff, 0x6d); + +// Define the default compression type +#define DPVCTGUID_DEFAULT DPVCTGUID_SC03 + +/**************************************************************************** + * + * DirectPlayVoice Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDirectPlayVoiceClient FAR *LPDIRECTPLAYVOICECLIENT, *PDIRECTPLAYVOICECLIENT; +typedef struct IDirectPlayVoiceServer FAR *LPDIRECTPLAYVOICESERVER, *PDIRECTPLAYVOICESERVER; +typedef struct IDirectPlayVoiceTest FAR *LPDIRECTPLAYVOICETEST, *PDIRECTPLAYVOICETEST; + +/**************************************************************************** + * + * DirectPlayVoice Callback Functions + * + ****************************************************************************/ +typedef HRESULT (FAR PASCAL *PDVMESSAGEHANDLER)( + PVOID pvUserContext, + DWORD dwMessageType, + LPVOID lpMessage +); + +typedef PDVMESSAGEHANDLER LPDVMESSAGEHANDLER; + +/**************************************************************************** + * + * DirectPlayVoice Datatypes (Non-Structure / Non-Message) + * + ****************************************************************************/ + +typedef DWORD DVID, *LPDVID, *PDVID; + +/**************************************************************************** + * + * DirectPlayVoice Message Types + * + ****************************************************************************/ + +#define DVMSGID_BASE 0x0000 + +#define DVMSGID_MINBASE (DVMSGID_CREATEVOICEPLAYER) +#define DVMSGID_CREATEVOICEPLAYER (DVMSGID_BASE+0x0001) +#define DVMSGID_DELETEVOICEPLAYER (DVMSGID_BASE+0x0002) +#define DVMSGID_SESSIONLOST (DVMSGID_BASE+0x0003) +#define DVMSGID_PLAYERVOICESTART (DVMSGID_BASE+0x0004) +#define DVMSGID_PLAYERVOICESTOP (DVMSGID_BASE+0x0005) +#define DVMSGID_RECORDSTART (DVMSGID_BASE+0x0006) +#define DVMSGID_RECORDSTOP (DVMSGID_BASE+0x0007) +#define DVMSGID_CONNECTRESULT (DVMSGID_BASE+0x0008) +#define DVMSGID_DISCONNECTRESULT (DVMSGID_BASE+0x0009) +#define DVMSGID_INPUTLEVEL (DVMSGID_BASE+0x000A) +#define DVMSGID_OUTPUTLEVEL (DVMSGID_BASE+0x000B) +#define DVMSGID_HOSTMIGRATED (DVMSGID_BASE+0x000C) +#define DVMSGID_SETTARGETS (DVMSGID_BASE+0x000D) +#define DVMSGID_PLAYEROUTPUTLEVEL (DVMSGID_BASE+0x000E) +#define DVMSGID_LOSTFOCUS (DVMSGID_BASE+0x0010) +#define DVMSGID_GAINFOCUS (DVMSGID_BASE+0x0011) +#define DVMSGID_LOCALHOSTSETUP (DVMSGID_BASE+0x0012) +#define DVMSGID_MAXBASE (DVMSGID_LOCALHOSTSETUP) + +/**************************************************************************** + * + * DirectPlayVoice Constants + * + ****************************************************************************/ + +// +// Buffer Aggresiveness Value Ranges +// +#define DVBUFFERAGGRESSIVENESS_MIN 0x00000001 +#define DVBUFFERAGGRESSIVENESS_MAX 0x00000064 +#define DVBUFFERAGGRESSIVENESS_DEFAULT 0x00000000 + +// +// Buffer Quality Value Ranges +// +#define DVBUFFERQUALITY_MIN 0x00000001 +#define DVBUFFERQUALITY_MAX 0x00000064 +#define DVBUFFERQUALITY_DEFAULT 0x00000000 + +#define DVID_SYS 0 + +// +// Used to identify the session host in client/server +// +#define DVID_SERVERPLAYER 1 + +// +// Used to target all players +// +#define DVID_ALLPLAYERS 0 + +// +// Used to identify the main buffer +// +#define DVID_REMAINING 0xFFFFFFFF + +// +// Input level range +// +#define DVINPUTLEVEL_MIN 0x00000000 +#define DVINPUTLEVEL_MAX 0x00000063 // 99 decimal + +#define DVNOTIFYPERIOD_MINPERIOD 20 + + +#define DVPLAYBACKVOLUME_DEFAULT DSBVOLUME_MAX + +#define DVRECORDVOLUME_LAST 0x00000001 + + +// +// Use the default value +// +#define DVTHRESHOLD_DEFAULT 0xFFFFFFFF + +// +// Threshold Ranges +// +#define DVTHRESHOLD_MIN 0x00000000 +#define DVTHRESHOLD_MAX 0x00000063 // 99 decimal + +// +// Threshold field is not used +// +#define DVTHRESHOLD_UNUSED 0xFFFFFFFE + +// +// Session Types +// +#define DVSESSIONTYPE_PEER 0x00000001 +#define DVSESSIONTYPE_MIXING 0x00000002 +#define DVSESSIONTYPE_FORWARDING 0x00000003 +#define DVSESSIONTYPE_ECHO 0x00000004 + +/**************************************************************************** + * + * DirectPlayVoice Flags + * + ****************************************************************************/ + + +// +// Enable automatic adjustment of the recording volume +// +#define DVCLIENTCONFIG_AUTORECORDVOLUME 0x00000008 + +// +// Enable automatic voice activation +// +#define DVCLIENTCONFIG_AUTOVOICEACTIVATED 0x00000020 + +// +// Enable echo suppression +// +#define DVCLIENTCONFIG_ECHOSUPPRESSION 0x08000000 + +// +// Voice Activation manual mode +// +#define DVCLIENTCONFIG_MANUALVOICEACTIVATED 0x00000004 + +// +// Only playback voices that have buffers created for them +// +#define DVCLIENTCONFIG_MUTEGLOBAL 0x00000010 + +// +// Mute the playback +// +#define DVCLIENTCONFIG_PLAYBACKMUTE 0x00000002 + +// +// Mute the recording +// +#define DVCLIENTCONFIG_RECORDMUTE 0x00000001 + +// +// Complete the operation before returning +// +#define DVFLAGS_SYNC 0x00000001 + +// +// Just check to see if wizard has been run, and if so what it's results were +// +#define DVFLAGS_QUERYONLY 0x00000002 + +// +// Shutdown the voice session without migrating the host +// +#define DVFLAGS_NOHOSTMIGRATE 0x00000008 + +// +// Allow the back button to be enabled in the wizard +// +#define DVFLAGS_ALLOWBACK 0x00000010 + +// +// Disable host migration in the voice session +// +#define DVSESSION_NOHOSTMIGRATION 0x00000001 + +// +// Server controlled targetting +// +#define DVSESSION_SERVERCONTROLTARGET 0x00000002 + +// +// Use DirectSound Normal Mode instead of priority +// +#define DVSOUNDCONFIG_NORMALMODE 0x00000001 + +// +// Automatically select the microphone +// +#define DVSOUNDCONFIG_AUTOSELECT 0x00000002 + +// +// Run in half duplex mode +// +#define DVSOUNDCONFIG_HALFDUPLEX 0x00000004 + +// +// No volume controls are available for the recording device +// +#define DVSOUNDCONFIG_NORECVOLAVAILABLE 0x00000010 + +// +// Disable capture sharing +// +#define DVSOUNDCONFIG_NOFOCUS 0x20000000 + +// +// Set system conversion quality to high +// +#define DVSOUNDCONFIG_SETCONVERSIONQUALITY 0x00000008 + +// +// Enable strict focus mode +// +#define DVSOUNDCONFIG_STRICTFOCUS 0x40000000 + +// +// Player is in half duplex mode +// +#define DVPLAYERCAPS_HALFDUPLEX 0x00000001 + +// +// Specifies that player is the local player +// +#define DVPLAYERCAPS_LOCAL 0x00000002 + +/**************************************************************************** + * + * DirectPlayVoice Structures (Non-Message) + * + ****************************************************************************/ + + +// +// DirectPlayVoice Caps +// (GetCaps / SetCaps) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Caps flags +} DVCAPS, *LPDVCAPS, *PDVCAPS; + +// +// DirectPlayVoice Client Configuration +// (Connect / GetClientConfig) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags for client config (DVCLIENTCONFIG_...) + LONG lRecordVolume; // Recording volume + LONG lPlaybackVolume; // Playback volume + DWORD dwThreshold; // Voice Activation Threshold + DWORD dwBufferQuality; // Buffer quality + DWORD dwBufferAggressiveness; // Buffer aggressiveness + DWORD dwNotifyPeriod; // Period of notification messages (ms) +} DVCLIENTCONFIG, *LPDVCLIENTCONFIG, *PDVCLIENTCONFIG; + +// +// DirectPlayVoice Compression Type Information +// (GetCompressionTypes) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + GUID guidType; // GUID that identifies this compression type + LPWSTR lpszName; // String name of this compression type + LPWSTR lpszDescription; // Description for this compression type + DWORD dwFlags; // Flags for this compression type + DWORD dwMaxBitsPerSecond; // Maximum # of bit/s this compression type uses +} DVCOMPRESSIONINFO, *LPDVCOMPRESSIONINFO, *PDVCOMPRESSIONINFO; + +// +// DirectPlayVoice Session Description +// (Host / GetSessionDesc) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Session flags (DVSESSION_...) + DWORD dwSessionType; // Session type (DVSESSIONTYPE_...) + GUID guidCT; // Compression Type to use + DWORD dwBufferQuality; // Buffer quality + DWORD dwBufferAggressiveness; // Buffer aggresiveness +} DVSESSIONDESC, *LPDVSESSIONDESC, *PDVSESSIONDESC; + +// +// DirectPlayVoice Client Sound Device Configuration +// (Connect / GetSoundDeviceConfig) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags for sound config (DVSOUNDCONFIG_...) + GUID guidPlaybackDevice; // GUID of the playback device to use + LPDIRECTSOUND lpdsPlaybackDevice; // DirectSound Object to use (optional) + GUID guidCaptureDevice; // GUID of the capture device to use + LPDIRECTSOUNDCAPTURE lpdsCaptureDevice; // DirectSoundCapture Object to use (optional) + HWND hwndAppWindow; // HWND of your application's top-level window + LPDIRECTSOUNDBUFFER lpdsMainBuffer; // DirectSoundBuffer to use for playback (optional) + DWORD dwMainBufferFlags; // Flags to pass to Play() on the main buffer + DWORD dwMainBufferPriority; // Priority to set when calling Play() on the main buffer +} DVSOUNDDEVICECONFIG, *LPDVSOUNDDEVICECONFIG, *PDVSOUNDDEVICECONFIG; + +/**************************************************************************** + * + * DirectPlayVoice message handler call back structures + * + ****************************************************************************/ + +// +// Result of the Connect() call. (If it wasn't called Async) +// (DVMSGID_CONNECTRESULT) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Result of the Connect() call +} DVMSG_CONNECTRESULT, *LPDVMSG_CONNECTRESULT, *PDVMSG_CONNECTRESULT; + +// +// A new player has entered the voice session +// (DVMSGID_CREATEVOICEPLAYER) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidPlayer; // DVID of the player who joined + DWORD dwFlags; // Player flags (DVPLAYERCAPS_...) + PVOID pvPlayerContext; // Context value for this player (user set) +} DVMSG_CREATEVOICEPLAYER, *LPDVMSG_CREATEVOICEPLAYER, *PDVMSG_CREATEVOICEPLAYER; + +// +// A player has left the voice session +// (DVMSGID_DELETEVOICEPLAYER) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidPlayer; // DVID of the player who left + PVOID pvPlayerContext; // Context value for the player +} DVMSG_DELETEVOICEPLAYER, *LPDVMSG_DELETEVOICEPLAYER, *PDVMSG_DELETEVOICEPLAYER; + +// +// Result of the Disconnect() call. (If it wasn't called Async) +// (DVMSGID_DISCONNECTRESULT) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Result of the Disconnect() call +} DVMSG_DISCONNECTRESULT, *LPDVMSG_DISCONNECTRESULT, *PDVMSG_DISCONNECTRESULT; + +// +// The voice session host has migrated. +// (DVMSGID_HOSTMIGRATED) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidNewHostID; // DVID of the player who is now the host + LPDIRECTPLAYVOICESERVER pdvServerInterface; + // Pointer to the new host object (if local player is now host) +} DVMSG_HOSTMIGRATED, *LPDVMSG_HOSTMIGRATED, *PDVMSG_HOSTMIGRATED; + +// +// The current input level / recording volume on the local machine +// (DVMSGID_INPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Current peak level of the audio + LONG lRecordVolume; // Current recording volume + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_INPUTLEVEL, *LPDVMSG_INPUTLEVEL, *PDVMSG_INPUTLEVEL; + +// +// The local client is about to become the new host +// (DVMSGID_LOCALHOSTSETUP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + PVOID pvContext; // Context value to be passed to Initialize() of new host object + PDVMESSAGEHANDLER pMessageHandler; // Message handler to be used by new host object +} DVMSG_LOCALHOSTSETUP, *LPDVMSG_LOCALHOSTSETUP, *PDVMSG_LOCALHOSTSETUP; + +// +// The current output level for the combined output of all incoming streams. +// (DVMSGID_OUTPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Current peak level of the output + LONG lOutputVolume; // Current playback volume + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_OUTPUTLEVEL, *LPDVMSG_OUTPUTLEVEL, *PDVMSG_OUTPUTLEVEL; + +// +// The current peak level of an individual player's incoming audio stream as it is +// being played back. +// (DVMSGID_PLAYEROUTPUTLEVEL) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the player + DWORD dwPeakLevel; // Peak level of the player's stream + PVOID pvPlayerContext; // Context value for the player +} DVMSG_PLAYEROUTPUTLEVEL, *LPDVMSG_PLAYEROUTPUTLEVEL, *PDVMSG_PLAYEROUTPUTLEVEL; + +// +// An audio stream from the specified player has started playing back on the local client. +// (DVMSGID_PLAYERVOICESTART). +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the Player + PVOID pvPlayerContext; // Context value for this player +} DVMSG_PLAYERVOICESTART, *LPDVMSG_PLAYERVOICESTART, *PDVMSG_PLAYERVOICESTART; + +// +// The audio stream from the specified player has stopped playing back on the local client. +// (DVMSGID_PLAYERVOICESTOP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DVID dvidSourcePlayerID; // DVID of the player + PVOID pvPlayerContext; // Context value for this player +} DVMSG_PLAYERVOICESTOP, *LPDVMSG_PLAYERVOICESTOP, *PDVMSG_PLAYERVOICESTOP; + +// +// Transmission has started on the local machine +// (DVMSGID_RECORDSTART) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Peak level that caused transmission to start + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_RECORDSTART, *LPDVMSG_RECORDSTART, *PDVMSG_RECORDSTART; + +// +// Transmission has stopped on the local machine +// (DVMSGID_RECORDSTOP) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwPeakLevel; // Peak level that caused transmission to stop + PVOID pvLocalPlayerContext; // Context value for the local player +} DVMSG_RECORDSTOP, *LPDVMSG_RECORDSTOP, *PDVMSG_RECORDSTOP; + +// +// The voice session has been lost +// (DVMSGID_SESSIONLOST) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + HRESULT hrResult; // Reason the session was disconnected +} DVMSG_SESSIONLOST, *LPDVMSG_SESSIONLOST, *PDVMSG_SESSIONLOST; + +// +// The target list has been updated for the local client +// (DVMSGID_SETTARGETS) +// +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwNumTargets; // # of targets + PDVID pdvidTargets; // An array of DVIDs specifying the current targets +} DVMSG_SETTARGETS, *LPDVMSG_SETTARGETS, *PDVMSG_SETTARGETS; + + +/**************************************************************************** + * + * DirectPlayVoice Functions + * + ****************************************************************************/ + +/* + * + * This function is no longer supported. It is recommended that CoCreateInstance be used to create + * DirectPlay voice objects. + * + * extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown); + * + */ + +/**************************************************************************** + * + * DirectPlay8 Application Interfaces + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceClient +DECLARE_INTERFACE_( IDirectPlayVoiceClient, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IDirectPlayVoiceClient methods ***/ + STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, Connect) (THIS_ PDVSOUNDDEVICECONFIG, PDVCLIENTCONFIG, DWORD ) PURE; + STDMETHOD_(HRESULT, Disconnect) (THIS_ DWORD ) PURE; + STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, GetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE; + STDMETHOD_(HRESULT, SetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE; + STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE; + STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ PDVID, DWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ PDVID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, Create3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUNDBUFFER, DWORD, DWORD, LPDIRECTSOUND3DBUFFER * ) PURE; + STDMETHOD_(HRESULT, Delete3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUND3DBUFFER * ) PURE; + STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetSoundDeviceConfig)( THIS_ PDVSOUNDDEVICECONFIG, PDWORD ) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceServer +DECLARE_INTERFACE_( IDirectPlayVoiceServer, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlayVoiceServer methods ***/ + STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, LPDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, StartSession) (THIS_ PDVSESSIONDESC, DWORD ) PURE; + STDMETHOD_(HRESULT, StopSession) (THIS_ DWORD ) PURE; + STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, SetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE; + STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE; + STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ DVID, PDVID, DWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ DVID, PDVID, PDWORD, DWORD ) PURE; + STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectPlayVoiceTest +DECLARE_INTERFACE_( IDirectPlayVoiceTest, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, PVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlayVoiceTest methods ***/ + STDMETHOD_(HRESULT, CheckAudioSetup) (THIS_ const GUID *, const GUID * , HWND, DWORD ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceClient_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceClient_Release(p) (p)->lpVtbl->Release(p) + +#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e) +#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c) +#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->lpVtbl->Disconnect(p,a) +#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a) +#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->lpVtbl->GetClientConfig(p,a) +#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->lpVtbl->SetClientConfig(p,a) +#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d) +#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->lpVtbl->SetTransmitTargets(p,a,b,c) +#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->lpVtbl->GetTransmitTargets(p,a,b,c) +#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->lpVtbl->Create3DSoundBuffer(p,a,b,c,d,e) +#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->lpVtbl->Delete3DSoundBuffer(p,a,b) +#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b) +#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->lpVtbl->GetSoundDeviceConfig(p,a,b) + +#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceServer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceServer_Release(p) (p)->lpVtbl->Release(p) + +#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e) +#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlayVoiceServer_StopSession(p,a) (p)->lpVtbl->StopSession(p,a) +#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a) +#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->lpVtbl->SetSessionDesc(p,a) +#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d) +#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->SetTransmitTargets(p,a,b,c,d) +#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->GetTransmitTargets(p,a,b,c,d) +#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b) +#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayVoiceTest_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayVoiceTest_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->lpVtbl->CheckAudioSetup(p,a,b,c,d) + + +#else /* C++ */ + +#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceClient_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceClient_Release(p) (p)->Release() + +#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e) +#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->Connect(a,b,c) +#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->Disconnect(a) +#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->GetSessionDesc(a) +#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->GetClientConfig(a) +#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->SetClientConfig(a) +#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d) +#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->SetTransmitTargets(a,b,c) +#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->GetTransmitTargets(a,b,c) +#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->Create3DSoundBuffer(a,b,c,d,e) +#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->Delete3DSoundBuffer(a,b) +#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b) +#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->GetSoundDeviceConfig(a,b) + +#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceServer_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceServer_Release(p) (p)->Release() + +#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e) +#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlayVoiceServer_StopSession(p,a) (p)->StopSession(a) +#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->GetSessionDesc(a) +#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->SetSessionDesc(a) +#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d) +#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->SetTransmitTargets(a,b,c,d) +#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->GetTransmitTargets(a,b,c,d) +#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b) + +#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayVoiceTest_AddRef(p) (p)->AddRef() +#define IDirectPlayVoiceTest_Release(p) (p)->Release() +#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->CheckAudioSetup(a,b,c,d) + + +#endif + + +/**************************************************************************** + * + * DIRECTPLAYVOICE ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +#define _FACDPV 0x15 +#define MAKE_DVHRESULT( code ) MAKE_HRESULT( 1, _FACDPV, code ) + +#define DV_OK S_OK +#define DV_FULLDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x0005 ) +#define DV_HALFDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x000A ) +#define DV_PENDING MAKE_HRESULT( 0, _FACDPV, 0x0010 ) + +#define DVERR_BUFFERTOOSMALL MAKE_DVHRESULT( 0x001E ) +#define DVERR_EXCEPTION MAKE_DVHRESULT( 0x004A ) +#define DVERR_GENERIC E_FAIL +#define DVERR_INVALIDFLAGS MAKE_DVHRESULT( 0x0078 ) +#define DVERR_INVALIDOBJECT MAKE_DVHRESULT( 0x0082 ) +#define DVERR_INVALIDPARAM E_INVALIDARG +#define DVERR_INVALIDPLAYER MAKE_DVHRESULT( 0x0087 ) +#define DVERR_INVALIDGROUP MAKE_DVHRESULT( 0x0091 ) +#define DVERR_INVALIDHANDLE MAKE_DVHRESULT( 0x0096 ) +#define DVERR_OUTOFMEMORY E_OUTOFMEMORY +#define DVERR_PENDING DV_PENDING +#define DVERR_NOTSUPPORTED E_NOTIMPL +#define DVERR_NOINTERFACE E_NOINTERFACE +#define DVERR_SESSIONLOST MAKE_DVHRESULT( 0x012C ) +#define DVERR_NOVOICESESSION MAKE_DVHRESULT( 0x012E ) +#define DVERR_CONNECTIONLOST MAKE_DVHRESULT( 0x0168 ) +#define DVERR_NOTINITIALIZED MAKE_DVHRESULT( 0x0169 ) +#define DVERR_CONNECTED MAKE_DVHRESULT( 0x016A ) +#define DVERR_NOTCONNECTED MAKE_DVHRESULT( 0x016B ) +#define DVERR_CONNECTABORTING MAKE_DVHRESULT( 0x016E ) +#define DVERR_NOTALLOWED MAKE_DVHRESULT( 0x016F ) +#define DVERR_INVALIDTARGET MAKE_DVHRESULT( 0x0170 ) +#define DVERR_TRANSPORTNOTHOST MAKE_DVHRESULT( 0x0171 ) +#define DVERR_COMPRESSIONNOTSUPPORTED MAKE_DVHRESULT( 0x0172 ) +#define DVERR_ALREADYPENDING MAKE_DVHRESULT( 0x0173 ) +#define DVERR_SOUNDINITFAILURE MAKE_DVHRESULT( 0x0174 ) +#define DVERR_TIMEOUT MAKE_DVHRESULT( 0x0175 ) +#define DVERR_CONNECTABORTED MAKE_DVHRESULT( 0x0176 ) +#define DVERR_NO3DSOUND MAKE_DVHRESULT( 0x0177 ) +#define DVERR_ALREADYBUFFERED MAKE_DVHRESULT( 0x0178 ) +#define DVERR_NOTBUFFERED MAKE_DVHRESULT( 0x0179 ) +#define DVERR_HOSTING MAKE_DVHRESULT( 0x017A ) +#define DVERR_NOTHOSTING MAKE_DVHRESULT( 0x017B ) +#define DVERR_INVALIDDEVICE MAKE_DVHRESULT( 0x017C ) +#define DVERR_RECORDSYSTEMERROR MAKE_DVHRESULT( 0x017D ) +#define DVERR_PLAYBACKSYSTEMERROR MAKE_DVHRESULT( 0x017E ) +#define DVERR_SENDERROR MAKE_DVHRESULT( 0x017F ) +#define DVERR_USERCANCEL MAKE_DVHRESULT( 0x0180 ) +#define DVERR_RUNSETUP MAKE_DVHRESULT( 0x0183 ) +#define DVERR_INCOMPATIBLEVERSION MAKE_DVHRESULT( 0x0184 ) +#define DVERR_INITIALIZED MAKE_DVHRESULT( 0x0187 ) +#define DVERR_INVALIDPOINTER E_POINTER +#define DVERR_NOTRANSPORT MAKE_DVHRESULT( 0x0188 ) +#define DVERR_NOCALLBACK MAKE_DVHRESULT( 0x0189 ) +#define DVERR_TRANSPORTNOTINIT MAKE_DVHRESULT( 0x018A ) +#define DVERR_TRANSPORTNOSESSION MAKE_DVHRESULT( 0x018B ) +#define DVERR_TRANSPORTNOPLAYER MAKE_DVHRESULT( 0x018C ) +#define DVERR_USERBACK MAKE_DVHRESULT( 0x018D ) +#define DVERR_NORECVOLAVAILABLE MAKE_DVHRESULT( 0x018E ) +#define DVERR_INVALIDBUFFER MAKE_DVHRESULT( 0x018F ) +#define DVERR_LOCKEDBUFFER MAKE_DVHRESULT( 0x0190 ) + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/dvp.h b/SDK/dxSDK/Include/dvp.h new file mode 100644 index 00000000..c40dc793 --- /dev/null +++ b/SDK/dxSDK/Include/dvp.h @@ -0,0 +1,966 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dvp.h + * Content: DirectDrawVideoPort include file + * + ***************************************************************************/ + +#ifndef __DVP_INCLUDED__ +#define __DVP_INCLUDED__ + +/* + * GUIDS used by DirectDrawVideoPort objects + */ +#if defined( _WIN32 ) && (!defined( _NO_COM ) || defined( DEFINE_GUID )) +DEFINE_GUID( IID_IDDVideoPortContainer, 0x6C142760,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawVideoPort, 0xB36D93E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDrawVideoPortNotify, 0xA655FB94,0x0589,0x4E57,0xB3,0x33,0x56,0x7A,0x89,0x46,0x8C,0x88); + + + +DEFINE_GUID( DDVPTYPE_E_HREFH_VREFH, 0x54F39980L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFH_VREFL, 0x92783220L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFL_VREFH, 0xA07A02E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_E_HREFL_VREFL, 0xE09C77E0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_CCIR656, 0xFCA326A0L,0xDA60,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_BROOKTREE, 0x1352A560L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +DEFINE_GUID( DDVPTYPE_PHILIPS, 0x332CF160L,0xDA61,0x11CF,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8); +#endif + +#ifndef GUID_DEFS_ONLY + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#define COM_NO_WINDOWS_H +#include +#else +#define IUnknown void +#endif + +/* + * These definitions are required to allow polymorphic structure members (i.e. those + * that are referred to both as DWORDs and as pointers) to resolve into a type + * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit + * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD. + */ +#ifndef MAXULONG_PTR +#define ULONG_PTR DWORD +#endif //MAXULONG_PTR + +#ifdef __cplusplus +extern "C" { +#endif + +/*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*/ + +struct IDirectDraw; +struct IDirectDrawSurface; +struct IDirectDrawPalette; +struct IDirectDrawClipper; + +typedef struct IDDVideoPortContainer FAR *LPDDVIDEOPORTCONTAINER; +typedef struct IDirectDrawVideoPort FAR *LPDIRECTDRAWVIDEOPORT; +typedef struct IDirectDrawVideoPortNotify FAR *LPDIRECTDRAWVIDEOPORTNOTIFY; + +typedef struct _DDVIDEOPORTCONNECT FAR *LPDDVIDEOPORTCONNECT; +typedef struct _DDVIDEOPORTCAPS FAR *LPDDVIDEOPORTCAPS; +typedef struct _DDVIDEOPORTDESC FAR *LPDDVIDEOPORTDESC; +typedef struct _DDVIDEOPORTINFO FAR *LPDDVIDEOPORTINFO; +typedef struct _DDVIDEOPORTBANDWIDTH FAR *LPDDVIDEOPORTBANDWIDTH; +typedef struct _DDVIDEOPORTSTATUS FAR *LPDDVIDEOPORTSTATUS; +typedef struct _DDVIDEOPORTNOTIFY FAR *LPDDVIDEOPORTNOTIFY; + +typedef struct IDDVideoPortContainerVtbl DDVIDEOPORTCONTAINERCALLBACKS; +typedef struct IDirectDrawVideoPortVtbl DIRECTDRAWVIDEOPORTCALLBACKS; +typedef struct IDirectDrawVideoPortNotifyVtbl DIRECTDRAWVIDEOPORTNOTIFYCALLBACKS; + + +/* + * API's + */ +typedef HRESULT (FAR PASCAL * LPDDENUMVIDEOCALLBACK)(LPDDVIDEOPORTCAPS, LPVOID); + + +/* + * INTERACES FOLLOW: + * IDirectDrawVideoPort + * IVideoPort + */ + +/* + * IDirectDrawVideoPortContainer + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDDVideoPortContainer +DECLARE_INTERFACE_( IDDVideoPortContainer, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawVideoPort methods ***/ + STDMETHOD(CreateVideoPort)(THIS_ DWORD, LPDDVIDEOPORTDESC, LPDIRECTDRAWVIDEOPORT FAR *, IUnknown FAR *) PURE; + STDMETHOD(EnumVideoPorts)(THIS_ DWORD, LPDDVIDEOPORTCAPS, LPVOID,LPDDENUMVIDEOCALLBACK ) PURE; + STDMETHOD(GetVideoPortConnectInfo)(THIS_ DWORD, LPDWORD, LPDDVIDEOPORTCONNECT ) PURE; + STDMETHOD(QueryVideoPortStatus)(THIS_ DWORD, LPDDVIDEOPORTSTATUS ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPortContainer_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IVideoPortContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPortContainer_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->lpVtbl->CreateVideoPort(p, a, b, c, d) +#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->lpVtbl->EnumVideoPorts(p, a, b, c, d) +#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->lpVtbl->GetVideoPortConnectInfo(p, a, b, c) +#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->lpVtbl->QueryVideoPortStatus(p, a, b) +#else +#define IVideoPortContainer_QueryInterface(p, a, b) (p)->QueryInterface(a, b) +#define IVideoPortContainer_AddRef(p) (p)->AddRef() +#define IVideoPortContainer_Release(p) (p)->Release() +#define IVideoPortContainer_CreateVideoPort(p, a, b, c, d) (p)->CreateVideoPort(a, b, c, d) +#define IVideoPortContainer_EnumVideoPorts(p, a, b, c, d) (p)->EnumVideoPorts(a, b, c, d) +#define IVideoPortContainer_GetVideoPortConnectInfo(p, a, b, c) (p)->GetVideoPortConnectInfo(a, b, c) +#define IVideoPortContainer_QueryVideoPortStatus(p, a, b) (p)->QueryVideoPortStatus(a, b) +#endif + +#endif + + +/* + * IDirectDrawVideoPort + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawVideoPort +DECLARE_INTERFACE_( IDirectDrawVideoPort, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IVideoPort methods ***/ + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetBandwidthInfo)(THIS_ LPDDPIXELFORMAT, DWORD, DWORD, DWORD, LPDDVIDEOPORTBANDWIDTH) PURE; + STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(GetInputFormats)(THIS_ LPDWORD, LPDDPIXELFORMAT, DWORD) PURE; + STDMETHOD(GetOutputFormats)(THIS_ LPDDPIXELFORMAT, LPDWORD, LPDDPIXELFORMAT, DWORD) PURE; + STDMETHOD(GetFieldPolarity)(THIS_ LPBOOL) PURE; + STDMETHOD(GetVideoLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVideoSignalStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE; + STDMETHOD(SetTargetSurface)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(StartVideo)(THIS_ LPDDVIDEOPORTINFO) PURE; + STDMETHOD(StopVideo)(THIS) PURE; + STDMETHOD(UpdateVideo)(THIS_ LPDDVIDEOPORTINFO) PURE; + STDMETHOD(WaitForSync)(THIS_ DWORD, DWORD, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPort_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IVideoPort_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPort_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPort_SetTargetSurface(p,a,b) (p)->lpVtbl->SetTargetSurface(p,a,b) +#define IVideoPort_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->lpVtbl->GetBandwidthInfo(p,a,b,c,d,e) +#define IVideoPort_GetColorControls(p,a) (p)->lpVtbl->GetColorControls(p,a) +#define IVideoPort_GetInputFormats(p,a,b,c) (p)->lpVtbl->GetInputFormats(p,a,b,c) +#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->lpVtbl->GetOutputFormats(p,a,b,c,d) +#define IVideoPort_GetFieldPolarity(p,a) (p)->lpVtbl->GetFieldPolarity(p,a) +#define IVideoPort_GetVideoLine(p,a) (p)->lpVtbl->GetVideoLine(p,a) +#define IVideoPort_GetVideoSignalStatus(p,a) (p)->lpVtbl->GetVideoSignalStatus(p,a) +#define IVideoPort_SetColorControls(p,a) (p)->lpVtbl->SetColorControls(p,a) +#define IVideoPort_StartVideo(p,a) (p)->lpVtbl->StartVideo(p,a) +#define IVideoPort_StopVideo(p) (p)->lpVtbl->StopVideo(p) +#define IVideoPort_UpdateVideo(p,a) (p)->lpVtbl->UpdateVideo(p,a) +#define IVideoPort_WaitForSync(p,a,b,c) (p)->lpVtbl->WaitForSync(p,a,b,c) +#else +#define IVideoPort_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IVideoPort_AddRef(p) (p)->AddRef() +#define IVideoPort_Release(p) (p)->Release() +#define IVideoPort_SetTargetSurface(p,a,b) (p)->SetTargetSurface(a,b) +#define IVideoPort_Flip(p,a,b) (p)->Flip(a,b) +#define IVideoPort_GetBandwidthInfo(p,a,b,c,d,e) (p)->GetBandwidthInfo(a,b,c,d,e) +#define IVideoPort_GetColorControls(p,a) (p)->GetColorControls(a) +#define IVideoPort_GetInputFormats(p,a,b,c) (p)->GetInputFormats(a,b,c) +#define IVideoPort_GetOutputFormats(p,a,b,c,d) (p)->GetOutputFormats(a,b,c,d) +#define IVideoPort_GetFieldPolarity(p,a) (p)->GetFieldPolarity(a) +#define IVideoPort_GetVideoLine(p,a) (p)->GetVideoLine(a) +#define IVideoPort_GetVideoSignalStatus(p,a) (p)->GetVideoSignalStatus(a) +#define IVideoPort_SetColorControls(p,a) (p)->SetColorControls(a) +#define IVideoPort_StartVideo(p,a) (p)->StartVideo(a) +#define IVideoPort_StopVideo(p) (p)->StopVideo() +#define IVideoPort_UpdateVideo(p,a) (p)->UpdateVideo(a) +#define IVideoPort_WaitForSync(p,a,b,c) (p)->WaitForSync(a,b,c) +#endif + +#endif + +/* + * IDirectDrawVideoPort + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawVideoPortNotify +DECLARE_INTERFACE_( IDirectDrawVideoPortNotify, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IVideoPort methods ***/ + STDMETHOD(AcquireNotification)(THIS_ HANDLE *, LPDDVIDEOPORTNOTIFY) PURE; + STDMETHOD(ReleaseNotification)(THIS_ HANDLE) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IVideoPortNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IVideoPortNotify_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IVideoPortNotify_Release(p) (p)->lpVtbl->Release(p) +#define IVideoPortNotify_AcquireNotification(p,a,b) (p)->lpVtbl->AcquireNotification(p,a,b) +#define IVideoPortNotify_ReleaseNotification(p,a) (p)->lpVtbl->ReleaseNotification(p,a) +#else +#define IVideoPortNotify_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IVideoPortNotify_AddRef(p) (p)->AddRef() +#define IVideoPortNotify_Release(p) (p)->Release() +#define IVideoPortNotify_AcquireNotification(p,a,b) (p)->lpVtbl->AcquireNotification(a,b) +#define IVideoPortNotify_ReleaseNotification(p,a) (p)->lpVtbl->ReleaseNotification(a) +#endif + +#endif + +/* + * DDVIDEOPORTCONNECT + */ +typedef struct _DDVIDEOPORTCONNECT +{ + DWORD dwSize; // size of the DDVIDEOPORTCONNECT structure + DWORD dwPortWidth; // Width of the video port + GUID guidTypeID; // Description of video port connection + DWORD dwFlags; // Connection flags + ULONG_PTR dwReserved1; // Reserved, set to zero. +} DDVIDEOPORTCONNECT; + + +/* + * DDVIDEOPORTCAPS + */ +typedef struct _DDVIDEOPORTCAPS +{ + DWORD dwSize; // size of the DDVIDEOPORTCAPS structure + DWORD dwFlags; // indicates which fields contain data + DWORD dwMaxWidth; // max width of the video port field + DWORD dwMaxVBIWidth; // max width of the VBI data + DWORD dwMaxHeight; // max height of the video port field + DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1)) + DWORD dwCaps; // Video port capabilities + DWORD dwFX; // More video port capabilities + DWORD dwNumAutoFlipSurfaces; // Max number of autoflippable surfaces allowed + DWORD dwAlignVideoPortBoundary; // Byte restriction of placement within the surface + DWORD dwAlignVideoPortPrescaleWidth;// Byte restriction of width after prescaling + DWORD dwAlignVideoPortCropBoundary; // Byte restriction of left cropping + DWORD dwAlignVideoPortCropWidth; // Byte restriction of cropping width + DWORD dwPreshrinkXStep; // Width can be shrunk in steps of 1/x + DWORD dwPreshrinkYStep; // Height can be shrunk in steps of 1/x + DWORD dwNumVBIAutoFlipSurfaces; // Max number of VBI autoflippable surfaces allowed + DWORD dwNumPreferredAutoflip; // Optimal number of autoflippable surfaces for hardware + WORD wNumFilterTapsX; // Number of taps the prescaler uses in the X direction (0 - no prescale, 1 - replication, etc.) + WORD wNumFilterTapsY; // Number of taps the prescaler uses in the Y direction (0 - no prescale, 1 - replication, etc.) +} DDVIDEOPORTCAPS; + +/* + * The dwMaxWidth and dwMaxVBIWidth members are valid + */ +#define DDVPD_WIDTH 0x00000001l + +/* + * The dwMaxHeight member is valid + */ +#define DDVPD_HEIGHT 0x00000002l + +/* + * The dwVideoPortID member is valid + */ +#define DDVPD_ID 0x00000004l + +/* + * The dwCaps member is valid + */ +#define DDVPD_CAPS 0x00000008l + +/* + * The dwFX member is valid + */ +#define DDVPD_FX 0x00000010l + +/* + * The dwNumAutoFlipSurfaces member is valid + */ +#define DDVPD_AUTOFLIP 0x00000020l + +/* + * All of the alignment members are valid + */ +#define DDVPD_ALIGN 0x00000040l + +/* + * The dwNumPreferredAutoflip member is valid + */ +#define DDVPD_PREFERREDAUTOFLIP 0x00000080l + +/* + * The wNumFilterTapsX and wNumFilterTapsY fields are valid + */ +#define DDVPD_FILTERQUALITY 0x00000100l + +/* + * DDVIDEOPORTDESC + */ +typedef struct _DDVIDEOPORTDESC +{ + DWORD dwSize; // size of the DDVIDEOPORTDESC structure + DWORD dwFieldWidth; // width of the video port field + DWORD dwVBIWidth; // width of the VBI data + DWORD dwFieldHeight; // height of the video port field + DWORD dwMicrosecondsPerField; // Microseconds per video field + DWORD dwMaxPixelsPerSecond; // Maximum pixel rate per second + DWORD dwVideoPortID; // Video port ID (0 - (dwMaxVideoPorts -1)) + DWORD dwReserved1; // Reserved for future use - set to zero (struct padding) + DDVIDEOPORTCONNECT VideoPortType; // Description of video port connection + ULONG_PTR dwReserved2; // Reserved for future use - set to zero + ULONG_PTR dwReserved3; // Reserved for future use - set to zero +} DDVIDEOPORTDESC; + + +/* + * DDVIDEOPORTINFO + */ +typedef struct _DDVIDEOPORTINFO +{ + DWORD dwSize; // Size of the structure + DWORD dwOriginX; // Placement of the video data within the surface. + DWORD dwOriginY; // Placement of the video data within the surface. + DWORD dwVPFlags; // Video port options + RECT rCrop; // Cropping rectangle (optional). + DWORD dwPrescaleWidth; // Determines pre-scaling/zooming in the X direction (optional). + DWORD dwPrescaleHeight; // Determines pre-scaling/zooming in the Y direction (optional). + LPDDPIXELFORMAT lpddpfInputFormat; // Video format written to the video port + LPDDPIXELFORMAT lpddpfVBIInputFormat; // Input format of the VBI data + LPDDPIXELFORMAT lpddpfVBIOutputFormat;// Output format of the data + DWORD dwVBIHeight; // Specifies the number of lines of data within the vertical blanking interval. + ULONG_PTR dwReserved1; // Reserved for future use - set to zero + ULONG_PTR dwReserved2; // Reserved for future use - set to zero +} DDVIDEOPORTINFO; + + +/* + * DDVIDEOPORTBANDWIDTH + */ +typedef struct _DDVIDEOPORTBANDWIDTH +{ + DWORD dwSize; // Size of the structure + DWORD dwCaps; + DWORD dwOverlay; // Zoom factor at which overlay is supported + DWORD dwColorkey; // Zoom factor at which overlay w/ colorkey is supported + DWORD dwYInterpolate; // Zoom factor at which overlay w/ Y interpolation is supported + DWORD dwYInterpAndColorkey; // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported + ULONG_PTR dwReserved1; // Reserved for future use - set to zero + ULONG_PTR dwReserved2; // Reserved for future use - set to zero +} DDVIDEOPORTBANDWIDTH; + + +/* + * DDVIDEOPORTSTATUS + */ +typedef struct _DDVIDEOPORTSTATUS +{ + DWORD dwSize; // Size of the structure + BOOL bInUse; // TRUE if video port is currently being used + DWORD dwFlags; // Currently not used + DWORD dwReserved1; // Reserved for future use + DDVIDEOPORTCONNECT VideoPortType; // Information about the connection + ULONG_PTR dwReserved2; // Reserved for future use + ULONG_PTR dwReserved3; // Reserved for future use +} DDVIDEOPORTSTATUS; + +/* + * DDVIDEOPORTNOTIFY + */ +typedef struct _DDVIDEOPORTNOTIFY +{ + LARGE_INTEGER ApproximateTimeStamp; // Timestamp in the event notification + LONG lField; // 0 if even, 1 if odd, -1 if unknown + UINT dwSurfaceIndex; // Index in the surface chain of the surface that received the sample + LONG lDone; // Call InterlockedIncrement on this when done with sample +} DDVIDEOPORTNOTIFY; + + +/*============================================================================ + * + * Video Port Flags + * + * All flags are bit flags. + * + *==========================================================================*/ + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTCONNECT FLAGS + * + ****************************************************************************/ + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of double clocking the data. + * When this is set by the client, this indicates that the video port + * should enable double clocking. This flag is only valid with external + * syncs. + */ +#define DDVPCONNECT_DOUBLECLOCK 0x00000001l + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of using an external VACT + * signal. When this is set by the client, this indicates that the + * video port should use the external VACT signal. + */ +#define DDVPCONNECT_VACT 0x00000002l + +/* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of treating even fields + * like odd fields and visa versa. When this is set by the client, + * this indicates that the video port should treat even fields like odd + * fields. + */ +#define DDVPCONNECT_INVERTPOLARITY 0x00000004l + +/* + * Indicates that any data written to the video port during the VREF + * period will not be written into the frame buffer. This flag is read only. + */ +#define DDVPCONNECT_DISCARDSVREFDATA 0x00000008l + +/* + * When this is set be the driver and passed to the client, this + * indicates that the device will write half lines into the frame buffer + * if half lines are provided by the decoder. If this is set by the client, + * this indicates that the decoder will be supplying half lines. + */ +#define DDVPCONNECT_HALFLINE 0x00000010l + +/* + * Indicates that the signal is interlaced. This flag is only + * set by the client. + */ +#define DDVPCONNECT_INTERLACED 0x00000020l + +/* + * Indicates that video port is shareable and that this video port + * will use the even fields. This flag is only set by the client. + */ +#define DDVPCONNECT_SHAREEVEN 0x00000040l + +/* + * Indicates that video port is shareable and that this video port + * will use the odd fields. This flag is only set by the client. + */ +#define DDVPCONNECT_SHAREODD 0x00000080l + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC CAPS + * + ****************************************************************************/ + +/* + * Flip can be performed automatically to avoid tearing. + */ +#define DDVPCAPS_AUTOFLIP 0x00000001l + +/* + * Supports interlaced video + */ +#define DDVPCAPS_INTERLACED 0x00000002l + +/* + * Supports non-interlaced video + */ +#define DDVPCAPS_NONINTERLACED 0x00000004l + +/* + * Indicates that the device can return whether the current field + * of an interlaced signal is even or odd. + */ +#define DDVPCAPS_READBACKFIELD 0x00000008l + +/* + * Indicates that the device can return the current line of video + * being written into the frame buffer. + */ +#define DDVPCAPS_READBACKLINE 0x00000010l + +/* + * Allows two gen-locked video streams to share a single video port, + * where one stream uses the even fields and the other uses the odd + * fields. Separate parameters (including address, scaling, + * cropping, etc.) are maintained for both fields.) + */ +#define DDVPCAPS_SHAREABLE 0x00000020l + +/* + * Even fields of video can be automatically discarded. + */ +#define DDVPCAPS_SKIPEVENFIELDS 0x00000040l + +/* + * Odd fields of video can be automatically discarded. + */ +#define DDVPCAPS_SKIPODDFIELDS 0x00000080l + +/* + * Indicates that the device is capable of driving the graphics + * VSYNC with the video port VSYNC. + */ +#define DDVPCAPS_SYNCMASTER 0x00000100l + +/* + * Indicates that data within the vertical blanking interval can + * be written to a different surface. + */ +#define DDVPCAPS_VBISURFACE 0x00000200l + +/* + * Indicates that the video port can perform color operations + * on the incoming data before it is written to the frame buffer. + */ +#define DDVPCAPS_COLORCONTROL 0x00000400l + +/* + * Indicates that the video port can accept VBI data in a different + * width or format than the regular video data. + */ +#define DDVPCAPS_OVERSAMPLEDVBI 0x00000800l + +/* + * Indicates that the video port can write data directly to system memory + */ +#define DDVPCAPS_SYSTEMMEMORY 0x00001000l + +/* + * Indicates that the VBI and video portions of the video stream can + * be controlled by an independent processes. + */ +#define DDVPCAPS_VBIANDVIDEOINDEPENDENT 0x00002000l + +/* + * Indicates that the video port contains high quality hardware + * de-interlacing hardware that should be used instead of the + * bob/weave algorithms. + */ +#define DDVPCAPS_HARDWAREDEINTERLACE 0x00004000l + + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC FX + * + ****************************************************************************/ + +/* + * Limited cropping is available to crop out the vertical interval data. + */ +#define DDVPFX_CROPTOPDATA 0x00000001l + +/* + * Incoming data can be cropped in the X direction before it is written + * to the surface. + */ +#define DDVPFX_CROPX 0x00000002l + +/* + * Incoming data can be cropped in the Y direction before it is written + * to the surface. + */ +#define DDVPFX_CROPY 0x00000004l + +/* + * Supports interleaving interlaced fields in memory. + */ +#define DDVPFX_INTERLEAVE 0x00000008l + +/* + * Supports mirroring left to right as the video data is written + * into the frame buffer. + */ +#define DDVPFX_MIRRORLEFTRIGHT 0x00000010l + +/* + * Supports mirroring top to bottom as the video data is written + * into the frame buffer. + */ +#define DDVPFX_MIRRORUPDOWN 0x00000020l + +/* + * Data can be arbitrarily shrunk in the X direction before it + * is written to the surface. + */ +#define DDVPFX_PRESHRINKX 0x00000040l + +/* + * Data can be arbitrarily shrunk in the Y direction before it + * is written to the surface. + */ +#define DDVPFX_PRESHRINKY 0x00000080l + +/* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X + * direction before it is written to the surface. + */ +#define DDVPFX_PRESHRINKXB 0x00000100l + +/* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y + * direction before it is written to the surface. + */ +#define DDVPFX_PRESHRINKYB 0x00000200l + +/* + * Data can be shrunk in increments of 1/x in the X direction + * (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkXStep) + * before it is written to the surface. + */ +#define DDVPFX_PRESHRINKXS 0x00000400l + +/* + * Data can be shrunk in increments of 1/x in the Y direction + * (where X is specified in the DDVIDEOPORTCAPS.dwPreshrinkYStep) + * before it is written to the surface. + */ +#define DDVPFX_PRESHRINKYS 0x00000800l + +/* + * Data can be arbitrarily stretched in the X direction before + * it is written to the surface. + */ +#define DDVPFX_PRESTRETCHX 0x00001000l + +/* + * Data can be arbitrarily stretched in the Y direction before + * it is written to the surface. + */ +#define DDVPFX_PRESTRETCHY 0x00002000l + +/* + * Data can be integer stretched in the X direction before it is + * written to the surface. + */ +#define DDVPFX_PRESTRETCHXN 0x00004000l + +/* + * Data can be integer stretched in the Y direction before it is + * written to the surface. + */ +#define DDVPFX_PRESTRETCHYN 0x00008000l + +/* + * Indicates that data within the vertical blanking interval can + * be converted independently of the remaining video data. + */ +#define DDVPFX_VBICONVERT 0x00010000l + +/* + * Indicates that scaling can be disabled for data within the + * vertical blanking interval. + */ +#define DDVPFX_VBINOSCALE 0x00020000l + +/* + * Indicates that the video data can ignore the left and right + * cropping coordinates when cropping oversampled VBI data. + */ +#define DDVPFX_IGNOREVBIXCROP 0x00040000l + +/* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + */ +#define DDVPFX_VBINOINTERLEAVE 0x00080000l + + +/**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTINFO FLAGS + * + ****************************************************************************/ + +/* + * Perform automatic flipping. Auto-flipping is performed between + * the overlay surface that was attached to the video port using + * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that + * are attached to the surface via the IDirectDrawSurface::AttachSurface + * method. The flip order is the order in which the overlay surfaces + * were. attached. + */ +#define DDVP_AUTOFLIP 0x00000001l + +/* + * Perform conversion using the ddpfOutputFormat information. + */ +#define DDVP_CONVERT 0x00000002l + +/* + * Perform cropping using the specified rectangle. + */ +#define DDVP_CROP 0x00000004l + +/* + * Indicates that interlaced fields should be interleaved in memory. + */ +#define DDVP_INTERLEAVE 0x00000008l + +/* + * Indicates that the data should be mirrored left to right as it's + * written into the frame buffer. + */ +#define DDVP_MIRRORLEFTRIGHT 0x00000010l + +/* + * Indicates that the data should be mirrored top to bottom as it's + * written into the frame buffer. + */ +#define DDVP_MIRRORUPDOWN 0x00000020l + +/* + * Perform pre-scaling/zooming based on the pre-scale parameters. + */ +#define DDVP_PRESCALE 0x00000040l + +/* + * Ignore input of even fields. + */ +#define DDVP_SKIPEVENFIELDS 0x00000080l + +/* + * Ignore input of odd fields. + */ +#define DDVP_SKIPODDFIELDS 0x00000100l + +/* + * Drive the graphics VSYNCs using the video port VYSNCs. + */ +#define DDVP_SYNCMASTER 0x00000200l + +/* + * The ddpfVBIOutputFormatFormat member contains data that should be used + * to convert the data within the vertical blanking interval. + */ +#define DDVP_VBICONVERT 0x00000400l + +/* + * Indicates that data within the vertical blanking interval + * should not be scaled. + */ +#define DDVP_VBINOSCALE 0x00000800l + +/* + * Indicates that these bob/weave decisions should not be + * overriden by other interfaces. + */ +#define DDVP_OVERRIDEBOBWEAVE 0x00001000l + +/* + * Indicates that the video data should ignore the left and right + * cropping coordinates when cropping the VBI data. + */ +#define DDVP_IGNOREVBIXCROP 0x00002000l + +/* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + */ +#define DDVP_VBINOINTERLEAVE 0x00004000l + +/* + * Indicates that the video port should use the hardware + * de-interlacing hardware. + */ +#define DDVP_HARDWAREDEINTERLACE 0x00008000l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS + * + ****************************************************************************/ + +/* + * Return formats for the video data + */ +#define DDVPFORMAT_VIDEO 0x00000001l + +/* + * Return formats for the VBI data + */ +#define DDVPFORMAT_VBI 0x00000002l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS + * + ****************************************************************************/ + +/* + * Surface should receive video data (and VBI data if a surface + * is not explicitly attached for that purpose) + */ +#define DDVPTARGET_VIDEO 0x00000001l + +/* + * Surface should receive VBI data + */ +#define DDVPTARGET_VBI 0x00000002l + + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS + * + ****************************************************************************/ + +/* + * Waits until the beginning of the next VSYNC + */ +#define DDVPWAIT_BEGIN 0x00000001l + +/* + * Waits until the end of the next/current VSYNC + */ +#define DDVPWAIT_END 0x00000002l + +/* + * Waits until the beginning of the specified line + */ +#define DDVPWAIT_LINE 0x00000003l + +/**************************************************************************** + * + * DIRECTDRAWVIDEOPORT FLIP FLAGS + * + ****************************************************************************/ + +/* + * Flips the normal video surface + */ +#define DDVPFLIP_VIDEO 0x00000001l + +/* + * Flips the VBI surface + */ +#define DDVPFLIP_VBI 0x00000002l + +/**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES + * + ****************************************************************************/ + +/* + * No video signal is present at the video port + */ +#define DDVPSQ_NOSIGNAL 0x00000001l + +/* + * A valid video signal is present at the video port + */ +#define DDVPSQ_SIGNALOK 0x00000002l + +/**************************************************************************** + * + * VIDEOPORTBANDWIDTH Flags + * + ****************************************************************************/ + +/* + * The specified height/width refer to the size of the video port data + * written into memory, after prescaling has occured. + */ +#define DDVPB_VIDEOPORT 0x00000001l + +/* + * The specified height/width refer to the source size of the overlay. + */ +#define DDVPB_OVERLAY 0x00000002l + +/* + * This is a query for the device to return which caps this device requires. + */ +#define DDVPB_TYPE 0x00000004l + +/**************************************************************************** + * + * VIDEOPORTBANDWIDTH Caps + * + ****************************************************************************/ + +/* + * The bandwidth for this device is dependant on the overlay source size. + */ +#define DDVPBCAPS_SOURCE 0x00000001l + +/* + * The bandwidth for this device is dependant on the overlay destination + * size. + */ +#define DDVPBCAPS_DESTINATION 0x00000002l + +/**************************************************************************** + * + * DDVIDEOPORTCONTAINER CreateVideoPort flags + * + ****************************************************************************/ + +/* + * The process only wants to control the VBI portion of the video stream. + */ +#define DDVPCREATE_VBIONLY 0x00000001l + +/* + * The process only wants to control the non-VBI (video) portion of + * the video stream. + */ +#define DDVPCREATE_VIDEOONLY 0x00000002l + +/**************************************************************************** + * + * DDVIDEOPORTSTATUS flags + * + ****************************************************************************/ + +/* + * The video port interface is only controlling the VBI portion of the + * video stream + */ +#define DDVPSTATUS_VBIONLY 0x00000001l + +/* + * The video port interface is only controlling the video portion of the + * video stream + */ +#define DDVPSTATUS_VIDEOONLY 0x00000002l + + +#ifdef __cplusplus +}; +#endif + +#endif // GUID_DEFS_ONLY + +#endif + diff --git a/SDK/dxSDK/Include/dx7todx8.h b/SDK/dxSDK/Include/dx7todx8.h new file mode 100644 index 00000000..a513d693 --- /dev/null +++ b/SDK/dxSDK/Include/dx7todx8.h @@ -0,0 +1,98 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dx7todx8.h + * Content: DX7 to DX8 Direct3D aliases to aid porting DX7 apps to DX8 + * + ***************************************************************************/ + +#ifndef _DX7TODX8_H_ + +/////////////////////////////////////////////////////////////////////////////// +// +// d3d8types.h +// +/////////////////////////////////////////////////////////////////////////////// + +#define D3DTRANSFORMSTATE_WORLD D3DTS_WORLD +#define D3DTRANSFORMSTATE_VIEW D3DTS_VIEW +#define D3DTRANSFORMSTATE_PROJECTION D3DTS_PROJECTION +#define D3DTRANSFORMSTATE_WORLD1 D3DTS_WORLD1 +#define D3DTRANSFORMSTATE_WORLD2 D3DTS_WORLD2 +#define D3DTRANSFORMSTATE_WORLD3 D3DTS_WORLD3 +#define D3DTRANSFORMSTATE_TEXTURE0 D3DTS_TEXTURE0 +#define D3DTRANSFORMSTATE_TEXTURE1 D3DTS_TEXTURE1 +#define D3DTRANSFORMSTATE_TEXTURE2 D3DTS_TEXTURE2 +#define D3DTRANSFORMSTATE_TEXTURE3 D3DTS_TEXTURE3 +#define D3DTRANSFORMSTATE_TEXTURE4 D3DTS_TEXTURE4 +#define D3DTRANSFORMSTATE_TEXTURE5 D3DTS_TEXTURE5 +#define D3DTRANSFORMSTATE_TEXTURE6 D3DTS_TEXTURE6 +#define D3DTRANSFORMSTATE_TEXTURE7 D3DTS_TEXTURE7 +#define D3DTRANSFORMSTATE_FORCE_DWORD D3DTS_FORCE_DWORD + +#define D3DRENDERSTATE_ZENABLE D3DRS_ZENABLE +#define D3DRENDERSTATE_FILLMODE D3DRS_FILLMODE +#define D3DRENDERSTATE_SHADEMODE D3DRS_SHADEMODE +#define D3DRENDERSTATE_LINEPATTERN D3DRS_LINEPATTERN +#define D3DRENDERSTATE_ZWRITEENABLE D3DRS_ZWRITEENABLE +#define D3DRENDERSTATE_ALPHATESTENABLE D3DRS_ALPHATESTENABLE +#define D3DRENDERSTATE_LASTPIXEL D3DRS_LASTPIXEL +#define D3DRENDERSTATE_SRCBLEND D3DRS_SRCBLEND +#define D3DRENDERSTATE_DESTBLEND D3DRS_DESTBLEND +#define D3DRENDERSTATE_CULLMODE D3DRS_CULLMODE +#define D3DRENDERSTATE_ZFUNC D3DRS_ZFUNC +#define D3DRENDERSTATE_ALPHAREF D3DRS_ALPHAREF +#define D3DRENDERSTATE_ALPHAFUNC D3DRS_ALPHAFUNC +#define D3DRENDERSTATE_DITHERENABLE D3DRS_DITHERENABLE +#define D3DRENDERSTATE_ALPHABLENDENABLE D3DRS_ALPHABLENDENABLE +#define D3DRENDERSTATE_FOGENABLE D3DRS_FOGENABLE +#define D3DRENDERSTATE_SPECULARENABLE D3DRS_SPECULARENABLE +#define D3DRENDERSTATE_ZVISIBLE D3DRS_ZVISIBLE +#define D3DRENDERSTATE_FOGCOLOR D3DRS_FOGCOLOR +#define D3DRENDERSTATE_FOGTABLEMODE D3DRS_FOGTABLEMODE +#define D3DRENDERSTATE_FOGSTART D3DRS_FOGSTART +#define D3DRENDERSTATE_FOGEND D3DRS_FOGEND +#define D3DRENDERSTATE_FOGDENSITY D3DRS_FOGDENSITY +#define D3DRENDERSTATE_EDGEANTIALIAS D3DRS_EDGEANTIALIAS +#define D3DRENDERSTATE_ZBIAS D3DRS_ZBIAS +#define D3DRENDERSTATE_RANGEFOGENABLE D3DRS_RANGEFOGENABLE +#define D3DRENDERSTATE_STENCILENABLE D3DRS_STENCILENABLE +#define D3DRENDERSTATE_STENCILFAIL D3DRS_STENCILFAIL +#define D3DRENDERSTATE_STENCILZFAIL D3DRS_STENCILZFAIL +#define D3DRENDERSTATE_STENCILPASS D3DRS_STENCILPASS +#define D3DRENDERSTATE_STENCILFUNC D3DRS_STENCILFUNC +#define D3DRENDERSTATE_STENCILREF D3DRS_STENCILREF +#define D3DRENDERSTATE_STENCILMASK D3DRS_STENCILMASK +#define D3DRENDERSTATE_STENCILWRITEMASK D3DRS_STENCILWRITEMASK +#define D3DRENDERSTATE_TEXTUREFACTOR D3DRS_TEXTUREFACTOR +#define D3DRENDERSTATE_WRAP0 D3DRS_WRAP0 +#define D3DRENDERSTATE_WRAP1 D3DRS_WRAP1 +#define D3DRENDERSTATE_WRAP2 D3DRS_WRAP2 +#define D3DRENDERSTATE_WRAP3 D3DRS_WRAP3 +#define D3DRENDERSTATE_WRAP4 D3DRS_WRAP4 +#define D3DRENDERSTATE_WRAP5 D3DRS_WRAP5 +#define D3DRENDERSTATE_WRAP6 D3DRS_WRAP6 +#define D3DRENDERSTATE_WRAP7 D3DRS_WRAP7 +#define D3DRENDERSTATE_CLIPPING D3DRS_CLIPPING +#define D3DRENDERSTATE_LIGHTING D3DRS_LIGHTING +#define D3DRENDERSTATE_EXTENTS D3DRS_EXTENTS +#define D3DRENDERSTATE_AMBIENT D3DRS_AMBIENT +#define D3DRENDERSTATE_FOGVERTEXMODE D3DRS_FOGVERTEXMODE +#define D3DRENDERSTATE_COLORVERTEX D3DRS_COLORVERTEX +#define D3DRENDERSTATE_LOCALVIEWER D3DRS_LOCALVIEWER +#define D3DRENDERSTATE_NORMALIZENORMALS D3DRS_NORMALIZENORMALS +#define D3DRENDERSTATE_DIFFUSEMATERIALSOURCE D3DRS_DIFFUSEMATERIALSOURCE +#define D3DRENDERSTATE_SPECULARMATERIALSOURCE D3DRS_SPECULARMATERIALSOURCE +#define D3DRENDERSTATE_AMBIENTMATERIALSOURCE D3DRS_AMBIENTMATERIALSOURCE +#define D3DRENDERSTATE_EMISSIVEMATERIALSOURCE D3DRS_EMISSIVEMATERIALSOURCE +#define D3DRENDERSTATE_VERTEXBLEND D3DRS_VERTEXBLEND +#define D3DRENDERSTATE_CLIPPLANEENABLE D3DRS_CLIPPLANEENABLE + +#define RGBA_MAKE D3DCOLOR_RGBA +#define RGB_MAKE D3DCOLOR_XRGB +#define D3DRGBA D3DCOLOR_COLORVALUE +#define D3DRGB(_r,_g,_b) D3DCOLOR_COLORVALUE(_r,_g,_b,1.f) + +#define _DX7TODX8_H_ +#endif //_DX7TODX8_H_ diff --git a/SDK/dxSDK/Include/dxdiag.h b/SDK/dxSDK/Include/dxdiag.h new file mode 100644 index 00000000..602c88f0 --- /dev/null +++ b/SDK/dxSDK/Include/dxdiag.h @@ -0,0 +1,187 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dxdiag.h + * Content: DirectX Diagnostic Tool include file + * + ****************************************************************************/ + +#ifndef _DXDIAG_H_ +#define _DXDIAG_H_ + +#include // for DECLARE_INTERFACE_ and HRESULT + +// This identifier is passed to IDxDiagProvider::Initialize in order to ensure that an +// application was built against the correct header files. This number is +// incremented whenever a header (or other) change would require applications +// to be rebuilt. If the version doesn't match, IDxDiagProvider::Initialize will fail. +// (The number itself has no meaning.) +#define DXDIAG_DX9_SDK_VERSION 111 + +#ifdef __cplusplus +extern "C" { +#endif + + +/**************************************************************************** + * + * DxDiag Errors + * + ****************************************************************************/ +#define DXDIAG_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + + +/**************************************************************************** + * + * DxDiag CLSIDs + * + ****************************************************************************/ + +// {A65B8071-3BFE-4213-9A5B-491DA4461CA7} +DEFINE_GUID(CLSID_DxDiagProvider, +0xA65B8071, 0x3BFE, 0x4213, 0x9A, 0x5B, 0x49, 0x1D, 0xA4, 0x46, 0x1C, 0xA7); + + +/**************************************************************************** + * + * DxDiag Interface IIDs + * + ****************************************************************************/ + +// {9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2} +DEFINE_GUID(IID_IDxDiagProvider, +0x9C6B4CB0, 0x23F8, 0x49CC, 0xA3, 0xED, 0x45, 0xA5, 0x50, 0x00, 0xA6, 0xD2); + +// {0x7D0F462F-0x4064-0x4862-BC7F-933E5058C10F} +DEFINE_GUID(IID_IDxDiagContainer, +0x7D0F462F, 0x4064, 0x4862, 0xBC, 0x7F, 0x93, 0x3E, 0x50, 0x58, 0xC1, 0x0F); + + +/**************************************************************************** + * + * DxDiag Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDxDiagProvider *LPDXDIAGPROVIDER, *PDXDIAGPROVIDER; + +typedef struct IDxDiagContainer *LPDXDIAGCONTAINER, *PDXDIAGCONTAINER; + + +/**************************************************************************** + * + * DxDiag Structures + * + ****************************************************************************/ + +typedef struct _DXDIAG_INIT_PARAMS +{ + DWORD dwSize; // Size of this structure. + DWORD dwDxDiagHeaderVersion; // Pass in DXDIAG_DX9_SDK_VERSION. This verifies + // the header and dll are correctly matched. + BOOL bAllowWHQLChecks; // If true, allow dxdiag to check if drivers are + // digital signed as logo'd by WHQL which may + // connect via internet to update WHQL certificates. + VOID* pReserved; // Reserved. Must be NULL. +} DXDIAG_INIT_PARAMS; + + +/**************************************************************************** + * + * DxDiag Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for IDxDiagProvider +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagProvider +DECLARE_INTERFACE_(IDxDiagProvider,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagProvider methods ***/ + STDMETHOD(Initialize) (THIS_ DXDIAG_INIT_PARAMS* pParams) PURE; + STDMETHOD(GetRootContainer) (THIS_ IDxDiagContainer **ppInstance) PURE; +}; + + +// +// COM definition for IDxDiagContainer +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagContainer +DECLARE_INTERFACE_(IDxDiagContainer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagContainer methods ***/ + STDMETHOD(GetNumberOfChildContainers) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumChildContainerNames) (THIS_ DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) PURE; + STDMETHOD(GetChildContainer) (THIS_ LPCWSTR pwszContainer, IDxDiagContainer **ppInstance) PURE; + STDMETHOD(GetNumberOfProps) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumPropNames) (THIS_ DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) PURE; + STDMETHOD(GetProp) (THIS_ LPCWSTR pwszPropName, VARIANT *pvarProp) PURE; +}; + + +/**************************************************************************** + * + * DxDiag application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->lpVtbl->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->lpVtbl->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->lpVtbl->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->lpVtbl->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->lpVtbl->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->lpVtbl->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->lpVtbl->GetProp(p,a,b) + +#else /* C++ */ + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->GetProp(p,a,b) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _DXDIAG_H_ */ + + diff --git a/SDK/dxSDK/Include/dxerr8.h b/SDK/dxSDK/Include/dxerr8.h new file mode 100644 index 00000000..4f4d8480 --- /dev/null +++ b/SDK/dxSDK/Include/dxerr8.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr8.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR8_H_ +#define _DXERR8_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString8 +// +// Desc: Converts a DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorString8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorString8W(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString8 DXGetErrorString8W +#else +#define DXGetErrorString8 DXGetErrorString8A +#endif + + +// +// DXGetErrorDescription8 +// +// Desc: Returns a string description of a DirectX HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescription8A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescription8W(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription8 DXGetErrorDescription8W +#else + #define DXGetErrorDescription8 DXGetErrorDescription8A +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_NOMSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR8_H_ diff --git a/SDK/dxSDK/Include/dxerr9.h b/SDK/dxSDK/Include/dxerr9.h new file mode 100644 index 00000000..baf6968d --- /dev/null +++ b/SDK/dxSDK/Include/dxerr9.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr9.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR9_H_ +#define _DXERR9_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString9 +// +// Desc: Converts a DirectX 9 or earlier HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorString9A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorString9W(HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString9 DXGetErrorString9W +#else +#define DXGetErrorString9 DXGetErrorString9A +#endif + + +// +// DXGetErrorDescription9 +// +// Desc: Returns a string description of a DirectX 9 or earlier HRESULT +// +// Args: HRESULT hr Can be any error code from +// D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescription9A(HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescription9W(HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription9 DXGetErrorDescription9W +#else + #define DXGetErrorDescription9 DXGetErrorDescription9A +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_MSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR9_H_ diff --git a/SDK/dxSDK/Include/dxfile.h b/SDK/dxSDK/Include/dxfile.h new file mode 100644 index 00000000..8b5995a5 --- /dev/null +++ b/SDK/dxSDK/Include/dxfile.h @@ -0,0 +1,240 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: dxfile.h + * + * Content: DirectX File public header file + * + ***************************************************************************/ + +#ifndef __DXFILE_H__ +#define __DXFILE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef DWORD DXFILEFORMAT; + +#define DXFILEFORMAT_BINARY 0 +#define DXFILEFORMAT_TEXT 1 +#define DXFILEFORMAT_COMPRESSED 2 + +typedef DWORD DXFILELOADOPTIONS; + +#define DXFILELOAD_FROMFILE 0x00L +#define DXFILELOAD_FROMRESOURCE 0x01L +#define DXFILELOAD_FROMMEMORY 0x02L +#define DXFILELOAD_FROMSTREAM 0x04L +#define DXFILELOAD_FROMURL 0x08L + +typedef struct _DXFILELOADRESOURCE { + HMODULE hModule; + LPCTSTR lpName; + LPCTSTR lpType; +}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE; + +typedef struct _DXFILELOADMEMORY { + LPVOID lpMemory; + DWORD dSize; +}DXFILELOADMEMORY, *LPDXFILELOADMEMORY; + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(IDirectXFile, DIRECTXFILE); +WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT); +WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT); +WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT); +WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA); +WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE); +WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY); + +/* + * API for creating IDirectXFile interface. + */ + +STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile); + +/* + * The methods for IUnknown + */ + +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirectXFileObject + */ + +#define IDIRECTXFILEOBJECT_METHODS(kind) \ + STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \ + STDMETHOD(GetId) (THIS_ LPGUID) kind + +/* + * DirectX File interfaces. + */ + +#undef INTERFACE +#define INTERFACE IDirectXFile + +DECLARE_INTERFACE_(IDirectXFile, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, + LPDIRECTXFILEENUMOBJECT *) PURE; + STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, + LPDIRECTXFILESAVEOBJECT *) PURE; + STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileEnumObject + +DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileSaveObject + +DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE; + STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, + DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectXFileObject + +DECLARE_INTERFACE_(IDirectXFileObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileData + +DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE; + STDMETHOD(GetType) (THIS_ const GUID **) PURE; + STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE; + STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE; + STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE; + STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileDataReference + +DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileBinary + +DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetSize) (THIS_ DWORD *) PURE; + STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE; + STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE; +}; + +/* + * DirectXFile Object Class Id (for CoCreateInstance()) + */ + +DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +/* + * DirectX File Interface GUIDs. + */ + +DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* + * DirectX File Header template's GUID. + */ + +DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + + +/* + * DirectX File errors. + */ + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#define DXFILE_OK 0 + +#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850) +#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851) +#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852) +#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853) +#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854) +#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855) +#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856) +#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857) +#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858) +#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859) +#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860) +#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861) +#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862) +#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863) +#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864) +#define DXFILEERR_BADFILE MAKE_DDHRESULT(865) +#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866) +#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867) +#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868) +#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869) +#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870) +#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871) +#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872) +#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873) +#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874) +#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875) +#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876) + + +#ifdef __cplusplus +}; +#endif + +#endif /* _DXFILE_H_ */ + \ No newline at end of file diff --git a/SDK/dxSDK/Include/dxsdkver.h b/SDK/dxSDK/Include/dxsdkver.h new file mode 100644 index 00000000..856c5f7d --- /dev/null +++ b/SDK/dxSDK/Include/dxsdkver.h @@ -0,0 +1,18 @@ +/*==========================================================================; + * + * + * File: dxsdkver.h + * Content: DirectX SDK Version Include File + * + ****************************************************************************/ + +#ifndef _DXSDKVER_H_ +#define _DXSDKVER_H_ + +#define _DXSDK_PRODUCT_MAJOR 9 +#define _DXSDK_PRODUCT_MINOR 20 +#define _DXSDK_BUILD_MAJOR 1057 +#define _DXSDK_BUILD_MINOR 0000 + +#endif // _DXSDKVER_H_ + diff --git a/SDK/dxSDK/Include/dxtrans.h b/SDK/dxSDK/Include/dxtrans.h new file mode 100644 index 00000000..8df2ff77 --- /dev/null +++ b/SDK/dxSDK/Include/dxtrans.h @@ -0,0 +1,5362 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0357 */ +/* Compiler settings for dxtrans.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxtrans_h__ +#define __dxtrans_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXBaseObject_FWD_DEFINED__ +#define __IDXBaseObject_FWD_DEFINED__ +typedef interface IDXBaseObject IDXBaseObject; +#endif /* __IDXBaseObject_FWD_DEFINED__ */ + + +#ifndef __IDXTransformFactory_FWD_DEFINED__ +#define __IDXTransformFactory_FWD_DEFINED__ +typedef interface IDXTransformFactory IDXTransformFactory; +#endif /* __IDXTransformFactory_FWD_DEFINED__ */ + + +#ifndef __IDXTransform_FWD_DEFINED__ +#define __IDXTransform_FWD_DEFINED__ +typedef interface IDXTransform IDXTransform; +#endif /* __IDXTransform_FWD_DEFINED__ */ + + +#ifndef __IDXSurfacePick_FWD_DEFINED__ +#define __IDXSurfacePick_FWD_DEFINED__ +typedef interface IDXSurfacePick IDXSurfacePick; +#endif /* __IDXSurfacePick_FWD_DEFINED__ */ + + +#ifndef __IDXTBindHost_FWD_DEFINED__ +#define __IDXTBindHost_FWD_DEFINED__ +typedef interface IDXTBindHost IDXTBindHost; +#endif /* __IDXTBindHost_FWD_DEFINED__ */ + + +#ifndef __IDXTaskManager_FWD_DEFINED__ +#define __IDXTaskManager_FWD_DEFINED__ +typedef interface IDXTaskManager IDXTaskManager; +#endif /* __IDXTaskManager_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceFactory_FWD_DEFINED__ +#define __IDXSurfaceFactory_FWD_DEFINED__ +typedef interface IDXSurfaceFactory IDXSurfaceFactory; +#endif /* __IDXSurfaceFactory_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceModifier_FWD_DEFINED__ +#define __IDXSurfaceModifier_FWD_DEFINED__ +typedef interface IDXSurfaceModifier IDXSurfaceModifier; +#endif /* __IDXSurfaceModifier_FWD_DEFINED__ */ + + +#ifndef __IDXSurface_FWD_DEFINED__ +#define __IDXSurface_FWD_DEFINED__ +typedef interface IDXSurface IDXSurface; +#endif /* __IDXSurface_FWD_DEFINED__ */ + + +#ifndef __IDXSurfaceInit_FWD_DEFINED__ +#define __IDXSurfaceInit_FWD_DEFINED__ +typedef interface IDXSurfaceInit IDXSurfaceInit; +#endif /* __IDXSurfaceInit_FWD_DEFINED__ */ + + +#ifndef __IDXARGBSurfaceInit_FWD_DEFINED__ +#define __IDXARGBSurfaceInit_FWD_DEFINED__ +typedef interface IDXARGBSurfaceInit IDXARGBSurfaceInit; +#endif /* __IDXARGBSurfaceInit_FWD_DEFINED__ */ + + +#ifndef __IDXARGBReadPtr_FWD_DEFINED__ +#define __IDXARGBReadPtr_FWD_DEFINED__ +typedef interface IDXARGBReadPtr IDXARGBReadPtr; +#endif /* __IDXARGBReadPtr_FWD_DEFINED__ */ + + +#ifndef __IDXARGBReadWritePtr_FWD_DEFINED__ +#define __IDXARGBReadWritePtr_FWD_DEFINED__ +typedef interface IDXARGBReadWritePtr IDXARGBReadWritePtr; +#endif /* __IDXARGBReadWritePtr_FWD_DEFINED__ */ + + +#ifndef __IDXDCLock_FWD_DEFINED__ +#define __IDXDCLock_FWD_DEFINED__ +typedef interface IDXDCLock IDXDCLock; +#endif /* __IDXDCLock_FWD_DEFINED__ */ + + +#ifndef __IDXTScaleOutput_FWD_DEFINED__ +#define __IDXTScaleOutput_FWD_DEFINED__ +typedef interface IDXTScaleOutput IDXTScaleOutput; +#endif /* __IDXTScaleOutput_FWD_DEFINED__ */ + + +#ifndef __IDXGradient_FWD_DEFINED__ +#define __IDXGradient_FWD_DEFINED__ +typedef interface IDXGradient IDXGradient; +#endif /* __IDXGradient_FWD_DEFINED__ */ + + +#ifndef __IDXTScale_FWD_DEFINED__ +#define __IDXTScale_FWD_DEFINED__ +typedef interface IDXTScale IDXTScale; +#endif /* __IDXTScale_FWD_DEFINED__ */ + + +#ifndef __IDXEffect_FWD_DEFINED__ +#define __IDXEffect_FWD_DEFINED__ +typedef interface IDXEffect IDXEffect; +#endif /* __IDXEffect_FWD_DEFINED__ */ + + +#ifndef __IDXLookupTable_FWD_DEFINED__ +#define __IDXLookupTable_FWD_DEFINED__ +typedef interface IDXLookupTable IDXLookupTable; +#endif /* __IDXLookupTable_FWD_DEFINED__ */ + + +#ifndef __IDXRawSurface_FWD_DEFINED__ +#define __IDXRawSurface_FWD_DEFINED__ +typedef interface IDXRawSurface IDXRawSurface; +#endif /* __IDXRawSurface_FWD_DEFINED__ */ + + +#ifndef __IHTMLDXTransform_FWD_DEFINED__ +#define __IHTMLDXTransform_FWD_DEFINED__ +typedef interface IHTMLDXTransform IHTMLDXTransform; +#endif /* __IHTMLDXTransform_FWD_DEFINED__ */ + + +#ifndef __ICSSFilterDispatch_FWD_DEFINED__ +#define __ICSSFilterDispatch_FWD_DEFINED__ +typedef interface ICSSFilterDispatch ICSSFilterDispatch; +#endif /* __ICSSFilterDispatch_FWD_DEFINED__ */ + + +#ifndef __DXTransformFactory_FWD_DEFINED__ +#define __DXTransformFactory_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTransformFactory DXTransformFactory; +#else +typedef struct DXTransformFactory DXTransformFactory; +#endif /* __cplusplus */ + +#endif /* __DXTransformFactory_FWD_DEFINED__ */ + + +#ifndef __DXTaskManager_FWD_DEFINED__ +#define __DXTaskManager_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTaskManager DXTaskManager; +#else +typedef struct DXTaskManager DXTaskManager; +#endif /* __cplusplus */ + +#endif /* __DXTaskManager_FWD_DEFINED__ */ + + +#ifndef __DXTScale_FWD_DEFINED__ +#define __DXTScale_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTScale DXTScale; +#else +typedef struct DXTScale DXTScale; +#endif /* __cplusplus */ + +#endif /* __DXTScale_FWD_DEFINED__ */ + + +#ifndef __DXSurface_FWD_DEFINED__ +#define __DXSurface_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXSurface DXSurface; +#else +typedef struct DXSurface DXSurface; +#endif /* __cplusplus */ + +#endif /* __DXSurface_FWD_DEFINED__ */ + + +#ifndef __DXSurfaceModifier_FWD_DEFINED__ +#define __DXSurfaceModifier_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXSurfaceModifier DXSurfaceModifier; +#else +typedef struct DXSurfaceModifier DXSurfaceModifier; +#endif /* __cplusplus */ + +#endif /* __DXSurfaceModifier_FWD_DEFINED__ */ + + +#ifndef __DXGradient_FWD_DEFINED__ +#define __DXGradient_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXGradient DXGradient; +#else +typedef struct DXGradient DXGradient; +#endif /* __cplusplus */ + +#endif /* __DXGradient_FWD_DEFINED__ */ + + +#ifndef __DXTFilter_FWD_DEFINED__ +#define __DXTFilter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DXTFilter DXTFilter; +#else +typedef struct DXTFilter DXTFilter; +#endif /* __cplusplus */ + +#endif /* __DXTFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "comcat.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_dxtrans_0000 */ +/* [local] */ + +#include +#include +#include +#include +#include +#if 0 +// Bogus definition used to make MIDL compiler happy +typedef void DDSURFACEDESC; + +typedef void D3DRMBOX; + +typedef void D3DVECTOR; + +typedef void D3DRMMATRIX4D; + +typedef void *LPSECURITY_ATTRIBUTES; + +#endif +#ifdef _DXTRANSIMPL + #define _DXTRANS_IMPL_EXT _declspec(dllexport) +#else + #define _DXTRANS_IMPL_EXT _declspec(dllimport) +#endif + + + + + + + + + + + + + + + + +// +// All GUIDs for DXTransform are declared in DXTGUID.C in the SDK include directory +// +EXTERN_C const GUID DDPF_RGB1; +EXTERN_C const GUID DDPF_RGB2; +EXTERN_C const GUID DDPF_RGB4; +EXTERN_C const GUID DDPF_RGB8; +EXTERN_C const GUID DDPF_RGB332; +EXTERN_C const GUID DDPF_ARGB4444; +EXTERN_C const GUID DDPF_RGB565; +EXTERN_C const GUID DDPF_BGR565; +EXTERN_C const GUID DDPF_RGB555; +EXTERN_C const GUID DDPF_ARGB1555; +EXTERN_C const GUID DDPF_RGB24; +EXTERN_C const GUID DDPF_BGR24; +EXTERN_C const GUID DDPF_RGB32; +EXTERN_C const GUID DDPF_BGR32; +EXTERN_C const GUID DDPF_ABGR32; +EXTERN_C const GUID DDPF_ARGB32; +EXTERN_C const GUID DDPF_PMARGB32; +EXTERN_C const GUID DDPF_A1; +EXTERN_C const GUID DDPF_A2; +EXTERN_C const GUID DDPF_A4; +EXTERN_C const GUID DDPF_A8; +EXTERN_C const GUID DDPF_Z8; +EXTERN_C const GUID DDPF_Z16; +EXTERN_C const GUID DDPF_Z24; +EXTERN_C const GUID DDPF_Z32; +// +// Component categories +// +EXTERN_C const GUID CATID_DXImageTransform; +EXTERN_C const GUID CATID_DX3DTransform; +EXTERN_C const GUID CATID_DXAuthoringTransform; +EXTERN_C const GUID CATID_DXSurface; +// +// Service IDs +// +EXTERN_C const GUID SID_SDirectDraw; +EXTERN_C const GUID SID_SDirect3DRM; +#define SID_SDXTaskManager CLSID_DXTaskManager +#define SID_SDXSurfaceFactory IID_IDXSurfaceFactory +#define SID_SDXTransformFactory IID_IDXTransformFactory +// +// DXTransforms Core Type Library Version Info +// +#define DXTRANS_TLB_MAJOR_VER 1 +#define DXTRANS_TLB_MINOR_VER 1 + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0000_v0_0_s_ifspec; + +#ifndef __IDXBaseObject_INTERFACE_DEFINED__ +#define __IDXBaseObject_INTERFACE_DEFINED__ + +/* interface IDXBaseObject */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXBaseObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("17B59B2B-9CC8-11d1-9053-00C04FD9189D") + IDXBaseObject : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGenerationId( + /* [out] */ ULONG *pID) = 0; + + virtual HRESULT STDMETHODCALLTYPE IncrementGenerationId( + /* [in] */ BOOL bRefresh) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObjectSize( + /* [out] */ ULONG *pcbSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXBaseObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXBaseObject * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXBaseObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXBaseObject * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXBaseObject * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXBaseObject * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXBaseObject * This, + /* [out] */ ULONG *pcbSize); + + END_INTERFACE + } IDXBaseObjectVtbl; + + interface IDXBaseObject + { + CONST_VTBL struct IDXBaseObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXBaseObject_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXBaseObject_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXBaseObject_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXBaseObject_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXBaseObject_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXBaseObject_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_GetGenerationId_Proxy( + IDXBaseObject * This, + /* [out] */ ULONG *pID); + + +void __RPC_STUB IDXBaseObject_GetGenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_IncrementGenerationId_Proxy( + IDXBaseObject * This, + /* [in] */ BOOL bRefresh); + + +void __RPC_STUB IDXBaseObject_IncrementGenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXBaseObject_GetObjectSize_Proxy( + IDXBaseObject * This, + /* [out] */ ULONG *pcbSize); + + +void __RPC_STUB IDXBaseObject_GetObjectSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXBaseObject_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0260 */ +/* [local] */ + +typedef +enum DXBNDID + { DXB_X = 0, + DXB_Y = 1, + DXB_Z = 2, + DXB_T = 3 + } DXBNDID; + +typedef +enum DXBNDTYPE + { DXBT_DISCRETE = 0, + DXBT_DISCRETE64 = DXBT_DISCRETE + 1, + DXBT_CONTINUOUS = DXBT_DISCRETE64 + 1, + DXBT_CONTINUOUS64 = DXBT_CONTINUOUS + 1 + } DXBNDTYPE; + +typedef struct DXDBND + { + long Min; + long Max; + } DXDBND; + +typedef DXDBND DXDBNDS[ 4 ]; + +typedef struct DXDBND64 + { + LONGLONG Min; + LONGLONG Max; + } DXDBND64; + +typedef DXDBND64 DXDBNDS64[ 4 ]; + +typedef struct DXCBND + { + float Min; + float Max; + } DXCBND; + +typedef DXCBND DXCBNDS[ 4 ]; + +typedef struct DXCBND64 + { + double Min; + double Max; + } DXCBND64; + +typedef DXCBND64 DXCBNDS64[ 4 ]; + +typedef struct DXBNDS + { + DXBNDTYPE eType; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_dxtrans_0260_0001 + { + /* [case()] */ DXDBND D[ 4 ]; + /* [case()] */ DXDBND64 LD[ 4 ]; + /* [case()] */ DXCBND C[ 4 ]; + /* [case()] */ DXCBND64 LC[ 4 ]; + } u; + } DXBNDS; + +typedef long DXDVEC[ 4 ]; + +typedef LONGLONG DXDVEC64[ 4 ]; + +typedef float DXCVEC[ 4 ]; + +typedef double DXCVEC64[ 4 ]; + +typedef struct DXVEC + { + DXBNDTYPE eType; + /* [switch_is] */ /* [switch_type] */ union __MIDL___MIDL_itf_dxtrans_0260_0002 + { + /* [case()] */ long D[ 4 ]; + /* [case()] */ LONGLONG LD[ 4 ]; + /* [case()] */ float C[ 4 ]; + /* [case()] */ double LC[ 4 ]; + } u; + } DXVEC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0260_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0260_v0_0_s_ifspec; + +#ifndef __IDXTransformFactory_INTERFACE_DEFINED__ +#define __IDXTransformFactory_INTERFACE_DEFINED__ + +/* interface IDXTransformFactory */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTransformFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6A950B2B-A971-11d1-81C8-0000F87557DB") + IDXTransformFactory : public IServiceProvider + { + public: + virtual HRESULT STDMETHODCALLTYPE SetService( + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTransform( + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitializeTransform( + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTransformFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTransformFactory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTransformFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTransformFactory * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *QueryService )( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ REFIID riid, + /* [out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *SetService )( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference); + + HRESULT ( STDMETHODCALLTYPE *CreateTransform )( + IDXTransformFactory * This, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform); + + HRESULT ( STDMETHODCALLTYPE *InitializeTransform )( + IDXTransformFactory * This, + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog); + + END_INTERFACE + } IDXTransformFactoryVtbl; + + interface IDXTransformFactory + { + CONST_VTBL struct IDXTransformFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTransformFactory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTransformFactory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTransformFactory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTransformFactory_QueryService(This,guidService,riid,ppvObject) \ + (This)->lpVtbl -> QueryService(This,guidService,riid,ppvObject) + + +#define IDXTransformFactory_SetService(This,guidService,pUnkService,bWeakReference) \ + (This)->lpVtbl -> SetService(This,guidService,pUnkService,bWeakReference) + +#define IDXTransformFactory_CreateTransform(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog,TransCLSID,TransIID,ppTransform) \ + (This)->lpVtbl -> CreateTransform(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog,TransCLSID,TransIID,ppTransform) + +#define IDXTransformFactory_InitializeTransform(This,pTransform,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog) \ + (This)->lpVtbl -> InitializeTransform(This,pTransform,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,pInitProps,pErrLog) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_SetService_Proxy( + IDXTransformFactory * This, + /* [in] */ REFGUID guidService, + /* [in] */ IUnknown *pUnkService, + /* [in] */ BOOL bWeakReference); + + +void __RPC_STUB IDXTransformFactory_SetService_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_CreateTransform_Proxy( + IDXTransformFactory * This, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog, + /* [in] */ REFCLSID TransCLSID, + /* [in] */ REFIID TransIID, + /* [iid_is][out] */ void **ppTransform); + + +void __RPC_STUB IDXTransformFactory_CreateTransform_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransformFactory_InitializeTransform_Proxy( + IDXTransformFactory * This, + /* [in] */ IDXTransform *pTransform, + /* [size_is][in] */ IUnknown **punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown **punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ IPropertyBag *pInitProps, + /* [in] */ IErrorLog *pErrLog); + + +void __RPC_STUB IDXTransformFactory_InitializeTransform_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTransformFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0261 */ +/* [local] */ + +typedef +enum DXTMISCFLAGS + { DXTMF_BLEND_WITH_OUTPUT = 1L << 0, + DXTMF_DITHER_OUTPUT = 1L << 1, + DXTMF_OPTION_MASK = 0xffff, + DXTMF_VALID_OPTIONS = DXTMF_BLEND_WITH_OUTPUT | DXTMF_DITHER_OUTPUT, + DXTMF_BLEND_SUPPORTED = 1L << 16, + DXTMF_DITHER_SUPPORTED = 1L << 17, + DXTMF_INPLACE_OPERATION = 1L << 24, + DXTMF_BOUNDS_SUPPORTED = 1L << 25, + DXTMF_PLACEMENT_SUPPORTED = 1L << 26, + DXTMF_QUALITY_SUPPORTED = 1L << 27, + DXTMF_OPAQUE_RESULT = 1L << 28 + } DXTMISCFLAGS; + +typedef +enum DXINOUTINFOFLAGS + { DXINOUTF_OPTIONAL = 1L << 0 + } DXINOUTINFOFLAGS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0261_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0261_v0_0_s_ifspec; + +#ifndef __IDXTransform_INTERFACE_DEFINED__ +#define __IDXTransform_INTERFACE_DEFINED__ + +/* interface IDXTransform */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTransform; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30A5FB78-E11F-11d1-9064-00C04FD9189D") + IDXTransform : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE Setup( + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Execute( + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapBoundsIn2Out( + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE MapBoundsOut2In( + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetMiscFlags( + /* [in] */ DWORD dwMiscFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMiscFlags( + /* [out] */ DWORD *pdwMiscFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInOutInfo( + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetQuality( + /* [in] */ float fQuality) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetQuality( + /* [out] */ float *fQuality) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTransformVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTransform * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTransform * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTransform * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXTransform * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXTransform * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXTransform * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *Setup )( + IDXTransform * This, + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *Execute )( + IDXTransform * This, + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement); + + HRESULT ( STDMETHODCALLTYPE *MapBoundsIn2Out )( + IDXTransform * This, + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds); + + HRESULT ( STDMETHODCALLTYPE *MapBoundsOut2In )( + IDXTransform * This, + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds); + + HRESULT ( STDMETHODCALLTYPE *SetMiscFlags )( + IDXTransform * This, + /* [in] */ DWORD dwMiscFlags); + + HRESULT ( STDMETHODCALLTYPE *GetMiscFlags )( + IDXTransform * This, + /* [out] */ DWORD *pdwMiscFlags); + + HRESULT ( STDMETHODCALLTYPE *GetInOutInfo )( + IDXTransform * This, + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject); + + HRESULT ( STDMETHODCALLTYPE *SetQuality )( + IDXTransform * This, + /* [in] */ float fQuality); + + HRESULT ( STDMETHODCALLTYPE *GetQuality )( + IDXTransform * This, + /* [out] */ float *fQuality); + + END_INTERFACE + } IDXTransformVtbl; + + interface IDXTransform + { + CONST_VTBL struct IDXTransformVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTransform_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTransform_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTransform_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTransform_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXTransform_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXTransform_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXTransform_Setup(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,dwFlags) \ + (This)->lpVtbl -> Setup(This,punkInputs,ulNumInputs,punkOutputs,ulNumOutputs,dwFlags) + +#define IDXTransform_Execute(This,pRequestID,pClipBnds,pPlacement) \ + (This)->lpVtbl -> Execute(This,pRequestID,pClipBnds,pPlacement) + +#define IDXTransform_MapBoundsIn2Out(This,pInBounds,ulNumInBnds,ulOutIndex,pOutBounds) \ + (This)->lpVtbl -> MapBoundsIn2Out(This,pInBounds,ulNumInBnds,ulOutIndex,pOutBounds) + +#define IDXTransform_MapBoundsOut2In(This,ulOutIndex,pOutBounds,ulInIndex,pInBounds) \ + (This)->lpVtbl -> MapBoundsOut2In(This,ulOutIndex,pOutBounds,ulInIndex,pInBounds) + +#define IDXTransform_SetMiscFlags(This,dwMiscFlags) \ + (This)->lpVtbl -> SetMiscFlags(This,dwMiscFlags) + +#define IDXTransform_GetMiscFlags(This,pdwMiscFlags) \ + (This)->lpVtbl -> GetMiscFlags(This,pdwMiscFlags) + +#define IDXTransform_GetInOutInfo(This,bIsOutput,ulIndex,pdwFlags,pIDs,pcIDs,ppUnkCurrentObject) \ + (This)->lpVtbl -> GetInOutInfo(This,bIsOutput,ulIndex,pdwFlags,pIDs,pcIDs,ppUnkCurrentObject) + +#define IDXTransform_SetQuality(This,fQuality) \ + (This)->lpVtbl -> SetQuality(This,fQuality) + +#define IDXTransform_GetQuality(This,fQuality) \ + (This)->lpVtbl -> GetQuality(This,fQuality) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTransform_Setup_Proxy( + IDXTransform * This, + /* [size_is][in] */ IUnknown *const *punkInputs, + /* [in] */ ULONG ulNumInputs, + /* [size_is][in] */ IUnknown *const *punkOutputs, + /* [in] */ ULONG ulNumOutputs, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXTransform_Setup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_Execute_Proxy( + IDXTransform * This, + /* [in] */ const GUID *pRequestID, + /* [in] */ const DXBNDS *pClipBnds, + /* [in] */ const DXVEC *pPlacement); + + +void __RPC_STUB IDXTransform_Execute_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_MapBoundsIn2Out_Proxy( + IDXTransform * This, + /* [in] */ const DXBNDS *pInBounds, + /* [in] */ ULONG ulNumInBnds, + /* [in] */ ULONG ulOutIndex, + /* [out] */ DXBNDS *pOutBounds); + + +void __RPC_STUB IDXTransform_MapBoundsIn2Out_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_MapBoundsOut2In_Proxy( + IDXTransform * This, + /* [in] */ ULONG ulOutIndex, + /* [in] */ const DXBNDS *pOutBounds, + /* [in] */ ULONG ulInIndex, + /* [out] */ DXBNDS *pInBounds); + + +void __RPC_STUB IDXTransform_MapBoundsOut2In_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_SetMiscFlags_Proxy( + IDXTransform * This, + /* [in] */ DWORD dwMiscFlags); + + +void __RPC_STUB IDXTransform_SetMiscFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetMiscFlags_Proxy( + IDXTransform * This, + /* [out] */ DWORD *pdwMiscFlags); + + +void __RPC_STUB IDXTransform_GetMiscFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetInOutInfo_Proxy( + IDXTransform * This, + /* [in] */ BOOL bIsOutput, + /* [in] */ ULONG ulIndex, + /* [out] */ DWORD *pdwFlags, + /* [size_is][out] */ GUID *pIDs, + /* [out][in] */ ULONG *pcIDs, + /* [out] */ IUnknown **ppUnkCurrentObject); + + +void __RPC_STUB IDXTransform_GetInOutInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_SetQuality_Proxy( + IDXTransform * This, + /* [in] */ float fQuality); + + +void __RPC_STUB IDXTransform_SetQuality_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTransform_GetQuality_Proxy( + IDXTransform * This, + /* [out] */ float *fQuality); + + +void __RPC_STUB IDXTransform_GetQuality_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTransform_INTERFACE_DEFINED__ */ + + +#ifndef __IDXSurfacePick_INTERFACE_DEFINED__ +#define __IDXSurfacePick_INTERFACE_DEFINED__ + +/* interface IDXSurfacePick */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfacePick; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30A5FB79-E11F-11d1-9064-00C04FD9189D") + IDXSurfacePick : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE PointPick( + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfacePickVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfacePick * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfacePick * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfacePick * This); + + HRESULT ( STDMETHODCALLTYPE *PointPick )( + IDXSurfacePick * This, + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint); + + END_INTERFACE + } IDXSurfacePickVtbl; + + interface IDXSurfacePick + { + CONST_VTBL struct IDXSurfacePickVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfacePick_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfacePick_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfacePick_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfacePick_PointPick(This,pPoint,pulInputSurfaceIndex,pInputPoint) \ + (This)->lpVtbl -> PointPick(This,pPoint,pulInputSurfaceIndex,pInputPoint) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfacePick_PointPick_Proxy( + IDXSurfacePick * This, + /* [in] */ const DXVEC *pPoint, + /* [out] */ ULONG *pulInputSurfaceIndex, + /* [out] */ DXVEC *pInputPoint); + + +void __RPC_STUB IDXSurfacePick_PointPick_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfacePick_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTBindHost_INTERFACE_DEFINED__ +#define __IDXTBindHost_INTERFACE_DEFINED__ + +/* interface IDXTBindHost */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTBindHost; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D26BCE55-E9DC-11d1-9066-00C04FD9189D") + IDXTBindHost : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBindHost( + /* [in] */ IBindHost *pBindHost) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTBindHostVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTBindHost * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTBindHost * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTBindHost * This); + + HRESULT ( STDMETHODCALLTYPE *SetBindHost )( + IDXTBindHost * This, + /* [in] */ IBindHost *pBindHost); + + END_INTERFACE + } IDXTBindHostVtbl; + + interface IDXTBindHost + { + CONST_VTBL struct IDXTBindHostVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTBindHost_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTBindHost_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTBindHost_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTBindHost_SetBindHost(This,pBindHost) \ + (This)->lpVtbl -> SetBindHost(This,pBindHost) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTBindHost_SetBindHost_Proxy( + IDXTBindHost * This, + /* [in] */ IBindHost *pBindHost); + + +void __RPC_STUB IDXTBindHost_SetBindHost_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTBindHost_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0264 */ +/* [local] */ + +typedef void __stdcall __stdcall DXTASKPROC( + void *pTaskData, + BOOL *pbContinueProcessing); + +typedef DXTASKPROC *PFNDXTASKPROC; + +typedef void __stdcall __stdcall DXAPCPROC( + DWORD dwData); + +typedef DXAPCPROC *PFNDXAPCPROC; + +#ifdef __cplusplus +typedef struct DXTMTASKINFO +{ + PFNDXTASKPROC pfnTaskProc; // Pointer to function to execute + PVOID pTaskData; // Pointer to argument data + PFNDXAPCPROC pfnCompletionAPC; // Pointer to completion APC proc + DWORD dwCompletionData; // Pointer to APC proc data + const GUID* pRequestID; // Used to identify groups of tasks +} DXTMTASKINFO; +#else +typedef struct DXTMTASKINFO + { + PVOID pfnTaskProc; + PVOID pTaskData; + PVOID pfnCompletionAPC; + DWORD dwCompletionData; + const GUID *pRequestID; + } DXTMTASKINFO; + +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0264_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0264_v0_0_s_ifspec; + +#ifndef __IDXTaskManager_INTERFACE_DEFINED__ +#define __IDXTaskManager_INTERFACE_DEFINED__ + +/* interface IDXTaskManager */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTaskManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("254DBBC1-F922-11d0-883A-3C8B00C10000") + IDXTaskManager : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE QueryNumProcessors( + /* [out] */ ULONG *pulNumProc) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetThreadPoolSize( + /* [in] */ ULONG ulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetThreadPoolSize( + /* [out] */ ULONG *pulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetConcurrencyLimit( + /* [in] */ ULONG ulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetConcurrencyLimit( + /* [out] */ ULONG *pulNumThreads) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleTasks( + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTasks( + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateRequest( + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTaskManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTaskManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTaskManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTaskManager * This); + + HRESULT ( STDMETHODCALLTYPE *QueryNumProcessors )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumProc); + + HRESULT ( STDMETHODCALLTYPE *SetThreadPoolSize )( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *GetThreadPoolSize )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *SetConcurrencyLimit )( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *GetConcurrencyLimit )( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + HRESULT ( STDMETHODCALLTYPE *ScheduleTasks )( + IDXTaskManager * This, + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod); + + HRESULT ( STDMETHODCALLTYPE *TerminateTasks )( + IDXTaskManager * This, + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut); + + HRESULT ( STDMETHODCALLTYPE *TerminateRequest )( + IDXTaskManager * This, + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut); + + END_INTERFACE + } IDXTaskManagerVtbl; + + interface IDXTaskManager + { + CONST_VTBL struct IDXTaskManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTaskManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTaskManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTaskManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTaskManager_QueryNumProcessors(This,pulNumProc) \ + (This)->lpVtbl -> QueryNumProcessors(This,pulNumProc) + +#define IDXTaskManager_SetThreadPoolSize(This,ulNumThreads) \ + (This)->lpVtbl -> SetThreadPoolSize(This,ulNumThreads) + +#define IDXTaskManager_GetThreadPoolSize(This,pulNumThreads) \ + (This)->lpVtbl -> GetThreadPoolSize(This,pulNumThreads) + +#define IDXTaskManager_SetConcurrencyLimit(This,ulNumThreads) \ + (This)->lpVtbl -> SetConcurrencyLimit(This,ulNumThreads) + +#define IDXTaskManager_GetConcurrencyLimit(This,pulNumThreads) \ + (This)->lpVtbl -> GetConcurrencyLimit(This,pulNumThreads) + +#define IDXTaskManager_ScheduleTasks(This,TaskInfo,Events,TaskIDs,ulNumTasks,ulWaitPeriod) \ + (This)->lpVtbl -> ScheduleTasks(This,TaskInfo,Events,TaskIDs,ulNumTasks,ulWaitPeriod) + +#define IDXTaskManager_TerminateTasks(This,TaskIDs,ulCount,ulTimeOut) \ + (This)->lpVtbl -> TerminateTasks(This,TaskIDs,ulCount,ulTimeOut) + +#define IDXTaskManager_TerminateRequest(This,RequestID,ulTimeOut) \ + (This)->lpVtbl -> TerminateRequest(This,RequestID,ulTimeOut) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_QueryNumProcessors_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumProc); + + +void __RPC_STUB IDXTaskManager_QueryNumProcessors_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_SetThreadPoolSize_Proxy( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + +void __RPC_STUB IDXTaskManager_SetThreadPoolSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_GetThreadPoolSize_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + +void __RPC_STUB IDXTaskManager_GetThreadPoolSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_SetConcurrencyLimit_Proxy( + IDXTaskManager * This, + /* [in] */ ULONG ulNumThreads); + + +void __RPC_STUB IDXTaskManager_SetConcurrencyLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_GetConcurrencyLimit_Proxy( + IDXTaskManager * This, + /* [out] */ ULONG *pulNumThreads); + + +void __RPC_STUB IDXTaskManager_GetConcurrencyLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_ScheduleTasks_Proxy( + IDXTaskManager * This, + /* [in] */ DXTMTASKINFO TaskInfo[ ], + /* [in] */ HANDLE Events[ ], + /* [out] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulNumTasks, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB IDXTaskManager_ScheduleTasks_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_TerminateTasks_Proxy( + IDXTaskManager * This, + /* [in] */ DWORD TaskIDs[ ], + /* [in] */ ULONG ulCount, + /* [in] */ ULONG ulTimeOut); + + +void __RPC_STUB IDXTaskManager_TerminateTasks_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTaskManager_TerminateRequest_Proxy( + IDXTaskManager * This, + /* [in] */ REFIID RequestID, + /* [in] */ ULONG ulTimeOut); + + +void __RPC_STUB IDXTaskManager_TerminateRequest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTaskManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0265 */ +/* [local] */ + +#ifdef __cplusplus +///////////////////////////////////////////////////// + +class DXBASESAMPLE; +class DXSAMPLE; +class DXPMSAMPLE; + +///////////////////////////////////////////////////// + +class DXBASESAMPLE +{ +public: + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + DXBASESAMPLE() {} + DXBASESAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + Alpha(alpha), + Red(red), + Green(green), + Blue(blue) {} + DXBASESAMPLE(const DWORD val) { *this = (*(DXBASESAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXBASESAMPLE *)&val); } +}; // DXBASESAMPLE + +///////////////////////////////////////////////////// + +class DXSAMPLE : public DXBASESAMPLE +{ +public: + DXSAMPLE() {} + DXSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + DXBASESAMPLE(alpha, red, green, blue) {} + DXSAMPLE(const DWORD val) { *this = (*(DXSAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXSAMPLE *)&val); } + operator DXPMSAMPLE() const; +}; // DXSAMPLE + +///////////////////////////////////////////////////// + +class DXPMSAMPLE : public DXBASESAMPLE +{ +public: + DXPMSAMPLE() {} + DXPMSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : + DXBASESAMPLE(alpha, red, green, blue) {} + DXPMSAMPLE(const DWORD val) { *this = (*(DXPMSAMPLE *)&val); } + operator DWORD () const {return *((DWORD *)this); } + DWORD operator=(const DWORD val) { return *this = *((DXPMSAMPLE *)&val); } + operator DXSAMPLE() const; +}; // DXPMSAMPLE + +// +// The following cast operators are to prevent a direct assignment of a DXSAMPLE to a DXPMSAMPLE +// +inline DXSAMPLE::operator DXPMSAMPLE() const { return *((DXPMSAMPLE *)this); } +inline DXPMSAMPLE::operator DXSAMPLE() const { return *((DXSAMPLE *)this); } +#else // !__cplusplus +typedef struct DXBASESAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXBASESAMPLE; + +typedef struct DXSAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXSAMPLE; + +typedef struct DXPMSAMPLE + { + BYTE Blue; + BYTE Green; + BYTE Red; + BYTE Alpha; + } DXPMSAMPLE; + +#endif // !__cplusplus +typedef +enum DXRUNTYPE + { DXRUNTYPE_CLEAR = 0, + DXRUNTYPE_OPAQUE = 1, + DXRUNTYPE_TRANS = 2, + DXRUNTYPE_UNKNOWN = 3 + } DXRUNTYPE; + +#define DX_MAX_RUN_INFO_COUNT ( 128 ) + +// Ignore the definition used by MIDL for TLB generation +#if 0 +typedef struct DXRUNINFO + { + ULONG Bitfields; + } DXRUNINFO; + +#endif // 0 +typedef struct DXRUNINFO +{ + ULONG Type : 2; // Type + ULONG Count : 30; // Number of samples in run +} DXRUNINFO; +typedef +enum DXSFCREATE + { DXSF_FORMAT_IS_CLSID = 1L << 0, + DXSF_NO_LAZY_DDRAW_LOCK = 1L << 1 + } DXSFCREATE; + +typedef +enum DXBLTOPTIONS + { DXBOF_DO_OVER = 1L << 0, + DXBOF_DITHER = 1L << 1 + } DXBLTOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0265_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0265_v0_0_s_ifspec; + +#ifndef __IDXSurfaceFactory_INTERFACE_DEFINED__ +#define __IDXSurfaceFactory_INTERFACE_DEFINED__ + +/* interface IDXSurfaceFactory */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("144946F5-C4D4-11d1-81D1-0000F87557DB") + IDXSurfaceFactory : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFromDDSurface( + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadImage( + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadImageFromStream( + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CopySurfaceToNewFormat( + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateD3DRMTexture( + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3) = 0; + + virtual HRESULT STDMETHODCALLTYPE BitBlt( + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceFactory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceFactory * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *CreateFromDDSurface )( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *LoadImage )( + IDXSurfaceFactory * This, + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *LoadImageFromStream )( + IDXSurfaceFactory * This, + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + HRESULT ( STDMETHODCALLTYPE *CopySurfaceToNewFormat )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface); + + HRESULT ( STDMETHODCALLTYPE *CreateD3DRMTexture )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3); + + HRESULT ( STDMETHODCALLTYPE *BitBlt )( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } IDXSurfaceFactoryVtbl; + + interface IDXSurfaceFactory + { + CONST_VTBL struct IDXSurfaceFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceFactory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceFactory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceFactory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceFactory_CreateSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags,punkOuter,riid,ppDXSurface) \ + (This)->lpVtbl -> CreateSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags,punkOuter,riid,ppDXSurface) + +#define IDXSurfaceFactory_CreateFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags,punkOuter,riid,ppDXSurface) \ + (This)->lpVtbl -> CreateFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags,punkOuter,riid,ppDXSurface) + +#define IDXSurfaceFactory_LoadImage(This,pszFileName,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) \ + (This)->lpVtbl -> LoadImage(This,pszFileName,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) + +#define IDXSurfaceFactory_LoadImageFromStream(This,pStream,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) \ + (This)->lpVtbl -> LoadImageFromStream(This,pStream,pDirectDraw,pDDSurfaceDesc,pFormatID,riid,ppDXSurface) + +#define IDXSurfaceFactory_CopySurfaceToNewFormat(This,pSrc,pDirectDraw,pDDSurfaceDesc,pDestFormatID,ppNewSurface) \ + (This)->lpVtbl -> CopySurfaceToNewFormat(This,pSrc,pDirectDraw,pDDSurfaceDesc,pDestFormatID,ppNewSurface) + +#define IDXSurfaceFactory_CreateD3DRMTexture(This,pSrc,pDirectDraw,pD3DRM3,riid,ppTexture3) \ + (This)->lpVtbl -> CreateD3DRMTexture(This,pSrc,pDirectDraw,pD3DRM3,riid,ppTexture3) + +#define IDXSurfaceFactory_BitBlt(This,pDest,pPlacement,pSrc,pClipBounds,dwFlags) \ + (This)->lpVtbl -> BitBlt(This,pDest,pPlacement,pSrc,pClipBounds,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateSurface_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_CreateSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateFromDDSurface_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags, + /* [in] */ IUnknown *punkOuter, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_CreateFromDDSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_LoadImage_Proxy( + IDXSurfaceFactory * This, + /* [in] */ const LPWSTR pszFileName, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_LoadImage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_LoadImageFromStream_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IStream *pStream, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppDXSurface); + + +void __RPC_STUB IDXSurfaceFactory_LoadImageFromStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CopySurfaceToNewFormat_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pDestFormatID, + /* [out] */ IDXSurface **ppNewSurface); + + +void __RPC_STUB IDXSurfaceFactory_CopySurfaceToNewFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_CreateD3DRMTexture_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pSrc, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ IUnknown *pD3DRM3, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppTexture3); + + +void __RPC_STUB IDXSurfaceFactory_CreateD3DRMTexture_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceFactory_BitBlt_Proxy( + IDXSurfaceFactory * This, + /* [in] */ IDXSurface *pDest, + /* [in] */ const DXVEC *pPlacement, + /* [in] */ IDXSurface *pSrc, + /* [in] */ const DXBNDS *pClipBounds, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXSurfaceFactory_BitBlt_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0266 */ +/* [local] */ + +typedef +enum DXSURFMODCOMPOP + { DXSURFMOD_COMP_OVER = 0, + DXSURFMOD_COMP_ALPHA_MASK = 1, + DXSURFMOD_COMP_MAX_VALID = 1 + } DXSURFMODCOMPOP; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0266_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0266_v0_0_s_ifspec; + +#ifndef __IDXSurfaceModifier_INTERFACE_DEFINED__ +#define __IDXSurfaceModifier_INTERFACE_DEFINED__ + +/* interface IDXSurfaceModifier */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceModifier; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B637-C37D-11d1-905E-00C04FD9189D") + IDXSurfaceModifier : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFillColor( + /* [in] */ DXSAMPLE Color) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFillColor( + /* [out] */ DXSAMPLE *pColor) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBounds( + /* [in] */ const DXBNDS *pBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBackground( + /* [in] */ IDXSurface *pSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBackground( + /* [out] */ IDXSurface **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCompositeOperation( + /* [in] */ DXSURFMODCOMPOP CompOp) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCompositeOperation( + /* [out] */ DXSURFMODCOMPOP *pCompOp) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetForeground( + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetForeground( + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetOpacity( + /* [in] */ float Opacity) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOpacity( + /* [out] */ float *pOpacity) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetLookup( + /* [in] */ IDXLookupTable *pLookupTable) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLookup( + /* [out] */ IDXLookupTable **ppLookupTable) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceModifierVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceModifier * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceModifier * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceModifier * This); + + HRESULT ( STDMETHODCALLTYPE *SetFillColor )( + IDXSurfaceModifier * This, + /* [in] */ DXSAMPLE Color); + + HRESULT ( STDMETHODCALLTYPE *GetFillColor )( + IDXSurfaceModifier * This, + /* [out] */ DXSAMPLE *pColor); + + HRESULT ( STDMETHODCALLTYPE *SetBounds )( + IDXSurfaceModifier * This, + /* [in] */ const DXBNDS *pBounds); + + HRESULT ( STDMETHODCALLTYPE *SetBackground )( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface); + + HRESULT ( STDMETHODCALLTYPE *GetBackground )( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *SetCompositeOperation )( + IDXSurfaceModifier * This, + /* [in] */ DXSURFMODCOMPOP CompOp); + + HRESULT ( STDMETHODCALLTYPE *GetCompositeOperation )( + IDXSurfaceModifier * This, + /* [out] */ DXSURFMODCOMPOP *pCompOp); + + HRESULT ( STDMETHODCALLTYPE *SetForeground )( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin); + + HRESULT ( STDMETHODCALLTYPE *GetForeground )( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin); + + HRESULT ( STDMETHODCALLTYPE *SetOpacity )( + IDXSurfaceModifier * This, + /* [in] */ float Opacity); + + HRESULT ( STDMETHODCALLTYPE *GetOpacity )( + IDXSurfaceModifier * This, + /* [out] */ float *pOpacity); + + HRESULT ( STDMETHODCALLTYPE *SetLookup )( + IDXSurfaceModifier * This, + /* [in] */ IDXLookupTable *pLookupTable); + + HRESULT ( STDMETHODCALLTYPE *GetLookup )( + IDXSurfaceModifier * This, + /* [out] */ IDXLookupTable **ppLookupTable); + + END_INTERFACE + } IDXSurfaceModifierVtbl; + + interface IDXSurfaceModifier + { + CONST_VTBL struct IDXSurfaceModifierVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceModifier_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceModifier_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceModifier_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceModifier_SetFillColor(This,Color) \ + (This)->lpVtbl -> SetFillColor(This,Color) + +#define IDXSurfaceModifier_GetFillColor(This,pColor) \ + (This)->lpVtbl -> GetFillColor(This,pColor) + +#define IDXSurfaceModifier_SetBounds(This,pBounds) \ + (This)->lpVtbl -> SetBounds(This,pBounds) + +#define IDXSurfaceModifier_SetBackground(This,pSurface) \ + (This)->lpVtbl -> SetBackground(This,pSurface) + +#define IDXSurfaceModifier_GetBackground(This,ppSurface) \ + (This)->lpVtbl -> GetBackground(This,ppSurface) + +#define IDXSurfaceModifier_SetCompositeOperation(This,CompOp) \ + (This)->lpVtbl -> SetCompositeOperation(This,CompOp) + +#define IDXSurfaceModifier_GetCompositeOperation(This,pCompOp) \ + (This)->lpVtbl -> GetCompositeOperation(This,pCompOp) + +#define IDXSurfaceModifier_SetForeground(This,pSurface,bTile,pOrigin) \ + (This)->lpVtbl -> SetForeground(This,pSurface,bTile,pOrigin) + +#define IDXSurfaceModifier_GetForeground(This,ppSurface,pbTile,pOrigin) \ + (This)->lpVtbl -> GetForeground(This,ppSurface,pbTile,pOrigin) + +#define IDXSurfaceModifier_SetOpacity(This,Opacity) \ + (This)->lpVtbl -> SetOpacity(This,Opacity) + +#define IDXSurfaceModifier_GetOpacity(This,pOpacity) \ + (This)->lpVtbl -> GetOpacity(This,pOpacity) + +#define IDXSurfaceModifier_SetLookup(This,pLookupTable) \ + (This)->lpVtbl -> SetLookup(This,pLookupTable) + +#define IDXSurfaceModifier_GetLookup(This,ppLookupTable) \ + (This)->lpVtbl -> GetLookup(This,ppLookupTable) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetFillColor_Proxy( + IDXSurfaceModifier * This, + /* [in] */ DXSAMPLE Color); + + +void __RPC_STUB IDXSurfaceModifier_SetFillColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetFillColor_Proxy( + IDXSurfaceModifier * This, + /* [out] */ DXSAMPLE *pColor); + + +void __RPC_STUB IDXSurfaceModifier_GetFillColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetBounds_Proxy( + IDXSurfaceModifier * This, + /* [in] */ const DXBNDS *pBounds); + + +void __RPC_STUB IDXSurfaceModifier_SetBounds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetBackground_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface); + + +void __RPC_STUB IDXSurfaceModifier_SetBackground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetBackground_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface); + + +void __RPC_STUB IDXSurfaceModifier_GetBackground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetCompositeOperation_Proxy( + IDXSurfaceModifier * This, + /* [in] */ DXSURFMODCOMPOP CompOp); + + +void __RPC_STUB IDXSurfaceModifier_SetCompositeOperation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetCompositeOperation_Proxy( + IDXSurfaceModifier * This, + /* [out] */ DXSURFMODCOMPOP *pCompOp); + + +void __RPC_STUB IDXSurfaceModifier_GetCompositeOperation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetForeground_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXSurface *pSurface, + /* [in] */ BOOL bTile, + /* [in] */ const POINT *pOrigin); + + +void __RPC_STUB IDXSurfaceModifier_SetForeground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetForeground_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXSurface **ppSurface, + /* [out] */ BOOL *pbTile, + /* [out] */ POINT *pOrigin); + + +void __RPC_STUB IDXSurfaceModifier_GetForeground_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetOpacity_Proxy( + IDXSurfaceModifier * This, + /* [in] */ float Opacity); + + +void __RPC_STUB IDXSurfaceModifier_SetOpacity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetOpacity_Proxy( + IDXSurfaceModifier * This, + /* [out] */ float *pOpacity); + + +void __RPC_STUB IDXSurfaceModifier_GetOpacity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_SetLookup_Proxy( + IDXSurfaceModifier * This, + /* [in] */ IDXLookupTable *pLookupTable); + + +void __RPC_STUB IDXSurfaceModifier_SetLookup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurfaceModifier_GetLookup_Proxy( + IDXSurfaceModifier * This, + /* [out] */ IDXLookupTable **ppLookupTable); + + +void __RPC_STUB IDXSurfaceModifier_GetLookup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceModifier_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0267 */ +/* [local] */ + +typedef +enum DXSAMPLEFORMATENUM + { DXPF_FLAGSMASK = 0xffff0000, + DXPF_NONPREMULT = 0x10000, + DXPF_TRANSPARENCY = 0x20000, + DXPF_TRANSLUCENCY = 0x40000, + DXPF_2BITERROR = 0x200000, + DXPF_3BITERROR = 0x300000, + DXPF_4BITERROR = 0x400000, + DXPF_5BITERROR = 0x500000, + DXPF_ERRORMASK = 0x700000, + DXPF_NONSTANDARD = 0, + DXPF_PMARGB32 = 1 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_ARGB32 = 2 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_ARGB4444 = 3 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY | DXPF_4BITERROR, + DXPF_A8 = 4 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY, + DXPF_RGB32 = 5, + DXPF_RGB24 = 6, + DXPF_RGB565 = 7 | DXPF_3BITERROR, + DXPF_RGB555 = 8 | DXPF_3BITERROR, + DXPF_RGB8 = 9 | DXPF_5BITERROR, + DXPF_ARGB1555 = 10 | DXPF_TRANSPARENCY | DXPF_3BITERROR, + DXPF_RGB32_CK = DXPF_RGB32 | DXPF_TRANSPARENCY, + DXPF_RGB24_CK = DXPF_RGB24 | DXPF_TRANSPARENCY, + DXPF_RGB555_CK = DXPF_RGB555 | DXPF_TRANSPARENCY, + DXPF_RGB565_CK = DXPF_RGB565 | DXPF_TRANSPARENCY, + DXPF_RGB8_CK = DXPF_RGB8 | DXPF_TRANSPARENCY + } DXSAMPLEFORMATENUM; + +typedef +enum DXLOCKSURF + { DXLOCKF_READ = 0, + DXLOCKF_READWRITE = 1 << 0, + DXLOCKF_EXISTINGINFOONLY = 1 << 1, + DXLOCKF_WANTRUNINFO = 1 << 2, + DXLOCKF_NONPREMULT = 1 << 16, + DXLOCKF_VALIDFLAGS = DXLOCKF_READWRITE | DXLOCKF_EXISTINGINFOONLY | DXLOCKF_WANTRUNINFO | DXLOCKF_NONPREMULT + } DXLOCKSURF; + +typedef +enum DXSURFSTATUS + { DXSURF_TRANSIENT = 1 << 0, + DXSURF_READONLY = 1 << 1, + DXSURF_VALIDFLAGS = DXSURF_TRANSIENT | DXSURF_READONLY + } DXSURFSTATUS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0267_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0267_v0_0_s_ifspec; + +#ifndef __IDXSurface_INTERFACE_DEFINED__ +#define __IDXSurface_INTERFACE_DEFINED__ + +/* interface IDXSurface */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B39FD73F-E139-11d1-9065-00C04FD9189D") + IDXSurface : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPixelFormat( + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBounds( + /* [out] */ DXBNDS *pBounds) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatusFlags( + /* [out] */ DWORD *pdwStatusFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStatusFlags( + /* [in] */ DWORD dwStatusFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE LockSurface( + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDirectDrawSurface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetColorKey( + DXSAMPLE *pColorKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetColorKey( + DXSAMPLE ColorKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE LockSurfaceDC( + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAppData( + DWORD_PTR dwAppData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAppData( + DWORD_PTR *pdwAppData) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurface * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXSurface * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXSurface * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXSurface * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *GetPixelFormat )( + IDXSurface * This, + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum); + + HRESULT ( STDMETHODCALLTYPE *GetBounds )( + IDXSurface * This, + /* [out] */ DXBNDS *pBounds); + + HRESULT ( STDMETHODCALLTYPE *GetStatusFlags )( + IDXSurface * This, + /* [out] */ DWORD *pdwStatusFlags); + + HRESULT ( STDMETHODCALLTYPE *SetStatusFlags )( + IDXSurface * This, + /* [in] */ DWORD dwStatusFlags); + + HRESULT ( STDMETHODCALLTYPE *LockSurface )( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId); + + HRESULT ( STDMETHODCALLTYPE *GetDirectDrawSurface )( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *GetColorKey )( + IDXSurface * This, + DXSAMPLE *pColorKey); + + HRESULT ( STDMETHODCALLTYPE *SetColorKey )( + IDXSurface * This, + DXSAMPLE ColorKey); + + HRESULT ( STDMETHODCALLTYPE *LockSurfaceDC )( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock); + + HRESULT ( STDMETHODCALLTYPE *SetAppData )( + IDXSurface * This, + DWORD_PTR dwAppData); + + HRESULT ( STDMETHODCALLTYPE *GetAppData )( + IDXSurface * This, + DWORD_PTR *pdwAppData); + + END_INTERFACE + } IDXSurfaceVtbl; + + interface IDXSurface + { + CONST_VTBL struct IDXSurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurface_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurface_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurface_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurface_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXSurface_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXSurface_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXSurface_GetPixelFormat(This,pFormatID,pSampleFormatEnum) \ + (This)->lpVtbl -> GetPixelFormat(This,pFormatID,pSampleFormatEnum) + +#define IDXSurface_GetBounds(This,pBounds) \ + (This)->lpVtbl -> GetBounds(This,pBounds) + +#define IDXSurface_GetStatusFlags(This,pdwStatusFlags) \ + (This)->lpVtbl -> GetStatusFlags(This,pdwStatusFlags) + +#define IDXSurface_SetStatusFlags(This,dwStatusFlags) \ + (This)->lpVtbl -> SetStatusFlags(This,dwStatusFlags) + +#define IDXSurface_LockSurface(This,pBounds,ulTimeOut,dwFlags,riid,ppPointer,pulGenerationId) \ + (This)->lpVtbl -> LockSurface(This,pBounds,ulTimeOut,dwFlags,riid,ppPointer,pulGenerationId) + +#define IDXSurface_GetDirectDrawSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetDirectDrawSurface(This,riid,ppSurface) + +#define IDXSurface_GetColorKey(This,pColorKey) \ + (This)->lpVtbl -> GetColorKey(This,pColorKey) + +#define IDXSurface_SetColorKey(This,ColorKey) \ + (This)->lpVtbl -> SetColorKey(This,ColorKey) + +#define IDXSurface_LockSurfaceDC(This,pBounds,ulTimeOut,dwFlags,ppDCLock) \ + (This)->lpVtbl -> LockSurfaceDC(This,pBounds,ulTimeOut,dwFlags,ppDCLock) + +#define IDXSurface_SetAppData(This,dwAppData) \ + (This)->lpVtbl -> SetAppData(This,dwAppData) + +#define IDXSurface_GetAppData(This,pdwAppData) \ + (This)->lpVtbl -> GetAppData(This,pdwAppData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetPixelFormat_Proxy( + IDXSurface * This, + /* [out] */ GUID *pFormatID, + /* [out] */ DXSAMPLEFORMATENUM *pSampleFormatEnum); + + +void __RPC_STUB IDXSurface_GetPixelFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetBounds_Proxy( + IDXSurface * This, + /* [out] */ DXBNDS *pBounds); + + +void __RPC_STUB IDXSurface_GetBounds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetStatusFlags_Proxy( + IDXSurface * This, + /* [out] */ DWORD *pdwStatusFlags); + + +void __RPC_STUB IDXSurface_GetStatusFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetStatusFlags_Proxy( + IDXSurface * This, + /* [in] */ DWORD dwStatusFlags); + + +void __RPC_STUB IDXSurface_SetStatusFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_LockSurface_Proxy( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppPointer, + /* [out] */ ULONG *pulGenerationId); + + +void __RPC_STUB IDXSurface_LockSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetDirectDrawSurface_Proxy( + IDXSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + +void __RPC_STUB IDXSurface_GetDirectDrawSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetColorKey_Proxy( + IDXSurface * This, + DXSAMPLE *pColorKey); + + +void __RPC_STUB IDXSurface_GetColorKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetColorKey_Proxy( + IDXSurface * This, + DXSAMPLE ColorKey); + + +void __RPC_STUB IDXSurface_SetColorKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_LockSurfaceDC_Proxy( + IDXSurface * This, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ ULONG ulTimeOut, + /* [in] */ DWORD dwFlags, + /* [out] */ IDXDCLock **ppDCLock); + + +void __RPC_STUB IDXSurface_LockSurfaceDC_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_SetAppData_Proxy( + IDXSurface * This, + DWORD_PTR dwAppData); + + +void __RPC_STUB IDXSurface_SetAppData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXSurface_GetAppData_Proxy( + IDXSurface * This, + DWORD_PTR *pdwAppData); + + +void __RPC_STUB IDXSurface_GetAppData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurface_INTERFACE_DEFINED__ */ + + +#ifndef __IDXSurfaceInit_INTERFACE_DEFINED__ +#define __IDXSurfaceInit_INTERFACE_DEFINED__ + +/* interface IDXSurfaceInit */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXSurfaceInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B639-C37D-11d1-905E-00C04FD9189D") + IDXSurfaceInit : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitSurface( + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXSurfaceInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXSurfaceInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXSurfaceInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXSurfaceInit * This); + + HRESULT ( STDMETHODCALLTYPE *InitSurface )( + IDXSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } IDXSurfaceInitVtbl; + + interface IDXSurfaceInit + { + CONST_VTBL struct IDXSurfaceInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXSurfaceInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXSurfaceInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXSurfaceInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXSurfaceInit_InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) \ + (This)->lpVtbl -> InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXSurfaceInit_InitSurface_Proxy( + IDXSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXSurfaceInit_InitSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXSurfaceInit_INTERFACE_DEFINED__ */ + + +#ifndef __IDXARGBSurfaceInit_INTERFACE_DEFINED__ +#define __IDXARGBSurfaceInit_INTERFACE_DEFINED__ + +/* interface IDXARGBSurfaceInit */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBSurfaceInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EA3B63A-C37D-11d1-905E-00C04FD9189D") + IDXARGBSurfaceInit : public IDXSurfaceInit + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromDDSurface( + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromRawSurface( + /* [in] */ IDXRawSurface *pRawSurface) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBSurfaceInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBSurfaceInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBSurfaceInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBSurfaceInit * This); + + HRESULT ( STDMETHODCALLTYPE *InitSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDirectDraw, + /* [in] */ const DDSURFACEDESC *pDDSurfaceDesc, + /* [in] */ const GUID *pFormatID, + /* [in] */ const DXBNDS *pBounds, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *InitFromDDSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags); + + HRESULT ( STDMETHODCALLTYPE *InitFromRawSurface )( + IDXARGBSurfaceInit * This, + /* [in] */ IDXRawSurface *pRawSurface); + + END_INTERFACE + } IDXARGBSurfaceInitVtbl; + + interface IDXARGBSurfaceInit + { + CONST_VTBL struct IDXARGBSurfaceInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBSurfaceInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBSurfaceInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBSurfaceInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBSurfaceInit_InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) \ + (This)->lpVtbl -> InitSurface(This,pDirectDraw,pDDSurfaceDesc,pFormatID,pBounds,dwFlags) + + +#define IDXARGBSurfaceInit_InitFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags) \ + (This)->lpVtbl -> InitFromDDSurface(This,pDDrawSurface,pFormatID,dwFlags) + +#define IDXARGBSurfaceInit_InitFromRawSurface(This,pRawSurface) \ + (This)->lpVtbl -> InitFromRawSurface(This,pRawSurface) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXARGBSurfaceInit_InitFromDDSurface_Proxy( + IDXARGBSurfaceInit * This, + /* [in] */ IUnknown *pDDrawSurface, + /* [in] */ const GUID *pFormatID, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB IDXARGBSurfaceInit_InitFromDDSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXARGBSurfaceInit_InitFromRawSurface_Proxy( + IDXARGBSurfaceInit * This, + /* [in] */ IDXRawSurface *pRawSurface); + + +void __RPC_STUB IDXARGBSurfaceInit_InitFromRawSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBSurfaceInit_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0270 */ +/* [local] */ + +typedef struct tagDXNATIVETYPEINFO + { + BYTE *pCurrentData; + BYTE *pFirstByte; + long lPitch; + DWORD dwColorKey; + } DXNATIVETYPEINFO; + +typedef struct tagDXPACKEDRECTDESC + { + DXBASESAMPLE *pSamples; + BOOL bPremult; + RECT rect; + long lRowPadding; + } DXPACKEDRECTDESC; + +typedef struct tagDXOVERSAMPLEDESC + { + POINT p; + DXPMSAMPLE Color; + } DXOVERSAMPLEDESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0270_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0270_v0_0_s_ifspec; + +#ifndef __IDXARGBReadPtr_INTERFACE_DEFINED__ +#define __IDXARGBReadPtr_INTERFACE_DEFINED__ + +/* interface IDXARGBReadPtr */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBReadPtr; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAAAC2D6-C290-11d1-905D-00C04FD9189D") + IDXARGBReadPtr : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSurface( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface) = 0; + + virtual DXSAMPLEFORMATENUM STDMETHODCALLTYPE GetNativeType( + /* [out] */ DXNATIVETYPEINFO *pInfo) = 0; + + virtual void STDMETHODCALLTYPE Move( + /* [in] */ long cSamples) = 0; + + virtual void STDMETHODCALLTYPE MoveToRow( + /* [in] */ ULONG y) = 0; + + virtual void STDMETHODCALLTYPE MoveToXY( + /* [in] */ ULONG x, + /* [in] */ ULONG y) = 0; + + virtual ULONG STDMETHODCALLTYPE MoveAndGetRunInfo( + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo) = 0; + + virtual DXSAMPLE *STDMETHODCALLTYPE Unpack( + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove) = 0; + + virtual DXPMSAMPLE *STDMETHODCALLTYPE UnpackPremult( + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove) = 0; + + virtual void STDMETHODCALLTYPE UnpackRect( + /* [in] */ const DXPACKEDRECTDESC *pRectDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBReadPtrVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBReadPtr * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBReadPtr * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurface )( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + DXSAMPLEFORMATENUM ( STDMETHODCALLTYPE *GetNativeType )( + IDXARGBReadPtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + void ( STDMETHODCALLTYPE *Move )( + IDXARGBReadPtr * This, + /* [in] */ long cSamples); + + void ( STDMETHODCALLTYPE *MoveToRow )( + IDXARGBReadPtr * This, + /* [in] */ ULONG y); + + void ( STDMETHODCALLTYPE *MoveToXY )( + IDXARGBReadPtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + ULONG ( STDMETHODCALLTYPE *MoveAndGetRunInfo )( + IDXARGBReadPtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + DXSAMPLE *( STDMETHODCALLTYPE *Unpack )( + IDXARGBReadPtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + DXPMSAMPLE *( STDMETHODCALLTYPE *UnpackPremult )( + IDXARGBReadPtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + void ( STDMETHODCALLTYPE *UnpackRect )( + IDXARGBReadPtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + END_INTERFACE + } IDXARGBReadPtrVtbl; + + interface IDXARGBReadPtr + { + CONST_VTBL struct IDXARGBReadPtrVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBReadPtr_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBReadPtr_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBReadPtr_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBReadPtr_GetSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetSurface(This,riid,ppSurface) + +#define IDXARGBReadPtr_GetNativeType(This,pInfo) \ + (This)->lpVtbl -> GetNativeType(This,pInfo) + +#define IDXARGBReadPtr_Move(This,cSamples) \ + (This)->lpVtbl -> Move(This,cSamples) + +#define IDXARGBReadPtr_MoveToRow(This,y) \ + (This)->lpVtbl -> MoveToRow(This,y) + +#define IDXARGBReadPtr_MoveToXY(This,x,y) \ + (This)->lpVtbl -> MoveToXY(This,x,y) + +#define IDXARGBReadPtr_MoveAndGetRunInfo(This,Row,ppInfo) \ + (This)->lpVtbl -> MoveAndGetRunInfo(This,Row,ppInfo) + +#define IDXARGBReadPtr_Unpack(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> Unpack(This,pSamples,cSamples,bMove) + +#define IDXARGBReadPtr_UnpackPremult(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> UnpackPremult(This,pSamples,cSamples,bMove) + +#define IDXARGBReadPtr_UnpackRect(This,pRectDesc) \ + (This)->lpVtbl -> UnpackRect(This,pRectDesc) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXARGBReadPtr_GetSurface_Proxy( + IDXARGBReadPtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + +void __RPC_STUB IDXARGBReadPtr_GetSurface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXSAMPLEFORMATENUM STDMETHODCALLTYPE IDXARGBReadPtr_GetNativeType_Proxy( + IDXARGBReadPtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + +void __RPC_STUB IDXARGBReadPtr_GetNativeType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_Move_Proxy( + IDXARGBReadPtr * This, + /* [in] */ long cSamples); + + +void __RPC_STUB IDXARGBReadPtr_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_MoveToRow_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG y); + + +void __RPC_STUB IDXARGBReadPtr_MoveToRow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_MoveToXY_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + +void __RPC_STUB IDXARGBReadPtr_MoveToXY_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +ULONG STDMETHODCALLTYPE IDXARGBReadPtr_MoveAndGetRunInfo_Proxy( + IDXARGBReadPtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + +void __RPC_STUB IDXARGBReadPtr_MoveAndGetRunInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXSAMPLE *STDMETHODCALLTYPE IDXARGBReadPtr_Unpack_Proxy( + IDXARGBReadPtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + +void __RPC_STUB IDXARGBReadPtr_Unpack_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DXPMSAMPLE *STDMETHODCALLTYPE IDXARGBReadPtr_UnpackPremult_Proxy( + IDXARGBReadPtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + +void __RPC_STUB IDXARGBReadPtr_UnpackPremult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadPtr_UnpackRect_Proxy( + IDXARGBReadPtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + +void __RPC_STUB IDXARGBReadPtr_UnpackRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBReadPtr_INTERFACE_DEFINED__ */ + + +#ifndef __IDXARGBReadWritePtr_INTERFACE_DEFINED__ +#define __IDXARGBReadWritePtr_INTERFACE_DEFINED__ + +/* interface IDXARGBReadWritePtr */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXARGBReadWritePtr; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAAAC2D7-C290-11d1-905D-00C04FD9189D") + IDXARGBReadWritePtr : public IDXARGBReadPtr + { + public: + virtual void STDMETHODCALLTYPE PackAndMove( + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + virtual void STDMETHODCALLTYPE PackPremultAndMove( + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + virtual void STDMETHODCALLTYPE PackRect( + /* [in] */ const DXPACKEDRECTDESC *pRectDesc) = 0; + + virtual void STDMETHODCALLTYPE CopyAndMoveBoth( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque) = 0; + + virtual void STDMETHODCALLTYPE CopyRect( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque) = 0; + + virtual void STDMETHODCALLTYPE FillAndMove( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver) = 0; + + virtual void STDMETHODCALLTYPE FillRect( + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver) = 0; + + virtual void STDMETHODCALLTYPE OverSample( + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc) = 0; + + virtual void STDMETHODCALLTYPE OverArrayAndMove( + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXARGBReadWritePtrVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXARGBReadWritePtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXARGBReadWritePtr * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXARGBReadWritePtr * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurface )( + IDXARGBReadWritePtr * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppSurface); + + DXSAMPLEFORMATENUM ( STDMETHODCALLTYPE *GetNativeType )( + IDXARGBReadWritePtr * This, + /* [out] */ DXNATIVETYPEINFO *pInfo); + + void ( STDMETHODCALLTYPE *Move )( + IDXARGBReadWritePtr * This, + /* [in] */ long cSamples); + + void ( STDMETHODCALLTYPE *MoveToRow )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG y); + + void ( STDMETHODCALLTYPE *MoveToXY )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG x, + /* [in] */ ULONG y); + + ULONG ( STDMETHODCALLTYPE *MoveAndGetRunInfo )( + IDXARGBReadWritePtr * This, + /* [in] */ ULONG Row, + /* [out] */ const DXRUNINFO **ppInfo); + + DXSAMPLE *( STDMETHODCALLTYPE *Unpack )( + IDXARGBReadWritePtr * This, + /* [in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + DXPMSAMPLE *( STDMETHODCALLTYPE *UnpackPremult )( + IDXARGBReadWritePtr * This, + /* [in] */ DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bMove); + + void ( STDMETHODCALLTYPE *UnpackRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + void ( STDMETHODCALLTYPE *PackAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + void ( STDMETHODCALLTYPE *PackPremultAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + void ( STDMETHODCALLTYPE *PackRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + void ( STDMETHODCALLTYPE *CopyAndMoveBoth )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque); + + void ( STDMETHODCALLTYPE *CopyRect )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque); + + void ( STDMETHODCALLTYPE *FillAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver); + + void ( STDMETHODCALLTYPE *FillRect )( + IDXARGBReadWritePtr * This, + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver); + + void ( STDMETHODCALLTYPE *OverSample )( + IDXARGBReadWritePtr * This, + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc); + + void ( STDMETHODCALLTYPE *OverArrayAndMove )( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples); + + END_INTERFACE + } IDXARGBReadWritePtrVtbl; + + interface IDXARGBReadWritePtr + { + CONST_VTBL struct IDXARGBReadWritePtrVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXARGBReadWritePtr_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXARGBReadWritePtr_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXARGBReadWritePtr_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXARGBReadWritePtr_GetSurface(This,riid,ppSurface) \ + (This)->lpVtbl -> GetSurface(This,riid,ppSurface) + +#define IDXARGBReadWritePtr_GetNativeType(This,pInfo) \ + (This)->lpVtbl -> GetNativeType(This,pInfo) + +#define IDXARGBReadWritePtr_Move(This,cSamples) \ + (This)->lpVtbl -> Move(This,cSamples) + +#define IDXARGBReadWritePtr_MoveToRow(This,y) \ + (This)->lpVtbl -> MoveToRow(This,y) + +#define IDXARGBReadWritePtr_MoveToXY(This,x,y) \ + (This)->lpVtbl -> MoveToXY(This,x,y) + +#define IDXARGBReadWritePtr_MoveAndGetRunInfo(This,Row,ppInfo) \ + (This)->lpVtbl -> MoveAndGetRunInfo(This,Row,ppInfo) + +#define IDXARGBReadWritePtr_Unpack(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> Unpack(This,pSamples,cSamples,bMove) + +#define IDXARGBReadWritePtr_UnpackPremult(This,pSamples,cSamples,bMove) \ + (This)->lpVtbl -> UnpackPremult(This,pSamples,cSamples,bMove) + +#define IDXARGBReadWritePtr_UnpackRect(This,pRectDesc) \ + (This)->lpVtbl -> UnpackRect(This,pRectDesc) + + +#define IDXARGBReadWritePtr_PackAndMove(This,pSamples,cSamples) \ + (This)->lpVtbl -> PackAndMove(This,pSamples,cSamples) + +#define IDXARGBReadWritePtr_PackPremultAndMove(This,pSamples,cSamples) \ + (This)->lpVtbl -> PackPremultAndMove(This,pSamples,cSamples) + +#define IDXARGBReadWritePtr_PackRect(This,pRectDesc) \ + (This)->lpVtbl -> PackRect(This,pRectDesc) + +#define IDXARGBReadWritePtr_CopyAndMoveBoth(This,pScratchBuffer,pSrc,cSamples,bIsOpaque) \ + (This)->lpVtbl -> CopyAndMoveBoth(This,pScratchBuffer,pSrc,cSamples,bIsOpaque) + +#define IDXARGBReadWritePtr_CopyRect(This,pScratchBuffer,pDestRect,pSrc,pSrcOrigin,bIsOpaque) \ + (This)->lpVtbl -> CopyRect(This,pScratchBuffer,pDestRect,pSrc,pSrcOrigin,bIsOpaque) + +#define IDXARGBReadWritePtr_FillAndMove(This,pScratchBuffer,SampVal,cSamples,bDoOver) \ + (This)->lpVtbl -> FillAndMove(This,pScratchBuffer,SampVal,cSamples,bDoOver) + +#define IDXARGBReadWritePtr_FillRect(This,pRect,SampVal,bDoOver) \ + (This)->lpVtbl -> FillRect(This,pRect,SampVal,bDoOver) + +#define IDXARGBReadWritePtr_OverSample(This,pOverDesc) \ + (This)->lpVtbl -> OverSample(This,pOverDesc) + +#define IDXARGBReadWritePtr_OverArrayAndMove(This,pScratchBuffer,pSrc,cSamples) \ + (This)->lpVtbl -> OverArrayAndMove(This,pScratchBuffer,pSrc,cSamples) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_PackAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackPremultAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPMSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_PackPremultAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_PackRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXPACKEDRECTDESC *pRectDesc); + + +void __RPC_STUB IDXARGBReadWritePtr_PackRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_CopyAndMoveBoth_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bIsOpaque); + + +void __RPC_STUB IDXARGBReadWritePtr_CopyAndMoveBoth_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_CopyRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const RECT *pDestRect, + /* [in] */ IDXARGBReadPtr *pSrc, + /* [in] */ const POINT *pSrcOrigin, + /* [in] */ BOOL bIsOpaque); + + +void __RPC_STUB IDXARGBReadWritePtr_CopyRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_FillAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ ULONG cSamples, + /* [in] */ BOOL bDoOver); + + +void __RPC_STUB IDXARGBReadWritePtr_FillAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_FillRect_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const RECT *pRect, + /* [in] */ DXPMSAMPLE SampVal, + /* [in] */ BOOL bDoOver); + + +void __RPC_STUB IDXARGBReadWritePtr_FillRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_OverSample_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ const DXOVERSAMPLEDESC *pOverDesc); + + +void __RPC_STUB IDXARGBReadWritePtr_OverSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +void STDMETHODCALLTYPE IDXARGBReadWritePtr_OverArrayAndMove_Proxy( + IDXARGBReadWritePtr * This, + /* [in] */ DXBASESAMPLE *pScratchBuffer, + /* [in] */ const DXPMSAMPLE *pSrc, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXARGBReadWritePtr_OverArrayAndMove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXARGBReadWritePtr_INTERFACE_DEFINED__ */ + + +#ifndef __IDXDCLock_INTERFACE_DEFINED__ +#define __IDXDCLock_INTERFACE_DEFINED__ + +/* interface IDXDCLock */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXDCLock; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0F619456-CF39-11d1-905E-00C04FD9189D") + IDXDCLock : public IUnknown + { + public: + virtual HDC STDMETHODCALLTYPE GetDC( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXDCLockVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXDCLock * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXDCLock * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXDCLock * This); + + HDC ( STDMETHODCALLTYPE *GetDC )( + IDXDCLock * This); + + END_INTERFACE + } IDXDCLockVtbl; + + interface IDXDCLock + { + CONST_VTBL struct IDXDCLockVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXDCLock_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXDCLock_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXDCLock_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXDCLock_GetDC(This) \ + (This)->lpVtbl -> GetDC(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HDC STDMETHODCALLTYPE IDXDCLock_GetDC_Proxy( + IDXDCLock * This); + + +void __RPC_STUB IDXDCLock_GetDC_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXDCLock_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTScaleOutput_INTERFACE_DEFINED__ +#define __IDXTScaleOutput_INTERFACE_DEFINED__ + +/* interface IDXTScaleOutput */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTScaleOutput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B2024B50-EE77-11d1-9066-00C04FD9189D") + IDXTScaleOutput : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetOutputSize( + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTScaleOutputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTScaleOutput * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTScaleOutput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTScaleOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetOutputSize )( + IDXTScaleOutput * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + END_INTERFACE + } IDXTScaleOutputVtbl; + + interface IDXTScaleOutput + { + CONST_VTBL struct IDXTScaleOutputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTScaleOutput_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTScaleOutput_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTScaleOutput_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTScaleOutput_SetOutputSize(This,OutSize,bMaintainAspect) \ + (This)->lpVtbl -> SetOutputSize(This,OutSize,bMaintainAspect) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTScaleOutput_SetOutputSize_Proxy( + IDXTScaleOutput * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + +void __RPC_STUB IDXTScaleOutput_SetOutputSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTScaleOutput_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGradient_INTERFACE_DEFINED__ +#define __IDXGradient_INTERFACE_DEFINED__ + +/* interface IDXGradient */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXGradient; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B2024B51-EE77-11d1-9066-00C04FD9189D") + IDXGradient : public IDXTScaleOutput + { + public: + virtual HRESULT STDMETHODCALLTYPE SetGradient( + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputSize( + /* [out] */ SIZE *pOutSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGradientVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGradient * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGradient * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGradient * This); + + HRESULT ( STDMETHODCALLTYPE *SetOutputSize )( + IDXGradient * This, + /* [in] */ const SIZE OutSize, + /* [in] */ BOOL bMaintainAspect); + + HRESULT ( STDMETHODCALLTYPE *SetGradient )( + IDXGradient * This, + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal); + + HRESULT ( STDMETHODCALLTYPE *GetOutputSize )( + IDXGradient * This, + /* [out] */ SIZE *pOutSize); + + END_INTERFACE + } IDXGradientVtbl; + + interface IDXGradient + { + CONST_VTBL struct IDXGradientVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGradient_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXGradient_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXGradient_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXGradient_SetOutputSize(This,OutSize,bMaintainAspect) \ + (This)->lpVtbl -> SetOutputSize(This,OutSize,bMaintainAspect) + + +#define IDXGradient_SetGradient(This,StartColor,EndColor,bHorizontal) \ + (This)->lpVtbl -> SetGradient(This,StartColor,EndColor,bHorizontal) + +#define IDXGradient_GetOutputSize(This,pOutSize) \ + (This)->lpVtbl -> GetOutputSize(This,pOutSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXGradient_SetGradient_Proxy( + IDXGradient * This, + DXSAMPLE StartColor, + DXSAMPLE EndColor, + BOOL bHorizontal); + + +void __RPC_STUB IDXGradient_SetGradient_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXGradient_GetOutputSize_Proxy( + IDXGradient * This, + /* [out] */ SIZE *pOutSize); + + +void __RPC_STUB IDXGradient_GetOutputSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXGradient_INTERFACE_DEFINED__ */ + + +#ifndef __IDXTScale_INTERFACE_DEFINED__ +#define __IDXTScale_INTERFACE_DEFINED__ + +/* interface IDXTScale */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXTScale; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B39FD742-E139-11d1-9065-00C04FD9189D") + IDXTScale : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetScales( + /* [in] */ float Scales[ 2 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetScales( + /* [out] */ float Scales[ 2 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleFitToSize( + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXTScaleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXTScale * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXTScale * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXTScale * This); + + HRESULT ( STDMETHODCALLTYPE *SetScales )( + IDXTScale * This, + /* [in] */ float Scales[ 2 ]); + + HRESULT ( STDMETHODCALLTYPE *GetScales )( + IDXTScale * This, + /* [out] */ float Scales[ 2 ]); + + HRESULT ( STDMETHODCALLTYPE *ScaleFitToSize )( + IDXTScale * This, + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect); + + END_INTERFACE + } IDXTScaleVtbl; + + interface IDXTScale + { + CONST_VTBL struct IDXTScaleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXTScale_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXTScale_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXTScale_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXTScale_SetScales(This,Scales) \ + (This)->lpVtbl -> SetScales(This,Scales) + +#define IDXTScale_GetScales(This,Scales) \ + (This)->lpVtbl -> GetScales(This,Scales) + +#define IDXTScale_ScaleFitToSize(This,pClipBounds,FitToSize,bMaintainAspect) \ + (This)->lpVtbl -> ScaleFitToSize(This,pClipBounds,FitToSize,bMaintainAspect) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXTScale_SetScales_Proxy( + IDXTScale * This, + /* [in] */ float Scales[ 2 ]); + + +void __RPC_STUB IDXTScale_SetScales_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTScale_GetScales_Proxy( + IDXTScale * This, + /* [out] */ float Scales[ 2 ]); + + +void __RPC_STUB IDXTScale_GetScales_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXTScale_ScaleFitToSize_Proxy( + IDXTScale * This, + /* [out][in] */ DXBNDS *pClipBounds, + /* [in] */ SIZE FitToSize, + /* [in] */ BOOL bMaintainAspect); + + +void __RPC_STUB IDXTScale_ScaleFitToSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXTScale_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0276 */ +/* [local] */ + +typedef +enum DISPIDDXEFFECT + { DISPID_DXECAPABILITIES = 10000, + DISPID_DXEPROGRESS = DISPID_DXECAPABILITIES + 1, + DISPID_DXESTEP = DISPID_DXEPROGRESS + 1, + DISPID_DXEDURATION = DISPID_DXESTEP + 1, + DISPID_DXE_NEXT_ID = DISPID_DXEDURATION + 1 + } DISPIDDXBOUNDEDEFFECT; + +typedef +enum DXEFFECTTYPE + { DXTET_PERIODIC = 1 << 0, + DXTET_MORPH = 1 << 1 + } DXEFFECTTYPE; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0276_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0276_v0_0_s_ifspec; + +#ifndef __IDXEffect_INTERFACE_DEFINED__ +#define __IDXEffect_INTERFACE_DEFINED__ + +/* interface IDXEffect */ +/* [dual][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXEffect; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E31FB81B-1335-11d1-8189-0000F87557DB") + IDXEffect : public IDispatch + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Capabilities( + /* [retval][out] */ long *pVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Progress( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Progress( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_StepResolution( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Duration( + /* [in] */ float newVal) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXEffectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXEffect * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXEffect * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXEffect * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + IDXEffect * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + IDXEffect * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + IDXEffect * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + IDXEffect * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Capabilities )( + IDXEffect * This, + /* [retval][out] */ long *pVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Progress )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Progress )( + IDXEffect * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StepResolution )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( + IDXEffect * This, + /* [in] */ float newVal); + + END_INTERFACE + } IDXEffectVtbl; + + interface IDXEffect + { + CONST_VTBL struct IDXEffectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXEffect_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXEffect_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXEffect_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXEffect_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IDXEffect_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IDXEffect_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IDXEffect_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IDXEffect_get_Capabilities(This,pVal) \ + (This)->lpVtbl -> get_Capabilities(This,pVal) + +#define IDXEffect_get_Progress(This,pVal) \ + (This)->lpVtbl -> get_Progress(This,pVal) + +#define IDXEffect_put_Progress(This,newVal) \ + (This)->lpVtbl -> put_Progress(This,newVal) + +#define IDXEffect_get_StepResolution(This,pVal) \ + (This)->lpVtbl -> get_StepResolution(This,pVal) + +#define IDXEffect_get_Duration(This,pVal) \ + (This)->lpVtbl -> get_Duration(This,pVal) + +#define IDXEffect_put_Duration(This,newVal) \ + (This)->lpVtbl -> put_Duration(This,newVal) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Capabilities_Proxy( + IDXEffect * This, + /* [retval][out] */ long *pVal); + + +void __RPC_STUB IDXEffect_get_Capabilities_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Progress_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_Progress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE IDXEffect_put_Progress_Proxy( + IDXEffect * This, + /* [in] */ float newVal); + + +void __RPC_STUB IDXEffect_put_Progress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_StepResolution_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_StepResolution_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE IDXEffect_get_Duration_Proxy( + IDXEffect * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB IDXEffect_get_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE IDXEffect_put_Duration_Proxy( + IDXEffect * This, + /* [in] */ float newVal); + + +void __RPC_STUB IDXEffect_put_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXEffect_INTERFACE_DEFINED__ */ + + +#ifndef __IDXLookupTable_INTERFACE_DEFINED__ +#define __IDXLookupTable_INTERFACE_DEFINED__ + +/* interface IDXLookupTable */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXLookupTable; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("01BAFC7F-9E63-11d1-9053-00C04FD9189D") + IDXLookupTable : public IDXBaseObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetTables( + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsChannelIdentity( + /* [out] */ DXBASESAMPLE *pSampleBools) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetIndexValues( + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyTables( + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXLookupTableVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXLookupTable * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXLookupTable * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXLookupTable * This); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationId )( + IDXLookupTable * This, + /* [out] */ ULONG *pID); + + HRESULT ( STDMETHODCALLTYPE *IncrementGenerationId )( + IDXLookupTable * This, + /* [in] */ BOOL bRefresh); + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + IDXLookupTable * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *GetTables )( + IDXLookupTable * This, + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]); + + HRESULT ( STDMETHODCALLTYPE *IsChannelIdentity )( + IDXLookupTable * This, + /* [out] */ DXBASESAMPLE *pSampleBools); + + HRESULT ( STDMETHODCALLTYPE *GetIndexValues )( + IDXLookupTable * This, + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample); + + HRESULT ( STDMETHODCALLTYPE *ApplyTables )( + IDXLookupTable * This, + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + END_INTERFACE + } IDXLookupTableVtbl; + + interface IDXLookupTable + { + CONST_VTBL struct IDXLookupTableVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXLookupTable_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXLookupTable_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXLookupTable_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXLookupTable_GetGenerationId(This,pID) \ + (This)->lpVtbl -> GetGenerationId(This,pID) + +#define IDXLookupTable_IncrementGenerationId(This,bRefresh) \ + (This)->lpVtbl -> IncrementGenerationId(This,bRefresh) + +#define IDXLookupTable_GetObjectSize(This,pcbSize) \ + (This)->lpVtbl -> GetObjectSize(This,pcbSize) + + +#define IDXLookupTable_GetTables(This,RedLUT,GreenLUT,BlueLUT,AlphaLUT) \ + (This)->lpVtbl -> GetTables(This,RedLUT,GreenLUT,BlueLUT,AlphaLUT) + +#define IDXLookupTable_IsChannelIdentity(This,pSampleBools) \ + (This)->lpVtbl -> IsChannelIdentity(This,pSampleBools) + +#define IDXLookupTable_GetIndexValues(This,Index,pSample) \ + (This)->lpVtbl -> GetIndexValues(This,Index,pSample) + +#define IDXLookupTable_ApplyTables(This,pSamples,cSamples) \ + (This)->lpVtbl -> ApplyTables(This,pSamples,cSamples) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_GetTables_Proxy( + IDXLookupTable * This, + /* [out] */ BYTE RedLUT[ 256 ], + /* [out] */ BYTE GreenLUT[ 256 ], + /* [out] */ BYTE BlueLUT[ 256 ], + /* [out] */ BYTE AlphaLUT[ 256 ]); + + +void __RPC_STUB IDXLookupTable_GetTables_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_IsChannelIdentity_Proxy( + IDXLookupTable * This, + /* [out] */ DXBASESAMPLE *pSampleBools); + + +void __RPC_STUB IDXLookupTable_IsChannelIdentity_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_GetIndexValues_Proxy( + IDXLookupTable * This, + /* [in] */ ULONG Index, + /* [out] */ DXBASESAMPLE *pSample); + + +void __RPC_STUB IDXLookupTable_GetIndexValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IDXLookupTable_ApplyTables_Proxy( + IDXLookupTable * This, + /* [out][in] */ DXSAMPLE *pSamples, + /* [in] */ ULONG cSamples); + + +void __RPC_STUB IDXLookupTable_ApplyTables_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXLookupTable_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0278 */ +/* [local] */ + +typedef struct DXRAWSURFACEINFO + { + BYTE *pFirstByte; + long lPitch; + ULONG Width; + ULONG Height; + const GUID *pPixelFormat; + HDC hdc; + DWORD dwColorKey; + DXBASESAMPLE *pPalette; + } DXRAWSURFACEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0278_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0278_v0_0_s_ifspec; + +#ifndef __IDXRawSurface_INTERFACE_DEFINED__ +#define __IDXRawSurface_INTERFACE_DEFINED__ + +/* interface IDXRawSurface */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDXRawSurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("09756C8A-D96A-11d1-9062-00C04FD9189D") + IDXRawSurface : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSurfaceInfo( + DXRAWSURFACEINFO *pSurfaceInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXRawSurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXRawSurface * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXRawSurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXRawSurface * This); + + HRESULT ( STDMETHODCALLTYPE *GetSurfaceInfo )( + IDXRawSurface * This, + DXRAWSURFACEINFO *pSurfaceInfo); + + END_INTERFACE + } IDXRawSurfaceVtbl; + + interface IDXRawSurface + { + CONST_VTBL struct IDXRawSurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXRawSurface_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IDXRawSurface_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IDXRawSurface_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IDXRawSurface_GetSurfaceInfo(This,pSurfaceInfo) \ + (This)->lpVtbl -> GetSurfaceInfo(This,pSurfaceInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IDXRawSurface_GetSurfaceInfo_Proxy( + IDXRawSurface * This, + DXRAWSURFACEINFO *pSurfaceInfo); + + +void __RPC_STUB IDXRawSurface_GetSurfaceInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IDXRawSurface_INTERFACE_DEFINED__ */ + + +#ifndef __IHTMLDXTransform_INTERFACE_DEFINED__ +#define __IHTMLDXTransform_INTERFACE_DEFINED__ + +/* interface IHTMLDXTransform */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IHTMLDXTransform; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30E2AB7D-4FDD-4159-B7EA-DC722BF4ADE5") + IHTMLDXTransform : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetHostUrl( + BSTR bstrHostUrl) = 0; + + }; + +#else /* C style interface */ + + typedef struct IHTMLDXTransformVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IHTMLDXTransform * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IHTMLDXTransform * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IHTMLDXTransform * This); + + HRESULT ( STDMETHODCALLTYPE *SetHostUrl )( + IHTMLDXTransform * This, + BSTR bstrHostUrl); + + END_INTERFACE + } IHTMLDXTransformVtbl; + + interface IHTMLDXTransform + { + CONST_VTBL struct IHTMLDXTransformVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IHTMLDXTransform_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IHTMLDXTransform_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IHTMLDXTransform_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IHTMLDXTransform_SetHostUrl(This,bstrHostUrl) \ + (This)->lpVtbl -> SetHostUrl(This,bstrHostUrl) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IHTMLDXTransform_SetHostUrl_Proxy( + IHTMLDXTransform * This, + BSTR bstrHostUrl); + + +void __RPC_STUB IHTMLDXTransform_SetHostUrl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IHTMLDXTransform_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxtrans_0280 */ +/* [local] */ + +typedef +enum DXTFILTER_STATUS + { DXTFILTER_STATUS_Stopped = 0, + DXTFILTER_STATUS_Applied = DXTFILTER_STATUS_Stopped + 1, + DXTFILTER_STATUS_Playing = DXTFILTER_STATUS_Applied + 1, + DXTFILTER_STATUS_MAX = DXTFILTER_STATUS_Playing + 1 + } DXTFILTER_STATUS; + +typedef +enum DXTFILTER_DISPID + { DISPID_DXTFilter_Percent = 1, + DISPID_DXTFilter_Duration = DISPID_DXTFilter_Percent + 1, + DISPID_DXTFilter_Enabled = DISPID_DXTFilter_Duration + 1, + DISPID_DXTFilter_Status = DISPID_DXTFilter_Enabled + 1, + DISPID_DXTFilter_Apply = DISPID_DXTFilter_Status + 1, + DISPID_DXTFilter_Play = DISPID_DXTFilter_Apply + 1, + DISPID_DXTFilter_Stop = DISPID_DXTFilter_Play + 1, + DISPID_DXTFilter_MAX = DISPID_DXTFilter_Stop + 1 + } DXTFILTER_DISPID; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0280_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxtrans_0280_v0_0_s_ifspec; + +#ifndef __ICSSFilterDispatch_INTERFACE_DEFINED__ +#define __ICSSFilterDispatch_INTERFACE_DEFINED__ + +/* interface ICSSFilterDispatch */ +/* [dual][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ICSSFilterDispatch; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9519152B-9484-4A6C-B6A7-4F25E92D6C6B") + ICSSFilterDispatch : public IDispatch + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Percent( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Percent( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( + /* [retval][out] */ float *pVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Duration( + /* [in] */ float newVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( + /* [retval][out] */ VARIANT_BOOL *pfVal) = 0; + + virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( + /* [in] */ VARIANT_BOOL fVal) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ DXTFILTER_STATUS *peVal) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Apply( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Play( + /* [optional][in] */ VARIANT varDuration) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ICSSFilterDispatchVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICSSFilterDispatch * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICSSFilterDispatch * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICSSFilterDispatch * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ICSSFilterDispatch * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ICSSFilterDispatch * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ICSSFilterDispatch * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ICSSFilterDispatch * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Percent )( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Percent )( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Duration )( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Enabled )( + ICSSFilterDispatch * This, + /* [retval][out] */ VARIANT_BOOL *pfVal); + + /* [id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Enabled )( + ICSSFilterDispatch * This, + /* [in] */ VARIANT_BOOL fVal); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ICSSFilterDispatch * This, + /* [retval][out] */ DXTFILTER_STATUS *peVal); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Apply )( + ICSSFilterDispatch * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Play )( + ICSSFilterDispatch * This, + /* [optional][in] */ VARIANT varDuration); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE *Stop )( + ICSSFilterDispatch * This); + + END_INTERFACE + } ICSSFilterDispatchVtbl; + + interface ICSSFilterDispatch + { + CONST_VTBL struct ICSSFilterDispatchVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICSSFilterDispatch_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ICSSFilterDispatch_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ICSSFilterDispatch_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ICSSFilterDispatch_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ICSSFilterDispatch_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ICSSFilterDispatch_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ICSSFilterDispatch_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ICSSFilterDispatch_get_Percent(This,pVal) \ + (This)->lpVtbl -> get_Percent(This,pVal) + +#define ICSSFilterDispatch_put_Percent(This,newVal) \ + (This)->lpVtbl -> put_Percent(This,newVal) + +#define ICSSFilterDispatch_get_Duration(This,pVal) \ + (This)->lpVtbl -> get_Duration(This,pVal) + +#define ICSSFilterDispatch_put_Duration(This,newVal) \ + (This)->lpVtbl -> put_Duration(This,newVal) + +#define ICSSFilterDispatch_get_Enabled(This,pfVal) \ + (This)->lpVtbl -> get_Enabled(This,pfVal) + +#define ICSSFilterDispatch_put_Enabled(This,fVal) \ + (This)->lpVtbl -> put_Enabled(This,fVal) + +#define ICSSFilterDispatch_get_Status(This,peVal) \ + (This)->lpVtbl -> get_Status(This,peVal) + +#define ICSSFilterDispatch_Apply(This) \ + (This)->lpVtbl -> Apply(This) + +#define ICSSFilterDispatch_Play(This,varDuration) \ + (This)->lpVtbl -> Play(This,varDuration) + +#define ICSSFilterDispatch_Stop(This) \ + (This)->lpVtbl -> Stop(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Percent_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Percent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Percent_Proxy( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Percent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Duration_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ float *pVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Duration_Proxy( + ICSSFilterDispatch * This, + /* [in] */ float newVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Duration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Enabled_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ VARIANT_BOOL *pfVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Enabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propput] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_put_Enabled_Proxy( + ICSSFilterDispatch * This, + /* [in] */ VARIANT_BOOL fVal); + + +void __RPC_STUB ICSSFilterDispatch_put_Enabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_get_Status_Proxy( + ICSSFilterDispatch * This, + /* [retval][out] */ DXTFILTER_STATUS *peVal); + + +void __RPC_STUB ICSSFilterDispatch_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Apply_Proxy( + ICSSFilterDispatch * This); + + +void __RPC_STUB ICSSFilterDispatch_Apply_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Play_Proxy( + ICSSFilterDispatch * This, + /* [optional][in] */ VARIANT varDuration); + + +void __RPC_STUB ICSSFilterDispatch_Play_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ICSSFilterDispatch_Stop_Proxy( + ICSSFilterDispatch * This); + + +void __RPC_STUB ICSSFilterDispatch_Stop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ICSSFilterDispatch_INTERFACE_DEFINED__ */ + + + +#ifndef __DXTRANSLib_LIBRARY_DEFINED__ +#define __DXTRANSLib_LIBRARY_DEFINED__ + +/* library DXTRANSLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_DXTRANSLib; + +EXTERN_C const CLSID CLSID_DXTransformFactory; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D1FE6762-FC48-11D0-883A-3C8B00C10000") +DXTransformFactory; +#endif + +EXTERN_C const CLSID CLSID_DXTaskManager; + +#ifdef __cplusplus + +class DECLSPEC_UUID("4CB26C03-FF93-11d0-817E-0000F87557DB") +DXTaskManager; +#endif + +EXTERN_C const CLSID CLSID_DXTScale; + +#ifdef __cplusplus + +class DECLSPEC_UUID("555278E2-05DB-11D1-883A-3C8B00C10000") +DXTScale; +#endif + +EXTERN_C const CLSID CLSID_DXSurface; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0E890F83-5F79-11D1-9043-00C04FD9189D") +DXSurface; +#endif + +EXTERN_C const CLSID CLSID_DXSurfaceModifier; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3E669F1D-9C23-11d1-9053-00C04FD9189D") +DXSurfaceModifier; +#endif + +EXTERN_C const CLSID CLSID_DXGradient; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C6365470-F667-11d1-9067-00C04FD9189D") +DXGradient; +#endif + +EXTERN_C const CLSID CLSID_DXTFilter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("385A91BC-1E8A-4e4a-A7A6-F4FC1E6CA1BD") +DXTFilter; +#endif +#endif /* __DXTRANSLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long *, unsigned long , VARIANT * ); +unsigned char * __RPC_USER VARIANT_UserMarshal( unsigned long *, unsigned char *, VARIANT * ); +unsigned char * __RPC_USER VARIANT_UserUnmarshal(unsigned long *, unsigned char *, VARIANT * ); +void __RPC_USER VARIANT_UserFree( unsigned long *, VARIANT * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/gameux.h b/SDK/dxSDK/Include/gameux.h new file mode 100644 index 00000000..2e28a5fb --- /dev/null +++ b/SDK/dxSDK/Include/gameux.h @@ -0,0 +1,250 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0486 */ +/* Compiler settings for gameux.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __gameux_h__ +#define __gameux_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IGameExplorer_FWD_DEFINED__ +#define __IGameExplorer_FWD_DEFINED__ +typedef interface IGameExplorer IGameExplorer; +#endif /* __IGameExplorer_FWD_DEFINED__ */ + + +#ifndef __GameExplorer_FWD_DEFINED__ +#define __GameExplorer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GameExplorer GameExplorer; +#else +typedef struct GameExplorer GameExplorer; +#endif /* __cplusplus */ + +#endif /* __GameExplorer_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "shobjidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_gameux_0000_0000 */ +/* [local] */ + +#define ID_GDF_XML __GDF_XML +#define ID_GDF_THUMBNAIL __GDF_THUMBNAIL +#define ID_ICON_ICO __ICON_ICO +#define ID_GDF_XML_STR L"__GDF_XML" +#define ID_GDF_THUMBNAIL_STR L"__GDF_THUMBNAIL" +typedef /* [v1_enum] */ +enum GAME_INSTALL_SCOPE + { GIS_NOT_INSTALLED = 1, + GIS_CURRENT_USER = 2, + GIS_ALL_USERS = 3 + } GAME_INSTALL_SCOPE; + + + +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0000_v0_0_s_ifspec; + +#ifndef __IGameExplorer_INTERFACE_DEFINED__ +#define __IGameExplorer_INTERFACE_DEFINED__ + +/* interface IGameExplorer */ +/* [unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IGameExplorer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E7B2FB72-D728-49B3-A5F2-18EBF5F1349E") + IGameExplorer : public IUnknown + { + public: + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddGame( + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [in] */ __RPC__in BSTR bstrGameInstallDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope, + /* [out][in] */ __RPC__inout GUID *pguidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveGame( + /* [in] */ GUID guidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UpdateGame( + /* [in] */ GUID guidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VerifyAccess( + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [out] */ __RPC__out BOOL *pfHasAccess) = 0; + + }; + +#else /* C style interface */ + + typedef struct IGameExplorerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IGameExplorer * This, + /* [in] */ __RPC__in REFIID riid, + /* [iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IGameExplorer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IGameExplorer * This); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddGame )( + IGameExplorer * This, + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [in] */ __RPC__in BSTR bstrGameInstallDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope, + /* [out][in] */ __RPC__inout GUID *pguidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveGame )( + IGameExplorer * This, + /* [in] */ GUID guidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *UpdateGame )( + IGameExplorer * This, + /* [in] */ GUID guidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VerifyAccess )( + IGameExplorer * This, + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [out] */ __RPC__out BOOL *pfHasAccess); + + END_INTERFACE + } IGameExplorerVtbl; + + interface IGameExplorer + { + CONST_VTBL struct IGameExplorerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IGameExplorer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IGameExplorer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IGameExplorer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IGameExplorer_AddGame(This,bstrGDFBinaryPath,bstrGameInstallDirectory,installScope,pguidInstanceID) \ + ( (This)->lpVtbl -> AddGame(This,bstrGDFBinaryPath,bstrGameInstallDirectory,installScope,pguidInstanceID) ) + +#define IGameExplorer_RemoveGame(This,guidInstanceID) \ + ( (This)->lpVtbl -> RemoveGame(This,guidInstanceID) ) + +#define IGameExplorer_UpdateGame(This,guidInstanceID) \ + ( (This)->lpVtbl -> UpdateGame(This,guidInstanceID) ) + +#define IGameExplorer_VerifyAccess(This,bstrGDFBinaryPath,pfHasAccess) \ + ( (This)->lpVtbl -> VerifyAccess(This,bstrGDFBinaryPath,pfHasAccess) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IGameExplorer_INTERFACE_DEFINED__ */ + + + +#ifndef __gameuxLib_LIBRARY_DEFINED__ +#define __gameuxLib_LIBRARY_DEFINED__ + +/* library gameuxLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_gameuxLib; + +EXTERN_C const CLSID CLSID_GameExplorer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9A5EA990-3034-4D6F-9128-01F3C61022BC") +GameExplorer; +#endif +#endif /* __gameuxLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); +void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/SDK/dxSDK/Include/multimon.h b/SDK/dxSDK/Include/multimon.h new file mode 100644 index 00000000..88e2862a --- /dev/null +++ b/SDK/dxSDK/Include/multimon.h @@ -0,0 +1,484 @@ +//============================================================================= +// +// multimon.h -- Stub module that fakes multiple monitor apis on Win32 OSes +// without them. +// +// By using this header your code will get back default values from +// GetSystemMetrics() for new metrics, and the new multimonitor APIs +// will act like only one display is present on a Win32 OS without +// multimonitor APIs. +// +// Exactly one source must include this with COMPILE_MULTIMON_STUBS defined. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +//============================================================================= + +#ifdef __cplusplus +extern "C" { // Assume C declarations for C++ +#endif // __cplusplus + +// +// If we are building with Win95/NT4 headers, we need to declare +// the multimonitor-related metrics and APIs ourselves. +// +#ifndef SM_CMONITORS + +#define SM_XVIRTUALSCREEN 76 +#define SM_YVIRTUALSCREEN 77 +#define SM_CXVIRTUALSCREEN 78 +#define SM_CYVIRTUALSCREEN 79 +#define SM_CMONITORS 80 +#define SM_SAMEDISPLAYFORMAT 81 + +// HMONITOR is already declared if WINVER >= 0x0500 in windef.h +// This is for components built with an older version number. +// +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) +DECLARE_HANDLE(HMONITOR); +#define HMONITOR_DECLARED +#endif + +#define MONITOR_DEFAULTTONULL 0x00000000 +#define MONITOR_DEFAULTTOPRIMARY 0x00000001 +#define MONITOR_DEFAULTTONEAREST 0x00000002 + +#define MONITORINFOF_PRIMARY 0x00000001 + +typedef struct tagMONITORINFO +{ + DWORD cbSize; + RECT rcMonitor; + RECT rcWork; + DWORD dwFlags; +} MONITORINFO, *LPMONITORINFO; + +#ifndef CCHDEVICENAME +#define CCHDEVICENAME 32 +#endif + +#ifdef __cplusplus +typedef struct tagMONITORINFOEXA : public tagMONITORINFO +{ + CHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXA, *LPMONITORINFOEXA; +typedef struct tagMONITORINFOEXW : public tagMONITORINFO +{ + WCHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXW, *LPMONITORINFOEXW; +#ifdef UNICODE +typedef MONITORINFOEXW MONITORINFOEX; +typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else +typedef MONITORINFOEXA MONITORINFOEX; +typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif // UNICODE +#else // ndef __cplusplus +typedef struct tagMONITORINFOEXA +{ + MONITORINFO; + CHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXA, *LPMONITORINFOEXA; +typedef struct tagMONITORINFOEXW +{ + MONITORINFO; + WCHAR szDevice[CCHDEVICENAME]; +} MONITORINFOEXW, *LPMONITORINFOEXW; +#ifdef UNICODE +typedef MONITORINFOEXW MONITORINFOEX; +typedef LPMONITORINFOEXW LPMONITORINFOEX; +#else +typedef MONITORINFOEXA MONITORINFOEX; +typedef LPMONITORINFOEXA LPMONITORINFOEX; +#endif // UNICODE +#endif + +typedef BOOL (CALLBACK* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM); + +#ifndef DISPLAY_DEVICE_ATTACHED_TO_DESKTOP +typedef struct _DISPLAY_DEVICEA { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD StateFlags; + CHAR DeviceID[128]; + CHAR DeviceKey[128]; +} DISPLAY_DEVICEA, *PDISPLAY_DEVICEA, *LPDISPLAY_DEVICEA; +typedef struct _DISPLAY_DEVICEW { + DWORD cb; + WCHAR DeviceName[32]; + WCHAR DeviceString[128]; + DWORD StateFlags; + WCHAR DeviceID[128]; + WCHAR DeviceKey[128]; +} DISPLAY_DEVICEW, *PDISPLAY_DEVICEW, *LPDISPLAY_DEVICEW; +#ifdef UNICODE +typedef DISPLAY_DEVICEW DISPLAY_DEVICE; +typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; +typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; +#else +typedef DISPLAY_DEVICEA DISPLAY_DEVICE; +typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE; +typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE; +#endif // UNICODE + +#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 +#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 +#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 +#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008 +#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010 +#endif + +#endif // SM_CMONITORS + +#undef GetMonitorInfo +#undef GetSystemMetrics +#undef MonitorFromWindow +#undef MonitorFromRect +#undef MonitorFromPoint +#undef EnumDisplayMonitors +#undef EnumDisplayDevices + +// +// Define COMPILE_MULTIMON_STUBS to compile the stubs; +// otherwise, you get the declarations. +// +#ifdef COMPILE_MULTIMON_STUBS + +//----------------------------------------------------------------------------- +// +// Implement the API stubs. +// +//----------------------------------------------------------------------------- + +#ifndef MULTIMON_FNS_DEFINED + +int (WINAPI* g_pfnGetSystemMetrics)(int) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromWindow)(HWND, DWORD) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromRect)(LPCRECT, DWORD) = NULL; +HMONITOR (WINAPI* g_pfnMonitorFromPoint)(POINT, DWORD) = NULL; +BOOL (WINAPI* g_pfnGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL; +BOOL (WINAPI* g_pfnEnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM) = NULL; +BOOL (WINAPI* g_pfnEnumDisplayDevices)(PVOID, DWORD, PDISPLAY_DEVICE,DWORD) = NULL; +BOOL g_fMultiMonInitDone = FALSE; +BOOL g_fMultimonPlatformNT = FALSE; + +#endif + +BOOL IsPlatformNT() +{ + OSVERSIONINFOA osvi = {0}; + osvi.dwOSVersionInfoSize = sizeof(osvi); + GetVersionExA((OSVERSIONINFOA*)&osvi); + return (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId); +} + +BOOL InitMultipleMonitorStubs(void) +{ + HMODULE hUser32; + if (g_fMultiMonInitDone) + { + return g_pfnGetMonitorInfo != NULL; + } + + g_fMultimonPlatformNT = IsPlatformNT(); + hUser32 = GetModuleHandle(TEXT("USER32")); + if (hUser32 && + (*(FARPROC*)&g_pfnGetSystemMetrics = GetProcAddress(hUser32,"GetSystemMetrics")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromWindow = GetProcAddress(hUser32,"MonitorFromWindow")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromRect = GetProcAddress(hUser32,"MonitorFromRect")) != NULL && + (*(FARPROC*)&g_pfnMonitorFromPoint = GetProcAddress(hUser32,"MonitorFromPoint")) != NULL && + (*(FARPROC*)&g_pfnEnumDisplayMonitors = GetProcAddress(hUser32,"EnumDisplayMonitors")) != NULL && +#ifdef UNICODE + (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesW")) != NULL && + (*(FARPROC*)&g_pfnGetMonitorInfo = g_fMultimonPlatformNT ? GetProcAddress(hUser32,"GetMonitorInfoW") : + GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL +#else + (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoA")) != NULL && + (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesA")) != NULL +#endif + ) { + g_fMultiMonInitDone = TRUE; + return TRUE; + } + else + { + g_pfnGetSystemMetrics = NULL; + g_pfnMonitorFromWindow = NULL; + g_pfnMonitorFromRect = NULL; + g_pfnMonitorFromPoint = NULL; + g_pfnGetMonitorInfo = NULL; + g_pfnEnumDisplayMonitors = NULL; + g_pfnEnumDisplayDevices = NULL; + + g_fMultiMonInitDone = TRUE; + return FALSE; + } +} + +//----------------------------------------------------------------------------- +// +// fake implementations of Monitor APIs that work with the primary display +// no special parameter validation is made since these run in client code +// +//----------------------------------------------------------------------------- + +int WINAPI +xGetSystemMetrics(int nIndex) +{ + if (InitMultipleMonitorStubs()) + return g_pfnGetSystemMetrics(nIndex); + + switch (nIndex) + { + case SM_CMONITORS: + case SM_SAMEDISPLAYFORMAT: + return 1; + + case SM_XVIRTUALSCREEN: + case SM_YVIRTUALSCREEN: + return 0; + + case SM_CXVIRTUALSCREEN: + nIndex = SM_CXSCREEN; + break; + + case SM_CYVIRTUALSCREEN: + nIndex = SM_CYSCREEN; + break; + } + + return GetSystemMetrics(nIndex); +} + +#define xPRIMARY_MONITOR ((HMONITOR)0x12340042) + +HMONITOR WINAPI +xMonitorFromPoint(POINT ptScreenCoords, DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromPoint(ptScreenCoords, dwFlags); + + if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) || + ((ptScreenCoords.x >= 0) && + (ptScreenCoords.x < GetSystemMetrics(SM_CXSCREEN)) && + (ptScreenCoords.y >= 0) && + (ptScreenCoords.y < GetSystemMetrics(SM_CYSCREEN)))) + { + return xPRIMARY_MONITOR; + } + + return NULL; +} + +HMONITOR WINAPI +xMonitorFromRect(LPCRECT lprcScreenCoords, DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromRect(lprcScreenCoords, dwFlags); + + if ((dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) || + ((lprcScreenCoords->right > 0) && + (lprcScreenCoords->bottom > 0) && + (lprcScreenCoords->left < GetSystemMetrics(SM_CXSCREEN)) && + (lprcScreenCoords->top < GetSystemMetrics(SM_CYSCREEN)))) + { + return xPRIMARY_MONITOR; + } + + return NULL; +} + +HMONITOR WINAPI +xMonitorFromWindow(HWND hWnd, DWORD dwFlags) +{ + WINDOWPLACEMENT wp; + + if (InitMultipleMonitorStubs()) + return g_pfnMonitorFromWindow(hWnd, dwFlags); + + if (dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST)) + return xPRIMARY_MONITOR; + + if (IsIconic(hWnd) ? + GetWindowPlacement(hWnd, &wp) : + GetWindowRect(hWnd, &wp.rcNormalPosition)) { + + return xMonitorFromRect(&wp.rcNormalPosition, dwFlags); + } + + return NULL; +} + +BOOL WINAPI +xGetMonitorInfo(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo) +{ + RECT rcWork; + + if (InitMultipleMonitorStubs()) + { + BOOL f = g_pfnGetMonitorInfo(hMonitor, lpMonitorInfo); +#ifdef UNICODE + if (f && !g_fMultimonPlatformNT && (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX))) + { + MultiByteToWideChar(CP_ACP, 0, + (LPSTR)((MONITORINFOEX*)lpMonitorInfo)->szDevice, -1, + ((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR))); + } +#endif + return f; + } + + if ((hMonitor == xPRIMARY_MONITOR) && + lpMonitorInfo && + (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && + SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0)) + { + lpMonitorInfo->rcMonitor.left = 0; + lpMonitorInfo->rcMonitor.top = 0; + lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN); + lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN); + lpMonitorInfo->rcWork = rcWork; + lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY; + + if (lpMonitorInfo->cbSize >= sizeof(MONITORINFOEX)) + { +#ifdef UNICODE + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, ((MONITORINFOEX*)lpMonitorInfo)->szDevice, (sizeof(((MONITORINFOEX*)lpMonitorInfo)->szDevice)/sizeof(TCHAR))); +#else // UNICODE + lstrcpy(((MONITORINFOEX*)lpMonitorInfo)->szDevice, TEXT("DISPLAY")); +#endif // UNICODE + } + + return TRUE; + } + + return FALSE; +} + +BOOL WINAPI +xEnumDisplayMonitors( + HDC hdcOptionalForPainting, + LPCRECT lprcEnumMonitorsThatIntersect, + MONITORENUMPROC lpfnEnumProc, + LPARAM dwData) +{ + RECT rcLimit; + + if (InitMultipleMonitorStubs()) { + return g_pfnEnumDisplayMonitors( + hdcOptionalForPainting, + lprcEnumMonitorsThatIntersect, + lpfnEnumProc, + dwData); + } + + if (!lpfnEnumProc) + return FALSE; + + rcLimit.left = 0; + rcLimit.top = 0; + rcLimit.right = GetSystemMetrics(SM_CXSCREEN); + rcLimit.bottom = GetSystemMetrics(SM_CYSCREEN); + + if (hdcOptionalForPainting) + { + RECT rcClip; + POINT ptOrg; + + switch (GetClipBox(hdcOptionalForPainting, &rcClip)) + { + default: + if (!GetDCOrgEx(hdcOptionalForPainting, &ptOrg)) + return FALSE; + + OffsetRect(&rcLimit, -ptOrg.x, -ptOrg.y); + if (IntersectRect(&rcLimit, &rcLimit, &rcClip) && + (!lprcEnumMonitorsThatIntersect || + IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect))) { + + break; + } + //fall thru + case NULLREGION: + return TRUE; + case ERROR: + return FALSE; + } + } else { + if ( lprcEnumMonitorsThatIntersect && + !IntersectRect(&rcLimit, &rcLimit, lprcEnumMonitorsThatIntersect)) { + + return TRUE; + } + } + + return lpfnEnumProc( + xPRIMARY_MONITOR, + hdcOptionalForPainting, + &rcLimit, + dwData); +} + +BOOL WINAPI +xEnumDisplayDevices( + PVOID Unused, + DWORD iDevNum, + PDISPLAY_DEVICE lpDisplayDevice, + DWORD dwFlags) +{ + if (InitMultipleMonitorStubs()) + return g_pfnEnumDisplayDevices(Unused, iDevNum, lpDisplayDevice, dwFlags); + + if (Unused != NULL) + return FALSE; + + if (iDevNum != 0) + return FALSE; + + if (lpDisplayDevice == NULL || lpDisplayDevice->cb < sizeof(DISPLAY_DEVICE)) + return FALSE; + +#ifdef UNICODE + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceName, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR))); + MultiByteToWideChar(CP_ACP, 0, "DISPLAY", -1, lpDisplayDevice->DeviceString, (sizeof(lpDisplayDevice->DeviceName)/sizeof(TCHAR))); +#else // UNICODE + lstrcpy((LPTSTR)lpDisplayDevice->DeviceName, TEXT("DISPLAY")); + lstrcpy((LPTSTR)lpDisplayDevice->DeviceString, TEXT("DISPLAY")); +#endif // UNICODE + + lpDisplayDevice->StateFlags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE; + + return TRUE; +} + +#undef xPRIMARY_MONITOR +#undef COMPILE_MULTIMON_STUBS + +#else // COMPILE_MULTIMON_STUBS + +extern int WINAPI xGetSystemMetrics(int); +extern HMONITOR WINAPI xMonitorFromWindow(HWND, DWORD); +extern HMONITOR WINAPI xMonitorFromRect(LPCRECT, DWORD); +extern HMONITOR WINAPI xMonitorFromPoint(POINT, DWORD); +extern BOOL WINAPI xGetMonitorInfo(HMONITOR, LPMONITORINFO); +extern BOOL WINAPI xEnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM); +extern BOOL WINAPI xEnumDisplayDevices(PVOID, DWORD, PDISPLAY_DEVICE, DWORD); + +#endif // COMPILE_MULTIMON_STUBS + +// +// build defines that replace the regular APIs with our versions +// +#define GetSystemMetrics xGetSystemMetrics +#define MonitorFromWindow xMonitorFromWindow +#define MonitorFromRect xMonitorFromRect +#define MonitorFromPoint xMonitorFromPoint +#define GetMonitorInfo xGetMonitorInfo +#define EnumDisplayMonitors xEnumDisplayMonitors +#define EnumDisplayDevices xEnumDisplayDevices + +#ifdef __cplusplus +} +#endif // __cplusplus + diff --git a/SDK/dxSDK/Include/rmxfguid.h b/SDK/dxSDK/Include/rmxfguid.h new file mode 100644 index 00000000..d3326ccc --- /dev/null +++ b/SDK/dxSDK/Include/rmxfguid.h @@ -0,0 +1,223 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: rmxfguid.h + * + * Content: Defines GUIDs of D3DRM's templates. + * + ***************************************************************************/ + +#ifndef __RMXFGUID_H_ +#define __RMXFGUID_H_ + +/* {2B957100-9E9A-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInfo, +0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB44-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMesh, +0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMVector, +0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMeshFace, +0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMaterial, +0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {35FF44E1-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialArray, +0x35ff44e1, 0x6c7c, 0x11cf, 0x8F, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB46-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMFrame, +0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {F6F23F41-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameTransformMatrix, +0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F42-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshMaterialList, +0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F40-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshTextureCoords, +0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F43-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshNormals, +0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F44-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMCoords2d, +0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F45-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMatrix4x4, +0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimation, +0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB50-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimationSet, +0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {10DD46A8-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationKey, +0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {10DD46A9-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFloatKeys, +0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411840-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialAmbientColor, +0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411841-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialDiffuseColor, +0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411842-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialSpecularColor, +0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E80-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialEmissiveColor, +0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {01411843-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialPower, +0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {35FF44E0-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGBA, +0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E81-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGB, +0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E0-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMGuid, +0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E1-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureFilename, +0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E2-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureReference, +0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B820-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMIndexedColor, +0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B821-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshVertexColors, +0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {4885AE60-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialWrap, +0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMBoolean, +0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMMeshFaceWraps, +0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {4885AE63-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMBoolean2d, +0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F406B180-7B3B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTimedFloatKeys, +0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C0-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationOptions, +0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C1-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFramePosition, +0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C2-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameVelocity, +0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C3-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameRotation, +0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMLight, +0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB51-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMCamera, +0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMAppData, +0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightUmbra, +0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightRange, +0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightPenumbra, +0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMLightAttenuation, +0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInlineData, +0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMUrl, +0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {8A63C360-997D-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMProgressiveMesh, +0x8A63C360, 0x997D, 0x11d0, 0x94, 0x1C, 0x0, 0x80, 0xC8, 0x0C, 0xFA, 0x7B); + +/* {98116AA0-BDBA-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMExternalVisual, +0x98116AA0, 0xBDBA, 0x11d1, 0x82, 0xC0, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x71); + +/* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMStringProperty, +0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +/* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMPropertyBag, +0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +// {7F5D5EA0-D53A-11d1-82C0-00A0C9697271} +DEFINE_GUID(TID_D3DRMRightHanded, +0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +#endif /* __RMXFGUID_H_ */ + diff --git a/SDK/dxSDK/Include/rmxftmpl.h b/SDK/dxSDK/Include/rmxftmpl.h new file mode 100644 index 00000000..e0018d04 --- /dev/null +++ b/SDK/dxSDK/Include/rmxftmpl.h @@ -0,0 +1,339 @@ +/* D3DRM XFile templates in binary form */ + +#ifndef _RMXFTMPL_H_ +#define _RMXFTMPL_H_ + +unsigned char D3DRM_XTEMPLATES[] = { + 0x78, 0x6f, 0x66, 0x20, 0x30, 0x33, 0x30, 0x32, 0x62, + 0x69, 0x6e, 0x20, 0x30, 0x30, 0x36, 0x34, 0x1f, 0, 0x1, + 0, 0x6, 0, 0, 0, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0xa, 0, 0x5, 0, 0x43, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x6d, + 0x61, 0x6a, 0x6f, 0x72, 0x14, 0, 0x28, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x14, + 0, 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x66, + 0x6c, 0x61, 0x67, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0xa, 0, 0x5, 0, 0x5e, 0xab, 0x82, 0x3d, + 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, + 0xe4, 0x33, 0x2a, 0, 0x1, 0, 0x1, 0, 0, 0, + 0x78, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x79, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x7a, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x44, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x75, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0xa, 0, 0x5, 0, 0x45, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, + 0xe, 0, 0x3, 0, 0x10, 0, 0, 0, 0xf, 0, + 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x41, 0xa, 0, 0x5, 0, 0xe0, 0x44, 0xff, 0x35, 0x7c, + 0x6c, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, + 0xa3, 0x2a, 0, 0x1, 0, 0x3, 0, 0, 0, 0x72, + 0x65, 0x64, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x4, 0, 0, 0, 0x62, 0x6c, 0x75, + 0x65, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, 0, + 0, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0xa, 0, 0x5, 0, + 0x81, 0x6e, 0xe1, 0xd3, 0x35, 0x78, 0xcf, 0x11, 0x8f, 0x52, + 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, + 0x3, 0, 0, 0, 0x72, 0x65, 0x64, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x67, 0x72, 0x65, + 0x65, 0x6e, 0x14, 0, 0x2a, 0, 0x1, 0, 0x4, 0, + 0, 0, 0x62, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0xa, 0, 0x5, 0, 0x20, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x14, 0, 0x1, 0, 0x9, 0, 0, + 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, + 0x1, 0, 0xa, 0, 0, 0, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, + 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0xa, 0, 0x5, 0, 0xa0, + 0xa6, 0x7d, 0x53, 0x37, 0xca, 0xd0, 0x11, 0x94, 0x1c, 0, + 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x74, 0x72, 0x75, 0x65, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x9, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, + 0x6e, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x63, 0xae, 0x85, + 0x48, 0xe8, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x1, 0, 0x7, 0, 0, 0, 0x42, + 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, + 0, 0, 0x75, 0x14, 0, 0x1, 0, 0x7, 0, 0, + 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, + 0x1, 0, 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xc, 0, 0, 0, 0x4d, 0x61, 0x74, + 0x65, 0x72, 0x69, 0x61, 0x6c, 0x57, 0x72, 0x61, 0x70, 0xa, + 0, 0x5, 0, 0x60, 0xae, 0x85, 0x48, 0xe8, 0x78, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, 0x75, 0x14, + 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, + 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, + 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0xe1, 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x31, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x66, 0x69, 0x6c, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x4d, 0x61, 0x74, 0x65, + 0x72, 0x69, 0x61, 0x6c, 0xa, 0, 0x5, 0, 0x4d, 0xab, + 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, + 0xaf, 0x71, 0xe4, 0x33, 0x1, 0, 0x9, 0, 0, 0, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, 0x1, + 0, 0x9, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x2a, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x14, + 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x52, 0x47, 0x42, 0x1, 0, 0xd, 0, 0, + 0, 0x73, 0x70, 0x65, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x1, 0, 0xd, 0, 0, 0, 0x65, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, + 0, 0xe, 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x8, 0, 0, + 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, 0xa, + 0, 0x5, 0, 0x5f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x12, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, + 0x64, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, + 0, 0x1, 0, 0x11, 0, 0, 0, 0x66, 0x61, 0x63, + 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, + 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, 0, 0x12, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x56, 0x65, 0x72, + 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xd, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x73, 0xa, 0, 0x5, + 0, 0xc0, 0xc5, 0x1e, 0xed, 0xa8, 0xc0, 0xd0, 0x11, 0x94, + 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x14, 0, 0x34, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x32, 0x64, 0x1, + 0, 0xe, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x57, + 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0xe, + 0, 0x1, 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x11, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, + 0x72, 0x64, 0x73, 0xa, 0, 0x5, 0, 0x40, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xe, 0, 0, + 0, 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, + 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0x1, 0, 0xd, 0, 0, 0, 0x74, + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, 0x72, + 0x64, 0x73, 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, + 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, + 0x6f, 0x72, 0x64, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x4d, 0x65, + 0x73, 0x68, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x73, 0x74, 0xa, 0, 0x5, 0, 0x42, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, 0, + 0, 0, 0x6e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x73, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, 0, + 0x1, 0, 0xb, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0xc, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xf, 0, 0x14, + 0, 0xe, 0, 0x1, 0, 0x8, 0, 0, 0, 0x4d, + 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x4d, + 0x65, 0x73, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xa, 0, 0x5, 0, 0x43, 0x3f, 0xf2, 0xf6, 0x86, 0x76, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x8, 0, 0, 0, 0x6e, 0x4e, + 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0xe, 0, 0x1, 0, 0x8, + 0, 0, 0, 0x6e, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, + 0x61, 0x63, 0x65, 0x1, 0, 0xb, 0, 0, 0, 0x66, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xe, 0, 0x1, 0, 0xc, 0, 0, 0, 0x6e, 0x46, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x10, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x56, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73, + 0xa, 0, 0x5, 0, 0x21, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0xc, 0, 0, + 0, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x1, 0, 0xc, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0xe, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, + 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x4, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x44, 0xab, 0x82, 0x3d, 0xda, 0x62, + 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0x29, 0, 0x1, 0, 0x9, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, + 0, 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x1, 0, 0x8, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x6e, 0x56, 0x65, 0x72, 0x74, + 0x69, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0x29, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, + 0x1, 0, 0x5, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x73, 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x6e, + 0x46, 0x61, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x14, 0, 0, 0, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0xa, + 0, 0x5, 0, 0x41, 0x3f, 0xf2, 0xf6, 0x86, 0x76, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0x1, 0, 0xb, 0, 0, 0, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x46, 0x72, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0x46, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, + 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, 0, + 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x4b, 0x65, 0x79, 0x73, 0xa, 0, 0x5, + 0, 0xa9, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, 0x8f, + 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, + 0, 0x7, 0, 0, 0, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0xe, 0, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, + 0x69, 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0xa, 0, 0x5, 0, 0x80, 0xb1, 0x6, + 0xf4, 0x3b, 0x7b, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x74, 0x69, 0x6d, 0x65, 0x14, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x6, 0, 0, 0, 0x74, 0x66, + 0x6b, 0x65, 0x79, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0xc, 0, 0, 0, 0x41, 0x6e, 0x69, 0x6d, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0xa, 0, + 0x5, 0, 0xa8, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, + 0x1, 0, 0x7, 0, 0, 0, 0x6b, 0x65, 0x79, 0x54, + 0x79, 0x70, 0x65, 0x14, 0, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x14, 0, + 0x34, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, 0x69, + 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x4, 0, 0, 0, 0x6b, 0x65, + 0x79, 0x73, 0xe, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x6e, 0x4b, 0x65, 0x79, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0, 0x5, 0, 0xc0, + 0x56, 0xbf, 0xe2, 0xf, 0x84, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, + 0, 0, 0, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x64, 0x14, 0, 0x29, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x14, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa, + 0, 0x5, 0, 0x4f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0xa, 0, 0x5, 0, 0x50, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0xe, 0, 0x1, 0, 0x9, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xf, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0xa, 0, 0, 0, + 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, + 0xa, 0, 0x5, 0, 0xa0, 0xee, 0x23, 0x3a, 0xb1, 0x94, + 0xd0, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x42, 0x49, + 0x4e, 0x41, 0x52, 0x59, 0xf, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, 0x6c, 0xa, + 0, 0x5, 0, 0xa1, 0xee, 0x23, 0x3a, 0xb1, 0x94, 0xd0, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, + 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x31, 0, 0x1, 0, + 0x4, 0, 0, 0, 0x75, 0x72, 0x6c, 0x73, 0xe, 0, + 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x50, 0x72, 0x6f, 0x67, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x60, 0xc3, 0x63, 0x8a, 0x7d, 0x99, + 0xd0, 0x11, 0x94, 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, + 0xe, 0, 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, + 0x6c, 0x13, 0, 0x1, 0, 0xa, 0, 0, 0, 0x49, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x47, 0x75, 0x69, 0x64, 0xa, 0, 0x5, 0, 0xe0, + 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x31, 0x14, 0, + 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x64, 0x61, + 0x74, 0x61, 0x32, 0x14, 0, 0x28, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x33, 0x14, 0, + 0x34, 0, 0x2d, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x64, 0x61, 0x74, 0x61, 0x34, 0xe, 0, 0x3, 0, 0x8, + 0, 0, 0, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x79, 0xa, 0, 0x5, 0, 0xe0, 0x21, 0xf, 0x7f, 0xe1, + 0xbf, 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, + 0x71, 0x31, 0, 0x1, 0, 0x3, 0, 0, 0, 0x6b, + 0x65, 0x79, 0x14, 0, 0x31, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x42, 0x61, 0x67, + 0xa, 0, 0x5, 0, 0xe1, 0x21, 0xf, 0x7f, 0xe1, 0xbf, + 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, + 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xe, 0, 0, 0, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6c, 0xa, 0, + 0x5, 0, 0xa0, 0x6a, 0x11, 0x98, 0xba, 0xbd, 0xd1, 0x11, + 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x1, 0, + 0x4, 0, 0, 0, 0x47, 0x75, 0x69, 0x64, 0x1, 0, + 0x12, 0, 0, 0, 0x67, 0x75, 0x69, 0x64, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, + 0x61, 0x6c, 0x14, 0, 0xe, 0, 0x12, 0, 0x12, 0, + 0x12, 0, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xb, 0, 0, 0, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0xa, 0, 0x5, 0, 0xa0, + 0x5e, 0x5d, 0x7f, 0x3a, 0xd5, 0xd1, 0x11, 0x82, 0xc0, 0, + 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x62, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0x14, 0, 0xb, 0 +}; + +#define D3DRM_XTEMPLATE_BYTES 3278 + +#endif /* _RMXFTMPL_H_ */ diff --git a/SDK/dxSDK/Include/strsafe.h b/SDK/dxSDK/Include/strsafe.h new file mode 100644 index 00000000..061b3c4d --- /dev/null +++ b/SDK/dxSDK/Include/strsafe.h @@ -0,0 +1,6611 @@ +/****************************************************************** +* * +* strsafe.h -- This module defines safer C library string * +* routine replacements. These are meant to make C * +* a bit more safe in reference to security and * +* robustness * +* * +* Copyright (c) Microsoft Corp. All rights reserved. * +* * +******************************************************************/ +#ifndef _STRSAFE_H_INCLUDED_ +#define _STRSAFE_H_INCLUDED_ +#pragma once + +#include // for _vsnprintf, _vsnwprintf, getc, getwc +#include // for memset +#include // for va_start, etc. + + +#ifndef _SIZE_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 size_t; +#else +typedef __w64 unsigned int size_t; +#endif // !_WIN64 +#define _SIZE_T_DEFINED +#endif // !_SIZE_T_DEFINED + +#if !defined(_WCHAR_T_DEFINED) && !defined(_NATIVE_WCHAR_T_DEFINED) +typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef long HRESULT; +#endif // !_HRESULT_DEFINED + +#ifndef SUCCEEDED +#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) +#endif + +#ifndef FAILED +#define FAILED(hr) ((HRESULT)(hr) < 0) +#endif + +#ifndef S_OK +#define S_OK ((HRESULT)0x00000000L) +#endif + +#ifdef __cplusplus +#define _STRSAFE_EXTERN_C extern "C" +#else +#define _STRSAFE_EXTERN_C extern +#endif + +// If you do not want to use these functions inline (and instead want to link w/ strsafe.lib), then +// #define STRSAFE_LIB before including this header file. +#if defined(STRSAFE_LIB) +#define STRSAFEAPI _STRSAFE_EXTERN_C HRESULT __stdcall +#pragma comment(lib, "strsafe.lib") +#elif defined(STRSAFE_LIB_IMPL) +#define STRSAFEAPI _STRSAFE_EXTERN_C HRESULT __stdcall +#else +#define STRSAFEAPI __inline HRESULT __stdcall +#define STRSAFE_INLINE +#endif + +// Some functions always run inline because they use stdin and we want to avoid building multiple +// versions of strsafe lib depending on if you use msvcrt, libcmt, etc. +#define STRSAFE_INLINE_API __inline HRESULT __stdcall + +// The user can request no "Cb" or no "Cch" fuctions, but not both! +#if defined(STRSAFE_NO_CB_FUNCTIONS) && defined(STRSAFE_NO_CCH_FUNCTIONS) +#error cannot specify both STRSAFE_NO_CB_FUNCTIONS and STRSAFE_NO_CCH_FUNCTIONS !! +#endif + +// This should only be defined when we are building strsafe.lib +#ifdef STRSAFE_LIB_IMPL +#define STRSAFE_INLINE +#endif + + +// If both strsafe.h and ntstrsafe.h are included, only use definitions from one. +#ifndef _NTSTRSAFE_H_INCLUDED_ + +#define STRSAFE_MAX_CCH 2147483647 // max # of characters we support (same as INT_MAX) + +// Flags for controling the Ex functions +// +// STRSAFE_FILL_BYTE(0xFF) 0x000000FF // bottom byte specifies fill pattern +#define STRSAFE_IGNORE_NULLS 0x00000100 // treat null as TEXT("") -- don't fault on NULL buffers +#define STRSAFE_FILL_BEHIND_NULL 0x00000200 // fill in extra space behind the null terminator +#define STRSAFE_FILL_ON_FAILURE 0x00000400 // on failure, overwrite pszDest with fill pattern and null terminate it +#define STRSAFE_NULL_ON_FAILURE 0x00000800 // on failure, set *pszDest = TEXT('\0') +#define STRSAFE_NO_TRUNCATION 0x00001000 // instead of returning a truncated result, copy/append nothing to pszDest and null terminate it + +#define STRSAFE_VALID_FLAGS (0x000000FF | STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL | STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION) + +// helper macro to set the fill character and specify buffer filling +#define STRSAFE_FILL_BYTE(x) ((unsigned long)((x & 0x000000FF) | STRSAFE_FILL_BEHIND_NULL)) +#define STRSAFE_FAILURE_BYTE(x) ((unsigned long)((x & 0x000000FF) | STRSAFE_FILL_ON_FAILURE)) + +#define STRSAFE_GET_FILL_PATTERN(dwFlags) ((int)(dwFlags & 0x000000FF)) + +#endif // _NTSTRSAFE_H_INCLUDED_ + +// STRSAFE error return codes +// +#define STRSAFE_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // 0x7A = 122L = ERROR_INSUFFICIENT_BUFFER +#define STRSAFE_E_INVALID_PARAMETER ((HRESULT)0x80070057L) // 0x57 = 87L = ERROR_INVALID_PARAMETER +#define STRSAFE_E_END_OF_FILE ((HRESULT)0x80070026L) // 0x26 = 38L = ERROR_HANDLE_EOF + +// prototypes for the worker functions +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCopyWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc); +STRSAFEAPI StringCopyNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc); +STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCopyNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCatWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCatNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCatNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringVPrintfExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringLengthWorkerW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#endif // STRSAFE_INLINE + +#ifndef STRSAFE_LIB_IMPL +// these functions are always inline +STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringGetsExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#endif + +#ifdef _NTSTRSAFE_H_INCLUDED_ +#pragma warning(push) +#pragma warning(disable : 4995) +#endif // _NTSTRSAFE_H_INCLUDED_ + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopy( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for strncpy. That function will pad the + destination string with extra null termination characters if the count is + greater than the length of the source string, and it will fail to null + terminate the destination string if the source string length is greater + than or equal to the count. You can not blindly use this instead of strncpy: + it is common for code to use it to "patch" strings and you would introduce + errors if the code started null terminating in the middle of the string. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was copied without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of + pszSrc will be copied to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(src) + 1) to hold all of the + source including the null terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCchCopyW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCchCopy StringCchCopyW +#else +#define StringCchCopy StringCchCopyA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCopyW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopy( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for strncpy. That function will pad the + destination string with extra null termination characters if the count is + greater than the length of the source string, and it will fail to null + terminate the destination string if the source string length is greater + than or equal to the count. You can not blindly use this instead of strncpy: + it is common for code to use it to "patch" strings and you would introduce + errors if the code started null terminating in the middle of the string. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was copied without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be copied to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc); +STRSAFEAPI StringCbCopyW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCbCopy StringCbCopyW +#else +#define StringCbCopy StringCbCopyA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCopyW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy' with + some additional parameters. In addition to functionality provided by + StringCchCopy, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszSrc) + 1) to hold all of + the source including the null terminator + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCopyExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCopyEx StringCchCopyExW +#else +#define StringCchCopyEx StringCchCopyExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCopyExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCopyExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcpy' with + some additional parameters. In addition to functionality provided by + StringCbCopy, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - pcbRemaining is non-null,the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCopyExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCopyEx StringCbCopyExW +#else +#define StringCbCopyEx StringCbCopyExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCopyExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyN( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc, + IN size_t cchSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cchSrc is greater than the length of pszSrc. + + This function returns a hresult, and not a pointer. It returns + S_OK if the entire string or the first cchSrc characters were copied + without truncation and the resultant destination string was null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be copied to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(src) + 1) to hold all of the + source including the null terminator + + pszSrc - source string + + cchSrc - maximum number of characters to copy from source string, + not including the null terminator. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCopyNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc); +STRSAFEAPI StringCchCopyNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc); +#ifdef UNICODE +#define StringCchCopyN StringCchCopyNW +#else +#define StringCchCopyN StringCchCopyNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerA(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCopyNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerW(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyN( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc, + IN size_t cbSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cbSrc is greater than the size of pszSrc. + + This function returns a hresult, and not a pointer. It returns + S_OK if the entire string or the first cbSrc characters were + copied without truncation and the resultant destination string was null + terminated, otherwise it will return a failure code. In failure cases as + much of pszSrc will be copied to pszDest as possible, and pszDest will be + null terminated. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(src) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string + + cbSrc - maximum number of bytes to copy from source string, + not including the null terminator. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCopyEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc); +STRSAFEAPI StringCbCopyNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc); +#ifdef UNICODE +#define StringCbCopyN StringCbCopyNW +#else +#define StringCbCopyN StringCbCopyNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + cchSrc = cbSrc / sizeof(char); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerA(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCopyNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + cchSrc = cbSrc / sizeof(wchar_t); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNWorkerW(pszDest, cchDest, pszSrc, cchSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCopyNEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cchSrc, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy' with + some additional parameters. In addition to functionality provided by + StringCchCopyN, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination + string including the null terminator. The flags parameter allows + additional controls. + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cchSrc is greater than the length of pszSrc. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszSrc) + 1) to hold all of + the source including the null terminator + + pszSrc - source string + + cchSrc - maximum number of characters to copy from the source + string + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCopyNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCopyNEx StringCchCopyNExW +#else +#define StringCchCopyNEx StringCchCopyNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCopyNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCopyNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCopyNEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cbSrc, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncpy' with + some additional parameters. In addition to functionality provided by + StringCbCopyN, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + + This routine is meant as a replacement for strncpy, but it does behave + differently. This function will not pad the destination buffer with extra + null termination characters if cbSrc is greater than the size of pszSrc. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszSrc) + 1) * sizeof(TCHAR)) to + hold all of the source including the null terminator + + pszSrc - source string + + cbSrc - maximum number of bytes to copy from source string + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - pcbRemaining is non-null,the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcpy + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all copied and the + resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the copy + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCopyNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCopyNEx StringCbCopyNExW +#else +#define StringCbCopyNEx StringCbCopyNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + cchSrc = cbSrc / sizeof(char); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCopyNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchSrc; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + cchSrc = cbSrc / sizeof(wchar_t); + + if ((cchDest > STRSAFE_MAX_CCH) || + (cchSrc > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCopyNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCat( + IN OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat'. + The size of the destination buffer (in characters) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was concatenated without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be appended to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be = (_tcslen(pszDest) + _tcslen(pszSrc) + 1) + to hold all of the combine string plus the null + terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCatEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error occurs, + the destination buffer is modified to contain a truncated + version of the ideal result and is null terminated. This + is useful for situations where truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc); +STRSAFEAPI StringCchCatW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCchCat StringCchCatW +#else +#define StringCchCat StringCchCatA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCchCatW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCat( + IN OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat'. + The size of the destination buffer (in bytes) is a parameter and this + function will not write past the end of this buffer and it will ALWAYS + null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was concatenated without truncation and null terminated, + otherwise it will return a failure code. In failure cases as much of pszSrc + will be appended to pszDest as possible, and pszDest will be null + terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be = ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator + + pszSrc - source string which must be null terminated + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCatEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error occurs, + the destination buffer is modified to contain a truncated + version of the ideal result and is null terminated. This + is useful for situations where truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc); +STRSAFEAPI StringCbCatW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc); +#ifdef UNICODE +#define StringCbCat StringCbCatW +#else +#define StringCbCat StringCbCatA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerA(pszDest, cchDest, pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCbCatW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatWorkerW(pszDest, cchDest, pszSrc); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat' with + some additional parameters. In addition to functionality provided by + StringCchCat, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters + length must be (_tcslen(pszDest) + _tcslen(pszSrc) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcat + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCatExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCatEx StringCchCatExW +#else +#define StringCchCatEx StringCchCatExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCatExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCatExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strcat' with + some additional parameters. In addition to functionality provided by + StringCbCat, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + _tcslen(pszSrc) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string which must be null terminated + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + this flag is useful for emulating functions like lstrcat + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated + and the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCatExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCatEx StringCbCatExW +#else +#define StringCbCatEx StringCbCatExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatExWorkerA(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCatExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatExWorkerW(pszDest, cchDest, cbDest, pszSrc, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatN( + IN OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszSrc, + IN size_t cchMaxAppend + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat'. + The size of the destination buffer (in characters) is a parameter as well as + the maximum number of characters to append, excluding the null terminator. + This function will not write past the end of the destination buffer and it will + ALWAYS null terminate pszDest (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if all of pszSrc or the first cchMaxAppend characters were appended + to the destination string and it was null terminated, otherwise it will + return a failure code. In failure cases as much of pszSrc will be appended + to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be (_tcslen(pszDest) + min(cchMaxAppend, _tcslen(pszSrc)) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cchMaxAppend - maximum number of characters to append + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCchCatNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if all of pszSrc or the first cchMaxAppend characters + were concatenated to pszDest and the resultant dest + string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend); +STRSAFEAPI StringCchCatNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend); +#ifdef UNICODE +#define StringCchCatN StringCchCatNW +#else +#define StringCchCatN StringCchCatNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatNWorkerA(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCchCatNW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringCatNWorkerW(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatN( + IN OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszSrc, + IN size_t cbMaxAppend + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat'. + The size of the destination buffer (in bytes) is a parameter as well as + the maximum number of bytes to append, excluding the null terminator. + This function will not write past the end of the destination buffer and it will + ALWAYS null terminate pszDest (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if all of pszSrc or the first cbMaxAppend bytes were appended + to the destination string and it was null terminated, otherwise it will + return a failure code. In failure cases as much of pszSrc will be appended + to pszDest as possible, and pszDest will be null terminated. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + min(cbMaxAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cbMaxAppend - maximum number of bytes to append + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL. See StringCbCatNEx if you require + the handling of NULL values. + +Return Value: + + S_OK - if all of pszSrc or the first cbMaxAppend bytes were + concatenated to pszDest and the resultant dest string + was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend); +STRSAFEAPI StringCbCatNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend); +#ifdef UNICODE +#define StringCbCatN StringCbCatNW +#else +#define StringCbCatN StringCbCatNA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(char); + + hr = StringCatNWorkerA(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCbCatNW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(wchar_t); + + hr = StringCatNWorkerW(pszDest, cchDest, pszSrc, cchMaxAppend); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchCatNEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cchMaxAppend, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat', with + some additional parameters. In addition to functionality provided by + StringCchCatN, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cchDest - size of destination buffer in characters. + length must be (_tcslen(pszDest) + min(cchMaxAppend, _tcslen(pszSrc)) + 1) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cchMaxAppend - maximum number of characters to append + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if all of pszSrc or the first cchMaxAppend characters + were concatenated to pszDest and the resultant dest + string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFEAPI StringCchCatNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchCatNEx StringCchCatNExW +#else +#define StringCchCatNEx StringCchCatNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringCatNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFEAPI StringCchCatNExW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbCatNEx( + IN OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + IN LPCTSTR pszSrc OPTIONAL, + IN size_t cbMaxAppend, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strncat', with + some additional parameters. In addition to functionality provided by + StringCbCatN, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string which must be null terminated + + cbDest - size of destination buffer in bytes. + length must be ((_tcslen(pszDest) + min(cbMaxAppend / sizeof(TCHAR), _tcslen(pszSrc)) + 1) * sizeof(TCHAR) + to hold all of the combine string plus the null + terminator. + + pszSrc - source string + + cbMaxAppend - maximum number of bytes to append + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function appended any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any pre-existing + or truncated string + + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any pre-existing or + truncated string + + STRSAFE_NO_TRUNCATION + if the function returns STRSAFE_E_INSUFFICIENT_BUFFER, pszDest + will not contain a truncated string, it will remain unchanged. + +Notes: + Behavior is undefined if source and destination strings overlap. + + pszDest and pszSrc should not be NULL unless the STRSAFE_IGNORE_NULLS flag + is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and pszSrc + may be NULL. An error may still be returned even though NULLS are ignored + due to insufficient space. + +Return Value: + + S_OK - if all of pszSrc or the first cbMaxAppend bytes were + concatenated to pszDest and the resultant dest string + was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the operation + failed due to insufficient space. When this error + occurs, the destination buffer is modified to contain + a truncated version of the ideal result and is null + terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +STRSAFEAPI StringCbCatNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbCatNEx StringCbCatNExW +#else +#define StringCbCatNEx StringCbCatNExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, size_t cbMaxAppend, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(char); + + hr = StringCatNExWorkerA(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbCatNExW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszSrc, size_t cbMaxAppend, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchMaxAppend; + + cchMaxAppend = cbMaxAppend / sizeof(wchar_t); + + hr = StringCatNExWorkerW(pszDest, cchDest, cbDest, pszSrc, cchMaxAppend, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchVPrintf( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszFormat, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCchVPrintfEx if you + require the handling of NULL values. + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringCchVPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCchVPrintf StringCchVPrintfW +#else +#define StringCchVPrintf StringCchVPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchVPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCchVPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbVPrintf( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszFormat, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCbVPrintfEx if you + require the handling of NULL values. + + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList); +STRSAFEAPI StringCbVPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCbVPrintf StringCbVPrintfW +#else +#define StringCbVPrintf StringCbVPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbVPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCbVPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchPrintf( + OUT LPTSTR pszDest, + IN size_t cchDest, + IN LPCTSTR pszFormat, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCchPrintfEx if you + require the handling of NULL values. + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...); +STRSAFEAPI StringCchPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCchPrintf StringCchPrintfW +#else +#define StringCchPrintf StringCchPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchPrintfA(char* pszDest, size_t cchDest, const char* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCchPrintfW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbPrintf( + OUT LPTSTR pszDest, + IN size_t cbDest, + IN LPCTSTR pszFormat, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This function returns a hresult, and not a pointer. It returns + S_OK if the string was printed without truncation and null terminated, + otherwise it will return a failure code. In failure cases it will return + a truncated version of the ideal result. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes + length must be sufficient to hold the resulting formatted + string, including the null terminator. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL. See StringCbPrintfEx if you + require the handling of NULL values. + + +Return Value: + + S_OK - if there was sufficient space in the dest buffer for + the resultant string and it was null terminated. + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...); +STRSAFEAPI StringCbPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCbPrintf StringCbPrintfW +#else +#define StringCbPrintf StringCbPrintfA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbPrintfA(char* pszDest, size_t cbDest, const char* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerA(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCbPrintfW(wchar_t* pszDest, size_t cbDest, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfWorkerW(pszDest, cchDest, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf' with + some additional parameters. In addition to functionality provided by + StringCchPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return + the number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...); +STRSAFEAPI StringCchPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCchPrintfEx StringCchPrintfExW +#else +#define StringCchPrintfEx StringCchPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + va_list argList; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + return hr; +} + +STRSAFEAPI StringCchPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + va_list argList; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + ... + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'sprintf' with + some additional parameters. In addition to functionality provided by + StringCbPrintf, this routine also returns a pointer to the end of the + destination string and the number of bytes left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + ... - additional parameters to be formatted according to + the format string + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...); +STRSAFEAPI StringCbPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...); +#ifdef UNICODE +#define StringCbPrintfEx StringCbPrintfExW +#else +#define StringCbPrintfEx StringCbPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, ...) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + va_list argList; + + va_start(argList, pszFormat); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + + va_end(argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchVPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf' with + some additional parameters. In addition to functionality provided by + StringCchVPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return + the number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringCchVPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCchVPrintfEx StringCchVPrintfExW +#else +#define StringCchVPrintfEx StringCchVPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchVPrintfExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + } + + return hr; +} + +STRSAFEAPI StringCchVPrintfExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags, pszFormat, argList); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbVPrintfEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags, + IN LPCTSTR pszFormat OPTIONAL, + IN va_list argList + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'vsprintf' with + some additional parameters. In addition to functionality provided by + StringCbVPrintf, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + length must be sufficient to contain the resulting + formatted string plus the null terminator. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return + a pointer to the end of the destination string. If the + function printed any data, the result will point to the + null termination character + + pcbRemaining - if pcbRemaining is non-null, the function will return + the number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")) + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. This will overwrite any truncated + string returned when the failure is + STRSAFE_E_INSUFFICIENT_BUFFER + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. This will overwrite any truncated string + returned when the failure is STRSAFE_E_INSUFFICIENT_BUFFER. + + pszFormat - format string which must be null terminated + + argList - va_list from the variable arguments according to the + stdarg.h convention + +Notes: + Behavior is undefined if destination, format strings or any arguments + strings overlap. + + pszDest and pszFormat should not be NULL unless the STRSAFE_IGNORE_NULLS + flag is specified. If STRSAFE_IGNORE_NULLS is passed, both pszDest and + pszFormat may be NULL. An error may still be returned even though NULLS + are ignored due to insufficient space. + +Return Value: + + S_OK - if there was source data and it was all concatenated and + the resultant dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that the print + operation failed due to insufficient space. When this + error occurs, the destination buffer is modified to + contain a truncated version of the ideal result and is + null terminated. This is useful for situations where + truncation is ok. + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function + +--*/ + +STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList); +STRSAFEAPI StringCbVPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList); +#ifdef UNICODE +#define StringCbVPrintfEx StringCbVPrintfExW +#else +#define StringCbVPrintfEx StringCbVPrintfExA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbVPrintfExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFEAPI StringCbVPrintfExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringVPrintfExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags, pszFormat, argList); + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchGets( + OUT LPTSTR pszDest, + IN size_t cchDest + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets'. + The size of the destination buffer (in characters) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for fgets. That function does not replace + newline characters with a null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if any characters were read from stdin and copied to pszDest and + pszDest was null terminated, otherwise it will return a failure code. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + +Notes: + pszDest should not be NULL. See StringCchGetsEx if you require the handling + of NULL values. + + cchDest must be > 1 for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest); +STRSAFE_INLINE_API StringCchGetsW(wchar_t* pszDest, size_t cchDest); +#ifdef UNICODE +#define StringCchGets StringCchGetsW +#else +#define StringCchGets StringCchGetsA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} + +STRSAFE_INLINE_API StringCchGetsW(wchar_t* pszDest, size_t cchDest) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} +#endif // !STRSAFE_NO_CCH_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbGets( + OUT LPTSTR pszDest, + IN size_t cbDest + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets'. + The size of the destination buffer (in bytes) is a parameter and + this function will not write past the end of this buffer and it will + ALWAYS null terminate the destination buffer (unless it is zero length). + + This routine is not a replacement for fgets. That function does not replace + newline characters with a null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if any characters were read from stdin and copied to pszDest + and pszDest was null terminated, otherwise it will return a failure code. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + +Notes: + pszDest should not be NULL. See StringCbGetsEx if you require the handling + of NULL values. + + cbDest must be > sizeof(TCHAR) for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest); +STRSAFE_INLINE_API StringCbGetsW(wchar_t* pszDest, size_t cbDest); +#ifdef UNICODE +#define StringCbGets StringCbGetsW +#else +#define StringCbGets StringCbGetsA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} + +STRSAFE_INLINE_API StringCbGetsW(wchar_t* pszDest, size_t cbDest) +{ + HRESULT hr; + size_t cchDest; + + // convert to count of characters + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); + } + + return hr; +} +#endif // !STRSAFE_NO_CB_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchGetsEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cchDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcchRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets' with + some additional parameters. In addition to functionality provided by + StringCchGets, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cchDest - size of destination buffer in characters. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcchRemaining - if pcchRemaining is non-null, the function will return the + number of characters left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. + +Notes: + pszDest should not be NULL unless the STRSAFE_IGNORE_NULLS flag is specified. + If STRSAFE_IGNORE_NULLS is passed and pszDest is NULL, an error may still be + returned even though NULLS are ignored + + cchDest must be > 1 for this function to succeed. + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringCchGetsExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCchGetsEx StringCchGetsExW +#else +#define StringCchGetsEx StringCchGetsExA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 + cbDest = cchDest * sizeof(char); + + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} + +STRSAFE_INLINE_API StringCchGetsExW(wchar_t* pszDest, size_t cchDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr; + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cbDest; + + // safe to multiply cchDest * sizeof(wchar_t) since cchDest < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + cbDest = cchDest * sizeof(wchar_t); + + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); + } + + return hr; +} +#endif // !STRSAFE_NO_CCH_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbGetsEx( + OUT LPTSTR pszDest OPTIONAL, + IN size_t cbDest, + OUT LPTSTR* ppszDestEnd OPTIONAL, + OUT size_t* pcbRemaining OPTIONAL, + IN DWORD dwFlags + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'gets' with + some additional parameters. In addition to functionality provided by + StringCbGets, this routine also returns a pointer to the end of the + destination string and the number of characters left in the destination string + including the null terminator. The flags parameter allows additional controls. + +Arguments: + + pszDest - destination string + + cbDest - size of destination buffer in bytes. + + ppszDestEnd - if ppszDestEnd is non-null, the function will return a + pointer to the end of the destination string. If the + function copied any data, the result will point to the + null termination character + + pcbRemaining - if pbRemaining is non-null, the function will return the + number of bytes left in the destination string, + including the null terminator + + dwFlags - controls some details of the string copy: + + STRSAFE_FILL_BEHIND_NULL + if the function succeeds, the low byte of dwFlags will be + used to fill the uninitialize part of destination buffer + behind the null terminator + + STRSAFE_IGNORE_NULLS + treat NULL string pointers like empty strings (TEXT("")). + + STRSAFE_FILL_ON_FAILURE + if the function fails, the low byte of dwFlags will be + used to fill all of the destination buffer, and it will + be null terminated. + + STRSAFE_NO_TRUNCATION / + STRSAFE_NULL_ON_FAILURE + if the function fails, the destination buffer will be set + to the empty string. + +Notes: + pszDest should not be NULL unless the STRSAFE_IGNORE_NULLS flag is specified. + If STRSAFE_IGNORE_NULLS is passed and pszDest is NULL, an error may still be + returned even though NULLS are ignored + + cbDest must be > sizeof(TCHAR) for this function to succeed + +Return Value: + + S_OK - data was read from stdin and copied, and the resultant + dest string was null terminated + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + STRSAFE_E_END_OF_FILE / + HRESULT_CODE(hr) == ERROR_HANDLE_EOF + - this return value indicates an error or end-of-file + condition, use feof or ferror to determine which one has + occured. + + STRSAFE_E_INSUFFICIENT_BUFFER / + HRESULT_CODE(hr) == ERROR_INSUFFICIENT_BUFFER + - this return value is an indication that there was + insufficient space in the destination buffer to copy any + data + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pbRemaining, unsigned long dwFlags); +STRSAFE_INLINE_API StringCbGetsExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); +#ifdef UNICODE +#define StringCbGetsEx StringCbGetsExW +#else +#define StringCbGetsEx StringCbGetsExA +#endif // !UNICODE + +STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(char); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); + } + } + + return hr; +} + +STRSAFE_INLINE_API StringCbGetsExW(wchar_t* pszDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) +{ + HRESULT hr; + size_t cchDest; + size_t cchRemaining = 0; + + cchDest = cbDest / sizeof(wchar_t); + + if (cchDest > STRSAFE_MAX_CCH) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (pcbRemaining) + { + // safe to multiply cchRemaining * sizeof(wchar_t) since cchRemaining < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcbRemaining = (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)); + } + } + + return hr; +} +#endif // !STRSAFE_NO_CB_FUNCTIONS +#endif // !STRSAFE_LIB_IMPL + +#ifndef STRSAFE_NO_CCH_FUNCTIONS +/*++ + +STDAPI +StringCchLength( + IN LPCTSTR psz, + IN size_t cchMax, + OUT size_t* pcch OPTIONAL + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strlen'. + It is used to make sure a string is not larger than a given length, and + it optionally returns the current length in characters not including + the null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string is non-null and the length including the null + terminator is less than or equal to cchMax characters. + +Arguments: + + psz - string to check the length of + + cchMax - maximum number of characters including the null terminator + that psz is allowed to contain + + pcch - if the function succeeds and pcch is non-null, the current length + in characters of psz excluding the null terminator will be returned. + This out parameter is equivalent to the return value of strlen(psz) + +Notes: + psz can be null but the function will fail + + cchMax should be greater than zero or the function will fail + +Return Value: + + S_OK - psz is non-null and the length including the null + terminator is less than or equal to cchMax characters + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringCchLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#ifdef UNICODE +#define StringCchLength StringCchLengthW +#else +#define StringCchLength StringCchLengthA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr; + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerA(psz, cchMax, pcch); + } + + return hr; +} + +STRSAFEAPI StringCchLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr; + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerW(psz, cchMax, pcch); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + + +#ifndef STRSAFE_NO_CB_FUNCTIONS +/*++ + +STDAPI +StringCbLength( + IN LPCTSTR psz, + IN size_t cbMax, + OUT size_t* pcb OPTIONAL + ); + +Routine Description: + + This routine is a safer version of the C built-in function 'strlen'. + It is used to make sure a string is not larger than a given length, and + it optionally returns the current length in bytes not including + the null terminator. + + This function returns a hresult, and not a pointer. It returns + S_OK if the string is non-null and the length including the null + terminator is less than or equal to cbMax bytes. + +Arguments: + + psz - string to check the length of + + cbMax - maximum number of bytes including the null terminator + that psz is allowed to contain + + pcb - if the function succeeds and pcb is non-null, the current length + in bytes of psz excluding the null terminator will be returned. + This out parameter is equivalent to the return value of strlen(psz) * sizeof(TCHAR) + +Notes: + psz can be null but the function will fail + + cbMax should be greater than or equal to sizeof(TCHAR) or the function will fail + +Return Value: + + S_OK - psz is non-null and the length including the null + terminator is less than or equal to cbMax bytes + + failure - you can use the macro HRESULT_CODE() to get a win32 + error code for all hresult failure cases + + It is strongly recommended to use the SUCCEEDED() / FAILED() macros to test the + return value of this function. + +--*/ + +STRSAFEAPI StringCbLengthA(const char* psz, size_t cchMax, size_t* pcch); +STRSAFEAPI StringCbLengthW(const wchar_t* psz, size_t cchMax, size_t* pcch); +#ifdef UNICODE +#define StringCbLength StringCbLengthW +#else +#define StringCbLength StringCbLengthA +#endif // !UNICODE + +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb) +{ + HRESULT hr; + size_t cchMax; + size_t cch = 0; + + cchMax = cbMax / sizeof(char); + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerA(psz, cchMax, &cch); + } + + if (SUCCEEDED(hr) && pcb) + { + // safe to multiply cch * sizeof(char) since cch < STRSAFE_MAX_CCH and sizeof(char) is 1 + *pcb = cch * sizeof(char); + } + + return hr; +} + +STRSAFEAPI StringCbLengthW(const wchar_t* psz, size_t cbMax, size_t* pcb) +{ + HRESULT hr; + size_t cchMax; + size_t cch = 0; + + cchMax = cbMax / sizeof(wchar_t); + + if ((psz == NULL) || (cchMax > STRSAFE_MAX_CCH)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = StringLengthWorkerW(psz, cchMax, &cch); + } + + if (SUCCEEDED(hr) && pcb) + { + // safe to multiply cch * sizeof(wchar_t) since cch < STRSAFE_MAX_CCH and sizeof(wchar_t) is 2 + *pcb = cch * sizeof(wchar_t); + } + + return hr; +} +#endif // STRSAFE_INLINE +#endif // !STRSAFE_NO_CB_FUNCTIONS + + +// these are the worker functions that actually do the work +#ifdef STRSAFE_INLINE +STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && (*pszSrc != '\0')) + { + *pszDest++ = *pszSrc++; + cchDest--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= '\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && (*pszSrc != L'\0')) + { + *pszDest++ = *pszSrc++; + cchDest--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= L'\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && (*pszSrc != '\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && (*pszSrc != L'\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && cchSrc && (*pszSrc != '\0')) + { + *pszDest++= *pszSrc++; + cchDest--; + cchSrc--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= '\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchSrc) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + while (cchDest && cchSrc && (*pszSrc != L'\0')) + { + *pszDest++= *pszSrc++; + cchDest--; + cchSrc--; + } + + if (cchDest == 0) + { + // we are going to truncate pszDest + pszDest--; + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDest= L'\0'; + } + + return hr; +} + +STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && cchSrc && (*pszSrc != '\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + cchSrc--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCopyNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually src data to copy + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while (cchRemaining && cchSrc && (*pszSrc != L'\0')) + { + *pszDestEnd++= *pszSrc++; + cchRemaining--; + cchSrc--; + } + + if (cchRemaining > 0) + { + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + else + { + // we are going to truncate pszDest + pszDestEnd--; + cchRemaining++; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyWorkerA(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCatWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyWorkerW(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc); + } + + return hr; +} + +STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchDestCurrent; + + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyExWorkerA(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), + pszSrc, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerA() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else + if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & STRSAFE_NULL_ON_FAILURE) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + size_t cchDestCurrent; + + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyExWorkerW(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), + pszSrc, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyExWorkerW() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & STRSAFE_NULL_ON_FAILURE) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyNWorkerA(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc, + cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCatNWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszSrc, size_t cchMaxAppend) +{ + HRESULT hr; + size_t cchDestCurrent; + + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + hr = StringCopyNWorkerW(pszDest + cchDestCurrent, + cchDest - cchDestCurrent, + pszSrc, + cchMaxAppend); + } + + return hr; +} + +STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + size_t cchDestCurrent = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = ""; + } + } + else + { + hr = StringLengthWorkerA(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyNExWorkerA(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)), + pszSrc, + cchMaxAppend, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerA() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringCatNExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, const wchar_t* pszSrc, size_t cchMaxAppend, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + size_t cchDestCurrent = 0; + + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest == 0) && (cbDest == 0)) + { + cchDestCurrent = 0; + } + else + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (pszSrc == NULL) + { + pszSrc = L""; + } + } + else + { + hr = StringLengthWorkerW(pszDest, cchDest, &cchDestCurrent); + + if (SUCCEEDED(hr)) + { + pszDestEnd = pszDest + cchDestCurrent; + cchRemaining = cchDest - cchDestCurrent; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + // only fail if there was actually src data to append + if (*pszSrc != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + // we handle the STRSAFE_FILL_ON_FAILURE and STRSAFE_NULL_ON_FAILURE cases below, so do not pass + // those flags through + hr = StringCopyNExWorkerW(pszDestEnd, + cchRemaining, + (cchRemaining * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t)), + pszSrc, + cchMaxAppend, + &pszDestEnd, + &cchRemaining, + dwFlags & (~(STRSAFE_FILL_ON_FAILURE | STRSAFE_NULL_ON_FAILURE))); + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + // STRSAFE_NO_TRUNCATION is taken care of by StringCopyNExWorkerW() + + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfWorkerA(char* pszDest, size_t cchDest, const char* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = '\0'; + + // we have truncated pszDest + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = '\0'; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfWorkerW(wchar_t* pszDest, size_t cchDest, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + + if (cchDest == 0) + { + // can not null terminate a zero-byte dest buffer + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = L'\0'; + + // we have truncated pszDest + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // need to null terminate the string + pszDest += cchMax; + *pszDest = L'\0'; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const char* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszFormat == NULL) + { + pszFormat = ""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually a non-empty format string + if (*pszFormat != '\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // we have truncated pszDest + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = '\0'; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // string fit perfectly + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = '\0'; + } + else if (((size_t)iRet) < cchMax) + { + // there is extra room + pszDestEnd = pszDest + iRet; + cchRemaining = cchDest - iRet; + + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringVPrintfExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags, const wchar_t* pszFormat, va_list argList) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(wchar_t)) || + // cbDest == (cchDest * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + + if (pszFormat == NULL) + { + pszFormat = L""; + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest == 0) + { + pszDestEnd = pszDest; + cchRemaining = 0; + + // only fail if there was actually a non-empty format string + if (*pszFormat != L'\0') + { + if (pszDest == NULL) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + } + } + else + { + int iRet; + size_t cchMax; + + // leave the last space for the null terminator + cchMax = cchDest - 1; + + iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); + // ASSERT((iRet < 0) || (((size_t)iRet) <= cchMax)); + + if ((iRet < 0) || (((size_t)iRet) > cchMax)) + { + // we have truncated pszDest + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = L'\0'; + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else if (((size_t)iRet) == cchMax) + { + // string fit perfectly + pszDestEnd = pszDest + cchMax; + cchRemaining = 1; + + // need to null terminate the string + *pszDestEnd = L'\0'; + } + else if (((size_t)iRet) < cchMax) + { + // there is extra room + pszDestEnd = pszDest + iRet; + cchRemaining = cchDest - iRet; + + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || (hr == STRSAFE_E_INSUFFICIENT_BUFFER)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr = S_OK; + size_t cchMaxPrev = cchMax; + + while (cchMax && (*psz != '\0')) + { + psz++; + cchMax--; + } + + if (cchMax == 0) + { + // the string is longer than cchMax + hr = STRSAFE_E_INVALID_PARAMETER; + } + + if (SUCCEEDED(hr) && pcch) + { + *pcch = cchMaxPrev - cchMax; + } + + return hr; +} + +STRSAFEAPI StringLengthWorkerW(const wchar_t* psz, size_t cchMax, size_t* pcch) +{ + HRESULT hr = S_OK; + size_t cchMaxPrev = cchMax; + + while (cchMax && (*psz != L'\0')) + { + psz++; + cchMax--; + } + + if (cchMax == 0) + { + // the string is longer than cchMax + hr = STRSAFE_E_INVALID_PARAMETER; + } + + if (SUCCEEDED(hr) && pcch) + { + *pcch = cchMaxPrev - cchMax; + } + + return hr; +} +#endif // STRSAFE_INLINE + +#ifndef STRSAFE_LIB_IMPL +STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + char* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest <= 1) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + if (cchDest == 1) + { + *pszDestEnd = '\0'; + } + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else + { + char ch; + + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while ((cchRemaining > 1) && (ch = (char)getc(stdin)) != '\n') + { + if (ch == EOF) + { + if (pszDestEnd == pszDest) + { + // we failed to read anything from stdin + hr = STRSAFE_E_END_OF_FILE; + } + break; + } + + *pszDestEnd = ch; + + pszDestEnd++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + // there is extra room + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); + } + } + + *pszDestEnd = '\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = '\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = '\0'; + } + } + } + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} + +STRSAFE_INLINE_API StringGetsExWorkerW(wchar_t* pszDest, size_t cchDest, size_t cbDest, wchar_t** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) +{ + HRESULT hr = S_OK; + wchar_t* pszDestEnd = pszDest; + size_t cchRemaining = 0; + + // ASSERT(cbDest == (cchDest * sizeof(char)) || + // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); + + // only accept valid flags + if (dwFlags & (~STRSAFE_VALID_FLAGS)) + { + hr = STRSAFE_E_INVALID_PARAMETER; + } + else + { + if (dwFlags & STRSAFE_IGNORE_NULLS) + { + if (pszDest == NULL) + { + if ((cchDest != 0) || (cbDest != 0)) + { + // NULL pszDest and non-zero cchDest/cbDest is invalid + hr = STRSAFE_E_INVALID_PARAMETER; + } + } + } + + if (SUCCEEDED(hr)) + { + if (cchDest <= 1) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + if (cchDest == 1) + { + *pszDestEnd = L'\0'; + } + + hr = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else + { + wchar_t ch; + + pszDestEnd = pszDest; + cchRemaining = cchDest; + + while ((cchRemaining > 1) && (ch = (wchar_t)getwc(stdin)) != L'\n') + { + if (ch == EOF) + { + if (pszDestEnd == pszDest) + { + // we failed to read anything from stdin + hr = STRSAFE_E_END_OF_FILE; + } + break; + } + + *pszDestEnd = ch; + + pszDestEnd++; + cchRemaining--; + } + + if (cchRemaining > 0) + { + // there is extra room + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(wchar_t)) + (cbDest % sizeof(wchar_t))); + } + } + + *pszDestEnd = L'\0'; + } + } + } + + if (FAILED(hr)) + { + if (pszDest) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); + + if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + } + else if (cchDest > 0) + { + pszDestEnd = pszDest + cchDest - 1; + cchRemaining = 1; + + // null terminate the end of the string + *pszDestEnd = L'\0'; + } + } + + if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) + { + if (cchDest > 0) + { + pszDestEnd = pszDest; + cchRemaining = cchDest; + + // null terminate the beginning of the string + *pszDestEnd = L'\0'; + } + } + } + } + + if (SUCCEEDED(hr) || + (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || + (hr == STRSAFE_E_END_OF_FILE)) + { + if (ppszDestEnd) + { + *ppszDestEnd = pszDestEnd; + } + + if (pcchRemaining) + { + *pcchRemaining = cchRemaining; + } + } + + return hr; +} +#endif // !STRSAFE_LIB_IMPL + + +// Do not call these functions, they are worker functions for internal use within this file +#ifdef DEPRECATE_SUPPORTED +#pragma deprecated(StringCopyWorkerA) +#pragma deprecated(StringCopyWorkerW) +#pragma deprecated(StringCopyExWorkerA) +#pragma deprecated(StringCopyExWorkerW) +#pragma deprecated(StringCatWorkerA) +#pragma deprecated(StringCatWorkerW) +#pragma deprecated(StringCatExWorkerA) +#pragma deprecated(StringCatExWorkerW) +#pragma deprecated(StringCatNWorkerA) +#pragma deprecated(StringCatNWorkerW) +#pragma deprecated(StringCatNExWorkerA) +#pragma deprecated(StringCatNExWorkerW) +#pragma deprecated(StringVPrintfWorkerA) +#pragma deprecated(StringVPrintfWorkerW) +#pragma deprecated(StringVPrintfExWorkerA) +#pragma deprecated(StringVPrintfExWorkerW) +#pragma deprecated(StringLengthWorkerA) +#pragma deprecated(StringLengthWorkerW) +#else +#define StringCopyWorkerA StringCopyWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA; +#define StringCopyWorkerW StringCopyWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW; +#define StringCopyExWorkerA StringCopyExWorkerA_instead_use_StringCchCopyA_or_StringCchCopyExA; +#define StringCopyExWorkerW StringCopyExWorkerW_instead_use_StringCchCopyW_or_StringCchCopyExW; +#define StringCatWorkerA StringCatWorkerA_instead_use_StringCchCatA_or_StringCchCatExA; +#define StringCatWorkerW StringCatWorkerW_instead_use_StringCchCatW_or_StringCchCatExW; +#define StringCatExWorkerA StringCatExWorkerA_instead_use_StringCchCatA_or_StringCchCatExA; +#define StringCatExWorkerW StringCatExWorkerW_instead_use_StringCchCatW_or_StringCchCatExW; +#define StringCatNWorkerA StringCatNWorkerA_instead_use_StringCchCatNA_or_StrincCbCatNA; +#define StringCatNWorkerW StringCatNWorkerW_instead_use_StringCchCatNW_or_StringCbCatNW; +#define StringCatNExWorkerA StringCatNExWorkerA_instead_use_StringCchCatNExA_or_StringCbCatNExA; +#define StringCatNExWorkerW StringCatNExWorkerW_instead_use_StringCchCatNExW_or_StringCbCatNExW; +#define StringVPrintfWorkerA StringVPrintfWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA; +#define StringVPrintfWorkerW StringVPrintfWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW; +#define StringVPrintfExWorkerA StringVPrintfExWorkerA_instead_use_StringCchVPrintfA_or_StringCchVPrintfExA; +#define StringVPrintfExWorkerW StringVPrintfExWorkerW_instead_use_StringCchVPrintfW_or_StringCchVPrintfExW; +#define StringLengthWorkerA StringLengthWorkerA_instead_use_StringCchLengthA_or_StringCbLengthA; +#define StringLengthWorkerW StringLengthWorkerW_instead_use_StringCchLengthW_or_StringCbLengthW; +#endif // !DEPRECATE_SUPPORTED + + +#ifndef STRSAFE_NO_DEPRECATE +// Deprecate all of the unsafe functions to generate compiletime errors. If you do not want +// this then you can #define STRSAFE_NO_DEPRECATE before including this file. +#ifdef DEPRECATE_SUPPORTED + +// First all the names that are a/w variants (or shouldn't be #defined by now anyway). +#pragma deprecated(lstrcpyA) +#pragma deprecated(lstrcpyW) +#pragma deprecated(lstrcatA) +#pragma deprecated(lstrcatW) +#pragma deprecated(wsprintfA) +#pragma deprecated(wsprintfW) + +#pragma deprecated(StrCpyW) +#pragma deprecated(StrCatW) +#pragma deprecated(StrNCatA) +#pragma deprecated(StrNCatW) +#pragma deprecated(StrCatNA) +#pragma deprecated(StrCatNW) +#pragma deprecated(wvsprintfA) +#pragma deprecated(wvsprintfW) + +#pragma deprecated(strcpy) +#pragma deprecated(wcscpy) +#pragma deprecated(strcat) +#pragma deprecated(wcscat) +#pragma deprecated(sprintf) +#pragma deprecated(swprintf) +#pragma deprecated(vsprintf) +#pragma deprecated(vswprintf) +#pragma deprecated(_snprintf) +#pragma deprecated(_snwprintf) +#pragma deprecated(_vsnprintf) +#pragma deprecated(_vsnwprintf) +#pragma deprecated(gets) +#pragma deprecated(_getws) + +// Then all the windows.h names - we need to undef and redef based on UNICODE setting +#undef lstrcpy +#undef lstrcat +#undef wsprintf +#undef wvsprintf +#pragma deprecated(lstrcpy) +#pragma deprecated(lstrcat) +#pragma deprecated(wsprintf) +#pragma deprecated(wvsprintf) +#ifdef UNICODE +#define lstrcpy lstrcpyW +#define lstrcat lstrcatW +#define wsprintf wsprintfW +#define wvsprintf wvsprintfW +#else +#define lstrcpy lstrcpyA +#define lstrcat lstrcatA +#define wsprintf wsprintfA +#define wvsprintf wvsprintfA +#endif + +// Then the shlwapi names - they key off UNICODE also. +#undef StrCpyA +#undef StrCpy +#undef StrCatA +#undef StrCat +#undef StrNCat +#undef StrCatN +#pragma deprecated(StrCpyA) +#pragma deprecated(StrCatA) +#pragma deprecated(StrCatN) +#pragma deprecated(StrCpy) +#pragma deprecated(StrCat) +#pragma deprecated(StrNCat) +#define StrCpyA lstrcpyA +#define StrCatA lstrcatA +#define StrCatN StrNCat +#ifdef UNICODE +#define StrCpy StrCpyW +#define StrCat StrCatW +#define StrNCat StrNCatW +#else +#define StrCpy lstrcpyA +#define StrCat lstrcatA +#define StrNCat StrNCatA +#endif + +// Then all the CRT names - we need to undef/redef based on _UNICODE value. +#undef _tcscpy +#undef _ftcscpy +#undef _tcscat +#undef _ftcscat +#undef _stprintf +#undef _sntprintf +#undef _vstprintf +#undef _vsntprintf +#undef _getts +#pragma deprecated(_tcscpy) +#pragma deprecated(_ftcscpy) +#pragma deprecated(_tcscat) +#pragma deprecated(_ftcscat) +#pragma deprecated(_stprintf) +#pragma deprecated(_sntprintf) +#pragma deprecated(_vstprintf) +#pragma deprecated(_vsntprintf) +#pragma deprecated(_getts) +#ifdef _UNICODE +#define _tcscpy wcscpy +#define _ftcscpy wcscpy +#define _tcscat wcscat +#define _ftcscat wcscat +#define _stprintf swprintf +#define _sntprintf _snwprintf +#define _vstprintf vswprintf +#define _vsntprintf _vsnwprintf +#define _getts _getws +#else +#define _tcscpy strcpy +#define _ftcscpy strcpy +#define _tcscat strcat +#define _ftcscat strcat +#define _stprintf sprintf +#define _sntprintf _snprintf +#define _vstprintf vsprintf +#define _vsntprintf _vsnprintf +#define _getts gets +#endif + +#else // DEPRECATE_SUPPORTED + +#undef strcpy +#define strcpy strcpy_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef wcscpy +#define wcscpy wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef strcat +#define strcat strcat_instead_use_StringCbCatA_or_StringCchCatA; + +#undef wcscat +#define wcscat wcscat_instead_use_StringCbCatW_or_StringCchCatW; + +#undef sprintf +#define sprintf sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef swprintf +#define swprintf swprintf_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef vsprintf +#define vsprintf vsprintf_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef vswprintf +#define vswprintf vswprintf_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef _snprintf +#define _snprintf _snprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef _snwprintf +#define _snwprintf _snwprintf_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef _vsnprintf +#define _vsnprintf _vsnprintf_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef _vsnwprintf +#define _vsnwprintf _vsnwprintf_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef strcpyA +#define strcpyA strcpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef strcpyW +#define strcpyW strcpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef lstrcpy +#define lstrcpy lstrcpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef lstrcpyA +#define lstrcpyA lstrcpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef lstrcpyW +#define lstrcpyW lstrcpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef StrCpy +#define StrCpy StrCpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef StrCpyA +#define StrCpyA StrCpyA_instead_use_StringCbCopyA_or_StringCchCopyA; + +#undef StrCpyW +#define StrCpyW StrCpyW_instead_use_StringCbCopyW_or_StringCchCopyW; + +#undef _tcscpy +#define _tcscpy _tcscpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef _ftcscpy +#define _ftcscpy _ftcscpy_instead_use_StringCbCopy_or_StringCchCopy; + +#undef lstrcat +#define lstrcat lstrcat_instead_use_StringCbCat_or_StringCchCat; + +#undef lstrcatA +#define lstrcatA lstrcatA_instead_use_StringCbCatA_or_StringCchCatA; + +#undef lstrcatW +#define lstrcatW lstrcatW_instead_use_StringCbCatW_or_StringCchCatW; + +#undef StrCat +#define StrCat StrCat_instead_use_StringCbCat_or_StringCchCat; + +#undef StrCatA +#define StrCatA StrCatA_instead_use_StringCbCatA_or_StringCchCatA; + +#undef StrCatW +#define StrCatW StrCatW_instead_use_StringCbCatW_or_StringCchCatW; + +#undef StrNCat +#define StrNCat StrNCat_instead_use_StringCbCatN_or_StringCchCatN; + +#undef StrNCatA +#define StrNCatA StrNCatA_instead_use_StringCbCatNA_or_StringCchCatNA; + +#undef StrNCatW +#define StrNCatW StrNCatW_instead_use_StringCbCatNW_or_StringCchCatNW; + +#undef StrCatN +#define StrCatN StrCatN_instead_use_StringCbCatN_or_StringCchCatN; + +#undef StrCatNA +#define StrCatNA StrCatNA_instead_use_StringCbCatNA_or_StringCchCatNA; + +#undef StrCatNW +#define StrCatNW StrCatNW_instead_use_StringCbCatNW_or_StringCchCatNW; + +#undef _tcscat +#define _tcscat _tcscat_instead_use_StringCbCat_or_StringCchCat; + +#undef _ftcscat +#define _ftcscat _ftcscat_instead_use_StringCbCat_or_StringCchCat; + +#undef wsprintf +#define wsprintf wsprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef wsprintfA +#define wsprintfA wsprintfA_instead_use_StringCbPrintfA_or_StringCchPrintfA; + +#undef wsprintfW +#define wsprintfW wsprintfW_instead_use_StringCbPrintfW_or_StringCchPrintfW; + +#undef wvsprintf +#define wvsprintf wvsprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef wvsprintfA +#define wvsprintfA wvsprintfA_instead_use_StringCbVPrintfA_or_StringCchVPrintfA; + +#undef wvsprintfW +#define wvsprintfW wvsprintfW_instead_use_StringCbVPrintfW_or_StringCchVPrintfW; + +#undef _vstprintf +#define _vstprintf _vstprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef _vsntprintf +#define _vsntprintf _vsntprintf_instead_use_StringCbVPrintf_or_StringCchVPrintf; + +#undef _stprintf +#define _stprintf _stprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef _sntprintf +#define _sntprintf _sntprintf_instead_use_StringCbPrintf_or_StringCchPrintf; + +#undef _getts +#define _getts _getts_instead_use_StringCbGets_or_StringCchGets; + +#undef gets +#define gets _gets_instead_use_StringCbGetsA_or_StringCchGetsA; + +#undef _getws +#define _getws _getws_instead_use_StringCbGetsW_or_StringCchGetsW; + +#endif // !DEPRECATE_SUPPORTED +#endif // !STRSAFE_NO_DEPRECATE + +#ifdef _NTSTRSAFE_H_INCLUDED_ +#pragma warning(pop) +#endif // _NTSTRSAFE_H_INCLUDED_ + +#endif // _STRSAFE_H_INCLUDED_ diff --git a/SDK/dxSDK/Include/xact.h b/SDK/dxSDK/Include/xact.h new file mode 100644 index 00000000..6955b830 --- /dev/null +++ b/SDK/dxSDK/Include/xact.h @@ -0,0 +1,1643 @@ +/*++ + +Copyright (C) Microsoft Corporation. All rights reserved. + +Module Name: + + xact.h + +Abstract: + + XACT public interfaces, functions and data types + +--*/ + +#pragma once + +#ifndef _XACT_H_ +#define _XACT_H_ + +//------------------------------------------------------------------------------ +// XACT class and interface IDs (Version 2.9) +//------------------------------------------------------------------------------ +#ifndef _XBOX // XACT COM support only exists on Windows + #include // For DEFINE_CLSID, DEFINE_IID and DECLARE_INTERFACE + DEFINE_CLSID(XACTEngine, 343e68e6, 8f82, 4a8d, a2, da, 6e, 9a, 94, 4b, 37, 8c); + DEFINE_CLSID(XACTAuditionEngine, cedde475, 50b5, 47ef, 91, a7, 3b, 49, a0, e8, e5, 88); + DEFINE_CLSID(XACTDebugEngine, 3cbb606b, 06f1, 473e, 9d, d5, 0e, 4a, 3b, 47, 14, 13); + DEFINE_IID(IXACTEngine, 893ff2e4, 8d03, 4d5f, b0, aa, 36, 3a, 9c, bb, f4, 37); +#endif + +// Ignore the rest of this header if only the GUID definitions were requested: +#ifndef GUID_DEFS_ONLY + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#ifndef _XBOX + #include + #include + #include +#else + #include +#endif +#include +#include + +//------------------------------------------------------------------------------ +// Forward Declarations +//------------------------------------------------------------------------------ + +typedef struct IXACTSoundBank IXACTSoundBank; +typedef struct IXACTWaveBank IXACTWaveBank; +typedef struct IXACTCue IXACTCue; +typedef struct IXACTWave IXACTWave; +typedef struct IXACTEngine IXACTEngine; +typedef struct XACT_NOTIFICATION XACT_NOTIFICATION; + + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +typedef WORD XACTINDEX; // All normal indices +typedef BYTE XACTNOTIFICATIONTYPE; // Notification type +typedef FLOAT XACTVARIABLEVALUE; // Variable value +typedef WORD XACTVARIABLEINDEX; // Variable index +typedef WORD XACTCATEGORY; // Sound category +typedef BYTE XACTCHANNEL; // Audio channel +typedef FLOAT XACTVOLUME; // Volume value +typedef LONG XACTTIME; // Time (in ms) +typedef SHORT XACTPITCH; // Pitch value +typedef BYTE XACTLOOPCOUNT; // For all loops / recurrences +typedef BYTE XACTVARIATIONWEIGHT; // Variation weight +typedef BYTE XACTPRIORITY; // Sound priority +typedef BYTE XACTINSTANCELIMIT; // Instance limitations + +//------------------------------------------------------------------------------ +// Standard win32 multimedia definitions +//------------------------------------------------------------------------------ +#ifndef WAVE_FORMAT_IEEE_FLOAT + #define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#endif + +#ifndef WAVE_FORMAT_EXTENSIBLE + #define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#endif + +#ifndef _WAVEFORMATEX_ +#define _WAVEFORMATEX_ + #pragma pack(push, 1) + typedef struct tWAVEFORMATEX + { + WORD wFormatTag; // format type + WORD nChannels; // number of channels (i.e. mono, stereo...) + DWORD nSamplesPerSec; // sample rate + DWORD nAvgBytesPerSec; // for buffer estimation + WORD nBlockAlign; // block size of data + WORD wBitsPerSample; // Number of bits per sample of mono data + WORD cbSize; // The count in bytes of the size of extra information (after cbSize) + + } WAVEFORMATEX, *PWAVEFORMATEX; + typedef WAVEFORMATEX NEAR *NPWAVEFORMATEX; + typedef WAVEFORMATEX FAR *LPWAVEFORMATEX; + #pragma pack(pop) +#endif + +#ifndef _WAVEFORMATEXTENSIBLE_ +#define _WAVEFORMATEXTENSIBLE_ + #pragma pack(push, 1) + typedef struct + { + WAVEFORMATEX Format; // WAVEFORMATEX data + + union + { + WORD wValidBitsPerSample; // Bits of precision + WORD wSamplesPerBlock; // Samples per block of audio data, valid if wBitsPerSample==0 + WORD wReserved; // Unused -- If neither applies, set to zero. + } Samples; + + DWORD dwChannelMask; // Speaker usage bitmask + GUID SubFormat; // Sub-format identifier + } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; + #pragma pack(pop) +#endif + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ +static const XACTTIME XACTTIME_MIN = LONG_MIN; +static const XACTTIME XACTTIME_MAX = LONG_MAX; // 24 days 20:31:23.647 +static const XACTTIME XACTTIME_INFINITE = LONG_MAX; +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_INFINITE = 0xff; +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MIN = 0x00; // == 1 instance total (0 additional instances) +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MAX = 0xfe; // == 255 instances total (254 additional instances) +static const XACTINDEX XACTINDEX_MIN = 0x0; +static const XACTINDEX XACTINDEX_MAX = 0xfffe; +static const XACTINDEX XACTINDEX_INVALID = 0xffff; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MIN = 0x00; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MAX = 0xff; +static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MIN = -FLT_MAX; +static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MAX = FLT_MAX; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MIN = 0x0000; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MAX = 0xfffe; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_INVALID = 0xffff; +static const XACTCATEGORY XACTCATEGORY_MIN = 0x0; +static const XACTCATEGORY XACTCATEGORY_MAX = 0xfffe; +static const XACTCATEGORY XACTCATEGORY_INVALID = 0xffff; +static const XACTCHANNEL XACTCHANNEL_MIN = 0; +static const XACTCHANNEL XACTCHANNEL_MAX = 0xFF; +static const XACTPITCH XACTPITCH_MIN = -1200; // pitch change allowable per individual content field +static const XACTPITCH XACTPITCH_MAX = 1200; +static const XACTPITCH XACTPITCH_MIN_TOTAL = -2400; // total allowable pitch change, use with IXACTWave.SetPitch() +static const XACTPITCH XACTPITCH_MAX_TOTAL = 2400; +static const XACTVOLUME XACTVOLUME_MIN = 0.0f; +static const XACTVOLUME XACTVOLUME_MAX = FLT_MAX; +static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MIN = -FLT_MAX; +static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MAX = FLT_MAX; +static const XACTLOOPCOUNT XACTLOOPCOUNT_MIN = 0x0; +static const XACTLOOPCOUNT XACTLOOPCOUNT_MAX = 0xfe; +static const XACTLOOPCOUNT XACTLOOPCOUNT_INFINITE = 0xff; +static const DWORD XACTWAVEALIGNMENT_MIN = 2048; +#ifdef _XBOX +static const XAUDIOVOICEINDEX XACTMAXOUTPUTVOICECOUNT = 3; +#endif // _XBOX + + +// ----------------------------------------------------------------------------- +// Cue friendly name length +// ----------------------------------------------------------------------------- +#define XACT_CUE_NAME_LENGTH 0xFF + +// ----------------------------------------------------------------------------- +// Current Content Tool Version +// ----------------------------------------------------------------------------- +#define XACT_CONTENT_VERSION 43 + +// ----------------------------------------------------------------------------- +// XACT Stop Flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_STOP_RELEASE = 0x00000000; // Stop with release envelope (or as authored), for looping waves this acts as break loop. +static const DWORD XACT_FLAG_STOP_IMMEDIATE = 0x00000001; // Stop immediately + +// ----------------------------------------------------------------------------- +// XACT Manage Data Flag - XACT will manage the lifetime of this data +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_MANAGEDATA = 0x00000001; + +// ----------------------------------------------------------------------------- +// XACT Content Preparation Flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_BACKGROUND_MUSIC = 0x00000002; // Marks the waves as background music. +static const DWORD XACT_FLAG_UNITS_MS = 0x00000004; // Indicates that the units passed in are in milliseconds. +static const DWORD XACT_FLAG_UNITS_SAMPLES = 0x00000008; // Indicates that the units passed in are in samples. + +// ----------------------------------------------------------------------------- +// XACT State flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_STATE_CREATED = 0x00000001; // Created, but nothing else +static const DWORD XACT_STATE_PREPARING = 0x00000002; // In the middle of preparing +static const DWORD XACT_STATE_PREPARED = 0x00000004; // Prepared, but not yet played +static const DWORD XACT_STATE_PLAYING = 0x00000008; // Playing (though could be paused) +static const DWORD XACT_STATE_STOPPING = 0x00000010; // Stopping +static const DWORD XACT_STATE_STOPPED = 0x00000020; // Stopped +static const DWORD XACT_STATE_PAUSED = 0x00000040; // Paused (Can be combined with some of the other state flags above) +static const DWORD XACT_STATE_INUSE = 0x00000080; // Object is in use (used by wavebanks and soundbanks). +static const DWORD XACT_STATE_PREPAREFAILED = 0x80000000; // Object preparation failed. + +//------------------------------------------------------------------------------ +// XACT Parameters +//------------------------------------------------------------------------------ + +#define XACT_FLAG_GLOBAL_SETTINGS_MANAGEDATA XACT_FLAG_MANAGEDATA + +// ----------------------------------------------------------------------------- +// File IO Callbacks +// ----------------------------------------------------------------------------- +typedef BOOL (__stdcall * XACT_READFILE_CALLBACK)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); +typedef BOOL (__stdcall * XACT_GETOVERLAPPEDRESULT_CALLBACK)(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait); + +typedef struct XACT_FILEIO_CALLBACKS +{ + XACT_READFILE_CALLBACK readFileCallback; + XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback; + +} XACT_FILEIO_CALLBACKS, *PXACT_FILEIO_CALLBACKS; +typedef const XACT_FILEIO_CALLBACKS *PCXACT_FILEIO_CALLBACKS; + +// ----------------------------------------------------------------------------- +// Notification Callback +// ----------------------------------------------------------------------------- +typedef void (__stdcall * XACT_NOTIFICATION_CALLBACK)(const XACT_NOTIFICATION* pNotification); + +#ifndef _XBOX + +#define XACT_RENDERER_ID_LENGTH 0xff // Maximum number of characters allowed in the renderer ID +#define XACT_RENDERER_NAME_LENGTH 0xff // Maximum number of characters allowed in the renderer display name. + +// ----------------------------------------------------------------------------- +// Renderer Details +// ----------------------------------------------------------------------------- +typedef struct XACT_RENDERER_DETAILS +{ + WCHAR rendererID[XACT_RENDERER_ID_LENGTH]; // The string ID for the rendering device. + WCHAR displayName[XACT_RENDERER_NAME_LENGTH]; // A friendly name suitable for display to a human. + BOOL defaultDevice; // Set to TRUE if this device is the primary audio device on the system. + +} XACT_RENDERER_DETAILS, *LPXACT_RENDERER_DETAILS; +#endif + +// ----------------------------------------------------------------------------- +// Engine Look-Ahead Time +// ----------------------------------------------------------------------------- +#define XACT_ENGINE_LOOKAHEAD_DEFAULT 250 // Default look-ahead time of 250ms can be used during XACT engine initialization. + +// ----------------------------------------------------------------------------- +// Runtime (engine) parameters +// ----------------------------------------------------------------------------- +typedef struct XACT_RUNTIME_PARAMETERS +{ + DWORD lookAheadTime; // Time in ms + void* pGlobalSettingsBuffer; // Buffer containing the global settings file + DWORD globalSettingsBufferSize; // Size of global settings buffer + DWORD globalSettingsFlags; // Flags for global settings + DWORD globalSettingsAllocAttributes; // Global settings buffer allocation attributes (see XMemAlloc) + XACT_FILEIO_CALLBACKS fileIOCallbacks; // File I/O callbacks + XACT_NOTIFICATION_CALLBACK fnNotificationCallback; // Callback that receives notifications. +#ifndef _XBOX + PWSTR pRendererID; // Ptr to the ID for the audio renderer the engine should connect to. +#endif + +} XACT_RUNTIME_PARAMETERS, *LPXACT_RUNTIME_PARAMETERS; +typedef const XACT_RUNTIME_PARAMETERS *LPCXACT_RUNTIME_PARAMETERS; + +//------------------------------------------------------------------------------ +// Streaming Parameters +//------------------------------------------------------------------------------ + +typedef struct XACT_STREAMING_PARAMETERS +{ + HANDLE file; // File handle associated with wavebank data + DWORD offset; // Offset within file of wavebank header (must be sector aligned) + DWORD flags; // Flags (none currently) + WORD packetSize; // Stream packet size (in sectors) to use for each stream (min = 2) + // number of sectors (DVD = 2048 bytes: 2 = 4096, 3 = 6144, 4 = 8192 etc.) + // optimal DVD size is a multiple of 16 (DVD block = 16 DVD sectors) + +} XACT_WAVEBANK_STREAMING_PARAMETERS, *LPXACT_WAVEBANK_STREAMING_PARAMETERS, XACT_STREAMING_PARAMETERS, *LPXACT_STREAMING_PARAMETERS; +typedef const XACT_STREAMING_PARAMETERS *LPCXACT_STREAMING_PARAMETERS; +typedef const XACT_WAVEBANK_STREAMING_PARAMETERS *LPCXACT_WAVEBANK_STREAMING_PARAMETERS; + +// Structure used to report cue properties back to the client. +typedef struct XACT_CUE_PROPERTIES +{ + CHAR friendlyName[XACT_CUE_NAME_LENGTH]; // Empty if the soundbank doesn't contain any friendly names + BOOL interactive; // TRUE if an IA cue; FALSE otherwise + XACTINDEX iaVariableIndex; // Only valid for IA cues; XACTINDEX_INVALID otherwise + XACTINDEX numVariations; // Number of variations in the cue + XACTINSTANCELIMIT maxInstances; // Number of maximum instances for this cue + XACTINSTANCELIMIT currentInstances; // Current active instances of this cue + +} XACT_CUE_PROPERTIES, *LPXACT_CUE_PROPERTIES; + +// Strucutre used to return the track properties. +typedef struct XACT_TRACK_PROPERTIES +{ + XACTTIME duration; // Duration of the track in ms + XACTINDEX numVariations; // Number of wave variations in the track + XACTCHANNEL numChannels; // Number of channels for the active wave variation on this track + XACTINDEX waveVariation; // Index of the active wave variation + XACTLOOPCOUNT loopCount; // Current loop count on this track + +} XACT_TRACK_PROPERTIES, *LPXACT_TRACK_PROPERTIES; + +// Structure used to return the properties of a variation. +typedef struct XACT_VARIATION_PROPERTIES +{ + XACTINDEX index; // Index of the variation in the cue's variation list + XACTVARIATIONWEIGHT weight; // Weight for the active variation. Valid only for complex cues + XACTVARIABLEVALUE iaVariableMin; // Valid only for IA cues + XACTVARIABLEVALUE iaVariableMax; // Valid only for IA cues + BOOL linger; // Valid only for IA cues + +} XACT_VARIATION_PROPERTIES, *LPXACT_VARIATION_PROPERTIES; + +// Structure used to return the properties of the sound referenced by a variation. +typedef struct XACT_SOUND_PROPERTIES +{ + XACTCATEGORY category; // Category this sound belongs to + BYTE priority; // Priority of this variation + XACTPITCH pitch; // Current pitch set on the active variation + XACTVOLUME volume; // Current volume set on the active variation + XACTINDEX numTracks; // Number of tracks in the active variation + XACT_TRACK_PROPERTIES arrTrackProperties[1]; // Array of active track properties (has numTracks number of elements) + +} XACT_SOUND_PROPERTIES, *LPXACT_SOUND_PROPERTIES; + +// Structure used to return the properties of the active variation and the sound referenced. +typedef struct XACT_SOUND_VARIATION_PROPERTIES +{ + XACT_VARIATION_PROPERTIES variationProperties;// Properties for this variation + XACT_SOUND_PROPERTIES soundProperties; // Proeprties for the sound referenced by this variation + +} XACT_SOUND_VARIATION_PROPERTIES, *LPXACT_SOUND_VARIATION_PROPERTIES; + +// Structure used to return the properties of an active cue instance. +typedef struct XACT_CUE_INSTANCE_PROPERTIES +{ + DWORD allocAttributes; // Buffer allocation attributes (see XMemAlloc) + XACT_CUE_PROPERTIES cueProperties; // Properties of the cue that are shared by all instances. + XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties; // Properties if the currently active variation. + +} XACT_CUE_INSTANCE_PROPERTIES, *LPXACT_CUE_INSTANCE_PROPERTIES; + +// Structure used to return the common wave properties. +typedef struct XACT_WAVE_PROPERTIES +{ + char friendlyName[WAVEBANK_ENTRYNAME_LENGTH]; // Friendly name for the wave; empty if the wavebank doesn't contain friendly names. + WAVEBANKMINIWAVEFORMAT format; // Format for the wave. + DWORD durationInSamples; // Duration of the wave in units of one sample + WAVEBANKSAMPLEREGION loopRegion; // Loop region defined in samples. + BOOL streaming; // Set to TRUE if the wave is streaming; FALSE otherwise. + +} XACT_WAVE_PROPERTIES, *LPXACT_WAVE_PROPERTIES; +typedef const XACT_WAVE_PROPERTIES* LPCXACT_WAVE_PROPERTIES; + +// Structure used to return the properties specific to a wave instance. +typedef struct XACT_WAVE_INSTANCE_PROPERTIES +{ + XACT_WAVE_PROPERTIES properties; // Static properties common to all the wave instances. + BOOL backgroundMusic; // Set to TRUE if the wave is tagged as background music; FALSE otherwise. + +} XACT_WAVE_INSTANCE_PROPERTIES, *LPXACT_WAVE_INSTANCE_PROPERTIES; +typedef const XACT_WAVE_INSTANCE_PROPERTIES* LPCXACT_WAVE_INSTANCE_PROPERTIES; + +//------------------------------------------------------------------------------ +// Channel Mapping / Speaker Panning +//------------------------------------------------------------------------------ + +typedef struct XACTCHANNELMAPENTRY +{ + XACTCHANNEL InputChannel; + XACTCHANNEL OutputChannel; + XACTVOLUME Volume; + +} XACTCHANNELMAPENTRY, *LPXACTCHANNELMAPENTRY; +typedef const XACTCHANNELMAPENTRY *LPCXACTCHANNELMAPENTRY; + +typedef struct XACTCHANNELMAP +{ + XACTCHANNEL EntryCount; + XACTCHANNELMAPENTRY* paEntries; + +} XACTCHANNELMAP, *LPXACTCHANNELMAP; +typedef const XACTCHANNELMAP *LPCXACTCHANNELMAP; + +typedef struct XACTCHANNELVOLUMEENTRY +{ + XACTCHANNEL EntryIndex; + XACTVOLUME Volume; + +} XACTCHANNELVOLUMEENTRY, *LPXACTCHANNELVOLUMEENTRY; +typedef const XACTCHANNELVOLUMEENTRY *LPCXACTCHANNELVOLUMEENTRY; + +typedef struct XACTCHANNELVOLUME +{ + XACTCHANNEL EntryCount; + XACTCHANNELVOLUMEENTRY* paEntries; + +} XACTCHANNELVOLUME, *LPXACTCHANNELVOLUME; +typedef const XACTCHANNELVOLUME *LPCXACTCHANNELVOLUME; + +//------------------------------------------------------------------------------ +// Notifications +//------------------------------------------------------------------------------ + +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPREPARED = 1; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPLAY = 2; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUESTOP = 3; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MARKER = 5; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; // None, SoundBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; // None, WaveBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED = 8; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GLOBALVARIABLECHANGED = 9; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUICONNECTED = 10; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUIDISCONNECTED = 11; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPREPARED = 12; // None, WaveBank & wave index, wave instance. +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPLAY = 13; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVESTOP = 14; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVELOOPED = 15; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; // None, WaveBank & wave index, wave instance. +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKPREPARED = 17; // None, WaveBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT = 18; // None, WaveBank + +static const BYTE XACT_FLAG_NOTIFICATION_PERSIST = 0x01; + +// Pack the notification structures +#pragma pack(push, 1) + +// Notification description used for registering, un-registering and flushing notifications +typedef struct XACT_NOTIFICATION_DESCRIPTION +{ + XACTNOTIFICATIONTYPE type; // Notification type + BYTE flags; // Flags + IXACTSoundBank* pSoundBank; // SoundBank instance + IXACTWaveBank* pWaveBank; // WaveBank instance + IXACTCue* pCue; // Cue instance + IXACTWave* pWave; // Wave instance + XACTINDEX cueIndex; // Cue index + XACTINDEX waveIndex; // Wave index + PVOID pvContext; // User context (optional) + +} XACT_NOTIFICATION_DESCRIPTION, *LPXACT_NOTIFICATION_DESCRIPTION; +typedef const XACT_NOTIFICATION_DESCRIPTION *LPCXACT_NOTIFICATION_DESCRIPTION; + +// Notification structure for all XACTNOTIFICATIONTYPE_CUE* notifications +typedef struct XACT_NOTIFICATION_CUE +{ + XACTINDEX cueIndex; // Cue index + IXACTSoundBank* pSoundBank; // SoundBank instance + IXACTCue* pCue; // Cue instance + +} XACT_NOTIFICATION_CUE, *LPXACT_NOTIFICATION_CUE; +typedef const XACT_NOTIFICATION_CUE *LPCXACT_NOTIFICATION_CUE; + +// Notification structure for all XACTNOTIFICATIONTYPE_MARKER* notifications +typedef struct XACT_NOTIFICATION_MARKER +{ + XACTINDEX cueIndex; // Cue index + IXACTSoundBank* pSoundBank; // SoundBank instance + IXACTCue* pCue; // Cue instance + DWORD marker; // Marker value + +} XACT_NOTIFICATION_MARKER, *LPXACT_NOTIFICATION_MARKER; +typedef const XACT_NOTIFICATION_MARKER *LPCXACT_NOTIFICATION_MARKER; + +// Notification structure for all XACTNOTIFICATIONTYPE_SOUNDBANK* notifications +typedef struct XACT_NOTIFICATION_SOUNDBANK +{ + IXACTSoundBank* pSoundBank; // SoundBank instance + +} XACT_NOTIFICATION_SOUNDBANK, *LPXACT_NOTIFICATION_SOUNDBANK; +typedef const XACT_NOTIFICATION_SOUNDBANK *LPCXACT_NOTIFICATION_SOUNDBANK; + +// Notification structure for all XACTNOTIFICATIONTYPE_WAVEBANK* notifications +typedef struct XACT_NOTIFICATION_WAVEBANK +{ + IXACTWaveBank* pWaveBank; // WaveBank instance + +} XACT_NOTIFICATION_WAVEBANK, *LPXACT_NOTIFICATION_WAVEBANK; +typedef const XACT_NOTIFICATION_WAVEBANK *LPCXACT_NOTIFICATION_WAVEBANK; + +// Notification structure for all XACTNOTIFICATIONTYPE_*VARIABLE* notifications +typedef struct XACT_NOTIFICATION_VARIABLE +{ + XACTINDEX cueIndex; // Cue index + IXACTSoundBank* pSoundBank; // SoundBank instance + IXACTCue* pCue; // Cue instance + XACTVARIABLEINDEX variableIndex; // Variable index + XACTVARIABLEVALUE variableValue; // Variable value + BOOL local; // TRUE if a local variable + +} XACT_NOTIFICATION_VARIABLE, *LPXACT_NOTIFICATION_VARIABLE; +typedef const XACT_NOTIFICATION_VARIABLE *LPCXACT_NOTIFICATION_VARIABLE; + +// Notification structure for all XACTNOTIFICATIONTYPE_GUI* notifications +typedef struct XACT_NOTIFICATION_GUI +{ + DWORD reserved; // Reserved +} XACT_NOTIFICATION_GUI, *LPXACT_NOTIFICATION_GUI; +typedef const XACT_NOTIFICATION_GUI *LPCXACT_NOTIFICATION_GUI; + +// Notification structure for all XACTNOTIFICATIONTYPE_WAVE* notifications +typedef struct XACT_NOTIFICATION_WAVE +{ + IXACTWaveBank* pWaveBank; // WaveBank + XACTINDEX waveIndex; // Wave index + XACTINDEX cueIndex; // Cue index + IXACTSoundBank* pSoundBank; // SoundBank instance + IXACTCue* pCue; // Cue instance + IXACTWave* pWave; // Wave instance + +} XACT_NOTIFICATION_WAVE, *LPXACT_NOTIFICATION_WAVE; +typedef const XACT_NOTIFICATION_WAVE *LPCXACT_NOTIFICATION_WAVE; + +// General notification structure +typedef struct XACT_NOTIFICATION +{ + XACTNOTIFICATIONTYPE type; // Notification type + LONG timeStamp; // Timestamp of notification (milliseconds) + PVOID pvContext; // User context (optional) + union + { + XACT_NOTIFICATION_CUE cue; // XACTNOTIFICATIONTYPE_CUE* + XACT_NOTIFICATION_MARKER marker; // XACTNOTIFICATIONTYPE_MARKER* + XACT_NOTIFICATION_SOUNDBANK soundBank; // XACTNOTIFICATIONTYPE_SOUNDBANK* + XACT_NOTIFICATION_WAVEBANK waveBank; // XACTNOTIFICATIONTYPE_WAVEBANK* + XACT_NOTIFICATION_VARIABLE variable; // XACTNOTIFICATIONTYPE_VARIABLE* + XACT_NOTIFICATION_GUI gui; // XACTNOTIFICATIONTYPE_GUI* + XACT_NOTIFICATION_WAVE wave; // XACTNOTIFICATIONTYPE_WAVE* + }; + +} XACT_NOTIFICATION, *LPXACT_NOTIFICATION; +typedef const XACT_NOTIFICATION *LPCXACT_NOTIFICATION; +#pragma pack(pop) + +//------------------------------------------------------------------------------ +// IXACTSoundBank +//------------------------------------------------------------------------------ + +#define XACT_FLAG_SOUNDBANK_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE +#define XACT_SOUNDBANKSTATE_INUSE XACT_STATE_INUSE + +STDAPI_(XACTINDEX) IXACTSoundBank_GetCueIndex(IXACTSoundBank* pSoundBank, PCSTR szFriendlyName); +STDAPI IXACTSoundBank_GetNumCues(IXACTSoundBank* pSoundBank, XACTINDEX* pnNumCues); +STDAPI IXACTSoundBank_GetCueProperties(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, LPXACT_CUE_PROPERTIES pProperties); +STDAPI IXACTSoundBank_Prepare(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue); +STDAPI IXACTSoundBank_Play(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue); +STDAPI IXACTSoundBank_Stop(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags); +STDAPI IXACTSoundBank_Destroy(IXACTSoundBank* pSoundBank); +STDAPI IXACTSoundBank_GetState(IXACTSoundBank* pSoundBank, DWORD* pdwState); + +#undef INTERFACE +#define INTERFACE IXACTSoundBank + +DECLARE_INTERFACE(IXACTSoundBank) +{ + STDMETHOD_(XACTINDEX, GetCueIndex)(THIS_ PCSTR szFriendlyName) PURE; + STDMETHOD(GetNumCues)(THIS_ XACTINDEX* pnNumCues) PURE; + STDMETHOD(GetCueProperties)(THIS_ XACTINDEX nCueIndex, LPXACT_CUE_PROPERTIES pProperties) PURE; + STDMETHOD(Prepare)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) PURE; + STDMETHOD(Play)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) PURE; + STDMETHOD(Stop)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags) PURE; + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(GetState)(THIS_ DWORD* pdwState) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACTSoundBank_Destroy(IXACTSoundBank* pSoundBank) +{ + return pSoundBank->Destroy(); +} + +__inline XACTINDEX __stdcall IXACTSoundBank_GetCueIndex(IXACTSoundBank* pSoundBank, PCSTR szFriendlyName) +{ + return pSoundBank->GetCueIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetNumCues(IXACTSoundBank* pSoundBank, XACTINDEX* pnNumCues) +{ + return pSoundBank->GetNumCues(pnNumCues); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetCueProperties(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, LPXACT_CUE_PROPERTIES pProperties) +{ + return pSoundBank->GetCueProperties(nCueIndex, pProperties); +} + +__inline HRESULT __stdcall IXACTSoundBank_Prepare(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) +{ + return pSoundBank->Prepare(nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACTSoundBank_Play(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) +{ + return pSoundBank->Play(nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACTSoundBank_Stop(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags) +{ + return pSoundBank->Stop(nCueIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetState(IXACTSoundBank* pSoundBank, DWORD* pdwState) +{ + return pSoundBank->GetState(pdwState); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACTSoundBank_Destroy(IXACTSoundBank* pSoundBank) +{ + return pSoundBank->lpVtbl->Destroy(pSoundBank); +} + +__inline XACTINDEX __stdcall IXACTSoundBank_GetCueIndex(IXACTSoundBank* pSoundBank, PCSTR szFriendlyName) +{ + return pSoundBank->lpVtbl->GetCueIndex(pSoundBank, szFriendlyName); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetNumCues(IXACTSoundBank* pSoundBank, XACTINDEX* pnNumCues) +{ + return pSoundBank->lpVtbl->GetNumCues(pSoundBank, pnNumCues); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetCueProperties(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, LPXACT_CUE_PROPERTIES pProperties) +{ + return pSoundBank->lpVtbl->GetCueProperties(pSoundBank, nCueIndex, pProperties); +} + +__inline HRESULT __stdcall IXACTSoundBank_Prepare(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) +{ + return pSoundBank->lpVtbl->Prepare(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACTSoundBank_Play(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, IXACTCue** ppCue) +{ + return pSoundBank->lpVtbl->Play(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACTSoundBank_Stop(IXACTSoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags) +{ + return pSoundBank->lpVtbl->Stop(pSoundBank, nCueIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACTSoundBank_GetState(IXACTSoundBank* pSoundBank, DWORD* pdwState) +{ + return pSoundBank->lpVtbl->GetState(pSoundBank, pdwState); +} + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACTWaveBank +//------------------------------------------------------------------------------ +#define XACT_WAVEBANKSTATE_INUSE XACT_STATE_INUSE // Currently in-use +#define XACT_WAVEBANKSTATE_PREPARED XACT_STATE_PREPARED // Prepared +#define XACT_WAVEBANKSTATE_PREPAREFAILED XACT_STATE_PREPAREFAILED // Prepare failed. + + +STDAPI IXACTWaveBank_Destroy(IXACTWaveBank* pWaveBank); +STDAPI IXACTWaveBank_GetState(IXACTWaveBank* pWaveBank, DWORD* pdwState); +STDAPI IXACTWaveBank_GetNumWaves(IXACTWaveBank* pWaveBank, XACTINDEX* pnNumWaves); +STDAPI_(XACTINDEX) IXACTWaveBank_GetWaveIndex(IXACTWaveBank* pWaveBank, PCSTR szFriendlyName); +STDAPI IXACTWaveBank_GetWaveProperties(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, LPXACT_WAVE_PROPERTIES pWaveProperties); +STDAPI IXACTWaveBank_Prepare(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave); +STDAPI IXACTWaveBank_Play(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave); +STDAPI IXACTWaveBank_Stop(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags); + +#undef INTERFACE +#define INTERFACE IXACTWaveBank + +DECLARE_INTERFACE(IXACTWaveBank) +{ + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(GetNumWaves)(THIS_ XACTINDEX* pnNumWaves) PURE; + STDMETHOD_(XACTINDEX, GetWaveIndex)(THIS_ PCSTR szFriendlyName) PURE; + STDMETHOD(GetWaveProperties)(THIS_ XACTINDEX nWaveIndex, LPXACT_WAVE_PROPERTIES pWaveProperties) PURE; + STDMETHOD(Prepare)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) PURE; + STDMETHOD(Play)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) PURE; + STDMETHOD(Stop)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags) PURE; + STDMETHOD(GetState)(THIS_ DWORD* pdwState) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACTWaveBank_Destroy(IXACTWaveBank* pWaveBank) +{ + return pWaveBank->Destroy(); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetNumWaves(IXACTWaveBank* pWaveBank, XACTINDEX* pnNumWaves) +{ + return pWaveBank->GetNumWaves(pnNumWaves); +} + +__inline XACTINDEX __stdcall IXACTWaveBank_GetWaveIndex(IXACTWaveBank* pWaveBank, PCSTR szFriendlyName) +{ + return pWaveBank->GetWaveIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetWaveProperties(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, LPXACT_WAVE_PROPERTIES pWaveProperties) +{ + return pWaveBank->GetWaveProperties(nWaveIndex, pWaveProperties); +} + +__inline HRESULT __stdcall IXACTWaveBank_Prepare(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pWaveBank->Prepare(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTWaveBank_Play(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pWaveBank->Play(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTWaveBank_Stop(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags) +{ + return pWaveBank->Stop(nWaveIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetState(IXACTWaveBank* pWaveBank, DWORD* pdwState) +{ + return pWaveBank->GetState(pdwState); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACTWaveBank_Destroy(IXACTWaveBank* pWaveBank) +{ + return pWaveBank->lpVtbl->Destroy(pWaveBank); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetNumWaves(IXACTWaveBank* pWaveBank, XACTINDEX* pnNumWaves) +{ + return pWaveBank->lpVtbl->GetNumWaves(pWaveBank, pnNumWaves); +} + +__inline XACTINDEX __stdcall IXACTWaveBank_GetWaveIndex(IXACTWaveBank* pWaveBank, PCSTR szFriendlyName) +{ + return pWaveBank->lpVtbl->GetWaveIndex(pWaveBank, szFriendlyName); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetWaveProperties(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, LPXACT_WAVE_PROPERTIES pWaveProperties) +{ + return pWaveBank->lpVtbl->GetWaveProperties(pWaveBank, nWaveIndex, pWaveProperties); +} + +__inline HRESULT __stdcall IXACTWaveBank_Prepare(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pWaveBank->lpVtbl->Prepare(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTWaveBank_Play(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pWaveBank->lpVtbl->Play(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTWaveBank_Stop(IXACTWaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags) +{ + return pWaveBank->lpVtbl->Stop(pWaveBank, nWaveIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACTWaveBank_GetState(IXACTWaveBank* pWaveBank, DWORD* pdwState) +{ + return pWaveBank->lpVtbl->GetState(pWaveBank, pdwState); +} +#endif // __cplusplus + + +//------------------------------------------------------------------------------ +// IXACTWave +//------------------------------------------------------------------------------ + +STDAPI IXACTWave_Destroy(IXACTWave* pWave); +STDAPI IXACTWave_Play(IXACTWave* pWave); +STDAPI IXACTWave_Stop(IXACTWave* pWave, DWORD dwFlags); +STDAPI IXACTWave_Pause(IXACTWave* pWave, BOOL fPause); +STDAPI IXACTWave_GetState(IXACTWave* pWave, DWORD* pdwState); +STDAPI IXACTWave_SetPitch(IXACTWave* pWave, XACTPITCH pitch); +STDAPI IXACTWave_SetVolume(IXACTWave* pWave, XACTVOLUME volume); +STDAPI IXACTWave_SetMatrixCoefficients(IXACTWave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients); +STDAPI IXACTWave_GetProperties(IXACTWave* pWave, LPXACT_WAVE_INSTANCE_PROPERTIES pProperties); + +#undef INTERFACE +#define INTERFACE IXACTWave + +DECLARE_INTERFACE(IXACTWave) +{ + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(Play)(THIS) PURE; + STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Pause)(THIS_ BOOL fPause) PURE; + STDMETHOD(GetState)(THIS_ DWORD* pdwState) PURE; + STDMETHOD(SetPitch)(THIS_ XACTPITCH pitch) PURE; + STDMETHOD(SetVolume)(THIS_ XACTVOLUME volume) PURE; + STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) PURE; + STDMETHOD(GetProperties)(THIS_ LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACTWave_Destroy(IXACTWave* pWave) +{ + return pWave->Destroy(); +} + +__inline HRESULT __stdcall IXACTWave_Play(IXACTWave* pWave) +{ + return pWave->Play(); +} + +__inline HRESULT __stdcall IXACTWave_Stop(IXACTWave* pWave, DWORD dwFlags) +{ + return pWave->Stop(dwFlags); +} + +__inline HRESULT __stdcall IXACTWave_Pause(IXACTWave* pWave, BOOL fPause) +{ + return pWave->Pause(fPause); +} + +__inline HRESULT __stdcall IXACTWave_GetState(IXACTWave* pWave, DWORD* pdwState) +{ + return pWave->GetState(pdwState); +} + +__inline HRESULT __stdcall IXACTWave_SetPitch(IXACTWave* pWave, XACTPITCH pitch) +{ + return pWave->SetPitch(pitch); +} + +__inline HRESULT __stdcall IXACTWave_SetVolume(IXACTWave* pWave, XACTVOLUME volume) +{ + return pWave->SetVolume(volume); +} + +__inline HRESULT __stdcall IXACTWave_SetMatrixCoefficients(IXACTWave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) +{ + return pWave->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline HRESULT __stdcall IXACTWave_GetProperties(IXACTWave* pWave, LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) +{ + return pWave->GetProperties(pProperties); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACTWave_Destroy(IXACTWave* pWave) +{ + return pWave->lpVtbl->Destroy(pWave); +} + +__inline HRESULT __stdcall IXACTWave_Play(IXACTWave* pWave) +{ + return pWave->lpVtbl->Play(pWave); +} + +__inline HRESULT __stdcall IXACTWave_Stop(IXACTWave* pWave, DWORD dwFlags) +{ + return pWave->lpVtbl->Stop(pWave, dwFlags); +} + +__inline HRESULT __stdcall IXACTWave_Pause(IXACTWave* pWave, BOOL fPause) +{ + return pWave->lpVtbl->Pause(pWave, fPause); +} + +__inline HRESULT __stdcall IXACTWave_GetState(IXACTWave* pWave, DWORD* pdwState) +{ + return pWave->lpVtbl->GetState(pWave, pdwState); +} + +__inline HRESULT __stdcall IXACTWave_SetPitch(IXACTWave* pWave, XACTPITCH pitch) +{ + return pWave->lpVtbl->SetPitch(pWave, pitch); +} + +__inline HRESULT __stdcall IXACTWave_SetVolume(IXACTWave* pWave, XACTVOLUME volume) +{ + return pWave->lpVtbl->SetVolume(pWave, volume); +} + +__inline HRESULT __stdcall IXACTWave_SetMatrixCoefficients(IXACTWave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) +{ + return pWave->lpVtbl->SetMatrixCoefficients(pWave, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline HRESULT __stdcall IXACTWave_GetProperties(IXACTWave* pWave, LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) +{ + return pWave->lpVtbl->GetProperties(pWave, pProperties); +} +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACTCue +//------------------------------------------------------------------------------ + +// Cue Flags +#define XACT_FLAG_CUE_STOP_RELEASE XACT_FLAG_STOP_RELEASE +#define XACT_FLAG_CUE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE + +// Mutually exclusive states +#define XACT_CUESTATE_CREATED XACT_STATE_CREATED // Created, but nothing else +#define XACT_CUESTATE_PREPARING XACT_STATE_PREPARING // In the middle of preparing +#define XACT_CUESTATE_PREPARED XACT_STATE_PREPARED // Prepared, but not yet played +#define XACT_CUESTATE_PLAYING XACT_STATE_PLAYING // Playing (though could be paused) +#define XACT_CUESTATE_STOPPING XACT_STATE_STOPPING // Stopping +#define XACT_CUESTATE_STOPPED XACT_STATE_STOPPED // Stopped +#define XACT_CUESTATE_PAUSED XACT_STATE_PAUSED // Paused (can be combined with other states) + +STDAPI IXACTCue_Destroy(IXACTCue* pCue); +STDAPI IXACTCue_Play(IXACTCue* pCue); +STDAPI IXACTCue_Stop(IXACTCue* pCue, DWORD dwFlags); +STDAPI IXACTCue_GetState(IXACTCue* pCue, DWORD* pdwState); +STDAPI IXACTCue_GetChannelMap(IXACTCue*, LPXACTCHANNELMAP pChannelMap, DWORD BufferSize, LPDWORD pRequiredSize); +STDAPI IXACTCue_SetChannelMap(IXACTCue*, LPCXACTCHANNELMAP pChannelMap); +STDAPI IXACTCue_GetChannelVolume(IXACTCue*, LPXACTCHANNELVOLUME pVolume); +STDAPI IXACTCue_SetChannelVolume(IXACTCue*, LPCXACTCHANNELVOLUME pVolume); +STDAPI IXACTCue_SetMatrixCoefficients(IXACTCue*, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients); +STDAPI_(XACTVARIABLEINDEX) IXACTCue_GetVariableIndex(IXACTCue* pCue, PCSTR szFriendlyName); +STDAPI IXACTCue_SetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); +STDAPI IXACTCue_GetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue); +STDAPI IXACTCue_Pause(IXACTCue* pCue, BOOL fPause); +STDAPI IXACTCue_GetProperties(IXACTCue* pCue, LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties); +#ifdef _XBOX +STDAPI IXACTCue_SetVoiceOutput(IXACTCue*, LPCXAUDIOVOICEOUTPUT pVoiceOutput); +STDAPI IXACTCue_SetVoiceOutputVolume(IXACTCue*, LPCXAUDIOVOICEOUTPUTVOLUME pVolume); +#endif // _XBOX + +#undef INTERFACE +#define INTERFACE IXACTCue + +DECLARE_INTERFACE(IXACTCue) +{ + STDMETHOD(Play)(THIS) PURE; + STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetState)(THIS_ DWORD* pdwState) PURE; + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(GetChannelMap)(THIS_ LPXACTCHANNELMAP pChannelMap, DWORD BufferSize, LPDWORD pRequiredSize) PURE; + STDMETHOD(SetChannelMap)(THIS_ LPCXACTCHANNELMAP pChannelMap) PURE; + STDMETHOD(GetChannelVolume)(THIS_ LPXACTCHANNELVOLUME pVolume) PURE; + STDMETHOD(SetChannelVolume)(THIS_ LPCXACTCHANNELVOLUME pVolume) PURE; + STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) PURE; + STDMETHOD_(XACTVARIABLEINDEX, GetVariableIndex)(THIS_ PCSTR szFriendlyName) PURE; + STDMETHOD(SetVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE; + STDMETHOD(GetVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue) PURE; + STDMETHOD(Pause)(THIS_ BOOL fPause) PURE; + STDMETHOD(GetProperties)(THIS_ LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) PURE; +#ifdef _XBOX + STDMETHOD(SetVoiceOutput)(THIS_ LPCXAUDIOVOICEOUTPUT pVoiceOutput) PURE; + STDMETHOD(SetVoiceOutputVolume)(THIS_ LPCXAUDIOVOICEOUTPUTVOLUME pVolume) PURE; +#endif // _XBOX +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACTCue_Play(IXACTCue* pCue) +{ + return pCue->Play(); +} + +__inline HRESULT __stdcall IXACTCue_Stop(IXACTCue* pCue, DWORD dwFlags) +{ + return pCue->Stop(dwFlags); +} + +__inline HRESULT __stdcall IXACTCue_GetState(IXACTCue* pCue, DWORD* pdwState) +{ + return pCue->GetState(pdwState); +} + +__inline HRESULT __stdcall IXACTCue_Destroy(IXACTCue* pCue) +{ + return pCue->Destroy(); +} + +__inline HRESULT __stdcall IXACTCue_GetChannelMap(IXACTCue* pCue, LPXACTCHANNELMAP pChannelMap, DWORD BufferSize, LPDWORD pRequiredSize) +{ + return pCue->GetChannelMap(pChannelMap, BufferSize, pRequiredSize); +} + +__inline HRESULT __stdcall IXACTCue_SetChannelMap(IXACTCue* pCue, LPCXACTCHANNELMAP pChannelMap) +{ + return pCue->SetChannelMap(pChannelMap); +} + +__inline HRESULT __stdcall IXACTCue_GetChannelVolume(IXACTCue* pCue, LPXACTCHANNELVOLUME pVolume) +{ + return pCue->GetChannelVolume(pVolume); +} + +__inline HRESULT __stdcall IXACTCue_SetChannelVolume(IXACTCue* pCue, LPCXACTCHANNELVOLUME pVolume) +{ + return pCue->SetChannelVolume(pVolume); +} + +__inline HRESULT __stdcall IXACTCue_SetMatrixCoefficients(IXACTCue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) +{ + return pCue->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline XACTVARIABLEINDEX __stdcall IXACTCue_GetVariableIndex(IXACTCue* pCue, PCSTR szFriendlyName) +{ + return pCue->GetVariableIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACTCue_SetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pCue->SetVariable(nIndex, nValue); +} + +__inline HRESULT __stdcall IXACTCue_GetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* pnValue) +{ + return pCue->GetVariable(nIndex, pnValue); +} + +__inline HRESULT __stdcall IXACTCue_Pause(IXACTCue* pCue, BOOL fPause) +{ + return pCue->Pause(fPause); +} + +__inline HRESULT __stdcall IXACTCue_GetProperties(IXACTCue* pCue, LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) +{ + return pCue->GetProperties(ppProperties); +} + +#ifdef _XBOX +__inline HRESULT __stdcall IXACTCue_SetVoiceOutput(IXACTCue* pCue, LPCXAUDIOVOICEOUTPUT pVoiceOutput) +{ + return pCue->SetVoiceOutput(pVoiceOutput); +} + +__inline HRESULT __stdcall IXACTCue_SetVoiceOutputVolume(IXACTCue* pCue, LPCXAUDIOVOICEOUTPUTVOLUME pVolume) +{ + return pCue->SetVoiceOutputVolume(pVolume); +} +#endif // _XBOX + +#else // __cplusplus + +__inline HRESULT __stdcall IXACTCue_Play(IXACTCue* pCue) +{ + return pCue->lpVtbl->Play(pCue); +} + +__inline HRESULT __stdcall IXACTCue_Stop(IXACTCue* pCue, DWORD dwFlags) +{ + return pCue->lpVtbl->Stop(pCue, dwFlags); +} + +__inline HRESULT __stdcall IXACTCue_GetState(IXACTCue* pCue, DWORD* pdwState) +{ + return pCue->lpVtbl->GetState(pCue, pdwState); +} + +__inline HRESULT __stdcall IXACTCue_Destroy(IXACTCue* pCue) +{ + return pCue->lpVtbl->Destroy(pCue); +} + +__inline HRESULT __stdcall IXACTCue_GetChannelMap(IXACTCue* pCue, LPXACTCHANNELMAP pChannelMap, DWORD BufferSize, LPDWORD pRequiredSize) +{ + return pCue->lpVtbl->GetChannelMap(pCue, pChannelMap, BufferSize, pRequiredSize); +} + +__inline HRESULT __stdcall IXACTCue_SetChannelMap(IXACTCue* pCue, LPCXACTCHANNELMAP pChannelMap) +{ + return pCue->lpVtbl->SetChannelMap(pCue, pChannelMap); +} + +__inline HRESULT __stdcall IXACTCue_GetChannelVolume(IXACTCue* pCue, LPXACTCHANNELVOLUME pVolume) +{ + return pCue->lpVtbl->GetChannelVolume(pCue, pVolume); +} + +__inline HRESULT __stdcall IXACTCue_SetChannelVolume(IXACTCue* pCue, LPCXACTCHANNELVOLUME pVolume) +{ + return pCue->lpVtbl->SetChannelVolume(pCue, pVolume); +} + +__inline HRESULT __stdcall IXACTCue_SetMatrixCoefficients(IXACTCue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, float* pMatrixCoefficients) +{ + return pCue->lpVtbl->SetMatrixCoefficients(pCue, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline XACTVARIABLEINDEX __stdcall IXACTCue_GetVariableIndex(IXACTCue* pCue, PCSTR szFriendlyName) +{ + return pCue->lpVtbl->GetVariableIndex(pCue, szFriendlyName); +} + +__inline HRESULT __stdcall IXACTCue_SetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pCue->lpVtbl->SetVariable(pCue, nIndex, nValue); +} + +__inline HRESULT __stdcall IXACTCue_GetVariable(IXACTCue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* pnValue) +{ + return pCue->lpVtbl->GetVariable(pCue, nIndex, pnValue); +} + +__inline HRESULT __stdcall IXACTCue_Pause(IXACTCue* pCue, BOOL fPause) +{ + return pCue->lpVtbl->Pause(pCue, fPause); +} + +__inline HRESULT __stdcall IXACTCue_GetProperties(IXACTCue* pCue, LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) +{ + return pCue->lpVtbl->GetProperties(pCue, ppProperties); +} + +#ifdef _XBOX +__inline HRESULT __stdcall IXACTCue_SetVoiceOutput(IXACTCue* pCue, LPCXAUDIOVOICEOUTPUT pVoiceOutput) +{ + return pCue->lpVtbl->SetVoiceOutput(pCue, pVoiceOutput); +} + +__inline HRESULT __stdcall IXACTCue_SetVoiceOutputVolume(IXACTCue* pCue, LPCXAUDIOVOICEOUTPUTVOLUME pVolume) +{ + return pCue->lpVtbl->SetVoiceOutputVolume(pCue, pVolume); +} +#endif // _XBOX + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACTEngine +//------------------------------------------------------------------------------ + +// Engine flags +#define XACT_FLAG_ENGINE_CREATE_MANAGEDATA XACT_FLAG_MANAGEDATA +#define XACT_FLAG_ENGINE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE + +STDAPI_(ULONG) IXACTEngine_AddRef(IXACTEngine* pEngine); +STDAPI_(ULONG) IXACTEngine_Release(IXACTEngine* pEngine); +#ifndef _XBOX +STDAPI IXACTEngine_GetRendererCount(IXACTEngine* pEngine, XACTINDEX* pnRendererCount); +STDAPI IXACTEngine_GetRendererDetails(IXACTEngine* pEngine, XACTINDEX nRendererIndex, LPXACT_RENDERER_DETAILS pRendererDetails); +#endif +STDAPI IXACTEngine_GetFinalMixFormat(IXACTEngine* pEngine, WAVEFORMATEXTENSIBLE* pFinalMixFormat); +STDAPI IXACTEngine_Initialize(IXACTEngine* pEngine, const XACT_RUNTIME_PARAMETERS* pParams); +STDAPI IXACTEngine_ShutDown(IXACTEngine* pEngine); +STDAPI IXACTEngine_DoWork(IXACTEngine* pEngine); +STDAPI IXACTEngine_CreateSoundBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank); +STDAPI IXACTEngine_CreateInMemoryWaveBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank); +STDAPI IXACTEngine_CreateStreamingWaveBank(IXACTEngine* pEngine, const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank); +STDAPI IXACTEngine_PrepareWave(IXACTEngine* pEngine, DWORD dwFlags, PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave); +STDAPI IXACTEngine_PrepareInMemoryWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, DWORD* pdwSeekTable, BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave); +STDAPI IXACTEngine_PrepareStreamingWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave); +STDAPI IXACTEngine_RegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); +STDAPI IXACTEngine_UnRegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); +STDAPI_(XACTCATEGORY) IXACTEngine_GetCategory(IXACTEngine* pEngine, PCSTR szFriendlyName); +STDAPI IXACTEngine_Stop(IXACTEngine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags); +STDAPI IXACTEngine_SetVolume(IXACTEngine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume); +STDAPI IXACTEngine_Pause(IXACTEngine* pEngine, XACTCATEGORY nCategory, BOOL fPause); +STDAPI_(XACTVARIABLEINDEX) IXACTEngine_GetGlobalVariableIndex(IXACTEngine* pEngine, PCSTR szFriendlyName); +STDAPI IXACTEngine_SetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); +STDAPI IXACTEngine_GetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* pnValue); + +#undef INTERFACE +#define INTERFACE IXACTEngine + +#ifdef _XBOX +DECLARE_INTERFACE(IXACTEngine) +{ +#else +DECLARE_INTERFACE_(IXACTEngine, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, OUT void** ppvObj) PURE; +#endif + + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + +#ifndef _XBOX + STDMETHOD(GetRendererCount)(THIS_ XACTINDEX* pnRendererCount) PURE; + STDMETHOD(GetRendererDetails)(THIS_ XACTINDEX nRendererIndex, LPXACT_RENDERER_DETAILS pRendererDetails) PURE; +#endif + + STDMETHOD(GetFinalMixFormat)(THIS_ WAVEFORMATEXTENSIBLE* pFinalMixFormat) PURE; + STDMETHOD(Initialize)(THIS_ const XACT_RUNTIME_PARAMETERS* pParams) PURE; + STDMETHOD(ShutDown)(THIS) PURE; + + STDMETHOD(DoWork)(THIS) PURE; + + STDMETHOD(CreateSoundBank)(THIS_ const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank) PURE; + STDMETHOD(CreateInMemoryWaveBank)(THIS_ const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank) PURE; + STDMETHOD(CreateStreamingWaveBank)(THIS_ const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank) PURE; + + STDMETHOD(PrepareWave)(THIS_ DWORD dwFlags, PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) PURE; + STDMETHOD(PrepareInMemoryWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, DWORD* pdwSeekTable, BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) PURE; + STDMETHOD(PrepareStreamingWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) PURE; + + STDMETHOD(RegisterNotification)(THIS_ const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE; + STDMETHOD(UnRegisterNotification)(THIS_ const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE; + + STDMETHOD_(XACTCATEGORY, GetCategory)(THIS_ PCSTR szFriendlyName) PURE; + STDMETHOD(Stop)(THIS_ XACTCATEGORY nCategory, DWORD dwFlags) PURE; + STDMETHOD(SetVolume)(THIS_ XACTCATEGORY nCategory, XACTVOLUME nVolume) PURE; + STDMETHOD(Pause)(THIS_ XACTCATEGORY nCategory, BOOL fPause) PURE; + + STDMETHOD_(XACTVARIABLEINDEX, GetGlobalVariableIndex)(THIS_ PCSTR szFriendlyName) PURE; + STDMETHOD(SetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE; + STDMETHOD(GetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue) PURE; +}; + +#ifdef __cplusplus + +__inline ULONG __stdcall IXACTEngine_AddRef(IXACTEngine* pEngine) +{ + return pEngine->AddRef(); +} + +__inline ULONG __stdcall IXACTEngine_Release(IXACTEngine* pEngine) +{ + return pEngine->Release(); +} + +#ifndef _XBOX +__inline HRESULT __stdcall IXACTEngine_GetRendererCount(IXACTEngine* pEngine, XACTINDEX* pnRendererCount) +{ + return pEngine->GetRendererCount(pnRendererCount); +} + +__inline HRESULT __stdcall IXACTEngine_GetRendererDetails(IXACTEngine* pEngine, XACTINDEX nRendererIndex, LPXACT_RENDERER_DETAILS pRendererDetails) +{ + return pEngine->GetRendererDetails(nRendererIndex, pRendererDetails); +} +#endif + +__inline HRESULT __stdcall IXACTEngine_GetFinalMixFormat(IXACTEngine* pEngine, WAVEFORMATEXTENSIBLE* pFinalMixFormat) +{ + return pEngine->GetFinalMixFormat(pFinalMixFormat); +} + +__inline HRESULT __stdcall IXACTEngine_Initialize(IXACTEngine* pEngine, const XACT_RUNTIME_PARAMETERS* pParams) +{ + return pEngine->Initialize(pParams); +} + +__inline HRESULT __stdcall IXACTEngine_ShutDown(IXACTEngine* pEngine) +{ + return pEngine->ShutDown(); +} + +__inline HRESULT __stdcall IXACTEngine_DoWork(IXACTEngine* pEngine) +{ + return pEngine->DoWork(); +} + +__inline HRESULT __stdcall IXACTEngine_CreateSoundBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank) +{ + return pEngine->CreateSoundBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank); +} + +__inline HRESULT __stdcall IXACTEngine_CreateInMemoryWaveBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank) +{ + return pEngine->CreateInMemoryWaveBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank); +} + +__inline HRESULT __stdcall IXACTEngine_CreateStreamingWaveBank(IXACTEngine* pEngine, const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank) +{ + return pEngine->CreateStreamingWaveBank(pParms, ppWaveBank); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareWave(IXACTEngine* pEngine, DWORD dwFlags, PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave * * ppWave) +{ + return pEngine->PrepareWave(dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareInMemoryWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, DWORD* pdwSeekTable, BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pEngine->PrepareInMemoryWave(dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareStreamingWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pEngine->PrepareStreamingWave(dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTEngine_RegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->RegisterNotification(pNotificationDesc); +} + +__inline HRESULT __stdcall IXACTEngine_UnRegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->UnRegisterNotification(pNotificationDesc); +} + +__inline XACTCATEGORY __stdcall IXACTEngine_GetCategory(IXACTEngine* pEngine, PCSTR szFriendlyName) +{ + return pEngine->GetCategory(szFriendlyName); +} + +__inline HRESULT __stdcall IXACTEngine_Stop(IXACTEngine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags) +{ + return pEngine->Stop(nCategory, dwFlags); +} + +__inline HRESULT __stdcall IXACTEngine_SetVolume(IXACTEngine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume) +{ + return pEngine->SetVolume(nCategory, nVolume); +} + +__inline HRESULT __stdcall IXACTEngine_Pause(IXACTEngine* pEngine, XACTCATEGORY nCategory, BOOL fPause) +{ + return pEngine->Pause(nCategory, fPause); +} + +__inline XACTVARIABLEINDEX __stdcall IXACTEngine_GetGlobalVariableIndex(IXACTEngine* pEngine, PCSTR szFriendlyName) +{ + return pEngine->GetGlobalVariableIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACTEngine_SetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pEngine->SetGlobalVariable(nIndex, nValue); +} + +__inline HRESULT __stdcall IXACTEngine_GetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue) +{ + return pEngine->GetGlobalVariable(nIndex, nValue); +} + +#else // __cplusplus + +__inline ULONG __stdcall IXACTEngine_AddRef(IXACTEngine* pEngine) +{ + return pEngine->lpVtbl->AddRef(pEngine); +} + +__inline ULONG __stdcall IXACTEngine_Release(IXACTEngine* pEngine) +{ + return pEngine->lpVtbl->Release(pEngine); +} + +#ifndef _XBOX +__inline HRESULT __stdcall IXACTEngine_GetRendererCount(IXACTEngine* pEngine, XACTINDEX* pnRendererCount) +{ + return pEngine->lpVtbl->GetRendererCount(pEngine, pnRendererCount); +} + +__inline HRESULT __stdcall IXACTEngine_GetRendererDetails(IXACTEngine* pEngine, XACTINDEX nRendererIndex, LPXACT_RENDERER_DETAILS pRendererDetails) +{ + return pEngine->lpVtbl->GetRendererDetails(pEngine, nRendererIndex, pRendererDetails); +} +#endif + +__inline HRESULT __stdcall IXACTEngine_GetFinalMixFormat(IXACTEngine* pEngine, WAVEFORMATEXTENSIBLE* pFinalMixFormat) +{ + return pEngine->lpVtbl->GetFinalMixFormat(pEngine, pFinalMixFormat); +} + +__inline HRESULT __stdcall IXACTEngine_Initialize(IXACTEngine* pEngine, const XACT_RUNTIME_PARAMETERS* pParams) +{ + return pEngine->lpVtbl->Initialize(pEngine, pParams); +} + +__inline HRESULT __stdcall IXACTEngine_ShutDown(IXACTEngine* pEngine) +{ + return pEngine->lpVtbl->ShutDown(pEngine); +} + +__inline HRESULT __stdcall IXACTEngine_DoWork(IXACTEngine* pEngine) +{ + return pEngine->lpVtbl->DoWork(pEngine); +} + +__inline HRESULT __stdcall IXACTEngine_CreateSoundBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank) +{ + return pEngine->lpVtbl->CreateSoundBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank); +} + +__inline HRESULT __stdcall IXACTEngine_CreateInMemoryWaveBank(IXACTEngine* pEngine, const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank) +{ + return pEngine->lpVtbl->CreateInMemoryWaveBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank); +} + +__inline HRESULT __stdcall IXACTEngine_CreateStreamingWaveBank(IXACTEngine* pEngine, const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank) +{ + return pEngine->lpVtbl->CreateStreamingWaveBank(pEngine, pParms, ppWaveBank); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareWave(IXACTEngine* pEngine, DWORD dwFlags, PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave * * ppWave) +{ + return pEngine->lpVtbl->PrepareWave(pEngine, dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareInMemoryWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, DWORD* pdwSeekTable, BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pEngine->lpVtbl->PrepareInMemoryWave(pEngine, dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACTEngine_PrepareStreamingWave(IXACTEngine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, IXACTWave** ppWave) +{ + return pEngine->lpVtbl->PrepareStreamingWave(pEngine, dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave); +} + + +__inline HRESULT __stdcall IXACTEngine_RegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->lpVtbl->RegisterNotification(pEngine, pNotificationDesc); +} + +__inline HRESULT __stdcall IXACTEngine_UnRegisterNotification(IXACTEngine* pEngine, const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->lpVtbl->UnRegisterNotification(pEngine, pNotificationDesc); +} + +__inline XACTCATEGORY __stdcall IXACTEngine_GetCategory(IXACTEngine* pEngine, PCSTR szFriendlyName) +{ + return pEngine->lpVtbl->GetCategory(pEngine, szFriendlyName); +} + +__inline HRESULT __stdcall IXACTEngine_Stop(IXACTEngine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags) +{ + return pEngine->lpVtbl->Stop(pEngine, nCategory, dwFlags); +} + +__inline HRESULT __stdcall IXACTEngine_SetVolume(IXACTEngine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume) +{ + return pEngine->lpVtbl->SetVolume(pEngine, nCategory, nVolume); +} + +__inline HRESULT __stdcall IXACTEngine_Pause(IXACTEngine* pEngine, XACTCATEGORY nCategory, BOOL fPause) +{ + return pEngine->lpVtbl->Pause(pEngine, nCategory, fPause); +} + +__inline XACTVARIABLEINDEX __stdcall IXACTEngine_GetGlobalVariableIndex(IXACTEngine* pEngine, PCSTR szFriendlyName) +{ + return pEngine->lpVtbl->GetGlobalVariableIndex(pEngine, szFriendlyName); +} + +__inline HRESULT __stdcall IXACTEngine_SetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pEngine->lpVtbl->SetGlobalVariable(pEngine, nIndex, nValue); +} + +__inline HRESULT __stdcall IXACTEngine_GetGlobalVariable(IXACTEngine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* nValue) +{ + return pEngine->lpVtbl->GetGlobalVariable(pEngine, nIndex, nValue); +} + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// XACT API's (these are deprecated and will be removed in a future release) +//------------------------------------------------------------------------------ + +#ifdef _XBOX + +#define XACT_FLAG_API_CREATE_MANAGEDATA XACT_FLAG_MANAGEDATA +#define XACT_FLAG_API_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE + +STDAPI XACTInitialize(const XACT_RUNTIME_PARAMETERS* pParams); +STDAPI XACTShutDown(void); +STDAPI XACTDoWork(void); + +STDAPI XACTCreateSoundBank(const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTSoundBank** ppSoundBank); +STDAPI XACTCreateInMemoryWaveBank(const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, IXACTWaveBank** ppWaveBank); +STDAPI XACTCreateStreamingWaveBank(const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, IXACTWaveBank** ppWaveBank); + +STDAPI XACTRegisterNotification(const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); +STDAPI XACTUnRegisterNotification(const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); + +STDAPI_(XACTCATEGORY) XACTGetCategory(PCSTR szFriendlyName); +STDAPI XACTStop(XACTCATEGORY nCategory, DWORD dwFlags); +STDAPI XACTSetVolume(XACTCATEGORY nCategory, XACTVOLUME nVolume); +STDAPI XACTPause(XACTCATEGORY nCategory, BOOL fPause); + +STDAPI_(XACTVARIABLEINDEX) XACTGetGlobalVariableIndex(PCSTR szFriendlyName); +STDAPI XACTSetGlobalVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); +STDAPI XACTGetGlobalVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE* pnValue); + +#endif // #ifdef _XBOX + +//------------------------------------------------------------------------------ +// Create Engine +//------------------------------------------------------------------------------ + +// Flags used only in XACTCreateEngine below. These flags are valid but ignored +// when building for Xbox 360; to enable auditioning on that platform you must +// link explicitly to an auditioning version of the XACT static library. +static const DWORD XACT_FLAG_API_AUDITION_MODE = 0x00000001; +static const DWORD XACT_FLAG_API_DEBUG_MODE = 0x00000002; + +STDAPI XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine); + +#ifndef _XBOX + +#define XACT_DEBUGENGINE_REGISTRY_KEY TEXT("Software\\Microsoft\\XACT") +#define XACT_DEBUGENGINE_REGISTRY_VALUE TEXT("DebugEngine") + +#ifdef __cplusplus + +__inline HRESULT __stdcall XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine) +{ + HRESULT hr; + HKEY key; + DWORD data; + DWORD type = REG_DWORD; + DWORD dataSize = sizeof(DWORD); + BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE; + BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE; + + // If neither the debug nor audition flags are set, see if the debug registry key is set + if(!debug && !audition && + (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS)) + { + if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS) + { + if(data) + { + debug = TRUE; + } + } + RegCloseKey(key); + } + + // Priority order: Audition, Debug, Retail + hr = CoCreateInstance(audition ? __uuidof(XACTAuditionEngine) + : (debug ? __uuidof(XACTDebugEngine) : __uuidof(XACTEngine)), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACTEngine), (void**)ppEngine); + + // If debug engine does not exist fallback to retail version + if(FAILED(hr) && debug && !audition) + { + hr = CoCreateInstance(__uuidof(XACTEngine), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACTEngine), (void**)ppEngine); + } + + return hr; +} + +#else + +__inline HRESULT __stdcall XACTCreateEngine(DWORD dwCreationFlags, IXACTEngine** ppEngine) +{ + HRESULT hr; + HKEY key; + DWORD data; + DWORD type = REG_DWORD; + DWORD dataSize = sizeof(DWORD); + BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE; + BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE; + + // If neither the debug nor audition flags are set, see if the debug registry key is set + if(!debug && !audition && + (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS)) + { + if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS) + { + if(data) + { + debug = TRUE; + } + } + RegCloseKey(key); + } + + // Priority order: Audition, Debug, Retail + hr = CoCreateInstance(audition ? &CLSID_XACTAuditionEngine + : (debug ? &CLSID_XACTDebugEngine : &CLSID_XACTEngine), + NULL, CLSCTX_INPROC_SERVER, &IID_IXACTEngine, (void**)ppEngine); + + // If debug engine does not exist fallback to retail version + if(FAILED(hr) && debug && !audition) + { + hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACTEngine, (void**)ppEngine); + } + + return hr; +} + +#endif // #ifdef __cplusplus +#endif // #ifndef _XBOX + +//------------------------------------------------------------------------------ +// XACT specific error codes +//------------------------------------------------------------------------------ + +#define FACILITY_XACTENGINE 0xAC7 +#define XACTENGINEERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XACTENGINE, n) + +#define XACTENGINE_E_OUTOFMEMORY E_OUTOFMEMORY // Out of memory +#define XACTENGINE_E_INVALIDARG E_INVALIDARG // Invalid arg +#define XACTENGINE_E_NOTIMPL E_NOTIMPL // Not implemented +#define XACTENGINE_E_FAIL E_FAIL // Unknown error + +#define XACTENGINE_E_ALREADYINITIALIZED XACTENGINEERROR(0x001) // The engine is already initialized +#define XACTENGINE_E_NOTINITIALIZED XACTENGINEERROR(0x002) // The engine has not been initialized +#define XACTENGINE_E_EXPIRED XACTENGINEERROR(0x003) // The engine has expired (demo or pre-release version) +#define XACTENGINE_E_NONOTIFICATIONCALLBACK XACTENGINEERROR(0x004) // No notification callback +#define XACTENGINE_E_NOTIFICATIONREGISTERED XACTENGINEERROR(0x005) // Notification already registered +#define XACTENGINE_E_INVALIDUSAGE XACTENGINEERROR(0x006) // Invalid usage +#define XACTENGINE_E_INVALIDDATA XACTENGINEERROR(0x007) // Invalid data +#define XACTENGINE_E_INSTANCELIMITFAILTOPLAY XACTENGINEERROR(0x008) // Fail to play due to instance limit +#define XACTENGINE_E_NOGLOBALSETTINGS XACTENGINEERROR(0x009) // Global Settings not loaded +#define XACTENGINE_E_INVALIDVARIABLEINDEX XACTENGINEERROR(0x00a) // Invalid variable index +#define XACTENGINE_E_INVALIDCATEGORY XACTENGINEERROR(0x00b) // Invalid category +#define XACTENGINE_E_INVALIDCUEINDEX XACTENGINEERROR(0x00c) // Invalid cue index +#define XACTENGINE_E_INVALIDWAVEINDEX XACTENGINEERROR(0x00d) // Invalid wave index +#define XACTENGINE_E_INVALIDTRACKINDEX XACTENGINEERROR(0x00e) // Invalid track index +#define XACTENGINE_E_INVALIDSOUNDOFFSETORINDEX XACTENGINEERROR(0x00f) // Invalid sound offset or index +#define XACTENGINE_E_READFILE XACTENGINEERROR(0x010) // Error reading a file +#define XACTENGINE_E_UNKNOWNEVENT XACTENGINEERROR(0x011) // Unknown event type +#define XACTENGINE_E_INCALLBACK XACTENGINEERROR(0x012) // Invalid call of method of function from callback +#define XACTENGINE_E_NOWAVEBANK XACTENGINEERROR(0x013) // No wavebank exists for desired operation +#define XACTENGINE_E_SELECTVARIATION XACTENGINEERROR(0x014) // Unable to select a variation +#define XACTENGINE_E_MULTIPLEAUDITIONENGINES XACTENGINEERROR(0x015) // There can be only one audition engine +#define XACTENGINE_E_WAVEBANKNOTPREPARED XACTENGINEERROR(0x016) // The wavebank is not prepared +#define XACTENGINE_E_NORENDERER XACTENGINEERROR(0x017) // No audio device found on. +#define XACTENGINE_E_INVALIDENTRYCOUNT XACTENGINEERROR(0x018) // Invalid entry count for channel maps +#define XACTENGINE_E_SEEKTIMEBEYONDCUEEND XACTENGINEERROR(0x019) // Time offset for seeking is beyond the cue end. +#define XACTENGINE_E_SEEKTIMEBEYONDWAVEEND XACTENGINEERROR(0x019) // Time offset for seeking is beyond the wave end. +#define XACTENGINE_E_NOFRIENDLYNAMES XACTENGINEERROR(0x01a) // Friendly names are not included in the bank. + +#define XACTENGINE_E_AUDITION_WRITEFILE XACTENGINEERROR(0x101) // Error writing a file during auditioning +#define XACTENGINE_E_AUDITION_NOSOUNDBANK XACTENGINEERROR(0x102) // Missing a soundbank +#define XACTENGINE_E_AUDITION_INVALIDRPCINDEX XACTENGINEERROR(0x103) // Missing an RPC curve +#define XACTENGINE_E_AUDITION_MISSINGDATA XACTENGINEERROR(0x104) // Missing data for an audition command +#define XACTENGINE_E_AUDITION_UNKNOWNCOMMAND XACTENGINEERROR(0x105) // Unknown command +#define XACTENGINE_E_AUDITION_INVALIDDSPINDEX XACTENGINEERROR(0x106) // Missing a DSP parameter +#define XACTENGINE_E_AUDITION_MISSINGWAVE XACTENGINEERROR(0x107) // Wave does not exist in auditioned wavebank +#define XACTENGINE_E_AUDITION_CREATEDIRECTORYFAILED XACTENGINEERROR(0x108) // Failed to create a directory for streaming wavebank data +#define XACTENGINE_E_AUDITION_INVALIDSESSION XACTENGINEERROR(0x109) // Invalid audition session +#endif // #ifndef GUID_DEFS_ONLY +#endif // #ifndef _XACT_H_ diff --git a/SDK/dxSDK/Include/xact2wb.h b/SDK/dxSDK/Include/xact2wb.h new file mode 100644 index 00000000..9105b218 --- /dev/null +++ b/SDK/dxSDK/Include/xact2wb.h @@ -0,0 +1,402 @@ +/*************************************************************************** + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: xact2wb.h + * Content: XACT 2 wave bank definitions. + * + ****************************************************************************/ + +#ifndef __XACTWB_H__ +#define __XACTWB_H__ + +#ifdef _XBOX +# include +#else +# include +#endif + +#include + +#pragma warning(push) +#pragma warning(disable:4201) +#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int + +#pragma pack(push, 1) +#if !defined(_X86_) + #define XACTUNALIGNED __unaligned +#else + #define XACTUNALIGNED +#endif + +#ifdef _M_PPCBE +#pragma bitfield_order(push, lsb_to_msb) +#endif + +#define WAVEBANK_HEADER_SIGNATURE 'DNBW' // WaveBank RIFF chunk signature +#define WAVEBANK_HEADER_VERSION 42 // Current wavebank file version + +#define WAVEBANK_BANKNAME_LENGTH 64 // Wave bank friendly name length, in characters +#define WAVEBANK_ENTRYNAME_LENGTH 64 // Wave bank entry friendly name length, in characters + +#define WAVEBANK_MAX_DATA_SEGMENT_SIZE 0xFFFFFFFF // Maximum wave bank data segment size, in bytes +#define WAVEBANK_MAX_COMPACT_DATA_SEGMENT_SIZE 0x001FFFFF // Maximum compact wave bank data segment size, in bytes + +typedef DWORD WAVEBANKOFFSET; + +// +// Bank flags +// + +#define WAVEBANK_TYPE_BUFFER 0x00000000 // In-memory buffer +#define WAVEBANK_TYPE_STREAMING 0x00000001 // Streaming +#define WAVEBANK_TYPE_MASK 0x00000001 + +#define WAVEBANK_FLAGS_ENTRYNAMES 0x00010000 // Bank includes entry names +#define WAVEBANK_FLAGS_COMPACT 0x00020000 // Bank uses compact format +#define WAVEBANK_FLAGS_SYNC_DISABLED 0x00040000 // Bank is disabled for audition sync +#define WAVEBANK_FLAGS_SEEKTABLES 0x00080000 // Bank includes seek tables. +#define WAVEBANK_FLAGS_MASK 0x000F0000 + +// +// Entry flags +// + +#define WAVEBANKENTRY_FLAGS_READAHEAD 0x00000001 // Enable stream read-ahead +#define WAVEBANKENTRY_FLAGS_LOOPCACHE 0x00000002 // One or more looping sounds use this wave +#define WAVEBANKENTRY_FLAGS_REMOVELOOPTAIL 0x00000004 // Remove data after the end of the loop region +#define WAVEBANKENTRY_FLAGS_IGNORELOOP 0x00000008 // Used internally when the loop region can't be used +#define WAVEBANKENTRY_FLAGS_MASK 0x00000008 + +// +// Entry wave format identifiers +// + +#define WAVEBANKMINIFORMAT_TAG_PCM 0x0 // PCM data +#define WAVEBANKMINIFORMAT_TAG_XMA 0x1 // XMA data +#define WAVEBANKMINIFORMAT_TAG_ADPCM 0x2 // ADPCM data + +#define WAVEBANKMINIFORMAT_BITDEPTH_8 0x0 // 8-bit data (PCM only) +#define WAVEBANKMINIFORMAT_BITDEPTH_16 0x1 // 16-bit data (PCM only) + +// +// Arbitrary fixed sizes +// +#define WAVEBANKENTRY_XMASTREAMS_MAX 3 // enough for 5.1 channel audio +#define WAVEBANKENTRY_XMACHANNELS_MAX 6 // enough for 5.1 channel audio (cf. XAUDIOCHANNEL_SOURCEMAX) + +// +// DVD data sizes +// + +#define WAVEBANK_DVD_SECTOR_SIZE 2048 +#define WAVEBANK_DVD_BLOCK_SIZE (WAVEBANK_DVD_SECTOR_SIZE * 16) + +// +// Bank alignment presets +// + +#define WAVEBANK_ALIGNMENT_MIN 4 // Minimum alignment +#define WAVEBANK_ALIGNMENT_DVD WAVEBANK_DVD_SECTOR_SIZE // DVD-optimized alignment + +// +// Wave bank segment identifiers +// + +typedef enum WAVEBANKSEGIDX +{ + WAVEBANK_SEGIDX_BANKDATA = 0, // Bank data + WAVEBANK_SEGIDX_ENTRYMETADATA, // Entry meta-data + WAVEBANK_SEGIDX_SEEKTABLES, // Storage for seek tables for the encoded waves. + WAVEBANK_SEGIDX_ENTRYNAMES, // Entry friendly names + WAVEBANK_SEGIDX_ENTRYWAVEDATA, // Entry wave data + WAVEBANK_SEGIDX_COUNT +} WAVEBANKSEGIDX, *LPWAVEBANKSEGIDX; + +typedef const WAVEBANKSEGIDX *LPCWAVEBANKSEGIDX; + +// +// Endianness +// + +#ifdef __cplusplus + +namespace XACTWaveBank +{ + __inline void SwapBytes(XACTUNALIGNED DWORD &dw) + { + +#ifdef _X86_ + + __asm + { + mov edi, dw + mov eax, [edi] + bswap eax + mov [edi], eax + } + +#else // _X86_ + + dw = _byteswap_ulong(dw); + +#endif // _X86_ + + } + + __inline void SwapBytes(XACTUNALIGNED WORD &w) + { + +#ifdef _X86_ + + __asm + { + mov edi, w + mov ax, [edi] + xchg ah, al + mov [edi], ax + } + +#else // _X86_ + + w = _byteswap_ushort(w); + +#endif // _X86_ + + } + +} + +#endif // __cplusplus + +// +// Wave bank region in bytes. +// + +typedef struct WAVEBANKREGION +{ + DWORD dwOffset; // Region offset, in bytes. + DWORD dwLength; // Region length, in bytes. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwOffset); + XACTWaveBank::SwapBytes(dwLength); + } + +#endif // __cplusplus + +} WAVEBANKREGION, *LPWAVEBANKREGION; + +typedef const WAVEBANKREGION *LPCWAVEBANKREGION; + + +// +// Wave bank region in samples. +// + +typedef struct WAVEBANKSAMPLEREGION +{ + DWORD dwStartSample; // Start sample for the region. + DWORD dwTotalSamples; // Region length in samples. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwStartSample); + XACTWaveBank::SwapBytes(dwTotalSamples); + } + +#endif // __cplusplus + +} WAVEBANKSAMPLEREGION, *LPWAVEBANKSAMPLEREGION; + +typedef const WAVEBANKSAMPLEREGION *LPCWAVEBANKSAMPLEREGION; + + +// +// Wave bank file header +// + +typedef struct WAVEBANKHEADER +{ + DWORD dwSignature; // File signature + DWORD dwVersion; // Version of the tool that created the file + DWORD dwHeaderVersion; // Version of the file format + WAVEBANKREGION Segments[WAVEBANK_SEGIDX_COUNT]; // Segment lookup table + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwSignature); + XACTWaveBank::SwapBytes(dwVersion); + XACTWaveBank::SwapBytes(dwHeaderVersion); + + for(int i = 0; i < WAVEBANK_SEGIDX_COUNT; i++) + { + Segments[i].SwapBytes(); + } + } + +#endif // __cplusplus + +} WAVEBANKHEADER, *LPWAVEBANKHEADER; + +typedef const WAVEBANKHEADER *LPCWAVEBANKHEADER; + +// +// Entry compressed data format +// + +typedef union WAVEBANKMINIWAVEFORMAT +{ + struct + { + DWORD wFormatTag : 2; // Format tag + DWORD nChannels : 3; // Channel count (1 - 6) + DWORD nSamplesPerSec : 18; // Sampling rate + DWORD wBlockAlign : 8; // Block alignment + DWORD wBitsPerSample : 1; // Bits per sample (8 vs. 16, PCM only) + }; + + DWORD dwValue; + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwValue); + } + + WORD BitsPerSample() const + { + return wBitsPerSample == WAVEBANKMINIFORMAT_BITDEPTH_16 ? 16 : 8; + } + + #define ADPCM_MINIWAVEFORMAT_BLOCKALIGN_CONVERSION_OFFSET 22 + DWORD BlockAlign() const + { + return wFormatTag != WAVEBANKMINIFORMAT_TAG_ADPCM ? wBlockAlign : + (wBlockAlign + ADPCM_MINIWAVEFORMAT_BLOCKALIGN_CONVERSION_OFFSET) * nChannels; + } + +#endif // __cplusplus + +} WAVEBANKMINIWAVEFORMAT, *LPWAVEBANKMINIWAVEFORMAT; + +typedef const WAVEBANKMINIWAVEFORMAT *LPCWAVEBANKMINIWAVEFORMAT; + +// +// Entry meta-data +// + +typedef struct WAVEBANKENTRY +{ + union + { + struct + { + // Entry flags + DWORD dwFlags : 4; + + // Duration of the wave, in units of one sample. + // For instance, a ten second long wave sampled + // at 48KHz would have a duration of 480,000. + // This value is not affected by the number of + // channels, the number of bits per sample, or the + // compression format of the wave. + DWORD Duration : 28; + }; + DWORD dwFlagsAndDuration; + }; + + WAVEBANKMINIWAVEFORMAT Format; // Entry format. + WAVEBANKREGION PlayRegion; // Region within the wave data segment that contains this entry. + WAVEBANKSAMPLEREGION LoopRegion; // Region within the wave data (in samples) that should loop. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwFlagsAndDuration); + Format.SwapBytes(); + PlayRegion.SwapBytes(); + LoopRegion.SwapBytes(); + } + +#endif // __cplusplus + +} WAVEBANKENTRY, *LPWAVEBANKENTRY; + +typedef const WAVEBANKENTRY *LPCWAVEBANKENTRY; + +// +// Compact entry meta-data +// + +typedef struct WAVEBANKENTRYCOMPACT +{ + DWORD dwOffset : 21; // Data offset, in sectors + DWORD dwLengthDeviation : 11; // Data length deviation, in bytes + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(*(LPDWORD)this); + } + +#endif // __cplusplus + +} WAVEBANKENTRYCOMPACT, *LPWAVEBANKENTRYCOMPACT; + +typedef const WAVEBANKENTRYCOMPACT *LPCWAVEBANKENTRYCOMPACT; + +// +// Bank data segment +// + +typedef struct WAVEBANKDATA +{ + DWORD dwFlags; // Bank flags + DWORD dwEntryCount; // Number of entries in the bank + CHAR szBankName[WAVEBANK_BANKNAME_LENGTH]; // Bank friendly name + DWORD dwEntryMetaDataElementSize; // Size of each entry meta-data element, in bytes + DWORD dwEntryNameElementSize; // Size of each entry name element, in bytes + DWORD dwAlignment; // Entry alignment, in bytes + WAVEBANKMINIWAVEFORMAT CompactFormat; // Format data for compact bank + FILETIME BuildTime; // Build timestamp + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwFlags); + XACTWaveBank::SwapBytes(dwEntryCount); + XACTWaveBank::SwapBytes(dwEntryMetaDataElementSize); + XACTWaveBank::SwapBytes(dwEntryNameElementSize); + XACTWaveBank::SwapBytes(dwAlignment); + CompactFormat.SwapBytes(); + XACTWaveBank::SwapBytes(BuildTime.dwLowDateTime); + XACTWaveBank::SwapBytes(BuildTime.dwHighDateTime); + } + +#endif // __cplusplus + +} WAVEBANKDATA, *LPWAVEBANKDATA; + +typedef const WAVEBANKDATA *LPCWAVEBANKDATA; + +#ifdef _M_PPCBE +#pragma bitfield_order(pop) +#endif + +#pragma warning(pop) +#pragma pack(pop) + +#endif // __XACTWB_H__ + diff --git a/SDK/dxSDK/Include/xact3d.h b/SDK/dxSDK/Include/xact3d.h new file mode 100644 index 00000000..46757871 --- /dev/null +++ b/SDK/dxSDK/Include/xact3d.h @@ -0,0 +1,273 @@ +/*-========================================================================-_ + | - XACT3D - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |VERSION: 0.1 MODEL: Unmanaged User-mode | + |CONTRACT: N / A EXCEPT: No Exceptions | + |PARENT: N / A MINREQ: Win2000, Xbox360 | + |PROJECT: XACT3D DIALECT: MS Visual C++ 7.0 | + |>------------------------------------------------------------------------<| + | DUTY: XACT 3D support | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. See X3DAudio.h for information regarding X3DAudio types. */ + + +#ifndef __XACT3D_H__ +#define __XACT3D_H__ +//---------------------------------------------------// + #include + #include + + #pragma warning(push) + #pragma warning(disable: 4701) // disable "local variable may be used without having been initialized" compile warning + + // Supported speaker positions, represented as azimuth angles. + // + // Here's a picture of the azimuth angles for the 8 cardinal points, + // seen from above. The emitter's base position is at the origin 0. + // + // FRONT + // | 0 <-- azimuth + // | + // 7pi/4 \ | / pi/4 + // \ | / + // LEFT \|/ RIGHT + // 3pi/2-------0-------pi/2 + // /|\ + // / | \ + // 5pi/4 / | \ 3pi/4 + // | + // | pi + // BACK + // + #define LEFT_AZIMUTH (3*X3DAUDIO_PI/2) + #define RIGHT_AZIMUTH (X3DAUDIO_PI/2) + #define FRONT_LEFT_AZIMUTH (7*X3DAUDIO_PI/4) + #define FRONT_RIGHT_AZIMUTH (X3DAUDIO_PI/4) + #define FRONT_CENTER_AZIMUTH 0.0f + #define LOW_FREQUENCY_AZIMUTH X3DAUDIO_2PI + #define BACK_LEFT_AZIMUTH (5*X3DAUDIO_PI/4) + #define BACK_RIGHT_AZIMUTH (3*X3DAUDIO_PI/4) + #define BACK_CENTER_AZIMUTH X3DAUDIO_PI + #define FRONT_LEFT_OF_CENTER_AZIMUTH (15*X3DAUDIO_PI/8) + #define FRONT_RIGHT_OF_CENTER_AZIMUTH (X3DAUDIO_PI/8) + + +//-----------------------------------------------------// + // Supported emitter channel layouts: + static const float aStereoLayout[] = + { + LEFT_AZIMUTH, + RIGHT_AZIMUTH + }; + static const float a2Point1Layout[] = + { + LEFT_AZIMUTH, + RIGHT_AZIMUTH, + LOW_FREQUENCY_AZIMUTH + }; + static const float aQuadLayout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a4Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a5Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + FRONT_CENTER_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a7Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + FRONT_CENTER_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH, + LEFT_AZIMUTH, + RIGHT_AZIMUTH + }; + + +//-------------------------------------------------------// + //// + // DESCRIPTION: + // Initializes the 3D API's: + // + // REMARKS: + // This method only needs to be called once. + // X3DAudio will be initialized such that its speaker channel mask + // matches the format of the given XACT engine's final mix. + // + // PARAMETERS: + // pEngine - [in] XACT engine + // X3DInstance - [out] X3DAudio instance handle + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DInitialize (IXACTEngine* pEngine, X3DAUDIO_HANDLE X3DInstance) + { + HRESULT hr = S_OK; + if (pEngine == NULL) { + hr = E_POINTER; + } + + XACTVARIABLEVALUE nSpeedOfSound; + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactSpeedOfSoundID = pEngine->GetGlobalVariableIndex("SpeedOfSound"); + hr = pEngine->GetGlobalVariable(xactSpeedOfSoundID, &nSpeedOfSound); + } + + if (SUCCEEDED(hr)) { + WAVEFORMATEXTENSIBLE wfxFinalMixFormat; + hr = pEngine->GetFinalMixFormat(&wfxFinalMixFormat); + if (SUCCEEDED(hr)) { + X3DAudioInitialize(wfxFinalMixFormat.dwChannelMask, nSpeedOfSound, X3DInstance); + } + } + return hr; + } + + + //// + // DESCRIPTION: + // Calculates DSP settings with respect to 3D parameters: + // + // REMARKS: + // Note the following flags are always specified for XACT3D calculation: + // X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER | X3DAUDIO_CALCULATE_EMITTER_ANGLE + // + // This means the caller must set at least the following fields: + // X3DAUDIO_LISTENER.OrientFront + // X3DAUDIO_LISTENER.OrientTop + // X3DAUDIO_LISTENER.Position + // X3DAUDIO_LISTENER.Velocity + // + // X3DAUDIO_EMITTER.OrientFront + // X3DAUDIO_EMITTER.OrientTop, if emitter is multi-channel + // X3DAUDIO_EMITTER.Position + // X3DAUDIO_EMITTER.Velocity + // X3DAUDIO_EMITTER.InnerRadius + // X3DAUDIO_EMITTER.InnerRadiusAngle + // X3DAUDIO_EMITTER.ChannelCount + // X3DAUDIO_EMITTER.CurveDistanceScaler + // X3DAUDIO_EMITTER.DopplerScaler + // + // X3DAUDIO_DSP_SETTINGS.pMatrixCoefficients, the caller need only allocate space for SrcChannelCount*DstChannelCount elements + // X3DAUDIO_DSP_SETTINGS.SrcChannelCount + // X3DAUDIO_DSP_SETTINGS.DstChannelCount + // + // If X3DAUDIO_EMITTER.pChannelAzimuths is left NULL for multi-channel emitters, + // a default channel radius and channel azimuth array will be applied below. + // Distance curves such as X3DAUDIO_EMITTER.pVolumeCurve should be + // left NULL as XACT's native RPCs will be used to define DSP behaviour + // with respect to normalized distance. + // + // See X3DAudio.h for information regarding X3DAudio types. + // + // PARAMETERS: + // X3DInstance - [in] X3DAudio instance handle, returned from XACT3DInitialize() + // pListener - [in] point of 3D audio reception + // pEmitter - [in] 3D audio source + // pDSPSettings - [out] receives calculation results, applied to an XACT cue via XACT3DApply() + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DCalculate (X3DAUDIO_HANDLE X3DInstance, const X3DAUDIO_LISTENER* pListener, X3DAUDIO_EMITTER* pEmitter, X3DAUDIO_DSP_SETTINGS* pDSPSettings) + { + HRESULT hr = S_OK; + if (pListener == NULL || pEmitter == NULL || pDSPSettings == NULL) { + hr = E_POINTER; + } + + if (SUCCEEDED(hr)) { + if (pEmitter->ChannelCount > 1 && pEmitter->pChannelAzimuths == NULL) { + pEmitter->ChannelRadius = 1.0f; + + switch (pEmitter->ChannelCount) { + case 2: pEmitter->pChannelAzimuths = (float*)&aStereoLayout[0]; break; + case 3: pEmitter->pChannelAzimuths = (float*)&a2Point1Layout[0]; break; + case 4: pEmitter->pChannelAzimuths = (float*)&aQuadLayout[0]; break; + case 5: pEmitter->pChannelAzimuths = (float*)&a4Point1Layout[0]; break; + case 6: pEmitter->pChannelAzimuths = (float*)&a5Point1Layout[0]; break; + case 8: pEmitter->pChannelAzimuths = (float*)&a7Point1Layout[0]; break; + default: hr = E_FAIL; break; + } + } + } + + if (SUCCEEDED(hr)) { + static X3DAUDIO_DISTANCE_CURVE_POINT DefaultCurvePoints[2] = { 0.0f, 1.0f, 1.0f, 1.0f }; + static X3DAUDIO_DISTANCE_CURVE DefaultCurve = { (X3DAUDIO_DISTANCE_CURVE_POINT*)&DefaultCurvePoints[0], 2 }; + if (pEmitter->pVolumeCurve == NULL) { + pEmitter->pVolumeCurve = &DefaultCurve; + } + if (pEmitter->pLFECurve == NULL) { + pEmitter->pLFECurve = &DefaultCurve; + } + + X3DAudioCalculate(X3DInstance, pListener, pEmitter, (X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER | X3DAUDIO_CALCULATE_EMITTER_ANGLE), pDSPSettings); + } + + return hr; + } + + + //// + // DESCRIPTION: + // Applies results from a call to XACT3DCalculate() to a cue. + // + // PARAMETERS: + // pDSPSettings - [in] calculation results generated by XACT3DCalculate() + // pCue - [in] cue to which to apply pDSPSettings + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DApply (X3DAUDIO_DSP_SETTINGS* pDSPSettings, IXACTCue* pCue) + { + HRESULT hr = S_OK; + if (pDSPSettings == NULL || pCue == NULL) { + hr = E_POINTER; + } + + if (SUCCEEDED(hr)) { + hr = pCue->SetMatrixCoefficients(pDSPSettings->SrcChannelCount, pDSPSettings->DstChannelCount, pDSPSettings->pMatrixCoefficients); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactDistanceID = pCue->GetVariableIndex("Distance"); + hr = pCue->SetVariable(xactDistanceID, pDSPSettings->EmitterToListenerDistance); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactDopplerID = pCue->GetVariableIndex("DopplerPitchScalar"); + hr = pCue->SetVariable(xactDopplerID, pDSPSettings->DopplerFactor); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactOrientationID = pCue->GetVariableIndex("OrientationAngle"); + hr = pCue->SetVariable(xactOrientationID, pDSPSettings->EmitterToListenerAngle * (180.0f / X3DAUDIO_PI)); + } + + return hr; + } + + + #pragma warning(pop) +#endif // __XACT3D_H__ +//---------------------------------<-EOF->----------------------------------// diff --git a/SDK/dxSDK/Include/xaudio2.h b/SDK/dxSDK/Include/xaudio2.h new file mode 100644 index 00000000..608dd84f --- /dev/null +++ b/SDK/dxSDK/Include/xaudio2.h @@ -0,0 +1,1072 @@ +/************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xaudio2.h + * Content: Declarations for the XAudio2 game audio API. + * + **************************************************************************/ + +#ifndef __XAUDIO2_INCLUDED__ +#define __XAUDIO2_INCLUDED__ + + +/************************************************************************** + * + * XAudio2 class and interface IDs. + * + **************************************************************************/ + +#include // For DEFINE_CLSID and DEFINE_IID + +DEFINE_CLSID(XAudio2, fac23f48, 31f5, 45a8, b4, 9b, 52, 25, d6, 14, 01, aa); +DEFINE_CLSID(XAudio2_Debug, fac23f48, 31f5, 45a8, b4, 9b, 52, 25, d6, 14, 01, db); +DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); + + +// Ignore the rest of this header if only the GUID definitions were requested +#ifndef GUID_DEFS_ONLY + +#ifdef _XBOX + #include // Xbox COM macros (DECLARE_INTERFACE_ etc) +#else + #include // Windows COM macros +#endif + +#include "audiodefs.h" // Basic data types and constants for audio work +#include "xma2defs.h" // Data types and constants for XMA2 work + + +/************************************************************************** + * + * XAudio2 constants, flags and error codes. + * + **************************************************************************/ + +// Numeric boundary values +#define XAUDIO2_MAX_BUFFER_BYTES 0x700000 // Maximum bytes allowed in a source buffer +#define XAUDIO2_MAX_QUEUED_BUFFERS 64 // Maximum buffers allowed in a voice queue +#define XAUDIO2_MAX_AUDIO_CHANNELS 64 // Maximum channels in an audio stream +#define XAUDIO2_MIN_SAMPLE_RATE 1000 // Minimum audio sample rate supported +#define XAUDIO2_MAX_SAMPLE_RATE 200000 // Maximum audio sample rate supported +#define XAUDIO2_MAX_VOLUME_LEVEL 16777216.0f // Maximum acceptable volume level (2^24) +#define XAUDIO2_MIN_FREQ_RATIO (1/1024.0f) // Minimum SetFrequencyRatio argument +#define XAUDIO2_MAX_FREQ_RATIO 1024.0f // Maximum MaxFrequencyRatio argument +#define XAUDIO2_DEFAULT_FREQ_RATIO 4.0f // Default SetFrequencyRatio argument +#define XAUDIO2_MAX_FILTER_ONEOVERQ 2.0f // Maximum XAUDIO2_FILTER_PARAMETERS.OneOverQ +#define XAUDIO2_MAX_FILTER_FREQ_FACTOR (1/6.0f) // Maximum XAUDIO2_FILTER_PARAMETERS.Frequency is + // (sample Rate * XAUDIO2_MAX_FILTER_FREQ_FACTOR) +#define XAUDIO2_MAX_LOOP_COUNT 0x100000 // Maximum XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_MAX_INSTANCES 8 // Maximum XAudio2 objects that can exist at once + +// Numeric values with special meanings +#define XAUDIO2_COMMIT_NOW 0 // Used as an OperationSet argument +#define XAUDIO2_COMMIT_ALL 0 // Used in IXAudio2::CommitChanges +#define XAUDIO2_INVALID_OPSET (UINT32)(-1) // Not allowed for OperationSet arguments +#define XAUDIO2_NO_LOOP_REGION 0 // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_LOOP_INFINITE (UINT32)(-1) // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_DEFAULT_CHANNELS 0 // Used in CreateMasteringVoice +#define XAUDIO2_DEFAULT_SAMPLERATE 0 // Used in CreateMasteringVoice + +// Flags +#define XAUDIO2_DEBUG_ENGINE 0x0001 // Used in XAudio2Create() on Windows only +#define XAUDIO2_VOICE_NOPITCH 0x0002 // Used in IXAudio2::CreateSourceVoice() +#define XAUDIO2_VOICE_NOSRC 0x0004 // Used in IXAudio2::CreateSourceVoice() +#define XAUDIO2_VOICE_USEFILTER 0x0008 // Used in IXAudio2::CreateSourceVoice() +#define XAUDIO2_VOICE_MUSIC 0x0010 // Used in IXAudio2::CreateSourceVoice() +#define XAUDIO2_PLAY_TAILS 0x0020 // Used in IXAudio2Voice::Start() and Stop() +#define XAUDIO2_FLUSH_BUFFERS 0x0040 // Used in IXAudio2Voice::Stop() +#define XAUDIO2_END_OF_STREAM 0x0080 // Used in XAUDIO2_BUFFER.Flags + +// Internal XAudio2 constants +#ifdef _XBOX + #define XAUDIO2_QUANTUM_NUMERATOR 2 // On Xbox 360, XAudio2 processes audio + #define XAUDIO2_QUANTUM_DENOMINATOR 375 // in 5.333ms chunks (= 2/375 seconds) +#else + #define XAUDIO2_QUANTUM_NUMERATOR 1 // On Windows, XAudio2 processes audio + #define XAUDIO2_QUANTUM_DENOMINATOR 100 // in 10ms chunks (= 1/100 seconds) +#endif +#define XAUDIO2_QUANTUM_MS (1000.0f * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR) + +// XAudio2 error codes +#define FACILITY_XAUDIO2 0x896 +#define X2ERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAUDIO2, n) + +#define XAUDIO2_E_NOT_INITIALIZED X2ERROR(0x01) // Method cannot be called before IXAudio2::Initialize. +#define XAUDIO2_E_ALREADY_INITIALIZED X2ERROR(0x02) // IXAudio2::Initialize was called redundantly. +#define XAUDIO2_E_INVALID_ARGUMENT X2ERROR(0x03) // One of the given arguments was invalid. +#define XAUDIO2_E_INVALID_FLAGS X2ERROR(0x04) // One of the flags was invalid for this method. +#define XAUDIO2_E_INVALID_POINTER X2ERROR(0x05) // A required pointer argument was NULL. +#define XAUDIO2_E_INVALID_INDEX X2ERROR(0x06) // An given index was out of the valid range. +#define XAUDIO2_E_INVALID_CALL X2ERROR(0x07) // The method call is currently invalid. +#define XAUDIO2_E_STILL_IN_USE X2ERROR(0x08) // Object cannot be destroyed because it is still in use. +#define XAUDIO2_E_UNSUPPORTED X2ERROR(0x09) // Requested operation is unsupported on this platform/device. +#define XAUDIO2_E_XMA_DECODER_ERROR X2ERROR(0x0a) // The XMA hardware suffered an unrecoverable error. +#define XAUDIO2_E_EFFECT_CREATION_FAILED X2ERROR(0x0b) // Failed to instantiate an effect. +#define XAUDIO2_E_DEVICE_INVALIDATED X2ERROR(0x0c) // An audio device became unusable (unplugged, etc). + + +/************************************************************************** + * + * Forward declarations for the XAudio2 interfaces. + * + **************************************************************************/ + +#ifdef __cplusplus + #define FWD_DECLARE(x) interface x +#else + #define FWD_DECLARE(x) typedef interface x x +#endif + +FWD_DECLARE(IXAudio2); +FWD_DECLARE(IXAudio2Voice); +FWD_DECLARE(IXAudio2SourceVoice); +FWD_DECLARE(IXAudio2SubmixVoice); +FWD_DECLARE(IXAudio2MasteringVoice); +FWD_DECLARE(IXAudio2EngineCallback); +FWD_DECLARE(IXAudio2VoiceCallback); + + +/************************************************************************** + * + * XAudio2 structures and enumerations. + * + **************************************************************************/ + +// Used in IXAudio2::Initialize +#ifdef _XBOX + typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER + { + XboxThread0 = 0x0001, + XboxThread1 = 0x0002, + XboxThread2 = 0x0004, + XboxThread3 = 0x0008, + XboxThread4 = 0x0010, + XboxThread5 = 0x0020, + XAUDIO2_MAX_PROCESSOR = XboxThread5, + XAUDIO2_ANY_PROCESSOR = XboxThread4, + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR + } XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR; +#else + typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER + { + Processor0 = 0x0001, + Processor1 = 0x0002, + Processor2 = 0x0004, + Processor3 = 0x0008, + Processor4 = 0x0010, + Processor5 = 0x0020, + Processor6 = 0x0040, + Processor7 = 0x0080, + Processor8 = 0x0100, + Processor9 = 0x0200, + Processor10 = 0x0400, + Processor11 = 0x0800, + Processor12 = 0x1000, + Processor13 = 0x2000, + Processor14 = 0x4000, + Processor15 = 0x8000, + XAUDIO2_MAX_PROCESSOR = Processor15, + XAUDIO2_ANY_PROCESSOR = 0xffff, + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR + } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR; +#endif + +// Used in XAUDIO2_DEVICE_DETAILS below to describe the types of applications +// that the user has specified each device as a default for. 0 means that the +// device isn't the default for any role. +typedef enum XAUDIO2_DEVICE_ROLE +{ + NotDefaultDevice = 0x0, + DefaultConsoleDevice = 0x1, + DefaultMultimediaDevice = 0x2, + DefaultCommunicationsDevice = 0x4, + DefaultGameDevice = 0x8, + GlobalDefaultDevice = 0xf, + InvalidDeviceRole = ~GlobalDefaultDevice +} XAUDIO2_DEVICE_ROLE; + +// Returned by IXAudio2::GetDeviceDetails +typedef struct XAUDIO2_DEVICE_DETAILS +{ + WCHAR DeviceID[256]; // String identifier for the audio device. + WCHAR DisplayName[256]; // Friendly name suitable for display to a human. + XAUDIO2_DEVICE_ROLE Role; // Roles that the device should be used for. + WAVEFORMATEXTENSIBLE OutputFormat; // The device's native PCM audio format. +} XAUDIO2_DEVICE_DETAILS; + +// Used for the voice creation functions and IXAudio2Voice::SetOutputVoices +typedef struct XAUDIO2_VOICE_SENDS +{ + UINT32 OutputCount; // No. of voices that should receive this voice's output. + IXAudio2Voice** pOutputVoices; // Array of uOutputCount destination voices. +} XAUDIO2_VOICE_SENDS; + +// Used in XAUDIO2_FILTER_PARAMETERS below +typedef enum XAUDIO2_FILTER_TYPE +{ + LowPassFilter, // Attenuates frequencies above the cutoff frequency. + BandPassFilter, // Attenuates frequencies outside a given range. + HighPassFilter // Attenuates frequencies below the cutoff frequency. +} XAUDIO2_FILTER_TYPE; + +// Used in IXAudio2SourceVoice::SetFilterParameters and GetFilterParameters +typedef struct XAUDIO2_FILTER_PARAMETERS +{ + XAUDIO2_FILTER_TYPE Type; // Low-pass, band-pass or high-pass. + float Frequency; // Radian frequency (2 * sin(pi*cutoffFrequency/sampleRate)). + float OneOverQ; // Reciprocal of filter's quality factor Q. +} XAUDIO2_FILTER_PARAMETERS; + +// Used in XAUDIO2_EFFECT_CHAIN below +typedef struct XAUDIO2_EFFECT_DESCRIPTOR +{ + IUnknown* pEffect; // Pointer to the effect object's IUnknown interface. + BOOL InitialState; // TRUE if the effect should begin in the enabled state. + UINT32 OutputChannels; // How many output channels the effect should produce. +} XAUDIO2_EFFECT_DESCRIPTOR; + +// Used for the voice creation functions and for IXAudio2Voice::SetEffectChain +typedef struct XAUDIO2_EFFECT_CHAIN +{ + UINT32 EffectCount; // Number of effects in this voice's effect chain. + const XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors; // Array of effect descriptors. +} XAUDIO2_EFFECT_CHAIN; + +// Used for IXAudio2SourceVoice::SubmitSourceBuffer +typedef struct XAUDIO2_BUFFER +{ + UINT32 Flags; // Either 0 or XAUDIO2_END_OF_STREAM. + UINT32 AudioBytes; // Size of the audio data buffer in bytes. + const BYTE* pAudioData; // Pointer to the audio data buffer. + UINT32 PlayBegin; // First sample in this buffer to be played. + UINT32 PlayLength; // Length of the region to be played in samples, + // or 0 to play the whole buffer. + UINT32 LoopBegin; // First sample of the region to be looped. + UINT32 LoopLength; // Length of the desired loop region in samples, + // or 0 to loop the entire buffer. + UINT32 LoopCount; // Number of times to repeat the loop region, + // or XAUDIO2_LOOP_INFINITE to loop forever. + void* pContext; // Context value to be passed back in callbacks. +} XAUDIO2_BUFFER; + +// Returned by IXAudio2SourceVoice::GetState +typedef struct XAUDIO2_VOICE_STATE +{ + void* pCurrentBufferContext; // The pContext value provided in the XAUDIO2_BUFFER + // that is currently being processed, or NULL if + // there are no buffers in the queue. + UINT32 BuffersQueued; // Number of buffers currently queued on the voice + // (including the one that is being processed). + UINT64 SamplesPlayed; // Total number of samples produced by the voice since + // it began processing the current audio stream. +} XAUDIO2_VOICE_STATE; + +// Returned by IXAudio2::GetPerformanceData +typedef struct XAUDIO2_PERFORMANCE_DATA +{ + // CPU usage information + UINT64 AudioCyclesSinceLastQuery; // CPU cycles spent on audio processing since the + // last call to StartEngine or GetPerformanceData. + UINT64 TotalCyclesSinceLastQuery; // Total CPU cycles elapsed since the last call + // (only counts the CPU XAudio2 is running on). + + UINT32 MinimumCyclesPerQuantum; // Fewest CPU cycles spent processing any one + // audio quantum since the last call. + UINT32 MaximumCyclesPerQuantum; // Most CPU cycles spent processing any one + // audio quantum since the last call. + + // Audio latency and glitching information + UINT32 CurrentLatencyInSamples; // Minimum delay from when a sample is read from + // a source buffer to when it reaches the speakers. + UINT32 CurrentOutputSamplesQueued; // Current samples in the output device's queue. + UINT32 GlitchesSinceLastQuery; // Total audio dropouts since the last call. + + // Data about XAudio2's current workload + UINT32 ActiveSourceVoiceCount; // Source voices currently playing. + UINT32 TotalSourceVoiceCount; // Source voices currently existing. + UINT32 ActiveSubmixVoiceCount; // Submix voices currently playing. + UINT32 TotalSubmixVoiceCount; // Submix voices currently existing. + + // Usage of the hardware XMA decoder (Xbox 360 only) + UINT32 ActiveXmaSourceVoices; // Number of source voices decoding XMA data. + UINT32 ActiveXmaStreams; // A voice can use more than one XMA stream. +} XAUDIO2_PERFORMANCE_DATA; + + +/************************************************************************** + * + * IXAudio2: Top-level XAudio2 COM interface. + * + **************************************************************************/ + +// Enable SAL annotations if or has been included +#ifdef __specstrings + #define X2IN __in + #define X2OUT __out + #define X2INOUT __inout + #define X2INOPT __in_opt + #define X2OUTOPT __out_opt + #define X2INOUTOPT __inout_opt +#else + #define X2IN + #define X2OUT + #define X2INOUT + #define X2INOPT + #define X2OUTOPT + #define X2INOUTOPT +#endif + +// Use default values for some parameters if building C++ code +#ifdef __cplusplus + #define DEFAULT(x) =x +#else + #define DEFAULT(x) +#endif + +#undef INTERFACE +#define INTERFACE IXAudio2 +DECLARE_INTERFACE_(IXAudio2, IUnknown) +{ + // NAME: IXAudio2::QueryInterface + // DESCRIPTION: Queries for the given COM interface on the XAudio2 object. + // Only IID_IUnknown and IID_IXAudio2 are supported. + // + // RETURN VALUES: + // S_OK: The interface was obtained successfully. + // E_POINTER: The given ppvInterface pointer was NULL. + // E_NOINTERFACE: The requested interface is not supported. + // + STDMETHOD(QueryInterface) (THIS_ REFIID riid, X2OUT void** ppvInterface) PURE; + + // NAME: IXAudio2::AddRef + // DESCRIPTION: Adds a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + + // NAME: IXAudio2::Release + // DESCRIPTION: Releases a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, Release) (THIS) PURE; + + // NAME: IXAudio2::GetDeviceCount + // DESCRIPTION: Returns the number of audio output devices available. + // + // ARGUMENTS: + // puCount - Returns the device count. + // + STDMETHOD(GetDeviceCount) (THIS_ X2OUT UINT32* pCount) PURE; + + // NAME: IXAudio2::GetDeviceDetails + // DESCRIPTION: Returns information about the device with the given index. + // + // ARGUMENTS: + // uIndex - Index of the device to be queried. + // pDeviceDetails - Returns the device details. + // + STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, X2OUT XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE; + + // NAME: IXAudio2::Initialize + // DESCRIPTION: Sets XAudio2 parameters and prepares it for use. + // + // ARGUMENTS: + // Flags - Flags specifying the XAudio2 object's behavior. Currently unused. + // pCallback - Callback interface to be called during each processing pass. + // XAudio2Processor - An XAUDIO2_PROCESSOR enumeration value that specifies + // the hardware thread (Xbox) or processor (Windows) that XAudio2 will use. + // The enumeration values are platform-specific; platform-independent code + // can use XAUDIO2_DEFAULT_PROCESSOR to use the default. + // + // RETURN VALUES: + // XAUDIO2_E_ALREADY_INITIALIZED: This object has already been initialized. + // + STDMETHOD(Initialize) (THIS_ UINT32 Flags DEFAULT(0), + X2INOPT IXAudio2EngineCallback* pCallback DEFAULT(NULL), + XAUDIO2_PROCESSOR XAudio2Processor DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE; + + + // NAME: IXAudio2::CreateSourceVoice + // DESCRIPTION: Creates and configures a source voice. + // + // ARGUMENTS: + // ppSourceVoice - Returns the new object's IXAudio2SourceVoice interface. + // pSourceFormat - Format of the audio that will be fed to the voice. + // Flags - Flags specifying the source voice's behavior. + // MaxFrequencyRatio - Maximum SetFrequencyRatio argument to be allowed. + // pCallback - Optional pointer to a client-provided callback interface. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSourceVoice) (THIS_ X2OUT IXAudio2SourceVoice** ppSourceVoice, + X2IN const WAVEFORMATEX* pSourceFormat, + UINT32 Flags DEFAULT(0), + float MaxFrequencyRatio DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO), + X2INOPT IXAudio2VoiceCallback* pCallback DEFAULT(NULL), + X2INOPT const XAUDIO2_VOICE_SENDS* pSendList DEFAULT(NULL), + X2INOPT const XAUDIO2_EFFECT_CHAIN* pEffectChain DEFAULT(NULL)) PURE; + + // NAME: IXAudio2::CreateSubmixVoice + // DESCRIPTION: Creates and configures a submix voice. + // + // ARGUMENTS: + // ppSubmixVoice - Returns the new object's IXAudio2SubmixVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - Flags specifying the submix voice's behavior. + // ProcessingStage - Arbitrary number that determines the processing order. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSubmixVoice) (THIS_ X2OUT IXAudio2SubmixVoice** ppSubmixVoice, + UINT32 InputChannels, UINT32 InputSampleRate, + UINT32 Flags DEFAULT(0), UINT32 ProcessingStage DEFAULT(0), + X2INOPT const XAUDIO2_VOICE_SENDS* pSendList DEFAULT(NULL), + X2INOPT const XAUDIO2_EFFECT_CHAIN* pEffectChain DEFAULT(NULL)) PURE; + + + // NAME: IXAudio2::CreateMasteringVoice + // DESCRIPTION: Creates and configures a mastering voice. + // + // ARGUMENTS: + // ppMasteringVoice - Returns the new object's IXAudio2MasteringVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - Flags specifying the mastering voice's behavior. + // DeviceIndex - Identifier of the device to receive the output audio. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateMasteringVoice) (THIS_ X2OUT IXAudio2MasteringVoice** ppMasteringVoice, + UINT32 InputChannels DEFAULT(XAUDIO2_DEFAULT_CHANNELS), + UINT32 InputSampleRate DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE), + UINT32 Flags DEFAULT(0), UINT32 DeviceIndex DEFAULT(0), + X2INOPT const XAUDIO2_EFFECT_CHAIN* pEffectChain DEFAULT(NULL)) PURE; + + // NAME: IXAudio2::StartEngine + // DESCRIPTION: Creates and starts the audio processing thread. + // + STDMETHOD(StartEngine) (THIS) PURE; + + // NAME: IXAudio2::StopEngine + // DESCRIPTION: Stops and destroys the audio processing thread. + // + STDMETHOD(StopEngine) (THIS) PURE; + + // NAME: IXAudio2::CommitChanges + // DESCRIPTION: Atomically applies a set of operations previously tagged + // with a given identifier. + // + // ARGUMENTS: + // OperationSet - Identifier of the set of operations to be applied. + // + STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE; + + // NAME: IXAudio2::GetPerformanceData + // DESCRIPTION: Returns current resource usage details: memory, CPU, etc. + // + // ARGUMENTS: + // pPerfData - Returns the performance data structure. + // + STDMETHOD(GetPerformanceData) (THIS_ X2OUT XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE; +}; + + +/************************************************************************** + * + * IXAudio2Voice: Base voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2Voice +DECLARE_INTERFACE(IXAudio2Voice) +{ + // These methods are declared in a macro so that the same declarations + // can be used in the derived voice types (IXAudio2SourceVoice, etc). + + #define Declare_IXAudio2Voice_Methods() \ + \ + /* NAME: IXAudio2Voice::Start + // DESCRIPTION: Makes this voice start consuming audio, processing it, and + // delivering the result to its destination voices or the output device. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be started. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(Start) (THIS_ UINT32 Flags, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::Stop + // DESCRIPTION: Makes this voice stop consuming audio. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be stopped. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(Stop) (THIS_ UINT32 Flags, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetVoiceState + // DESCRIPTION: Returns the voice's current state (TRUE iff it is running). + // + // ARGUMENTS: + // pRunning - Returns the voice's current state. + */\ + /* REVISE: This is disabled until we come up with a clean solution + for voice state reporting in Beta 2 (if we even need one). + STDMETHOD(GetVoiceState) (THIS_ X2OUT BOOL* pRunning) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputVoices + // DESCRIPTION: Establish a new set of submix/mastering voices that should + // receive this voice's output. + // + // ARGUMENTS: + // pSendList - Optional list of voices this voice should send audio to. + */\ + STDMETHOD(SetOutputVoices) (THIS_ X2INOPT const XAUDIO2_VOICE_SENDS* pSendList) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectChain + // DESCRIPTION: Replaces this voice's current effect chain with a new one. + // + // ARGUMENTS: + // pEffectChain - Structure describing the new effect chain to be used. + */\ + STDMETHOD(SetEffectChain) (THIS_ X2INOPT const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \ + \ + /* NAME: IXAudio2Voice::EnableEffect + // DESCRIPTION: Enables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::DisableEffect + // DESCRIPTION: Disables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectState + // DESCRIPTION: Returns the running state of an effect. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pEnabled - Returns the enabled/disabled state of the given effect. + */\ + STDMETHOD(GetEffectState) (THIS_ UINT32 EffectIndex, X2OUT BOOL* pEnabled) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectParameters + // DESCRIPTION: Sets effect-specific parameters. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Pointer to an effect-specific parameters block. + // ParametersByteSize - Size of the pParameters array in bytes. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, X2IN const void* pParameters, \ + UINT32 ParametersByteSize, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectParameters + // DESCRIPTION: Obtains the current effect-specific parameters. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Returns the current values of the effect-specific parameters. + // ParametersByteSize - Size of the pParameters array in bytes. + */\ + STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, X2OUT void* pParameters, \ + UINT32 ParametersByteSize) PURE; \ + \ + /* NAME: IXAudio2Voice::SetVolume + // DESCRIPTION: Sets this voice's overall volume level. + // + // ARGUMENTS: + // Volume - New overall volume level to be used, as an amplitude factor. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetVolume) (THIS_ float Volume, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetVolume + // DESCRIPTION: Obtains this voice's current overall volume level. + // + // ARGUMENTS: + // pVolume: Returns the voice's current overall volume level. + */\ + STDMETHOD(GetVolume) (THIS_ X2OUT float* pVolume) PURE; \ + \ + /* NAME: IXAudio2Voice::SetChannelVolumes + // DESCRIPTION: Sets this voice's per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Array of per-channel volume levels to be used. + // OperationSet - Used to identify this call as part of a deferred batch. + // + // RETURN VALUES: + // XAUDIO2_E_INVALID_CALL: The method was called on an output voice. + */\ + STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, X2IN const float* pVolumes, \ + UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetChannelVolumes + // DESCRIPTION: Returns this voice's current per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Returns an array of the current per-channel volume levels. + // + // RETURN VALUES: + // XAUDIO2_E_INVALID_CALL: The method was called on an output voice. + */\ + STDMETHOD(GetChannelVolumes) (THIS_ UINT32 Channels, X2OUT float* pVolumes) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputMatrix + // DESCRIPTION: Sets the volume levels used to mix from each channel of this + // voice's final output to each channel of a given destination voice's input. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to change. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of [SourceChannels * DestinationChannels] send + // levels. The level used to send from source channel S to destination + // channel D should be in pLevelMatrix[S + SourceChannels * D]. + // OperationSet - Used to identify this call as part of a deferred batch. + // + // RETURN VALUES: + // XAUDIO2_E_INVALID_CALL: The method was called on an output voice. + */\ + STDMETHOD(SetOutputMatrix) (THIS_ X2IN IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + X2IN const float* pLevelMatrix, UINT32 OperationSet DEFAULT(0)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetOutputMatrix + // DESCRIPTION: Obtains the volume levels used to send each channel of this + // voice's final output to each channel of a given destination voice's input. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to obtain. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of send levels, as above. + // + // RETURN VALUES: + // XAUDIO2_E_INVALID_CALL: The method was called on an output voice. + */\ + STDMETHOD(GetOutputMatrix) (THIS_ X2IN IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + X2OUT float* pLevelMatrix) PURE; \ + \ + /* NAME: IXAudio2Voice::DestroyVoice + // DESCRIPTION: Destroys this voice, stopping it if necessary and removing + // it from the XAudio2 graph. + // + // RETURN VALUES: + // XAUDIO2_E_STILL_IN_USE: Some voice is sending audio to this one. + */\ + STDMETHOD(DestroyVoice) (THIS) PURE; + + Declare_IXAudio2Voice_Methods() +}; + + +/************************************************************************** + * + * IXAudio2SourceVoice: Source voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice +DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods() + + // NAME: IXAudio2SourceVoice::SubmitSourceBuffer + // DESCRIPTION: Adds a new audio buffer to this voice's input queue. + // + // ARGUMENTS: + // pBuffer - Pointer to the buffer structure to be queued. + // + STDMETHOD(SubmitSourceBuffer) (THIS_ X2IN const XAUDIO2_BUFFER* pBuffer) PURE; + + // NAME: IXAudio2SourceVoice::ExitLoop + // DESCRIPTION: Breaks out of the current loop when its end is reached. + // + // ARGUMENTS: + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet DEFAULT(0)) PURE; + + // NAME: IXAudio2SourceVoice::GetState + // DESCRIPTION: Returns this voice's current cursor position data. + // + // ARGUMENTS: + // pVoiceState - Returns the voice position details. + // + STDMETHOD(GetState) (THIS_ X2OUT XAUDIO2_VOICE_STATE* pVoiceState) PURE; + + // NAME: IXAudio2SourceVoice::SetFrequencyRatio + // DESCRIPTION: Sets this voice's frequency adjustment, i.e. its pitch. + // + // ARGUMENTS: + // Ratio - Frequency change, expressed as source frequency / target frequency. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio, UINT32 OperationSet DEFAULT(0)) PURE; + + // NAME: IXAudio2SourceVoice::GetFrequencyRatio + // DESCRIPTION: Returns this voice's current frequency adjustment + // + // ARGUMENTS: + // pRatio - Returns the voice's current frequency adjustment. + // + STDMETHOD(GetFrequencyRatio) (THIS_ X2OUT float* pRatio) PURE; + + // NAME: IXAudio2SourceVoice::SetFilterParameters + // DESCRIPTION: Sets this voice's filter parameters. + // + // ARGUMENTS: + // pParameters - Pointer to the filter's parameter structure. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(SetFilterParameters) (THIS_ X2IN const XAUDIO2_FILTER_PARAMETERS* pParameters, UINT32 OperationSet DEFAULT(0)) PURE; + + // NAME: IXAudio2SourceVoice::GetFilterParameters + // DESCRIPTION: Returns this voice's current filter parameters. + // + // ARGUMENTS: + // pParameters - Returns the filter's current filter parameters. + // + STDMETHOD(GetFilterParameters) (THIS_ X2OUT XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; +}; + + +/************************************************************************** + * + * IXAudio2SubmixVoice: Submixing voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SubmixVoice +DECLARE_INTERFACE_(IXAudio2SubmixVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods() + + // There are no methods specific to submix voices. +}; + + +/************************************************************************** + * + * IXAudio2MasteringVoice: Mastering voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice +DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods() + + // There are no methods specific to mastering voices. +}; + + +/************************************************************************** + * + * IXAudio2EngineCallback: Client notification interface for engine events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in the XAudio2 engine. This interface should be implemented by + * the client. XAudio2 will call these methods via an interface + * pointer provided by the client using either XAudio2Create() or + * IXAudio2::Initialize(). + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2EngineCallback +DECLARE_INTERFACE(IXAudio2EngineCallback) +{ + // Called by XAudio2 just before an audio processing pass begins. + STDMETHOD_(void, OnProcessingPassStart) (THIS) PURE; + + // Called just after an audio processing pass ends. + STDMETHOD_(void, OnProcessingPassEnd) (THIS) PURE; + + // Called in the event of a critical system error which requires XAudio2 + // to be closed down and restarted. The error code is given in hrError. + STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT hrError) PURE; +}; + + +/************************************************************************** + * + * IXAudio2VoiceCallback: Client notification interface for voice events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in an XAudio2 voice. This interface should be implemented by the + * client. XAudio2 will call these methods via an interface pointer + * provided by the client using IXAudio2::CreateSourceVoice(). + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback +DECLARE_INTERFACE(IXAudio2VoiceCallback) +{ + // Called just before this voice's processing pass begins. + STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS) PURE; + + // Called just after this voice's processing pass ends. + STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE; + + // Called when this voice has just finished playing a buffer stream + // (as marked with the XAUDIO2_END_OF_STREAM flag on the last buffer). + STDMETHOD_(void, OnStreamEnd) (THIS) PURE; + + // Called when this voice is about to start processing a new buffer. + STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just finished processing a buffer. + // The buffer can now be reused or destroyed. + STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just reached the end position of a loop. + STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext) PURE; +}; + + +/************************************************************************** + * + * Macros to make it easier to use the XAudio2 COM interfaces in C code. + * + **************************************************************************/ + +#ifndef __cplusplus + +// IXAudio2 +#define IXAudio2_QueryInterface(This,riid,ppvInterface) ((This)->lpVtbl->QueryInterface(This,riid,ppvInterface)) +#define IXAudio2_AddRef(This) ((This)->lpVtbl->AddRef(This)) +#define IXAudio2_Release(This) ((This)->lpVtbl->Release(This)) +#define IXAudio2_GetDeviceCount(This,puCount) ((This)->lpVtbl->GetDeviceCount(This,puCount)) +#define IXAudio2_GetDeviceDetails(This,uIndex,pDeviceDetails) ((This)->lpVtbl->GetDeviceDetails(This,uIndex,pDeviceDetails)) +#define IXAudio2_Initialize(This,Flags,pCallback,XAudio2Processor) ((This)->lpVtbl->Initialize(This,Flags,pCallback,XAudio2Processor)) +#define IXAudio2_CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) ((This)->lpVtbl->CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)) +#define IXAudio2_CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain) ((This)->lpVtbl->CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain)) +#define IXAudio2_CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) ((This)->lpVtbl->CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)) +#define IXAudio2_StartEngine(This) ((This)->lpVtbl->StartEngine(This)) +#define IXAudio2_StopEngine(This) ((This)->lpVtbl->StopEngine(This)) +#define IXAudio2_CommitChanges(This,OperationSet) ((This)->lpVtbl->CommitChanges(This,OperationSet)) +#define IXAudio2_GetPerformanceData(This,pPerfData) ((This)->lpVtbl->GetPerformanceData(This,pPerfData)) + +// IXAudio2Voice +#define IXAudio2Voice_Start(This,Flags,OperationSet) ((This)->lpVtbl->Start(This,Flags,OperationSet)) +#define IXAudio2Voice_Stop(This,Flags,OperationSet) ((This)->lpVtbl->Stop(This,Flags,OperationSet)) +//#define IXAudio2Voice_GetVoiceState(This,pRunning) ((This)->lpVtbl->GetVoiceState(This,pRunning)) // REVISE: Disabled for now +#define IXAudio2Voice_SetOutputVoices(This,pSendList) ((This)->lpVtbl->SetOutputVoices(This,pSendList)) +#define IXAudio2Voice_SetEffectChain(This,pEffectChain) ((This)->lpVtbl->SetEffectChain(This,pEffectChain)) +#define IXAudio2Voice_EnableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->EnableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_DisableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->DisableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_GetEffectState(This,EffectIndex,pEnabled) ((This)->lpVtbl->GetEffectState(This,EffectIndex,pEnabled)) +#define IXAudio2Voice_SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize, OperationSet) ((This)->lpVtbl->SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize,OperationSet)) +#define IXAudio2Voice_GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize) ((This)->lpVtbl->GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize)) +#define IXAudio2Voice_SetVolume(This,Volume,OperationSet) ((This)->lpVtbl->SetVolume(This,Volume,OperationSet)) +#define IXAudio2Voice_GetVolume(This,pVolume) ((This)->lpVtbl->GetVolume(This,pVolume)) +#define IXAudio2Voice_SetChannelVolumes(This,Channels,pVolumes,OperationSet) ((This)->lpVtbl->SetChannelVolumes(This,Channels,pVolumes,OperationSet)) +#define IXAudio2Voice_GetChannelVolumes(This,Channels,pVolumes) ((This)->lpVtbl->GetChannelVolumes(This,Channels,pVolumes)) +#define IXAudio2Voice_SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet) ((This)->lpVtbl->SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet)) +#define IXAudio2Voice_GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix) ((This)->lpVtbl->GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix)) +#define IXAudio2Voice_DestroyVoice(This) ((This)->lpVtbl->DestroyVoice(This)) + +// IXAudio2SourceVoice +#define IXAudio2SourceVoice_Start IXAudio2Voice_Start +#define IXAudio2SourceVoice_Stop IXAudio2Voice_Stop +//#define IXAudio2SourceVoice_GetVoiceState IXAudio2Voice_GetVoiceState // REVISE: Disabled for now +#define IXAudio2SourceVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SourceVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SourceVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SourceVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SourceVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SourceVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SourceVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SourceVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SourceVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SourceVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SourceVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SourceVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SourceVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SourceVoice_DestroyVoice IXAudio2Voice_DestroyVoice +#define IXAudio2SourceVoice_SubmitSourceBuffer(This,pBuffer) ((This)->lpVtbl->SubmitSourceBuffer(This,pBuffer)) +#define IXAudio2SourceVoice_ExitLoop(This,OperationSet) ((This)->lpVtbl->ExitLoop(This,OperationSet)) +#define IXAudio2SourceVoice_GetState(This,pVoiceState) ((This)->lpVtbl->GetState(This,pVoiceState)) +#define IXAudio2SourceVoice_SetFrequencyRatio(This,Ratio,OperationSet) ((This)->lpVtbl->SetFrequencyRatio(This,Ratio,OperationSet)) +#define IXAudio2SourceVoice_GetFrequencyRatio(This,pRatio) ((This)->lpVtbl->GetFrequencyRatio(This,pRatio)) +#define IXAudio2SourceVoice_SetFilterParameters(This,pParameters,OperationSet) ((This)->lpVtbl->SetFilterParameters(This,pParameters,OperationSet)) +#define IXAudio2SourceVoice_GetFilterParameters(This,pParameters) ((This)->lpVtbl->GetFilterParameters(This,pParameters)) + +// IXAudio2SubmixVoice +#define IXAudio2SubmixVoice_Start IXAudio2Voice_Start +#define IXAudio2SubmixVoice_Stop IXAudio2Voice_Stop +//#define IXAudio2SubmixVoice_GetVoiceState IXAudio2Voice_GetVoiceState // REVISE: Disabled for now +#define IXAudio2SubmixVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SubmixVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SubmixVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SubmixVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SubmixVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SubmixVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SubmixVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SubmixVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SubmixVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SubmixVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SubmixVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SubmixVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SubmixVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SubmixVoice_DestroyVoice IXAudio2Voice_DestroyVoice + +// IXAudio2MasteringVoice +#define IXAudio2MasteringVoice_Start IXAudio2Voice_Start +#define IXAudio2MasteringVoice_Stop IXAudio2Voice_Stop +//#define IXAudio2MasteringVoice_GetVoiceState IXAudio2Voice_GetVoiceState // REVISE: Disabled for now +#define IXAudio2MasteringVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2MasteringVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2MasteringVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2MasteringVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2MasteringVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2MasteringVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2MasteringVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2MasteringVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2MasteringVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2MasteringVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2MasteringVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2MasteringVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2MasteringVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2MasteringVoice_DestroyVoice IXAudio2Voice_DestroyVoice + +#endif // #ifndef __cplusplus + + +/************************************************************************** + * + * Helper functions used to convert from pitch in semitones and volume in + * decibels to the frequency and amplitude ratios used by XAudio2. These + * are only defined if the client #defines XAUDIO2_HELPER_FUNCTIONS. + * + **************************************************************************/ + +#ifdef XAUDIO2_HELPER_FUNCTIONS + +#include + +// Used to calculate the argument to SetVolume() +__inline float XAudio2DecibelsToAmplitudeRatio(float Decibels) +{ + return (float)pow(10.0, (double)Decibels / 20.0); +} + +// Used to recover a volume in decibels from an amplitude factor +__inline float XAudio2AmplitudeRatioToDecibels(float Volume) +{ + return (float)(20.0 * log10((double)Volume)); +} + +// Used to calculate the argument to SetFrequencyRatio() +__inline float XAudio2SemitonesToFrequencyRatio(float Semitones) +{ + // FrequencyRatio = 2 ^ Octaves + // = 2 ^ (Semitones / 12) + return (float)pow(2.0, Semitones / 12.0); +} + +// Used to recover a pitch in semitones from a frequency ratio +__inline float XAudio2FrequencyRatioToSemitones(float FrequencyRatio) +{ + // Semitones = 12 * log2(FrequencyRatio) + // = 12 * log2(10) * log10(FrequencyRatio) + // = 12 * 3.3219281 * log10(FrequencyRatio) + return (float)(39.86313713865 * log10((double)FrequencyRatio); +} + +#endif // #ifdef XAUDIO2_HELPER_FUNCTIONS + + +/************************************************************************** + * + * XAudio2Create: Top-level function that creates an XAudio2 instance. + * + * On Windows this is just an inline function that calls CoCreateInstance + * and Initialize. The arguments are described above, under Initialize, + * except that the XAUDIO2_DEBUG_ENGINE flag can be used here to select + * the debug version of XAudio2. On Xbox, this flag has no effect; the + * application must link with the debug version of the library instead. + * + **************************************************************************/ + +#ifdef _XBOX + +STDAPI XAudio2Create(X2OUT IXAudio2** ppXAudio2, UINT32 Flags DEFAULT(0), + X2INOPT IXAudio2EngineCallback* pCallback DEFAULT(NULL), + XAUDIO2_PROCESSOR XAudio2Processor DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); + +#else // Windows + +__inline HRESULT XAudio2Create(X2OUT IXAudio2** ppXAudio2, UINT32 Flags DEFAULT(0), + X2INOPT IXAudio2EngineCallback* pCallback DEFAULT(NULL), + XAUDIO2_PROCESSOR XAudio2Processor DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) +{ + // Instantiate the appropriate XAudio2 engine + IXAudio2* pXAudio2; + + #ifdef __cplusplus + + HRESULT hr = CoCreateInstance((Flags & XAUDIO2_DEBUG_ENGINE) ? __uuidof(XAudio2_Debug) : __uuidof(XAudio2), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IXAudio2), (void**)&pXAudio2); + if (SUCCEEDED(hr)) + { + hr = pXAudio2->Initialize(Flags, pCallback, XAudio2Processor); + if (SUCCEEDED(hr)) + { + *ppXAudio2 = pXAudio2; + } + else + { + pXAudio2->Release(); + } + } + + #else + + HRESULT hr = CoCreateInstance((Flags & XAUDIO2_DEBUG_ENGINE) ? &CLSID_XAudio2_Debug : &CLSID_XAudio2, + NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); + if (SUCCEEDED(hr)) + { + hr = pXAudio2->lpVtbl->Initialize(pXAudio2, Flags, pCallback, XAudio2Processor); + if (SUCCEEDED(hr)) + { + *ppXAudio2 = pXAudio2; + } + else + { + pXAudio2->lpVtbl->Release(pXAudio2); + } + } + + #endif // #ifdef __cplusplus + + return hr; +} + +#endif // #ifdef _XBOX +#endif // #ifndef GUID_DEFS_ONLY +#endif // #ifndef __XAUDIO2_INCLUDED__ diff --git a/SDK/dxSDK/Include/xaudio2fx.h b/SDK/dxSDK/Include/xaudio2fx.h new file mode 100644 index 00000000..445f925a --- /dev/null +++ b/SDK/dxSDK/Include/xaudio2fx.h @@ -0,0 +1,152 @@ +/************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xaudio2.h + * Content: Declarations for the audio effects included with XAudio2. + * + **************************************************************************/ + +#ifndef __XAUDIO2FX_INCLUDED__ +#define __XAUDIO2FX_INCLUDED__ + + +/************************************************************************** + * + * XAudio2 effect class IDs. + * + **************************************************************************/ + +#include // For DEFINE_CLSID and DEFINE_IID + +DEFINE_CLSID(AudioVolumeMeter, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, E2); +DEFINE_CLSID(AudioVolumeMeter_Debug, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, DB); +DEFINE_CLSID(AudioReverb, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, 63); +DEFINE_CLSID(AudioReverb_Debug, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, DB); + + +// Ignore the rest of this header if only the GUID definitions were requested +#ifndef GUID_DEFS_ONLY + + +/************************************************************************** + * + * XAudio2 effect parameter structures. + * + **************************************************************************/ + + +// XAUDIO2FX_VOLUMEMETER_LEVELS: Receives results from GetMeterLevels(). +// The user is responsible for allocating pPeakLevels, pRMSLevels, and +// initializing ChannelCount accordingly. +typedef struct XAUDIO2FX_VOLUMEMETER_LEVELS +{ + float* pPeakLevels; // Peak levels table: receives maximum absolute level for each channel + // over a processing pass; must have at least ChannelCount elements + float* pRMSLevels; // Root mean square levels table: receives RMS level for each channel + // over a processing pass; must have at least ChannelCount elements + UINT32 ChannelCount; // Number of channels being processed by the volume meter APO +} XAUDIO2FX_VOLUMEMETER_LEVELS; + + +// XAUDIO2FX_REVERB_PARAMETERS: Parameter set for the reverb effect. +typedef struct XAUDIO2FX_REVERB_PARAMETERS +{ + // Original / processed signal ratio + float WetDryMix; // [0, 100] (percentage) + + // Delay times + UINT32 ReflectionsDelay; // [0, 300] in ms + BYTE ReverbDelay; // [0, 85] in ms + BYTE RearDelay; // [0, 5] in ms + + // Indexed parameters + BYTE PositionLeft; // [0, 30] no units + BYTE PositionRight; // [0, 30] no units + BYTE PositionMatrixLeft; // [0, 30] no units + BYTE PositionMatrixRight; // [0, 30] no units + BYTE EarlyDiffusion; // [0, 15] no units + BYTE LateDiffusion; // [0, 15] no units + BYTE LowEQGain; // [0, 12] no units + BYTE LowEQCutoff; // [0, 9] no units + BYTE HighEQGain; // [0, 8] no units + BYTE HighEQCutoff; // [0, 14] no units + + // Direct parameters + float RoomFilterFreq; // [20, 20000] in Hz + float RoomFilterMain; // [-100, 0] in dB + float RoomFilterHF; // [-100, 0] in dB + float ReflectionsGain; // [-100, 20] in dB + float ReverbGain; // [-100, 20] in dB + float DecayTime; // [0.1, inf] in seconds + float Density; // [0, 100] (percentage) + float RoomSize; // [1, 100] in feet +} XAUDIO2FX_REVERB_PARAMETERS; + + +/************************************************************************** + * + * Effect creation functions. On Windows, these are just inline functions + * that call CoCreateInstance and Initialize; the XAUDIO2FX_DEBUG flag can + * be used to select the debug version of the effects. On Xbox, these map + * to real functions included in xaudio2.lib, and the XAUDIO2FX_DEBUG flag + * is ignored; the application must link with the debug library to use the + * debug functionality. + * + **************************************************************************/ + +// Use default values for some parameters if building C++ code +#ifdef __cplusplus + #define DEFAULT(x) =x +#else + #define DEFAULT(x) +#endif + +#define XAUDIO2FX_DEBUG 1 // To select the debug version of an effect + +#ifdef _XBOX + + STDAPI CreateAudioVolumeMeter(IUnknown** ppApo); + STDAPI CreateAudioReverb(IUnknown** ppApo); + + __inline HRESULT XAudio2CreateVolumeMeter(IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) + { + return CreateAudioVolumeMeter(ppApo); + } + + __inline HRESULT XAudio2CreateReverb(IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) + { + return CreateAudioReverb(ppApo); + } + +#else // Windows + + __inline HRESULT XAudio2CreateVolumeMeter(IUnknown** ppApo, UINT32 Flags DEFAULT(0)) + { + #ifdef __cplusplus + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioVolumeMeter_Debug) + : __uuidof(AudioVolumeMeter), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); + #else + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioVolumeMeter_Debug + : &CLSID_AudioVolumeMeter, + NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); + #endif + } + + __inline HRESULT XAudio2CreateReverb(IUnknown** ppApo, UINT32 Flags DEFAULT(0)) + { + #ifdef __cplusplus + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioReverb_Debug) + : __uuidof(AudioReverb), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); + #else + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioReverb_Debug + : &CLSID_AudioReverb, + NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); + #endif + } + +#endif // #ifdef _XBOX +#endif // #ifndef GUID_DEFS_ONLY +#endif // #ifndef __XAUDIO2FX_INCLUDED__ diff --git a/SDK/dxSDK/Include/xma2defs.h b/SDK/dxSDK/Include/xma2defs.h new file mode 100644 index 00000000..7a8c2504 --- /dev/null +++ b/SDK/dxSDK/Include/xma2defs.h @@ -0,0 +1,685 @@ +/*************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xma2defs.h + * Content: Constants, data types and functions for XMA2 compressed audio. + * + ***************************************************************************/ + +#ifndef __XMA2DEFS_INCLUDED__ +#define __XMA2DEFS_INCLUDED__ + +#include "audiodefs.h" // Basic data types and constants for audio work + + +/*************************************************************************** + * Overview + ***************************************************************************/ + +// A typical XMA2 file contains these RIFF chunks: +// +// 'fmt' or 'XMA2' chunk (or both): A description of the XMA data's structure +// and characteristics (length, channels, sample rate, loops, block size, etc). +// +// 'seek' chunk: A seek table to help navigate the XMA data. +// +// 'data' chunk: The encoded XMA2 data. +// +// The encoded XMA2 data is structured as a set of BLOCKS, which contain PACKETS, +// which contain FRAMES, which contain SUBFRAMES (roughly speaking). The frames +// in a file may also be divided into several subsets, called STREAMS. +// +// FRAME: A variable-sized segment of XMA data that decodes to exactly 512 mono +// or stereo PCM samples. This is the smallest unit of XMA data that can +// be decoded in isolation. Frames are an arbitrary number of bits in +// length, and need not be byte-aligned. See "XMA frame structure" below. +// +// SUBFRAME: A region of bits in an XMA frame that decodes to 128 mono or stereo +// samples. The XMA decoder cannot decode a subframe in isolation; it needs +// a whole frame to work with. However, it can begin emitting the frame's +// decoded samples at any one of the four subframe boundaries. Subframes +// can be addressed for seeking and looping purposes. +// +// PACKET: A 2Kb region containing a 32-bit header and some XMA frames. Frames +// can (and usually do) span packets. A packet's header includes the offset +// in bits of the first frame that begins within that packet. All of the +// frames that begin in a given packet belong to the same "stream" (see the +// Multichannel Audio section below). +// +// STREAM: A set of packets within an XMA file that all contain data for the +// same mono or stereo component of a PCM file with more than two channels. +// The packets comprising a given stream may be interleaved with each other +// more or less arbitrarily; see Multichannel Audio. +// +// BLOCK: An array of XMA packets; or, to break it down differently, a series of +// consecutive XMA frames, padded at the end with reserved data. A block +// must contain at least one 2Kb packet per stream, and it can hold up to +// 4095 packets (8190Kb), but its size is typically in the 32Kb-128Kb range. +// (The size chosen involves a trade-off between memory use and efficiency +// of reading from permanent storage.) +// +// XMA frames do not span blocks, so a block is guaranteed to begin with a +// set of complete frames, one per stream. Also, a block in a multi-stream +// XMA2 file always contains the same number of samples for each stream in +// the file; see Multichannel Audio. +// +// The 'data' chunk in an XMA2 file is an array of XMA2WAVEFORMAT.BlockCount XMA +// blocks, all of the same size (as specified in XMA2WAVEFORMAT.BlockSizeInBytes) +// except for the last one, which may be shorter. + + +// MULTICHANNEL AUDIO: the XMA decoder can only decode raw XMA data into either +// mono or stereo PCM data. In order to encode a 6-channel file (say), the file +// must be deinterleaved into 3 stereo streams that are encoded independently, +// producing 3 encoded XMA data streams. Then the packets in these 3 streams +// are interleaved to produce a single XMA2 file, and some information is added +// to the file so that the original 6-channel audio can be reconstructed at +// decode time. This works using the concept of an XMA stream (see above). +// +// The frames for all the streams in an XMA file are interleaved in an arbitrary +// order. To locate a frame that belongs to a given stream in a given XMA block, +// you must examine the first few packets in the block. Here (and only here) the +// packets are guaranteed to be presented in stream order, so that all frames +// beginning in packet 0 belong to stream 0 (the first stereo pair), etc. +// +// (This means that when decoding multi-stream XMA files, only entire XMA blocks +// should be submitted to the decoder; otherwise it cannot know which frames +// belong to which stream.) +// +// Once you have one frame that belongs to a given stream, you can find the next +// one by looking at the frame's 'NextFrameOffsetBits' value (which is stored in +// its first 15 bits; see XMAFRAME below). The GetXmaFrameBitPosition function +// uses this technique. + + +// SEEKING IN XMA2 FILES: Here is some pseudocode to find the byte position and +// subframe in an XMA2 file which will contain sample S when decoded. +// +// 1. Traverse the seek table to find the XMA2 block containing sample S. The +// seek table is an array of big-endian DWORDs, one per block in the file. +// The Nth DWORD is the total number of PCM samples that would be obtained +// by decoding the entire XMA file up to the end of block N. Hence, the +// block we want is the first one whose seek table entry is greater than S. +// (See the GetXmaBlockContainingSample helper function.) +// +// 2. Calculate which frame F within the block found above contains sample S. +// Since each frame decodes to 512 samples, this is straightforward. The +// first frame in the block produces samples X to X + 512, where X is the +// seek table entry for the prior block. So F is (S - X) / 512. +// +// 3. Find the bit offset within the block where frame F starts. Since frames +// are variable-sized, this can only be done by traversing all the frames in +// the block until we reach frame F. (See GetXmaFrameBitPosition.) +// +// 4. This frame is made up of four 128-sample subframes. To find the subframe +// containing S, we can use the formula (S % 512) / 128. +// +// In the case of multi-stream XMA files, sample S is a multichannel sample with +// parts coming from several frames, one per stream. To find all these frames, +// steps 2-4 need to be repeated for each stream N, using the knowledge that the +// first packets in a block are presented in stream order. The frame traversal +// in step 3 must be started at the first frame in the Nth packet of the block, +// which will be the first frame for stream N. (And the packet header will tell +// you where within the packet's first frame begins.) +// +// Step 1 can be performed using the GetXmaBlockContainingSample function below, +// and steps 2-4 by calling GetXmaDecodePositionForSample once for each stream. + + + +/*************************************************************************** + * XMA constants + ***************************************************************************/ + +// Size of the PCM samples produced by the XMA decoder +#define XMA_OUTPUT_SAMPLE_BYTES 2u +#define XMA_OUTPUT_SAMPLE_BITS (XMA_OUTPUT_SAMPLE_BYTES * 8u) + +// Size of an XMA packet +#define XMA_BYTES_PER_PACKET 2048u +#define XMA_BITS_PER_PACKET (XMA_BYTES_PER_PACKET * 8u) + +// Size of an XMA packet header +#define XMA_PACKET_HEADER_BYTES 4u +#define XMA_PACKET_HEADER_BITS (XMA_PACKET_HEADER_BYTES * 8u) + +// Sample blocks in a decoded XMA frame +#define XMA_SAMPLES_PER_FRAME 512u + +// Sample blocks in a decoded XMA subframe +#define XMA_SAMPLES_PER_SUBFRAME 128u + +// Maximum encoded data that can be submitted to the XMA decoder at a time +#define XMA_READBUFFER_MAX_PACKETS 4095u +#define XMA_READBUFFER_MAX_BYTES (XMA_READBUFFER_MAX_PACKETS * XMA_BYTES_PER_PACKET) + +// Maximum size allowed for the XMA decoder's output buffers +#define XMA_WRITEBUFFER_MAX_BYTES (31u * 256u) + +// Required byte alignment of the XMA decoder's output buffers +#define XMA_WRITEBUFFER_BYTE_ALIGNMENT 256u + +// Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field +#define XMA_MIN_SUBFRAMES_TO_DECODE 1u +#define XMA_MAX_SUBFRAMES_TO_DECODE 8u +#define XMA_OPTIMAL_SUBFRAMES_TO_DECODE 4u + +// Maximum legal value for LoopCount; represent an infinite number of loops +#define XMA_MAX_LOOPCOUNT 255u + + + +/*************************************************************************** + * XMA format structures + ***************************************************************************/ + +// The currently recommended way to express format information for XMA2 files +// is the XMAWAVEFORMATEX structure. This structure is fully compliant with +// the WAVEFORMATEX standard and contains all the information needed to parse +// and manage XMA2 files in a compact way. + +#define WAVE_FORMAT_XMA2 0x166 + +typedef struct XMA2WAVEFORMATEX +{ + WAVEFORMATEX wfx; + // Meaning of the WAVEFORMATEX fields here: + // wFormatTag; // Audio format type; always WAVE_FORMAT_XMA2 + // nChannels; // Channel count of the decoded audio + // nSamplesPerSec; // Sample rate of the decoded audio + // nAvgBytesPerSec; // Used internally by the XMA encoder + // nBlockAlign; // Decoded sample size; channels * wBitsPerSample / 8 + // wBitsPerSample; // Bits per decoded mono sample; always 16 for XMA + // cbSize; // Size in bytes of the rest of this structure (34) + + WORD NumStreams; // Number of audio streams (1 or 2 channels each) + DWORD ChannelMask; // Spatial positions of the channels in this file + DWORD SamplesEncoded; // Total number of PCM samples the file decodes to + DWORD BytesPerBlock; // XMA block size (but the last one may be shorter) + DWORD PlayBegin; // First valid sample in the decoded audio + DWORD PlayLength; // Length of the valid part of the decoded audio + DWORD LoopBegin; // Beginning of the loop region in decoded sample terms + DWORD LoopLength; // Length of the loop region in decoded sample terms + BYTE LoopCount; // Number of loops; 0 = no looping, 255 == infinite + BYTE EncoderVersion; // Version of XMA encoder that generated the file + WORD BlockCount; // XMA blocks in file (and entries in its seek table) +} XMA2WAVEFORMATEX, *PXMA2WAVEFORMATEX; + + +// The legacy XMA format structures are described here for reference, but they +// should not be used in new content. XMAWAVEFORMAT was the structure used in +// XMA version 1 files. XMA2WAVEFORMAT was used in early XMA2 files; it is not +// placed in the usual 'fmt' RIFF chunk but in its own 'XMA2' chunk. + +#ifndef WAVE_FORMAT_XMA +#define WAVE_FORMAT_XMA 0x0165 + +// Values used in the ChannelMask fields below. Similar to the SPEAKER_xxx +// values used in WAVEFORMATEXTENSIBLE, but modified to fit in a single byte. +#ifndef XMA_SPEAKER_LEFT + #define XMA_SPEAKER_LEFT 0x01 + #define XMA_SPEAKER_RIGHT 0x02 + #define XMA_SPEAKER_CENTER 0x04 + #define XMA_SPEAKER_LFE 0x08 + #define XMA_SPEAKER_LEFT_SURROUND 0x10 + #define XMA_SPEAKER_RIGHT_SURROUND 0x20 + #define XMA_SPEAKER_LEFT_BACK 0x40 + #define XMA_SPEAKER_RIGHT_BACK 0x80 +#endif + + +// Used in XMAWAVEFORMAT for per-stream data +typedef struct XMASTREAMFORMAT +{ + DWORD PsuedoBytesPerSec; // Used by the XMA encoder (typo preserved for legacy reasons) + DWORD SampleRate; // The stream's decoded sample rate (in XMA2 files, + // this is the same for all streams in the file). + DWORD LoopStart; // Bit offset of the frame containing the loop start + // point, relative to the beginning of the stream. + DWORD LoopEnd; // Bit offset of the frame containing the loop end. + BYTE SubframeData; // Two 4-bit numbers specifying the exact location of + // the loop points within the frames that contain them. + // 1st 4 bits: Which subframe of the end frame does + // the loop end at. Ranges from 0 to 3. + // 2nd 4 bits: Which subframe of the start frame does + // the loop begin at. Ranges from 1 to 4. + BYTE Channels; // Number of channels in the stream (1 or 2) + WORD ChannelMask; // Spatial positions of the channels in the stream +} XMASTREAMFORMAT; + +// Legacy XMA1 format structure +typedef struct XMAWAVEFORMAT +{ + WORD FormatTag; // Audio format type (always WAVE_FORMAT_XMA) + WORD BitsPerSample; // Bit depth (currently required to be 16) + WORD EncodeOptions; // Options for XMA encoder/decoder + WORD LargestSkip; // Largest skip used in interleaving streams + WORD NumStreams; // Number of interleaved audio streams + BYTE LoopCount; // Number of loop repetitions; 255 == infinite + BYTE Version; // XMA encoder version that generated the file. + // Always 3 or higher for XMA2 files. + XMASTREAMFORMAT XmaStreams[1]; // Per-stream format information; the actual + // array length is in the NumStreams field. +} XMAWAVEFORMAT; + + +// Used in XMA2WAVEFORMAT for per-stream data +typedef struct XMA2STREAMFORMAT +{ + BYTE Channels; // Number of channels in the stream (1 or 2) + BYTE RESERVED; // Reserved for future use + WORD ChannelMask; // Spatial positions of the channels in the stream +} XMA2STREAMFORMAT; + +// Legacy XMA2 format structure (big-endian byte ordering) +typedef struct XMA2WAVEFORMAT +{ + BYTE Version; // XMA encoder version that generated the file. + // Always 3 or higher for XMA2 files. + BYTE NumStreams; // Number of interleaved audio streams + BYTE RESERVED; // Reserved for future use + BYTE LoopCount; // Loop count; 255 == infinite + DWORD LoopBegin; // Loop begin point, in samples + DWORD LoopEnd; // Loop end point, in samples + DWORD SampleRate; // The file's decoded sample rate + DWORD EncodeOptions; // Options for the XMA encoder/decoder + DWORD PsuedoBytesPerSec; // Used internally by the XMA encoder + DWORD BlockSizeInBytes; // Size in bytes of this file's XMA blocks (except + // possibly the last one). Always a multiple of + // 2Kb, since XMA blocks are arrays of 2Kb packets. + DWORD SamplesEncoded; // Total number of PCM samples encoded in this file + DWORD SamplesInSource; // Actual number of PCM samples in the source + // material used to generate this file + DWORD BlockCount; // Number of XMA blocks in this file (and hence + // also the number of entries in its seek table) + XMA2STREAMFORMAT Streams[1]; // Per-stream format information; the actual + // array length is in the NumStreams field. +} XMA2WAVEFORMAT; + +#endif // #ifndef WAVE_FORMAT_XMA + + + +/*************************************************************************** + * XMA packet structure (in big-endian form) + ***************************************************************************/ + +typedef struct XMA2PACKET +{ + int FrameCount : 6; // Number of XMA frames that begin in this packet + int FrameOffsetInBits : 15; // Bit of XmaData where the first complete frame begins + int PacketMetaData : 3; // Metadata stored in the packet (always 1 for XMA2) + int PacketSkipCount : 8; // How many packets belonging to other streams must be + // skipped to find the next packet belonging to this one + BYTE XmaData[XMA_BYTES_PER_PACKET - sizeof(DWORD)]; // XMA encoded data +} XMA2PACKET; + +// E.g. if the first DWORD of a packet is 0x30107902: +// +// 001100 000001000001111 001 00000010 +// | | | |____ Skip 2 packets to find the next one for this stream +// | | |___________ XMA2 signature (always 001) +// | |_____________________ First frame starts 527 bits into packet +// |________________________________ Packet contains 12 frames + + +// Helper functions to extract the fields above from an XMA packet. (Note that +// the bitfields cannot be read directly on little-endian architectures such as +// the Intel x86, as they are laid out in big-endian form.) + +__inline DWORD GetXmaPacketFrameCount(const BYTE* pPacket) +{ + return (DWORD)(pPacket[0] >> 2); +} + +__inline DWORD GetXmaPacketFirstFrameOffsetInBits(const BYTE* pPacket) +{ + return ((DWORD)(pPacket[0] & 0x3) << 13) | + ((DWORD)(pPacket[1]) << 5) | + ((DWORD)(pPacket[2]) >> 3); +} + +__inline DWORD GetXmaPacketMetadata(const BYTE* pPacket) +{ + return (DWORD)(pPacket[2] & 0x7); +} + +__inline DWORD GetXmaPacketSkipCount(const BYTE* pPacket) +{ + return (DWORD)(pPacket[3]); +} + + + +/*************************************************************************** + * XMA frame structure + ***************************************************************************/ + +// There is no way to represent the XMA frame as a C struct, since it is a +// variable-sized string of bits that need not be stored at a byte-aligned +// position in memory. This is the layout: +// +// XMAFRAME +// { +// LengthInBits: A 15-bit number representing the length of this frame. +// XmaData: Encoded XMA data; its size in bits is (LengthInBits - 15). +// } + + + +/*************************************************************************** + * XMA helper functions + ***************************************************************************/ + +// Try to use ASSERT and TRACE macros if available +#ifdef ASSERT + #define XMA2DEFS_ASSERT ASSERT +#else + #define XMA2DEFS_ASSERT(a) +#endif + +// GetXmaBlockContainingSample: Use a given seek table to find the XMA block +// containing a given decoded sample. + +__inline HRESULT GetXmaBlockContainingSample +( + DWORD nBlockCount, // Blocks in the file (= seek table entries) + const DWORD* pSeekTable, // Pointer to data from the seek table chunk + DWORD nDesiredSample, // Decoder sample to locate + DWORD* pnBlockContainingSample, // Index of the block containing the sample + DWORD* pnSampleOffsetWithinBlock // Position of the sample in this block +) +{ + DWORD nPreviousTotalSamples = 0; + DWORD nBlock; + DWORD nTotalSamplesSoFar; + + XMA2DEFS_ASSERT(pSeekTable); + XMA2DEFS_ASSERT(pnBlockContainingSample); + XMA2DEFS_ASSERT(pnSampleOffsetWithinBlock); + + for (nBlock = 0; nBlock < nBlockCount; ++nBlock) + { + // REVISE: Is byte-swapping required? + nTotalSamplesSoFar = pSeekTable[nBlock]; + if (nTotalSamplesSoFar > nDesiredSample) + { + *pnBlockContainingSample = nBlock; + *pnSampleOffsetWithinBlock = nDesiredSample - nPreviousTotalSamples; + return S_OK; + } + nPreviousTotalSamples = nTotalSamplesSoFar; + } + + return E_FAIL; +} + +// GetXmaFrameLengthInBits: Reads a given frame's LengthInBits field. + +__inline DWORD GetXmaFrameLengthInBits +( + const BYTE* pPacket, // Beginning of the XMA packet containing the frame + DWORD nBitPosition // Bit offset of the frame within this packet +) +{ + DWORD nBytePosition = nBitPosition / 8; + + DWORD nRegion = (DWORD)(pPacket[nBytePosition+0]) << 16 | + (DWORD)(pPacket[nBytePosition+1]) << 8 | + (DWORD)(pPacket[nBytePosition+2]); + + return (nRegion >> (9 - nBitPosition % 8)) & 0x7FFF; // Last 15 bits +} + +// GetXmaFrameBitPosition: Calculates the bit offset of a given frame within +// an XMA block or set of blocks. Returns 0 on failure. + +__inline DWORD GetXmaFrameBitPosition +( + const BYTE* pXmaData, // Pointer to beginning of the XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex, // Stream within which to seek + DWORD nDesiredFrame // Frame sought +) +{ + const BYTE* pCurrentPacket; + DWORD nPacketsExamined = 0; + DWORD nFrameCountSoFar = 0; + DWORD nFramesToSkip; + DWORD nFrameBitOffset; + + XMA2DEFS_ASSERT(pXmaData); + XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0); + + // Get the first XMA packet belonging to the desired stream, relying on the + // fact that the first packets for each stream are in consecutive order at + // the beginning of an XMA block. + + pCurrentPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET; + for (;;) + { + // If we have exceeded the size of the XMA data, return failure + if (pCurrentPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes) + { + return 0; + } + + // If the current packet contains the frame we are looking for... + if (nFrameCountSoFar + GetXmaPacketFrameCount(pCurrentPacket) > nDesiredFrame) + { + // See how many frames in this packet we need to skip to get to it + XMA2DEFS_ASSERT(nDesiredFrame >= nFrameCountSoFar); + nFramesToSkip = nDesiredFrame - nFrameCountSoFar; + + // Get the bit offset of the first frame in this packet + nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pCurrentPacket); + + // Advance nFrameBitOffset to the frame of interest + while (nFramesToSkip--) + { + nFrameBitOffset += GetXmaFrameLengthInBits(pCurrentPacket, nFrameBitOffset); + } + + // The bit offset to return is the number of bits from pXmaData to + // pCurrentPacket plus the bit offset of the frame of interest + return (DWORD)(pCurrentPacket - pXmaData) * 8 + nFrameBitOffset; + } + + // If we haven't found the right packet yet, advance our counters + ++nPacketsExamined; + nFrameCountSoFar += GetXmaPacketFrameCount(pCurrentPacket); + + // And skip to the next packet belonging to the same stream + pCurrentPacket += XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pCurrentPacket) + 1); + } +} + +// GetLastXmaFrameBitPosition: Calculates the bit offset of the last frame in +// an XMA block or set of blocks. Returns 0 on failure. + +__inline DWORD GetLastXmaFrameBitPosition +( + const BYTE* pXmaData, // Pointer to beginning of the XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex // Stream within which to seek +) +{ + const BYTE* pCurrentPacket; + DWORD nBytesToNextPacket; + + XMA2DEFS_ASSERT(pXmaData); + XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0); + + // Get the first XMA packet belonging to the desired stream, relying on the + // fact that the first packets for each stream are in consecutive order at + // the beginning of an XMA block. + + pCurrentPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET; + for (;;) + { + // If we have exceeded the size of the XMA data, return failure + if (pCurrentPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes) + { + return 0; + } + + // See if the next packet begins beyond pXmaData + nXmaDataBytes + nBytesToNextPacket = XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pCurrentPacket) + 1); + if (pCurrentPacket + nBytesToNextPacket >= pXmaData + nXmaDataBytes) + { + // Found the last packet. Get the bit offset of its first frame. + DWORD nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pCurrentPacket); + + // Find the bit offset of the last complete frame in the packet + DWORD nFrameCount = GetXmaPacketFrameCount(pCurrentPacket); + while (--nFrameCount) + { + nFrameBitOffset += GetXmaFrameLengthInBits(pCurrentPacket, nFrameBitOffset); + } + + // The bit offset to return is the number of bits from pXmaData to + // pCurrentPacket plus the offset of the last frame in this packet + return (DWORD)(pCurrentPacket - pXmaData) * 8 + nFrameBitOffset; + } + + // Advance to the next packet and continue + pCurrentPacket += nBytesToNextPacket; + } +} + +// GetXmaDecodePositionForSample: Obtains the information needed to make the +// decoder generate audio starting at a given sample position relative to the +// beginning of the given XMA block: the bit offset of the appropriate frame, +// and the right subframe within that frame. This data can be passed directly +// to the XMAPlaybackSetDecodePosition function. + +__inline HRESULT GetXmaDecodePositionForSample +( + const BYTE* pXmaData, // Pointer to beginning of the XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex, // Stream within which to seek + DWORD nDesiredSample, // Sample sought + DWORD* pnBitOffset, // Returns the bit offset within pXmaData of + // the frame containing the sample sought + DWORD* pnSubFrame // Returns the subframe containing the sample +) +{ + DWORD nDesiredFrame = nDesiredSample / XMA_SAMPLES_PER_FRAME; + DWORD nSubFrame = (nDesiredSample % XMA_SAMPLES_PER_FRAME) / XMA_SAMPLES_PER_SUBFRAME; + DWORD nBitOffset = GetXmaFrameBitPosition(pXmaData, nXmaDataBytes, nStreamIndex, nDesiredFrame); + + XMA2DEFS_ASSERT(pnBitOffset); + XMA2DEFS_ASSERT(pnSubFrame); + + if (nBitOffset) + { + *pnBitOffset = nBitOffset; + *pnSubFrame = nSubFrame; + return S_OK; + } + else + { + return E_FAIL; + } +} + +// GetXmaSampleRate: Obtains the legal XMA sample rate (24, 32, 44.1 or 48Khz) +// corresponding to a generic sample rate. + +__inline DWORD GetXmaSampleRate(DWORD dwGeneralRate) +{ + DWORD dwXmaRate = 48000; // Default XMA rate for all rates above 44100Hz + + if (dwGeneralRate <= 24000) dwXmaRate = 24000; + else if (dwGeneralRate <= 32000) dwXmaRate = 32000; + else if (dwGeneralRate <= 44100) dwXmaRate = 44100; + + return dwXmaRate; +} + +// Functions to convert between WAVEFORMATEXTENSIBLE channel masks (combinations +// of the SPEAKER_xxx flags defined in x3daudio.h) and XMA channel masks (which +// are limited to eight possible speaker positions: left, right, center, low +// frequency, side left, side right, back left and back right). + +#ifndef SPEAKER_FRONT_LEFT + #include // Definitions of the SPEAKER_xxx positions + #define _SPEAKER_POSITIONS_ // Avoids macro redefinition errors in mmreg.h +#endif + +__inline DWORD GetStandardChannelMaskFromXmaMask(BYTE bXmaMask) +{ + DWORD dwStandardMask = 0; + + if (bXmaMask & XMA_SPEAKER_LEFT) dwStandardMask |= SPEAKER_FRONT_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT) dwStandardMask |= SPEAKER_FRONT_RIGHT; + if (bXmaMask & XMA_SPEAKER_CENTER) dwStandardMask |= SPEAKER_FRONT_CENTER; + if (bXmaMask & XMA_SPEAKER_LFE) dwStandardMask |= SPEAKER_LOW_FREQUENCY; + if (bXmaMask & XMA_SPEAKER_LEFT_SURROUND) dwStandardMask |= SPEAKER_SIDE_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT_SURROUND) dwStandardMask |= SPEAKER_SIDE_RIGHT; + if (bXmaMask & XMA_SPEAKER_LEFT_BACK) dwStandardMask |= SPEAKER_BACK_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT_BACK) dwStandardMask |= SPEAKER_BACK_RIGHT; + + return dwStandardMask; +} + +__inline BYTE GetXmaChannelMaskFromStandardMask(DWORD dwStandardMask) +{ + BYTE bXmaMask = 0; + + if (dwStandardMask & SPEAKER_FRONT_LEFT) bXmaMask |= XMA_SPEAKER_LEFT; + if (dwStandardMask & SPEAKER_FRONT_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT; + if (dwStandardMask & SPEAKER_FRONT_CENTER) bXmaMask |= XMA_SPEAKER_CENTER; + if (dwStandardMask & SPEAKER_LOW_FREQUENCY) bXmaMask |= XMA_SPEAKER_LFE; + if (dwStandardMask & SPEAKER_SIDE_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_SURROUND; + if (dwStandardMask & SPEAKER_SIDE_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_SURROUND; + if (dwStandardMask & SPEAKER_BACK_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_BACK; + if (dwStandardMask & SPEAKER_BACK_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_BACK; + + return bXmaMask; +} + +// LocalizeXma2Format: Modifies a XMA2WAVEFORMATEX structure in place to comply +// with the current platform's byte-ordering rules (little- or big-endian). + +__inline HRESULT LocalizeXma2Format(XMA2WAVEFORMATEX* pXma2Format) +{ + #define XMASWAP2BYTES(n) ((WORD)(((n) >> 8) | (((n) & 0xff) << 8))) + #define XMASWAP4BYTES(n) ((DWORD)((n) >> 24 | (n) << 24 | ((n) & 0xff00) << 8 | ((n) & 0xff0000) >> 8)) + + if (pXma2Format->wfx.wFormatTag == WAVE_FORMAT_XMA2) + { + return S_OK; + } + else if (XMASWAP2BYTES(pXma2Format->wfx.wFormatTag) == WAVE_FORMAT_XMA2) + { + pXma2Format->wfx.wFormatTag = XMASWAP2BYTES(pXma2Format->wfx.wFormatTag); + pXma2Format->wfx.nChannels = XMASWAP2BYTES(pXma2Format->wfx.nChannels); + pXma2Format->wfx.nSamplesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nSamplesPerSec); + pXma2Format->wfx.nAvgBytesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nAvgBytesPerSec); + pXma2Format->wfx.nBlockAlign = XMASWAP2BYTES(pXma2Format->wfx.nBlockAlign); + pXma2Format->wfx.wBitsPerSample = XMASWAP2BYTES(pXma2Format->wfx.wBitsPerSample); + pXma2Format->wfx.cbSize = XMASWAP2BYTES(pXma2Format->wfx.cbSize); + pXma2Format->NumStreams = XMASWAP2BYTES(pXma2Format->NumStreams); + pXma2Format->ChannelMask = XMASWAP4BYTES(pXma2Format->ChannelMask); + pXma2Format->SamplesEncoded = XMASWAP4BYTES(pXma2Format->SamplesEncoded); + pXma2Format->BytesPerBlock = XMASWAP4BYTES(pXma2Format->BytesPerBlock); + pXma2Format->PlayBegin = XMASWAP4BYTES(pXma2Format->PlayBegin); + pXma2Format->PlayLength = XMASWAP4BYTES(pXma2Format->PlayLength); + pXma2Format->LoopBegin = XMASWAP4BYTES(pXma2Format->LoopBegin); + pXma2Format->LoopLength = XMASWAP4BYTES(pXma2Format->LoopLength); + pXma2Format->BlockCount = XMASWAP2BYTES(pXma2Format->BlockCount); + return S_OK; + } + else + { + return E_FAIL; // Not a recognizable XMA2 format + } + + #undef XMASWAP2BYTES + #undef XMASWAP4BYTES +} + + +#endif // #ifndef __XMA2DEFS_INCLUDED__ diff --git a/SDK/dxSDK/Lib/DxErr.lib b/SDK/dxSDK/Lib/DxErr.lib new file mode 100644 index 00000000..1397f3c1 Binary files /dev/null and b/SDK/dxSDK/Lib/DxErr.lib differ diff --git a/SDK/dxSDK/Lib/DxErr8.lib b/SDK/dxSDK/Lib/DxErr8.lib new file mode 100644 index 00000000..e99f1a17 Binary files /dev/null and b/SDK/dxSDK/Lib/DxErr8.lib differ diff --git a/SDK/dxSDK/Lib/DxErr9.lib b/SDK/dxSDK/Lib/DxErr9.lib new file mode 100644 index 00000000..c8216c41 Binary files /dev/null and b/SDK/dxSDK/Lib/DxErr9.lib differ diff --git a/SDK/dxSDK/Lib/X3DAudio.lib b/SDK/dxSDK/Lib/X3DAudio.lib new file mode 100644 index 00000000..2a1cc40c Binary files /dev/null and b/SDK/dxSDK/Lib/X3DAudio.lib differ diff --git a/SDK/dxSDK/Lib/XInput.lib b/SDK/dxSDK/Lib/XInput.lib new file mode 100644 index 00000000..4078b6c5 Binary files /dev/null and b/SDK/dxSDK/Lib/XInput.lib differ diff --git a/SDK/dxSDK/Lib/d3d10.lib b/SDK/dxSDK/Lib/d3d10.lib new file mode 100644 index 00000000..df8ed199 Binary files /dev/null and b/SDK/dxSDK/Lib/d3d10.lib differ diff --git a/SDK/dxSDK/Lib/d3d10_1.lib b/SDK/dxSDK/Lib/d3d10_1.lib new file mode 100644 index 00000000..7f0ebfb4 Binary files /dev/null and b/SDK/dxSDK/Lib/d3d10_1.lib differ diff --git a/SDK/dxSDK/Lib/d3d10_1d.lib b/SDK/dxSDK/Lib/d3d10_1d.lib new file mode 100644 index 00000000..4d5774f2 Binary files /dev/null and b/SDK/dxSDK/Lib/d3d10_1d.lib differ diff --git a/SDK/dxSDK/Lib/d3d8.lib b/SDK/dxSDK/Lib/d3d8.lib new file mode 100644 index 00000000..252aac44 Binary files /dev/null and b/SDK/dxSDK/Lib/d3d8.lib differ diff --git a/SDK/dxSDK/Lib/d3d9.lib b/SDK/dxSDK/Lib/d3d9.lib new file mode 100644 index 00000000..f6eddc60 Binary files /dev/null and b/SDK/dxSDK/Lib/d3d9.lib differ diff --git a/SDK/dxSDK/Lib/d3dx10.lib b/SDK/dxSDK/Lib/d3dx10.lib new file mode 100644 index 00000000..362c6455 Binary files /dev/null and b/SDK/dxSDK/Lib/d3dx10.lib differ diff --git a/SDK/dxSDK/Lib/d3dx10d.lib b/SDK/dxSDK/Lib/d3dx10d.lib new file mode 100644 index 00000000..5682d276 Binary files /dev/null and b/SDK/dxSDK/Lib/d3dx10d.lib differ diff --git a/SDK/dxSDK/Lib/d3dx9.lib b/SDK/dxSDK/Lib/d3dx9.lib new file mode 100644 index 00000000..727baf5e Binary files /dev/null and b/SDK/dxSDK/Lib/d3dx9.lib differ diff --git a/SDK/dxSDK/Lib/d3dx9d.lib b/SDK/dxSDK/Lib/d3dx9d.lib new file mode 100644 index 00000000..13cb9117 Binary files /dev/null and b/SDK/dxSDK/Lib/d3dx9d.lib differ diff --git a/SDK/dxSDK/Lib/d3dxof.lib b/SDK/dxSDK/Lib/d3dxof.lib new file mode 100644 index 00000000..bf3cde4f Binary files /dev/null and b/SDK/dxSDK/Lib/d3dxof.lib differ diff --git a/SDK/dxSDK/Lib/ddraw.lib b/SDK/dxSDK/Lib/ddraw.lib new file mode 100644 index 00000000..57f83d64 Binary files /dev/null and b/SDK/dxSDK/Lib/ddraw.lib differ diff --git a/SDK/dxSDK/Lib/dinput.lib b/SDK/dxSDK/Lib/dinput.lib new file mode 100644 index 00000000..7c93a651 Binary files /dev/null and b/SDK/dxSDK/Lib/dinput.lib differ diff --git a/SDK/dxSDK/Lib/dinput8.lib b/SDK/dxSDK/Lib/dinput8.lib new file mode 100644 index 00000000..a639c4ec Binary files /dev/null and b/SDK/dxSDK/Lib/dinput8.lib differ diff --git a/SDK/dxSDK/Lib/dplayx.lib b/SDK/dxSDK/Lib/dplayx.lib new file mode 100644 index 00000000..a8ada842 Binary files /dev/null and b/SDK/dxSDK/Lib/dplayx.lib differ diff --git a/SDK/dxSDK/Lib/dsetup.lib b/SDK/dxSDK/Lib/dsetup.lib new file mode 100644 index 00000000..30b9065c Binary files /dev/null and b/SDK/dxSDK/Lib/dsetup.lib differ diff --git a/SDK/dxSDK/Lib/dsound.lib b/SDK/dxSDK/Lib/dsound.lib new file mode 100644 index 00000000..37bf188b Binary files /dev/null and b/SDK/dxSDK/Lib/dsound.lib differ diff --git a/SDK/dxSDK/Lib/dxgi.lib b/SDK/dxSDK/Lib/dxgi.lib new file mode 100644 index 00000000..bd4cb765 Binary files /dev/null and b/SDK/dxSDK/Lib/dxgi.lib differ diff --git a/SDK/dxSDK/Lib/dxguid.lib b/SDK/dxSDK/Lib/dxguid.lib new file mode 100644 index 00000000..db398219 Binary files /dev/null and b/SDK/dxSDK/Lib/dxguid.lib differ diff --git a/SDK/dxSDK/Lib/dxtrans.lib b/SDK/dxSDK/Lib/dxtrans.lib new file mode 100644 index 00000000..c2221337 Binary files /dev/null and b/SDK/dxSDK/Lib/dxtrans.lib differ diff --git a/SDK/luabind/luabind/luabind/config.hpp b/SDK/luabind/luabind/luabind/config.hpp index 4edc8aeb..4c5fb0f6 100644 --- a/SDK/luabind/luabind/luabind/config.hpp +++ b/SDK/luabind/luabind/luabind/config.hpp @@ -28,7 +28,7 @@ #include namespace std { - void terminate(); + void _terminate(); } #ifdef BOOST_MSVC diff --git a/SDK/luabind/luabind/luabind/detail/class_cache.hpp b/SDK/luabind/luabind/luabind/detail/class_cache.hpp index e6772b6f..9bbc963b 100644 --- a/SDK/luabind/luabind/luabind/detail/class_cache.hpp +++ b/SDK/luabind/luabind/luabind/detail/class_cache.hpp @@ -75,7 +75,7 @@ namespace luabind { namespace detail { #else template - class_rep* get_class_rep(lua_State* L, void(*)(T) = 0) + class_rep* get_class_rep(lua_State* L, void(*)(T*) = 0) { class_registry* registry = class_registry::get_registry(L); return registry->find_class(LUABIND_TYPEID(T)); diff --git a/SDK/stlport/algorithm b/SDK/stlport/algorithm deleted file mode 100644 index 16957350..00000000 --- a/SDK/stlport/algorithm +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_ALGORITHM -#define _STLP_ALGORITHM - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_CSTDIO -// remove() conflicts, should always go first -# include -#endif - -#ifndef _STLP_INTERNAL_ALGO_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(algorithm) -#endif /* _STLP_IMPORT_VENDOR_STD */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_ALGORITHM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/assert.h b/SDK/stlport/assert.h deleted file mode 100644 index 28d01090..00000000 --- a/SDK/stlport/assert.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x202 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */ -#ifndef _STLP_WCE_EVC3 -# include _STLP_NATIVE_C_HEADER(assert.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x202) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/bitset b/SDK/stlport/bitset deleted file mode 100644 index 15466e5a..00000000 --- a/SDK/stlport/bitset +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_BITSET -#define _STLP_BITSET - -// This implementation of bitset<> has a second template parameter, -// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE -// THIS FEATURE*. It is experimental, and it may be removed in -// future releases. - -// A bitset of size N, using words of type _WordT, will have -// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high- -// order bits in the highest word.) It is a class invariant -// of class bitset<> that those unused bits are always zero. - -// Most of the actual code isn't contained in bitset<> itself, but in the -// base class _Base_bitset. The base class works with whole words, not with -// individual bits. This allows us to specialize _Base_bitset for the -// important special case where the bitset is only a single word. - -// The C++ standard does not define the precise semantics of operator[]. -// In this implementation the const version of operator[] is equivalent -// to test(), except that it does no range checking. The non-const version -// returns a reference to a bit, again without doing any range checking. - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_BITSET */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/cassert b/SDK/stlport/cassert deleted file mode 100644 index 51757dec..00000000 --- a/SDK/stlport/cassert +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x103 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if !defined (_STLP_WCE_EVC3) -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cassert) -# else -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x103 ) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cctype b/SDK/stlport/cctype deleted file mode 100644 index 646c6864..00000000 --- a/SDK/stlport/cctype +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CCTYPE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x104 -# define _STLP_CCTYPE -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x104 ) -# include _STLP_NATIVE_CPP_C_HEADER(cctype) -#else -# ifndef _STLP_INTERNAL_CCTYPE -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x104 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CCTYPE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cerrno b/SDK/stlport/cerrno deleted file mode 100644 index 83b3960a..00000000 --- a/SDK/stlport/cerrno +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CERRNO -# define _STLP_CERRNO - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x105 -# include -# endif - -# ifndef _STLP_WCE -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cerrno) -# else -# include -# endif -# endif - -#ifndef errno - -# if defined (_STLP_IMPORT_VENDOR_CSTD) && \ - ! defined (__IBMCPP__) && ! defined(__hpux) && ! defined(__MWERKS__) && !defined(_STLP_WCE) -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::errno; -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x105 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_CERRNO */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cfloat b/SDK/stlport/cfloat deleted file mode 100644 index 8a76a102..00000000 --- a/SDK/stlport/cfloat +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CFLOAT -#define _STLP_CFLOAT - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x106 -# include -#endif - -// Borland defines some implementation constants in std:: namespace, -// we do not want to import them. -#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__) -# include _STLP_NATIVE_CPP_C_HEADER(cfloat) -#else -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x106 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CFLOAT */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ciso646 b/SDK/stlport/ciso646 deleted file mode 100644 index 901f36f0..00000000 --- a/SDK/stlport/ciso646 +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CISO646 -#define _STLP_CISO646 - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x107 -# include -#endif - -#if !defined(_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__) -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(ciso646) -# else -# include -# endif /* _STLP_USE_NEW_C_HEADERS */ -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x107 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CISO646 */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/climits b/SDK/stlport/climits deleted file mode 100644 index bdd4ab43..00000000 --- a/SDK/stlport/climits +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CLIMITS -# define _STLP_CLIMITS - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x108 -# include -#endif - -#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4)) -# include -#elif defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(climits) -#else -# if defined (__BORLANDC__) -# include _STLP_NATIVE_C_HEADER(limits.h) -# else -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x108 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CLIMITS */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/clocale b/SDK/stlport/clocale deleted file mode 100644 index 4e9ff7a8..00000000 --- a/SDK/stlport/clocale +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CLOCALE -#define _STLP_CLOCALE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x109 -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x109 ) -# include _STLP_NATIVE_CPP_C_HEADER(clocale) -#else -# ifndef _STLP_INTERNAL_CLOCALE -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x109 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CLOCALE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cmath b/SDK/stlport/cmath deleted file mode 100644 index ec319b0c..00000000 --- a/SDK/stlport/cmath +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CMATH - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x110 -# define _STLP_CMATH -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x110) -# include _STLP_NATIVE_CPP_C_HEADER(cmath) -#else -# ifndef _STLP_INTERNAL_CMATH -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x110 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CMATH */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/complex b/SDK/stlport/complex deleted file mode 100644 index d3738242..00000000 --- a/SDK/stlport/complex +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_COMPLEX -#define _STLP_COMPLEX - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x10 -# include -#endif - -// This header declares the template class complex, as described in -// in the draft C++ standard. Single-precision complex numbers -// are complex, double-precision are complex, and -// quad precision are complex. - -// Note that the template class complex is declared within namespace -// std, as called for by the draft C++ standard - -#ifndef _STLP_INTERNAL_COMPLEX -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x10 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_COMPLEX */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/csetjmp b/SDK/stlport/csetjmp deleted file mode 100644 index 068d0b36..00000000 --- a/SDK/stlport/csetjmp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSETJMP - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x111 -# define _STLP_CSETJMP -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x111) -# include _STLP_NATIVE_CPP_C_HEADER(csetjmp) -#else -# ifndef _STLP_INTERNAL_CSETJMP -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x111 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSETJMP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/csignal b/SDK/stlport/csignal deleted file mode 100644 index 9142648e..00000000 --- a/SDK/stlport/csignal +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSIGNAL - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x112 -# define _STLP_CSIGNAL -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x112) -# include _STLP_NATIVE_CPP_C_HEADER(csignal) -#else -# ifndef _STLP_INTERNAL_CSIGNAL -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x112 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSIGNAL */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cstdarg b/SDK/stlport/cstdarg deleted file mode 100644 index 20141ec0..00000000 --- a/SDK/stlport/cstdarg +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#ifndef _STLP_CSTDARG - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x113 -# define _STLP_CSTDARG -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x113) -# include _STLP_NATIVE_CPP_C_HEADER(cstdarg) -#else -# ifndef _STLP_INTERNAL_CSTDARG -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x113 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSTDARG */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cstddef b/SDK/stlport/cstddef deleted file mode 100644 index 24d15271..00000000 --- a/SDK/stlport/cstddef +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSTDDEF - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x114 -# define _STLP_CSTDDEF -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x114) -# include _STLP_NATIVE_CPP_C_HEADER(cstddef) -#else -# ifndef _STLP_INTERNAL_CSTDDEF -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x114 ) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSTDDEF */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cstdio b/SDK/stlport/cstdio deleted file mode 100644 index 83eff86f..00000000 --- a/SDK/stlport/cstdio +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSTDIO -#define _STLP_CSTDIO - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x15 -# define _STLP_CSTDIO -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x15) -# include _STLP_NATIVE_CPP_C_HEADER(cstdio) -#else -# ifndef _STLP_INTERNAL_CSTDIO -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x15) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cstdlib b/SDK/stlport/cstdlib deleted file mode 100644 index 4718fbbd..00000000 --- a/SDK/stlport/cstdlib +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSTDLIB - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x116 -# define _STLP_CSTDLIB -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x116) -# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) -#else -# ifndef _STLP_INTERNAL_CSTDLIB -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x116) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSTDLIB */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cstring b/SDK/stlport/cstring deleted file mode 100644 index 34d3bdb2..00000000 --- a/SDK/stlport/cstring +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CSTRING - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x117 -# define _STLP_CSTRING -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x117) -# include _STLP_NATIVE_CPP_C_HEADER(cstring) -#else -# ifndef _STLP_INTERNAL_CSTRING -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x117) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CSTRING */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ctime b/SDK/stlport/ctime deleted file mode 100644 index 0f9c37bc..00000000 --- a/SDK/stlport/ctime +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#ifndef _STLP_CTIME - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x118 -# define _STLP_CTIME -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x118) -# include _STLP_NATIVE_CPP_C_HEADER(ctime) -#else -# ifndef _STLP_INTERNAL_CTIME -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x118) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CTIME */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ctype.h b/SDK/stlport/ctype.h deleted file mode 100644 index a3a80327..00000000 --- a/SDK/stlport/ctype.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CTYPE_H - -/* Workaround for a "misbehaviour" when compiling resource scripts using - * eMbedded Visual C++. The standard .rc file includes windows header files, - * which in turn include ctype.h, which results in warnings and errors - */ -#if !defined(RC_INVOKED) - -# if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x219 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x219) -# define _STLP_DONT_POP_HEADER_ID -# define _STLP_CTYPE_H -# endif - -# if defined(_STLP_WCE_EVC3) -struct _exception; -# endif - -# include _STLP_NATIVE_C_HEADER(ctype.h) - -/* on evc4 including ctype.h also defines setjmp macro */ -# if defined (_STLP_WCE) -# define _STLP_NATIVE_SETJMP_H_INCLUDED -# endif - -# ifndef _STLP_CTYPE_H_SEEN -# define _STLP_CTYPE_H_SEEN - -/* Undef convenience interfaces */ -# undef isspace -# undef isprint -# undef iscntrl -# undef isupper -# undef islower -# undef isalpha -# undef isdigit -# undef ispunct -# undef isxdigit -# undef isalnum -# undef isgraph -# undef toupper -# undef tolower - -# if defined (UNDER_CE) - -# if (_WIN32_WCE < 300) /* Only wide chars for older versions */ -# define _isctype iswctype -# endif - -__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); } -__inline int (isupper)(int c) { return _isctype(c, _UPPER); } -__inline int (islower)(int c) { return _isctype(c, _LOWER); } -__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); } -__inline int (isxdigit)(int c) { return _isctype(c, _HEX); } -__inline int (isspace)(int c) { return _isctype(c, _SPACE); } -__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); } -__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); } -__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); } -__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); } -__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); } -__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); } - -# undef _isctype - -__inline int (iswalpha)(int c) { return iswctype(c, _ALPHA); } -__inline int (iswupper)(int c) { return iswctype(c, _UPPER); } -__inline int (iswlower)(int c) { return iswctype(c, _LOWER); } -__inline int (iswdigit)(int c) { return iswctype(c, _DIGIT); } -__inline int (iswxdigit)(int c) { return iswctype(c, _HEX); } -__inline int (iswspace)(int c) { return iswctype(c, _SPACE); } -__inline int (iswpunct)(int c) { return iswctype(c, _PUNCT); } -__inline int (iswalnum)(int c) { return iswctype(c, _ALPHA|_DIGIT); } -__inline int (iswprint)(int c) { return iswctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); } -__inline int (iswgraph)(int c) { return iswctype(c, _PUNCT|_ALPHA|_DIGIT); } -__inline int (iswcntrl)(int c) { return iswctype(c, _CONTROL); } -__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); } - -# endif /* UNDER_CE */ - -# endif /* _STLP_CTYPE_H_SEEN */ - -# if (_STLP_OUTERMOST_HEADER_ID == 0x219) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif - -#endif /* RC_INVOKED */ - -#endif /* _STLP_CTYPE_H */ diff --git a/SDK/stlport/cwchar b/SDK/stlport/cwchar deleted file mode 100644 index 85b99f82..00000000 --- a/SDK/stlport/cwchar +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CWCHAR - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x120 -# define _STLP_CWCHAR -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x120) -# include _STLP_NATIVE_CPP_C_HEADER(cwchar) -#else -# ifndef _STLP_INTERNAL_CWCHAR -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x120) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CWCHAR */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/cwctype b/SDK/stlport/cwctype deleted file mode 100644 index 29f0859e..00000000 --- a/SDK/stlport/cwctype +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CWCTYPE -#define _STLP_CWCTYPE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x121 -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x121) -# include _STLP_NATIVE_CPP_C_HEADER(cwctype) -#else -# ifndef _STLP_INTERNAL_CWCTYPE -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x121) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_CWCTYPE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/deque b/SDK/stlport/deque deleted file mode 100644 index 8fdf513c..00000000 --- a/SDK/stlport/deque +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_DEQUE -#define _STLP_DEQUE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x22 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_DEQUE_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(deque) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x22) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_DEQUE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/errno.h b/SDK/stlport/errno.h deleted file mode 100644 index 27037ead..00000000 --- a/SDK/stlport/errno.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x205 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#ifdef _STLP_WCE -// only show message when directly including this file in a non-library build -# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205) -# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here") -# endif -#else -# ifndef errno -/* We define the following macro first to guaranty the header reentrancy: */ -# define _STLP_NATIVE_ERRNO_H_INCLUDED -# include _STLP_NATIVE_C_HEADER(errno.h) -# endif /* errno */ - -# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED) -/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h - * becomes impossible because if: - * #define errno foo - * then - * #include _STLP_NATIVE_C_HEADER(errno.h) - * becomes: - * #include _STLP_NATIVE_C_HEADER(foo.h) - * - * To fix this problem you have to find where this definition comes from and include errno.h before it. - */ -# error errno has been defined before inclusion of errno.h header. -# endif - -# ifdef __cplusplus -# ifndef errno /* errno still not defined */ -_STLP_BEGIN_NAMESPACE -# if !defined (__BORLANDC__) -using ::errno; -# else -using _STLP_VENDOR_CSTD::errno; -# endif -_STLP_END_NAMESPACE -# endif /* errno */ -# endif /* __cplusplus */ - -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x205) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/exception b/SDK/stlport/exception deleted file mode 100644 index a8e8cd79..00000000 --- a/SDK/stlport/exception +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -// This header exists solely for portability. Normally it just includes -// the native header . - -#ifndef _STLP_EXCEPTION - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x423 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x423) -# define _STLP_DONT_POP_HEADER_ID -# define _STLP_EXCEPTION -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) -/* If we are here it means that we are in an include called - * from the native lib which means that we can simply forward this - * call to the native exception header: - */ -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception) -#else -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x423) -# if !defined(_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -#endif /* _STLP_EXCEPTION */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/exception.h b/SDK/stlport/exception.h deleted file mode 100644 index c5937abd..00000000 --- a/SDK/stlport/exception.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_OLDSTD_exception -#define _STLP_OLDSTD_exception - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x824 -# include -#endif - -#if defined (__BORLANDC__) || defined (_MSC_VER) -# include -#else -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x824) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_OLDSTD_exception */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/float.h b/SDK/stlport/float.h deleted file mode 100644 index 67adb570..00000000 --- a/SDK/stlport/float.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x203 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) -# error This header is only reentrant once, it should be modified if it has to be included more. -#endif - -#if defined (_STLP_WCE_EVC3) -struct _exception; -#endif - -#include _STLP_NATIVE_C_HEADER(float.h) - -#if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560) -_STLP_BEGIN_NAMESPACE -using ::_max_dble; -using ::_max_flt; -using ::_max_ldble; -using ::_tiny_ldble; -_STLP_END_NAMESPACE -#endif - -#if defined (__BORLANDC__) && defined (__cplusplus) && !defined (_STLP_BCC_FPU_BUG) -# define _STLP_BCC_FPU_BUG -// Ignore FPU exceptions, set FPU precision to 53 bits for floatio_test and cmath_test -static unsigned int _bcc_fpu_bug = _control87(PC_53|MCW_EM, MCW_PC|MCW_EM); -template -int __fpclass(_Fp __val) -{ int __f = _fpclass(__val); _control87(PC_53|MCW_EM, MCW_PC|MCW_EM); return __f; } -# define _fpclass __fpclass -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x203) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif diff --git a/SDK/stlport/fstream b/SDK/stlport/fstream deleted file mode 100644 index efdf6459..00000000 --- a/SDK/stlport/fstream +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -// This header defines classes basic_filebuf, basic_ifstream, -// basic_ofstream, and basic_fstream. These classes represent -// streambufs and streams whose sources or destinations are files. - -#ifndef _STLP_FSTREAM -#define _STLP_FSTREAM - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1025 -# include -# endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -# include -# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x1025) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_FSTREAM */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/fstream.h b/SDK/stlport/fstream.h deleted file mode 100644 index 46400334..00000000 --- a/SDK/stlport/fstream.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_FSTREAM_H -#define _STLP_FSTREAM_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2026 -# include -#endif - -#include - -// get desired pollution -#include - -#ifndef _STLP_HAS_NO_NAMESPACES -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2026) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_FSTREAM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/functional b/SDK/stlport/functional deleted file mode 100644 index d0741030..00000000 --- a/SDK/stlport/functional +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_FUNCTIONAL -#define _STLP_FUNCTIONAL - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x27 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(functional) -# endif - -# ifndef _STLP_INTERNAL_FUNCTION_H -# include -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x27) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_FUNCTIONAL */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/hash_map b/SDK/stlport/hash_map deleted file mode 100644 index 0e2422d8..00000000 --- a/SDK/stlport/hash_map +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_HASH_MAP -#define _STLP_HASH_MAP - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x4028 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if defined (_STLP_NO_EXTENSIONS) -/* Comment following if you want to use hash constainers even if you ask for - * no extension. - */ -# error The hash_map and hash_multimap class are STLport extensions. -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x4028) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_HASH_MAP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/hash_set b/SDK/stlport/hash_set deleted file mode 100644 index 0fc89ec5..00000000 --- a/SDK/stlport/hash_set +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_HASH_SET -#define _STLP_HASH_SET - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x4029 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if defined (_STLP_NO_EXTENSIONS) -/* Comment following if you want to use hash constainers even if you ask for - * no extension. - */ -# error The hash_set and hash_multiset class are STLport extensions. -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x4029) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_HASH_SET */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iomanip b/SDK/stlport/iomanip deleted file mode 100644 index 6956190e..00000000 --- a/SDK/stlport/iomanip +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOMANIP -#define _STLP_IOMANIP - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1030 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include -#include // Includes and - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Machinery for defining manipulators. - -// Class that calls one of ios_base's single-argument member functions. -template -struct _Ios_Manip_1 { - typedef _Arg (ios_base::*__f_ptr_type)(_Arg); - - _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg) - : _M_f(__f), _M_arg(__arg) {} - - void operator()(ios_base& __ios) const - { (__ios.*_M_f)(_M_arg); } - - __f_ptr_type _M_f; - _Arg _M_arg; -}; - -// Class that calls one of ios_base's two-argument member functions. -struct _Ios_Setf_Manip { - ios_base::fmtflags _M_flag; - ios_base::fmtflags _M_mask; - bool _M_two_args; - - _Ios_Setf_Manip(ios_base::fmtflags __f) - : _M_flag(__f), _M_mask(0), _M_two_args(false) {} - - _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m) - : _M_flag(__f), _M_mask(__m), _M_two_args(true) {} - - void operator()(ios_base& __ios) const { - if (_M_two_args) - __ios.setf(_M_flag, _M_mask); - else - __ios.setf(_M_flag); - } -}; - - -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __istr, - const _Ios_Manip_1<_Arg>& __f) { - __f(__istr); - return __istr; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, - const _Ios_Manip_1<_Arg>& __f) { - __f(__os); - return __os; -} - -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __istr, const _Ios_Setf_Manip& __f) { - __f(__istr); - return __istr; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const _Ios_Setf_Manip& __f) { - __f(__os); - return __os; -} - -//---------------------------------------------------------------------- -// The ios_base manipulators. -inline _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask) -{ return _Ios_Setf_Manip(0, __mask); } - -inline _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag) -{ return _Ios_Setf_Manip(__flag); } - -inline _Ios_Setf_Manip _STLP_CALL setbase(int __n) { - ios_base::fmtflags __base = __n == 8 ? ios_base::oct : - __n == 10 ? ios_base::dec : - __n == 16 ? ios_base::hex : - ios_base::fmtflags(0); - return _Ios_Setf_Manip(__base, ios_base::basefield); -} - -inline _Ios_Manip_1 _STLP_CALL -setprecision(int __n) { - _Ios_Manip_1::__f_ptr_type __f = &ios_base::precision; - return _Ios_Manip_1(__f, __n); -} - -inline _Ios_Manip_1 _STLP_CALL -setw(int __n) { - _Ios_Manip_1::__f_ptr_type __f = &ios_base::width; - return _Ios_Manip_1(__f, __n); -} - -//---------------------------------------------------------------------- -// setfill, a manipulator that operates on basic_ios<> instead of ios_base. - -template -struct _Setfill_Manip { - _Setfill_Manip(_CharT __c) : _M_c(__c) {} - _CharT _M_c; -}; - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, - const _Setfill_Manip<_CharT2>& __m) { - __os.fill(__m._M_c); - return __os; -} - -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, - const _Setfill_Manip<_CharT2>& __m) { - __is.fill(__m._M_c); - return __is; -} - -template -inline _Setfill_Manip<_CharT> _STLP_CALL -setfill(_CharT __c) { - return _Setfill_Manip<_CharT>(__c); -} - -_STLP_END_NAMESPACE - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1030) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_IOMANIP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iomanip.h b/SDK/stlport/iomanip.h deleted file mode 100644 index 1bfb0d24..00000000 --- a/SDK/stlport/iomanip.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOMANIP_H -#define _STLP_IOMANIP_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2031 -# include -#endif - -#include - -#include - -#ifndef _STLP_HAS_NO_NAMESPACES -# ifdef _STLP_BROKEN_USING_DIRECTIVE -_STLP_USING_NAMESPACE(stlport) -# else -using _STLP_STD::setiosflags; -using _STLP_STD::resetiosflags; -using _STLP_STD::setbase; -using _STLP_STD::setfill; -using _STLP_STD::setprecision; -using _STLP_STD::setw; -# endif -#endif /* _STLP_HAS_NO_NAMESPACES */ - -// get all the pollution we want -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2031) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_IOMANIP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ios b/SDK/stlport/ios deleted file mode 100644 index 2a923ad7..00000000 --- a/SDK/stlport/ios +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOS -#define _STLP_IOS - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1032 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# include -# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x1032) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_IOS */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ios.h b/SDK/stlport/ios.h deleted file mode 100644 index 90ccfbbd..00000000 --- a/SDK/stlport/ios.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOS_H -#define _STLP_IOS_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1033 -# include -#endif - -#include - -#if defined (_STLP_USE_NAMESPACES) -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1033) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_IOS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iosfwd b/SDK/stlport/iosfwd deleted file mode 100644 index 0a449825..00000000 --- a/SDK/stlport/iosfwd +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOSFWD -#define _STLP_IOSFWD - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1034 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if !defined (_STLP_USE_NO_IOSTREAMS) - -# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) -# include -# endif /* _STLP_HAS_WCHAR_T && !_STLP_CWCHAR */ - -# include -#else -# include -#endif /* _STLP_USE_NO_IOSTREAMS */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1034) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_IOSFWD */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iostream b/SDK/stlport/iostream deleted file mode 100644 index 05289e48..00000000 --- a/SDK/stlport/iostream +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOSTREAM -#define _STLP_IOSTREAM - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1037 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -#include - -#ifdef _STLP_REDIRECT_STDSTREAMS -// for ofstream redirection -# include -#endif - -#include -#include - -_STLP_BEGIN_NAMESPACE - -#ifndef _STLP_USE_NAMESPACES -// in case of SGI iostreams, we have to rename our streams not to clash with those -// provided in native lib -# define cin _STLP_cin -# define cout _STLP_cout -# define cerr _STLP_cerr -# define clog _STLP_clog -#endif - -// Note: cin and wcin are both associated with stdio. The C standard -// (Amendment 1, section 4.6.2.1) says that it is an error to mix -// wide- and narrow-oriented I/O on the same stream. This implies -// that it is an error to use both cin and wcin in the same C++ -// program; the same applies to cout and wcout, and cerr/clog and -// wcerr/wclog. - -# ifdef _STLP_REDIRECT_STDSTREAMS -extern _STLP_DECLSPEC istream cin; -extern _STLP_DECLSPEC ofstream cout; -extern _STLP_DECLSPEC ofstream cerr; -extern _STLP_DECLSPEC ofstream clog; -# else -extern _STLP_DECLSPEC istream cin; -extern _STLP_DECLSPEC ostream cout; -extern _STLP_DECLSPEC ostream cerr; -extern _STLP_DECLSPEC ostream clog; -# endif - -# ifndef _STLP_NO_WCHAR_T -extern _STLP_DECLSPEC wistream wcin; -extern _STLP_DECLSPEC wostream wcout; -extern _STLP_DECLSPEC wostream wcerr; -extern _STLP_DECLSPEC wostream wclog; -# endif - -_STLP_END_NAMESPACE - -//# elif defined ( _STLP_USE_NO_IOSTREAMS ) -//# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x1037) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_IOSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iostream.h b/SDK/stlport/iostream.h deleted file mode 100644 index 2e7a7a9f..00000000 --- a/SDK/stlport/iostream.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_IOSTREAM_H -#define _STLP_IOSTREAM_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2035 -# include -#endif - -#include - -// Those should be included all separately, as they do contain using declarations -#include -#include -#include - -#ifndef _STLP_HAS_NO_NAMESPACES - -# ifdef _STLP_BROKEN_USING_DIRECTIVE -_STLP_USING_NAMESPACE(stlport) -# else -using _STLP_STD::cin; -using _STLP_STD::cout; -using _STLP_STD::clog; -using _STLP_STD::cerr; -using _STLP_STD::iostream; -# ifndef _STLP_NO_WCHAR_T -using _STLP_STD::wcin; -using _STLP_STD::wcout; -using _STLP_STD::wclog; -using _STLP_STD::wcerr; -# endif -# endif -#endif /* _STLP_HAS_NO_NAMESPACES */ - -// Obsolete classes for old-style backwards compatibility - - -class istream_withassign : public istream { - public: - istream_withassign() : istream((streambuf*)0) {} - ~istream_withassign() {} - - istream_withassign& operator=(istream& __s) { - ios::init(__s.rdbuf()); - return *this; - } - istream_withassign& operator=(streambuf* __s) { - ios::init(__s); - return *this; - } -}; - -class ostream_withassign : public ostream { - public: - ostream_withassign() : ostream((streambuf*)0) {} - ~ostream_withassign() {} - - ostream_withassign& operator=(ostream& __s) { - ios::init(__s.rdbuf()); - return *this; - } - ostream_withassign& operator=(streambuf* __s) { - ios::init(__s); - return *this; - } -}; - -class iostream_withassign : public iostream { - public: - iostream_withassign() : iostream((streambuf*)0) {} - ~iostream_withassign() {} - iostream_withassign & operator=(ios& __i) { - ios::init(__i.rdbuf()); - return *this; - } - iostream_withassign & operator=(streambuf* __s) { - ios::init(__s); - return *this; - } -} ; - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2035) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_IOSTREAM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/iso646.h b/SDK/stlport/iso646.h deleted file mode 100644 index 058ed3b8..00000000 --- a/SDK/stlport/iso646.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x204 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -/* evc3 doesn't have iso646.h */ -#if !defined (_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__) -# include _STLP_NATIVE_C_HEADER(iso646.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x204) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/istream b/SDK/stlport/istream deleted file mode 100644 index 9c288baf..00000000 --- a/SDK/stlport/istream +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_ISTREAM -#define _STLP_ISTREAM - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1036 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#ifndef _STLP_INTERNAL_ISTREAM -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1036) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_ISTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/istream.h b/SDK/stlport/istream.h deleted file mode 100644 index d382d96e..00000000 --- a/SDK/stlport/istream.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_ISTREAM_H -#define _STLP_ISTREAM_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2037 -# include -#endif - -#include - -#include - -#ifndef _STLP_HAS_NO_NAMESPACES -# ifdef _STLP_BROKEN_USING_DIRECTIVE -_STLP_USING_NAMESPACE(stlport) -# else -using _STLP_STD::basic_istream; -using _STLP_STD::basic_iostream; -using _STLP_STD::istream; -using _STLP_STD::iostream; -using _STLP_STD::ios; -# ifndef _STLP_NO_WCHAR_T -using _STLP_STD::wistream; -using _STLP_STD::wiostream; -# endif -using _STLP_STD::ws; -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2037) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_ISTREAM_H */ diff --git a/SDK/stlport/iterator b/SDK/stlport/iterator deleted file mode 100644 index b08caf48..00000000 --- a/SDK/stlport/iterator +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_ITERATOR -#define _STLP_ITERATOR - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x38 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(iterator) -#endif /* IMPORT */ - -# ifndef _STLP_INTERNAL_ITERATOR_H -# include -# endif - -# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H -# include -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x38) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_ITERATOR */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/limits b/SDK/stlport/limits deleted file mode 100644 index c0db9eb5..00000000 --- a/SDK/stlport/limits +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_LIMITS -#define _STLP_LIMITS - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x39 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x39) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_LIMITS */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/limits.h b/SDK/stlport/limits.h deleted file mode 100644 index 9353af18..00000000 --- a/SDK/stlport/limits.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x201 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if defined(_STLP_WCE_EVC3) -struct _exception; -#endif - -#include _STLP_NATIVE_C_HEADER(limits.h) - -#if (_STLP_OUTERMOST_HEADER_ID == 0x201) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif diff --git a/SDK/stlport/list b/SDK/stlport/list deleted file mode 100644 index a638f04c..00000000 --- a/SDK/stlport/list +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_LIST -#define _STLP_LIST - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x40 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_LIST_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(list) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x40) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_LIST */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/locale b/SDK/stlport/locale deleted file mode 100644 index 289bfe39..00000000 --- a/SDK/stlport/locale +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_LOCALE -#define _STLP_LOCALE - -// Basic framework: class locale and class locale::facet - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1041 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -// Individual facets -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif - -#ifndef _STLP_INTERNAL_CODECVT_H -# include -#endif - -#ifndef _STLP_INTERNAL_COLLATE_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_PUT_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_GET_H -# include -#endif - -// those never included separately anyway -#include -#include -#include - -// some stuff for streambuf iterators ended up defined there -// Strictly speaking, _istream.h portion is only required for , but it may break too many -// programs if we omit it -#ifndef _STLP_ISTREAM_H -# include -#endif - -// Convenience interfaces -#undef isspace -#undef isprint -#undef iscntrl -#undef isupper -#undef islower -#undef isalpha -#undef isdigit -#undef ispunct -#undef isxdigit -#undef isalnum -#undef isgraph -#undef toupper -#undef tolower - -_STLP_BEGIN_NAMESPACE - -template -inline bool isspace (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::space, c); } - -template -inline bool isprint (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::print, c); } - -template -inline bool iscntrl (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::cntrl, c); } - -template -inline bool isupper (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::upper, c); } - -template -inline bool islower (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::lower, c); } - -template -inline bool isalpha (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::alpha, c); } - -template -inline bool isdigit (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::digit, c); } - -template -inline bool ispunct (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::punct, c); } - -template -inline bool isxdigit (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::xdigit, c); } - -template -inline bool isalnum (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::alnum, c); } - -template -inline bool isgraph (_CharT c, const locale& loc) -{ return (use_facet >(loc)).is(ctype_base::graph, c); } - -template -inline _CharT toupper(_CharT c, const locale& loc) -{ return (use_facet >(loc)).toupper(c); } - -template -inline _CharT tolower(_CharT c, const locale& loc) -{ return (use_facet >(loc)).tolower(c); } - -_STLP_END_NAMESPACE - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1041) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_LOCALE */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/locale.h b/SDK/stlport/locale.h deleted file mode 100644 index 9bf7691d..00000000 --- a/SDK/stlport/locale.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x242 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x242) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# else -# error STLport include schema violation -# endif -#endif - -/* evc3 doesn't have locale.h */ -#ifndef _STLP_WCE_EVC3 -# include _STLP_NATIVE_C_HEADER(locale.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x242) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/map b/SDK/stlport/map deleted file mode 100644 index e18a89b1..00000000 --- a/SDK/stlport/map +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_MAP -#define _STLP_MAP - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x43 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(map) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x43) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_MAP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/math.h b/SDK/stlport/math.h deleted file mode 100644 index 57bf5415..00000000 --- a/SDK/stlport/math.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x244 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \ - !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3) -# define _STLP_EXCEPTION_WAS_REDEFINED 1 -# define exception __math_exception -#endif - -#include _STLP_NATIVE_C_HEADER(math.h) - -#if defined (_STLP_EXCEPTION_WAS_REDEFINED) -# undef exception -# undef _STLP_EXCEPTION_WAS_REDEFINED -#endif - -#ifdef _STLP_WCE_EVC3 -# undef _exception -# define _exception exception -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x244) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/mem.h b/SDK/stlport/mem.h deleted file mode 100644 index d8b39350..00000000 --- a/SDK/stlport/mem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_mem_h - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x245 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID) -# include _STLP_NATIVE_C_HEADER(mem.h) -#else -# if defined (__BORLANDC__) && defined (__USING_CNAME__) -# define _USING_CNAME_WAS_UNDEFINED -# undef __USING_CNAME__ -# endif - -# include _STLP_NATIVE_C_HEADER(mem.h) - -# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED) -# define __USING_CNAME__ -# define _STLP_mem_h 1 -# undef _USING_CNAME_WAS_UNDEFINED -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x245) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif - -#endif /* _STLP_mem_h */ - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/memory b/SDK/stlport/memory deleted file mode 100644 index 89af8839..00000000 --- a/SDK/stlport/memory +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_MEMORY -#define _STLP_MEMORY - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x46 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_TEMPBUF_H -# include -#endif - -#ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H -# include -#endif - -#include - -#if defined (_STLP_IMPORT_VENDOR_STD) - -# if defined (__MSL__) -# include _STLP_NATIVE_HEADER(limits) -# endif - -# include _STLP_NATIVE_HEADER(memory) - -# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201) -/* 980401 vss MSL 2.4 Pro 3 Release */ -# include -# endif - -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x46) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_MEMORY */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/new b/SDK/stlport/new deleted file mode 100644 index e013dab1..00000000 --- a/SDK/stlport/new +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_NEW_HEADER -#define _STLP_NEW_HEADER - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x447 -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x447) -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new) -#else -# ifndef _STLP_NEW_H_HEADER -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x447) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_NEW */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/new.h b/SDK/stlport/new.h deleted file mode 100644 index 6489b5d3..00000000 --- a/SDK/stlport/new.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x848 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if !defined(_STLP_NO_NEW_HEADER) -# if defined (__BORLANDC__) -# include -# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER)) -# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h) -# else -# if defined (__GNUC__) && (__GNUC__ >= 3) -# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h) -# else -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h) -# endif -# endif -#endif /* !defined(_STLP_NO_NEW_HEADER) */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x848) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/numeric b/SDK/stlport/numeric deleted file mode 100644 index 8a32cfe4..00000000 --- a/SDK/stlport/numeric +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_NUMERIC -#define _STLP_NUMERIC - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x49 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_NUMERIC_H -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x49) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_NUMERIC */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ostream b/SDK/stlport/ostream deleted file mode 100644 index 0cf823f4..00000000 --- a/SDK/stlport/ostream +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_OSTREAM -#define _STLP_OSTREAM - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1050 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# include -# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x1050) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_OSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/ostream.h b/SDK/stlport/ostream.h deleted file mode 100644 index b6a76649..00000000 --- a/SDK/stlport/ostream.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_OSTREAM_H -#define _STLP_OSTREAM_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2051 -# include -#endif - -#include - -#include - -#ifdef _STLP_USE_NAMESPACES -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2051) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_OSTREAM_H */ diff --git a/SDK/stlport/pthread.h b/SDK/stlport/pthread.h deleted file mode 100644 index 57c0c24c..00000000 --- a/SDK/stlport/pthread.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -# if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x280 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# endif - -# if defined (__SUNPRO_CC) || defined (__HP_aCC) -# include "/usr/include/pthread.h" -# else -# include _STLP_NATIVE_C_HEADER(pthread.h) -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x280) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif - -/* - Local Variables: - mode:C++ - End: -*/ diff --git a/SDK/stlport/pthread_alloc b/SDK/stlport/pthread_alloc deleted file mode 100644 index c5ccbcb9..00000000 --- a/SDK/stlport/pthread_alloc +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_PTHREAD_ALLOC -#define _STLP_PTHREAD_ALLOC - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x52 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x52) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_PTHREAD_ALLOC */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/queue b/SDK/stlport/queue deleted file mode 100644 index 190bc067..00000000 --- a/SDK/stlport/queue +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_QUEUE -#define _STLP_QUEUE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x53 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_QUEUE_H -# include -#endif - -#ifndef _STLP_FUNCTIONAL -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(queue) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x53) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_QUEUE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/rlocks.h b/SDK/stlport/rlocks.h deleted file mode 100644 index 84db1f40..00000000 --- a/SDK/stlport/rlocks.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _STLP_misc_rlocks_h -# define _STLP_misc_rlocks_h -# if (__SUNPRO_CC >= 0x500 ) -# include <../CCios/rlocks.h> -# elif defined (__SUNPRO_CC) -# include <../CC/rlocks.h> -# else -# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers." -# endif -#endif - diff --git a/SDK/stlport/rope b/SDK/stlport/rope deleted file mode 100644 index 4faa36b6..00000000 --- a/SDK/stlport/rope +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef _STLP_ROPE -#define _STLP_ROPE - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x54 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if defined (_STLP_NO_EXTENSIONS) -/* Comment following if you want to use rope class even if you ask for - * no extension. - */ -# error The rope class is a STLport extension. -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x54) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_ROPE */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/set b/SDK/stlport/set deleted file mode 100644 index 4c3dd2de..00000000 --- a/SDK/stlport/set +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_SET -#define _STLP_SET - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x55 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(set) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x55) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_SET */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/setjmp.h b/SDK/stlport/setjmp.h deleted file mode 100644 index dabef163..00000000 --- a/SDK/stlport/setjmp.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_SETJMP_H - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x256 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# define _STLP_SETJMP_H -#endif - -#if defined(_STLP_WCE_EVC3) -struct _exception; -#endif - -#if !defined (setjmp) -# define _STLP_NATIVE_SETJMP_H_INCLUDED -# include _STLP_NATIVE_C_HEADER(setjmp.h) -#endif - -#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED) -/* See errno.h file for a description of this problem. */ -# error setjmp has been defined before inclusion of setjmp.h header. -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x256) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif -#endif /* _STLP_SETJMP_H */ diff --git a/SDK/stlport/signal.h b/SDK/stlport/signal.h deleted file mode 100644 index 7b3c70aa..00000000 --- a/SDK/stlport/signal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x257 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -/* evc3 and evc4 don't have signal.h */ -#ifndef _STLP_WCE -# include _STLP_NATIVE_C_HEADER(signal.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x257) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif -# undef _STLP_DONT_POP_HEADER_ID -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/slist b/SDK/stlport/slist deleted file mode 100644 index c1930e4f..00000000 --- a/SDK/stlport/slist +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef _STLP_SLIST -#define _STLP_SLIST - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x58 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if defined (_STLP_NO_EXTENSIONS) -/* Comment following if you want to use the slist constainer even if you ask for - * no extension. - */ -# error The slist class is an STLport extension. -#endif - -#ifndef _STLP_INTERNAL_SLIST_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -//This is not a Standard header, it might failed for most of -//the compilers so we comment it for the moment. Should be uncommented -//on a compiler basis. -//# include _STLP_NATIVE_HEADER(slist) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x58) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_SLIST */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/sstream b/SDK/stlport/sstream deleted file mode 100644 index e2b325ee..00000000 --- a/SDK/stlport/sstream +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// This header defines classes basic_stringbuf, basic_istringstream, -// basic_ostringstream, and basic_stringstream. These classes -// represent streamsbufs and streams whose sources or destinations are -// C++ strings. - -#ifndef _STLP_SSTREAM -#define _STLP_SSTREAM - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1059 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1059) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_SSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stack b/SDK/stlport/stack deleted file mode 100644 index d19106b1..00000000 --- a/SDK/stlport/stack +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STACK -#define _STLP_STACK - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x60 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef _STLP_INTERNAL_STACK_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(stack) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x60) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_STACK */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stdarg.h b/SDK/stlport/stdarg.h deleted file mode 100644 index e8605cc9..00000000 --- a/SDK/stlport/stdarg.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* Workaround for a "misbehaviour" when compiling resource scripts using - * eMbedded Visual C++. The standard .rc file includes windows header files, - * which in turn include stdarg.h, which results in warnings and errors - */ -#if !defined (RC_INVOKED) - -# if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x261 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# endif - -# if defined(_STLP_WCE_EVC3) -struct _exception; -# endif - -# include _STLP_NATIVE_C_HEADER(stdarg.h) - -# if (_STLP_OUTERMOST_HEADER_ID == 0x261) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif -#endif /* RC_INVOKED */ diff --git a/SDK/stlport/stddef.h b/SDK/stlport/stddef.h deleted file mode 100644 index 01c449fc..00000000 --- a/SDK/stlport/stddef.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x262 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -# if defined (_MSC_VER) || defined (__DMC__) -/* Native stddef.h contains errno macro definition making inclusion of native - * errno.h in STLport errno.h impossible. We are then forced to include errno.h - * first. - */ -# include "errno.h" -# endif - -# include _STLP_NATIVE_C_HEADER(stddef.h) - -#if (_STLP_OUTERMOST_HEADER_ID == 0x262) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - diff --git a/SDK/stlport/stdexcept b/SDK/stlport/stdexcept deleted file mode 100644 index b00331f3..00000000 --- a/SDK/stlport/stdexcept +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STDEXCEPT - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x63 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# define _STLP_STDEXCEPT -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_DONT_POP_HEADER_ID) -# include _STLP_NATIVE_HEADER(stdexcept) -#else -# ifndef _STLP_INTERNAL_STDEXCEPT -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x63) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -#endif /* _STLP_STDEXCEPT */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stdio.h b/SDK/stlport/stdio.h deleted file mode 100644 index 271f37ba..00000000 --- a/SDK/stlport/stdio.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* Workaround for a "misbehaviour" when compiling resource scripts using - * eMbedded Visual C++. The standard .rc file includes windows header files, - * which in turn include stdarg.h, which results in warnings and errors - */ -#if !defined(RC_INVOKED) - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x264 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# endif - -# if defined(_STLP_WCE_EVC3) -struct _exception; -# endif -# include _STLP_NATIVE_C_HEADER(stdio.h) - -# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE) -# define _STRUCT_FILE -# endif - -# if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__) -# undef stdin -# undef stdout -# undef stderr -# if defined (__MWERKS__) -# define stdin (&_STLP_VENDOR_CSTD::__files[0]) -# define stdout (&_STLP_VENDOR_CSTD::__files[1]) -# define stderr (&_STLP_VENDOR_CSTD::__files[2]) -# elif defined (__BORLANDC__) -# define stdin (&_STLP_VENDOR_CSTD::_streams[0]) -# define stdout (&_STLP_VENDOR_CSTD::_streams[1]) -# define stderr (&_STLP_VENDOR_CSTD::_streams[2]) -# endif -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x264) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif - -#endif /* RC_INVOKED */ diff --git a/SDK/stlport/stdiostream.h b/SDK/stlport/stdiostream.h deleted file mode 100644 index 80a5c672..00000000 --- a/SDK/stlport/stdiostream.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _STLP_misc_stdiostream_h -# define _STLP_misc_stdiostream_h -# if (__SUNPRO_CC >= 0x500 ) -# include <../CCios/stdiostream.h> -# else if defined (__SUNPRO_CC) -# include <../CC/stdiostream.h> -# else -# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers." -# endif -#endif diff --git a/SDK/stlport/stdlib.h b/SDK/stlport/stdlib.h deleted file mode 100644 index 3a415ee3..00000000 --- a/SDK/stlport/stdlib.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* Workaround for a "misbehaviour" when compiling resource scripts using - * eMbedded Visual C++. The standard .rc file includes windows header files, - * which in turn include stdlib.h, which results in warnings and errors - */ -#if !defined (RC_INVOKED) - -# if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x265 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# endif - -# if defined (_MSC_VER) || (defined (__GNUC__) && defined (__MINGW32__)) || \ - defined (__BORLANDC__) || defined (__DMC__) || \ - (defined (__HP_aCC) && defined (_REENTRANT)) -/* Native stdlib.h contains errno macro definition making inclusion of native - * errno.h in STLport errno.h impossible. We are then forced to include errno.h - * first. - */ -# include "errno.h" -# endif - -/* - forward-declaration for _exception struct; prevents warning message - ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses -*/ -# if defined(_STLP_WCE_EVC3) -struct _exception; -# endif - -# include _STLP_NATIVE_C_HEADER(stdlib.h) - -/* on evc3/evc4 including stdlib.h also defines setjmp macro */ -# if defined (_STLP_WCE) -# define _STLP_NATIVE_SETJMP_H_INCLUDED -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x265) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif - -#endif /* RC_INVOKED */ - -/* - Local Variables: - mode:C++ - End: -*/ diff --git a/SDK/stlport/stl/_abbrevs.h b/SDK/stlport/stl/_abbrevs.h deleted file mode 100644 index c4acac8b..00000000 --- a/SDK/stlport/stl/_abbrevs.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ABBREVS_H -# define _STLP_INTERNAL_ABBREVS_H - -// ugliness is intentional - to reduce conflicts -# define input_iterator_tag _In__ItT -# define output_iterator_tag _Ou__ItT -# define bidirectional_iterator_tag _Bd__ItT -# define random_access_iterator_tag _Ra__ItT -# define input_iterator _In__It -# define output_iterator _Ou__It -# define bidirectional_iterator _Bd__It -# define random_access_iterator _Ra__It -# define reverse_bidirectional_iterator _rBd__It -# define reverse_iterator _r__It -# define back_insert_iterator _bI__It -# define front_insert_iterator _fI__It -# define raw_storage_iterator _rS__It -# define _Const_traits _C_Tr -# define _Const_Const_traits _CC_Tr -# define _Nonconst_traits _N_Tr -# define _Nonconst_Const_traits _NC_Tr - -// ugliness is intentional - to reduce conflicts probability -# define __malloc_alloc M__A -# define __node_alloc D__A -# define __new_alloc N__A -# define __debug_alloc G__A -# define _STLP_alloc_proxy P__A - -# define _Deque_iterator_base _Dq__ItB -# define _Deque_iterator _Dq__It - -# define _Select1st _S1st -# define _Select2nd _S2nd -# define __move_source __m_s -# define _Vector_nonconst_traits _V_nct - -# define _Ht_iterator _Ht_It - -# define _List_node_base _L__NB -# define _List_iterator_base _L__ItB -# define _List_iterator _L__It - -# define _Slist_iterator_base _SL__ItB -# define _Slist_iterator _SL__It - -# define _Rb_tree_node_base _rbT__NB -# define _Rb_tree_node _rbT__N -# define _Rb_tree_base_iterator _rbT__It -# define _Rb_tree_base _rbT__B - -# if defined (__DMC__) && defined (_STLP_DEBUG) -# define _NonDbg_hashtable _Nd_Ht -# define _DBG_iter _d__It -# endif -#endif - diff --git a/SDK/stlport/stl/_algo.c b/SDK/stlport/stl/_algo.c deleted file mode 100644 index 79745ba0..00000000 --- a/SDK/stlport/stl/_algo.c +++ /dev/null @@ -1,2012 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_ALGO_C -#define _STLP_ALGO_C - -#if !defined (_STLP_INTERNAL_ALGO_H) -# include -#endif - -#ifndef _STLP_INTERNAL_TEMPBUF_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void __merge_without_buffer(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, - _Distance __len1, _Distance __len2, - _Compare __comp); - - -template -_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, - _BidirectionalIter1 __last1, - _BidirectionalIter2 __first2, - _BidirectionalIter2 __last2, - _BidirectionalIter3 __result, - _Compare __comp); - -template -#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 )) -inline -#endif -const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { - if (__a < __b) - if (__b < __c) - return __b; - else if (__a < __c) - return __c; - else - return __a; - else if (__a < __c) - return __a; - else if (__b < __c) - return __c; - else - return __b; -} - -template -#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 )) -inline -#endif -const _Tp& -__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { - if (__comp(__a, __b)) { - _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - if (__comp(__b, __c)) { - _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return __b; - } - else if (__comp(__a, __c)) { - _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return __c; - } - else - return __a; - } - else if (__comp(__a, __c)) { - _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return __a; - } - else if (__comp(__b, __c)) { - _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return __c; - } - else - return __b; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - // Test for empty ranges - if (__first1 == __last1 || __first2 == __last2) - return __first1; - - // Test for a pattern of length 1. - _ForwardIter2 __p1(__first2); - - if ( ++__p1 == __last2 ) - return find(__first1, __last1, *__first2); - - // General case. - - for ( ; ; ) { // __first1 != __last1 will be checked in find below - __first1 = find(__first1, __last1, *__first2); - if (__first1 == __last1) - return __last1; - - _ForwardIter2 __p = __p1; - _ForwardIter1 __current = __first1; - if (++__current == __last1) - return __last1; - - while (*__current == *__p) { - if (++__p == __last2) - return __first1; - if (++__current == __last1) - return __last1; - } - - ++__first1; - } - return __first1; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last, - _Integer __count, const _Tp& __val, _BinaryPred __pred, - _Distance*, const random_access_iterator_tag &) -{ - _Distance __tailSize = __last - __first; - const _Distance __pattSize = __count; - const _Distance __skipOffset = __pattSize - 1; - _RandomAccessIter __backTrack; - _Distance __remainder, __prevRemainder; - - for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop... - //__lookAhead here is always pointing to the last element of next possible match. - __tailSize -= __pattSize; - - while ( !__pred(*__lookAhead, __val) ) { // the skip loop... - if (__tailSize < __pattSize) - return __last; - - __lookAhead += __pattSize; - __tailSize -= __pattSize; - } - - if ( __skipOffset == 0 ) { - return (__lookAhead - __skipOffset); //Success - } - - __remainder = __skipOffset; - - for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) { - if (--__remainder == 0) - return (__lookAhead - __skipOffset); //Success - } - - if (__remainder > __tailSize) - return __last; //failure - - __lookAhead += __remainder; - __tailSize -= __remainder; - - while ( __pred(*__lookAhead, __val) ) { - __prevRemainder = __remainder; - __backTrack = __lookAhead; - - do { - if (--__remainder == 0) - return (__lookAhead - __skipOffset); //Success - } while (__pred(*--__backTrack, __val)); - - //adjust remainder for next comparison - __remainder += __pattSize - __prevRemainder; - - if (__remainder > __tailSize) - return __last; //failure - - __lookAhead += __remainder; - __tailSize -= __remainder; - } - - //__lookAhead here is always pointing to the element of the last mismatch. - } - - return __last; //failure -} - -template -_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val, _BinaryPred __pred, - _Distance*, const forward_iterator_tag &) { - for (; (__first != __last) && !__pred(*__first, __val); ++__first) {} - while (__first != __last) { - _Integer __n = __count - 1; - _ForwardIter __i = __first; - ++__i; - while (__i != __last && __n != 0 && __pred(*__i, __val)) { - ++__i; - --__n; - } - if (__n == 0) - return __first; - else if (__i != __last) - for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {} - else - break; - } - return __last; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -// search_n. Search for __count consecutive copies of __val. -template -_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__count <= 0) - return __first; - if (__count == 1) - //We use find when __count == 1 to use potential find overload. - return find(__first, __last, __val); - return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(), - _STLP_DISTANCE_TYPE(__first, _ForwardIter), - _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); -} - -template -_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val, - _BinaryPred __binary_pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__count <= 0) - return __first; - return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred, - _STLP_DISTANCE_TYPE(__first, _ForwardIter), - _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); -} - -template -_ForwardIter1 -find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2, -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1), - _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2), -#else - forward_iterator_tag(), - forward_iterator_tag(), -#endif - _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1)) - ); -} - -// unique and unique_copy -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP _OutputIterator -__unique_copy(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, - _BinaryPredicate __binary_pred, _Tp*) { - _Tp __val = *__first; - *__result = __val; - while (++__first != __last) - if (!__binary_pred(__val, *__first)) { - __val = *__first; - *++__result = __val; - } - return ++__result; -} - -template -inline _OutputIter -__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, - _BinaryPredicate __binary_pred, const output_iterator_tag &) { - return __unique_copy(__first, __last, __result, __binary_pred, _STLP_VALUE_TYPE(__first, _InputIter)); -} - -template -_STLP_INLINE_LOOP _ForwardIter -__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result, - _BinaryPredicate __binary_pred, const forward_iterator_tag &) { - *__result = *__first; - while (++__first != __last) - if (!__binary_pred(*__result, *__first)) *++__result = *__first; - return ++__result; -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline _BidirectionalIterator -__unique_copy(_InputIterator __first, _InputIterator __last, - _BidirectionalIterator __result, _BinaryPredicate __binary_pred, - const bidirectional_iterator_tag &) { - return __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag()); -} - -template -inline _RandomAccessIterator -__unique_copy(_InputIterator __first, _InputIterator __last, - _RandomAccessIterator __result, _BinaryPredicate __binary_pred, - const random_access_iterator_tag &) { - return __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag()); -} -#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */ - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter -unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __result; - return _STLP_PRIV __unique_copy(__first, __last, __result, - _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)), - _STLP_ITERATOR_CATEGORY(__result, _OutputIter)); -} - -template -_OutputIter -unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, - _BinaryPredicate __binary_pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __result; - return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, - _STLP_ITERATOR_CATEGORY(__result, _OutputIter)); -} - -// rotate and rotate_copy, and their auxiliary functions -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __rotate_aux(_ForwardIter __first, - _ForwardIter __middle, - _ForwardIter __last, - _Distance*, - const forward_iterator_tag &) { - if (__first == __middle) - return __last; - if (__last == __middle) - return __first; - - _ForwardIter __first2 = __middle; - do { - swap(*__first++, *__first2++); - if (__first == __middle) - __middle = __first2; - } while (__first2 != __last); - - _ForwardIter __new_middle = __first; - - __first2 = __middle; - - while (__first2 != __last) { - swap (*__first++, *__first2++); - if (__first == __middle) - __middle = __first2; - else if (__first2 == __last) - __first2 = __middle; - } - - return __new_middle; -} - -template -_BidirectionalIter __rotate_aux(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, - _Distance*, - const bidirectional_iterator_tag &) { - if (__first == __middle) - return __last; - if (__last == __middle) - return __first; - - __reverse(__first, __middle, bidirectional_iterator_tag()); - __reverse(__middle, __last, bidirectional_iterator_tag()); - - while (__first != __middle && __middle != __last) - swap (*__first++, *--__last); - - if (__first == __middle) { - __reverse(__middle, __last, bidirectional_iterator_tag()); - return __last; - } - else { - __reverse(__first, __middle, bidirectional_iterator_tag()); - return __first; - } -} - -template -_RandomAccessIter __rotate_aux(_RandomAccessIter __first, - _RandomAccessIter __middle, - _RandomAccessIter __last, - _Distance *, _Tp *) { - - _Distance __n = __last - __first; - _Distance __k = __middle - __first; - _Distance __l = __n - __k; - _RandomAccessIter __result = __first + (__last - __middle); - - if (__k == 0) /* __first == middle */ - return __last; - - if (__k == __l) { - swap_ranges(__first, __middle, __middle); - return __result; - } - - _Distance __d = __gcd(__n, __k); - - for (_Distance __i = 0; __i < __d; __i++) { - _Tp __tmp = *__first; - _RandomAccessIter __p = __first; - - if (__k < __l) { - for (_Distance __j = 0; __j < __l/__d; __j++) { - if (__p > __first + __l) { - *__p = *(__p - __l); - __p -= __l; - } - - *__p = *(__p + __k); - __p += __k; - } - } - - else { - for (_Distance __j = 0; __j < __k/__d - 1; __j ++) { - if (__p < __last - __k) { - *__p = *(__p + __k); - __p += __k; - } - - *__p = * (__p - __l); - __p -= __l; - } - } - - *__p = __tmp; - ++__first; - } - - return __result; -} - -template -inline _RandomAccessIter -__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last, - _Distance * __dis, const random_access_iterator_tag &) { - return __rotate_aux(__first, __middle, __last, - __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter)); -} - -template -_ForwardIter -__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) { - _STLP_DEBUG_CHECK(__check_range(__first, __middle)) - _STLP_DEBUG_CHECK(__check_range(__middle, __last)) - return __rotate_aux(__first, __middle, __last, - _STLP_DISTANCE_TYPE(__first, _ForwardIter), - _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) { - _STLP_PRIV __rotate(__first, __middle, __last); -} - -// Return a random number in the range [0, __n). This function encapsulates -// whether we're using rand (part of the standard C library) or lrand48 -// (not standard, but a much better choice whenever it's available). -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _Distance __random_number(_Distance __n) { -#ifdef _STLP_NO_DRAND48 - return rand() % __n; -#else - return lrand48() % __n; -#endif -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void random_shuffle(_RandomAccessIter __first, - _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return; - for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) - iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1)); -} - -template -void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, - _RandomNumberGenerator &__rand) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return; - for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) - iter_swap(__i, __first + __rand((__i - __first) + 1)); -} - -#if !defined (_STLP_NO_EXTENSIONS) -// random_sample and random_sample_n (extensions, not part of the standard). -template -_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __out_ite, const _Distance __n) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Distance __remaining = distance(__first, __last); - _Distance __m = (min) (__n, __remaining); - - while (__m > 0) { - if (_STLP_PRIV __random_number(__remaining) < __m) { - *__out_ite = *__first; - ++__out_ite; - --__m; - } - - --__remaining; - ++__first; - } - return __out_ite; -} - - -template -_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __out_ite, const _Distance __n, - _RandomNumberGenerator& __rand) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Distance __remaining = distance(__first, __last); - _Distance __m = (min) (__n, __remaining); - - while (__m > 0) { - if (__rand(__remaining) < __m) { - *__out_ite = *__first; - ++__out_ite; - --__m; - } - - --__remaining; - ++__first; - } - return __out_ite; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_ite, - const _Distance __n) { - _Distance __m = 0; - _Distance __t = __n; - for ( ; __first != __last && __m < __n; ++__m, ++__first) - __out_ite[__m] = *__first; - - while (__first != __last) { - ++__t; - _Distance __M = __random_number(__t); - if (__M < __n) - __out_ite[__M] = *__first; - ++__first; - } - - return __out_ite + __m; -} - -template -_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_ite, - _RandomNumberGenerator& __rand, - const _Distance __n) { - _Distance __m = 0; - _Distance __t = __n; - for ( ; __first != __last && __m < __n; ++__m, ++__first) - __out_ite[__m] = *__first; - - while (__first != __last) { - ++__t; - _Distance __M = __rand(__t); - if (__M < __n) - __out_ite[__M] = *__first; - ++__first; - } - - return __out_ite + __m; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_RandomAccessIter -random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_first, _RandomAccessIter __out_last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last)) - return _STLP_PRIV __random_sample(__first, __last, - __out_first, __out_last - __out_first); -} - -template -_RandomAccessIter -random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_first, _RandomAccessIter __out_last, - _RandomNumberGenerator& __rand) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last)) - return _STLP_PRIV __random_sample(__first, __last, - __out_first, __rand, - __out_last - __out_first); -} - -#endif /* _STLP_NO_EXTENSIONS */ - -// partition, stable_partition, and their auxiliary functions -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first, - _ForwardIter __last, - _Predicate __pred, - const forward_iterator_tag &) { - if (__first == __last) return __first; - - while (__pred(*__first)) - if (++__first == __last) return __first; - - _ForwardIter __next = __first; - - while (++__next != __last) { - if (__pred(*__next)) { - swap(*__first, *__next); - ++__first; - } - } - return __first; -} - -template -_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first, - _BidirectionalIter __last, - _Predicate __pred, - const bidirectional_iterator_tag &) { - for (;;) { - for (;;) { - if (__first == __last) - return __first; - else if (__pred(*__first)) - ++__first; - else - break; - } - --__last; - for (;;) { - if (__first == __last) - return __first; - else if (!__pred(*__last)) - --__last; - else - break; - } - iter_swap(__first, __last); - ++__first; - } -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline -_BidirectionalIter __partition(_BidirectionalIter __first, - _BidirectionalIter __last, - _Predicate __pred, - const random_access_iterator_tag &) { - return __partition(__first, __last, __pred, bidirectional_iterator_tag()); -} -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); -} - - -/* __pred_of_first: false if we know that __pred(*__first) is false, - * true when we don't know the result of __pred(*__first). - * __not_pred_of_before_last: true if we know that __pred(*--__last) is true, - * false when we don't know the result of __pred(*--__last). - */ -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __inplace_stable_partition(_ForwardIter __first, - _ForwardIter __last, - _Predicate __pred, _Distance __len, - bool __pred_of_first, bool __pred_of_before_last) { - if (__len == 1) - return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first; - _ForwardIter __middle = __first; - _Distance __half_len = __len / 2; - advance(__middle, __half_len); - return __rotate(__inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false), - __middle, - __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last)); -} - -template -_ForwardIter __stable_partition_adaptive(_ForwardIter __first, - _ForwardIter __last, - _Predicate __pred, _Distance __len, - _Pointer __buffer, _Distance __buffer_size, - bool __pred_of_first, bool __pred_of_before_last) { - if (__len <= __buffer_size) { - _ForwardIter __result1 = __first; - _Pointer __result2 = __buffer; - if ((__first != __last) && (!__pred_of_first || __pred(*__first))) { - *__result2 = *__first; - ++__result2; ++__first; --__len; - } - for (; __first != __last ; ++__first, --__len) { - if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) || - ((__len != 1) && __pred(*__first))){ - *__result1 = *__first; - ++__result1; - } - else { - *__result2 = *__first; - ++__result2; - } - } - copy(__buffer, __result2, __result1); - return __result1; - } - else { - _ForwardIter __middle = __first; - _Distance __half_len = __len / 2; - advance(__middle, __half_len); - return __rotate(__stable_partition_adaptive( - __first, __middle, __pred, - __half_len, __buffer, __buffer_size, - __pred_of_first, false), - __middle, - __stable_partition_adaptive( - __middle, __last, __pred, - __len - __half_len, __buffer, __buffer_size, - true, __pred_of_before_last)); - } -} - -template -inline _ForwardIter -__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last, - _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last = false) { - _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last); - _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present - return (__buf.size() > 0) ? - __stable_partition_adaptive(__first, __last, __pred, - _Distance(__buf.requested_size()), - __buf.begin(), __buf.size(), - false, __pred_of_before_last) : - __inplace_stable_partition(__first, __last, __pred, - _Distance(__buf.requested_size()), - false, __pred_of_before_last); - _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present -} - -template -_ForwardIter -__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, - const forward_iterator_tag &) { - return __stable_partition_aux_aux(__first, __last, __pred, - _STLP_VALUE_TYPE(__first, _ForwardIter), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -template -_BidirectIter -__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred, - const bidirectional_iterator_tag &) { - for (--__last;;) { - if (__first == __last) - return __first; - else if (!__pred(*__last)) - --__last; - else - break; - } - ++__last; - //Here we know that __pred(*--__last) is true - return __stable_partition_aux_aux(__first, __last, __pred, - _STLP_VALUE_TYPE(__first, _BidirectIter), - _STLP_DISTANCE_TYPE(__first, _BidirectIter), true); -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -_BidirectIter -__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred, - const random_access_iterator_tag &) { - return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag()); -} -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_ForwardIter -stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for (;;) { - if (__first == __last) - return __first; - else if (__pred(*__first)) - ++__first; - else - break; - } - return _STLP_PRIV __stable_partition_aux(__first, __last, __pred, - _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_RandomAccessIter __unguarded_partition(_RandomAccessIter __first, - _RandomAccessIter __last, - _Tp __pivot, _Compare __comp) { - for (;;) { - while (__comp(*__first, __pivot)) { - _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - ++__first; - } - --__last; - while (__comp(__pivot, *__last)) { - _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - --__last; - } - if (!(__first < __last)) - return __first; - iter_swap(__first, __last); - ++__first; - } -} - -// sort() and its auxiliary functions. -#define __stl_threshold 16 - -template -void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val, - _Compare __comp) { - _RandomAccessIter __next = __last; - --__next; - while (__comp(__val, *__next)) { - _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__last = *__next; - __last = __next; - --__next; - } - *__last = __val; -} - -template -inline void __linear_insert(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp __val, _Compare __comp) { - //*TY 12/26/1998 - added __val as a paramter - // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller - if (__comp(__val, *__first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - copy_backward(__first, __last, __last + 1); - *__first = __val; - } - else - __unguarded_linear_insert(__last, __val, __comp); -} - -template -void __insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, - _Tp *, _Compare __comp) { - if (__first == __last) return; - for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) - __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val -} - -template -void __unguarded_insertion_sort_aux(_RandomAccessIter __first, - _RandomAccessIter __last, - _Tp*, _Compare __comp) { - for (_RandomAccessIter __i = __first; __i != __last; ++__i) - __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp); -} - -template -inline void __unguarded_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, - _Compare __comp) { - __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); -} - -template -void __final_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { - if (__last - __first > __stl_threshold) { - __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); - __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp); - } - else - __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); -} - -template -void __introsort_loop(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*, - _Size __depth_limit, _Compare __comp) { - while (__last - __first > __stl_threshold) { - if (__depth_limit == 0) { - partial_sort(__first, __last, __last, __comp); - return; - } - --__depth_limit; - _RandomAccessIter __cut = - __unguarded_partition(__first, __last, - _Tp(__median(*__first, - *(__first + (__last - __first)/2), - *(__last - 1), __comp)), - __comp); - __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp); - __last = __cut; - } -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void sort(_RandomAccessIter __first, _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first != __last) { - _STLP_PRIV __introsort_loop(__first, __last, - _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_PRIV __lg(__last - __first) * 2, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); - _STLP_PRIV __final_insertion_sort(__first, __last, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); - } -} - -template -void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first != __last) { - _STLP_PRIV __introsort_loop(__first, __last, - _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_PRIV __lg(__last - __first) * 2, __comp); - _STLP_PRIV __final_insertion_sort(__first, __last, __comp); - } -} - -// stable_sort() and its auxiliary functions. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void __inplace_stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { - if (__last - __first < 15) { - __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); - return; - } - _RandomAccessIter __middle = __first + (__last - __first) / 2; - __inplace_stable_sort(__first, __middle, __comp); - __inplace_stable_sort(__middle, __last, __comp); - __merge_without_buffer(__first, __middle, __last, - __middle - __first, - __last - __middle, - __comp); -} - -template -void __merge_sort_loop(_RandomAccessIter1 __first, - _RandomAccessIter1 __last, - _RandomAccessIter2 __result, _Distance __step_size, - _Compare __comp) { - _Distance __two_step = 2 * __step_size; - - while (__last - __first >= __two_step) { - __result = merge(__first, __first + __step_size, - __first + __step_size, __first + __two_step, - __result, - __comp); - __first += __two_step; - } - __step_size = (min) (_Distance(__last - __first), __step_size); - - merge(__first, __first + __step_size, - __first + __step_size, __last, - __result, - __comp); -} - -const int __stl_chunk_size = 7; - -template -void __chunk_insertion_sort(_RandomAccessIter __first, - _RandomAccessIter __last, - _Distance __chunk_size, _Compare __comp) { - while (__last - __first >= __chunk_size) { - __insertion_sort(__first, __first + __chunk_size, - _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); - __first += __chunk_size; - } - __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); -} - -template -void __merge_sort_with_buffer(_RandomAccessIter __first, - _RandomAccessIter __last, _Pointer __buffer, - _Distance*, _Compare __comp) { - _Distance __len = __last - __first; - _Pointer __buffer_last = __buffer + __len; - - _Distance __step_size = __stl_chunk_size; - __chunk_insertion_sort(__first, __last, __step_size, __comp); - - while (__step_size < __len) { - __merge_sort_loop(__first, __last, __buffer, __step_size, __comp); - __step_size *= 2; - __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp); - __step_size *= 2; - } -} - -template -_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first, - _BidirectionalIter1 __middle, - _BidirectionalIter1 __last, - _Distance __len1, _Distance __len2, - _BidirectionalIter2 __buffer, - _Distance __buffer_size) { - if (__len1 > __len2 && __len2 <= __buffer_size) { - _BidirectionalIter2 __buffer_end = copy(__middle, __last, __buffer); - copy_backward(__first, __middle, __last); - return copy(__buffer, __buffer_end, __first); - } - else if (__len1 <= __buffer_size) { - _BidirectionalIter2 __buffer_end = copy(__first, __middle, __buffer); - copy(__middle, __last, __first); - return copy_backward(__buffer, __buffer_end, __last); - } - else - return __rotate(__first, __middle, __last); -} - -template -void __merge_adaptive(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, - _Distance __len1, _Distance __len2, - _Pointer __buffer, _Distance __buffer_size, - _Compare __comp) { - if (__len1 <= __len2 && __len1 <= __buffer_size) { - _Pointer __buffer_end = copy(__first, __middle, __buffer); - merge(__buffer, __buffer_end, __middle, __last, __first, __comp); - } - else if (__len2 <= __buffer_size) { - _Pointer __buffer_end = copy(__middle, __last, __buffer); - __merge_backward(__first, __middle, __buffer, __buffer_end, __last, - __comp); - } - else { - _BidirectionalIter __first_cut = __first; - _BidirectionalIter __second_cut = __middle; - _Distance __len11 = 0; - _Distance __len22 = 0; - if (__len1 > __len2) { - __len11 = __len1 / 2; - advance(__first_cut, __len11); - __second_cut = lower_bound(__middle, __last, *__first_cut, __comp); - __len22 += distance(__middle, __second_cut); - } - else { - __len22 = __len2 / 2; - advance(__second_cut, __len22); - __first_cut = upper_bound(__first, __middle, *__second_cut, __comp); - __len11 += distance(__first, __first_cut); - } - _BidirectionalIter __new_middle = - __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, - __len22, __buffer, __buffer_size); - __merge_adaptive(__first, __first_cut, __new_middle, __len11, - __len22, __buffer, __buffer_size, __comp); - __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, - __len2 - __len22, __buffer, __buffer_size, __comp); - } -} - -template -void __stable_sort_adaptive(_RandomAccessIter __first, - _RandomAccessIter __last, _Pointer __buffer, - _Distance __buffer_size, _Compare __comp) { - _Distance __len = (__last - __first + 1) / 2; - _RandomAccessIter __middle = __first + __len; - if (__len > __buffer_size) { - __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size, - __comp); - __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size, - __comp); - } - else { - __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0, - __comp); - __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0, - __comp); - } - __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), - _Distance(__last - __middle), __buffer, __buffer_size, - __comp); -} - -template -void __stable_sort_aux(_RandomAccessIter __first, - _RandomAccessIter __last, _Tp*, _Distance*, - _Compare __comp) { - _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); - if (buf.begin() == 0) - __inplace_stable_sort(__first, __last, __comp); - else - __stable_sort_adaptive(__first, __last, buf.begin(), - _Distance(buf.size()), - __comp); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_PRIV __stable_sort_aux(__first, __last, - _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_DISTANCE_TYPE(__first, _RandomAccessIter), - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); -} - -template -void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_PRIV __stable_sort_aux(__first, __last, - _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_DISTANCE_TYPE(__first, _RandomAccessIter), - __comp); -} - -// partial_sort, partial_sort_copy, and auxiliary functions. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last, _Tp*, _Compare __comp) { - make_heap(__first, __middle, __comp); - for (_RandomAccessIter __i = __middle; __i < __last; ++__i) { - if (__comp(*__i, *__first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __pop_heap(__first, __middle, __i, _Tp(*__i), __comp, - _STLP_DISTANCE_TYPE(__first, _RandomAccessIter)); - } - } - sort_heap(__first, __middle, __comp); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, - _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) - _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); -} - -template -void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, - _RandomAccessIter __last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) - _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_RandomAccessIter __partial_sort_copy(_InputIter __first, - _InputIter __last, - _RandomAccessIter __result_first, - _RandomAccessIter __result_last, - _Compare __comp, _Distance*, _Tp*) { - if (__result_first == __result_last) return __result_last; - _RandomAccessIter __result_real_last = __result_first; - while(__first != __last && __result_real_last != __result_last) { - *__result_real_last = *__first; - ++__result_real_last; - ++__first; - } - make_heap(__result_first, __result_real_last, __comp); - while (__first != __last) { - if (__comp(*__first, *__result_first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __adjust_heap(__result_first, _Distance(0), - _Distance(__result_real_last - __result_first), - _Tp(*__first), - __comp); - } - ++__first; - } - sort_heap(__result_first, __result_real_last, __comp); - return __result_real_last; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_RandomAccessIter -partial_sort_copy(_InputIter __first, _InputIter __last, - _RandomAccessIter __result_first, _RandomAccessIter __result_last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last)) - return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)), - _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter), - _STLP_VALUE_TYPE(__first, _InputIter)); -} - -template -_RandomAccessIter -partial_sort_copy(_InputIter __first, _InputIter __last, - _RandomAccessIter __result_first, - _RandomAccessIter __result_last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last)) - return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last, - __comp, - _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter), - _STLP_VALUE_TYPE(__first, _InputIter)); -} - -// nth_element() and its auxiliary functions. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Tp*, _Compare __comp) { - while (__last - __first > 3) { - _RandomAccessIter __cut = - __unguarded_partition(__first, __last, - _Tp(__median(*__first, - *(__first + (__last - __first)/2), - *(__last - 1), - __comp)), - __comp); - if (__cut <= __nth) - __first = __cut; - else - __last = __cut; - } - __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last)) - _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); -} - -template -void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last)) - _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); -} - -// Binary search (lower_bound, upper_bound, equal_range, binary_search). -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare1 __comp1, _Compare2 __comp2, _Distance*) { - _Distance __len = distance(__first, __last); - _Distance __half; - - while (__len > 0) { - __half = __len >> 1; - _ForwardIter __middle = __first; - advance(__middle, __half); - if (__comp2(__val, *__middle)) { - _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __len = __half; - } - else { - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - } - return __first; -} - -template -pair<_ForwardIter, _ForwardIter> -__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) { - _Distance __len = distance(__first, __last); - _Distance __half; - - while (__len > 0) { - __half = __len >> 1; - _ForwardIter __middle = __first; - advance(__middle, __half); - if (__comp1(*__middle, __val)) { - _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else if (__comp2(__val, *__middle)) { - _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __len = __half; - } - else { - _ForwardIter __left = __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist); - //Small optim: If lower_bound haven't found an equivalent value - //there is no need to call upper_bound. - if (__comp1(*__left, __val)) { - _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return pair<_ForwardIter, _ForwardIter>(__left, __left); - } - advance(__first, __len); - _ForwardIter __right = __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist); - return pair<_ForwardIter, _ForwardIter>(__left, __right); - } - } - return pair<_ForwardIter, _ForwardIter>(__first, __first); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) { - if (*__first2 < *__first1) { - *__result = *__first2; - ++__first2; - } - else { - *__result = *__first1; - ++__first1; - } - ++__result; - } - return copy(__first2, __last2, copy(__first1, __last1, __result)); -} - -template -_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) { - if (__comp(*__first2, *__first1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__result = *__first2; - ++__first2; - } - else { - *__result = *__first1; - ++__first1; - } - ++__result; - } - return copy(__first2, __last2, copy(__first1, __last1, __result)); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void __merge_without_buffer(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, - _Distance __len1, _Distance __len2, - _Compare __comp) { - if (__len1 == 0 || __len2 == 0) - return; - if (__len1 + __len2 == 2) { - if (__comp(*__middle, *__first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - iter_swap(__first, __middle); - } - return; - } - _BidirectionalIter __first_cut = __first; - _BidirectionalIter __second_cut = __middle; - _Distance __len11 = 0; - _Distance __len22 = 0; - if (__len1 > __len2) { - __len11 = __len1 / 2; - advance(__first_cut, __len11); - __second_cut = lower_bound(__middle, __last, *__first_cut, __comp); - __len22 += distance(__middle, __second_cut); - } - else { - __len22 = __len2 / 2; - advance(__second_cut, __len22); - __first_cut = upper_bound(__first, __middle, *__second_cut, __comp); - __len11 +=distance(__first, __first_cut); - } - _BidirectionalIter __new_middle - = __rotate(__first_cut, __middle, __second_cut); - __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22, - __comp); - __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, - __len2 - __len22, __comp); -} - -template -_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, - _BidirectionalIter1 __last1, - _BidirectionalIter2 __first2, - _BidirectionalIter2 __last2, - _BidirectionalIter3 __result, - _Compare __comp) { - if (__first1 == __last1) - return copy_backward(__first2, __last2, __result); - if (__first2 == __last2) - return copy_backward(__first1, __last1, __result); - --__last1; - --__last2; - for (;;) { - if (__comp(*__last2, *__last1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *--__result = *__last1; - if (__first1 == __last1) - return copy_backward(__first2, ++__last2, __result); - --__last1; - } - else { - *--__result = *__last2; - if (__first2 == __last2) - return copy_backward(__first1, ++__last1, __result); - --__last2; - } - } -} - -template -inline void __inplace_merge_aux(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, _Tp*, _Distance*, - _Compare __comp) { - _Distance __len1 = distance(__first, __middle); - _Distance __len2 = distance(__middle, __last); - - _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last); - if (__buf.begin() == 0) - __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp); - else - __merge_adaptive(__first, __middle, __last, __len1, __len2, - __buf.begin(), _Distance(__buf.size()), - __comp); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) - if (__first == __middle || __middle == __last) - return; - _STLP_PRIV __inplace_merge_aux(__first, __middle, __last, - _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter), - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); -} - -template -void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) - if (__first == __middle || __middle == __last) - return; - _STLP_PRIV __inplace_merge_aux(__first, __middle, __last, - _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter), - __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) - if (__comp(*__first2, *__first1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return false; - } - else if (__comp(*__first1, *__first2)) - ++__first1; - else - ++__first1, ++__first2; - - return __first2 == __last2; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { - return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp); -} - -template -bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) { - if (__comp(*__first1, *__first2)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__result = *__first1; - ++__first1; - } - else if (__comp(*__first2, *__first1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__result = *__first2; - ++__first2; - } - else { - *__result = *__first1; - ++__first1; - ++__first2; - } - ++__result; - } - return copy(__first2, __last2, copy(__first1, __last1, __result)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); -} - -template -_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) - if (__comp(*__first1, *__first2)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - ++__first1; - } - else if (__comp(*__first2, *__first1)) - ++__first2; - else { - *__result = *__first1; - ++__first1; - ++__first2; - ++__result; - } - return __result; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); -} - -template -_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) - if (__comp(*__first1, *__first2)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__result = *__first1; - ++__first1; - ++__result; - } - else if (__comp(*__first2, *__first1)) - ++__first2; - else { - ++__first1; - ++__first2; - } - return copy(__first1, __last1, __result); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); -} - -template -_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIter -__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - while (__first1 != __last1 && __first2 != __last2) { - if (__comp(*__first1, *__first2)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *__result = *__first1; - ++__first1; - ++__result; - } - else if (__comp(*__first2, *__first1)) { - *__result = *__first2; - ++__first2; - ++__result; - } - else { - ++__first1; - ++__first2; - } - } - return copy(__first2, __last2, copy(__first1, __last1, __result)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter -set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result) { - return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); -} - -template -_OutputIter -set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, - _Compare __comp) { - return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp); -} - -// min_element and max_element, with and without an explicitly supplied -// comparison function. - -template -_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __first; - _ForwardIter __result = __first; - while (++__first != __last) - if (*__result < *__first) - __result = __first; - return __result; -} - -template -_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __first; - _ForwardIter __result = __first; - while (++__first != __last) { - if (__comp(*__result, *__first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __result = __first; - } - } - return __result; -} - -template -_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __first; - _ForwardIter __result = __first; - while (++__first != __last) - if (*__first < *__result) - __result = __first; - return __result; -} - -template -_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) return __first; - _ForwardIter __result = __first; - while (++__first != __last) { - if (__comp(*__first, *__result)) { - _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __result = __first; - } - } - return __result; -} - -// next_permutation and prev_permutation, with and without an explicitly -// supplied comparison function. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - if (__first == __last) - return false; - _BidirectionalIter __i = __first; - ++__i; - if (__i == __last) - return false; - __i = __last; - --__i; - - for(;;) { - _BidirectionalIter __ii = __i; - --__i; - if (__comp(*__i, *__ii)) { - _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - _BidirectionalIter __j = __last; - while (!__comp(*__i, *--__j)) {} - iter_swap(__i, __j); - reverse(__ii, __last); - return true; - } - if (__i == __first) { - reverse(__first, __last); - return false; - } - } -#if defined (_STLP_NEED_UNREACHABLE_RETURN) - return false; -#endif -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __next_permutation(__first, __last, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); -} - -template -bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __next_permutation(__first, __last, __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - if (__first == __last) - return false; - _BidirectionalIter __i = __first; - ++__i; - if (__i == __last) - return false; - __i = __last; - --__i; - - for(;;) { - _BidirectionalIter __ii = __i; - --__i; - if (__comp(*__ii, *__i)) { - _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - _BidirectionalIter __j = __last; - while (!__comp(*--__j, *__i)) {} - iter_swap(__i, __j); - reverse(__ii, __last); - return true; - } - if (__i == __first) { - reverse(__first, __last); - return false; - } - } -#if defined (_STLP_NEED_UNREACHABLE_RETURN) - return false; -#endif -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __prev_permutation(__first, __last, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); -} - -template -bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __prev_permutation(__first, __last, __comp); -} - -#if !defined (_STLP_NO_EXTENSIONS) - -// is_heap, a predicate testing whether or not a range is -// a heap. This function is an extension, not part of the C++ -// standard. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp, - _Distance __n) { - _Distance __parent = 0; - for (_Distance __child = 1; __child < __n; ++__child) { - if (__comp(__first[__parent], __first[__child])) { - _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return false; - } - if ((__child & 1) == 0) - ++__parent; - } - return true; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first); -} - -template -bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, - _StrictWeakOrdering __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __is_heap(__first, __comp, __last - __first); -} - - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __is_sorted(_ForwardIter __first, _ForwardIter __last, - _StrictWeakOrdering __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - if (__first == __last) - return true; - - _ForwardIter __next = __first; - for (++__next; __next != __last; __first = __next, ++__next) { - if (__comp(*__next, *__first)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return false; - } - } - - return true; -} - -_STLP_MOVE_TO_STD_NAMESPACE -#endif /* _STLP_NO_EXTENSIONS */ - -_STLP_END_NAMESPACE - -#undef __stl_threshold - -#endif /* _STLP_ALGO_C */ -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_algo.h b/SDK/stlport/stl/_algo.h deleted file mode 100644 index d6513fc8..00000000 --- a/SDK/stlport/stl/_algo.h +++ /dev/null @@ -1,760 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ALGO_H -#define _STLP_INTERNAL_ALGO_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_HEAP_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO) -// remove() conflict -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// for_each. Apply a function to every element of a range. -template -_STLP_INLINE_LOOP _Function -for_each(_InputIter __first, _InputIter __last, _Function __f) { - for ( ; __first != __last; ++__first) - __f(*__first); - return __f; -} - -// count_if -template -_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter) -count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; - for ( ; __first != __last; ++__first) { - if (__pred(*__first)) - ++__n; - } - return __n; -} - -// adjacent_find. - -template -_STLP_INLINE_LOOP _ForwardIter -adjacent_find(_ForwardIter __first, _ForwardIter __last, - _BinaryPredicate __binary_pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - if (__first == __last) - return __last; - _ForwardIter __next = __first; - while(++__next != __last) { - if (__binary_pred(*__first, *__next)) - return __first; - __first = __next; - } - return __last; -} - -template -_STLP_INLINE_LOOP _ForwardIter -adjacent_find(_ForwardIter __first, _ForwardIter __last) { - return adjacent_find(__first, __last, - _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter))); -} - -#if !defined (_STLP_NO_ANACHRONISMS) -template -_STLP_INLINE_LOOP void -count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - if (*__first == __val) - ++__n; -} - -template -_STLP_INLINE_LOOP void -count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - if (__pred(*__first)) - ++__n; -} -#endif - -template -_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2); - -// search_n. Search for __count consecutive copies of __val. -template -_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val); -template -_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, - _Integer __count, const _Tp& __val, _BinaryPred __binary_pred); - -template -inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, - _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter))); -} - -template -inline _InputIter -find_first_of(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp); -} - -template -_ForwardIter1 -find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2); - -// swap_ranges -template -_STLP_INLINE_LOOP _ForwardIter2 -swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2) - iter_swap(__first1, __first2); - return __first2; -} - -// transform -template -_STLP_INLINE_LOOP _OutputIter -transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first, ++__result) - *__result = __opr(*__first); - return __result; -} -template -_STLP_INLINE_LOOP _OutputIter -transform(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result) - *__result = __binary_op(*__first1, *__first2); - return __result; -} - -// replace_if, replace_copy, replace_copy_if - -template -_STLP_INLINE_LOOP void -replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - if (__pred(*__first)) - *__first = __new_value; -} - -template -_STLP_INLINE_LOOP _OutputIter -replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result, - const _Tp& __old_value, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first, ++__result) - *__result = *__first == __old_value ? __new_value : *__first; - return __result; -} - -template -_STLP_INLINE_LOOP _OutputIter -replace_copy_if(_Iterator __first, _Iterator __last, - _OutputIter __result, - _Predicate __pred, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first, ++__result) - *__result = __pred(*__first) ? __new_value : *__first; - return __result; -} - -// generate and generate_n - -template -_STLP_INLINE_LOOP void -generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - *__first = __gen(); -} - -template -_STLP_INLINE_LOOP void -generate_n(_OutputIter __first, _Size __n, _Generator __gen) { - for ( ; __n > 0; --__n, ++__first) - *__first = __gen(); -} - -// remove, remove_if, remove_copy, remove_copy_if - -template -_STLP_INLINE_LOOP _OutputIter -remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) { - if (!(*__first == __val)) { - *__result = *__first; - ++__result; - } - } - return __result; -} - -template -_STLP_INLINE_LOOP _OutputIter -remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) { - if (!__pred(*__first)) { - *__result = *__first; - ++__result; - } - } - return __result; -} - -template -_STLP_INLINE_LOOP _ForwardIter -remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - __first = find(__first, __last, __val); - if (__first == __last) - return __first; - else { - _ForwardIter __next = __first; - return remove_copy(++__next, __last, __first, __val); - } -} - -template -_STLP_INLINE_LOOP _ForwardIter -remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - __first = find_if(__first, __last, __pred); - if ( __first == __last ) - return __first; - else { - _ForwardIter __next = __first; - return remove_copy_if(++__next, __last, __first, __pred); - } -} - -// unique and unique_copy -template -_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result); - -template -_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, - _BinaryPredicate __binary_pred); - -template -inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) { - __first = adjacent_find(__first, __last); - return unique_copy(__first, __last, __first); -} - -template -inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last, - _BinaryPredicate __binary_pred) { - __first = adjacent_find(__first, __last, __binary_pred); - return unique_copy(__first, __last, __first, __binary_pred); -} - -// reverse and reverse_copy, and their auxiliary functions - -template -_STLP_INLINE_LOOP void -__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) { - for (; __first != __last && __first != --__last; ++__first) - iter_swap(__first,__last); -} - - -template -_STLP_INLINE_LOOP void -__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) { - for (; __first < __last; ++__first) - iter_swap(__first, --__last); -} - -template -inline void -reverse(_BidirectionalIter __first, _BidirectionalIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter)); -} - -template -_STLP_INLINE_LOOP -_OutputIter reverse_copy(_BidirectionalIter __first, - _BidirectionalIter __last, - _OutputIter __result) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - while (__first != __last) { - --__last; - *__result = *__last; - ++__result; - } - return __result; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// rotate and rotate_copy, and their auxiliary functions -template -_STLP_INLINE_LOOP -_EuclideanRingElement __gcd(_EuclideanRingElement __m, - _EuclideanRingElement __n) { - while (__n != 0) { - _EuclideanRingElement __t = __m % __n; - __m = __n; - __n = __t; - } - return __m; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last); - -template -inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle, - _ForwardIter __last, _OutputIter __result) { - return copy(__first, __middle, copy(__middle, __last, __result)); -} - -// random_shuffle - -template -void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last); - -template -void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, - _RandomNumberGenerator& __rand); - -#if !defined (_STLP_NO_EXTENSIONS) -// random_sample and random_sample_n (extensions, not part of the standard). - -template -_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __out_ite, const _Distance __n); - -template -_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __out_ite, const _Distance __n, - _RandomNumberGenerator& __rand); - -template -_RandomAccessIter -random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_first, _RandomAccessIter __out_last); - -template -_RandomAccessIter -random_sample(_InputIter __first, _InputIter __last, - _RandomAccessIter __out_first, _RandomAccessIter __out_last, - _RandomNumberGenerator& __rand); - -#endif /* _STLP_NO_EXTENSIONS */ - -// partition, stable_partition, and their auxiliary functions - -template -_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); - -template -_ForwardIter -stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); - -// sort() and its auxiliary functions. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _Size __lg(_Size __n) { - _Size __k; - for (__k = 0; __n != 1; __n >>= 1) ++__k; - return __k; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -void sort(_RandomAccessIter __first, _RandomAccessIter __last); -template -void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp); - -// stable_sort() and its auxiliary functions. -template -void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last); - -template -void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp); - -// partial_sort, partial_sort_copy, and auxiliary functions. - -template -void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, - _RandomAccessIter __last); - -template -void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, - _RandomAccessIter __last, _Compare __comp); - -template -_RandomAccessIter -partial_sort_copy(_InputIter __first, _InputIter __last, - _RandomAccessIter __result_first, _RandomAccessIter __result_last); - -template -_RandomAccessIter -partial_sort_copy(_InputIter __first, _InputIter __last, - _RandomAccessIter __result_first, - _RandomAccessIter __result_last, _Compare __comp); - -// nth_element() and its auxiliary functions. -template -void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last); - -template -void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, - _RandomAccessIter __last, _Compare __comp); - -// auxiliary class for lower_bound, etc. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct __less_2 { - bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; } -}; - -template -__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); } - -#if defined (_STLP_FUNCTION_PARTIAL_ORDER) -template -less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); } -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -// Binary search (lower_bound, upper_bound, equal_range, binary_search). -template -inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __lower_bound(__first, __last, __val, - _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -template -inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare1 __comp1, _Compare2 __comp2, _Distance*); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __upper_bound(__first, __last, __val, - _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -template -inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -pair<_ForwardIter, _ForwardIter> -__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare1 __comp1, _Compare2 __comp2, _Distance*); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline pair<_ForwardIter, _ForwardIter> -equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __equal_range(__first, __last, __val, - _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -template -inline pair<_ForwardIter, _ForwardIter> -equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -template -inline bool binary_search(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, - _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); - return __i != __last && !(__val < *__i); -} - -template -inline bool binary_search(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); - return __i != __last && !__comp(__val, *__i); -} - -// merge, with and without an explicitly supplied comparison function. - -template -_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result); - -template -_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp); - - -// inplace_merge and its auxiliary functions. - - -template -void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last) ; - -template -void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, _Compare __comp); - -// Set algorithms: includes, set_union, set_intersection, set_difference, -// set_symmetric_difference. All of these algorithms have the precondition -// that their input ranges are sorted and the postcondition that their output -// ranges are sorted. - -template -bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2); - -template -bool includes(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, _Compare __comp); - -template -_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result); - -template -_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp); - -template -_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result); - -template -_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp); - - - -template -_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result); - -template -_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, _Compare __comp); - -template -_OutputIter -set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result); - - -template -_OutputIter -set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _OutputIter __result, - _Compare __comp); - - -// min_element and max_element, with and without an explicitly supplied -// comparison function. - -template -_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last); -template -_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp); - -template -_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last); - -template -_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, - _Compare __comp); - -// next_permutation and prev_permutation, with and without an explicitly -// supplied comparison function. - -template -bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last); - -template -bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp); - - -template -bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last); - - -template -bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, - _Compare __comp); - -#if !defined (_STLP_NO_EXTENSIONS) -// is_heap, a predicate testing whether or not a range is -// a heap. This function is an extension, not part of the C++ -// standard. - -template -bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last); - -template -bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, - _StrictWeakOrdering __comp); - -// is_sorted, a predicated testing whether a range is sorted in -// nondescending order. This is an extension, not part of the C++ -// standard. -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __is_sorted(_ForwardIter __first, _ForwardIter __last, - _StrictWeakOrdering __comp); - -_STLP_MOVE_TO_STD_NAMESPACE -template -inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) { - return _STLP_PRIV __is_sorted(__first, __last, - _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter))); -} - -template -inline bool is_sorted(_ForwardIter __first, _ForwardIter __last, - _StrictWeakOrdering __comp) { - return _STLP_PRIV __is_sorted(__first, __last, __comp); -} -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_ALGO_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_algobase.c b/SDK/stlport/stl/_algobase.c deleted file mode 100644 index 8a1f657f..00000000 --- a/SDK/stlport/stl/_algobase.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_ALGOBASE_C -#define _STLP_ALGOBASE_C - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - for ( ; __first1 != __last1 && __first2 != __last2 - ; ++__first1, ++__first2) { - if (*__first1 < *__first2) { - return true; - } - if (*__first2 < *__first1) - return false; - } - return __first1 == __last1 && __first2 != __last2; -} - -template -bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _Compare __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - for ( ; __first1 != __last1 && __first2 != __last2 - ; ++__first1, ++__first2) { - if (__comp(*__first1, *__first2)) { - return true; - } - if (__comp(*__first2, *__first1)) - return false; - } - return __first1 == __last1 && __first2 != __last2; -} - -#if !defined (_STLP_NO_EXTENSIONS) -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - while (__first1 != __last1 && __first2 != __last2) { - if (*__first1 < *__first2) { - _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return -1; - } - if (*__first2 < *__first1) - return 1; - ++__first1; - ++__first2; - } - if (__first2 == __last2) { - return !(__first1 == __last1); - } - else { - return -1; - } -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2); -} -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last, - const _Tp& __val, - const random_access_iterator_tag &) { - _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2; - - for ( ; __trip_count > 0 ; --__trip_count) { - if (*__first == __val) return __first; - ++__first; - - if (*__first == __val) return __first; - ++__first; - - if (*__first == __val) return __first; - ++__first; - - if (*__first == __val) return __first; - ++__first; - } - - switch (__last - __first) { - case 3: - if (*__first == __val) return __first; - ++__first; - case 2: - if (*__first == __val) return __first; - ++__first; - case 1: - if (*__first == __val) return __first; - //++__first; - case 0: - default: - return __last; - } -} - -inline char* -__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) { - void *res = memchr(__first, __val, __last - __first); - return res != 0 ? __STATIC_CAST(char*, res) : __last; -} -inline const char* -__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) { - const void *res = memchr(__first, __val, __last - __first); - return res != 0 ? __STATIC_CAST(const char*, res) : __last; -} - -template -_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last, - _Predicate __pred, - const random_access_iterator_tag &) { - _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2; - - for ( ; __trip_count > 0 ; --__trip_count) { - if (__pred(*__first)) return __first; - ++__first; - - if (__pred(*__first)) return __first; - ++__first; - - if (__pred(*__first)) return __first; - ++__first; - - if (__pred(*__first)) return __first; - ++__first; - } - - switch(__last - __first) { - case 3: - if (__pred(*__first)) return __first; - ++__first; - case 2: - if (__pred(*__first)) return __first; - ++__first; - case 1: - if (__pred(*__first)) return __first; - //++__first; - case 0: - default: - return __last; - } -} - -template -_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last, - const _Tp& __val, - const input_iterator_tag &) { - while (__first != __last && !(*__first == __val)) ++__first; - return __first; -} - -template -_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _STLP_MPW_EXTRA_CONST _InputIter __last, - _Predicate __pred, - const input_iterator_tag &) { - while (__first != __last && !__pred(*__first)) - ++__first; - return __first; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_InputIter find_if(_InputIter __first, _InputIter __last, - _Predicate __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); -} - -template -_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); -} - -template -_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, - _BinaryPred __pred) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - // Test for empty ranges - if (__first1 == __last1 || __first2 == __last2) - return __first1; - - // Test for a pattern of length 1. - _ForwardIter2 __p1(__first2); - - if ( ++__p1 == __last2 ) { - while (__first1 != __last1 && !__pred(*__first1, *__first2)) { - ++__first1; - } - return __first1; - } - - // General case. - - for ( ; ; ) { // __first1 != __last1 will be checked below - while (__first1 != __last1 && !__pred(*__first1, *__first2)) { - ++__first1; - } - if (__first1 == __last1) { - return __last1; - } - _ForwardIter2 __p = __p1; - _ForwardIter1 __current = __first1; - if (++__current == __last1) return __last1; - - while (__pred(*__current, *__p)) { - if (++__p == __last2) - return __first1; - if (++__current == __last1) - return __last1; - } - - ++__first1; - } - return __first1; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// find_first_of, with and without an explicitly supplied comparison function. -template -_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2, - _BinaryPredicate __comp) { - for ( ; __first1 != __last1; ++__first1) { - for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) { - if (__comp(*__first1, *__iter)) { - return __first1; - } - } - } - return __last1; -} - -// find_end, with and without an explicitly supplied comparison function. -// Search [first2, last2) as a subsequence in [first1, last1), and return -// the *last* possible match. Note that find_end for bidirectional iterators -// is much faster than for forward iterators. - -// find_end for forward iterators. -template -_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, - const forward_iterator_tag &, const forward_iterator_tag &, - _BinaryPredicate __comp) { - if (__first2 == __last2) - return __last1; - else { - _ForwardIter1 __result = __last1; - for (;;) { - _ForwardIter1 __new_result = search(__first1, __last1, __first2, __last2, __comp); - if (__new_result == __last1) - return __result; - else { - __result = __new_result; - __first1 = __new_result; - ++__first1; - } - } - } -} - -_STLP_MOVE_TO_STD_NAMESPACE - -// find_end for bidirectional iterators. Requires partial specialization. -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - -# ifndef _STLP_INTERNAL_ITERATOR_H -_STLP_END_NAMESPACE -# include -_STLP_BEGIN_NAMESPACE -# endif /*_STLP_INTERNAL_ITERATOR_H*/ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_BidirectionalIter1 -__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, - _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, - const bidirectional_iterator_tag &, const bidirectional_iterator_tag &, - _BinaryPredicate __comp) { - typedef reverse_iterator<_BidirectionalIter1> _RevIter1; - typedef reverse_iterator<_BidirectionalIter2> _RevIter2; - - _RevIter1 __rlast1(__first1); - _RevIter2 __rlast2(__first2); - _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1, - _RevIter2(__last2), __rlast2, - __comp); - - if (__rresult == __rlast1) - return __last1; - else { - _BidirectionalIter1 __result = __rresult.base(); - advance(__result, -distance(__first2, __last2)); - return __result; - } -} - -_STLP_MOVE_TO_STD_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -template -_ForwardIter1 -find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, - _BinaryPredicate __comp) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2, -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1), - _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2), -#else - forward_iterator_tag(), - forward_iterator_tag(), -#endif - __comp); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare1 __comp1, _Compare2 __comp2, _Distance*) { - _Distance __len = distance(__first, __last); - _Distance __half; - _ForwardIter __middle; - - while (__len > 0) { - __half = __len >> 1; - __middle = __first; - advance(__middle, __half); - if (__comp1(*__middle, __val)) { - _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __first = __middle; - ++__first; - __len = __len - __half - 1; - } - else - __len = __half; - } - return __first; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_ALGOBASE_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_algobase.h b/SDK/stlport/stl/_algobase.h deleted file mode 100644 index 6864223a..00000000 --- a/SDK/stlport/stl/_algobase.h +++ /dev/null @@ -1,670 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ALGOBASE_H -#define _STLP_INTERNAL_ALGOBASE_H - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -#ifndef _STLP_INTERNAL_CSTRING -# include -#endif - -#ifndef _STLP_CLIMITS -# include -#endif - -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -#ifndef _STLP_INTERNAL_PAIR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -#ifndef _STLP_TYPE_TRAITS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined(_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -_STLP_MOVE_TO_PRIV_NAMESPACE -template -inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) { - __a.swap(__b); -} - -template -inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) { - _Tp __tmp = __a; - __a = __b; - __b = __tmp; -} -_STLP_MOVE_TO_STD_NAMESPACE -#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */ - -// swap and iter_swap -template -inline void swap(_Tp& __a, _Tp& __b) { -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -# if !defined(__BORLANDC__) - typedef typename _SwapImplemented<_Tp>::_Ret _Implemented; -# else - enum { _Is = _SwapImplemented<_Tp>::_Is }; - typedef typename __bool2type<_Is>::_Ret _Implemented; -# endif - _STLP_PRIV __swap_aux(__a, __b, _Implemented()); -#else - _Tp __tmp = __a; - __a = __b; - __b = __tmp; -#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */ -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) { - _Value tmp = *__i1; - *__i1 = *__i2; - *__i2 = tmp; -} - -template -inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) { - swap(*__i1, *__i2); -} - -template -inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) { - __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) ); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) { - // swap(*__i1, *__i2); - _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2), - _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1), - _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer()); -} - -//-------------------------------------------------- -// min and max - -#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE) -# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__) -//In not ANSI mode Borland import min/max in global namespace which conflict -//with STLport min/max when user does a 'using namespace std' in its code -//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max -//in STLport namespace. -using _STLP_VENDOR_STD::min; -using _STLP_VENDOR_STD::max; -# else -template -inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } -template -inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } -# endif -#endif - -# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE) -inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; } -inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; } -# endif - -template -inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) { - return __comp(__b, __a) ? __b : __a; -} - -template -inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) { - return __comp(__a, __b) ? __b : __a; -} - -//-------------------------------------------------- -// copy - -// All of these auxiliary functions serve two purposes. (1) Replace -// calls to copy with memmove whenever possible. (Memmove, not memcpy, -// because the input and output ranges are permitted to overlap.) -// (2) If we're using random access iterators, then write the loop as -// a for loop with an explicit count. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _OutputIter __copy(_InputIter __first, _InputIter __last, - _OutputIter __result, const input_iterator_tag &, _Distance*) { - for ( ; __first != __last; ++__result, ++__first) - *__result = *__first; - return __result; -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline _OutputIter __copy(_InputIter __first, _InputIter __last, - _OutputIter __result, const forward_iterator_tag &, _Distance* ) { - for ( ; __first != __last; ++__result, ++__first) - *__result = *__first; - return __result; -} - -template -inline _OutputIter __copy(_InputIter __first, _InputIter __last, - _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) { - for ( ; __first != __last; ++__result, ++__first) - *__result = *__first; - return __result; -} -#endif - -template -inline _OutputIter -__copy(_RandomAccessIter __first, _RandomAccessIter __last, - _OutputIter __result, const random_access_iterator_tag &, _Distance*) { - for (_Distance __n = __last - __first; __n > 0; --__n) { - *__result = *__first; - ++__first; - ++__result; - } - return __result; -} - -inline void* -__copy_trivial(const void* __first, const void* __last, void* __result) { - size_t __n = (const char*)__last - (const char*)__first; - return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result; -} - -//-------------------------------------------------- -// copy_backward auxiliary functions - -template -inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, - _BidirectionalIter1 __last, - _BidirectionalIter2 __result, - const bidirectional_iterator_tag &, - _Distance*) { - while (__first != __last) - *--__result = *--__last; - return __result; -} - -template -inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, - _RandomAccessIter __last, - _BidirectionalIter __result, - const random_access_iterator_tag &, - _Distance*) { - for (_Distance __n = __last - __first; __n > 0; --__n) - *--__result = *--__last; - return __result; -} - -inline void* -__copy_trivial_backward(const void* __first, const void* __last, void* __result) { - const ptrdiff_t _Num = (const char*)__last - (const char*)__first; - return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ; -} - -template -inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, - const __false_type& /*IsOKToMemCpy*/) { - return __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); -} -template -inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, - const __true_type& /*IsOKToMemCpy*/) { - // we know they all pointers, so this cast is OK - // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result)); - return (_OutputIter)__copy_trivial(__first, __last, __result); -} - -template -inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, - const __true_type& /*BothPtrType*/) { - return __copy_ptrs(__first, __last, __result, - _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter), - _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); -} - -template -inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, - const __false_type& /*BothPtrType*/) { - return __copy(__first, __last, __result, - _STLP_ITERATOR_CATEGORY(__first, _InputIter), - _STLP_DISTANCE_TYPE(__first, _InputIter)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer()); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last, - _OutputIter __result, const __false_type& /*TrivialAssignment*/) { - return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter)); -} -template -inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last, - _OutputIter __result, const __true_type& /*TrivialAssignment*/) { - return (_OutputIter)__copy_trivial_backward(__first, __last, __result); -} - -template -inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) { - return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first,_InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter)); -} - -template -inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) { - return __copy_backward_ptrs(__first, __last, __result, - _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter), - _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() ); -} - -#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) -# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \ -inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \ -{ return (_Tp*)__copy_trivial(__first, __last, __result); } \ -inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \ -{ return (_Tp*)__copy_trivial_backward(__first, __last, __result); } - -_STLP_DECLARE_COPY_TRIVIAL(char) -# if !defined (_STLP_NO_SIGNED_BUILTINS) -_STLP_DECLARE_COPY_TRIVIAL(signed char) -# endif -_STLP_DECLARE_COPY_TRIVIAL(unsigned char) -_STLP_DECLARE_COPY_TRIVIAL(short) -_STLP_DECLARE_COPY_TRIVIAL(unsigned short) -_STLP_DECLARE_COPY_TRIVIAL(int) -_STLP_DECLARE_COPY_TRIVIAL(unsigned int) -_STLP_DECLARE_COPY_TRIVIAL(long) -_STLP_DECLARE_COPY_TRIVIAL(unsigned long) -# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT) -_STLP_DECLARE_COPY_TRIVIAL(wchar_t) -# endif -# if defined (_STLP_LONG_LONG) -_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG) -_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG) -# endif -_STLP_DECLARE_COPY_TRIVIAL(float) -_STLP_DECLARE_COPY_TRIVIAL(double) -# if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_DECLARE_COPY_TRIVIAL(long double) -# endif -# undef _STLP_DECLARE_COPY_TRIVIAL -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -//-------------------------------------------------- -// copy_n (not part of the C++ standard) - -#if !defined (_STLP_NO_EXTENSIONS) -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP pair<_InputIter, _OutputIter> -__copy_n(_InputIter __first, _Size __count, - _OutputIter __result, - const input_iterator_tag &) { - for ( ; __count > 0; --__count) { - *__result = *__first; - ++__first; - ++__result; - } - return pair<_InputIter, _OutputIter>(__first, __result); -} - -template -inline pair<_RAIter, _OutputIter> -__copy_n(_RAIter __first, _Size __count, - _OutputIter __result, - const random_access_iterator_tag &) { - _RAIter __last = __first + __count; - return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline pair<_InputIter, _OutputIter> -copy_n(_InputIter __first, _Size __count, _OutputIter __result) { - _STLP_FIX_LITERAL_BUG(__first) - return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); -} -#endif - -//-------------------------------------------------- -// fill and fill_n -template -_STLP_INLINE_LOOP -void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - *__first = __val; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP -_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) { - _STLP_FIX_LITERAL_BUG(__first) - for ( ; __n > 0; --__n, ++__first) - *__first = __val; - return __first; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_STLP_INLINE_LOOP -void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) { - _STLP_FIX_LITERAL_BUG(__first) - _STLP_PRIV __fill_n(__first, __n, __val); -} - -// Specialization: for one-byte types we can use memset. -inline void fill(unsigned char* __first, unsigned char* __last, - const unsigned char& __val) { - unsigned char __tmp = __val; - memset(__first, __tmp, __last - __first); -} -#if !defined (_STLP_NO_SIGNED_BUILTINS) -inline void fill(signed char* __first, signed char* __last, - const signed char& __val) { - signed char __tmp = __val; - memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); -} -#endif -inline void fill(char* __first, char* __last, const char& __val) { - char __tmp = __val; - memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); -} - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline unsigned char* __fill_n(unsigned char* __first, _Size __n, - const unsigned char& __val) { - fill(__first, __first + __n, __val); - return __first + __n; -} - -template -inline signed char* __fill_n(char* __first, _Size __n, - const signed char& __val) { - fill(__first, __first + __n, __val); - return __first + __n; -} - -template -inline char* __fill_n(char* __first, _Size __n, const char& __val) { - fill(__first, __first + __n, __val); - return __first + __n; -} - -_STLP_MOVE_TO_STD_NAMESPACE -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - - -//-------------------------------------------------- -// equal and mismatch - -template -_STLP_INLINE_LOOP -pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, - _InputIter1 __last1, - _InputIter2 __first2) { - _STLP_FIX_LITERAL_BUG(__first2) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - while (__first1 != __last1 && *__first1 == *__first2) { - ++__first1; - ++__first2; - } - return pair<_InputIter1, _InputIter2>(__first1, __first2); -} - -template -_STLP_INLINE_LOOP -pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, - _InputIter1 __last1, - _InputIter2 __first2, - _BinaryPredicate __binary_pred) { - _STLP_FIX_LITERAL_BUG(__first2) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { - ++__first1; - ++__first2; - } - return pair<_InputIter1, _InputIter2>(__first1, __first2); -} - -template -_STLP_INLINE_LOOP -bool equal(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2) { - _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2) - if (!(*__first1 == *__first2)) - return false; - return true; -} - -template -_STLP_INLINE_LOOP -bool equal(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _BinaryPredicate __binary_pred) { - _STLP_FIX_LITERAL_BUG(__first2) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2) - if (!__binary_pred(*__first1, *__first2)) - return false; - return true; -} - -//-------------------------------------------------- -// lexicographical_compare and lexicographical_compare_3way. -// (the latter is not part of the C++ standard.) - -template -bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2); - -template -bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _Compare __comp); - -inline bool -lexicographical_compare(const unsigned char* __first1, - const unsigned char* __last1, - const unsigned char* __first2, - const unsigned char* __last2) { - const size_t __len1 = __last1 - __first1; - const size_t __len2 = __last2 - __first2; - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - - const int __result = memcmp(__first1, __first2, (min) (__len1, __len2)); - return __result != 0 ? (__result < 0) : (__len1 < __len2); -} - - -#if !(CHAR_MAX == SCHAR_MAX) -inline bool lexicographical_compare(const char* __first1, const char* __last1, - const char* __first2, const char* __last2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) - - return lexicographical_compare((const unsigned char*) __first1, - (const unsigned char*) __last1, - (const unsigned char*) __first2, - (const unsigned char*) __last2); -} -#endif /* CHAR_MAX == SCHAR_MAX */ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2); - -inline int -__lexicographical_compare_3way(const unsigned char* __first1, - const unsigned char* __last1, - const unsigned char* __first2, - const unsigned char* __last2) { - const ptrdiff_t __len1 = __last1 - __first1; - const ptrdiff_t __len2 = __last2 - __first2; - const int __result = memcmp(__first1, __first2, (min) (__len1, __len2)); - return __result != 0 ? __result - : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); -} - - -#if !(CHAR_MAX == SCHAR_MAX) -inline int -__lexicographical_compare_3way(const char* __first1, const char* __last1, - const char* __first2, const char* __last2) { - return __lexicographical_compare_3way((const unsigned char*) __first1, - (const unsigned char*) __last1, - (const unsigned char*) __first2, - (const unsigned char*) __last2); -} -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -#if !defined (_STLP_NO_EXTENSIONS) -template -int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2); - -#endif /* EXTENSIONS */ - -// count -template -_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter) -count(_InputIter __first, _InputIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; - for ( ; __first != __last; ++__first) - if (*__first == __val) - ++__n; - return __n; -} - -// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available. -template -_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val); - -template -_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred); - -// search. -template -_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate); - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// find_first_of -template -_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2, - _BinaryPredicate __comp); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_ForwardIter1 -find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, - _ForwardIter2 __first2, _ForwardIter2 __last2, - _BinaryPredicate __comp); - -// replace -template -_STLP_INLINE_LOOP void -replace(_ForwardIter __first, _ForwardIter __last, - const _Tp& __old_value, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - if (*__first == __old_value) - *__first = __new_value; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*); - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_ALGOBASE_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_alloc.c b/SDK/stlport/stl/_alloc.c deleted file mode 100644 index ad6656c4..00000000 --- a/SDK/stlport/stl/_alloc.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_ALLOC_C -#define _STLP_ALLOC_C - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#if defined (__WATCOMC__) -# pragma warning 13 9 -# pragma warning 367 9 -# pragma warning 368 9 -#endif - -_STLP_BEGIN_NAMESPACE - -template -void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) { - size_t __total_extra = __extra_before_chunk() + __extra_after_chunk(); - size_t __real_n = __n + __total_extra; - if (__real_n < __n) { - //It means that we rolled on size_t, __n must be very large, lets hope - //that allocating it will raised a bad_alloc exception: - __real_n = __n + (__total_extra - __real_n - 1); - } - __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n); - memset((char*)__result, __shred_byte, __real_n * sizeof(value_type)); - __result->__magic = __magic; - __result->__type_size = sizeof(value_type); - __result->_M_size = (_STLP_UINT32_T)__n; - return ((char*)__result) + (long)__extra_before; -} - -template -void _STLP_CALL -__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) { - __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before); - // check integrity - _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE) - _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED) - _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH) - _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH) - // check pads on both sides - unsigned char* __tmp; - for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) { - _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN) - } - - size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk(); - - for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type); - __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) { - _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN) - } - - // that may be unfortunate, just in case - __real_p->__magic = __deleted_magic; - memset((char*)__p, __shred_byte, __n * sizeof(value_type)); - __allocator_type::deallocate(__real_p, __real_n); -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_ALLOC_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_alloc.h b/SDK/stlport/stl/_alloc.h deleted file mode 100644 index bd2b1bc6..00000000 --- a/SDK/stlport/stl/_alloc.h +++ /dev/null @@ -1,665 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ALLOC_H -#define _STLP_INTERNAL_ALLOC_H - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -#if !defined (_STLP_DEBUG_H) && (defined(_STLP_DEBUG) || defined(_STLP_ASSERTIONS) || defined(_STLP_DEBUG_ALLOC)) -# include -#endif - -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -#ifndef _STLP_INTERNAL_CSTRING -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef __THROW_BAD_ALLOC -# if !defined(_STLP_USE_EXCEPTIONS) -# ifndef _STLP_INTERNAL_CSTDIO -# include -# endif -# define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1) -# else -# define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc() -# endif -#endif - -#ifndef _STLP_INTERNAL_NEW_HEADER -# include -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -#if !defined (__ALLOC) -# define __ALLOC __sgi_alloc -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_USE_RAW_SGI_ALLOCATORS) -template struct __allocator; -#endif - -// Malloc-based allocator. Typically slower than default alloc below. -// Typically thread-safe and more storage efficient. - -#if !defined (_STLP_USE_NO_IOSTREAMS) -typedef void (* __oom_handler_type)(); -#endif - -class _STLP_CLASS_DECLSPEC __malloc_alloc { -public: - // this one is needed for proper simple_alloc wrapping - typedef char value_type; -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS) - template struct rebind { - typedef __allocator<_Tp1, __malloc_alloc> other; - }; -#endif - static void* _STLP_CALL allocate(size_t& __n) -#if !defined (_STLP_USE_NO_IOSTREAMS) - ; -#else - { - void *__result = malloc(__n); -# if defined (_STLP_MALLOC_USABLE_SIZE) - if (__result != 0) { - __n = _STLP_MALLOC_USABLE_SIZE(__result); - } -# endif - if (__result == 0) { - __THROW_BAD_ALLOC; - } - return __result; - } -#endif - - static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); } -#if !defined (_STLP_USE_NO_IOSTREAMS) - static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f); -#endif -}; - -// New-based allocator. Typically slower than default alloc below. -// Typically thread-safe and more storage efficient. -class _STLP_CLASS_DECLSPEC __new_alloc { -public: - // this one is needed for proper simple_alloc wrapping - typedef char value_type; -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS) - template struct rebind { - typedef __allocator<_Tp1, __new_alloc > other; - }; -#endif - static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); } - static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); } -}; - - -// Allocator adaptor to check size arguments for debugging. -// Reports errors using assert. Checking can be disabled with -// NDEBUG, but it's far better to just use the underlying allocator -// instead when no checking is desired. -// There is some evidence that this can confuse Purify. -// This adaptor can only be applied to raw allocators - -template -class __debug_alloc : public _Alloc { -public: - typedef _Alloc __allocator_type; - typedef typename _Alloc::value_type value_type; -private: - struct __alloc_header { - size_t __magic: 16; - size_t __type_size:16; - _STLP_UINT32_T _M_size; - }; // that is 8 bytes for sure - // Sunpro CC has bug on enums, so extra_before/after set explicitly - enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd, - __shred_byte = _STLP_SHRED_BYTE }; - - enum { __extra_before = 16, __extra_after = 8 }; - // Size of space used to store size. Note - // that this must be large enough to preserve - // alignment. - static size_t _STLP_CALL __extra_before_chunk() { - return (long)__extra_before / sizeof(value_type) + - (size_t)((long)__extra_before % sizeof(value_type) > 0); - } - static size_t _STLP_CALL __extra_after_chunk() { - return (long)__extra_after / sizeof(value_type) + - (size_t)((long)__extra_after % sizeof(value_type) > 0); - } -public: -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS) - template struct rebind { - typedef __allocator< _Tp1, __debug_alloc<_Alloc> > other; - }; -#endif - __debug_alloc() {} - ~__debug_alloc() {} - static void* _STLP_CALL allocate(size_t); - static void _STLP_CALL deallocate(void *, size_t); -}; - -# if defined (__OS400__) || defined (_WIN64) -enum {_ALIGN = 16, _ALIGN_SHIFT = 4, _MAX_BYTES = 256}; -# else -enum {_ALIGN = 8, _ALIGN_SHIFT = 3, _MAX_BYTES = 128}; -# endif /* __OS400__ */ - -#if !defined (_STLP_USE_NO_IOSTREAMS) -// Default node allocator. -// With a reasonable compiler, this should be roughly as fast as the -// original STL class-specific allocators, but with less fragmentation. -class _STLP_CLASS_DECLSPEC __node_alloc { - static void * _STLP_CALL _M_allocate(size_t& __n); - /* __p may not be 0 */ - static void _STLP_CALL _M_deallocate(void *__p, size_t __n); - -public: - // this one is needed for proper simple_alloc wrapping - typedef char value_type; -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS) - template struct rebind { - typedef __allocator<_Tp1, __node_alloc> other; - }; -# endif - /* __n must be > 0 */ - static void* _STLP_CALL allocate(size_t& __n) - { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); } - /* __p may not be 0 */ - static void _STLP_CALL deallocate(void *__p, size_t __n) - { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); } -}; - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>; -# endif - -#endif /* _STLP_USE_NO_IOSTREAMS */ - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>; -_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>; -#endif - -/* macro to convert the allocator for initialization - * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */ -#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is - * not used implicitly to convert allocator parameter, so let us do it explicitly */ -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS) -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) -# else -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a -# endif -/* else convert, but only if partial specialization works, since else - * Container::allocator_type won't be different */ -#else -# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) -#endif /* _STLP_MEMBER_TEMPLATES || !_STLP_CLASS_PARTIAL_SPECIALIZATION */ - -// Another allocator adaptor: _Alloc_traits. This serves two -// purposes. First, make it possible to write containers that can use -// either SGI-style allocators or standard-conforming allocator. - -// The fully general version. -template -struct _Alloc_traits { - typedef _Allocator _Orig; -#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) - typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type; - typedef typename _Rebind_type::other allocator_type; - static allocator_type create_allocator(const _Orig& __a) - { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); } -#else - // this is not actually true, used only to pass this type through - // to dynamic overload selection in _STLP_alloc_proxy methods - typedef _Allocator allocator_type; -#endif /* !_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ -}; - -#if defined (_STLP_USE_PERTHREAD_ALLOC) - -_STLP_END_NAMESPACE - -// include additional header here -# include - -_STLP_BEGIN_NAMESPACE - -# if defined (_STLP_DEBUG_ALLOC) -typedef __debug_alloc<__pthread_alloc> __sgi_alloc; -# else -typedef __pthread_alloc __sgi_alloc; -# endif /* _STLP_DEBUG_ALLOC */ - -typedef __pthread_alloc __single_client_alloc; -typedef __pthread_alloc __multithreaded_alloc; - -#else /* _STLP_USE_PERTHREAD_ALLOC */ - -# if defined (_STLP_USE_NEWALLOC) - -# if defined (_STLP_DEBUG_ALLOC) -typedef __debug_alloc<__new_alloc> __sgi_alloc; -# else -typedef __new_alloc __sgi_alloc; -# endif /* _STLP_DEBUG_ALLOC */ - -typedef __new_alloc __single_client_alloc; -typedef __new_alloc __multithreaded_alloc; - -# elif defined (_STLP_USE_MALLOC) - -# if defined (_STLP_DEBUG_ALLOC) -typedef __debug_alloc<__malloc_alloc> __sgi_alloc; -# else -typedef __malloc_alloc __sgi_alloc; -# endif /* _STLP_DEBUG_ALLOC */ - -typedef __malloc_alloc __single_client_alloc; -typedef __malloc_alloc __multithreaded_alloc; - -# else - -# if defined (_STLP_DEBUG_ALLOC) -typedef __debug_alloc<__node_alloc> __sgi_alloc; -# else -typedef __node_alloc __sgi_alloc; -# endif - -typedef __node_alloc __single_client_alloc; -typedef __node_alloc __multithreaded_alloc; - -# endif /* _STLP_USE_NEWALLOC */ -#endif /* _STLP_USE_PERTHREAD_ALLOC */ - -// This implements allocators as specified in the C++ standard. -// -// Note that standard-conforming allocators use many language features -// that are not yet widely implemented. In particular, they rely on -// member templates, partial specialization, partial ordering of function -// templates, the typename keyword, and the use of the template keyword -// to refer to a template member of a dependent type. - -/* -template -struct _AllocatorAux { - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - - pointer address(reference __x) const {return &__x;} - const_pointer address(const_reference __x) const { return &__x; } -}; - -template -struct _AllocatorAux { - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - - const_pointer address(const_reference __x) const { return &__x; } -}; -*/ - -template -class allocator //: public _AllocatorAux<_Tp> -/* A small helper struct to recognize STLport allocator implementation - * from any user specialization one. - */ - : public __stlport_class > { -public: - typedef _Tp value_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) - template struct rebind { - typedef allocator<_Tp1> other; - }; -#endif - allocator() _STLP_NOTHROW {} -#if defined (_STLP_MEMBER_TEMPLATES) - template allocator(const allocator<_Tp1>&) _STLP_NOTHROW {} -#endif - allocator(const allocator<_Tp>&) _STLP_NOTHROW {} - allocator(__move_source > src) _STLP_NOTHROW {} - ~allocator() _STLP_NOTHROW {} - pointer address(reference __x) const {return &__x;} - const_pointer address(const_reference __x) const { return &__x; } - // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - return __ret; - } - else - return 0; - } - // __p is permitted to be a null pointer, only if n==0. - void deallocate(pointer __p, size_type __n) { - _STLP_ASSERT( (__p == 0) == (__n == 0) ) - if (__p != 0) { -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); -#endif - __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type)); - } - } - // backwards compatibility - void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); } - size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); } - void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); } - void destroy(pointer __p) { _STLP_STD::_Destroy(__p); } -#if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__)) - template bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; } - template bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; } -#endif - -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - //This is just to make swap workaround for compiler without template function partial - //happy. - void swap(allocator<_Tp>&) {} -#endif - -#if defined (_STLP_NO_EXTENSIONS) - /* STLport extension giving rounded size of an allocated memory buffer - * This method do not have to be part of a user defined allocator implementation - * and won't even be called if such a function was granted. - */ -protected: -#endif - _Tp* allocate(size_type __n, size_type& __allocated_n) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - __allocated_n = __buf_size / sizeof(value_type); - return __ret; - } - else - return 0; - } -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - typedef void value_type; -#endif -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) - template struct rebind { - typedef allocator<_Tp1> other; - }; -#endif -#if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions - template bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; } - template bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; } -#endif -}; - -#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions -template inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return true; } -template inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return false; } -#endif - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS allocator; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS allocator; -# endif -# if defined (_STLP_USE_PTR_SPECIALIZATIONS) -_STLP_EXPORT_TEMPLATE_CLASS allocator; -# endif -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct __alloc_type_traits { -#if !defined (__BORLANDC__) - typedef typename _IsSTLportClass >::_Ret _STLportAlloc; -#else - enum { _Is = _IsSTLportClass >::_Is }; - typedef typename __bool2type<_Is>::_Ret _STLportAlloc; -#endif - //The default allocator implementation which is recognize thanks to the - //__stlport_class inheritance is a stateless object so: - typedef _STLportAlloc has_trivial_default_constructor; - typedef _STLportAlloc has_trivial_copy_constructor; - typedef _STLportAlloc has_trivial_assignment_operator; - typedef _STLportAlloc has_trivial_destructor; - typedef _STLportAlloc is_POD_type; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits > : _STLP_PRIV __alloc_type_traits<_Tp> {}; -#else -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; -# endif -# if defined (_STLP_USE_PTR_SPECIALIZATIONS) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; -# endif -#endif - - -#if !defined (_STLP_FORCE_ALLOCATORS) -# define _STLP_FORCE_ALLOCATORS(a,y) -#endif - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES) -// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes -template -struct _Alloc_traits<_Tp, allocator<_Tp1> > { - typedef allocator<_Tp1> _Orig; - typedef allocator<_Tp> allocator_type; - static allocator_type create_allocator(const allocator<_Tp1 >& __a) - { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); } -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES) -template -inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL -__stl_alloc_create(const _Alloc& __a, const _Tp*) { - typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type; - return _Rebound_type(__a); -} -#else -// If custom allocators are being used without member template classes support : -// user (on purpose) is forced to define rebind/get operations !!! -template -inline allocator<_Tp2>& _STLP_CALL -__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); } -template -inline allocator<_Tp2> _STLP_CALL -__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); } -#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ - -#if defined (_STLP_USE_RAW_SGI_ALLOCATORS) -// move obsolete stuff out of the way -# include -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// inheritance is being used for EBO optimization -template -class _STLP_alloc_proxy : public _MaybeReboundAlloc { -private: - typedef _MaybeReboundAlloc _Base; - typedef typename _Base::size_type size_type; - typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self; -public: - _Value _M_data; - - _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) : - _MaybeReboundAlloc(__a), _M_data(__p) {} - - _STLP_alloc_proxy (__move_source<_Self> src) : - _MaybeReboundAlloc(_STLP_PRIV _AsMoveSource<_Base>(src.get())), - _M_data(_STLP_PRIV _AsMoveSource<_Value>(src.get()._M_data)) {} - -private: - /* Following are helper methods to detect stateless allocators and avoid - * swap in this case. For some compilers (VC6) it is a workaround for a - * compiler bug in the Empty Base class Optimization feature, for others - * it is a small optimization or nothing if no EBO. */ - void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/) - {} - - void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) { - _MaybeReboundAlloc &__base_this = *this; - _MaybeReboundAlloc &__base_x = __x; - _STLP_STD::swap(__base_this, __base_x); - } - -public: - void _M_swap_alloc(_Self& __x) { -#if !defined (__BORLANDC__) - typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc; -#else - typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc; -#endif - _M_swap_alloc(__x, _StatelessAlloc()); - } - - /* We need to define the following swap implementation for allocator with state - * as those allocators might have implement a special swap function to correctly - * move datas from an instance to the oher, _STLP_alloc_proxy should not break - * this mecanism. */ - void swap(_Self& __x) { - _M_swap_alloc(__x); - _STLP_STD::swap(_M_data, __x._M_data); - } - - _Tp* allocate(size_type __n, size_type& __allocated_n) { -#if !defined (__BORLANDC__) - typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc; -#else - typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc; -#endif - return allocate(__n, __allocated_n, _STLportAlloc()); - } - - // Unified interface to perform allocate()/deallocate() with limited - // language support -#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) - // else it is rebound already, and allocate() member is accessible - _Tp* allocate(size_type __n) - { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); } - void deallocate(_Tp* __p, size_type __n) - { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); } -private: - _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/) - { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, __allocated_n); } -#else - //Expose Standard allocate overload (using expression do not work for some compilers (Borland)) - _Tp* allocate(size_type __n) - { return _Base::allocate(__n); } -private: - _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/) - { return _Base::allocate(__n, __allocated_n); } -#endif - - _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/) - { __allocated_n = __n; return allocate(__n); } -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; -# endif -# if defined (_STLP_USE_PTR_SPECIALIZATIONS) -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; -# endif -#endif - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_ALLOC_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_alloc_old.h b/SDK/stlport/stl/_alloc_old.h deleted file mode 100644 index 4627243e..00000000 --- a/SDK/stlport/stl/_alloc_old.h +++ /dev/null @@ -1,287 +0,0 @@ -template -class __simple_alloc { - typedef _Alloc __alloc_type; -public: - typedef typename _Alloc::value_type __alloc_value_type; - typedef _Tp value_type; - static size_t _STLP_CALL __chunk(size_t __n) { - return (sizeof(__alloc_value_type)==sizeof(value_type)) ? __n : - ((__n*sizeof(value_type)+sizeof(__alloc_value_type)-1)/sizeof(__alloc_value_type)); - } - static _Tp* _STLP_CALL allocate(size_t __n) { return 0 == __n ? 0 : (_Tp*) __alloc_type::allocate(__chunk(__n)); } - static void _STLP_CALL deallocate(_Tp * __p, size_t __n) { - __alloc_type::deallocate((__alloc_value_type*)__p, __chunk(__n)); } -}; - -// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc) -// into a standard-conforming allocator. Note that this adaptor does -// *not* assume that all objects of the underlying alloc class are -// identical, nor does it assume that all of the underlying alloc's -// member functions are static member functions. Note, also, that -// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>. - -template -struct __allocator : public _Alloc { - typedef _Alloc __underlying_alloc; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) - template struct rebind { - typedef __allocator<_Tp1, _Alloc> other; - }; -# endif - __allocator() _STLP_NOTHROW {} - __allocator(const _Alloc& ) _STLP_NOTHROW {} - __allocator(const __allocator<_Tp, _Alloc>& __a) _STLP_NOTHROW - : _Alloc(__a) {} -# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - template - __allocator(const __allocator<_Tp1, _Alloc>& __a) _STLP_NOTHROW - : _Alloc(__a) {} -# endif -# ifdef _STLP_TRIVIAL_DESTRUCTOR_BUG - ~__allocator() _STLP_NOTHROW {} -# endif - pointer address(reference __x) const { return &__x; } - -# if !defined (__WATCOM_CPLUSPLUS__) - const_pointer address(const_reference __x) const { return &__x; } -# endif - - // __n is permitted to be 0. - _Tp* allocate(size_type __n, const void* = 0) { - if (__n > max_size()) - __THROW_BAD_ALLOC; - return __n != 0 - ? __STATIC_CAST(_Tp*,__underlying_alloc::allocate(__n * sizeof(_Tp))) - : 0; - } - - // __p is not permitted to be a null pointer. - void deallocate(pointer __p, size_type __n) - { if (__p) __underlying_alloc::deallocate(__p, __n * sizeof(_Tp)); } - - size_type max_size() const _STLP_NOTHROW - { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); } - void destroy(pointer __p) { _STLP_STD::_Destroy(__p); } - - const __underlying_alloc& __get_underlying_alloc() const { return *this; } -}; - -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION -template -class __allocator { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; -#ifdef _STLP_MEMBER_TEMPLATE_CLASSES - template struct rebind { - typedef __allocator<_Tp1, _Alloc> other; - }; -#endif -}; -#endif - -template -inline bool _STLP_CALL operator==(const __allocator<_Tp, _Alloc>& __a1, - const __allocator<_Tp, _Alloc>& __a2) -{ - return __a1.__get_underlying_alloc() == __a2.__get_underlying_alloc(); -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE -template -inline bool _STLP_CALL operator!=(const __allocator<_Tp, _Alloc>& __a1, - const __allocator<_Tp, _Alloc>& __a2) -{ - return __a1.__get_underlying_alloc() != __a2.__get_underlying_alloc(); -} -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - - -// Comparison operators for all of the predifined SGI-style allocators. -// This ensures that __allocator (for example) will -// work correctly. - -#ifndef _STLP_NON_TYPE_TMPL_PARAM_BUG -inline bool _STLP_CALL operator==(const __malloc_alloc&, const __malloc_alloc&) -{ return true; } - -# ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -inline bool _STLP_CALL operator!=(const __malloc_alloc&, const __malloc_alloc&) -{ return false; } -# endif - -inline bool _STLP_CALL operator==(const __new_alloc&, const __new_alloc&) { return true; } - -# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE -inline bool _STLP_CALL operator!=(const __new_alloc&, const __new_alloc&) { return false; } -# endif - -# if !defined (_STLP_USE_NO_IOSTREAMS) -inline bool _STLP_CALL operator==(const __node_alloc&, - const __node_alloc&) -{ return true; } - -# if defined( _STLP_FUNCTION_TMPL_PARTIAL_ORDER ) - -inline bool _STLP_CALL operator!=(const __node_alloc&, - const __node_alloc&) -{ return false; } -# endif -# endif - -#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ - -template -inline bool _STLP_CALL operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return true; } -# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE -template -inline bool _STLP_CALL operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return false; } -# endif - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - -// Versions for the predefined SGI-style allocators. -template -struct _Alloc_traits<_Tp, __malloc_alloc> { - typedef __allocator<_Tp, __malloc_alloc> allocator_type; -}; - -# if !defined (_STLP_USE_NO_IOSTREAMS) -template -struct _Alloc_traits<_Tp, __node_alloc> { - typedef __allocator<_Tp, __node_alloc> allocator_type; -}; -# endif - -template -struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> > { - typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type; -}; - -// Versions for the __allocator adaptor used with the predefined -// SGI-style allocators. - -template -struct _Alloc_traits<_Tp, __allocator<_Tp1, _Alloc > > { - typedef __allocator<_Tp, _Alloc > allocator_type; -}; - -#endif - -#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) - -// Versions for the predefined SGI-style allocators. - - -# if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) - -typedef __malloc_alloc __malloc_alloc_dfl; - -template -inline __allocator<_Tp, __malloc_alloc_dfl >& _STLP_CALL -__stl_alloc_rebind(__malloc_alloc_dfl& __a, const _Tp*) { - return (__allocator<_Tp, __malloc_alloc_dfl >&)__a; -} - -# if !defined (_STLP_USE_NO_IOSTREAMS) -template -inline __allocator<_Tp, __node_alloc>& _STLP_CALL -__stl_alloc_rebind(__node_alloc& __a, const _Tp*) { - return (__allocator<_Tp, __node_alloc>&)__a; -} -# endif - -template -inline __allocator<_Tp, __malloc_alloc_dfl > _STLP_CALL -__stl_alloc_create(const __malloc_alloc_dfl&, const _Tp*) { - return __allocator<_Tp, __malloc_alloc_dfl > (); -} - -# if !defined (_STLP_USE_NO_IOSTREAMS) -template -inline __allocator<_Tp, __node_alloc> _STLP_CALL -__stl_alloc_create(const __node_alloc&, const _Tp*) { - return __allocator<_Tp, __node_alloc>(); -} - -# endif - -# else - -template -inline __allocator<_Tp, __malloc_alloc>& _STLP_CALL -__stl_alloc_rebind(__malloc_alloc& __a, const _Tp*) { - return (__allocator<_Tp, __malloc_alloc>&)__a; -} - -# if !defined (_STLP_USE_NO_IOSTREAMS) -template -inline __allocator<_Tp, __node_alloc>& _STLP_CALL -__stl_alloc_rebind(__node_alloc& __a, const _Tp*) { - return (__allocator<_Tp, __node_alloc>&)__a; -} -# endif - -template -inline __allocator<_Tp, __malloc_alloc> _STLP_CALL -__stl_alloc_create(const __malloc_alloc&, const _Tp*) { - return __allocator<_Tp, __malloc_alloc>(); -} - -# if !defined (_STLP_USE_NO_IOSTREAMS) -template -inline __allocator<_Tp, __node_alloc> _STLP_CALL -__stl_alloc_create(const __node_alloc&, const _Tp*) { - return __allocator<_Tp, __node_alloc>(); -} -# endif - -# endif - -template -inline __allocator<_Tp, __debug_alloc<_Alloc> > _STLP_CALL -__stl_alloc_create(const __debug_alloc<_Alloc>&, const _Tp*) { - return __allocator<_Tp, __debug_alloc<_Alloc> >(); -} -template -inline __allocator<_Tp, __debug_alloc<_Alloc> >& _STLP_CALL -__stl_alloc_rebind(__debug_alloc<_Alloc>& __a, const _Tp*) { - return (__allocator<_Tp, __debug_alloc<_Alloc> >&)__a; -} - -template -inline __allocator<_Tp, __new_alloc > _STLP_CALL -__stl_alloc_create(const __new_alloc&, const _Tp*) { - return __allocator<_Tp, __new_alloc >(); -} -template -inline __allocator<_Tp, __new_alloc >& _STLP_CALL -__stl_alloc_rebind(__new_alloc& __a, const _Tp*) { - return (__allocator<_Tp, __new_alloc >&)__a; -} - -template -inline __allocator<_Tp2, _Alloc>& _STLP_CALL -__stl_alloc_rebind(__allocator<_Tp1, _Alloc>& __a, const _Tp2*) { - return (__allocator<_Tp2, _Alloc>&)__a; -} - -template -inline __allocator<_Tp2, _Alloc> _STLP_CALL -__stl_alloc_create(const __allocator<_Tp1, _Alloc>&, const _Tp2*) { - return __allocator<_Tp2, _Alloc>(); -} -#endif diff --git a/SDK/stlport/stl/_auto_ptr.h b/SDK/stlport/stl/_auto_ptr.h deleted file mode 100644 index 715130a5..00000000 --- a/SDK/stlport/stl/_auto_ptr.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_AUTO_PTR_H -# define _STLP_AUTO_PTR_H - -_STLP_BEGIN_NAMESPACE -// implementation primitive -class __ptr_base { -public: - void* _M_p; - void __set(const void* p) { _M_p = __CONST_CAST(void*,p); } - void __set(void* p) { _M_p = p; } -}; - -template -class auto_ptr_ref { -public: - __ptr_base& _M_r; - _Tp* const _M_p; - - auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { } - - _Tp* release() const { _M_r.__set((void*)0); return _M_p; } - -private: - //explicitely defined as private to avoid warnings: - typedef auto_ptr_ref<_Tp> _Self; - _Self& operator = (_Self const&); -}; - -template -class auto_ptr : public __ptr_base { -public: - typedef _Tp element_type; - typedef auto_ptr<_Tp> _Self; - - _Tp* release() _STLP_NOTHROW { - _Tp* __px = this->get(); - this->_M_p = 0; - return __px; - } - - void reset(_Tp* __px = 0) _STLP_NOTHROW { - _Tp* __pt = this->get(); - if (__px != __pt) - delete __pt; - this->__set(__px); - } - - _Tp* get() const _STLP_NOTHROW - { return __REINTERPRET_CAST(_Tp*,__CONST_CAST(void*,_M_p)); } - -#if !defined (_STLP_NO_ARROW_OPERATOR) - _Tp* operator->() const _STLP_NOTHROW { - _STLP_VERBOSE_ASSERT(get()!=0, _StlMsg_AUTO_PTR_NULL) - return get(); - } -#endif - _Tp& operator*() const _STLP_NOTHROW { - _STLP_VERBOSE_ASSERT(get()!= 0, _StlMsg_AUTO_PTR_NULL) - return *get(); - } - - explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS) - template auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW { - _Tp* __conversionCheck = __r.release(); - this->__set(__conversionCheck); - } -# endif - template auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW { - _Tp* __conversionCheck = __r.release(); - reset(__conversionCheck); - return *this; - } -#endif - - auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); } - - _Self& operator=(_Self& __r) _STLP_NOTHROW { - reset(__r.release()); - return *this; - } - - ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); } - - auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW - { this->__set(__r.release()); } - - _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW { - reset(__r.release()); - return *this; - } - -#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS) - template operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW - { return auto_ptr_ref<_Tp1>(*this, this->get()); } - template operator auto_ptr<_Tp1>() _STLP_NOTHROW - { return auto_ptr<_Tp1>(release()); } -#else - operator auto_ptr_ref<_Tp>() _STLP_NOTHROW - { return auto_ptr_ref<_Tp>(*this, this->get()); } -#endif -}; -_STLP_END_NAMESPACE - -#endif /* _STLP_AUTO_PTR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_bitset.c b/SDK/stlport/stl/_bitset.c deleted file mode 100644 index 82b9312d..00000000 --- a/SDK/stlport/stl/_bitset.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_BITSET_C -#define _STLP_BITSET_C - -#ifndef _STLP_BITSET_H -# include -#endif - -#define __BITS_PER_WORD (CHAR_BIT * sizeof(unsigned long)) - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE -// -// Definitions of non-inline functions from _Base_bitset. -// -template -void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) { - if (__shift != 0) { - const size_t __wshift = __shift / __BITS_PER_WORD; - const size_t __offset = __shift % __BITS_PER_WORD; - - if (__offset == 0) - for (size_t __n = _Nw - 1; __n >= __wshift; --__n) - _M_w[__n] = _M_w[__n - __wshift]; - - else { - const size_t __sub_offset = __BITS_PER_WORD - __offset; - for (size_t __n = _Nw - 1; __n > __wshift; --__n) - _M_w[__n] = (_M_w[__n - __wshift] << __offset) | - (_M_w[__n - __wshift - 1] >> __sub_offset); - _M_w[__wshift] = _M_w[0] << __offset; - } - - fill(_M_w + 0, _M_w + __wshift, __STATIC_CAST(_WordT,0)); - } -} - -template -void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) { - if (__shift != 0) { - const size_t __wshift = __shift / __BITS_PER_WORD; - const size_t __offset = __shift % __BITS_PER_WORD; - const size_t __limit = _Nw - __wshift - 1; - - if (__offset == 0) - for (size_t __n = 0; __n <= __limit; ++__n) - _M_w[__n] = _M_w[__n + __wshift]; - - else { - const size_t __sub_offset = __BITS_PER_WORD - __offset; - for (size_t __n = 0; __n < __limit; ++__n) - _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | - (_M_w[__n + __wshift + 1] << __sub_offset); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - } - - fill(_M_w + __limit + 1, _M_w + _Nw, __STATIC_CAST(_WordT,0)); - } -} - -template -unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const { - for (size_t __i = 1; __i < _Nw; ++__i) - if (_M_w[__i]) - __stl_throw_overflow_error("bitset"); - return _M_w[0]; -} // End _M_do_to_ulong - -template -size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _WordT __thisword = _M_w[__i]; - if ( __thisword != __STATIC_CAST(_WordT,0) ) { - // find byte within word - for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { - unsigned char __this_byte - = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); - if ( __this_byte ) - return __i*__BITS_PER_WORD + __j*CHAR_BIT + - _Bs_G::_S_first_one(__this_byte); - - __thisword >>= CHAR_BIT; - } - } - } - // not found, so return an indication of failure. - return __not_found; -} - -template -size_t -_Base_bitset<_Nw>::_M_do_find_next(size_t __prev, - size_t __not_found) const { - // make bound inclusive - ++__prev; - - // check out of bounds - if ( __prev >= _Nw * __BITS_PER_WORD ) - return __not_found; - - // search first word - size_t __i = _S_whichword(__prev); - _WordT __thisword = _M_w[__i]; - - // mask off bits below bound - __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev); - - if ( __thisword != __STATIC_CAST(_WordT,0) ) { - // find byte within word - // get first byte into place - __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; - for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); ++__j ) { - unsigned char __this_byte - = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); - if ( __this_byte ) - return __i*__BITS_PER_WORD + __j*CHAR_BIT + - _Bs_G::_S_first_one(__this_byte); - - __thisword >>= CHAR_BIT; - } - } - - // check subsequent words - ++__i; - for ( ; __i < _Nw; ++__i ) { - /* _WordT */ __thisword = _M_w[__i]; - if ( __thisword != __STATIC_CAST(_WordT,0) ) { - // find byte within word - for ( size_t __j = 0; __j < sizeof(_WordT); ++__j ) { - unsigned char __this_byte - = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); - if ( __this_byte ) - return __i*__BITS_PER_WORD + __j*CHAR_BIT + - _Bs_G::_S_first_one(__this_byte); - - __thisword >>= CHAR_BIT; - } - } - } - - // not found, so return an indication of failure. - return __not_found; -} // end _M_do_find_next - -_STLP_MOVE_TO_STD_NAMESPACE - -#if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) - -# if !defined (_STLP_USE_NO_IOSTREAMS) - -_STLP_END_NAMESPACE - -#ifndef _STLP_STRING_IO_H -# include //includes _istream.h and _ostream.h -#endif - -_STLP_BEGIN_NAMESPACE - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { - basic_string<_CharT, _Traits> __tmp; - __tmp.reserve(_Nb); - - // Skip whitespace - typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - for (size_t __i = 0; __i < _Nb; ++__i) { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) { - __is.setstate(ios_base::eofbit); - break; - } - else { - typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); - char __c = __is.narrow(__c2, '*'); - - if (__c == '0' || __c == '1') - __tmp.push_back(__c); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { - __is.setstate(ios_base::failbit); - break; - } - } - } - - if (__tmp.empty()) - __is.setstate(ios_base::failbit); - else - __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); - } - - return __is; -} - -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, - const bitset<_Nb>& __x) { - basic_string<_CharT, _Traits> __tmp; - __x._M_copy_to_string(__tmp); - return __os << __tmp; -} - -# endif /* !_STLP_USE_NO_IOSTREAMS */ - -#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ - -_STLP_END_NAMESPACE - -#undef __BITS_PER_WORD -#undef bitset - -#endif /* _STLP_BITSET_C */ diff --git a/SDK/stlport/stl/_bitset.h b/SDK/stlport/stl/_bitset.h deleted file mode 100644 index f894346a..00000000 --- a/SDK/stlport/stl/_bitset.h +++ /dev/null @@ -1,880 +0,0 @@ -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_BITSET_H -#define _STLP_BITSET_H - -// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused -// bits. (They are the high- order bits in the highest word.) It is -// a class invariant of class bitset<> that those unused bits are -// always zero. - -// Most of the actual code isn't contained in bitset<> itself, but in the -// base class _Base_bitset. The base class works with whole words, not with -// individual bits. This allows us to specialize _Base_bitset for the -// important special case where the bitset is only a single word. - -// The C++ standard does not define the precise semantics of operator[]. -// In this implementation the const version of operator[] is equivalent -// to test(), except that it does no range checking. The non-const version -// returns a reference to a bit, again without doing any range checking. - - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -# include -#endif - -#ifndef _STLP_RANGE_ERRORS_H -# include -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long)) -#define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD) - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// structure to aid in counting bits -class _STLP_CLASS_DECLSPEC _Bs_G -{ - public: - //returns the number of bit set within the buffer between __beg and __end. - static size_t _S_count(const unsigned char *__beg, const unsigned char *__end) -#if defined (_STLP_USE_NO_IOSTREAMS) - { - size_t __result = 0; - for (; __beg != __end; ++__beg) { - for (size_t i = 0; i < (sizeof(unsigned char) * 8); ++i) { - if ((*__beg & (1 << i)) != 0) { ++__result; } - } - } - return __result; - } -#else - ; -#endif - // Mapping from 8 bit unsigned integers to the index of the first one bit set: - static unsigned char _S_first_one(unsigned char __x) -#if defined (_STLP_USE_NO_IOSTREAMS) - { - for (unsigned char i = 0; i < (sizeof(unsigned char) * 8); ++i) { - if ((__x & (1 << i)) != 0) { return i; } - } - return 0; - } -#else - ; -#endif -}; - -// -// Base class: general case. -// - -template -struct _Base_bitset { - typedef unsigned long _WordT; - - _WordT _M_w[_Nw]; // 0 is the least significant word. - - _Base_bitset() { _M_do_reset(); } - - _Base_bitset(unsigned long __val) { - _M_do_reset(); - _M_w[0] = __val; - } - - static size_t _STLP_CALL _S_whichword( size_t __pos ) { - return __pos / __BITS_PER_WORD; - } - static size_t _STLP_CALL _S_whichbyte( size_t __pos ) { - return (__pos % __BITS_PER_WORD) / CHAR_BIT; - } - static size_t _STLP_CALL _S_whichbit( size_t __pos ) { - return __pos % __BITS_PER_WORD; - } - static _WordT _STLP_CALL _S_maskbit( size_t __pos ) { - return __STATIC_CAST(_WordT,1) << _S_whichbit(__pos); - } - - _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; } - _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; } - - _WordT& _M_hiword() { return _M_w[_Nw - 1]; } - _WordT _M_hiword() const { return _M_w[_Nw - 1]; } - - void _M_do_and(const _Base_bitset<_Nw>& __x) { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _M_w[__i] &= __x._M_w[__i]; - } - } - - void _M_do_or(const _Base_bitset<_Nw>& __x) { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _M_w[__i] |= __x._M_w[__i]; - } - } - - void _M_do_xor(const _Base_bitset<_Nw>& __x) { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _M_w[__i] ^= __x._M_w[__i]; - } - } - - void _M_do_left_shift(size_t __shift); - - void _M_do_right_shift(size_t __shift); - - void _M_do_flip() { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _M_w[__i] = ~_M_w[__i]; - } - } - - void _M_do_set() { - for ( size_t __i = 0; __i < _Nw; __i++ ) { - _M_w[__i] = ~__STATIC_CAST(_WordT,0); - } - } - - void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); } - - bool _M_is_equal(const _Base_bitset<_Nw>& __x) const { - for (size_t __i = 0; __i < _Nw; ++__i) { - if (_M_w[__i] != __x._M_w[__i]) - return false; - } - return true; - } - - bool _M_is_any() const { - for ( size_t __i = 0; __i < _Nw ; __i++ ) { - if ( _M_w[__i] != __STATIC_CAST(_WordT,0) ) - return true; - } - return false; - } - - size_t _M_do_count() const { - const unsigned char* __byte_ptr = (const unsigned char*)_M_w; - const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw); - - return _Bs_G::_S_count(__byte_ptr, __end_ptr); - } - - unsigned long _M_do_to_ulong() const; - - // find first "on" bit - size_t _M_do_find_first(size_t __not_found) const; - - // find the next "on" bit that follows "prev" - size_t _M_do_find_next(size_t __prev, size_t __not_found) const; -}; - -// -// Base class: specialization for a single word. -// -_STLP_TEMPLATE_NULL -struct _Base_bitset<1UL> { - typedef unsigned long _WordT; - typedef _Base_bitset<1UL> _Self; - - _WordT _M_w; - - _Base_bitset( void ) : _M_w(0) {} - _Base_bitset(unsigned long __val) : _M_w(__val) {} - - static size_t _STLP_CALL _S_whichword( size_t __pos ) { - return __pos / __BITS_PER_WORD ; - } - static size_t _STLP_CALL _S_whichbyte( size_t __pos ) { - return (__pos % __BITS_PER_WORD) / CHAR_BIT; - } - static size_t _STLP_CALL _S_whichbit( size_t __pos ) { - return __pos % __BITS_PER_WORD; - } - static _WordT _STLP_CALL _S_maskbit( size_t __pos ) { - return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos); - } - - _WordT& _M_getword(size_t) { return _M_w; } - _WordT _M_getword(size_t) const { return _M_w; } - - _WordT& _M_hiword() { return _M_w; } - _WordT _M_hiword() const { return _M_w; } - - void _M_do_and(const _Self& __x) { _M_w &= __x._M_w; } - void _M_do_or(const _Self& __x) { _M_w |= __x._M_w; } - void _M_do_xor(const _Self& __x) { _M_w ^= __x._M_w; } - void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; } - void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; } - void _M_do_flip() { _M_w = ~_M_w; } - void _M_do_set() { _M_w = ~__STATIC_CAST(_WordT,0); } - void _M_do_reset() { _M_w = 0; } - - bool _M_is_equal(const _Self& __x) const { - return _M_w == __x._M_w; - } - bool _M_is_any() const { - return _M_w != 0; - } - - size_t _M_do_count() const { - const unsigned char* __byte_ptr = (const unsigned char*)&_M_w; - const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w); - return _Bs_G::_S_count(__byte_ptr, __end_ptr); - } - - unsigned long _M_do_to_ulong() const { return _M_w; } - - inline size_t _M_do_find_first(size_t __not_found) const; - - // find the next "on" bit that follows "prev" - inline size_t _M_do_find_next(size_t __prev, size_t __not_found) const; -}; - - -// ------------------------------------------------------------ -// -// Definitions of should-be-non-inline functions from the single-word version of -// _Base_bitset. -// -inline size_t -_Base_bitset<1UL>::_M_do_find_first(size_t __not_found) const { - // typedef unsigned long _WordT; - _WordT __thisword = _M_w; - - if ( __thisword != __STATIC_CAST(_WordT,0) ) { - // find byte within word - for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { - unsigned char __this_byte - = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); - if ( __this_byte ) - return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte); - - __thisword >>= CHAR_BIT; - } - } - // not found, so return a value that indicates failure. - return __not_found; -} - -inline size_t -_Base_bitset<1UL>::_M_do_find_next(size_t __prev, - size_t __not_found ) const { - // make bound inclusive - ++__prev; - - // check out of bounds - if ( __prev >= __BITS_PER_WORD ) - return __not_found; - - // search first (and only) word - _WordT __thisword = _M_w; - - // mask off bits below bound - __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev); - - if ( __thisword != __STATIC_CAST(_WordT,0) ) { - // find byte within word - // get first byte into place - __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; - for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { - unsigned char __this_byte - = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); - if ( __this_byte ) - return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte); - - __thisword >>= CHAR_BIT; - } - } - - // not found, so return a value that indicates failure. - return __not_found; -} // end _M_do_find_next - - -// ------------------------------------------------------------ -// Helper class to zero out the unused high-order bits in the highest word. - -template struct _Sanitize { - static void _STLP_CALL _M_do_sanitize(unsigned long& __val) - { __val &= ~((~__STATIC_CAST(unsigned long,0)) << _Extrabits); } -}; - -_STLP_TEMPLATE_NULL struct _Sanitize<0UL> { - static void _STLP_CALL _M_do_sanitize(unsigned long) {} -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -// ------------------------------------------------------------ -// Class bitset. -// _Nb may be any nonzero number of type size_t. -template -class bitset : public _STLP_PRIV _Base_bitset<__BITSET_WORDS(_Nb) > { -public: - enum { _Words = __BITSET_WORDS(_Nb) } ; - -private: - typedef _STLP_PRIV _Base_bitset< _Words > _Base; - - void _M_do_sanitize() { - _STLP_PRIV _Sanitize<_Nb%__BITS_PER_WORD >::_M_do_sanitize(this->_M_hiword()); - } -public: - typedef unsigned long _WordT; - struct reference; - friend struct reference; - - // bit reference: - struct reference { - typedef _STLP_PRIV _Base_bitset<_Words > _Bitset_base; - typedef bitset<_Nb> _Bitset; - // friend _Bitset; - _WordT *_M_wp; - size_t _M_bpos; - - // should be left undefined - reference() {} - - reference( _Bitset& __b, size_t __pos ) { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _Bitset_base::_S_whichbit(__pos); - } - - public: - ~reference() {} - - // for b[i] = __x; - reference& operator=(bool __x) { - if ( __x ) - *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos); - - return *this; - } - - // for b[i] = b[__j]; - reference& operator=(const reference& __j) { - if ( (*(__j._M_wp) & _Bitset_base::_S_maskbit(__j._M_bpos)) ) - *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos); - - return *this; - } - - // flips the bit - bool operator~() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) == 0; } - - // for __x = b[i]; - operator bool() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) != 0; } - - // for b[i].flip(); - reference& flip() { - *_M_wp ^= _Bitset_base::_S_maskbit(_M_bpos); - return *this; - } - }; - - // 23.3.5.1 constructors: - bitset() {} - - bitset(unsigned long __val) : _STLP_PRIV _Base_bitset<_Words>(__val) { _M_do_sanitize(); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t __pos = 0) - : _STLP_PRIV _Base_bitset<_Words >() { - if (__pos > __s.size()) - __stl_throw_out_of_range("bitset"); - _M_copy_from_string(__s, __pos, - basic_string<_CharT, _Traits, _Alloc>::npos); - } - template - bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __pos, - size_t __n) - : _STLP_PRIV _Base_bitset<_Words >() { - if (__pos > __s.size()) - __stl_throw_out_of_range("bitset"); - _M_copy_from_string(__s, __pos, __n); - } -#else /* _STLP_MEMBER_TEMPLATES */ - explicit bitset(const string& __s, - size_t __pos = 0, - size_t __n = (size_t)-1) - : _STLP_PRIV _Base_bitset<_Words >() { - if (__pos > __s.size()) - __stl_throw_out_of_range("bitset"); - _M_copy_from_string(__s, __pos, __n); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - // 23.3.5.2 bitset operations: - bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) { - this->_M_do_and(__rhs); - return *this; - } - - bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) { - this->_M_do_or(__rhs); - return *this; - } - - bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) { - this->_M_do_xor(__rhs); - return *this; - } - - bitset<_Nb>& operator<<=(size_t __pos) { - this->_M_do_left_shift(__pos); - this->_M_do_sanitize(); - return *this; - } - - bitset<_Nb>& operator>>=(size_t __pos) { - this->_M_do_right_shift(__pos); - this->_M_do_sanitize(); - return *this; - } - - // - // Extension: - // Versions of single-bit set, reset, flip, test with no range checking. - // - - bitset<_Nb>& _Unchecked_set(size_t __pos) { - this->_M_getword(__pos) |= _STLP_PRIV _Base_bitset<_Words > ::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) { - if (__val) - this->_M_getword(__pos) |= this->_S_maskbit(__pos); - else - this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos); - - return *this; - } - - bitset<_Nb>& _Unchecked_reset(size_t __pos) { - this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& _Unchecked_flip(size_t __pos) { - this->_M_getword(__pos) ^= this->_S_maskbit(__pos); - return *this; - } - - bool _Unchecked_test(size_t __pos) const { - return (this->_M_getword(__pos) & this->_S_maskbit(__pos)) != __STATIC_CAST(_WordT,0); - } - - // Set, reset, and flip. - - bitset<_Nb>& set() { - this->_M_do_set(); - this->_M_do_sanitize(); - return *this; - } - - bitset<_Nb>& set(size_t __pos) { - if (__pos >= _Nb) - __stl_throw_out_of_range("bitset"); - return _Unchecked_set(__pos); - } - - bitset<_Nb>& set(size_t __pos, int __val) { - if (__pos >= _Nb) - __stl_throw_out_of_range("bitset"); - return _Unchecked_set(__pos, __val); - } - - bitset<_Nb>& reset() { - this->_M_do_reset(); - return *this; - } - - bitset<_Nb>& reset(size_t __pos) { - if (__pos >= _Nb) - __stl_throw_out_of_range("bitset"); - - return _Unchecked_reset(__pos); - } - - bitset<_Nb>& flip() { - this->_M_do_flip(); - this->_M_do_sanitize(); - return *this; - } - - bitset<_Nb>& flip(size_t __pos) { - if (__pos >= _Nb) - __stl_throw_out_of_range("bitset"); - - return _Unchecked_flip(__pos); - } - - bitset<_Nb> operator~() const { - return bitset<_Nb>(*this).flip(); - } - - // element access: - //for b[i]; - reference operator[](size_t __pos) { return reference(*this,__pos); } - bool operator[](size_t __pos) const { return _Unchecked_test(__pos); } - - unsigned long to_ulong() const { return this->_M_do_to_ulong(); } - -#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) - template - basic_string<_CharT, _Traits, _Alloc> to_string() const { - basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result); - return __result; - } -#else - string to_string() const { - string __result; - _M_copy_to_string(__result); - return __result; - } -#endif /* _STLP_EXPLICIT_FUNCTION_TMPL_ARGS */ - - size_t count() const { return this->_M_do_count(); } - - size_t size() const { return _Nb; } - - bool operator==(const bitset<_Nb>& __rhs) const { - return this->_M_is_equal(__rhs); - } - bool operator!=(const bitset<_Nb>& __rhs) const { - return !this->_M_is_equal(__rhs); - } - - bool test(size_t __pos) const { - if (__pos >= _Nb) - __stl_throw_out_of_range("bitset"); - - return _Unchecked_test(__pos); - } - - bool any() const { return this->_M_is_any(); } - bool none() const { return !this->_M_is_any(); } - - bitset<_Nb> operator<<(size_t __pos) const { - bitset<_Nb> __result(*this); - __result <<= __pos ; return __result; - } - bitset<_Nb> operator>>(size_t __pos) const { - bitset<_Nb> __result(*this); - __result >>= __pos ; return __result; - } - -#if !defined (_STLP_NO_EXTENSIONS) - // - // EXTENSIONS: bit-find operations. These operations are - // experimental, and are subject to change or removal in future - // versions. - // - - // find the index of the first "on" bit - size_t _Find_first() const - { return this->_M_do_find_first(_Nb); } - - // find the index of the next "on" bit after prev - size_t _Find_next( size_t __prev ) const - { return this->_M_do_find_next(__prev, _Nb); } -#endif - -// -// Definitions of should-be non-inline member functions. -// -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t __pos, size_t __n) { -#else - void _M_copy_from_string(const string& __s, - size_t __pos, size_t __n) { - typedef typename string::traits_type _Traits; -#endif - reset(); - size_t __tmp = _Nb; - const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos)); - for ( size_t __i= 0; __i < __Nbits; ++__i) { - typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]); - // boris : widen() ? - if (__k == '1') - set(__i); - else if (__k != '0') - __stl_throw_invalid_argument("bitset"); - } - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const -#else - void _M_copy_to_string(string& __s) const -#endif - { - __s.assign(_Nb, '0'); - - for (size_t __i = 0; __i < _Nb; ++__i) { - if (_Unchecked_test(__i)) - __s[_Nb - 1 - __i] = '1'; - } - } - -#if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T) - void _M_copy_to_string(wstring& __s) const { - __s.assign(_Nb, '0'); - - for (size_t __i = 0; __i < _Nb; ++__i) { - if (_Unchecked_test(__i)) - __s[_Nb - 1 - __i] = '1'; - } - } -#endif - -#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) - bitset<_Nb> operator&(const bitset<_Nb>& __y) const { - bitset<_Nb> __result(*this); - __result &= __y; - return __result; - } - bitset<_Nb> operator|(const bitset<_Nb>& __y) const { - bitset<_Nb> __result(*this); - __result |= __y; - return __result; - } - bitset<_Nb> operator^(const bitset<_Nb>& __y) const { - bitset<_Nb> __result(*this); - __result ^= __y; - return __result; - } -#endif -}; - -// ------------------------------------------------------------ -// -// 23.3.5.3 bitset operations: -// -#if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) -template -inline bitset<_Nb> _STLP_CALL -operator&(const bitset<_Nb>& __x, - const bitset<_Nb>& __y) { - bitset<_Nb> __result(__x); - __result &= __y; - return __result; -} - - -template -inline bitset<_Nb> _STLP_CALL -operator|(const bitset<_Nb>& __x, - const bitset<_Nb>& __y) { - bitset<_Nb> __result(__x); - __result |= __y; - return __result; -} - -template -inline bitset<_Nb> _STLP_CALL -operator^(const bitset<_Nb>& __x, - const bitset<_Nb>& __y) { - bitset<_Nb> __result(__x); - __result ^= __y; - return __result; -} - -#if !defined (_STLP_USE_NO_IOSTREAMS) - -_STLP_END_NAMESPACE - -# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \ - !(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500)) - -#ifndef _STLP_INTERNAL_IOSFWD -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x); - -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x); - -# else - -#ifndef _STLP_STRING_IO_H -# include //includes _istream.h and _ostream.h -#endif - -_STLP_BEGIN_NAMESPACE - -template -istream& _STLP_CALL -operator>>(istream& __is, bitset<_Nb>& __x) { - typedef typename string::traits_type _Traits; - string __tmp; - __tmp.reserve(_Nb); - - // Skip whitespace - typename istream::sentry __sentry(__is); - if (__sentry) { - streambuf* __buf = __is.rdbuf(); - for (size_t __i = 0; __i < _Nb; ++__i) { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) { - __is.setstate(ios_base::eofbit); - break; - } - else { - typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); - char __c = __is.narrow(__c2, '*'); - - if (__c == '0' || __c == '1') - __tmp.push_back(__c); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { - __is.setstate(ios_base::failbit); - break; - } - } - } - - if (__tmp.empty()) - __is.setstate(ios_base::failbit); - else - __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); - } - - return __is; -} - -template -ostream& _STLP_CALL -operator<<(ostream& __os, const bitset<_Nb>& __x) { - string __tmp; - __x._M_copy_to_string(__tmp); - return __os << __tmp; -} - -# if !defined (_STLP_NO_WCHAR_T) - -template -wistream& _STLP_CALL -operator>>(wistream& __is, bitset<_Nb>& __x) { - typedef typename wstring::traits_type _Traits; - wstring __tmp; - __tmp.reserve(_Nb); - - // Skip whitespace - typename wistream::sentry __sentry(__is); - if (__sentry) { - wstreambuf* __buf = __is.rdbuf(); - for (size_t __i = 0; __i < _Nb; ++__i) { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) { - __is.setstate(ios_base::eofbit); - break; - } - else { - typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); - char __c = __is.narrow(__c2, '*'); - - if (__c == '0' || __c == '1') - __tmp.push_back(__c); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { - __is.setstate(ios_base::failbit); - break; - } - } - } - - if (__tmp.empty()) - __is.setstate(ios_base::failbit); - else - __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); - } - - return __is; -} - -template -wostream& _STLP_CALL -operator<<(wostream& __os, const bitset<_Nb>& __x) { - wstring __tmp; - __x._M_copy_to_string(__tmp); - return __os << __tmp; -} - -# endif /* _STLP_NO_WCHAR_T */ -# endif -#endif - -#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ - -#undef bitset - -_STLP_END_NAMESPACE - -#undef __BITS_PER_WORD -#undef __BITSET_WORDS - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_BITSET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_bvector.h b/SDK/stlport/stl/_bvector.h deleted file mode 100644 index 1943eda5..00000000 --- a/SDK/stlport/stl/_bvector.h +++ /dev/null @@ -1,837 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_BVECTOR_H -#define _STLP_INTERNAL_BVECTOR_H - -#ifndef _STLP_INTERNAL_VECTOR_H -# include -#endif - -#define _STLP_WORD_BIT (int(CHAR_BIT*sizeof(unsigned int))) - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -struct _Bit_reference { - unsigned int* _M_p; - unsigned int _M_mask; - _Bit_reference(unsigned int* __x, unsigned int __y) - : _M_p(__x), _M_mask(__y) {} - -public: - _Bit_reference() : _M_p(0), _M_mask(0) {} - - operator bool() const { - return !(!(*_M_p & _M_mask)); - } - _Bit_reference& operator = (bool __x) { - if (__x) *_M_p |= _M_mask; - else *_M_p &= ~_M_mask; - return *this; - } - _Bit_reference& operator = (const _Bit_reference& __x) { - return *this = bool(__x); - } - bool operator == (const _Bit_reference& __x) const { - return bool(*this) == bool(__x); - } - bool operator < (const _Bit_reference& __x) const { - return !bool(*this) && bool(__x); - } - - _Bit_reference& operator |= (bool __x) { - if (__x) - *_M_p |= _M_mask; - return *this; - } - _Bit_reference& operator &= (bool __x) { - if (!__x) - *_M_p &= ~_M_mask; - return *this; - } - void flip() { *_M_p ^= _M_mask; } -}; - - -_STLP_MOVE_TO_STD_NAMESPACE - -inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) { - bool __tmp = (bool)__x; - __x = __y; - __y = __tmp; -} - -// Might not be very useful but costs nothing! -_STLP_TEMPLATE_NULL -struct __type_traits<_STLP_PRIV _Bit_reference> { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __false_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -struct _Bit_iterator_base { - typedef ptrdiff_t difference_type; - - unsigned int* _M_p; - unsigned int _M_offset; - - void _M_bump_up() { - if (_M_offset++ == _STLP_WORD_BIT - 1) { - _M_offset = 0; - ++_M_p; - } - } - - void _M_bump_down() { - if (_M_offset-- == 0) { - _M_offset = _STLP_WORD_BIT - 1; - --_M_p; - } - } - - _Bit_iterator_base() : _M_p(0), _M_offset(0) {} - _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {} -// see comment in doc/README.evc4 and doc/README.evc8 -#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG) - _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {} -#endif - // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; } - - void _M_advance (difference_type __i) { - difference_type __n = __i + _M_offset; - _M_p += __n / _STLP_WORD_BIT; - __n = __n % _STLP_WORD_BIT; - if (__n < 0) { - _M_offset = (unsigned int) __n + _STLP_WORD_BIT; - --_M_p; - } else - _M_offset = (unsigned int) __n; - } - - difference_type _M_subtract(const _Bit_iterator_base& __x) const { - return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; - } -}; - -inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset; -} -inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset; -} - -inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset); -} - -inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return operator <(__y , __x); -} -inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return !(__y < __x); -} -inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { - return !(__x < __y); -} - -template -struct _Bit_iter : public _Bit_iterator_base { - typedef _Ref reference; - typedef _Ptr pointer; - typedef _Bit_iter<_Ref, _Ptr> _Self; - typedef random_access_iterator_tag iterator_category; - typedef bool value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - - _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {} - _Bit_iter() {} - - _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x): - _Bit_iterator_base((const _Bit_iterator_base&)__x) {} - - // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x) - // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; } - - reference operator*() const { - return _Bit_reference(_M_p, 1UL << _M_offset); - } - _Self& operator++() { - _M_bump_up(); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - _M_bump_up(); - return __tmp; - } - _Self& operator--() { - _M_bump_down(); - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - _M_bump_down(); - return __tmp; - } - _Self& operator+=(difference_type __i) { - _M_advance(__i); - return *this; - } - _Self& operator-=(difference_type __i) { - *this += -__i; - return *this; - } - _Self operator+(difference_type __i) const { - _Self __tmp = *this; - return __tmp += __i; - } - _Self operator-(difference_type __i) const { - _Self __tmp = *this; - return __tmp -= __i; - } - difference_type operator-(const _Self& __x) const { - return _M_subtract(__x); - } - reference operator[](difference_type __i) { return *(*this + __i); } -}; - -template -inline _Bit_iter<_Ref,_Ptr> _STLP_CALL -operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) { - return __x + __n; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&) -{ return random_access_iterator_tag(); } -inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&) -{ return (ptrdiff_t*)0; } -inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&) -{ return (bool*)0; } -inline bool* value_type(const _STLP_PRIV _Bit_iter&) -{ return (bool*)0; } -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -typedef _Bit_iter _Bit_const_iterator; -typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator; - -// Bit-vector base class, which encapsulates the difference between -// old SGI-style allocators and standard-conforming allocators. -template -class _Bvector_base { - typedef _Bvector_base<_Alloc> _Self; -public: - _STLP_FORCE_ALLOCATORS(bool, _Alloc) - typedef typename _Alloc_traits::allocator_type allocator_type; - typedef unsigned int __chunk_type; - typedef typename _Alloc_traits<__chunk_type, - _Alloc>::allocator_type __chunk_allocator_type; - allocator_type get_allocator() const { - return _STLP_CONVERT_ALLOCATOR((const __chunk_allocator_type&)_M_end_of_storage, bool); - } - static allocator_type __get_dfl_allocator() { return allocator_type(); } - - _Bvector_base(const allocator_type& __a) - : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type), - (__chunk_type*)0) - {} - _Bvector_base(__move_source<_Self> src) - : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), - _M_end_of_storage(src.get()._M_end_of_storage) { - //Make the source destroyable - src.get()._M_start._M_p = 0; - } - - ~_Bvector_base() { - _M_deallocate(); - } - -protected: - - unsigned int* _M_bit_alloc(size_t __n) { - return _M_end_of_storage.allocate((__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT); - } - void _M_deallocate() { - if (_M_start._M_p) - _M_end_of_storage.deallocate(_M_start._M_p, - _M_end_of_storage._M_data - _M_start._M_p); - } - - _Bit_iterator _M_start; - _Bit_iterator _M_finish; - _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage; -}; - - -// The next few lines are confusing. What we're doing is declaring a -// partial specialization of vector if we have the necessary -// compiler support. Otherwise, we define a class bit_vector which uses -// the default allocator. - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC) -# define _STLP_VECBOOL_TEMPLATE -# define __BVEC_TMPL_HEADER template -#else -# undef _STLP_VECBOOL_TEMPLATE -# ifdef _STLP_NO_BOOL -# define __BVEC_TMPL_HEADER -# else -# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL -# endif -# if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*TY 12/17/2000 - -# define _Alloc _STLP_DEFAULT_ALLOCATOR(bool) -# else -# define _Alloc allocator -# endif -#endif - -#if defined (_STLP_DEBUG) -# define vector _STLP_NON_DBG_NAME(vector) -#endif - -#ifdef _STLP_NO_BOOL -# define __BVECTOR_QUALIFIED bit_vector -# define __BVECTOR bit_vector -#else -# ifdef _STLP_VECBOOL_TEMPLATE -# define __BVECTOR_QUALIFIED vector -# else -# define __BVECTOR_QUALIFIED vector > -# endif -# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS) -# define __BVECTOR __BVECTOR_QUALIFIED -# else -# define __BVECTOR vector -# endif -#endif - -#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -__BVEC_TMPL_HEADER -class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG) - , public __stlport_class< __BVECTOR_QUALIFIED > -#endif -{ - typedef _STLP_PRIV _Bvector_base<_Alloc > _Base; - typedef __BVECTOR_QUALIFIED _Self; -public: - typedef bool value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _STLP_PRIV _Bit_reference reference; - typedef bool const_reference; - typedef _STLP_PRIV _Bit_reference* pointer; - typedef const bool* const_pointer; - typedef random_access_iterator_tag _Iterator_category; - - typedef _STLP_PRIV _Bit_iterator iterator; - typedef _STLP_PRIV _Bit_const_iterator const_iterator; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -#ifdef _STLP_VECBOOL_TEMPLATE - typedef typename _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type; - typedef typename _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type; -#else - typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type; - typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type; -#endif - -protected: - - void _M_initialize(size_type __n) { - unsigned int* __q = this->_M_bit_alloc(__n); - this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - this->_M_finish = this->_M_start + difference_type(__n); - } - void _M_insert_aux(iterator __position, bool __x) { - if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) { - _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1, - random_access_iterator_tag(), (difference_type*)0 ); - *__position = __x; - ++this->_M_finish; - } - else { - size_type __len = size() ? 2 * size() : _STLP_WORD_BIT; - unsigned int* __q = this->_M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - *__i++ = __x; - this->_M_finish = copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - } - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_initialize_range(_InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - this->_M_start = iterator(); - this->_M_finish = iterator(); - this->_M_end_of_storage._M_data = 0; - for ( ; __first != __last; ++__first) - push_back(*__first); - } - - template - void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - size_type __n = distance(__first, __last); - _M_initialize(__n); - copy(__first, __last, this->_M_start); - } - - template - void _M_insert_range(iterator __pos, - _InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - for ( ; __first != __last; ++__first) { - __pos = insert(__pos, *__first); - ++__pos; - } - } - - template - void _M_insert_range(iterator __position, - _ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - if (__first != __last) { - size_type __n = distance(__first, __last); - if (capacity() - size() >= __n) { - _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n), - random_access_iterator_tag(), (difference_type*)0 ); - copy(__first, __last, __position); - this->_M_finish += difference_type(__n); - } - else { - size_type __len = size() + (max)(size(), __n); - unsigned int* __q = this->_M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - this->_M_finish = copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - } - } - } - -#endif /* _STLP_MEMBER_TEMPLATES */ - -public: - iterator begin() { return this->_M_start; } - const_iterator begin() const { return this->_M_start; } - iterator end() { return this->_M_finish; } - const_iterator end() const { return this->_M_finish; } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - size_type size() const { return size_type(end() - begin()); } - size_type max_size() const { return size_type(-1); } - size_type capacity() const { - return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin()); - } - bool empty() const { return begin() == end(); } - reference operator[](size_type __n) - { return *(begin() + difference_type(__n)); } - const_reference operator[](size_type __n) const - { return *(begin() + difference_type(__n)); } - - void _M_range_check(size_type __n) const { - if (__n >= this->size()) - __stl_throw_range_error("vector"); - } - - reference at(size_type __n) - { _M_range_check(__n); return (*this)[__n]; } - const_reference at(size_type __n) const - { _M_range_check(__n); return (*this)[__n]; } - - explicit __BVECTOR(const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Bvector_base<_Alloc >(__a) {} - - __BVECTOR(size_type __n, bool __val, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Bvector_base<_Alloc >(__a) { - _M_initialize(__n); - fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0); - } - - explicit __BVECTOR(size_type __n) - : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) { - _M_initialize(__n); - fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0); - } - - __BVECTOR(const _Self& __x) - : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) { - _M_initialize(__x.size()); - copy(__x.begin(), __x.end(), this->_M_start); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) { - _M_initialize(__n); - fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0); - } - - template - void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); - } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - // Check whether it's an integral type. If so, it's not an iterator. - template - __BVECTOR(_InputIterator __first, _InputIterator __last) - : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -# endif - template - __BVECTOR(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _Bvector_base<_Alloc >(__a) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -#else /* _STLP_MEMBER_TEMPLATES */ - __BVECTOR(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Bvector_base<_Alloc >(__a) { - size_type __n = distance(__first, __last); - _M_initialize(__n); - copy(__first, __last, this->_M_start); - } - __BVECTOR(const bool* __first, const bool* __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Bvector_base<_Alloc >(__a) { - size_type __n = distance(__first, __last); - _M_initialize(__n); - copy(__first, __last, this->_M_start); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - __BVECTOR(__move_source<_Self> src) - : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {} - - ~__BVECTOR() {} - - __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) { - if (&__x == this) return *this; - if (__x.size() > capacity()) { - this->_M_deallocate(); - _M_initialize(__x.size()); - } - copy(__x.begin(), __x.end(), begin()); - this->_M_finish = begin() + difference_type(__x.size()); - return *this; - } - - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void _M_fill_assign(size_t __n, bool __x) { - if (__n > size()) { - fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0); - insert(end(), __n - size(), __x); - } - else { - erase(begin() + __n, end()); - fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0); - } - } - void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&) - { _M_fill_assign((size_t) __n, (bool) __val); } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&) - { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } - - template - void _M_assign_aux(_InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - iterator __cur = begin(); - for ( ; __first != __last && __cur != end(); ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - erase(__cur, end()); - else - insert(end(), __first, __last); - } - - template - void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - size_type __len = distance(__first, __last); - if (__len < size()) - erase(copy(__first, __last, begin()), end()); - else { - _ForwardIterator __mid = __first; - advance(__mid, size()); - copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - void reserve(size_type __n) { - if (capacity() < __n) { - if (max_size() < __n) - __stl_throw_length_error("vector"); - unsigned int* __q = this->_M_bit_alloc(__n); - _STLP_PRIV _Bit_iterator __z(__q, 0); - this->_M_finish = copy(begin(), end(), __z); - this->_M_deallocate(); - this->_M_start = iterator(__q, 0); - this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - } - } - - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - void push_back(bool __x) { - if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) { - *(this->_M_finish) = __x; - ++this->_M_finish; - } - else - _M_insert_aux(end(), __x); - } - void swap(__BVECTOR_QUALIFIED& __x) { - _STLP_STD::swap(this->_M_start, __x._M_start); - _STLP_STD::swap(this->_M_finish, __x._M_finish); - this->_M_end_of_storage.swap(__x._M_end_of_storage); - } - iterator insert(iterator __position, bool __x = bool()) { - difference_type __n = __position - begin(); - if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) { - *(this->_M_finish) = __x; - ++this->_M_finish; - } - else - _M_insert_aux(__position, __x); - return begin() + __n; - } - -#if defined (_STLP_MEMBER_TEMPLATES) - - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - const __true_type&) { - _M_fill_insert(__pos, (size_type) __n, (bool) __x); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); - } - - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __position, - _InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__position, __first, __last, _Integral()); - } -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __position, - const_iterator __first, const_iterator __last) { - if (__first == __last) return; - size_type __n = distance(__first, __last); - if (capacity() - size() >= __n) { - _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n, - random_access_iterator_tag(), (difference_type*)0 ); - copy(__first, __last, __position); - this->_M_finish += __n; - } - else { - size_type __len = size() + (max)(size(), __n); - unsigned int* __q = this->_M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - this->_M_finish = copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - } - } - - void insert(iterator __position, const bool* __first, const bool* __last) { - if (__first == __last) return; - size_type __n = distance(__first, __last); - if (capacity() - size() >= __n) { - _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n, - random_access_iterator_tag(), (difference_type*)0 ); - copy(__first, __last, __position); - this->_M_finish += __n; - } - else { - size_type __len = size() + (max)(size(), __n); - unsigned int* __q = this->_M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - __i = copy(__first, __last, __i); - this->_M_finish = copy(__position, end(), __i); - this->_M_deallocate(); - this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - } - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - void _M_fill_insert(iterator __position, size_type __n, bool __x) { - if (__n == 0) return; - if (capacity() - size() >= __n) { - _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n), - random_access_iterator_tag(), (difference_type*)0 ); - fill(__position, __position + difference_type(__n), __x); - this->_M_finish += difference_type(__n); - } - else { - size_type __len = size() + (max)(size(), __n); - unsigned int* __q = this->_M_bit_alloc(__len); - iterator __i = copy(begin(), __position, iterator(__q, 0)); - fill_n(__i, __n, __x); - this->_M_finish = copy(__position, end(), __i + difference_type(__n)); - this->_M_deallocate(); - this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT; - this->_M_start = iterator(__q, 0); - } - } - - void insert(iterator __position, size_type __n, bool __x) { - _M_fill_insert(__position, __n, __x); - } - - void pop_back() { - --this->_M_finish; - } - iterator erase(iterator __position) { - if (__position + 1 != end()) - copy(__position + 1, end(), __position); - --this->_M_finish; - return __position; - } - iterator erase(iterator __first, iterator __last) { - this->_M_finish = copy(__last, end(), __first); - return __first; - } - void resize(size_type __new_size, bool __x = bool()) { - if (__new_size < size()) - erase(begin() + difference_type(__new_size), end()); - else - insert(end(), __new_size - size(), __x); - } - void flip() { - for (unsigned int* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p) - *__p = ~*__p; - } - - void clear() { erase(begin(), end()); } -}; - -#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000) -# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER -# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED -# include -# undef _STLP_TEMPLATE_CONTAINER -# undef _STLP_TEMPLATE_HEADER -#endif /* NO_BOOL */ - -#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#undef vector -#undef _Alloc -#undef _STLP_VECBOOL_TEMPLATE -#undef __BVECTOR -#undef __BVECTOR_QUALIFIED -#undef __BVEC_TMPL_HEADER - -#undef _STLP_WORD_BIT - -#endif /* _STLP_INTERNAL_BVECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_carray.h b/SDK/stlport/stl/_carray.h deleted file mode 100644 index 560bab29..00000000 --- a/SDK/stlport/stl/_carray.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_CARRAY_H -#define _STLP_CARRAY_H - -/* Purpose: Mimic a pur C array with the additionnal feature of - * being able to be used with type not default constructible. - */ - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _CArray { - _CArray (const _Tp& __val) { - for (size_t __i = 0; __i < _Nb; ++__i) { - _Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val); - } - } - - ~_CArray() { - _Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0), - __REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp))); - } - - _Tp& operator [] (size_t __i) { - _STLP_ASSERT(__i < _Nb) - return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)); - } - -private: - char _M_data[sizeof(_Tp) * _Nb]; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif //_STLP_CARRAY_H diff --git a/SDK/stlport/stl/_cctype.h b/SDK/stlport/stl/_cctype.h deleted file mode 100644 index 935c9366..00000000 --- a/SDK/stlport/stl/_cctype.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CCTYPE -#define _STLP_INTERNAL_CCTYPE - -#if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cctype) -#else -# include -#endif /* _STLP_USE_NEW_C_HEADERS */ - -#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -# if defined ( _STLP_IMPORT_VENDOR_CSTD ) -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::isalnum; -using _STLP_VENDOR_CSTD::isalpha; -using _STLP_VENDOR_CSTD::iscntrl; -using _STLP_VENDOR_CSTD::isdigit; -using _STLP_VENDOR_CSTD::isgraph; -using _STLP_VENDOR_CSTD::islower; -using _STLP_VENDOR_CSTD::isprint; -using _STLP_VENDOR_CSTD::ispunct; -using _STLP_VENDOR_CSTD::isspace; -using _STLP_VENDOR_CSTD::isupper; -using _STLP_VENDOR_CSTD::isxdigit; -using _STLP_VENDOR_CSTD::tolower; -using _STLP_VENDOR_CSTD::toupper; -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD*/ -#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ - -#endif diff --git a/SDK/stlport/stl/_check_config.h b/SDK/stlport/stl/_check_config.h deleted file mode 100644 index 9dab3ca7..00000000 --- a/SDK/stlport/stl/_check_config.h +++ /dev/null @@ -1,24 +0,0 @@ -// This file is reserved to site configuration purpose -// and should NEVER be overridden by user - -/* - * Consistency check : if we use SGI iostreams, we have to use consistent - * thread model (single-threaded or multi-threaded) with the compiled library - * - * Default is multithreaded build. If you want to build and use single-threaded - * STLport, please change _STLP_NOTHREADS configuration setting above and rebuild the library - * - */ - -# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_NO_THREADS) && !defined(_REENTRANT) - -# if defined(_MSC_VER) && !defined(__MWERKS__) && !defined (__COMO__) && !defined(_MT) -# error "Only multi-threaded runtime library may be linked with STLport!" -# endif - -// boris : you may change that to build non-threadsafe STLport library -# if defined (__BUILDING_STLPORT) /* || defined (_STLP_DEBUG) */ -# define _REENTRANT 1 -# endif - -# endif diff --git a/SDK/stlport/stl/_clocale.h b/SDK/stlport/stl/_clocale.h deleted file mode 100644 index 4ecdee83..00000000 --- a/SDK/stlport/stl/_clocale.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CLOCALE -#define _STLP_INTERNAL_CLOCALE - -#if !defined (_STLP_WCE_EVC3) - -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(clocale) -# else -# include _STLP_NATIVE_C_HEADER(locale.h) -# endif - -# if defined (_STLP_IMPORT_VENDOR_CSTD) -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::lconv; -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -using _STLP_VENDOR_CSTD::localeconv; -using _STLP_VENDOR_CSTD::setlocale; -# endif -_STLP_END_NAMESPACE -# endif - -#endif /* !_STLP_WCE_EVC3 */ - -#endif diff --git a/SDK/stlport/stl/_cmath.h b/SDK/stlport/stl/_cmath.h deleted file mode 100644 index a715f003..00000000 --- a/SDK/stlport/stl/_cmath.h +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CMATH -#define _STLP_INTERNAL_CMATH - -/* gcc do not like when a using directive appear after a function - * declaration. cmath have abs overloads and cstdlib a using directive - * so cstdlib has to be included first. - */ -#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) -#endif - -#if defined (_STLP_USE_NEW_C_HEADERS) -# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception) -# define exception __math_exception -# endif -# include _STLP_NATIVE_CPP_C_HEADER(cmath) -# if defined (_STLP_HAS_NO_NAMESPACES) -# undef exception -# endif -#else -# include -#endif - -#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \ - !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) )) -# ifndef _STLP_HAS_NO_NAMESPACES -namespace std { -# endif -extern "C" double hypot(double x, double y); -# ifndef _STLP_HAS_NO_NAMESPACES -} -# endif - -#endif - -#if defined (__sun) && defined (__GNUC__) -extern "C" { - float __cosf(float v); - float __sinf(float v); - float __atan2f(float, float); - float __coshf(float v); - float __sinhf(float v); - float __sqrtf(float v); - float __expf(float v); - float __logf(float v); - float __log10f(float v); - - long double __cosl(long double v); - long double __sinl(long double v); - long double __atan2l(long double, long double); - long double __coshl(long double v); - long double __sinhl(long double v); - long double __sqrtl(long double v); - long double __expl(long double v); - long double __logl(long double v); - long double __log10l(long double v); -} - -extern "C" { - inline float cosf(float v) { return __cosf(v); } - inline float sinf(float v) { return __sinf(v); } - inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); } - inline float coshf(float v) { return __coshf(v); } - inline float sinhf(float v) { return __sinhf(v); } - inline float sqrtf(float v) { return __sqrtf(v); } - inline float expf(float v) { return __expf(v); } - inline float logf(float v) { return __logf(v); } - inline float log10f(float v) { return __log10f(v); } - - inline long double cosl(long double v) { return __cosl(v); } - inline long double sinl(long double v) { return __sinl(v); } - inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); } - inline long double coshl(long double v) { return __coshl(v); } - inline long double sinhl(long double v) { return __sinhl(v); } - inline long double sqrtl(long double v) { return __sqrtl(v); } - inline long double expl(long double v) { return __expl(v); } - inline long double logl(long double v) { return __logl(v); } - inline long double log10l(long double v) { return __log10l(v); } -} -#endif // __sun && __GNUC__ - -#if defined (__sun) -extern "C" { -extern float __acosf(float); -extern float __asinf(float); -extern float __atanf(float); -extern float __atan2f(float, float); -extern float __ceilf(float); -extern float __cosf(float); -extern float __coshf(float); -extern float __expf(float); -extern float __fabsf(float); -extern float __floorf(float); -extern float __fmodf(float, float); -extern float __frexpf(float, int *); -extern float __ldexpf(float, int); -extern float __logf(float); -extern float __log10f(float); -extern float __modff(float, float *); -extern float __powf(float, float); -extern float __sinf(float); -extern float __sinhf(float); -extern float __sqrtf(float); -extern float __tanf(float); -extern float __tanhf(float); - -extern long double __acosl(long double); -extern long double __asinl(long double); -extern long double __atanl(long double); -extern long double __atan2l(long double, long double); -extern long double __ceill(long double); -extern long double __cosl(long double); -extern long double __coshl(long double); -extern long double __expl(long double); -extern long double __fabsl(long double); -extern long double __floorl(long double); -extern long double __fmodl(long double, long double); -extern long double __frexpl(long double, int *); -extern long double __ldexpl(long double, int); -extern long double __logl(long double); -extern long double __log10l(long double); -extern long double __modfl(long double, long double *); -extern long double __powl(long double, long double); -extern long double __sinl(long double); -extern long double __sinhl(long double); -extern long double __sqrtl(long double); -extern long double __tanl(long double); -extern long double __tanhl(long double); -} -#endif - -#if defined (__BORLANDC__) -# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD -#else -# define _STLP_CMATH_FUNC_NAMESPACE -#endif - -#if !defined (__sun) || defined (__GNUC__) -# define _STLP_MATH_INLINE(float_type, func, cfunc) \ - inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); } -# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \ - inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); } -# define _STLP_MATH_INLINE_D(float_type, func, cfunc) -# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) -#else -# ifdef __SUNPRO_CC -# define _STLP_MATH_INLINE(float_type, func, cfunc) \ - inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); } -# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \ - inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); } -# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \ - inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); } -# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \ - inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); } -# else -# error Unknown compiler for the Sun platform -# endif -#endif - -/** macros to define math functions -These macros (having an X somewhere in the name) forward to the C library's -double functions but cast the arguments and return values to the given type. */ - -#define _STLP_MATH_INLINEX(__type,func,cfunc) \ - inline __type func (__type x) \ - { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); } -#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \ - inline __type1 func (__type1 x, __type2 y) \ - { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); } -#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \ - inline __type func (__type x, __type *y) { \ - double tmp1, tmp2; \ - tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \ - *y = __STATIC_CAST(__type, tmp2); \ - return __STATIC_CAST(__type, tmp1); \ - } -#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \ - inline __type func (__type x, __type y) \ - { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); } - - -/** rough characterization of compiler and native C library -For the compiler, it can either support long double or not. If it doesn't, the -macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double -overloads. -For the native C library the question is whether it has variants with an 'f' -suffix (for float as opposed to double) or an 'l' suffix (for long double). If -the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the -long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course -the latter doesn't make sense anyway when the compiler already has no long -double support. - -Those two traits determine a) which overloads get defined and b) how they are -defined. - -Meaning of suffixes: -"" : function returning and taking a float_type -"2" : function returning a float_type and taking to float_types -"2P" : function returning a float_type and taking a float_type and a float_type* -"2PI": function returning a float_type and taking a float_type and an int* -"2I" : function returning a float_type and taking a float_Type and an int -*/ - -#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F) - // long double support and both e.g. sinl(long double) and sinf(float) - // This is the default for a correct and complete native library. -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINE(float,func,cf##f) \ - _STLP_MATH_INLINE_D(double,func,cf) \ - _STLP_MATH_INLINE(long double,func,cf##l) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2(float,float,func,cf##f) \ - _STLP_MATH_INLINE2_D(double,double,func,cf) \ - _STLP_MATH_INLINE2(long double,long double,func,cf##l) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2(float,float *,func,cf##f) \ - _STLP_MATH_INLINE2_D(double,double *,func,cf) \ - _STLP_MATH_INLINE2(long double,long double *,func,cf##l) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2(float,int *,func,cf##f) \ - _STLP_MATH_INLINE2_D(double,int *,func,cf) \ - _STLP_MATH_INLINE2(long double,int *,func,cf##l) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2(float,int,func,cf##f) \ - _STLP_MATH_INLINE2_D(double,int,func,cf) \ - _STLP_MATH_INLINE2(long double,int,func,cf##l) -#else -# if !defined (_STLP_NO_LONG_DOUBLE) -# if !defined (_STLP_NO_VENDOR_MATH_F) - // long double support and e.g. sinf(float) but not e.g. sinl(long double) -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINE(float,func,cf##f) \ - _STLP_MATH_INLINEX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2(float,float,func,cf##f) \ - _STLP_MATH_INLINE2XX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2(float,float *,func,cf##f) \ - _STLP_MATH_INLINE2PX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2(float,int *,func,cf##f) \ - _STLP_MATH_INLINE2X(long double,int *,func,cf) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2(float,int,func,cf##f) \ - _STLP_MATH_INLINE2X(long double,int,func,cf) -# elif !defined (_STLP_NO_VENDOR_MATH_L) - // long double support and e.g. sinl(long double) but not e.g. sinf(float) -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINEX(float,func,cf) \ - _STLP_MATH_INLINE(long double,func,cf##l) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2XX(float,func,cf) \ - _STLP_MATH_INLINE2(long double,long double,func,cf##l) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2PX(float,func,cf) \ - _STLP_MATH_INLINE2(long double,long double *,func,cf##l) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2X(float,int *,func,cf) \ - _STLP_MATH_INLINE2(long double,int *,func,cf##l) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2X(float,int,func,cf) \ - _STLP_MATH_INLINE2(long double,int,func,cf##l) -# else -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINEX(float,func,cf) \ - _STLP_MATH_INLINEX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2XX(float,func,cf) \ - _STLP_MATH_INLINE2XX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2PX(float,func,cf) \ - _STLP_MATH_INLINE2PX(long double,func,cf) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2X(float,int *,func,cf) \ - _STLP_MATH_INLINE2X(long double,int *,func,cf) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2X(float,int,func,cf) \ - _STLP_MATH_INLINE2X(long double,int,func,cf) -# endif -# else -# if !defined (_STLP_NO_VENDOR_MATH_F) -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINE(float,func,cf##f) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2(float,float,func,cf##f) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2(float,float *,func,cf##f) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2(float,int *,func,cf##f) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2(float,int,func,cf##f) -# else // _STLP_NO_VENDOR_MATH_F - // neither long double support nor e.g. sinf(float) functions -# define _STLP_DEF_MATH_INLINE(func,cf) \ - _STLP_MATH_INLINEX(float,func,cf) -# define _STLP_DEF_MATH_INLINE2(func,cf) \ - _STLP_MATH_INLINE2XX(float,func,cf) -# define _STLP_DEF_MATH_INLINE2P(func,cf) \ - _STLP_MATH_INLINE2PX(float,func,cf) -# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ - _STLP_MATH_INLINE2X(float,int *,func,cf) -# define _STLP_DEF_MATH_INLINE2I(func,cf) \ - _STLP_MATH_INLINE2X(float,int,func,cf) -# endif // _STLP_NO_VENDOR_MATH_F -# endif -#endif - -#if defined (_STLP_WCE) || \ - (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */) -/* - * dums: VC6 has all the required C++ functions but only define them if - * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same - * thing also when _MSC_EXTENSIONS is defined. - * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended? - */ -//We have to tell the compilers that abs, acos ... math functions are not intrinsic -//otherwise we have Internal Compiler Error in release mode... -# pragma warning(push) -# pragma warning(disable: 4162) // no function with C linkage found -# pragma warning(disable: 4163) // not available as an intrinsic function -# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh) -# if defined (_STLP_WCE) -# pragma function (ceil, floor) -# endif -# define _STLP_RESTORE_FUNCTION_INTRINSIC -#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS - -#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS) -/* In this config Borland native lib only define functions in std namespace. - * In order to have all overloads in STLport namespace we need to add the - * double overload in global namespace. We do not use a using statement to avoid - * import of invalid overload. - */ -# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func) -# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func) - -_STLP_DMATH_INLINE(acos) -_STLP_DMATH_INLINE(asin) -_STLP_DMATH_INLINE(atan) -_STLP_DMATH_INLINE2(atan2) -_STLP_DMATH_INLINE(ceil) -_STLP_DMATH_INLINE(cos) -_STLP_DMATH_INLINE(cosh) -_STLP_DMATH_INLINE(exp) -_STLP_DMATH_INLINE(fabs) -_STLP_DMATH_INLINE(floor) -_STLP_DMATH_INLINE2(fmod) -_STLP_MATH_INLINE2X(double, int*, frexp, frexp) -_STLP_MATH_INLINE2X(double, int, ldexp, ldexp) -_STLP_DMATH_INLINE(log) -_STLP_DMATH_INLINE(log10) -_STLP_MATH_INLINE2PX(double, modf, modf) -_STLP_DMATH_INLINE(sin) -_STLP_DMATH_INLINE(sinh) -_STLP_DMATH_INLINE(sqrt) -_STLP_DMATH_INLINE(tan) -_STLP_DMATH_INLINE(tanh) -_STLP_DMATH_INLINE2(pow) -_STLP_DMATH_INLINE2(hypot) - -# undef _STLP_DMATH_INLINE -# undef _STLP_DMATH_INLINE2 -#endif - -#if defined (__DMC__) -# if defined (fabs) -inline double __stlp_fabs(double __x) { return fabs(__x); } -# undef fabs -inline double fabs(double __x) { return __stlp_fabs(__x); } -# endif -# if defined (cos) -inline double __stlp_cos(double __x) { return cos(__x); } -# undef cos -inline double cos(double __x) { return __stlp_cos(__x); } -# endif -# if defined (sin) -inline double __stlp_sin(double __x) { return sin(__x); } -# undef sin -inline double sin(double __x) { return __stlp_sin(__x); } -# endif -# if defined (sqrt) -inline double __stlp_sqrt(double __x) { return sqrt(__x); } -# undef sqrt -inline double sqrt(double __x) { return __stlp_sqrt(__x); } -# endif -# if defined (ldexp) -inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); } -# undef ldexp -inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); } -# endif -#endif - -/* MSVC native lib starting with .Net 2003 has already all math functions - * in global namespace. - * HP-UX native lib has math functions in the global namespace. - */ -#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \ - (!defined (__HP_aCC) || (__HP_aCC < 30000)) -inline double abs(double __x) -{ return ::fabs(__x); } -# if !defined (__MVS__) -_STLP_DEF_MATH_INLINE(abs, fabs) -# else // __MVS__ has native long double abs? -inline float abs(float __x) { return ::fabsf(__x); } -# endif - -_STLP_DEF_MATH_INLINE(acos, acos) -_STLP_DEF_MATH_INLINE(asin, asin) -_STLP_DEF_MATH_INLINE(atan, atan) -_STLP_DEF_MATH_INLINE2(atan2, atan2) -_STLP_DEF_MATH_INLINE(ceil, ceil) -_STLP_DEF_MATH_INLINE(cos, cos) -_STLP_DEF_MATH_INLINE(cosh, cosh) -_STLP_DEF_MATH_INLINE(exp, exp) -_STLP_DEF_MATH_INLINE(fabs, fabs) -_STLP_DEF_MATH_INLINE(floor, floor) -_STLP_DEF_MATH_INLINE2(fmod, fmod) -_STLP_DEF_MATH_INLINE2PI(frexp, frexp) -_STLP_DEF_MATH_INLINE2I(ldexp, ldexp) -_STLP_DEF_MATH_INLINE(log, log) -_STLP_DEF_MATH_INLINE(log10, log10) -_STLP_DEF_MATH_INLINE2P(modf, modf) -_STLP_DEF_MATH_INLINE(sin, sin) -_STLP_DEF_MATH_INLINE(sinh, sinh) -_STLP_DEF_MATH_INLINE(sqrt, sqrt) -_STLP_DEF_MATH_INLINE(tan, tan) -_STLP_DEF_MATH_INLINE(tanh, tanh) -_STLP_DEF_MATH_INLINE2(pow, pow) - -# if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */ -# ifndef _STLP_NO_VENDOR_MATH_F -# ifndef __sun -inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); } -# else -inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); } -# endif -# else -inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); } -# endif -inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); } -# if !defined (_STLP_NO_LONG_DOUBLE) -# if !defined(_STLP_NO_VENDOR_MATH_L) -# ifndef __sun -inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); } -# else -# ifndef __SUNPRO_CC -inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); } -# else -inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); } -# endif -# endif -# else -inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); } -# endif -# endif -# else -//The MS native pow version has a bugged overload so it is not imported -//in the STLport namespace. -//Here is the bugged version: -//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); } -inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); } -inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); } -inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); } -# endif -#endif - -#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun) -# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400) -# pragma warning (push) -# pragma warning (disable : 4996) // hypot is deprecated. -# endif -_STLP_MATH_INLINE2XX(float, hypot, hypot) -inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); } -# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400) -# pragma warning (pop) -# endif -#else -# if defined (_STLP_USE_UCLIBC) -inline double hypot(double x, double y) { return sqrt(x * x + y * y); } -_STLP_DEF_MATH_INLINE2(hypot, hypot) -# elif defined (_STLP_WCE) - /* CE has a double _hypot(double,double) which we use */ -inline double hypot(double __x, double __y) { return _hypot(__x,__y); } -_STLP_DEF_MATH_INLINE2(hypot, _hypot) -# endif -#endif - -#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC) -//restoration of the default intrinsic status of those functions: -# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh) -# if defined (_STLP_WCE) -# pragma intrinsic (ceil, floor) -# endif -# pragma warning(pop) -# undef _STLP_RESTORE_FUNCTION_INTRINSIC -#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS - -/* C++ Standard is unclear about several call to 'using ::func' if new overloads - * of ::func appears between 2 successive 'using' calls. To avoid this potential - * problem we provide all abs overload before the 'using' call. - * Beware: This header inclusion has to be after all abs overload of this file. - * The first 'using ::abs' call is going to be in the other header. - */ -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -_STLP_BEGIN_NAMESPACE -using ::abs; -using ::acos; -using ::asin; -using ::atan; -using ::atan2; -using ::ceil; -using ::cos; -using ::cosh; -using ::exp; -using ::fabs; -using ::floor; -using ::fmod; -using ::frexp; -using ::hypot; -using ::ldexp; -using ::log; -using ::log10; -using ::modf; -using ::pow; -using ::sin; -using ::sinh; -using ::sqrt; -using ::tan; -using ::tanh; -_STLP_END_NAMESPACE -# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560) -using _STLP_VENDOR_CSTD::_ecvt; -using _STLP_VENDOR_CSTD::_fcvt; -# endif -#endif - -#endif /* _STLP_INTERNAL_CMATH */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_codecvt.h b/SDK/stlport/stl/_codecvt.h deleted file mode 100644 index caee7f36..00000000 --- a/SDK/stlport/stl/_codecvt.h +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_CODECVT_H -#define _STLP_INTERNAL_CODECVT_H - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class _STLP_CLASS_DECLSPEC codecvt_base { -public: - enum result {ok, partial, error, noconv}; -}; - -template -class codecvt : public locale::facet, public codecvt_base { -public: - typedef _InternT intern_type; - typedef _ExternT extern_type; - typedef _StateT state_type; - -#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) - /* For the moment VC6 do not support this facet default implementation - * because of the static locale::id instance. When VC6 see this definition - * it goes crasy with locale::id static instances and all the has_facet tests - * unit tests are failing. - */ -}; -#else - explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} - - result out(state_type& __state, - const intern_type* __from, - const intern_type* __from_end, - const intern_type*& __from_next, - extern_type* __to, - extern_type* __to_limit, - extern_type*& __to_next) const { - return do_out(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - result unshift(state_type& __state, - extern_type* __to, - extern_type* __to_limit, - extern_type*& __to_next) const { - return do_unshift(__state, __to, __to_limit, __to_next); - } - - result in(state_type& __state, - const extern_type* __from, - const extern_type* __from_end, - const extern_type*& __from_next, - intern_type* __to, - intern_type* __to_limit, - intern_type*& __to_next) const { - return do_in(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - int encoding() const _STLP_NOTHROW { return do_encoding(); } - - bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } - - int length(const state_type& __state, - const extern_type* __from, - const extern_type* __end, - size_t __max) const { - return do_length(__state, __from, __end, __max); - } - - int max_length() const _STLP_NOTHROW { return do_max_length(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~codecvt() {} - - virtual result do_out(state_type&, - const intern_type* __from, - const intern_type*, - const intern_type*& __from_next, - extern_type* __to, - extern_type*, - extern_type*& __to_next) const - { __from_next = __from; __to_next = __to; return noconv; } - - virtual result do_in (state_type&, - const extern_type* __from, - const extern_type*, - const extern_type*& __from_next, - intern_type* __to, - intern_type*, - intern_type*& __to_next) const - { __from_next = __from; __to_next = __to; return noconv; } - - virtual result do_unshift(state_type&, - extern_type* __to, - extern_type*, - extern_type*& __to_next) const - { __to_next = __to; return noconv; } - - virtual int do_encoding() const _STLP_NOTHROW - { return 1; } - - virtual bool do_always_noconv() const _STLP_NOTHROW - { return true; } - - virtual int do_length(const state_type&, - const extern_type* __from, - const extern_type* __end, - size_t __max) const - { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); } - - virtual int do_max_length() const _STLP_NOTHROW - { return 1; } - -private: - codecvt(const codecvt&); - codecvt& operator = (const codecvt&); -}; - -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# if (_STLP_STATIC_TEMPLATE_DATA > 0) -# if !defined (__BORLANDC__) -template -locale::id codecvt<_InternT, _ExternT, _StateT>::id; -# endif -# endif -# endif -#endif - -template -class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC codecvt - : public locale::facet, public codecvt_base -{ - friend class _Locale_impl; - -public: - typedef char intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} - - result out(mbstate_t& __state, - const char* __from, - const char* __from_end, - const char*& __from_next, - char* __to, - char* __to_limit, - char*& __to_next) const { - return do_out(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - result unshift(mbstate_t& __state, - char* __to, char* __to_limit, char*& __to_next) const - { return do_unshift(__state, __to, __to_limit, __to_next); } - - result in(state_type& __state, - const char* __from, - const char* __from_end, - const char*& __from_next, - char* __to, - char* __to_limit, - char*& __to_next) const { - return do_in(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - int encoding() const _STLP_NOTHROW { return do_encoding(); } - - bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } - - int length(const state_type& __state, - const char* __from, const char* __end, - size_t __max) const - { return do_length(__state, __from, __end, __max); } - - int max_length() const _STLP_NOTHROW { return do_max_length(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~codecvt(); - - virtual result do_out(mbstate_t& /* __state */, - const char* __from, - const char* /* __from_end */, - const char*& __from_next, - char* __to, - char* /* __to_limit */, - char*& __to_next) const; - - virtual result do_in (mbstate_t& /* __state */ , - const char* __from, - const char* /* __from_end */, - const char*& __from_next, - char* __to, - char* /* __to_end */, - char*& __to_next) const; - - virtual result do_unshift(mbstate_t& /* __state */, - char* __to, - char* /* __to_limit */, - char*& __to_next) const; - - virtual int do_encoding() const _STLP_NOTHROW; - virtual bool do_always_noconv() const _STLP_NOTHROW; - virtual int do_length(const mbstate_t& __state, - const char* __from, - const char* __end, - size_t __max) const; - virtual int do_max_length() const _STLP_NOTHROW; -private: - codecvt(const codecvt&); - codecvt& operator =(const codecvt&); -}; - -# ifndef _STLP_NO_WCHAR_T - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC codecvt - : public locale::facet, public codecvt_base -{ - friend class _Locale_impl; -public: - typedef wchar_t intern_type; - typedef char extern_type; - typedef mbstate_t state_type; - - explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} - - result out(mbstate_t& __state, - const wchar_t* __from, - const wchar_t* __from_end, - const wchar_t*& __from_next, - char* __to, - char* __to_limit, - char*& __to_next) const { - return do_out(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - result unshift(mbstate_t& __state, - char* __to, char* __to_limit, char*& __to_next) const { - return do_unshift(__state, __to, __to_limit, __to_next); - } - - result in(mbstate_t& __state, - const char* __from, - const char* __from_end, - const char*& __from_next, - wchar_t* __to, - wchar_t* __to_limit, - wchar_t*& __to_next) const { - return do_in(__state, - __from, __from_end, __from_next, - __to, __to_limit, __to_next); - } - - int encoding() const _STLP_NOTHROW { return do_encoding(); } - - bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } - - int length(const mbstate_t& __state, - const char* __from, const char* __end, - size_t __max) const - { return do_length(__state, __from, __end, __max); } - - int max_length() const _STLP_NOTHROW { return do_max_length(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~codecvt(); - - virtual result do_out(mbstate_t& __state, - const wchar_t* __from, - const wchar_t* __from_end, - const wchar_t*& __from_next, - char* __to, - char* __to_limit, - char*& __to_next) const; - - virtual result do_in (mbstate_t& __state, - const char* __from, - const char* __from_end, - const char*& __from_next, - wchar_t* __to, - wchar_t* __to_limit, - wchar_t*& __to_next) const; - - virtual result do_unshift(mbstate_t& __state, - char* __to, - char* __to_limit, - char*& __to_next) const; - - virtual int do_encoding() const _STLP_NOTHROW; - - virtual bool do_always_noconv() const _STLP_NOTHROW; - - virtual int do_length(const mbstate_t& __state, - const char* __from, - const char* __end, - size_t __max) const; - - virtual int do_max_length() const _STLP_NOTHROW; - -private: - codecvt(const codecvt&); - codecvt& operator = (const codecvt&); -}; - -# endif - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC codecvt_byname - : public codecvt { -public: - explicit codecvt_byname(const char* __name, size_t __refs = 0); - ~codecvt_byname(); -private: - codecvt_byname(const codecvt_byname&); - codecvt_byname& operator =(const codecvt_byname&); -}; - -# ifndef _STLP_NO_WCHAR_T -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC codecvt_byname - : public codecvt -{ -public: - explicit codecvt_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~codecvt_byname(); - - virtual result do_out(mbstate_t& __state, - const wchar_t* __from, - const wchar_t* __from_end, - const wchar_t*& __from_next, - char* __to, - char* __to_limit, - char*& __to_next) const; - - virtual result do_in (mbstate_t& __state, - const char* __from, - const char* __from_end, - const char*& __from_next, - wchar_t* __to, - wchar_t* __to_limit, - wchar_t*& __to_next) const; - - virtual result do_unshift(mbstate_t& __state, - char* __to, - char* __to_limit, - char*& __to_next) const; - - virtual int do_encoding() const _STLP_NOTHROW; - - virtual bool do_always_noconv() const _STLP_NOTHROW; - - virtual int do_length(const mbstate_t& __state, - const char* __from, - const char* __end, - size_t __max) const; - - virtual int do_max_length() const _STLP_NOTHROW; - -private: - _Locale_ctype* _M_ctype; - codecvt_byname(const codecvt_byname&); - codecvt_byname& operator =(const codecvt_byname&); -}; - -# endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_CODECVT_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_collate.h b/SDK/stlport/stl/_collate.h deleted file mode 100644 index 63e8f678..00000000 --- a/SDK/stlport/stl/_collate.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - -#ifndef _STLP_INTERNAL_COLLATE_H -#define _STLP_INTERNAL_COLLATE_H - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template class collate {}; -template class collate_byname {}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC collate : public locale::facet -{ - friend class _Locale_impl; - -public: - typedef char char_type; - typedef string string_type; - - explicit collate(size_t __refs = 0) : locale::facet(__refs) {} - - int compare(const char* __low1, const char* __high1, - const char* __low2, const char* __high2) const { - return do_compare( __low1, __high1, __low2, __high2); - } - - string_type transform(const char* __low, const char* __high) const { - return do_transform(__low, __high); - } - - long hash(const char* __low, const char* __high) const - { return do_hash(__low, __high); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~collate(); - - virtual int do_compare(const char*, const char*, - const char*, const char*) const; - virtual string_type do_transform(const char*, const char*) const; - virtual long do_hash(const char*, const char*) const; -private: - collate(const collate&); - collate& operator =(const collate&); -}; - -# ifndef _STLP_NO_WCHAR_T - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC collate : public locale::facet -{ - friend class _Locale_impl; - -public: - typedef wchar_t char_type; - typedef wstring string_type; - - explicit collate(size_t __refs = 0) : locale::facet(__refs) {} - - int compare(const wchar_t* __low1, const wchar_t* __high1, - const wchar_t* __low2, const wchar_t* __high2) const { - return do_compare( __low1, __high1, __low2, __high2); - } - - string_type transform(const wchar_t* __low, const wchar_t* __high) const { - return do_transform(__low, __high); - } - - long hash(const wchar_t* __low, const wchar_t* __high) const - { return do_hash(__low, __high); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~collate(); - - virtual int do_compare(const wchar_t*, const wchar_t*, - const wchar_t*, const wchar_t*) const; - virtual string_type do_transform(const wchar_t*, const wchar_t*) const; - virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const; -private: - collate(const collate&); - collate& operator = (const collate&); -}; - -# endif /* NO_WCHAR_T */ - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC collate_byname: public collate -{ -public: - explicit collate_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~collate_byname(); - - virtual int do_compare(const char*, const char*, - const char*, const char*) const; - virtual string_type do_transform(const char*, const char*) const; - -private: - _Locale_collate* _M_collate; - collate_byname(const collate_byname&); - collate_byname& operator =(const collate_byname&); - friend _Locale_name_hint* _Locale_extract_hint(collate_byname*); -}; - -# ifndef _STLP_NO_WCHAR_T - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC collate_byname: public collate -{ -public: - explicit collate_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~collate_byname(); - - virtual int do_compare(const wchar_t*, const wchar_t*, - const wchar_t*, const wchar_t*) const; - virtual string_type do_transform(const wchar_t*, const wchar_t*) const; - -private: - _Locale_collate* _M_collate; - collate_byname(const collate_byname&); - collate_byname& operator =(const collate_byname&); -}; - -# endif /* NO_WCHAR_T */ - -template -bool -__locale_do_operator_call (const locale& __loc, - const basic_string<_CharT, _Traits, _Alloc>& __x, - const basic_string<_CharT, _Traits, _Alloc>& __y) { - collate<_CharT> const& __coll = use_facet >(__loc); - return __coll.compare(__x.data(), __x.data() + __x.size(), - __y.data(), __y.data() + __y.size()) < 0; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_COLLATE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_complex.c b/SDK/stlport/stl/_complex.c deleted file mode 100644 index ba3260b4..00000000 --- a/SDK/stlport/stl/_complex.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_COMPLEX_C -#define _STLP_COMPLEX_C - -#ifndef _STLP_INTERNAL_COMPLEX -# include -#endif - -#if !defined (_STLP_USE_NO_IOSTREAMS) -# ifndef _STLP_INTERNAL_ISTREAM -# include -# endif - -# ifndef _STLP_INTERNAL_SSTREAM -# include -# endif - -# ifndef _STLP_STRING_IO_H -# include -# endif -#endif - -_STLP_BEGIN_NAMESPACE - -// Non-inline member functions. - -template -void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i, - const _Tp& __z2_r, const _Tp& __z2_i, - _Tp& __res_r, _Tp& __res_i) { - _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; - _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; - - if (__ar <= __ai) { - _Tp __ratio = __z2_r / __z2_i; - _Tp __denom = __z2_i * (1 + __ratio * __ratio); - __res_r = (__z1_r * __ratio + __z1_i) / __denom; - __res_i = (__z1_i * __ratio - __z1_r) / __denom; - } - else { - _Tp __ratio = __z2_i / __z2_r; - _Tp __denom = __z2_r * (1 + __ratio * __ratio); - __res_r = (__z1_r + __z1_i * __ratio) / __denom; - __res_i = (__z1_i - __z1_r * __ratio) / __denom; - } -} - -template -void complex<_Tp>::_div(const _Tp& __z1_r, - const _Tp& __z2_r, const _Tp& __z2_i, - _Tp& __res_r, _Tp& __res_i) { - _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; - _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; - - if (__ar <= __ai) { - _Tp __ratio = __z2_r / __z2_i; - _Tp __denom = __z2_i * (1 + __ratio * __ratio); - __res_r = (__z1_r * __ratio) / __denom; - __res_i = - __z1_r / __denom; - } - else { - _Tp __ratio = __z2_i / __z2_r; - _Tp __denom = __z2_r * (1 + __ratio * __ratio); - __res_r = __z1_r / __denom; - __res_i = - (__z1_r * __ratio) / __denom; - } -} - -// I/O. -#if !defined (_STLP_USE_NO_IOSTREAMS) - -// Complex output, in the form (re,im). We use a two-step process -// involving stringstream so that we get the padding right. -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) { - basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp; - __tmp.flags(__os.flags()); - __tmp.imbue(__os.getloc()); - __tmp.precision(__os.precision()); - __tmp << '(' << __z.real() << ',' << __z.imag() << ')'; - return __os << __tmp.str(); -} - -// Complex input from arbitrary streams. Note that results in some -// locales may be confusing, since the decimal character varies with -// locale and the separator between real and imaginary parts does not. - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) { - _Tp __re = 0; - _Tp __im = 0; - - // typedef ctype<_CharT> _Ctype; - // locale __loc = __is.getloc(); - //const _Ctype& __c_type = use_facet<_Ctype>(__loc); - const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __is._M_ctype_facet()); - - const char __punct[4] = "(,)"; - _CharT __wpunct[3]; - __c_type.widen(__punct, __punct + 3, __wpunct); - - _CharT __c; - - __is >> __c; - if (_Traits::eq(__c, __wpunct[0])) { // Left paren - __is >> __re >> __c; - if (_Traits::eq(__c, __wpunct[1])) // Comma - __is >> __im >> __c; - if (!_Traits::eq(__c, __wpunct[2])) // Right paren - __is.setstate(ios_base::failbit); - } - else { - __is.putback(__c); - __is >> __re; - } - - if (__is) - __z = complex<_Tp>(__re, __im); - return __is; -} - -#endif /* _STLP_USE_NO_IOSTREAMS */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_COMPLEX_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_complex.h b/SDK/stlport/stl/_complex.h deleted file mode 100644 index b320805f..00000000 --- a/SDK/stlport/stl/_complex.h +++ /dev/null @@ -1,947 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_COMPLEX -#define _STLP_INTERNAL_COMPLEX - -// This header declares the template class complex, as described in -// in the draft C++ standard. Single-precision complex numbers -// are complex, double-precision are complex, and -// quad precision are complex. - -// Note that the template class complex is declared within namespace -// std, as called for by the draft C++ standard. - -#ifndef _STLP_INTERNAL_CMATH -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround - -template struct complex; - -_STLP_TEMPLATE_NULL struct complex; -_STLP_TEMPLATE_NULL struct complex; -# if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_TEMPLATE_NULL struct complex; -# endif -#endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */ - -template -struct complex { - typedef _Tp value_type; - typedef complex<_Tp> _Self; - - // Constructors, destructor, assignment operator. - complex() : _M_re(0), _M_im(0) {} - complex(const value_type& __x) - : _M_re(__x), _M_im(0) {} - complex(const value_type& __x, const value_type& __y) - : _M_re(__x), _M_im(__y) {} - complex(const _Self& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} - - _Self& operator=(const _Self& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - -#if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS)) - template - explicit complex(const complex<_Tp2>& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} - - template - _Self& operator=(const complex<_Tp2>& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - // Element access. - value_type real() const { return _M_re; } - value_type imag() const { return _M_im; } - - // Arithmetic op= operations involving one real argument. - - _Self& operator= (const value_type& __x) { - _M_re = __x; - _M_im = 0; - return *this; - } - _Self& operator+= (const value_type& __x) { - _M_re += __x; - return *this; - } - _Self& operator-= (const value_type& __x) { - _M_re -= __x; - return *this; - } - _Self& operator*= (const value_type& __x) { - _M_re *= __x; - _M_im *= __x; - return *this; - } - _Self& operator/= (const value_type& __x) { - _M_re /= __x; - _M_im /= __x; - return *this; - } - - // Arithmetic op= operations involving two complex arguments. - - static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i, - const value_type& __z2_r, const value_type& __z2_i, - value_type& __res_r, value_type& __res_i); - - static void _STLP_CALL _div(const value_type& __z1_r, - const value_type& __z2_r, const value_type& __z2_i, - value_type& __res_r, value_type& __res_i); - -#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - - template _Self& operator+= (const complex<_Tp2>& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - template _Self& operator-= (const complex<_Tp2>& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - template _Self& operator*= (const complex<_Tp2>& __z) { - value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; - value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - template _Self& operator/= (const complex<_Tp2>& __z) { - value_type __r; - value_type __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator+= (const _Self& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - _Self& operator-= (const _Self& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - _Self& operator*= (const _Self& __z) { - value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; - value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - _Self& operator/= (const _Self& __z) { - value_type __r; - value_type __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - - // Data members. - value_type _M_re; - value_type _M_im; -}; - -#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround -// Explicit specializations for float, double, long double. The only -// reason for these specializations is to enable automatic conversions -// from complex to complex, and complex to -// complex. - -_STLP_TEMPLATE_NULL -struct _STLP_CLASS_DECLSPEC complex { - typedef float value_type; - typedef complex _Self; - // Constructors, destructor, assignment operator. - - complex(value_type __x = 0.0f, value_type __y = 0.0f) - : _M_re(__x), _M_im(__y) {} - - complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} - - inline explicit complex(const complex& __z); -# ifndef _STLP_NO_LONG_DOUBLE - inline explicit complex(const complex& __z); -# endif - // Element access. - value_type real() const { return _M_re; } - value_type imag() const { return _M_im; } - - // Arithmetic op= operations involving one real argument. - - _Self& operator= (value_type __x) { - _M_re = __x; - _M_im = 0.0f; - return *this; - } - _Self& operator+= (value_type __x) { - _M_re += __x; - return *this; - } - _Self& operator-= (value_type __x) { - _M_re -= __x; - return *this; - } - _Self& operator*= (value_type __x) { - _M_re *= __x; - _M_im *= __x; - return *this; - } - _Self& operator/= (value_type __x) { - _M_re /= __x; - _M_im /= __x; - return *this; - } - - // Arithmetic op= operations involving two complex arguments. - - static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i, - const float& __z2_r, const float& __z2_i, - float& __res_r, float& __res_i); - - static void _STLP_CALL _div(const float& __z1_r, - const float& __z2_r, const float& __z2_i, - float& __res_r, float& __res_i); - -# if defined (_STLP_MEMBER_TEMPLATES) - template - complex& operator=(const complex<_Tp2>& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - template - complex& operator+= (const complex<_Tp2>& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - template - complex& operator-= (const complex<_Tp2>& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - template - complex& operator*= (const complex<_Tp2>& __z) { - float __r = _M_re * __z._M_re - _M_im * __z._M_im; - float __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - template - complex& operator/= (const complex<_Tp2>& __z) { - float __r; - float __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - -# endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator=(const _Self& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - _Self& operator+= (const _Self& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - _Self& operator-= (const _Self& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - _Self& operator*= (const _Self& __z) { - value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; - value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - _Self& operator/= (const _Self& __z) { - value_type __r; - value_type __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - - // Data members. - value_type _M_re; - value_type _M_im; -}; - -_STLP_TEMPLATE_NULL -struct _STLP_CLASS_DECLSPEC complex { - typedef double value_type; - typedef complex _Self; - - // Constructors, destructor, assignment operator. - - complex(value_type __x = 0.0, value_type __y = 0.0) - : _M_re(__x), _M_im(__y) {} - - complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} - inline complex(const complex& __z); -# if !defined (_STLP_NO_LONG_DOUBLE) - explicit inline complex(const complex& __z); -# endif - // Element access. - value_type real() const { return _M_re; } - value_type imag() const { return _M_im; } - - // Arithmetic op= operations involving one real argument. - - _Self& operator= (value_type __x) { - _M_re = __x; - _M_im = 0.0; - return *this; - } - _Self& operator+= (value_type __x) { - _M_re += __x; - return *this; - } - _Self& operator-= (value_type __x) { - _M_re -= __x; - return *this; - } - _Self& operator*= (value_type __x) { - _M_re *= __x; - _M_im *= __x; - return *this; - } - _Self& operator/= (value_type __x) { - _M_re /= __x; - _M_im /= __x; - return *this; - } - - // Arithmetic op= operations involving two complex arguments. - - static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i, - const double& __z2_r, const double& __z2_i, - double& __res_r, double& __res_i); - static void _STLP_CALL _div(const double& __z1_r, - const double& __z2_r, const double& __z2_i, - double& __res_r, double& __res_i); - -# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - template - complex& operator=(const complex<_Tp2>& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - template - complex& operator+= (const complex<_Tp2>& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - template - complex& operator-= (const complex<_Tp2>& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - template - complex& operator*= (const complex<_Tp2>& __z) { - double __r = _M_re * __z._M_re - _M_im * __z._M_im; - double __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - template - complex& operator/= (const complex<_Tp2>& __z) { - double __r; - double __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - -# endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator=(const _Self& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - _Self& operator+= (const _Self& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - _Self& operator-= (const _Self& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - _Self& operator*= (const _Self& __z) { - value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; - value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - _Self& operator/= (const _Self& __z) { - value_type __r; - value_type __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - - // Data members. - value_type _M_re; - value_type _M_im; -}; - -# if !defined (_STLP_NO_LONG_DOUBLE) - -_STLP_TEMPLATE_NULL -struct _STLP_CLASS_DECLSPEC complex { - typedef long double value_type; - typedef complex _Self; - - // Constructors, destructor, assignment operator. - complex(value_type __x = 0.0l, value_type __y = 0.0l) - : _M_re(__x), _M_im(__y) {} - - complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} - inline complex(const complex& __z); - inline complex(const complex& __z); - - // Element access. - value_type real() const { return _M_re; } - value_type imag() const { return _M_im; } - - // Arithmetic op= operations involving one real argument. - - _Self& operator= (value_type __x) { - _M_re = __x; - _M_im = 0.0l; - return *this; - } - _Self& operator+= (value_type __x) { - _M_re += __x; - return *this; - } - _Self& operator-= (value_type __x) { - _M_re -= __x; - return *this; - } - _Self& operator*= (value_type __x) { - _M_re *= __x; - _M_im *= __x; - return *this; - } - _Self& operator/= (value_type __x) { - _M_re /= __x; - _M_im /= __x; - return *this; - } - - // Arithmetic op= operations involving two complex arguments. - - static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i, - const long double& __z2_r, const long double& __z2_i, - long double& __res_r, long double& __res_i); - - static void _STLP_CALL _div(const long double& __z1_r, - const long double& __z2_r, const long double& __z2_i, - long double& __res_r, long double& __res_i); - -# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - - template - complex& operator=(const complex<_Tp2>& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - template - complex& operator+= (const complex<_Tp2>& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - template - complex& operator-= (const complex<_Tp2>& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - template - complex& operator*= (const complex<_Tp2>& __z) { - long double __r = _M_re * __z._M_re - _M_im * __z._M_im; - long double __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - template - complex& operator/= (const complex<_Tp2>& __z) { - long double __r; - long double __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - -# endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator=(const _Self& __z) { - _M_re = __z._M_re; - _M_im = __z._M_im; - return *this; - } - - _Self& operator+= (const _Self& __z) { - _M_re += __z._M_re; - _M_im += __z._M_im; - return *this; - } - - _Self& operator-= (const _Self& __z) { - _M_re -= __z._M_re; - _M_im -= __z._M_im; - return *this; - } - - _Self& operator*= (const _Self& __z) { - value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; - value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; - _M_re = __r; - _M_im = __i; - return *this; - } - - _Self& operator/= (const _Self& __z) { - value_type __r; - value_type __i; - _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); - _M_re = __r; - _M_im = __i; - return *this; - } - - // Data members. - value_type _M_re; - value_type _M_im; -}; - -# endif /* _STLP_NO_LONG_DOUBLE */ - -// Converting constructors from one of these three specialized types -// to another. - -inline complex::complex(const complex& __z) - : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} -inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} -# ifndef _STLP_NO_LONG_DOUBLE -inline complex::complex(const complex& __z) - : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} -inline complex::complex(const complex& __z) - : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {} -inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} -inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} -# endif - -#endif /* SPECIALIZATIONS */ - -// Unary non-member arithmetic operators. - -template -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) -{ return __z; } - -template -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) -{ return complex<_Tp>(-__z._M_re, -__z._M_im); } - -// Non-member arithmetic operations involving one real argument. - -template -inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) -{ return complex<_Tp>(__x + __z._M_re, __z._M_im); } - -template -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) -{ return complex<_Tp>(__z._M_re + __x, __z._M_im); } - -template -inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) -{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); } - -template -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) -{ return complex<_Tp>(__z._M_re - __x, __z._M_im); } - -template -inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) -{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); } - -template -inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) -{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); } - -template -inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) { - complex<_Tp> __result; - complex<_Tp>::_div(__x, - __z._M_re, __z._M_im, - __result._M_re, __result._M_im); - return __result; -} - -template -inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) -{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); } - -// Non-member arithmetic operations involving two complex arguments - -template -inline complex<_Tp> _STLP_CALL -operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2) -{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); } - -template -inline complex<_Tp> _STLP_CALL -operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) -{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); } - -template -inline complex<_Tp> _STLP_CALL -operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im, - __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re); -} - -template -inline complex<_Tp> _STLP_CALL -operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - complex<_Tp> __result; - complex<_Tp>::_div(__z1._M_re, __z1._M_im, - __z2._M_re, __z2._M_im, - __result._M_re, __result._M_im); - return __result; -} - -// Comparison operators. - -template -inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) -{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; } - -template -inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) -{ return __z._M_re == __x && __z._M_im == 0; } - -template -inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) -{ return __x == __z._M_re && 0 == __z._M_im; } - -//04/27/04 dums: removal of this check, if it is restablish -//please explain why the other operators are not macro guarded -//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER - -template -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) -{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; } - -//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - -template -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) -{ return __z._M_re != __x || __z._M_im != 0; } - -template -inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) -{ return __x != __z._M_re || 0 != __z._M_im; } - -// Other basic arithmetic operations -template -inline _Tp _STLP_CALL real(const complex<_Tp>& __z) -{ return __z._M_re; } - -template -inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) -{ return __z._M_im; } - -template -_Tp _STLP_CALL abs(const complex<_Tp>& __z); - -template -_Tp _STLP_CALL arg(const complex<_Tp>& __z); - -template -inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) -{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; } - -template -inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) -{ return complex<_Tp>(__z._M_re, -__z._M_im); } - -template -complex<_Tp> _STLP_CALL polar(const _Tp& __rho) -{ return complex<_Tp>(__rho, 0); } - -template -complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi); - -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC float _STLP_CALL abs(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC double _STLP_CALL abs(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC float _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC double _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC complex _STLP_CALL polar(const float& __rho, const float& __phi); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC complex _STLP_CALL polar(const double& __rho, const double& __phi); - -template -_Tp _STLP_CALL abs(const complex<_Tp>& __z) -{ return _Tp(abs(complex(double(__z.real()), double(__z.imag())))); } - -template -_Tp _STLP_CALL arg(const complex<_Tp>& __z) -{ return _Tp(arg(complex(double(__z.real()), double(__z.imag())))); } - -template -complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) { - complex __tmp = polar(double(__rho), double(__phi)); - return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag())); -} - -#if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC long double _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC long double _STLP_CALL abs(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC complex _STLP_CALL polar(const long double&, const long double&); -#endif - - -#if !defined (_STLP_USE_NO_IOSTREAMS) - -_STLP_END_NAMESPACE - -# include - -_STLP_BEGIN_NAMESPACE - -// Complex output, in the form (re,im). We use a two-step process -// involving stringstream so that we get the padding right. -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z); - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z); - -// Specializations for narrow characters; lets us avoid widen. - -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL -operator>>(basic_istream >& __is, complex& __z); - -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL -operator>>(basic_istream >& __is, complex& __z); - -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __is, const complex& __z); - -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __is, const complex& __z); - -# if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL -operator>>(basic_istream >& __is, complex& __z); - -_STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __is, const complex& __z); - -# endif - -# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T) - -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL -operator>>(basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL -operator<<(basic_ostream >&, const complex&); -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL -operator>>(basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL -operator<<(basic_ostream >&, const complex&); - -# if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL -operator>>(basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL -operator<<(basic_ostream >&, const complex&); -# endif -# endif -#endif - - -// Transcendental functions. These are defined only for float, -// double, and long double. (Sqrt isn't transcendental, of course, -// but it's included in this section anyway.) - -_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const float&); -_STLP_DECLSPEC complex _STLP_CALL pow(const float&, const complex&); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const double&); -_STLP_DECLSPEC complex _STLP_CALL pow(const double&, const complex&); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); - -#if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); -_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log(const complex&); -_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const long double&); -_STLP_DECLSPEC complex _STLP_CALL pow(const long double&, const complex&); -_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, - const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); - -_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); -_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); -#endif - -_STLP_END_NAMESPACE - -#ifndef _STLP_LINK_TIME_INSTANTIATION -# include -#endif - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_config_compat_post.h b/SDK/stlport/stl/_config_compat_post.h deleted file mode 100644 index c326ac58..00000000 --- a/SDK/stlport/stl/_config_compat_post.h +++ /dev/null @@ -1,55 +0,0 @@ -/*========================================== */ -#if 1 /* def _STLP_3_COMPATIBILITY */ - -# define __SGI_STL_PORT _STLPORT_VERSION - -# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG ) -# define __STL_DEBUG _STLP_DEBUG -# endif - -# if defined (_STLP_USE_NAMESPACES) -# undef __STL_USE_NAMESPACES -# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES -# endif - -# if defined (_STLP_USE_EXCEPTIONS) -# undef __STL_USE_EXCEPTIONS -# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS -# endif - -# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE ) -# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE -# define __STL_END_NAMESPACE _STLP_END_NAMESPACE -# define __STL_VENDOR_STD _STLP_VENDOR_STD -# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD -# endif -# endif - -/* -# if defined (_STLP_XXX) && ! defined ( __STL_XXX ) -# define __STL_XXX _STLP_XXX -# endif -*/ - -/* 5.0 -> 4.6 compatibility section */ -#if 1 /* def _STLP_46_COMPATIBILITY */ - -#ifndef _STLP_USING_NAMESPACE_BUG -# define _STLP_USING_NAMESPACE_BUG -#endif - -/* provide a uniform way to access full funclionality */ -# define __slist__ slist -# define __map__ map -# define __multimap__ multimap -# define __set__ set -# define __multiset__ multiset -# define __list__ list -# define __hash_map__ hash_map -# define __hash_multimap__ hash_multimap -# define __hash_set__ hash_set -# define __hash_multiset__ hash_multiset -# define __vector__ vector - -#endif - diff --git a/SDK/stlport/stl/_construct.h b/SDK/stlport/stl/_construct.h deleted file mode 100644 index f828d924..00000000 --- a/SDK/stlport/stl/_construct.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -#define _STLP_INTERNAL_CONSTRUCT_H - -#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING) -# include -#endif - -#ifndef _STLP_INTERNAL_NEW -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -#ifndef _STLP_MOVE_CONSTRUCT_FWK_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/) -{ __pointer->~_Tp(); } - -template -inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {} - -template -inline void _Destroy(_Tp* __pointer) { -#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1010) - __pointer; -#endif - typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor; - __destroy_aux(__pointer, _Trivial_destructor()); -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp)); -#endif -} - -template -inline void _Destroy_Moved(_Tp* __pointer) { - typedef typename __move_traits<_Tp>::complete _Trivial_destructor; - __destroy_aux(__pointer, _Trivial_destructor()); -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp)); -#endif -} - -#if defined (new) -# define _STLP_NEW_REDEFINE new -# undef new -#endif - -#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG) -template -inline void _Construct_aux (_T1* __p, const __false_type&) { - _STLP_PLACEMENT_NEW (__p) _T1(); -} - -template -inline void _Construct_aux (_T1* __p, const __true_type&) { - _STLP_PLACEMENT_NEW (__p) _T1(0); -} -#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */ - -template -inline void _Construct(_T1* __p) { -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); -#endif -#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG) - _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer() ); -#else - _STLP_PLACEMENT_NEW (__p) _T1(); -#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */ -} - -template -inline void _Copy_Construct(_Tp* __p, const _Tp& __val) { -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp)); -#endif - _STLP_PLACEMENT_NEW (__p) _Tp(__val); -} - -template -inline void _Param_Construct(_T1* __p, const _T2& __val) { -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); -#endif - _STLP_PLACEMENT_NEW (__p) _T1(__val); -} - -template -inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) { - _STLP_PLACEMENT_NEW (__p) _T1(_STLP_PRIV _AsMoveSource(__val)); -} - -template -inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) { - _STLP_PLACEMENT_NEW (__p) _T1(__val); -} - -template -inline void _Move_Construct(_T1* __p, _T2& __val) { -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); -#endif - _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer()); -} - -#if defined(_STLP_NEW_REDEFINE) -# if defined (DEBUG_NEW) -# define new DEBUG_NEW -# endif -# undef _STLP_NEW_REDEFINE -#endif - -template -_STLP_INLINE_LOOP void -__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) { - for ( ; __first != __last; ++__first) { - __destroy_aux(&(*__first), __false_type()); -#if defined (_STLP_DEBUG_UNINITIALIZED) - memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp)); -#endif - } -} - -template -#if defined (_STLP_DEBUG_UNINITIALIZED) -_STLP_INLINE_LOOP void -__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) { - for ( ; __first != __last; ++__first) - memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp)); -} -#else -inline void -__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {} -#endif - -template -inline void -__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) { - typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor; - __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor()); -} - -template -inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) { - __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); -} - -inline void _Destroy_Range(char*, char*) {} -#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97 -inline void _Destroy_Range(wchar_t*, wchar_t*) {} -inline void _Destroy_Range(const wchar_t*, const wchar_t*) {} -#endif - -template -inline void -__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) { - typedef typename __move_traits<_Tp>::complete _CompleteMove; - __destroy_range_aux(__first, __last, __ptr, _CompleteMove()); -} - -template -inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last) { - __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); -} - -#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG) -// Those adaptors are here to fix common compiler bug regarding builtins: -// expressions like int k = int() should initialize k to 0 -template -inline _Tp __default_constructed_aux(_Tp*, const __false_type&) { - return _Tp(); -} -template -inline _Tp __default_constructed_aux(_Tp*, const __true_type&) { - return _Tp(0); -} - -template -inline _Tp __default_constructed(_Tp* __p) { - return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer()); -} - -# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0) -#else -# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp() -#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */ - - -#if !defined (_STLP_NO_ANACHRONISMS) -// -------------------------------------------------- -// Old names from the HP STL. - -template -inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); } -template -inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); } -template -inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); } -template -inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); } -#endif /* _STLP_NO_ANACHRONISMS */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_CONSTRUCT_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_csetjmp.h b/SDK/stlport/stl/_csetjmp.h deleted file mode 100644 index 7bb00180..00000000 --- a/SDK/stlport/stl/_csetjmp.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSETJMP -#define _STLP_INTERNAL_CSETJMP - -// if the macro is on, the header is already there -#if !defined (setjmp) -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(csetjmp) -# else -# define _STLP_NATIVE_SETJMP_H_INCLUDED -# include _STLP_NATIVE_C_HEADER(setjmp.h) -# endif -#endif - -#if defined (_STLP_IMPORT_VENDOR_CSTD) - -# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS) -/* For Borland, even if stdjmp.h is included symbols won't be in global namespace - * so we need to reach them in vendor namespace: - */ -# undef _STLP_NATIVE_SETJMP_H_INCLUDED -# endif - -_STLP_BEGIN_NAMESPACE -# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED) -using _STLP_VENDOR_CSTD::jmp_buf; -# else -// if setjmp.h was included first, this is in global namespace, not in -// vendor's std. - 2005-08-04, ptr -using ::jmp_buf; -# endif -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -# if !defined (setjmp) -# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000)) -# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED -using _STLP_VENDOR_CSTD::setjmp; -# else -using ::setjmp; -# endif -# endif -# endif -# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED) -using _STLP_VENDOR_CSTD::longjmp; -# else -using ::longjmp; -# endif -# endif -_STLP_END_NAMESPACE -#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif diff --git a/SDK/stlport/stl/_csignal.h b/SDK/stlport/stl/_csignal.h deleted file mode 100644 index 919e9c47..00000000 --- a/SDK/stlport/stl/_csignal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSIGNAL -#define _STLP_INTERNAL_CSIGNAL - -#if !defined (_STLP_WCE) -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(csignal) -# else -# include _STLP_NATIVE_C_HEADER(signal.h) -# endif - -# if defined (_STLP_IMPORT_VENDOR_CSTD) -_STLP_BEGIN_NAMESPACE -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -using _STLP_VENDOR_CSTD::signal; -using _STLP_VENDOR_CSTD::raise; -# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ -using _STLP_VENDOR_CSTD::sig_atomic_t; -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD */ -#endif - -#endif /* _STLP_INTERNAL_CSIGNAL */ diff --git a/SDK/stlport/stl/_cstdarg.h b/SDK/stlport/stl/_cstdarg.h deleted file mode 100644 index 0e51e62d..00000000 --- a/SDK/stlport/stl/_cstdarg.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#ifndef _STLP_INTERNAL_CSTDARG -#define _STLP_INTERNAL_CSTDARG - -#if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstdarg) -#else -# include _STLP_NATIVE_C_HEADER(stdarg.h) -#endif - -#ifdef _STLP_IMPORT_VENDOR_CSTD -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::va_list; -_STLP_END_NAMESPACE -#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif diff --git a/SDK/stlport/stl/_cstddef.h b/SDK/stlport/stl/_cstddef.h deleted file mode 100644 index d1c1e2d8..00000000 --- a/SDK/stlport/stl/_cstddef.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSTDDEF -#define _STLP_INTERNAL_CSTDDEF - -# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0 -# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :( -# define __need_wchar_t -# define __need_size_t -# define __need_ptrdiff_t -# define __need_NULL -# endif - -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstddef) -# else -# include -# endif - -# ifdef _STLP_IMPORT_VENDOR_CSTD -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::ptrdiff_t; -using _STLP_VENDOR_CSTD::size_t; -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif /* _STLP_INTERNAL_CSTDDEF */ diff --git a/SDK/stlport/stl/_cstdio.h b/SDK/stlport/stl/_cstdio.h deleted file mode 100644 index c4afb357..00000000 --- a/SDK/stlport/stl/_cstdio.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSTDIO -#define _STLP_INTERNAL_CSTDIO - -#if defined (__Lynx__) -# include _STLP_NATIVE_C_HEADER(stdarg.h) -#endif - -#if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstdio) -#else -# include _STLP_NATIVE_C_HEADER(stdio.h) -#endif - -#if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__) -# undef stdin -# undef stdout -# undef stderr -# if defined (__MWERKS__) -# define stdin (&_STLP_VENDOR_CSTD::__files[0]) -# define stdout (&_STLP_VENDOR_CSTD::__files[1]) -# define stderr (&_STLP_VENDOR_CSTD::__files[2]) -# elif defined (__BORLANDC__) -# define stdin (&_STLP_VENDOR_CSTD::_streams[0]) -# define stdout (&_STLP_VENDOR_CSTD::_streams[1]) -# define stderr (&_STLP_VENDOR_CSTD::_streams[2]) -# endif -#endif - -#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) -inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v) -{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); } -#endif - -#if defined (_STLP_IMPORT_VENDOR_CSTD ) -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::FILE; -using _STLP_VENDOR_CSTD::fpos_t; -using _STLP_VENDOR_CSTD::size_t; - -// undef obsolete macros -# undef putc -# undef getc -# undef getchar -# undef putchar -# undef feof -# undef ferror - -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -using _STLP_VENDOR_CSTD::clearerr; -using _STLP_VENDOR_CSTD::fclose; -using _STLP_VENDOR_CSTD::feof; -using _STLP_VENDOR_CSTD::ferror; -using _STLP_VENDOR_CSTD::fflush; -using _STLP_VENDOR_CSTD::fgetc; -using _STLP_VENDOR_CSTD::fgetpos; -using _STLP_VENDOR_CSTD::fgets; -using _STLP_VENDOR_CSTD::fopen; -using _STLP_VENDOR_CSTD::fprintf; -using _STLP_VENDOR_CSTD::fputc; -using _STLP_VENDOR_CSTD::fputs; -using _STLP_VENDOR_CSTD::fread; -# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this -using _STLP_VENDOR_CSTD::freopen; -# endif -using _STLP_VENDOR_CSTD::fscanf; -using _STLP_VENDOR_CSTD::fseek; -using _STLP_VENDOR_CSTD::fsetpos; -using _STLP_VENDOR_CSTD::ftell; -using _STLP_VENDOR_CSTD::fwrite; - -# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500)) -# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this except as macros. TODO: use inline function to redirect to the macros? - using _STLP_VENDOR_CSTD::getc; - using _STLP_VENDOR_CSTD::putc; -# endif - using _STLP_VENDOR_CSTD::getchar; - using _STLP_VENDOR_CSTD::putchar; -# endif - -using _STLP_VENDOR_CSTD::gets; -# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this -using _STLP_VENDOR_CSTD::perror; -# endif -using _STLP_VENDOR_CSTD::printf; -using _STLP_VENDOR_CSTD::puts; -# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this -using _STLP_VENDOR_CSTD::remove; -using _STLP_VENDOR_CSTD::rename; -using _STLP_VENDOR_CSTD::rewind; -using _STLP_VENDOR_CSTD::setbuf; -using _STLP_VENDOR_CSTD::tmpfile; -using _STLP_VENDOR_CSTD::tmpnam; -# endif -using _STLP_VENDOR_CSTD::scanf; -using _STLP_VENDOR_CSTD::setvbuf; -using _STLP_VENDOR_CSTD::sprintf; -using _STLP_VENDOR_CSTD::sscanf; -using _STLP_VENDOR_CSTD::ungetc; -using _STLP_VENDOR_CSTD::vfprintf; -using _STLP_VENDOR_CSTD::vprintf; -using _STLP_VENDOR_CSTD::vsprintf; -# if ((defined (__MWERKS__) && !defined (N_PLAT_NLM)) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \ - (defined (__BORLANDC__))) -using _STLP_VENDOR_CSTD::vsnprintf; -# endif -# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ -_STLP_END_NAMESPACE -#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif /* _STLP_INTERNAL_CSTDIO */ diff --git a/SDK/stlport/stl/_cstdlib.h b/SDK/stlport/stl/_cstdlib.h deleted file mode 100644 index 106f5306..00000000 --- a/SDK/stlport/stl/_cstdlib.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSTDLIB -#define _STLP_INTERNAL_CSTDLIB - -#if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) -#else -# include -#endif - -#if defined (__BORLANDC__) -/* Borland process.h header do not bring anything here and is just included - * in order to avoid inclusion later. This header cannot be included later - * because Borland compiler consider that for instance the abort function - * defined as extern "C" cannot be overloaded and it finds 2 "overloads", - * once in native std namespace and the other in STLport namespace... - */ -# include -#endif - -/* on evc3/evc4 including stdlib.h also defines setjmp macro */ -#if defined (_STLP_WCE) -# define _STLP_NATIVE_SETJMP_H_INCLUDED -#endif - -#if defined (__MSL__) && (__MSL__ <= 0x5003) -namespace std { - typedef ::div_t div_t; - typedef ::ldiv_t ldiv_t; -# ifdef __MSL_LONGLONG_SUPPORT__ - typedef ::lldiv_t lldiv_t; -# endif -} -#endif - -#ifdef _STLP_IMPORT_VENDOR_CSTD -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::div_t; -using _STLP_VENDOR_CSTD::ldiv_t; -using _STLP_VENDOR_CSTD::size_t; - -# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS -# ifndef _STLP_WCE -// these functions just don't exist on Windows CE -using _STLP_VENDOR_CSTD::abort; -#ifndef _XBOX - using _STLP_VENDOR_CSTD::getenv; -#endif // #ifndef _XBOX - -#ifndef __hpux -using _STLP_VENDOR_CSTD::mblen; -using _STLP_VENDOR_CSTD::mbtowc; -#endif - -using _STLP_VENDOR_CSTD::system; -using _STLP_VENDOR_CSTD::bsearch; -# endif -using _STLP_VENDOR_CSTD::atexit; -using _STLP_VENDOR_CSTD::exit; -using _STLP_VENDOR_CSTD::calloc; -using _STLP_VENDOR_CSTD::free; -using _STLP_VENDOR_CSTD::malloc; -using _STLP_VENDOR_CSTD::realloc; -using _STLP_VENDOR_CSTD::atof; -using _STLP_VENDOR_CSTD::atoi; -using _STLP_VENDOR_CSTD::atol; - -#ifndef __hpux -using _STLP_VENDOR_CSTD::mbstowcs; -#endif - -using _STLP_VENDOR_CSTD::strtod; -using _STLP_VENDOR_CSTD::strtol; -using _STLP_VENDOR_CSTD::strtoul; - -# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T)) -using _STLP_VENDOR_CSTD::wcstombs; -# ifndef _STLP_WCE -using _STLP_VENDOR_CSTD::wctomb; -# endif -# endif -using _STLP_VENDOR_CSTD::qsort; -using _STLP_VENDOR_CSTD::labs; -using _STLP_VENDOR_CSTD::ldiv; -# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L) -# if !defined(__sun) -using _STLP_VENDOR_CSTD::llabs; -using _STLP_VENDOR_CSTD::lldiv_t; -using _STLP_VENDOR_CSTD::lldiv; -# else -using ::llabs; -using ::lldiv_t; -using ::lldiv; -# endif -# endif -using _STLP_VENDOR_CSTD::rand; -using _STLP_VENDOR_CSTD::srand; -# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ -_STLP_END_NAMESPACE -#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS) -//In this config bcc define everything in std namespace and not in -//the global one. -inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); } -inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); } -#endif - -#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) -# define _STLP_RESTORE_FUNCTION_INTRINSIC -# pragma warning (push) -# pragma warning (disable: 4162) -# pragma function (abs) -#endif - -//HP-UX native lib has abs() and div() functions in global namespace -#if !defined (__HP_aCC) || (__HP_aCC < 30000) - -//MSVC starting with .Net 2003 already define all math functions in global namespace: -# if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE) -inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); } -# endif - -/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */ -# if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined(UNDER_CE) -inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); } -# endif - -#endif - -#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC) -# pragma intrinsic (abs) -# pragma warning (pop) -# undef _STLP_RESTORE_FUNCTION_INTRINSIC -#endif - -#if defined (_STLP_LONG_LONG) -# if !defined (_STLP_NO_VENDOR_STDLIB_L) -# if !defined (__sun) -inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); } -inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); } -# else -inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); } -inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); } -# endif -# else -# ifndef _XBOX -inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; } -# endif -# endif -#endif - -/* C++ Standard is unclear about several call to 'using ::func' if new overloads - * of ::func appears between 2 successive 'using' calls. To avoid this potential - * problem we provide all abs overload before the 'using' call. - * Beware: This header inclusion has to be after all abs overload of this file. - * The first 'using ::abs' call is going to be in the other header. - */ -#ifndef _STLP_INTERNAL_CMATH -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05 -_STLP_BEGIN_NAMESPACE -using ::abs; -# if !defined (N_PLAT_NLM) -using ::div; -# else -// Don't use div from clib or libc on NetWare---buggy! - ptr 2005-06-06 -inline div_t div(int __x, int __y) { div_t d; d.quot = __x / __y; d.rem = __x % __y; return d; } -inline ldiv_t div(long __x, long __y) { ldiv_t d; d.quot = __x / __y; d.rem = __x % __y; return d; } -# endif -_STLP_END_NAMESPACE -#endif - -#endif /* _STLP_INTERNAL_CSTDLIB */ diff --git a/SDK/stlport/stl/_cstring.h b/SDK/stlport/stl/_cstring.h deleted file mode 100644 index 8f39a7ac..00000000 --- a/SDK/stlport/stl/_cstring.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CSTRING -#define _STLP_INTERNAL_CSTRING - -#if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cstring) -#else -# include _STLP_NATIVE_C_HEADER(string.h) -#endif - -#ifdef _STLP_IMPORT_VENDOR_CSTD -_STLP_BEGIN_NAMESPACE -# include -_STLP_END_NAMESPACE -#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif /* _STLP_INTERNAL_CSTRING */ diff --git a/SDK/stlport/stl/_ctime.h b/SDK/stlport/stl/_ctime.h deleted file mode 100644 index d995d420..00000000 --- a/SDK/stlport/stl/_ctime.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CTIME -#define _STLP_INTERNAL_CTIME - -#if !defined (_STLP_WCE_EVC3) - -# if defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(ctime) -# else -# include _STLP_NATIVE_C_HEADER(time.h) -# endif - -# if defined (_STLP_IMPORT_VENDOR_CSTD) -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD::size_t; -using _STLP_VENDOR_CSTD::clock_t; -using _STLP_VENDOR_CSTD::time_t; -using _STLP_VENDOR_CSTD::tm; -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -using _STLP_VENDOR_CSTD::clock; -using _STLP_VENDOR_CSTD::asctime; -using _STLP_VENDOR_CSTD::ctime; -using _STLP_VENDOR_CSTD::gmtime; - -# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this -using _STLP_VENDOR_CSTD::difftime; -# endif -using _STLP_VENDOR_CSTD::mktime; -using _STLP_VENDOR_CSTD::localtime; -using _STLP_VENDOR_CSTD::strftime; -using _STLP_VENDOR_CSTD::time; -# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#endif - -#endif /* _STLP_INTERNAL_CTIME */ diff --git a/SDK/stlport/stl/_ctraits_fns.h b/SDK/stlport/stl/_ctraits_fns.h deleted file mode 100644 index e4a4af10..00000000 --- a/SDK/stlport/stl/_ctraits_fns.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - -#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H -#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -// This file contains a few small adapters that allow a character -// traits class to be used as a function object. - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Eq_traits - : public binary_function { - bool operator()(const typename _Traits::char_type& __x, - const typename _Traits::char_type& __y) const - { return _Traits::eq(__x, __y); } -}; - -template -struct _Eq_char_bound - : public unary_function { - typename _Traits::char_type __val; - _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {} - bool operator()(const typename _Traits::char_type& __x) const - { return _Traits::eq(__x, __val); } -}; - -template -struct _Neq_char_bound - : public unary_function -{ - typename _Traits::char_type __val; - _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {} - bool operator()(const typename _Traits::char_type& __x) const - { return !_Traits::eq(__x, __val); } -}; - -template -struct _Eq_int_bound - : public unary_function { - typename _Traits::int_type __val; - - _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {} - bool operator()(const typename _Traits::char_type& __x) const - { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); } -}; - -#if 0 -template -struct _Lt_traits - : public binary_function { - bool operator()(const typename _Traits::char_type& __x, - const typename _Traits::char_type& __y) const - { return _Traits::lt(__x, __y); } -}; -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ctype.h b/SDK/stlport/stl/_ctype.h deleted file mode 100644 index b110f454..00000000 --- a/SDK/stlport/stl/_ctype.h +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - -#ifndef _STLP_INTERNAL_CTYPE_H -#define _STLP_INTERNAL_CTYPE_H - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class _STLP_CLASS_DECLSPEC ctype_base { -public: - enum mask { - space = _Locale_SPACE, - print = _Locale_PRINT, - cntrl = _Locale_CNTRL, - upper = _Locale_UPPER, - lower = _Locale_LOWER, - alpha = _Locale_ALPHA, - digit = _Locale_DIGIT, - punct = _Locale_PUNCT, - xdigit = _Locale_XDIGIT, - alnum = alpha | digit, - graph = alnum | punct - }; -}; - -// ctype<> template - -template class ctype {}; -template class ctype_byname {}; - -//ctype specializations - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC ctype : public locale::facet, public ctype_base { -#ifndef _STLP_NO_WCHAR_T -# ifdef _STLP_MSVC - typedef ctype _Wctype; - friend _Wctype; -# else - friend class ctype; -# endif -#endif - friend class _Locale_impl; -public: - - typedef char char_type; - - explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); - bool is(mask __m, char __c) const - { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; } - - const char* is(const char* __low, const char* __high, mask* __vec) const { - for (const char* __p = __low;__p != __high; ++__p, ++__vec) { - *__vec = _M_ctype_table[(unsigned char)*__p]; - } - return __high; - } - - const char* scan_is(mask __m, const char* __low, const char* __high) const; - const char* scan_not(mask __m, const char* __low, const char* __high) const; - - char (toupper)(char __c) const { return do_toupper(__c); } - const char* (toupper)(char* __low, const char* __high) const { - return do_toupper(__low, __high); - } - - char (tolower)(char __c) const { return do_tolower(__c); } - const char* (tolower)(char* __low, const char* __high) const { - return do_tolower(__low, __high); - } - - char widen(char __c) const { return do_widen(__c); } - const char* widen(const char* __low, const char* __high, char* __to) const { - return do_widen(__low, __high, __to); - } - - char narrow(char __c, char __dfault) const { - return do_narrow(__c, __dfault); - } - const char* narrow(const char* __low, const char* __high, - char __dfault, char* __to) const { - return do_narrow(__low, __high, __dfault, __to); - } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; -# if defined(_STLP_STATIC_CONST_INIT_BUG) - enum __TableSize { table_size = 256 }; -# else - static const size_t table_size = 256; -# endif - -protected: - const mask* table() const _STLP_NOTHROW { return _M_ctype_table; } - static const mask* _STLP_CALL classic_table() _STLP_NOTHROW; - - ~ctype(); - - virtual char do_toupper(char __c) const; - virtual char do_tolower(char __c) const; - virtual const char* do_toupper(char* __low, const char* __high) const; - virtual const char* do_tolower(char* __low, const char* __high) const; - virtual char do_widen(char __c) const; - virtual const char* do_widen(const char* __low, const char* __high, - char* __to) const; - virtual char do_narrow(char __c, char /* dfault */ ) const; - virtual const char* do_narrow(const char* __low, const char* __high, - char /* dfault */, char* __to) const; -private: - struct _Is_mask { - mask __m; - _Is_mask(mask __x): __m(__x) {} - bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;} - }; - -protected: - const mask* _M_ctype_table; -private: - bool _M_delete; -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC ctype_byname: public ctype { -public: - explicit ctype_byname(const char*, size_t = 0, _Locale_name_hint* __hint = 0); - ~ctype_byname(); - - virtual char do_toupper(char __c) const; - virtual char do_tolower(char __c) const; - - virtual const char* do_toupper(char*, const char*) const; - virtual const char* do_tolower(char*, const char*) const; - -private: - mask _M_byname_table[table_size]; - _Locale_ctype* _M_ctype; - - //explicitely defined as private to avoid warnings: - typedef ctype_byname _Self; - ctype_byname(_Self const&); - _Self& operator = (_Self const&); - friend _Locale_name_hint* _Locale_extract_hint(ctype_byname*); -}; - -# ifndef _STLP_NO_WCHAR_T -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC ctype : public locale::facet, public ctype_base -{ - friend class _Locale_impl; -public: - typedef wchar_t char_type; - - explicit ctype(size_t __refs = 0) : locale::facet(__refs) {} - - bool is(mask __m, wchar_t __c) const - { return do_is(__m, __c); } - - const wchar_t* is(const wchar_t* __low, const wchar_t* __high, - mask* __vec) const - { return do_is(__low, __high, __vec); } - - const wchar_t* scan_is(mask __m, - const wchar_t* __low, const wchar_t* __high) const - { return do_scan_is(__m, __low, __high); } - - const wchar_t* scan_not (mask __m, - const wchar_t* __low, const wchar_t* __high) const - { return do_scan_not(__m, __low, __high); } - - wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); } - const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const - { return do_toupper(__low, __high); } - - wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); } - const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const - { return do_tolower(__low, __high); } - - wchar_t widen(char __c) const { return do_widen(__c); } - const char* widen(const char* __low, const char* __high, - wchar_t* __to) const - { return do_widen(__low, __high, __to); } - - char narrow(wchar_t __c, char __dfault) const - { return do_narrow(__c, __dfault); } - const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high, - char __dfault, char* __to) const - { return do_narrow(__low, __high, __dfault, __to); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~ctype(); - - virtual bool do_is(mask __m, wchar_t __c) const; - virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const; - virtual const wchar_t* do_scan_is(mask, - const wchar_t*, const wchar_t*) const; - virtual const wchar_t* do_scan_not(mask, - const wchar_t*, const wchar_t*) const; - virtual wchar_t do_toupper(wchar_t __c) const; - virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const; - virtual wchar_t do_tolower(wchar_t c) const; - virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const; - virtual wchar_t do_widen(char c) const; - virtual const char* do_widen(const char*, const char*, wchar_t*) const; - virtual char do_narrow(wchar_t __c, char __dfault) const; - virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*, - char, char*) const; -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC ctype_byname: public ctype { -public: - explicit ctype_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~ctype_byname(); - - virtual bool do_is(mask __m, wchar_t __c) const; - virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const; - virtual const wchar_t* do_scan_is(mask, - const wchar_t*, const wchar_t*) const; - virtual const wchar_t* do_scan_not(mask, - const wchar_t*, const wchar_t*) const; - virtual wchar_t do_toupper(wchar_t __c) const; - virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const; - virtual wchar_t do_tolower(wchar_t c) const; - virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const; - -private: - _Locale_ctype* _M_ctype; - - //explicitely defined as private to avoid warnings: - typedef ctype_byname _Self; - ctype_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -# endif /* WCHAR_T */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_CTYPE_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_cwchar.h b/SDK/stlport/stl/_cwchar.h deleted file mode 100644 index e94ba8f7..00000000 --- a/SDK/stlport/stl/_cwchar.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CWCHAR -#define _STLP_INTERNAL_CWCHAR - -#if defined (_STLP_WCE_EVC3) -# ifndef _STLP_INTERNAL_MBSTATE_T -# include -# endif -#else -# if defined (__GNUC__) -# include _STLP_NATIVE_CPP_C_HEADER(cstddef) -# endif - -# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS) -# include _STLP_NATIVE_CPP_C_HEADER(cwchar) -# if defined (__OpenBSD__) -typedef _BSD_WINT_T_ wint_t; -# endif /* __OpenBSD__ */ - -# elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \ - (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \ - defined (__OpenBSD__) || defined (__FreeBSD__) || \ - (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ ))) -# include _STLP_NATIVE_C_HEADER(stddef.h) -# if defined (__Lynx__) -# ifndef _WINT_T -typedef long int wint_t; -# define _WINT_T -# endif /* _WINT_T */ -# endif -# if defined(__OpenBSD__) -typedef _BSD_WINT_T_ wint_t; -# endif /* __OpenBSD__ */ -# elif defined (__MWERKS__) && defined (N_PLAT_NLM) -# include -# else -# include _STLP_NATIVE_C_HEADER(wchar.h) - -# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4)) -extern wint_t btowc(); -extern int fwprintf(); -extern int fwscanf(); -extern int fwide(); -extern int mbsinit(); -extern size_t mbrlen(); -extern size_t mbrtowc(); -extern size_t mbsrtowcs(); -extern int swprintf(); -extern int swscanf(); -extern int vfwprintf(); -extern int vwprintf(); -extern int vswprintf(); -extern size_t wcrtomb(); -extern size_t wcsrtombs(); -extern wchar_t *wcsstr(); -extern int wctob(); -extern wchar_t *wmemchr(); -extern int wmemcmp(); -extern wchar_t *wmemcpy(); -extern wchar_t *wmemmove(); -extern wchar_t *wmemset(); -extern int wprintf(); -extern int wscanf(); -# endif -# endif - -# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */ -# define _STLP_WCHAR_MSL_EXCLUDE 1 -namespace std { - extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr); -} -# define _STLP_NO_MBSTATE_T 1 -# elif defined (__BORLANDC__) -# if !defined (_STLP_USE_NO_IOSTREAMS) -# define _STLP_NO_NATIVE_MBSTATE_T -# endif -# define _STLP_WCHAR_BORLAND_EXCLUDE 1 -# endif - -# ifndef _STLP_INTERNAL_MBSTATE_T -# include -# endif - -# if !defined (_STLP_NO_WCHAR_T) -# ifndef WCHAR_MIN -# define WCHAR_MIN 0 -/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */ -# if defined (__SUNPRO_CC) || defined (__DJGPP) -# define WCHAR_MAX (~0) -# else -# define WCHAR_MAX ((wchar_t)~0) -# endif -# endif -# if defined (__GNUC__) && defined (__alpha__) -/* Definition of WCHAR_MIN and MAX are wrong for alpha platform - * as gcc consider wchar_t as an unsigned type. Static assertion are - * here to check that a future alpha SDK or a future gcc won't change the - * situation making this workaround useless. - */ -_STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0)) -# undef WCHAR_MIN -# define WCHAR_MIN 0 -# undef WCHAR_MAX -# define WCHAR_MAX ((wchar_t)~0) -# endif -# if defined(__HP_aCC) && (__HP_aCC >= 60000) -/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions - * of WCHAR_MIN/MAX macros without having to define - * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not - * predefine). Let STLport provide B.11.31 definitions on any version of - * HP-UX/ia64. - */ -# undef WCHAR_MIN -# define WCHAR_MIN 0 -# undef WCHAR_MAX -# define WCHAR_MAX UINT_MAX -# endif -# endif - -# if defined (_STLP_IMPORT_VENDOR_CSTD) - -# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) -using _STLP_VENDOR_CSTD::wint_t; -# endif - -_STLP_BEGIN_NAMESPACE -# if defined (_STLP_NO_WCHAR_T) -typedef int wint_t; -# else -// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined -// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition -// in stdio.h; I prefer settings from last file. -# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM)) -using ::wint_t; -# else -using _STLP_VENDOR_CSTD::wint_t; -# endif -# endif - -using _STLP_VENDOR_CSTD::size_t; - -# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T) -using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; - -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \ - (!defined(__MSL__) || __MSL__ > 0x6001) -# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ - !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -using _STLP_VENDOR_MB_NAMESPACE::btowc; -# if (!defined(__MSL__) || __MSL__ > 0x7001) -using _STLP_VENDOR_MB_NAMESPACE::mbsinit; -# endif -# endif -# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ - !defined (__GNUC__) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -using _STLP_VENDOR_MB_NAMESPACE::mbrlen; -using _STLP_VENDOR_MB_NAMESPACE::mbrtowc; -using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs; -using _STLP_VENDOR_MB_NAMESPACE::wcrtomb; -using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs; -# endif -# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */ - -# endif /* _STLP_NO_NATIVE_MBSTATE_T */ - -# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) - -# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -using _STLP_VENDOR_CSTD::fgetwc; -using _STLP_VENDOR_CSTD::fgetws; -using _STLP_VENDOR_CSTD::fputwc; -using _STLP_VENDOR_CSTD::fputws; -# endif - -# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ - defined(_STLP_WCHAR_HPACC_EXCLUDE) || (defined(__MWERKS__) && defined(N_PLAT_NLM))) -# if !defined (__DECCXX) -using _STLP_VENDOR_CSTD::fwide; -# endif -using _STLP_VENDOR_CSTD::fwprintf; -using _STLP_VENDOR_CSTD::fwscanf; -using _STLP_VENDOR_CSTD::getwchar; -# endif - -# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -# ifndef _STLP_WCE_NET -using _STLP_VENDOR_CSTD::getwc; -# endif -using _STLP_VENDOR_CSTD::ungetwc; -# ifndef _STLP_WCE_NET -using _STLP_VENDOR_CSTD::putwc; -# endif -using _STLP_VENDOR_CSTD::putwchar; -# endif - -# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ - defined (_STLP_WCHAR_HPACC_EXCLUDE) || (defined (__MWERKS__) && defined (N_PLAT_NLM))) -# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \ - defined (__MINGW32__) -# undef swprintf -# define swprintf _snwprintf -# undef vswprintf -# define vswprintf _vsnwprintf -using ::swprintf; -using ::vswprintf; -# else -using _STLP_VENDOR_CSTD::swprintf; -using _STLP_VENDOR_CSTD::vswprintf; -# endif -using _STLP_VENDOR_CSTD::swscanf; -using _STLP_VENDOR_CSTD::vfwprintf; -using _STLP_VENDOR_CSTD::vwprintf; - -# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \ - !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */ - -using _STLP_VENDOR_CSTD::wcsftime; -# endif -using _STLP_VENDOR_CSTD::wcstok; - -# endif - -# if !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -# if !defined (_STLP_WCE_NET) -using _STLP_VENDOR_CSTD::wcscoll; -using _STLP_VENDOR_CSTD::wcsxfrm; -# endif -using _STLP_VENDOR_CSTD::wcscat; -using _STLP_VENDOR_CSTD::wcsrchr; -using _STLP_VENDOR_CSTD::wcscmp; - -using _STLP_VENDOR_CSTD::wcscpy; -using _STLP_VENDOR_CSTD::wcscspn; - -using _STLP_VENDOR_CSTD::wcslen; -using _STLP_VENDOR_CSTD::wcsncat; -using _STLP_VENDOR_CSTD::wcsncmp; -using _STLP_VENDOR_CSTD::wcsncpy; -using _STLP_VENDOR_CSTD::wcspbrk; -using _STLP_VENDOR_CSTD::wcschr; - -using _STLP_VENDOR_CSTD::wcsspn; -# endif - -# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM)) -using _STLP_VENDOR_CSTD::wcstod; -using _STLP_VENDOR_CSTD::wcstol; -# endif - -# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \ - (defined (__MWERKS__) && defined (N_PLAT_NLM))) -using _STLP_VENDOR_CSTD::wcsstr; -using _STLP_VENDOR_CSTD::wmemchr; - -# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) -# if !defined (_STLP_WCE_NET) -using _STLP_VENDOR_CSTD::wctob; -# endif -# if !defined (__DMC__) -using _STLP_VENDOR_CSTD::wmemcmp; -using _STLP_VENDOR_CSTD::wmemmove; -# endif -using _STLP_VENDOR_CSTD::wprintf; -using _STLP_VENDOR_CSTD::wscanf; -# endif - -# if defined (__BORLANDC__) -inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) -{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); } -inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) -{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); } -# undef wmemcpy -# undef wmemset -inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) -{ return _STLP_wmemcpy(__wdst, __wsrc, __n); } -inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) -{ return _STLP_wmemset(__wdst, __wc, __n); } -# elif defined (__DMC__) -inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n) -{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); } -inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n) -{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); } -inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) -{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; } -# else -using _STLP_VENDOR_CSTD::wmemcpy; -using _STLP_VENDOR_CSTD::wmemset; -# endif -# endif - -# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ -using _STLP_VENDOR_CSTD::wcslen; -using _STLP_VENDOR_CSTD::wcscmp; -using _STLP_VENDOR_CSTD::wcscpy; -using _STLP_VENDOR_CSTD::wcsstr; -using _STLP_VENDOR_CSTD::wcschr; -using _STLP_VENDOR_CSTD::wcsrchr; -using _STLP_VENDOR_CSTD::wcspbrk; -# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ -_STLP_END_NAMESPACE - -# endif /* _STLP_IMPORT_VENDOR_CSTD */ - -# undef _STLP_WCHAR_SUNPRO_EXCLUDE -# undef _STLP_WCHAR_MSL_EXCLUDE - -# endif /* !defined(_STLP_WCE_EVC3) */ - -#endif /* _STLP_INTERNAL_CWCHAR */ diff --git a/SDK/stlport/stl/_cwctype.h b/SDK/stlport/stl/_cwctype.h deleted file mode 100644 index 32db7ef5..00000000 --- a/SDK/stlport/stl/_cwctype.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_CWCTYPE -#define _STLP_INTERNAL_CWCTYPE - -#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE) -# include -#endif - -#if !defined (_STLP_WCE_EVC3) -# if defined (_STLP_USE_NEW_C_HEADERS) -# if !defined (N_PLAT_NLM) -# include _STLP_NATIVE_CPP_C_HEADER(cwctype) -# else - // see comments in stlport/cwchar about wint_t on Novell -# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h) -# include _STLP_NATIVE_C_HEADER(stddef.h) -# include _STLP_NATIVE_C_HEADER(stdio.h) -# endif -# if defined (__MSL__) && !defined (N_PLAT_NLM) -namespace std { - typedef wchar_t wctrans_t; - wint_t towctrans(wint_t c, wctrans_t value); - wctrans_t wctrans(const char *name); -} -using std::wctrans_t; -using std::towctrans; -using std::wctrans; -# endif -# else -# include _STLP_NATIVE_C_HEADER(wctype.h) -# endif - -# if defined (_STLP_IMPORT_VENDOR_CSTD) - -# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \ - defined (__sun) || defined (__FreeBSD__) || \ - defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0)) -//We take wide functions from global namespace: -# define _STLP_VENDOR_CSTD_WFUNC -# else -# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD -# endif - -_STLP_BEGIN_NAMESPACE -using _STLP_VENDOR_CSTD_WFUNC::wctype_t; -using _STLP_VENDOR_CSTD_WFUNC::wint_t; -# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -# if !defined (__BORLANDC__) && !defined (__MSL__) -using _STLP_VENDOR_CSTD_WFUNC::wctrans_t; -# if !defined (__DMC__) && (!defined(_WIN32_WCE) || _WIN32_WCE<0x500) -using _STLP_VENDOR_CSTD_WFUNC::towctrans; -using _STLP_VENDOR_CSTD_WFUNC::wctrans; -using _STLP_VENDOR_CSTD_WFUNC::wctype; -# endif -using _STLP_VENDOR_CSTD_WFUNC::iswctype; -# endif -# if !defined(N_PLAT_NLM) -using _STLP_VENDOR_CSTD_WFUNC::iswalnum; -using _STLP_VENDOR_CSTD_WFUNC::iswalpha; -using _STLP_VENDOR_CSTD_WFUNC::iswcntrl; - -using _STLP_VENDOR_CSTD_WFUNC::iswdigit; -using _STLP_VENDOR_CSTD_WFUNC::iswgraph; -using _STLP_VENDOR_CSTD_WFUNC::iswlower; -using _STLP_VENDOR_CSTD_WFUNC::iswprint; -using _STLP_VENDOR_CSTD_WFUNC::iswpunct; -using _STLP_VENDOR_CSTD_WFUNC::iswspace; -using _STLP_VENDOR_CSTD_WFUNC::iswupper; -using _STLP_VENDOR_CSTD_WFUNC::iswxdigit; - -using _STLP_VENDOR_CSTD_WFUNC::towlower; -using _STLP_VENDOR_CSTD_WFUNC::towupper; -# endif /* !N_PLAT_NLM */ -# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ -_STLP_END_NAMESPACE -# endif /* _STLP_IMPORT_VENDOR_CSTD */ -#endif /* _STLP_WCE_EVC3 */ - -#endif /* _STLP_INTERNAL_CWCTYPE */ diff --git a/SDK/stlport/stl/_deque.c b/SDK/stlport/stl/_deque.c deleted file mode 100644 index 52d6fc91..00000000 --- a/SDK/stlport/stl/_deque.c +++ /dev/null @@ -1,814 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_DEQUE_C -#define _STLP_DEQUE_C - -#ifndef _STLP_INTERNAL_DEQUE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Non-inline member functions from _Deque_base. - -template -_Deque_base<_Tp,_Alloc >::~_Deque_base() { - if (_M_map._M_data) { - _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1); - _M_map.deallocate(_M_map._M_data, _M_map_size._M_data); - } -} - -template -void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) { - size_t __num_nodes = __num_elements / this->buffer_size() + 1 ; - - _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2); - _M_map._M_data = _M_map.allocate(_M_map_size._M_data); - - _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2; - _Tp** __nfinish = __nstart + __num_nodes; - - _STLP_TRY { - _M_create_nodes(__nstart, __nfinish); - } - _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data), - _M_map._M_data = 0, _M_map_size._M_data = 0)) - _M_start._M_set_node(__nstart); - this->_M_finish._M_set_node(__nfinish - 1); - _M_start._M_cur = _M_start._M_first; - this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size(); -} - -template -void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, - _Tp** __nfinish) { - _Tp** __cur = __nstart; - _STLP_TRY { - for (; __cur < __nfinish; ++__cur) - *__cur = _M_map_size.allocate(this->buffer_size()); - } - _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur)) -} - -template -void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, - _Tp** __nfinish) { - for (_Tp** __n = __nstart; __n < __nfinish; ++__n) - _M_map_size.deallocate(*__n, this->buffer_size()); -} - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define deque _STLP_PTR_IMPL_NAME(deque) -#elif defined (_STLP_DEBUG) -# define deque _STLP_NON_DBG_NAME(deque) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -// qualified references -# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > -# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> > -# define iterator __iterator__ -# define size_type size_t -# define value_type _Tp -#else -# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator -#endif - -template -deque<_Tp, _Alloc >& -deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) { - const size_type __len = size(); - if (&__x != this) { - if (__len >= __x.size()) - erase(copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish); - else { - const_iterator __mid = __x.begin() + difference_type(__len); - copy(__x.begin(), __mid, this->_M_start); - insert(this->_M_finish, __mid, __x.end()); - } - } - return *this; -} - -template -void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos, - size_type __n, const value_type& __x) { - if (__pos._M_cur == this->_M_start._M_cur) { - iterator __new_start = _M_reserve_elements_at_front(__n); - _STLP_TRY { - uninitialized_fill(__new_start, this->_M_start, __x); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - this->_M_start = __new_start; - } - else if (__pos._M_cur == this->_M_finish._M_cur) { - iterator __new_finish = _M_reserve_elements_at_back(__n); - _STLP_TRY { - uninitialized_fill(this->_M_finish, __new_finish, __x); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1)) - this->_M_finish = __new_finish; - } - else - _M_fill_insert_aux(__pos, __n, __x, _Movable()); -} - -#if !defined (_STLP_MEMBER_TEMPLATES) - -template -void deque<_Tp, _Alloc>::insert(iterator __pos, - const value_type* __first, const value_type* __last) { - size_type __n = __last - __first; - if (__pos._M_cur == this->_M_start._M_cur) { - iterator __new_start = _M_reserve_elements_at_front(__n); - _STLP_TRY { - _STLP_PRIV __ucopy(__first, __last, __new_start); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - this->_M_start = __new_start; - } - else if (__pos._M_cur == this->_M_finish._M_cur) { - iterator __new_finish = _M_reserve_elements_at_back(__n); - _STLP_TRY { - _STLP_PRIV __ucopy(__first, __last, this->_M_finish); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, - __new_finish._M_node + 1)) - this->_M_finish = __new_finish; - } - else - _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); -} - -template -void deque<_Tp,_Alloc>::insert(iterator __pos, - const_iterator __first, const_iterator __last) { - size_type __n = __last - __first; - if (__pos._M_cur == this->_M_start._M_cur) { - iterator __new_start = _M_reserve_elements_at_front(__n); - _STLP_TRY { - _STLP_PRIV __ucopy(__first, __last, __new_start); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - this->_M_start = __new_start; - } - else if (__pos._M_cur == this->_M_finish._M_cur) { - iterator __new_finish = _M_reserve_elements_at_back(__n); - _STLP_TRY { - _STLP_PRIV __ucopy(__first, __last, this->_M_finish); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, - __new_finish._M_node + 1)) - this->_M_finish = __new_finish; - } - else - _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); -} - -#endif /* _STLP_MEMBER_TEMPLATES */ - -template -__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos, - const __true_type& /*_Movable*/) { - difference_type __index = __pos - this->_M_start; - if (size_type(__index) < this->size() >> 1) { - //We move the start of the deque one position to the right - //starting from the rightmost element to move. - iterator __src = __pos, __dst = __pos; - _STLP_STD::_Destroy(&(*__dst)); - if (__src != this->_M_start) { - for (--__src; __dst != this->_M_start; --__src, --__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - } - _M_pop_front_aux(); - } - else { - iterator __src = __pos, __dst = __pos; - _STLP_STD::_Destroy(&(*__dst)); - for (++__src; __src != this->_M_finish; ++__src, ++__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - //Duplication of the pop_back code without the destroy which has already been done: - if (this->_M_finish._M_cur != this->_M_finish._M_first) { - --this->_M_finish._M_cur; - } - else { - _M_pop_back_aux(); - } - } - return this->_M_start + __index; -} - -template -__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos, - const __false_type& /*_Movable*/) { - iterator __next = __pos; - ++__next; - difference_type __index = __pos - this->_M_start; - if (size_type(__index) < this->size() >> 1) { - copy_backward(this->_M_start, __pos, __next); - pop_front(); - } - else { - copy(__next, this->_M_finish, __pos); - pop_back(); - } - return this->_M_start + __index; -} - -template -__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last, - const __true_type& /*_Movable*/) { - difference_type __n = __last - __first; - difference_type __elems_before = __first - this->_M_start; - if (__elems_before <= difference_type(this->size() - __n) / 2) { - iterator __src = __first, __dst = __last; - if (__src != this->_M_start) { - for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) { - _STLP_STD::_Destroy(&(*__dst)); - _STLP_STD::_Move_Construct(&(*__dst), *__src); - } - if (__dst >= __first) { - //There are more elements to erase than elements to move - _STLP_STD::_Destroy_Range(__first, ++__dst); - _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first); - } - else { - //There are more elements to move than elements to erase - for (; __src >= this->_M_start; --__src, --__dst) { - _STLP_STD::_Destroy_Moved(&(*__dst)); - _STLP_STD::_Move_Construct(&(*__dst), *__src); - } - _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst); - } - } - else { - _STLP_STD::_Destroy_Range(this->_M_start, __last); - } - iterator __new_start = this->_M_start + __n; - this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node); - this->_M_start = __new_start; - } - else { - if (__last != this->_M_finish) { - iterator __src = __last, __dst = __first; - for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) { - _STLP_STD::_Destroy(&(*__dst)); - _STLP_STD::_Move_Construct(&(*__dst), *__src); - } - if (__dst != __last) { - //There are more elements to erase than elements to move - _STLP_STD::_Destroy_Range(__dst, __last); - _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish); - } - else { - //There are more elements to move than elements to erase - for (; __src != this->_M_finish; ++__src, ++__dst) { - _STLP_STD::_Destroy_Moved(&(*__dst)); - _STLP_STD::_Move_Construct(&(*__dst), *__src); - } - _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish); - } - } - else { - _STLP_STD::_Destroy_Range(__first, this->_M_finish); - } - iterator __new_finish = this->_M_finish - __n; - this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1); - this->_M_finish = __new_finish; - } - return this->_M_start + __elems_before; -} - -template -__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last, - const __false_type& /*_Movable*/) { - difference_type __n = __last - __first; - difference_type __elems_before = __first - this->_M_start; - if (__elems_before <= difference_type(this->size() - __n) / 2) { - copy_backward(this->_M_start, __first, __last); - iterator __new_start = this->_M_start + __n; - _STLP_STD::_Destroy_Range(this->_M_start, __new_start); - this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node); - this->_M_start = __new_start; - } - else { - copy(__last, this->_M_finish, __first); - iterator __new_finish = this->_M_finish - __n; - _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish); - this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1); - this->_M_finish = __new_finish; - } - return this->_M_start + __elems_before; -} - -template -void deque<_Tp,_Alloc>::clear() { - for (_Map_pointer __node = this->_M_start._M_node + 1; - __node < this->_M_finish._M_node; - ++__node) { - _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size()); - this->_M_map_size.deallocate(*__node, this->buffer_size()); - } - - if (this->_M_start._M_node != this->_M_finish._M_node) { - _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last); - _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur); - this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size()); - } - else - _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur); - - this->_M_finish = this->_M_start; -} - -// Precondition: this->_M_start and this->_M_finish have already been initialized, -// but none of the deque's elements have yet been constructed. -template -void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val, - const __false_type& /*_TrivialInit*/) { - _Map_pointer __cur = this->_M_start._M_node; - _STLP_TRY { - for (; __cur < this->_M_finish._M_node; ++__cur) - uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val); - uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur))) -} - - -// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1. -template -void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) { - _M_reserve_map_at_back(); - *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size()); - _STLP_TRY { - _Copy_Construct(this->_M_finish._M_cur, __t); - this->_M_finish._M_set_node(this->_M_finish._M_node + 1); - this->_M_finish._M_cur = this->_M_finish._M_first; - } - _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1), - this->buffer_size())) -} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) -// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1. -template -void deque<_Tp,_Alloc>::_M_push_back_aux() { - _M_reserve_map_at_back(); - *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size()); - _STLP_TRY { - _STLP_STD::_Construct(this->_M_finish._M_cur); - this->_M_finish._M_set_node(this->_M_finish._M_node + 1); - this->_M_finish._M_cur = this->_M_finish._M_first; - } - _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1), - this->buffer_size())) -} -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - -// Called only if this->_M_start._M_cur == this->_M_start._M_first. -template -void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) { - _M_reserve_map_at_front(); - *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size()); - _STLP_TRY { - this->_M_start._M_set_node(this->_M_start._M_node - 1); - this->_M_start._M_cur = this->_M_start._M_last - 1; - _Copy_Construct(this->_M_start._M_cur, __t); - } - _STLP_UNWIND((++this->_M_start, - this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size()))) -} - - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) -// Called only if this->_M_start._M_cur == this->_M_start._M_first. -template -void deque<_Tp,_Alloc>::_M_push_front_aux() { - _M_reserve_map_at_front(); - *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size()); - _STLP_TRY { - this->_M_start._M_set_node(this->_M_start._M_node - 1); - this->_M_start._M_cur = this->_M_start._M_last - 1; - _STLP_STD::_Construct(this->_M_start._M_cur); - } - _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), - this->buffer_size()))) -} -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - -// Called only if this->_M_finish._M_cur == this->_M_finish._M_first. -template -void deque<_Tp,_Alloc>::_M_pop_back_aux() { - this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size()); - this->_M_finish._M_set_node(this->_M_finish._M_node - 1); - this->_M_finish._M_cur = this->_M_finish._M_last - 1; -} - -// Note that if the deque has at least one element (a precondition for this member -// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque -// must have at least two nodes. -template -void deque<_Tp,_Alloc>::_M_pop_front_aux() { - if (this->_M_start._M_cur != this->_M_start._M_last - 1) - ++this->_M_start._M_cur; - else { - this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size()); - this->_M_start._M_set_node(this->_M_start._M_node + 1); - this->_M_start._M_cur = this->_M_start._M_first; - } -} - -template -__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, - const value_type& __x, - const __true_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = this->size(); - value_type __x_copy = __x; - if (__elems_before <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - __pos = this->_M_start + __elems_before; - _STLP_TRY { - iterator __dst = __new_start; - iterator __src = this->_M_start; - for (; __src != __pos; ++__dst, ++__src) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_start = __new_start; - uninitialized_fill(__dst, __src, __x_copy); - __pos = __dst; - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - const difference_type __elems_after = difference_type(__length) - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - iterator __dst = __new_finish; - iterator __src = this->_M_finish; - for (--__src, --__dst; __src >= __pos; --__src, --__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_finish = __new_finish; - uninitialized_fill(__pos, __pos + __n, __x_copy); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } - return __pos; -} - -template -__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, - const value_type& __x, - const __false_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = this->size(); - value_type __x_copy = __x; - if (__elems_before <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_start; - __pos = this->_M_start + __elems_before; - _STLP_TRY { - if (__elems_before >= difference_type(__n)) { - iterator __start_n = this->_M_start + difference_type(__n); - _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); - this->_M_start = __new_start; - copy(__start_n, __pos, __old_start); - fill(__pos - difference_type(__n), __pos, __x_copy); - __pos -= difference_type(__n); - } - else { - _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start, - this->_M_start, __x_copy); - this->_M_start = __new_start; - fill(__old_start, __pos, __x_copy); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_finish; - const difference_type __elems_after = - difference_type(__length) - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - if (__elems_after > difference_type(__n)) { - iterator __finish_n = this->_M_finish - difference_type(__n); - _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy_backward(__pos, __finish_n, __old_finish); - fill(__pos, __pos + difference_type(__n), __x_copy); - } - else { - _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n), - __x_copy, __pos, this->_M_finish); - this->_M_finish = __new_finish; - fill(__pos, __old_finish, __x_copy); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } - return __pos; -} - -#if !defined (_STLP_MEMBER_TEMPLATES) -template -void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, - const value_type* __first, const value_type* __last, - size_type __n, const __true_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = size(); - if (__elems_before <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - __pos = this->_M_start + __elems_before; - _STLP_TRY { - iterator __dst = __new_start; - iterator __src = this->_M_start; - for (; __src != __pos; ++__dst, ++__src) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_start = __new_start; - _STLP_PRIV __ucopy(__first, __last, __dst); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - const difference_type __elems_after = difference_type(__length) - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - iterator __dst = __new_finish; - iterator __src = this->_M_finish; - for (--__src, --__dst; __src >= __pos; --__src, --__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_finish = __new_finish; - _STLP_PRIV __ucopy(__first, __last, __pos); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } -} - -template -void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, - const value_type* __first, const value_type* __last, - size_type __n, const __false_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = size(); - if (__elems_before <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_start; - __pos = this->_M_start + __elems_before; - _STLP_TRY { - if (__elems_before >= difference_type(__n)) { - iterator __start_n = this->_M_start + difference_type(__n); - _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); - this->_M_start = __new_start; - copy(__start_n, __pos, __old_start); - copy(__first, __last, __pos - difference_type(__n)); - } - else { - const value_type* __mid = __first + (difference_type(__n) - __elems_before); - __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); - this->_M_start = __new_start; - copy(__mid, __last, __old_start); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_finish; - const difference_type __elems_after = - difference_type(__length) - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - - if (__elems_after > difference_type(__n)) { - iterator __finish_n = this->_M_finish - difference_type(__n); - _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy_backward(__pos, __finish_n, __old_finish); - copy(__first, __last, __pos); - } - else { - const value_type* __mid = __first + __elems_after; - __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy(__first, __mid, __pos); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } -} - -template -void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, - const_iterator __first, const_iterator __last, - size_type __n, const __true_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = size(); - if (__elems_before <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - __pos = this->_M_start + __elems_before; - _STLP_TRY { - iterator __dst = __new_start; - iterator __src = this->_M_start; - for (; __src != __pos; ++__dst, ++__src) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_start = __new_start; - _STLP_PRIV __ucopy(__first, __last, __dst); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - const difference_type __elems_after = difference_type(__length) - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - iterator __dst = __new_finish; - iterator __src = this->_M_finish; - for (--__src, --__dst; __src >= __pos; --__src, --__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_finish = __new_finish; - _STLP_PRIV __ucopy(__first, __last, __pos); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } -} - -template -void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, - const_iterator __first, const_iterator __last, - size_type __n, const __false_type& /*_Movable*/) { - const difference_type __elems_before = __pos - this->_M_start; - size_type __length = size(); - if (__elems_before < difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_start; - __pos = this->_M_start + __elems_before; - _STLP_TRY { - if (__elems_before >= difference_type(__n)) { - iterator __start_n = this->_M_start + __n; - _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); - this->_M_start = __new_start; - copy(__start_n, __pos, __old_start); - copy(__first, __last, __pos - difference_type(__n)); - } - else { - const_iterator __mid = __first + (__n - __elems_before); - __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); - this->_M_start = __new_start; - copy(__mid, __last, __old_start); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_finish; - const difference_type __elems_after = __length - __elems_before; - __pos = this->_M_finish - __elems_after; - _STLP_TRY { - if (__elems_after > difference_type(__n)) { - iterator __finish_n = this->_M_finish - difference_type(__n); - _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy_backward(__pos, __finish_n, __old_finish); - copy(__first, __last, __pos); - } - else { - const_iterator __mid = __first + __elems_after; - __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy(__first, __mid, __pos); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } -} -#endif /* _STLP_MEMBER_TEMPLATES */ - -template -void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) { - size_type __new_nodes - = (__new_elems + this->buffer_size() - 1) / this->buffer_size(); - _M_reserve_map_at_front(__new_nodes); - size_type __i = 1; - _STLP_TRY { - for (; __i <= __new_nodes; ++__i) - *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size()); - } - _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j) - this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size())) -} - -template -void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) { - size_type __new_nodes - = (__new_elems + this->buffer_size() - 1) / this->buffer_size(); - _M_reserve_map_at_back(__new_nodes); - size_type __i = 1; - _STLP_TRY { - for (; __i <= __new_nodes; ++__i) - *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size()); - } - _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j) - this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size())) -} - -template -void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add, - bool __add_at_front) { - size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1; - size_type __new_num_nodes = __old_num_nodes + __nodes_to_add; - - _Map_pointer __new_nstart; - if (this->_M_map_size._M_data > 2 * __new_num_nodes) { - __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2 - + (__add_at_front ? __nodes_to_add : 0); - if (__new_nstart < this->_M_start._M_node) - copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart); - else - copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1, - __new_nstart + __old_num_nodes); - } - else { - size_type __new_map_size = - this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2; - - _Map_pointer __new_map = this->_M_map.allocate(__new_map_size); - __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2 - + (__add_at_front ? __nodes_to_add : 0); - copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart); - this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data); - - this->_M_map._M_data = __new_map; - this->_M_map_size._M_data = __new_map_size; - } - - this->_M_start._M_set_node(__new_nstart); - this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); -} - -#if defined (deque) -# undef deque -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#undef __iterator__ -#undef iterator -#undef const_iterator -#undef size_type -#undef value_type - -#endif /* _STLP_DEQUE_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_deque.h b/SDK/stlport/stl/_deque.h deleted file mode 100644 index 6b8b9383..00000000 --- a/SDK/stlport/stl/_deque.h +++ /dev/null @@ -1,1097 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DEQUE_H -#define _STLP_INTERNAL_DEQUE_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -# include -#endif - -#ifndef _STLP_RANGE_ERRORS_H -# include -#endif - -/* Class invariants: - * For any nonsingular iterator i: - * i.node is the address of an element in the map array. The - * contents of i.node is a pointer to the beginning of a node. - * i.first == *(i.node) - * i.last == i.first + node_size - * i.cur is a pointer in the range [i.first, i.last). NOTE: - * the implication of this is that i.cur is always a dereferenceable - * pointer, even if i is a past-the-end iterator. - * Start and Finish are always nonsingular iterators. NOTE: this means - * that an empty deque must have one node, and that a deque - * with N elements, where N is the buffer size, must have two nodes. - * For every node other than start.node and finish.node, every element - * in the node is an initialized object. If start.node == finish.node, - * then [start.cur, finish.cur) are initialized objects, and - * the elements outside that range are uninitialized storage. Otherwise, - * [start.cur, start.last) and [finish.first, finish.cur) are initialized - * objects, and [start.first, start.cur) and [finish.cur, finish.last) - * are uninitialized storage. - * [map, map + map_size) is a valid, non-empty range. - * [start.node, finish.node] is a valid range contained within - * [map, map + map_size). - * A pointer in the range [map, map + map_size) points to an allocated node - * if and only if the pointer is in the range [start.node, finish.node]. - */ - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Deque_iterator_base { - - enum _Constants { - _blocksize = _MAX_BYTES, - __buffer_size = (sizeof(_Tp) < (size_t)_blocksize ? - ( (size_t)_blocksize / sizeof(_Tp)) : size_t(1)) - }; - - typedef random_access_iterator_tag iterator_category; - - typedef _Tp value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - typedef value_type** _Map_pointer; - - typedef _Deque_iterator_base< _Tp > _Self; - - value_type* _M_cur; - value_type* _M_first; - value_type* _M_last; - _Map_pointer _M_node; - - _Deque_iterator_base(value_type* __x, _Map_pointer __y) - : _M_cur(__x), _M_first(*__y), - _M_last(*__y + __buffer_size), _M_node(__y) {} - - _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {} - -// see comment in doc/README.evc4 and doc/README.evc8 -#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG) - _Deque_iterator_base(_Deque_iterator_base const& __other) - : _M_cur(__other._M_cur), _M_first(__other._M_first), - _M_last(__other._M_last), _M_node(__other._M_node) {} -#endif - - difference_type _M_subtract(const _Self& __x) const { - return difference_type(__buffer_size) * (_M_node - __x._M_node - 1) + - (_M_cur - _M_first) + (__x._M_last - __x._M_cur); - } - - void _M_increment() { - if (++_M_cur == _M_last) { - _M_set_node(_M_node + 1); - _M_cur = _M_first; - } - } - - void _M_decrement() { - if (_M_cur == _M_first) { - _M_set_node(_M_node - 1); - _M_cur = _M_last; - } - --_M_cur; - } - - void _M_advance(difference_type __n) { - difference_type __offset = __n + (_M_cur - _M_first); - if (__offset >= 0 && __offset < difference_type(__buffer_size)) - _M_cur += __n; - else { - difference_type __node_offset = - __offset > 0 ? __offset / __buffer_size - : -difference_type((-__offset - 1) / __buffer_size) - 1; - _M_set_node(_M_node + __node_offset); - _M_cur = _M_first + - - (__offset - __node_offset * difference_type(__buffer_size)); - } - } - - void _M_set_node(_Map_pointer __new_node) { - _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(__buffer_size); - } -}; - - -template -struct _Deque_iterator : public _Deque_iterator_base< _Tp> { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef typename _Traits::reference reference; - typedef typename _Traits::pointer pointer; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef value_type** _Map_pointer; - - typedef _Deque_iterator_base< _Tp > _Base; - typedef _Deque_iterator<_Tp, _Traits> _Self; - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef _Deque_iterator<_Tp, _NonConstTraits> iterator; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator; - - _Deque_iterator(value_type* __x, _Map_pointer __y) : - _Deque_iterator_base(__x,__y) {} - - _Deque_iterator() {} - //copy constructor for iterator and constructor from iterator for const_iterator - _Deque_iterator(const iterator& __x) : - _Deque_iterator_base(__x) {} - - reference operator*() const { - return *this->_M_cur; - } - - _STLP_DEFINE_ARROW_OPERATOR - - difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); } - - _Self& operator++() { this->_M_increment(); return *this; } - _Self operator++(int) { - _Self __tmp = *this; - ++*this; - return __tmp; - } - - _Self& operator--() { this->_M_decrement(); return *this; } - _Self operator--(int) { - _Self __tmp = *this; - --*this; - return __tmp; - } - - _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; } - _Self operator+(difference_type __n) const { - _Self __tmp = *this; - return __tmp += __n; - } - - _Self& operator-=(difference_type __n) { return *this += -__n; } - _Self operator-(difference_type __n) const { - _Self __tmp = *this; - return __tmp -= __n; - } - - reference operator[](difference_type __n) const { return *(*this + __n); } -}; - - -template -inline _Deque_iterator<_Tp, _Traits> _STLP_CALL -operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x) -{ return __x + __n; } - - -#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -template -inline bool _STLP_CALL -operator==(const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) -{ return __x._M_cur == __y._M_cur; } - -template -inline bool _STLP_CALL -operator < (const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) { - return (__x._M_node == __y._M_node) ? - (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); -} - -template -inline bool _STLP_CALL -operator!=(const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) -{ return __x._M_cur != __y._M_cur; } - -template -inline bool _STLP_CALL -operator>(const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) -{ return !(__x < __y); } - -template -inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x, - const _Deque_iterator_base<_Tp >& __y) -{ return !(__y < __x); } - -#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline bool _STLP_CALL -operator==(const _Deque_iterator<_Tp, _Traits1 >& __x, - const _Deque_iterator<_Tp, _Traits2 >& __y) -{ return __x._M_cur == __y._M_cur; } - -template -inline bool _STLP_CALL -operator < (const _Deque_iterator<_Tp, _Traits1 >& __x, - const _Deque_iterator<_Tp, _Traits2 >& __y) { - return (__x._M_node == __y._M_node) ? - (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); -} - -template -inline bool _STLP_CALL -operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, - const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) -{ return __x._M_cur != __y._M_cur; } - -template -inline bool _STLP_CALL -operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, - const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL -operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, - const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) -{ return !(__x < __y); } - -template -inline bool _STLP_CALL -operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, - const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) -{ return !(__y < __x); } -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -_STLP_MOVE_TO_STD_NAMESPACE -template -struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -_STLP_MOVE_TO_STD_NAMESPACE -template inline _Tp* _STLP_CALL -value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; } -template inline random_access_iterator_tag _STLP_CALL -iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); } -template inline ptrdiff_t* _STLP_CALL -distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; } -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -/* Deque base class. It has two purposes. First, its constructor - * and destructor allocate (but don't initialize) storage. This makes - * exception safety easier. Second, the base class encapsulates all of - * the differences between SGI-style allocators and standard-conforming - * allocators. - */ - -template -class _Deque_base { - typedef _Deque_base<_Tp, _Alloc> _Self; -public: - typedef _Tp value_type; - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; - typedef _STLP_alloc_proxy _Alloc_proxy; - - typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type; - typedef _STLP_alloc_proxy _Map_alloc_proxy; - - typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; - typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator; - - static size_t _STLP_CALL buffer_size() { return (size_t)_Deque_iterator_base<_Tp>::__buffer_size; } - - _Deque_base(const allocator_type& __a, size_t __num_elements) - : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0), - _M_map_size(__a, (size_t)0) - { _M_initialize_map(__num_elements); } - - _Deque_base(const allocator_type& __a) - : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0), - _M_map_size(__a, (size_t)0) {} - - _Deque_base(__move_source<_Self> src) - : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), - _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)), - _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) { - src.get()._M_map._M_data = 0; - src.get()._M_map_size._M_data = 0; - src.get()._M_finish = src.get()._M_start; - } - - ~_Deque_base(); - -protected: - void _M_initialize_map(size_t); - void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); - void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); - enum { _S_initial_map_size = 8 }; - -protected: - iterator _M_start; - iterator _M_finish; - _Map_alloc_proxy _M_map; - _Alloc_proxy _M_map_size; -}; - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define deque _STLP_PTR_IMPL_NAME(deque) -#elif defined (_STLP_DEBUG) -# define deque _STLP_NON_DBG_NAME(deque) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc> -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque) - , public __stlport_class > -#endif -{ - typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base; - typedef deque<_Tp, _Alloc> _Self; -public: // Basic types - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag _Iterator_category; - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Base::allocator_type allocator_type; - -public: // Iterators - typedef typename _Base::iterator iterator; - typedef typename _Base::const_iterator const_iterator; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -protected: // Internal typedefs - typedef pointer* _Map_pointer; - typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialAss; - typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialCpy; - typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit; -#if !defined (_STLP_NO_MOVE_SEMANTIC) - typedef typename __move_traits<_Tp>::implemented _Movable; -#else - typedef __false_type _Movable; -#endif - -public: // Basic accessors - iterator begin() { return this->_M_start; } - iterator end() { return this->_M_finish; } - const_iterator begin() const { return const_iterator(this->_M_start); } - const_iterator end() const { return const_iterator(this->_M_finish); } - - reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); } - reverse_iterator rend() { return reverse_iterator(this->_M_start); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(this->_M_finish); } - const_reverse_iterator rend() const - { return const_reverse_iterator(this->_M_start); } - - reference operator[](size_type __n) - { return this->_M_start[difference_type(__n)]; } - const_reference operator[](size_type __n) const - { return this->_M_start[difference_type(__n)]; } - - void _M_range_check(size_type __n) const { - if (__n >= this->size()) - __stl_throw_out_of_range("deque"); - } - reference at(size_type __n) - { _M_range_check(__n); return (*this)[__n]; } - const_reference at(size_type __n) const - { _M_range_check(__n); return (*this)[__n]; } - - reference front() { return *this->_M_start; } - reference back() { - iterator __tmp = this->_M_finish; - --__tmp; - return *__tmp; - } - const_reference front() const { return *this->_M_start; } - const_reference back() const { - const_iterator __tmp = this->_M_finish; - --__tmp; - return *__tmp; - } - - size_type size() const { return this->_M_finish - this->_M_start; } - size_type max_size() const { return size_type(-1); } - bool empty() const { return this->_M_finish == this->_M_start; } - allocator_type get_allocator() const { return this->_M_map_size; } - -public: // Constructor, destructor. -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit deque(const allocator_type& __a = allocator_type()) -#else - deque() - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {} - deque(const allocator_type& __a) -#endif - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {} - - deque(const _Self& __x) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size()) - { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) -private: - void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) - { _M_fill_initialize(__val, _TrivialInit()); } -public: - explicit deque(size_type __n) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) - { _M_initialize(__n); } - deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type()) -#else - explicit deque(size_type __n) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) - { _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit()); } - deque(size_type __n, const value_type& __val) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) - { _M_fill_initialize(__val, __false_type()); } - deque(size_type __n, const value_type& __val, const allocator_type& __a) -#endif - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n) - { _M_fill_initialize(__val, __false_type()); } - -#if defined (_STLP_MEMBER_TEMPLATES) -protected: - template - void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) { - this->_M_initialize_map(__n); - _M_fill_initialize(__x, __false_type()); - } - - template - void _M_initialize_dispatch(_InputIter __first, _InputIter __last, - const __false_type&) { - _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); - } - -public: - // Check whether it's an integral type. If so, it's not an iterator. - template - deque(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - deque(_InputIterator __first, _InputIterator __last) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__first, __last, _Integral()); - } -# endif - -#else - deque(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type() ) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first) - { _STLP_PRIV __ucopy(__first, __last, this->_M_start); } - - deque(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type() ) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first) - { _STLP_PRIV __ucopy(__first, __last, this->_M_start); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - deque(__move_source<_Self> src) - : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) - {} - - ~deque() - { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); } - - _Self& operator= (const _Self& __x); - - void swap(_Self& __x) { - _STLP_STD::swap(this->_M_start, __x._M_start); - _STLP_STD::swap(this->_M_finish, __x._M_finish); - this->_M_map.swap(__x._M_map); - this->_M_map_size.swap(__x._M_map_size); - } - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void _M_fill_assign(size_type __n, const _Tp& __val) { - if (__n > size()) { - _STLP_STD::fill(begin(), end(), __val); - insert(end(), __n - size(), __val); - } - else { - erase(begin() + __n, end()); - _STLP_STD::fill(begin(), end(), __val); - } - } - - void assign(size_type __n, const _Tp& __val) { - _M_fill_assign(__n, __val); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - -private: // helper functions for assign() - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) - { _M_fill_assign((size_type) __n, (_Tp) __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - const __false_type& /*_IsIntegral*/) { - _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); - } - - template - void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) { - iterator __cur = begin(); - for ( ; __first != __last && __cur != end(); ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - erase(__cur, end()); - else - insert(end(), __first, __last); - } - - template - void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { -#else - void assign(const value_type *__first, const value_type *__last) { - size_type __size = size(); - size_type __len = __last - __first; - if (__len > __size) { - const value_type *__mid = __first + __size; - copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - else { - erase(copy(__first, __last, begin()), end()); - } - } - void assign(const_iterator __first, const_iterator __last) { - typedef const_iterator _ForwardIterator; -#endif /* _STLP_MEMBER_TEMPLATES */ - size_type __len = distance(__first, __last); - if (__len > size()) { - _ForwardIterator __mid = __first; - advance(__mid, size()); - copy(__first, __mid, begin()); - insert(end(), __mid, __last); - } - else { - erase(copy(__first, __last, begin()), end()); - } - } - - -public: // push_* and pop_* - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void push_back(const value_type& __t) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) { - _Copy_Construct(this->_M_finish._M_cur, __t); - ++this->_M_finish._M_cur; - } - else - _M_push_back_aux_v(__t); - } -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void push_front(const value_type& __t) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - if (this->_M_start._M_cur != this->_M_start._M_first) { - _Copy_Construct(this->_M_start._M_cur - 1, __t); - --this->_M_start._M_cur; - } - else - _M_push_front_aux_v(__t); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back() { - if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) { - _STLP_STD::_Construct(this->_M_finish._M_cur); - ++this->_M_finish._M_cur; - } - else - _M_push_back_aux(); - } - void push_front() { - if (this->_M_start._M_cur != this->_M_start._M_first) { - _STLP_STD::_Construct(this->_M_start._M_cur - 1); - --this->_M_start._M_cur; - } - else - _M_push_front_aux(); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void pop_back() { - if (this->_M_finish._M_cur != this->_M_finish._M_first) { - --this->_M_finish._M_cur; - _STLP_STD::_Destroy(this->_M_finish._M_cur); - } - else { - _M_pop_back_aux(); - _STLP_STD::_Destroy(this->_M_finish._M_cur); - } - } - - void pop_front() { - _STLP_STD::_Destroy(this->_M_start._M_cur); - _M_pop_front_aux(); - } - -public: // Insert - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - iterator insert(iterator __pos, const value_type& __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - if (__pos._M_cur == this->_M_start._M_cur) { - push_front(__x); - return this->_M_start; - } - else if (__pos._M_cur == this->_M_finish._M_cur) { - push_back(__x); - iterator __tmp = this->_M_finish; - --__tmp; - return __tmp; - } - else { - return _M_fill_insert_aux(__pos, 1, __x, _Movable()); - } - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) - { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) - { _M_fill_insert(__pos, __n, __x); } - -protected: - iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/); - iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/); - - void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - const __true_type& /*_IsIntegral*/) { - _M_fill_insert(__pos, (size_type) __n, (value_type) __x); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type& /*_IsIntegral*/) { - _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); - } - -public: - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - -#else /* _STLP_MEMBER_TEMPLATES */ - void _M_insert_range_aux(iterator __pos, - const value_type* __first, const value_type* __last, - size_type __n, const __true_type& /*_Movable*/); - void _M_insert_range_aux(iterator __pos, - const value_type* __first, const value_type* __last, - size_type __n, const __false_type& /*_Movable*/); - void _M_insert_range_aux(iterator __pos, - const_iterator __first, const_iterator __last, - size_type __n, const __true_type& /*_Movable*/); - void _M_insert_range_aux(iterator __pos, - const_iterator __first, const_iterator __last, - size_type __n, const __false_type& /*_Movable*/); -public: - void insert(iterator __pos, - const value_type* __first, const value_type* __last); - void insert(iterator __pos, - const_iterator __first, const_iterator __last); - -#endif /* _STLP_MEMBER_TEMPLATES */ - -public: -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, - const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void resize(size_type __new_size, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const size_type __len = size(); - if (__new_size < __len) - erase(this->_M_start + __new_size, this->_M_finish); - else - insert(this->_M_finish, __new_size - __len, __x); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) - { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -protected: - iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/); - iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/); - - iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/); - iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/); -public: // Erase - iterator erase(iterator __pos) { - return _M_erase(__pos, _Movable()); - } - iterator erase(iterator __first, iterator __last) { - if (__first == this->_M_start && __last == this->_M_finish) { - clear(); - return this->_M_finish; - } - else { - if (__first == __last) - return __first; - return _M_erase(__first, __last, _Movable()); - } - } - void clear(); - -protected: // Internal construction/destruction - - void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/) - {} - void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/); - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_range_initialize(_InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - this->_M_initialize_map(0); - _STLP_TRY { - for ( ; __first != __last; ++__first) - push_back(*__first); - } - _STLP_UNWIND(clear()) - } - template - void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - size_type __n = distance(__first, __last); - this->_M_initialize_map(__n); - _Map_pointer __cur_node = this->_M_start._M_node; - _STLP_TRY { - for (; __cur_node < this->_M_finish._M_node; ++__cur_node) { - _ForwardIterator __mid = __first; - advance(__mid, this->buffer_size()); - uninitialized_copy(__first, __mid, *__cur_node); - __first = __mid; - } - uninitialized_copy(__first, __last, this->_M_finish._M_first); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node))) - } -#endif /* _STLP_MEMBER_TEMPLATES */ - -protected: // Internal push_* and pop_* - - void _M_push_back_aux_v(const value_type&); - void _M_push_front_aux_v(const value_type&); -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void _M_push_back_aux(); - void _M_push_front_aux(); -#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/ - void _M_pop_back_aux(); - void _M_pop_front_aux(); - -protected: // Internal insert functions - -#if defined (_STLP_MEMBER_TEMPLATES) - - template - void _M_insert(iterator __pos, - _InputIterator __first, - _InputIterator __last, - const input_iterator_tag &) { - copy(__first, __last, inserter(*this, __pos)); - } - - template - void _M_insert(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - size_type __n = distance(__first, __last); - if (__pos._M_cur == this->_M_start._M_cur) { - iterator __new_start = _M_reserve_elements_at_front(__n); - _STLP_TRY { - uninitialized_copy(__first, __last, __new_start); - this->_M_start = __new_start; - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else if (__pos._M_cur == this->_M_finish._M_cur) { - iterator __new_finish = _M_reserve_elements_at_back(__n); - _STLP_TRY { - uninitialized_copy(__first, __last, this->_M_finish); - this->_M_finish = __new_finish; - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } - else - _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); - } - - template - void _M_insert_range_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - size_type __n, const __true_type& /*_Movable*/) { - const difference_type __elemsbefore = __pos - this->_M_start; - size_type __length = size(); - if (__elemsbefore <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - __pos = this->_M_start + __elemsbefore; - _STLP_TRY { - iterator __dst = __new_start; - iterator __src = this->_M_start; - for (; __src != __pos; ++__dst, ++__src) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_start = __new_start; - uninitialized_copy(__first, __last, __dst); - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - const difference_type __elemsafter = difference_type(__length) - __elemsbefore; - __pos = this->_M_finish - __elemsafter; - _STLP_TRY { - iterator __dst = __new_finish; - iterator __src = this->_M_finish; - for (--__src, --__dst; __src >= __pos; --__src, --__dst) { - _STLP_STD::_Move_Construct(&(*__dst), *__src); - _STLP_STD::_Destroy_Moved(&(*__src)); - } - this->_M_finish = __new_finish; - uninitialized_copy(__first, __last, __pos); - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } - } - - template - void _M_insert_range_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - size_type __n, const __false_type& /*_Movable*/) { - const difference_type __elemsbefore = __pos - this->_M_start; - size_type __length = size(); - if (__elemsbefore <= difference_type(__length / 2)) { - iterator __new_start = _M_reserve_elements_at_front(__n); - iterator __old_start = this->_M_start; - __pos = this->_M_start + __elemsbefore; - _STLP_TRY { - if (__elemsbefore >= difference_type(__n)) { - iterator __start_n = this->_M_start + difference_type(__n); - uninitialized_copy(this->_M_start, __start_n, __new_start); - this->_M_start = __new_start; - copy(__start_n, __pos, __old_start); - copy(__first, __last, __pos - difference_type(__n)); - } - else { - _ForwardIterator __mid = __first; - advance(__mid, difference_type(__n) - __elemsbefore); - _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); - this->_M_start = __new_start; - copy(__mid, __last, __old_start); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) - } - else { - iterator __new_finish = _M_reserve_elements_at_back(__n); - iterator __old_finish = this->_M_finish; - const difference_type __elemsafter = difference_type(__length) - __elemsbefore; - __pos = this->_M_finish - __elemsafter; - _STLP_TRY { - if (__elemsafter > difference_type(__n)) { - iterator __finish_n = this->_M_finish - difference_type(__n); - uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy_backward(__pos, __finish_n, __old_finish); - copy(__first, __last, __pos); - } - else { - _ForwardIterator __mid = __first; - advance(__mid, __elemsafter); - _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); - this->_M_finish = __new_finish; - copy(__first, __mid, __pos); - } - } - _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) - } - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - iterator _M_reserve_elements_at_front(size_type __n) { - size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first; - if (__n > __vacancies) - _M_new_elements_at_front(__n - __vacancies); - return this->_M_start - difference_type(__n); - } - - iterator _M_reserve_elements_at_back(size_type __n) { - size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1; - if (__n > __vacancies) - _M_new_elements_at_back(__n - __vacancies); - return this->_M_finish + difference_type(__n); - } - - void _M_new_elements_at_front(size_type __new_elements); - void _M_new_elements_at_back(size_type __new_elements); - -protected: // Allocation of _M_map and nodes - - // Makes sure the _M_map has space for new nodes. Does not actually - // add the nodes. Can invalidate _M_map pointers. (And consequently, - // deque iterators.) - - void _M_reserve_map_at_back (size_type __nodes_to_add = 1) { - if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data)) - _M_reallocate_map(__nodes_to_add, false); - } - - void _M_reserve_map_at_front (size_type __nodes_to_add = 1) { - if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data)) - _M_reallocate_map(__nodes_to_add, true); - } - - void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); -}; - -#if defined (deque) -# undef deque -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc> -#define _STLP_TEMPLATE_HEADER template -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - typedef typename __move_traits<_Alloc>::complete complete; -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_DEQUE_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_epilog.h b/SDK/stlport/stl/_epilog.h deleted file mode 100644 index 0747ae32..00000000 --- a/SDK/stlport/stl/_epilog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* NOTE : this header has no guards and is MEANT for multiple inclusion! - * If you are using "header protection" option with your compiler, - * please also find #pragma which disables it and put it here, to - * allow reentrancy of this header. - */ - -#ifndef _STLP_PROLOG_HEADER_INCLUDED -# error STLport epilog header can not be included as long as prolog has not be included. -#endif - -/* If the platform provides any specific epilog actions, - * like #pragmas, do include platform-specific prolog file - */ -#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) -# include -#endif - -#if !defined (_STLP_NO_POST_COMPATIBLE_SECTION) -# include -#endif - -#if defined (_STLP_USE_OWN_NAMESPACE) - -# if !defined (_STLP_DONT_REDEFINE_STD) -/* We redefine "std" to STLPORT, so that user code may use std:: transparently - * The STLPORT macro contains the STLport namespace name containing all the std - * stuff. - */ -# if defined (std) -/* - * Looks like the compiler native library on which STLport rely defined the std macro. - * This might introduce major incompatibility so report the problem to the STLport - * forum or comment the following #error at your own risk. - */ -# error Incompatible native Std library. -# endif /* std */ -# define std STLPORT -# endif /* _STLP_DONT_REDEFINE_STD */ - -#endif - -#undef _STLP_PROLOG_HEADER_INCLUDED /* defined in _prolog.h */ diff --git a/SDK/stlport/stl/_exception.h b/SDK/stlport/stl/_exception.h deleted file mode 100644 index f85841fb..00000000 --- a/SDK/stlport/stl/_exception.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -// The header contains low-level functions that interact -// with a compiler's exception-handling mechanism. It is assumed to -// be supplied with the compiler, rather than with the library, because -// it is inherently tied very closely to the compiler itself. - -// On platforms where does not exist, this header defines -// an exception base class. This is *not* a substitute for everything -// in , but it suffices to support a bare minimum of STL -// functionality. - -#ifndef _STLP_INTERNAL_EXCEPTION -#define _STLP_INTERNAL_EXCEPTION - -#if !defined (_STLP_NO_EXCEPTION_HEADER) - -# if defined ( _UNCAUGHT_EXCEPTION ) -# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT -# endif - -# if defined (_STLP_BROKEN_EXCEPTION_CLASS) -# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS -# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS -# if defined (_STLP_NO_NEW_NEW_HEADER) -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h) -# else -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception) -# endif -# undef exception -# undef bad_exception -# else -# if defined (_STLP_NO_NEW_NEW_HEADER) -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h) -# else -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception) -# endif -# endif - -# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL)) -// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6. -// the header which ships with vc6 and is included by its native -// actually turns on warnings, so we have to turn them back off. -# include -# endif - -# if defined (_STLP_USE_OWN_NAMESPACE) - -_STLP_BEGIN_NAMESPACE -# if !defined (_STLP_BROKEN_EXCEPTION_CLASS) -# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) -using _STLP_VENDOR_EXCEPT_STD::exception; -# else -using ::exception; -# endif -using _STLP_VENDOR_EXCEPT_STD::bad_exception; -# endif - -# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) -// fbp : many platforms present strange mix of -// those in various namespaces -# if !defined (_STLP_VENDOR_UNEXPECTED_STD) -# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD -# else -/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD - * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD - * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction. - */ -# if !defined (_STLP_VENDOR_TERMINATE_STD) -# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD -# endif -# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) -# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD -# endif -# endif -# if !defined (_STLP_VENDOR_TERMINATE_STD) -# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD -# endif -# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) -# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD -# endif -# if !defined (_STLP_VENDOR_TERMINATE_STD) -# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD -# endif -# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) -# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD -# endif -// weird errors -# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) -# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) -//See config/_intel.h for reason about this workaround -using std::unexpected; -# else -using _STLP_VENDOR_UNEXPECTED_STD::unexpected; -# endif -using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler; -using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected; -# endif -using _STLP_VENDOR_TERMINATE_STD::terminate; -using _STLP_VENDOR_TERMINATE_STD::terminate_handler; -using _STLP_VENDOR_TERMINATE_STD::set_terminate; - -# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) -using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception; -# endif -# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */ -_STLP_END_NAMESPACE -# endif /* _STLP_OWN_NAMESPACE */ -#else /* _STLP_NO_EXCEPTION_HEADER */ - -/* fbp : absence of usually means that those - * functions are not going to be called by compiler. - * Still, define them for the user. - * dums: Policy modification, if the function do not behave like the Standard - * defined it we do not grant it in the STLport namespace. We will have - * compile time error rather than runtime error. - */ -#if 0 -/* -typedef void (*unexpected_handler)(); -unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY; -void unexpected(); - -typedef void (*terminate_handler)(); -terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY; -void terminate(); - -bool uncaught_exception(); // not implemented under mpw as of Jan/1999 -*/ -#endif - -#endif /* _STLP_NO_EXCEPTION_HEADER */ - -#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS) -_STLP_BEGIN_NAMESPACE - -// section 18.6.1 -class _STLP_CLASS_DECLSPEC exception { -public: -# ifndef _STLP_USE_NO_IOSTREAMS - exception() _STLP_NOTHROW; - virtual ~exception() _STLP_NOTHROW; - virtual const char* what() const _STLP_NOTHROW; -# else - exception() _STLP_NOTHROW {} - virtual ~exception() _STLP_NOTHROW {} - virtual const char* what() const _STLP_NOTHROW {return "class exception";} -# endif -}; - -// section 18.6.2.1 -class _STLP_CLASS_DECLSPEC bad_exception : public exception { -public: -# ifndef _STLP_USE_NO_IOSTREAMS - bad_exception() _STLP_NOTHROW; - ~bad_exception() _STLP_NOTHROW; - const char* what() const _STLP_NOTHROW; -# else - bad_exception() _STLP_NOTHROW {} - ~bad_exception() _STLP_NOTHROW {} - const char* what() const _STLP_NOTHROW {return "class bad_exception";} -# endif -}; - -// forward declaration -class __Named_exception; -_STLP_END_NAMESPACE -#endif - -#endif /* _STLP_INTERNAL_EXCEPTION */ diff --git a/SDK/stlport/stl/_fstream.c b/SDK/stlport/stl/_fstream.c deleted file mode 100644 index 366683f1..00000000 --- a/SDK/stlport/stl/_fstream.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_FSTREAM_C -#define _STLP_FSTREAM_C - -#ifndef _STLP_INTERNAL_FSTREAM_H -# include -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -_STLP_BEGIN_NAMESPACE - -# if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -// no wchar_t is supported for this mode -# define __BF_int_type__ int -# define __BF_pos_type__ streampos -# define __BF_off_type__ streamoff -# else -# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type -# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type -# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type -# endif - - -//---------------------------------------------------------------------- -// Public basic_filebuf<> member functions - -template -basic_filebuf<_CharT, _Traits>::basic_filebuf() - : basic_streambuf<_CharT, _Traits>(), _M_base(), - _M_constant_width(false), _M_always_noconv(false), - _M_int_buf_dynamic(false), - _M_in_input_mode(false), _M_in_output_mode(false), - _M_in_error_mode(false), _M_in_putback_mode(false), - _M_int_buf(0), _M_int_buf_EOS(0), - _M_ext_buf(0), _M_ext_buf_EOS(0), - _M_ext_buf_converted(0), _M_ext_buf_end(0), - _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)), - _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)), - _M_mmap_base(0), _M_mmap_len(0), - _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0), - _M_codecvt(0), - _M_width(1), _M_max_width(1) -{ - this->_M_setup_codecvt(locale(), false); -} - -template -basic_filebuf<_CharT, _Traits>::~basic_filebuf() { - this->close(); - _M_deallocate_buffers(); -} - - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type -basic_filebuf<_CharT, _Traits>::underflow() { - return _Underflow<_CharT, _Traits>::_M_doit(this); -} - -template -basic_filebuf<_CharT, _Traits>* -basic_filebuf<_CharT, _Traits>::close() { - bool __ok = this->is_open(); - - if (_M_in_output_mode) { - __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()), - traits_type::eof()); - __ok == __ok && this->_M_unshift(); - } - else if (_M_in_input_mode) - this->_M_exit_input_mode(); - - // Note order of arguments. We close the file even if __ok is false. - __ok = _M_base._M_close() && __ok; - - // Restore the initial state, except that we don't deallocate the buffer - // or mess with the cached codecvt information. - _M_state = _M_end_state = _State_type(); - _M_ext_buf_converted = _M_ext_buf_end = 0; - - _M_mmap_base = 0; - _M_mmap_len = 0; - - this->setg(0, 0, 0); - this->setp(0, 0); - - _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0; - - _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode - = false; - - return __ok ? this : 0; -} - -// This member function is called whenever we exit input mode. -// It unmaps the memory-mapped file, if any, and sets -// _M_in_input_mode to false. -template -void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() { - if (_M_mmap_base != 0) - _M_base._M_unmap(_M_mmap_base, _M_mmap_len); - _M_in_input_mode = false; - _M_mmap_base = 0; -} - - -//---------------------------------------------------------------------- -// basic_filebuf<> overridden protected virtual member functions - -template -streamsize basic_filebuf<_CharT, _Traits>::showmanyc() { - // Is there any possibility that reads can succeed? - if (!this->is_open() || _M_in_output_mode || _M_in_error_mode) - return -1; - else if (_M_in_putback_mode) - return this->egptr() - this->gptr(); - else if (_M_constant_width) { - streamoff __pos = _M_base._M_seek(0, ios_base::cur); - streamoff __size = _M_base._M_file_size(); - return __pos >= 0 && __size > __pos ? __size - __pos : 0; - } - else - return 0; -} - - -// Make a putback position available, if necessary, by switching to a -// special internal buffer used only for putback. The buffer is -// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base -// class only sees a piece of it at a time. (We want to make sure -// that we don't try to read a character that hasn't been initialized.) -// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size, -// but the beginning is usually not _M_pback_buf. -template -__BF_int_type__ -basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) { - const int_type __eof = traits_type::eof(); - - // If we aren't already in input mode, pushback is impossible. - if (!_M_in_input_mode) - return __eof; - - // We can use the ordinary get buffer if there's enough space, and - // if it's a buffer that we're allowed to write to. - if (this->gptr() != this->eback() && - (traits_type::eq_int_type(__c, __eof) || - traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) || - !_M_mmap_base)) { - this->gbump(-1); - if (traits_type::eq_int_type(__c, __eof) || - traits_type::eq(traits_type::to_char_type(__c), *this->gptr())) - return traits_type::to_int_type(*this->gptr()); - } - else if (!traits_type::eq_int_type(__c, __eof)) { - // Are we in the putback buffer already? - _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size); - if (_M_in_putback_mode) { - // Do we have more room in the putback buffer? - if (this->eback() != _M_pback_buf) - this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end); - else - return __eof; // No more room in the buffer, so fail. - } - else { // We're not yet in the putback buffer. - _M_saved_eback = this->eback(); - _M_saved_gptr = this->gptr(); - _M_saved_egptr = this->egptr(); - this->setg(__pback_end - 1, __pback_end - 1, __pback_end); - _M_in_putback_mode = true; - } - } - else - return __eof; - - // We have made a putback position available. Assign to it, and return. - *this->gptr() = traits_type::to_char_type(__c); - return __c; -} - -// This member function flushes the put area, and also outputs the -// character __c (unless __c is eof). Invariant: we always leave room -// in the internal buffer for one character more than the base class knows -// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but -// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1). -template -__BF_int_type__ -basic_filebuf<_CharT, _Traits>::overflow(int_type __c) { - // Switch to output mode, if necessary. - if (!_M_in_output_mode) - if (!_M_switch_to_output_mode()) - return traits_type::eof(); - - _CharT* __ibegin = this->_M_int_buf; - _CharT* __iend = this->pptr(); - this->setp(_M_int_buf, _M_int_buf_EOS - 1); - - // Put __c at the end of the internal buffer. - if (!traits_type::eq_int_type(__c, traits_type::eof())) - *__iend++ = _Traits::to_char_type(__c); - - // For variable-width encodings, output may take more than one pass. - while (__ibegin != __iend) { - const _CharT* __inext = __ibegin; - char* __enext = _M_ext_buf; - typename _Codecvt::result __status - = _M_codecvt->out(_M_state, __ibegin, __iend, __inext, - _M_ext_buf, _M_ext_buf_EOS, __enext); - if (__status == _Codecvt::noconv) { - return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend) - ? traits_type::not_eof(__c) - : _M_output_error(); - } - - // For a constant-width encoding we know that the external buffer - // is large enough, so failure to consume the entire internal buffer - // or to produce the correct number of external characters, is an error. - // For a variable-width encoding, however, we require only that we - // consume at least one internal character - else if (__status != _Codecvt::error && - (((__inext == __iend) && - (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) || - (!_M_constant_width && __inext != __ibegin))) { - // We successfully converted part or all of the internal buffer. - ptrdiff_t __n = __enext - _M_ext_buf; - if (_M_write(_M_ext_buf, __n)) - __ibegin += __inext - __ibegin; - else - return _M_output_error(); - } - else - return _M_output_error(); - } - - return traits_type::not_eof(__c); -} - -// This member function must be called before any I/O has been -// performed on the stream, otherwise it has no effect. -// -// __buf == 0 && __n == 0 means to make this stream unbuffered. -// __buf != 0 && __n > 0 means to use __buf as the stream's internal -// buffer, rather than the buffer that would otherwise be allocated -// automatically. __buf must be a pointer to an array of _CharT whose -// size is at least __n. -template -basic_streambuf<_CharT, _Traits>* -basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) { - if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode && - _M_int_buf == 0) { - if (__buf == 0 && __n == 0) - _M_allocate_buffers(0, 1); - else if (__buf != 0 && __n > 0) - _M_allocate_buffers(__buf, __n); - } - return this; -} - -template -__BF_pos_type__ -basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, - ios_base::seekdir __whence, - ios_base::openmode /* dummy */) { - if (this->is_open() && - (__off == 0 || (_M_constant_width && this->_M_base._M_in_binary_mode()))) { - - if (!_M_seek_init(__off != 0 || __whence != ios_base::cur)) - return pos_type(-1); - - // Seek to beginning or end, regardless of whether we're in input mode. - if (__whence == ios_base::beg || __whence == ios_base::end) - return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence), - _State_type()); - - // Seek relative to current position. Complicated if we're in input mode. - else if (__whence == ios_base::cur) { - if (!_M_in_input_mode) - return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence), - _State_type()); - else if (_M_mmap_base != 0) { - // __off is relative to gptr(). We need to do a bit of arithmetic - // to get an offset relative to the external file pointer. - streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base); - - // if __off == 0, we do not need to exit input mode and to shift file pointer - return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust) - : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type()); - } - else if (_M_constant_width) { // Get or set the position. - streamoff __iadj = _M_width * (this->gptr() - this->eback()); - - // Compensate for offset relative to gptr versus offset relative - // to external pointer. For a text-oriented stream, where the - // compensation is more than just pointer arithmetic, we may get - // but not set the current position. - - if (__iadj <= _M_ext_buf_end - _M_ext_buf) { - streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end); - - return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj) - : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type()); - } - } else { // Get the position. Encoding is var width. - // Get position in internal buffer. - ptrdiff_t __ipos = this->gptr() - this->eback(); - - // Get corresponding position in external buffer. - _State_type __state = _M_state; - int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_end, - __ipos); - - if (__epos >= 0) { - // Sanity check (expensive): make sure __epos is the right answer. - _State_type __tmp_state = _M_state; - _Filebuf_Tmp_Buf<_CharT> __buf(__ipos); - _CharT* __ibegin = __buf._M_ptr; - _CharT* __inext = __ibegin; - - const char* __dummy; - typename _Codecvt::result __status - = _M_codecvt->in(__tmp_state, - _M_ext_buf, _M_ext_buf + __epos, __dummy, - __ibegin, __ibegin + __ipos, __inext); - if (__status != _Codecvt::error && - (__status == _Codecvt::noconv || - (__inext == __ibegin + __ipos && - equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits())))) { - // Get the current position (at the end of the external buffer), - // then adjust it. Again, it might be a text-oriented stream. - streamoff __cur = _M_base._M_seek(0, ios_base::cur); - streamoff __adj = - _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) - - _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end); - if (__cur != -1 && __cur + __adj >= 0) - return __off == 0 ? pos_type(__cur + __adj) - : _M_seek_return(__cur + __adj, __state); - //return _M_seek_return(__cur + __adj, __state); - } - // We failed the sanity check here. - } - } - } - // Unrecognized value for __whence here. - } - - return pos_type(-1); -} - - -template -__BF_pos_type__ -basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos, - ios_base::openmode /* dummy */) { - if (this->is_open()) { - if (!_M_seek_init(true)) - return pos_type(-1); - - streamoff __off = off_type(__pos); - if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) { - _M_state = __pos.state(); - return _M_seek_return(__off, __pos.state()); - } - } - - return pos_type(-1); -} - - -template -int basic_filebuf<_CharT, _Traits>::sync() { - if (_M_in_output_mode) - return traits_type::eq_int_type(this->overflow(traits_type::eof()), - traits_type::eof()) ? -1 : 0; - return 0; -} - - -// Change the filebuf's locale. This member function has no effect -// unless it is called before any I/O is performed on the stream. -template -void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) { - if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) { - this->_M_setup_codecvt(__loc); - } -} - -//---------------------------------------------------------------------- -// basic_filebuf<> helper functions. - -//---------------------------------------- -// Helper functions for switching between modes. - -// This member function is called if we're performing the first I/O -// operation on a filebuf, or if we're performing an input operation -// immediately after a seek. -template -bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() { - if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) != 0) - && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) { - if (!_M_int_buf && !_M_allocate_buffers()) - return false; - - _M_ext_buf_converted = _M_ext_buf; - _M_ext_buf_end = _M_ext_buf; - - _M_end_state = _M_state; - - _M_in_input_mode = true; - return true; - } - - return false; -} - - -// This member function is called if we're performing the first I/O -// operation on a filebuf, or if we're performing an output operation -// immediately after a seek. -template -bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() { - if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) && - _M_in_input_mode == 0 && _M_in_error_mode == 0) { - - if (!_M_int_buf && !_M_allocate_buffers()) - return false; - - // In append mode, every write does an implicit seek to the end - // of the file. Whenever leaving output mode, the end of file - // get put in the initial shift state. - if (_M_base.__o_mode() & ios_base::app) - _M_state = _State_type(); - - this->setp(_M_int_buf, _M_int_buf_EOS - 1); - _M_in_output_mode = true; - return true; - } - - return false; -} - - -//---------------------------------------- -// Helper functions for input - -// This member function is called if there is an error during input. -// It puts the filebuf in error mode, clear the get area buffer, and -// returns eof. -// returns eof. Error mode is sticky; it is cleared only by close or -// seek. - -template -__BF_int_type__ -basic_filebuf<_CharT, _Traits>::_M_input_error() { - this->_M_exit_input_mode(); - _M_in_output_mode = false; - _M_in_error_mode = true; - this->setg(0, 0, 0); - return traits_type::eof(); -} - -template -__BF_int_type__ -basic_filebuf<_CharT, _Traits>::_M_underflow_aux() { - // We have the state and file position from the end of the internal - // buffer. This round, they become the beginning of the internal buffer. - _M_state = _M_end_state; - - // Fill the external buffer. Start with any leftover characters that - // didn't get converted last time. - if (_M_ext_buf_end > _M_ext_buf_converted) - - _M_ext_buf_end = copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf); - // boris : copy_backward did not work - //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end, - //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted)); - else - _M_ext_buf_end = _M_ext_buf; - - // Now fill the external buffer with characters from the file. This is - // a loop because occasionally we don't get enough external characters - // to make progress. - for (;;) { - ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end); - _M_ext_buf_end += __n; - - // If external buffer is empty there is nothing to do. - if (_M_ext_buf == _M_ext_buf_end) { - this->setg(0, 0, 0); - return traits_type::eof(); - } - - // Convert the external buffer to internal characters. - const char* __enext; - _CharT* __inext; - - typename _Codecvt::result __status - = _M_codecvt->in(_M_end_state, - _M_ext_buf, _M_ext_buf_end, __enext, - _M_int_buf, _M_int_buf_EOS, __inext); - - /* Error conditions: - * (1) Return value of error. - * (2) Producing internal characters without consuming external characters. - * (3) In fixed-width encodings, producing an internal sequence whose length - * is inconsistent with that of the internal sequence. - * (4) Failure to produce any characters if we have enough characters in - * the external buffer, where "enough" means the largest possible width - * of a single character. */ - if (__status == _Codecvt::noconv) - return _Noconv_input<_Traits>::_M_doit(this); - else if (__status == _Codecvt::error || - (__inext != _M_int_buf && __enext == _M_ext_buf) || - (_M_constant_width && (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) || - (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width)) - return _M_input_error(); - else if (__inext != _M_int_buf) { - _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf); - this->setg(_M_int_buf, _M_int_buf, __inext); - return traits_type::to_int_type(*_M_int_buf); - } - /* We need to go around the loop again to get more external characters. - * But if the previous read failed then don't try again for now. - * Don't enter error mode for a failed read. Error mode is sticky, - * and we might succeed if we try again. */ - if (__n <= 0) { - this->setg(0, 0, 0); - return traits_type::eof(); - } - } -} - -//---------------------------------------- -// Helper functions for output - -// This member function is called if there is an error during output. -// It puts the filebuf in error mode, clear the put area buffer, and -// returns eof. Error mode is sticky; it is cleared only by close or -// seek. -template -__BF_int_type__ -basic_filebuf<_CharT, _Traits>::_M_output_error() { - _M_in_output_mode = false; - _M_in_input_mode = false; - _M_in_error_mode = true; - this->setp(0, 0); - return traits_type::eof(); -} - - -// Write whatever sequence of characters is necessary to get back to -// the initial shift state. This function overwrites the external -// buffer, changes the external file position, and changes the state. -// Precondition: the internal buffer is empty. -template -bool basic_filebuf<_CharT, _Traits>::_M_unshift() { - if (_M_in_output_mode && !_M_constant_width) { - typename _Codecvt::result __status; - do { - char* __enext = _M_ext_buf; - __status = _M_codecvt->unshift(_M_state, - _M_ext_buf, _M_ext_buf_EOS, __enext); - if (__status == _Codecvt::noconv || - (__enext == _M_ext_buf && __status == _Codecvt::ok)) - return true; - else if (__status == _Codecvt::error) - return false; - else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf)) - return false; - } while (__status == _Codecvt::partial); - } - - return true; -} - - -//---------------------------------------- -// Helper functions for buffer allocation and deallocation - -// This member function is called when we're initializing a filebuf's -// internal and external buffers. The argument is the size of the -// internal buffer; the external buffer is sized using the character -// width in the current encoding. Preconditions: the buffers are currently -// null. __n >= 1. __buf is either a null pointer or a pointer to an -// array show size is at least __n. - -// We need __n >= 1 for two different reasons. For input, the base -// class always needs a buffer because of the semantics of underflow(). -// For output, we want to have an internal buffer that's larger by one -// element than the buffer that the base class knows about. (See -// basic_filebuf<>::overflow() for the reason.) -template -bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) { - //The major hypothesis in the following implementation is that size_t is unsigned. - //We also need streamsize byte representation to be larger or equal to the int - //representation to correctly store the encoding information. - _STLP_STATIC_ASSERT(!numeric_limits::is_signed && - sizeof(streamsize) >= sizeof(int)) - - if (__buf == 0) { - streamsize __bufsize = __n * sizeof(_CharT); - //We first check that the streamsize representation can't overflow a size_t one. - //If it can, we check that __bufsize is not higher than the size_t max value. - if ((sizeof(streamsize) > sizeof(size_t)) && - (__bufsize > __STATIC_CAST(streamsize, (numeric_limits::max)()))) - return false; - _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize))); - if (!_M_int_buf) - return false; - _M_int_buf_dynamic = true; - } - else { - _M_int_buf = __buf; - _M_int_buf_dynamic = false; - } - - streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width), - __STATIC_CAST(streamsize, _M_codecvt->max_length())); - _M_ext_buf = 0; - if ((sizeof(streamsize) < sizeof(size_t)) || - ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits::is_signed) || - (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits::max)()))) { - _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz))); - } - - if (!_M_ext_buf) { - _M_deallocate_buffers(); - return false; - } - - _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n); - _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz); - return true; -} - -// Abbreviation for the most common case. -template -bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() { - // Choose a buffer that's at least 4096 characters long and that's a - // multiple of the page size. - streamsize __default_bufsiz = - ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size(); - return _M_allocate_buffers(0, __default_bufsiz); -} - -template -void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() { - if (_M_int_buf_dynamic) - free(_M_int_buf); - free(_M_ext_buf); - _M_int_buf = 0; - _M_int_buf_EOS = 0; - _M_ext_buf = 0; - _M_ext_buf_EOS = 0; -} - - -//---------------------------------------- -// Helper functiosn for seek and imbue - -template -bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) { - // If we're in error mode, leave it. - _M_in_error_mode = false; - - // Flush the output buffer if we're in output mode, and (conditionally) - // emit an unshift sequence. - if (_M_in_output_mode) { - bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()), - traits_type::eof()); - if (__do_unshift) - __ok = __ok && this->_M_unshift(); - if (!__ok) { - _M_in_output_mode = false; - _M_in_error_mode = true; - this->setp(0, 0); - return false; - } - } - - // Discard putback characters, if any. - if (_M_in_input_mode && _M_in_putback_mode) - _M_exit_putback_mode(); - - return true; -} - - -/* Change the filebuf's locale. This member function has no effect - * unless it is called before any I/O is performed on the stream. - * This function is called on construction and on an imbue call. In the - * case of the construction the codecvt facet might be a custom one if - * the basic_filebuf user has instanciate it with a custom char_traits. - * The user will have to call imbue before any I/O operation. - */ -template -void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) { - if (has_facet<_Codecvt>(__loc)) { - _M_codecvt = &use_facet<_Codecvt>(__loc) ; - int __encoding = _M_codecvt->encoding(); - - _M_width = (max)(__encoding, 1); - _M_max_width = _M_codecvt->max_length(); - _M_constant_width = __encoding > 0; - _M_always_noconv = _M_codecvt->always_noconv(); - } - else { - _M_codecvt = 0; - _M_width = _M_max_width = 1; - _M_constant_width = _M_always_noconv = false; - if (__on_imbue) { - //This call will generate an exception reporting the problem. - use_facet<_Codecvt>(__loc); - } - } -} - -_STLP_END_NAMESPACE - -# undef __BF_int_type__ -# undef __BF_pos_type__ -# undef __BF_off_type__ - -#endif /* _STLP_FSTREAM_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_fstream.h b/SDK/stlport/stl/_fstream.h deleted file mode 100644 index b3b643c6..00000000 --- a/SDK/stlport/stl/_fstream.h +++ /dev/null @@ -1,757 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// This header defines classes basic_filebuf, basic_ifstream, -// basic_ofstream, and basic_fstream. These classes represent -// streambufs and streams whose sources or destinations are files. - -#ifndef _STLP_INTERNAL_FSTREAM_H -#define _STLP_INTERNAL_FSTREAM_H - -#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS) -# error This header file requires the -LANG:std option -#endif - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAM -# include -#endif - -#ifndef _STLP_INTERNAL_CODECVT_H -# include -#endif - -#if !defined (_STLP_USE_UNIX_IO) && !defined(_STLP_USE_WIN32_IO) && \ - !defined (_STLP_USE_UNIX_EMULATION_IO) && !defined (_STLP_USE_STDIO_IO) - -# if defined (_STLP_UNIX) || defined (__CYGWIN__) || defined (__amigaos__) || defined (__EMX__) -// open/close/read/write -# define _STLP_USE_UNIX_IO -# elif defined (_STLP_WIN32) -// CreateFile/ReadFile/WriteFile -# define _STLP_USE_WIN32_IO -# elif defined (_STLP_WIN16) || defined (_STLP_MAC) -// _open/_read/_write -# define _STLP_USE_UNIX_EMULATION_IO -# else -// fopen/fread/fwrite -# define _STLP_USE_STDIO_IO -# endif /* _STLP_UNIX */ -#endif /* mode selection */ - -#if defined (_STLP_USE_WIN32_IO) -typedef void* _STLP_fd; -#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO) -typedef int _STLP_fd; -#else -# error "Configure i/o !" -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Class _Filebuf_base, a private base class to factor out the system- -// dependent code from basic_filebuf<>. - -class _STLP_CLASS_DECLSPEC _Filebuf_base { -public: // Opening and closing files. - _Filebuf_base(); - - bool _M_open(const char*, ios_base::openmode, long __protection); - bool _M_open(const char*, ios_base::openmode); - bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode); -#if defined (_STLP_USE_WIN32_IO) - bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode); -#endif /* _STLP_USE_WIN32_IO */ - bool _M_close(); - -public: // Low-level I/O, like Unix read/write - ptrdiff_t _M_read(char* __buf, ptrdiff_t __n); - streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir); - streamoff _M_file_size(); - bool _M_write(char* __buf, ptrdiff_t __n); - -public: // Memory-mapped I/O. - void* _M_mmap(streamoff __offset, streamoff __len); - void _M_unmap(void* __mmap_base, streamoff __len); - -public: - // Returns a value n such that, if pos is the file pointer at the - // beginning of the range [first, last), pos + n is the file pointer at - // the end. On many operating systems n == __last - __first. - // In Unix, writing n characters always bumps the file position by n. - // In Windows text mode, however, it bumps the file position by n + m, - // where m is the number of newlines in the range. That's because an - // internal \n corresponds to an external two-character sequence. - streamoff _M_get_offset(char* __first, char* __last) { -#if defined (_STLP_UNIX) || defined (_STLP_MAC) - return __last - __first; -#else // defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined(N_PLAT_NLM) - return ( (_M_openmode & ios_base::binary) != 0 ) - ? (__last - __first) - : count(__first, __last, '\n') + (__last - __first); -#endif - } - - // Returns true if we're in binary mode or if we're using an OS or file - // system where there is no distinction between text and binary mode. - bool _M_in_binary_mode() const { -#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__) - return true; -#elif defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined (_STLP_VM) || defined (__EMX__) || defined(N_PLAT_NLM) - return (_M_openmode & ios_base::binary) != 0; -#else -# error "Port!" -#endif - } - - static void _S_initialize(); - -protected: // Static data members. - static size_t _M_page_size; - -protected: // Data members. - _STLP_fd _M_file_id; -#if defined (_STLP_USE_STDIO_IO) - // for stdio, the whole FILE* is being kept here - FILE* _M_file; -#endif -#if defined (_STLP_USE_WIN32_IO) - _STLP_fd _M_view_id; -#endif - - ios_base::openmode _M_openmode ; - unsigned char _M_is_open ; - unsigned char _M_should_close ; - unsigned char _M_regular_file ; - -public : - static size_t _STLP_CALL __page_size() { return _M_page_size; } - int __o_mode() const { return (int)_M_openmode; } - bool __is_open() const { return (_M_is_open !=0 ); } - bool __should_close() const { return (_M_should_close != 0); } - bool __regular_file() const { return (_M_regular_file != 0); } - _STLP_fd __get_fd() const { return _M_file_id; } -}; - -//---------------------------------------------------------------------- -// Class basic_filebuf<>. - -// Forward declaration of two helper classes. -template class _Noconv_input; -_STLP_TEMPLATE_NULL -class _Noconv_input >; - -template class _Noconv_output; -_STLP_TEMPLATE_NULL -class _Noconv_output< char_traits >; - -// There is a specialized version of underflow, for basic_filebuf, -// in fstream.cxx. - -template -class _Underflow; - -_STLP_TEMPLATE_NULL class _Underflow< char, char_traits >; - -template -class basic_filebuf : public basic_streambuf<_CharT, _Traits> { -public: // Types. - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef typename _Traits::state_type _State_type; - typedef basic_streambuf<_CharT, _Traits> _Base; - typedef basic_filebuf<_CharT, _Traits> _Self; - -public: // Constructors, destructor. - basic_filebuf(); - ~basic_filebuf(); - -public: // Opening and closing files. - bool is_open() const { return _M_base.__is_open(); } - - _Self* open(const char* __s, ios_base::openmode __m) { - return _M_base._M_open(__s, __m) ? this : 0; - } - -#if !defined (_STLP_NO_EXTENSIONS) - // These two version of open() and file descriptor getter are extensions. - _Self* open(const char* __s, ios_base::openmode __m, - long __protection) { - return _M_base._M_open(__s, __m, __protection) ? this : 0; - } - - _STLP_fd fd() const { return _M_base.__get_fd(); } - - _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { - return this->_M_open(__id, _Init_mode); - } - -# if defined (_STLP_USE_WIN32_IO) - _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { - return _M_base._M_open(__id, _Init_mode) ? this : 0; - } -# endif /* _STLP_USE_WIN32_IO */ - -#endif - - _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { - return _M_base._M_open(__id, _Init_mode) ? this : 0; - } - - _Self* close(); - -protected: // Virtual functions from basic_streambuf. - virtual streamsize showmanyc(); - virtual int_type underflow(); - - virtual int_type pbackfail(int_type = traits_type::eof()); - virtual int_type overflow(int_type = traits_type::eof()); - - virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize); - virtual pos_type seekoff(off_type, ios_base::seekdir, - ios_base::openmode = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type, - ios_base::openmode = ios_base::in | ios_base::out); - - virtual int sync(); - virtual void imbue(const locale&); - -private: // Helper functions. - - // Precondition: we are currently in putback input mode. Effect: - // switches back to ordinary input mode. - void _M_exit_putback_mode() { - this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr); - _M_in_putback_mode = false; - } - bool _M_switch_to_input_mode(); - void _M_exit_input_mode(); - bool _M_switch_to_output_mode(); - - int_type _M_input_error(); - int_type _M_underflow_aux(); - // friend class _Noconv_input<_Traits>; - // friend class _Noconv_output<_Traits>; - friend class _Underflow<_CharT, _Traits>; - - int_type _M_output_error(); - bool _M_unshift(); - - bool _M_allocate_buffers(_CharT* __buf, streamsize __n); - bool _M_allocate_buffers(); - void _M_deallocate_buffers(); - - pos_type _M_seek_return(off_type __off, _State_type __state) { - if (__off != -1) { - if (_M_in_input_mode) - _M_exit_input_mode(); - _M_in_input_mode = false; - _M_in_output_mode = false; - _M_in_putback_mode = false; - _M_in_error_mode = false; - this->setg(0, 0, 0); - this->setp(0, 0); - } - - pos_type __result(__off); - __result.state(__state); - return __result; - } - - bool _M_seek_init(bool __do_unshift); - - void _M_setup_codecvt(const locale&, bool __on_imbue = true); - -private: // Data members used in all modes. - - _Filebuf_base _M_base; - -private: // Locale-related information. - - unsigned char _M_constant_width; - unsigned char _M_always_noconv; - - // private: // Mode flags. - unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated, - // false if it was supplied by the user. - unsigned char _M_in_input_mode; - unsigned char _M_in_output_mode; - unsigned char _M_in_error_mode; - unsigned char _M_in_putback_mode; - - // Internal buffer: characters seen by the filebuf's clients. - _CharT* _M_int_buf; - _CharT* _M_int_buf_EOS; - - // External buffer: characters corresponding to the external file. - char* _M_ext_buf; - char* _M_ext_buf_EOS; - - // The range [_M_ext_buf, _M_ext_buf_converted) contains the external - // characters corresponding to the sequence in the internal buffer. The - // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that - // have been read into the external buffer but have not been converted - // to an internal sequence. - char* _M_ext_buf_converted; - char* _M_ext_buf_end; - - // State corresponding to beginning of internal buffer. - _State_type _M_state; - -private: // Data members used only in input mode. - - // Similar to _M_state except that it corresponds to - // the end of the internal buffer instead of the beginning. - _State_type _M_end_state; - - // This is a null pointer unless we are in mmap input mode. - void* _M_mmap_base; - streamoff _M_mmap_len; - -private: // Data members used only in putback mode. - _CharT* _M_saved_eback; - _CharT* _M_saved_gptr; - _CharT* _M_saved_egptr; - - typedef codecvt<_CharT, char, _State_type> _Codecvt; - const _Codecvt* _M_codecvt; - - int _M_width; // Width of the encoding (if constant), else 1 - int _M_max_width; // Largest possible width of single character. - - - enum { _S_pback_buf_size = 8 }; - _CharT _M_pback_buf[_S_pback_buf_size]; - - // for _Noconv_output -public: - bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); } - -public: - int_type - _M_do_noconv_input() { - _M_ext_buf_converted = _M_ext_buf_end; - /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end); - return traits_type::to_int_type(*_M_ext_buf); - } -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf >; -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -// public: -// helper class. -template -struct _Filebuf_Tmp_Buf { - _CharT* _M_ptr; - _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; } - ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; } -}; - - -// -// This class had to be designed very carefully to work -// with Visual C++. -// -template -class _Noconv_output { -public: - typedef typename _Traits::char_type char_type; - static bool _STLP_CALL _M_doit(basic_filebuf*, - char_type*, char_type*) - { return false; } -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits > { -public: - static bool _STLP_CALL - _M_doit(basic_filebuf >* __buf, - char* __first, char* __last) { - ptrdiff_t __n = __last - __first; - return (__buf->_M_write(__first, __n)); - } -}; - -//---------------------------------------------------------------------- -// basic_filebuf<> helper functions. - - -//---------------------------------------- -// Helper functions for switching between modes. - -// -// This class had to be designed very carefully to work -// with Visual C++. -// -template -class _Noconv_input { -public: - typedef typename _Traits::int_type int_type; - typedef typename _Traits::char_type char_type; - - static inline int_type _STLP_CALL - _M_doit(basic_filebuf*) - { return _Traits::eof(); } -}; - -_STLP_TEMPLATE_NULL -class _Noconv_input > { -public: - static inline int _STLP_CALL - _M_doit(basic_filebuf >* __buf) { - return __buf->_M_do_noconv_input(); - } -}; - -// underflow() may be called for one of two reasons. (1) We've -// been going through the special putback buffer, and we need to move back -// to the regular internal buffer. (2) We've exhausted the internal buffer, -// and we need to replentish it. -template -class _Underflow { -public: - typedef typename _Traits::int_type int_type; - typedef _Traits traits_type; - - static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this); -}; - - -// Specialization of underflow: if the character type is char, maybe -// we can use mmap instead of read. -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits > { -public: - typedef char_traits::int_type int_type; - typedef char_traits traits_type; - static int _STLP_CALL _M_doit(basic_filebuf* __this); -}; - -// There is a specialized version of underflow, for basic_filebuf, -// in fstream.cxx. - -template -_STLP_TYPENAME_ON_RETURN_TYPE _Underflow<_CharT, _Traits>::int_type // _STLP_CALL - _Underflow<_CharT, _Traits>::_M_doit(basic_filebuf<_CharT, _Traits>* __this) { - if (!__this->_M_in_input_mode) { - if (!__this->_M_switch_to_input_mode()) - return traits_type::eof(); - } - else if (__this->_M_in_putback_mode) { - __this->_M_exit_putback_mode(); - if (__this->gptr() != __this->egptr()) { - int_type __c = traits_type::to_int_type(*__this->gptr()); - return __c; - } - } - - return __this->_M_underflow_aux(); -} - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS _Underflow >; -#endif - -//---------------------------------------------------------------------- -// Class basic_ifstream<> - -template -class basic_ifstream : public basic_istream<_CharT, _Traits> { -public: // Types - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_istream<_CharT, _Traits> _Base; - typedef basic_filebuf<_CharT, _Traits> _Buf; - -public: // Constructors, destructor. - - basic_ifstream() : - basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - } - - explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) : - basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), - _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __mod | ios_base::in)) - this->setstate(ios_base::failbit); - } - -#if !defined (_STLP_NO_EXTENSIONS) - explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) : - basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod | ios_base::in)) - this->setstate(ios_base::failbit); - } - basic_ifstream(const char* __s, ios_base::openmode __m, - long __protection) : - basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __m | ios_base::in, __protection)) - this->setstate(ios_base::failbit); - } - -# if defined (_STLP_USE_WIN32_IO) - explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) : - basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod | ios_base::in)) - this->setstate(ios_base::failbit); - } -# endif /* _STLP_USE_WIN32_IO */ -#endif - - ~basic_ifstream() {} - -public: // File and buffer operations. - basic_filebuf<_CharT, _Traits>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - bool is_open() { - return this->rdbuf()->is_open(); - } - - void open(const char* __s, ios_base::openmode __mod = ios_base::in) { - if (!this->rdbuf()->open(__s, __mod | ios_base::in)) - this->setstate(ios_base::failbit); - } - - void close() { - if (!this->rdbuf()->close()) - this->setstate(ios_base::failbit); - } - -private: - basic_filebuf<_CharT, _Traits> _M_buf; -}; - - -//---------------------------------------------------------------------- -// Class basic_ofstream<> - -template -class basic_ofstream : public basic_ostream<_CharT, _Traits> { -public: // Types - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_ostream<_CharT, _Traits> _Base; - typedef basic_filebuf<_CharT, _Traits> _Buf; - -public: // Constructors, destructor. - basic_ofstream() : - basic_ios<_CharT, _Traits>(), - basic_ostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - } - explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out) - : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __mod | ios_base::out)) - this->setstate(ios_base::failbit); - } - -#if !defined (_STLP_NO_EXTENSIONS) - explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out) - : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), - _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod | ios_base::out)) - this->setstate(ios_base::failbit); - } - basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) : - basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __m | ios_base::out, __protection)) - this->setstate(ios_base::failbit); - } -# if defined (_STLP_USE_WIN32_IO) - explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out) - : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), - _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod | ios_base::out)) - this->setstate(ios_base::failbit); - } -# endif /* _STLP_USE_WIN32_IO */ -#endif - - ~basic_ofstream() {} - -public: // File and buffer operations. - basic_filebuf<_CharT, _Traits>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - bool is_open() { - return this->rdbuf()->is_open(); - } - - void open(const char* __s, ios_base::openmode __mod= ios_base::out) { - if (!this->rdbuf()->open(__s, __mod | ios_base::out)) - this->setstate(ios_base::failbit); - } - - void close() { - if (!this->rdbuf()->close()) - this->setstate(ios_base::failbit); - } - -private: - basic_filebuf<_CharT, _Traits> _M_buf; -}; - - -//---------------------------------------------------------------------- -// Class basic_fstream<> - -template -class basic_fstream : public basic_iostream<_CharT, _Traits> { -public: // Types - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_iostream<_CharT, _Traits> _Base; - typedef basic_filebuf<_CharT, _Traits> _Buf; - -public: // Constructors, destructor. - - basic_fstream() - : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - } - - explicit basic_fstream(const char* __s, - ios_base::openmode __mod = ios_base::in | ios_base::out) : - basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __mod)) - this->setstate(ios_base::failbit); - } - -#if !defined (_STLP_NO_EXTENSIONS) - explicit basic_fstream(int __id, - ios_base::openmode __mod = ios_base::in | ios_base::out) : - basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod)) - this->setstate(ios_base::failbit); - } - basic_fstream(const char* __s, ios_base::openmode __m, long __protection) : - basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__s, __m, __protection)) - this->setstate(ios_base::failbit); - } -# if defined (_STLP_USE_WIN32_IO) - explicit basic_fstream(_STLP_fd __id, - ios_base::openmode __mod = ios_base::in | ios_base::out) : - basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { - this->init(&_M_buf); - if (!_M_buf.open(__id, __mod)) - this->setstate(ios_base::failbit); - } -# endif /* _STLP_USE_WIN32_IO */ -#endif - ~basic_fstream() {} - -public: // File and buffer operations. - - basic_filebuf<_CharT, _Traits>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - bool is_open() { - return this->rdbuf()->is_open(); - } - - void open(const char* __s, - ios_base::openmode __mod = - ios_base::in | ios_base::out) { - if (!this->rdbuf()->open(__s, __mod)) - this->setstate(ios_base::failbit); - } - - void close() { - if (!this->rdbuf()->close()) - this->setstate(ios_base::failbit); - } - -private: - basic_filebuf<_CharT, _Traits> _M_buf; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - typedef basic_fstream<_CharT, _Traits> _Self; - //explicitely defined as private to avoid warnings: - basic_fstream(_Self const&); - _Self& operator = (_Self const&); -#endif -}; - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream >; -_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream >; -_STLP_EXPORT_TEMPLATE_CLASS basic_fstream >; -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream >; -_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream >; -_STLP_EXPORT_TEMPLATE_CLASS basic_fstream >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_FSTREAM */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_function.h b/SDK/stlport/stl/_function.h deleted file mode 100644 index c9d7888b..00000000 --- a/SDK/stlport/stl/_function.h +++ /dev/null @@ -1,427 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_FUNCTION_H -#define _STLP_INTERNAL_FUNCTION_H - -#ifndef _STLP_TYPE_TRAITS_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -struct not_equal_to : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } -}; - -template -struct greater : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } -}; - -template -struct greater_equal : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } -}; - -template -struct less_equal : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } -}; - -template -struct divides : public binary_function<_Tp, _Tp, _Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } -}; - -template -struct modulus : public binary_function<_Tp, _Tp, _Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } -}; - -template -struct negate : public unary_function<_Tp, _Tp> { - _Tp operator()(const _Tp& __x) const { return -__x; } -}; - -template -struct logical_and : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } -}; - -template -struct logical_or : public binary_function<_Tp, _Tp,bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } -}; - -template -struct logical_not : public unary_function<_Tp, bool> { - bool operator()(const _Tp& __x) const { return !__x; } -}; - -#if !defined (_STLP_NO_EXTENSIONS) -// identity_element (not part of the C++ standard). -template inline _Tp identity_element(plus<_Tp>) { return _Tp(0); } -template inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); } -#endif - -#if defined (_STLP_BASE_TYPEDEF_BUG) -// this workaround is needed for SunPro 4.0.1 -// suggested by "Martin Abernethy" : - -// We have to introduce the XXary_predicate_aux structures in order to -// access the argument and return types of predicate functions supplied -// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters -// of the form 'name1::name2', where name1 is itself a type parameter. -template -struct __pair_aux : private _Pair { - typedef typename _Pair::first_type first_type; - typedef typename _Pair::second_type second_type; -}; - -template -struct __unary_fun_aux : private _Operation { - typedef typename _Operation::argument_type argument_type; - typedef typename _Operation::result_type result_type; -}; - -template -struct __binary_fun_aux : private _Operation { - typedef typename _Operation::first_argument_type first_argument_type; - typedef typename _Operation::second_argument_type second_argument_type; - typedef typename _Operation::result_type result_type; -}; - -# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type -# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type -# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type -#else -# define __UNARY_ARG(__Operation,__type) __Operation::__type -# define __BINARY_ARG(__Operation,__type) __Operation::__type -# define __PAIR_ARG(__Pair,__type) __Pair::__type -#endif - -template -class unary_negate - : public unary_function { - typedef unary_function _Base; -public: - typedef typename _Base::argument_type argument_type; -private: - typedef typename __call_traits::param_type _ArgParamType; -protected: - _Predicate _M_pred; -public: - explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {} - bool operator()(_ArgParamType __x) const { - return !_M_pred(__x); - } -}; - -template -inline unary_negate<_Predicate> -not1(const _Predicate& __pred) { - return unary_negate<_Predicate>(__pred); -} - -template -class binary_negate - : public binary_function { - typedef binary_function _Base; -public: - typedef typename _Base::first_argument_type first_argument_type; - typedef typename _Base::second_argument_type second_argument_type; -private: - typedef typename __call_traits::param_type _FstArgParamType; - typedef typename __call_traits::param_type _SndArgParamType; -protected: - _Predicate _M_pred; -public: - explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {} - bool operator()(_FstArgParamType __x, _SndArgParamType __y) const { - return !_M_pred(__x, __y); - } -}; - -template -inline binary_negate<_Predicate> -not2(const _Predicate& __pred) { - return binary_negate<_Predicate>(__pred); -} - -template -class binder1st : - public unary_function { - typedef unary_function _Base; -public: - typedef typename _Base::argument_type argument_type; - typedef typename _Base::result_type result_type; -private: - typedef typename __call_traits::param_type _ArgParamType; - typedef typename __call_traits::param_type _ValueParamType; -protected: - //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant. - _Operation op; - typename _Operation::first_argument_type _M_value; -public: - binder1st(const _Operation& __x, _ValueParamType __y) - : op(__x), _M_value(__y) {} - - result_type operator()(_ArgParamType __x) const { - return op(_M_value, __x); - } -}; - -template -inline binder1st<_Operation> -bind1st(const _Operation& __fn, const _Tp& __x) { - typedef typename _Operation::first_argument_type _Arg1_type; - return binder1st<_Operation>(__fn, _Arg1_type(__x)); -} - -template -class binder2nd - : public unary_function { - typedef unary_function _Base; -public: - typedef typename _Base::argument_type argument_type; - typedef typename _Base::result_type result_type; -private: - typedef typename __call_traits::param_type _ArgParamType; - typedef typename __call_traits::param_type _ValueParamType; -protected: - //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant. - _Operation op; - typename _Operation::second_argument_type value; -public: - binder2nd(const _Operation& __x, _ValueParamType __y) - : op(__x), value(__y) {} - - result_type operator()(_ArgParamType __x) const { - return op(__x, value); - } -}; - -template -inline binder2nd<_Operation> -bind2nd(const _Operation& __fn, const _Tp& __x) { - typedef typename _Operation::second_argument_type _Arg2_type; - return binder2nd<_Operation>(__fn, _Arg2_type(__x)); -} - -#if !defined (_STLP_NO_EXTENSIONS) -// unary_compose and binary_compose (extensions, not part of the standard). - -template -class unary_compose : - public unary_function { - typedef unary_function _Base; -public: - typedef typename _Base::argument_type argument_type; - typedef typename _Base::result_type result_type; -private: - typedef typename __call_traits::param_type _ArgParamType; -protected: - _Operation1 _M_fn1; - _Operation2 _M_fn2; -public: - unary_compose(const _Operation1& __x, const _Operation2& __y) - : _M_fn1(__x), _M_fn2(__y) {} - - result_type operator()(_ArgParamType __x) const { - return _M_fn1(_M_fn2(__x)); - } -}; - -template -inline unary_compose<_Operation1,_Operation2> -compose1(const _Operation1& __fn1, const _Operation2& __fn2) { - return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); -} - -template -class binary_compose : - public unary_function { - typedef unary_function _Base; -public: - typedef typename _Base::argument_type argument_type; - typedef typename _Base::result_type result_type; -private: - typedef typename __call_traits::param_type _ArgParamType; -protected: - _Operation1 _M_fn1; - _Operation2 _M_fn2; - _Operation3 _M_fn3; -public: - binary_compose(const _Operation1& __x, const _Operation2& __y, - const _Operation3& __z) - : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } - - result_type operator()(_ArgParamType __x) const { - return _M_fn1(_M_fn2(__x), _M_fn3(__x)); - } -}; - -template -inline binary_compose<_Operation1, _Operation2, _Operation3> -compose2(const _Operation1& __fn1, const _Operation2& __fn2, - const _Operation3& __fn3) { - return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3); -} - -// identity is an extension: it is not part of the standard. -template struct identity : public _STLP_PRIV _Identity<_Tp> {}; -// select1st and select2nd are extensions: they are not part of the standard. -template struct select1st : public _STLP_PRIV _Select1st<_Pair> {}; -template struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {}; - -template -struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {}; - -template -struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {}; - - -// constant_void_fun, constant_unary_fun, and constant_binary_fun are -// extensions: they are not part of the standard. (The same, of course, -// is true of the helper functions constant0, constant1, and constant2.) - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Constant_void_fun { - typedef _Result result_type; - result_type _M_val; - - _Constant_void_fun(const result_type& __v) : _M_val(__v) {} - const result_type& operator()() const { return _M_val; } -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -template -struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> { - constant_void_fun(const _Result& __v) - : _STLP_PRIV _Constant_void_fun<_Result>(__v) {} -}; - -template -struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> { - constant_unary_fun(const _Result& __v) - : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {} -}; - -template -struct constant_binary_fun - : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> { - constant_binary_fun(const _Result& __v) - : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} -}; - -template -inline constant_void_fun<_Result> constant0(const _Result& __val) { - return constant_void_fun<_Result>(__val); -} - -template -inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) { - return constant_unary_fun<_Result,_Result>(__val); -} - -template -inline constant_binary_fun<_Result,_Result,_Result> -constant2(const _Result& __val) { - return constant_binary_fun<_Result,_Result,_Result>(__val); -} - -// subtractive_rng is an extension: it is not part of the standard. -// Note: this code assumes that int is 32 bits. -class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> { -private: - _STLP_UINT32_T _M_table[55]; - _STLP_UINT32_T _M_index1; - _STLP_UINT32_T _M_index2; -public: - _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) { - _M_index1 = (_M_index1 + 1) % 55; - _M_index2 = (_M_index2 + 1) % 55; - _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; - return _M_table[_M_index1] % __limit; - } - - void _M_initialize(_STLP_UINT32_T __seed) { - _STLP_UINT32_T __k = 1; - _M_table[54] = __seed; - _STLP_UINT32_T __i; - for (__i = 0; __i < 54; __i++) { - _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1; - _M_table[__ii] = __k; - __k = __seed - __k; - __seed = _M_table[__ii]; - } - for (int __loop = 0; __loop < 4; __loop++) { - for (__i = 0; __i < 55; __i++) - _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; - } - _M_index1 = 0; - _M_index2 = 31; - } - - subtractive_rng(unsigned int __seed) { _M_initialize(__seed); } - subtractive_rng() { _M_initialize(161803398ul); } -}; - -#endif /* _STLP_NO_EXTENSIONS */ - -_STLP_END_NAMESPACE - -#include - -#endif /* _STLP_INTERNAL_FUNCTION_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_function_adaptors.h b/SDK/stlport/stl/_function_adaptors.h deleted file mode 100644 index 1eb85e7a..00000000 --- a/SDK/stlport/stl/_function_adaptors.h +++ /dev/null @@ -1,802 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * Copyright (c) 2000 - * Pavel Kuznetsov - * - * Copyright (c) 2001 - * Meridian'93 - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -// This file has noo macro protection as it is meant to be included several times -// from other header. -// Adaptor function objects: pointers to member functions. - -// There are a total of 16 = 2^4 function objects in this family. -// (1) Member functions taking no arguments vs member functions taking -// one argument. -// (2) Call through pointer vs call through reference. -// (3) Member function with void return type vs member function with -// non-void return type. -// (4) Const vs non-const member function. - -// Note that choice (3) is nothing more than a workaround: according -// to the draft, compilers should handle void and non-void the same way. -// This feature is not yet widely implemented, though. You can only use -// member functions returning void if your compiler supports partial -// specialization. - -// All of this complexity is in the function objects themselves. You can -// ignore it by using the helper function mem_fun and mem_fun_ref, -// which create whichever type of adaptor is appropriate. - -_STLP_BEGIN_NAMESPACE - -//This implementation will only be used if needed, that is to say when there is the return void bug -//and when there is no partial template specialization -#if defined(_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined(_STLP_MEMBER_TEMPLATE_CLASSES) - -template -class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> { -protected: - typedef _Result (_Tp::*__fun_type) (); - explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> { -protected: - typedef _Result (_Tp::*__fun_type) (_Arg); - explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Const_mem_fun0_ptr : public unary_function { -protected: - typedef _Result (_Tp::*__fun_type) () const; - explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Const_mem_fun1_ptr : public binary_function { -protected: - typedef _Result (_Tp::*__fun_type) (_Arg) const; - explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(const _Tp* __p, _Arg __x) const { - return (__p->*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Mem_fun0_ref : public unary_function<_Tp&,_Result> { -protected: - typedef _Result (_Tp::*__fun_type) (); - explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Mem_fun1_ref : public binary_function<_Tp&,_Arg,_Result> { -protected: - typedef _Result (_Tp::*__fun_type) (_Arg); - explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Const_mem_fun0_ref : public unary_function { -protected: - typedef _Result (_Tp::*__fun_type) () const; - explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Const_mem_fun1_ref : public binary_function { -protected: - typedef _Result (_Tp::*__fun_type) (_Arg) const; - explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -struct _Mem_fun_traits { - template - struct _Args0 { - typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr; - typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const; - typedef _Mem_fun0_ref<_Result,_Tp> _Ref; - typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const; - }; - - template - struct _Args1 { - typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr; - typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const; - typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref; - typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const; - }; -}; - -template -class _Ptr_fun1_base : public unary_function<_Arg, _Result> { -protected: - typedef _Result (*__fun_type) (_Arg); - explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator()(_Arg __x) const { return _M_f(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> { -protected: - typedef _Result (*__fun_type) (_Arg1, _Arg2); - explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {} - -public: - _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); } - -private: - __fun_type _M_f; -}; - -template -struct _Ptr_fun_traits { - template struct _Args1 { - typedef _Ptr_fun1_base<_Arg,_Result> _Fun; - }; - - template struct _Args2 { - typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun; - }; -}; - -/*Specialization for void return type -*/ -template -class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> { -protected: - typedef void (_Tp::*__fun_type) (); - explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(_Tp* __p) const { (__p->*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> { -protected: - typedef void (_Tp::*__fun_type) (_Arg); - explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Void_const_mem_fun0_ptr : public unary_function { -protected: - typedef void (_Tp::*__fun_type) () const; - explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(const _Tp* __p) const { (__p->*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Void_const_mem_fun1_ptr : public binary_function { -protected: - typedef void (_Tp::*__fun_type) (_Arg) const; - explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Void_mem_fun0_ref : public unary_function<_Tp&,void> { -protected: - typedef void (_Tp::*__fun_type) (); - explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(_Tp& __p) const { (__p.*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Void_mem_fun1_ref : public binary_function<_Tp&,_Arg,void> { -protected: - typedef void (_Tp::*__fun_type) (_Arg); - explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Void_const_mem_fun0_ref : public unary_function { -protected: - typedef void (_Tp::*__fun_type) () const; - explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(const _Tp& __p) const { (__p.*_M_f)(); } - -private: - __fun_type _M_f; -}; - -template -class _Void_const_mem_fun1_ref : public binary_function { -protected: - typedef void (_Tp::*__fun_type) (_Arg) const; - explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} - -public: - void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); } - -private: - __fun_type _M_f; -}; - -_STLP_TEMPLATE_NULL -struct _Mem_fun_traits { - template struct _Args0 { - typedef _Void_mem_fun0_ptr<_Tp> _Ptr; - typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const; - typedef _Void_mem_fun0_ref<_Tp> _Ref; - typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const; - }; - - template struct _Args1 { - typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr; - typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const; - typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref; - typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const; - }; -}; - -template -class _Ptr_void_fun1_base : public unary_function<_Arg, void> { -protected: - typedef void (*__fun_type) (_Arg); - explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {} - -public: - void operator()(_Arg __x) const { _M_f(__x); } - -private: - __fun_type _M_f; -}; - -template -class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> { -protected: - typedef void (*__fun_type) (_Arg1, _Arg2); - explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {} - -public: - void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); } - -private: - __fun_type _M_f; -}; - -_STLP_TEMPLATE_NULL -struct _Ptr_fun_traits { - template struct _Args1 { - typedef _Ptr_void_fun1_base<_Arg> _Fun; - }; - - template struct _Args2 { - typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun; - }; -}; - -// pavel: need extra level of inheritance here since MSVC++ does not -// accept traits-based fake partial specialization for template -// arguments other than first - -template -class _Ptr_fun1 : - public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun { -protected: - typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base; - explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -template -class _Ptr_fun2 : - public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun { -protected: - typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base; - explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {} -}; - - -#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/ - - -#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES) - -template -class mem_fun_t : public unary_function<_Tp*,_Ret> { - typedef _Ret (_Tp::*__fun_type)(void); -public: - explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun_t : public unary_function { - typedef _Ret (_Tp::*__fun_type)(void) const; -public: - explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } -private: - __fun_type _M_f; -}; - - -template -class mem_fun_ref_t : public unary_function<_Tp,_Ret> { - typedef _Ret (_Tp::*__fun_type)(void); -public: - explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> { - typedef _Ret (_Tp::*__fun_type)(void) const; -public: - explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> { - typedef _Ret (_Tp::*__fun_type)(_Arg); -public: - explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun1_t : public binary_function { - typedef _Ret (_Tp::*__fun_type)(_Arg) const; -public: - explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(const _Tp* __p, _Arg __x) const - { return (__p->*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { - typedef _Ret (_Tp::*__fun_type)(_Arg); -public: - explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { - typedef _Ret (_Tp::*__fun_type)(_Arg) const; -public: - explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {} - _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class pointer_to_unary_function : public unary_function<_Arg, _Result> { -protected: - _Result (*_M_ptr)(_Arg); -public: - pointer_to_unary_function() {} - explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {} - _Result operator()(_Arg __x) const { return _M_ptr(__x); } -}; - -template -class pointer_to_binary_function : - public binary_function<_Arg1,_Arg2,_Result> { -protected: - _Result (*_M_ptr)(_Arg1, _Arg2); -public: - pointer_to_binary_function() {} - explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) - : _M_ptr(__x) {} - _Result operator()(_Arg1 __x, _Arg2 __y) const { - return _M_ptr(__x, __y); - } -}; - - -#if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) -//Partial specialization for the void type -template -class mem_fun_t : public unary_function<_Tp*,void> { - typedef void (_Tp::*__fun_type)(void); -public: - explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} - void operator()(_Tp* __p) const { (__p->*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun_t : public unary_function { - typedef void (_Tp::*__fun_type)(void) const; -public: - explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} - void operator()(const _Tp* __p) const { (__p->*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class mem_fun_ref_t : public unary_function<_Tp,void> { - typedef void (_Tp::*__fun_type)(void); -public: - explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} - void operator()(_Tp& __r) const { (__r.*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun_ref_t : public unary_function<_Tp,void> { - typedef void (_Tp::*__fun_type)(void) const; -public: - explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} - void operator()(const _Tp& __r) const { (__r.*_M_f)(); } -private: - __fun_type _M_f; -}; - -template -class mem_fun1_t : public binary_function<_Tp*,_Arg,void> { - typedef void (_Tp::*__fun_type)(_Arg); -public: - explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} - void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun1_t - : public binary_function { - typedef void (_Tp::*__fun_type)(_Arg) const; -public: - explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} - void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class mem_fun1_ref_t - : public binary_function<_Tp,_Arg,void> { - typedef void (_Tp::*__fun_type)(_Arg); -public: - explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} - void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class const_mem_fun1_ref_t - : public binary_function<_Tp,_Arg,void> { - typedef void (_Tp::*__fun_type)(_Arg) const; -public: - explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} - void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } -private: - __fun_type _M_f; -}; - -template -class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> { - typedef void (*__fun_type)(_Arg); - __fun_type _M_ptr; -public: - pointer_to_unary_function() {} - explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {} - void operator()(_Arg __x) const { _M_ptr(__x); } -}; - -template -class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> { - typedef void (*__fun_type)(_Arg1, _Arg2); - __fun_type _M_ptr; -public: - pointer_to_binary_function() {} - explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {} - void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); } -}; - -#endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/ - -#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/ - -//mem_fun_t -template -class mem_fun_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base; -public: - explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//const_mem_fun_t -template -class const_mem_fun_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base; -public: - explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//mem_fun_ref_t -template -class mem_fun_ref_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base; -public: - explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//const_mem_fun_ref_t -template -class const_mem_fun_ref_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base; -public: - explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//mem_fun1_t -template -class mem_fun1_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base; -public: - explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//const_mem_fun1_t -template -class const_mem_fun1_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base; -public: - explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//mem_fun1_ref_t -template -class mem_fun1_ref_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base; -public: - explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - -//const_mem_fun1_t -template -class const_mem_fun1_ref_t : - public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const { - typedef typename - _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base; -public: - explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} -}; - - -template -class pointer_to_unary_function : -public _Ptr_fun1<_Result,_Arg> { - typedef typename - _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type; -public: - explicit pointer_to_unary_function(__fun_type __f) - : _Ptr_fun1<_Result,_Arg>(__f) {} -}; - -template -class pointer_to_binary_function : -public _Ptr_fun2<_Result,_Arg1,_Arg2> { - typedef typename - _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type; -public: - explicit pointer_to_binary_function(__fun_type __f) - : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {} -}; - -#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/ - - -# if !defined (_STLP_MEMBER_POINTER_PARAM_BUG) -// Mem_fun adaptor helper functions. There are only two: -// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref -// are provided for backward compatibility, but they are no longer -// part of the C++ standard.) - -template -inline mem_fun_t<_Result,_Tp> -mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); } - -template -inline const_mem_fun_t<_Result,_Tp> -mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); } - -template -inline mem_fun_ref_t<_Result,_Tp> -mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); } - -template -inline const_mem_fun_ref_t<_Result,_Tp> -mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); } - -template -inline mem_fun1_t<_Result,_Tp,_Arg> -mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); } - -template -inline const_mem_fun1_t<_Result,_Tp,_Arg> -mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); } - -template -inline mem_fun1_ref_t<_Result,_Tp,_Arg> -mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } - -template -inline const_mem_fun1_ref_t<_Result,_Tp,_Arg> -mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } - -# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS)) -// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard, -// but they are provided for backward compatibility. -template -inline mem_fun1_t<_Result,_Tp,_Arg> -mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); } - -template -inline const_mem_fun1_t<_Result,_Tp,_Arg> -mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); } - -template -inline mem_fun1_ref_t<_Result,_Tp,_Arg> -mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } - -template -inline const_mem_fun1_ref_t<_Result,_Tp,_Arg> -mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } - -# endif /* _STLP_NO_EXTENSIONS */ - -# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */ - -template -inline pointer_to_unary_function<_Arg, _Result> -ptr_fun(_Result (*__f)(_Arg)) -{ return pointer_to_unary_function<_Arg, _Result>(__f); } - -template -inline pointer_to_binary_function<_Arg1,_Arg2,_Result> -ptr_fun(_Result (*__f)(_Arg1, _Arg2)) -{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); } - -_STLP_END_NAMESPACE diff --git a/SDK/stlport/stl/_function_base.h b/SDK/stlport/stl/_function_base.h deleted file mode 100644 index 5bb9b94b..00000000 --- a/SDK/stlport/stl/_function_base.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -#define _STLP_INTERNAL_FUNCTION_BASE_H - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -struct unary_function { - typedef _Arg argument_type; - typedef _Result result_type; -}; - -template -struct binary_function { - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; -}; - -template -struct equal_to : public binary_function<_Tp, _Tp, bool> { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } -}; - -template -struct less : public binary_function<_Tp,_Tp,bool> -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -/* less is the default template parameter for many STL containers, to fully use - * the move constructor feature we need to know that the default less is just a - * functor. - */ - , public __stlport_class > -#endif -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - //This is for a very special compiler config: partial template specialization - //but no template function partial ordering. - void swap(less<_Tp>&) {} -#endif -}; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits > { -#if !defined (__BORLANDC__) - typedef typename _IsSTLportClass >::_Ret _STLportLess; -#else - enum { _Is = _IsSTLportClass >::_Is }; - typedef typename __bool2type<_Is>::_Ret _STLportLess; -#endif - typedef _STLportLess has_trivial_default_constructor; - typedef _STLportLess has_trivial_copy_constructor; - typedef _STLportLess has_trivial_assignment_operator; - typedef _STLportLess has_trivial_destructor; - typedef _STLportLess is_POD_type; -}; -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -less<_Tp> __less(_Tp* ) { return less<_Tp>(); } - -template -equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); } - -_STLP_MOVE_TO_STD_NAMESPACE - -template -struct plus : public binary_function<_Tp, _Tp, _Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } -}; - -template -struct minus : public binary_function<_Tp, _Tp, _Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } -}; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); } - -template -minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); } - -_STLP_MOVE_TO_STD_NAMESPACE - -template -struct multiplies : public binary_function<_Tp, _Tp, _Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } -}; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { - const typename _Pair::first_type& operator()(const _Pair& __x) const { - return __x.first; - } -}; - -template -struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { - const typename _Pair::second_type& operator()(const _Pair& __x) const { - return __x.second; - } -}; - -// project1st and project2nd are extensions: they are not part of the standard -template -struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> { - _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; } -}; - -template -struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { - _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } -}; - -#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG) -// fbp : sort of select1st just for maps -template -// JDJ (CW Pro1 doesn't like const when first_type is also const) -struct __Select1st_hint : public unary_function<_Pair, _Whatever> { - const _Whatever& operator () (const _Pair& __x) const { return __x.first; } -}; -# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y > -#else -# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x > -#endif - -template -struct _Identity : public unary_function<_Tp,_Tp> { - const _Tp& operator()(const _Tp& __x) const { return __x; } -}; - -template -struct _Constant_unary_fun { - typedef _Argument argument_type; - typedef _Result result_type; - result_type _M_val; - - _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} - const result_type& operator()(const _Argument&) const { return _M_val; } -}; - -template -struct _Constant_binary_fun { - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; - _Result _M_val; - - _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} - const result_type& operator()(const _Arg1&, const _Arg2&) const { - return _M_val; - } -}; - -// identity_element (not part of the C++ standard). -template inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); } -template inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); } - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_hash_fun.h b/SDK/stlport/stl/_hash_fun.h deleted file mode 100644 index b069ff05..00000000 --- a/SDK/stlport/stl/_hash_fun.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_HASH_FUN_H -#define _STLP_HASH_FUN_H - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template struct hash { }; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -inline size_t __stl_hash_string(const char* __s) { - _STLP_FIX_LITERAL_BUG(__s) - unsigned long __h = 0; - for ( ; *__s; ++__s) - __h = 5*__h + *__s; - - return size_t(__h); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_TEMPLATE_NULL -struct hash { - size_t operator()(const char* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return _STLP_PRIV __stl_hash_string(__s); - } -}; - -_STLP_TEMPLATE_NULL -struct hash { - size_t operator()(const char* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return _STLP_PRIV __stl_hash_string(__s); - } -}; - -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(char __x) const { return __x; } -}; -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned char __x) const { return __x; } -}; -#if !defined (_STLP_NO_SIGNED_BUILTINS) -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned char __x) const { return __x; } -}; -#endif -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(short __x) const { return __x; } -}; -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned short __x) const { return __x; } -}; -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(int __x) const { return __x; } -}; - -#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned int __x) const { return __x; } -}; -#else -/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef - * like size_t are tagged as potential 64 bits variables making them different from - * unsigned int. To avoid the warning when a hash container is instanciated with - * the size_t key we prefer to grant the size_t specialization rather than the - * unsigned int one. - */ -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(size_t __x) const { return __x; } -}; -#endif - -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(long __x) const { return __x; } -}; -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned long __x) const { return __x; } -}; - -#if defined (_STLP_LONG_LONG) -_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> { - size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; } -}; -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; } -}; -#endif - -_STLP_TEMPLATE_NULL -struct hash -{ - union __vp { - size_t s; - void *p; - }; - - size_t operator()(void *__x) const - { - __vp vp; - vp.p = __x; - return vp.s; - } -}; - -_STLP_END_NAMESPACE - -#endif /* _STLP_HASH_FUN_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_hash_map.h b/SDK/stlport/stl/_hash_map.h deleted file mode 100644 index accf3e5c..00000000 --- a/SDK/stlport/stl/_hash_map.h +++ /dev/null @@ -1,500 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_HASH_MAP_H -#define _STLP_INTERNAL_HASH_MAP_H - -#ifndef _STLP_INTERNAL_HASHTABLE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class hash_map -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ -private: - typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; -public: - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; -#if !defined (__DMC__) - typedef pair value_type; -#else - /* DMC goes too far in template instanciation and tries to fully instanciate - * slist > for instance. The generation of assignment - * operator fails of course so we are force to use mutable key for this compiler. - */ - typedef pair value_type; -#endif -private: - //Specific iterator traits creation - typedef _STLP_PRIV _HashMapTraitsT _HashMapTraits; - -public: - typedef hashtable _Ht; - - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) -public: - hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_map(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_map(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - hash_map(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { - } - -#ifdef _STLP_MEMBER_TEMPLATES - template - hash_map(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } -# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) - { _M_ht.insert_unique(__f, __l); } -# endif - template - hash_map(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - -#else - hash_map(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - hash_map(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_map(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - pair insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } -#ifdef _STLP_MEMBER_TEMPLATES - template - void insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_unique(__f,__l); } -#else - void insert(const value_type* __f, const value_type* __l) - { _M_ht.insert_unique(__f,__l); } - void insert(const_iterator __f, const_iterator __l) - { _M_ht.insert_unique(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - pair insert_noresize(const value_type& __obj) - { return _M_ht.insert_unique_noresize(__obj); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - _Tp& operator[](const _KT& __key) { - iterator __it = _M_ht.find(__key); - return (__it == _M_ht.end() ? - _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second : - (*__it).second ); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type erase(const _KT& __key) {return _M_ht.erase(__key); } - void erase(iterator __it) { _M_ht.erase(__it); } - void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - - void resize(size_type __hint) { _M_ht.resize(__hint); } - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } -}; - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class hash_multimap -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ -private: - typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; -public: - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; -#if !defined (__DMC__) - typedef pair value_type; -#else - typedef pair value_type; -#endif -private: - //Specific iterator traits creation - typedef _STLP_PRIV _HashMultimapTraitsT _HashMultimapTraits; - -public: - typedef hashtable _Ht; - - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) -public: - hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_multimap(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_multimap(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - hash_multimap(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { - } - -#ifdef _STLP_MEMBER_TEMPLATES - template - hash_multimap(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } -# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) - { _M_ht.insert_equal(__f, __l); } -# endif - template - hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - -#else - hash_multimap(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - hash_multimap(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multimap(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - iterator insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } -#ifdef _STLP_MEMBER_TEMPLATES - template - void insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } -#else - void insert(const value_type* __f, const value_type* __l) { - _M_ht.insert_equal(__f,__l); - } - void insert(const_iterator __f, const_iterator __l) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - iterator insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair - equal_range(const _KT& __key) { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair - equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type erase(const _KT& __key) {return _M_ht.erase(__key); } - void erase(iterator __it) { _M_ht.erase(__it); } - void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - -public: - void resize(size_type __hint) { _M_ht.resize(__hint); } - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } -}; - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_help::_Ht> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_help::_Ht> -{}; - -// Specialization of insert_iterator so that it will work for hash_map -// and hash_multimap. -template -class insert_iterator > { -protected: - typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; - _Container* container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; - -template -class insert_iterator > { -protected: - typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; - _Container* container; - typename _Container::iterator iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_HASH_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_hash_set.h b/SDK/stlport/stl/_hash_set.h deleted file mode 100644 index b800dc14..00000000 --- a/SDK/stlport/stl/_hash_set.h +++ /dev/null @@ -1,483 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_HASH_SET_H -#define _STLP_INTERNAL_HASH_SET_H - -#ifndef _STLP_INTERNAL_HASHTABLE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > -class hash_set -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self; - //Specific iterator traits creation - typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits; -public: - typedef hashtable<_Value, _Value, _HashFcn, - _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; -public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - hash_set() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_set(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_set(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) -#else - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) {} - hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a) -#endif - : _M_ht(__n, __hf, __eql, __a) {} - - hash_set(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - hash_set(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - hash_set(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) - { _M_ht.insert_unique(__f, __l); } -# endif -#else - hash_set(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - hash_set(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_unique(__f, __l); } - hash_set(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - pair insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) -#else - void insert(const_iterator __f, const_iterator __l) - {_M_ht.insert_unique(__f, __l); } - void insert(const value_type* __f, const value_type* __l) -#endif - { _M_ht.insert_unique(__f,__l); } - - pair insert_noresize(const value_type& __obj) - { return _M_ht.insert_unique_noresize(__obj); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type erase(const _KT& __key) {return _M_ht.erase(__key); } - void erase(iterator __it) { _M_ht.erase(__it); } - void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - -public: - void resize(size_type __hint) { _M_ht.resize(__hint); } - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } -}; - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > -class hash_multiset -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self; - //Specific iterator traits creation - typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits; -public: - typedef hashtable<_Value, _Value, _HashFcn, - _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; - - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_funct() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - hash_multiset() - : _M_ht(100, hasher(), key_equal(), allocator_type()) {} - explicit hash_multiset(size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} - hash_multiset(size_type __n, const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) {} - hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) {} - hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, - const allocator_type& __a) - : _M_ht(__n, __hf, __eql, __a) {} - - hash_multiset(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - hash_multiset(_InputIterator __f, _InputIterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql) - : _M_ht(__n, __hf, __eql, allocator_type()) - { _M_ht.insert_equal(__f, __l); } -# endif -#else - hash_multiset(const value_type* __f, const value_type* __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const value_type* __f, const value_type* __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - hash_multiset(const_iterator __f, const_iterator __l) - : _M_ht(100, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n) - : _M_ht(__n, hasher(), key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf) - : _M_ht(__n, __hf, key_equal(), allocator_type()) - { _M_ht.insert_equal(__f, __l); } - hash_multiset(const_iterator __f, const_iterator __l, size_type __n, - const hasher& __hf, const key_equal& __eql, - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - -public: - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& hs) { _M_ht.swap(hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - -public: - iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) - { _M_ht.insert_equal(__f,__l); } -#else - void insert(const value_type* __f, const value_type* __l) - { _M_ht.insert_equal(__f,__l); } - void insert(const_iterator __f, const_iterator __l) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - iterator insert_noresize(const value_type& __obj) - { return _M_ht.insert_equal_noresize(__obj); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type erase(const _KT& __key) {return _M_ht.erase(__key); } - void erase(iterator __it) { _M_ht.erase(__it); } - void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - -public: - void resize(size_type __hint) { _M_ht.resize(__hint); } - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type elems_in_bucket(size_type __n) const - { return _M_ht.elems_in_bucket(__n); } -}; - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc> - -#include - -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc> -#include - -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -// Specialization of insert_iterator so that it will work for hash_set -// and hash_multiset. - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Ht> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Ht> -{}; - -template -class insert_iterator > { -protected: - typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; - _Container* container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; - -template -class insert_iterator > { -protected: - typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; - _Container* container; - typename _Container::iterator iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_HASH_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_hashtable.c b/SDK/stlport/stl/_hashtable.c deleted file mode 100644 index c9dafa22..00000000 --- a/SDK/stlport/stl/_hashtable.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_HASHTABLE_C -#define _STLP_HASHTABLE_C - -#ifndef _STLP_INTERNAL_HASHTABLE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) - -_STLP_MOVE_TO_PRIV_NAMESPACE - -# define __PRIME_LIST_BODY { \ - 7ul, 23ul, \ - 53ul, 97ul, 193ul, 389ul, 769ul, \ - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \ - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \ - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \ - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\ - 1610612741ul, 3221225473ul, 4294967291ul \ -} - -template -size_t _STLP_CALL -_Stl_prime<_Dummy>::_S_max_nb_buckets() { - const size_t _list[] = __PRIME_LIST_BODY; -# ifndef __MWERKS__ - return _list[(sizeof(_list)/sizeof(_list[0])) - 1]; -# else - return _list[30/sizeof(size_t) - 1]; // stupid MWERKS! -# endif -} - -template -size_t _STLP_CALL -_Stl_prime<_Dummy>::_S_next_size(size_t __n) { - static const size_t _list[] = __PRIME_LIST_BODY; - const size_t* __first = _list; -# ifndef __MWERKS__ - const size_t* __last = _list + (sizeof(_list)/sizeof(_list[0])); -# else - const size_t* __last = _list + (30/sizeof(size_t)); // stupid MWERKS -# endif - const size_t* pos = __lower_bound(__first, __last, __n, - __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0); - return (pos == __last ? *(__last - 1) : *pos); -} - -# undef __PRIME_LIST_BODY - -_STLP_MOVE_TO_STD_NAMESPACE - -#endif - -#if defined (_STLP_DEBUG) -# define hashtable _STLP_NON_DBG_NAME(hashtable) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -// fbp: these defines are for outline methods definitions. -// needed to definitions to be portable. Should not be used in method bodies. - -#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -# define __size_type__ size_t -# define size_type size_t -# define value_type _Val -# define key_type _Key -# define __reference__ _Val& - -# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \ - _Key, _HF, _ExK, _EqK, _All> -# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \ - _Key, _HF, _ExK, _EqK, _All> -#else -# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type -# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference -# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator -# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator -#endif - -/* - * This method is too difficult to implement for hashtable that do not - * require a sorted operation on the stored type. -template -bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal( - const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1, - const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) { - return __ht1._M_buckets == __ht2._M_buckets && - __ht1._M_elems == __ht2._M_elems; -} -*/ - -/* Returns the iterator before the first iterator of the bucket __n and set - * __n to the first previous bucket having the same first iterator as bucket - * __n. - */ -template -__iterator__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_M_before_begin(size_type &__n) const { - return _S_before_begin(_M_elems, _M_buckets, __n); -} - -template -__iterator__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets, - size_type &__n) { - _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems); - typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n); - - _ElemsIte __pos(*__bpos); - if (__pos == __mutable_elems.begin()) { - __n = 0; - return __mutable_elems.before_begin(); - } - - typename _BucketVector::const_iterator __bcur(__bpos); - _BucketType *__pos_node = __pos._M_node; - for (--__bcur; __pos_node == *__bcur; --__bcur); - - __n = __bcur - __buckets.begin() + 1; - _ElemsIte __cur(*__bcur); - _ElemsIte __prev = __cur++; - for (; __cur != __pos; ++__prev, ++__cur); - return __prev; -} - - -template -__iterator__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_M_insert_noresize(size_type __n, const value_type& __obj) { - //We always insert this element as 1st in the bucket to not break - //the elements order as equal elements must be kept next to each other. - size_type __prev = __n; - _ElemsIte __pos = _M_before_begin(__prev)._M_ite; - - fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1, - _M_elems.insert_after(__pos, __obj)._M_node); - ++_M_num_elements; - return iterator(_ElemsIte(_M_buckets[__n])); -} - -template -pair<__iterator__, bool> -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::insert_unique_noresize(const value_type& __obj) { - const size_type __n = _M_bkt_num(__obj); - _ElemsIte __cur(_M_buckets[__n]); - _ElemsIte __last(_M_buckets[__n + 1]); - - if (__cur != __last) { - for (; __cur != __last; ++__cur) { - if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) { - //We check that equivalent keys have equals hash code as otherwise, on resize, - //equivalent value might not be in the same bucket - _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj))) - return pair(iterator(__cur), false); - } - } - /* Here we do not rely on the _M_insert_noresize method as we know - * that we cannot break element orders, elements are unique, and - * insertion after the first bucket element is faster than what is - * done in _M_insert_noresize. - */ - __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj); - ++_M_num_elements; - return pair(iterator(__cur), true); - } - - return pair(_M_insert_noresize(__n, __obj), true); -} - -template -__iterator__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::insert_equal_noresize(const value_type& __obj) { - const size_type __n = _M_bkt_num(__obj); - { - _ElemsIte __cur(_M_buckets[__n]); - _ElemsIte __last(_M_buckets[__n + 1]); - - for (; __cur != __last; ++__cur) { - if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) { - //We check that equivalent keys have equals hash code as otherwise, on resize, - //equivalent value might not be in the same bucket - _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj))) - ++_M_num_elements; - return _M_elems.insert_after(__cur, __obj); - } - } - } - - return _M_insert_noresize(__n, __obj); -} - -template -__reference__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_M_insert(const value_type& __obj) { - resize(_M_num_elements + 1); - return *insert_unique_noresize(__obj).first; -} - -/* -template -__reference__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::find_or_insert(const value_type& __obj) { - _Node* __first = _M_find(_M_get_key(__obj)); - if (__first) - return __first->_M_val; - else - return _M_insert(__obj); -} -*/ - -template -__size_type__ -hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::erase(const key_type& __key) { - const size_type __n = _M_bkt_num_key(__key); - - _ElemsIte __cur(_M_buckets[__n]); - _ElemsIte __last(_M_buckets[__n + 1]); - if (__cur == __last) - return 0; - - size_type __erased = 0; - if (_M_equals(_M_get_key(*__cur), __key)) { - //We look for the pos before __cur: - size_type __prev_b = __n; - _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite; - do { - __cur = _M_elems.erase_after(__prev); - ++__erased; - } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key)); - fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node); - } - else { - _ElemsIte __prev = __cur++; - for (; __cur != __last; ++__prev, ++__cur) { - if (_M_equals(_M_get_key(*__cur), __key)) { - do { - __cur = _M_elems.erase_after(__prev); - ++__erased; - } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key)); - break; - } - } - } - - _M_num_elements -= __erased; - return __erased; -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::erase(const_iterator __it) { - const size_type __n = _M_bkt_num(*__it); - _ElemsIte __cur(_M_buckets[__n]); - - if (__cur == __it._M_ite) { - size_type __prev_b = __n; - _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite; - fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, - _M_elems.erase_after(__prev)._M_node); - --_M_num_elements; - } - else { - _ElemsIte __prev = __cur++; - _ElemsIte __last(_M_buckets[__n + 1]); - for (; __cur != __last; ++__prev, ++__cur) { - if (__cur == __it._M_ite) { - _M_elems.erase_after(__prev); - --_M_num_elements; - break; - } - } - } -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::erase(const_iterator __first, const_iterator __last) { - if (__first == __last) - return; - size_type __f_bucket = _M_bkt_num(*__first); - size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1); - - _ElemsIte __cur(_M_buckets[__f_bucket]); - _ElemsIte __prev; - if (__cur == __first._M_ite) { - __prev = _M_before_begin(__f_bucket)._M_ite; - } - else { - _ElemsIte __last(_M_buckets[++__f_bucket]); - __prev = __cur++; - for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur); - } - //We do not use the slist::erase_after method taking a range to count the - //number of erased elements: - while (__cur != __last._M_ite) { - __cur = _M_elems.erase_after(__prev); - --_M_num_elements; - } - fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node); -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::rehash(size_type __num_buckets_hint) { - if ((bucket_count() >= __num_buckets_hint) && - (max_load_factor() > load_factor())) - return; - - //Here if max_load_factor is lower than 1.0 the resulting value might not be representable - //as a size_type. The result concerning the respect of the max_load_factor will then be - //undefined. - __num_buckets_hint = (max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor())); - size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint); - _M_rehash(__num_buckets); -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::resize(size_type __num_elements_hint) { - if (((float)__num_elements_hint / (float)bucket_count() <= max_load_factor()) && - (max_load_factor() >= load_factor())) { - return; - } - - size_type __num_buckets_hint = (size_type)((float)(max) (__num_elements_hint, size()) / max_load_factor()); - size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint); -#if defined (_STLP_DEBUG) - _M_check(); -#endif - _M_rehash(__num_buckets); -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_M_rehash(size_type __num_buckets) { - _ElemsCont __tmp_elems(_M_elems.get_allocator()); - _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator()); - _ElemsIte __cur, __last(_M_elems.end()); - while (!_M_elems.empty()) { - __cur = _M_elems.begin(); - size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets); - _ElemsIte __ite(__cur), __before_ite(__cur); - for (++__ite; - __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite)); - ++__ite, ++__before_ite); - size_type __prev_bucket = __new_bucket; - _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite; - __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite); - fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node); - } - _M_elems.swap(__tmp_elems); - _M_buckets.swap(__tmp); -} - -#if defined (_STLP_DEBUG) -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const { - //We check that hash code of stored keys haven't change and also that equivalent - //relation hasn't been modified - size_t __num_buckets = bucket_count(); - for (size_t __b = 0; __b < __num_buckets; ++__b) { - _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]); - _ElemsIte __fst(__cur), __snd(__cur); - for (; __cur != __last; ++__cur) { - _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b ) - _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) ) - if (__fst != __snd) - ++__fst; - if (__snd != __cur) - ++__snd; - } - } -} -#endif - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() { - _M_elems.clear(); - _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0)); - _M_num_elements = 0; -} - -template -void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> - ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) { - _M_elems.clear(); - _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end()); - _M_buckets.resize(__ht._M_buckets.size()); - _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end()); - _ElemsIte __dst(_M_elems.begin()); - typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()), - __src_end_b(__ht._M_buckets.end()); - typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end()); - for (; __src != __src_end; ++__src, ++__dst) { - for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) { - if (*__src_b == __src._M_node) { - *__dst_b = __dst._M_node; - } - else - break; - } - } - fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0)); - _M_num_elements = __ht._M_num_elements; - _M_max_load_factor = __ht._M_max_load_factor; -} - -#undef __iterator__ -#undef const_iterator -#undef __size_type__ -#undef __reference__ -#undef size_type -#undef value_type -#undef key_type -#undef __stl_num_primes - -#if defined (_STLP_DEBUG) -# undef hashtable -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_HASHTABLE_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_hashtable.h b/SDK/stlport/stl/_hashtable.h deleted file mode 100644 index 66539318..00000000 --- a/SDK/stlport/stl/_hashtable.h +++ /dev/null @@ -1,682 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_HASHTABLE_H -#define _STLP_INTERNAL_HASHTABLE_H - -#ifndef _STLP_INTERNAL_VECTOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_SLIST_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_HASH_FUN_H -# include -#endif - -/* - * Hashtable class, used to implement the hashed associative containers - * hash_set, hash_map, hash_multiset, hash_multimap, - * unordered_set, unordered_map, unordered_multiset, unordered_multimap. - */ - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -//Export of the classes used to represent buckets in the hashtable implementation. -# if !defined (_STLP_USE_PTR_SPECIALIZATIONS) -//If pointer specialization is enabled vector<_Slist_node_base*> will use the void* -//storage type for which internal classes have already been exported. -_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>; - -_STLP_MOVE_TO_PRIV_NAMESPACE -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*, - allocator<_Slist_node_base*> >; -_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*, - allocator<_Slist_node_base*> >; -_STLP_MOVE_TO_STD_NAMESPACE -# endif - -# if defined (_STLP_DEBUG) -_STLP_MOVE_TO_PRIV_NAMESPACE -# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector) -_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >; -_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >; -# undef _STLP_NON_DBG_VECTOR -_STLP_MOVE_TO_STD_NAMESPACE -# endif - -_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*, - allocator<_STLP_PRIV _Slist_node_base*> >; -#endif - -#if defined (_STLP_DEBUG) -# define hashtable _STLP_NON_DBG_NAME(hashtable) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -// some compilers require the names of template parameters to be the same -template -class hashtable; - -#if !defined (_STLP_DEBUG) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -struct _Ht_iterator { - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef typename _Traits::_NonConstTraits _NonConstTraits; - - typedef _Ht_iterator<_BaseIte,_Traits> _Self; - - typedef typename _Traits::value_type value_type; - typedef typename _Traits::pointer pointer; - typedef typename _Traits::reference reference; - typedef forward_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - - typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator; - typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator; - - _Ht_iterator() {} - //copy constructor for iterator and constructor from iterator for const_iterator - _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {} - _Ht_iterator(_BaseIte __it) : _M_ite(__it) {} - - reference operator*() const { - return *_M_ite; - } - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - ++_M_ite; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - ++*this; - return __tmp; - } - - bool operator == (const_iterator __rhs) const { - return _M_ite == __rhs._M_ite; - } - bool operator != (const_iterator __rhs) const { - return _M_ite != __rhs._M_ite; - } - - _BaseIte _M_ite; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -template -inline -# if defined (_STLP_NESTED_TYPE_PARAM_BUG) -_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type * -# else -_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type * -# endif -value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) { - typedef typename _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val; - return (_Val*) 0; -} -template -inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) -{ return forward_iterator_tag(); } -template -inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) -{ return (ptrdiff_t*) 0; } -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class _Stl_prime { -public: - //Returns the maximum number of buckets handled by the hashtable implementation - static size_t _STLP_CALL _S_max_nb_buckets(); - - //Returns the bucket size next to a required size - static size_t _STLP_CALL _S_next_size(size_t); -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime; -#endif - -typedef _Stl_prime _Stl_prime_type; - -#if !defined (_STLP_DEBUG) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -/* - * Hashtables handle allocators a bit differently than other containers - * do. If we're using standard-conforming allocators, then a hashtable - * unconditionally has a member variable to hold its allocator, even if - * it so happens that all instances of the allocator type are identical. - * This is because, for hashtables, this extra storage is negligible. - * Additionally, a base class wouldn't serve any other purposes; it - * wouldn't, for example, simplify the exception-handling code. - */ -template -class hashtable { - typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self; - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits; - typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits; - -public: - typedef _Key key_type; - typedef _Val value_type; - typedef _HF hasher; - typedef _EqK key_equal; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef typename _NonConstTraits::pointer pointer; - typedef const value_type* const_pointer; - typedef typename _NonConstTraits::reference reference; - typedef const value_type& const_reference; - typedef forward_iterator_tag _Iterator_category; - - hasher hash_funct() const { return _M_hash; } - key_equal key_eq() const { return _M_equals; } - -private: - _STLP_FORCE_ALLOCATORS(_Val, _All) -#if defined (_STLP_DEBUG) - typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist) _ElemsCont; -#else - typedef slist _ElemsCont; -#endif - typedef typename _ElemsCont::iterator _ElemsIte; - typedef typename _ElemsCont::const_iterator _ElemsConstIte; - typedef _STLP_PRIV _Slist_node_base _BucketType; - typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _M_bucket_allocator_type; - /* - * We are going to use vector of _Slist_node_base pointers for 2 reasons: - * - limit code bloat, all hashtable instanciation use the same buckets representation. - * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize - * method would be too slow because the slist::splice_after method become linear on - * the number of iterators in the buckets rather than constant in time as the iterator - * has to be move from a slist to the other. - */ -#if defined (_STLP_DEBUG) - typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _M_bucket_allocator_type> _BucketVector; -#else - typedef vector<_BucketType*, _M_bucket_allocator_type> _BucketVector; -#endif - - hasher _M_hash; - key_equal _M_equals; - _ExK _M_get_key; - _ElemsCont _M_elems; - _BucketVector _M_buckets; - size_type _M_num_elements; - float _M_max_load_factor; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator; - typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator; - //TODO: Avoids this debug check and make the local_iterator different from - //iterator in debug mode too. -#if !defined (_STLP_DEBUG) - typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator; - typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator; -#else - typedef iterator local_iterator; - typedef const_iterator const_local_iterator; -#endif - - typedef typename _Alloc_traits<_Val, _All>::allocator_type allocator_type; - allocator_type get_allocator() const { return _M_elems.get_allocator(); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const _ExK& __ext, - const allocator_type& __a = allocator_type()) -#else - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const _ExK& __ext) - : _M_hash(__hf), - _M_equals(__eql), - _M_get_key(__ext), - _M_elems(allocator_type()), - _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), - _M_num_elements(0), - _M_max_load_factor(1.0f) - { _M_initialize_buckets(__n); } - - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const _ExK& __ext, - const allocator_type& __a) -#endif - : _M_hash(__hf), - _M_equals(__eql), - _M_get_key(__ext), - _M_elems(__a), - _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), - _M_num_elements(0), - _M_max_load_factor(1.0f) - { _M_initialize_buckets(__n); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const allocator_type& __a = allocator_type()) -#else - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql) - : _M_hash(__hf), - _M_equals(__eql), - _M_get_key(_ExK()), - _M_elems(allocator_type()), - _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), - _M_num_elements(0), - _M_max_load_factor(1.0f) - { _M_initialize_buckets(__n); } - - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const allocator_type& __a) -#endif - : _M_hash(__hf), - _M_equals(__eql), - _M_get_key(_ExK()), - _M_elems(__a), - _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), - _M_num_elements(0), - _M_max_load_factor(1.0f) - { _M_initialize_buckets(__n); } - - hashtable(const _Self& __ht) - : _M_hash(__ht._M_hash), - _M_equals(__ht._M_equals), - _M_get_key(__ht._M_get_key), - _M_elems(__ht.get_allocator()), - _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)), - _M_num_elements(0), - _M_max_load_factor(1.0f) - { _M_copy_from(__ht); } - - hashtable(__move_source<_Self> src) - : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)), - _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)), - _M_get_key(_STLP_PRIV _AsMoveSource(src.get()._M_get_key)), - _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)), - _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)), - _M_num_elements(src.get()._M_num_elements), - _M_max_load_factor(src.get()._M_max_load_factor) {} - - _Self& operator= (const _Self& __ht) { - if (&__ht != this) { - clear(); - _M_hash = __ht._M_hash; - _M_equals = __ht._M_equals; - _M_get_key = __ht._M_get_key; - _M_copy_from(__ht); - } - return *this; - } - - ~hashtable() { clear(); } - - size_type size() const { return _M_num_elements; } - size_type max_size() const { return size_type(-1); } - bool empty() const { return size() == 0; } - - void swap(_Self& __ht) { - _STLP_STD::swap(_M_hash, __ht._M_hash); - _STLP_STD::swap(_M_equals, __ht._M_equals); - _STLP_STD::swap(_M_get_key, __ht._M_get_key); - _M_elems.swap(__ht._M_elems); - _M_buckets.swap(__ht._M_buckets); - _STLP_STD::swap(_M_num_elements, __ht._M_num_elements); - _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor); - } - - iterator begin() { return _M_elems.begin(); } - iterator end() { return _M_elems.end(); } - local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); } - local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); } - - const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); } - const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); } - const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); } - const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); } - - //static bool _STLP_CALL _M_equal (const _Self&, const _Self&); - -public: - //The number of buckets is size() - 1 because the last bucket always contains - //_M_elems.end() to make algo easier to implement. - size_type bucket_count() const { return _M_buckets.size() - 1; } - size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); } - size_type elems_in_bucket(size_type __bucket) const - { return distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); } - - // hash policy - float load_factor() const { return (float)size() / (float)bucket_count(); } - float max_load_factor() const { return _M_max_load_factor; } - void max_load_factor(float __z) { _M_max_load_factor = __z;} - - pair insert_unique(const value_type& __obj) { - resize(_M_num_elements + 1); - return insert_unique_noresize(__obj); - } - - iterator insert_equal(const value_type& __obj) { - resize(_M_num_elements + 1); - return insert_equal_noresize(__obj); - } - -protected: - iterator _M_insert_noresize(size_type __n, const value_type& __obj); -public: - pair insert_unique_noresize(const value_type& __obj); - iterator insert_equal_noresize(const value_type& __obj); - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert_unique(_InputIterator __f, _InputIterator __l) - { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); } - - template - void insert_equal(_InputIterator __f, _InputIterator __l) - { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); } - - template - void insert_unique(_InputIterator __f, _InputIterator __l, - const input_iterator_tag &) { - for ( ; __f != __l; ++__f) - insert_unique(*__f); - } - - template - void insert_equal(_InputIterator __f, _InputIterator __l, - const input_iterator_tag &) { - for ( ; __f != __l; ++__f) - insert_equal(*__f); - } - - template - void insert_unique(_ForwardIterator __f, _ForwardIterator __l, - const forward_iterator_tag &) { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_unique_noresize(*__f); - } - - template - void insert_equal(_ForwardIterator __f, _ForwardIterator __l, - const forward_iterator_tag &) { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_equal_noresize(*__f); - } - -#else /* _STLP_MEMBER_TEMPLATES */ - void insert_unique(const value_type* __f, const value_type* __l) { - size_type __n = __l - __f; - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_unique_noresize(*__f); - } - - void insert_equal(const value_type* __f, const value_type* __l) { - size_type __n = __l - __f; - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_equal_noresize(*__f); - } - - void insert_unique(const_iterator __f, const_iterator __l) { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_unique_noresize(*__f); - } - - void insert_equal(const_iterator __f, const_iterator __l) { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_equal_noresize(*__f); - } -#endif /*_STLP_MEMBER_TEMPLATES */ - - //reference find_or_insert(const value_type& __obj); - -private: - _STLP_TEMPLATE_FOR_CONT_EXT - _ElemsIte _M_find(const _KT& __key) const { - size_type __n = _M_bkt_num_key(__key); - _ElemsIte __first(_M_buckets[__n]); - _ElemsIte __last(_M_buckets[__n + 1]); - for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first); - if (__first != __last) - return __first; - else - return __CONST_CAST(_ElemsCont&, _M_elems).end(); - } - -public: - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { - const size_type __n = _M_bkt_num_key(__key); - - _ElemsIte __cur(_M_buckets[__n]); - _ElemsIte __last(_M_buckets[__n + 1]); - for (; __cur != __last; ++__cur) { - if (_M_equals(_M_get_key(*__cur), __key)) { - size_type __result = 1; - for (++__cur; - __cur != __last && _M_equals(_M_get_key(*__cur), __key); - ++__result, ++__cur); - return __result; - } - } - return 0; - } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) { - typedef pair _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]); - __first != __last; ++__first) { - if (_M_equals(_M_get_key(*__first), __key)) { - _ElemsIte __cur(__first); - for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur); - return _Pii(__first, __cur); - } - } - return _Pii(end(), end()); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const { - typedef pair _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]); - __first != __last; ++__first) { - if (_M_equals(_M_get_key(*__first), __key)) { - _ElemsIte __cur(__first); - for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur); - return _Pii(__first, __cur); - } - } - return _Pii(end(), end()); - } - - size_type erase(const key_type& __key); - void erase(const_iterator __it); - void erase(const_iterator __first, const_iterator __last); - -private: - void _M_rehash(size_type __num_buckets); -#if defined (_STLP_DEBUG) - void _M_check() const; -#endif - -public: - void rehash(size_type __num_buckets_hint); - void resize(size_type __num_elements_hint); - void clear(); - - // this is for hash_map::operator[] - reference _M_insert(const value_type& __obj); - -private: - //__n is set to the first bucket that has to be modified if any - //erase/insert operation is done after the returned iterator. - iterator _M_before_begin(size_type &__n) const; - - static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets, - size_type &__n); - - void _M_initialize_buckets(size_type __n) { - const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1; - _M_buckets.reserve(__n_buckets); - _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0)); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type _M_bkt_num_key(const _KT& __key) const - { return _M_bkt_num_key(__key, bucket_count()); } - - size_type _M_bkt_num(const value_type& __obj) const - { return _M_bkt_num_key(_M_get_key(__obj)); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type _M_bkt_num_key(const _KT& __key, size_type __n) const - { return _M_hash(__key) % __n; } - - size_type _M_bkt_num(const value_type& __obj, size_t __n) const - { return _M_bkt_num_key(_M_get_key(__obj), __n); } - - void _M_copy_from(const _Self& __ht); -}; - -#if defined (_STLP_DEBUG) -# undef hashtable -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - //Hashtables are movable: - typedef __stlp_movable implemented; - - //Completeness depends on many template parameters, for the moment we consider it not complete: - typedef __false_type complete; -}; -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_HASHTABLE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_heap.c b/SDK/stlport/stl/_heap.c deleted file mode 100644 index a4ab049f..00000000 --- a/SDK/stlport/stl/_heap.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_HEAP_C -#define _STLP_HEAP_C - -#ifndef _STLP_INTERNAL_HEAP_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -_STLP_INLINE_LOOP -void -__push_heap(_RandomAccessIterator __first, - _Distance __holeIndex, _Distance __topIndex, _Tp __val) -{ - _Distance __parent = (__holeIndex - 1) / 2; - while (__holeIndex > __topIndex && *(__first + __parent) < __val) { - *(__first + __holeIndex) = *(__first + __parent); - __holeIndex = __parent; - __parent = (__holeIndex - 1) / 2; - } - *(__first + __holeIndex) = __val; -} - -template -inline void -__push_heap_aux(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Distance*, _Tp*) -{ - __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), - _Tp(*(__last - 1))); -} - -template -void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - __push_heap_aux(__first, __last, - _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); -} - - -template -_STLP_INLINE_LOOP -void -__push_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __topIndex, _Tp __val, _Compare __comp) -{ - _Distance __parent = (__holeIndex - 1) / 2; - while (__holeIndex > __topIndex && __comp(*(__first + __parent), __val)) { - _STLP_VERBOSE_ASSERT(!__comp(__val, *(__first + __parent)), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - *(__first + __holeIndex) = *(__first + __parent); - __holeIndex = __parent; - __parent = (__holeIndex - 1) / 2; - } - *(__first + __holeIndex) = __val; -} - -template -inline void -__push_heap_aux(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp, - _Distance*, _Tp*) -{ - __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), - _Tp(*(__last - 1)), __comp); -} - -template -void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp) -{ - __push_heap_aux(__first, __last, __comp, - _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); -} - -template -void -__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __len, _Tp __val) { - _Distance __topIndex = __holeIndex; - _Distance __secondChild = 2 * __holeIndex + 2; - while (__secondChild < __len) { - if (*(__first + __secondChild) < *(__first + (__secondChild - 1))) - __secondChild--; - *(__first + __holeIndex) = *(__first + __secondChild); - __holeIndex = __secondChild; - __secondChild = 2 * (__secondChild + 1); - } - if (__secondChild == __len) { - *(__first + __holeIndex) = *(__first + (__secondChild - 1)); - __holeIndex = __secondChild - 1; - } - __push_heap(__first, __holeIndex, __topIndex, __val); -} - - -template -inline void -__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*) { - __pop_heap(__first, __last - 1, __last - 1, - _Tp(*(__last - 1)), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); -} - -template -void pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last) { - __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); -} - -template -void -__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __len, _Tp __val, _Compare __comp) -{ - _Distance __topIndex = __holeIndex; - _Distance __secondChild = 2 * __holeIndex + 2; - while (__secondChild < __len) { - if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) { - _STLP_VERBOSE_ASSERT(!__comp(*(__first + (__secondChild - 1)), *(__first + __secondChild)), - _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __secondChild--; - } - *(__first + __holeIndex) = *(__first + __secondChild); - __holeIndex = __secondChild; - __secondChild = 2 * (__secondChild + 1); - } - if (__secondChild == __len) { - *(__first + __holeIndex) = *(__first + (__secondChild - 1)); - __holeIndex = __secondChild - 1; - } - __push_heap(__first, __holeIndex, __topIndex, __val, __comp); -} - - -template -inline void -__pop_heap_aux(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Tp*, _Compare __comp) -{ - __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp, - _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); -} - - -template -void -pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator), __comp); -} - -template -_STLP_INLINE_LOOP -void -__make_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Tp*, _Distance*) -{ - if (__last - __first < 2) return; - _Distance __len = __last - __first; - _Distance __parent = (__len - 2)/2; - - for (;;) { - __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent))); - if (__parent == 0) return; - __parent--; - } -} - -template -void -make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - __make_heap(__first, __last, - _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); -} - -template -_STLP_INLINE_LOOP -void -__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp, _Tp*, _Distance*) -{ - if (__last - __first < 2) return; - _Distance __len = __last - __first; - _Distance __parent = (__len - 2)/2; - - for (;;) { - __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)), - __comp); - if (__parent == 0) return; - __parent--; - } -} - -template -void -make_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - __make_heap(__first, __last, __comp, - _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_HEAP_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_heap.h b/SDK/stlport/stl/_heap.h deleted file mode 100644 index 016dc490..00000000 --- a/SDK/stlport/stl/_heap.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_HEAP_H -#define _STLP_INTERNAL_HEAP_H - -_STLP_BEGIN_NAMESPACE - -// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap. - -template -void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last); - - -template -void -push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Compare __comp); - -template -void -__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __len, _Tp __val); - -template -inline void -__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _RandomAccessIterator __result, _Tp __val, _Distance*) -{ - *__result = *__first; - __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __val); -} - -template -void pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last); - -template -void -__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, - _Distance __len, _Tp __val, _Compare __comp); - -template -inline void -__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, - _RandomAccessIterator __result, _Tp __val, _Compare __comp, - _Distance*) -{ - *__result = *__first; - __adjust_heap(__first, _Distance(0), _Distance(__last - __first), - __val, __comp); -} - -template -void -pop_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp); - -template -void -make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last); - -template -void -make_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp); - -template -_STLP_INLINE_LOOP -void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) -{ - while (__last - __first > 1) - pop_heap(__first, __last--); -} - -template -_STLP_INLINE_LOOP -void -sort_heap(_RandomAccessIterator __first, - _RandomAccessIterator __last, _Compare __comp) -{ - while (__last - __first > 1) - pop_heap(__first, __last--, __comp); -} - -_STLP_END_NAMESPACE - -# if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -# endif - -#endif /* _STLP_INTERNAL_HEAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ios.c b/SDK/stlport/stl/_ios.c deleted file mode 100644 index 99e477bd..00000000 --- a/SDK/stlport/stl/_ios.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_IOS_C -#define _STLP_IOS_C - -#ifndef _STLP_INTERNAL_IOS_H -# include -#endif - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -#ifndef _STLP_INTERNAL_NUMPUNCT_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// basic_ios<>'s non-inline member functions - -// Public constructor, taking a streambuf. -template -basic_ios<_CharT, _Traits> - ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf) - : ios_base(), - _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) { - basic_ios<_CharT, _Traits>::init(__streambuf); -} - -template -basic_streambuf<_CharT, _Traits>* -basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) { - basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf; - _M_streambuf = __buf; - this->clear(); - return __tmp; -} - -template -basic_ios<_CharT, _Traits>& -basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) { - _M_invoke_callbacks(erase_event); - _M_copy_state(__x); // Inherited from ios_base. - _M_fill = __x._M_fill; - _M_tied_ostream = __x._M_tied_ostream; - _M_invoke_callbacks(copyfmt_event); - this->_M_set_exception_mask(__x.exceptions()); - return *this; -} - -template -locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { - locale __tmp = ios_base::imbue(__loc); - _STLP_TRY { - if (_M_streambuf) - _M_streambuf->pubimbue(__loc); - - // no throwing here - this->_M_cached_ctype = __loc._M_get_facet(ctype::id); - this->_M_cached_numpunct = __loc._M_get_facet(numpunct::id); - this->_M_cached_grouping = ((numpunct*)_M_cached_numpunct)->grouping(); - } - _STLP_CATCH_ALL { - __tmp = ios_base::imbue(__tmp); - _M_handle_exception(ios_base::failbit); - } - return __tmp; -} - -// Protected constructor and initialization functions. The default -// constructor creates an uninitialized basic_ios, and init() initializes -// all of the members to the values in Table 89 of the C++ standard. - -template -basic_ios<_CharT, _Traits>::basic_ios() - : ios_base(), - _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) -{} - -template -void -basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) -{ - this->rdbuf(__sb); - this->imbue(locale()); - this->tie(0); - this->_M_set_exception_mask(ios_base::goodbit); - this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit); - ios_base::flags(ios_base::skipws | ios_base::dec); - ios_base::width(0); - ios_base::precision(6); - this->fill(widen(' ')); - // We don't need to worry about any of the three arrays: they are - // initialized correctly in ios_base's constructor. -} - -// This is never called except from within a catch clause. -template -void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag) -{ - this->_M_setstate_nothrow(__flag); - if (this->_M_get_exception_mask() & __flag) - _STLP_RETHROW; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_IOS_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ios.h b/SDK/stlport/stl/_ios.h deleted file mode 100644 index 8e6da2db..00000000 --- a/SDK/stlport/stl/_ios.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_IOS_H -#define _STLP_INTERNAL_IOS_H - - -#ifndef _STLP_IOS_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif -#ifndef _STLP_INTERNAL_NUMPUNCT_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// ---------------------------------------------------------------------- - -// Class basic_ios, a subclass of ios_base. The only important difference -// between the two is that basic_ios is a class template, parameterized -// by the character type. ios_base exists to factor out all of the -// common properties that don't depend on the character type. - -// The second template parameter, _Traits, defaults to char_traits<_CharT>. -// The default is declared in header , and it isn't declared here -// because C++ language rules do not allow it to be declared twice. - -template -class basic_ios : public ios_base { - friend class ios_base; -public: // Synonyms for types. - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - -public: // Constructor, destructor. - explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf); - virtual ~basic_ios() {} - -public: // Members from clause 27.4.4.2 - basic_ostream<_CharT, _Traits>* tie() const { - return _M_tied_ostream; - } - basic_ostream<_CharT, _Traits>* - tie(basic_ostream* __new_tied_ostream) { - basic_ostream* __tmp = _M_tied_ostream; - _M_tied_ostream = __new_tied_ostream; - return __tmp; - } - - basic_streambuf<_CharT, _Traits>* rdbuf() const - { return _M_streambuf; } - - basic_streambuf<_CharT, _Traits>* - rdbuf(basic_streambuf*); - - // Copies __x's state to *this. - basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x); - - char_type fill() const { return _M_fill; } - char_type fill(char_type __fill) { - char_type __tmp(_M_fill); - _M_fill = __fill; - return __tmp; - } - -public: // Members from 27.4.4.3. These four functions - // can almost be defined in ios_base. - - void clear(iostate __state = goodbit) { - _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit)); - _M_check_exception_mask(); - } - void setstate(iostate __state) { this->clear(rdstate() | __state); } - - iostate exceptions() const { return this->_M_get_exception_mask(); } - void exceptions(iostate __mask) { - this->_M_set_exception_mask(__mask); - this->clear(this->rdstate()); - } - -public: // Locale-related member functions. - locale imbue(const locale&); - - inline char narrow(_CharT, char) const ; - inline _CharT widen(char) const; - - // Helper function that makes testing for EOF more convenient. - static bool _STLP_CALL _S_eof(int_type __c) { - const int_type __eof = _Traits::eof(); - return _Traits::eq_int_type(__c, __eof); - } - -protected: - basic_ios(); - - void init(basic_streambuf<_CharT, _Traits>* __streambuf); - -public: - - // Helper function used in istream and ostream. It is called only from - // a catch clause. - void _M_handle_exception(ios_base::iostate __flag); - -private: // Data members - char_type _M_fill; // The fill character, used for padding. - - basic_streambuf<_CharT, _Traits>* _M_streambuf; - basic_ostream<_CharT, _Traits>* _M_tied_ostream; - -}; - - -template -inline char -basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const -{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->narrow(__c, __default); } - -template -inline _CharT -basic_ios<_CharT, _Traits>::widen(char __c) const -{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->widen(__c); } - -# if !defined (_STLP_NO_METHOD_SPECIALIZATION) -_STLP_TEMPLATE_NULL -inline char -basic_ios >::narrow(char __c, char) const -{ - return __c; -} - -_STLP_TEMPLATE_NULL -inline char -basic_ios >::widen(char __c) const -{ - return __c; -} -# endif /* _STLP_NO_METHOD_SPECIALIZATION */ - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_ios >; -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_ios >; -# endif -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_IOS */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_ios_base.h b/SDK/stlport/stl/_ios_base.h deleted file mode 100644 index b90606a4..00000000 --- a/SDK/stlport/stl/_ios_base.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_IOS_BASE_H -#define _STLP_IOS_BASE_H - -#ifndef _STLP_INTERNAL_STDEXCEPT_BASE -# include -#endif - -#ifndef _STLP_UTILITY -# include -#endif - -#ifndef _STLP_INTERNAL_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// ---------------------------------------------------------------------- - -// Class ios_base. This is the base class of the ios hierarchy, which -// includes basic_istream and basic_ostream. Classes in the ios -// hierarchy are actually quite simple: they are just glorified -// wrapper classes. They delegate buffering and physical character -// manipulation to the streambuf classes, and they delegate most -// formatting tasks to a locale. - -class _STLP_CLASS_DECLSPEC ios_base { -public: - - class _STLP_CLASS_DECLSPEC failure : public __Named_exception { - public: - explicit failure(const string&); - virtual ~failure() _STLP_NOTHROW_INHERENTLY; - }; - - typedef int fmtflags; - typedef int iostate; - typedef int openmode; - typedef int seekdir; - -# ifndef _STLP_NO_ANACHRONISMS - typedef fmtflags fmt_flags; -# endif - - // Formatting flags. -#if defined (_STLP_STATIC_CONST_INIT_BUG) - enum { -#else - // boris : type for all those constants is int - static const int -#endif - left = 0x0001, - right = 0x0002, - internal = 0x0004, - dec = 0x0008, - hex = 0x0010, - oct = 0x0020, - fixed = 0x0040, - scientific = 0x0080, - boolalpha = 0x0100, - showbase = 0x0200, - showpoint = 0x0400, - showpos = 0x0800, - skipws = 0x1000, - unitbuf = 0x2000, - uppercase = 0x4000, - adjustfield = left | right | internal, - basefield = dec | hex | oct, - floatfield = scientific | fixed, - - // State flags. - goodbit = 0x00, - badbit = 0x01, - eofbit = 0x02, - failbit = 0x04, - - // Openmode flags. - __default_mode = 0x0, /* implementation detail */ - app = 0x01, - ate = 0x02, - binary = 0x04, - in = 0x08, - out = 0x10, - trunc = 0x20, - - // Seekdir flags - - beg = 0x01, - cur = 0x02, - end = 0x04 -# ifdef _STLP_STATIC_CONST_INIT_BUG - } -# endif - ; - -public: // Flag-manipulation functions. - fmtflags flags() const { return _M_fmtflags; } - fmtflags flags(fmtflags __flags) { - fmtflags __tmp = _M_fmtflags; - _M_fmtflags = __flags; - return __tmp; - } - - fmtflags setf(fmtflags __flag) { - fmtflags __tmp = _M_fmtflags; - _M_fmtflags |= __flag; - return __tmp; - } - fmtflags setf(fmtflags __flag, fmtflags __mask) { - fmtflags __tmp = _M_fmtflags; - _M_fmtflags &= ~__mask; - _M_fmtflags |= __flag & __mask; - return __tmp; - } - void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; } - - streamsize precision() const { return _M_precision; } - streamsize precision(streamsize __newprecision) { - streamsize __tmp = _M_precision; - _M_precision = __newprecision; - return __tmp; - } - - streamsize width() const { return _M_width; } - streamsize width(streamsize __newwidth) { - streamsize __tmp = _M_width; - _M_width = __newwidth; - return __tmp; - } - -public: // Locales - locale imbue(const locale&); - locale getloc() const { return _M_locale; } - -public: // Auxiliary storage. - static int _STLP_CALL xalloc(); - long& iword(int __index); - void*& pword(int __index); - -public: // Destructor. - virtual ~ios_base(); - -public: // Callbacks. - enum event { erase_event, imbue_event, copyfmt_event }; - typedef void (*event_callback)(event, ios_base&, int __index); - void register_callback(event_callback __fn, int __index); - -public: // This member function affects only - // the eight predefined ios objects: - // cin, cout, etc. - static bool _STLP_CALL sync_with_stdio(bool __sync = true); - -public: // The C++ standard requires only that these - // member functions be defined in basic_ios. - // We define them in the non-template - // base class to avoid code duplication. - operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; } - bool operator!() const { return fail(); } - - iostate rdstate() const { return _M_iostate; } - - bool good() const { return _M_iostate == 0; } - bool eof() const { return (_M_iostate & eofbit) != 0; } - bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; } - bool bad() const { return (_M_iostate & badbit) != 0; } - -protected: // The functional protected interface. - - // Copies the state of __x to *this. This member function makes it - // possible to implement basic_ios::copyfmt without having to expose - // ios_base's private data members. Does not copy _M_exception_mask - // or _M_iostate. - void _M_copy_state(const ios_base& __x); - - void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; } - void _M_clear_nothrow(iostate __state) { _M_iostate = __state; } - iostate _M_get_exception_mask() const { return _M_exception_mask; } - void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; } - void _M_check_exception_mask() { - if (_M_iostate & _M_exception_mask) - _M_throw_failure(); - } - - void _M_invoke_callbacks(event); - void _STLP_FUNCTION_THROWS _M_throw_failure(); - - ios_base(); // Default constructor. - -protected: // Initialization of the I/O system - static void _STLP_CALL _S_initialize(); - static void _STLP_CALL _S_uninitialize(); - static bool _S_was_synced; - -private: // Invalidate the copy constructor and - // assignment operator. - ios_base(const ios_base&); - void operator=(const ios_base&); - -private: // Data members. - - fmtflags _M_fmtflags; // Flags - iostate _M_iostate; - openmode _M_openmode; - seekdir _M_seekdir; - iostate _M_exception_mask; - - streamsize _M_precision; - streamsize _M_width; - - locale _M_locale; - - pair* _M_callbacks; - size_t _M_num_callbacks; // Size of the callback array. - size_t _M_callback_index; // Index of the next available callback; - // initially zero. - - long* _M_iwords; // Auxiliary storage. The count is zero - size_t _M_num_iwords; // if and only if the pointer is null. - - void** _M_pwords; - size_t _M_num_pwords; - -protected: - // Cached copies of the curent locale's facets. Set by init() and imbue(). - locale::facet* _M_cached_ctype; - locale::facet* _M_cached_numpunct; - string _M_cached_grouping; -public: - // Equivalent to &use_facet< Facet >(getloc()), but faster. - const locale::facet* _M_ctype_facet() const { return _M_cached_ctype; } - const locale::facet* _M_numpunct_facet() const { return _M_cached_numpunct; } - const string& _M_grouping() const { return _M_cached_grouping; } -public: - - // ---------------------------------------------------------------------- - // Nested initializer class. This is an implementation detail, but it's - // prescribed by the standard. The static initializer object (on - // implementations where such a thing is required) is declared in - // - - class _STLP_CLASS_DECLSPEC Init - { - public: - Init(); - ~Init(); - private: - static long _S_count; - friend class ios_base; - }; - - friend class Init; - -public: -# ifndef _STLP_NO_ANACHRONISMS - // 31.6 Old iostreams members [depr.ios.members] - typedef iostate io_state; - typedef openmode open_mode; - typedef seekdir seek_dir; - typedef _STLP_STD::streamoff streamoff; - typedef _STLP_STD::streampos streampos; -# endif -}; - -// ---------------------------------------------------------------------- -// ios_base manipulator functions, from section 27.4.5 of the C++ standard. -// All of them are trivial one-line wrapper functions. - -// fmtflag manipulators, section 27.4.5.1 -inline ios_base& _STLP_CALL boolalpha(ios_base& __s) - { __s.setf(ios_base::boolalpha); return __s;} - -inline ios_base& _STLP_CALL noboolalpha(ios_base& __s) - { __s.unsetf(ios_base::boolalpha); return __s;} - -inline ios_base& _STLP_CALL showbase(ios_base& __s) - { __s.setf(ios_base::showbase); return __s;} - -inline ios_base& _STLP_CALL noshowbase(ios_base& __s) - { __s.unsetf(ios_base::showbase); return __s;} - -inline ios_base& _STLP_CALL showpoint(ios_base& __s) - { __s.setf(ios_base::showpoint); return __s;} - -inline ios_base& _STLP_CALL noshowpoint(ios_base& __s) - { __s.unsetf(ios_base::showpoint); return __s;} - -inline ios_base& _STLP_CALL showpos(ios_base& __s) - { __s.setf(ios_base::showpos); return __s;} - -inline ios_base& _STLP_CALL noshowpos(ios_base& __s) - { __s.unsetf(ios_base::showpos); return __s;} - -inline ios_base& _STLP_CALL skipws(ios_base& __s) - { __s.setf(ios_base::skipws); return __s;} - -inline ios_base& _STLP_CALL noskipws(ios_base& __s) - { __s.unsetf(ios_base::skipws); return __s;} - -inline ios_base& _STLP_CALL uppercase(ios_base& __s) - { __s.setf(ios_base::uppercase); return __s;} - -inline ios_base& _STLP_CALL nouppercase(ios_base& __s) - { __s.unsetf(ios_base::uppercase); return __s;} - -inline ios_base& _STLP_CALL unitbuf(ios_base& __s) - { __s.setf(ios_base::unitbuf); return __s;} - -inline ios_base& _STLP_CALL nounitbuf(ios_base& __s) - { __s.unsetf(ios_base::unitbuf); return __s;} - - -// adjustfield manipulators, section 27.4.5.2 -inline ios_base& _STLP_CALL internal(ios_base& __s) - { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; } - -inline ios_base& _STLP_CALL left(ios_base& __s) - { __s.setf(ios_base::left, ios_base::adjustfield); return __s; } - -inline ios_base& _STLP_CALL right(ios_base& __s) - { __s.setf(ios_base::right, ios_base::adjustfield); return __s; } - -// basefield manipulators, section 27.4.5.3 -inline ios_base& _STLP_CALL dec(ios_base& __s) - { __s.setf(ios_base::dec, ios_base::basefield); return __s; } - -inline ios_base& _STLP_CALL hex(ios_base& __s) - { __s.setf(ios_base::hex, ios_base::basefield); return __s; } - -inline ios_base& _STLP_CALL oct(ios_base& __s) - { __s.setf(ios_base::oct, ios_base::basefield); return __s; } - - -// floatfield manipulators, section 27.4.5.3 -inline ios_base& _STLP_CALL fixed(ios_base& __s) - { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; } - -inline ios_base& _STLP_CALL scientific(ios_base& __s) - { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; } - -_STLP_END_NAMESPACE - -#endif /* _STLP_IOS_BASE */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_ioserr.h b/SDK/stlport/stl/_ioserr.h deleted file mode 100644 index 83ba8775..00000000 --- a/SDK/stlport/stl/_ioserr.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * This file is included in every header that needs the STLport library to be - * built; the header files mostly are the iostreams-headers. The file checks for - * _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS being not defined, so that the - * iostreams part of STLport cannot be used when the symbols were defined - * accidentally. - */ -#if defined (_STLP_NO_IOSTREAMS) -# error STLport iostreams header cannot be used; you chose not to use iostreams in the STLport configuration file (stlport/stl/config/user_config.h). -#elif defined (_STLP_USE_NO_IOSTREAMS ) -# error STLport iostreams header cannot be used; your compiler do not support it. -#endif diff --git a/SDK/stlport/stl/_iosfwd.h b/SDK/stlport/stl/_iosfwd.h deleted file mode 100644 index 64c64302..00000000 --- a/SDK/stlport/stl/_iosfwd.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef _STLP_INTERNAL_IOSFWD -#define _STLP_INTERNAL_IOSFWD - -#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS) -# error This header file requires the -LANG:std option -#endif - -// This file provides forward declarations of the most important I/O -// classes. Note that almost all of those classes are class templates, -// with default template arguments. According to the C++ standard, -// if a class template is declared more than once in the same scope -// then only one of those declarations may have default arguments. - -// contains the same declarations as other headers, and including -// both and (say) is permitted. This means that only -// one header may contain those default template arguments. - -// In this implementation, the declarations in contain default -// template arguments. All of the other I/O headers include . - -#ifndef _STLP_CHAR_TRAITS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class ios_base; - -template ) > -class basic_ios; - -template ) > -class basic_streambuf; - -template ) > -class basic_istream; - -template ) > -class basic_ostream; - -template ) > -class basic_iostream; - -template ), - _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > -class basic_stringbuf; - -template ), - _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > -class basic_istringstream; - -template ), - _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > -class basic_ostringstream; - -template ), - _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > -class basic_stringstream; - -template ) > -class basic_filebuf; - -template ) > -class basic_ifstream; - -template ) > -class basic_ofstream; - -template ) > -class basic_fstream; - -template ) > -class istreambuf_iterator; - -template ) > -class ostreambuf_iterator; - -typedef basic_ios > ios; - -#if !defined (_STLP_NO_WCHAR_T) -typedef basic_ios > wios; -#endif - -// Forward declaration of class locale, and of the most important facets. -class locale; -#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) -template -struct _Use_facet { - const locale& __loc; - _Use_facet(const locale& __p_loc) : __loc(__p_loc) {} - inline const _Facet& operator *() const; -}; -# define use_facet *_Use_facet -#else -template inline const _Facet& use_facet(const locale&); -#endif - -template class ctype; -template class ctype_byname; -template class collate; -template class collate_byname; - -_STLP_TEMPLATE_NULL class ctype; -_STLP_TEMPLATE_NULL class ctype_byname; -_STLP_TEMPLATE_NULL class collate; -_STLP_TEMPLATE_NULL class collate_byname; - -#if !defined (_STLP_NO_WCHAR_T) -_STLP_TEMPLATE_NULL class ctype; -_STLP_TEMPLATE_NULL class ctype_byname; -_STLP_TEMPLATE_NULL class collate; -_STLP_TEMPLATE_NULL class collate_byname; -#endif - -#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 ) -// Typedefs for ordinary (narrow-character) streams. -//_STLP_TEMPLATE_NULL class basic_streambuf >; -#endif - -typedef basic_istream > istream; -typedef basic_ostream > ostream; -typedef basic_iostream > iostream; -typedef basic_streambuf > streambuf; - -typedef basic_stringbuf, allocator > stringbuf; -typedef basic_istringstream, allocator > istringstream; -typedef basic_ostringstream, allocator > ostringstream; -typedef basic_stringstream, allocator > stringstream; - -typedef basic_filebuf > filebuf; -typedef basic_ifstream > ifstream; -typedef basic_ofstream > ofstream; -typedef basic_fstream > fstream; - -#if !defined (_STLP_NO_WCHAR_T) -// Typedefs for wide-character streams. -typedef basic_streambuf > wstreambuf; -typedef basic_istream > wistream; -typedef basic_ostream > wostream; -typedef basic_iostream > wiostream; - -typedef basic_stringbuf, allocator > wstringbuf; -typedef basic_istringstream, allocator > wistringstream; -typedef basic_ostringstream, allocator > wostringstream; -typedef basic_stringstream, allocator > wstringstream; - -typedef basic_filebuf > wfilebuf; -typedef basic_ifstream > wifstream; -typedef basic_ofstream > wofstream; -typedef basic_fstream > wfstream; -#endif - -_STLP_END_NAMESPACE - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_iostream_string.h b/SDK/stlport/stl/_iostream_string.h deleted file mode 100644 index 87656a4c..00000000 --- a/SDK/stlport/stl/_iostream_string.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - /* - * This is an internal string for the STLport own iostream implementation. - * The only diference rely on the allocator used to instanciate the basic_string. - * Its goals is to improve performance limitating the number of dynamic allocation - * that could occur when requesting a big float ouput for instance. This allocator - * is not standard conformant as it has an internal state (the static buffer) - */ - - -#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H -#define _STLP_INTERNAL_IOSTREAM_STRING_H - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif /* _STLP_INTERNAL_ALLOC_H */ - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif /* _STLP_INTERNAL_STRING_H */ - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class __iostring_allocator : public allocator<_CharT> { -public: - enum { _STR_SIZE = 256 }; - -private: - enum { _BUF_SIZE = _STR_SIZE + 1 }; - typedef allocator<_CharT> _Base; - _CharT _M_static_buf[_BUF_SIZE]; - -public: - typedef typename _Base::size_type size_type; - typedef typename _Base::pointer pointer; -#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) - template struct rebind { -# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) - typedef __iostring_allocator<_Tp1> other; -# else - typedef _STLP_PRIV __iostring_allocator<_Tp1> other; -# endif - }; -#endif - - _CharT* allocate(size_type __n, const void* __ptr = 0) { - if (__n > _BUF_SIZE) { - return _Base::allocate(__n, __ptr); - } - return _M_static_buf; - } - void deallocate(pointer __p, size_type __n) { - if (__p != _M_static_buf) _Base::deallocate(__p, __n); - } -}; - -#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES) -/* - * As the __iostring_allocator allocator will only be used in the basic_string implementation - * we known that it is never going to be bound to another type that the one used to instantiate - * the basic_string. This is why the associated __stl_alloc_rebind has only one template - * parameter. - */ -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _STLP_PRIV __iostring_allocator<_Tp>& _STLP_CALL -__stl_alloc_rebind(_STLP_PRIV __iostring_allocator<_Tp>& __a, const _Tp*) -{ return __a; } -template -inline _STLP_PRIV __iostring_allocator<_Tp> _STLP_CALL -__stl_alloc_create(const _STLP_PRIV __iostring_allocator<_Tp>&, const _Tp*) -{ return _STLP_PRIV __iostring_allocator<_Tp>(); } - -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ - -#if !defined (_STLP_DEBUG) -template -struct __basic_iostring : public basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > { - /* - * A consequence of the non standard conformant allocator is that a string using it - * must always be presized to the allocator static buffer size because the basic_string implementation - * do not manage an allocator returning always the same memory adress as long as the - * requested memory block size is under a certain value. - */ - typedef __basic_iostring<_CharT> _Self; - typedef basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > _Base; - typedef typename _Base::_Reserve_t _Reserve_t; - - __basic_iostring() : _Base(_Reserve_t(), __iostring_allocator<_CharT>::_STR_SIZE) - {} - - _Self& operator=(const _CharT* __s) { - _Base::operator=(__s); - return *this; - } -}; - -typedef __basic_iostring __iostring; - -# if !defined (_STLP_NO_WCHAR_T) -typedef __basic_iostring __iowstring; -# endif - -# define _STLP_BASIC_IOSTRING(_CharT) _STLP_PRIV __basic_iostring<_CharT> - -#else - -typedef string __iostring; -# if !defined (_STLP_NO_WCHAR_T) -typedef wstring __iowstring; -# endif - -# define _STLP_BASIC_IOSTRING(_CharT) basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > - -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_IOSTREAM_STRING_H */ diff --git a/SDK/stlport/stl/_istream.c b/SDK/stlport/stl/_istream.c deleted file mode 100644 index 1ac2486a..00000000 --- a/SDK/stlport/stl/_istream.c +++ /dev/null @@ -1,1428 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_ISTREAM_C -#define _STLP_ISTREAM_C - -#ifndef _STLP_INTERNAL_ISTREAM -# include -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_GET_H -# include -#endif - -#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -// no wchar_t is supported for this mode -# define __BIS_int_type__ int -# define __BIS_pos_type__ streampos -# define __BIS_off_type__ streamoff -#else -# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type -# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type -# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Function object structs used by some member functions. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Is_not_wspace { - typedef typename _Traits::char_type argument_type; - typedef bool result_type; - - const ctype* _M_ctype; - - _Is_not_wspace(const ctype* __c_type) : _M_ctype(__c_type) {} - bool operator()(argument_type __c) const - { return !_M_ctype->is(ctype_base::space, __c); } -}; - -template -struct _Is_wspace_null { - typedef typename _Traits::char_type argument_type; - typedef bool result_type; - - const ctype* _M_ctype; - - _Is_wspace_null(const ctype* __c_type) : _M_ctype(__c_type) {} - bool operator()(argument_type __c) const { - return _Traits::eq(__c, argument_type()) || - _M_ctype->is(ctype_base::space, __c); - } -}; - -template -struct _Scan_for_wspace { - typedef typename _Traits::char_type char_type; - typedef char_type* first_argument_type; - typedef char_type* second_argument_type; - typedef char_type* result_type; - - const ctype* _M_ctype; - - _Scan_for_wspace(const ctype* __ctype) : _M_ctype(__ctype) {} - const char_type* - operator()(const char_type* __first, const char_type* __last) const { - return _M_ctype->scan_is(ctype_base::space, __first, __last); - } -}; - -template -struct _Scan_wspace_null { - typedef typename _Traits::char_type char_type; - typedef char_type* first_argument_type; - typedef char_type* second_argument_type; - typedef char_type* result_type; - - const ctype* _M_ctype; - - _Scan_wspace_null(const ctype* __c_type) : _M_ctype(__c_type) {} - const char_type* - operator()(const char_type* __first, const char_type* __last) const { - __last = find_if(__first, __last, - _Eq_char_bound<_Traits>(char_type())); - return _M_ctype->scan_is(ctype_base::space, __first, __last); - } -}; - -template -struct _Scan_for_not_wspace { - typedef typename _Traits::char_type char_type; - typedef char_type* first_argument_type; - typedef char_type* second_argument_type; - typedef char_type* result_type; - - const ctype* _M_ctype; - - _Scan_for_not_wspace(const ctype* __c_type) : _M_ctype(__c_type) {} - const char_type* - operator()(const char_type* __first, const char_type* __last) const { - return _M_ctype->scan_not(ctype_base::space, __first, __last); - } -}; - -template -struct _Scan_for_char_val { - typedef typename _Traits::char_type char_type; - typedef char_type* first_argument_type; - typedef char_type* second_argument_type; - typedef char_type* result_type; - - char_type _M_val; - - _Scan_for_char_val(char_type __val) : _M_val(__val) {} - - const char_type* - operator()(const char_type* __first, const char_type* __last) const { - return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val)); - } -}; - -template -struct _Scan_for_int_val { - typedef typename _Traits::char_type char_type; - typedef typename _Traits::int_type int_type; - typedef char_type* first_argument_type; - typedef char_type* second_argument_type; - typedef char_type* result_type; - - int_type _M_val; - - _Scan_for_int_val(int_type __val) : _M_val(__val) {} - - const char_type* - operator()(const char_type* __first, const char_type* __last) const { - return find_if(__first, __last, - _Eq_int_bound<_Traits>(_M_val)); - } -}; - -// Helper function: try to push back a character to a streambuf, -// return true if the pushback succeeded. Does not throw. - -template -bool _STLP_CALL -__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) { - bool ret; - _STLP_TRY { - const typename _Traits::int_type __eof = _Traits::eof(); - ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof); - } - _STLP_CATCH_ALL { - ret = false; - } - return ret; -} - -//---------------------------------------------------------------------- -// Definitions of basic_istream<>'s noninline member functions. - -// Helper function for formatted input of numbers. -template -ios_base::iostate _STLP_CALL -__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) { - typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; - ios_base::iostate __err = 0; - _Sentry __sentry( __that ); // Skip whitespace. - if (__sentry) { - typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get; - _STLP_TRY { - ((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()), - 0, __that, __err, __val); - } - _STLP_CATCH_ALL { - __that._M_handle_exception(ios_base::badbit); - } - if (__err) __that.setstate(__err); - } - return __err; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) { - long __lval; - _STLP_PRIV __get_num(*this, __lval); - if ( this->fail() ) { - return *this; - } - short __tmp = __STATIC_CAST(short, __lval); - unsigned short __uval = __STATIC_CAST(unsigned short, __lval); - // check if we lose digits - // if ((__val != __lval) && ((unsigned short)__val != __lval)) - if ((__tmp != __lval) && ((long)__uval != __lval)) - this->setstate(ios_base::failbit); - else - __val = __tmp; - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) { - long __lval; - _STLP_PRIV __get_num(*this, __lval); - if ( this->fail() ) { - return *this; - } - int __tmp = __lval; - unsigned int __uval = __lval; - // check if we lose digits - // if ((__val != __lval) && ((unsigned int)__val != __lval)) - if ((__tmp != __lval) && ((long)__uval != __lval)) - this->setstate(ios_base::failbit); - else - __val = __tmp; - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -#if defined (_STLP_LONG_LONG) -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} -#endif -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} -#if !defined (_STLP_NO_LONG_DOUBLE) -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} -#endif -#if !defined (_STLP_NO_BOOL) -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} -#endif - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) { - _STLP_PRIV __get_num(*this, __val); - return *this; -} - -// Unformatted input - -template -__BIS_int_type__ -basic_istream<_CharT, _Traits>::peek() { - typename _Traits::int_type __tmp = _Traits::eof(); - - this->_M_gcount = 0; - sentry __sentry(*this, _No_Skip_WS()); - - if (__sentry) { - _STLP_TRY { - __tmp = this->rdbuf()->sgetc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - if (this->_S_eof(__tmp)) - this->setstate(ios_base::eofbit); - } - - return __tmp; -} - - -template -__BIS_int_type__ -basic_istream<_CharT, _Traits>::get() { - typename _Traits::int_type __tmp = _Traits::eof(); - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - _STLP_TRY { - __tmp = this->rdbuf()->sbumpc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - - if (!this->_S_eof(__tmp)) - this->_M_gcount = 1; - } - - if (_M_gcount == 0) - this->setstate(ios_base::eofbit | ios_base::failbit); - - return __tmp; -} - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::get(_CharT& __c) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - typename _Traits::int_type __tmp = _Traits::eof(); - _STLP_TRY { - __tmp = this->rdbuf()->sbumpc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - - if (!this->_S_eof(__tmp)) { - this->_M_gcount = 1; - __c = _Traits::to_char_type(__tmp); - } - } - - if (this->_M_gcount == 0) - this->setstate(ios_base::eofbit | ios_base::failbit); - - return *this; -} - - -// Read characters and discard them. The standard specifies a single -// function with two arguments, each with a default. We instead use -// three overloded functions, because it's possible to implement the -// first two more efficiently than the fully general third version. -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - int_type __c; - _STLP_TRY { - __c = this->rdbuf()->sbumpc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - return *this; - } - - if (!this->_S_eof(__c)) - this->_M_gcount = 1; - else - this->setstate(ios_base::eofbit); - } - - return *this; -} - -// Putback - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::putback(_CharT __c) { - this->_M_gcount = 0; - sentry __sentry(*this, _No_Skip_WS()); - - if (__sentry) { - typename _Traits::int_type __tmp = _Traits::eof(); - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); -// if (!__buf || this->_S_eof(__buf->sputbackc(__c))) - if (__buf) { - _STLP_TRY { - __tmp = __buf->sputbackc(__c); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - } - if (this->_S_eof(__tmp)) - this->setstate(ios_base::badbit); - } - else - this->setstate(ios_base::failbit); - - return *this; -} - -template -basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { - this->_M_gcount = 0; - - sentry __sentry(*this, _No_Skip_WS()); - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof())) - if (__buf) { - _STLP_TRY { - if (this->_S_eof(__buf->sungetc())) - this->setstate(ios_base::badbit); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - } else - this->setstate(ios_base::badbit); - } - else - this->setstate(ios_base::failbit); - - return *this; -} - -// Positioning and buffer control. - -template -int basic_istream<_CharT, _Traits>::sync() { - sentry __sentry(*this, _No_Skip_WS()); - - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - if (__buf) { - if (__buf->pubsync() == -1) { - this->setstate(ios_base::badbit); - return -1; - } - else - return 0; - } - else - return -1; -} - -template -__BIS_pos_type__ -basic_istream<_CharT, _Traits>::tellg() { - sentry __sentry(*this, _No_Skip_WS()); - - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in) - : pos_type(-1); -} - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::seekg(pos_type __pos) { - sentry __sentry(*this, _No_Skip_WS()); - - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - if (!this->fail() && __buf) { - if (__buf->pubseekpos(__pos) == pos_type(-1)) { - this->setstate(ios_base::failbit); - } - } - return *this; -} - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) { - sentry __sentry(*this, _No_Skip_WS()); - - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - if (!this->fail() && __buf) - __buf->pubseekoff(__off, __dir); - return *this; -} - -// Formatted input of characters and character arrays. - -template -void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) { -// typename _Traits::int_type __tmp = _Traits::eof(); - - sentry __sentry(*this); // Skip whitespace. - - if (__sentry) { - typename _Traits::int_type __tmp;// = _Traits::eof(); - - _STLP_TRY { - __tmp = this->rdbuf()->sbumpc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - return; - } - - if (!this->_S_eof(__tmp)) - __c = _Traits::to_char_type(__tmp); - else - this->setstate(ios_base::eofbit | ios_base::failbit); - } -} - - -//--------------------------------------------------------------------------- -// istream's helper functions. - -// A generic function for unbuffered input. We stop when we reach EOF, -// or when we have extracted _Num characters, or when the function object -// __is_delim return true. In the last case, it extracts the character -// for which __is_delim is true, if and only if __extract_delim is true. -// It appends a null character to the end of the string; this means that -// it may store up to _Num + 1 characters. -// -// __is_getline governs two corner cases: reading _Num characters without -// encountering delim or eof (in which case failbit is set if __is_getline -// is true); and reading _Num characters where the _Num+1'st character is -// eof (in which case eofbit is set if __is_getline is true). -// -// It is assumed that __is_delim never throws. -// -// Return value is the number of characters extracted, including the -// delimiter if it is extracted. Note that the number of characaters -// extracted isn't necessarily the same as the number stored. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template < class _CharT, class _Traits, class _Is_Delim> -streamsize _STLP_CALL -__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf, - streamsize _Num, _CharT* __s, - _Is_Delim __is_delim, - bool __extract_delim, bool __append_null, - bool __is_getline) -{ - streamsize __n = 0; - ios_base::iostate __status = 0; - - typedef typename basic_istream<_CharT, _Traits>::int_type int_type; - // The operations that can potentially throw are sbumpc, snextc, and sgetc. - _STLP_TRY { - for (;;) { - if (__n == _Num) { - if (__is_getline) // didn't find delimiter as one of the _Num chars - __status |= ios_base::failbit; - break; - } - - int_type __c = __buf->sbumpc(); // sschwarz - - if (__that->_S_eof(__c)) { - if (__n < _Num || __is_getline) - __status |= ios_base::eofbit; - break; - } else if (__is_delim(_Traits::to_char_type(__c))) { - if (__extract_delim) { // Extract and discard current character. - ++__n; - } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter - __status |= ios_base::failbit; - } - break; - } - // regular character - *__s++ = _Traits::to_char_type(__c); - ++__n; - } - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); - return __n; - } - - if (__append_null) - *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); - if (__status) - __that->setstate(__status); // This might throw. - return __n; -} - -// Much like __read_unbuffered, but with one additional function object: -// __scan_delim(first, last) returns the first pointer p in [first, last) -// such that __is_delim(p) is true. - -template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> -streamsize _STLP_CALL -__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf, - streamsize _Num, _CharT* __s, - _Is_Delim __is_delim, _Scan_Delim __scan_delim, - bool __extract_delim, bool __append_null, - bool __is_getline) { - streamsize __n = 0; - ios_base::iostate __status = 0; - bool __done = false; - - _STLP_TRY { - while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) { - const _CharT* __first = __buf->_M_gptr(); - const _CharT* __last = __buf->_M_egptr(); - //casting numeric_limits::max to streamsize only works is ptrdiff_t is signed or streamsize representation - //is larger than ptrdiff_t one. - _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) || - (sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits::is_signed) - ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), _Num - __n)); - - const _CharT* __p = __scan_delim(__first, __last); - ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request); - _Traits::copy(__s, __first, __chunk); - __s += __chunk; - __n += __chunk; - __buf->_M_gbump((int)__chunk); - - // We terminated by finding delim. - if (__p != __last && __p - __first <= __request) { - if (__extract_delim) { - __n += 1; - __buf->_M_gbump(1); - } - __done = true; - } - - // We terminated by reading all the characters we were asked for. - else if (__n == _Num) { - - // Find out if we have reached eof. This matters for getline. - if (__is_getline) { - if (__chunk == __last - __first) { - if (__that->_S_eof(__buf->sgetc())) - __status |= ios_base::eofbit; - } - else - __status |= ios_base::failbit; - } - __done = true; - } - - // The buffer contained fewer than _Num - __n characters. Either we're - // at eof, or we should refill the buffer and try again. - else { - if (__that->_S_eof(__buf->sgetc())) { - __status |= ios_base::eofbit; - __done = true; - } - } - } // Close the while loop. - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - __done = true; - } - - if (__done) { - if (__append_null) - *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); - if (__status != 0) - __that->setstate(__status); // This might throw. - return __n; - } - - // If execution has reached this point, then we have an empty buffer but - // we have not reached eof. What that means is that the streambuf has - // decided to switch from buffered to unbuffered input. We switch to - // to __read_unbuffered. - - return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim, - __extract_delim,__append_null,__is_getline); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n, - _CharT __delim) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - if (__n > 0) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - - if (__buf->egptr() != __buf->gptr()) - this->_M_gcount = - _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s, - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), - false, true, false); - else - this->_M_gcount = - _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s, - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - false, true, false); - } - } - - if (this->_M_gcount == 0) - this->setstate(ios_base::failbit); - - return *this; -} - -// Getline is essentially identical to get, except that it extracts -// the delimiter. -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n, - _CharT __delim) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - if (__n > 0) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - this->_M_gcount = __buf->egptr() != __buf->gptr() - ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s, - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), - true, true, true) - : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s, - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - true, true, true); - } - } - - if (this->_M_gcount == 0) - this->setstate(ios_base::failbit); - - return *this; -} - -// Read n characters. We don't look for any delimiter, and we don't -// put in a terminating null character. -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry && !this->eof()) { - basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf(); - if (__buf->gptr() != __buf->egptr()) - _M_gcount - = _STLP_PRIV __read_buffered(this, __buf, __n, __s, - _STLP_PRIV _Constant_unary_fun(false), - _STLP_PRIV _Project2nd(), - false, false, false); - else - _M_gcount - = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s, - _STLP_PRIV _Constant_unary_fun(false), - false, false, false); - } - else - this->setstate(ios_base::failbit); - - if (this->eof()) - this->setstate(ios_base::eofbit | ios_base::failbit); - - return *this; -} - - -// Read n or fewer characters. We don't look for any delimiter, and -// we don't put in a terminating null character. -template -streamsize -basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry && !this->eof() && __nmax >= 0) { - - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - streamsize __avail = __buf->in_avail(); - - // fbp : isn't full-blown setstate required here ? - if (__avail == -1) - this->_M_setstate_nothrow(ios_base::eofbit); - - else if (__avail != 0) { - - if (__buf->gptr() != __buf->egptr()) - _M_gcount - = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s, - _STLP_PRIV _Constant_unary_fun(false), - _STLP_PRIV _Project2nd(), - false, false, false); - else - _M_gcount - = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s, - _STLP_PRIV _Constant_unary_fun(false), - false, false, false); - } - } - else { - // fbp : changed so that failbit is set only there, to pass Dietmar's test - if (this->eof()) - this->setstate(ios_base::eofbit | ios_base::failbit); - else - this->setstate(ios_base::failbit); - } - - // if (this->eof()) - // this->setstate(ios_base::eofbit | ios_base::failbit); - - return _M_gcount; -} - -template -void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) { - sentry __sentry(*this); // Skip whitespace. - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - streamsize __nmax = this->width() > 0 - ? this->width() - 1 - : ((numeric_limits::max)() / sizeof(_CharT)) - 1; - - streamsize __n = __buf->gptr() != __buf->egptr() - ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s, - _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - _STLP_PRIV _Scan_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - false, true, false) - : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s, - _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - false, true, false); - if (__n == 0) - this->setstate(ios_base::failbit); - } - this->width(0); -} - -// A generic unbuffered function for ignoring characters. We stop -// when we reach EOF, or when the function object __is_delim returns -// true. In the last case, it extracts the character for which -// __is_delim is true, if and only if __extract_delim is true. - -template < class _CharT, class _Traits, class _Is_Delim> -void _STLP_CALL -_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that, - basic_streambuf<_CharT, _Traits>* __buf, - _Is_Delim __is_delim, - bool __extract_delim, bool __set_failbit) { - bool __done = false; - ios_base::iostate __status = 0; - typedef typename basic_istream<_CharT, _Traits>::int_type int_type; - - _STLP_TRY { - while (!__done) { - int_type __c = __buf->sbumpc(); - - if (__that->_S_eof(__c)) { - __done = true; - __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit - : ios_base::eofbit; - } - - else if (__is_delim(_Traits::to_char_type(__c))) { - __done = true; - if (!__extract_delim) - if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c)))) - __status |= ios_base::failbit; - } - } - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - } - - __that->setstate(__status); -} - -// A generic buffered function for ignoring characters. Much like -// _M_ignore_unbuffered, but with one additional function object: -// __scan_delim(first, last) returns the first pointer p in [first, -// last) such that __is_delim(p) is true. - -template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> -void _STLP_CALL -_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that, - basic_streambuf<_CharT, _Traits>* __buf, - _Is_Delim __is_delim, _Scan_Delim __scan_delim, - bool __extract_delim, bool __set_failbit) { - bool __at_eof = false; - bool __found_delim = false; - - _STLP_TRY { - while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) { - const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr()); - __buf->_M_gbump((int)(__p - __buf->_M_gptr())); - - if (__p != __buf->_M_egptr()) { // We found delim, so we're done. - if (__extract_delim) - __buf->_M_gbump(1); - __found_delim = true; - } - - else // No delim. Try to refil the buffer. - __at_eof = __that->_S_eof(__buf->sgetc()); - } // Close the while loop. - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - return; - } - - if (__at_eof) { - __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit - : ios_base::eofbit); - return; - } - if (__found_delim) - return; - - // If execution has reached this point, then we have an empty buffer but - // we have not reached eof. What that means is that the streambuf has - // decided to switch from a buffered to an unbuffered mode. We switch - // to _M_ignore_unbuffered. - _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit); -} - -// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered -// with an explicit count _Num. Return value is the number of -// characters extracted. -// -// The function object __max_chars takes two arguments, _Num and __n -// (the latter being the number of characters we have already read), -// and returns the maximum number of characters to read from the buffer. -// We parameterize _M_ignore_buffered so that we can use it for both -// bounded and unbounded input; for the former the function object should -// be minus<>, and for the latter it should return a constant maximum value. - -template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim> -streamsize _STLP_CALL -_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that, - basic_streambuf<_CharT, _Traits>* __buf, - streamsize _Num, _Max_Chars __max_chars, - _Is_Delim __is_delim, - bool __extract_delim, bool __set_failbit) { - streamsize __n = 0; - ios_base::iostate __status = 0; - typedef typename basic_istream<_CharT, _Traits>::int_type int_type; - - _STLP_TRY { - while (__max_chars(_Num, __n) > 0) { - int_type __c = __buf->sbumpc(); - - if (__that->_S_eof(__c)) { - __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit - : ios_base::eofbit; - break; - } - - else if (__is_delim(_Traits::to_char_type(__c))) { - if (__extract_delim) - ++__n; - else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c)))) - __status |= ios_base::failbit; - - break; - } - // fbp : added counter increment to pass Dietmar's test - ++__n; - } - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - } - - if (__status) - __that->setstate(__status); // This might throw. - return __n; -} - -template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim> -streamsize _STLP_CALL -_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that, - basic_streambuf<_CharT, _Traits>* __buf, - streamsize _Num, - _Max_Chars __max_chars, - _Is_Delim __is_delim, _Scan_Delim __scan_delim, - bool __extract_delim, bool __set_failbit) { - streamsize __n = 0; - bool __at_eof = false; - bool __done = false; - - _STLP_TRY { - while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) { - ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr(); - streamsize __m = __max_chars(_Num, __n); - - if (__avail >= __m) { // We have more characters than we need. - const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m); - const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last); - ptrdiff_t __chunk = __p - __buf->_M_gptr(); - __n += __chunk; - __buf->_M_gbump((int)__chunk); - - if (__extract_delim && __p != __last) { - __n += 1; - __buf->_M_gbump(1); - } - - __done = true; - } - - else { - const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr()); - ptrdiff_t __chunk = __p - __buf->_M_gptr(); - __n += __chunk; - __buf->_M_gbump((int)__chunk); - - if (__p != __buf->_M_egptr()) { // We found delim. - if (__extract_delim) { - __n += 1; - __buf->_M_gbump(1); - } - - __done = true; - } - - // We didn't find delim. Try to refill the buffer. - else if (__that->_S_eof(__buf->sgetc())) { - __done = true; - __at_eof = true; - } - } - } // Close the while loop. - } - _STLP_CATCH_ALL { - __that->_M_handle_exception(ios_base::badbit); - return __n; - } - - if (__at_eof) - __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit - : ios_base::eofbit); - - if (__done) - return __n; - - // If execution has reached this point, then we have an empty buffer but - // we have not reached eof. What that means is that the streambuf has - // decided to switch from buffered to unbuffered input. We switch to - // to _M_ignore_unbuffered. - - return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars, - __is_delim, __extract_delim, __set_failbit); -} - - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::ignore(streamsize __n) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - typedef _STLP_PRIV _Constant_unary_fun _Const_bool; - typedef _STLP_PRIV _Constant_binary_fun _Const_streamsize; - const streamsize __maxss = (numeric_limits::max)(); - - if (__n == (numeric_limits::max)()) { - if (__buf->gptr() != __buf->egptr()) - _M_gcount = _M_ignore_buffered(this, __buf, - __maxss, _Const_streamsize(__maxss), - _Const_bool(false), - _STLP_PRIV _Project2nd(), - false, false); - else - _M_gcount = _M_ignore_unbuffered(this, __buf, - __maxss, _Const_streamsize(__maxss), - _Const_bool(false), false, false); - } - else { - if (__buf->gptr() != __buf->egptr()) - _M_gcount = _M_ignore_buffered(this, __buf, - __n, minus(), - _Const_bool(false), - _STLP_PRIV _Project2nd(), - false, false); - else - _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus(), - _Const_bool(false), false, false); - } - } - - return *this; -} - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - typedef _STLP_PRIV _Constant_unary_fun _Const_bool; - typedef _STLP_PRIV _Constant_binary_fun - _Const_streamsize; - const streamsize __maxss = (numeric_limits::max)(); - - if (__n == (numeric_limits::max)()) { - if (__buf->gptr() != __buf->egptr()) - _M_gcount = _M_ignore_buffered(this, __buf, - __maxss, _Const_streamsize(__maxss), - _STLP_PRIV _Eq_int_bound<_Traits>(__delim), - _STLP_PRIV _Scan_for_int_val<_Traits>(__delim), - true, false); - else - _M_gcount = _M_ignore_unbuffered(this, __buf, - __maxss, _Const_streamsize(__maxss), - _STLP_PRIV _Eq_int_bound<_Traits>(__delim), - true, false); - } - else { - if (__buf->gptr() != __buf->egptr()) - _M_gcount = _M_ignore_buffered(this, __buf, - __n, minus(), - _STLP_PRIV _Eq_int_bound<_Traits>(__delim), - _STLP_PRIV _Scan_for_int_val<_Traits>(__delim), - true, false); - else - _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus(), - _STLP_PRIV _Eq_int_bound<_Traits>(__delim), - true, false); - } - } - - return *this; -} - -// This member function does not construct a sentry object, because -// it is called from sentry's constructor. -template -void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - if (!__buf) - this->setstate(ios_base::badbit); - else if (__buf->gptr() != __buf->egptr()) - _M_ignore_buffered(this, __buf, - _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - _STLP_PRIV _Scan_for_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - false, __set_failbit); - else - _M_ignore_unbuffered(this, __buf, - _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())), - false, __set_failbit); -} - - -// This is a very simple loop that reads characters from __src and puts -// them into __dest. It looks complicated because of the (standard- -// mandated) exception handling policy. -// -// We stop when we get an exception, when we fail to insert into the -// output streambuf, or when __is_delim is true. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template < class _CharT, class _Traits, class _Is_Delim> -streamsize _STLP_CALL -__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src, - basic_streambuf<_CharT, _Traits>* __dest, - _Is_Delim __is_delim, - bool __extract_delim, bool __rethrow) { - streamsize __extracted = 0; - ios_base::iostate __status = 0; - typedef typename basic_istream<_CharT, _Traits>::int_type int_type; - int_type __c; - - _STLP_TRY { - for (;;) { - // Get a character. If there's an exception, catch and (maybe) rethrow it. - __c = __src->sbumpc(); - - // If we failed to get a character, then quit. - if (__that->_S_eof(__c)) { - __status |= ios_base::eofbit; - break; - } - // If it's the delimiter, then quit. - else if (__is_delim(_Traits::to_char_type(__c))) { - if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c))) - __status |= ios_base::failbit; - break; - } - else { - // Try to put the character in the output streambuf. - bool __failed = false; - _STLP_TRY { - if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c)))) - ++__extracted; - else - __failed = true; - } - _STLP_CATCH_ALL { - __failed = true; - } - - // If we failed to put the character in the output streambuf, then - // try to push it back to the input streambuf. - if (__failed && !__pushback(__src, _Traits::to_char_type(__c))) - __status |= ios_base::failbit; - - // fbp : avoiding infinite loop in io-27-6-1-2-3.exp - if (__failed) - break; - } - - } /* for (;;) */ - - } - // fbp : this try/catch moved here in reasonable assumption - // __is_delim never throw (__pushback is guaranteed not to) - _STLP_CATCH_ALL { - // See 27.6.1.2.3, paragraph 13. - if (__rethrow && __extracted == 0) - __that->_M_handle_exception(ios_base::failbit); - } - __that->setstate(__status); - return __extracted; -} - -// Buffered copying from one streambuf to another. We copy the characters -// in chunks, rather than one at a time. We still have to worry about all -// of the error conditions we checked in __copy_unbuffered, plus one more: -// the streambuf might decide to switch from a buffered to an unbuffered mode. - -template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> -streamsize _STLP_CALL -__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src, - basic_streambuf<_CharT, _Traits>* __dest, - _Scan_Delim __scan_delim, _Is_Delim __is_delim, - bool __extract_delim, bool __rethrow) { - streamsize __extracted = 0; - ios_base::iostate __status = 0; - typedef typename basic_istream<_CharT, _Traits>::int_type int_type; - //Borland compiler generates a warning if assignment because value is never used: - int_type __c /*= _Traits::eof()*/; - _CharT* __first = __src->_M_gptr(); - ptrdiff_t __avail = __src->_M_egptr() - __first; - // fbp : introduced to move catch/try blocks out of the loop - bool __do_handle_exceptions = false; - - _STLP_TRY { - for (;;) { - const _CharT* __last = __scan_delim(__first, __src->_M_egptr()); - - // Try to copy the entire input buffer to the output buffer. - streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr() - ? (__last - __first) + 1 - : (__last - __first)); - __src->_M_gbump((int)__n); - __extracted += __n; - - // from this on, catch() will call _M_handle_exceptions() - __do_handle_exceptions = true; - - if (__n < __avail) // We found the delimiter, or else failed to - break; // copy some characters. - - __c = __src->sgetc(); - - // Three possibilities: we succeeded in refilling the buffer, or - // we got EOF, or the streambuf has switched to unbuffered mode. - __first = __src->_M_gptr(); - __avail = __src->_M_egptr() - __first; - - if (__avail > 0) - {} // dwa 1/16/00 -- suppress a Metrowerks warning - else if (__that->_S_eof(__c)) { - __status |= ios_base::eofbit; - break; - } - else { - return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim, - __extract_delim, __rethrow); - } - - __do_handle_exceptions = false; - } - } - - _STLP_CATCH_ALL { - // See 27.6.1.2.3, paragraph 13. - if (__rethrow && __do_handle_exceptions && __extracted == 0) - __that->_M_handle_exception(ios_base::failbit); - } - - if (__status) - __that->setstate(__status); // This might throw. - return __extracted; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits> - ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) { - sentry __sentry(*this, _No_Skip_WS()); - this->_M_gcount = 0; - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __src = this->rdbuf(); - - if (__src) - this->_M_gcount = __src->egptr() != __src->gptr() - ? _STLP_PRIV __copy_buffered(this, __src, &__dest, - _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - false, false) - : _STLP_PRIV __copy_unbuffered(this, __src, &__dest, - _STLP_PRIV _Eq_char_bound<_Traits>(__delim), - false, false); - } - - if (this->_M_gcount == 0) - this->setstate(ios_base::failbit); - - return *this; -} - -// Copying characters into a streambuf. -template -basic_istream<_CharT, _Traits>& -basic_istream<_CharT, _Traits> - ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) { - streamsize __n = 0; - typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; - _Sentry __sentry(*this); - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __src = this->rdbuf(); - if (__src && __dest) - __n = __src->egptr() != __src->gptr() - ? _STLP_PRIV __copy_buffered(this, __src, __dest, - _STLP_PRIV _Project2nd(), - _STLP_PRIV _Constant_unary_fun(false), - false, true) - : _STLP_PRIV __copy_unbuffered(this, __src, __dest, - _STLP_PRIV _Constant_unary_fun(false), - false, true); - } - - if (__n == 0) - this->setstate(ios_base::failbit); - - return *this; -} - -// ---------------------------------------------------------------- -// basic_iostream<> class -// ---------------------------------------------------------------- - -template -basic_iostream<_CharT, _Traits> - ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf) - : basic_ios<_CharT, _Traits>(), - basic_istream<_CharT, _Traits>(__buf), - basic_ostream<_CharT, _Traits>(__buf) { - this->init(__buf); -} - -template -basic_iostream<_CharT, _Traits>::~basic_iostream() -{} - -_STLP_END_NAMESPACE - -#undef __BIS_int_type__ -#undef __BIS_pos_type__ -#undef __BIS_off_type__ - -#endif /* _STLP_ISTREAM_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_istream.h b/SDK/stlport/stl/_istream.h deleted file mode 100644 index 9292cce2..00000000 --- a/SDK/stlport/stl/_istream.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_ISTREAM -#define _STLP_INTERNAL_ISTREAM - -// this block is included by _ostream.h, we include it here to lower #include level -#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) -# include -#endif - -#ifndef _STLP_INTERNAL_IOS_H -# include // For basic_ios<>. Includes . -#endif - -#ifndef _STLP_INTERNAL_OSTREAM_H -# include // Needed as a base class of basic_iostream. -#endif - -#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H -# include -#endif - -#include // Helper functions that allow char traits - // to be used as function objects. -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -template -class _Isentry; -#endif - -struct _No_Skip_WS {}; // Dummy class used by sentry. - -template -bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr); -template -bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr); - -//---------------------------------------------------------------------- -// Class basic_istream, a class that performs formatted input through -// a stream buffer. - -// The second template parameter, _Traits, defaults to char_traits<_CharT>. -// The default is declared in header , and it isn't declared here -// because C++ language rules do not allow it to be declared twice. - -template -class basic_istream : virtual public basic_ios<_CharT, _Traits> { - typedef basic_istream<_CharT, _Traits> _Self; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - //explicitely defined as private to avoid warnings: - basic_istream(_Self const&); - _Self& operator = (_Self const&); -#endif - -public: - // Types - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - typedef basic_ios<_CharT, _Traits> _Basic_ios; - - typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&); - typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&); - typedef _Self& (_STLP_CALL *__istream_fn)(_Self&); - -public: // Constructor and destructor. - explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) : - basic_ios<_CharT, _Traits>(), _M_gcount(0) { - this->init(__buf); - } - ~basic_istream() {}; - -public: // Nested sentry class. - -public: // Hooks for manipulators. The arguments are - // function pointers. - _Self& operator>> (__istream_fn __f) { return __f(*this); } - _Self& operator>> (__ios_fn __f) { __f(*this); return *this; } - _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; } - -public: // Formatted input of numbers. - _Self& operator>> (short& __val); - _Self& operator>> (int& __val); - _Self& operator>> (unsigned short& __val); - _Self& operator>> (unsigned int& __val); - _Self& operator>> (long& __val); - _Self& operator>> (unsigned long& __val); -#ifdef _STLP_LONG_LONG - _Self& operator>> (_STLP_LONG_LONG& __val); - _Self& operator>> (unsigned _STLP_LONG_LONG& __val); -#endif - _Self& operator>> (float& __val); - _Self& operator>> (double& __val); -# ifndef _STLP_NO_LONG_DOUBLE - _Self& operator>> (long double& __val); -# endif -# ifndef _STLP_NO_BOOL - _Self& operator>> (bool& __val); -# endif - _Self& operator>> (void*& __val); - -public: // Copying characters into a streambuf. - _Self& operator>>(basic_streambuf<_CharT, _Traits>*); - -public: // Unformatted input. - streamsize gcount() const { return _M_gcount; } - int_type peek(); - -public: // get() for single characters - int_type get(); - _Self& get(char_type& __c); - -public: // get() for character arrays. - _Self& get(char_type* __s, streamsize __n, char_type __delim); - _Self& get(char_type* __s, streamsize __n) - { return get(__s, __n, this->widen('\n')); } - -public: // get() for streambufs - _Self& get(basic_streambuf<_CharT, _Traits>& __buf, - char_type __delim); - _Self& get(basic_streambuf<_CharT, _Traits>& __buf) - { return get(__buf, this->widen('\n')); } - -public: // getline() - _Self& getline(char_type* __s, streamsize __n, char_type delim); - _Self& getline(char_type* __s, streamsize __n) - { return getline(__s, __n, this->widen('\n')); } - -public: // read(), readsome(), ignore() - _Self& ignore(); - _Self& ignore(streamsize __n); -#if (defined (_STLP_MSVC) && _STLP_MSVC < 1200) - inline -#endif - _Self& ignore(streamsize __n, int_type __delim); - - _Self& read(char_type* __s, streamsize __n); - streamsize readsome(char_type* __s, streamsize __n); - -public: // putback - _Self& putback(char_type __c); - _Self& unget(); - -public: // Positioning and buffer control. - int sync(); - - pos_type tellg(); - _Self& seekg(pos_type __pos); - _Self& seekg(off_type, ios_base::seekdir); - -public: // Helper functions for non-member extractors. - void _M_formatted_get(_CharT& __c); - void _M_formatted_get(_CharT* __s); - void _M_skip_whitespace(bool __set_failbit); - -private: // Number of characters extracted by the - streamsize _M_gcount; // most recent unformatted input function. - -public: - -#if defined (_STLP_USE_TEMPLATE_EXPORT) - // If we are using DLL specs, we have not to use inner classes - // end class declaration here - typedef _Isentry<_CharT, _Traits> sentry; -}; -# define sentry _Isentry -template -class _Isentry { - typedef _Isentry<_CharT, _Traits> _Self; -# else - class sentry { - typedef sentry _Self; -#endif - - private: - const bool _M_ok; - // basic_streambuf<_CharT, _Traits>* _M_buf; - - public: - typedef _Traits traits_type; - - explicit sentry(basic_istream<_CharT, _Traits>& __istr, - bool __noskipws = false) : - _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) ) - /* , _M_buf(__istr.rdbuf()) */ - {} - - // Calling this constructor is the same as calling the previous one with - // __noskipws = true, except that it doesn't require a runtime test. - sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */ - _M_ok(_M_init_noskip(__istr)) {} - - ~sentry() {} - - operator bool() const { return _M_ok; } - - private: // Disable assignment and copy constructor. - //Implementation is here only to avoid warning with some compilers. - sentry(const _Self&) : _M_ok(false) {} - _Self& operator=(const _Self&) { return *this; } - }; - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -# undef sentry -# else - // close basic_istream class definition here -}; -# endif - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _Isentry >; -_STLP_EXPORT_TEMPLATE_CLASS basic_istream >; -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS _Isentry >; -_STLP_EXPORT_TEMPLATE_CLASS basic_istream >; -# endif -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -// Non-member character and string extractor functions. -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) { - __in_str._M_formatted_get(__c); - return __in_str; -} - -template -inline basic_istream& _STLP_CALL -operator>>(basic_istream& __in_str, unsigned char& __c) { - __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c)); - return __in_str; -} - -template -inline basic_istream& _STLP_CALL -operator>>(basic_istream& __in_str, signed char& __c) { - __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c)); - return __in_str; -} - -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) { - __in_str._M_formatted_get(__s); - return __in_str; -} - -template -inline basic_istream& _STLP_CALL -operator>>(basic_istream& __in_str, unsigned char* __s) { - __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s)); - return __in_str; -} - -template -inline basic_istream& _STLP_CALL -operator>>(basic_istream& __in_str, signed char* __s) { - __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s)); - return __in_str; -} - -//---------------------------------------------------------------------- -// istream manipulator. -template -basic_istream<_CharT, _Traits>& _STLP_CALL -ws(basic_istream<_CharT, _Traits>& __istr) { - if (!__istr.eof()) { - typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; - _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace. - if (__sentry) - __istr._M_skip_whitespace(false); - } - return __istr; -} - -// Helper functions for istream<>::sentry constructor. -template -inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) { - if (__istr.good()) { - if (__istr.tie()) - __istr.tie()->flush(); - - __istr._M_skip_whitespace(true); - } - - if (!__istr.good()) { - __istr.setstate(ios_base::failbit); - return false; - } else - return true; -} - -template -inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) { - if (__istr.good()) { - if (__istr.tie()) - __istr.tie()->flush(); - - if (!__istr.rdbuf()) - __istr.setstate(ios_base::badbit); - } - else - __istr.setstate(ios_base::failbit); - return __istr.good(); -} - -//---------------------------------------------------------------------- -// Class iostream. -template -class basic_iostream - : public basic_istream<_CharT, _Traits>, - public basic_ostream<_CharT, _Traits> -{ -public: - typedef basic_ios<_CharT, _Traits> _Basic_ios; - - explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf); - virtual ~basic_iostream(); -}; - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_iostream >; - -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_iostream >; -# endif -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -template -basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr) -{ return __istr.rdbuf(); } - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_ISTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_istreambuf_iterator.h b/SDK/stlport/stl/_istreambuf_iterator.h deleted file mode 100644 index a1578eb0..00000000 --- a/SDK/stlport/stl/_istreambuf_iterator.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H -#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// defined in _istream.h -template -extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ; - -// We do not read any characters until operator* is called. operator* calls sgetc -// unless the iterator is unchanged from the last call in which case a cached value is -// used. Calls to operator++ use sbumpc. - -template -class istreambuf_iterator : - public iterator -{ -public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename _Traits::int_type int_type; - typedef basic_streambuf<_CharT, _Traits> streambuf_type; - typedef basic_istream<_CharT, _Traits> istream_type; - - typedef input_iterator_tag iterator_category; - typedef _CharT value_type; - typedef typename _Traits::off_type difference_type; - typedef const _CharT* pointer; - typedef const _CharT& reference; - -public: - istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); } - // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); } - inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is); - - char_type operator*() const { this->_M_getc(); return _M_c; } - istreambuf_iterator<_CharT, _Traits>& operator++() - { - _M_buf->sbumpc(); - _M_have_c = false; - return *this; - } - istreambuf_iterator<_CharT, _Traits> operator++(int); - - bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const { - if (this->_M_buf) - this->_M_getc(); - if (__i._M_buf) - __i._M_getc(); - return this->_M_eof == __i._M_eof; - } - -private: - void _M_init(streambuf_type* __p) { - _M_buf = __p; - _M_eof = (__p == 0); - _M_have_c = false; - } - - void _M_getc() const { - if (_M_have_c) - return; - int_type __c = _M_buf->sgetc(); -# if !defined (_STLP_NEED_MUTABLE) /* && ! defined (__SUNPRO_CC) */ - _M_c = traits_type::to_char_type(__c); - _M_eof = traits_type::eq_int_type(__c, traits_type::eof()); - _M_have_c = true; -# else - typedef istreambuf_iterator<_CharT,_Traits> _Self; - _Self* __that = __CONST_CAST(_Self*, this); - __that->_M_c = __STATIC_CAST(_CharT, traits_type::to_char_type(__c)); - __that->_M_eof = traits_type::eq_int_type(__c, traits_type::eof()); - __that->_M_have_c = true; -# endif - } - -private: - streambuf_type* _M_buf; - mutable _CharT _M_c; - mutable bool _M_eof; - mutable bool _M_have_c; -}; - -template -inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) -{ this->_M_init(_M_get_istreambuf(__is)); } - -template -inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x, - const istreambuf_iterator<_CharT, _Traits>& __y) { - return __x.equal(__y); -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x, - const istreambuf_iterator<_CharT, _Traits>& __y) { - return !__x.equal(__y); -} - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator >; -# if defined (INSTANTIATE_WIDE_STREAMS) -_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator >; -# endif -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES -template -inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); } -template -inline streamoff* _STLP_CALL -distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; } -template -inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; } -# endif - -template -istreambuf_iterator<_CharT, _Traits> -istreambuf_iterator<_CharT, _Traits>::operator++(int) { - _M_getc(); // __tmp should avoid any future actions under - // underlined buffer---during call of operator *() - // (due to buffer for *this and __tmp are the same). - istreambuf_iterator<_CharT, _Traits> __tmp = *this; - _M_buf->sbumpc(); - _M_have_c = false; - return __tmp; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_iterator.h b/SDK/stlport/stl/_iterator.h deleted file mode 100644 index ad23faa2..00000000 --- a/SDK/stlport/stl/_iterator.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ITERATOR_H -#define _STLP_INTERNAL_ITERATOR_H - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -// This is the new version of reverse_iterator, as defined in the -// draft C++ standard. It relies on the iterator_traits template, -// which in turn relies on partial specialization. The class -// reverse_bidirectional_iterator is no longer part of the draft -// standard, but it is retained for backward compatibility. - -template -class reverse_iterator : - public iterator::iterator_category, - typename iterator_traits<_Iterator>::value_type, - typename iterator_traits<_Iterator>::difference_type, - typename iterator_traits<_Iterator>::pointer, - typename iterator_traits<_Iterator>::reference> { -protected: - _Iterator current; - typedef reverse_iterator<_Iterator> _Self; -public: - typedef typename iterator_traits<_Iterator>::iterator_category iterator_category; - typedef typename iterator_traits<_Iterator>::value_type value_type; - typedef typename iterator_traits<_Iterator>::difference_type difference_type; - typedef typename iterator_traits<_Iterator>::pointer pointer; - typedef typename iterator_traits<_Iterator>::reference reference; - typedef _Iterator iterator_type; -public: - reverse_iterator() {} - explicit reverse_iterator(iterator_type __x) : current(__x) {} - reverse_iterator(const _Self& __x) : current(__x.current) {} - _Self& operator = (const _Self& __x) { current = __x.base(); return *this; } -# if defined (_STLP_MEMBER_TEMPLATES) - template - reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {} - template - _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; } -# endif /* _STLP_MEMBER_TEMPLATES */ - - iterator_type base() const { return current; } - reference operator*() const { - _Iterator __tmp = current; - return *--__tmp; - } - _STLP_DEFINE_ARROW_OPERATOR - _Self& operator++() { - --current; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - --current; - return __tmp; - } - _Self& operator--() { - ++current; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - ++current; - return __tmp; - } - - _Self operator+(difference_type __n) const { return _Self(current - __n); } - _Self& operator+=(difference_type __n) { - current -= __n; - return *this; - } - _Self operator-(difference_type __n) const { return _Self(current + __n); } - _Self& operator-=(difference_type __n) { - current += __n; - return *this; - } - reference operator[](difference_type __n) const { return *(*this + __n); } -}; - -template -inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return __x.base() == __y.base(); } - -template -inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return __y.base() < __x.base(); } - -# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -template -inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return !(__x == __y); } - -template -inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return !(__y < __x); } - -template -inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return !(__x < __y); } -# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -# if defined (__SUNPRO_CC) -inline ptrdiff_t _STLP_CALL -# else -inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL -# endif -operator-(const reverse_iterator<_Iterator>& __x, - const reverse_iterator<_Iterator>& __y) -{ return __y.base() - __x.base(); } - -template -inline reverse_iterator<_Iterator> _STLP_CALL -operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x) -{ return x.operator+(n); } -#endif - -template -class back_insert_iterator - : public iterator { - typedef back_insert_iterator<_Container> _Self; -protected: - //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant. - _Container *container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - - explicit back_insert_iterator(_Container& __x) : container(&__x) {} - - _Self& operator=(const _Self& __other) { - container = __other.container; - return *this; - } - _Self& operator=(const typename _Container::value_type& __val) { - container->push_back(__val); - return *this; - } - _Self& operator*() { return *this; } - _Self& operator++() { return *this; } - _Self operator++(int) { return *this; } -}; - -template -inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x) -{ return back_insert_iterator<_Container>(__x); } - -template -class front_insert_iterator - : public iterator { - typedef front_insert_iterator<_Container> _Self; -protected: - //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant. - _Container *container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - explicit front_insert_iterator(_Container& __x) : container(&__x) {} - - _Self& operator=(const _Self& __other) { - container = __other.container; - return *this; - } - _Self& operator=(const typename _Container::value_type& __val) { - container->push_front(__val); - return *this; - } - _Self& operator*() { return *this; } - _Self& operator++() { return *this; } - _Self operator++(int) { return *this; } -}; - -template -inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x) -{ return front_insert_iterator<_Container>(__x); } - -template -class insert_iterator - : public iterator { - typedef insert_iterator<_Container> _Self; -protected: - //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant. - _Container *container; - typename _Container::iterator _M_iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - insert_iterator(_Container& __x, typename _Container::iterator __i) - : container(&__x), _M_iter(__i) {} - - _Self& operator=(_Self const& __other) { - container = __other.container; - _M_iter = __other._M_iter; - return *this; - } - _Self& operator=(const typename _Container::value_type& __val) { - _M_iter = container->insert(_M_iter, __val); - ++_M_iter; - return *this; - } - _Self& operator*() { return *this; } - _Self& operator++() { return *this; } - _Self& operator++(int) { return *this; } -}; - -template -inline insert_iterator<_Container> _STLP_CALL -inserter(_Container& __x, _Iterator __i) { - typedef typename _Container::iterator __iter; - return insert_iterator<_Container>(__x, __iter(__i)); -} - -_STLP_END_NAMESPACE - -#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -# include -#endif - -#endif /* _STLP_INTERNAL_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_iterator_base.h b/SDK/stlport/stl/_iterator_base.h deleted file mode 100644 index 75fe492e..00000000 --- a/SDK/stlport/stl/_iterator_base.h +++ /dev/null @@ -1,541 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -#define _STLP_INTERNAL_ITERATOR_BASE_H - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) -//_STLP_BEGIN_NAMESPACE -//using namespace _STLP_VENDOR_CSTD; -//_STLP_END_NAMESPACE -//#endif /* _STLP_IMPORT_VENDOR_CSTD */ - -#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) -# ifndef _STLP_TYPE_TRAITS_H -# include -# endif -#endif - -_STLP_BEGIN_NAMESPACE - -struct input_iterator_tag {}; -struct output_iterator_tag {}; -struct forward_iterator_tag : public input_iterator_tag {}; -struct bidirectional_iterator_tag : public forward_iterator_tag {}; -struct random_access_iterator_tag : public bidirectional_iterator_tag {}; - - -template -struct iterator { - typedef _Category iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; - typedef _Pointer pointer; - typedef _Reference reference; -}; -_STLP_TEMPLATE_NULL -struct iterator { - typedef output_iterator_tag iterator_category; -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; -#endif -}; - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_category(_It) -# define _STLP_DISTANCE_TYPE(_It, _Tp) distance_type(_It) -# define _STLP_VALUE_TYPE(_It, _Tp) value_type(_It) -//Old HP iterator queries do not give information about the iterator -//associated reference type so we consider that it is not a real reference. -# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type() -#else -# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -# define _STLP_VALUE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::value_type*)0 -# define _STLP_DISTANCE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::difference_type*)0 -# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || ( defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__) -# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_traits< _Tp >::iterator_category() -# else -# define _STLP_ITERATOR_CATEGORY(_It, _Tp) typename iterator_traits< _Tp >::iterator_category() -# endif -# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _IsRefType< typename iterator_traits< _Tp >::reference >::_Ret() -# else -# define _STLP_ITERATOR_CATEGORY(_It, _Tp) __iterator_category(_It, _IsPtrType<_Tp>::_Ret()) -# define _STLP_DISTANCE_TYPE(_It, _Tp) (ptrdiff_t*)0 -# define _STLP_VALUE_TYPE(_It, _Tp) __value_type(_It, _IsPtrType<_Tp>::_Ret() ) -# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type() -# endif -#endif - -template -struct iterator_traits { - typedef typename _Iterator::iterator_category iterator_category; - typedef typename _Iterator::value_type value_type; - typedef typename _Iterator::difference_type difference_type; - typedef typename _Iterator::pointer pointer; - typedef typename _Iterator::reference reference; -}; - - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (__SUNPRO_CC) -# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type -#else -# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t -#endif - -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - -// fbp : this order keeps gcc happy -template -struct iterator_traits { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; -}; - -template -struct iterator_traits<_Tp*> { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef _Tp& reference; -}; - -# if defined (__BORLANDC__) -template -struct iterator_traits<_Tp* const> { - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef ptrdiff_t difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; -}; -# endif - -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \ - (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && ! defined (_STLP_NO_ARROW_OPERATOR)) -# define _STLP_POINTERS_SPECIALIZE( _TpP ) -# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); } -#else -# include -#endif - -#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES -// The overloaded functions iterator_category, distance_type, and -// value_type are not part of the C++ standard. (They have been -// replaced by struct iterator_traits.) They are included for -// backward compatibility with the HP STL. -// We introduce internal names for these functions. - -# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - -template -inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) { - typedef typename iterator_traits<_Iter>::iterator_category _Category; - return _Category(); -} - -template -inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) { - typedef typename iterator_traits<_Iter>::difference_type _diff_type; - return __STATIC_CAST(_diff_type*,0); -} - -template -inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) { - typedef typename iterator_traits<_Iter>::value_type _value_type; - return __STATIC_CAST(_value_type*,0); -} - -# else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -template -inline random_access_iterator_tag -__iterator_category(const _Iter&, const __true_type&) { - return random_access_iterator_tag(); -} - -template -inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::iterator_category -__iterator_category(const _Iter&, const __false_type&) { - typedef typename iterator_traits<_Iter>::iterator_category _Category; - return _Category(); -} - - -template -inline ptrdiff_t* _STLP_CALL __distance_type(const _Iter&) { return __STATIC_CAST(ptrdiff_t*, 0); } - -template -inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::value_type* -__value_type(const _Iter&, const __false_type&) { - typedef typename iterator_traits<_Iter>::value_type _value_type; - return __STATIC_CAST(_value_type*,0); -} - -template -inline _Tp* -__value_type(const _Tp*, const __true_type&) { - return __STATIC_CAST(_Tp*, 0); -} - -# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ -template -inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); } -template -inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); } -template -inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); } -template -inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); } -template -inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); } -template -inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); } -#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ - -# if ! defined (_STLP_NO_ANACHRONISMS) -// The base classes input_iterator, output_iterator, forward_iterator, -// bidirectional_iterator, and random_access_iterator are not part of -// the C++ standard. (They have been replaced by struct iterator.) -// They are included for backward compatibility with the HP STL. -template struct input_iterator : - public iterator {}; -struct output_iterator : public iterator {}; -template struct forward_iterator : - public iterator {}; -template struct bidirectional_iterator : - public iterator {}; -template struct random_access_iterator : - public iterator {}; - -# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -template -inline input_iterator_tag _STLP_CALL -iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); } -inline output_iterator_tag _STLP_CALL -iterator_category(const output_iterator&) { return output_iterator_tag(); } -template -inline forward_iterator_tag _STLP_CALL -iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); } -template -inline bidirectional_iterator_tag _STLP_CALL -iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); } -template -inline random_access_iterator_tag _STLP_CALL -iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); } -template -inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } -template -inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } -template -inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } -template -inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } -template -inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } -template -inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } -template -inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);} -template -inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } -# endif /* BASE_MATCH */ - -#endif /* _STLP_NO_ANACHRONISMS */ - -template -inline void _STLP_CALL __distance(const _InputIterator& __first, const _InputIterator& __last, - _Distance& __n, const input_iterator_tag &) { - _InputIterator __it(__first); - while (__it != __last) { ++__it; ++__n; } -} - - -# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline void _STLP_CALL __distance(const _ForwardIterator& __first, const _ForwardIterator& __last, - _Distance& __n, const forward_iterator_tag &) { - _ForwardIterator __it(__first); - while (__it != __last) { ++__first; ++__n; } -} - -template -_STLP_INLINE_LOOP void _STLP_CALL __distance(const _BidirectionalIterator& __first, - const _BidirectionalIterator& __last, - _Distance& __n, const bidirectional_iterator_tag &) { - _BidirectionalIterator __it(__first); - while (__it != __last) { ++__it; ++__n; } -} -# endif - -template -inline void _STLP_CALL __distance(const _RandomAccessIterator& __first, - const _RandomAccessIterator& __last, - _Distance& __n, const random_access_iterator_tag &) { - __n += __last - __first; -} - -#ifndef _STLP_NO_ANACHRONISMS -template -inline void _STLP_CALL distance(const _InputIterator& __first, - const _InputIterator& __last, _Distance& __n) { - __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); -} -#endif - -template -inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL -__distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) { - _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0; - _InputIterator __it(__first); - while (__it != __last) { - ++__it; ++__n; - } - return __n; -} - -# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL -__distance(const _ForwardIterator& __first, const _ForwardIterator& __last, - const forward_iterator_tag &) -{ - _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0; - _ForwardIterator __it(__first); - while (__it != __last) { - ++__it; ++__n; - } - return __n; - -} - -template -_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL -__distance(const _BidirectionalIterator& __first, - const _BidirectionalIterator& __last, - const bidirectional_iterator_tag &) { - _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0; - _BidirectionalIterator __it(__first); - while (__it != __last) { - ++__it; ++__n; - } - return __n; -} -# endif - -template -inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL -__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last, - const random_access_iterator_tag &) { - return __last - __first; -} - -template -inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL -distance(_InputIterator __first, _InputIterator __last) { - return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); -} - -// fbp: those are being used for iterator/const_iterator definitions everywhere -template -struct _Nonconst_traits; - -template -struct _Const_traits { - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - typedef _Const_traits<_Tp> _ConstTraits; - typedef _Nonconst_traits<_Tp> _NonConstTraits; -}; - -template -struct _Nonconst_traits { - typedef _Tp value_type; - typedef _Tp& reference; - typedef _Tp* pointer; - typedef _Const_traits<_Tp> _ConstTraits; - typedef _Nonconst_traits<_Tp> _NonConstTraits; -}; - -/* - * dums: A special iterator/const_iterator traits for set and multiset for which even - * the iterator is not mutable - */ -template -struct _Nonconst_Const_traits; - -template -struct _Const_Const_traits { - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - typedef _Const_Const_traits<_Tp> _ConstTraits; - typedef _Nonconst_Const_traits<_Tp> _NonConstTraits; -}; - -template -struct _Nonconst_Const_traits { - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - typedef _Const_Const_traits<_Tp> _ConstTraits; - typedef _Nonconst_Const_traits<_Tp> _NonConstTraits; -}; - -/* - * A macro to generate a new iterator traits from one of the - * previous one. Changing the iterator traits type make iterators - * from different containers not comparable. - */ -#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \ -template \ -struct _##Motif; \ -template \ -struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \ - typedef _Const##Motif<_Tp> _ConstTraits; \ - typedef _##Motif<_Tp> _NonConstTraits; \ -}; \ -template \ -struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \ - typedef _Const##Motif<_Tp> _ConstTraits; \ - typedef _##Motif<_Tp> _NonConstTraits; \ -}; - -#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \ -_STLP_MOVE_TO_PRIV_NAMESPACE \ -_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \ -_STLP_MOVE_TO_STD_NAMESPACE - -#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \ -_STLP_MOVE_TO_PRIV_NAMESPACE \ -_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \ -_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \ -template \ -struct _##Motif { \ - typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \ - typedef _NonLocal##Motif<_Tp> _NonConstTraits; \ - typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \ - typedef _Local##Motif<_Tp> _NonConstLocalTraits; \ -}; \ -_STLP_MOVE_TO_STD_NAMESPACE - -/* -# if defined (_STLP_BASE_TYPEDEF_BUG) -// this workaround is needed for SunPro 4.0.1 -template -struct __cnst_traits_aux : private _Traits { - typedef typename _Traits::value_type value_type; -}; -# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type -# else -# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type -# endif -*/ - -#if defined (_STLP_MSVC) -// MSVC specific -template -inline void _STLP_CALL _Distance(_InputIterator __first, - _InputIterator __last, _Dist& __n) { - __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); -} -#endif - -template -_STLP_INLINE_LOOP void _STLP_CALL -__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) { - while (__n--) ++__i; -} - -// fbp : added output iterator tag variant -template -_STLP_INLINE_LOOP void _STLP_CALL -__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) { - while (__n--) ++__i; -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -_STLP_INLINE_LOOP void _STLP_CALL -__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) { - while (n--) ++i; -} -#endif - -template -_STLP_INLINE_LOOP void _STLP_CALL -__advance(_BidirectionalIterator& __i, _Distance __n, - const bidirectional_iterator_tag &) { - if (__n > 0) - while (__n--) ++__i; - else - while (__n++) --__i; -} - -template -inline void _STLP_CALL -__advance(_RandomAccessIterator& __i, _Distance __n, - const random_access_iterator_tag &) { - __i += __n; -} - -template -inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) { - __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator)); -} - -_STLP_END_NAMESPACE - -#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_H) -# include -#endif - -#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_iterator_old.h b/SDK/stlport/stl/_iterator_old.h deleted file mode 100644 index d20a11f9..00000000 --- a/SDK/stlport/stl/_iterator_old.h +++ /dev/null @@ -1,351 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_ITERATOR_OLD_H -#define _STLP_INTERNAL_ITERATOR_OLD_H - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES - -template -inline output_iterator_tag _STLP_CALL -iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); } -template -inline output_iterator_tag _STLP_CALL -iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); } -template -inline output_iterator_tag _STLP_CALL -iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); } - -# endif - -# if defined (_STLP_MSVC50_COMPATIBILITY) -# define __Reference _Reference, class _Pointer -# define Reference__ _Reference, _Pointer -template -# else -# define __Reference _Reference -# define Reference__ _Reference -template -# endif -class reverse_bidirectional_iterator { - typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, - Reference__, _Distance> _Self; - // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y); -protected: - _BidirectionalIterator current; -public: - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; -# if defined (_STLP_MSVC50_COMPATIBILITY) - typedef _Pointer pointer; -# else - typedef _Tp* pointer; -# endif - typedef _Reference reference; - - reverse_bidirectional_iterator() {} - explicit reverse_bidirectional_iterator(_BidirectionalIterator __x) - : current(__x) {} - _BidirectionalIterator base() const { return current; } - _Reference operator*() const { - _BidirectionalIterator __tmp = current; - return *(--__tmp); - } -# if !(defined _STLP_NO_ARROW_OPERATOR) - _STLP_DEFINE_ARROW_OPERATOR -# endif - _Self& operator++() { - --current; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - --current; - return __tmp; - } - _Self& operator--() { - ++current; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - ++current; - return __tmp; - } -}; - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES -template -inline bidirectional_iterator_tag _STLP_CALL -iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) -{ return bidirectional_iterator_tag(); } -template -inline _Tp* _STLP_CALL -value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) -{ return (_Tp*) 0; } -template -inline _Distance* _STLP_CALL -distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) -{ return (_Distance*) 0; } -#endif - -template -inline bool _STLP_CALL operator==( - const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, - Reference__, _Distance>& __y) -{ - return __x.base() == __y.base(); -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool _STLP_CALL operator!=( - const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x, - const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y) -{ - return !(__x == __y); -} - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) - -// This is the old version of reverse_iterator, as found in the original -// HP STL. It does not use partial specialization. - -template = 0x2405) \ - || defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*ty 03/22/2001 - give the default to the secont param under MPW. - // I believe giving the default will cause any harm even though the 2nd type parameter - // still have to be provided for T* type iterators. - _STLP_DFL_TMPL_PARAM(_Tp,iterator_traits<_RandomAccessIterator>::value_type), -# else - class _Tp, -#endif - _STLP_DFL_TMPL_PARAM(_Reference,_Tp&), -# if defined (_STLP_MSVC50_COMPATIBILITY) - _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*), -# endif - _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)> -class reverse_iterator { - typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance> - _Self; -protected: - _RandomAccessIterator __current; -public: - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Distance difference_type; -# if defined (_STLP_MSVC50_COMPATIBILITY) - typedef _Pointer pointer; -# else - typedef _Tp* pointer; -# endif - typedef _Reference reference; - - reverse_iterator() {} - reverse_iterator(const _Self& __x) : __current(__x.base()) {} - explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {} - _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; } - - _RandomAccessIterator base() const { return __current; } - _Reference operator*() const { return *(__current - (difference_type)1); } - -# if !(defined _STLP_NO_ARROW_OPERATOR) - _STLP_DEFINE_ARROW_OPERATOR -# endif - - _Self& operator++() { - --__current; - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - --__current; - return __tmp; - } - _Self& operator--() { - ++__current; - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - ++__current; - return __tmp; - } - _Self operator+(_Distance __n) const { - return _Self(__current - __n); - } - _Self& operator+=(_Distance __n) { - __current -= __n; - return *this; - } - _Self operator-(_Distance __n) const { - return _Self(__current + __n); - } - _Self& operator-=(_Distance __n) { - __current += __n; - return *this; - } - _Reference operator[](_Distance __n) const { return *(*this + __n); } -}; - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES -template -inline random_access_iterator_tag _STLP_CALL -iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) -{ return random_access_iterator_tag(); } -template -inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) -{ return (_Tp*) 0; } -template -inline _Distance* _STLP_CALL -distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) -{ return (_Distance*) 0; } -#endif - -template -inline bool _STLP_CALL -operator==(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) -{ - return __x.base() == __y.base(); -} - -template -inline bool _STLP_CALL -operator<(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) -{ - return __y.base() < __x.base(); -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool _STLP_CALL -operator!=(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) { - return !(__x == __y); -} - -template -inline bool _STLP_CALL -operator>(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) { - return __y < __x; -} - -template -inline bool _STLP_CALL -operator<=(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) { - return !(__y < __x); -} - -template -inline bool _STLP_CALL -operator>=(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) { - return !(__x < __y); -} - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline _Distance _STLP_CALL -operator-(const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __y) -{ - return __y.base() - __x.base(); -} - -template -inline reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance> _STLP_CALL -operator+(_Distance __n, - const reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>& __x) -{ - return reverse_iterator<_RandomAccessIterator, _Tp, - Reference__, _Distance>(__x.base() - __n); -} - -#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_limits.c b/SDK/stlport/stl/_limits.c deleted file mode 100644 index f56489bd..00000000 --- a/SDK/stlport/stl/_limits.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 1998,1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_LIMITS_C -#define _STLP_LIMITS_C - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -//========================================================== -// numeric_limits static members -//========================================================== - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#if !defined (_STLP_STATIC_CONST_INIT_BUG) - -# define __declare_numeric_base_member(__type, __mem, _Init) \ -template \ - const __type _Numeric_limits_base<__number>:: __mem - -__declare_numeric_base_member(bool, is_specialized, false); -__declare_numeric_base_member(int, digits, 0); -__declare_numeric_base_member(int, digits10, 0); -__declare_numeric_base_member(bool, is_signed, false); -__declare_numeric_base_member(bool, is_integer, false); -__declare_numeric_base_member(bool, is_exact, false); -__declare_numeric_base_member(int, radix, 0); -__declare_numeric_base_member(int, min_exponent, 0); -__declare_numeric_base_member(int, max_exponent, 0); -__declare_numeric_base_member(int, min_exponent10, 0); -__declare_numeric_base_member(int, max_exponent10, 0); -__declare_numeric_base_member(bool, has_infinity, false); -__declare_numeric_base_member(bool, has_quiet_NaN, false); -__declare_numeric_base_member(bool, has_signaling_NaN, false); -__declare_numeric_base_member(float_denorm_style, has_denorm, denorm_absent); -__declare_numeric_base_member(bool, has_denorm_loss, false); -__declare_numeric_base_member(bool, is_iec559, false); -__declare_numeric_base_member(bool, is_bounded, false); -__declare_numeric_base_member(bool, is_modulo, false); -__declare_numeric_base_member(bool, traps, false); -__declare_numeric_base_member(bool, tinyness_before, false); -__declare_numeric_base_member(float_round_style, round_style, round_toward_zero); - -# undef __declare_numeric_base_member - -# define __declare_integer_limits_member(__type, __mem, _Init) \ -template \ - const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem - -__declare_integer_limits_member(bool, is_specialized, true); -__declare_integer_limits_member(int, digits, (__idigits < 0) ? \ - ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) \ - : (__idigits) ); -__declare_integer_limits_member(int, digits10, (int)(301UL * digits) /1000); -__declare_integer_limits_member(bool, is_signed, __imin != 0); -__declare_integer_limits_member(bool, is_integer, true); -__declare_integer_limits_member(bool, is_exact, true); -__declare_integer_limits_member(int, radix, 2); -__declare_integer_limits_member(bool, is_bounded, true); -__declare_integer_limits_member(bool, is_modulo, true); -# undef __declare_integer_limits_member - -# define __declare_float_limits_member(__type, __mem, _Init) \ -template \ -const __type _Floating_limits< __number, __Digits, __Digits10, \ - __MinExp, __MaxExp, __MinExp10, __MaxExp10, \ - __IsIEC559, __RoundStyle>::\ - __mem - -__declare_float_limits_member(bool, is_specialized, true); -__declare_float_limits_member(int, digits, __Digits); -__declare_float_limits_member(int, digits10, __Digits10); -__declare_float_limits_member(bool, is_signed, true); -__declare_float_limits_member(int, radix, FLT_RADIX); -__declare_float_limits_member(int, min_exponent, __MinExp); -__declare_float_limits_member(int, max_exponent, __MaxExp); -__declare_float_limits_member(int, min_exponent10, __MinExp10); -__declare_float_limits_member(int, max_exponent10, __MaxExp10); -__declare_float_limits_member(bool, has_infinity, true); -__declare_float_limits_member(bool, has_quiet_NaN, true); -__declare_float_limits_member(bool, has_signaling_NaN, true); -__declare_float_limits_member(float_denorm_style, has_denorm, denorm_indeterminate); -__declare_float_limits_member(bool, has_denorm_loss, false); -__declare_float_limits_member(bool, is_iec559, __IsIEC559); -__declare_float_limits_member(bool, is_bounded, true); -__declare_float_limits_member(bool, traps, true); -__declare_float_limits_member(bool, tinyness_before, false); -__declare_float_limits_member(float_round_style, round_style, __RoundStyle); -# undef __declare_float_limits_member - -#endif /* _STLP_STATIC_CONST_INIT_BUG */ - - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) - -# if defined (_STLP_BIG_ENDIAN) -# if defined (__OS400__) -# define _STLP_FLOAT_INF_REP { 0x7f80, 0 } -# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 } -# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 } -# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 } -# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 } -# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 } -# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 } -# else /* __OS400__ */ -# define _STLP_FLOAT_INF_REP { 0x7f80, 0 } -# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 } -# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 } -# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 } -# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 } -# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 } -# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 } -# endif /* __OS400__ */ - -# elif defined (_STLP_LITTLE_ENDIAN) - -# if 0 /* defined(_STLP_MSVC) || defined(__linux__) */ -// some IA-32 platform ?? -/* -# define _STLP_FLOAT_INF_REP { 0, 0x7f80 } -# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 } -# define _STLP_FLOAT_SNAN_REP { 0, 0xff80 } - -# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } -# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 } -# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 } -# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 } // ???? -# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 } // ???? -# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF0, 0 } // ???? -*/ -# elif defined(__DECCXX) - -# define _STLP_FLOAT_INF_REP { 0, 0x7f80 } -# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 } -# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 } - -# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } -# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 } -# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 } - -# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff } -# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff } -# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff} -# else -# define _STLP_FLOAT_INF_REP { 0, 0x7f80 } -# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 } -# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 } -# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } -# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 } -# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 } -# if defined (_STLP_MSVC) || defined (__ICL) -# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 } -# elif defined (__BORLANDC__) -# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff } -# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff } -# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff } -# else -# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 } -# endif -# endif -# else -/* This is an architecture we don't know how to handle. Return some -obviously wrong values. */ -# define _STLP_FLOAT_INF_REP { 0, 0 } -# define _STLP_FLOAT_QNAN_REP { 0, 0 } -# define _STLP_FLOAT_SNAN_REP { 0, 0 } -# define _STLP_DOUBLE_INF_REP { 0, 0 } -# define _STLP_DOUBLE_QNAN_REP { 0, 0 } -# define _STLP_DOUBLE_SNAN_REP { 0, 0 } -# define _STLP_LDOUBLE_INF_REP { 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0 } - -# endif - -# if 0 -/* -# if defined(_STLP_BIG_ENDIAN) - -# elif defined (_STLP_LITTLE_ENDIAN) -# else - -//This is an architecture we don't know how to handle. Return some -//obviously wrong values. -# define _STLP_FLOAT_INF_REP { 0, 0 } -# define _STLP_FLOAT_QNAN_REP { 0, 0 } -# define _STLP_FLOAT_SNAN_REP { 0, 0 } -# define _STLP_DOUBLE_INF_REP { 0, 0 } -# define _STLP_DOUBLE_QNAN_REP { 0, 0 } -# define _STLP_DOUBLE_SNAN_REP { 0, 0 } -# define _STLP_LDOUBLE_INF_REP { 0 } -# define _STLP_LDOUBLE_QNAN_REP { 0 } -# define _STLP_LDOUBLE_SNAN_REP { 0 } -# endif -*/ -# endif - -union _F_rep { - unsigned short rep[2]; - float val; -}; -union _D_rep { - unsigned short rep[4]; - double val; -}; - -# ifndef _STLP_NO_LONG_DOUBLE -union _LD_rep { - unsigned short rep[8]; - long double val; -}; -# endif - -template -float _STLP_CALL _LimG<__dummy>::get_F_inf() { - _F_rep _F_inf = {_STLP_FLOAT_INF_REP}; - return _F_inf.val; -} -template -float _STLP_CALL _LimG<__dummy>::get_F_qNaN() { - _F_rep _F_qNaN = {_STLP_FLOAT_QNAN_REP}; - return _F_qNaN.val; -} -template -float _STLP_CALL _LimG<__dummy>::get_F_sNaN() { - _F_rep _F_sNaN = {_STLP_FLOAT_SNAN_REP}; - return _F_sNaN.val; -} - -template -double _STLP_CALL _LimG<__dummy>::get_D_inf() { - _D_rep _D_inf = {_STLP_DOUBLE_INF_REP}; - return _D_inf.val; -} -template -double _STLP_CALL _LimG<__dummy>::get_D_qNaN() { - _D_rep _D_qNaN = {_STLP_DOUBLE_QNAN_REP}; - return _D_qNaN.val; -} -template -double _STLP_CALL _LimG<__dummy>::get_D_sNaN() { - _D_rep _D_sNaN = {_STLP_DOUBLE_SNAN_REP}; - return _D_sNaN.val; -} - -# if !defined (_STLP_NO_LONG_DOUBLE) -template -long double _STLP_CALL _LimG<__dummy>::get_LD_inf() { - _LD_rep _LD_inf = {_STLP_LDOUBLE_INF_REP}; - return _LD_inf.val; -} -template -long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() { - _LD_rep _LD_qNaN = {_STLP_LDOUBLE_QNAN_REP}; - return _LD_qNaN.val; -} -template -long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() { - _LD_rep _LD_sNaN = {_STLP_LDOUBLE_SNAN_REP}; - return _LD_sNaN.val; -} -# endif /* _STLP_NO_LONG_DOUBLE */ - -#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ - -#undef _STLP_LIMITS_MIN_TYPE -#undef _STLP_LIMITS_MAX_TYPE - -#undef _STLP_FLOAT_INF_REP -#undef _STLP_FLOAT_QNAN_REP -#undef _STLP_FLOAT_SNAN_REP -#undef _STLP_DOUBLE_INF_REP -#undef _STLP_DOUBLE_QNAN_REP -#undef _STLP_DOUBLE_SNAN_REP -#undef _STLP_LDOUBLE_INF_REP -#undef _STLP_LDOUBLE_QNAN_REP -#undef _STLP_LDOUBLE_SNAN_REP - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_LIMITS_C_INCLUDED */ diff --git a/SDK/stlport/stl/_limits.h b/SDK/stlport/stl/_limits.h deleted file mode 100644 index 0d4202d9..00000000 --- a/SDK/stlport/stl/_limits.h +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This may be not portable code. Parts of numeric_limits<> are - * inherently machine-dependent. At present this file is suitable - * for the MIPS, SPARC, Alpha and ia32 architectures. - */ - -#ifndef _STLP_INTERNAL_LIMITS -#define _STLP_INTERNAL_LIMITS - -#ifndef _STLP_CLIMITS -# include -#endif - -#ifndef _STLP_CFLOAT -# include -#endif - -#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -enum float_round_style { - round_indeterminate = -1, - round_toward_zero = 0, - round_to_nearest = 1, - round_toward_infinity = 2, - round_toward_neg_infinity = 3 -}; - -enum float_denorm_style { - denorm_indeterminate = -1, - denorm_absent = 0, - denorm_present = 1 -}; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Base class for all specializations of numeric_limits. -template -class _Numeric_limits_base { -public: - - static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); } - static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); } - -#if defined ( _STLP_STATIC_CONST_INIT_BUG) - enum { -#else - static const int -#endif - - digits = 0, - digits10 = 0, - radix = 0, - min_exponent = 0, - min_exponent10 = 0, - max_exponent = 0, - max_exponent10 = 0 - -#if defined ( _STLP_STATIC_CONST_INIT_BUG) - , - has_denorm = denorm_absent, - round_style = round_toward_zero, -#else - ; - static const float_denorm_style has_denorm = denorm_absent; - static const float_round_style round_style = round_toward_zero; - static const bool -#endif - - is_specialized = false, - is_signed = false, - is_integer = false, - is_exact = false, - has_infinity = false, - has_quiet_NaN = false, - has_signaling_NaN = false, - has_denorm_loss = false, - is_iec559 = false, - is_bounded = false, - is_modulo = false, - traps = false, - tinyness_before = false -#if defined ( _STLP_STATIC_CONST_INIT_BUG) - } -#endif - ; - - static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); } - static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); } - - static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); } - static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); } - static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); } - static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); } -}; - -// Base class for integers. - -#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES -# ifdef _STLP_LONG_LONG -# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG -# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG -# else -# define _STLP_LIMITS_MIN_TYPE long -# define _STLP_LIMITS_MAX_TYPE unsigned long -# endif -#else -# define _STLP_LIMITS_MIN_TYPE _Int -# define _STLP_LIMITS_MAX_TYPE _Int -#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ - -template -class _Integer_limits : public _Numeric_limits_base<_Int> { -public: - - static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; } - static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; } - -#if defined (_STLP_STATIC_CONST_INIT_BUG) - enum { -#else - static const int -#endif - digits = (__idigits < 0) ? - ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) - : (__idigits), - digits10 = (digits * 301UL) / 1000, - radix = 2 -#if !defined (_STLP_STATIC_CONST_INIT_BUG) - ; - static const bool -#else - , -#endif - is_specialized = true, - is_signed = (__imin != 0), - is_integer = true, - is_exact = true, - is_bounded = true, - is_modulo = __ismod -#if defined ( _STLP_STATIC_CONST_INIT_BUG) - } -#endif - ; -}; - -// Base class for floating-point numbers. -template -class _Floating_limits : public _Numeric_limits_base<__number> { -public: - -#if defined (_STLP_STATIC_CONST_INIT_BUG) - enum { -#else - static const int -#endif - - digits = __Digits, - digits10 = __Digits10, - - radix = ( FLT_RADIX /* 2 */ ), - min_exponent = __MinExp, - max_exponent = __MaxExp, - min_exponent10 = __MinExp10, - max_exponent10 = __MaxExp10 - -#if defined (_STLP_STATIC_CONST_INIT_BUG) - , - has_denorm = denorm_indeterminate, - round_style = __RoundStyle, -#else - ; - static const float_denorm_style has_denorm = denorm_indeterminate; - static const float_round_style round_style = __RoundStyle; - static const bool -#endif - - is_specialized = true, - is_signed = true, - - //IEC 559 specify the floating point representation of - //infinity, quiet and signaling Not a Number. Not supporting - //it is consider as not being able to grant those values. -#if (defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) - //MSVC 6 do not fully support IEC 599 but grant a good infinity value. - has_infinity = true, -#else - has_infinity = __IsIEC559, -#endif - has_quiet_NaN = __IsIEC559, - has_signaling_NaN = __IsIEC559, - - has_denorm_loss = false, - is_iec559 = __IsIEC559, - is_bounded = true, - traps = true, - tinyness_before= false - -#if defined (_STLP_STATIC_CONST_INIT_BUG) - } -#endif - ; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -// Class numeric_limits - -// The unspecialized class. - -template -class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {}; - -// Specializations for all built-in integral types. - -#if !defined (_STLP_NO_BOOL) -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; -#endif /* _STLP_NO_BOOL */ - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -#if !defined (_STLP_NO_SIGNED_BUILTINS) -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; -#endif - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -#if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT)) - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -#endif - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -#if defined (__xlC__) && (__xlC__ == 0x500) -# undef INT_MIN -# define INT_MIN -2147483648 -#endif - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; - -#if defined (_STLP_LONG_LONG) - -# if defined (_STLP_MSVC) || defined (__BORLANDC__) -# define LONGLONG_MAX 0x7fffffffffffffffi64 -# define LONGLONG_MIN (-LONGLONG_MAX-1i64) -# define ULONGLONG_MAX 0xffffffffffffffffUi64 -# else -# ifndef LONGLONG_MAX -# define LONGLONG_MAX 0x7fffffffffffffffLL -# endif -# ifndef LONGLONG_MIN -# define LONGLONG_MIN (-LONGLONG_MAX-1LL) -# endif -# ifndef ULONGLONG_MAX -# define ULONGLONG_MAX 0xffffffffffffffffULL -# endif -# endif - -# if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) - -_STLP_TEMPLATE_NULL -class numeric_limits<_STLP_LONG_LONG> - : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> -{}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Integer_limits -{}; -# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */ -/* - newest gcc has new mangling scheme, that has problem - with generating name [instantiated] of template specialization like - _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> - ~~~~~~~~~~~~ ~~~~~~~~~~~~ - Below is code that solve this problem. - - ptr - */ -_STLP_TEMPLATE_NULL -class numeric_limits<_STLP_LONG_LONG> - : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> { -public: - - static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; } - static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; } - -# if defined ( _STLP_STATIC_CONST_INIT_BUG) - enum { -# else - static const int -# endif - digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1), - digits10 = (digits * 301UL) / 1000, - radix = 2 -# if ! defined (_STLP_STATIC_CONST_INIT_BUG) - ; - static const bool -# else - , -# endif - is_specialized = true, - is_signed = true, - is_integer = true, - is_exact = true, - is_bounded = true, - is_modulo = true -# if defined (_STLP_STATIC_CONST_INIT_BUG) - } -# endif - ; -}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Numeric_limits_base { -public: - - static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; } - static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; } - -# if defined (_STLP_STATIC_CONST_INIT_BUG) - enum { -# else - static const int -# endif - digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))), - digits10 = (digits * 301UL) / 1000, - radix = 2 -# if ! defined (_STLP_STATIC_CONST_INIT_BUG) - ; - static const bool -# else - , -# endif - is_specialized = true, - is_signed = false, - is_integer = true, - is_exact = true, - is_bounded = true, - is_modulo = true -# if defined ( _STLP_STATIC_CONST_INIT_BUG) - } -# endif - ; -}; - -# endif /* __GNUC__ > 2000-11-01 */ - -#endif /* _STLP_LONG_LONG */ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Specializations for all built-in floating-point types. -template -class _LimG { -public: - static float _STLP_CALL get_F_inf(); - static float _STLP_CALL get_F_qNaN(); - static float _STLP_CALL get_F_sNaN(); - static double _STLP_CALL get_D_inf(); - static double _STLP_CALL get_D_qNaN(); - static double _STLP_CALL get_D_sNaN(); - -#if !defined (_STLP_NO_LONG_DOUBLE) - static long double _STLP_CALL get_LD_inf(); - static long double _STLP_CALL get_LD_qNaN(); - static long double _STLP_CALL get_LD_sNaN(); -#endif -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _LimG; -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Floating_limits { -public: - static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; } - static float _STLP_CALL denorm_min() _STLP_NOTHROW { return FLT_MIN; } - static float (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return FLT_MAX; } - static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; } - static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps. - static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_inf(); } - static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_qNaN(); } - static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_sNaN(); } -}; - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Floating_limits { -public: - static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; } - static double _STLP_CALL denorm_min() _STLP_NOTHROW { return DBL_MIN; } - static double (_STLP_CALL max)() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return DBL_MAX; } - static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; } - static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps. - static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_inf(); } - static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_qNaN(); } - static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_sNaN(); } -}; - -#if !defined (_STLP_NO_LONG_DOUBLE) - -_STLP_TEMPLATE_NULL -class numeric_limits - : public _STLP_PRIV _Floating_limits { -public: - static long double (_STLP_CALL min) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; } - static long double _STLP_CALL denorm_min() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; } - static long double (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MAX; } - static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; } - static long double _STLP_CALL round_error() _STLP_NOTHROW { return 4; } // Units: ulps. - static long double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_LD_inf(); } - static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_LD_qNaN(); } - static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_LD_sNaN(); } -}; - -#endif - -// We write special values (Inf and NaN) as bit patterns and -// cast the the appropriate floating-point types. -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_list.c b/SDK/stlport/stl/_list.c deleted file mode 100644 index a1376c28..00000000 --- a/SDK/stlport/stl/_list.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_LIST_C -#define _STLP_LIST_C - -#ifndef _STLP_INTERNAL_LIST_H -# include -#endif - -#ifndef _STLP_CARRAY_H -# include -#endif - -#ifndef _STLP_RANGE_ERRORS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) -template -void _STLP_CALL -_List_global<_Dummy>::_Transfer(_List_node_base* __position, - _List_node_base* __first, _List_node_base* __last) { - if (__position != __last) { - // Remove [first, last) from its old position. - __last->_M_prev->_M_next = __position; - __first->_M_prev->_M_next = __last; - __position->_M_prev->_M_next = __first; - - // Splice [first, last) into its new position. - _Node_base* __tmp = __position->_M_prev; - __position->_M_prev = __last->_M_prev; - __last->_M_prev = __first->_M_prev; - __first->_M_prev = __tmp; - } -} -#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ - -template -void _List_base<_Tp,_Alloc>::clear() { - _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next); - while (__cur != &(_M_node._M_data)) { - _Node* __tmp = __cur; - __cur = __STATIC_CAST(_Node*, __cur->_M_next); - _STLP_STD::_Destroy(&__tmp->_M_data); - this->_M_node.deallocate(__tmp, 1); - } - _M_node._M_data._M_next = &_M_node._M_data; - _M_node._M_data._M_prev = &_M_node._M_data; -} - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# define size_type size_t -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define list _STLP_PTR_IMPL_NAME(list) -#elif defined (_STLP_DEBUG) -# define list _STLP_NON_DBG_NAME(list) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) { - iterator __i = begin(); - size_type __len = 0; - for ( ; __i != end() && __len < __new_size; ++__i, ++__len); - - if (__len == __new_size) - erase(__i, end()); - else // __i == end() - insert(end(), __new_size - __len, __x); -} - -template -list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) { - if (this != &__x) { - iterator __first1 = begin(); - iterator __last1 = end(); - const_iterator __first2 = __x.begin(); - const_iterator __last2 = __x.end(); - while (__first1 != __last1 && __first2 != __last2) - *__first1++ = *__first2++; - if (__first2 == __last2) - erase(__first1, __last1); - else - insert(__last1, __first2, __last2); - } - return *this; -} - -template -void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { - iterator __i = begin(); - for ( ; __i != end() && __n > 0; ++__i, --__n) - *__i = __val; - if (__n > 0) - insert(end(), __n, __val); - else - erase(__i, end()); -} - -#if !defined (list) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) { - typedef typename list<_Tp, _Alloc>::iterator _Literator; - _Literator __first = __that.begin(); - _Literator __last = __that.end(); - while (__first != __last) { - _Literator __next = __first; - ++__next; - if (__pred(*__first)) __that.erase(__first); - __first = __next; - } -} - -template -void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) { - typedef typename list<_Tp, _Alloc>::iterator _Literator; - _Literator __first = __that.begin(); - _Literator __last = __that.end(); - if (__first == __last) return; - _Literator __next = __first; - while (++__next != __last) { - if (__binary_pred(*__first, *__next)) - __that.erase(__next); - else - __first = __next; - __next = __first; - } -} - -template -void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x, - _StrictWeakOrdering __comp) { - typedef typename list<_Tp, _Alloc>::iterator _Literator; - _Literator __first1 = __that.begin(); - _Literator __last1 = __that.end(); - _Literator __first2 = __x.begin(); - _Literator __last2 = __x.end(); - if (__that.get_allocator() == __x.get_allocator()) { - while (__first1 != __last1 && __first2 != __last2) { - if (__comp(*__first2, *__first1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - _Literator __next = __first2; - _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node); - __first2 = __next; - } - else - ++__first1; - } - if (__first2 != __last2) - _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node); - } - else { - while (__first1 != __last1 && __first2 != __last2) { - if (__comp(*__first2, *__first1)) { - _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __first1 = __that.insert(__first1, *__first2); - } - else - ++__first1; - } - if (__first2 != __last2) { - __that.insert(__first1, __first2, __last2); - } - __x.clear(); - } -} - -template -void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) { - // Do nothing if the list has length 0 or 1. - if (__that._M_node._M_data._M_next == &__that._M_node._M_data || - __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data) - return; - - list<_Tp, _Alloc> __carry(__that.get_allocator()); - const int NB = 64; - _STLP_PRIV _CArray, NB> __counter(__carry); - int __fill = 0; - while (!__that.empty()) { - __carry.splice(__carry.begin(), __that, __that.begin()); - int __i = 0; - while (__i < __fill && !__counter[__i].empty()) { - _S_merge(__counter[__i], __carry, __comp); - __carry.swap(__counter[__i++]); - } - __carry.swap(__counter[__i]); - if (__i == __fill) { - ++__fill; - if (__fill >= NB) { - //Looks like the list has too many elements to be sorted with this algorithm: - __stl_throw_overflow_error("list::sort"); - } - } - } - - for (int __i = 1; __i < __fill; ++__i) - _S_merge(__counter[__i], __counter[__i - 1], __comp); - __that.swap(__counter[__fill - 1]); -} - -#if defined (list) -# undef list -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_LIST_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_list.h b/SDK/stlport/stl/_list.h deleted file mode 100644 index d7fb9ba0..00000000 --- a/SDK/stlport/stl/_list.h +++ /dev/null @@ -1,732 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_LIST_IMPL_H -#define _STLP_INTERNAL_LIST_IMPL_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -struct _List_node_base { - _List_node_base* _M_next; - _List_node_base* _M_prev; -}; - -template -class _List_global { -public: - typedef _List_node_base _Node_base; - static void _STLP_CALL _Transfer(_Node_base* __pos, - _Node_base* __first, _Node_base* __last); -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _List_global; -#endif -typedef _List_global _List_global_inst; - -template -class _List_node : public _List_node_base { -public: - _Tp _M_data; - __TRIVIAL_STUFF(_List_node) -}; - -struct _List_iterator_base { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef bidirectional_iterator_tag iterator_category; - - _List_node_base* _M_node; - - _List_iterator_base(_List_node_base* __x) : _M_node(__x) {} - - void _M_incr() { _M_node = _M_node->_M_next; } - void _M_decr() { _M_node = _M_node->_M_prev; } -}; - - -template -struct _List_iterator : public _List_iterator_base { - typedef _Tp value_type; - typedef typename _Traits::pointer pointer; - typedef typename _Traits::reference reference; - - typedef _List_iterator<_Tp, _Traits> _Self; - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef _List_iterator<_Tp, _NonConstTraits> iterator; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef _List_iterator<_Tp, _ConstTraits> const_iterator; - - typedef bidirectional_iterator_tag iterator_category; - typedef _List_node<_Tp> _Node; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {} - _List_iterator() : _List_iterator_base(0) {} - //copy constructor for iterator and constructor from iterator for const_iterator - _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {} - - reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; } - - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - this->_M_incr(); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - this->_M_incr(); - return __tmp; - } - _Self& operator--() { - this->_M_decr(); - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - this->_M_decr(); - return __tmp; - } - bool operator==(const_iterator __y ) const { - return this->_M_node == __y._M_node; - } - bool operator!=(const_iterator __y ) const { - return this->_M_node != __y._M_node; - } -}; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -_STLP_MOVE_TO_STD_NAMESPACE -template -struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -_STLP_MOVE_TO_STD_NAMESPACE -template -inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; } -inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();} -inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; } -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -// Base class that encapsulates details of allocators and helps -// to simplify EH - -template -class _List_base { -protected: - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef _List_node_base _Node_base; - typedef _List_node<_Tp> _Node; - typedef _List_base<_Tp, _Alloc> _Self; - typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type; -public: - typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy; - typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; - - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); } - - _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base()) - { _M_empty_initialize(); } - _List_base(__move_source<_Self> src) : - _M_node(__move_source<_AllocProxy>(src.get()._M_node)) { - if (src.get().empty()) - //We force this to empty. - _M_empty_initialize(); - else { - src.get()._M_empty_initialize(); - _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data; - } - } - - ~_List_base() - { clear(); } - - void clear(); - bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; } - - void _M_empty_initialize() { - _M_node._M_data._M_next = &_M_node._M_data; - _M_node._M_data._M_prev = _M_node._M_data._M_next; - } - -public: - _AllocProxy _M_node; -}; - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define list _STLP_PTR_IMPL_NAME(list) -#elif defined (_STLP_DEBUG) -# define list _STLP_NON_DBG_NAME(list) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class list; - -#if !defined (list) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -// helper functions to reduce code duplication -template -void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred); - -template -void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred); - -template -void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x, - _StrictWeakOrdering __comp); - -template -void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp); - -#if !defined (list) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class list : public _STLP_PRIV _List_base<_Tp, _Alloc> -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list) - , public __stlport_class > -#endif -{ - typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base; - typedef list<_Tp, _Alloc> _Self; - typedef _STLP_PRIV _List_node<_Tp> _Node; - typedef _STLP_PRIV _List_node_base _Node_base; -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Base::allocator_type allocator_type; - typedef bidirectional_iterator_tag _Iterator_category; - -public: - typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; - typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator; - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - -protected: -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - _Node_base* _M_create_node(const_reference __x = value_type()) { -#else - _Node_base* _M_create_node(const_reference __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ - _Node* __p = this->_M_node.allocate(1); - _STLP_TRY { - _Copy_Construct(&__p->_M_data, __x); - } - _STLP_UNWIND(this->_M_node.deallocate(__p, 1)) - return __p; - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - _Node_base* _M_create_node() { - _Node* __p = this->_M_node.allocate(1); - _STLP_TRY { - _STLP_STD::_Construct(&__p->_M_data); - } - _STLP_UNWIND(this->_M_node.deallocate(__p, 1)) - return __p; - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -public: -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type), - const allocator_type& __a = allocator_type()) -#else - explicit list(size_type __n) - : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) - { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); } - list(size_type __n, const_reference __val) - : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) - { this->insert(begin(), __n, __val); } - list(size_type __n, const_reference __val, const allocator_type& __a) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) - { this->insert(begin(), __n, __val); } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because insert does all of - // that anyway. - template - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) - { _M_insert(begin(), __first, __last); } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - list(_InputIterator __first, _InputIterator __last) - : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) - { _M_insert(begin(), __first, __last); } -# endif -#else /* _STLP_MEMBER_TEMPLATES */ - list(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) - { _M_insert(begin(), __first, __last); } - list(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) - { _M_insert(begin(), __first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit list(const allocator_type& __a = allocator_type()) -#else - list() - : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {} - list(const allocator_type& __a) -#endif - : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {} - - list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator()) - { _M_insert(begin(), __x.begin(), __x.end()); } - - list(__move_source<_Self> src) - : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {} - - ~list() {} - - _Self& operator = (const _Self& __x); - - iterator begin() { return iterator(this->_M_node._M_data._M_next); } - const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); } - - iterator end() { return iterator(&this->_M_node._M_data); } - const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - size_type size() const { - size_type __result = distance(begin(), end()); - return __result; - } - size_type max_size() const { return size_type(-1); } - - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(--end()); } - const_reference back() const { return *(--end()); } - -private: - void _M_swap_aux(_Self& __x) { - __x._M_node._M_swap_alloc(this->_M_node); - __x._M_node._M_data._M_next = this->_M_node._M_data._M_next; - __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data; - __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev; - __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data; - this->_M_empty_initialize(); - } - -public: - void swap(_Self& __x) { - if (__x.empty()) { - if (this->empty()) { - return; - } - this->_M_swap_aux(__x); - } else if (this->empty()) { - __x._M_swap_aux(*this); - } else { - this->_M_node.swap(__x._M_node); - _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next); - _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev); - } - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const_reference __x = value_type()) { -#else - iterator insert(iterator __pos, const_reference __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _Node_base* __tmp = _M_create_node(__x); - _Node_base* __n = __pos._M_node; - _Node_base* __p = __n->_M_prev; - __tmp->_M_next = __n; - __tmp->_M_prev = __p; - __p->_M_next = __tmp; - __n->_M_prev = __tmp; - return iterator(__tmp); - } - -private: -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - - // Check whether it's an integral type. If so, it's not an iterator. - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - const __true_type& /*_IsIntegral*/) { - _M_fill_insert(__pos, __n, __x); - } - template - void _M_insert_dispatch(iterator __pos, - _InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) { -#else /* _STLP_MEMBER_TEMPLATES */ - void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) { - for (; __first != __last; ++__first) - insert(__pos, *__first); - } - void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - //We use a temporary list to avoid the auto reference troubles (infinite loop) - for (; __first != __last; ++__first) - insert(__pos, *__first); - } - -public: -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_splice_insert_dispatch(__pos, __first, __last, _Integral()); - } - -private: - // Check whether it's an integral type. If so, it's not an iterator. - template - void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, - const __true_type& /*_IsIntegral*/) { - _M_fill_insert(__pos, __n, __x); - } - template - void _M_splice_insert_dispatch(iterator __pos, - _InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) { -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __pos, const value_type* __first, const value_type* __last) { - _Self __tmp(__first, __last, this->get_allocator()); - splice(__pos, __tmp); - } - void insert(iterator __pos, const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - //We use a temporary list to avoid the auto reference troubles (infinite loop) - _Self __tmp(__first, __last, this->get_allocator()); - splice(__pos, __tmp); - } - -public: - void insert(iterator __pos, size_type __n, const_reference __x) - { _M_fill_insert(__pos, __n, __x); } - -private: - void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) { - for ( ; __n > 0; --__n) - insert(__pos, __x); - } - -public: - void push_front(const_reference __x) { insert(begin(), __x); } - void push_back (const_reference __x) { insert(end(), __x); } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) - { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); } - void push_front() {insert(begin());} - void push_back() {insert(end());} -# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - iterator erase(iterator __pos) { - _Node_base* __next_node = __pos._M_node->_M_next; - _Node_base* __prev_node = __pos._M_node->_M_prev; - _Node* __n = __STATIC_CAST(_Node*, __pos._M_node); - __prev_node->_M_next = __next_node; - __next_node->_M_prev = __prev_node; - _STLP_STD::_Destroy(&__n->_M_data); - this->_M_node.deallocate(__n, 1); - return iterator(__next_node); - } - - iterator erase(iterator __first, iterator __last) { - while (__first != __last) - erase(__first++); - return __last; - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const_reference __x = value_type()); -#else - void resize(size_type __new_size, const_reference __x); - void resize(size_type __new_size) - { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); } -#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ - - void pop_front() { erase(begin()); } - void pop_back() { - iterator __tmp = end(); - erase(--__tmp); - } - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); } - - void _M_fill_assign(size_type __n, const_reference __val); - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) { - _M_fill_assign(__n, __val); - } - - template - void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2, - const __false_type& /*_IsIntegral*/) { -#else - void assign(const value_type *__first2, const value_type *__last2) { - iterator __first1 = begin(); - iterator __last1 = end(); - for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) - *__first1 = *__first2; - if (__first2 == __last2) - erase(__first1, __last1); - else - insert(__last1, __first2, __last2); - } - void assign(const_iterator __first2, const_iterator __last2) { -#endif /* _STLP_MEMBER_TEMPLATES */ - iterator __first1 = begin(); - iterator __last1 = end(); - for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) - *__first1 = *__first2; - if (__first2 == __last2) - erase(__first1, __last1); - else - insert(__last1, __first2, __last2); - } - -public: - void splice(iterator __pos, _Self& __x) { - if (!__x.empty()) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node); - } - else { - insert(__pos, __x.begin(), __x.end()); - __x.clear(); - } - } - } - void splice(iterator __pos, _Self& __x, iterator __i) { - iterator __j = __i; - ++__j; - if (__pos == __i || __pos == __j) return; - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node); - } - else { - insert(__pos, *__i); - __x.erase(__i); - } - } - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { - if (__first != __last) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node); - } - else { - insert(__pos, __first, __last); - __x.erase(__first, __last); - } - } - } - - void remove(const_reference __val) { - iterator __first = begin(); - iterator __last = end(); - while (__first != __last) { - iterator __next = __first; - ++__next; - if (__val == *__first) erase(__first); - __first = __next; - } - } - - void unique() - { _STLP_PRIV _S_unique(*this, equal_to()); } - - void merge(_Self& __x) - { _STLP_PRIV _S_merge(*this, __x, less()); } - - void reverse() { - _Node_base* __p = &this->_M_node._M_data; - _Node_base* __tmp = __p; - do { - _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev); - __tmp = __tmp->_M_prev; // Old next node is now prev. - } while (__tmp != __p); - } - - void sort() - { _STLP_PRIV _S_sort(*this, less()); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void remove_if(_Predicate __pred) - { _STLP_PRIV _S_remove_if(*this, __pred); } - template - void unique(_BinaryPredicate __binary_pred) - { _STLP_PRIV _S_unique(*this, __binary_pred); } - - template - void merge(_Self& __x, - _StrictWeakOrdering __comp) { - _STLP_PRIV _S_merge(*this, __x, __comp); - } - - template - void sort(_StrictWeakOrdering __comp) - { _STLP_PRIV _S_sort(*this, __comp); } -#endif /* _STLP_MEMBER_TEMPLATES */ -}; - -#if defined (list) -# undef list -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -_STLP_INLINE_LOOP bool _STLP_CALL -operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) { - typedef typename list<_Tp,_Alloc>::const_iterator const_iterator; - const_iterator __end1 = __x.end(); - const_iterator __end2 = __y.end(); - - const_iterator __i1 = __x.begin(); - const_iterator __i2 = __y.begin(); - while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { - ++__i1; - ++__i2; - } - return __i1 == __end1 && __i2 == __end2; -} - -#define _STLP_EQUAL_OPERATOR_SPECIALIZED -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER -#undef _STLP_EQUAL_OPERATOR_SPECIALIZED - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - typedef typename __move_traits<_Alloc>::complete complete; -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_LIST_IMPL_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_locale.h b/SDK/stlport/stl/_locale.h deleted file mode 100644 index 454fa43d..00000000 --- a/SDK/stlport/stl/_locale.h +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_LOCALE_H -#define _STLP_INTERNAL_LOCALE_H - -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -#ifndef _STLP_INTERNAL_CWCHAR -# include -#endif - -#ifndef _STLP_INTERNAL_THREADS_H -# include -#endif - -#ifndef _STLP_STRING_FWD_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class _Locale_impl; // Forward declaration of opaque type. -class ios_base; -class locale; - -template -bool __locale_do_operator_call (const locale& __loc, - const basic_string<_CharT, _Traits, _Alloc>& __x, - const basic_string<_CharT, _Traits, _Alloc>& __y); - -_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl ); -_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl ); - -template -bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW; - -template -_Facet* _UseFacet(const locale& __loc, const _Facet* __facet); - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# define locale _STLP_NO_MEM_T_NAME(loc) -#endif - -class _STLP_CLASS_DECLSPEC locale { -public: - // types: - class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base { - protected: - /* Here we filter __init_count user value to 0 or 1 because __init_count is a - * size_t instance and _Refcount_Base use __stl_atomic_t instances that might - * have lower sizeof and generate roll issues. 1 is enough to keep the facet - * alive when required. - */ - explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {} - virtual ~facet(); - friend class locale; - friend class _Locale_impl; - friend facet * _STLP_CALL _get_facet( facet * ); - friend void _STLP_CALL _release_facet( facet *& ); - - private: // Invalidate assignment and copying. - facet(const facet& ) /* : _Refcount_Base(1) {} */; - void operator=(const facet&); - }; - -#if defined (__MVS__) || defined (__OS400__) - struct -#else - class -#endif - _STLP_CLASS_DECLSPEC id { - friend class locale; - friend class _Locale_impl; - public: - size_t _M_index; - static size_t _S_max; - }; - - typedef int category; -#if defined (_STLP_STATIC_CONST_INIT_BUG) - enum _Category { -#else - static const category -#endif - none = 0x000, - collate = 0x010, - ctype = 0x020, - monetary = 0x040, - numeric = 0x100, - time = 0x200, - messages = 0x400, - all = collate | ctype | monetary | numeric | time | messages -#if defined (_STLP_STATIC_CONST_INIT_BUG) - } -#endif - ; - - // construct/copy/destroy: - locale() _STLP_NOTHROW; - locale(const locale&) _STLP_NOTHROW; - explicit locale(const char *); - locale(const locale&, const char*, category); - -#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - locale(const locale& __loc, _Facet* __f) { - if ( __f != 0 ) { - this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) ); - this->_M_insert(__f, _Facet::id); - } else { - this->_M_impl = _get_Locale_impl( __loc._M_impl ); - } - } -#endif // _STLP_MEMBER_TEMPLATES - -protected: - // those are for internal use - locale(_Locale_impl*); - -public: - - locale(const locale&, const locale&, category); - const locale& operator=(const locale&) _STLP_NOTHROW; - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - virtual -#endif - ~locale() _STLP_NOTHROW; - -#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \ - !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - locale combine(const locale& __loc) const { - _Facet *__facet = 0; - if (!_HasFacet(__loc, __facet)) - _M_throw_runtime_error(); - - return locale(*this, _UseFacet(__loc, __facet)); - } -#endif // _STLP_MEMBER_TEMPLATES && !_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS - - // locale operations: - string name() const; - - bool operator==(const locale&) const; - bool operator!=(const locale&) const; - -#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301) - bool operator()(const string& __x, const string& __y) const; -# ifndef _STLP_NO_WCHAR_T - bool operator()(const wstring& __x, const wstring& __y) const; -# endif -#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x, - const basic_string<_CharT, _Traits, _Alloc>& __y) const - { return __locale_do_operator_call(*this, __x, __y); } -#endif - - // global locale objects: - static locale _STLP_CALL global(const locale&); - static const locale& _STLP_CALL classic(); - -//protected: // Helper functions for locale globals. - facet* _M_get_facet(const id&) const; - // same, but throws - facet* _M_use_facet(const id&) const; - static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_runtime_error(const char* = 0); - -protected: // More helper functions. - void _M_insert(facet* __f, id& __id); - - // friends: - friend class _Locale_impl; - friend class ios_base; - -protected: // Data members - _Locale_impl* _M_impl; - _Locale_impl* _M_get_impl() const { return _M_impl; } -}; - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# undef locale -# define _Locale _STLP_NO_MEM_T_NAME(loc) - -class locale : public _Locale { -public: - - // construct/copy/destroy: - locale() _STLP_NOTHROW {} - locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {} - explicit locale(const char *__str) : _Locale(__str) {} - locale(const locale& __loc, const char* __str, category __cat) - : _Locale(__loc, __str, __cat) {} - - template - locale(const locale& __loc, _Facet* __f) { - if ( __f != 0 ) { - this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) ); - this->_M_insert(__f, _Facet::id); - } else { - this->_M_impl = _get_Locale_impl( __loc._M_impl ); - } - } - -private: - // those are for internal use - locale(_Locale_impl* __impl) : _Locale(__impl) {} - locale(const _Locale& __loc) : _Locale(__loc) {} - -public: - - locale(const locale& __loc1, const locale& __loc2, category __cat) - : _Locale(__loc1, __loc2, __cat) {} - - const locale& operator=(const locale& __loc) _STLP_NOTHROW { - _Locale::operator=(__loc); - return *this; - } - - template - locale combine(const locale& __loc) const { - _Facet *__facet = 0; - if (!_HasFacet(__loc, __facet)) - _M_throw_runtime_error(); - - return locale(*this, _UseFacet(__loc, __facet)); - } - - // locale operations: - bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); } - bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); } - - template - bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x, - const basic_string<_CharT, _Traits, _Alloc>& __y) const - { return __locale_do_operator_call(*this, __x, __y); } - - // global locale objects: - static locale _STLP_CALL global(const locale& __loc) { - return _Locale::global(__loc); - } - static const locale& _STLP_CALL classic() { - return __STATIC_CAST(const locale&, _Locale::classic()); - } - - // friends: - friend class _Locale_impl; - friend class ios_base; -}; - -#endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */ - -//---------------------------------------------------------------------- -// locale globals - -#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -template -inline const _Facet& -_Use_facet<_Facet>::operator *() const -#else -template inline const _Facet& use_facet(const locale& __loc) -#endif -{ - _Facet *__facet = 0; - return *_UseFacet(__loc, __facet); -} - - -#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -template -struct has_facet { - const locale& __loc; - has_facet(const locale& __p_loc) : __loc(__p_loc) {} - operator bool() const _STLP_NOTHROW -#else -template inline bool has_facet(const locale& __loc) _STLP_NOTHROW -#endif -{ - _Facet *__facet = 0; - return _HasFacet(__loc, __facet); -} - -#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -}; // close class definition -#endif - -template -bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW -{ return (__loc._M_get_facet(_Facet::id) != 0); } - -template -_Facet* _UseFacet(const locale& __loc, const _Facet* __facet) -{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_Facet::id)); } - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_LOCALE_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_map.h b/SDK/stlport/stl/_map.h deleted file mode 100644 index 15d2e3f6..00000000 --- a/SDK/stlport/stl/_map.h +++ /dev/null @@ -1,425 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_MAP_H -#define _STLP_INTERNAL_MAP_H - -#ifndef _STLP_INTERNAL_TREE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits) - -template ), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class map -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef map<_Key, _Tp, _Compare, _Alloc> _Self; -public: - -// typedefs: - - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef pair value_type; - typedef _Compare key_compare; - - class value_compare - : public binary_function { - friend class map<_Key,_Tp,_Compare,_Alloc>; - protected : - //c is a Standard name (23.3.1), do no make it STLport naming convention compliant. - _Compare comp; - value_compare(_Compare __c) : comp(__c) {} - public: - bool operator()(const value_type& __x, const value_type& __y) const - { return comp(__x.first, __y.first); } - }; - -protected: - typedef _STLP_PRIV _MapTraitsT _MapTraits; - -public: - //Following typedef have to be public for __move_traits specialization. - typedef _STLP_PRIV _Rb_tree _Rep_type; - - typedef typename _Rep_type::pointer pointer; - typedef typename _Rep_type::const_pointer const_pointer; - typedef typename _Rep_type::reference reference; - typedef typename _Rep_type::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing map - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - // allocation/deallocation - map() : _M_t(_Compare(), allocator_type()) {} -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit map(const _Compare& __comp, - const allocator_type& __a = allocator_type()) -#else - explicit map(const _Compare& __comp) - : _M_t(__comp, allocator_type()) {} - explicit map(const _Compare& __comp, const allocator_type& __a) -#endif - : _M_t(__comp, __a) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - map(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - template - map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - map(_InputIterator __first, _InputIterator __last, const _Compare& __comp) - : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); } -# endif - -#else - map(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - map(const value_type* __first, - const value_type* __last, const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } - - map(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - map(const_iterator __first, const_iterator __last, const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - map(const _Self& __x) : _M_t(__x._M_t) {} - - map(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - // accessors: - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return value_compare(_M_t.key_comp()); } - allocator_type get_allocator() const { return _M_t.get_allocator(); } - - iterator begin() { return _M_t.begin(); } - const_iterator begin() const { return _M_t.begin(); } - iterator end() { return _M_t.end(); } - const_iterator end() const { return _M_t.end(); } - reverse_iterator rbegin() { return _M_t.rbegin(); } - const_reverse_iterator rbegin() const { return _M_t.rbegin(); } - reverse_iterator rend() { return _M_t.rend(); } - const_reverse_iterator rend() const { return _M_t.rend(); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - _STLP_TEMPLATE_FOR_CONT_EXT - _Tp& operator[](const _KT& __k) { - iterator __i = lower_bound(__k); - // __i->first is greater than or equivalent to __k. - if (__i == end() || key_comp()(__k, (*__i).first)) - __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp))); - return (*__i).second; - } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - pair insert(const value_type& __x) - { return _M_t.insert_unique(__x); } - iterator insert(iterator __pos, const value_type& __x) - { return _M_t.insert_unique(__pos, __x); } -#ifdef _STLP_MEMBER_TEMPLATES - template - void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_unique(__first, __last); } -#else - void insert(const value_type* __first, const value_type* __last) - { _M_t.insert_unique(__first, __last); } - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_unique(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - void erase(iterator __pos) { _M_t.erase(__pos); } - size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); } - void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } - void clear() { _M_t.clear(); } - - // map operations: - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) - { return _M_t.equal_range_unique(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const - { return _M_t.equal_range_unique(__x); } -}; - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits) - -template ), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class multimap -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self; -public: - -// typedefs: - - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; - typedef pair value_type; - typedef _Compare key_compare; - - class value_compare : public binary_function { - friend class multimap<_Key,_Tp,_Compare,_Alloc>; - protected: - //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant. - _Compare comp; - value_compare(_Compare __c) : comp(__c) {} - public: - bool operator()(const value_type& __x, const value_type& __y) const - { return comp(__x.first, __y.first); } - }; - -protected: - //Specific iterator traits creation - typedef _STLP_PRIV _MultimapTraitsT _MultimapTraits; - -public: - //Following typedef have to be public for __move_traits specialization. - typedef _STLP_PRIV _Rb_tree _Rep_type; - - typedef typename _Rep_type::pointer pointer; - typedef typename _Rep_type::const_pointer const_pointer; - typedef typename _Rep_type::reference reference; - typedef typename _Rep_type::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing multimap - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - // allocation/deallocation - multimap() : _M_t(_Compare(), allocator_type()) { } - explicit multimap(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { } - -#ifdef _STLP_MEMBER_TEMPLATES - template - multimap(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } -# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS - template - multimap(_InputIterator __first, _InputIterator __last, - const _Compare& __comp) - : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); } -# endif - template - multimap(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } -#else - multimap(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - multimap(const value_type* __first, const value_type* __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } - - multimap(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - multimap(const_iterator __first, const_iterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - multimap(const _Self& __x) : _M_t(__x._M_t) {} - - multimap(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - // accessors: - - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return value_compare(_M_t.key_comp()); } - allocator_type get_allocator() const { return _M_t.get_allocator(); } - - iterator begin() { return _M_t.begin(); } - const_iterator begin() const { return _M_t.begin(); } - iterator end() { return _M_t.end(); } - const_iterator end() const { return _M_t.end(); } - reverse_iterator rbegin() { return _M_t.rbegin(); } - const_reverse_iterator rbegin() const { return _M_t.rbegin(); } - reverse_iterator rend() { return _M_t.rend(); } - const_reverse_iterator rend() const { return _M_t.rend(); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); } - iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_equal(__first, __last); } -#else - void insert(const value_type* __first, const value_type* __last) - { _M_t.insert_equal(__first, __last); } - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_equal(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - void erase(iterator __pos) { _M_t.erase(__pos); } - size_type erase(const key_type& __x) { return _M_t.erase(__x); } - void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } - void clear() { _M_t.clear(); } - - // multimap operations: - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const { return _M_t.count(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) - { return _M_t.equal_range(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const - { return _M_t.equal_range(__x); } -}; - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Rep_type> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Rep_type> -{}; -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_MAP_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_mbstate_t.h b/SDK/stlport/stl/_mbstate_t.h deleted file mode 100644 index 4aa936f9..00000000 --- a/SDK/stlport/stl/_mbstate_t.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_MBSTATE_T -#define _STLP_INTERNAL_MBSTATE_T - -#if (defined (__OpenBSD__) || defined (__FreeBSD__)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T) -# define __mbstate_t_defined /* mbstate_t defined in native , so not defined in C! */ -#endif - -#if defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_NO_MBSTATE_T) && !defined (_MBSTATE_T) && !defined (__mbstate_t_defined) -# define _STLP_USE_OWN_MBSTATE_T -# define _MBSTATE_T -#endif - -#if defined (_STLP_USE_OWN_MBSTATE_T) -typedef int mbstate_t; - -# if defined (__cplusplus) -_STLP_BEGIN_NAMESPACE -using ::mbstate_t; -_STLP_END_NAMESPACE -# endif - -#endif /* _STLP_USE_OWN_MBSTATE_T */ - -#endif /* _STLP_INTERNAL_MBSTATE_T */ diff --git a/SDK/stlport/stl/_messages_facets.h b/SDK/stlport/stl/_messages_facets.h deleted file mode 100644 index eb4f8698..00000000 --- a/SDK/stlport/stl/_messages_facets.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_MESSAGES_H -#define _STLP_INTERNAL_MESSAGES_H - -#ifndef _STLP_IOS_BASE_H -# include -#endif - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// messages facets - -class messages_base { - public: - typedef int catalog; -}; - -template class messages {}; - -_STLP_MOVE_TO_PRIV_NAMESPACE -class _Messages; -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC messages : public locale::facet, public messages_base { - friend class _Locale_impl; -public: - typedef messages_base::catalog catalog; - typedef char char_type; - typedef string string_type; - - explicit messages(size_t __refs = 0); - - catalog open(const string& __fn, const locale& __loc) const - { return do_open(__fn, __loc); } - string_type get(catalog __c, int __set, int __msgid, - const string_type& __dfault) const - { return do_get(__c, __set, __msgid, __dfault); } - inline void close(catalog __c) const - { do_close(__c); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -private: - messages(_STLP_PRIV _Messages*); - -protected: - messages(size_t, _Locale_messages*); - ~messages(); - - virtual catalog do_open(const string& __fn, const locale& __loc) const; - virtual string_type do_get(catalog __c, int __set, int __msgid, - const string_type& __dfault) const; - virtual void do_close(catalog __c) const; - - void _M_initialize(const char* __name); - -private: - _STLP_PRIV _Messages* _M_impl; -}; - -#if !defined (_STLP_NO_WCHAR_T) - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC messages : public locale::facet, public messages_base { - friend class _Locale_impl; -public: - typedef messages_base::catalog catalog; - typedef wchar_t char_type; - typedef wstring string_type; - - explicit messages(size_t __refs = 0); - - inline catalog open(const string& __fn, const locale& __loc) const - { return do_open(__fn, __loc); } - inline string_type get(catalog __c, int __set, int __msgid, - const string_type& __dfault) const - { return do_get(__c, __set, __msgid, __dfault); } - inline void close(catalog __c) const - { do_close(__c); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -private: - messages(_STLP_PRIV _Messages*); - -protected: - messages(size_t, _Locale_messages*); - ~messages(); - - virtual catalog do_open(const string& __fn, const locale& __loc) const; - virtual string_type do_get(catalog __c, int __set, int __msgid, - const string_type& __dfault) const; - virtual void do_close(catalog __c) const; - - void _M_initialize(const char* __name); - -private: - _STLP_PRIV _Messages* _M_impl; -}; - -#endif - -template class messages_byname {}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC messages_byname : public messages { -public: - typedef messages_base::catalog catalog; - typedef string string_type; - - explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~messages_byname(); - -private: - typedef messages_byname _Self; - //explicitely defined as private to avoid warnings: - messages_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -#if !defined (_STLP_NO_WCHAR_T) -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC messages_byname : public messages { -public: - typedef messages_base::catalog catalog; - typedef wstring string_type; - - explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - ~messages_byname(); - -private: - typedef messages_byname _Self; - //explicitely defined as private to avoid warnings: - messages_byname(_Self const&); - _Self& operator = (_Self const&); -}; -#endif /* WCHAR_T */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_MESSAGES_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_monetary.c b/SDK/stlport/stl/_monetary.c deleted file mode 100644 index f801128b..00000000 --- a/SDK/stlport/stl/_monetary.c +++ /dev/null @@ -1,604 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_MONETARY_C -#define _STLP_MONETARY_C - -# ifndef _STLP_INTERNAL_MONETARY_H -# include -# endif - -#ifndef _STLP_INTERNAL_IOS_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_PUT_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_GET_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if (_STLP_STATIC_TEMPLATE_DATA > 0) - -# if !defined (__BORLANDC__) -template -locale::id money_get<_CharT, _InputIterator>::id; - -template -locale::id money_put<_CharT, _OutputIterator>::id; -# endif - -# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ - defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) -/* - * Under cygwin, when STLport is used as a shared library, the id needs - * to be specified as imported otherwise they will be duplicated in the - * calling executable. - */ -template <> -_STLP_DECLSPEC locale::id money_get > >::id; -/* -template <> -_STLP_DECLSPEC locale::id money_get::id; -*/ - -template <> -_STLP_DECLSPEC locale::id money_put > >::id; -template <> -_STLP_DECLSPEC locale::id money_put::id; - -# if !defined (_STLP_NO_WCHAR_T) -template <> -_STLP_DECLSPEC locale::id money_get > >::id; -template <> -_STLP_DECLSPEC locale::id money_get::id; - -template <> -_STLP_DECLSPEC locale::id money_put > >::id; -template <> -_STLP_DECLSPEC locale::id money_put::id; -# endif - -# endif - -#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -//typedef money_get money_get_char; -//typedef money_put money_put_char; -typedef money_get > > money_get_char_2; -typedef money_put > > money_put_char_2; - -//__DECLARE_INSTANCE(locale::id, money_get_char::id, ); -//__DECLARE_INSTANCE(locale::id, money_put_char::id, ); -__DECLARE_INSTANCE(locale::id, money_get_char_2::id, ); -__DECLARE_INSTANCE(locale::id, money_put_char_2::id, ); - -# ifndef _STLP_NO_WCHAR_T - -//typedef money_get money_get_wchar_t; -//typedef money_get > > money_get_wchar_t_2; -typedef money_put money_put_wchar_t; -typedef money_put > > money_put_wchar_t_2; - -//__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, ); -//__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, ); -__DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, ); -__DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, ); - -# endif -#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -// money_get facets - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// helper functions for do_get -template -pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last, - _InIt2 __str_first, _InIt2 __str_last) { - while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) { - ++__first; - ++__str_first; - } - return make_pair(__first, __str_first == __str_last); -} - -template -bool -__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite, - const ctype<_CharT>& _c_type, - _CharT __point, int __frac_digits, _CharT __sep, - const string& __grouping, bool &__syntax_ok) { - if (__first == __last || !_c_type.is(ctype_base::digit, *__first)) - return false; - - char __group_sizes[128]; - char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes; - char __current_group_size = 0; - - while (__first != __last) { - if (_c_type.is(ctype_base::digit, *__first)) { - ++__current_group_size; - *__out_ite++ = *__first++; - } - else if (__group_sizes_end) { - if (*__first == __sep) { - *__group_sizes_end++ = __current_group_size; - __current_group_size = 0; - ++__first; - } - else break; - } - else - break; - } - - if (__grouping.empty()) - __syntax_ok = true; - else { - if (__group_sizes_end != __group_sizes) - *__group_sizes_end++ = __current_group_size; - - __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end, - __grouping.data(), __grouping.data()+ __grouping.size()); - - if (__first == __last || *__first != __point) { - for (int __digits = 0; __digits != __frac_digits; ++__digits) - *__out_ite++ = _CharT('0'); - return true; // OK not to have decimal point - } - } - - ++__first; - - int __digits = 0; - - while (__first != __last && _c_type.is(ctype_base::digit, *__first)) { - *__out_ite++ = *__first++; - ++__digits; - } - - __syntax_ok = __syntax_ok && (__digits == __frac_digits); - - return true; -} - - -template -_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) { - if (__s == __end) { - __err |= ios_base::eofbit; - return __s; - } - - typedef _CharT char_type; - typedef _StrType string_type; - typedef _InputIter iter_type; - typedef moneypunct _Punct; - typedef moneypunct _Punct_intl; - typedef ctype _Ctype; - - locale __loc = __str.getloc(); - const _Punct& __punct = use_facet<_Punct>(__loc) ; - const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ; - const _Ctype& __c_type = use_facet<_Ctype>(__loc) ; - - money_base::pattern __format = __intl ? __punct_intl.neg_format() - : __punct.neg_format(); - string_type __ns = __intl ? __punct_intl.negative_sign() - : __punct.negative_sign(); - string_type __ps = __intl ? __punct_intl.positive_sign() - : __punct.positive_sign(); - int __i; - bool __symbol_required = (__str.flags() & ios_base::showbase) != 0; - string_type __buf; - back_insert_iterator __out_ite(__buf); - - for (__i = 0; __i < 4; ++__i) { - switch (__format.field[__i]) { - case money_base::none: - if (__i == 3) { - if (__c_type.is(ctype_base::space, *__s)) { - __err = ios_base::failbit; - return __s; - } - break; - } - while (__s != __end && __c_type.is(ctype_base::space, *__s)) - ++__s; - break; - case money_base::space: - if (!__c_type.is(ctype_base::space, *__s)) { - __err = ios_base::failbit; - return __s; - } - ++__s; - while (__s != __end && __c_type.is(ctype_base::space, *__s)) - ++__s; - break; - case money_base::symbol: { - string_type __curs = __intl ? __punct_intl.curr_symbol() - : __punct.curr_symbol(); - pair - __result = __get_string(__s, __end, __curs.begin(), __curs.end()); - if (!__result.second && __symbol_required) - __err = ios_base::failbit; - __s = __result.first; - break; - } - case money_base::sign: { - if (__s == __end) { - if (__ps.empty()) - break; - if (__ns.empty()) { - __is_positive = false; - break; - } - __err = ios_base::failbit; - return __s; - } - else { - if (__ps.empty()) { - if (__ns.empty()) - break; - if (*__s == __ns[0]) { - ++__s; - __is_positive = false; - } - break; - } - else { - if (*__s == __ps[0]) { - ++__s; - break; - } - if (__ns.empty()) - break; - if (*__s == __ns[0]) { - ++__s; - __is_positive = false; - break; - } - __err = ios_base::failbit; - } - } - return __s; - } - case money_base::value: { - char_type __point = __intl ? __punct_intl.decimal_point() - : __punct.decimal_point(); - int __frac_digits = __intl ? __punct_intl.frac_digits() - : __punct.frac_digits(); - string __grouping = __intl ? __punct_intl.grouping() - : __punct.grouping(); - bool __syntax_ok = true; - - bool __result; - - char_type __sep = __grouping.empty() ? char_type() : - __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep(); - - __result = __get_monetary_value(__s, __end, __out_ite, __c_type, - __point, __frac_digits, - __sep, - __grouping, __syntax_ok); - - if (!__syntax_ok) - __err |= ios_base::failbit; - if (!__result) { - __err = ios_base::failbit; - return __s; - } - break; - - } // Close money_base::value case - } // Close switch statement - } // Close for loop - - if (__is_positive) { - if (__ps.size() > 1) { - pair<_InputIter, bool> - __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end()); - __s = __result.first; - if (!__result.second) - __err |= ios::failbit; - } - if (!(__err & ios_base::failbit)) - __digits = __buf; - } - else { - if (__ns.size() > 1) { - pair<_InputIter, bool> - __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end()); - __s = __result.first; - if (!__result.second) - __err |= ios::failbit; - } - if (!(__err & ios::failbit)) { - __digits = __c_type.widen('-'); - __digits += __buf; - } - } - if (__s == __end) - __err |= ios::eofbit; - - return __s; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -//===== methods ====== -template -_InputIter -money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - _STLP_LONGEST_FLOAT_TYPE& __units) const { - string_type __buf; - bool __is_positive = true; - __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0); - - if (__err == ios_base::goodbit || __err == ios_base::eofbit) { - typename string_type::iterator __b = __buf.begin(), __e = __buf.end(); - - if (!__is_positive) ++__b; - // Can't use atold, since it might be wchar_t. Don't get confused by name below : - // it's perfectly capable of reading long double. - _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0); - - if (!__is_positive) { - __units = -__units; - } - } - - return __s; -} - -template -_InputIter -money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - string_type& __digits) const { - bool __is_positive = true; - return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0); -} - -// money_put facets - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str, - _CharT __fill, const _Str& __digits, bool __check_digits, - _Str_Type * /*__dummy*/) { - typedef _CharT char_type; - typedef _Str_Type string_type; - typedef ctype _Ctype; - typedef moneypunct _Punct; - typedef moneypunct _Punct_intl; - - locale __loc = __str.getloc(); - const _Ctype& __c_type = use_facet<_Ctype>(__loc) ; - const _Punct& __punct = use_facet<_Punct>(__loc) ; - const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ; - - // some special characters - char_type __minus = __c_type.widen('-'); - char_type __plus = __c_type.widen('+'); - char_type __space = __c_type.widen(' '); - char_type __zero = __c_type.widen('0'); - char_type __point = __intl ? __punct_intl.decimal_point() - : __punct.decimal_point(); - - char_type __sep = __intl ? __punct_intl.thousands_sep() - : __punct.thousands_sep(); - - string __grouping = __intl ? __punct_intl.grouping() - : __punct.grouping(); - - int __frac_digits = __intl ? __punct_intl.frac_digits() - : __punct.frac_digits(); - - string_type __curr_sym = __intl ? __punct_intl.curr_symbol() - : __punct.curr_symbol(); - - // if there are no digits we are going to return __s. If there - // are digits, but not enough to fill the frac_digits, we are - // going to add zeros. I don't know whether this is right or - // not. - if (__digits.empty()) - return __s; - - typename string_type::const_iterator __digits_first = __digits.begin(); - typename string_type::const_iterator __digits_last = __digits.end(); - - bool __is_negative = *__digits_first == __minus; - if (__is_negative) - ++__digits_first; - -#if !defined (__BORLANDC__) - string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign() - : __punct_intl.positive_sign() - : __is_negative ? __punct.negative_sign() - : __punct.positive_sign(); -#else - string_type __sign; - if (__intl) { - if (__is_negative) - __sign = __punct_intl.negative_sign(); - else - __sign = __punct_intl.positive_sign(); - } - else { - if (__is_negative) - __sign = __punct.negative_sign(); - else - __sign = __punct.positive_sign(); - } -#endif - - if (__check_digits) { - typename string_type::const_iterator __cp = __digits_first; - while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp)) - ++__cp; - if (__cp == __digits_first) - return __s; - __digits_last = __cp; - } - - // If grouping is required, we make a copy of __digits and - // insert the grouping. - _STLP_BASIC_IOSTRING(char_type) __new_digits; - if (!__grouping.empty()) { - __new_digits.assign(__digits_first, __digits_last); - __insert_grouping(__new_digits, - __new_digits.size() - __frac_digits, - __grouping, - __sep, __plus, __minus, 0); - __digits_first = __new_digits.begin(); // <<-- - __digits_last = __new_digits.end(); // <<-- - } - - // Determine the amount of padding required, if any. - streamsize __width = __str.width(); - -#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1)) - size_t __value_length = operator -(__digits_last, __digits_first); -#else - size_t __value_length = __digits_last - __digits_first; -#endif - - size_t __length = __value_length + __sign.size(); - - if (__frac_digits != 0) - ++__length; - - bool __generate_curr = (__str.flags() & ios_base::showbase) !=0; - if (__generate_curr) - __length += __curr_sym.size(); - money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format() - : __punct_intl.pos_format()) - : (__is_negative ? __punct.neg_format() - : __punct.pos_format()); - { - //For the moment the following is commented for decoding reason. - //No reason to add a space last if the money symbol do not have to be display - //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) { - // if (__format.field[2] == (char) money_base::space) { - // __format.field[2] = (char) money_base::none; - // } - //} - //space can only be second or third and only once (22.2.6.3-1): - if ((__format.field[1] == (char) money_base::space) || - (__format.field[2] == (char) money_base::space)) - ++__length; - } - - const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) || - ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width)))); - streamsize __fill_amt = __need_fill ? __width - __length : 0; - - ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield; - - if (__fill_amt != 0 && - !(__fill_pos & (ios_base::left | ios_base::internal))) - __s = __fill_n(__s, __fill_amt, __fill); - - for (int __i = 0; __i < 4; ++__i) { - char __ffield = __format.field[__i]; - switch (__ffield) { - case money_base::none: - if (__fill_amt != 0 && __fill_pos == ios_base::internal) - __s = __fill_n(__s, __fill_amt, __fill); - break; - case money_base::space: - *__s++ = __space; - if (__fill_amt != 0 && __fill_pos == ios_base::internal) - __s = __fill_n(__s, __fill_amt, __fill); - break; - case money_base::symbol: - if (__generate_curr) - __s = copy(__curr_sym.begin(), __curr_sym.end(), __s); - break; - case money_base::sign: - if (!__sign.empty()) - *__s++ = __sign[0]; - break; - case money_base::value: - if (__frac_digits == 0) { - __s = copy(__digits_first, __digits_last, __s); - } else { - if ((int)__value_length <= __frac_digits) { - // if we see '9' here, we should out 0.09 - *__s++ = __zero; // integer part is zero - *__s++ = __point; // decimal point - __s = __fill_n(__s, __frac_digits - __value_length, __zero); // zeros - __s = copy(__digits_first, __digits_last, __s); // digits - } else { - __s = copy(__digits_first, __digits_last - __frac_digits, __s); - if (__frac_digits != 0) { - *__s++ = __point; - __s = copy(__digits_last - __frac_digits, __digits_last, __s); - } - } - } - break; - } //Close for switch - } // Close for loop - - // Ouput rest of sign if necessary. - if (__sign.size() > 1) - __s = copy(__sign.begin() + 1, __sign.end(), __s); - if (__fill_amt != 0 && - !(__fill_pos & (ios_base::right | ios_base::internal))) - __s = __fill_n(__s, __fill_amt, __fill); - - return __s; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_OutputIter -money_put<_CharT, _OutputIter> - ::do_put(_OutputIter __s, bool __intl, ios_base& __str, - char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const { - _STLP_BASIC_IOSTRING(char_type) __digits; - _STLP_PRIV __get_money_digits(__digits, __str, __units); - return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0)); -} - -template -_OutputIter -money_put<_CharT, _OutputIter> - ::do_put(_OutputIter __s, bool __intl, ios_base& __str, - char_type __fill, const string_type& __digits) const { - return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0)); -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_MONETARY_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_monetary.h b/SDK/stlport/stl/_monetary.h deleted file mode 100644 index 906f2e87..00000000 --- a/SDK/stlport/stl/_monetary.h +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_MONETARY_H -#define _STLP_INTERNAL_MONETARY_H - -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif - -#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class money_base { -public: - enum part {none, space, symbol, sign, value}; - struct pattern { - char field[4]; - }; -}; - -// moneypunct facets: forward declaration -template class moneypunct {}; - -// money_get facets - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class money_get : public locale::facet { - friend class _Locale_impl; - -public: - typedef _CharT char_type; - typedef _InputIter iter_type; - typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type; - - money_get(size_t __refs = 0) : locale::facet(__refs) {} - iter_type get(iter_type __s, iter_type __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - _STLP_LONGEST_FLOAT_TYPE& __units) const - { return do_get(__s, __end, __intl, __str, __err, __units); } - iter_type get(iter_type __s, iter_type __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - string_type& __digits) const - { return do_get(__s, __end, __intl, __str, __err, __digits); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~money_get() {} - virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - _STLP_LONGEST_FLOAT_TYPE& __units) const; - virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, - ios_base& __str, ios_base::iostate& __err, - string_type& __digits) const; -}; - - -// moneypunct facets: definition of specializations - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base { - -public: - typedef char char_type; - typedef string string_type; - explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0); - - char decimal_point() const { return do_decimal_point(); } - char thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - string_type curr_symbol() const { return do_curr_symbol(); } - string_type positive_sign() const { return do_positive_sign(); } - string_type negative_sign() const { return do_negative_sign(); } - int frac_digits() const { return do_frac_digits(); } - pattern pos_format() const { return do_pos_format(); } - pattern neg_format() const { return do_neg_format(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; -# if defined (_STLP_STATIC_CONST_INIT_BUG) - enum _IntlVal { intl = 1 } ; -# else - static const bool intl = true; -# endif - -protected: - pattern _M_pos_format; - pattern _M_neg_format; - - ~moneypunct _STLP_PSPEC2(char, true) (); - - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string do_curr_symbol() const; - - virtual string do_positive_sign() const; - virtual string do_negative_sign() const; - virtual int do_frac_digits() const; - virtual pattern do_pos_format() const; - virtual pattern do_neg_format() const; - - friend class _Locale_impl; -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base -{ -public: - typedef char char_type; - typedef string string_type; - - explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0); - - char decimal_point() const { return do_decimal_point(); } - char thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - string_type curr_symbol() const { return do_curr_symbol(); } - string_type positive_sign() const { return do_positive_sign(); } - string_type negative_sign() const { return do_negative_sign(); } - int frac_digits() const { return do_frac_digits(); } - pattern pos_format() const { return do_pos_format(); } - pattern neg_format() const { return do_neg_format(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; -# if defined (_STLP_STATIC_CONST_INIT_BUG) - enum _IntlVal { intl = 0 } ; -# else - static const bool intl = false; -# endif - -protected: - pattern _M_pos_format; - pattern _M_neg_format; - - ~moneypunct _STLP_PSPEC2(char, false) (); - - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string do_curr_symbol() const; - - virtual string do_positive_sign() const; - virtual string do_negative_sign() const; - virtual int do_frac_digits() const; - virtual pattern do_pos_format() const; - virtual pattern do_neg_format() const; - - friend class _Locale_impl; -}; - - -# ifndef _STLP_NO_WCHAR_T - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base -{ - friend class _Locale_impl; -public: - typedef wchar_t char_type; - typedef wstring string_type; - explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0); - wchar_t decimal_point() const { return do_decimal_point(); } - wchar_t thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - string_type curr_symbol() const { return do_curr_symbol(); } - string_type positive_sign() const { return do_positive_sign(); } - string_type negative_sign() const { return do_negative_sign(); } - int frac_digits() const { return do_frac_digits(); } - pattern pos_format() const { return do_pos_format(); } - pattern neg_format() const { return do_neg_format(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; -# if defined (_STLP_STATIC_CONST_INIT_BUG) - enum _IntlVal { intl = 1 } ; -# else - static const bool intl = true; -# endif - -protected: - pattern _M_pos_format; - pattern _M_neg_format; - - ~moneypunct _STLP_PSPEC2(wchar_t, true) (); - - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - virtual pattern do_pos_format() const; - virtual pattern do_neg_format() const; -}; - - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base -{ - friend class _Locale_impl; -public: - typedef wchar_t char_type; - typedef wstring string_type; - explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0); - wchar_t decimal_point() const { return do_decimal_point(); } - wchar_t thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - string_type curr_symbol() const { return do_curr_symbol(); } - string_type positive_sign() const { return do_positive_sign(); } - string_type negative_sign() const { return do_negative_sign(); } - int frac_digits() const { return do_frac_digits(); } - pattern pos_format() const { return do_pos_format(); } - pattern neg_format() const { return do_neg_format(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; -# if defined (_STLP_STATIC_CONST_INIT_BUG) - enum _IntlVal { intl = 0 } ; -# else - static const bool intl = false; -# endif - -protected: - pattern _M_pos_format; - pattern _M_neg_format; - - ~moneypunct _STLP_PSPEC2(wchar_t, false) (); - - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - virtual pattern do_pos_format() const; - virtual pattern do_neg_format() const; -}; - -# endif - -template class moneypunct_byname {}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct { -public: - typedef money_base::pattern pattern; - typedef char char_type; - typedef string string_type; - - explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0, - _Locale_name_hint* __hint = 0); - -protected: - _Locale_monetary* _M_monetary; - ~moneypunct_byname _STLP_PSPEC2(char, true) (); - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - -private: - typedef moneypunct_byname _Self; - //explicitely defined as private to avoid warnings: - moneypunct_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct -{ -public: - typedef money_base::pattern pattern; - typedef char char_type; - typedef string string_type; - - explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0, - _Locale_name_hint* __hint = 0); - -protected: - _Locale_monetary* _M_monetary; - ~moneypunct_byname _STLP_PSPEC2(char, false) (); - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - -private: - typedef moneypunct_byname _Self; - //explicitely defined as private to avoid warnings: - moneypunct_byname(_Self const&); - _Self& operator = (_Self const&); - friend _Locale_name_hint* _Locale_extract_hint(moneypunct_byname*); -}; - -#if !defined (_STLP_NO_WCHAR_T) -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct -{ -public: - typedef money_base::pattern pattern; - typedef wchar_t char_type; - typedef wstring string_type; - - explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0, - _Locale_name_hint* __hint = 0); - -protected: - _Locale_monetary* _M_monetary; - ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) (); - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - -private: - typedef moneypunct_byname _Self; - //explicitely defined as private to avoid warnings: - moneypunct_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct -{ -public: - typedef money_base::pattern pattern; - typedef wchar_t char_type; - typedef wstring string_type; - - explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0, - _Locale_name_hint* __hint = 0); - -protected: - _Locale_monetary* _M_monetary; - ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) (); - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - - virtual string_type do_curr_symbol() const; - - virtual string_type do_positive_sign() const; - virtual string_type do_negative_sign() const; - virtual int do_frac_digits() const; - -private: - typedef moneypunct_byname _Self; - //explicitely defined as private to avoid warnings: - moneypunct_byname(_Self const&); - _Self& operator = (_Self const&); -}; -#endif - -//===== methods ====== - - -// money_put facets - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class money_put : public locale::facet { - friend class _Locale_impl; - -public: - typedef _CharT char_type; - typedef _OutputIter iter_type; - typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type; - - money_put(size_t __refs = 0) : locale::facet(__refs) {} - iter_type put(iter_type __s, bool __intl, ios_base& __str, - char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const - { return do_put(__s, __intl, __str, __fill, __units); } - iter_type put(iter_type __s, bool __intl, ios_base& __str, - char_type __fill, - const string_type& __digits) const - { return do_put(__s, __intl, __str, __fill, __digits); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~money_put() {} - virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str, - char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const; - virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str, - char_type __fill, - const string_type& __digits) const; -}; - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS money_get > >; -_STLP_EXPORT_TEMPLATE_CLASS money_put > >; -//_STLP_EXPORT_TEMPLATE_CLASS money_get; -//_STLP_EXPORT_TEMPLATE_CLASS money_put; -# if ! defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS money_get > >; -_STLP_EXPORT_TEMPLATE_CLASS money_put > >; -// _STLP_EXPORT_TEMPLATE_CLASS money_get; -// _STLP_EXPORT_TEMPLATE_CLASS money_put; -# endif -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_MONETARY_H */ - -// Local Variables: -// mode:C++ -// End: - - diff --git a/SDK/stlport/stl/_move_construct_fwk.h b/SDK/stlport/stl/_move_construct_fwk.h deleted file mode 100644 index 5f65a9dc..00000000 --- a/SDK/stlport/stl/_move_construct_fwk.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * Copyright (c) 2003 - * François Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_MOVE_CONSTRUCT_FWK_H -#define _STLP_MOVE_CONSTRUCT_FWK_H - -#ifndef _STLP_TYPE_TRAITS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -/************************************************************* - * Move constructor framework - *************************************************************/ - -/************************************************************* - *Partial move: - *The source HAS to be a valid instance after the move! - *************************************************************/ -template -class __move_source { -public: - explicit __move_source (_Tp &_src) : _M_data(_src) - {} - - _Tp& get() const - { return _M_data; } -private: - _Tp &_M_data; - - //We explicitely forbid assignment to avoid warning: - typedef __move_source<_Tp> _Self; - _Self& operator = (_Self const&); -}; - -//Class used to signal move constructor support, implementation and type. -template -struct __move_traits { - /* - * implemented tells if a the special move constructor has to be called or the classic - * copy constructor is just fine. Most of the time the copy constructor is fine only - * if the following info is true. - */ -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \ - !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \ - !defined (_STLP_NO_MOVE_SEMANTIC) - typedef typename _IsSTLportClass<_Tp>::_Ret implemented; -#else - typedef __false_type implemented; -#endif - /* - * complete tells if the move is complete or partial, that is to say, does the source - * needs to be destroyed once it has been moved. - */ - typedef typename __type_traits<_Tp>::has_trivial_destructor complete; -}; - -#if !defined (_STLP_NO_MOVE_SEMANTIC) -typedef __true_type __stlp_movable; -#else -typedef __false_type __stlp_movable; -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -/* - * This struct should never be used if the user has not explicitely stipulated - * that its class support the full move concept. To check that the return type - * in such a case will be __invalid_source<_Tp> to generate a compile error - * revealing the configuration problem. - */ -template -struct _MoveSourceTraits { - typedef typename __move_traits<_Tp>::implemented _MvImpRet; -#if defined (__BORLANDC__) - typedef typename __selectT<_MvImpRet, -#else - enum {_MvImp = __type2bool<_MvImpRet>::_Ret}; - typedef typename __select<_MvImp, -#endif - __move_source<_Tp>, - _Tp const&>::_Ret _Type; -}; - -//The helper function -template -inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type -_AsMoveSource (_Tp &src) { - typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType; - return _SrcType(src); -} - -//Helper structs used for many class. -template -struct __move_traits_aux { - typedef typename __move_traits<_Tp>::implemented implemented; - typedef typename __move_traits<_Tp>::complete complete; -}; - -template -struct __move_traits_aux2 { - typedef __move_traits<_Tp1> _MoveTraits1; - typedef __move_traits<_Tp2> _MoveTraits2; - - typedef typename _Lor2::_Ret implemented; - typedef typename _Land2::_Ret complete; -}; - -/* - * Most of the time a class implement a move constructor but its use depends - * on a third party, this is what the following struct are for. - */ -template -struct __move_traits_help { - typedef __true_type implemented; - typedef typename __move_traits<_Tp>::complete complete; -}; - -template -struct __move_traits_help1 { - typedef __move_traits<_Tp1> _MoveTraits1; - typedef __move_traits<_Tp2> _MoveTraits2; - - typedef typename _Lor2::_Ret implemented; - typedef typename _Land2::_Ret complete; -}; - -template -struct __move_traits_help2 { - typedef __move_traits<_Tp1> _MoveTraits1; - typedef __move_traits<_Tp2> _MoveTraits2; - - typedef __stlp_movable implemented; - typedef typename _Land2::_Ret complete; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */ diff --git a/SDK/stlport/stl/_new.h b/SDK/stlport/stl/_new.h deleted file mode 100644 index dabc5faf..00000000 --- a/SDK/stlport/stl/_new.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_NEW -#define _STLP_INTERNAL_NEW - -#ifndef _STLP_INTERNAL_CSTDDEF -// size_t -# include -#endif - -#if defined (__BORLANDC__) && (__BORLANDC__ < 0x580) -// new.h uses ::malloc ;( -# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) -using _STLP_VENDOR_CSTD::malloc; -#endif - -#if !defined (_STLP_NO_NEW_NEW_HEADER) -# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS) -# define bad_alloc _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS -# define nothrow_t _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS -# define nothrow _STLP_NULLIFIED_BROKEN_BAD_NOTHROW -# endif - -// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both and -// we undefine the symbol to get the stuff in the SDK's -# if defined (_STLP_WCE_NET) && defined (_INC_NEW) -# undef _INC_NEW -# endif - -# if defined (new) -/* STLport cannot replace native Std library new header if new is a macro, - * please define new macro after header inclusion. - */ -# error Cannot include native new header as new is a macro. -# endif - -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new) - -# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS) -# undef bad_alloc -# undef nothrow_t -# undef nothrow -# undef _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS -# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS -# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW -# endif -#else -# include -#endif - -#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) -# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 -#endif - -#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) - -# ifndef _STLP_INTERNAL_EXCEPTION -# include -# endif - -_STLP_BEGIN_NAMESPACE - -# if defined (_STLP_NO_BAD_ALLOC) -struct nothrow_t {}; -# define nothrow nothrow_t() -# endif - -/* - * STLport own bad_alloc exception to be used if the native C++ library - * do not define it or when the new operator do not throw it to avoid - * a useless library dependency. - */ -class bad_alloc : public exception { -public: - bad_alloc () _STLP_NOTHROW_INHERENTLY { } - bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { } - bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;} - ~bad_alloc () _STLP_NOTHROW_INHERENTLY { } - const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; } -}; - -_STLP_END_NAMESPACE - -#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */ - -#if defined (_STLP_RTTI_BUG) -_STLP_BEGIN_NAMESPACE - -inline void* _STLP_CALL __stl_new(size_t __n) -{ return ::malloc(__n); } - -inline void _STLP_CALL __stl_delete(void* __p) -{ ::free(__p); } -_STLP_END_NAMESPACE - -#else /* _STLP_RTTI_BUG */ - -# if defined (_STLP_USE_OWN_NAMESPACE) - -_STLP_BEGIN_NAMESPACE - -# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) -using _STLP_VENDOR_EXCEPT_STD::bad_alloc; -# endif - -# if !defined (_STLP_NO_BAD_ALLOC) -using _STLP_VENDOR_EXCEPT_STD::nothrow_t; -using _STLP_VENDOR_EXCEPT_STD::nothrow; -# if defined (_STLP_GLOBAL_NEW_HANDLER) -using ::new_handler; -using ::set_new_handler; -# else -using _STLP_VENDOR_EXCEPT_STD::new_handler; -using _STLP_VENDOR_EXCEPT_STD::set_new_handler; -# endif -# endif /* !_STLP_NO_BAD_ALLOC */ - -_STLP_END_NAMESPACE -# endif /* _STLP_USE_OWN_NAMESPACE */ - -# if defined (_STLP_USE_EXCEPTIONS) && \ - (defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)) -# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW(_STLP_STD::bad_alloc()); } return __y -# else -# define _STLP_CHECK_NULL_ALLOC(__x) return __x -# endif - -_STLP_BEGIN_NAMESPACE - -# if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (__DEBUG_ALLOC__)) -inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n, __FILE__, __LINE__)); } -inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); } -# else -inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n)); } -inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); } -# endif -_STLP_END_NAMESPACE - -#endif /* _STLP_RTTI_BUG */ - -#endif /* _STLP_INTERNAL_NEW */ - - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/stl/_null_stream.h b/SDK/stlport/stl/_null_stream.h deleted file mode 100644 index ecdb7a2b..00000000 --- a/SDK/stlport/stl/_null_stream.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_NULL_STREAM_H -# define _STLP_NULL_STREAM_H - -_STLP_BEGIN_NAMESPACE - -struct __null_stream -{ - void flush() { } -}; - -template -__null_stream& operator <<(__null_stream& __x, const _Tp& ) -{ - return __x; -} - -template -__null_stream& operator >>(const _Tp&, __null_stream& __x ) -{ - return __x; -} - -extern __null_stream cin, cout, cerr, endl, ws, hex, dec; - -_STLP_END_NAMESPACE - -# endif diff --git a/SDK/stlport/stl/_num_get.c b/SDK/stlport/stl/_num_get.c deleted file mode 100644 index da129930..00000000 --- a/SDK/stlport/stl/_num_get.c +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_NUM_GET_C -#define _STLP_NUM_GET_C - -#ifndef _STLP_INTERNAL_NUM_GET_H -# include -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned); -_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms(); - -template < class _InputIter, class _Integer, class _CharT> -_InputIter _STLP_CALL -__do_get_integer(_InputIter&, _InputIter&, ios_base&, ios_base::iostate&, _Integer&, _CharT*); - -// __do_get_integer and its helper functions. - -inline bool _STLP_CALL __get_fdigit(char __c, const char*) -{ return __c >= '0' && __c <= '9'; } - -inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) { - if (__c == __sep) { - __c = ',' ; - return true ; - } - else - return __get_fdigit(__c, __digits); -} - -inline int _STLP_CALL -__get_digit_from_table(unsigned __index) -{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); } - -template -int -__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, _CharT*) { - _CharT __atoms[5]; - const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __str._M_ctype_facet()); - - __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms); - - bool __negative = false; - _CharT __c = *__in_ite; - - if (__c == __atoms[1] /* __xminus_char */ ) { - __negative = true; - ++__in_ite; - } - else if (__c == __atoms[0] /* __xplus_char */ ) - ++__in_ite; - - int __base; - int __valid_zero = 0; - - ios_base::fmtflags __basefield = __str.flags() & ios_base::basefield; - - switch (__basefield) { - case ios_base::oct: - __base = 8; - break; - case ios_base::dec: - __base = 10; - break; - case ios_base::hex: - __base = 16; - if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { - ++__in_ite; - if (__in_ite != __end && - (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) - ++__in_ite; - else - __valid_zero = 1; // That zero is valid by itself. - } - break; - default: - if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { - ++__in_ite; - if (__in_ite != __end && - (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) { - ++__in_ite; - __base = 16; - } - else - { - __base = 8; - __valid_zero = 1; // That zero is still valid by itself. - } - } - else - __base = 10; - break; - } - return (__base << 2) | ((int)__negative << 1) | __valid_zero; -} - - -template -bool _STLP_CALL -__get_integer(_InputIter& __first, _InputIter& __last, - int __base, _Integer& __val, - int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) { - bool __ovflow = false; - _Integer __result = 0; - bool __is_group = !__grouping.empty(); - char __group_sizes[64]; - char __current_group_size = 0; - char* __group_sizes_end = __group_sizes; - - _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base); - - for ( ; __first != __last ; ++__first) { - - const _CharT __c = *__first; - - if (__is_group && __c == __separator) { - *__group_sizes_end++ = __current_group_size; - __current_group_size = 0; - continue; - } - - int __n = __get_digit_from_table(__c); - - if (__n >= __base) - break; - - ++__got; - ++__current_group_size; - - if (__result < __over_base) - __ovflow = true; // don't need to keep accumulating - else { - _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n); - if (__result != 0) - __ovflow = __ovflow || __next >= __result; - __result = __next; - } - } - - if (__is_group && __group_sizes_end != __group_sizes) { - *__group_sizes_end++ = __current_group_size; - } - - // fbp : added to not modify value if nothing was read - if (__got > 0) { - __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)() - : (numeric_limits<_Integer>::max)() - : __is_negative ? __result - : __STATIC_CAST(_Integer, -__result); - } - // overflow is being treated as failure - return ((__got > 0) && !__ovflow) && - (__is_group == 0 || - __valid_grouping(__group_sizes, __group_sizes_end, - __grouping.data(), __grouping.data()+ __grouping.size())); -} - -template -bool _STLP_CALL -__get_integer(_InputIter& __first, _InputIter& __last, - int __base, _Integer& __val, - int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) { - bool __ovflow = false; - _Integer __result = 0; - bool __is_group = !__grouping.empty(); - char __group_sizes[64]; - char __current_group_size = 0; - char* __group_sizes_end = __group_sizes; - - _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base); - - for ( ; __first != __last ; ++__first) { - - const _CharT __c = *__first; - - if (__is_group && __c == __separator) { - *__group_sizes_end++ = __current_group_size; - __current_group_size = 0; - continue; - } - - int __n = __get_digit_from_table(__c); - - if (__n >= __base) - break; - - ++__got; - ++__current_group_size; - - if (__result > __over_base) - __ovflow = true; //don't need to keep accumulating - else { - _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n); - if (__result != 0) - __ovflow = __ovflow || __next <= __result; - __result = __next; - } - } - - if (__is_group && __group_sizes_end != __group_sizes) { - *__group_sizes_end++ = __current_group_size; - } - - // fbp : added to not modify value if nothing was read - if (__got > 0) { - __val = __ovflow ? (numeric_limits<_Integer>::max)() - : (__is_negative ? __STATIC_CAST(_Integer, -__result) - : __result); - } - - // overflow is being treated as failure - return ((__got > 0) && !__ovflow) && - (__is_group == 0 || - __valid_grouping(__group_sizes, __group_sizes_end, - __grouping.data(), __grouping.data()+ __grouping.size())); -} - - -template -bool _STLP_CALL -__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) { - string __grp; - //Here there is no grouping so separator is not important, we just pass the default charater. - return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type()); -} - -template -_InputIter _STLP_CALL -__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, - ios_base::iostate& __err, _Integer& __val, _CharT* __pc) { -#if defined (__HP_aCC) && (__HP_aCC == 1) - bool _IsSigned = !((_Integer)(-1) > 0); -#else - typedef typename __bool2type::is_signed>::_Ret _IsSigned; -#endif - - const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __str._M_numpunct_facet()); - const string& __grouping = __str._M_grouping(); // cached copy - - const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str, __pc); - int __got = __base_or_zero & 1; - - bool __result; - - if (__in_ite == __end) { // We may have already read a 0. If so, - - if (__got > 0) { // the result is 0 even if we're at eof. - __val = 0; - __result = true; - } - else - __result = false; - } - else { - const bool __negative = (__base_or_zero & 2) != 0; - const int __base = __base_or_zero >> 2; - -#if defined (__HP_aCC) && (__HP_aCC == 1) - if (_IsSigned) - __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() ); - else - __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() ); -#else - __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned()); -# endif - } - - __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit); - - if (__in_ite == __end) - __err |= ios_base::eofbit; - return __in_ite; -} - -// __read_float and its helper functions. -template -_InputIter _STLP_CALL -__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v, - _CharT __xplus, _CharT __xminus) { - if (__first != __last) { - _CharT __c = *__first; - if (__c == __xplus) - ++__first; - else if (__c == __xminus) { - __v.push_back('-'); - ++__first; - } - } - return __first; -} - - -template -bool _STLP_CALL -__copy_digits(_InputIter& __first, _InputIter __last, - __iostring& __v, const _CharT* __digits) { - bool __ok = false; - - for ( ; __first != __last; ++__first) { - _CharT __c = *__first; - if (__get_fdigit(__c, __digits)) { - __v.push_back((char)__c); - __ok = true; - } - else - break; - } - return __ok; -} - -template -bool _STLP_CALL -__copy_grouped_digits(_InputIter& __first, _InputIter __last, - __iostring& __v, const _CharT * __digits, - _CharT __sep, const string& __grouping, - bool& __grouping_ok) { - bool __ok = false; - char __group_sizes[64]; - char*__group_sizes_end = __group_sizes; - char __current_group_size = 0; - - for ( ; __first != __last; ++__first) { - _CharT __c = *__first; - bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits); - if (__tmp) { - if (__c == ',') { - *__group_sizes_end++ = __current_group_size; - __current_group_size = 0; - } - else { - __ok = true; - __v.push_back((char)__c); - ++__current_group_size; - } - } - else - break; - } - - if (__group_sizes_end != __group_sizes) - *__group_sizes_end++ = __current_group_size; - __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size()); - return __ok; -} - - -template -bool _STLP_CALL -__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end, ios_base& __s, _CharT*) { - // Create a string, copying characters of the form - // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)? - - bool __digits_before_dot /* = false */; - bool __digits_after_dot = false; - bool __ok; - - bool __grouping_ok = true; - - const ctype<_CharT>& __ct = *__STATIC_CAST(const ctype<_CharT>*, __s._M_ctype_facet()); - const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __s._M_numpunct_facet()); - const string& __grouping = __s._M_grouping(); // cached copy - - _CharT __dot = __numpunct.decimal_point(); - _CharT __sep = __numpunct.thousands_sep(); - - _CharT __digits[10]; - _CharT __xplus; - _CharT __xminus; - - _CharT __pow_e; - _CharT __pow_E; - - _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits); - - // Get an optional sign - __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus); - - // Get an optional string of digits. - if (!__grouping.empty()) - __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits, - __sep, __grouping, __grouping_ok); - else - __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits); - - // Get an optional decimal point, and an optional string of digits. - if (__in_ite != __end && *__in_ite == __dot) { - __buf.push_back('.'); - ++__in_ite; - __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits); - } - - // There have to be some digits, somewhere. - __ok = __digits_before_dot || __digits_after_dot; - - // Get an optional exponent. - if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) { - __buf.push_back('e'); - ++__in_ite; - __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus); - __ok = __copy_digits(__in_ite, __end, __buf, __digits); - // If we have an exponent then the sign - // is optional but the digits aren't. - } - - return __ok; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -// -// num_get<>, num_put<> -// - -#if ( _STLP_STATIC_TEMPLATE_DATA > 0 ) -# if !defined (__BORLANDC__) -template -locale::id num_get<_CharT, _InputIterator>::id; -# endif - -# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ - defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) -/* - * Under cygwin, when STLport is used as a shared library, the id needs - * to be specified as imported otherwise they will be duplicated in the - * calling executable. - */ -template <> -_STLP_DECLSPEC locale::id num_get > >::id; -/* -template <> -_STLP_DECLSPEC locale::id num_get::id; -*/ - -# if !defined (STLP_NO_WCHAR_T) -template <> -_STLP_DECLSPEC locale::id num_get > >::id; -/* -template <> -_STLP_DECLSPEC locale::id num_get::id; -*/ -# endif - -# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */ - -#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -//typedef num_get num_get_char; -typedef num_get > > num_get_char_2; - -//__DECLARE_INSTANCE(locale::id, num_get_char::id, ); -__DECLARE_INSTANCE(locale::id, num_get_char_2::id, ); - -# if !defined (_STLP_NO_WCHAR_T) - -//typedef num_get num_get_wchar_t; -typedef num_get > > num_get_wchar_t_2; - -//__DECLARE_INSTANCE(locale::id, num_get_wchar_t::id, ); -__DECLARE_INSTANCE(locale::id, num_get_wchar_t_2::id, ); - -# endif - -#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -#if !defined (_STLP_NO_BOOL) -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, - ios_base& __s, - ios_base::iostate& __err, bool& __x) const { - if (__s.flags() & ios_base::boolalpha) { - locale __loc = __s.getloc(); - const _Numpunct& __np = *__STATIC_CAST(const _Numpunct*, __s._M_numpunct_facet()); - // const numpunct<_CharT>& __np = use_facet >(__loc) ; -// const ctype<_CharT>& __ct = use_facet >(__loc) ; - - const basic_string<_CharT> __truename = __np.truename(); - const basic_string<_CharT> __falsename = __np.falsename(); - bool __true_ok = true; - bool __false_ok = true; - - size_t __n = 0; - for ( ; __in_ite != __end; ++__in_ite) { - _CharT __c = *__in_ite; - __true_ok = __true_ok && (__c == __truename[__n]); - __false_ok = __false_ok && (__c == __falsename[__n]); - ++__n; - - if ((!__true_ok && !__false_ok) || - (__true_ok && __n >= __truename.size()) || - (__false_ok && __n >= __falsename.size())) { - ++__in_ite; - break; - } - } - if (__true_ok && __n < __truename.size()) __true_ok = false; - if (__false_ok && __n < __falsename.size()) __false_ok = false; - - if (__true_ok || __false_ok) { - __err = ios_base::goodbit; - __x = __true_ok; - } - else - __err = ios_base::failbit; - - if (__in_ite == __end) - __err |= ios_base::eofbit; - - return __in_ite; - } - - else { - long __lx; - _InputIter __tmp = this->do_get(__in_ite, __end, __s, __err, __lx); - if (!(__err & ios_base::failbit)) { - if (__lx == 0) - __x = false; - else if (__lx == 1) - __x = true; - else - __err |= ios_base::failbit; - } - return __tmp; - } -} - -#endif /* _STLP_NO_BOOL */ - -#if defined (_STLP_FIX_LIBRARY_ISSUES) -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, short& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, int& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - -#endif - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, long& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - unsigned short& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - unsigned int& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - unsigned long& __val) const -{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } - - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - float& __val) const { - _STLP_PRIV __iostring __buf ; - bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 ); - _STLP_PRIV __string_to_float(__buf, __val); - __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit); - if (__in_ite == __end) - __err |= ios_base::eofbit; - return __in_ite; -} - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - double& __val) const { - _STLP_PRIV __iostring __buf ; - bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 ); - _STLP_PRIV __string_to_float(__buf, __val); - __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit); - if (__in_ite == __end) - __err |= ios_base::eofbit; - return __in_ite; -} - -#if !defined (_STLP_NO_LONG_DOUBLE) -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - long double& __val) const { - _STLP_PRIV __iostring __buf ; - bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 ); - _STLP_PRIV __string_to_float(__buf, __val); - __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit); - if (__in_ite == __end) - __err |= ios_base::eofbit; - return __in_ite; -} -#endif /* _STLP_NO_LONG_DOUBLE */ - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - void*& __p) const { -#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void* - unsigned _STLP_LONG_LONG __val; -#else - unsigned long __val; -#endif - iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); - if (!(__err & ios_base::failbit)) - __p = __REINTERPRET_CAST(void*,__val); - return __tmp; - } - -#if defined (_STLP_LONG_LONG) -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - _STLP_LONG_LONG& __val) const { - return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); -} - -template -_InputIter -num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, - unsigned _STLP_LONG_LONG& __val) const { - return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); -} -#endif /* _STLP_LONG_LONG */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_NUMERIC_FACETS_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_num_get.h b/SDK/stlport/stl/_num_get.h deleted file mode 100644 index d764eeac..00000000 --- a/SDK/stlport/stl/_num_get.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_NUM_GET_H -#define _STLP_INTERNAL_NUM_GET_H - -#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H -# include -#endif - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUMPUNCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif - -#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// num_get facets - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class num_get: public locale::facet { - friend class _Locale_impl; -public: - typedef _CharT char_type; - typedef _InputIter iter_type; - - explicit num_get(size_t __refs = 0): locale::facet(__refs) {} - -#if !defined (_STLP_NO_BOOL) - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, bool& __val) const - { return do_get(__ii, __end, __str, __err, __val); } -#endif - -#if defined (_STLP_FIX_LIBRARY_ISSUES) - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, short& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, int& __val) const - { return do_get(__ii, __end, __str, __err, __val); } -#endif - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, long& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned short& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned int& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned long& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - -#if defined (_STLP_LONG_LONG) - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, _STLP_LONG_LONG& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const - { return do_get(__ii, __end, __str, __err, __val); } -#endif /* _STLP_LONG_LONG */ - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, float& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, double& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - -#if !defined (_STLP_NO_LONG_DOUBLE) - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, long double& __val) const - { return do_get(__ii, __end, __str, __err, __val); } -# endif - - _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, void*& __val) const - { return do_get(__ii, __end, __str, __err, __val); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~num_get() {} - - typedef string string_type; - typedef ctype<_CharT> _Ctype; - typedef numpunct<_CharT> _Numpunct; - -#if !defined (_STLP_NO_BOOL) - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, bool& __val) const; -#endif - - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, long& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned short& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned int& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned long& __val) const; - -#if defined (_STLP_FIX_LIBRARY_ISSUES) - // issue 118 : those are actually not supposed to be here - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, short& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, int& __val) const; -#endif - - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, float& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, double& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, void*& __p) const; - -#if !defined (_STLP_NO_LONG_DOUBLE) - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, long double& __val) const; -#endif - -#if defined (_STLP_LONG_LONG) - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, _STLP_LONG_LONG& __val) const; - virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, - ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const; -#endif - -}; - - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS num_get > >; -// _STLP_EXPORT_TEMPLATE_CLASS num_get; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS num_get > >; -// _STLP_EXPORT_TEMPLATE_CLASS num_get; -# endif -#endif - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) - -_STLP_MOVE_TO_PRIV_NAMESPACE - -_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*); - -template -bool _STLP_CALL -__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*); - -# if !defined (_STLP_NO_WCHAR_T) -bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*); -bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*); -# endif - -inline void _STLP_CALL -_Initialize_get_float(const ctype&, - char& Plus, char& Minus, - char& pow_e, char& pow_E, - char*) { - Plus = '+'; - Minus = '-'; - pow_e = 'e'; - pow_E = 'E'; -} - -# if !defined (_STLP_NO_WCHAR_T) -void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype&, - wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*); -# endif -void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&); -void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&); -# if !defined (_STLP_NO_LONG_DOUBLE) -void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&); -# endif - -_STLP_MOVE_TO_STD_NAMESPACE - -#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */ - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_NUM_GET_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_num_put.c b/SDK/stlport/stl/_num_put.c deleted file mode 100644 index 6908404f..00000000 --- a/SDK/stlport/stl/_num_put.c +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_NUM_PUT_C -#define _STLP_NUM_PUT_C - -#ifndef _STLP_INTERNAL_NUM_PUT_H -# include -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// __do_put_float and its helper functions. Strategy: write the output -// to a buffer of char, transform the buffer to _CharT, and then copy -// it to the output. - -//---------------------------------------------------------------------- -// num_put facet - -template -_OutputIter _STLP_CALL -__copy_float_and_fill(const _CharT* __first, const _CharT* __last, - _OutputIter __oi, - ios_base::fmtflags __flags, - streamsize __width, _CharT __fill, - _CharT __xplus, _CharT __xminus) { - if (__width <= __last - __first) - return copy(__first, __last, __oi); - else { - streamsize __pad = __width - (__last - __first); - ios_base::fmtflags __dir = __flags & ios_base::adjustfield; - - if (__dir == ios_base::left) { - __oi = copy(__first, __last, __oi); - return __fill_n(__oi, __pad, __fill); - } - else if (__dir == ios_base::internal && __first != __last && - (*__first == __xplus || *__first == __xminus)) { - *__oi++ = *__first++; - __oi = __fill_n(__oi, __pad, __fill); - return copy(__first, __last, __oi); - } - else { - __oi = __fill_n(__oi, __pad, __fill); - return copy(__first, __last, __oi); - } - } -} - -#if !defined (_STLP_NO_WCHAR_T) -// Helper routine for wchar_t -template -_OutputIter _STLP_CALL -__put_float(__iostring &__str, _OutputIter __oi, - ios_base& __f, wchar_t __fill, - wchar_t __decimal_point, wchar_t __sep, - size_t __group_pos, const string& __grouping) { - const ctype& __ct = *__STATIC_CAST(const ctype*, __f._M_ctype_facet()); - - __iowstring __wbuf; - __convert_float_buffer(__str, __wbuf, __ct, __decimal_point); - - if (!__grouping.empty()) { - __insert_grouping(__wbuf, __group_pos, __grouping, - __sep, __ct.widen('+'), __ct.widen('-'), 0); - } - - return __copy_float_and_fill(__CONST_CAST(wchar_t*, __wbuf.data()), - __CONST_CAST(wchar_t*, __wbuf.data()) + __wbuf.size(), __oi, - __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-')); -} -#endif /* WCHAR_T */ - -// Helper routine for char -template -_OutputIter _STLP_CALL -__put_float(__iostring &__str, _OutputIter __oi, - ios_base& __f, char __fill, - char __decimal_point, char __sep, - size_t __group_pos, const string& __grouping) { - if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) { - __str[__group_pos] = __decimal_point; - } - - if (!__grouping.empty()) { - __insert_grouping(__str, __group_pos, - __grouping, __sep, '+', '-', 0); - } - - return __copy_float_and_fill(__CONST_CAST(char*, __str.data()), - __CONST_CAST(char*, __str.data()) + __str.size(), __oi, - __f.flags(), __f.width(0), __fill, '+', '-'); -} - -template -_OutputIter _STLP_CALL -__do_put_float(_OutputIter __s, ios_base& __f, - _CharT __fill, _Float __x) { - __iostring __buf; - - size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x); - - const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet()); - - return __put_float(__buf, __s, __f, __fill, - __np.decimal_point(), __np.thousands_sep(), - __group_pos, __f._M_grouping()); -} - -inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x) -{ __get_floor_digits(__buf, __x); } - -#if !defined (_STLP_NO_WCHAR_T) -inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) { - __iostring __buf; - __get_floor_digits(__buf, __x); - - const ctype& __ct = *__STATIC_CAST(const ctype*, __f._M_ctype_facet()); - __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false); -} -#endif - -template -void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x) -{ __get_money_digits_aux(__buf, __f, __x); } - -// _M_do_put_integer and its helper functions. - -template -_OutputIter _STLP_CALL -__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len, - _OutputIter __oi, - ios_base::fmtflags __flg, streamsize __wid, _CharT __fill, - _CharT __xplus, _CharT __xminus) { - if (__len >= __wid) - return copy(__buf, __buf + __len, __oi); - else { - //casting numeric_limits::max to streamsize only works is ptrdiff_t is signed or streamsize representation - //is larger than ptrdiff_t one. - _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) || - (sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits::is_signed) - ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), - __STATIC_CAST(streamsize, __wid - __len))); - ios_base::fmtflags __dir = __flg & ios_base::adjustfield; - - if (__dir == ios_base::left) { - __oi = copy(__buf, __buf + __len, __oi); - return __fill_n(__oi, __pad, __fill); - } - else if (__dir == ios_base::internal && __len != 0 && - (__buf[0] == __xplus || __buf[0] == __xminus)) { - *__oi++ = __buf[0]; - __oi = __fill_n(__oi, __pad, __fill); - return copy(__buf + 1, __buf + __len, __oi); - } - else if (__dir == ios_base::internal && __len >= 2 && - (__flg & ios_base::showbase) && - (__flg & ios_base::basefield) == ios_base::hex) { - *__oi++ = __buf[0]; - *__oi++ = __buf[1]; - __oi = __fill_n(__oi, __pad, __fill); - return copy(__buf + 2, __buf + __len, __oi); - } - else { - __oi = __fill_n(__oi, __pad, __fill); - return copy(__buf, __buf + __len, __oi); - } - } -} - -#if !defined (_STLP_NO_WCHAR_T) -// Helper function for wchar_t -template -_OutputIter _STLP_CALL -__put_integer(char* __buf, char* __iend, _OutputIter __s, - ios_base& __f, - ios_base::fmtflags __flags, wchar_t __fill) { - locale __loc = __f.getloc(); - // const ctype& __ct = use_facet >(__loc); - const ctype& __ct = *__STATIC_CAST(const ctype*, __f._M_ctype_facet()); - - wchar_t __xplus = __ct.widen('+'); - wchar_t __xminus = __ct.widen('-'); - - wchar_t __wbuf[64]; - __ct.widen(__buf, __iend, __wbuf); - ptrdiff_t __len = __iend - __buf; - wchar_t* __eend = __wbuf + __len; - - // const numpunct& __np = use_facet >(__loc); - // const string& __grouping = __np.grouping(); - - const numpunct& __np = *__STATIC_CAST(const numpunct*, __f._M_numpunct_facet()); - const string& __grouping = __f._M_grouping(); - - if (!__grouping.empty()) { - int __basechars; - if (__flags & ios_base::showbase) - switch (__flags & ios_base::basefield) { - case ios_base::hex: __basechars = 2; break; - case ios_base::oct: __basechars = 1; break; - default: __basechars = 0; - } - else - __basechars = 0; - - __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(), - __xplus, __xminus, __basechars); - } - - return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s, - __flags, __f.width(0), __fill, __xplus, __xminus); -} -#endif - -// Helper function for char -template -_OutputIter _STLP_CALL -__put_integer(char* __buf, char* __iend, _OutputIter __s, - ios_base& __f, ios_base::fmtflags __flags, char __fill) { - char __grpbuf[64]; - ptrdiff_t __len = __iend - __buf; - - // const numpunct& __np = use_facet >(__f.getloc()); - // const string& __grouping = __np.grouping(); - - const numpunct& __np = *__STATIC_CAST(const numpunct*, __f._M_numpunct_facet()); - const string& __grouping = __f._M_grouping(); - - if (!__grouping.empty()) { - int __basechars; - if (__flags & ios_base::showbase) - switch (__flags & ios_base::basefield) { - case ios_base::hex: __basechars = 2; break; - case ios_base::oct: __basechars = 1; break; - default: __basechars = 0; - } - else - __basechars = 0; - - // make sure there is room at the end of the buffer - // we pass to __insert_grouping - copy(__buf, __iend, (char *) __grpbuf); - __buf = __grpbuf; - __iend = __grpbuf + __len; - __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(), - '+', '-', __basechars); - } - - return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-'); -} - -#if defined (_STLP_LONG_LONG) -typedef _STLP_LONG_LONG __max_int_t; -typedef unsigned _STLP_LONG_LONG __umax_int_t; -#else -typedef long __max_int_t; -typedef unsigned long __umax_int_t; -#endif - -_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo(); -_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi(); - -template -inline char* _STLP_CALL -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) { - const bool __negative = __x < 0 ; - __max_int_t __temp = __x; - __umax_int_t __utemp = __negative?-__temp:__temp; - - for (; __utemp != 0; __utemp /= 10) - *--__ptr = (char)((int)(__utemp % 10) + '0'); - // put sign if needed or requested - if (__negative) - *--__ptr = '-'; - else if (__flags & ios_base::showpos) - *--__ptr = '+'; - return __ptr; -} - -template -inline char* _STLP_CALL -__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) { - for (; __x != 0; __x /= 10) - *--__ptr = (char)((int)(__x % 10) + '0'); - // put sign if requested - if (__flags & ios_base::showpos) - *--__ptr = '+'; - return __ptr; -} - -template -char* _STLP_CALL -__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) { - char* __ptr = __buf; - - if (__x == 0) { - *--__ptr = '0'; - if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0)) - *--__ptr = '+'; - // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings) - } - else { - switch (__flags & ios_base::basefield) { - case ios_base::oct: - { - __umax_int_t __temp = __x; - // if the size of integer is less than 8, clear upper part - if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) - __temp &= 0xFFFFFFFF; - - for (; __temp != 0; __temp >>=3) - *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0'); - - // put leading '0' if showbase is set - if (__flags & ios_base::showbase) - *--__ptr = '0'; - } - break; - case ios_base::hex: - { - const char* __table_ptr = (__flags & ios_base::uppercase) ? - __hex_char_table_hi() : __hex_char_table_lo(); - __umax_int_t __temp = __x; - // if the size of integer is less than 8, clear upper part - if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) - __temp &= 0xFFFFFFFF; - - for (; __temp != 0; __temp >>=4) - *--__ptr = __table_ptr[((unsigned)__temp & 0xF)]; - - if (__flags & ios_base::showbase) { - *--__ptr = __table_ptr[16]; - *--__ptr = '0'; - } - } - break; - //case ios_base::dec: - default: - { -#if defined(__HP_aCC) && (__HP_aCC == 1) - bool _IsSigned = !((_Integer)-1 > 0); - if (_IsSigned) - __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() ); - else - __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() ); -#else - typedef typename __bool2type::is_signed>::_Ret _IsSigned; - __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned()); -#endif - } - break; - } - } - - // return pointer to beginning of the string - return __ptr; -} - -template -_OutputIter _STLP_CALL -__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) { - // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte) - // plus the longest base representation '0x' - // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as - // the specification of a static buffer size. - char __buf[sizeof(_Integer) * 3 + 2]; - const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char); - ios_base::fmtflags __flags = __f.flags(); - char* __ibeg = __write_integer_backward((char*)__buf+__buf_size, __flags, __x); - return __put_integer(__ibeg, (char*)__buf+__buf_size, __s, __f, __flags, __fill); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -// -// num_put<> -// - -#if (_STLP_STATIC_TEMPLATE_DATA > 0) - -# if !defined (__BORLANDC__) -template -locale::id num_put<_CharT, _OutputIterator>::id; -# endif - -# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ - defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) -/* - * Under cygwin, when STLport is used as a shared library, the id needs - * to be specified as imported otherwise they will be duplicated in the - * calling executable. - */ -template <> -_STLP_DECLSPEC locale::id num_put > >::id; -/* -template <> -_STLP_DECLSPEC locale::id num_put::id; -*/ - -# if !defined (_STLP_NO_WCHAR_T) -template <> -_STLP_DECLSPEC locale::id num_put > >::id; -/* -template <> -_STLP_DECLSPEC locale::id num_put::id; -*/ -# endif - -# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */ - -#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -//typedef num_put num_put_char; -typedef num_put > > num_put_char_2; - -//__DECLARE_INSTANCE(locale::id, num_put_char::id, ); -__DECLARE_INSTANCE(locale::id, num_put_char_2::id, ); - -# if !defined (_STLP_NO_WCHAR_T) - -//typedef num_put num_put_wchar_t; -typedef num_put > > num_put_wchar_t_2; - -//__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, ); -__DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, ); - -# endif - -#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -// issue 118 - -#if !defined (_STLP_NO_BOOL) -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, - char_type __fill, bool __val) const { - if (!(__f.flags() & ios_base::boolalpha)) - return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val)); - - locale __loc = __f.getloc(); - // typedef numpunct<_CharT> _Punct; - // const _Punct& __np = use_facet<_Punct>(__loc); - - const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet()); - - basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename(); - - // Reuse __copy_integer_and_fill. Since internal padding makes no - // sense for bool, though, make sure we use something else instead. - // The last two argument to __copy_integer_and_fill are dummies. - ios_base::fmtflags __flags = __f.flags(); - if ((__flags & ios_base::adjustfield) == ios_base::internal) - __flags = (__flags & ~ios_base::adjustfield) | ios_base::right; - - return _STLP_PRIV __copy_integer_and_fill(__str.c_str(), __str.size(), __s, - __flags, __f.width(0), __fill, - (_CharT) 0, (_CharT) 0); -} - -#endif - -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - long __val) const -{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } - -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - unsigned long __val) const -{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } - -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - double __val) const -{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } - -#if !defined (_STLP_NO_LONG_DOUBLE) -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - long double __val) const -{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } -#endif - -#if defined (_STLP_LONG_LONG) -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - _STLP_LONG_LONG __val) const -{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } - -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - unsigned _STLP_LONG_LONG __val) const -{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } -#endif /* _STLP_LONG_LONG */ - - -// lib.facet.num.put.virtuals "12 For conversion from void* the specifier is %p." -template -_OutputIter -num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/, - const void* __val) const { - const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __f._M_ctype_facet()); - ios_base::fmtflags __save_flags = __f.flags(); - - __f.setf(ios_base::hex, ios_base::basefield); - __f.setf(ios_base::showbase); - __f.setf(ios_base::internal, ios_base::adjustfield); - __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix -# if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long - _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val)); -# else - _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val)); -# endif - __f.flags(__save_flags); - return result; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_NUM_PUT_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_num_put.h b/SDK/stlport/stl/_num_put.h deleted file mode 100644 index 077cd93d..00000000 --- a/SDK/stlport/stl/_num_put.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_NUM_PUT_H -#define _STLP_INTERNAL_NUM_PUT_H - -#ifndef _STLP_INTERNAL_NUMPUNCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif - -#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// num_put facet - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class num_put: public locale::facet { - friend class _Locale_impl; -public: - typedef _CharT char_type; - typedef _OutputIter iter_type; - - explicit num_put(size_t __refs = 0) : locale::facet(__refs) {} - -#if !defined (_STLP_NO_BOOL) - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - bool __val) const { - return do_put(__s, __f, __fill, __val); - } -#endif - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - long __val) const { - return do_put(__s, __f, __fill, __val); - } - - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - unsigned long __val) const { - return do_put(__s, __f, __fill, __val); - } - -#if defined (_STLP_LONG_LONG) - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - _STLP_LONG_LONG __val) const { - return do_put(__s, __f, __fill, __val); - } - - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - unsigned _STLP_LONG_LONG __val) const { - return do_put(__s, __f, __fill, __val); - } -#endif - - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - double __val) const { - return do_put(__s, __f, __fill, (double)__val); - } - -#if !defined (_STLP_NO_LONG_DOUBLE) - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - long double __val) const { - return do_put(__s, __f, __fill, __val); - } -#endif - - iter_type put(iter_type __s, ios_base& __f, char_type __fill, - const void * __val) const { - return do_put(__s, __f, __fill, __val); - } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - ~num_put() {} -#if !defined (_STLP_NO_BOOL) - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const; -#endif - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const; - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const; - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const; -#if !defined (_STLP_NO_LONG_DOUBLE) - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const; -#endif - -#if defined (_STLP_LONG_LONG) - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const; - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, - unsigned _STLP_LONG_LONG __val) const ; -#endif - virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const; -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS num_put > >; -// _STLP_EXPORT_TEMPLATE_CLASS num_put; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS num_put > >; -// _STLP_EXPORT_TEMPLATE_CLASS num_put; -# endif -#endif - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -char* _STLP_CALL -__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x); - -/* - * Returns the position on the right of the digits that has to be considered - * for the application of the grouping policy. - */ -extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double); -# if !defined (_STLP_NO_LONG_DOUBLE) -extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double); -# endif - -/* - * Gets the digits of the integer part. - */ -void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE); - -template -void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE); - -# if !defined (_STLP_NO_WCHAR_T) -extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype&, wchar_t, bool = true); -# endif -extern void _STLP_CALL __adjust_float_buffer(__iostring&, char); - -extern char* _STLP_CALL -__write_integer(char* buf, ios_base::fmtflags flags, long x); - -extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int); -extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int); -# if !defined (_STLP_NO_WCHAR_T) -extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int); -extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int); -# endif - -_STLP_MOVE_TO_STD_NAMESPACE - -#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */ - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_numeric.c b/SDK/stlport/stl/_numeric.c deleted file mode 100644 index 6bd07ff1..00000000 --- a/SDK/stlport/stl/_numeric.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_NUMERIC_C -#define _STLP_NUMERIC_C - -#ifndef _STLP_INTERNAL_NUMERIC_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIterator -__partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp*, _BinaryOperation __binary_op) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - if (__first == __last) return __result; - *__result = *__first; - - _Tp __val = *__first; - while (++__first != __last) { - __val = __binary_op(__val, *__first); - *++__result = __val; - } - return ++__result; -} - -template -_OutputIterator -__adjacent_difference(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp*, - _BinaryOperation __binary_op) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - if (__first == __last) return __result; - *__result = *__first; - _Tp __val = *__first; - while (++__first != __last) { - _Tp __tmp = *__first; - *++__result = __binary_op(__tmp, __val); - __val = __tmp; - } - return ++__result; -} - - -template -_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr) { - _STLP_MPWFIX_TRY - if (__n == 0) - return __identity_element(__opr); - else { - while ((__n & 1) == 0) { - __n >>= 1; - __x = __opr(__x, __x); - } - _Tp __result = __x; - _STLP_MPWFIX_TRY - __n >>= 1; - while (__n != 0) { - __x = __opr(__x, __x); - if ((__n & 1) != 0) - __result = __opr(__result, __x); - __n >>= 1; - } - return __result; - _STLP_MPWFIX_CATCH - } - _STLP_MPWFIX_CATCH_ACTION(__x = _Tp()) -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_NUMERIC_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_numeric.h b/SDK/stlport/stl/_numeric.h deleted file mode 100644 index 4844da16..00000000 --- a/SDK/stlport/stl/_numeric.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_NUMERIC_H -#define _STLP_INTERNAL_NUMERIC_H - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -_STLP_INLINE_LOOP -_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - _Init = _Init + *__first; - return _Init; -} - -template -_STLP_INLINE_LOOP -_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init, - _BinaryOperation __binary_op) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - for ( ; __first != __last; ++__first) - _Init = __binary_op(_Init, *__first); - return _Init; -} - -template -_STLP_INLINE_LOOP -_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp _Init) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2) - _Init = _Init + (*__first1 * *__first2); - return _Init; -} - -template -_STLP_INLINE_LOOP -_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, - _InputIterator2 __first2, _Tp _Init, - _BinaryOperation1 __binary_op1, - _BinaryOperation2 __binary_op2) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) - for ( ; __first1 != __last1; ++__first1, ++__first2) - _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2)); - return _Init; -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIterator -__partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp*, _BinaryOperation __binary_op); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result) { - return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator), - _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator))); -} - -template -inline _OutputIterator -partial_sum(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOperation __binary_op) { - return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator), - __binary_op); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_OutputIterator -__adjacent_difference(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _Tp*, - _BinaryOperation __binary_op); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _OutputIterator -adjacent_difference(_InputIterator __first, - _InputIterator __last, _OutputIterator __result) { - return _STLP_PRIV __adjacent_difference(__first, __last, __result, - _STLP_VALUE_TYPE(__first, _InputIterator), - _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator))); -} - -template -_OutputIterator -adjacent_difference(_InputIterator __first, _InputIterator __last, - _OutputIterator __result, _BinaryOperation __binary_op) { - return _STLP_PRIV __adjacent_difference(__first, __last, __result, - _STLP_VALUE_TYPE(__first, _InputIterator), - __binary_op); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr); - -_STLP_MOVE_TO_STD_NAMESPACE - -#if !defined (_STLP_NO_EXTENSIONS) - -// Returns __x ** __n, where __n >= 0. _Note that "multiplication" -// is required to be associative, but not necessarily commutative. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _Tp __power(_Tp __x, _Integer __n) { - return __power(__x, __n, multiplies<_Tp>()); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -// Alias for the internal name __power. Note that power is an extension, -// not part of the C++ standard. -template -inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) { - return _STLP_PRIV __power(__x, __n, __opr); -} - -template -inline _Tp power(_Tp __x, _Integer __n) { - return _STLP_PRIV __power(__x, __n, multiplies<_Tp>()); -} - -// iota is not part of the C++ standard. It is an extension. - -template -_STLP_INLINE_LOOP -void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - while (__first != __last) - *__first++ = __val++; -} -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_NUMERIC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_numpunct.h b/SDK/stlport/stl/_numpunct.h deleted file mode 100644 index 504d979b..00000000 --- a/SDK/stlport/stl/_numpunct.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_NUMPUNCT_H -#define _STLP_INTERNAL_NUMPUNCT_H - -#ifndef _STLP_IOS_BASE_H -# include -#endif - -# ifndef _STLP_C_LOCALE_H -# include -# endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// numpunct facets - -template class numpunct {}; -template class numpunct_byname {}; -template class num_get; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC numpunct : public locale::facet -{ - friend class _Locale_impl; - -#ifndef _STLP_NO_FRIEND_TEMPLATES - template friend class num_get; -#endif -public: - typedef char char_type; - typedef string string_type; - - explicit numpunct(size_t __refs = 0) - : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {} - - char decimal_point() const { return do_decimal_point(); } - char thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - string truename() const { return do_truename(); } - string falsename() const { return do_falsename(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -#ifndef _STLP_NO_FRIEND_TEMPLATES -protected: -#endif - ~numpunct(); - - string _M_truename; - string _M_falsename; - string _M_grouping; - - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - virtual string do_truename() const; - virtual string do_falsename() const; -}; - -# if ! defined (_STLP_NO_WCHAR_T) - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC numpunct : public locale::facet -{ - friend class _Locale_impl; -public: - typedef wchar_t char_type; - typedef wstring string_type; - - explicit numpunct(size_t __refs = 0) - : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {} - - wchar_t decimal_point() const { return do_decimal_point(); } - wchar_t thousands_sep() const { return do_thousands_sep(); } - string grouping() const { return do_grouping(); } - wstring truename() const { return do_truename(); } - wstring falsename() const { return do_falsename(); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - wstring _M_truename; - wstring _M_falsename; - string _M_grouping; - - ~numpunct(); - - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - virtual wstring do_truename() const; - virtual wstring do_falsename() const; -}; - -# endif /* WCHAR_T */ - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC numpunct_byname : public numpunct { -public: - typedef char char_type; - typedef string string_type; - - explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - - ~numpunct_byname(); - - virtual char do_decimal_point() const; - virtual char do_thousands_sep() const; - virtual string do_grouping() const; - -private: - _Locale_numeric* _M_numeric; - - //explicitely defined as private to avoid warnings: - typedef numpunct_byname _Self; - numpunct_byname(_Self const&); - _Self& operator = (_Self const&); - friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname*); -}; - -# ifndef _STLP_NO_WCHAR_T -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC numpunct_byname: public numpunct { -public: - typedef wchar_t char_type; - typedef wstring string_type; - - explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0); - -protected: - - ~numpunct_byname(); - - virtual wchar_t do_decimal_point() const; - virtual wchar_t do_thousands_sep() const; - virtual string do_grouping() const; - -private: - _Locale_numeric* _M_numeric; - - //explicitely defined as private to avoid warnings: - typedef numpunct_byname _Self; - numpunct_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -# endif /* WCHAR_T */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_NUMPUNCT_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_ostream.c b/SDK/stlport/stl/_ostream.c deleted file mode 100644 index 6baf4ab8..00000000 --- a/SDK/stlport/stl/_ostream.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_OSTREAM_C -#define _STLP_OSTREAM_C - -#ifndef _STLP_INTERNAL_OSTREAM_H -# include -#endif - -#if !defined (_STLP_INTERNAL_NUM_PUT_H) -# include // For basic_streambuf and iterators -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Definitions of non-inline member functions. - -// Constructor, destructor - -template -basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf) - : basic_ios<_CharT, _Traits>() { - this->init(__buf); -} - -template -basic_ostream<_CharT, _Traits>::~basic_ostream() -{} - -// Output directly from a streambuf. -template -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) { - sentry __sentry(*this); - if (__sentry) { - if (__from) { - bool __any_inserted = __from->gptr() != __from->egptr() - ? this->_M_copy_buffered(__from, this->rdbuf()) - : this->_M_copy_unbuffered(__from, this->rdbuf()); - if (!__any_inserted) - this->setstate(ios_base::failbit); - } - else - this->setstate(ios_base::badbit); - } - - return *this; -} - -// Helper functions for the streambuf version of operator<<. The -// exception-handling code is complicated because exceptions thrown -// while extracting characters are treated differently than exceptions -// thrown while inserting characters. - -template -bool basic_ostream<_CharT, _Traits> - ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from, - basic_streambuf<_CharT, _Traits>* __to) { - bool __any_inserted = false; - - while (__from->egptr() != __from->gptr()) { - const ptrdiff_t __avail = __from->egptr() - __from->gptr(); - - streamsize __nwritten; - _STLP_TRY { - __nwritten = __to->sputn(__from->gptr(), __avail); - __from->gbump((int)__nwritten); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - return __any_inserted; - } - - if (__nwritten == __avail) { - _STLP_TRY { - if (this->_S_eof(__from->sgetc())) - return true; - else - __any_inserted = true; - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::failbit); - return false; - } - } - else if (__nwritten != 0) - return true; - else - return __any_inserted; - } - - // No characters are in the buffer, but we aren't at EOF. Switch to - // unbuffered mode. - return __any_inserted || this->_M_copy_unbuffered(__from, __to); -} - -/* - * Helper struct (guard) to put back a character in a streambuf - * whenever an exception or an eof occur. - */ -template -struct _SPutBackC { - typedef basic_streambuf<_CharT, _Traits> _StreamBuf; - typedef typename _StreamBuf::int_type int_type; - _SPutBackC(_StreamBuf *pfrom) - : __pfrom(pfrom), __c(0), __do_guard(false) {} - ~_SPutBackC() { - if (__do_guard) { - __pfrom->sputbackc(_Traits::to_char_type(__c)); - } - } - - void guard(int_type c) { - __c = c; - __do_guard = true; - } - void release() { - __do_guard = false; - } - -private: - _StreamBuf *__pfrom; - int_type __c; - bool __do_guard; -}; - -template -bool basic_ostream<_CharT, _Traits> - ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from, - basic_streambuf<_CharT, _Traits>* __to) { - typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard; - bool __any_inserted = false; - int_type __c; - - _STLP_TRY { - _SPutBackCGuard __cguard(__from); - for (;;) { - _STLP_TRY { - __c = __from->sbumpc(); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::failbit); - return __any_inserted; - } - - if ( this->_S_eof(__c) ) - return __any_inserted; - - __cguard.guard(__c); - if ( this->_S_eof( __to->sputc(_Traits::to_char_type(__c)) ) ) { - return __any_inserted; - } - - __cguard.release(); - __any_inserted = true; - } - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - return __any_inserted; - } -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Helper function for numeric output. -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) { - typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry; - _Sentry __sentry(__os); - bool __failed = true; - - if (__sentry) { - _STLP_TRY { - typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut; - __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()), - __os, __os.fill(), - __x).failed(); - } - _STLP_CATCH_ALL { - __os._M_handle_exception(ios_base::badbit); - } - } - if (__failed) - __os.setstate(ios_base::badbit); - return __os; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -/* - * In the following operators we try to limit code bloat by limiting the - * number of __put_num instanciations. - */ -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) { - _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) ) - long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ? - __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x; - return _STLP_PRIV __put_num(*this, __tmp); -} - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) { - _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) ) - return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x)); -} - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) { - _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) ) - long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ? - __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x; - return _STLP_PRIV __put_num(*this, __tmp); -} - -template -#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) { - _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) ) -#else -/* We define this operator with size_t rather than unsigned int to avoid - * 64 bits warning. - */ -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) { - _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) ) -#endif - return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x)); -} - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x) -{ return _STLP_PRIV __put_num(*this, __x); } - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x) -{ return _STLP_PRIV __put_num(*this, __x); } - -#ifdef _STLP_LONG_LONG -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x) -{ return _STLP_PRIV __put_num(*this, __x); } - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x) -{ return _STLP_PRIV __put_num(*this, __x); } -#endif - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x) -{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); } - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x) -{ return _STLP_PRIV __put_num(*this, __x); } - -#ifndef _STLP_NO_LONG_DOUBLE -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x) -{ return _STLP_PRIV __put_num(*this, __x); } -#endif - -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x) -{ return _STLP_PRIV __put_num(*this, __x); } - -#ifndef _STLP_NO_BOOL -template -basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x) -{ return _STLP_PRIV __put_num(*this, __x); } -#endif - -template -void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) { - sentry __sentry(*this); - if (__sentry) { - bool __failed = true; - _STLP_TRY { - streamsize __npad = this->width() > 0 ? this->width() - 1 : 0; - // if (__npad <= 1) - if (__npad == 0) - __failed = this->_S_eof(this->rdbuf()->sputc(__c)); - else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { - __failed = this->_S_eof(this->rdbuf()->sputc(__c)); - __failed = __failed || - this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - } - else { - __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c)); - } - - this->width(0); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - - if (__failed) - this->setstate(ios_base::badbit); - } -} - -template -void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) { - sentry __sentry(*this); - if (__sentry) { - bool __failed = true; - streamsize __n = _Traits::length(__s); - streamsize __npad = this->width() > __n ? this->width() - __n : 0; - - _STLP_TRY { - if (__npad == 0) - __failed = this->rdbuf()->sputn(__s, __n) != __n; - else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { - __failed = this->rdbuf()->sputn(__s, __n) != __n; - __failed = __failed || - this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - } - else { - __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n; - } - - this->width(0); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - - if (__failed) - this->setstate(ios_base::failbit); - } -} - -template -void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) { - sentry __sentry(*this); - if (__sentry) { - bool __failed = true; - streamsize __n = char_traits::length(__s); - streamsize __npad = this->width() > __n ? this->width() - __n : 0; - - _STLP_TRY { - if (__npad == 0) - __failed = !this->_M_put_widen_aux(__s, __n); - else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { - __failed = !this->_M_put_widen_aux(__s, __n); - __failed = __failed || - this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - } - else { - __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; - __failed = __failed || !this->_M_put_widen_aux(__s, __n); - } - - this->width(0); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - - if (__failed) - this->setstate(ios_base::failbit); - } -} - -template -bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s, - streamsize __n) { - basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); - - for ( ; __n > 0 ; --__n) - if (this->_S_eof(__buf->sputc(this->widen(*__s++)))) - return false; - return true; -} - -// Unformatted output of a single character. -template -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::put(char_type __c) { - sentry __sentry(*this); - bool __failed = true; - - if (__sentry) { - _STLP_TRY { - __failed = this->_S_eof(this->rdbuf()->sputc(__c)); - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - } - - if (__failed) - this->setstate(ios_base::badbit); - - return *this; -} - -// Unformatted output of a single character. -template -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) { - sentry __sentry(*this); - bool __failed = true; - - if (__sentry) { - _STLP_TRY { - __failed = this->rdbuf()->sputn(__s, __n) != __n; - } - _STLP_CATCH_ALL { - this->_M_handle_exception(ios_base::badbit); - } - } - - if (__failed) - this->setstate(ios_base::badbit); - - return *this; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_OSTREAM_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ostream.h b/SDK/stlport/stl/_ostream.h deleted file mode 100644 index 0e4c3643..00000000 --- a/SDK/stlport/stl/_ostream.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -#ifndef _STLP_INTERNAL_OSTREAM_H -#define _STLP_INTERNAL_OSTREAM_H - -#ifndef _STLP_INTERNAL_IOS_H -# include // For basic_ios<>. Includes . -#endif - -#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H -# include -#endif - -#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -template -class _Osentry; -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -bool __init_bostr(basic_ostream<_CharT, _Traits>& __str); - -_STLP_MOVE_TO_STD_NAMESPACE - -//---------------------------------------------------------------------- -// class basic_ostream<> - -template -class basic_ostream : virtual public basic_ios<_CharT, _Traits> { - typedef basic_ostream<_CharT, _Traits> _Self; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - //explicitely defined as private to avoid warnings: - basic_ostream(_Self const&); - _Self& operator = (_Self const&); -#endif - -public: // Types - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - typedef basic_ios<_CharT, _Traits> _Basic_ios; - -public: // Constructor and destructor. - explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf); - ~basic_ostream(); - -public: // Hooks for manipulators. - typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&); - typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&); - typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&); - _Self& operator<< (__ostream_fn __f) { return __f(*this); } - _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; } - _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; } - -private: - bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from, - basic_streambuf<_CharT, _Traits>* __to); - bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from, - basic_streambuf<_CharT, _Traits>* __to); - -public: - void _M_put_char(_CharT __c); - - void _M_put_nowiden(const _CharT* __s); - void _M_put_widen(const char* __s); - bool _M_put_widen_aux(const char* __s, streamsize __n); - -public: // Unformatted output. - _Self& put(char_type __c); - _Self& write(const char_type* __s, streamsize __n); - -public: // Formatted output. - // Formatted output from a streambuf. - _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf); -# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER - // this is needed for compiling with option char = unsigned - _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; } -# endif - _Self& operator<<(short __x); - _Self& operator<<(unsigned short __x); - _Self& operator<<(int __x); -#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) - _Self& operator<<(unsigned int __x); -#else -/* We define this operator with size_t rather than unsigned int to avoid - * 64 bits warning. - */ - _Self& operator<<(size_t __x); -#endif - _Self& operator<<(long __x); - _Self& operator<<(unsigned long __x); -#ifdef _STLP_LONG_LONG - _Self& operator<< (_STLP_LONG_LONG __x); - _Self& operator<< (unsigned _STLP_LONG_LONG __x); -#endif - _Self& operator<<(float __x); - _Self& operator<<(double __x); -# ifndef _STLP_NO_LONG_DOUBLE - _Self& operator<<(long double __x); -# endif - _Self& operator<<(const void* __x); -# ifndef _STLP_NO_BOOL - _Self& operator<<(bool __x); -# endif - -public: // Buffer positioning and manipulation. - _Self& flush() { - if (this->rdbuf()) - if (this->rdbuf()->pubsync() == -1) - this->setstate(ios_base::badbit); - return *this; - } - - pos_type tellp() { - return this->rdbuf() && !this->fail() - ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out) - : pos_type(-1); - } - - _Self& seekp(pos_type __pos) { - if (this->rdbuf() && !this->fail()) { - if (this->rdbuf()->pubseekpos(__pos) == pos_type(-1)) { - this->setstate(ios_base::failbit); - } - } - return *this; - } - - _Self& seekp(off_type __off, ios_base::seekdir __dir) { - if (this->rdbuf() && !this->fail()) - this->rdbuf()->pubseekoff(__off, __dir); - return *this; - } - -#if defined (_STLP_USE_TEMPLATE_EXPORT) - // If we are using DLL specs, we have not to use inner classes - // end class declaration here - typedef _Osentry<_CharT, _Traits> sentry; -}; -# define sentry _Osentry - template - class _Osentry { - typedef _Osentry<_CharT, _Traits> _Self; -#else - class sentry { - typedef sentry _Self; -#endif - private: - basic_ostream<_CharT, _Traits>& _M_str; - // basic_streambuf<_CharT, _Traits>* _M_buf; - bool _M_ok; - public: - explicit sentry(basic_ostream<_CharT, _Traits>& __str) - : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str)) - {} - - ~sentry() { - if (_M_str.flags() & ios_base::unitbuf) -#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) - if (!uncaught_exception()) -#endif - _M_str.flush(); - } - - operator bool() const { return _M_ok; } - private: // Disable assignment and copy constructor. - //Implementation is here only to avoid warning with some compilers. - sentry(const _Self& __s) : _M_str(__s._M_str) {} - _Self& operator=(const _Self&) { return *this; } - }; -#if defined (_STLP_USE_TEMPLATE_EXPORT) -# undef sentry -#else - // close basic_ostream class definition here -}; -#endif - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_ostream >; -_STLP_EXPORT_TEMPLATE_CLASS _Osentry >; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_ostream >; -_STLP_EXPORT_TEMPLATE_CLASS _Osentry >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Helper functions for istream<>::sentry constructor. -template -bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) { - if (__str.good()) { - // boris : check if this is needed ! - if (!__str.rdbuf()) - __str.setstate(ios_base::badbit); - if (__str.tie()) - __str.tie()->flush(); - return __str.good(); - } - else - return false; -} - -template -inline basic_streambuf<_CharT, _Traits>* _STLP_CALL -__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St) -{ return __St.rdbuf(); } - -_STLP_MOVE_TO_STD_NAMESPACE - -// Non-member functions. -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){ - __os._M_put_char(__c); - return __os; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) { - __os._M_put_nowiden(__s); - return __os; -} - -#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) -// some specializations - -inline basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __os, char __c) { - __os._M_put_char(__c); - return __os; -} - -inline basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __os, signed char __c) { - __os._M_put_char(__c); - return __os; -} - -inline basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __os, unsigned char __c) { - __os._M_put_char(__c); - return __os; -} - -inline basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __os, const char* __s) { - __os._M_put_nowiden(__s); - return __os; -} - -inline basic_ostream >& _STLP_CALL -operator<<(basic_ostream >& __os, const signed char* __s) { - __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); - return __os; -} - -inline basic_ostream >& -operator<<(basic_ostream >& __os, const unsigned char* __s) { - __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); - return __os; -} - -#else - -// also for compilers who might use that -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) { - __os._M_put_char(__os.widen(__c)); - return __os; -} - -template -inline basic_ostream& _STLP_CALL -operator<<(basic_ostream& __os, char __c) { - __os._M_put_char(__c); - return __os; -} - -template -inline basic_ostream& _STLP_CALL -operator<<(basic_ostream& __os, signed char __c) { - __os._M_put_char(__c); - return __os; -} - -template -inline basic_ostream& _STLP_CALL -operator<<(basic_ostream& __os, unsigned char __c) { - __os._M_put_char(__c); - return __os; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) { - __os._M_put_widen(__s); - return __os; -} - -template -inline basic_ostream& _STLP_CALL -operator<<(basic_ostream& __os, const char* __s) { - __os._M_put_nowiden(__s); - return __os; -} - -template -inline basic_ostream& _STLP_CALL -operator<<(basic_ostream& __os, const signed char* __s) { - __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); - return __os; -} - -template -inline basic_ostream& -operator<<(basic_ostream& __os, const unsigned char* __s) { - __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); - return __os; -} -#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */ - -//---------------------------------------------------------------------- -// basic_ostream manipulators. - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -endl(basic_ostream<_CharT, _Traits>& __os) { - __os.put(__os.widen('\n')); - __os.flush(); - return __os; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -ends(basic_ostream<_CharT, _Traits>& __os) { - __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT)); - return __os; -} - -template -inline basic_ostream<_CharT, _Traits>& _STLP_CALL -flush(basic_ostream<_CharT, _Traits>& __os) { - __os.flush(); - return __os; -} - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_OSTREAM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ostreambuf_iterator.h b/SDK/stlport/stl/_ostreambuf_iterator.h deleted file mode 100644 index d8865493..00000000 --- a/SDK/stlport/stl/_ostreambuf_iterator.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H -#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -extern basic_streambuf<_CharT, _Traits>* _STLP_CALL __get_ostreambuf(basic_ostream<_CharT, _Traits>&); - -_STLP_MOVE_TO_STD_NAMESPACE - -// The default template argument is declared in iosfwd -template -class ostreambuf_iterator : - public iterator { -public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename _Traits::int_type int_type; - typedef basic_streambuf<_CharT, _Traits> streambuf_type; - typedef basic_ostream<_CharT, _Traits> ostream_type; - - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - -public: - ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {} - // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(__get_ostreambuf(__o)), _M_ok(_M_buf != 0) {} - inline ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW; - - ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) { - _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c), - traits_type::eof()); - return *this; - } - - ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; } - ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; } - ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; } - - bool failed() const { return !_M_ok; } - -private: - streambuf_type* _M_buf; - bool _M_ok; -}; - -template -inline ostreambuf_iterator<_CharT, _Traits>::ostreambuf_iterator(basic_ostream<_CharT, _Traits>& __o) _STLP_NOTHROW - : _M_buf(_STLP_PRIV __get_ostreambuf(__o)), _M_ok(_M_buf != 0) {} - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator >; -# if defined (INSTANTIATE_WIDE_STREAMS) -_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -template -inline output_iterator_tag _STLP_CALL -iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); } -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_pair.h b/SDK/stlport/stl/_pair.h deleted file mode 100644 index d431fe08..00000000 --- a/SDK/stlport/stl/_pair.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_PAIR_H -#define _STLP_INTERNAL_PAIR_H - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -# include -#endif - -#ifndef _STLP_MOVE_CONSTRUCT_FWK_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -struct pair { - typedef _T1 first_type; - typedef _T2 second_type; - - _T1 first; - _T2 second; -#if defined (_STLP_CONST_CONSTRUCTOR_BUG) - pair() {} -#else - pair() : first(_T1()), second(_T2()) {} -#endif - pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} - -#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200)) - template - pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} - - pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {} -#endif - - pair(__move_source > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)), - second(_STLP_PRIV _AsMoveSource(src.get().second)) - {} - - __TRIVIAL_DESTRUCTOR(pair) -}; - -template -inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ return __x.first == __y.first && __x.second == __y.second; } - -template -inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { - return __x.first < __y.first || - (!(__y.first < __x.first) && __x.second < __y.second); -} - -#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -template -inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ return !(__x == __y); } - -template -inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ return !(__y < __x); } - -template -inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) -{ return !(__x < __y); } -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS) -template -inline pair<_T1, _T2 const*> make_pair(_T1 const& __x, - _T2 const (&__y)[_Sz]) -{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); } - -template -inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz], - _T2 const& __y) -{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); } - -template -inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1], - _T2 const (&__y)[_Sz2]) { - return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x), - static_cast<_T2 const*>(__y)); -} -#endif - -template -inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y) -{ return pair<_T1, _T2>(__x, __y); } - -_STLP_END_NAMESPACE - -#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -_STLP_BEGIN_RELOPS_NAMESPACE - -template -inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y) -{ return !(__x == __y); } - -template -inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y) -{ return !(__y < __x); } - -template -inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y) -{ return !(__x < __y); } - -_STLP_END_RELOPS_NAMESPACE -#endif - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -_STLP_BEGIN_NAMESPACE - -template -struct __type_traits > { - typedef __type_traits<_T1> _T1Traits; - typedef __type_traits<_T2> _T2Traits; - typedef typename _Land2::_Ret has_trivial_default_constructor; - typedef typename _Land2::_Ret has_trivial_copy_constructor; - typedef typename _Land2::_Ret has_trivial_assignment_operator; - typedef typename _Land2::_Ret has_trivial_destructor; - typedef __false_type is_POD_type; - -#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) - // disable incorrect "dependent type qualifier" error - typedef __false_type implemented; -#endif -}; - -template -struct __move_traits > - : _STLP_PRIV __move_traits_help1<_T1, _T2> {}; - -_STLP_END_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#endif /* _STLP_INTERNAL_PAIR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_prolog.h b/SDK/stlport/stl/_prolog.h deleted file mode 100644 index 1d276562..00000000 --- a/SDK/stlport/stl/_prolog.h +++ /dev/null @@ -1,25 +0,0 @@ -/* NOTE : this header has no guards and is MEANT for multiple inclusion! - * If you are using "header protection" option with your compiler, - * please also find #pragma which disables it and put it here, to - * allow reentrancy of this header. - */ - -#ifdef std -# undef std /* We undef "std" on entry , as STLport headers may include native ones. */ -#endif - -#ifdef _STLP_PROLOG_HEADER_INCLUDED -# error STlport prolog header can not be reincluded as long as epilog has not be included. -#endif - -#define _STLP_PROLOG_HEADER_INCLUDED - -#ifndef _STLP_FEATURES_H -# include -#endif - -/* If the platform provides any specific prolog actions, - * like #pragmas, do include platform-specific prolog file */ -#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) -# include -#endif diff --git a/SDK/stlport/stl/_pthread_alloc.h b/SDK/stlport/stl/_pthread_alloc.h deleted file mode 100644 index 2826185c..00000000 --- a/SDK/stlport/stl/_pthread_alloc.h +++ /dev/null @@ -1,472 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_PTHREAD_ALLOC_H -#define _STLP_PTHREAD_ALLOC_H - -/* - * Pthread-specific node allocator. - * This is similar to the default allocator, except that free-list - * information is kept separately for each thread, avoiding locking. - * This should be reasonably fast even in the presence of threads. - * The down side is that storage may not be well-utilized. - * It is not an error to allocate memory in thread A and deallocate - * it in thread B. But this effectively transfers ownership of the memory, - * so that it can only be reallocated by thread B. Thus this can effectively - * result in a storage leak if it's done on a regular basis. - * It can also result in frequent sharing of - * cache lines among processors, with potentially serious performance - * consequences. - */ - -#if !defined (_STLP_PTHREADS) -# error POSIX specific allocator implementation. Your system do not seems to \ -have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \ -or report to the STLport forum. -#endif - -#if defined (_STLP_USE_NO_IOSTREAMS) -# error You cannot use per thread allocator implementation without building \ -STLport libraries. -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -struct _Pthread_alloc_per_thread_state; - -// Pthread-specific allocator. -class _STLP_CLASS_DECLSPEC _Pthread_alloc { -public: // but only for internal use: - typedef _Pthread_alloc_per_thread_state __state_type; - typedef char value_type; - -public: - // Return a recycled or new per thread state. - static __state_type * _STLP_CALL _S_get_per_thread_state(); - - /* n must be > 0 */ - static void * _STLP_CALL allocate(size_t& __n); - - /* p may not be 0 */ - static void _STLP_CALL deallocate(void *__p, size_t __n); - - // boris : versions for per_thread_allocator - /* n must be > 0 */ - static void * _STLP_CALL allocate(size_t& __n, __state_type* __a); - - /* p may not be 0 */ - static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a); - - static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz); -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -typedef _STLP_PRIV _Pthread_alloc __pthread_alloc; -typedef __pthread_alloc pthread_alloc; - -template -class pthread_allocator : public __stlport_class > { - typedef pthread_alloc _S_Alloc; // The underlying allocator. -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - -#ifdef _STLP_MEMBER_TEMPLATE_CLASSES - template struct rebind { - typedef pthread_allocator<_NewType> other; - }; -#endif - - pthread_allocator() _STLP_NOTHROW {} - pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {} - -#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */ - template pthread_allocator(const pthread_allocator<_OtherType>&) - _STLP_NOTHROW {} -#endif - - ~pthread_allocator() _STLP_NOTHROW {} - - pointer address(reference __x) const { return &__x; } - const_pointer address(const_reference __x) const { return &__x; } - - // __n is permitted to be 0. The C++ standard says nothing about what - // the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - return __ret; - } - else - return 0; - } - - void deallocate(pointer __p, size_type __n) { - _STLP_ASSERT( (__p == 0) == (__n == 0) ) - if (__p != 0) { -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); -#endif - _S_Alloc::deallocate(__p, __n * sizeof(value_type)); - } - } - - size_type max_size() const _STLP_NOTHROW - { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); } - void destroy(pointer _p) { _p->~_Tp(); } - -#if defined (_STLP_NO_EXTENSIONS) - /* STLport extension giving rounded size of an allocated memory buffer - * This method do not have to be part of a user defined allocator implementation - * and won't even be called if such a function was granted. - */ -protected: -#endif - _Tp* allocate(size_type __n, size_type& __allocated_n) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - __allocated_n = __buf_size / sizeof(value_type); - return __ret; - } - else - return 0; - } -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC pthread_allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; -#ifdef _STLP_MEMBER_TEMPLATE_CLASSES - template struct rebind { - typedef pthread_allocator<_NewType> other; - }; -#endif -}; - -template -inline bool operator==(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>& a2) -{ return true; } - -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -template -inline bool operator!=(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>&) -{ return false; } -#endif - - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - -# if defined (_STLP_USE_RAW_SGI_ALLOCATORS) -template -struct _Alloc_traits<_Tp, _Pthread_alloc> -{ typedef __allocator<_Tp, _Pthread_alloc> allocator_type; }; -# endif - -template -struct _Alloc_traits<_Tp, pthread_allocator<_Atype> > -{ typedef pthread_allocator<_Tp> allocator_type; }; - -#endif - -#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) - -template -inline pthread_allocator<_Tp2>& -__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*) -{ return (pthread_allocator<_Tp2>&)__x; } - -template -inline pthread_allocator<_Tp2> -__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*) -{ return pthread_allocator<_Tp2>(); } - -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct __pthread_alloc_type_traits { - typedef typename _IsSTLportClass >::_Ret _STLportAlloc; - //The default allocator implementation which is recognize thanks to the - //__stlport_class inheritance is a stateless object so: - typedef _STLportAlloc has_trivial_default_constructor; - typedef _STLportAlloc has_trivial_copy_constructor; - typedef _STLportAlloc has_trivial_assignment_operator; - typedef _STLportAlloc has_trivial_destructor; - typedef _STLportAlloc is_POD_type; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {}; -#else -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; -# endif -# if defined (_STLP_USE_PTR_SPECIALIZATIONS) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; -# endif -#endif - -// -// per_thread_allocator<> : this allocator always return memory to the same thread -// it was allocated from. -// - -template -class per_thread_allocator { - typedef pthread_alloc _S_Alloc; // The underlying allocator. - typedef pthread_alloc::__state_type __state_type; -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - -#ifdef _STLP_MEMBER_TEMPLATE_CLASSES - template struct rebind { - typedef per_thread_allocator<_NewType> other; - }; -#endif - - per_thread_allocator() _STLP_NOTHROW { - _M_state = _S_Alloc::_S_get_per_thread_state(); - } - per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){} - -#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */ - template per_thread_allocator(const per_thread_allocator<_OtherType>& __a) - _STLP_NOTHROW : _M_state(__a._M_state) {} -#endif - - ~per_thread_allocator() _STLP_NOTHROW {} - - pointer address(reference __x) const { return &__x; } - const_pointer address(const_reference __x) const { return &__x; } - - // __n is permitted to be 0. The C++ standard says nothing about what - // the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - return __ret; - } - else - return 0; - } - - void deallocate(pointer __p, size_type __n) { - _STLP_ASSERT( (__p == 0) == (__n == 0) ) - if (__p != 0) { -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); -#endif - _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state); - } - } - - size_type max_size() const _STLP_NOTHROW - { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); } - void destroy(pointer _p) { _p->~_Tp(); } - - // state is being kept here - __state_type* _M_state; - -#if defined (_STLP_NO_EXTENSIONS) - /* STLport extension giving rounded size of an allocated memory buffer - * This method do not have to be part of a user defined allocator implementation - * and won't even be called if such a function was granted. - */ -protected: -#endif - _Tp* allocate(size_type __n, size_type& __allocated_n) { - if (__n > max_size()) { - __THROW_BAD_ALLOC; - } - if (__n != 0) { - size_type __buf_size = __n * sizeof(value_type); - _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state)); -#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) - if (__ret != 0) { - memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); - } -#endif - __allocated_n = __buf_size / sizeof(value_type); - return __ret; - } - else - return 0; - } -}; - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC per_thread_allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; -#ifdef _STLP_MEMBER_TEMPLATE_CLASSES - template struct rebind { - typedef per_thread_allocator<_NewType> other; - }; -#endif -}; - -template -inline bool operator==(const per_thread_allocator<_T1>& __a1, - const per_thread_allocator<_T2>& __a2) -{ return __a1._M_state == __a2._M_state; } - -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -template -inline bool operator!=(const per_thread_allocator<_T1>& __a1, - const per_thread_allocator<_T2>& __a2) -{ return __a1._M_state != __a2._M_state; } -#endif - - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - -template -struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> > -{ typedef per_thread_allocator<_Tp> allocator_type; }; - -#endif - -#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) - -template -inline per_thread_allocator<_Tp2>& -__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*) -{ return (per_thread_allocator<_Tp2>&)__x; } - -template -inline per_thread_allocator<_Tp2> -__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*) -{ return per_thread_allocator<_Tp2>(); } - -#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct __perthread_alloc_type_traits { - typedef typename _IsSTLportClass >::_Ret _STLportAlloc; - //The default allocator implementation which is recognize thanks to the - //__stlport_class inheritance is a stateless object so: - typedef __false_type has_trivial_default_constructor; - typedef _STLportAlloc has_trivial_copy_constructor; - typedef _STLportAlloc has_trivial_assignment_operator; - typedef _STLportAlloc has_trivial_destructor; - typedef __false_type is_POD_type; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {}; -#else -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; -# endif -# if defined (_STLP_USE_PTR_SPECIALIZATIONS) -_STLP_TEMPLATE_NULL -struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; -# endif -#endif - - -_STLP_END_NAMESPACE - -#endif /* _STLP_PTHREAD_ALLOC */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_ptrs_specialize.h b/SDK/stlport/stl/_ptrs_specialize.h deleted file mode 100644 index 92340db2..00000000 --- a/SDK/stlport/stl/_ptrs_specialize.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _STLP_PTRS_SPECIALIZE_H -#define _STLP_PTRS_SPECIALIZE_H - -#ifndef _STLP_TYPE_TRAITS_H -# include -#endif - -// the following is a workaround for arrow operator problems -#if defined ( _STLP_NO_ARROW_OPERATOR ) -// User wants to disable proxy -> operators -# define _STLP_DEFINE_ARROW_OPERATOR -# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp) -#else -// Compiler can handle generic -> operator. -# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp) -# if defined (__BORLANDC__) -# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); } -# elif defined(__WATCOMC__) -# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; } -# else -# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); } -# endif -#endif /* _STLP_NO_ARROW_OPERATOR */ - -// Important pointers specializations - -#ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS -# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) -# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) -#else -# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<1> {}; -# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \ -_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***) -#endif - -# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Type) - -_STLP_BEGIN_NAMESPACE - -# if !defined ( _STLP_NO_BOOL ) -_STLP_POINTERS_SPECIALIZE( bool ) -# endif -_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void) -# ifndef _STLP_NO_SIGNED_BUILTINS - _STLP_POINTERS_SPECIALIZE( signed char ) -# endif - _STLP_POINTERS_SPECIALIZE( char ) - _STLP_POINTERS_SPECIALIZE( unsigned char ) - _STLP_POINTERS_SPECIALIZE( short ) - _STLP_POINTERS_SPECIALIZE( unsigned short ) - _STLP_POINTERS_SPECIALIZE( int ) - _STLP_POINTERS_SPECIALIZE( unsigned int ) - _STLP_POINTERS_SPECIALIZE( long ) - _STLP_POINTERS_SPECIALIZE( unsigned long ) - _STLP_POINTERS_SPECIALIZE( float ) - _STLP_POINTERS_SPECIALIZE( double ) -# if !defined ( _STLP_NO_LONG_DOUBLE ) - _STLP_POINTERS_SPECIALIZE( long double ) -# endif -# if defined ( _STLP_LONG_LONG) - _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG ) - _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG ) -# endif -#if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) - _STLP_POINTERS_SPECIALIZE( wchar_t ) -# endif - -_STLP_END_NAMESPACE - -# undef _STLP_ARROW_SPECIALIZE -# undef _STLP_ARROW_SPECIALIZE_WITH_PTRS -# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V - -#endif diff --git a/SDK/stlport/stl/_queue.h b/SDK/stlport/stl/_queue.h deleted file mode 100644 index 49206154..00000000 --- a/SDK/stlport/stl/_queue.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_QUEUE_H -#define _STLP_INTERNAL_QUEUE_H - -#ifndef _STLP_INTERNAL_DEQUE_H -# include -#endif - -#ifndef _STLP_INTERNAL_VECTOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_HEAP_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#if defined(__SC__) && !defined(__DMC__) //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp -# define comp _Comp -#endif - -_STLP_BEGIN_NAMESPACE - -# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) -template > -# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) -# define _STLP_QUEUE_ARGS _Tp -template -# else -template -# endif -class queue -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) -# if defined (_STLP_QUEUE_ARGS) - : public __stlport_class > -# else - : public __stlport_class > -# endif -#endif -{ -# if defined ( _STLP_QUEUE_ARGS ) - typedef deque<_Tp> _Sequence; - typedef queue<_Tp> _Self; -# else - typedef queue<_Tp, _Sequence> _Self; -# endif -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; - -protected: - //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant. - _Sequence c; -public: - queue() : c() {} - explicit queue(const _Sequence& __c) : c(__c) {} - - queue(__move_source<_Self> src) - : c(_STLP_PRIV _AsMoveSource(src.get().c)) {} - - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - reference front() { return c.front(); } - const_reference front() const { return c.front(); } - reference back() { return c.back(); } - const_reference back() const { return c.back(); } - void push(const value_type& __x) { c.push_back(__x); } - void pop() { c.pop_front(); } - const _Sequence& _Get_s() const { return c; } -}; - -#ifndef _STLP_QUEUE_ARGS -# define _STLP_QUEUE_ARGS _Tp, _Sequence -# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence -#else -# define _STLP_QUEUE_HEADER_ARGS class _Tp -#endif - -template < _STLP_QUEUE_HEADER_ARGS > -inline bool _STLP_CALL -operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { - return __x._Get_s() == __y._Get_s(); -} - -template < _STLP_QUEUE_HEADER_ARGS > -inline bool _STLP_CALL -operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { - return __x._Get_s() < __y._Get_s(); -} - -_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > ) - -# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG )) -template , - class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> > -# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) -template -# else -template -# endif -class priority_queue -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) -# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) - : public __stlport_class > -# else - : public __stlport_class > -# endif -#endif -{ -# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS - typedef vector<_Tp> _Sequence; - typedef less< typename vector<_Tp>::value_type> _Compare; - typedef priority_queue<_Tp> _Self; -# else - typedef priority_queue<_Tp, _Sequence, _Compare> _Self; -# endif -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; -protected: - //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant. - _Sequence c; - _Compare comp; -public: - priority_queue() : c() {} - explicit priority_queue(const _Compare& __x) : c(), comp(__x) {} - priority_queue(const _Compare& __x, const _Sequence& __s) - : c(__s), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - - priority_queue(__move_source<_Self> src) - : c(_STLP_PRIV _AsMoveSource(src.get().c)), - comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {} - -#ifdef _STLP_MEMBER_TEMPLATES - template - priority_queue(_InputIterator __first, _InputIterator __last) - : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } - - template - priority_queue(_InputIterator __first, - _InputIterator __last, const _Compare& __x) - : c(__first, __last), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - - template - priority_queue(_InputIterator __first, _InputIterator __last, - const _Compare& __x, const _Sequence& __s) - : c(__s), comp(__x) - { - c.insert(c.end(), __first, __last); - make_heap(c.begin(), c.end(), comp); - } - -#else /* _STLP_MEMBER_TEMPLATES */ - priority_queue(const value_type* __first, const value_type* __last) - : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } - - priority_queue(const value_type* __first, const value_type* __last, - const _Compare& __x) - : c(__first, __last), comp(__x) - { make_heap(c.begin(), c.end(), comp); } - - priority_queue(const value_type* __first, const value_type* __last, - const _Compare& __x, const _Sequence& __c) - : c(__c), comp(__x) - { - c.insert(c.end(), __first, __last); - make_heap(c.begin(), c.end(), comp); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - const_reference top() const { return c.front(); } - void push(const value_type& __x) { - _STLP_TRY { - c.push_back(__x); - push_heap(c.begin(), c.end(), comp); - } - _STLP_UNWIND(c.clear()) - } - void pop() { - _STLP_TRY { - pop_heap(c.begin(), c.end(), comp); - c.pop_back(); - } - _STLP_UNWIND(c.clear()) - } -}; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux<_Sequence> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux2<_Sequence, _Compare> -{}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#undef _STLP_QUEUE_ARGS -#undef _STLP_QUEUE_HEADER_ARGS -#undef comp - -#endif /* _STLP_INTERNAL_QUEUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_range_errors.h b/SDK/stlport/stl/_range_errors.h deleted file mode 100644 index 1f53fdef..00000000 --- a/SDK/stlport/stl/_range_errors.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef _STLP_RANGE_ERRORS_H -#define _STLP_RANGE_ERRORS_H - -// A few places in the STL throw range errors, using standard exception -// classes defined in . This header file provides functions -// to throw those exception objects. - -// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable -// this exception throwing. -#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \ - !defined (_STLP_DONT_THROW_RANGE_ERRORS) -# define _STLP_THROW_RANGE_ERRORS -#endif - -// For the STLport iostreams, only declaration here, definition is in the lib -#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS) -# define _STLP_EXTERN_RANGE_ERRORS -#endif - -_STLP_BEGIN_NAMESPACE -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg); -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg); -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg); -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg); -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg); -void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg); -_STLP_END_NAMESPACE - -#if !defined (_STLP_EXTERN_RANGE_ERRORS) - -# if defined(_STLP_THROW_RANGE_ERRORS) -# ifndef _STLP_INTERNAL_STDEXCEPT -# include -# endif -# ifndef _STLP_STRING -# include -# endif -# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg)) -# else -# if defined (_STLP_RTTI_BUG) -# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0) -# else -# ifndef _STLP_INTERNAL_CSTDLIB -# include -# endif -# ifndef _STLP_INTERNAL_CSTDIO -# include -# endif -# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT() -# endif -# endif - -// For mode without library and throwing range errors, include the -// stdexcept header and throw the appropriate exceptions directly. - -_STLP_BEGIN_NAMESPACE - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg) -{ _STLP_THROW_MSG(runtime_error, __msg); } - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg) -{ _STLP_THROW_MSG(range_error, __msg); } - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) -{ _STLP_THROW_MSG(out_of_range, __msg); } - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg) -{ _STLP_THROW_MSG(length_error, __msg); } - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) -{ _STLP_THROW_MSG(invalid_argument, __msg); } - -inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) -{ _STLP_THROW_MSG(overflow_error, __msg); } - -_STLP_END_NAMESPACE - -# undef _STLP_THROW_MSG - -#endif /* EXTERN_RANGE_ERRORS */ - -#endif /* _STLP_RANGE_ERRORS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_raw_storage_iter.h b/SDK/stlport/stl/_raw_storage_iter.h deleted file mode 100644 index 6e4bc2e9..00000000 --- a/SDK/stlport/stl/_raw_storage_iter.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H -#define _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -class raw_storage_iterator - : public iterator -{ -protected: - _ForwardIterator _M_iter; -public: - typedef output_iterator_tag iterator_category; -# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; -# endif - explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {} - raw_storage_iterator<_ForwardIterator, _Tp>& operator*() { return *this; } - raw_storage_iterator<_ForwardIterator, _Tp>& operator=(const _Tp& __element) { - _Param_Construct(&*_M_iter, __element); - return *this; - } - raw_storage_iterator<_ForwardIterator, _Tp>& operator++() { - ++_M_iter; - return *this; - } - raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) { - raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this; - ++_M_iter; - return __tmp; - } -}; - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES -template -inline output_iterator_tag iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) { return output_iterator_tag(); } -#endif -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_relops_cont.h b/SDK/stlport/stl/_relops_cont.h deleted file mode 100644 index cd8ec050..00000000 --- a/SDK/stlport/stl/_relops_cont.h +++ /dev/null @@ -1,29 +0,0 @@ -// This is an implementation file which -// is intended to be included multiple times with different _STLP_ASSOCIATIVE_CONTAINER -// setting - -#if !defined (_STLP_EQUAL_OPERATOR_SPECIALIZED) -_STLP_TEMPLATE_HEADER -inline bool _STLP_CALL operator==(const _STLP_TEMPLATE_CONTAINER& __x, - const _STLP_TEMPLATE_CONTAINER& __y) { - return __x.size() == __y.size() && - equal(__x.begin(), __x.end(), __y.begin()); -} -#endif /* _STLP_EQUAL_OPERATOR_SPECIALIZED */ - -_STLP_TEMPLATE_HEADER -inline bool _STLP_CALL operator<(const _STLP_TEMPLATE_CONTAINER& __x, - const _STLP_TEMPLATE_CONTAINER& __y) { - return lexicographical_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()); -} - -_STLP_RELOPS_OPERATORS( _STLP_TEMPLATE_HEADER , _STLP_TEMPLATE_CONTAINER ) - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -_STLP_TEMPLATE_HEADER -inline void _STLP_CALL swap(_STLP_TEMPLATE_CONTAINER& __x, - _STLP_TEMPLATE_CONTAINER& __y) { - __x.swap(__y); -} -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ diff --git a/SDK/stlport/stl/_relops_hash_cont.h b/SDK/stlport/stl/_relops_hash_cont.h deleted file mode 100644 index 421c8050..00000000 --- a/SDK/stlport/stl/_relops_hash_cont.h +++ /dev/null @@ -1,13 +0,0 @@ -/* This is an implementation file which is intended to be included - * multiple times with different _STLP_TEMPLATE_CONTAINER settings. - */ - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) - -_STLP_TEMPLATE_HEADER -inline void _STLP_CALL -swap(_STLP_TEMPLATE_CONTAINER& __hm1, _STLP_TEMPLATE_CONTAINER& __hm2) { - __hm1.swap(__hm2); -} - -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ diff --git a/SDK/stlport/stl/_rope.c b/SDK/stlport/stl/_rope.c deleted file mode 100644 index 61a8fda1..00000000 --- a/SDK/stlport/stl/_rope.c +++ /dev/null @@ -1,1433 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf -// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct. -// Results in a valid buf_ptr if the iterator can be legitimately -// dereferenced. -#ifndef _STLP_ROPEIMPL_H -#define _STLP_ROPEIMPL_H - -#ifndef _STLP_INTERNAL_ROPE_H -# include -#endif - -#ifndef _STLP_INTERNAL_CSTDIO -# include -#endif - -#if !defined (_STLP_USE_NO_IOSTREAMS) -# ifndef _STLP_IOSTREAM -# include -# endif -#endif - -#include - -_STLP_BEGIN_NAMESPACE - -# if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -# define __allocator__ _Alloc -# else -# define __allocator__ allocator_type -# endif - -template -_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) - : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos), - _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); } - -template -_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos): - _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos), - _M_root_rope(&__r) { -#if !defined (__DMC__) - _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this); -#else - _Rope_iterator_base<_CharT, _Alloc>* __x = this; - _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x); -#endif -} - -template -void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() { - _CharT* __cstr = _M_c_string; - if (0 != __cstr) { - size_t _p_size = _M_size._M_data + 1; - _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size); - _M_size.deallocate(__cstr, _p_size); - } -} - -// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf -// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct. -// Results in a valid buf_ptr if the iterator can be legitimately -// dereferenced. -template -void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( - _Rope_iterator_base<_CharT,_Alloc>& __x) { - const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index]; - size_t __leaf_pos = __x._M_leaf_pos; - size_t __pos = __x._M_current_pos; - - switch(__leaf->_M_tag) { - case _RopeRep::_S_leaf: - typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf; - __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data; - __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); - __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data; - break; - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - { - size_t __len = _S_iterator_buf_len; - size_t __buf_start_pos = __leaf_pos; - size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data; - typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction; - char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn; - - if (__buf_start_pos + __len <= __pos) { - __buf_start_pos = __pos - __len/4; - if (__buf_start_pos + __len > __leaf_end) { - __buf_start_pos = __leaf_end - __len; - } - } - if (__buf_start_pos + __len > __leaf_end) { - __len = __leaf_end - __buf_start_pos; - } - (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data); - __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos); - __x._M_buf_start = __x._M_tmp_buf._M_data; - __x._M_buf_end = __x._M_tmp_buf._M_data + __len; - } - break; - default: - _STLP_ASSERT(0) - ; - } -} - -// Set path and buffer inside a rope iterator. We assume that -// pos and root are already set. -template -void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache( - _Rope_iterator_base<_CharT,_Alloc>& __x) { - const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1]; - const _RopeRep* __curr_rope; - int __curr_depth = -1; /* index into path */ - size_t __curr_start_pos = 0; - size_t __pos = __x._M_current_pos; - unsigned char __dirns = 0; // Bit vector marking right turns in the path - - _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data) - if (__pos >= __x._M_root->_M_size._M_data) { - __x._M_buf_ptr = 0; - return; - } - __curr_rope = __x._M_root; - if (0 != __curr_rope->_M_c_string) { - /* Treat the root as a leaf. */ - __x._M_buf_start = __curr_rope->_M_c_string; - __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data; - __x._M_buf_ptr = __curr_rope->_M_c_string + __pos; - __x._M_path_end._M_data[0] = __curr_rope; - __x._M_leaf_index = 0; - __x._M_leaf_pos = 0; - return; - } - for(;;) { - ++__curr_depth; - _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth) - __path[__curr_depth] = __curr_rope; - switch(__curr_rope->_M_tag) { - case _RopeRep::_S_leaf: - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - __x._M_leaf_pos = __curr_start_pos; - goto done; - case _RopeRep::_S_concat: - { - const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope); - _RopeRep* __left = __c->_M_left; - size_t __left_len = __left->_M_size._M_data; - - __dirns <<= 1; - if (__pos >= __curr_start_pos + __left_len) { - __dirns |= 1; - __curr_rope = __c->_M_right; - __curr_start_pos += __left_len; - } else { - __curr_rope = __left; - } - } - break; - } - } -done: - // Copy last section of path into _M_path_end. - { - int __i = -1; - int __j = __curr_depth + 1 - _S_path_cache_len; - - if (__j < 0) __j = 0; - while (__j <= __curr_depth) { - __x._M_path_end._M_data[++__i] = __path[__j++]; - } - __x._M_leaf_index = __i; - } - __x._M_path_directions = __dirns; - _S_setbuf(__x); -} - -// Specialized version of the above. Assumes that -// the path cache is valid for the previous position. -template -void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr( -_Rope_iterator_base<_CharT,_Alloc>& __x) { - int __current_index = __x._M_leaf_index; - const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index]; - size_t __len = __current_node->_M_size._M_data; - size_t __node_start_pos = __x._M_leaf_pos; - unsigned char __dirns = __x._M_path_directions; - const _RopeConcat* __c; - - _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data) - if (__x._M_current_pos - __node_start_pos < __len) { - /* More stuff in this leaf, we just didn't cache it. */ - _S_setbuf(__x); - return; - } - _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos) - // node_start_pos is starting position of last_node. - while (--__current_index >= 0) { - if (!(__dirns & 1) /* Path turned left */) - break; - __current_node = __x._M_path_end._M_data[__current_index]; - __c = __STATIC_CAST(const _RopeConcat*, __current_node); - // Otherwise we were in the right child. Thus we should pop - // the concatenation node. - __node_start_pos -= __c->_M_left->_M_size._M_data; - __dirns >>= 1; - } - if (__current_index < 0) { - // We underflowed the cache. Punt. - _S_setcache(__x); - return; - } - __current_node = __x._M_path_end._M_data[__current_index]; - __c = __STATIC_CAST(const _RopeConcat*, __current_node); - // current_node is a concatenation node. We are positioned on the first - // character in its right child. - // node_start_pos is starting position of current_node. - __node_start_pos += __c->_M_left->_M_size._M_data; - __current_node = __c->_M_right; - __x._M_path_end._M_data[++__current_index] = __current_node; - __dirns |= 1; - while (_RopeRep::_S_concat == __current_node->_M_tag) { - ++__current_index; - if (_S_path_cache_len == __current_index) { - int __i; - for (__i = 0; __i < _S_path_cache_len-1; ++__i) { - __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1]; - } - --__current_index; - } - __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left; - __x._M_path_end._M_data[__current_index] = __current_node; - __dirns <<= 1; - // node_start_pos is unchanged. - } - __x._M_leaf_index = __current_index; - __x._M_leaf_pos = __node_start_pos; - __x._M_path_directions = __dirns; - _S_setbuf(__x); -} - -template -void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) { - _M_current_pos += __n; - if (0 != _M_buf_ptr) { - size_t __chars_left = _M_buf_end - _M_buf_ptr; - if (__chars_left > __n) { - _M_buf_ptr += __n; - } else if (__chars_left == __n) { - _M_buf_ptr += __n; - _S_setcache_for_incr(*this); - } else { - _M_buf_ptr = 0; - } - } -} - -template -void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) { - if (0 != _M_buf_ptr) { - size_t __chars_left = _M_buf_ptr - _M_buf_start; - if (__chars_left >= __n) { - _M_buf_ptr -= __n; - } else { - _M_buf_ptr = 0; - } - } - _M_current_pos -= __n; -} - -template -void _Rope_iterator<_CharT,_Alloc>::_M_check() { - if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) { - // _Rope was modified. Get things fixed up. - _RopeRep::_S_unref(this->_M_root); - this->_M_root = _M_root_rope->_M_tree_ptr._M_data; - _RopeRep::_S_ref(this->_M_root); - this->_M_buf_ptr = 0; - } -} - -// There are several reasons for not doing this with virtual destructors -// and a class specific delete operator: -// - A class specific delete operator can't easily get access to -// allocator instances if we need them. -// - Any virtual function would need a 4 or byte vtable pointer; -// this only requires a one byte tag per object. -template -void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() { - switch (_M_tag) { - case _S_leaf: - { - typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf; - _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this); - _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf(); - _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size, - _RopeLeaf).deallocate(__l, 1); - break; - } - case _S_concat: - { - typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation; - _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this); - _STLP_STD::_Destroy(__c); - _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size, - _RopeConcatenation).deallocate(__c, 1); - break; - } - case _S_function: - { - typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction; - _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this); - _STLP_STD::_Destroy(__f); - _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size, - _RopeFunction).deallocate(__f, 1); - break; - } - case _S_substringfn: - { - typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring; - _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this); - _STLP_STD::_Destroy(__rss); - _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size, - _RopeSubstring).deallocate(__rss, 1); - break; - } - } -} - -# if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc> -# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc> -# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc> -# define _RopeRep _Rope_RopeRep<_CharT,_Alloc> -# define size_type size_t -# else -# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf -# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep -# endif - -template -void rope<_CharT, _Alloc>::_M_throw_out_of_range() const { - __stl_throw_out_of_range("rope"); -} - -// Concatenate a C string onto a leaf rope by copying the rope data. -// Used for short ropes. -template -__RopeLeaf__* -rope<_CharT,_Alloc>::_S_leaf_concat_char_iter ( - _RopeLeaf* __r, const _CharT* __iter, size_t __len) { - size_t __old_len = __r->_M_size._M_data; - _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len)); - _RopeLeaf* __result; - - _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data); - _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len); - _S_construct_null(__new_data + __old_len + __len); - _STLP_TRY { - __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator()); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len, - __r->get_allocator())) - return __result; -} - -template -void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r, - size_t __size, const __true_type& /*basic char type*/) { - _S_construct_null(__r->_M_data + __size); - _STLP_ASSERT(__r->_M_c_string == __r->_M_data) -} - -template -void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r, - size_t, const __false_type& /*basic char type*/) { - if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) { - __r->_M_free_c_string(); - __r->_M_c_string = 0; - } -} - -// As above, but it's OK to clobber original if refcount is 1 -template -__RopeLeaf__* -rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) { - //_STLP_ASSERT(__r->_M_ref_count >= 1) - if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr - __r->_M_decr(); // - ptr - return _S_leaf_concat_char_iter(__r, __iter, __len); - } - __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0 - size_t __old_len = __r->_M_size._M_data; - if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) { - // The space has been partially initialized for the standard - // character types. But that doesn't matter for those types. - _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len); - _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType()); - __r->_M_size._M_data = __old_len + __len; - // _STLP_ASSERT(__r->_M_ref_count == 1) - // __r->_M_ref_count = 2; - __r->_M_incr(); // i.e. __r->_M_ref_count = 2 - return __r; - } else { - _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len); - //_STLP_ASSERT(__result->_M_ref_count == 1) - return __result; - } -} - -// Assumes left and right are not 0. -// Does not increment (nor decrement on exception) child reference counts. -// Result has ref count 1. -template -__RopeRep__* -rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) { - _RopeConcatenation* __result = - _S_new_RopeConcatenation(__left, __right, __left->get_allocator()); - size_t __depth = __result->_M_depth; - - _STLP_ASSERT(__left->get_allocator() == __right->get_allocator()) - if (__depth > 20 && (__result->_M_size._M_data < 1000 || - __depth > _RopeRep::_S_max_rope_depth)) { - _RopeRep* __balanced; - - _STLP_TRY { - __balanced = _S_balance(__result); - // _STLP_ASSERT(__result == __balanced || - // 1 == __result->_M_ref_count && - // 1 == __balanced->_M_ref_count) - __result->_M_unref_nonnil(); - } - _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size, - _RopeConcatenation).deallocate(__result,1))) - // In case of exception, we need to deallocate - // otherwise dangling result node. But caller - // still owns its children. Thus unref is - // inappropriate. - return __balanced; - } else { - return __result; - } -} - -template -__RopeRep__* -rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r, - const _CharT*__s, size_t __slen) { - _RopeRep* __result; - if (0 == __slen) { - _S_ref(__r); - return __r; - } - if (0 == __r) - return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); - if (_RopeRep::_S_leaf == __r->_M_tag && - __r->_M_size._M_data + __slen <= _S_copy_max) { - __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); - // _STLP_ASSERT(1 == __result->_M_ref_count) - return __result; - } - if (_RopeRep::_S_concat == __r->_M_tag && - _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) { - _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); - if (__right->_M_size._M_data + __slen <= _S_copy_max) { - _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; - _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); - __left->_M_ref_nonnil(); - _STLP_TRY { - __result = _S_tree_concat(__left, __nright); - } - _STLP_UNWIND(_S_unref(__left); _S_unref(__nright)) - // _STLP_ASSERT(1 == __result->_M_ref_count) - return __result; - } - } - _RopeRep* __nright = - _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); - _STLP_TRY { - __r->_M_ref_nonnil(); - __result = _S_tree_concat(__r, __nright); - } - _STLP_UNWIND(_S_unref(__r); _S_unref(__nright)) - // _STLP_ASSERT(1 == __result->_M_ref_count) - return __result; -} - -template -__RopeRep__* -rope<_CharT,_Alloc>::_S_destr_concat_char_iter( - _RopeRep* __r, const _CharT* __s, size_t __slen) { - _RopeRep* __result; - if (0 == __r) - return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, - __r->get_allocator()); - // size_t __count = __r->_M_ref_count; - size_t __orig_size = __r->_M_size._M_data; - // _STLP_ASSERT(__count >= 1) - if ( /* __count > 1 */ __r->_M_incr() > 2 ) { - __r->_M_decr(); - return _S_concat_char_iter(__r, __s, __slen); - } - if (0 == __slen) { - return __r; - } - __r->_M_decr(); - if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) { - return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); - } - if (_RopeRep::_S_concat == __r->_M_tag) { - _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right); - if (_RopeRep::_S_leaf == __right->_M_tag && - __right->_M_size._M_data + __slen <= _S_copy_max) { - _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen); - if (__right == __new_right) { - // _STLP_ASSERT(__new_right->_M_ref_count == 2) - // __new_right->_M_ref_count = 1; - __new_right->_M_decr(); - } else { - // _STLP_ASSERT(__new_right->_M_ref_count >= 1) - __right->_M_unref_nonnil(); - } - // _STLP_ASSERT(__r->_M_ref_count == 1) - // __r->_M_ref_count = 2; // One more than before. - __r->_M_incr(); - __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right; - // E.Musser : moved below - // __r->_M_size._M_data = __orig_size + __slen; - if (0 != __r->_M_c_string) { - __r->_M_free_c_string(); - __r->_M_c_string = 0; - } - __r->_M_size._M_data = __orig_size + __slen; - return __r; - } - } - _RopeRep* __right = - _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); - __r->_M_ref_nonnil(); - _STLP_TRY { - __result = _S_tree_concat(__r, __right); - } - _STLP_UNWIND(_S_unref(__r); _S_unref(__right)) - // _STLP_ASSERT(1 == __result->_M_ref_count) - return __result; -} - -template -__RopeRep__* -rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) { - if (0 == __left) { - _S_ref(__right); - return __right; - } - if (0 == __right) { - __left->_M_ref_nonnil(); - return __left; - } - if (_RopeRep::_S_leaf == __right->_M_tag) { - if (_RopeRep::_S_leaf == __left->_M_tag) { - if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) { - return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left), - __STATIC_CAST(_RopeLeaf*, __right)->_M_data, - __right->_M_size._M_data); - } - } else if (_RopeRep::_S_concat == __left->_M_tag && - _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) { - _RopeLeaf* __leftright = - __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right); - if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) { - _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left; - _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, - __STATIC_CAST(_RopeLeaf*, __right)->_M_data, - __right->_M_size._M_data); - __leftleft->_M_ref_nonnil(); - _STLP_TRY { - return _S_tree_concat(__leftleft, __rest); - } - _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest)) - } - } - } - __left->_M_ref_nonnil(); - __right->_M_ref_nonnil(); - _STLP_TRY { - return _S_tree_concat(__left, __right); - } - _STLP_UNWIND(_S_unref(__left); _S_unref(__right)) - _STLP_RET_AFTER_THROW(0) -} - -template -__RopeRep__* -rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base, - size_t __start, size_t __endp1) { - if (0 == __base) return 0; - size_t __len = __base->_M_size._M_data; - size_t __adj_endp1; - const size_t __lazy_threshold = 128; - - if (__endp1 >= __len) { - if (0 == __start) { - __base->_M_ref_nonnil(); - return __base; - } else { - __adj_endp1 = __len; - } - } else { - __adj_endp1 = __endp1; - } - switch(__base->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base); - _RopeRep* __left = __c->_M_left; - _RopeRep* __right = __c->_M_right; - size_t __left_len = __left->_M_size._M_data; - _RopeRep* __result; - - if (__adj_endp1 <= __left_len) { - return _S_substring(__left, __start, __endp1); - } else if (__start >= __left_len) { - return _S_substring(__right, __start - __left_len, - __adj_endp1 - __left_len); - } - _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len)); - _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len)); - _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block - __result = _S_concat_rep(__left_result, __right_result); - // _STLP_ASSERT(1 == __result->_M_ref_count) - return __result; - _STLP_MPWFIX_CATCH //*TY 06/01/2000 - - } - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base); - _RopeLeaf* __result; - size_t __result_len; - if (__start >= __adj_endp1) return 0; - __result_len = __adj_endp1 - __start; - if (__result_len > __lazy_threshold) goto lazy; - const _CharT* __section = __l->_M_data + __start; - // We should sometimes create substring node instead. - __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len, - __base->get_allocator()); - return __result; - } - case _RopeRep::_S_substringfn: - // Avoid introducing multiple layers of substring nodes. - { - _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base); - size_t __result_len; - if (__start >= __adj_endp1) return 0; - __result_len = __adj_endp1 - __start; - if (__result_len > __lazy_threshold) { - _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base, - __start + __old->_M_start, - __adj_endp1 - __start, - __base->get_allocator()); - return __result; - } // *** else fall through: *** - } - case _RopeRep::_S_function: - { - _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base); - if (__start >= __adj_endp1) return 0; - size_t __result_len = __adj_endp1 - __start; - - if (__result_len > __lazy_threshold) goto lazy; - _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len)); - _STLP_TRY { - (*(__f->_M_fn))(__start, __result_len, __section); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__section, - __result_len, __base->get_allocator())) - _S_construct_null(__section + __result_len); - return _S_new_RopeLeaf(__section, __result_len, - __base->get_allocator()); - } - } - /*NOTREACHED*/ - _STLP_ASSERT(false) - lazy: - { - // Create substring node. - return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start, - __base->get_allocator()); - } -} - -template -class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { -private: - _CharT* _M_buf_ptr; -public: - _Rope_flatten_char_consumer(_CharT* __buffer) { - _M_buf_ptr = __buffer; - } - ~_Rope_flatten_char_consumer() {} - bool operator() (const _CharT* __leaf, size_t __n) { - _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr); - _M_buf_ptr += __n; - return true; - } -}; - -template -class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { -private: - _CharT _M_pattern; -public: - size_t _M_count; // Number of nonmatching characters - _Rope_find_char_char_consumer(_CharT __p) - : _M_pattern(__p), _M_count(0) {} - ~_Rope_find_char_char_consumer() {} - bool operator() (const _CharT* __leaf, size_t __n) { - size_t __i; - for (__i = 0; __i < __n; ++__i) { - if (__leaf[__i] == _M_pattern) { - _M_count += __i; return false; - } - } - _M_count += __n; return true; - } -}; - -#if !defined (_STLP_USE_NO_IOSTREAMS) -template -// Here _CharT is both the stream and rope character type. -class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { -private: - typedef basic_ostream<_CharT,_Traits> _Insert_ostream; - typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self; - _Insert_ostream& _M_o; - - //explicitely defined as private to avoid warnings: - _Self& operator = (_Self const&); -public: - _Rope_insert_char_consumer(_Insert_ostream& __writer) - : _M_o(__writer) {} -# if defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable - ~_Rope_insert_char_consumer(); //*TY 05/23/2000 - -# else //*TY 05/23/2000 - - ~_Rope_insert_char_consumer() {} -# endif //*TY 05/23/2000 - - // Caller is presumed to own the ostream - bool operator() (const _CharT* __leaf, size_t __n); - // Returns true to continue traversal. -}; - -# if defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable -template -_Rope_insert_char_consumer<_CharT, _Traits>:: ~_Rope_insert_char_consumer() {} -# endif //*TY 05/23/2000 - - -template -bool _Rope_insert_char_consumer<_CharT, _Traits>::operator() - (const _CharT* __leaf, size_t __n) { - size_t __i; - // We assume that formatting is set up correctly for each element. - for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]); - return true; -} -#endif /* !_STLP_USE_NO_IOSTREAMS */ - -template -bool _S_apply_to_pieces(_CharConsumer& __c, - _Rope_RopeRep<_CharT, _Alloc> * __r, - size_t __begin, size_t __end) { - typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; - typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; - typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; - typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; - - if (0 == __r) return true; - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r); - _RopeRep* __left = __conc->_M_left; - size_t __left_len = __left->_M_size._M_data; - if (__begin < __left_len) { - size_t __left_end = (min) (__left_len, __end); - if (!_S_apply_to_pieces(__c, __left, __begin, __left_end)) - return false; - } - if (__end > __left_len) { - _RopeRep* __right = __conc->_M_right; - size_t __right_start = (max)(__left_len, __begin); - if (!_S_apply_to_pieces(__c, __right, - __right_start - __left_len, - __end - __left_len)) { - return false; - } - } - } - return true; - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r); - return __c(__l->_M_data + __begin, __end - __begin); - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - { - _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r); - size_t __len = __end - __begin; - bool __result; - _CharT* __buffer = __r->get_allocator().allocate(__len); - _STLP_TRY { - (*(__f->_M_fn))(__begin, __len, __buffer); - __result = __c(__buffer, __len); - __r->get_allocator().deallocate(__buffer, __len); - } - _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len))) - return __result; - } - default: - _STLP_ASSERT(false) - /*NOTREACHED*/ - return false; - } -} - -#if !defined (_STLP_USE_NO_IOSTREAMS) -template -inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) { - char __f = __o.fill(); - for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f); -} - -template -basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o, - const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) { - streamsize __w = __o.width(); - const bool __left = (__o.flags() & ios::left) != 0; - size_t __rope_len = __r.size(); - _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); - - const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) || - ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w)))); - streamsize __pad_len = __need_pad ? __w - __rope_len : 0; - - if (!__left && __pad_len > 0) { - _Rope_fill(__o, __pad_len); - } - __r.apply_to_pieces(0, __rope_len, __c); - if (__left && __pad_len > 0) { - _Rope_fill(__o, __pad_len); - } - return __o; -} - -template -basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o, - const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) { - streamsize __w = __o.width(); - size_t __rope_len = __r.size(); - _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); - - __o.width(__w /__rope_len); - _STLP_TRY { - __r.apply_to_pieces(0, __rope_len, __c); - __o.width(__w); - } - _STLP_UNWIND(__o.width(__w)) - return __o; -} - -template -basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o, - const rope<_CharT, _Alloc>& __r) { - typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral; - return _S_io_get(__o, __r, _Char_Is_Integral()); -} -#endif /* NO_IOSTREAMS */ - -template -_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r, - size_t __start, size_t __len, - _CharT* __buffer) { - _Rope_flatten_char_consumer<_CharT> __c(__buffer); - _S_apply_to_pieces(__c, __r, __start, __start + __len); - return(__buffer + __len); -} - -template -size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const { - _Rope_find_char_char_consumer<_CharT> __c(__pattern); - _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size()); - size_type __result_pos = __start + __c._M_count; -#ifndef _STLP_OLD_ROPE_SEMANTICS - if (__result_pos == size()) __result_pos = npos; -#endif - return __result_pos; -} - -template -_CharT* -rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) { - if (0 == __r) return __buffer; - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r); - _RopeRep* __left = __c->_M_left; - _RopeRep* __right = __c->_M_right; - _CharT* __rest = _S_flatten(__left, __buffer); - return _S_flatten(__right, __rest); - } - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r); - return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second; - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - // We dont yet do anything with substring nodes. - // This needs to be fixed before ropefiles will work well. - { - _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r); - (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer); - return __buffer + __f->_M_size._M_data; - } - default: - _STLP_ASSERT(false) - /*NOTREACHED*/ - return 0; - } -} - -#ifdef _STLP_DEBUG -// This needs work for _CharT != char -template -void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) { - for (int __i = 0; __i < __indent; ++__i) putchar(' '); - if (0 == __r) { - printf("NULL\n"); return; - } - if (_RopeRep::_S_concat == __r->_M_tag) { - _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r); - _RopeRep* __left = __c->_M_left; - _RopeRep* __right = __c->_M_right; - printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n", - __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data, - __r->_M_is_balanced? "" : "not"); - _S_dump(__left, __indent + 2); - _S_dump(__right, __indent + 2); - return; - } - else { - const char* __kind; - - switch (__r->_M_tag) { - case _RopeRep::_S_leaf: - __kind = "Leaf"; - break; - case _RopeRep::_S_function: - __kind = "Function"; - break; - case _RopeRep::_S_substringfn: - __kind = "Function representing substring"; - break; - default: - __kind = "(corrupted kind field!)"; - } - printf("%s %p (rc = %ld, depth = %d, len = %ld) ", - __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data); - if (sizeof(_CharT) == 1) { - const int __max_len = 40; - _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len)); - _CharT __buffer[__max_len + 1]; - bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data; - - _S_flatten(__prefix, __buffer); - __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT); - printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n"); - } else { - printf("\n"); - } - } -} -#endif /* _STLP_DEBUG */ - -# define __ROPE_TABLE_BODY = { \ -/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \ -/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \ -/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \ -/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \ -/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \ -/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \ -/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \ -/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \ -/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \ -/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \ -/* 45 */2971215073ul } - -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 ) -template -const unsigned long -rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY; -# else -__DECLARE_INSTANCE(const unsigned long, - crope::_S_min_len[__ROPE_DEPTH_SIZE], - __ROPE_TABLE_BODY); -# ifndef _STLP_NO_WCHAR_T -__DECLARE_INSTANCE(const unsigned long, - wrope::_S_min_len[__ROPE_DEPTH_SIZE], - __ROPE_TABLE_BODY); -# endif -# endif -# undef __ROPE_DEPTH_SIZE -# undef __ROPE_MAX_DEPTH -# undef __ROPE_TABLE_BODY - -// These are Fibonacci numbers < 2**32. - -template -__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) { - _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0}; - _RopeRep* __result = 0; - int __i; - // Invariant: - // The concatenation of forest in descending order is equal to __r. - // __forest[__i]._M_size._M_data >= _S_min_len[__i] - // __forest[__i]._M_depth = __i - // References from forest are included in refcount. - - _STLP_TRY { - _S_add_to_forest(__r, __forest); - for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) - if (0 != __forest[__i]) { - _Self_destruct_ptr __old(__result); - __result = _S_concat_rep(__forest[__i], __result); - __forest[__i]->_M_unref_nonnil(); -# ifdef _STLP_USE_EXCEPTIONS - __forest[__i] = 0; -# endif - } - } - _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) - _S_unref(__forest[__i])) - if (__result->_M_depth > _RopeRep::_S_max_rope_depth) { - __stl_throw_range_error("rope too long"); - } - return(__result); -} - - -template -void -rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest) -{ - if (__r -> _M_is_balanced) { - _S_add_leaf_to_forest(__r, __forest); - return; - } - _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat) - { - _RopeConcatenation* __c = (_RopeConcatenation*)__r; - - _S_add_to_forest(__c->_M_left, __forest); - _S_add_to_forest(__c->_M_right, __forest); - } -} - - -template -void -rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) -{ - _RopeRep* __insertee; // included in refcount - _RopeRep* __too_tiny = 0; // included in refcount - int __i; // forest[0..__i-1] is empty - size_t __s = __r->_M_size._M_data; - - for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) { - if (0 != __forest[__i]) { - _Self_destruct_ptr __old(__too_tiny); - __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny); - __forest[__i]->_M_unref_nonnil(); - __forest[__i] = 0; - } - } - { - _Self_destruct_ptr __old(__too_tiny); - __insertee = _S_concat_and_set_balanced(__too_tiny, __r); - } - // Too_tiny dead, and no longer included in refcount. - // Insertee is live and included. - _STLP_ASSERT(_S_is_almost_balanced(__insertee)) - _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1) - for (;; ++__i) { - if (0 != __forest[__i]) { - _Self_destruct_ptr __old(__insertee); - __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee); - __forest[__i]->_M_unref_nonnil(); - __forest[__i] = 0; - _STLP_ASSERT(_S_is_almost_balanced(__insertee)) - } - _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data) - _STLP_ASSERT(__forest[__i] == 0) - if (__i == _RopeRep::_S_max_rope_depth || - __insertee->_M_size._M_data < _S_min_len[__i+1]) { - __forest[__i] = __insertee; - // refcount is OK since __insertee is now dead. - return; - } - } -} - -template -_CharT -rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i) -{ - _CharT* __cstr = __r->_M_c_string; - - _STLP_ASSERT(__i < __r->_M_size._M_data) - if (0 != __cstr) return __cstr[__i]; - for(;;) { - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = (_RopeConcatenation*)__r; - _RopeRep* __left = __c->_M_left; - size_t __left_len = __left->_M_size._M_data; - - if (__i >= __left_len) { - __i -= __left_len; - __r = __c->_M_right; - } else { - __r = __left; - } - } - break; - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = (_RopeLeaf*)__r; - return __l->_M_data[__i]; - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - { - _RopeFunction* __f = (_RopeFunction*)__r; - _CharT __result; - - (*(__f->_M_fn))(__i, 1, &__result); - return __result; - } - } - } -#if defined(_STLP_NEED_UNREACHABLE_RETURN) - return 0; -#endif -} - -// Return a uniquely referenced character slot for the given -// position, or 0 if that's not possible. -template -_CharT* -rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i) -{ - _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth]; - size_t __csptr = 0; - - for(;;) { - // if (__r->_M_ref_count > 1) return 0; - if ( __r->_M_incr() > 2 ) { - __r->_M_decr(); - return 0; - } - switch(__r->_M_tag) { - case _RopeRep::_S_concat: - { - _RopeConcatenation* __c = (_RopeConcatenation*)__r; - _RopeRep* __left = __c->_M_left; - size_t __left_len = __left->_M_size._M_data; - - if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c; - if (__i >= __left_len) { - __i -= __left_len; - __r = __c->_M_right; - } else { - __r = __left; - } - } - break; - case _RopeRep::_S_leaf: - { - _RopeLeaf* __l = (_RopeLeaf*)__r; - if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) - __clrstack[__csptr++] = __l; - while (__csptr > 0) { - -- __csptr; - _RopeRep* __d = __clrstack[__csptr]; - __d->_M_free_c_string(); - __d->_M_c_string = 0; - } - return __l->_M_data + __i; - } - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - return 0; - } - } -#if defined(_STLP_NEED_UNREACHABLE_RETURN) - return 0; -#endif - -} - -// The following could be implemented trivially using -// lexicographical_compare_3way. -// We do a little more work to avoid dealing with rope iterators for -// flat strings. -template -int -rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left, - const _RopeRep* __right) { - size_t __left_len; - size_t __right_len; - - if (0 == __right) return 0 != __left; - if (0 == __left) return -1; - __left_len = __left->_M_size._M_data; - __right_len = __right->_M_size._M_data; - if (_RopeRep::_S_leaf == __left->_M_tag) { - const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left); - if (_RopeRep::_S_leaf == __right->_M_tag) { - const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right); - return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, - __r->_M_data, __r->_M_data + __right_len); - } - else { - const_iterator __rstart(__right, 0); - const_iterator __rend(__right, __right_len); - return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, - __rstart, __rend); - } - } - else { - const_iterator __lstart(__left, 0); - const_iterator __lend(__left, __left_len); - if (_RopeRep::_S_leaf == __right->_M_tag) { - const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right); - return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, - __r->_M_data, __r->_M_data + __right_len); - } - else { - const_iterator __rstart(__right, 0); - const_iterator __rend(__right, __right_len); - return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend); - } - } -} - -// Assignment to reference proxies. -template -_Rope_char_ref_proxy<_CharT, _Alloc>& -_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) { - _RopeRep* __old = _M_root->_M_tree_ptr._M_data; - // First check for the case in which everything is uniquely - // referenced. In that case we can do this destructively. - _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos); - if (0 != __ptr) { - *__ptr = __c; - return *this; - } - _Self_destruct_ptr __left( - _My_rope::_S_substring(__old, 0, _M_pos)); - _Self_destruct_ptr __right( - _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data)); - _Self_destruct_ptr __result_left( - _My_rope::_S_destr_concat_char_iter(__left, &__c, 1)); - - // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count) - _RopeRep* __result = - _My_rope::_S_concat_rep(__result_left, __right); - // _STLP_ASSERT(1 <= __result->_M_ref_count) - _RopeRep::_S_unref(__old); - _M_root->_M_tree_ptr._M_data = __result; - return *this; -} - -template -_Rope_char_ptr_proxy<_CharT, _Alloc> -_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const { - return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); -} - -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 ) -template -_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() }; -# else -__DECLARE_INSTANCE(char, crope::_S_empty_c_str[1], ={0}); -# ifdef _STLP_HAS_WCHAR_T -__DECLARE_INSTANCE(wchar_t, wrope::_S_empty_c_str[1], ={0}); -# endif /* _STLP_HAS_WCHAR_T */ -# endif /* _STLP_STATIC_TEMPLATE_DATA */ -// # endif - -#if !defined (_STLP_STATIC_CONST_INIT_BUG) -# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96) -template -const size_t rope<_CharT, _Alloc>::npos; -# endif -#endif - -template -const _CharT* rope<_CharT,_Alloc>::c_str() const { - if (0 == _M_tree_ptr._M_data) { - // Possibly redundant, but probably fast. - _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT); - return _S_empty_c_str; - } - _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string; - if (0 != __old_c_string) return __old_c_string; - size_t __s = size(); - _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1); - _S_flatten(_M_tree_ptr._M_data, __result); - _S_construct_null(__result + __s); - __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)), - __result)); - if (0 != __old_c_string) { - // It must have been added in the interim. Hence it had to have been - // separately allocated. Deallocate the old copy, since we just - // replaced it. - _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1); - _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1); - } - return __result; -} - -template -const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() { - if (0 == _M_tree_ptr._M_data) { - _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT); - return _S_empty_c_str; - } - _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string; - if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) { - return __old_c_string; - } - size_t __s = size(); - _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s)); - _S_flatten(_M_tree_ptr._M_data, __result); - _S_construct_null(__result + __s); - _M_tree_ptr._M_data->_M_unref_nonnil(); - _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr); - return __result; -} - -// Algorithm specializations. More should be added. - -#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && \ - (!defined (__DMC__) || defined (__PUT_STATIC_DATA_MEMBERS_HERE)) -// I couldn't get this to work with VC++ -template -void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first, - _Rope_iterator<_CharT,_Alloc> __middle, - _Rope_iterator<_CharT,_Alloc> __last) { - _STLP_ASSERT(__first.container() == __middle.container() && - __middle.container() == __last.container()) - rope<_CharT,_Alloc>& __r(__first.container()); - rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index()); - rope<_CharT,_Alloc> __suffix = - __r.substr(__last.index(), __r.size() - __last.index()); - rope<_CharT,_Alloc> __part1 = - __r.substr(__middle.index(), __last.index() - __middle.index()); - rope<_CharT,_Alloc> __part2 = - __r.substr(__first.index(), __middle.index() - __first.index()); - __r = __prefix; - __r += __part1; - __r += __part2; - __r += __suffix; -} - - -# if 0 -// Probably not useful for several reasons: -// - for SGIs 7.1 compiler and probably some others, -// this forces lots of rope instantiations, creating a -// code bloat and compile time problem. (Fixed in 7.2.) -// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive -// for unicode strings. Unsigned short may be a better character -// type. -inline void rotate( - _Rope_iterator __first, - _Rope_iterator __middle, - _Rope_iterator __last) { - _Rope_rotate(__first, __middle, __last); -} -# endif -#endif /* _STLP_MSVC */ - -# undef __RopeLeaf__ -# undef __RopeRep__ -# undef __RopeLeaf -# undef __RopeRep -# undef size_type - -_STLP_END_NAMESPACE - -# endif /* ROPEIMPL_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_rope.h b/SDK/stlport/stl/_rope.h deleted file mode 100644 index 82fc84e6..00000000 --- a/SDK/stlport/stl/_rope.h +++ /dev/null @@ -1,2374 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -// rope<_CharT,_Alloc> is a sequence of _CharT. -// Ropes appear to be mutable, but update operations -// really copy enough of the data structure to leave the original -// valid. Thus ropes can be logically copied by just copying -// a pointer value. - -#ifndef _STLP_INTERNAL_ROPE_H -#define _STLP_INTERNAL_ROPE_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_IOSFWD -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALGO_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUMERIC_H -# include -#endif - -#ifndef _STLP_INTERNAL_HASH_FUN_H -# include -#endif - -#ifndef _STLP_CHAR_TRAITS_H -# include -#endif - -#ifndef _STLP_INTERNAL_THREADS_H -# include -#endif - -#ifdef _STLP_SGI_THREADS -# include -#endif - -#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE -# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a)) -#elif defined(__MRC__)||defined(__SC__) -# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create<_Tp,__atype>(__a,(_Tp*)0) -#else -# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) -#endif - -_STLP_BEGIN_NAMESPACE - -// First a lot of forward declarations. The standard seems to require -// much stricter "declaration before use" than many of the implementations -// that preceded it. -template class rope; -template struct _Rope_RopeConcatenation; -template struct _Rope_RopeRep; -template struct _Rope_RopeLeaf; -template struct _Rope_RopeFunction; -template struct _Rope_RopeSubstring; -template class _Rope_iterator; -template class _Rope_const_iterator; -template class _Rope_char_ref_proxy; -template class _Rope_char_ptr_proxy; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Some helpers, so we can use the power algorithm on ropes. -// See below for why this isn't local to the implementation. - -// This uses a nonstandard refcount convention. -// The result has refcount 0. -template -struct _Rope_Concat_fn - : public binary_function, rope<_CharT,_Alloc>, - rope<_CharT,_Alloc> > { - rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x, - const rope<_CharT,_Alloc>& __y) { - return __x + __y; - } -}; - -template -inline -rope<_CharT,_Alloc> -__identity_element(_Rope_Concat_fn<_CharT, _Alloc>) -{ return rope<_CharT,_Alloc>(); } - -_STLP_MOVE_TO_STD_NAMESPACE - -// Store an eos -template -inline void _S_construct_null_aux(_CharT *__p, const __true_type&) -{ *__p = 0; } - -template -inline void _S_construct_null_aux(_CharT *__p, const __false_type&) -{ _STLP_STD::_Construct(__p); } - -template -inline void _S_construct_null(_CharT *__p) { - typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral; - _S_construct_null_aux(__p, _Char_Is_Integral()); -} - -// char_producers are logically functions that generate a section of -// a string. These can be converted to ropes. The resulting rope -// invokes the char_producer on demand. This allows, for example, -// files to be viewed as ropes without reading the entire file. -template -class char_producer { -public: - virtual ~char_producer() {} - virtual void operator()(size_t __start_pos, size_t __len, - _CharT* __buffer) = 0; - // Buffer should really be an arbitrary output iterator. - // That way we could flatten directly into an ostream, etc. - // This is thoroughly impossible, since iterator types don't - // have runtime descriptions. -}; - -// Sequence buffers: -// -// Sequence must provide an append operation that appends an -// array to the sequence. Sequence buffers are useful only if -// appending an entire array is cheaper than appending element by element. -// This is true for many string representations. -// This should perhaps inherit from ostream -// and be implemented correspondingly, so that they can be used -// for formatted. For the sake of portability, we don't do this yet. -// -// For now, sequence buffers behave as output iterators. But they also -// behave a little like basic_ostringstream and a -// little like containers. - -template -// The 3rd parameter works around a common compiler bug. -class sequence_buffer : public iterator { -public: -# ifndef __TYPEDEF_WORKAROUND - typedef typename _Sequence::value_type value_type; - typedef sequence_buffer<_Sequence -# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \ - defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM )) - , _Buf_sz - > _Self; -# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ - > _Self; - enum { _Buf_sz = 100}; -# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ - // # endif -# else /* __TYPEDEF_WORKAROUND */ - typedef _V value_type; - typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self; -# endif /* __TYPEDEF_WORKAROUND */ -protected: - _Sequence* _M_prefix; - value_type _M_buffer[_Buf_sz]; - size_t _M_buf_count; -public: - void flush() { - _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count); - _M_buf_count = 0; - } - ~sequence_buffer() { flush(); } - sequence_buffer() : _M_prefix(0), _M_buf_count(0) {} - sequence_buffer(const _Self& __x) { - _M_prefix = __x._M_prefix; - _M_buf_count = __x._M_buf_count; - copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); - } - sequence_buffer(_Self& __x) { - __x.flush(); - _M_prefix = __x._M_prefix; - _M_buf_count = 0; - } - sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {} - _Self& operator= (_Self& __x) { - __x.flush(); - _M_prefix = __x._M_prefix; - _M_buf_count = 0; - return *this; - } - _Self& operator= (const _Self& __x) { - _M_prefix = __x._M_prefix; - _M_buf_count = __x._M_buf_count; - copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); - return *this; - } - void push_back(value_type __x) { - if (_M_buf_count < _Buf_sz) { - _M_buffer[_M_buf_count] = __x; - ++_M_buf_count; - } else { - flush(); - _M_buffer[0] = __x; - _M_buf_count = 1; - } - } - void append(const value_type *__s, size_t __len) { - if (__len + _M_buf_count <= _Buf_sz) { - size_t __i = _M_buf_count; - size_t __j = 0; - for (; __j < __len; __i++, __j++) { - _M_buffer[__i] = __s[__j]; - } - _M_buf_count += __len; - } else if (0 == _M_buf_count) { - _M_prefix->append(__s, __s + __len); - } else { - flush(); - append(__s, __len); - } - } - _Self& write(const value_type *__s, size_t __len) { - append(__s, __len); - return *this; - } - _Self& put(value_type __x) { - push_back(__x); - return *this; - } - _Self& operator=(const value_type& __rhs) { - push_back(__rhs); - return *this; - } - _Self& operator*() { return *this; } - _Self& operator++() { return *this; } - _Self& operator++(int) { return *this; } -}; - -// The following should be treated as private, at least for now. -template -class _Rope_char_consumer { -#if !defined (_STLP_MEMBER_TEMPLATES) -public: - //Without member templates we have to use run-time parameterization. - // The symmetry with char_producer is accidental and temporary. - virtual ~_Rope_char_consumer() {} - virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; -#endif -}; - -// -// What follows should really be local to rope. Unfortunately, -// that doesn't work, since it makes it impossible to define generic -// equality on rope iterators. According to the draft standard, the -// template parameters for such an equality operator cannot be inferred -// from the occurence of a member class as a parameter. -// (SGI compilers in fact allow this, but the __result wouldn't be -// portable.) -// Similarly, some of the static member functions are member functions -// only to avoid polluting the global namespace, and to circumvent -// restrictions on type inference for template functions. -// - -// -// The internal data structure for representing a rope. This is -// private to the implementation. A rope is really just a pointer -// to one of these. -// -// A few basic functions for manipulating this data structure -// are members of _RopeRep. Most of the more complex algorithms -// are implemented as rope members. -// -// Some of the static member functions of _RopeRep have identically -// named functions in rope that simply invoke the _RopeRep versions. -// - -template -struct _Rope_RopeRep - : public _Refcount_Base -{ - typedef _Rope_RopeRep<_CharT, _Alloc> _Self; -public: - // - // GAB: 11/09/05 - // - // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH". - // This was originally just an addition of "__ROPE_MAX_DEPTH + 1" - // but this addition causes the sunpro compiler to complain about - // multiple declarations during the initialization of "_S_min_len". - // Changed to be a fixed value and the sunpro compiler appears to - // be happy??? - // -# define __ROPE_MAX_DEPTH 45 -# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1 - enum { _S_max_rope_depth = __ROPE_MAX_DEPTH }; - enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; - // Apparently needed by VC++ - // The data fields of leaves are allocated with some - // extra space, to accomodate future growth and for basic - // character types, to hold a trailing eos character. - enum { _S_alloc_granularity = 8 }; - - _Tag _M_tag:8; - bool _M_is_balanced:8; - - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type; - - allocator_type get_allocator() const { return allocator_type(_M_size); } - - unsigned char _M_depth; - _CharT* _STLP_VOLATILE _M_c_string; - _STLP_PRIV _STLP_alloc_proxy _M_size; - -# ifdef _STLP_NO_ARROW_OPERATOR - _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) {} -# endif - - /* Flattened version of string, if needed. */ - /* typically 0. */ - /* If it's not 0, then the memory is owned */ - /* by this node. */ - /* In the case of a leaf, this may point to */ - /* the same memory as the data field. */ - _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size, - allocator_type __a) : - _Refcount_Base(1), - _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size) - { } - - typedef typename _AreSameUnCVTypes<_CharT, char>::_Ret _IsChar; -# ifdef _STLP_HAS_WCHAR_T - typedef typename _AreSameUnCVTypes<_CharT, wchar_t>::_Ret _IsWCharT; -# else - typedef __false_type _IsWCharT; -# endif - - typedef typename _Lor2<_IsChar, _IsWCharT>::_Ret _IsBasicCharType; - -#if 0 - /* Please tell why this code is necessary if you uncomment it. - * Problem with it is that rope implementation expect that _S_rounded_up_size(n) - * returns a size > n in order to store the terminating null charater. When - * instanciation type is not a char or wchar_t this is not guaranty resulting in - * memory overrun. - */ - static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) { - // Allow slop for in-place expansion. - return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); - } - - static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) { - // Allow slop for in-place expansion. - return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1); - } -#endif - // fbp : moved from RopeLeaf - static size_t _S_rounded_up_size(size_t __n) - //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); } - { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); } - - static void _S_free_string( _CharT* __s, size_t __len, - allocator_type __a) { - _STLP_STD::_Destroy_Range(__s, __s + __len); - // This has to be a static member, so this gets a bit messy -# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE - __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES -# else - __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len)); -# endif - } - - // Deallocate data section of a leaf. - // This shouldn't be a member function. - // But its hard to do anything else at the - // moment, because it's templatized w.r.t. - // an allocator. - // Does nothing if __GC is defined. - void _M_free_c_string(); - void _M_free_tree(); - // Deallocate t. Assumes t is not 0. - void _M_unref_nonnil() { - if (_M_decr() == 0) _M_free_tree(); - } - void _M_ref_nonnil() { - _M_incr(); - } - static void _S_unref(_Self* __t) { - if (0 != __t) { - __t->_M_unref_nonnil(); - } - } - static void _S_ref(_Self* __t) { - if (0 != __t) __t->_M_incr(); - } - //static void _S_free_if_unref(_Self* __t) { - // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); - //} -}; - -template -struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { -public: - _CharT* _M_data; /* Not necessarily 0 terminated. */ - /* The allocated size is */ - /* _S_rounded_up_size(size), except */ - /* in the GC case, in which it */ - /* doesn't matter. */ -private: - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType; - void _M_init(__true_type const& /*_IsBasicCharType*/) { - this->_M_c_string = _M_data; - } - void _M_init(__false_type const& /*_IsBasicCharType*/) {} - -public: - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _RopeRep::allocator_type allocator_type; - - _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a), - _M_data(__d) { - _STLP_ASSERT(_p_size > 0) - _M_init(_IsBasicCharType()); - } - -# ifdef _STLP_NO_ARROW_OPERATOR - _Rope_RopeLeaf() {} - _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {} -# endif - -// The constructor assumes that d has been allocated with - // the proper allocator and the properly padded size. - // In contrast, the destructor deallocates the data: - ~_Rope_RopeLeaf() { - if (_M_data != this->_M_c_string) { - this->_M_free_c_string(); - } - _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator()); - } -}; - -template -struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> { -private: - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - -public: - _RopeRep* _M_left; - _RopeRep* _M_right; - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _RopeRep::allocator_type allocator_type; - _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat, - (max)(__l->_M_depth, __r->_M_depth) + 1, false, - __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r) - {} -# ifdef _STLP_NO_ARROW_OPERATOR - _Rope_RopeConcatenation() {} - _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {} -# endif - - ~_Rope_RopeConcatenation() { - this->_M_free_c_string(); - _M_left->_M_unref_nonnil(); - _M_right->_M_unref_nonnil(); - } -}; - -template -struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> { -private: - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; -public: - char_producer<_CharT>* _M_fn; - /* - * Char_producer is owned by the - * rope and should be explicitly - * deleted when the rope becomes - * inaccessible. - */ - bool _M_delete_when_done; - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type; -# ifdef _STLP_NO_ARROW_OPERATOR - _Rope_RopeFunction() {} - _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {} -# endif - - _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size, - bool __d, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f) - , _M_delete_when_done(__d) - { _STLP_ASSERT(_p_size > 0) } - - ~_Rope_RopeFunction() { - this->_M_free_c_string(); - if (_M_delete_when_done) { - delete _M_fn; - } - } -}; - -/* - * Substring results are usually represented using just - * concatenation nodes. But in the case of very long flat ropes - * or ropes with a functional representation that isn't practical. - * In that case, we represent the __result as a special case of - * RopeFunction, whose char_producer points back to the rope itself. - * In all cases except repeated substring operations and - * deallocation, we treat the __result as a RopeFunction. - */ -template -struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> { -public: - // XXX this whole class should be rewritten. - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - _RopeRep *_M_base; // not 0 - size_t _M_start; - /* virtual */ void operator()(size_t __start_pos, size_t __req_len, - _CharT* __buffer) { - typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; - typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; - switch (_M_base->_M_tag) { - case _RopeRep::_S_function: - case _RopeRep::_S_substringfn: - { - char_producer<_CharT>* __fn = - __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn; - _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data) - _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data) - (*__fn)(__start_pos + _M_start, __req_len, __buffer); - } - break; - case _RopeRep::_S_leaf: - { - _CharT* __s = - __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data; - _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer); - } - break; - default: - _STLP_ASSERT(false) - ; - } - } - - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _RopeRep::allocator_type allocator_type; - - _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a) - : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), - _M_base(__b), _M_start(__s) { - _STLP_ASSERT(__l > 0) - _STLP_ASSERT(__s + __l <= __b->_M_size._M_data) - _M_base->_M_ref_nonnil(); - this->_M_tag = _RopeRep::_S_substringfn; - } - virtual ~_Rope_RopeSubstring() - { _M_base->_M_unref_nonnil(); } -}; - -/* - * Self-destructing pointers to Rope_rep. - * These are not conventional smart pointers. Their - * only purpose in life is to ensure that unref is called - * on the pointer either at normal exit or if an exception - * is raised. It is the caller's responsibility to - * adjust reference counts when these pointers are initialized - * or assigned to. (This convention significantly reduces - * the number of potentially expensive reference count - * updates.) - */ -template -struct _Rope_self_destruct_ptr { - _Rope_RopeRep<_CharT,_Alloc>* _M_ptr; - ~_Rope_self_destruct_ptr() - { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); } -# ifdef _STLP_USE_EXCEPTIONS - _Rope_self_destruct_ptr() : _M_ptr(0) {} -# else - _Rope_self_destruct_ptr() {} -# endif - _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {} - _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; } - _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; } - operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; } - _Rope_self_destruct_ptr<_CharT, _Alloc>& - operator= (_Rope_RopeRep<_CharT,_Alloc>* __x) - { _M_ptr = __x; return *this; } -}; - -/* - * Dereferencing a nonconst iterator has to return something - * that behaves almost like a reference. It's not possible to - * return an actual reference since assignment requires extra - * work. And we would get into the same problems as with the - * CD2 version of basic_string. - */ -template -class _Rope_char_ref_proxy { - typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self; - friend class rope<_CharT,_Alloc>; - friend class _Rope_iterator<_CharT,_Alloc>; - friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; - typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - typedef rope<_CharT,_Alloc> _My_rope; - size_t _M_pos; - _CharT _M_current; - bool _M_current_valid; - _My_rope* _M_root; // The whole rope. -public: - _Rope_char_ref_proxy(_My_rope* __r, size_t __p) : - _M_pos(__p), _M_current_valid(false), _M_root(__r) {} - _Rope_char_ref_proxy(const _Self& __x) : - _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} - // Don't preserve cache if the reference can outlive the - // expression. We claim that's not possible without calling - // a copy constructor or generating reference to a proxy - // reference. We declare the latter to have undefined semantics. - _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) - : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} - inline operator _CharT () const; - _Self& operator= (_CharT __c); - _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const; - _Self& operator= (const _Self& __c) { - return operator=((_CharT)__c); - } -}; - -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -template -inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, - _Rope_char_ref_proxy <_CharT, __Alloc > __b) { - _CharT __tmp = __a; - __a = __b; - __b = __tmp; -} -#else -// There is no really acceptable way to handle this. The default -// definition of swap doesn't work for proxy references. -// It can't really be made to work, even with ugly hacks, since -// the only unusual operation it uses is the copy constructor, which -// is needed for other purposes. We provide a macro for -// full specializations, and instantiate the most common case. -# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \ - inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \ - _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \ - _CharT __tmp = __a; \ - __a = __b; \ - __b = __tmp; \ - } - -_ROPE_SWAP_SPECIALIZATION(char,_STLP_DEFAULT_ALLOCATOR(char) ) - -# ifndef _STLP_NO_WCHAR_T -_ROPE_SWAP_SPECIALIZATION(wchar_t,_STLP_DEFAULT_ALLOCATOR(wchar_t) ) -# endif - -#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - -template -class _Rope_char_ptr_proxy { - // XXX this class should be rewritten. -public: - typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self; - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - size_t _M_pos; - rope<_CharT,_Alloc>* _M_root; // The whole rope. - - _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy(const _Self& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy() {} - _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) { - _STLP_ASSERT(0 == __x) - } - _Self& operator= (const _Self& __x) { - _M_pos = __x._M_pos; - _M_root = __x._M_root; - return *this; - } - - _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const { - return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos); - } -}; - - -/* - * Rope iterators: - * Unlike in the C version, we cache only part of the stack - * for rope iterators, since they must be efficiently copyable. - * When we run out of cache, we have to reconstruct the iterator - * value. - * Pointers from iterators are not included in reference counts. - * Iterators are assumed to be thread private. Ropes can - * be shared. - */ -template -class _Rope_iterator_base -/* : public random_access_iterator<_CharT, ptrdiff_t> */ -{ - friend class rope<_CharT,_Alloc>; - typedef _Rope_iterator_base<_CharT, _Alloc> _Self; - typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat; -public: - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - - enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction. - enum { _S_iterator_buf_len = 15 }; - size_t _M_current_pos; - // The whole rope. - _RopeRep* _M_root; - // Starting position for current leaf - size_t _M_leaf_pos; - // Buffer possibly containing current char. - _CharT* _M_buf_start; - // Pointer to current char in buffer, != 0 ==> buffer valid. - _CharT* _M_buf_ptr; - // One past __last valid char in buffer. - _CharT* _M_buf_end; - - // What follows is the path cache. We go out of our - // way to make this compact. - // Path_end contains the bottom section of the path from - // the root to the current leaf. - struct { -# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) - _RopeRep const*_M_data[4]; -# else - _RopeRep const*_M_data[_S_path_cache_len]; -# endif - } _M_path_end; - // Last valid __pos in path_end; - // _M_path_end[0] ... _M_path_end[_M_leaf_index-1] - // point to concatenation nodes. - int _M_leaf_index; - // (_M_path_directions >> __i) & 1 is 1 - // if we got from _M_path_end[leaf_index - __i - 1] - // to _M_path_end[leaf_index - __i] by going to the - // __right. Assumes path_cache_len <= 9. - unsigned char _M_path_directions; - // Short buffer for surrounding chars. - // This is useful primarily for - // RopeFunctions. We put the buffer - // here to avoid locking in the - // multithreaded case. - // The cached path is generally assumed to be valid - // only if the buffer is valid. - struct { -# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) - _CharT _M_data[15]; -# else - _CharT _M_data[_S_iterator_buf_len]; -# endif - } _M_tmp_buf; - - // Set buffer contents given path cache. - static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x); - // Set buffer contents and path cache. - static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x); - // As above, but assumes path cache is valid for previous posn. - static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x); - _Rope_iterator_base() {} - _Rope_iterator_base(_RopeRep* __root, size_t __pos) - : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {} - void _M_incr(size_t __n); - void _M_decr(size_t __n); -public: - size_t index() const { return _M_current_pos; } -private: - void _M_copy_buf(const _Self& __x) { - _M_tmp_buf = __x._M_tmp_buf; - if (__x._M_buf_start == __x._M_tmp_buf._M_data) { - _M_buf_start = _M_tmp_buf._M_data; - _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start); - _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start); - } else { - _M_buf_end = __x._M_buf_end; - } - } - -public: - _Rope_iterator_base(const _Self& __x) : - _M_current_pos(__x._M_current_pos), - _M_root(__x._M_root), - _M_leaf_pos( __x._M_leaf_pos ), - _M_buf_start(__x._M_buf_start), - _M_buf_ptr(__x._M_buf_ptr), - _M_path_end(__x._M_path_end), - _M_leaf_index(__x._M_leaf_index), - _M_path_directions(__x._M_path_directions) - { - if (0 != __x._M_buf_ptr) { - _M_copy_buf(__x); - } - } - _Self& operator = (const _Self& __x) - { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_buf_start = __x._M_buf_start; - _M_buf_ptr = __x._M_buf_ptr; - _M_path_end = __x._M_path_end; - _M_leaf_index = __x._M_leaf_index; - _M_path_directions = __x._M_path_directions; - _M_leaf_pos = __x._M_leaf_pos; - if (0 != __x._M_buf_ptr) { - _M_copy_buf(__x); - } - return *this; - } -}; - -template class _Rope_iterator; - -template -class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - typedef _Rope_const_iterator<_CharT, _Alloc> _Self; - typedef _Rope_iterator_base<_CharT,_Alloc> _Base; - // protected: -public: -# ifndef _STLP_HAS_NO_NAMESPACES - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - // The one from the base class may not be directly visible. -# endif - _Rope_const_iterator(const _RopeRep* __root, size_t __pos): - _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos) - // Only nonconst iterators modify root ref count - {} -public: - typedef _CharT reference; // Really a value. Returning a reference - // Would be a mess, since it would have - // to be included in refcount. - typedef const _CharT* pointer; - typedef _CharT value_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag iterator_category; - -public: - _Rope_const_iterator() {} - _Rope_const_iterator(const _Self& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { } - _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x): - _Rope_iterator_base<_CharT,_Alloc>(__x) {} - _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) : - _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {} - _Self& operator= (const _Self& __x) { - _Base::operator=(__x); - return *this; - } - reference operator*() { - if (0 == this->_M_buf_ptr) -#if !defined (__DMC__) - _S_setcache(*this); -#else - { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); } -#endif - return *(this->_M_buf_ptr); - } - _Self& operator++() { - _CharT* __next; - if (0 != this->_M_buf_ptr && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) { - this->_M_buf_ptr = __next; - ++this->_M_current_pos; - } else { - this->_M_incr(1); - } - return *this; - } - _Self& operator+=(ptrdiff_t __n) { - if (__n >= 0) { - this->_M_incr(__n); - } else { - this->_M_decr(-__n); - } - return *this; - } - _Self& operator--() { - this->_M_decr(1); - return *this; - } - _Self& operator-=(ptrdiff_t __n) { - if (__n >= 0) { - this->_M_decr(__n); - } else { - this->_M_incr(-__n); - } - return *this; - } - _Self operator++(int) { - size_t __old_pos = this->_M_current_pos; - this->_M_incr(1); - return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); - // This makes a subsequent dereference expensive. - // Perhaps we should instead copy the iterator - // if it has a valid cache? - } - _Self operator--(int) { - size_t __old_pos = this->_M_current_pos; - this->_M_decr(1); - return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); - } - inline reference operator[](size_t __n); -}; - -template -class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - typedef _Rope_iterator<_CharT, _Alloc> _Self; - typedef _Rope_iterator_base<_CharT,_Alloc> _Base; - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - -public: - rope<_CharT,_Alloc>* _M_root_rope; - // root is treated as a cached version of this, - // and is used to detect changes to the underlying - // rope. - // Root is included in the reference count. - // This is necessary so that we can detect changes reliably. - // Unfortunately, it requires careful bookkeeping for the - // nonGC case. - _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos); - - void _M_check(); -public: - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer; - typedef _CharT value_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag iterator_category; -public: - ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count - _RopeRep::_S_unref(this->_M_root); - } - - rope<_CharT,_Alloc>& container() { return *_M_root_rope; } - _Rope_iterator() { - this->_M_root = 0; // Needed for reference counting. - } - _Rope_iterator(const _Self& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { - _M_root_rope = __x._M_root_rope; - _RopeRep::_S_ref(this->_M_root); - } - _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos); - _Self& operator= (const _Self& __x) { - _RopeRep* __old = this->_M_root; - _RopeRep::_S_ref(__x._M_root); - _Base::operator=(__x); - _M_root_rope = __x._M_root_rope; - _RopeRep::_S_unref(__old); - return *this; - } - reference operator*() { - _M_check(); - if (0 == this->_M_buf_ptr) { - return reference(_M_root_rope, this->_M_current_pos); - } else { - return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr)); - } - } - _Self& operator++() { - this->_M_incr(1); - return *this; - } - _Self& operator+=(ptrdiff_t __n) { - if (__n >= 0) { - this->_M_incr(__n); - } else { - this->_M_decr(-__n); - } - return *this; - } - _Self& operator--() { - this->_M_decr(1); - return *this; - } - _Self& operator-=(ptrdiff_t __n) { - if (__n >= 0) { - this->_M_decr(__n); - } else { - this->_M_incr(-__n); - } - return *this; - } - _Self operator++(int) { - size_t __old_pos = this->_M_current_pos; - this->_M_incr(1); - return _Self(_M_root_rope, __old_pos); - } - _Self operator--(int) { - size_t __old_pos = this->_M_current_pos; - this->_M_decr(1); - return _Self(_M_root_rope, __old_pos); - } - reference operator[](ptrdiff_t __n) { - return reference(_M_root_rope, this->_M_current_pos + __n); - } -}; - -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES -template -inline random_access_iterator_tag -iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();} -template -inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; } -template -inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; } -template -inline random_access_iterator_tag -iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); } -template -inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; } -template -inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; } -#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ - -template -bool _S_apply_to_pieces(_CharConsumer& __c, - _Rope_RopeRep<_CharT, _Alloc> *__r, - size_t __begin, size_t __end); - // begin and end are assumed to be in range. - -template -class rope -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef rope<_CharT,_Alloc> _Self; -public: - typedef _CharT value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef _CharT const_reference; - typedef const _CharT* const_pointer; - typedef _Rope_iterator<_CharT,_Alloc> iterator; - typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator; - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer; - - friend class _Rope_iterator<_CharT,_Alloc>; - friend class _Rope_const_iterator<_CharT,_Alloc>; - friend struct _Rope_RopeRep<_CharT,_Alloc>; - friend class _Rope_iterator_base<_CharT,_Alloc>; - friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - friend struct _Rope_RopeSubstring<_CharT,_Alloc>; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -protected: - typedef _CharT* _Cstrptr; - - static _CharT _S_empty_c_str[1]; - - enum { _S_copy_max = 23 }; - // For strings shorter than _S_copy_max, we copy to - // concatenate. - - typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; - typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType; - -public: - _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) - typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type; - -public: - // The only data member of a rope: - _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr; - -public: - allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); } - -public: - typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; - typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; - typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; - typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring; - - // Retrieve a character at the indicated position. - static _CharT _S_fetch(_RopeRep* __r, size_type __pos); - - // Obtain a pointer to the character at the indicated position. - // The pointer can be used to change the character. - // If such a pointer cannot be produced, as is frequently the - // case, 0 is returned instead. - // (Returns nonzero only if all nodes in the path have a refcount - // of 1.) - static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); - - static void _S_unref(_RopeRep* __t) { - _RopeRep::_S_unref(__t); - } - static void _S_ref(_RopeRep* __t) { - _RopeRep::_S_ref(__t); - } - - typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; - - // _Result is counted in refcount. - static _RopeRep* _S_substring(_RopeRep* __base, - size_t __start, size_t __endp1); - - static _RopeRep* _S_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen); - // Concatenate rope and char ptr, copying __s. - // Should really take an arbitrary iterator. - // Result is counted in refcount. - static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen); - // As above, but one reference to __r is about to be - // destroyed. Thus the pieces may be recycled if all - // relevent reference counts are 1. - - // General concatenation on _RopeRep. _Result - // has refcount of 1. Adjusts argument refcounts. - static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right); - -public: -#if defined (_STLP_MEMBER_TEMPLATES) - template -#else - typedef _Rope_char_consumer<_CharT> _CharConsumer; -#endif - void apply_to_pieces(size_t __begin, size_t __end, - _CharConsumer& __c) const - { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); } - -protected: - - static size_t _S_rounded_up_size(size_t __n) - { return _RopeRep::_S_rounded_up_size(__n); } - - // Allocate and construct a RopeLeaf using the supplied allocator - // Takes ownership of s instead of copying. - static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s, - size_t _p_size, allocator_type __a) { - _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, - _RopeLeaf).allocate(1); - _STLP_TRY { - _STLP_PLACEMENT_NEW(__space) _RopeLeaf(__s, _p_size, __a); - } - _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a, - _RopeLeaf).deallocate(__space, 1)) - return __space; - } - - static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right, - allocator_type __a) { - _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, - _RopeConcatenation).allocate(1); - return _STLP_PLACEMENT_NEW(__space) _RopeConcatenation(__left, __right, __a); - } - - static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, - size_t _p_size, bool __d, allocator_type __a) { - _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, - _RopeFunction).allocate(1); - return _STLP_PLACEMENT_NEW(__space) _RopeFunction(__f, _p_size, __d, __a); - } - - static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, - size_t __l, allocator_type __a) { - _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, - _RopeSubstring).allocate(1); - return _STLP_PLACEMENT_NEW(__space) _RopeSubstring(__b, __s, __l, __a); - } - - static - _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, - size_t _p_size, allocator_type __a) { - if (0 == _p_size) return 0; - - _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size)); - - _STLP_PRIV __ucopy_n(__s, _p_size, __buf); - _S_construct_null(__buf + _p_size); - - _STLP_TRY { - return _S_new_RopeLeaf(__buf, _p_size, __a); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a)) - _STLP_RET_AFTER_THROW(0) - } - - - // Concatenation of nonempty strings. - // Always builds a concatenation node. - // Rebalances if the result is too deep. - // Result has refcount 1. - // Does not increment left and right ref counts even though - // they are referenced. - static _RopeRep* - _S_tree_concat(_RopeRep* __left, _RopeRep* __right); - - // Concatenation helper functions - static _RopeLeaf* - _S_leaf_concat_char_iter(_RopeLeaf* __r, - const _CharT* __iter, size_t __slen); - // Concatenate by copying leaf. - // should take an arbitrary iterator - // result has refcount 1. - static _RopeLeaf* _S_destr_leaf_concat_char_iter - (_RopeLeaf* __r, const _CharT* __iter, size_t __slen); - // A version that potentially clobbers __r if __r->_M_ref_count == 1. - - - // A helper function for exponentiating strings. - // This uses a nonstandard refcount convention. - // The result has refcount 0. - typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn; -#if !defined (__GNUC__) || (__GNUC__ < 3) - friend _Concat_fn; -#else - friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>; -#endif - -public: - static size_t _S_char_ptr_len(const _CharT* __s) { - return char_traits<_CharT>::length(__s); - } - -public: /* for operators */ - rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, __t) { } -private: - // Copy __r to the _CharT buffer. - // Returns __buffer + __r->_M_size._M_data. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); - - // Again, with explicit starting position and length. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, - size_t __start, size_t __len, - _CharT* __buffer); - - // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? ) -public: - static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE]; -protected: - static bool _S_is_balanced(_RopeRep* __r) - { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); } - - static bool _S_is_almost_balanced(_RopeRep* __r) { - return (__r->_M_depth == 0 || - __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]); - } - - static bool _S_is_roughly_balanced(_RopeRep* __r) { - return (__r->_M_depth <= 1 || - __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]); - } - - // Assumes the result is not empty. - static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, - _RopeRep* __right) { - _RopeRep* __result = _S_concat_rep(__left, __right); - if (_S_is_balanced(__result)) __result->_M_is_balanced = true; - return __result; - } - - // The basic rebalancing operation. Logically copies the - // rope. The result has refcount of 1. The client will - // usually decrement the reference count of __r. - // The result is within height 2 of balanced by the above - // definition. - static _RopeRep* _S_balance(_RopeRep* __r); - - // Add all unbalanced subtrees to the forest of balanceed trees. - // Used only by balance. - static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); - - // Add __r to forest, assuming __r is already balanced. - static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); - -#ifdef _STLP_DEBUG - // Print to stdout, exposing structure - static void _S_dump(_RopeRep* __r, int __indent = 0); -#endif - - // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. - static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); - - void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; - - void _M_reset(_RopeRep* __r) { - //if (__r != _M_tree_ptr._M_data) { - _S_unref(_M_tree_ptr._M_data); - _M_tree_ptr._M_data = __r; - //} - } - -public: - bool empty() const { return 0 == _M_tree_ptr._M_data; } - - // Comparison member function. This is public only for those - // clients that need a ternary comparison. Others - // should use the comparison operators below. - int compare(const _Self& __y) const { - return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data); - } - - rope(const _CharT* __s, const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a)) - {} - - rope(const _CharT* __s, size_t __len, - const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a))) - {} - - // Should perhaps be templatized with respect to the iterator type - // and use Sequence_buffer. (It should perhaps use sequence_buffer - // even now.) - rope(const _CharT *__s, const _CharT *__e, - const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a)) - {} - - rope(const const_iterator& __s, const const_iterator& __e, - const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos)) - {} - - rope(const iterator& __s, const iterator& __e, - const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos)) - {} - - rope(_CharT __c, const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, (_RopeRep*)0) { - _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1)); - - _Copy_Construct(__buf, __c); - _S_construct_null(__buf + 1); - - _STLP_TRY { - _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a)) - } - - rope(size_t __n, _CharT __c, - const allocator_type& __a = allocator_type()): - _M_tree_ptr(__a, (_RopeRep*)0) { - if (0 == __n) - return; - - rope<_CharT,_Alloc> __result; -# define __exponentiate_threshold size_t(32) - _RopeRep* __remainder; - rope<_CharT,_Alloc> __remainder_rope; - - // gcc-2.7.2 bugs - typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn; - - size_t __exponent = __n / __exponentiate_threshold; - size_t __rest = __n % __exponentiate_threshold; - if (0 == __rest) { - __remainder = 0; - } else { - _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest)); - uninitialized_fill_n(__rest_buffer, __rest, __c); - _S_construct_null(__rest_buffer + __rest); - _STLP_TRY { - __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a)) - } - __remainder_rope._M_tree_ptr._M_data = __remainder; - if (__exponent != 0) { - _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold)); - _RopeLeaf* __base_leaf; - rope<_CharT,_Alloc> __base_rope; - uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c); - _S_construct_null(__base_buffer + __exponentiate_threshold); - _STLP_TRY { - __base_leaf = _S_new_RopeLeaf(__base_buffer, - __exponentiate_threshold, __a); - } - _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer, - __exponentiate_threshold, __a)) - __base_rope._M_tree_ptr._M_data = __base_leaf; - if (1 == __exponent) { - __result = __base_rope; - // One each for base_rope and __result - //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count) - } else { - __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn()); - } - if (0 != __remainder) { - __result += __remainder_rope; - } - } else { - __result = __remainder_rope; - } - _M_tree_ptr._M_data = __result._M_tree_ptr._M_data; - _M_tree_ptr._M_data->_M_ref_nonnil(); -# undef __exponentiate_threshold - } - - rope(const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, (_RopeRep*)0) {} - - // Construct a rope from a function that can compute its members - rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, - const allocator_type& __a = allocator_type()) - : _M_tree_ptr(__a, (_RopeRep*)0) { - _M_tree_ptr._M_data = (0 == __len) ? - 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); - } - - rope(const _Self& __x) - : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) { - _S_ref(_M_tree_ptr._M_data); - } - - rope(__move_source<_Self> __src) - : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) { - __src.get()._M_tree_ptr._M_data = 0; - } - - ~rope() { - _S_unref(_M_tree_ptr._M_data); - } - - _Self& operator=(const _Self& __x) { - _STLP_ASSERT(get_allocator() == __x.get_allocator()) - _S_ref(__x._M_tree_ptr._M_data); - _M_reset(__x._M_tree_ptr._M_data); - return *this; - } - - void clear() { - _S_unref(_M_tree_ptr._M_data); - _M_tree_ptr._M_data = 0; - } - void push_back(_CharT __x) { - _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1)); - } - - void pop_back() { - _RopeRep* __old = _M_tree_ptr._M_data; - _M_tree_ptr._M_data = - _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1); - _S_unref(__old); - } - - _CharT back() const { - return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1); - } - - void push_front(_CharT __x) { - _RopeRep* __old = _M_tree_ptr._M_data; - _RopeRep* __left = - _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr); - _STLP_TRY { - _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data); - _S_unref(__old); - _S_unref(__left); - } - _STLP_UNWIND(_S_unref(__left)) - } - - void pop_front() { - _RopeRep* __old = _M_tree_ptr._M_data; - _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data); - _S_unref(__old); - } - - _CharT front() const { - return _S_fetch(_M_tree_ptr._M_data, 0); - } - - void balance() { - _RopeRep* __old = _M_tree_ptr._M_data; - _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data); - _S_unref(__old); - } - - void copy(_CharT* __buffer) const { - _STLP_STD::_Destroy_Range(__buffer, __buffer + size()); - _S_flatten(_M_tree_ptr._M_data, __buffer); - } - - /* - * This is the copy function from the standard, but - * with the arguments reordered to make it consistent with the - * rest of the interface. - * Note that this guaranteed not to compile if the draft standard - * order is assumed. - */ - size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const { - size_t _p_size = size(); - size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n); - - _STLP_STD::_Destroy_Range(__buffer, __buffer + __len); - _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer); - return __len; - } - -# ifdef _STLP_DEBUG - // Print to stdout, exposing structure. May be useful for - // performance debugging. - void dump() { - _S_dump(_M_tree_ptr._M_data); - } -# endif - - // Convert to 0 terminated string in new allocated memory. - // Embedded 0s in the input do not terminate the copy. - const _CharT* c_str() const; - - // As above, but also use the flattened representation as the - // the new rope representation. - const _CharT* replace_with_c_str(); - - // Reclaim memory for the c_str generated flattened string. - // Intentionally undocumented, since it's hard to say when this - // is safe for multiple threads. - void delete_c_str () { - if (0 == _M_tree_ptr._M_data) return; - if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && - ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data == - _M_tree_ptr._M_data->_M_c_string) { - // Representation shared - return; - } - _M_tree_ptr._M_data->_M_free_c_string(); - _M_tree_ptr._M_data->_M_c_string = 0; - } - - _CharT operator[] (size_type __pos) const { - return _S_fetch(_M_tree_ptr._M_data, __pos); - } - - _CharT at(size_type __pos) const { - if (__pos >= size()) _M_throw_out_of_range(); - return (*this)[__pos]; - } - - const_iterator begin() const { - return(const_iterator(_M_tree_ptr._M_data, 0)); - } - - // An easy way to get a const iterator from a non-const container. - const_iterator const_begin() const { - return(const_iterator(_M_tree_ptr._M_data, 0)); - } - - const_iterator end() const { - return(const_iterator(_M_tree_ptr._M_data, size())); - } - - const_iterator const_end() const { - return(const_iterator(_M_tree_ptr._M_data, size())); - } - - size_type size() const { - return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data); - } - - size_type length() const { - return size(); - } - - size_type max_size() const { - return _S_min_len[__ROPE_MAX_DEPTH-1] - 1; - // Guarantees that the result can be sufficiently - // balanced. Longer ropes will probably still work, - // but it's harder to make guarantees. - } - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator const_rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - const_reverse_iterator const_rend() const { - return const_reverse_iterator(begin()); - } - // The symmetric cases are intentionally omitted, since they're presumed - // to be less common, and we don't handle them as well. - - // The following should really be templatized. - // The first argument should be an input iterator or - // forward iterator with value_type _CharT. - _Self& append(const _CharT* __iter, size_t __n) { - _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n)); - return *this; - } - - _Self& append(const _CharT* __c_string) { - size_t __len = _S_char_ptr_len(__c_string); - append(__c_string, __len); - return *this; - } - - _Self& append(const _CharT* __s, const _CharT* __e) { - _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s)); - return *this; - } - - _Self& append(const_iterator __s, const_iterator __e) { - _STLP_ASSERT(__s._M_root == __e._M_root) - _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator()) - _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos)); - _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee)); - return *this; - } - - _Self& append(_CharT __c) { - _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1)); - return *this; - } - - _Self& append() { return append(_CharT()); } // XXX why? - - _Self& append(const _Self& __y) { - _STLP_ASSERT(__y.get_allocator() == get_allocator()) - _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data)); - return *this; - } - - _Self& append(size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __last(__n, __c); - return append(__last); - } - - void swap(_Self& __b) { - _M_tree_ptr.swap(__b._M_tree_ptr); - } - -protected: - // Result is included in refcount. - static _RopeRep* replace(_RopeRep* __old, size_t __pos1, - size_t __pos2, _RopeRep* __r) { - if (0 == __old) { _S_ref(__r); return __r; } - _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1)); - _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data)); - _STLP_MPWFIX_TRY //*TY 06/01/2000 - - _RopeRep* __result; - - if (0 == __r) { - __result = _S_concat_rep(__left, __right); - } else { - _STLP_ASSERT(__old->get_allocator() == __r->get_allocator()) - _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r)); - __result = _S_concat_rep(__left_result, __right); - } - return __result; - _STLP_MPWFIX_CATCH //*TY 06/01/2000 - - } - -public: - void insert(size_t __p, const _Self& __r) { - if (__p > size()) _M_throw_out_of_range(); - _STLP_ASSERT(get_allocator() == __r.get_allocator()) - _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data)); - } - - void insert(size_t __p, size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __r(__n,__c); - insert(__p, __r); - } - - void insert(size_t __p, const _CharT* __i, size_t __n) { - if (__p > size()) _M_throw_out_of_range(); - _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p)); - _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size())); - _Self_destruct_ptr __left_result( - _S_concat_char_iter(__left, __i, __n)); - // _S_ destr_concat_char_iter should be safe here. - // But as it stands it's probably not a win, since __left - // is likely to have additional references. - _M_reset(_S_concat_rep(__left_result, __right)); - } - - void insert(size_t __p, const _CharT* __c_string) { - insert(__p, __c_string, _S_char_ptr_len(__c_string)); - } - - void insert(size_t __p, _CharT __c) { - insert(__p, &__c, 1); - } - - void insert(size_t __p) { - _CharT __c = _CharT(); - insert(__p, &__c, 1); - } - - void insert(size_t __p, const _CharT* __i, const _CharT* __j) { - _Self __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - _Self __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const iterator& __i, - const iterator& __j) { - _Self __r(__i, __j); - insert(__p, __r); - } - - // (position, length) versions of replace operations: - void replace(size_t __p, size_t __n, const _Self& __r) { - if (__p > size()) _M_throw_out_of_range(); - _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data)); - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, size_t __i_len) { - _Self __r(__i, __i_len); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, _CharT __c) { - _Self __r(__c); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, const _CharT* __c_string) { - _Self __r(__c_string); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, const _CharT* __j) { - _Self __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const const_iterator& __i, const const_iterator& __j) { - _Self __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const iterator& __i, const iterator& __j) { - _Self __r(__i, __j); - replace(__p, __n, __r); - } - - // Single character variants: - void replace(size_t __p, _CharT __c) { - if (__p > size()) _M_throw_out_of_range(); - iterator __i(this, __p); - *__i = __c; - } - - void replace(size_t __p, const _Self& __r) { - replace(__p, 1, __r); - } - - void replace(size_t __p, const _CharT* __i, size_t __i_len) { - replace(__p, 1, __i, __i_len); - } - - void replace(size_t __p, const _CharT* __c_string) { - replace(__p, 1, __c_string); - } - - void replace(size_t __p, const _CharT* __i, const _CharT* __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const iterator& __i, - const iterator& __j) { - replace(__p, 1, __i, __j); - } - - // Erase, (position, size) variant. - void erase(size_t __p, size_t __n) { - if (__p > size()) _M_throw_out_of_range(); - _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0)); - } - - // Erase, single character - void erase(size_t __p) { - erase(__p, __p + 1); - } - - // Insert, iterator variants. - iterator insert(const iterator& __p, const _Self& __r) - { insert(__p.index(), __r); return __p; } - iterator insert(const iterator& __p, size_t __n, _CharT __c) - { insert(__p.index(), __n, __c); return __p; } - iterator insert(const iterator& __p, _CharT __c) - { insert(__p.index(), __c); return __p; } - iterator insert(const iterator& __p ) - { insert(__p.index()); return __p; } - iterator insert(const iterator& __p, const _CharT* c_string) - { insert(__p.index(), c_string); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, size_t __n) - { insert(__p.index(), __i, __n); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, - const _CharT* __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const const_iterator& __i, const const_iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const iterator& __i, const iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - - // Replace, range variants. - void replace(const iterator& __p, const iterator& __q, - const _Self& __r) - { replace(__p.index(), __q.index() - __p.index(), __r); } - void replace(const iterator& __p, const iterator& __q, _CharT __c) - { replace(__p.index(), __q.index() - __p.index(), __c); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __c_string) - { replace(__p.index(), __q.index() - __p.index(), __c_string); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, size_t __n) - { replace(__p.index(), __q.index() - __p.index(), __i, __n); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const const_iterator& __i, const const_iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const iterator& __i, const iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - - // Replace, iterator variants. - void replace(const iterator& __p, const _Self& __r) - { replace(__p.index(), __r); } - void replace(const iterator& __p, _CharT __c) - { replace(__p.index(), __c); } - void replace(const iterator& __p, const _CharT* __c_string) - { replace(__p.index(), __c_string); } - void replace(const iterator& __p, const _CharT* __i, size_t __n) - { replace(__p.index(), __i, __n); } - void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, const_iterator __i, - const_iterator __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, iterator __i, iterator __j) - { replace(__p.index(), __i, __j); } - - // Iterator and range variants of erase - iterator erase(const iterator& __p, const iterator& __q) { - size_t __p_index = __p.index(); - erase(__p_index, __q.index() - __p_index); - return iterator(this, __p_index); - } - iterator erase(const iterator& __p) { - size_t __p_index = __p.index(); - erase(__p_index, 1); - return iterator(this, __p_index); - } - - _Self substr(size_t __start, size_t __len = 1) const { - if (__start > size()) _M_throw_out_of_range(); - return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len)); - } - - _Self substr(iterator __start, iterator __end) const { - return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index())); - } - - _Self substr(iterator __start) const { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1)); - } - - _Self substr(const_iterator __start, const_iterator __end) const { - // This might eventually take advantage of the cache in the - // iterator. - return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index())); - } - - rope<_CharT,_Alloc> substr(const_iterator __start) { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1)); - } - -#include - - size_type find(const _Self& __s, size_type __pos = 0) const { - if (__pos >= size()) -# ifndef _STLP_OLD_ROPE_SEMANTICS - return npos; -# else - return size(); -# endif - - size_type __result_pos; - const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() ); - __result_pos = __result.index(); -# ifndef _STLP_OLD_ROPE_SEMANTICS - if (__result_pos == size()) __result_pos = npos; -# endif - return __result_pos; - } - size_type find(_CharT __c, size_type __pos = 0) const; - size_type find(const _CharT* __s, size_type __pos = 0) const { - size_type __result_pos; - const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(), - __s, __s + _S_char_ptr_len(__s)); - __result_pos = __result.index(); -# ifndef _STLP_OLD_ROPE_SEMANTICS - if (__result_pos == size()) __result_pos = npos; -# endif - return __result_pos; - } - - iterator mutable_begin() { - return(iterator(this, 0)); - } - - iterator mutable_end() { - return(iterator(this, size())); - } - - reverse_iterator mutable_rbegin() { - return reverse_iterator(mutable_end()); - } - - reverse_iterator mutable_rend() { - return reverse_iterator(mutable_begin()); - } - - reference mutable_reference_at(size_type __pos) { - return reference(this, __pos); - } - -# ifdef __STD_STUFF - reference operator[] (size_type __pos) { - return reference(this, __pos); - } - - reference at(size_type __pos) { - if (__pos >= size()) _M_throw_out_of_range(); - return (*this)[__pos]; - } - - void resize(size_type, _CharT) {} - void resize(size_type) {} - void reserve(size_type = 0) {} - size_type capacity() const { - return max_size(); - } - - // Stuff below this line is dangerous because it's error prone. - // I would really like to get rid of it. - // copy function with funny arg ordering. - size_type copy(_CharT* __buffer, size_type __n, - size_type __pos = 0) const { - return copy(__pos, __n, __buffer); - } - - iterator end() { return mutable_end(); } - - iterator begin() { return mutable_begin(); } - - reverse_iterator rend() { return mutable_rend(); } - - reverse_iterator rbegin() { return mutable_rbegin(); } - -# else - - const_iterator end() { return const_end(); } - - const_iterator begin() { return const_begin(); } - - const_reverse_iterator rend() { return const_rend(); } - - const_reverse_iterator rbegin() { return const_rbegin(); } - -# endif -}; //class rope - -#if !defined (_STLP_STATIC_CONST_INIT_BUG) -# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) -template -const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0; -# endif -#endif - -template -inline _CharT -_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n) -{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); } - -template -inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos == __y._M_current_pos && - __x._M_root == __y._M_root); -} - -template -inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return (__x._M_current_pos < __y._M_current_pos); } - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return !(__x == __y); } - -template -inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return __y < __x; } - -template -inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return !(__y < __x); } - -template -inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return !(__x < __y); } - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) -{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; } - -#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug. -template -inline _Rope_const_iterator<_CharT,_Alloc> -operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) -{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); } -# endif - -template -inline _Rope_const_iterator<_CharT,_Alloc> -operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) -{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); } - -template -inline _Rope_const_iterator<_CharT,_Alloc> -operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) -{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); } - -template -inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos == __y._M_current_pos && - __x._M_root_rope == __y._M_root_rope); -} - -template -inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return (__x._M_current_pos < __y._M_current_pos); } - -#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -template -inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return !(__x == __y); } - -template -inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return __y < __x; } - -template -inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return !(__y < __x); } - -template -inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return !(__x < __y); } -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) -{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; } - -#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug. -template -inline _Rope_iterator<_CharT,_Alloc> -operator-(const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n) { - return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n); -} -# endif - -template -inline _Rope_iterator<_CharT,_Alloc> -operator+(const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n) { - return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n); -} - -template -inline _Rope_iterator<_CharT,_Alloc> -operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) { - return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n); -} - -template -inline rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - _STLP_ASSERT(__left.get_allocator() == __right.get_allocator()) - return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data)); - // Inlining this should make it possible to keep __left and __right in registers. -} - -template -inline rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - __left.append(__right); - return __left; -} - -template -inline rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, - const _CharT* __right) { - size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); - return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen)); -} - -template -inline rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const _CharT* __right) { - __left.append(__right); - return __left; -} - -template -inline rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) { - return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1)); -} - -template -inline rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { - __left.append(__right); - return __left; -} - -template -inline bool -operator< (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) < 0; -} - -template -inline bool -operator== (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) == 0; -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool -operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -template -inline bool -operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return __y < __x; -} - -template -inline bool -operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__y < __x); -} - -template -inline bool -operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__x < __y); -} - -template -inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { - return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); -} - -#if !defined (_STLP_USE_NO_IOSTREAMS) -template -basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o, - const rope<_CharT, _Alloc>& __r); -#endif - -typedef rope crope; -#if defined (_STLP_HAS_WCHAR_T) -typedef rope wrope; -#endif - -inline crope::reference __mutable_reference_at(crope& __c, size_t __i) -{ return __c.mutable_reference_at(__i); } - -#if defined (_STLP_HAS_WCHAR_T) -inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) -{ return __c.mutable_reference_at(__i); } -#endif - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -template -inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) -{ __x.swap(__y); } -#else - -inline void swap(crope& __x, crope& __y) { __x.swap(__y); } -# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97 -inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); } -# endif - -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - - -// Hash functions should probably be revisited later: -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(const crope& __str) const { - size_t _p_size = __str.size(); - - if (0 == _p_size) return 0; - return 13*__str[0] + 5*__str[_p_size - 1] + _p_size; - } -}; - -#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97 -_STLP_TEMPLATE_NULL struct hash { - size_t operator()(const wrope& __str) const { - size_t _p_size = __str.size(); - - if (0 == _p_size) return 0; - return 13*__str[0] + 5*__str[_p_size - 1] + _p_size; - } -}; -#endif - -#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) -// I couldn't get this to work with VC++ -template -# if defined (__DMC__) && !defined (__PUT_STATIC_DATA_MEMBERS_HERE) -extern -# endif -void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first, - _Rope_iterator<_CharT, _Alloc> __middle, - _Rope_iterator<_CharT, _Alloc> __last); - -inline void rotate(_Rope_iterator __first, - _Rope_iterator __middle, - _Rope_iterator __last) -{ _Rope_rotate(__first, __middle, __last); } -#endif - -template -inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const { - if (_M_current_valid) { - return _M_current; - } else { - return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos); - } -} - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - //Completness depends on the allocator: - typedef typename __move_traits<_Alloc>::complete complete; -}; -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_ROPE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_set.h b/SDK/stlport/stl/_set.h deleted file mode 100644 index 6fd58d50..00000000 --- a/SDK/stlport/stl/_set.h +++ /dev/null @@ -1,402 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_SET_H -#define _STLP_INTERNAL_SET_H - -#ifndef _STLP_INTERNAL_TREE_H -# include -#endif - -#if !defined (_STLP_USE_PTR_SPECIALIZATIONS) - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, traits) - -template ), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) > -class set -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef set<_Key, _Compare, _Alloc> _Self; -public: -// typedefs: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - -private: - //Specific iterator traits creation - typedef _STLP_PRIV _SetTraitsT _SetTraits; - -public: - //Following typedef have to be public for __move_traits specialization. - typedef _STLP_PRIV _Rb_tree, - _SetTraits, _Alloc> _Rep_type; - - typedef typename _Rep_type::pointer pointer; - typedef typename _Rep_type::const_pointer const_pointer; - typedef typename _Rep_type::reference reference; - typedef typename _Rep_type::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing set - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - - // allocation/deallocation -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit set(const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) -#else - set() - : _M_t(_Compare(), allocator_type()) {} - explicit set(const _Compare& __comp) - : _M_t(__comp, allocator_type()) {} - set(const _Compare& __comp, const allocator_type& __a) -#endif - : _M_t(__comp, __a) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - set(_InputIterator __first, _InputIterator __last, const _Compare& __comp) - : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); } -# endif - template - set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } -#else - set(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - set(const value_type* __first, - const value_type* __last, const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } - - set(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } - - set(const_iterator __first, const_iterator __last, const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - set(const _Self& __x) : _M_t(__x._M_t) {} - - set(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - // accessors: - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return _M_t.key_comp(); } - allocator_type get_allocator() const { return _M_t.get_allocator(); } - - iterator begin() { return _M_t.begin(); } - iterator end() { return _M_t.end(); } - const_iterator begin() const { return _M_t.begin(); } - const_iterator end() const { return _M_t.end(); } - reverse_iterator rbegin() { return _M_t.rbegin(); } - reverse_iterator rend() { return _M_t.rend(); } - const_reverse_iterator rbegin() const { return _M_t.rbegin(); } - const_reverse_iterator rend() const { return _M_t.rend(); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - pair insert(const value_type& __x) - { return _M_t.insert_unique(__x); } - iterator insert(iterator __pos, const value_type& __x) - { return _M_t.insert_unique( __pos , __x); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_unique(__first, __last); } -#else - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_unique(__first, __last); } - void insert(const value_type* __first, const value_type* __last) - { _M_t.insert_unique(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - void erase(iterator __pos) { _M_t.erase( __pos ); } - size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); } - void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); } - void clear() { _M_t.clear(); } - - // set operations: - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const - { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) - { return _M_t.equal_range_unique(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const - { return _M_t.equal_range_unique(__x); } -}; - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, traits) - -template ), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) > -class multiset -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef multiset<_Key, _Compare, _Alloc> _Self; -public: - // typedefs: - - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - -private: - //Specific iterator traits creation - typedef _STLP_PRIV _MultisetTraitsT _MultisetTraits; - -public: - //Following typedef have to be public for __move_traits specialization. - typedef _STLP_PRIV _Rb_tree, - _MultisetTraits, _Alloc> _Rep_type; - - typedef typename _Rep_type::pointer pointer; - typedef typename _Rep_type::const_pointer const_pointer; - typedef typename _Rep_type::reference reference; - typedef typename _Rep_type::const_reference const_reference; - typedef typename _Rep_type::iterator iterator; - typedef typename _Rep_type::const_iterator const_iterator; - typedef typename _Rep_type::reverse_iterator reverse_iterator; - typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Rep_type::size_type size_type; - typedef typename _Rep_type::difference_type difference_type; - typedef typename _Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing multiset - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit multiset(const _Compare& __comp = _Compare(), - const allocator_type& __a = allocator_type()) -#else - multiset() - : _M_t(_Compare(), allocator_type()) {} - explicit multiset(const _Compare& __comp) - : _M_t(__comp, allocator_type()) {} - multiset(const _Compare& __comp, const allocator_type& __a) -#endif - : _M_t(__comp, __a) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp) - : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); } -# endif -#else - multiset(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - - multiset(const value_type* __first, const value_type* __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } - - multiset(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } - - multiset(const_iterator __first, const_iterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - multiset(const _Self& __x) : _M_t(__x._M_t) {} - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - multiset(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - // accessors: - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return _M_t.key_comp(); } - allocator_type get_allocator() const { return _M_t.get_allocator(); } - - iterator begin() { return _M_t.begin(); } - iterator end() { return _M_t.end(); } - const_iterator begin() const { return _M_t.begin(); } - const_iterator end() const { return _M_t.end(); } - reverse_iterator rbegin() { return _M_t.rbegin(); } - reverse_iterator rend() { return _M_t.rend(); } - const_reverse_iterator rbegin() const { return _M_t.rbegin(); } - const_reverse_iterator rend() const { return _M_t.rend(); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - iterator insert(const value_type& __x) - { return _M_t.insert_equal(__x); } - iterator insert(iterator __pos, const value_type& __x) - { return _M_t.insert_equal(__pos, __x); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_equal(__first, __last); } -#else - void insert(const value_type* __first, const value_type* __last) - { _M_t.insert_equal(__first, __last); } - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_equal(__first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - void erase(iterator __pos) { _M_t.erase( __pos ); } - size_type erase(const key_type& __x) { return _M_t.erase(__x); } - void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); } - void clear() { _M_t.clear(); } - - // multiset operations: - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const { return _M_t.find(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const { return _M_t.count(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) { return _M_t.equal_range(__x); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const { return _M_t.equal_range(__x); } -}; - -#else -# include -_STLP_BEGIN_NAMESPACE -#endif /* _STLP_USE_PTR_SPECIALIZATIONS */ - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Rep_type> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Rep_type> -{}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_slist.c b/SDK/stlport/stl/_slist.c deleted file mode 100644 index ba158d00..00000000 --- a/SDK/stlport/stl/_slist.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_SLIST_C -#define _STLP_SLIST_C - -#ifndef _STLP_INTERNAL_SLIST_H -# include -#endif - -#ifndef _STLP_CARRAY_H -# include -#endif - -#ifndef _STLP_RANGE_ERRORS_H -# include -#endif - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# define size_type size_t -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_Slist_node_base* -_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first, - _Slist_node_base* __last_node) { - _Slist_node_base* __cur = __before_first->_M_next; - while (__cur != __last_node) { - _Node* __tmp = __STATIC_CAST(_Node*, __cur); - __cur = __cur->_M_next; - _STLP_STD::_Destroy(&__tmp->_M_data); - _M_head.deallocate(__tmp,1); - } - __before_first->_M_next = __last_node; - return __last_node; -} - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define slist _STLP_PTR_IMPL_NAME(slist) -#elif defined (_STLP_DEBUG) -# define slist _STLP_NON_DBG_NAME(slist) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -/* When building STLport lib Digital Mars Compiler complains on the _M_data assignment - * problem which would be perfertly right if we were using it. Hiding it during build - * fix this issue. - */ -template -slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) { - if (&__x != this) { - _Node_base* __p1 = &this->_M_head._M_data; - _Node_base* __n1 = this->_M_head._M_data._M_next; - const _Node_base* __n2 = __x._M_head._M_data._M_next; - while (__n1 && __n2) { - __STATIC_CAST(_Node*, __n1)->_M_data = __STATIC_CAST(const _Node*, __n2)->_M_data; - __p1 = __n1; - __n1 = __n1->_M_next; - __n2 = __n2->_M_next; - } - if (__n2 == 0) - this->_M_erase_after(__p1, 0); - else - _M_insert_after_range(__p1, const_iterator(__CONST_CAST(_Node_base*, __n2)), - const_iterator(0)); - } - return *this; -} - -template -void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { - _Node_base* __prev = &this->_M_head._M_data; - _Node_base* __node = this->_M_head._M_data._M_next; - for ( ; __node != 0 && __n > 0 ; --__n) { - __STATIC_CAST(_Node*, __node)->_M_data = __val; - __prev = __node; - __node = __node->_M_next; - } - if (__n > 0) - _M_insert_after_fill(__prev, __n, __val); - else - this->_M_erase_after(__prev, 0); -} - -template -void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) { - _Node_base* __cur = &this->_M_head._M_data; - while (__cur->_M_next != 0 && __len > 0) { - --__len; - __cur = __cur->_M_next; - } - if (__cur->_M_next) - this->_M_erase_after(__cur, 0); - else - _M_insert_after_fill(__cur, __len, __x); -} - -template -void slist<_Tp,_Alloc>::remove(const _Tp& __val) { - _Node_base* __cur = &this->_M_head._M_data; - while (__cur && __cur->_M_next) { - if (__STATIC_CAST(_Node*, __cur->_M_next)->_M_data == __val) - this->_M_erase_after(__cur); - else - __cur = __cur->_M_next; - } -} - -#if !defined (slist) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __pred) { - typedef _Slist_node<_Tp> _Node; - typename slist<_Tp, _Alloc>::iterator __ite(__that.begin()); - if (__ite != __that.end()) { - while (__ite._M_node->_M_next) { - if (__pred(*__ite, __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) - __that.erase_after(__ite); - else - ++__ite; - } - } -} - -template -void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x, - _StrictWeakOrdering __comp) { - typedef _Slist_node<_Tp> _Node; - typedef _STLP_PRIV _Slist_node_base _Node_base; - if (__that.get_allocator() == __x.get_allocator()) { - typename slist<_Tp, _Alloc>::iterator __ite(__that.before_begin()); - while (__ite._M_node->_M_next && !__x.empty()) { - if (__comp(__x.front(), __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) { - _STLP_VERBOSE_ASSERT(!__comp(__STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data, __x.front()), - _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - __that.splice_after(__ite, __x, __x.before_begin()); - } - ++__ite; - } - if (!__x.empty()) { - __that.splice_after(__ite, __x); - } - } - else { - typename slist<_Tp, _Alloc>::iterator __i1(__that.before_begin()), __i2(__x.begin()); - while (__i1._M_node->_M_next && __i2._M_node) { - if (__comp(__STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data, *__i2)) { - _STLP_VERBOSE_ASSERT(!__comp(*__i2, __STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data), - _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - ++__i1; - } - else { - __i1 = __that.insert_after(__i1, *(__i2++)); - } - } - __that.insert_after(__i1, __i2, __x.end()); - __x.clear(); - } -} - -template -void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) { - if (!__that.begin()._M_node || !__that.begin()._M_node->_M_next) - return; - - slist<_Tp, _Alloc> __carry(__that.get_allocator()); - const int NB = 64; - _STLP_PRIV _CArray, NB> __counter(__carry); - int __fill = 0; - while (!__that.empty()) { - __carry.splice_after(__carry.before_begin(), __that, __that.before_begin()); - int __i = 0; - while (__i < __fill && !__counter[__i].empty()) { - _STLP_PRIV _Slist_merge(__counter[__i], __carry, __comp); - __carry.swap(__counter[__i]); - ++__i; - } - __carry.swap(__counter[__i]); - if (__i == __fill) { - ++__fill; - if (__fill >= NB) { - //Looks like the slist has too many elements to be sorted with this algorithm: - __stl_throw_overflow_error("slist::sort"); - } - } - } - - for (int __i = 1; __i < __fill; ++__i) - _STLP_PRIV _Slist_merge(__counter[__i], __counter[__i - 1], __comp); - __that.swap(__counter[__fill-1]); -} - -#if defined (slist) -# undef slist -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# undef size_type -#endif - -#endif /* _STLP_SLIST_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_slist.h b/SDK/stlport/stl/_slist.h deleted file mode 100644 index b0d941a8..00000000 --- a/SDK/stlport/stl/_slist.h +++ /dev/null @@ -1,906 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_SLIST_H -#define _STLP_INTERNAL_SLIST_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_SLIST_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class _Slist_node : public _Slist_node_base { -public: - _Tp _M_data; - __TRIVIAL_STUFF(_Slist_node) -}; - -struct _Slist_iterator_base { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef forward_iterator_tag iterator_category; - - _Slist_node_base *_M_node; - - _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {} - - void _M_incr() { - _M_node = _M_node->_M_next; - } -}; - -template -class _Slist_iterator : public _Slist_iterator_base { -public: - typedef typename _Traits::value_type value_type; - typedef typename _Traits::pointer pointer; - typedef typename _Traits::reference reference; - typedef forward_iterator_tag iterator_category; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - typedef _Slist_iterator<_Tp, _Traits> _Self; - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef _Slist_iterator<_Tp, _NonConstTraits> iterator; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator; - - typedef _Slist_node _Node; - - explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {} - _Slist_iterator() : _Slist_iterator_base(0) {} - //copy constructor for iterator and constructor from iterator for const_iterator - _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {} - - reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; } - - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - _M_incr(); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - _M_incr(); - return __tmp; - } - - bool operator==(const_iterator __y ) const { - return this->_M_node == __y._M_node; - } - bool operator!=(const_iterator __y ) const { - return this->_M_node != __y._M_node; - } -}; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -_STLP_MOVE_TO_STD_NAMESPACE -template -struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -_STLP_MOVE_TO_STD_NAMESPACE -template -inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); } -inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; } -inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); } -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* OLD_QUERIES */ - -// Base class that encapsulates details of allocators and simplifies EH -template -class _Slist_base { -protected: - typedef _Slist_node<_Tp> _Node; - typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type; - typedef _Slist_base<_Tp, _Alloc> _Self; - -public: - typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy; - - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; - - _Slist_base(const allocator_type& __a) : - _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() ) { - _M_head._M_data._M_next = 0; - } - _Slist_base(__move_source<_Self> src) : - _M_head(__move_source<_AllocProxy>(src.get()._M_head)) { - src.get()._M_head._M_data._M_next = 0; - } - ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); } - -protected: - _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) { - _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next); - _Slist_node_base* __next_next = __next->_M_next; - __pos->_M_next = __next_next; - _STLP_STD::_Destroy(&__next->_M_data); - _M_head.deallocate(__next,1); - return __next_next; - } - _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); - -public: - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); } - _AllocProxy _M_head; -}; - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define slist _STLP_PTR_IMPL_NAME(slist) -#elif defined (_STLP_DEBUG) -# define slist _STLP_NON_DBG_NAME(slist) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class slist; - -#if !defined (slist) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -// helper functions to reduce code duplication -template -void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred); - -template -void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x, - _StrictWeakOrdering __comp); - -template -void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp); - -#if !defined (slist) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc> -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist) - , public __stlport_class > -#endif -{ -private: - typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base; - typedef slist<_Tp,_Alloc> _Self; -public: - typedef _Tp value_type; - - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef forward_iterator_tag _Iterator_category; - - typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; - typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator; - - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Base::allocator_type allocator_type; - -private: - typedef _STLP_PRIV _Slist_node<_Tp> _Node; - typedef _STLP_PRIV _Slist_node_base _Node_base; - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - _Node* _M_create_node(const value_type& __x = _Tp()) { -#else - _Node* _M_create_node(const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _Node* __node = this->_M_head.allocate(1); - _STLP_TRY { - _Copy_Construct(&__node->_M_data, __x); - __node->_M_next = 0; - } - _STLP_UNWIND(this->_M_head.deallocate(__node, 1)) - return __node; - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - _Node* _M_create_node() { - _Node* __node = this->_M_head.allocate(1); - _STLP_TRY { - _STLP_STD::_Construct(&__node->_M_data); - __node->_M_next = 0; - } - _STLP_UNWIND(this->_M_head.deallocate(__node, 1)) - return __node; - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -public: - - allocator_type get_allocator() const { return _Base::get_allocator(); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(const allocator_type& __a = allocator_type()) -#else - slist() - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {} - slist(const allocator_type& __a) -#endif - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {} - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp), - const allocator_type& __a = allocator_type()) -#else - explicit slist(size_type __n) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) - { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } - slist(size_type __n, const value_type& __x) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) - { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); } - slist(size_type __n, const value_type& __x, const allocator_type& __a) -#endif - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) - { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because _M_insert_after_range - // already does them. - template - slist(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) - { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - // VC++ needs this crazyness - template - slist(_InputIterator __first, _InputIterator __last) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) - { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } -# endif -#else /* _STLP_MEMBER_TEMPLATES */ - slist(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type() ) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) - { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } - slist(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) - { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - slist(const _Self& __x) - : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator()) - { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); } - - slist(__move_source<_Self> src) - : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {} - - _Self& operator= (const _Self& __x); - - ~slist() {} - -public: - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } - -private: - void _M_fill_assign(size_type __n, const _Tp& __val); - -#if defined (_STLP_MEMBER_TEMPLATES) -public: - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } - -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) { - _M_fill_assign((size_type) __n, (_Tp) __val); - } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) { -#else -public: - void assign(const_pointer __first, const_pointer __last) { - _Node_base* __prev = &this->_M_head._M_data; - _Node_base* __node = this->_M_head._M_data._M_next; - while (__node != 0 && __first != __last) { - __STATIC_CAST(_Node*, __node)->_M_data = *__first; - __prev = __node; - __node = __node->_M_next; - ++__first; - } - if (__first != __last) - _M_insert_after_range(__prev, __first, __last); - else - this->_M_erase_after(__prev, 0); - } - void assign(const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - _Node_base* __prev = &this->_M_head._M_data; - _Node_base* __node = this->_M_head._M_data._M_next; - while (__node != 0 && __first != __last) { - __STATIC_CAST(_Node*, __node)->_M_data = *__first; - __prev = __node; - __node = __node->_M_next; - ++__first; - } - if (__first != __last) - _M_insert_after_range(__prev, __first, __last); - else - this->_M_erase_after(__prev, 0); - } - -public: - - // Experimental new feature: before_begin() returns a - // non-dereferenceable iterator that, when incremented, yields - // begin(). This iterator may be used as the argument to - // insert_after, erase_after, etc. Note that even for an empty - // slist, before_begin() is not the same iterator as end(). It - // is always necessary to increment before_begin() at least once to - // obtain end(). - iterator before_begin() { return iterator(&this->_M_head._M_data); } - const_iterator before_begin() const - { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); } - - iterator begin() { return iterator(this->_M_head._M_data._M_next); } - const_iterator begin() const - { return const_iterator(this->_M_head._M_data._M_next);} - - iterator end() { return iterator(); } - const_iterator end() const { return const_iterator(); } - - size_type size() const - { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); } - - size_type max_size() const { return size_type(-1); } - - bool empty() const { return this->_M_head._M_data._M_next == 0; } - - void swap(_Self& __x) { - this->_M_head.swap(__x._M_head); - } - -public: - reference front() { return *begin(); } - const_reference front() const { return *begin(); } -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front(const value_type& __x = _Tp()) { -#else - void push_front(const value_type& __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());} -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void pop_front() { - _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next); - this->_M_head._M_data._M_next = __node->_M_next; - _STLP_STD::_Destroy(&__node->_M_data); - this->_M_head.deallocate(__node, 1); - } - - iterator previous(const_iterator __pos) { - return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node)); - } - const_iterator previous(const_iterator __pos) const { - return const_iterator(__CONST_CAST(_Node_base*, - _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, - __pos._M_node))); - } - -private: -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) { -#else - _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x))); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - _Node* _M_insert_after(_Node_base* __pos) { - return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node())); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void _M_insert_after_fill(_Node_base* __pos, - size_type __n, const value_type& __x) { - for (size_type __i = 0; __i < __n; ++__i) - __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // Check whether it's an integral type. If so, it's not an iterator. - template - void _M_insert_after_range(_Node_base* __pos, - _InIter __first, _InIter __last) { - typedef typename _IsIntegral<_InIter>::_Ret _Integral; - _M_insert_after_range(__pos, __first, __last, _Integral()); - } - - template - void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, - const __true_type&) { - _M_insert_after_fill(__pos, __n, __x); - } - - template - void _M_insert_after_range(_Node_base* __pos, - _InIter __first, _InIter __last, - const __false_type&) { -#else /* _STLP_MEMBER_TEMPLATES */ - void _M_insert_after_range(_Node_base* __pos, - const value_type* __first, - const value_type* __last) { - while (__first != __last) { - __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); - ++__first; - } - } - void _M_insert_after_range(_Node_base* __pos, - const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - while (__first != __last) { - __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); - ++__first; - } - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // Check whether it's an integral type. If so, it's not an iterator. - template - void _M_splice_after_range(_Node_base* __pos, - _InIter __first, _InIter __last) { - typedef typename _IsIntegral<_InIter>::_Ret _Integral; - _M_splice_after_range(__pos, __first, __last, _Integral()); - } - - template - void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x, - const __true_type&) { - _M_insert_after_fill(__pos, __n, __x); - } - - template - void _M_splice_after_range(_Node_base* __pos, - _InIter __first, _InIter __last, - const __false_type&) { -#else /* _STLP_MEMBER_TEMPLATES */ - void _M_splice_after_range(_Node_base* __pos, - const value_type* __first, - const value_type* __last) { - while (__first != __last) { - __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); - ++__first; - } - } - void _M_splice_after_range(_Node_base* __pos, - const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - //We use a temporary slist to avoid the auto reference troubles (infinite loop) - _Self __tmp(__first, __last, this->get_allocator()); - splice_after(iterator(__pos), __tmp); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // Check whether it's an integral type. If so, it's not an iterator. - template - void _M_splice_range(_Node_base* __pos, - _InIter __first, _InIter __last) { - typedef typename _IsIntegral<_InIter>::_Ret _Integral; - _M_splice_range(__pos, __first, __last, _Integral()); - } - - template - void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x, - const __true_type&) { - _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos), - __n, __x); - } - - template - void _M_splice_range(_Node_base* __pos, - _InIter __first, _InIter __last, - const __false_type&) { -#else /* _STLP_MEMBER_TEMPLATES */ - void _M_splice_range(_Node_base* __pos, - const value_type* __first, - const value_type* __last) { - while (__first != __last) { - __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); - ++__first; - } - } - void _M_splice_range(_Node_base* __pos, - const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - //We use a temporary slist to avoid the auto reference troubles (infinite loop) - _Self __tmp(__first, __last, this->get_allocator()); - splice(iterator(__pos), __tmp); - } - -public: - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos, const value_type& __x = _Tp()) { -#else - iterator insert_after(iterator __pos, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - return iterator(_M_insert_after(__pos._M_node, __x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos) { - return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert_after(iterator __pos, size_type __n, const value_type& __x) { - _M_insert_after_fill(__pos._M_node, __n, __x); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because _M_insert_after_range - // already does them. - template - void insert_after(iterator __pos, _InIter __first, _InIter __last) { -#else /* _STLP_MEMBER_TEMPLATES */ - void insert_after(iterator __pos, - const value_type* __first, const value_type* __last) { - _M_insert_after_range(__pos._M_node, __first, __last); - } - void insert_after(iterator __pos, - const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - _M_splice_after_range(__pos._M_node, __first, __last); - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos, const value_type& __x = _Tp()) { -#else - iterator insert(iterator __pos, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - __x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos) { - return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - _STLP_DEFAULT_CONSTRUCTED(_Tp))); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) { - _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because _M_insert_after_range - // already does them. - template - void insert(iterator __pos, _InIter __first, _InIter __last) { -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __pos, const value_type* __first, - const value_type* __last) { - _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - __first, __last); - } - void insert(iterator __pos, const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - _M_splice_range(__pos._M_node, __first, __last); - } - -public: - iterator erase_after(iterator __pos) - { return iterator(this->_M_erase_after(__pos._M_node)); } - iterator erase_after(iterator __before_first, iterator __last) - { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); } - - iterator erase(iterator __pos) - { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); } - iterator erase(iterator __first, iterator __last) - { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type new_size, const value_type& __x = _Tp()); -#else - void resize(size_type new_size, const value_type& __x); -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void clear() - { this->_M_erase_after(&this->_M_head._M_data, 0); } - -public: - // Moves the range [__before_first + 1, __before_last + 1) to *this, - // inserting it immediately after __pos. This is constant time. - void splice_after(iterator __pos, _Self& __x, - iterator __before_first, iterator __before_last) { - if (__before_first != __before_last) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, - __before_first._M_node, __before_last._M_node); - } - else { - this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next)); - __x.erase_after(__before_first, ++__before_last); - } - } - } - - // Moves the element that follows __prev to *this, inserting it immediately - // after __pos. This is constant time. - void splice_after(iterator __pos, _Self& __x, iterator __prev) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, - __prev._M_node, __prev._M_node->_M_next); - } - else { - this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data); - __x.erase_after(__prev); - } - } - - // Removes all of the elements from the list __x to *this, inserting - // them immediately after __pos. __x must not be *this. Complexity: - // linear in __x.size(). - void splice_after(iterator __pos, _Self& __x) { - if (this->get_allocator() == __x.get_allocator()) - _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data); - else { - this->insert_after(__pos, __x.begin(), __x.end()); - __x.clear(); - } - } - - // Linear in distance(begin(), __pos), and linear in __x.size(). - void splice(iterator __pos, _Self& __x) { - if (__x._M_head._M_data._M_next) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - &__x._M_head._M_data, - _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0)); - } - else { - insert(__pos, __x.begin(), __x.end()); - __x.clear(); - } - } - } - - // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). - void splice(iterator __pos, _Self& __x, iterator __i) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node), - __i._M_node); - } - else { - insert(__pos, *__i); - __x.erase(__i); - } - } - - // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), - // and in distance(__first, __last). - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { - if (__first != __last) { - if (this->get_allocator() == __x.get_allocator()) { - _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), - _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node), - _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node)); - } - else { - insert(__pos, __first, __last); - __x.erase(__first, __last); - } - } - } - -public: - void reverse() { - if (this->_M_head._M_data._M_next) - this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next); - } - - void remove(const _Tp& __val); - - void unique() { _STLP_PRIV _Slist_unique(*this, equal_to()); } - void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less()); } - void sort() { _STLP_PRIV _Slist_sort(*this, less()); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void remove_if(_Predicate __pred) { - _Node_base* __cur = &this->_M_head._M_data; - while (__cur->_M_next) { - if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data)) - this->_M_erase_after(__cur); - else - __cur = __cur->_M_next; - } - } - - template - void unique(_BinaryPredicate __pred) - { _STLP_PRIV _Slist_unique(*this, __pred); } - - template - void merge(_Self& __x, _StrictWeakOrdering __comp) - { _STLP_PRIV _Slist_merge(*this, __x, __comp); } - - template - void sort(_StrictWeakOrdering __comp) - { _STLP_PRIV _Slist_sort(*this, __comp); } -#endif /* _STLP_MEMBER_TEMPLATES */ -}; - -#if defined (slist) -# undef slist -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -inline bool _STLP_CALL -operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { - typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator; - const_iterator __end1 = _SL1.end(); - const_iterator __end2 = _SL2.end(); - - const_iterator __i1 = _SL1.begin(); - const_iterator __i2 = _SL2.begin(); - while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { - ++__i1; - ++__i2; - } - return __i1 == __end1 && __i2 == __end2; -} - -#define _STLP_EQUAL_OPERATOR_SPECIALIZED -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER -#undef _STLP_EQUAL_OPERATOR_SPECIALIZED - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - typedef typename __move_traits<_Alloc>::complete complete; -}; - -// Specialization of insert_iterator so that insertions will be constant -// time rather than linear time. -template -class insert_iterator > { -protected: - typedef slist<_Tp, _Alloc> _Container; - _Container* _M_container; - typename _Container::iterator _M_iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x, typename _Container::iterator __i) - : _M_container(&__x) { - if (__i == __x.begin()) - _M_iter = __x.before_begin(); - else - _M_iter = __x.previous(__i); - } - - insert_iterator<_Container>& - operator = (const typename _Container::value_type& __val) { - _M_iter = _M_container->insert_after(_M_iter, __val); - return *this; - } - - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_SLIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_slist_base.c b/SDK/stlport/stl/_slist_base.c deleted file mode 100644 index e0e68c9b..00000000 --- a/SDK/stlport/stl/_slist_base.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_SLIST_BASE_C -#define _STLP_SLIST_BASE_C - -#ifndef _STLP_INTERNAL_SLIST_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_Slist_node_base* _STLP_CALL -_Sl_global<_Dummy>::__previous(_Slist_node_base* __head, - const _Slist_node_base* __node) { - while (__head && __head->_M_next != __node) - __head = __head->_M_next; - return __head; -} - -template -void _STLP_CALL -_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) { - _Slist_node_base* __before_last = __previous(__head, 0); - if (__before_last != __head) { - _Slist_node_base* __after = __pos->_M_next; - __pos->_M_next = __head->_M_next; - __head->_M_next = 0; - __before_last->_M_next = __after; - } -} - -template -void _STLP_CALL -_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, - _Slist_node_base* __before_first, - _Slist_node_base* __before_last) { - if (__pos != __before_first && __pos != __before_last) { - _Slist_node_base* __first = __before_first->_M_next; - _Slist_node_base* __after = __pos->_M_next; - __before_first->_M_next = __before_last->_M_next; - __pos->_M_next = __first; - __before_last->_M_next = __after; - } -} - -template -_Slist_node_base* _STLP_CALL -_Sl_global<_Dummy>::__reverse(_Slist_node_base* __node) { - _Slist_node_base* __result = __node; - __node = __node->_M_next; - __result->_M_next = 0; - while(__node) { - _Slist_node_base* __next = __node->_M_next; - __node->_M_next = __result; - __result = __node; - __node = __next; - } - return __result; -} - -template -size_t _STLP_CALL -_Sl_global<_Dummy>::size(_Slist_node_base* __node) { - size_t __result = 0; - for ( ; __node != 0; __node = __node->_M_next) - ++__result; - return __result; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_SLIST_BASE_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_slist_base.h b/SDK/stlport/stl/_slist_base.h deleted file mode 100644 index 3afa18a1..00000000 --- a/SDK/stlport/stl/_slist_base.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_SLIST_BASE_H -#define _STLP_INTERNAL_SLIST_BASE_H - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -struct _Slist_node_base { - _Slist_node_base* _M_next; -}; - -inline _Slist_node_base* -__slist_make_link(_Slist_node_base* __prev_node, - _Slist_node_base* __new_node) { - __new_node->_M_next = __prev_node->_M_next; - __prev_node->_M_next = __new_node; - return __new_node; -} - - -template -class _Sl_global { -public: - // those used to be global functions - // moved here to reduce code bloat without templatizing _Slist_iterator_base - static size_t _STLP_CALL size(_Slist_node_base* __node); - static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node); - static void _STLP_CALL __splice_after(_Slist_node_base* __pos, - _Slist_node_base* __before_first, - _Slist_node_base* __before_last); - - static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head); - - static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head, - const _Slist_node_base* __node); - static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head, - const _Slist_node_base* __node) { - return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node); - } -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _Sl_global; -#endif - -typedef _Sl_global _Sl_global_inst; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) -# include -#endif - -#endif /* _STLP_INTERNAL_SLIST_BASE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_sparc_atomic.h b/SDK/stlport/stl/_sparc_atomic.h deleted file mode 100644 index 40d10f37..00000000 --- a/SDK/stlport/stl/_sparc_atomic.h +++ /dev/null @@ -1,62 +0,0 @@ - -// Currently, SUN CC requires object file - -#if defined (__GNUC__) - -/* -** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value) -*/ - -# if defined(__sparc_v9__) || defined (__sparcv9) - -# ifdef __arch64__ - -# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \ - "=r" (_L_value2), "=m" (*_L_pvalue1) : \ - "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) ) - -# else /* __arch64__ */ - -# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \ - "=r" (_L_value2), "=m" (*_L_pvalue1) : \ - "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) ) -# endif - -# else /* __sparc_v9__ */ - -# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \ - "=r" (_L_value2), "=m" (*_L_pvalue1) : \ - "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) ) -# endif - - -# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \ - ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ - register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \ - do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ - _L_value1; }) - -# define _STLP_ATOMIC_INCREMENT(__pvalue1) \ - ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ - register __stl_atomic_t _L_value1, _L_value2; \ - do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ - (_L_value2 + 1); }) - -# define _STLP_ATOMIC_DECREMENT(__pvalue1) \ - ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ - register __stl_atomic_t _L_value1, _L_value2; \ - do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ - (_L_value2 - 1); }) - -# elif ! defined (_STLP_NO_EXTERN_INLINE) - -extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v); -extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i); -extern "C" void _STLP_atomic_increment(__stl_atomic_t* i); - -# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x) -# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x) -# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y) - -# endif - diff --git a/SDK/stlport/stl/_sstream.c b/SDK/stlport/stl/_sstream.c deleted file mode 100644 index cbf439ff..00000000 --- a/SDK/stlport/stl/_sstream.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_SSTREAM_C -#define _STLP_SSTREAM_C - -#ifndef _STLP_INTERNAL_SSTREAM -# include -#endif - -#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) -// no wint_t is supported for this mode -# define __BSB_int_type__ int -# define __BSB_pos_type__ streampos -#else -# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type -# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Non-inline stringbuf member functions. - -// Constructors. Note that the base class constructor sets all of the -// get and area pointers to null. - -template -basic_stringbuf<_CharT, _Traits, _Alloc> - ::basic_stringbuf(ios_base::openmode __mode) - : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str() -{} - -template -basic_stringbuf<_CharT, _Traits, _Alloc> - ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode) - : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s) -{ - _M_set_ptrs(); -} - -template -basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf() -{} - -// Set the underlying string to a new value. -template -void -basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s) -{ - _M_str = __s; - _M_set_ptrs(); -} - -template -void -basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs() { - _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data()); - _CharT* __data_end = __data_ptr + _M_str.size(); - // The initial read position is the beginning of the string. - if (_M_mode & ios_base::in) { - if (_M_mode & ios_base::ate) - this->setg(__data_ptr, __data_end, __data_end); - else - this->setg(__data_ptr, __data_ptr, __data_end); - } - - // The initial write position is the beginning of the string. - if (_M_mode & ios_base::out) { - if (_M_mode & (ios_base::app | ios_base::ate)) - this->setp(__data_end, __data_end); - else - this->setp(__data_ptr, __data_end); - } -} - -// Precondition: gptr() >= egptr(). Returns a character, if one is available. -template -__BSB_int_type__ -basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() { - return this->gptr() != this->egptr() - ? _Traits::to_int_type(*this->gptr()) - : _Traits::eof(); -} - -// Precondition: gptr() >= egptr(). -template -__BSB_int_type__ -basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() { - if (this->gptr() != this->egptr()) { - int_type __c = _Traits::to_int_type(*this->gptr()); - this->gbump(1); - return __c; - } - else - return _Traits::eof(); -} - -template -__BSB_int_type__ -basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) { - if (this->gptr() != this->eback()) { - if (!_Traits::eq_int_type(__c, _Traits::eof())) { - if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) { - this->gbump(-1); - return __c; - } - else if (_M_mode & ios_base::out) { - this->gbump(-1); - *this->gptr() = _Traits::to_char_type(__c); - return __c; - } - else - return _Traits::eof(); - } - else { - this->gbump(-1); - return _Traits::not_eof(__c); - } - } - else - return _Traits::eof(); -} - -template -__BSB_int_type__ -basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c) { - // fbp : reverse order of "ifs" to pass Dietmar's test. - // Apparently, standard allows overflow with eof even for read-only streams. - if (!_Traits::eq_int_type(__c, _Traits::eof())) { - if (_M_mode & ios_base::out) { - if (!(_M_mode & ios_base::in)) { - // It's a write-only streambuf, so we can use special append buffer. - if (this->pptr() == this->epptr()) - this->_M_append_buffer(); - - if (this->pptr() != this->epptr()) { - *this->pptr() = _Traits::to_char_type(__c); - this->pbump(1); - return __c; - } - else - return _Traits::eof(); - } - else { - // We're not using a special append buffer, just the string itself. - if (this->pptr() == this->epptr()) { - ptrdiff_t __offset = this->gptr() - this->eback(); - _M_str.push_back(_Traits::to_char_type(__c)); - - _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data()); - size_t __data_size = _M_str.size(); - - this->setg(__data_ptr, __data_ptr + __offset, __data_ptr+__data_size); - this->setp(__data_ptr, __data_ptr + __data_size); - this->pbump((int)__data_size); - return __c; - } - else { - *this->pptr() = _Traits::to_char_type(__c); - this->pbump(1); - return __c; - } - } - } - else // Overflow always fails if it's read-only - return _Traits::eof(); - } - else // __c is EOF, so we don't have to do anything - return _Traits::not_eof(__c); -} - -template -streamsize -basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s, - streamsize __n) { - streamsize __nwritten = 0; - - if ((_M_mode & ios_base::out) && __n > 0) { - // If the put pointer is somewhere in the middle of the string, - // then overwrite instead of append. - if (this->pbase() == _M_str.data() ) { - ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr(); - if (__avail > __n) { - _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n)); - this->pbump((int)__n); - return __n; - } - else { - _Traits::copy(this->pptr(), __s, __avail); - __nwritten += __avail; - __n -= __avail; - __s += __avail; - this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz)); - } - } - - // At this point we know we're appending. - if (_M_mode & ios_base::in) { - ptrdiff_t __get_offset = this->gptr() - this->eback(); - _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n)); - - _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data()); - size_t __data_size = _M_str.size(); - - this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size); - this->setp(__data_ptr, __data_ptr + __data_size); - this->pbump((int)__data_size); - } - else { - _M_append_buffer(); - _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n)); - } - - __nwritten += __n; - } - - return __nwritten; -} - -template -streamsize -basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c, - streamsize __n) { - streamsize __nwritten = 0; - - if ((_M_mode & ios_base::out) && __n > 0) { - // If the put pointer is somewhere in the middle of the string, - // then overwrite instead of append. - if (this->pbase() == _M_str.data()) { - ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr(); - if (__avail > __n) { - _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c); - this->pbump(__STATIC_CAST(int, __n)); - return __n; - } - else { - _Traits::assign(this->pptr(), __avail, __c); - __nwritten += __avail; - __n -= __avail; - this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz)); - } - } - - // At this point we know we're appending. - size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) - : __STATIC_CAST(size_t, __n); - if (this->_M_mode & ios_base::in) { - ptrdiff_t __get_offset = this->gptr() - this->eback(); - _M_str.append(__app_size, __c); - - _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data()); - size_t __data_size = _M_str.size(); - - this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size); - this->setp(__data_ptr, __data_ptr + __data_size); - this->pbump((int)__data_size); - } - else { - _M_append_buffer(); - _M_str.append(__app_size, __c); - } - - __nwritten += __app_size; - } - - return __nwritten; -} - -// According to the C++ standard the effects of setbuf are implementation -// defined, except that setbuf(0, 0) has no effect. In this implementation, -// setbuf(, n), for n > 0, calls reserve(n) on the underlying -// string. -template -basic_streambuf<_CharT, _Traits>* -basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) { - if (__n > 0) { - bool __do_get_area = false; - bool __do_put_area = false; - ptrdiff_t __offg = 0; - ptrdiff_t __offp = 0; - - if (this->pbase() == _M_str.data()) { - __do_put_area = true; - __offp = this->pptr() - this->pbase(); - } - - if (this->eback() == _M_str.data()) { - __do_get_area = true; - __offg = this->gptr() - this->eback(); - } - - if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in)) - _M_append_buffer(); - - _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) - : __STATIC_CAST(size_t, __n)); - - _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data()); - size_t __data_size = _M_str.size(); - - if (__do_get_area) { - this->setg(__data_ptr, __data_ptr + __offg, __data_ptr + __data_size); - } - - if (__do_put_area) { - this->setp(__data_ptr, __data_ptr + __data_size); - this->pbump((int)__offp); - } - } - - return this; -} - -template -__BSB_pos_type__ -basic_stringbuf<_CharT, _Traits, _Alloc> - ::seekoff(off_type __off, - ios_base::seekdir __dir, - ios_base::openmode __mode) { - __mode &= _M_mode; - - bool __imode = (__mode & ios_base::in) != 0; - bool __omode = (__mode & ios_base::out) != 0; - - if ( !(__imode || __omode) ) - return pos_type(off_type(-1)); - - if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) ) - return pos_type(off_type(-1)); - - if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in)) - _M_append_buffer(); - - streamoff __newoff; - switch(__dir) { - case ios_base::beg: - __newoff = 0; - break; - case ios_base::end: - __newoff = _M_str.size(); - break; - case ios_base::cur: - __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase(); - break; - default: - return pos_type(off_type(-1)); - } - - __off += __newoff; - - if (__imode) { - ptrdiff_t __n = this->egptr() - this->eback(); - - if (__off < 0 || __off > __n) - return pos_type(off_type(-1)); - this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off), - this->eback() + __STATIC_CAST(ptrdiff_t, __n)); - } - - if (__omode) { - ptrdiff_t __n = this->epptr() - this->pbase(); - - if (__off < 0 || __off > __n) - return pos_type(off_type(-1)); - this->setp(this->pbase(), this->pbase() + __n); - this->pbump((int)__off); - } - - return pos_type(__off); -} - -template -__BSB_pos_type__ -basic_stringbuf<_CharT, _Traits, _Alloc> - ::seekpos(pos_type __pos, ios_base::openmode __mode) { - __mode &= _M_mode; - - bool __imode = (__mode & ios_base::in) != 0; - bool __omode = (__mode & ios_base::out) != 0; - - if ( !(__imode || __omode) ) - return pos_type(off_type(-1)); - - if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) ) - return pos_type(off_type(-1)); - - const off_type __n = __pos - pos_type(off_type(0)); - if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in)) - _M_append_buffer(); - - if (__imode) { - if (__n < 0 || __n > this->egptr() - this->eback()) - return pos_type(off_type(-1)); - this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr()); - } - - if (__omode) { - if (__n < 0 || size_t(__n) > _M_str.size()) - return pos_type(off_type(-1)); - - _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data()); - size_t __data_size = _M_str.size(); - - this->setp(__data_ptr, __data_ptr+__data_size); - this->pbump((int)__n); - } - - return __pos; -} - -// This is declared as a const member function because it is -// called by basic_stringbuf<>::str(). Precondition: this is a -// write-only stringbuf. We can't use an output buffer for read- -// write stringbufs. Postcondition: pptr is reset to the beginning -// of the buffer. -template -void basic_stringbuf<_CharT, _Traits, _Alloc>::_M_append_buffer() const { - // Do we have a buffer to append? - if (this->pbase() == this->_M_Buf && this->pptr() != this->_M_Buf) { - basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this); - __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr()); -#ifndef __MWERKS__ - __this->setp(__CONST_CAST(_CharT*,_M_Buf), - __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz))); -#else // CodeWarrior treat const char * and const char [8] as different types - __this->setp((_CharT*)_M_Buf, - (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz))); -#endif - } - - // Have we run off the end of the string? - else if (this->pptr() == this->epptr()) { - basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this); -#ifndef __MWERKS__ - __this->setp(__CONST_CAST(_CharT*,_M_Buf), - __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz))); -#else // CodeWarrior treat const char * and const char [8] as different types - __this->setp((_CharT*)_M_Buf, - (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz))); -#endif - } -} - -//---------------------------------------------------------------------- -// Non-inline istringstream member functions. - -template -basic_istringstream<_CharT, _Traits, _Alloc> - ::basic_istringstream(ios_base::openmode __mode) - : basic_istream<_CharT, _Traits>(0), - _M_buf(__mode | ios_base::in) { - this->init(&_M_buf); -} - -template -basic_istringstream<_CharT, _Traits, _Alloc> - ::basic_istringstream(const _String& __str,ios_base::openmode __mode) - : basic_istream<_CharT, _Traits>(0), - _M_buf(__str, __mode | ios_base::in) { - this->init(&_M_buf); -} - -template -basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream() -{} - -//---------------------------------------------------------------------- -// Non-inline ostringstream member functions. - -template -basic_ostringstream<_CharT, _Traits, _Alloc> - ::basic_ostringstream(ios_base::openmode __mode) - : basic_ostream<_CharT, _Traits>(0), - _M_buf(__mode | ios_base::out) { - this->init(&_M_buf); -} - -template -basic_ostringstream<_CharT, _Traits, _Alloc> - ::basic_ostringstream(const _String& __str, ios_base::openmode __mode) - : basic_ostream<_CharT, _Traits>(0), - _M_buf(__str, __mode | ios_base::out) { - this->init(&_M_buf); -} - -template -basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream() -{} - -//---------------------------------------------------------------------- -// Non-inline stringstream member functions. - -template -basic_stringstream<_CharT, _Traits, _Alloc> - ::basic_stringstream(ios_base::openmode __mode) - : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) { - this->init(&_M_buf); -} - -template -basic_stringstream<_CharT, _Traits, _Alloc> - ::basic_stringstream(const _String& __str, ios_base::openmode __mode) - : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) { - this->init(&_M_buf); -} - -template -basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream() -{} - -_STLP_END_NAMESPACE - -# undef __BSB_int_type__ -# undef __BSB_pos_type__ - -#endif /* _STLP_SSTREAM_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_sstream.h b/SDK/stlport/stl/_sstream.h deleted file mode 100644 index 82396489..00000000 --- a/SDK/stlport/stl/_sstream.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -// This header defines classes basic_stringbuf, basic_istringstream, -// basic_ostringstream, and basic_stringstream. These classes -// represent streamsbufs and streams whose sources or destinations are -// C++ strings. - -#ifndef _STLP_INTERNAL_SSTREAM -#define _STLP_INTERNAL_SSTREAM - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAM -# include // Includes , , -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// This version of basic_stringbuf relies on the internal details of -// basic_string. It relies on the fact that, in this implementation, -// basic_string's iterators are pointers. It also assumes (as allowed -// by the standard) that _CharT is a POD type. - -// We have a very small buffer for the put area, just so that we don't -// have to use append() for every sputc. Conceptually, the buffer -// immediately follows the end of the underlying string. We use this -// buffer when appending to write-only streambufs, but we don't use it -// for read-write streambufs. - -template -class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { -public: // Typedefs. - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_streambuf<_CharT, _Traits> _Base; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self; - typedef basic_string<_CharT, _Traits, _Alloc> _String; - -public: // Constructors, destructor. - explicit basic_stringbuf(ios_base::openmode __mode - = ios_base::in | ios_base::out); - explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode - = ios_base::in | ios_base::out); - virtual ~basic_stringbuf(); - -public: // Get or set the string. - _String str() const { _M_append_buffer(); return _M_str; } - void str(const _String& __s); - -protected: // Overridden virtual member functions. - virtual int_type underflow(); - virtual int_type uflow(); - virtual int_type pbackfail(int_type __c); - virtual int_type overflow(int_type __c); - int_type pbackfail() {return pbackfail(_Traits::eof());} - int_type overflow() {return overflow(_Traits::eof());} - - virtual streamsize xsputn(const char_type* __s, streamsize __n); - virtual streamsize _M_xsputnc(char_type __c, streamsize __n); - - virtual _Base* setbuf(_CharT* __buf, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, - ios_base::openmode __mode - = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode - = ios_base::in | ios_base::out); - -private: // Helper functions. - // Append the internal buffer to the string if necessary. - void _M_append_buffer() const; - void _M_set_ptrs(); - -private: - ios_base::openmode _M_mode; - mutable basic_string<_CharT, _Traits, _Alloc> _M_str; - - enum _JustName { _S_BufSiz = 8 }; - _CharT _M_Buf[ 8 /* _S_BufSiz */]; -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf, allocator >; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf, allocator >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -//---------------------------------------------------------------------- -// Class basic_istringstream, an input stream that uses a stringbuf. - -template -class basic_istringstream : public basic_istream<_CharT, _Traits> { -public: // Typedefs - typedef typename _Traits::char_type char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_istream<_CharT, _Traits> _Base; - typedef basic_string<_CharT, _Traits, _Alloc> _String; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; - -public: // Constructors, destructor. - basic_istringstream(ios_base::openmode __mode = ios_base::in); - basic_istringstream(const _String& __str, - ios_base::openmode __mode = ios_base::in); - ~basic_istringstream(); - -public: // Member functions - - basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - _String str() const { return _M_buf.str(); } - void str(const _String& __s) { _M_buf.str(__s); } - -private: - basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - typedef basic_istringstream<_CharT, _Traits> _Self; - //explicitely defined as private to avoid warnings: - basic_istringstream(_Self const&); - _Self& operator = (_Self const&); -#endif -}; - - -//---------------------------------------------------------------------- -// Class basic_ostringstream, an output stream that uses a stringbuf. - -template -class basic_ostringstream : public basic_ostream<_CharT, _Traits> { -public: // Typedefs - typedef typename _Traits::char_type char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_ostream<_CharT, _Traits> _Base; - typedef basic_string<_CharT, _Traits, _Alloc> _String; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; - -public: // Constructors, destructor. - basic_ostringstream(ios_base::openmode __mode = ios_base::out); - basic_ostringstream(const _String& __str, - ios_base::openmode __mode = ios_base::out); - ~basic_ostringstream(); - -public: // Member functions. - - basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - _String str() const { return _M_buf.str(); } - void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE - - -private: - basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - typedef basic_ostringstream<_CharT, _Traits> _Self; - //explicitely defined as private to avoid warnings: - basic_ostringstream(_Self const&); - _Self& operator = (_Self const&); -#endif -}; - - -//---------------------------------------------------------------------- -// Class basic_stringstream, a bidirectional stream that uses a stringbuf. - -template -class basic_stringstream : public basic_iostream<_CharT, _Traits> { -public: // Typedefs - typedef typename _Traits::char_type char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - typedef basic_ios<_CharT, _Traits> _Basic_ios; - typedef basic_iostream<_CharT, _Traits> _Base; - typedef basic_string<_CharT, _Traits, _Alloc> _String; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; - - typedef ios_base::openmode openmode; - -public: // Constructors, destructor. - basic_stringstream(openmode __mod = ios_base::in | ios_base::out); - basic_stringstream(const _String& __str, - openmode __mod = ios_base::in | ios_base::out); - ~basic_stringstream(); - -public: // Member functions. - - basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const - { return __CONST_CAST(_Buf*,&_M_buf); } - - _String str() const { return _M_buf.str(); } - void str(const _String& __s) { _M_buf.str(__s); } - -private: - basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; - -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) - typedef basic_stringstream<_CharT, _Traits> _Self; - //explicitely defined as private to avoid warnings: - basic_stringstream(_Self const&); - _Self& operator = (_Self const&); -#endif -}; - - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream, allocator >; -_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream, allocator >; -_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream, allocator >; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream, allocator >; -_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream, allocator >; -_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream, allocator >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_SSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_stack.h b/SDK/stlport/stl/_stack.h deleted file mode 100644 index 7aa468d1..00000000 --- a/SDK/stlport/stl/_stack.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_STACK_H -#define _STLP_INTERNAL_STACK_H - -#ifndef _STLP_INTERNAL_DEQUE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) -template > -#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) -# define _STLP_STACK_ARGS _Tp -template -#else -template -#endif -class stack -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) -# if defined (_STLP_STACK_ARGS) - : public __stlport_class > -# else - : public __stlport_class > -# endif -#endif -{ -#ifdef _STLP_STACK_ARGS - typedef deque<_Tp> _Sequence; - typedef stack<_Tp> _Self; -#else - typedef stack<_Tp, _Sequence> _Self; -#endif - -public: - typedef typename _Sequence::value_type value_type; - typedef typename _Sequence::size_type size_type; - typedef _Sequence container_type; - - typedef typename _Sequence::reference reference; - typedef typename _Sequence::const_reference const_reference; -protected: - //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant. - _Sequence c; -public: - stack() : c() {} - explicit stack(const _Sequence& __s) : c(__s) {} - - stack(__move_source<_Self> src) - : c(_STLP_PRIV _AsMoveSource(src.get().c)) {} - - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - reference top() { return c.back(); } - const_reference top() const { return c.back(); } - void push(const value_type& __x) { c.push_back(__x); } - void pop() { c.pop_back(); } - const _Sequence& _Get_s() const { return c; } -}; - -#ifndef _STLP_STACK_ARGS -# define _STLP_STACK_ARGS _Tp, _Sequence -# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence -#else -# define _STLP_STACK_HEADER_ARGS class _Tp -#endif - -template < _STLP_STACK_HEADER_ARGS > -inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x, - const stack< _STLP_STACK_ARGS >& __y) -{ return __x._Get_s() == __y._Get_s(); } - -template < _STLP_STACK_HEADER_ARGS > -inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x, - const stack< _STLP_STACK_ARGS >& __y) -{ return __x._Get_s() < __y._Get_s(); } - -_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >) - -#undef _STLP_STACK_ARGS -#undef _STLP_STACK_HEADER_ARGS - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux<_Sequence> -{}; -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_STACK_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_stdexcept.h b/SDK/stlport/stl/_stdexcept.h deleted file mode 100644 index 8c784bb9..00000000 --- a/SDK/stlport/stl/_stdexcept.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_STDEXCEPT -#define _STLP_INTERNAL_STDEXCEPT - -#ifndef _STLP_INTERNAL_STDEXCEPT_BASE -# include -#endif - -#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE) - -# if defined(_STLP_USE_EXCEPTIONS) || \ - !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32)) - -_STLP_BEGIN_NAMESPACE - -class _STLP_CLASS_DECLSPEC logic_error : public __Named_exception { -public: - logic_error(const string& __s) : __Named_exception(__s) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~logic_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC runtime_error : public __Named_exception { -public: - runtime_error(const string& __s) : __Named_exception(__s) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~runtime_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC domain_error : public logic_error { -public: - domain_error(const string& __arg) : logic_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~domain_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC invalid_argument : public logic_error { -public: - invalid_argument(const string& __arg) : logic_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~invalid_argument() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC length_error : public logic_error { -public: - length_error(const string& __arg) : logic_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~length_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC out_of_range : public logic_error { -public: - out_of_range(const string& __arg) : logic_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~out_of_range() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC range_error : public runtime_error { -public: - range_error(const string& __arg) : runtime_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~range_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC overflow_error : public runtime_error { -public: - overflow_error(const string& __arg) : runtime_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~overflow_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -class _STLP_CLASS_DECLSPEC underflow_error : public runtime_error { -public: - underflow_error(const string& __arg) : runtime_error(__arg) {} -# ifndef _STLP_USE_NO_IOSTREAMS - ~underflow_error() _STLP_NOTHROW_INHERENTLY; -# endif -}; - -_STLP_END_NAMESPACE - -# endif -#endif - -#endif /* _STLP_INTERNAL_STDEXCEPT */ diff --git a/SDK/stlport/stl/_stdexcept_base.h b/SDK/stlport/stl/_stdexcept_base.h deleted file mode 100644 index 3bcd8490..00000000 --- a/SDK/stlport/stl/_stdexcept_base.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_STDEXCEPT_BASE -#define _STLP_INTERNAL_STDEXCEPT_BASE - -#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE) - -# ifndef _STLP_INTERNAL_EXCEPTION -# include -# endif - -# if defined(_STLP_USE_EXCEPTIONS) || \ - !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32)) - -# ifndef _STLP_INTERNAL_CSTRING -# include -# endif - -# ifndef _STLP_STRING_FWD_H -# include -# endif - -# ifndef _STLP_USE_NO_IOSTREAMS -# define _STLP_OWN_STDEXCEPT 1 -# endif - -_STLP_BEGIN_NAMESPACE - -/* We disable the 4275 warning for - * - WinCE where there are only static version of the native C++ runtime. - * - The MSVC compilers when the STLport user wants to make an STLport dll linked to - * the static C++ native runtime. In this case the std::exception base class is no more - * exported from native dll but is used as a base class for the exported __Named_exception - * class. - */ -# if defined (_STLP_WCE_NET) || \ - defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# define _STLP_DO_WARNING_POP -# pragma warning (push) -# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base - // for dll-interface class '__Named_exception' -# endif - -# if !defined (_STLP_NO_EXCEPTION_HEADER) -# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \ - defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE) -using _STLP_VENDOR_EXCEPT_STD::exception; -# endif -# endif -# define _STLP_EXCEPTION_BASE exception - -class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE { -public: - __Named_exception(const string& __str) -# ifndef _STLP_USE_NO_IOSTREAMS - ; - const char* what() const _STLP_NOTHROW_INHERENTLY; - ~__Named_exception() _STLP_NOTHROW_INHERENTLY; -# else - { -# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) - strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize); - _M_name[_S_bufsize - 1] = '\0'; -# else - strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE); -# endif - } - const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; } -# endif - -private: - enum { _S_bufsize = 256 }; - char _M_name[_S_bufsize]; -}; - -# if defined (_STLP_DO_WARNING_POP) -# pragma warning (pop) -# undef _STLP_DO_WARNING_POP -# endif - -_STLP_END_NAMESPACE - -# endif /* Not o32, and no exceptions */ -#endif /* _STLP_STDEXCEPT_SEEN */ - -#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */ diff --git a/SDK/stlport/stl/_stlport_version.h b/SDK/stlport/stl/_stlport_version.h deleted file mode 100644 index 31786785..00000000 --- a/SDK/stlport/stl/_stlport_version.h +++ /dev/null @@ -1,30 +0,0 @@ - /* - * - * Copyright (c) 2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STLPORT_VERSION_H -#define _STLP_STLPORT_VERSION_H - -/* The last SGI STL release we merged with */ -#define __SGI_STL 0x330 - -/* STLport version */ -#define _STLPORT_MAJOR 5 -#define _STLPORT_MINOR 1 -#define _STLPORT_PATCHLEVEL 5 - -#define _STLPORT_VERSION 0x515 - -#endif /* _STLP_STLPORT_VERSION_H */ diff --git a/SDK/stlport/stl/_stream_iterator.h b/SDK/stlport/stl/_stream_iterator.h deleted file mode 100644 index 1d1ff3f5..00000000 --- a/SDK/stlport/stl/_stream_iterator.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS) -#define _STLP_INTERNAL_STREAM_ITERATOR_H - -#ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -#endif - -// streambuf_iterators predeclarations must appear first -#ifndef _STLP_IOSFWD -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAM -# include -#endif - -// istream_iterator and ostream_iterator look very different if we're -// using new, templatized iostreams than if we're using the old cfront -// version. - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist -# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist -template , - class _Dist = ptrdiff_t> -class istream_iterator : public iterator { -#else -# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) -# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp -# define __ISI_TMPL_ARGUMENTS _Tp -template -class istream_iterator : public iterator { -# else -# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist -# define __ISI_TMPL_ARGUMENTS _Tp, _Dist -template -class istream_iterator : public iterator { -# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */ -#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) - typedef char _CharT; - typedef char_traits _Traits; -# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) - typedef ptrdiff_t _Dist; -# endif -#endif - - typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self; -public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_istream<_CharT, _Traits> istream_type; - - typedef input_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Dist difference_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; - - istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {} - istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {} - - reference operator*() const { - if (!_M_read_done) { - _M_read(); - } - return _M_value; - } - - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - _M_read(); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - _M_read(); - return __tmp; - } - - bool _M_equal(const _Self& __x) const { - if (!_M_read_done) { - _M_read(); - } - if (!__x._M_read_done) { - __x._M_read(); - } - return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); - } - -private: - istream_type* _M_stream; - mutable _Tp _M_value; - mutable bool _M_ok; - mutable bool _M_read_done; - - void _M_read() const { - _M_ok = ((_M_stream != 0) && !_M_stream->fail()); - if (_M_ok) { - *_M_stream >> _M_value; - _M_ok = !_M_stream->fail(); - } - _M_read_done = true; - } -}; - -#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template > -#else -template -#endif -class ostream_iterator: public iterator { -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) - typedef char _CharT; - typedef char_traits _Traits; - typedef ostream_iterator<_TpP> _Self; -#else - typedef ostream_iterator<_TpP, _CharT, _Traits> _Self; -#endif -public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_ostream<_CharT, _Traits> ostream_type; - - typedef output_iterator_tag iterator_category; - - ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} - ostream_iterator(ostream_type& __s, const _CharT* __c) - : _M_stream(&__s), _M_string(__c) {} - _Self& operator=(const _TpP& __val) { - *_M_stream << __val; - if (_M_string) *_M_stream << _M_string; - return *this; - } - _Self& operator*() { return *this; } - _Self& operator++() { return *this; } - _Self& operator++(int) { return *this; } -private: - ostream_type* _M_stream; - const _CharT* _M_string; -}; - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -inline output_iterator_tag _STLP_CALL -iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); } -# else -template -inline output_iterator_tag _STLP_CALL -iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); } -# endif -#endif - -_STLP_END_NAMESPACE - -// form-independent definiotion of stream iterators -_STLP_BEGIN_NAMESPACE - -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline bool _STLP_CALL -operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x, - const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y) -{ return __x._M_equal(__y); } - -#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline bool _STLP_CALL -operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x, - const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y) -{ return !__x._M_equal(__y); } -#endif - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline input_iterator_tag _STLP_CALL -iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) -{ return input_iterator_tag(); } -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline _Tp* _STLP_CALL -value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; } - -# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline ptrdiff_t* _STLP_CALL -distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; } -# else -template < __ISI_TMPL_HEADER_ARGUMENTS > -inline _Dist* _STLP_CALL -distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; } -# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */ -#endif - -_STLP_END_NAMESPACE - -#undef __ISI_TMPL_HEADER_ARGUMENTS -#undef __ISI_TMPL_ARGUMENTS - -#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_streambuf.c b/SDK/stlport/stl/_streambuf.c deleted file mode 100644 index bd61a204..00000000 --- a/SDK/stlport/stl/_streambuf.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_STREAMBUF_C -#define _STLP_STREAMBUF_C - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -_STLP_BEGIN_NAMESPACE -//---------------------------------------------------------------------- -// Non-inline basic_streambuf<> member functions. - -#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) || !defined (_STLP_USE_STATIC_LIB) -template -basic_streambuf<_CharT, _Traits>::basic_streambuf() - : _M_gbegin(0), _M_gnext(0), _M_gend(0), - _M_pbegin(0), _M_pnext(0), _M_pend(0), - _M_locale() { - // _M_lock._M_initialize(); -} -#endif - -template -basic_streambuf<_CharT, _Traits>::~basic_streambuf() -{} - -template -locale -basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc) { - this->imbue(__loc); - locale __tmp = _M_locale; - _M_locale = __loc; - return __tmp; -} - -template -streamsize -basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) { - streamsize __result = 0; - const int_type __eof = _Traits::eof(); - - while (__result < __n) { - if (_M_gnext < _M_gend) { - size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext), - __STATIC_CAST(size_t,__n - __result)); - _Traits::copy(__s, _M_gnext, __chunk); - __result += __chunk; - __s += __chunk; - _M_gnext += __chunk; - } - else { - int_type __c = this->sbumpc(); - if (!_Traits::eq_int_type(__c, __eof)) { - *__s = _Traits::to_char_type(__c); - ++__result; - ++__s; - } - else - break; - } - } - - return __result; -} - -template -streamsize -basic_streambuf<_CharT, _Traits>::xsputn(const _CharT* __s, streamsize __n) -{ - streamsize __result = 0; - const int_type __eof = _Traits::eof(); - - while (__result < __n) { - if (_M_pnext < _M_pend) { - size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), - __STATIC_CAST(size_t,__n - __result)); - _Traits::copy(_M_pnext, __s, __chunk); - __result += __chunk; - __s += __chunk; - _M_pnext += __chunk; - } - - else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(*__s)), - __eof)) { - ++__result; - ++__s; - } - else - break; - } - return __result; -} - -template -streamsize -basic_streambuf<_CharT, _Traits>::_M_xsputnc(_CharT __c, streamsize __n) -{ - streamsize __result = 0; - const int_type __eof = _Traits::eof(); - - while (__result < __n) { - if (_M_pnext < _M_pend) { - size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), - __STATIC_CAST(size_t,__n - __result)); - _Traits::assign(_M_pnext, __chunk, __c); - __result += __chunk; - _M_pnext += __chunk; - } - - else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(__c)), - __eof)) - ++__result; - else - break; - } - return __result; -} - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::_M_snextc_aux() -{ - int_type __eof = _Traits::eof(); - if (_M_gend == _M_gnext) - return _Traits::eq_int_type(this->uflow(), __eof) ? __eof : this->sgetc(); - else { - _M_gnext = _M_gend; - return this->underflow(); - } -} - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::pbackfail(int_type) { - return _Traits::eof(); -} - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::overflow(int_type) { - return _Traits::eof(); -} - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::uflow() { - return ( _Traits::eq_int_type(this->underflow(),_Traits::eof()) ? - _Traits::eof() : - _Traits::to_int_type(*_M_gnext++)); -} - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type -basic_streambuf<_CharT, _Traits>::underflow() -{ return _Traits::eof(); } - -template -streamsize -basic_streambuf<_CharT, _Traits>::showmanyc() -{ return 0; } - -template -void -basic_streambuf<_CharT, _Traits>::imbue(const locale&) {} - -template -int -basic_streambuf<_CharT, _Traits>::sync() { return 0; } - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type -basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) -{ return pos_type(-1); } - -template -_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type -basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, - ios_base::openmode) -{ return pos_type(-1); } - -template -basic_streambuf<_CharT, _Traits>* -basic_streambuf<_CharT, _Traits>:: setbuf(char_type*, streamsize) -{ return this; } - -_STLP_END_NAMESPACE - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_streambuf.h b/SDK/stlport/stl/_streambuf.h deleted file mode 100644 index d6df0a75..00000000 --- a/SDK/stlport/stl/_streambuf.h +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_STREAMBUF -#define _STLP_INTERNAL_STREAMBUF - -#ifndef _STLP_IOS_BASE_H -# include // Needed for ios_base bitfield members. -#endif // includes . - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Class basic_streambuf<>, the base class of the streambuf hierarchy. - -// A basic_streambuf<> manages an input (get) area and an output (put) -// area. Each is described by three pointers: a beginning, an end, and a -// current position. basic_streambuf<> contains some very simple member -// functions that manipulate those six pointers, but almost all of the real -// functionality gets delegated to protected virtual member functions. -// All of the public member functions are inline, and most of the protected -// member functions are virtual. - -// Although basic_streambuf<> is not abstract, it is useful only as a base -// class. Its virtual member functions have default definitions such that -// reading from a basic_streambuf<> will always yield EOF, and writing to a -// basic_streambuf<> will always fail. - -// The second template parameter, _Traits, defaults to char_traits<_CharT>. -// The default is declared in header , and it isn't declared here -// because C++ language rules do not allow it to be declared twice. - -template -class basic_streambuf { - friend class basic_istream<_CharT, _Traits>; - friend class basic_ostream<_CharT, _Traits>; - -public: // Typedefs. - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - -private: // Data members. - - char_type* _M_gbegin; // Beginning of get area - char_type* _M_gnext; // Current position within the get area - char_type* _M_gend; // End of get area - - char_type* _M_pbegin; // Beginning of put area - char_type* _M_pnext; // Current position within the put area - char_type* _M_pend; // End of put area - - locale _M_locale; // The streambuf's locale object - -//public: // Extension: locking, for thread safety. -// _STLP_mutex _M_lock; - -public: // Destructor. - virtual ~basic_streambuf(); - -protected: // The default constructor. - basic_streambuf() -#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB) - //We make it inline to avoid unresolved symbol. - : _M_gbegin(0), _M_gnext(0), _M_gend(0), - _M_pbegin(0), _M_pnext(0), _M_pend(0), - _M_locale() - {} -#else - ; -#endif - -protected: // Protected interface to the get area. - char_type* eback() const { return _M_gbegin; } // Beginning - char_type* gptr() const { return _M_gnext; } // Current position - char_type* egptr() const { return _M_gend; } // End - - void gbump(int __n) { _M_gnext += __n; } - void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) { - _M_gbegin = __gbegin; - _M_gnext = __gnext; - _M_gend = __gend; - } - -public: - // An alternate public interface to the above functions - // which allows us to avoid using templated friends which - // are not supported on some compilers. - char_type* _M_eback() const { return eback(); } - char_type* _M_gptr() const { return gptr(); } - char_type* _M_egptr() const { return egptr(); } - void _M_gbump(int __n) { gbump(__n); } - void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) - { this->setg(__gbegin, __gnext, __gend); } - -protected: // Protected interface to the put area - - char_type* pbase() const { return _M_pbegin; } // Beginning - char_type* pptr() const { return _M_pnext; } // Current position - char_type* epptr() const { return _M_pend; } // End - - void pbump(int __n) { _M_pnext += __n; } - void setp(char_type* __pbegin, char_type* __pend) { - _M_pbegin = __pbegin; - _M_pnext = __pbegin; - _M_pend = __pend; - } - -protected: // Virtual buffer management functions. - - virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize); - - // Alters the stream position, using an integer offset. In this - // class seekoff does nothing; subclasses are expected to override it. - virtual pos_type seekoff(off_type, ios_base::seekdir, - ios_base::openmode = ios_base::in | ios_base::out); - - // Alters the stream position, using a previously obtained streampos. In - // this class seekpos does nothing; subclasses are expected to override it. - virtual pos_type - seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out); - - // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to - // override this virtual member function. - virtual int sync(); - - -public: // Buffer management. - basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n) - { return this->setbuf(__s, __n); } - - pos_type pubseekoff(off_type __offset, ios_base::seekdir __way, - ios_base::openmode __mod = ios_base::in | ios_base::out) - { return this->seekoff(__offset, __way, __mod); } - - pos_type pubseekpos(pos_type __sp, - ios_base::openmode __mod = ios_base::in | ios_base::out) - { return this->seekpos(__sp, __mod); } - - int pubsync() { return this->sync(); } - -protected: // Virtual get area functions, as defined in - // 17.5.2.4.3 and 17.5.2.4.4 of the standard. - // Returns a lower bound on the number of characters that we can read, - // with underflow, before reaching end of file. (-1 is a special value: - // it means that underflow will fail.) Most subclasses should probably - // override this virtual member function. - virtual streamsize showmanyc(); - - // Reads up to __n characters. Return value is the number of - // characters read. - virtual streamsize xsgetn(char_type* __s, streamsize __n); - - // Called when there is no read position, i.e. when gptr() is null - // or when gptr() >= egptr(). Subclasses are expected to override - // this virtual member function. - virtual int_type underflow(); - - // Similar to underflow(), but used for unbuffered input. Most - // subclasses should probably override this virtual member function. - virtual int_type uflow(); - - // Called when there is no putback position, i.e. when gptr() is null - // or when gptr() == eback(). All subclasses are expected to override - // this virtual member function. - virtual int_type pbackfail(int_type = traits_type::eof()); - -protected: // Virtual put area functions, as defined in - // 27.5.2.4.5 of the standard. - - // Writes up to __n characters. Return value is the number of characters - // written. - virtual streamsize xsputn(const char_type* __s, streamsize __n); - - // Extension: writes up to __n copies of __c. Return value is the number - // of characters written. - virtual streamsize _M_xsputnc(char_type __c, streamsize __n); - - // Called when there is no write position. All subclasses are expected to - // override this virtual member function. - virtual int_type overflow(int_type = traits_type::eof()); - -public: // Public members for writing characters. - // Write a single character. - int_type sputc(char_type __c) { - return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c) - : this->overflow(_Traits::to_int_type(__c))); - } - - // Write __n characters. - streamsize sputn(const char_type* __s, streamsize __n) - { return this->xsputn(__s, __n); } - - // Extension: write __n copies of __c. - streamsize _M_sputnc(char_type __c, streamsize __n) - { return this->_M_xsputnc(__c, __n); } - -private: // Helper functions. - int_type _M_snextc_aux(); - -public: // Public members for reading characters. - streamsize in_avail() { - return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc(); - } - - // Advance to the next character and return it. - int_type snextc() { - return ( _M_gend - _M_gnext > 1 ? - _Traits::to_int_type(*++_M_gnext) : - this->_M_snextc_aux()); - } - - // Return the current character and advance to the next. - int_type sbumpc() { - return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++) - : this->uflow(); - } - - // Return the current character without advancing to the next. - int_type sgetc() { - return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext) - : this->underflow(); - } - - streamsize sgetn(char_type* __s, streamsize __n) - { return this->xsgetn(__s, __n); } - - int_type sputbackc(char_type __c) { - return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1))) - ? _Traits::to_int_type(*--_M_gnext) - : this->pbackfail(_Traits::to_int_type(__c)); - } - - int_type sungetc() { - return (_M_gbegin < _M_gnext) - ? _Traits::to_int_type(*--_M_gnext) - : this->pbackfail(); - } - -protected: // Virtual locale functions. - - // This is a hook, called by pubimbue() just before pubimbue() - // sets the streambuf's locale to __loc. Note that imbue should - // not (and cannot, since it has no access to streambuf's private - // members) set the streambuf's locale itself. - virtual void imbue(const locale&); - -public: // Locale-related functions. - locale pubimbue(const locale&); - locale getloc() const { return _M_locale; } - -#if !defined (_STLP_NO_ANACHRONISMS) - void stossc() { this->sbumpc(); } -#endif -#if defined (__MVS__) || defined (__OS400__) -private: // Data members. - - char_type* _M_gbegin; // Beginning of get area - char_type* _M_gnext; // Current position within the get area - char_type* _M_gend; // End of get area - - char_type* _M_pbegin; // Beginning of put area - char_type* _M_pnext; // Current position within the put area - char_type* _M_pend; // End of put area -#endif -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf >; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf >; -# endif // _STLP_NO_WCHAR_T -#endif // _STLP_USE_TEMPLATE_EXPORT - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_string.c b/SDK/stlport/stl/_string.c deleted file mode 100644 index 5dbc6284..00000000 --- a/SDK/stlport/stl/_string.c +++ /dev/null @@ -1,691 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_STRING_C -#define _STLP_STRING_C - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H -# include -#endif - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# define basic_string _STLP_NO_MEM_T_NAME(str) -#elif defined (_STLP_DEBUG) -# define basic_string _STLP_NON_DBG_NAME(str) -#endif - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# define __size_type__ size_t -# define size_type size_t -# define iterator _CharT* -#else -# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// A helper class to use a char_traits as a function object. -template -struct _Not_within_traits : public unary_function { - typedef typename _Traits::char_type _CharT; - const _CharT* _M_first; - const _CharT* _M_last; - - _Not_within_traits(const _CharT* __f, const _CharT* __l) - : _M_first(__f), _M_last(__l) {} - - bool operator()(const _CharT& __x) const { - return find_if(_M_first, _M_last, - _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last; - } -}; - -// ------------------------------------------------------------ -// Non-inline declarations. - -#if !defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -// Change the string's capacity so that it is large enough to hold -// at least __res_arg elements, plus the terminating _CharT(). Note that, -// if __res_arg < capacity(), this member function may actually decrease -// the string's capacity. -template -void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) { - if (__res_arg > max_size()) - this->_M_throw_length_error(); - - size_type __n = (max)(__res_arg, size()) + 1; - if (__n <= capacity() + 1) - return; - - pointer __new_start = this->_M_end_of_storage.allocate(__n, __n); - pointer __new_finish = __new_start; - - _STLP_TRY { - __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start, __new_finish), - this->_M_end_of_storage.deallocate(__new_start, __n))) - - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __n); -} - -template -basic_string<_CharT,_Traits,_Alloc>& -basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) { - if (__n > max_size() || size() > max_size() - __n) - this->_M_throw_length_error(); - if (size() + __n > capacity()) - reserve(size() + (max)(size(), __n)); - if (__n > 0) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _Traits::assign(this->_M_finish + 1, __n - 1, __c); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c); - _STLP_TRY { - _M_construct_null(this->_M_finish + __n); - } - _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, this->_M_finish + __n)) - _Traits::assign(*end(), __c); - this->_M_finish += __n; - } - return *this; -} - -template -basic_string<_CharT, _Traits, _Alloc>& -basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) { - if (__first != __last) { - const size_type __old_size = size(); - ptrdiff_t __n = __last - __first; - if ((size_type)__n > max_size() || __old_size > max_size() - __n) - this->_M_throw_length_error(); - if (__old_size + __n > capacity()) { - size_type __len = __old_size + (max)(__old_size, (size_t) __n) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start); - __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - else { - const _CharT* __f1 = __first; - ++__f1; -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy(__f1, __last, this->_M_Finish() + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1); - _STLP_TRY { - _M_construct_null(this->_M_finish + __n); - } - _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, this->_M_finish + __n)) - _Traits::assign(*end(), *__first); - this->_M_finish += __n; - } - } - return *this; -} - -template -basic_string<_CharT,_Traits,_Alloc>& -basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) { - if (__n <= size()) { - _Traits::assign(this->_M_Start(), __n, __c); - erase(begin() + __n, end()); - } - else { - if (__n < capacity()) { - _Traits::assign(this->_M_Start(), size(), __c); - append(__n - size(), __c); - } - else { - _Self __str(__n, __c); - this->swap(__str); - } - } - return *this; -} - -template -basic_string<_CharT,_Traits,_Alloc>& -basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) { - ptrdiff_t __n = __l - __f; - if (__STATIC_CAST(size_type, __n) <= size()) { - _Traits::copy(this->_M_Start(), __f, __n); - erase(begin() + __n, end()); - } - else { - _Traits::copy(this->_M_Start(), __f, size()); - _M_append(__f + size(), __l); - } - return *this; -} - -template -_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p, - _CharT __c) { - pointer __new_pos = __p; - if (this->_M_finish + 1 < this->_M_end_of_storage._M_data) { - _M_construct_null(this->_M_finish + 1); - _Traits::move(__p + 1, __p, this->_M_finish - __p); - _Traits::assign(*__p, __c); - ++this->_M_finish; - } - else { - const size_type __old_len = size(); - size_type __len = __old_len + (max)(__old_len, __STATIC_CAST(size_type,1)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start); - _Copy_Construct(__new_pos, __c); - __new_finish = __new_pos + 1; - __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - return __new_pos; -} - -template -void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos, - size_t __n, _CharT __c) { - if (__n != 0) { - if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n + 1) { - const size_type __elems_after = this->_M_finish - __pos; - pointer __old_finish = this->_M_finish; - if (__elems_after >= __n) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, - this->_M_finish + 1); - this->_M_finish += __n; - _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); - _Traits::assign(__pos, __n, __c); - } - else { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _Traits::assign(this->_M_finish + 1, __n - __elems_after - 1, __c); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c); - this->_M_finish += __n - __elems_after; - _STLP_TRY { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy(__pos, __old_finish + 1, this->_M_finish); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish); - this->_M_finish += __elems_after; - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish), - this->_M_finish = __old_finish)) - _Traits::assign(__pos, __elems_after + 1, __c); - } - } - else { - const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __n) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start); - __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c); - __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - } -} - -template -void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos, - const _CharT* __first, const _CharT* __last, - bool __self_ref) { - //this version has to take care about the auto referencing - if (__first != __last) { - const ptrdiff_t __n = __last - __first; - if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) { - const ptrdiff_t __elems_after = this->_M_finish - __pos; - pointer __old_finish = this->_M_finish; - if (__elems_after >= __n) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1); - this->_M_finish += __n; - _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); - if (!__self_ref || __last < __pos) { - _M_copy(__first, __last, __pos); - } - else { - //We have to check that the source buffer hasn't move - if (__first >= __pos) { - //The source buffer has move - __first += __n; - __last += __n; - _M_copy(__first, __last, __pos); - } - else { - //The source buffer hasn't move, it has been duplicated - _M_move(__first, __last, __pos); - } - } - } - else { - const_iterator __mid = __first; - __mid += __elems_after + 1; -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy(__mid, __last, this->_M_finish + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1); - this->_M_finish += __n - __elems_after; - _STLP_TRY { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy(__pos, __old_finish + 1, this->_M_finish); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish); - this->_M_finish += __elems_after; - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish), - this->_M_finish = __old_finish)) - if (!__self_ref) - _M_copy(__first, __mid, __pos); - else - _M_move(__first, __mid, __pos); - } - } - else { - const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start); - __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish); - __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - } -} - -template -basic_string<_CharT,_Traits,_Alloc>& -basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last, - size_type __n, _CharT __c) { - size_type __len = (size_type)(__last - __first); - - if (__len >= __n) { - _Traits::assign(__first, __n, __c); - erase(__first + __n, __last); - } - else { - _Traits::assign(__first, __len, __c); - insert(__last, __n - __len, __c); - } - return *this; -} - -template -basic_string<_CharT,_Traits,_Alloc>& -basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l, - bool __self_ref) { - const ptrdiff_t __n = __l - __f; - const difference_type __len = __last - __first; - if (__len >= __n) { - if (!__self_ref || __l < __first || __f >= __last) - _M_copy(__f, __l, __first); - else - _M_move(__f, __l, __first); - erase(__first + __n, __last); - } - else { - if (!__self_ref || (__f >= __last) || (__l <= __first)) { - //no overlap: - const_iterator __m = __f + __len; - _M_copy(__f, __m, __first); - _M_insert(__last, __m, __l, false ); - } - else { - //we have to take care of overlaping - if (__f < __first) { - const_iterator __m = __f + __len; - //We have to deal with possible reallocation because we do insert first. - const difference_type __off_dest = __first - this->begin(); - const difference_type __off_src = __f - this->begin(); - _M_insert(__last, __m, __l, true); - _Traits::move(begin() + __off_dest, begin() + __off_src, __len); - } - else { - const_iterator __m = __f + __len; - _Traits::move(__first, __f, __len); - _M_insert(__last, __m, __l, true); - } - } - } - return *this; -} - -template __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find(const _CharT* __s, size_type __pos, - size_type __n) const { - const size_t __len = size(); - if (__pos >= __len || __pos + __n > __len) - return npos; - else { - const_pointer __result = - _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(), - __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>()); - return __result != this->_M_Finish() ? __result - this->_M_Start() : npos; - } -} - -template __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find(_CharT __c, size_type __pos) const { - if (__pos >= size()) /*__pos + 1 > size()*/ - return npos; - else { - const_pointer __result = - _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(), - _STLP_PRIV _Eq_char_bound<_Traits>(__c)); - return __result != this->_M_Finish() ? __result - this->_M_Start() : npos; - } -} - -template -__size_type__ -basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos, size_type __n) const -{ - const size_type __len = size(); - if ( __len < __n ) { - return npos; - } - const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n; - const_pointer __result = find_end(this->_M_Start(), __last, - __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>()); - return __result != __last ? __result - this->_M_Start() : npos; -} - -template -__size_type__ -basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const -{ - const size_type __len = size(); - if ( __len < 1 ) { - return npos; - } - const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; - const_reverse_iterator __rresult = - _STLP_STD::find_if(const_reverse_iterator(__last), rend(), - _STLP_PRIV _Eq_char_bound<_Traits>(__c)); - return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; -} - -template __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos, - size_type __n) const { - if (__pos >= size()) /*__pos + 1 > size()*/ - return npos; - else { - const_iterator __result = _STLP_PRIV __find_first_of(begin() + __pos, end(), - __s, __s + __n, - _STLP_PRIV _Eq_traits<_Traits>()); - return __result != end() ? __result - begin() : npos; - } -} - -template - __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos, - size_type __n) const -{ - const size_type __len = size(); - if ( __len < 1 ) { - return npos; - } - const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; - const const_reverse_iterator __rresult = - _STLP_PRIV __find_first_of(const_reverse_iterator(__last), rend(), - __s, __s + __n, - _STLP_PRIV _Eq_traits<_Traits>()); - return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; -} - - -template __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos, - size_type __n) const { - typedef typename _Traits::char_type _CharType; - if (__pos >= size()) /*__pos + 1 >= size()*/ - return npos; - else { - const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(), - _STLP_PRIV _Not_within_traits<_Traits>(__CONST_CAST(const _CharType*, __s), - __CONST_CAST(const _CharType*, __s) + __n)); - return __result != this->_M_finish ? __result - this->_M_Start() : npos; - } -} - -template __size_type__ -basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const { - if (1 > size()) - return npos; - else { - const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(), - _STLP_PRIV _Neq_char_bound<_Traits>(__c)); - return __result != this->_M_finish ? __result - this->_M_Start() : npos; - } -} - -template -__size_type__ -basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const -{ - typedef typename _Traits::char_type _CharType; - const size_type __len = size(); - if ( __len < 1 ) { - return npos; - } - const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; - const_reverse_iterator __rlast = const_reverse_iterator(__last); - const_reverse_iterator __rresult = - _STLP_STD::find_if(__rlast, rend(), - _STLP_PRIV _Not_within_traits<_Traits>((const _CharType*)__s, - (const _CharType*)__s + __n)); - return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; -} - -template -__size_type__ -basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const -{ - const size_type __len = size(); - if ( __len < 1 ) { - return npos; - } - const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; - const_reverse_iterator __rlast = const_reverse_iterator(__last); - const_reverse_iterator __rresult = - _STLP_STD::find_if(__rlast, rend(), - _STLP_PRIV _Neq_char_bound<_Traits>(__c)); - return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; -} - -#if !defined (basic_string) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, - _CharT* __buf, size_t __n) { - if (__n > 0) { - __n = (min) (__n - 1, __s.size()); - _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf); - __buf[__n] = _CharT(); - } -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#include - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// _String_base methods -template -void _String_base<_Tp,_Alloc>::_M_throw_length_error() const -{ __stl_throw_length_error("basic_string"); } - -template -void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const -{ __stl_throw_out_of_range("basic_string"); } - -template -void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) { - if ((__n <= (max_size() + 1)) && (__n > 0)) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (__n > _DEFAULT_SIZE) { - this->_M_buffers._M_dynamic_buf = _M_end_of_storage.allocate(__n, __n); - this->_M_finish = this->_M_buffers._M_dynamic_buf; - this->_M_end_of_storage._M_data = this->_M_finish + __n; - } -#else - this->_M_start = _M_end_of_storage.allocate(__n, __n); - this->_M_finish = this->_M_start; - this->_M_end_of_storage._M_data = this->_M_finish + __n; -#endif /*_STLP_USE_SHORT_STRING_OPTIM */ - } else { - this->_M_throw_length_error(); - } -} - -#if !defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) -template -basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - _STLP_FIX_LITERAL_BUG(__s) - _M_range_initialize(__s, __s + traits_type::length(__s)); -} -#endif - -template -basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s, - const allocator_type& __a) - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { - _STLP_FIX_LITERAL_BUG(__s) - _M_range_initialize(__s, __s + traits_type::length(__s)); -} - -template -basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s) - : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator()) -{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); } - -#if defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -# undef basic_string -#else -/* If basic_string is defined it means that it won't be the basic_string class - * exposed to STLport users so npos do not need external linkage. - */ -# if !defined (_STLP_STATIC_CONST_INIT_BUG) -# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96) -template -const size_t basic_string<_CharT, _Traits, _Alloc>::npos; -# endif -# endif -#endif - -_STLP_END_NAMESPACE - -#undef __size_type__ -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# undef size_type -# undef iterator -#endif - -#endif /* _STLP_STRING_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_string.h b/SDK/stlport/stl/_string.h deleted file mode 100644 index 928deddc..00000000 --- a/SDK/stlport/stl/_string.h +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_STRING_H -#define _STLP_INTERNAL_STRING_H - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_STRING_FWD_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -# include -#endif - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -# include -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE) - -// MSL implementation classes expect to see the definition of streampos -// when this header is included. We expect this to be fixed in later MSL -// implementations -# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105 -# include -# endif -#endif // __MWERKS__ - -/* - * Standard C++ string class. This class has performance - * characteristics very much like vector<>, meaning, for example, that - * it does not perform reference-count or copy-on-write, and that - * concatenation of two strings is an O(N) operation. - - * There are three reasons why basic_string is not identical to - * vector. - * First, basic_string can always stores a null character - * at the end (macro dependent); this makes it possible for c_str to - * be a fast operation. - * Second, the C++ standard requires basic_string to copy elements - * using char_traits<>::assign, char_traits<>::copy, and - * char_traits<>::move. This means that all of vector<>'s low-level - * operations must be rewritten. Third, basic_string<> has a lot of - * extra functions in its interface that are convenient but, strictly - * speaking, redundant. - - * Additionally, the C++ standard imposes a major restriction: according - * to the standard, the character type _CharT must be a POD type. This - * implementation weakens that restriction, and allows _CharT to be a - * a user-defined non-POD type. However, _CharT must still have a - * default constructor. - */ - -#include - -_STLP_BEGIN_NAMESPACE - -// ------------------------------------------------------------ -// Class basic_string. - -// Class invariants: -// (1) [start, finish) is a valid range. -// (2) Each iterator in [start, finish) points to a valid object -// of type value_type. -// (3) *finish is a valid object of type value_type; when -// value_type is not a POD it is value_type(). -// (4) [finish + 1, end_of_storage) is a valid range. -// (5) Each iterator in [finish + 1, end_of_storage) points to -// unininitialized memory. - -// Note one important consequence: a string of length n must manage -// a block of memory whose size is at least n + 1. - -struct _String_reserve_t {}; - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# define basic_string _STLP_NO_MEM_T_NAME(str) -#elif defined (_STLP_DEBUG) -# define basic_string _STLP_NON_DBG_NAME(str) -#endif - -#if defined (basic_string) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -class basic_string : protected _STLP_PRIV _String_base<_CharT,_Alloc> -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) - , public __stlport_class > -#endif -{ -protected: // Protected members inherited from base. - typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base; - typedef basic_string<_CharT, _Traits, _Alloc> _Self; - // fbp : used to optimize char/wchar_t cases, and to simplify - // _STLP_DEF_CONST_PLCT_NEW_BUG problem workaround - typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral; - typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD; - typedef random_access_iterator_tag r_a_i_t; - -public: - typedef _CharT value_type; - typedef _Traits traits_type; - - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename _Base::size_type size_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag _Iterator_category; - - typedef const value_type* const_iterator; - typedef value_type* iterator; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -#include - - typedef _String_reserve_t _Reserve_t; - -public: // Constructor, destructor, assignment. - typedef typename _Base::allocator_type allocator_type; - - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _CharT); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit basic_string(const allocator_type& __a = allocator_type()) -#else - basic_string() - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE) - { _M_terminate_string(); } - explicit basic_string(const allocator_type& __a) -#endif - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE) - { _M_terminate_string(); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - basic_string(_Reserve_t, size_t __n, - const allocator_type& __a = allocator_type()) -#else - basic_string(_Reserve_t, size_t __n) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) - { _M_terminate_string(); } - basic_string(_Reserve_t, size_t __n, const allocator_type& __a) -#endif - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) - { _M_terminate_string(); } - - basic_string(const _Self&); - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - basic_string(const _Self& __s, size_type __pos, size_type __n = npos, - const allocator_type& __a = allocator_type()) -#else - basic_string(const _Self& __s, size_type __pos) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - if (__pos > __s.size()) - this->_M_throw_out_of_range(); - else - _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish()); - } - basic_string(const _Self& __s, size_type __pos, size_type __n) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - if (__pos > __s.size()) - this->_M_throw_out_of_range(); - else - _M_range_initialize(__s._M_Start() + __pos, - __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); - } - basic_string(const _Self& __s, size_type __pos, size_type __n, - const allocator_type& __a) -#endif - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { - if (__pos > __s.size()) - this->_M_throw_out_of_range(); - else - _M_range_initialize(__s._M_Start() + __pos, - __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - basic_string(const _CharT* __s, size_type __n, - const allocator_type& __a = allocator_type()) -#else - basic_string(const _CharT* __s, size_type __n) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - _STLP_FIX_LITERAL_BUG(__s) - _M_range_initialize(__s, __s + __n); - } - basic_string(const _CharT* __s, size_type __n, const allocator_type& __a) -#endif - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { - _STLP_FIX_LITERAL_BUG(__s) - _M_range_initialize(__s, __s + __n); - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - basic_string(const _CharT* __s, - const allocator_type& __a = allocator_type()); -#else - basic_string(const _CharT* __s); - basic_string(const _CharT* __s, const allocator_type& __a); -#endif - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - basic_string(size_type __n, _CharT __c, - const allocator_type& __a = allocator_type()) -#else - basic_string(size_type __n, _CharT __c) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) { -# if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _Traits::assign(this->_M_Start(), __n, __c); - this->_M_finish = this->_M_Start() + __n; - } - else -# endif - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c); - _M_terminate_string(); - } - basic_string(size_type __n, _CharT __c, const allocator_type& __a) -#endif - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _Traits::assign(this->_M_Start(), __n, __c); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c); - _M_terminate_string(); - } - - basic_string(__move_source<_Self> src) - : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {} - - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. -#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - basic_string(_InputIterator __f, _InputIterator __l, - const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__f, __l, _Integral()); - } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - basic_string(_InputIterator __f, _InputIterator __l) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__f, __l, _Integral()); - } -# endif -# else - /* We need an additionnal constructor to build an empty string without - * any allocation or termination char*/ -protected: - struct _CalledFromWorkaround_t {}; - basic_string(_CalledFromWorkaround_t, const allocator_type &__a) - : _String_base<_CharT,_Alloc>(__a) {} -public: -# endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */ -#endif /* !__MRC__ || (__SC__ && !__DMC__) */ - -#if !(defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)))) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) || \ - defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - basic_string(const _CharT* __f, const _CharT* __l, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _M_range_initialize(__f, __l); - } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - basic_string(const _CharT* __f, const _CharT* __l) - : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _M_range_initialize(__f, __l); - } -# endif -#endif /* _STLP_MEMBER_TEMPLATES */ - -private: - template - void _M_range_initialize(_InputIter __f, _InputIter __l, - const input_iterator_tag &__tag) { - this->_M_allocate_block(); - _M_construct_null(this->_M_Finish()); - _STLP_TRY { - _M_appendT(__f, __l, __tag); - } - _STLP_UNWIND(this->_M_destroy_range()) - } - - template - void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, - const forward_iterator_tag &) { - difference_type __n = distance(__f, __l); - this->_M_allocate_block(__n + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _M_copyT(__f, __l, this->_M_Start()); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); - this->_M_terminate_string(); - } - - template - void _M_range_initializeT(_InputIter __f, _InputIter __l) { - _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - } - - template - void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { - this->_M_allocate_block(__n + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _Traits::assign(this->_M_Start(), __n, __x); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x); - this->_M_terminate_string(); - } - - template - void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { - _M_range_initializeT(__f, __l); - } - -public: - ~basic_string() - { this->_M_destroy_range(); } - - _Self& operator=(const _Self& __s) { - if (&__s != this) - _M_assign(__s._M_Start(), __s._M_Finish()); - return *this; - } - - _Self& operator=(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return _M_assign(__s, __s + traits_type::length(__s)); - } - - _Self& operator=(_CharT __c) - { return assign(__STATIC_CAST(size_type,1), __c); } - -protected: - - static _CharT _STLP_CALL _M_null() - { return _STLP_DEFAULT_CONSTRUCTED(_CharT); } - -protected: // Helper functions used by constructors - // and elsewhere. - // fbp : simplify integer types (char, wchar) - void _M_construct_null_aux(_CharT* __p, const __false_type& /*_Is_Integral*/) const { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _Traits::assign(*__p, _M_null()); - else -#endif /*_STLP_USE_SHORT_STRING_OPTIM*/ - _STLP_STD::_Construct(__p); - } - void _M_construct_null_aux(_CharT* __p, const __true_type& /*_Is_Integral*/) const - { *__p = 0; } - - void _M_force_construct_null(_CharT*, const __true_type& /* _Is_POD */) const - { /*Nothing to do*/ } - void _M_force_construct_null(_CharT* __p, const __false_type& /* _Is_POD */) const - { _M_construct_null_aux(__p, _Char_Is_Integral()); } - - void _M_construct_null(_CharT* __p) const { - typedef __false_type _Answer; - - _M_force_construct_null(__p, _Answer()); - } - -protected: - // Helper functions used by constructors. It is a severe error for - // any of them to be called anywhere except from within constructors. - void _M_terminate_string_aux(const __false_type& __is_integral) { - _STLP_TRY { - _M_construct_null_aux(this->_M_Finish(), __is_integral); - } - _STLP_UNWIND(this->_M_destroy_range(0,0)) - } - - void _M_terminate_string_aux(const __true_type& __is_integral) - { _M_construct_null_aux(this->_M_Finish(), __is_integral); } - - void _M_force_terminate_string(const __true_type& /* _Is_POD */) - { /*Nothing to do*/ } - void _M_force_terminate_string(const __false_type& /* _Is_POD */) - { _M_terminate_string_aux(_Char_Is_Integral()); } - - void _M_terminate_string() { - typedef __false_type _Answer; - - _M_force_terminate_string(_Answer()); - } - - bool _M_inside(const _CharT* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return (__s >= this->_M_Start()) && (__s < this->_M_Finish()); - } - - void _M_range_initialize(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - ptrdiff_t __n = __l - __f; - this->_M_allocate_block(__n + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _M_copy(__f, __l, this->_M_Start()); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); - _M_terminate_string(); - } - -public: // Iterators. - iterator begin() { return this->_M_Start(); } - iterator end() { return this->_M_Finish(); } - const_iterator begin() const { return this->_M_Start(); } - const_iterator end() const { return this->_M_Finish(); } - - reverse_iterator rbegin() - { return reverse_iterator(this->_M_Finish()); } - reverse_iterator rend() - { return reverse_iterator(this->_M_Start()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(this->_M_Finish()); } - const_reverse_iterator rend() const - { return const_reverse_iterator(this->_M_Start()); } - -public: // Size, capacity, etc. - size_type size() const { return this->_M_Finish() - this->_M_Start(); } - size_type length() const { return size(); } - size_t max_size() const { return _Base::max_size(); } - - void resize(size_type __n, _CharT __c) { - if (__n <= size()) - erase(begin() + __n, end()); - else - append(__n - size(), __c); - } - - void resize(size_type __n) { resize(__n, _M_null()); } - - void reserve(size_type = 0); - - size_type capacity() const - { return (this->_M_end_of_storage._M_data - this->_M_Start()) - 1; } - - void clear() { - if (!empty()) { - _Traits::assign(*(this->_M_Start()), _M_null()); - this->_M_destroy_range(1); - this->_M_finish = this->_M_Start(); - } - } - - bool empty() const { return this->_M_Start() == this->_M_Finish(); } - -public: // Element access. - - const_reference operator[](size_type __n) const - { return *(this->_M_Start() + __n); } - reference operator[](size_type __n) - { return *(this->_M_Start() + __n); } - - const_reference at(size_type __n) const { - if (__n >= size()) - this->_M_throw_out_of_range(); - return *(this->_M_Start() + __n); - } - - reference at(size_type __n) { - if (__n >= size()) - this->_M_throw_out_of_range(); - return *(this->_M_Start() + __n); - } - -public: // Append, operator+=, push_back. - - _Self& operator+=(const _Self& __s) { return append(__s); } - _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); } - _Self& operator+=(_CharT __c) { push_back(__c); return *this; } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -private: // Helper functions for append. - template - _Self& _M_appendT(_InputIter __first, _InputIter __last, - const input_iterator_tag &) { - for ( ; __first != __last ; ++__first) - push_back(*__first); - return *this; - } - - template - _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last, - const forward_iterator_tag &) { - if (__first != __last) { - const size_type __old_size = this->size(); - difference_type __n = distance(__first, __last); - if (__STATIC_CAST(size_type,__n) > this->max_size() || __old_size > this->max_size() - __STATIC_CAST(size_type,__n)) - this->_M_throw_length_error(); - if (__old_size + __n > this->capacity()) { - size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start, __len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - else { - _ForwardIter __f1 = __first; - ++__f1; -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copyT(__f1, __last, this->_M_Finish() + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__f1, __last, this->_M_Finish() + 1); - _STLP_TRY { - _M_construct_null(this->_M_Finish() + __n); - } - _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n)) - _Traits::assign(*this->_M_finish, *__first); - this->_M_finish += __n; - } - } - return *this; - } - - template - _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/) - { return append((size_type) __n, (_CharT) __x); } - - template - _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/) - { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); } - -public: - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - _Self& append(_InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_append_dispatch(__first, __last, _Integral()); - } -# endif -#endif - -protected: - _Self& _M_append(const _CharT* __first, const _CharT* __last); - -public: -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - _Self& append(const _CharT* __first, const _CharT* __last) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - return _M_append(__first, __last); - } -# endif -#endif - - _Self& append(const _Self& __s) - { return _M_append(__s._M_Start(), __s._M_Finish()); } - - _Self& append(const _Self& __s, - size_type __pos, size_type __n) { - if (__pos > __s.size()) - this->_M_throw_out_of_range(); - return _M_append(__s._M_Start() + __pos, - __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); - } - - _Self& append(const _CharT* __s, size_type __n) - { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); } - _Self& append(const _CharT* __s) - { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); } - _Self& append(size_type __n, _CharT __c); - -public: - void push_back(_CharT __c) { - if (this->_M_Finish() + 1 == this->_M_end_of_storage._M_data) - reserve(size() + (max)(size(), __STATIC_CAST(size_type,1))); - _M_construct_null(this->_M_Finish() + 1); - _Traits::assign(*(this->_M_Finish()), __c); - ++this->_M_finish; - } - - void pop_back() { - _Traits::assign(*(this->_M_Finish() - 1), _M_null()); - this->_M_destroy_back(); - --this->_M_finish; - } - -public: // Assign - _Self& assign(const _Self& __s) - { return _M_assign(__s._M_Start(), __s._M_Finish()); } - - _Self& assign(const _Self& __s, - size_type __pos, size_type __n) { - if (__pos > __s.size()) - this->_M_throw_out_of_range(); - return _M_assign(__s._M_Start() + __pos, - __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); - } - - _Self& assign(const _CharT* __s, size_type __n) - { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); } - - _Self& assign(const _CharT* __s) - { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); } - - _Self& assign(size_type __n, _CharT __c); - -#if defined (_STLP_MEMBER_TEMPLATES) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -private: // Helper functions for assign. - template - _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) - { return assign((size_type) __n, (_CharT) __x); } - - template - _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { - pointer __cur = this->_M_Start(); - while (__f != __l && __cur != this->_M_Finish()) { - _Traits::assign(*__cur, *__f); - ++__f; - ++__cur; - } - if (__f == __l) - erase(__cur, this->end()); - else - _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - return *this; - } - -public: - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - _Self& assign(_InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_assign_dispatch(__first, __last, _Integral()); - } -# endif -#endif - -protected: - _Self& _M_assign(const _CharT* __f, const _CharT* __l); - -public: - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - _Self& assign(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - return _M_assign(__f, __l); - } -# endif -#endif - -public: // Insert - - _Self& insert(size_type __pos, const _Self& __s) { - if (__pos > size()) - this->_M_throw_out_of_range(); - if (size() > max_size() - __s.size()) - this->_M_throw_length_error(); - _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this); - return *this; - } - - _Self& insert(size_type __pos, const _Self& __s, - size_type __beg, size_type __n) { - if (__pos > size() || __beg > __s.size()) - this->_M_throw_out_of_range(); - size_type __len = (min) (__n, __s.size() - __beg); - if (size() > max_size() - __len) - this->_M_throw_length_error(); - _M_insert(begin() + __pos, - __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this); - return *this; - } - _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos > size()) - this->_M_throw_out_of_range(); - if (size() > max_size() - __n) - this->_M_throw_length_error(); - _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s)); - return *this; - } - - _Self& insert(size_type __pos, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos > size()) - this->_M_throw_out_of_range(); - size_type __len = _Traits::length(__s); - if (size() > max_size() - __len) - this->_M_throw_length_error(); - _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s)); - return *this; - } - - _Self& insert(size_type __pos, size_type __n, _CharT __c) { - if (__pos > size()) - this->_M_throw_out_of_range(); - if (size() > max_size() - __n) - this->_M_throw_length_error(); - insert(begin() + __pos, __n, __c); - return *this; - } - - iterator insert(iterator __p, _CharT __c) { - _STLP_FIX_LITERAL_BUG(__p) - if (__p == end()) { - push_back(__c); - return this->_M_Finish() - 1; - } - else - return _M_insert_aux(__p, __c); - } - - void insert(iterator __p, size_t __n, _CharT __c); - -protected: // Helper functions for insert. - - void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref); - - pointer _M_insert_aux(pointer, _CharT); - - void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _STLP_FIX_LITERAL_BUG(__res) - _Traits::copy(__res, __f, __l - __f); - } - - void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _Traits::move(__res, __f, __l - __f); - } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last, - difference_type __n) { - const size_type __old_size = this->size(); - size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start, __len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - - template - void _M_insertT(iterator __p, _InputIter __first, _InputIter __last, - const input_iterator_tag &) { - for ( ; __first != __last; ++__first) { - __p = insert(__p, *__first); - ++__p; - } - } - - template - void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last, - const forward_iterator_tag &) { - if (__first != __last) { - difference_type __n = distance(__first, __last); - if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) { - const difference_type __elems_after = this->_M_finish - __pos; - if (__elems_after >= __n) { -# if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); - else -# endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); - this->_M_finish += __n; - _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); - _M_copyT(__first, __last, __pos); - } - else { - pointer __old_finish = this->_M_Finish(); - _ForwardIter __mid = __first; - advance(__mid, __elems_after + 1); -# if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copyT(__mid, __last, this->_M_Finish() + 1); - else -# endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__mid, __last, this->_M_Finish() + 1); - this->_M_finish += __n - __elems_after; - _STLP_TRY { -# if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copy(__pos, __old_finish + 1, this->_M_Finish()); - else -# endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish()); - this->_M_finish += __elems_after; - } - _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()), - this->_M_finish = __old_finish)) - _M_copyT(__first, __mid, __pos); - } - } - else { - _M_insert_overflow(__pos, __first, __last, __n); - } - } - } - - template - void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, - const __true_type& /*Integral*/) { - insert(__p, (size_type) __n, (_CharT) __x); - } - - template - void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last, - const __false_type& /*Integral*/) { - _STLP_FIX_LITERAL_BUG(__p) - /* - * Within the basic_string implementation we are only going to check for - * self referencing if iterators are string iterators or _CharT pointers. - * A user could encapsulate those iterator within their own iterator interface - * and in this case lead to a bad behavior, this is a known limitation. - */ - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside; - _M_insert_aux(__p, __first, __last, _CheckInside()); - } - - template - void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last, - const __true_type& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__p) - _M_insert(__p, &(*__first), &(*__last), _M_inside(&(*__first))); - } - - template - void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last, - const __false_type& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__p) - _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); - } - - template - void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) { - _STLP_FIX_LITERAL_BUG(__result) - for ( ; __first != __last; ++__first, ++__result) - _Traits::assign(*__result, *__first); - } - -# if !defined (_STLP_NO_METHOD_SPECIALIZATION) - void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _STLP_FIX_LITERAL_BUG(__res) - _Traits::copy(__res, __f, __l - __f); - } -# endif - -public: - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - void insert(iterator __p, _InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - _M_insert_dispatch(__p, __first, __last, _Integral()); - } -# endif -#endif - -public: - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - void insert(iterator __p, const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _M_insert(__p, __f, __l, _M_inside(__f)); - } -#endif - -public: // Erase. - - _Self& erase(size_type __pos = 0, size_type __n = npos) { - if (__pos > size()) - this->_M_throw_out_of_range(); - erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos)); - return *this; - } - - iterator erase(iterator __pos) { - // The move includes the terminating _CharT(). - _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos); - this->_M_destroy_back(); - --this->_M_finish; - return __pos; - } - - iterator erase(iterator __first, iterator __last) { - if (__first != __last) { - // The move includes the terminating _CharT(). - traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1); - pointer __new_finish = this->_M_Finish() - (__last - __first); - this->_M_destroy_ptr_range(__new_finish + 1, this->_M_Finish() + 1); - this->_M_finish = __new_finish; - } - return __first; - } - -public: // Replace. (Conceptually equivalent - // to erase followed by insert.) - _Self& replace(size_type __pos, size_type __n, const _Self& __s) { - if (__pos > size()) - this->_M_throw_out_of_range(); - const size_type __len = (min) (__n, size() - __pos); - if (size() - __len >= max_size() - __s.size()) - this->_M_throw_length_error(); - return _M_replace(begin() + __pos, begin() + __pos + __len, - __s._M_Start(), __s._M_Finish(), &__s == this); - } - - _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, - size_type __pos2, size_type __n2) { - if (__pos1 > size() || __pos2 > __s.size()) - this->_M_throw_out_of_range(); - const size_type __len1 = (min) (__n1, size() - __pos1); - const size_type __len2 = (min) (__n2, __s.size() - __pos2); - if (size() - __len1 >= max_size() - __len2) - this->_M_throw_length_error(); - return _M_replace(begin() + __pos1, begin() + __pos1 + __len1, - __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this); - } - - _Self& replace(size_type __pos, size_type __n1, - const _CharT* __s, size_type __n2) { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos > size()) - this->_M_throw_out_of_range(); - const size_type __len = (min) (__n1, size() - __pos); - if (__n2 > max_size() || size() - __len >= max_size() - __n2) - this->_M_throw_length_error(); - return _M_replace(begin() + __pos, begin() + __pos + __len, - __s, __s + __n2, _M_inside(__s)); - } - - _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos > size()) - this->_M_throw_out_of_range(); - const size_type __len = (min) (__n1, size() - __pos); - const size_type __n2 = _Traits::length(__s); - if (__n2 > max_size() || size() - __len >= max_size() - __n2) - this->_M_throw_length_error(); - return _M_replace(begin() + __pos, begin() + __pos + __len, - __s, __s + _Traits::length(__s), _M_inside(__s)); - } - - _Self& replace(size_type __pos, size_type __n1, - size_type __n2, _CharT __c) { - if (__pos > size()) - this->_M_throw_out_of_range(); - const size_type __len = (min) (__n1, size() - __pos); - if (__n2 > max_size() || size() - __len >= max_size() - __n2) - this->_M_throw_length_error(); - return replace(begin() + __pos, begin() + __pos + __len, __n2, __c); - } - - _Self& replace(iterator __first, iterator __last, const _Self& __s) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this); - } - - _Self& replace(iterator __first, iterator __last, - const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__s) - return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s)); - } - - _Self& replace(iterator __first, iterator __last, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__s) - return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s)); - } - - _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c); - -protected: // Helper functions for replace. - _Self& _M_replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l, bool __self_ref); - -public: -#if defined (_STLP_MEMBER_TEMPLATES) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - template - _Self& _M_replace_dispatch(iterator __first, iterator __last, - _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return replace(__first, __last, (size_type) __n, (_CharT) __x); - } - - template - _Self& _M_replace_dispatch(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside; - return _M_replace_aux(__first, __last, __f, __l, _CheckInside()); - } - - template - _Self& _M_replace_aux(iterator __first, iterator __last, - _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return _M_replace(__first, __last, &(*__f), &(*__l), _M_inside(&(*__f))); - } - - template - _Self& _M_replace_aux(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - } - - template - _Self& _M_replaceT(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - for ( ; __first != __last && __f != __l; ++__first, ++__f) - _Traits::assign(*__first, *__f); - if (__f == __l) - erase(__first, __last); - else - _M_insertT(__last, __f, __l, __ite_tag); - return *this; - } - - template - _Self& _M_replaceT(iterator __first, iterator __last, - _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - difference_type __n = distance(__f, __l); - const difference_type __len = __last - __first; - if (__len >= __n) { - _M_copyT(__f, __l, __first); - erase(__first + __n, __last); - } - else { - _ForwardIter __m = __f; - advance(__m, __len); - _M_copyT(__f, __m, __first); - _M_insertT(__last, __m, __l, __ite_tag); - } - return *this; - } - -public: - // Check to see if _InputIter is an integer type. If so, then - // it can't be an iterator. - template - _Self& replace(iterator __first, iterator __last, - _InputIter __f, _InputIter __l) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_replace_dispatch(__first, __last, __f, __l, _Integral()); - } - -# endif -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) -# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - _Self& replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - return _M_replace(__first, __last, __f, __l, _M_inside(__f)); - } -# endif -#endif - -public: // Other modifier member functions. - - size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos > size()) - this->_M_throw_out_of_range(); - const size_type __len = (min) (__n, size() - __pos); - _Traits::copy(__s, this->_M_Start() + __pos, __len); - return __len; - } - - void swap(_Self& __s) { - this->_M_Swap(__s); - } - -public: // Conversion to C string. - - const _CharT* c_str() const { return this->_M_Start(); } - const _CharT* data() const { return this->_M_Start(); } - -public: // find. - - size_type find(const _Self& __s, size_type __pos = 0) const - { return find(__s._M_Start(), __pos, __s.size()); } - - size_type find(const _CharT* __s, size_type __pos = 0) const - { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); } - - size_type find(const _CharT* __s, size_type __pos, size_type __n) const; - - // WIE: Versant schema compiler 5.2.2 ICE workaround - size_type find(_CharT __c) const { return find(__c, 0); } - size_type find(_CharT __c, size_type __pos /* = 0 */) const; - -public: // rfind. - - size_type rfind(const _Self& __s, size_type __pos = npos) const - { return rfind(__s._M_Start(), __pos, __s.size()); } - - size_type rfind(const _CharT* __s, size_type __pos = npos) const - { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); } - - size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; - size_type rfind(_CharT __c, size_type __pos = npos) const; - -public: // find_first_of - - size_type find_first_of(const _Self& __s, size_type __pos = 0) const - { return find_first_of(__s._M_Start(), __pos, __s.size()); } - - size_type find_first_of(const _CharT* __s, size_type __pos = 0) const - { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); } - - size_type find_first_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - size_type find_first_of(_CharT __c, size_type __pos = 0) const - { return find(__c, __pos); } - -public: // find_last_of - - size_type find_last_of(const _Self& __s, - size_type __pos = npos) const - { return find_last_of(__s._M_Start(), __pos, __s.size()); } - - size_type find_last_of(const _CharT* __s, size_type __pos = npos) const - { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); } - - size_type find_last_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - size_type find_last_of(_CharT __c, size_type __pos = npos) const { - return rfind(__c, __pos); - } - -public: // find_first_not_of - - size_type find_first_not_of(const _Self& __s, - size_type __pos = 0) const - { return find_first_not_of(__s._M_Start(), __pos, __s.size()); } - - size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const - { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); } - - size_type find_first_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - size_type find_first_not_of(_CharT __c, size_type __pos = 0) const; - -public: // find_last_not_of - - size_type find_last_not_of(const _Self& __s, - size_type __pos = npos) const - { return find_last_not_of(__s._M_Start(), __pos, __s.size()); } - - size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const - { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); } - - size_type find_last_not_of(const _CharT* __s, size_type __pos, - size_type __n) const; - - size_type find_last_not_of(_CharT __c, size_type __pos = npos) const; - -public: // Substring. - _Self substr(size_type __pos = 0, size_type __n = npos) const - { return _Self(*this, __pos, __n, get_allocator()); } - -public: // Compare - int compare(const _Self& __s) const - { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); } - - int compare(size_type __pos1, size_type __n1, - const _Self& __s) const { - if (__pos1 > size()) - this->_M_throw_out_of_range(); - return _M_compare(this->_M_Start() + __pos1, - this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), - __s._M_Start(), __s._M_Finish()); - } - - int compare(size_type __pos1, size_type __n1, - const _Self& __s, - size_type __pos2, size_type __n2) const { - if (__pos1 > size() || __pos2 > __s.size()) - this->_M_throw_out_of_range(); - return _M_compare(this->_M_Start() + __pos1, - this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), - __s._M_Start() + __pos2, - __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2)); - } - - int compare(const _CharT* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s)); - } - - int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos1 > size()) - this->_M_throw_out_of_range(); - return _M_compare(this->_M_Start() + __pos1, - this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), - __s, __s + _Traits::length(__s)); - } - - int compare(size_type __pos1, size_type __n1, const _CharT* __s, - size_type __n2) const { - _STLP_FIX_LITERAL_BUG(__s) - if (__pos1 > size()) - this->_M_throw_out_of_range(); - return _M_compare(this->_M_Start() + __pos1, - this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), - __s, __s + __n2); - } - -public: // Helper functions for compare. - - static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, - const _CharT* __f2, const _CharT* __l2) { - const ptrdiff_t __n1 = __l1 - __f1; - const ptrdiff_t __n2 = __l2 - __f2; - const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2)); - return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0)); - } -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1) -# include -# undef _STLP_STRING_SUM_BASE -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ -}; - -#if !defined (_STLP_STATIC_CONST_INIT_BUG) -# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) -template -const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0; -# endif -#endif - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -#if defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -# undef basic_string -#endif - -_STLP_END_NAMESPACE - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// ------------------------------------------------------------ -// Non-member functions. -// Swap. -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -template -inline void _STLP_CALL -swap(basic_string<_CharT,_Traits,_Alloc>& __x, - basic_string<_CharT,_Traits,_Alloc>& __y) -{ __x.swap(__y); } -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - //Completness depends on the allocator: - typedef typename __move_traits<_Alloc>::complete complete; -}; -/*#else - * There is no need to specialize for string and wstring in this case - * as the default __move_traits will already tell that string is movable - * but not complete. We cannot define it as complete as nothing guaranty - * that the STLport user hasn't specialized std::allocator for char or - * wchar_t. - */ -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, - _CharT* __buf, size_t __n); - -#if defined(_STLP_USE_WIDE_INTERFACE) -// A couple of functions to transfer between ASCII/Unicode -wstring __ASCIIToWide(const char *ascii); -string __WideToASCII(const wchar_t *wide); -#endif - -inline const char* _STLP_CALL -__get_c_string(const string& __str) { return __str.c_str(); } - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#include - -#if defined(_STLP_USE_NO_IOSTREAMS) || \ - (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)) -# include -#endif - -#endif /* _STLP_INTERNAL_STRING_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/stl/_string_base.h b/SDK/stlport/stl/_string_base.h deleted file mode 100644 index 923049dc..00000000 --- a/SDK/stlport/stl/_string_base.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_BASE_H -#define _STLP_STRING_BASE_H - -// ------------------------------------------------------------ -// Class _String_base. - -// _String_base is a helper class that makes it it easier to write an -// exception-safe version of basic_string. The constructor allocates, -// but does not initialize, a block of memory. The destructor -// deallocates, but does not destroy elements within, a block of -// memory. The destructor assumes that _M_start either is null, or else -// points to a block of memory that was allocated using _String_base's -// allocator and whose size is _M_end_of_storage._M_data - _M_start. - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#ifndef _STLP_SHORT_STRING_SZ -# define _STLP_SHORT_STRING_SZ 16 -#endif - -template -class _String_base { - typedef _String_base<_Tp, _Alloc> _Self; -protected: - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) -public: - //dums: Some compiler(MSVC6) require it to be public not simply protected! - enum {_DEFAULT_SIZE = _STLP_SHORT_STRING_SZ}; - //This is needed by the full move framework - typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; - typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy; - typedef size_t size_type; -private: -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - union _Buffers { - _Tp* _M_dynamic_buf; - _Tp _M_static_buf[_DEFAULT_SIZE]; - } _M_buffers; -#else - _Tp* _M_start; -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ -protected: -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - bool _M_using_static_buf() const { - return (_M_end_of_storage._M_data == _M_buffers._M_static_buf + _DEFAULT_SIZE); - } - _Tp const* _M_Start() const { - return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf; - } - _Tp* _M_Start() { - return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf; - } -#else - _Tp const* _M_Start() const {return _M_start;} - _Tp* _M_Start() {return _M_start;} -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - - _Tp* _M_finish; - _AllocProxy _M_end_of_storage; - - _Tp const* _M_Finish() const {return _M_finish;} - _Tp* _M_Finish() {return _M_finish;} - - // Precondition: 0 < __n <= max_size(). - void _M_allocate_block(size_t __n = _DEFAULT_SIZE); - void _M_deallocate_block() { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (!_M_using_static_buf() && (_M_buffers._M_dynamic_buf != 0)) - _M_end_of_storage.deallocate(_M_buffers._M_dynamic_buf, _M_end_of_storage._M_data - _M_buffers._M_dynamic_buf); -#else - if (_M_start != 0) - _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start); -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - } - - size_t max_size() const { - const size_type __string_max_size = size_type(-1) / sizeof(_Tp); - typename allocator_type::size_type __alloc_max_size = _M_end_of_storage.max_size(); - return (min)(__alloc_max_size, __string_max_size) - 1; - } - - _String_base(const allocator_type& __a) -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - : _M_finish(_M_buffers._M_static_buf), _M_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE) -#else - : _M_start(0), _M_finish(0), _M_end_of_storage(__a, (_Tp*)0) -#endif - {} - - _String_base(const allocator_type& __a, size_t __n) -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - : _M_finish(_M_buffers._M_static_buf), _M_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE) { -#else - : _M_start(0), _M_finish(0), _M_end_of_storage(__a, (_Tp*)0) { -#endif - _M_allocate_block(__n); - } - -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - void _M_move_src (_Self &src) { - if (src._M_using_static_buf()) { - _M_buffers = src._M_buffers; - _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_buffers._M_static_buf); - _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE; - } - else { - _M_buffers._M_dynamic_buf = src._M_buffers._M_dynamic_buf; - _M_finish = src._M_finish; - _M_end_of_storage._M_data = src._M_end_of_storage._M_data; - src._M_buffers._M_dynamic_buf = 0; - } - } -#endif - - _String_base(__move_source<_Self> src) -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - : _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) { - _M_move_src(src.get()); -#else - : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), - _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) { - src.get()._M_start = 0; -#endif - } - - ~_String_base() { _M_deallocate_block(); } - - void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - _M_buffers._M_dynamic_buf = __start; -#else - _M_start = __start; -#endif - _M_finish = __finish; - _M_end_of_storage._M_data = __end_of_storage; - } - - void _M_destroy_back () { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (!_M_using_static_buf()) -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_STD::_Destroy(_M_finish); - } - - void _M_destroy_range(size_t __from_off = 0, size_t __to_off = 1) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (!_M_using_static_buf()) - _STLP_STD::_Destroy_Range(_M_buffers._M_dynamic_buf + __from_off, _M_finish + __to_off); -#else - _STLP_STD::_Destroy_Range(_M_start + __from_off, _M_finish + __to_off); -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - } - - void _M_destroy_ptr_range(_Tp *__f, _Tp *__l) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (!_M_using_static_buf()) -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - _STLP_STD::_Destroy_Range(__f, __l); - } - - void _M_Swap(_Self &__s) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (_M_using_static_buf()) { - if (__s._M_using_static_buf()) { - _STLP_STD::swap(_M_buffers, __s._M_buffers); - _Tp *__tmp = _M_finish; - _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf); - __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_buffers._M_static_buf); - //We need to swap _M_end_of_storage for allocators with state: - _M_end_of_storage.swap(__s._M_end_of_storage); - _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE; - __s._M_end_of_storage._M_data = __s._M_buffers._M_static_buf + _DEFAULT_SIZE; - } else { - __s._M_Swap(*this); - return; - } - } - else if (__s._M_using_static_buf()) { - _Tp *__tmp = _M_buffers._M_dynamic_buf; - _Tp *__tmp_finish = _M_finish; - _Tp *__tmp_end_data = _M_end_of_storage._M_data; - _M_buffers = __s._M_buffers; - //We need to swap _M_end_of_storage for allocators with state: - _M_end_of_storage.swap(__s._M_end_of_storage); - _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE; - _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf); - __s._M_buffers._M_dynamic_buf = __tmp; - __s._M_end_of_storage._M_data = __tmp_end_data; - __s._M_finish = __tmp_finish; - } - else { - _STLP_STD::swap(_M_buffers._M_dynamic_buf, __s._M_buffers._M_dynamic_buf); - _M_end_of_storage.swap(__s._M_end_of_storage); - _STLP_STD::swap(_M_finish, __s._M_finish); - } -#else - _STLP_STD::swap(_M_start, __s._M_start); - _M_end_of_storage.swap(__s._M_end_of_storage); - _STLP_STD::swap(_M_finish, __s._M_finish); -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - } - - void _STLP_FUNCTION_THROWS _M_throw_length_error() const; - void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; -}; - -#undef _STLP_SHORT_STRING_SZ - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _String_base >; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS _String_base >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_STRING_BASE_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/stl/_string_fwd.h b/SDK/stlport/stl/_string_fwd.h deleted file mode 100644 index 15203226..00000000 --- a/SDK/stlport/stl/_string_fwd.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_FWD_H -#define _STLP_STRING_FWD_H - -#ifndef _STLP_IOSFWD -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template , - class _Alloc = allocator<_CharT> > -class basic_string; -#else -template -class basic_string; -#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ - -typedef basic_string, allocator > string; - -#if defined (_STLP_HAS_WCHAR_T) -typedef basic_string, allocator > wstring; -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -//This function limits header dependency between exception and string -//implementation. It is implemented in _string.h -const char* _STLP_CALL __get_c_string(const string& __str); - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_STRING_FWD_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_string_hash.h b/SDK/stlport/stl/_string_hash.h deleted file mode 100644 index c5f13392..00000000 --- a/SDK/stlport/stl/_string_hash.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_HASH_H -#define _STLP_STRING_HASH_H - -#ifndef _STLP_HASH_FUN_H -# include -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -_STLP_INLINE_LOOP size_t -__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) { - unsigned long __h = 0; - size_t __len = __s.size(); - const _CharT* __data = __s.data(); - for ( size_t __i = 0; __i < __len; ++__i) - __h = /* 5 *__h */(__h << 2) + __h + __data[__i]; - return size_t(__h); -} - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - -template -struct hash > { - size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const - { return __stl_string_hash(__s); } -}; - -#else - -_STLP_TEMPLATE_NULL -struct _STLP_CLASS_DECLSPEC hash { - size_t operator()(const string& __s) const - { return __stl_string_hash(__s); } -}; - -# if defined (_STLP_HAS_WCHAR_T) -_STLP_TEMPLATE_NULL -struct _STLP_CLASS_DECLSPEC hash { - size_t operator()(const wstring& __s) const - { return __stl_string_hash(__s); } -}; -# endif - -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif diff --git a/SDK/stlport/stl/_string_io.c b/SDK/stlport/stl/_string_io.c deleted file mode 100644 index 84b18736..00000000 --- a/SDK/stlport/stl/_string_io.c +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef _STLP_STRING_IO_C -#define _STLP_STRING_IO_C - -#ifndef _STLP_STRING_IO_H -# include -#endif - -#ifndef _STLP_INTERNAL_CTYPE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -bool _STLP_CALL -__stlp_string_fill(basic_ostream<_CharT, _Traits>& __os, - basic_streambuf<_CharT, _Traits>* __buf, - streamsize __n) { - _CharT __f = __os.fill(); - for (streamsize __i = 0; __i < __n; ++__i) { - if (_Traits::eq_int_type(__buf->sputc(__f), _Traits::eof())) - return false; - } - return true; -} - - -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator << (basic_ostream<_CharT, _Traits>& __os, - const basic_string<_CharT,_Traits,_Alloc>& __s) { - typedef basic_ostream<_CharT, _Traits> __ostream; - typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; - - // The hypothesis of this implementation is that size_type is unsigned: - _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0) - - typename __ostream::sentry __sentry(__os); - bool __ok = false; - - if (__sentry) { - __ok = true; - size_type __n = __s.size(); - const bool __left = (__os.flags() & __ostream::left) != 0; - const streamsize __w = __os.width(0); - basic_streambuf<_CharT, _Traits>* __buf = __os.rdbuf(); - - const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __n) < __w)) || - ((sizeof(streamsize) <= sizeof(size_t)) && (__n < __STATIC_CAST(size_t, __w)))); - streamsize __pad_len = __need_pad ? __w - __n : 0; - - if (!__left) - __ok = __stlp_string_fill(__os, __buf, __pad_len); - - __ok = __ok && (__buf->sputn(__s.data(), streamsize(__n)) == streamsize(__n)); - - if (__left) - __ok = __ok && __stlp_string_fill(__os, __buf, __pad_len); - } - - if (!__ok) - __os.setstate(__ostream::failbit); - - return __os; -} - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator >> (basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT,_Traits, _Alloc>& __s) { - typedef basic_istream<_CharT, _Traits> __istream; - typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; - - // The hypothesis of this implementation is that size_type is unsigned: - _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0) - - typename __istream::sentry __sentry(__is); - - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - typedef ctype<_CharT> _C_type; - - const locale& __loc = __is.getloc(); - const _C_type& _Ctype = use_facet<_C_type>(__loc); - __s.clear(); - streamsize __width = __is.width(0); - size_type __n; - if (__width <= 0) - __n = __s.max_size(); - /* __width can only overflow size_type if sizeof(streamsize) > sizeof(size_type) - * because here we know that __width is positive and the stattic assertion check - * that size_type is unsigned. - */ - else if (sizeof(streamsize) > sizeof(size_type) && - (__width > __STATIC_CAST(streamsize, __s.max_size()))) - __n = 0; - else { - __n = __STATIC_CAST(size_type, __width); - __s.reserve(__n); - } - - while (__n-- > 0) { - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, _Traits::eof())) { - __is.setstate(__istream::eofbit); - break; - } - else { - _CharT __c = _Traits::to_char_type(__c1); - - if (_Ctype.is(_C_type::space, __c)) { - if (_Traits::eq_int_type(__buf->sputbackc(__c), _Traits::eof())) - __is.setstate(__istream::failbit); - break; - } - else - __s.push_back(__c); - } - } - - // If we have read no characters, then set failbit. - if (__s.empty()) - __is.setstate(__istream::failbit); - } - else - __is.setstate(__istream::failbit); - - return __is; -} - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -getline(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT,_Traits,_Alloc>& __s, - _CharT __delim) { - typedef basic_istream<_CharT, _Traits> __istream; - typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; - size_type __nread = 0; - typename basic_istream<_CharT, _Traits>::sentry __sentry(__is, true); - if (__sentry) { - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - __s.clear(); - - while (__nread < __s.max_size()) { - int __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, _Traits::eof())) { - __is.setstate(__istream::eofbit); - break; - } - else { - ++__nread; - _CharT __c = _Traits::to_char_type(__c1); - if (!_Traits::eq(__c, __delim)) - __s.push_back(__c); - else - break; // Character is extracted but not appended. - } - } - } - if (__nread == 0 || __nread >= __s.max_size()) - __is.setstate(__istream::failbit); - - return __is; -} - -_STLP_END_NAMESPACE - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_string_io.h b/SDK/stlport/stl/_string_io.h deleted file mode 100644 index fe549fef..00000000 --- a/SDK/stlport/stl/_string_io.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_IO_H -#define _STLP_STRING_IO_H - -#ifndef _STLP_INTERNAL_OSTREAM_H -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAM -# include -#endif - -// I/O. -_STLP_BEGIN_NAMESPACE - -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, - const basic_string<_CharT,_Traits,_Alloc>& __s); - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) - -template -basic_ostream<_CharT, _Traits>& _STLP_CALL -operator<<(basic_ostream<_CharT, _Traits>& __os, - const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __sum) { - basic_string<_CharT, _Traits, _Alloc> __tmp(__sum); - return __os << __tmp; -} - -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -operator>>(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT,_Traits,_Alloc>& __s); - -template -basic_istream<_CharT, _Traits>& _STLP_CALL -getline(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT,_Traits,_Alloc>& __s, - _CharT __delim); - -#if !(defined (__BORLANDC__) && !defined (_STLP_USE_OWN_NAMESPACE)) - -template -inline basic_istream<_CharT, _Traits>& _STLP_CALL -getline(basic_istream<_CharT, _Traits>& __is, - basic_string<_CharT,_Traits,_Alloc>& __s) { - return getline(__is, __s, __is.widen('\n')); -} -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_STRING_IO_H */ diff --git a/SDK/stlport/stl/_string_npos.h b/SDK/stlport/stl/_string_npos.h deleted file mode 100644 index faa9c627..00000000 --- a/SDK/stlport/stl/_string_npos.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -/* This header contains npos definition used in basic_string and rope - * implementation. It do not have to be guarded as files including it - * are already guarded and it has sometimes to be included several times. - */ - -#if defined (_STLP_STATIC_CONST_INIT_BUG) - enum { npos = -1 }; -#elif defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) - // inline initializer conflicts with 'extern template' - static const size_t npos; -#else - static const size_t npos = ~(size_t)0; -#endif diff --git a/SDK/stlport/stl/_string_operators.h b/SDK/stlport/stl/_string_operators.h deleted file mode 100644 index cff13af0..00000000 --- a/SDK/stlport/stl/_string_operators.h +++ /dev/null @@ -1,602 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_OPERATORS_H -#define _STLP_STRING_OPERATORS_H - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_USE_TEMPLATE_EXPRESSION) - -# if defined (__GNUC__) || defined (__MLCCPP__) -# define _STLP_INIT_AMBIGUITY 1 -# endif - -template -inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - typedef basic_string<_CharT,_Traits,_Alloc> _Str; - typedef typename _Str::_Reserve_t _Reserve_t; -# if defined (_STLP_INIT_AMBIGUITY) - // gcc counts this as a function - _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); -# else - _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); -# endif - __result.append(__s); - __result.append(__y); - return __result; -} - -template -inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL -operator+(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - typedef basic_string<_CharT,_Traits,_Alloc> _Str; - typedef typename _Str::_Reserve_t _Reserve_t; - const size_t __n = _Traits::length(__s); -# if defined (_STLP_INIT_AMBIGUITY) - _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator()); -# else - _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator()); -# endif - __result.append(__s, __s + __n); - __result.append(__y); - return __result; -} - -template -inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL -operator+(_CharT __c, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - typedef basic_string<_CharT,_Traits,_Alloc> _Str; - typedef typename _Str::_Reserve_t _Reserve_t; -# if defined (_STLP_INIT_AMBIGUITY) - _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); -# else - _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); -# endif - __result.push_back(__c); - __result.append(__y); - return __result; -} - -template -inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - typedef basic_string<_CharT,_Traits,_Alloc> _Str; - typedef typename _Str::_Reserve_t _Reserve_t; - const size_t __n = _Traits::length(__s); -# if defined (_STLP_INIT_AMBIGUITY) - _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator()); -# else - _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator()); -# endif - __result.append(__x); - __result.append(__s, __s + __n); - return __result; -} - -template -inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT __c) { - typedef basic_string<_CharT,_Traits,_Alloc> _Str; - typedef typename _Str::_Reserve_t _Reserve_t; -# if defined (_STLP_INIT_AMBIGUITY) - _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator()); -# else - _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator()); -# endif - __result.append(__x); - __result.push_back(__c); - return __result; -} - -# undef _STLP_INIT_AMBIGUITY - -#else /* _STLP_USE_TEMPLATE_EXPRESSION */ - -// addition with basic_string -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, - const basic_string<_CharT,_Traits,_Alloc>& __rhs) { - typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right> __root_type; - __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator())); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - __root_type, - _STLP_PRIV __on_right>(__lhs, __root); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, - const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) { - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right>(__lhs, __rhs); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __on_left> _STLP_CALL -operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs, - const basic_string<_CharT,_Traits,_Alloc>& __rhs) { - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __on_left>(__lhs, __rhs); -} - -// addition with C string -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - const size_t __n = _Traits::length(__s); - typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right> __root_type; - __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - __root_type, _STLP_PRIV __on_right>(__x, __root); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - const size_t __n = _Traits::length(__s); - typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right> __root_type; - __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator())); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, - __root_type, - _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __on_left> _STLP_CALL -operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, - const _CharT* __s) { - const size_t __n = _Traits::length(__s); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n)); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) { - const size_t __n = _Traits::length(__s); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y); -} - -// addition with char -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) { - typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right> __root_type; - __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - __root_type, _STLP_PRIV __on_right>(__x, __root); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) { - typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, - _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, - _STLP_PRIV __on_right> __root_type; - __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, - __root_type, _STLP_PRIV __on_right>(__c, __root); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __on_left> _STLP_CALL -operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) { - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c); -} - -template -inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right> _STLP_CALL -operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) { - return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, - _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, - _STLP_PRIV __on_right>(__c, __x); -} - -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -// Operator== and operator!= - -template -inline bool _STLP_CALL -operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; -} - -template -inline bool _STLP_CALL -operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - - -template -inline bool _STLP_CALL -operator==(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; -} - -template -inline bool _STLP_CALL -operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator==(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; -} - -template -inline bool _STLP_CALL -operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -// Operator< (and also >, <=, and >=). - -template -inline bool _STLP_CALL -operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()) < 0; -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()) < 0; -} - -template -inline bool _STLP_CALL -operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), - __y.begin(), __y.end()) < 0; -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -template -inline bool _STLP_CALL -operator<(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, - __y.begin(), __y.end()) < 0; -} - -template -inline bool _STLP_CALL -operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), - __s, __s + __n) < 0; -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator<(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, - __y.begin(), __y.end()) < 0; -} - -template -inline bool _STLP_CALL -operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - size_t __n = _Traits::length(__s); - return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), - __s, __s + __n) < 0; -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) - -/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise - * it might introduce ambiguity with pure template relational operators - * from rel_ops namespace. - */ -template -inline bool _STLP_CALL -operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) -{ return !(__x == __y); } - -template -inline bool _STLP_CALL -operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) -{ return __y < __x; } - -template -inline bool _STLP_CALL -operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) -{ return !(__y < __x); } - -template -inline bool _STLP_CALL -operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) -{ return !(__x < __y); } - -# if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const basic_string<_CharT,_Traits,_Alloc>& __y) -{ return !(__x==__y); } - -template -inline bool _STLP_CALL -operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) -{ return !(__x==__y); } -# endif - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - -template -inline bool _STLP_CALL -operator!=(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s == __y); -} - -template -inline bool _STLP_CALL -operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__x == __s); -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator!=(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s == __y); -} - -template -inline bool _STLP_CALL -operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__x == __s); -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -template -inline bool _STLP_CALL -operator>(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return __y < __s; -} - -template -inline bool _STLP_CALL -operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return __s < __x; -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator>(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return __y < __s; -} - -template -inline bool _STLP_CALL -operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return __s < __x; -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -template -inline bool _STLP_CALL -operator<=(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__y < __s); -} - -template -inline bool _STLP_CALL -operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s < __x); -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator<=(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__y < __s); -} - -template -inline bool _STLP_CALL -operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s < __x); -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -template -inline bool _STLP_CALL -operator>=(const _CharT* __s, - const basic_string<_CharT,_Traits,_Alloc>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s < __y); -} - -template -inline bool _STLP_CALL -operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__x < __s); -} - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -template -inline bool _STLP_CALL -operator>=(const _CharT* __s, - const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__s < __y); -} - -template -inline bool _STLP_CALL -operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - return !(__x < __s); -} -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_STRING_OPERATORS_H */ - diff --git a/SDK/stlport/stl/_string_sum.h b/SDK/stlport/stl/_string_sum.h deleted file mode 100644 index 98e1e317..00000000 --- a/SDK/stlport/stl/_string_sum.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING_SUM_H -#define _STLP_STRING_SUM_H - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -/*char wrapper to simulate basic_string*/ -template -struct __char_wrapper { - typedef const _CharT& const_reference; - - __char_wrapper(_CharT __val) : _Val(__val) {} - - _CharT getValue() const { return _Val; } - size_t size() const { return 1; } - - const_reference operator[] (size_t __n) const { - //To avoid a check on __n we use this strange implementation - return (&_Val)[__n]; - } - -private: - _CharT _Val; -}; - -/*C string wrapper to simulate basic_string*/ -template -struct __cstr_wrapper { - typedef const _CharT& const_reference; - - __cstr_wrapper(const _CharT *__cstr, size_t __size) : - _CStr(__cstr), _Size(__size) {} - - const _CharT* c_str() const { return _CStr; } - - size_t size() const { return _Size; } - - const_reference operator[] (size_t __n) const { return _CStr[__n]; } - -private: - const _CharT *_CStr; - size_t _Size; -}; - -/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/ -template -struct __bstr_wrapper { - typedef const _CharT& const_reference; - typedef basic_string<_CharT, _Traits, _Alloc> _BString; - - __bstr_wrapper (_BString const& __s) : - _BStr(__s) {} - - size_t size() const { return _BStr.size(); } - - const_reference operator[] (size_t __n) const { return _BStr[__n]; } - - _BString const& b_str() const { return _BStr; } - -private: - _BString const& _BStr; -}; - -struct __on_left {}; -struct __on_right {}; - -template -class __bstr_sum { -public: - typedef basic_string<_CharT, _Traits, _Alloc> _BString; - typedef typename _BString::const_reference const_reference; - typedef typename _BString::const_iterator const_iterator; - typedef typename _BString::const_reverse_iterator const_reverse_iterator; - typedef typename _BString::size_type size_type; - typedef typename _BString::allocator_type allocator_type; - typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self; - - __bstr_sum (_Left const& lhs, _Right const& rhs) : - _lhs(lhs), _rhs(rhs) {} - - _Left const& getLhs() const { return _lhs; } - _Right const& getRhs() const { return _rhs; } - - allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); } - - const_iterator begin() const { return _M_get_storage().begin(); } - const_iterator end() const { return _M_get_storage().end(); } - const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); } - const_reverse_iterator rend() const { return _M_get_storage().rend(); } - - size_type size() const { return _lhs.size() + _rhs.size(); } - size_type length() const { return size(); } - - size_t max_size() const { return _M_get_storage().max_size(); } - size_type capacity() const { return size(); } - bool empty() const { return size() == 0; } - - const_reference operator[](size_t __n) const - { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; } - - const_reference at(size_type __n) const - { return _M_get_storage().at(__n); } - - //operator += - typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft; - _BStrOnLeft operator += (const _BString& __s) { return append(__s); } - - typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft; - _CStrOnLeft operator += (const _CharT* __s) { return append(__s); } - - typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft; - _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); } - - //append - _BStrOnLeft append (const _BString& __s) - { return _BStrOnLeft(*this, __s); } - _BString& append(const _BString& __s, size_type __pos, size_type __n) - { return _M_get_storage().append(__s, __pos, __n); } - _CStrOnLeft append(const _CharT* __s) { - const size_type __n = _Traits::length(__s); - return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); - } - _CStrOnLeft append(const _CharT* __s, size_type __n) - { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); } - _BString& append(size_type __n, _CharT __c) - {return _M_get_storage().append(__n, __c);} - template - _BString& append(_InputIter __first, _InputIter __last) - {return _M_get_storage().append(__first, __last);} - - //assign - _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);} - _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);} - _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);} - _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); } - _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);} - - //insert - _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);} - _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n) - {return _M_get_storage().insert(__pos, __s, __beg, __n);} - _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);} - _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);} - _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);} - - //erase - _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);} - - //replace - _BString& replace(size_type __pos, size_type __n, const _BString& __s) - {return _M_get_storage().replace(__pos, __n, __s);} - _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2) - {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);} - _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) - {return _M_get_storage().replace(__pos, __n1, __s, __n2);} - _BString& replace(size_type __pos, size_type __n1, const _CharT* __s) - {return _M_get_storage().replace(__pos, __n1, __s);} - _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) - {return _M_get_storage().replace(__pos, __n1, __n2, __c);} - - size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const - {return _M_get_storage().copy(__s, __n, __pos);} - - void swap(_BString& __s) - {_M_get_storage().swap(__s);} - - const _CharT* c_str() const { return _M_get_storage().c_str(); } - const _CharT* data() const { return _M_get_storage().data(); } - - //find family - size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); } - size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); } - size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); } - size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); } - - size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); } - size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); } - size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); } - size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); } - - size_type find_first_of(const _BString& __s, size_type __pos = 0) const - { return _M_get_storage().find_first_of(__s, __pos); } - size_type find_first_of(const _CharT* __s, size_type __pos = 0) const - { return _M_get_storage().find_first_of(__s, __pos); } - size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const - { return _M_get_storage().find_first_of(__s, __pos, __n); } - size_type find_first_of(_CharT __c, size_type __pos = 0) const - { return _M_get_storage().find(__c, __pos); } - - size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const - { return _M_get_storage().find_last_of(__s, __pos); } - size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const - { return _M_get_storage().find_last_of(__s, __pos); } - size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const - { return _M_get_storage().find_last_of(__s, __pos, __n); } - size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const - { return _M_get_storage().rfind(__c, __pos); } - - size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const - { return _M_get_storage().find_first_not_of(__s, __pos); } - size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const - { return _M_get_storage().find_first_not_of(__s, __pos); } - size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { return _M_get_storage().find_first_not_of(__s, __pos, __n); } - size_type find_first_not_of(_CharT __c, size_type __pos = 0) const - { return _M_get_storage().find_first_not_of(__c, __pos); } - - size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const - { return _M_get_storage().find_last_not_of(__s, __pos); } - size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const - { return _M_get_storage().find_last_not_of(__s, __pos); } - size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const - { return _M_get_storage().find_last_not_of(__s, __pos, __n); } - size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const - { return _M_get_storage().find_last_not_of(__c, __pos); } - - _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const - { return _M_get_storage().substr(__pos, __n); } - - //compare - int compare(const _BString& __s) const - { return _M_get_storage().compare(__s); } - int compare(size_type __pos1, size_type __n1, const _Self& __s) const - { return _M_get_storage().compare(__pos1, __n1, __s); } - int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const - { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); } - int compare(const _CharT* __s) const - { return _M_get_storage().compare(__s); } - int compare(size_type __pos1, size_type __n1, const _CharT* __s) const - { return _M_get_storage().compare(__pos1, __n1, __s); } - int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const - { return _M_get_storage().compare(__pos1, __n1, __s, __n2); } - - //Returns the underlying basic_string representation of the template expression - //The non const method will always initialise it. - _BString& _M_get_storage() - { return _rhs._M_get_storage(*this, _StorageDirection()); } - - template - _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, - __on_left const& /*StorageDir*/) - { return _lhs._M_get_storage(__ref); } - - template - _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, - __on_right const& /*StorageDir*/) - { return _rhs._M_get_storage(__ref); } - - template - _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref) - { return _M_get_storage(__ref, _StorageDirection()); } - - //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation. - _BString const& _M_get_storage(bool __do_init = true) const - { return _M_get_storage(*this, __do_init, _StorageDirection()); } - - template - _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, - bool __do_init, __on_left const& /*StorageDir*/) const - { return _lhs._M_get_storage(__ref, __do_init); } - - template - _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, - bool __do_init, __on_right const& /*StorageDir*/) const - { return _rhs._M_get_storage(__ref, __do_init); } - - template - _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, - bool __do_init) const - { return _M_get_storage(__ref, __do_init, _StorageDirection()); } - -private: - _Left _lhs; - _Right _rhs; -}; - -/* - * For this operator we choose to use the right part as the storage part - */ -template -inline __bstr_sum<_CharT, _Traits, _Alloc, - __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>, - __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>, - __on_right> _STLP_CALL -operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) { - return __bstr_sum<_CharT, _Traits, _Alloc, - __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>, - __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>, - __on_right>(__lhs, __rhs); -} - -template -inline bool _STLP_CALL -operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); } - -template -inline bool _STLP_CALL -operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return __lhs._M_get_storage() < __rhs._M_get_storage(); } - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline bool _STLP_CALL -operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return !(__lhs == __rhs); } - -template -inline bool _STLP_CALL -operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return __rhs < __lhs; } - -template -inline bool _STLP_CALL -operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return !(__rhs < __lhs); } - -template -inline bool _STLP_CALL -operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, - const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) -{ return !(__lhs < __rhs); } - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ - - -/* - * This class will be used to simulate a temporary string that is required for - * a call to the c_str method on the __bstr_sum class. - */ - -template -struct __sum_storage_elem { - typedef basic_string<_CharT, _Traits, _Alloc> _BString; - - __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc) - {} - - template - void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const { - if (!_M_init) { - _M_storage = __ref; - _M_init = true; - } - } - - template - _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref, - bool __do_init) const { - if (__do_init) { - _M_Init(__ref); - } - return _M_storage; - } - template - _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) { - _M_Init(__ref); - return _M_storage; - } - - size_t size() const { return 0; } - _CharT const& operator[](size_t __n) const - { return __STATIC_CAST(_CharT*, 0)[__n]; } - -private: - mutable bool _M_init; - mutable basic_string<_CharT, _Traits, _Alloc> _M_storage; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /*_STLP_STRING_SUM_H*/ diff --git a/SDK/stlport/stl/_string_sum_methods.h b/SDK/stlport/stl/_string_sum_methods.h deleted file mode 100644 index 952ce187..00000000 --- a/SDK/stlport/stl/_string_sum_methods.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* - * All the necessary methods used for template expressions with basic_string - * This file do not have to be macro guarded as it is only used in the _string.h - * file and it is a part of the basic_string definition. - */ - -public: - template - basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) - : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator()) - { _M_append_sum(__s); } - - template - basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - size_type __pos, size_type __n = npos, - const allocator_type& __a = allocator_type()) - : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) { - size_type __size = __s.size(); - if (__pos > __size) - this->_M_throw_out_of_range(); - else - _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos)); - } - -private: - _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) { - _STLP_STD::_Copy_Construct(__buf, __c.getValue()); - return __buf + 1; - } - _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf) - { return uninitialized_copy(__s, __s + __s_size, __buf); } - _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf) - { return _M_append_fast(__s.c_str(), __s.size(), __buf); } - _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf) - { return _M_append_fast(__s.b_str(), __buf); } - _CharT* _M_append_fast(_Self const& __s, _CharT *__buf) - { return _M_append_fast(__s.data(), __s.size(), __buf); } - _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf) - { return __buf; } - template - _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf) - { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); } - - _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) { - if (__n == 0) - return __buf; - _STLP_STD::_Copy_Construct(__buf, __c.getValue()); - return __buf + 1; - } - _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf, - size_type __pos, size_type __n) - { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); } - _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf, - size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); } - _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf, - size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); } - _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf, - size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); } - _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf, - size_type, size_type) - { return __buf; } - - template - _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - _CharT *__buf, size_type __pos, size_type __n) { - if (__n == 0) { - return __buf; - } - size_type __lhs_size = __s.getLhs().size(); - if (__pos < __lhs_size) { - if (__n < (__lhs_size - __pos)) { - return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n); - } else { - return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n), - 0, __n - (__lhs_size - __pos)); - } - } else { - return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n); - } - } - - /* Note: We always force use of dynamic buffer if the short string optim option is activated - * to avoid complicated code if the basic_string was instanciated with a non POD type. - * In such a case we should use assignment for objects in the static array something that we - * do not do. - */ - size_type _M_get_additional_size(size_type __new_size, const __false_type& /*_Char_Is_POD*/) const { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - //To avoid problem with the string assumptions, never allocate a dynamic buffer smaller or equal - //than the static one: - if (__new_size < _Base::_DEFAULT_SIZE + 1) - return (_Base::_DEFAULT_SIZE + 1) - __new_size; -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - return 0; - } - size_type _M_get_additional_size(size_type, const __true_type& /*_Char_Is_POD*/) const - { return 0; } - - template - _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) { - size_type __s_size = __s.size(); - if (__s_size == 0) - return *this; - const size_type __old_size = this->size(); - if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size)) - this->_M_throw_length_error(); - size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD()); - if (__old_size + __s_size + __offset_size > this->capacity()) { - const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); - __new_finish = this->_M_append_fast(__s, __new_finish); - this->_M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - else { - _M_append_sum_no_overflow(__s, 0, __s_size); - } - return *this; - } - - template - _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - size_type __pos, size_type __n) { - size_type __s_size = (min)(__s.size() - __pos, __n); - if (__s_size == 0) - return *this; - const size_type __old_size = this->size(); - if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size)) - this->_M_throw_length_error(); - size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD()); - if (__old_size + __s_size + __offset_size > this->capacity()) { - const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); - __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size); - this->_M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - else { - _M_append_sum_no_overflow(__s, __pos, __s_size); - } - return *this; - } - - template - void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - size_type __pos, size_type __n) { - pointer __finish = this->_M_Finish(); - _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1); - _STLP_TRY { - this->_M_construct_null(__finish + __n); - } - _STLP_UNWIND(this->_M_destroy_ptr_range(__finish + 1, __finish + __n)) - /* The call to the traits::assign method is only important for non POD types because the instance - * pointed to by _M_finish has been constructed (default constructor) and should not be constructed - * (copy constructor) once again. For POD it is irrelevant, uninitialized_copy could be fine, - * but we are not going to make two implementations just for that. - */ - _Traits::assign(*this->_M_finish, __s[__pos]); - this->_M_finish += __n; - } diff --git a/SDK/stlport/stl/_string_workaround.h b/SDK/stlport/stl/_string_workaround.h deleted file mode 100644 index acd5d3d3..00000000 --- a/SDK/stlport/stl/_string_workaround.h +++ /dev/null @@ -1,733 +0,0 @@ -/* - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -//Included from _string.h, no need for macro guarding. - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_DEBUG) -# define basic_string _STLP_NON_DBG_NAME(str) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc> - -template -class basic_string : public _STLP_NO_MEM_T_STRING_BASE -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \ - !defined (basic_string) - , public __stlport_class > -#endif -{ -protected: // Protected members inherited from base. - typedef basic_string<_CharT, _Traits, _Alloc> _Self; - typedef _STLP_NO_MEM_T_STRING_BASE _Base; - typedef typename _Base::_Char_Is_POD _Char_Is_POD; - -public: - - __IMPORT_WITH_REVERSE_ITERATORS(_Base) - - typedef typename _Base::_Iterator_category _Iterator_category; - typedef typename _Base::traits_type traits_type; - typedef typename _Base::_Reserve_t _Reserve_t; - -public: // Constructor, destructor, assignment. - explicit basic_string(const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__a) {} - - basic_string(_Reserve_t __r, size_t __n, - const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {} - - basic_string(const _Self& __s) - : _STLP_NO_MEM_T_STRING_BASE(__s) {} - - basic_string(const _Self& __s, size_type __pos, size_type __n = npos, - const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {} - - basic_string(const _CharT* __s, size_type __n, - const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {} - - basic_string(const _CharT* __s, - const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {} - - basic_string(size_type __n, _CharT __c, - const allocator_type& __a = allocator_type()) - : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {} - - basic_string(__move_source<_Self> src) - : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {} - - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. -#if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor - template - basic_string(_InputIterator __f, _InputIterator __l, - const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) - : _STLP_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), __a) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__f, __l, _Integral()); - } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - basic_string(_InputIterator __f, _InputIterator __l) - : _STLP_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), allocator_type()) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_dispatch(__f, __l, _Integral()); - } -# endif -#endif /* !__MRC__ || (__SC__ && !__DMC__) */ - - _Self& operator=(const _Self& __s) { - _Base::operator=(__s); - return *this; - } - - _Self& operator=(const _CharT* __s) { - _Base::operator=(__s); - return *this; - } - - _Self& operator=(_CharT __c) { - _Base::operator=(__c); - return *this; - } - -private: - template - void _M_range_initialize(_InputIter __f, _InputIter __l, - const input_iterator_tag &__tag) { - this->_M_allocate_block(); - this->_M_construct_null(this->_M_Finish()); - _STLP_TRY { - _M_appendT(__f, __l, __tag); - } - _STLP_UNWIND(this->_M_destroy_range()) - } - - template - void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, - const forward_iterator_tag &) { - difference_type __n = distance(__f, __l); - this->_M_allocate_block(__n + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _M_copyT(__f, __l, this->_M_Start()); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); - this->_M_terminate_string(); - } - - template - void _M_range_initializeT(_InputIter __f, _InputIter __l) { - _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - } - - template - void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { - this->_M_allocate_block(__n + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) { - _Traits::assign(this->_M_Start(), __n, __x); - this->_M_finish = this->_M_Start() + __n; - } - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x); - this->_M_terminate_string(); - } - - template - void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { - _M_range_initializeT(__f, __l); - } - -public: // Append, operator+=, push_back. - _Self& operator+=(const _Self& __s) { - _Base::operator+=(__s); - return *this; - } - _Self& operator+=(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::operator+=(__s); - return *this; - } - _Self& operator+=(_CharT __c) { - _Base::operator+=(__c); - return *this; - } - - _Self& append(const _Self& __s) { - _Base::append(__s); - return *this; - } - - _Self& append(const _Self& __s, - size_type __pos, size_type __n) { - _Base::append(__s, __pos, __n); - return *this; - } - - _Self& append(const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::append(__s, __n); - return *this; - } - _Self& append(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::append(__s); - return *this; - } - _Self& append(size_type __n, _CharT __c) { - _Base::append(__n, __c); - return *this; - } - - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - _Self& append(_InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_append_dispatch(__first, __last, _Integral()); - } - -#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - //See equivalent assign method remark. - _Self& append(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) - _Base::append(__f, __l); - return *this; - } -#endif - -private: // Helper functions for append. - - template - _Self& _M_appendT(_InputIter __first, _InputIter __last, - const input_iterator_tag &) { - for ( ; __first != __last ; ++__first) - _Base::push_back(*__first); - return *this; - } - - template - _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last, - const forward_iterator_tag &) { - if (__first != __last) { - const size_type __old_size = this->size(); - difference_type __n = distance(__first, __last); - if (__STATIC_CAST(size_type,__n) > max_size() || __old_size > max_size() - __STATIC_CAST(size_type,__n)) - this->_M_throw_length_error(); - if (__old_size + __n > capacity()) { - const size_type __len = __old_size + - (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - _M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - else { - _ForwardIter __f1 = __first; - ++__f1; -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copyT(__f1, __last, this->_M_Finish() + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__f1, __last, this->_M_Finish() + 1); - _STLP_TRY { - this->_M_construct_null(this->_M_Finish() + __n); - } - _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n)) - _Traits::assign(*this->_M_finish, *__first); - this->_M_finish += __n; - } - } - return *this; - } - - template - _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/) { - return append((size_type) __n, (_CharT) __x); - } - - template - _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/) { - return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - } - -public: // Assign - - _Self& assign(const _Self& __s) { - _Base::assign(__s); - return *this; - } - - _Self& assign(const _Self& __s, - size_type __pos, size_type __n) { - _Base::assign(__s, __pos, __n); - return *this; - } - - _Self& assign(const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::assign(__s, __n); - return *this; - } - - _Self& assign(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::assign(__s); - return *this; - } - - _Self& assign(size_type __n, _CharT __c) { - _Base::assign(__n, __c); - return *this; - } - -private: // Helper functions for assign. - - template - _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { - return assign((size_type) __n, (_CharT) __x); - } - - template - _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { - pointer __cur = this->_M_Start(); - while (__f != __l && __cur != this->_M_Finish()) { - _Traits::assign(*__cur, *__f); - ++__f; - ++__cur; - } - if (__f == __l) - _Base::erase(__cur, this->_M_Finish()); - else - _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - return *this; - } - -public: - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - _Self& assign(_InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_assign_dispatch(__first, __last, _Integral()); - } - -#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - /* This method is not part of the standard and is a specialization of the - * template method assign. It is only granted for convenience to call assign - * with mixed parameters iterator and const_iterator. - */ - _Self& assign(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) - _Base::assign(__f, __l); - return *this; - } -#endif - -public: // Insert - - _Self& insert(size_type __pos, const _Self& __s) { - _Base::insert(__pos, __s); - return *this; - } - - _Self& insert(size_type __pos, const _Self& __s, - size_type __beg, size_type __n) { - _Base::insert(__pos, __s, __beg, __n); - return *this; - } - _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::insert(__pos, __s, __n); - return *this; - } - - _Self& insert(size_type __pos, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::insert(__pos, __s); - return *this; - } - - _Self& insert(size_type __pos, size_type __n, _CharT __c) { - _Base::insert(__pos, __n, __c); - return *this; - } - - iterator insert(iterator __p, _CharT __c) { - return _Base::insert(__p, __c); - } - - void insert(iterator __p, size_t __n, _CharT __c) { - _Base::insert(__p, __n, __c); - } - - // Check to see if _InputIterator is an integer type. If so, then - // it can't be an iterator. - template - void insert(iterator __p, _InputIter __first, _InputIter __last) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - _M_insert_dispatch(__p, __first, __last, _Integral()); - } - -private: // Helper functions for insert. - - void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) { - _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) - _Base::_M_insert(__p, __f, __l, __self_ref); - } - - template - void _M_insert_overflow(iterator __position, _ForwardIter __first, _ForwardIter __last, - difference_type __n) { - const size_type __old_size = this->size(); - const size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1; - pointer __new_start = this->_M_end_of_storage.allocate(__len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = uninitialized_copy(this->_M_Start(), __position, __new_start); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - __new_finish = uninitialized_copy(__position, this->_M_Finish(), __new_finish); - this->_M_construct_null(__new_finish); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - this->_M_destroy_range(); - this->_M_deallocate_block(); - this->_M_reset(__new_start, __new_finish, __new_start + __len); - } - - template - void _M_insertT(iterator __p, _InputIter __first, _InputIter __last, - const input_iterator_tag &) { - for ( ; __first != __last; ++__first) { - __p = insert(__p, *__first); - ++__p; - } - } - - template - void _M_insertT(iterator __position, _ForwardIter __first, _ForwardIter __last, - const forward_iterator_tag &) { - if (__first != __last) { - difference_type __n = distance(__first, __last); - if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) { - const difference_type __elems_after = this->_M_finish - __position; - if (__elems_after >= __n) { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _Base::_M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); - this->_M_finish += __n; - _Traits::move(__position + __n, __position, (__elems_after - __n) + 1); - _M_copyT(__first, __last, __position); - } - else { - pointer __old_finish = this->_M_Finish(); - _ForwardIter __mid = __first; - advance(__mid, __elems_after + 1); -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _M_copyT(__mid, __last, this->_M_Finish() + 1); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__mid, __last, this->_M_Finish() + 1); - this->_M_finish += __n - __elems_after; - _STLP_TRY { -#if defined (_STLP_USE_SHORT_STRING_OPTIM) - if (this->_M_using_static_buf()) - _Base::_M_copy(__position, __old_finish + 1, this->_M_Finish()); - else -#endif /* _STLP_USE_SHORT_STRING_OPTIM */ - uninitialized_copy(__position, __old_finish + 1, this->_M_Finish()); - this->_M_finish += __elems_after; - } - _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()), - this->_M_finish = __old_finish)) - _M_copyT(__first, __mid, __position); - } - } - else { - _M_insert_overflow(__position, __first, __last, __n); - } - } - } - - template - void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, - const __true_type& /*Integral*/) { - insert(__p, (size_type) __n, (_CharT) __x); - } - - template - void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last, - const __false_type& /*Integral*/) { - _STLP_FIX_LITERAL_BUG(__p) - /* - * Within the basic_string implementation we are only going to check for - * self referencing if iterators are string iterators or _CharT pointers. - * A user could encapsulate those iterator within their own iterator interface - * and in this case lead to a bad behavior, this is a known limitation. - */ - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside; - _M_insert_aux(__p, __first, __last, _CheckInside()); - } - - template - void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last, - const __true_type& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__p) - _M_insert(__p, &(*__first), &(*__last), _Base::_M_inside(&(*__first))); - } - - template - void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last, - const __false_type& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__p) - _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); - } - - template - void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) { - _STLP_FIX_LITERAL_BUG(__p) - for ( ; __first != __last; ++__first, ++__result) - _Traits::assign(*__result, *__first); - } - -#if !defined (_STLP_NO_METHOD_SPECIALIZATION) - void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res) - _Base::_M_copy(__f, __l, __res); - } -#endif - -public: // Erase. - - _Self& erase(size_type __pos = 0, size_type __n = npos) { - _Base::erase(__pos, __n); - return *this; - } - - iterator erase(iterator __pos) { - _STLP_FIX_LITERAL_BUG(__pos) - return _Base::erase(__pos); - } - - iterator erase(iterator __first, iterator __last) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return _Base::erase(__first, __last); - } - -public: // Replace. (Conceptually equivalent - // to erase followed by insert.) - _Self& replace(size_type __pos, size_type __n, const _Self& __s) { - _Base::replace(__pos, __n, __s); - return *this; - } - - _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, - size_type __pos2, size_type __n2) { - _Base::replace(__pos1, __n1, __s, __pos2, __n2); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, - const _CharT* __s, size_type __n2) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::replace(__pos, __n1, __s, __n2); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _Base::replace(__pos, __n1, __s); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, - size_type __n2, _CharT __c) { - _Base::replace(__pos, __n1, __n2, __c); - return *this; - } - - _Self& replace(iterator __first, iterator __last, const _Self& __s) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _Base::replace(__first, __last, __s); - return *this; - } - - _Self& replace(iterator __first, iterator __last, - const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__s) - _Base::replace(__first, __last, __s, __n); - return *this; - } - - _Self& replace(iterator __first, iterator __last, - const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__s) - _Base::replace(__first, __last, __s); - return *this; - } - - _Self& replace(iterator __first, iterator __last, - size_type __n, _CharT __c) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _Base::replace(__first, __last, __n, __c); - return *this; - } - - // Check to see if _InputIter is an integer type. If so, then - // it can't be an iterator. - template - _Self& replace(iterator __first, iterator __last, - _InputIter __f, _InputIter __l) { - _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - return _M_replace_dispatch(__first, __last, __f, __l, _Integral()); - } - -#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - _Self& replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _Base::replace(__first, __last, __f, __l); - return *this; - } -#endif - -protected: // Helper functions for replace. - _Self& _M_replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l, bool __self_ref) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _Base::_M_replace(__first, __last, __f, __l, __self_ref); - return *this; - } - - template - _Self& _M_replace_dispatch(iterator __first, iterator __last, - _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return replace(__first, __last, (size_type) __n, (_CharT) __x); - } - - template - _Self& _M_replace_dispatch(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside; - return _M_replace_aux(__first, __last, __f, __l, _CheckInside()); - } - - template - _Self& _M_replace_aux(iterator __first, iterator __last, - _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return _M_replace(__first, __last, &(*__f), &(*__l), _Base::_M_inside(&(*__f))); - } - - template - _Self& _M_replace_aux(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); - } - - template - _Self& _M_replaceT(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - for ( ; __first != __last && __f != __l; ++__first, ++__f) - _Traits::assign(*__first, *__f); - if (__f == __l) - _Base::erase(__first, __last); - else - _M_insertT(__last, __f, __l, __ite_tag); - return *this; - } - - template - _Self& _M_replaceT(iterator __first, iterator __last, - _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - difference_type __n = distance(__f, __l); - const difference_type __len = __last - __first; - if (__len >= __n) { - _M_copyT(__f, __l, __first); - _Base::erase(__first + __n, __last); - } - else { - _ForwardIter __m = __f; - advance(__m, __len); - _M_copyT(__f, __m, __first); - _M_insertT(__last, __m, __l, __ite_tag); - } - return *this; - } - -public: // Other modifier member functions. - - void swap(_Self& __s) - { _Base::swap(__s); } - -public: // Substring. - - _Self substr(size_type __pos = 0, size_type __n = npos) const - { return _Self(*this, __pos, __n, get_allocator()); } - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) -# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE -# include -# undef _STLP_STRING_SUM_BASE -#endif -}; - -#undef _STLP_NO_MEM_T_STRING_BASE - -#if defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -# undef basic_string -#endif - -_STLP_END_NAMESPACE diff --git a/SDK/stlport/stl/_strstream.h b/SDK/stlport/stl/_strstream.h deleted file mode 100644 index 5e3d4c37..00000000 --- a/SDK/stlport/stl/_strstream.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_STRSTREAM -#define _STLP_INTERNAL_STRSTREAM - -#ifndef _STLP_INTERNAL_STREAMBUF -# include -#endif - -#ifndef _STLP_INTERNAL_ISTREAM -# include // Includes , , -#endif - -#ifndef _STLP_INTERNAL_STRING_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#ifndef _STLP_USE_NAMESPACES -# define strstream _STLP_strstream -# define ostrstream _STLP_ostrstream -# define istrstream _STLP_istrstream -# define strstreambuf _STLP_strstreambuf -#endif - -//---------------------------------------------------------------------- -// Class strstreambuf, a streambuf class that manages an array of char. -// Note that this class is not a template. - -class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf > { -public: // Types. - typedef char_traits _Traits; - typedef basic_streambuf > _Base; - typedef void* (*__alloc_fn)(size_t); - typedef void (*__free_fn)(void*); -public: // Constructor, destructor - - explicit strstreambuf(streamsize _Initial_capacity = 0); - - strstreambuf(__alloc_fn, __free_fn); - - strstreambuf(char* __get, streamsize __n, char* __put = 0); - strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0); - strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0); - - strstreambuf(const char* __get, streamsize __n); - strstreambuf(const signed char* __get, streamsize __n); - strstreambuf(const unsigned char* __get, streamsize __n); - - virtual ~strstreambuf(); - -public: // strstreambuf operations. - void freeze(bool = true); - char* str(); - int pcount() const; - -protected: // Overridden virtual member functions. - virtual int_type overflow(int_type __c = _Traits::eof()); - virtual int_type pbackfail(int_type __c = _Traits::eof()); - virtual int_type underflow(); - virtual _Base* setbuf(char* __buf, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, - ios_base::openmode __mode - = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode - = ios_base::in | ios_base::out); - -private: // Helper functions. - // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. - char* _M_alloc(size_t); - void _M_free(char*); - - // Helper function used in constructors. - void _M_setup(char* __get, char* __put, streamsize __n); -private: // Data members. - __alloc_fn _M_alloc_fun; - __free_fn _M_free_fun; - bool _M_dynamic : 1; - bool _M_frozen : 1; - bool _M_constant : 1; -}; - -//---------------------------------------------------------------------- -// Class istrstream, an istream that manages a strstreambuf. - -class _STLP_CLASS_DECLSPEC istrstream : public basic_istream > { -public: - explicit istrstream(char*); - explicit istrstream(const char*); - istrstream(char* , streamsize); - istrstream(const char*, streamsize); - virtual ~istrstream(); - - strstreambuf* rdbuf() const; - char* str(); - -private: - strstreambuf _M_buf; -}; - -//---------------------------------------------------------------------- -// Class ostrstream - -class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream > -{ -public: - ostrstream(); - ostrstream(char*, int, ios_base::openmode = ios_base::out); - virtual ~ostrstream(); - - strstreambuf* rdbuf() const; - void freeze(bool = true); - char* str(); - int pcount() const; - -private: - strstreambuf _M_buf; -}; - -//---------------------------------------------------------------------- -// Class strstream - -class _STLP_CLASS_DECLSPEC strstream : public basic_iostream > { -public: - typedef char char_type; - typedef char_traits::int_type int_type; - typedef char_traits::pos_type pos_type; - typedef char_traits::off_type off_type; - - strstream(); - strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); - virtual ~strstream(); - - strstreambuf* rdbuf() const; - void freeze(bool = true); - int pcount() const; - char* str(); - -private: - strstreambuf _M_buf; - - //explicitely defined as private to avoid warnings: - strstream(strstream const&); - strstream& operator = (strstream const&); -}; - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_STRSTREAM */ diff --git a/SDK/stlport/stl/_tempbuf.c b/SDK/stlport/stl/_tempbuf.c deleted file mode 100644 index 179b4725..00000000 --- a/SDK/stlport/stl/_tempbuf.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_TEMPBUF_C -#define _STLP_TEMPBUF_C - -#ifndef _STLP_INTERNAL_TEMPBUF_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -pair<_Tp*, ptrdiff_t> _STLP_CALL -__get_temporary_buffer(ptrdiff_t __len, _Tp*) -{ - if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp))) - __len = INT_MAX / sizeof(_Tp); - - while (__len > 0) { - _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp)); - if (__tmp != 0) - return pair<_Tp*, ptrdiff_t>(__tmp, __len); - __len /= 2; - } - - return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0); -} -_STLP_END_NAMESPACE - -#endif /* _STLP_TEMPBUF_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_tempbuf.h b/SDK/stlport/stl/_tempbuf.h deleted file mode 100644 index b50e6d43..00000000 --- a/SDK/stlport/stl/_tempbuf.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_TEMPBUF_H -#define _STLP_INTERNAL_TEMPBUF_H - -#ifndef _STLP_CLIMITS -# include -#endif - -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -pair<_Tp*, ptrdiff_t> _STLP_CALL -__get_temporary_buffer(ptrdiff_t __len, _Tp*); - -#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS - -template -inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) { - return __get_temporary_buffer(__len, (_Tp*) 0); -} - -# if ! defined(_STLP_NO_EXTENSIONS) -// This overload is not required by the standard; it is an extension. -// It is supported for backward compatibility with the HP STL, and -// because not all compilers support the language feature (explicit -// function template arguments) that is required for the standard -// version of get_temporary_buffer. -template -inline pair<_Tp*, ptrdiff_t> _STLP_CALL -get_temporary_buffer(ptrdiff_t __len, _Tp*) { - return __get_temporary_buffer(__len, (_Tp*) 0); -} -# endif -#endif - -template -inline void _STLP_CALL return_temporary_buffer(_Tp* __p) { -// SunPro brain damage - free((char*)__p); -} - -template -class _Temporary_buffer { -private: - ptrdiff_t _M_original_len; - ptrdiff_t _M_len; - _Tp* _M_buffer; - - void _M_allocate_buffer() { - _M_original_len = _M_len; - _M_buffer = 0; - - if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp))) - _M_len = INT_MAX / sizeof(_Tp); - - while (_M_len > 0) { - _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp)); - if (_M_buffer) - break; - _M_len /= 2; - } - } - - void _M_initialize_buffer(const _Tp&, const __true_type&) {} - void _M_initialize_buffer(const _Tp& val, const __false_type&) { - uninitialized_fill_n(_M_buffer, _M_len, val); - } - -public: - ptrdiff_t size() const { return _M_len; } - ptrdiff_t requested_size() const { return _M_original_len; } - _Tp* begin() { return _M_buffer; } - _Tp* end() { return _M_buffer + _M_len; } - - _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) { - // Workaround for a __type_traits bug in the pre-7.3 compiler. -# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730 - typedef typename __type_traits<_Tp>::is_POD_type _Trivial; -# else - typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial; -# endif - _STLP_TRY { - _M_len = distance(__first, __last); - _M_allocate_buffer(); - if (_M_len > 0) - _M_initialize_buffer(*__first, _Trivial()); - } - _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0) - } - - ~_Temporary_buffer() { - _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len); - free(_M_buffer); - } - -private: - // Disable copy constructor and assignment operator. - _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {} - void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {} -}; - -# ifndef _STLP_NO_EXTENSIONS - -// Class temporary_buffer is not part of the standard. It is an extension. - -template ::value_type -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - > -struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> -{ - temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) - : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {} - ~temporary_buffer() {} -}; - -# endif /* _STLP_NO_EXTENSIONS */ - -_STLP_END_NAMESPACE - -# ifndef _STLP_LINK_TIME_INSTANTIATION -# include -# endif - -#endif /* _STLP_INTERNAL_TEMPBUF_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_threads.c b/SDK/stlport/stl/_threads.c deleted file mode 100644 index 40641e84..00000000 --- a/SDK/stlport/stl/_threads.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_THREADS_C -#define _STLP_THREADS_C - -#ifndef _STLP_INTERNAL_THREADS_H -# include -#endif - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) - -#if defined (_STLP_SGI_THREADS) -# include -#elif defined (_STLP_UNIX) -# ifndef _STLP_INTERNAL_CTIME -# include -# endif -# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD) -using _STLP_VENDOR_CSTD::time_t; -# endif -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if (_STLP_STATIC_TEMPLATE_DATA > 0) - -# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX) -template -_STLP_STATIC_MUTEX -_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER; -# undef _STLP_USE_ATOMIC_SWAP_MUTEX -# endif - -# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) -template -unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max; - -template -unsigned _STLP_mutex_spin<__inst>::__last = 0; -# endif // _STLP_USE_PTHREAD_SPINLOCK - -#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX) -__DECLARE_INSTANCE(_STLP_STATIC_MUTEX, _Atomic_swap_struct::_S_swap_lock, - _STLP_MUTEX_INITIALIZER ); -# undef _STLP_USE_ATOMIC_SWAP_MUTEX -# endif /* _STLP_PTHREADS */ - -# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) -__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__max, =30); -__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__last, =0); -# endif // _STLP_USE_PTHREAD_SPINLOCK - -#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) - -# if defined (_STLP_SPARC_SOLARIS_THREADS) -// underground function in libc.so; we do not want dependance on librt -extern "C" int __nanosleep(const struct timespec*, struct timespec*); -# define _STLP_NANOSLEEP __nanosleep -# else -# define _STLP_NANOSLEEP nanosleep -# endif - -template -void _STLP_CALL -_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec) { -# if defined (_STLP_WIN32THREADS) - if (__log_nsec <= 20) { - // Note from boost (www.boost.org): - // Changed to Sleep(1) from Sleep(0). - // According to MSDN, Sleep(0) will never yield - // to a lower-priority thread, whereas Sleep(1) - // will. Performance seems not to be affected. - Sleep(1); - } else { - Sleep(1 << (__log_nsec - 20)); - } -# elif defined(_STLP_OS2THREADS) - if (__log_nsec <= 20) { - DosSleep(0); - } else { - DosSleep(1 << (__log_nsec - 20)); - } -# elif defined (_STLP_UNIX) - timespec __ts; - /* Max sleep is 2**27nsec ~ 60msec */ - __ts.tv_sec = 0; - __ts.tv_nsec = 1 << __log_nsec; - _STLP_NANOSLEEP(&__ts, 0); -# endif -} - -template -void _STLP_CALL -_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) { -# if defined(_STLP_ATOMIC_EXCHANGE) - if (_Atomic_swap(__lock, 1)) { - unsigned __my_spin_max = _STLP_mutex_spin<0>::__max; - unsigned __my_last_spins = _STLP_mutex_spin<0>::__last; - volatile unsigned __junk = 17; // Value doesn't matter. - unsigned __i; - - for (__i = 0; __i < __my_spin_max; ++__i) { - if (__i < __my_last_spins/2 || *__lock) { - __junk *= __junk; __junk *= __junk; - __junk *= __junk; __junk *= __junk; - } else { - if (!_Atomic_swap(__lock, 1)) { - // got it! - // Spinning worked. Thus we're probably not being scheduled - // against the other process with which we were contending. - // Thus it makes sense to spin longer the next time. - _STLP_mutex_spin<0>::__last = __i; - _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max; - return; - } - } - } - - // We are probably being scheduled against the other process. Sleep. - _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max; - - for (__i = 0 ;; ++__i) { - int __log_nsec = __i + 6; - - if (__log_nsec > 27) __log_nsec = 27; - if (!_Atomic_swap(__lock, 1)) { - break; - } - _S_nsec_sleep(__log_nsec); - } - } /* first _Atomic_swap */ -# endif -} -#endif // _STLP_USE_PTHREAD_SPINLOCK - -_STLP_END_NAMESPACE - -#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ -#endif /* _STLP_THREADS_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_threads.h b/SDK/stlport/stl/_threads.h deleted file mode 100644 index ca96ca25..00000000 --- a/SDK/stlport/stl/_threads.h +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_THREADS_H -#define _STLP_INTERNAL_THREADS_H - -// Supported threading models are native SGI, pthreads, uithreads -// (similar to pthreads, but based on an earlier draft of the Posix -// threads standard), and Win32 threads. Uithread support by Jochen -// Schlick, 1999, and Solaris threads generalized to them. - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -#ifndef _STLP_INTERNAL_CSTDLIB -# include -#endif - -// On SUN and Mac OS X gcc, zero-initialization works just fine... -#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__)) -# define _STLP_MUTEX_INITIALIZER -#endif - -/* This header defines the following atomic operation that platform should - * try to support as much as possible. Atomic operation are exposed as macro - * in order to easily test for their existance. They are: - * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) : - * increment *__ptr by 1 and returns the new value - * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) : - * decrement *__ptr by 1 and returns the new value - * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) : - * assign __val to *__target and returns former *__target value - * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) : - * assign __ptr to *__target and returns former *__target value - * __stl_atomic_t _STLP_ATOMIC_ADD(volatile __stl_atomic_t* __target, __stl_atomic_t __val) : - * does *__target = *__target + __val and returns the old *__target value - */ - -#if defined (_STLP_WIN32) || defined (__sgi) || defined (_STLP_SPARC_SOLARIS_THREADS) -typedef long __stl_atomic_t; -#else -/* Don't import whole namespace!!!! - ptr */ -// # if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) -// // using _STLP_VENDOR_CSTD::size_t; -// using namespace _STLP_VENDOR_CSTD; -// # endif -typedef size_t __stl_atomic_t; -#endif - -#if defined (_STLP_THREADS) - -# if defined (_STLP_SGI_THREADS) - -# include -// Hack for SGI o32 compilers. -# if !defined(__add_and_fetch) && \ - (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64))) -# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v) -# define __test_and_set(__l,__v) test_and_set(__l,__v) -# endif /* o32 */ - -# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) -# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q) -# else -# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q) -# endif - -# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1) -# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1) - -# elif defined (_STLP_PTHREADS) - -# include -# if !defined (_STLP_USE_PTHREAD_SPINLOCK) -# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT) -# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER } -# endif -//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl -# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_) -# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default -# else -# define _STLP_PTHREAD_ATTR_DEFAULT 0 -# endif -# else // _STLP_USE_PTHREAD_SPINLOCK -# if defined (__OpenBSD__) -# include -# endif -# endif // _STLP_USE_PTHREAD_SPINLOCK - -# if defined (__GNUC__) && defined (__i386__) - -# if !defined (_STLP_ATOMIC_INCREMENT) -inline long _STLP_atomic_increment_gcc_x86(long volatile* p) { - long result; - __asm__ __volatile__ - ("lock; xaddl %1, %0;" - :"=m" (*p), "=r" (result) - :"m" (*p), "1" (1) - :"cc"); - return result + 1; -} -# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x)) -# endif - -# if !defined (_STLP_ATOMIC_DECREMENT) -inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) { - long result; - __asm__ __volatile__ - ("lock; xaddl %1, %0;" - :"=m" (*p), "=r" (result) - :"m" (*p), "1" (-1) - :"cc"); - return result - 1; -} -# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x)) -# endif - -# if !defined (_STLP_ATOMIC_ADD) -inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) { - long result; - __asm__ __volatile__ - ("lock; xaddl %1, %0;" - :"=m" (*p), "=r" (result) - :"m" (*p), "1" (addend) - :"cc"); - return result + addend; -} -# define _STLP_ATOMIC_ADD(__dst, __val) (_STLP_atomic_add_gcc_x86((long volatile*)__dst, (long)__val)) -# endif - -# endif /* if defined(__GNUC__) && defined(__i386__) */ - -# elif defined (_STLP_WIN32THREADS) - -# if !defined (_STLP_ATOMIC_INCREMENT) -# if !defined (_STLP_NEW_PLATFORM_SDK) -# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x)) -# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x)) -# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y) -# else -# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x) -# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x) -# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y) -# endif -# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y) -/* - * The following functionnality is only available since Windows 98, those that are targeting previous OSes - * should define _WIN32_WINDOWS to a value lower that the one of Win 98, see Platform SDK documentation for - * more informations: - */ -# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (_STLP_WIN32_VERSION) || (_STLP_WIN32_VERSION >= 0x0410)) -# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val) -# endif -# endif - -# elif defined (__DECC) || defined (__DECCXX) - -# include -# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG -# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1) -# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1) - -# elif defined(_STLP_SPARC_SOLARIS_THREADS) - -# include - -# elif defined (_STLP_UITHREADS) - -// this inclusion is potential hazard to bring up all sorts -// of old-style headers. Let's assume vendor already know how -// to deal with that. -# ifndef _STLP_INTERNAL_CTIME -# include -# endif -# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) -using _STLP_VENDOR_CSTD::time_t; -# endif -# include -# include -# include - -# elif defined (_STLP_BETHREADS) - -# include -# include -# include -# define _STLP_MUTEX_INITIALIZER = { 0 } - -# elif defined (_STLP_NWTHREADS) - -# include -# include - -# elif defined(_STLP_OS2THREADS) - -# if defined (__GNUC__) -# define INCL_DOSSEMAPHORES -# include -# else -// This section serves to replace os2.h for VisualAge C++ - typedef unsigned long ULONG; -# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */ -# define __HEV__ - typedef ULONG HEV; - typedef HEV* PHEV; -# endif - typedef ULONG APIRET; - typedef ULONG HMTX; - typedef HMTX* PHMTX; - typedef const char* PCSZ; - typedef ULONG BOOL32; - APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState); - APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout); - APIRET _System DosReleaseMutexSem(HMTX hmtx); - APIRET _System DosCloseMutexSem(HMTX hmtx); -# define _STLP_MUTEX_INITIALIZER = { 0 } -# endif /* GNUC */ - -# endif - -#else -/* no threads */ -# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x) -# define _STLP_ATOMIC_DECREMENT(__x) --(*__x) -/* We do not grant other atomic operations as they are useless if STLport do not have - * to be thread safe - */ -#endif - -#if !defined (_STLP_MUTEX_INITIALIZER) -# if defined(_STLP_ATOMIC_EXCHANGE) -# define _STLP_MUTEX_INITIALIZER = { 0 } -# elif defined(_STLP_UITHREADS) -# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX } -# else -# define _STLP_MUTEX_INITIALIZER -# endif -#endif - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) -// Helper struct. This is a workaround for various compilers that don't -// handle static variables in inline functions properly. -template -struct _STLP_mutex_spin { - enum { __low_max = 30, __high_max = 1000 }; - // Low if we suspect uniprocessor, high for multiprocessor. - static unsigned __max; - static unsigned __last; - static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock); - static void _STLP_CALL _S_nsec_sleep(int __log_nsec); -}; -#endif // !_STLP_USE_PTHREAD_SPINLOCK - -// Locking class. Note that this class *does not have a constructor*. -// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER, -// or dynamically, by explicitly calling the _M_initialize member function. -// (This is similar to the ways that a pthreads mutex can be initialized.) -// There are explicit member functions for acquiring and releasing the lock. - -// There is no constructor because static initialization is essential for -// some uses, and only a class aggregate (see section 8.5.1 of the C++ -// standard) can be initialized that way. That means we must have no -// constructors, no base classes, no virtual functions, and no private or -// protected members. - -// For non-static cases, clients should use _STLP_mutex. - -struct _STLP_CLASS_DECLSPEC _STLP_mutex_base { -#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS) - // It should be relatively easy to get this to work on any modern Unix. - volatile __stl_atomic_t _M_lock; -#endif - -#if defined (_STLP_THREADS) -# if defined (_STLP_ATOMIC_EXCHANGE) - inline void _M_initialize() { _M_lock = 0; } - inline void _M_destroy() {} - - void _M_acquire_lock() { - _STLP_mutex_spin<0>::_M_do_lock(&_M_lock); - } - - inline void _M_release_lock() { - volatile __stl_atomic_t* __lock = &_M_lock; -# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3 - asm("sync"); - *__lock = 0; -# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \ - (defined (_ABIN32) || defined(_ABI64)) - __lock_release(__lock); -# elif defined (_STLP_SPARC_SOLARIS_THREADS) -# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus) - asm("membar #StoreStore ; membar #LoadStore"); -# else - asm(" stbar "); -# endif - *__lock = 0; -# else - *__lock = 0; - // This is not sufficient on many multiprocessors, since - // writes to protected variables and the lock may be reordered. -# endif - } -# elif defined (_STLP_PTHREADS) -# if defined (_STLP_USE_PTHREAD_SPINLOCK) -# if !defined (__OpenBSD__) - pthread_spinlock_t _M_lock; - inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); } - inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); } - - // sorry, but no static initializer for pthread_spinlock_t; - // this will not work for compilers that has problems with call - // constructor of static object... - - // _STLP_mutex_base() - // { pthread_spin_init( &_M_lock, 0 ); } - - // ~_STLP_mutex_base() - // { pthread_spin_destroy( &_M_lock ); } - - inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); } - inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); } -# else // __OpenBSD__ - spinlock_t _M_lock; - inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); } - inline void _M_destroy() { } - inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); } - inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); } -# endif // __OpenBSD__ -# else // !_STLP_USE_PTHREAD_SPINLOCK - pthread_mutex_t _M_lock; - inline void _M_initialize() - { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); } - inline void _M_destroy() - { pthread_mutex_destroy(&_M_lock); } - inline void _M_acquire_lock() { -# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER) - if (!_M_lock.field1) _M_initialize(); -# endif - pthread_mutex_lock(&_M_lock); - } - inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); } -# endif // !_STLP_USE_PTHREAD_SPINLOCK - -# elif defined (_STLP_UITHREADS) - mutex_t _M_lock; - inline void _M_initialize() - { mutex_init(&_M_lock, 0, NULL); } - inline void _M_destroy() - { mutex_destroy(&_M_lock); } - inline void _M_acquire_lock() { mutex_lock(&_M_lock); } - inline void _M_release_lock() { mutex_unlock(&_M_lock); } - -# elif defined (_STLP_OS2THREADS) - HMTX _M_lock; - inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); } - inline void _M_destroy() { DosCloseMutexSem(_M_lock); } - inline void _M_acquire_lock() { - if (!_M_lock) _M_initialize(); - DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT); - } - inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); } -# elif defined (_STLP_BETHREADS) - sem_id sem; - inline void _M_initialize() { - sem = create_sem(1, "STLPort"); - assert(sem > 0); - } - inline void _M_destroy() { - int t = delete_sem(sem); - assert(t == B_NO_ERROR); - } - inline void _M_acquire_lock(); - inline void _M_release_lock() { - status_t t = release_sem(sem); - assert(t == B_NO_ERROR); - } -# elif defined (_STLP_NWTHREADS) - LONG _M_lock; - inline void _M_initialize() - { _M_lock = OpenLocalSemaphore(1); } - inline void _M_destroy() - { CloseLocalSemaphore(_M_lock); } - inline void _M_acquire_lock() - { WaitOnLocalSemaphore(_M_lock); } - inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); } -# else //*ty 11/24/2001 - added configuration check -# error "Unknown thread facility configuration" -# endif -#else /* No threads */ - inline void _M_initialize() {} - inline void _M_destroy() {} - inline void _M_acquire_lock() {} - inline void _M_release_lock() {} -#endif // _STLP_PTHREADS -}; - -// Locking class. The constructor initializes the lock, the destructor destroys it. -// Well - behaving class, does not need static initializer - -class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base { - public: - inline _STLP_mutex () { _M_initialize(); } - inline ~_STLP_mutex () { _M_destroy(); } - private: - _STLP_mutex(const _STLP_mutex&); - void operator=(const _STLP_mutex&); -}; - -// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes -// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor -// releases the lock. -// It's not clear that this is exactly the right functionality. -// It will probably change in the future. - -struct _STLP_CLASS_DECLSPEC _STLP_auto_lock { - _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock) - { _M_lock._M_acquire_lock(); } - ~_STLP_auto_lock() - { _M_lock._M_release_lock(); } - -private: - _STLP_STATIC_MUTEX& _M_lock; - void operator=(const _STLP_auto_lock&); - _STLP_auto_lock(const _STLP_auto_lock&); -}; - -/* - * Class _Refcount_Base provides a type, __stl_atomic_t, a data member, - * _M_ref_count, and member functions _M_incr and _M_decr, which perform - * atomic preincrement/predecrement. The constructor initializes - * _M_ref_count. - */ -class _STLP_CLASS_DECLSPEC _Refcount_Base { - // The data member _M_ref_count -#if defined (__DMC__) -public: -#endif - _STLP_VOLATILE __stl_atomic_t _M_ref_count; - -#if defined (_STLP_THREADS) && \ - (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \ - (defined (_STLP_WIN32_VERSION) && (_STLP_WIN32_VERSION <= 0x0400))) -# define _STLP_USE_MUTEX - _STLP_mutex _M_mutex; -#endif - - public: - // Constructor - _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {} - - // _M_incr and _M_decr -#if defined (_STLP_THREADS) -# if !defined (_STLP_USE_MUTEX) - __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); } - __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); } -# else -# undef _STLP_USE_MUTEX - __stl_atomic_t _M_incr() { - _STLP_auto_lock l(_M_mutex); - return ++_M_ref_count; - } - __stl_atomic_t _M_decr() { - _STLP_auto_lock l(_M_mutex); - return --_M_ref_count; - } -# endif -#else /* No threads */ - __stl_atomic_t _M_incr() { return ++_M_ref_count; } - __stl_atomic_t _M_decr() { return --_M_ref_count; } -#endif -}; - -/* Atomic swap on __stl_atomic_t - * This is guaranteed to behave as though it were atomic only if all - * possibly concurrent updates use _Atomic_swap. - * In some cases the operation is emulated with a lock. - * Idem for _Atomic_swap_ptr - */ -/* Helper struct to handle following cases: - * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic - * exchange can be done on pointers - * - on platform without atomic operation swap is done in a critical section, - * portable but inefficient. - */ -template -class _Atomic_swap_struct { -public: -#if defined (_STLP_THREADS) && \ - !defined (_STLP_ATOMIC_EXCHANGE) && \ - (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \ - defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS)) -# define _STLP_USE_ATOMIC_SWAP_MUTEX - static _STLP_STATIC_MUTEX _S_swap_lock; -#endif - - static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) { -#if defined (_STLP_THREADS) -# if defined (_STLP_ATOMIC_EXCHANGE) - return _STLP_ATOMIC_EXCHANGE(__p, __q); -# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) - _S_swap_lock._M_acquire_lock(); - __stl_atomic_t __result = *__p; - *__p = __q; - _S_swap_lock._M_release_lock(); - return __result; -# else -# error Missing atomic swap implementation -# endif -#else - /* no threads */ - __stl_atomic_t __result = *__p; - *__p = __q; - return __result; -#endif // _STLP_THREADS - } - - static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { -#if defined (_STLP_THREADS) -# if defined (_STLP_ATOMIC_EXCHANGE_PTR) - return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q); -# elif defined (_STLP_ATOMIC_EXCHANGE) - _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*)) - return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p), - __REINTERPRET_CAST(__stl_atomic_t, __q)) - ); -# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) - _S_swap_lock._M_acquire_lock(); - void *__result = *__p; - *__p = __q; - _S_swap_lock._M_release_lock(); - return __result; -# else -# error Missing pointer atomic swap implementation -# endif -#else - /* no thread */ - void *__result = *__p; - *__p = __q; - return __result; -#endif - } -}; - -_STLP_TEMPLATE_NULL -class _Atomic_swap_struct<0> { -public: -#if defined (_STLP_THREADS) && \ - (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \ - (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \ - defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS)) -# define _STLP_USE_ATOMIC_SWAP_MUTEX - static _STLP_STATIC_MUTEX _S_swap_lock; -#endif - - static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) { -#if defined (_STLP_THREADS) -# if defined (_STLP_ATOMIC_EXCHANGE) - return _STLP_ATOMIC_EXCHANGE(__p, __q); -# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) - /* This should be portable, but performance is expected - * to be quite awful. This really needs platform specific - * code. - */ - _S_swap_lock._M_acquire_lock(); - __stl_atomic_t __result = *__p; - *__p = __q; - _S_swap_lock._M_release_lock(); - return __result; -# else -# error Missing atomic swap implementation -# endif -#else - /* no threads */ - __stl_atomic_t __result = *__p; - *__p = __q; - return __result; -#endif // _STLP_THREADS - } - - static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { -#if defined (_STLP_THREADS) -# if defined (_STLP_ATOMIC_EXCHANGE_PTR) - return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q); -# elif defined (_STLP_ATOMIC_EXCHANGE) - _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*)) - return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p), - __REINTERPRET_CAST(__stl_atomic_t, __q)) - ); -# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) - _S_swap_lock._M_acquire_lock(); - void *__result = *__p; - *__p = __q; - _S_swap_lock._M_release_lock(); - return __result; -# else -# error Missing pointer atomic swap implementation -# endif -#else - /* no thread */ - void *__result = *__p; - *__p = __q; - return __result; -#endif - } -}; - -#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300) -# pragma warning (push) -# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used -#endif - -inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) { - const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*); - return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q); -} - -inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { - const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*); - return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q); -} - -#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300) -# pragma warning (pop) -#endif - -#if defined (_STLP_BETHREADS) -template -struct _STLP_beos_static_lock_data { - static bool is_init; - struct mutex_t : public _STLP_mutex { - mutex_t() - { _STLP_beos_static_lock_data<0>::is_init = true; } - ~mutex_t() - { _STLP_beos_static_lock_data<0>::is_init = false; } - }; - static mutex_t mut; -}; - -template -bool _STLP_beos_static_lock_data<__inst>::is_init = false; -template -typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut; - -inline void _STLP_mutex_base::_M_acquire_lock() { - if (sem == 0) { - // we need to initialise on demand here - // to prevent race conditions use our global - // mutex if it's available: - if (_STLP_beos_static_lock_data<0>::is_init) { - _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut); - if (sem == 0) _M_initialize(); - } - else { - // no lock available, we must still be - // in startup code, THERE MUST BE ONE THREAD - // ONLY active at this point. - _M_initialize(); - } - } - status_t t; - t = acquire_sem(sem); - assert(t == B_NO_ERROR); -} -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_THREADS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_time_facets.c b/SDK/stlport/stl/_time_facets.c deleted file mode 100644 index 53f87f98..00000000 --- a/SDK/stlport/stl/_time_facets.c +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_TIME_FACETS_C -#define _STLP_TIME_FACETS_C - -#ifndef _STLP_INTERNAL_TIME_FACETS_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_PUT_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUM_GET_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Declarations of static template members. -#if (_STLP_STATIC_TEMPLATE_DATA > 0) - -# if !defined (__BORLANDC__) -template -locale::id time_get<_CharT, _InputIterator>::id; - -template -locale::id time_put<_CharT, _OutputIterator>::id; -# endif - -# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ - defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) -/* - * Under cygwin, when STLport is used as a shared library, the id needs - * to be specified as imported otherwise they will be duplicated in the - * calling executable. - */ -template <> -_STLP_DECLSPEC locale::id time_get > >::id; -/* -template <> -_STLP_DECLSPEC locale::id time_get::id; -*/ - -template <> -_STLP_DECLSPEC locale::id time_put > >::id; -/* -template <> -_STLP_DECLSPEC locale::id time_put::id; -*/ - -# ifndef _STLP_NO_WCHAR_T -template <> -_STLP_DECLSPEC locale::id time_get > >::id; -/* -template <> -_STLP_DECLSPEC locale::id time_get::id; -*/ - -template <> -_STLP_DECLSPEC locale::id time_put > >::id; -/* -template <> -_STLP_DECLSPEC locale::id time_put::id; -*/ -# endif /* _STLP_NO_WCHAR_T */ -# endif /* __CUGWIN__ && _STLP_USE_DYNAMIC_LIB */ - -#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -//typedef time_get time_get_char; -typedef time_get > > time_get_char_2; -//typedef time_put time_put_char; -typedef time_put > > time_put_char_2; - -//__DECLARE_INSTANCE(locale::id, time_get_char::id, ); -__DECLARE_INSTANCE(locale::id, time_get_char_2::id, ); -//__DECLARE_INSTANCE(locale::id, time_put_char::id, ); -__DECLARE_INSTANCE(locale::id, time_put_char_2::id, ); - -# if !defined (_STLP_NO_WCHAR_T) - -//typedef time_get time_get_wchar_t; -typedef time_get > > time_get_wchar_t_2; -//typedef time_put time_put_wchar_t; -typedef time_put > > time_put_wchar_t_2; - -//__DECLARE_INSTANCE(locale::id, time_get_wchar_t::id, ); -__DECLARE_INSTANCE(locale::id, time_get_wchar_t_2::id, ); -//__DECLARE_INSTANCE(locale::id, time_put_wchar_t::id, ); -__DECLARE_INSTANCE(locale::id, time_put_wchar_t_2::id, ); - -# endif - -#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */ - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -const string* _STLP_CALL -__match(_InIt& __first, _InIt& __last, const string *__name, const string *__name_end, - const ctype<_CharT>& __ct) { - typedef ptrdiff_t difference_type; - difference_type __n = __name_end - __name; - difference_type __i; - size_t __pos = 0; - difference_type __check_count = __n; - bool __do_check[_MAXNAMES]; - const string* __matching_name[_MAX_NAME_LENGTH]; - - for (__i = 0; __i < _MAXNAMES; ++__i) - __do_check[__i] = true; - - for (__i = 0; __i < _MAX_NAME_LENGTH; ++__i) - __matching_name[__i] = __name_end; - - while (__first != __last) { - for (__i = 0; __i < __n; ++__i) { - if (__do_check[__i]) { - if (*__first == __ct.widen(__name[__i][__pos])) { - if (__pos == (__name[__i].size() - 1)) { - __do_check[__i] = 0; - __matching_name[__pos + 1] = __name + __i; - --__check_count; - if (__check_count == 0) { - ++__first; - return __name + __i; - } - } - } - else { - __do_check[__i] = 0; - --__check_count; - if (__check_count == 0) - return __matching_name[__pos]; - } - } - } - - ++__first; ++__pos; - } - - return __matching_name[__pos]; -} - -// __get_formatted_time reads input that is assumed to be formatted -// according to the rules for the C strftime function (C standard, -// 7.12.3.5). This function is used to implement the do_get_time -// and do_get_date virtual functions, which depend on the locale -// specifications for the time and day formats respectively. -// Note the catchall default case, intended mainly for the '%Z' -// format designator, which does not make sense here since the -// representation of timezones is not part of the locale. -// -// The case branches are implemented either by doing a match using -// the appopriate name table or by doing a __get_integer_nogroup. -// -// 'y' format is assumed to mean that the input represents years -// since 1900. That is, 2002 should be represented as 102. There -// is no century-guessing. -// -// The match is successful if and only if the second component of the -// return value is format_end. - -// Note that the antepenultimate parameter is being used only to determine -// the correct overloading for the calls to __get_integer_nogroup. -template -string::const_iterator _STLP_CALL -__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last, - string::const_iterator __format, string::const_iterator __format_end, - _Ch*, const _Time_Info& __table, - const ios_base& __s, ios_base::iostate& __err, tm* __t) { - const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __s._M_ctype_facet()); - while (__first != __last && __format != __format_end) { - if (*__format == '%') { - ++__format; - char __c = *__format; - if (__c == '#') { //MS extension - ++__format; - __c = *__format; - } - - switch (__c) { - case 'a': { - const string* __pr = __match(__first, __last, - __table._M_dayname + 0, __table._M_dayname + 7, - __ct); - if (__pr == __table._M_dayname + 7) - return __format; - __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname); - break; - } - - case 'A': { - const string* __pr = __match(__first, __last, - __table._M_dayname + 7, __table._M_dayname + 14, - __ct); - if (__pr == __table._M_dayname + 14) - return __format; - __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname - 7); - break; - } - - case 'b': { - const string* __pr = __match(__first, __last, - __table._M_monthname + 0, __table._M_monthname + 12, - __ct); - if (__pr == __table._M_monthname + 12) - return __format; - __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname); - break; - } - - case 'B': { - const string* __pr = __match(__first, __last, - __table._M_monthname + 12, __table._M_monthname + 24, - __ct); - if (__pr == __table._M_monthname + 24) - return __format; - __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname - 12); - break; - } - - case 'd': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0)); - if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) { - __err |= ios_base::failbit; - return __format; - } - break; - } - - case 'H': case 'I': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0)); - if (!__pr) - return __format; - break; - } - - case 'j': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0)); - if (!__pr) - return __format; - break; - } - - case 'm': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0)); - --__t->tm_mon; - if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) { - __err |= ios_base::failbit; - return __format; - } - break; - } - - case 'M': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0)); - if (!__pr) - return __format; - break; - } - - case 'p': { - const string* __pr = __match(__first, __last, - __table._M_am_pm + 0, __table._M_am_pm + 2, __ct); - if (__pr == __table._M_am_pm + 2) - return __format; - // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00 - if (__pr == __table._M_am_pm + 1 && __t->tm_hour != 12 ) - __t->tm_hour += 12; - if (__pr == __table._M_am_pm && __t->tm_hour == 12 ) - __t->tm_hour = 0; - break; - } - - case 'S': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0)); - if (!__pr) - return __format; - break; - } - - case 'y': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0)); - if (!__pr) - return __format; - break; - } - - case 'Y': { - bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0)); - __t->tm_year -= 1900; - if (!__pr) - return __format; - break; - } - - default: - break; - } - } - else { - if (*__first++ != __ct.widen(*__format)) break; - } - - ++__format; - } - - return __format; -} - -template -bool _STLP_CALL -__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct, - const _Time_Info& __table, tm* __t) { - const string* __pr = - __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14, __ct); - __t->tm_wday = __STATIC_CAST(int, (__pr - __table._M_dayname) % 7); - return __pr != __table._M_dayname + 14; -} - -template -bool _STLP_CALL -__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct, - const _Time_Info& __table, tm* __t) { - const string* __pr = - __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24, __ct); - __t->tm_mon = __STATIC_CAST(int, (__pr - __table._M_monthname) % 12); - return __pr != __table._M_monthname + 24; -} - -#if !defined (_STLP_NO_WCHAR_T) -template -_OuIt _STLP_CALL -__put_time(char * __first, char * __last, _OuIt __out_ite, - const ios_base& __s, wchar_t) { - const ctype& __ct = *__STATIC_CAST(const ctype*, __s._M_ctype_facet()); - wchar_t __wbuf[64]; - __ct.widen(__first, __last, __wbuf); - ptrdiff_t __len = __last - __first; - wchar_t * __eend = __wbuf + __len; - return copy((wchar_t*)__wbuf, __eend, __out_ite); -} -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -template -_InIt -time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end, - ios_base& __str, ios_base::iostate& __err, - tm* __t) const { - typedef string::const_iterator string_iterator; - - string_iterator __format = _M_timeinfo._M_date_format.begin(); - string_iterator __format_end = _M_timeinfo._M_date_format.end(); - - string_iterator __result - = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end, - __STATIC_CAST(_Ch*, 0), _M_timeinfo, - __str, __err, __t); - if (__result == __format_end) - __err = ios_base::goodbit; - else { - __err = ios_base::failbit; - if (__s == __end) - __err |= ios_base::eofbit; - } - return __s; -} - -template -_InIt -time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end, - ios_base& __str, ios_base::iostate& __err, - tm* __t) const { - typedef string::const_iterator string_iterator; - string_iterator __format = _M_timeinfo._M_time_format.begin(); - string_iterator __format_end = _M_timeinfo._M_time_format.end(); - - string_iterator __result - = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end, - __STATIC_CAST(_Ch*, 0), _M_timeinfo, - __str, __err, __t); - __err = __result == __format_end ? ios_base::goodbit - : ios_base::failbit; - if (__s == __end) - __err |= ios_base::eofbit; - return __s; -} - -template -_InIt -time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end, - ios_base&, ios_base::iostate& __err, - tm* __t) const { - if (__s == __end) { - __err = ios_base::failbit | ios_base::eofbit; - return __s; - } - - bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0)); - __t->tm_year -= 1900; - __err = __pr ? ios_base::goodbit : ios_base::failbit; - if (__s == __end) - __err |= ios_base::eofbit; - - return __s; -} - -template -_InIt -time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end, - ios_base &__str, ios_base::iostate &__err, - tm *__t) const { - const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet()); - bool __result = - _STLP_PRIV __get_short_or_long_dayname(__s, __end, __ct, _M_timeinfo, __t); - if (__result) - __err = ios_base::goodbit; - else { - __err = ios_base::failbit; - if (__s == __end) - __err |= ios_base::eofbit; - } - return __s; -} - -template -_InIt -time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end, - ios_base &__str, ios_base::iostate &__err, - tm *__t) const { - const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet()); - bool __result = - _STLP_PRIV __get_short_or_long_monthname(__s, __end, __ct, _M_timeinfo, __t); - if (__result) - __err = ios_base::goodbit; - else { - __err = ios_base::failbit; - if (__s == __end) - __err |= ios_base::eofbit; - } - return __s; -} - -template -_OutputIter -time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill, - const tm* __tmb, const _Ch* __pat, - const _Ch* __pat_end) const { - // locale __loc = __f.getloc(); - // const ctype<_Ch>& _Ct = use_facet >(__loc); - const ctype<_Ch>& _Ct = *__STATIC_CAST(const ctype<_Ch>*, __f._M_ctype_facet()); - while (__pat != __pat_end) { - char __c = _Ct.narrow(*__pat, 0); - if (__c == '%') { - char __mod = 0; - ++__pat; - __c = _Ct.narrow(*__pat++, 0); - if (__c == '#') { // MS extension - __mod = __c; - __c = _Ct.narrow(*__pat++, 0); - } - __s = do_put(__s, __f, __fill, __tmb, __c, __mod); - } - else - *__s++ = *__pat++; - } - return __s; -} - -template -_OutputIter -time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */, - const tm* __tmb, char __format, - char __modifier ) const { - char __buf[64]; - char * __iend = _STLP_PRIV __write_formatted_time(_STLP_ARRAY_AND_SIZE(__buf), - __format, __modifier, _M_timeinfo, __tmb); - // locale __loc = __f.getloc(); - return _STLP_PRIV __put_time(__buf, __iend, __s, __f, _Ch()); -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_TIME_FACETS_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_time_facets.h b/SDK/stlport/stl/_time_facets.h deleted file mode 100644 index 34238184..00000000 --- a/SDK/stlport/stl/_time_facets.h +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: This is an internal header file, included by other C++ -// standard library headers. You should not attempt to use this header -// file directly. - - -#ifndef _STLP_INTERNAL_TIME_FACETS_H -#define _STLP_INTERNAL_TIME_FACETS_H - -#ifndef _STLP_INTERNAL_CTIME -# include // Needed (for struct tm) by time facets -#endif - -#ifndef _STLP_C_LOCALE_H -# include -#endif - -#ifndef _STLP_IOS_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// Template functions used by time_get - -// Matching input against a list of names - -// Alphabetic input of the names of months and the names -// of weekdays requires matching input against a list of names. -// We use a simple generic algorithm to accomplish this. This -// algorithm is not very efficient, especially for longer lists -// of names, but it probably does not matter for the initial -// implementation and it may never matter, since we do not expect -// this kind of input to be used very often. The algorithm -// could be improved fairly simply by creating a new list of -// names still in the running at each iteration. A more sophisticated -// approach would be to build a trie to do the matching. -// -// We compare each character of the input to the corresponding -// character of each name on the list that has not been eliminated, -// either because every character in the name has already been -// matched, or because some character has not been matched. We -// continue only as long as there are some names that have not been -// eliminated. - -// We do not really need a random access iterator (a forward iterator -// would do), but the extra generality makes the notation clumsier, -// and we don't really need it. - -// We can recognize a failed match by the fact that the second -// component of the return value will be __name_end. - -#define _MAXNAMES 64 -#define _MAX_NAME_LENGTH 64 - -// Both time_get and time_put need a structure of type _Time_Info -// to provide names and abbreviated names for months and days, -// as well as the am/pm designator. The month and weekday tables -// have the all the abbreviated names before all the full names. -// The _Time_Info tables are initialized using the non-template -// function _Init_timeinfo, which has two overloadings: one -// with a single reference parameter for the table to be initialized, -// and one with a second _Locale_time * parameter. The first form -// is called by the default constructor and the second by a special -// constructor invoked from the _byname subclass constructor to -// construct the base class. - -class _STLP_CLASS_DECLSPEC _Time_Info { -public: - string _M_dayname[14]; - string _M_monthname[24]; - string _M_am_pm[2]; - string _M_time_format; - string _M_date_format; - string _M_date_time_format; - string _M_long_date_format; - string _M_long_date_time_format; -}; - -void _STLP_CALL _Init_timeinfo(_Time_Info&); -void _STLP_CALL _Init_timeinfo(_Time_Info&, _Locale_time*); - -_STLP_MOVE_TO_STD_NAMESPACE - -class _STLP_CLASS_DECLSPEC time_base { -public: - enum dateorder {no_order, dmy, mdy, ymd, ydm}; -}; - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class time_get : public locale::facet, public time_base { - friend class _Locale_impl; - -public: - typedef _Ch char_type; - typedef _InIt iter_type; - - explicit time_get(size_t __refs = 0) : locale::facet(__refs) - { _STLP_PRIV _Init_timeinfo(_M_timeinfo); } - dateorder date_order() const { return do_date_order(); } - iter_type get_time(iter_type __s, iter_type __end, ios_base& __str, - ios_base::iostate& __err, tm* __t) const - { return do_get_time(__s, __end, __str, __err, __t); } - iter_type get_date(iter_type __s, iter_type __end, ios_base& __str, - ios_base::iostate& __err, tm* __t) const - { return do_get_date(__s, __end, __str, __err, __t); } - iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str, - ios_base::iostate& __err, tm* __t) const - { return do_get_weekday(__s, __end, __str, __err, __t); } - iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str, - ios_base::iostate& __err, tm* __t) const - { return do_get_monthname(__s, __end, __str, __err, __t); } - iter_type get_year(iter_type __s, iter_type __end, ios_base& __str, - ios_base::iostate& __err, tm* __t) const - { return do_get_year(__s, __end, __str, __err, __t); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - time_get(_Locale_time *, size_t __refs) : locale::facet(__refs) {} - - ~time_get() {} - - virtual dateorder do_date_order() const {return no_order;} - - virtual iter_type do_get_time(iter_type __s, iter_type __end, - ios_base&, ios_base::iostate& __err, - tm* __t) const; - - virtual iter_type do_get_date(iter_type __s, iter_type __end, - ios_base&, ios_base::iostate& __err, - tm* __t) const; - - virtual iter_type do_get_weekday(iter_type __s, iter_type __end, - ios_base&, - ios_base::iostate& __err, - tm* __t) const; - virtual iter_type do_get_monthname(iter_type __s, iter_type __end, - ios_base&, - ios_base::iostate& __err, - tm* __t) const; - - virtual iter_type do_get_year(iter_type __s, iter_type __end, - ios_base&, ios_base::iostate& __err, - tm* __t) const; - - _STLP_PRIV _Time_Info _M_timeinfo; -}; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -time_base::dateorder _STLP_CALL __get_date_order(_Locale_time*); -_Locale_time* _STLP_CALL __acquire_time(const char* __name, _Locale_name_hint*); -void _STLP_CALL __release_time(_Locale_time* __time); - -_STLP_MOVE_TO_STD_NAMESPACE - -template -class time_get_byname; - -#if defined (__GNUC__) && (__GNUC__ < 3) -template -_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>*); -#else -_Locale_name_hint* _Locale_time_extract_hint(time_get_byname > >*); -#endif - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class time_get_byname : public time_get<_Ch, _InIt> { -public: - typedef time_base::dateorder dateorder; - typedef _InIt iter_type; - - explicit time_get_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0) - : time_get<_Ch, _InIt>((_Locale_time*) 0, __refs), - _M_time(_STLP_PRIV __acquire_time(__name, __hint)) - { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); } - -protected: - ~time_get_byname() { _STLP_PRIV __release_time(_M_time); } - dateorder do_date_order() const { return _STLP_PRIV __get_date_order(_M_time); } - -private: - _Locale_time* _M_time; - - typedef time_get_byname<_Ch, _InIt> _Self; - //explicitely defined as private to avoid warnings: - time_get_byname(_Self const&); - _Self& operator = (_Self const&); -#if defined (__GNUC__) && (__GNUC__ < 3) - friend _Locale_name_hint* _Locale_time_extract_hint<>(_Self*); -#else - friend _Locale_name_hint* _Locale_time_extract_hint(time_get_byname > >*); -#endif -}; - -// time_put facet - -// For the formats 'x, 'X', and 'c', do_put calls the first form of -// put with the pattern obtained from _M_timeinfo._M_date_format or -// _M_timeinfo._M_time_format. - -// Helper function: __ takes a single-character -// format. As indicated by the foregoing remark, this will never be -// 'x', 'X', or 'c'. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -char * _STLP_CALL -__write_formatted_time(char *__buf, size_t __buf_size, char __format, char __modifier, - const _Time_Info& __table, const tm* __t); - -template -inline _OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite, - const ios_base& /* __loc */, char) -{ return copy(__first, __last, __out_ite); } - -#if !defined (_STLP_NO_WCHAR_T) -template -_OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite, - const ios_base& __s, wchar_t); -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class time_put : public locale::facet, public time_base { - friend class _Locale_impl; -public: - typedef _Ch char_type; - typedef _OutIt iter_type; - - explicit time_put(size_t __refs = 0) : locale::facet(__refs) - { _STLP_PRIV _Init_timeinfo(_M_timeinfo); } - - _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, - const tm* __tmb, - const _Ch* __pat, const _Ch* __pat_end) const; - - _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, - const tm* __tmb, char __format, char __modifier = 0) const - { return do_put(__s, __f, __fill, __tmb, __format, __modifier); } - - static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; - -protected: - time_put(_Locale_time* /*__time*/, size_t __refs) : locale::facet(__refs) - {} //_STLP_PRIV _Init_timeinfo(_M_timeinfo, __time); } - - ~time_put() {} - virtual iter_type do_put(iter_type __s, ios_base& __f, - char_type /* __fill */, const tm* __tmb, - char __format, char /* __modifier */) const; - - _STLP_PRIV _Time_Info _M_timeinfo; -}; - -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -template -#else -template > > -#endif -class time_put_byname : public time_put<_Ch, _OutIt> { - friend class _Locale_impl; -public: - typedef time_base::dateorder dateorder; - typedef _OutIt iter_type; - typedef _Ch char_type; - - explicit time_put_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0) - : time_put<_Ch, _OutIt>((_Locale_time*) 0, __refs), - _M_time(_STLP_PRIV __acquire_time(__name, __hint)) - { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); } - -protected: - ~time_put_byname() { _STLP_PRIV __release_time(_M_time); } - -private: - _Locale_time* _M_time; - - typedef time_put_byname<_Ch, _OutIt> _Self; - //explicitely defined as private to avoid warnings: - time_put_byname(_Self const&); - _Self& operator = (_Self const&); -}; - -#if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS time_get > >; -_STLP_EXPORT_TEMPLATE_CLASS time_put > >; -// _STLP_EXPORT_TEMPLATE_CLASS time_get; -// _STLP_EXPORT_TEMPLATE_CLASS time_put; -# if !defined (_STLP_NO_WCHAR_T) -_STLP_EXPORT_TEMPLATE_CLASS time_get > >; -_STLP_EXPORT_TEMPLATE_CLASS time_put > >; -// _STLP_EXPORT_TEMPLATE_CLASS time_get; -// _STLP_EXPORT_TEMPLATE_CLASS time_put; -# endif - -#endif - -_STLP_END_NAMESPACE - -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* _STLP_INTERNAL_TIME_FACETS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_tree.c b/SDK/stlport/stl/_tree.c deleted file mode 100644 index 818fcc4a..00000000 --- a/SDK/stlport/stl/_tree.c +++ /dev/null @@ -1,730 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - * Modified CRP 7/10/00 for improved conformance / efficiency on insert_unique / - * insert_equal with valid hint -- efficiency is improved all around, and it is - * should now be standard conforming for complexity on insert point immediately - * after hint (amortized constant time). - * - */ -#ifndef _STLP_TREE_C -#define _STLP_TREE_C - -#ifndef _STLP_INTERNAL_TREE_H -# include -#endif - -#if defined (_STLP_DEBUG) -# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) -#endif - -// fbp: these defines are for outline methods definitions. -// needed for definitions to be portable. Should not be used in method bodies. -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# define __iterator__ _Rb_tree_iterator<_Value, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits> -# define __size_type__ size_t -# define iterator __iterator__ -#else -# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::iterator -# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::size_type -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) - -template void _STLP_CALL -_Rb_global<_Dummy>::_Rotate_left(_Rb_tree_node_base* __x, - _Rb_tree_node_base*& __root) { - _Rb_tree_node_base* __y = __x->_M_right; - __x->_M_right = __y->_M_left; - if (__y->_M_left != 0) - __y->_M_left->_M_parent = __x; - __y->_M_parent = __x->_M_parent; - - if (__x == __root) - __root = __y; - else if (__x == __x->_M_parent->_M_left) - __x->_M_parent->_M_left = __y; - else - __x->_M_parent->_M_right = __y; - __y->_M_left = __x; - __x->_M_parent = __y; -} - -template void _STLP_CALL -_Rb_global<_Dummy>::_Rotate_right(_Rb_tree_node_base* __x, - _Rb_tree_node_base*& __root) { - _Rb_tree_node_base* __y = __x->_M_left; - __x->_M_left = __y->_M_right; - if (__y->_M_right != 0) - __y->_M_right->_M_parent = __x; - __y->_M_parent = __x->_M_parent; - - if (__x == __root) - __root = __y; - else if (__x == __x->_M_parent->_M_right) - __x->_M_parent->_M_right = __y; - else - __x->_M_parent->_M_left = __y; - __y->_M_right = __x; - __x->_M_parent = __y; -} - -template void _STLP_CALL -_Rb_global<_Dummy>::_Rebalance(_Rb_tree_node_base* __x, - _Rb_tree_node_base*& __root) { - __x->_M_color = _S_rb_tree_red; - while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) { - if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) { - _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right; - if (__y && __y->_M_color == _S_rb_tree_red) { - __x->_M_parent->_M_color = _S_rb_tree_black; - __y->_M_color = _S_rb_tree_black; - __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; - __x = __x->_M_parent->_M_parent; - } - else { - if (__x == __x->_M_parent->_M_right) { - __x = __x->_M_parent; - _Rotate_left(__x, __root); - } - __x->_M_parent->_M_color = _S_rb_tree_black; - __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; - _Rotate_right(__x->_M_parent->_M_parent, __root); - } - } - else { - _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left; - if (__y && __y->_M_color == _S_rb_tree_red) { - __x->_M_parent->_M_color = _S_rb_tree_black; - __y->_M_color = _S_rb_tree_black; - __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; - __x = __x->_M_parent->_M_parent; - } - else { - if (__x == __x->_M_parent->_M_left) { - __x = __x->_M_parent; - _Rotate_right(__x, __root); - } - __x->_M_parent->_M_color = _S_rb_tree_black; - __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; - _Rotate_left(__x->_M_parent->_M_parent, __root); - } - } - } - __root->_M_color = _S_rb_tree_black; -} - -template _Rb_tree_node_base* _STLP_CALL -_Rb_global<_Dummy>::_Rebalance_for_erase(_Rb_tree_node_base* __z, - _Rb_tree_node_base*& __root, - _Rb_tree_node_base*& __leftmost, - _Rb_tree_node_base*& __rightmost) { - _Rb_tree_node_base* __y = __z; - _Rb_tree_node_base* __x; - _Rb_tree_node_base* __x_parent; - - if (__y->_M_left == 0) // __z has at most one non-null child. y == z. - __x = __y->_M_right; // __x might be null. - else { - if (__y->_M_right == 0) // __z has exactly one non-null child. y == z. - __x = __y->_M_left; // __x is not null. - else { // __z has two non-null children. Set __y to - __y = _Rb_tree_node_base::_S_minimum(__y->_M_right); // __z's successor. __x might be null. - __x = __y->_M_right; - } - } - - if (__y != __z) { // relink y in place of z. y is z's successor - __z->_M_left->_M_parent = __y; - __y->_M_left = __z->_M_left; - if (__y != __z->_M_right) { - __x_parent = __y->_M_parent; - if (__x) __x->_M_parent = __y->_M_parent; - __y->_M_parent->_M_left = __x; // __y must be a child of _M_left - __y->_M_right = __z->_M_right; - __z->_M_right->_M_parent = __y; - } - else - __x_parent = __y; - if (__root == __z) - __root = __y; - else if (__z->_M_parent->_M_left == __z) - __z->_M_parent->_M_left = __y; - else - __z->_M_parent->_M_right = __y; - __y->_M_parent = __z->_M_parent; - _STLP_STD::swap(__y->_M_color, __z->_M_color); - __y = __z; - // __y now points to node to be actually deleted - } - else { // __y == __z - __x_parent = __y->_M_parent; - if (__x) __x->_M_parent = __y->_M_parent; - if (__root == __z) - __root = __x; - else { - if (__z->_M_parent->_M_left == __z) - __z->_M_parent->_M_left = __x; - else - __z->_M_parent->_M_right = __x; - } - - if (__leftmost == __z) { - if (__z->_M_right == 0) // __z->_M_left must be null also - __leftmost = __z->_M_parent; - // makes __leftmost == _M_header if __z == __root - else - __leftmost = _Rb_tree_node_base::_S_minimum(__x); - } - if (__rightmost == __z) { - if (__z->_M_left == 0) // __z->_M_right must be null also - __rightmost = __z->_M_parent; - // makes __rightmost == _M_header if __z == __root - else // __x == __z->_M_left - __rightmost = _Rb_tree_node_base::_S_maximum(__x); - } - } - - if (__y->_M_color != _S_rb_tree_red) { - while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black)) - if (__x == __x_parent->_M_left) { - _Rb_tree_node_base* __w = __x_parent->_M_right; - if (__w->_M_color == _S_rb_tree_red) { - __w->_M_color = _S_rb_tree_black; - __x_parent->_M_color = _S_rb_tree_red; - _Rotate_left(__x_parent, __root); - __w = __x_parent->_M_right; - } - if ((__w->_M_left == 0 || - __w->_M_left->_M_color == _S_rb_tree_black) && (__w->_M_right == 0 || - __w->_M_right->_M_color == _S_rb_tree_black)) { - __w->_M_color = _S_rb_tree_red; - __x = __x_parent; - __x_parent = __x_parent->_M_parent; - } else { - if (__w->_M_right == 0 || - __w->_M_right->_M_color == _S_rb_tree_black) { - if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; - __w->_M_color = _S_rb_tree_red; - _Rotate_right(__w, __root); - __w = __x_parent->_M_right; - } - __w->_M_color = __x_parent->_M_color; - __x_parent->_M_color = _S_rb_tree_black; - if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; - _Rotate_left(__x_parent, __root); - break; - } - } else { // same as above, with _M_right <-> _M_left. - _Rb_tree_node_base* __w = __x_parent->_M_left; - if (__w->_M_color == _S_rb_tree_red) { - __w->_M_color = _S_rb_tree_black; - __x_parent->_M_color = _S_rb_tree_red; - _Rotate_right(__x_parent, __root); - __w = __x_parent->_M_left; - } - if ((__w->_M_right == 0 || - __w->_M_right->_M_color == _S_rb_tree_black) && (__w->_M_left == 0 || - __w->_M_left->_M_color == _S_rb_tree_black)) { - __w->_M_color = _S_rb_tree_red; - __x = __x_parent; - __x_parent = __x_parent->_M_parent; - } else { - if (__w->_M_left == 0 || - __w->_M_left->_M_color == _S_rb_tree_black) { - if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; - __w->_M_color = _S_rb_tree_red; - _Rotate_left(__w, __root); - __w = __x_parent->_M_left; - } - __w->_M_color = __x_parent->_M_color; - __x_parent->_M_color = _S_rb_tree_black; - if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; - _Rotate_right(__x_parent, __root); - break; - } - } - if (__x) __x->_M_color = _S_rb_tree_black; - } - return __y; -} - -template _Rb_tree_node_base* _STLP_CALL -_Rb_global<_Dummy>::_M_decrement(_Rb_tree_node_base* _M_node) { - if (_M_node->_M_color == _S_rb_tree_red && _M_node->_M_parent->_M_parent == _M_node) - _M_node = _M_node->_M_right; - else if (_M_node->_M_left != 0) { - _M_node = _Rb_tree_node_base::_S_maximum(_M_node->_M_left); - } - else { - _Base_ptr __y = _M_node->_M_parent; - while (_M_node == __y->_M_left) { - _M_node = __y; - __y = __y->_M_parent; - } - _M_node = __y; - } - return _M_node; -} - -template _Rb_tree_node_base* _STLP_CALL -_Rb_global<_Dummy>::_M_increment(_Rb_tree_node_base* _M_node) { - if (_M_node->_M_right != 0) { - _M_node = _Rb_tree_node_base::_S_minimum(_M_node->_M_right); - } - else { - _Base_ptr __y = _M_node->_M_parent; - while (_M_node == __y->_M_right) { - _M_node = __y; - __y = __y->_M_parent; - } - // check special case: This is necessary if _M_node is the - // _M_head and the tree contains only a single node __y. In - // that case parent, left and right all point to __y! - if (_M_node->_M_right != __y) - _M_node = __y; - } - return _M_node; -} - -#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ - - -template -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::operator=( - const _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& __x) { - if (this != &__x) { - // Note that _Key may be a constant type. - clear(); - _M_node_count = 0; - _M_key_compare = __x._M_key_compare; - if (__x._M_root() == 0) { - _M_root() = 0; - _M_leftmost() = &this->_M_header._M_data; - _M_rightmost() = &this->_M_header._M_data; - } - else { - _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - _M_node_count = __x._M_node_count; - } - } - return *this; -} - -// CRP 7/10/00 inserted argument __on_right, which is another hint (meant to -// act like __on_left and ignore a portion of the if conditions -- specify -// __on_right != 0 to bypass comparison as false or __on_left != 0 to bypass -// comparison as true) -template -__iterator__ -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_insert(_Rb_tree_node_base * __parent, - const _Value& __val, - _Rb_tree_node_base * __on_left, - _Rb_tree_node_base * __on_right) { - // We do not create the node here as, depending on tests, we might call - // _M_key_compare that can throw an exception. - _Base_ptr __new_node; - - if ( __parent == &this->_M_header._M_data ) { - __new_node = _M_create_node(__val); - _S_left(__parent) = __new_node; // also makes _M_leftmost() = __new_node - _M_root() = __new_node; - _M_rightmost() = __new_node; - } - else if ( __on_right == 0 && // If __on_right != 0, the remainder fails to false - ( __on_left != 0 || // If __on_left != 0, the remainder succeeds to true - _M_key_compare( _KeyOfValue()(__val), _S_key(__parent) ) ) ) { - __new_node = _M_create_node(__val); - _S_left(__parent) = __new_node; - if (__parent == _M_leftmost()) - _M_leftmost() = __new_node; // maintain _M_leftmost() pointing to min node - } - else { - __new_node = _M_create_node(__val); - _S_right(__parent) = __new_node; - if (__parent == _M_rightmost()) - _M_rightmost() = __new_node; // maintain _M_rightmost() pointing to max node - } - _S_parent(__new_node) = __parent; - _Rb_global_inst::_Rebalance(__new_node, this->_M_header._M_data._M_parent); - ++_M_node_count; - return iterator(__new_node); -} - -template -__iterator__ -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(const _Value& __val) { - _Base_ptr __y = &this->_M_header._M_data; - _Base_ptr __x = _M_root(); - while (__x != 0) { - __y = __x; - if (_M_key_compare(_KeyOfValue()(__val), _S_key(__x))) { - __x = _S_left(__x); - } - else - __x = _S_right(__x); - } - return _M_insert(__y, __val, __x); -} - - -template -pair<__iterator__, bool> -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(const _Value& __val) { - _Base_ptr __y = &this->_M_header._M_data; - _Base_ptr __x = _M_root(); - bool __comp = true; - while (__x != 0) { - __y = __x; - __comp = _M_key_compare(_KeyOfValue()(__val), _S_key(__x)); - __x = __comp ? _S_left(__x) : _S_right(__x); - } - iterator __j = iterator(__y); - if (__comp) { - if (__j == begin()) - return pair(_M_insert(__y, __val, /* __x*/ __y), true); - else - --__j; - } - if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__val))) { - return pair(_M_insert(__y, __val, __x), true); - } - return pair(__j, false); -} - -// Modifications CRP 7/10/00 as noted to improve conformance and -// efficiency. -template -__iterator__ -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(iterator __position, - const _Value& __val) { - if (__position._M_node == this->_M_header._M_data._M_left) { // begin() - - // if the container is empty, fall back on insert_unique. - if (empty()) - return insert_unique(__val).first; - - if (_M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node))) { - return _M_insert(__position._M_node, __val, __position._M_node); - } - // first argument just needs to be non-null - else { - bool __comp_pos_v = _M_key_compare( _S_key(__position._M_node), _KeyOfValue()(__val) ); - - if (__comp_pos_v == false) // compare > and compare < both false so compare equal - return __position; - //Below __comp_pos_v == true - - // Standard-conformance - does the insertion point fall immediately AFTER - // the hint? - iterator __after = __position; - ++__after; - - // Check for only one member -- in that case, __position points to itself, - // and attempting to increment will cause an infinite loop. - if (__after._M_node == &this->_M_header._M_data) - // Check guarantees exactly one member, so comparison was already - // performed and we know the result; skip repeating it in _M_insert - // by specifying a non-zero fourth argument. - return _M_insert(__position._M_node, __val, 0, __position._M_node); - - // All other cases: - - // Optimization to catch insert-equivalent -- save comparison results, - // and we get this for free. - if (_M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) )) { - if (_S_right(__position._M_node) == 0) - return _M_insert(__position._M_node, __val, 0, __position._M_node); - else - return _M_insert(__after._M_node, __val, __after._M_node); - } - else { - return insert_unique(__val).first; - } - } - } - else if (__position._M_node == &this->_M_header._M_data) { // end() - if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__val))) { - // pass along to _M_insert that it can skip comparing - // v, Key ; since compare Key, v was true, compare v, Key must be false. - return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null - } - else - return insert_unique(__val).first; - } - else { - iterator __before = __position; - --__before; - - bool __comp_v_pos = _M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node)); - - if (__comp_v_pos - && _M_key_compare( _S_key(__before._M_node), _KeyOfValue()(__val) )) { - - if (_S_right(__before._M_node) == 0) - return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null - else - return _M_insert(__position._M_node, __val, __position._M_node); - // first argument just needs to be non-null - } - else { - // Does the insertion point fall immediately AFTER the hint? - iterator __after = __position; - ++__after; - // Optimization to catch equivalent cases and avoid unnecessary comparisons - bool __comp_pos_v = !__comp_v_pos; // Stored this result earlier - // If the earlier comparison was true, this comparison doesn't need to be - // performed because it must be false. However, if the earlier comparison - // was false, we need to perform this one because in the equal case, both will - // be false. - if (!__comp_v_pos) { - __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)); - } - - if ( (!__comp_v_pos) // comp_v_pos true implies comp_v_pos false - && __comp_pos_v - && (__after._M_node == &this->_M_header._M_data || - _M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) ))) { - if (_S_right(__position._M_node) == 0) - return _M_insert(__position._M_node, __val, 0, __position._M_node); - else - return _M_insert(__after._M_node, __val, __after._M_node); - } else { - // Test for equivalent case - if (__comp_v_pos == __comp_pos_v) - return __position; - else - return insert_unique(__val).first; - } - } - } -} - -template -__iterator__ -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(iterator __position, - const _Value& __val) { - if (__position._M_node == this->_M_header._M_data._M_left) { // begin() - - // Check for zero members - if (size() <= 0) - return insert_equal(__val); - - if (!_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val))) - return _M_insert(__position._M_node, __val, __position._M_node); - else { - // Check for only one member - if (__position._M_node->_M_left == __position._M_node) - // Unlike insert_unique, can't avoid doing a comparison here. - return _M_insert(__position._M_node, __val); - - // All other cases: - // Standard-conformance - does the insertion point fall immediately AFTER - // the hint? - iterator __after = __position; - ++__after; - - // Already know that compare(pos, v) must be true! - // Therefore, we want to know if compare(after, v) is false. - // (i.e., we now pos < v, now we want to know if v <= after) - // If not, invalid hint. - if ( __after._M_node == &this->_M_header._M_data || - !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) { - if (_S_right(__position._M_node) == 0) - return _M_insert(__position._M_node, __val, 0, __position._M_node); - else - return _M_insert(__after._M_node, __val, __after._M_node); - } - else { // Invalid hint - return insert_equal(__val); - } - } - } - else if (__position._M_node == &this->_M_header._M_data) { // end() - if (!_M_key_compare(_KeyOfValue()(__val), _S_key(_M_rightmost()))) - return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null - else { - return insert_equal(__val); - } - } - else { - iterator __before = __position; - --__before; - // store the result of the comparison between pos and v so - // that we don't have to do it again later. Note that this reverses the shortcut - // on the if, possibly harming efficiency in comparisons; I think the harm will - // be negligible, and to do what I want to do (save the result of a comparison so - // that it can be re-used) there is no alternative. Test here is for before <= v <= pos. - bool __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)); - if (!__comp_pos_v && - !_M_key_compare(_KeyOfValue()(__val), _S_key(__before._M_node))) { - if (_S_right(__before._M_node) == 0) - return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null - else - return _M_insert(__position._M_node, __val, __position._M_node); - } - else { - // Does the insertion point fall immediately AFTER the hint? - // Test for pos < v <= after - iterator __after = __position; - ++__after; - - if (__comp_pos_v && - ( __after._M_node == &this->_M_header._M_data || - !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) ) { - if (_S_right(__position._M_node) == 0) - return _M_insert(__position._M_node, __val, 0, __position._M_node); - else - return _M_insert(__after._M_node, __val, __after._M_node); - } - else { // Invalid hint - return insert_equal(__val); - } - } - } -} - -template -_Rb_tree_node_base* -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_copy(_Rb_tree_node_base* __x, - _Rb_tree_node_base* __p) { - // structural copy. __x and __p must be non-null. - _Base_ptr __top = _M_clone_node(__x); - _S_parent(__top) = __p; - - _STLP_TRY { - if (_S_right(__x)) - _S_right(__top) = _M_copy(_S_right(__x), __top); - __p = __top; - __x = _S_left(__x); - - while (__x != 0) { - _Base_ptr __y = _M_clone_node(__x); - _S_left(__p) = __y; - _S_parent(__y) = __p; - if (_S_right(__x)) - _S_right(__y) = _M_copy(_S_right(__x), __y); - __p = __y; - __x = _S_left(__x); - } - } - _STLP_UNWIND(_M_erase(__top)) - - return __top; -} - -// this has to stay out-of-line : it's recursive -template -void -_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::_M_erase(_Rb_tree_node_base *__x) { - // erase without rebalancing - while (__x != 0) { - _M_erase(_S_right(__x)); - _Base_ptr __y = _S_left(__x); - _STLP_STD::_Destroy(&_S_value(__x)); - this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x),1); - __x = __y; - } -} - -#if defined (_STLP_DEBUG) -inline int -__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) { - if (__node == 0) - return 0; - else { - int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0; - if (__node == __root) - return __bc; - else - return __bc + __black_count(__node->_M_parent, __root); - } -} - -template -bool _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::__rb_verify() const { - if (_M_node_count == 0 || begin() == end()) - return ((_M_node_count == 0) && - (begin() == end()) && - (this->_M_header._M_data._M_left == &this->_M_header._M_data) && - (this->_M_header._M_data._M_right == &this->_M_header._M_data)); - - int __len = __black_count(_M_leftmost(), _M_root()); - for (const_iterator __it = begin(); __it != end(); ++__it) { - _Base_ptr __x = __it._M_node; - _Base_ptr __L = _S_left(__x); - _Base_ptr __R = _S_right(__x); - - if (__x->_M_color == _S_rb_tree_red) - if ((__L && __L->_M_color == _S_rb_tree_red) || - (__R && __R->_M_color == _S_rb_tree_red)) - return false; - - if (__L && _M_key_compare(_S_key(__x), _S_key(__L))) - return false; - if (__R && _M_key_compare(_S_key(__R), _S_key(__x))) - return false; - - if (!__L && !__R && __black_count(__x, _M_root()) != __len) - return false; - } - - if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) - return false; - if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) - return false; - - return true; -} -#endif /* _STLP_DEBUG */ - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -#undef _Rb_tree -#undef __iterator__ -#undef iterator -#undef __size_type__ - -#endif /* _STLP_TREE_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_tree.h b/SDK/stlport/stl/_tree.h deleted file mode 100644 index c4c799d7..00000000 --- a/SDK/stlport/stl/_tree.h +++ /dev/null @@ -1,679 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_TREE_H -#define _STLP_INTERNAL_TREE_H - -/* - -Red-black tree class, designed for use in implementing STL -associative containers (set, multiset, map, and multimap). The -insertion and deletion algorithms are based on those in Cormen, -Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), -except that - -(1) the header cell is maintained with links not only to the root -but also to the leftmost node of the tree, to enable constant time -begin(), and to the rightmost node of the tree, to enable linear time -performance when used with the generic set algorithms (set_union, -etc.); - -(2) when a node being deleted has two children its successor node is -relinked into its place, rather than copied, so that the only -iterators invalidated are those referring to the deleted node. - -*/ - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -typedef bool _Rb_tree_Color_type; -//const _Rb_tree_Color_type _S_rb_tree_red = false; -//const _Rb_tree_Color_type _S_rb_tree_black = true; - -#define _S_rb_tree_red false -#define _S_rb_tree_black true - -struct _Rb_tree_node_base { - typedef _Rb_tree_Color_type _Color_type; - typedef _Rb_tree_node_base* _Base_ptr; - - _Color_type _M_color; - _Base_ptr _M_parent; - _Base_ptr _M_left; - _Base_ptr _M_right; - - static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) { - while (__x->_M_left != 0) __x = __x->_M_left; - return __x; - } - - static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) { - while (__x->_M_right != 0) __x = __x->_M_right; - return __x; - } -}; - -template -struct _Rb_tree_node : public _Rb_tree_node_base { - _Value _M_value_field; - __TRIVIAL_STUFF(_Rb_tree_node) -}; - -struct _Rb_tree_base_iterator; - -template -class _Rb_global { -public: - typedef _Rb_tree_node_base* _Base_ptr; - // those used to be global functions - static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root); - static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z, - _Base_ptr& __root, - _Base_ptr& __leftmost, - _Base_ptr& __rightmost); - // those are from _Rb_tree_base_iterator - moved here to reduce code bloat - // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator - static _Base_ptr _STLP_CALL _M_increment (_Base_ptr); - static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr); - static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root); - static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root); -}; - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE_CLASS _Rb_global; -# endif - -typedef _Rb_global _Rb_global_inst; - -struct _Rb_tree_base_iterator { - typedef _Rb_tree_node_base* _Base_ptr; - typedef bidirectional_iterator_tag iterator_category; - typedef ptrdiff_t difference_type; - _Base_ptr _M_node; - _Rb_tree_base_iterator() : _M_node(0) {} - _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {} -}; - -template -struct _Rb_tree_iterator : public _Rb_tree_base_iterator { - typedef _Value value_type; - typedef typename _Traits::reference reference; - typedef typename _Traits::pointer pointer; - typedef _Rb_tree_iterator<_Value, _Traits> _Self; - typedef _Rb_tree_node_base* _Base_ptr; - typedef _Rb_tree_node<_Value>* _Link_type; - - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator; - - _Rb_tree_iterator() {} -#if !defined (_STLP_DEBUG) - /* In STL debug mode we need this constructor implicit for the pointer - * specialization implementation. - */ - explicit -#endif - _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {} - //copy constructor for iterator and constructor from iterator for const_iterator - _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {} - - reference operator*() const { - return __STATIC_CAST(_Link_type, _M_node)->_M_value_field; - } - - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - _M_node = _Rb_global_inst::_M_increment(_M_node); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - ++(*this); - return __tmp; - } - - _Self& operator--() { - _M_node = _Rb_global_inst::_M_decrement(_M_node); - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - --(*this); - return __tmp; - } - - bool operator == (const_iterator __rhs) const { - return _M_node == __rhs._M_node; - } - bool operator != (const_iterator __rhs) const { - return _M_node != __rhs._M_node; - } -}; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -_STLP_MOVE_TO_STD_NAMESPACE -template -struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _Traits> > { - typedef __false_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -_STLP_MOVE_TO_STD_NAMESPACE -template -inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&) -{ return (_Value*)0; } -inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&) -{ return bidirectional_iterator_tag(); } -inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&) -{ return (ptrdiff_t*) 0; } -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -// Base class to help EH - -template -class _Rb_tree_base { -public: - typedef _Rb_tree_node_base _Node_base; - typedef _Rb_tree_node<_Tp> _Node; - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; -private: - typedef _Rb_tree_base<_Tp, _Alloc> _Self; - typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type; - typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy; - -public: - allocator_type get_allocator() const { - return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp); - } - -protected: - _Rb_tree_base(const allocator_type& __a) : - _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) { - _M_empty_initialize(); - } - _Rb_tree_base(__move_source<_Self> src) : - _M_header(__move_source<_AllocProxy>(src.get()._M_header)) { - _M_rebind(&src.get()._M_header._M_data); - src.get()._M_empty_initialize(); - } - void _M_empty_initialize() { - _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from - // __root, in iterator.operator++ - _M_header._M_data._M_parent = 0; - _M_header._M_data._M_left = &_M_header._M_data; - _M_header._M_data._M_right = &_M_header._M_data; - } - - void _M_rebind(_Node_base *__static_node) { - if (_M_header._M_data._M_parent != 0) { - _M_header._M_data._M_parent->_M_parent = &_M_header._M_data; - } - if (_M_header._M_data._M_right == __static_node) { - _M_header._M_data._M_right = &_M_header._M_data; - } - if (_M_header._M_data._M_left == __static_node) { - _M_header._M_data._M_left = &_M_header._M_data; - } - } - - _AllocProxy _M_header; -}; - -#if defined (_STLP_DEBUG) -# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) -#endif - -template -class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> { - typedef _Rb_tree_base<_Value, _Alloc> _Base; - typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self; -protected: - typedef _Rb_tree_node_base * _Base_ptr; - typedef _Rb_tree_node<_Value> _Node; - typedef _Node* _Link_type; - typedef _Rb_tree_Color_type _Color_type; -public: - typedef _Key key_type; - typedef _Value value_type; - typedef typename _Traits::pointer pointer; - typedef const value_type* const_pointer; - typedef typename _Traits::reference reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef bidirectional_iterator_tag _Iterator_category; - typedef typename _Base::allocator_type allocator_type; - -protected: - - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - _Base_ptr _M_create_node(const value_type& __x) { - _Link_type __tmp = this->_M_header.allocate(1); - _STLP_TRY { - _Copy_Construct(&__tmp->_M_value_field, __x); - } - _STLP_UNWIND(this->_M_header.deallocate(__tmp,1)) - _S_left(__tmp) = 0; - _S_right(__tmp) = 0; - return __tmp; - } - - _Base_ptr _M_clone_node(_Base_ptr __x) { - _Base_ptr __tmp = _M_create_node(_S_value(__x)); - _S_color(__tmp) = _S_color(__x); - return __tmp; - } - - size_type _M_node_count; // keeps track of size of tree - _Compare _M_key_compare; - - _Base_ptr _M_root() const - { return this->_M_header._M_data._M_parent; } - _Base_ptr _M_leftmost() const - { return this->_M_header._M_data._M_left; } - _Base_ptr _M_rightmost() const - { return this->_M_header._M_data._M_right; } - - _Base_ptr& _M_root() - { return this->_M_header._M_data._M_parent; } - _Base_ptr& _M_leftmost() - { return this->_M_header._M_data._M_left; } - _Base_ptr& _M_rightmost() - { return this->_M_header._M_data._M_right; } - - static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x) - { return __x->_M_left; } - static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x) - { return __x->_M_right; } - static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x) - { return __x->_M_parent; } - static value_type& _STLP_CALL _S_value(_Base_ptr __x) - { return __STATIC_CAST(_Link_type, __x)->_M_value_field; } - static const _Key& _STLP_CALL _S_key(_Base_ptr __x) - { return _KeyOfValue()(_S_value(__x));} - static _Color_type& _STLP_CALL _S_color(_Base_ptr __x) - { return (_Color_type&)(__x->_M_color); } - - static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) - { return _Rb_tree_node_base::_S_minimum(__x); } - - static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) - { return _Rb_tree_node_base::_S_maximum(__x); } - -public: - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef _Rb_tree_iterator iterator; - typedef _Rb_tree_iterator const_iterator; - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - -private: - iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0); - _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p); - void _M_erase(_Base_ptr __x); - -public: - // allocation/deallocation - _Rb_tree() - : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare()) - {} - - _Rb_tree(const _Compare& __comp) - : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp) - {} - - _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp) - {} - - _Rb_tree(const _Self& __x) - : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()), - _M_node_count(0), _M_key_compare(__x._M_key_compare) { - if (__x._M_root() != 0) { - _S_color(&this->_M_header._M_data) = _S_rb_tree_red; - _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data); - _M_leftmost() = _S_minimum(_M_root()); - _M_rightmost() = _S_maximum(_M_root()); - } - _M_node_count = __x._M_node_count; - } - - _Rb_tree(__move_source<_Self> src) - : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())), - _M_node_count(src.get()._M_node_count), - _M_key_compare(_AsMoveSource(src.get()._M_key_compare)) { - src.get()._M_node_count = 0; - } - - ~_Rb_tree() { clear(); } - _Self& operator=(const _Self& __x); - -public: - // accessors: - _Compare key_comp() const { return _M_key_compare; } - - iterator begin() { return iterator(_M_leftmost()); } - const_iterator begin() const { return const_iterator(_M_leftmost()); } - iterator end() { return iterator(&this->_M_header._M_data); } - const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const - { return const_reverse_iterator(begin()); } - bool empty() const { return _M_node_count == 0; } - size_type size() const { return _M_node_count; } - size_type max_size() const { return size_type(-1); } - - void swap(_Self& __t) { - if (__t.empty()) { - if (this->empty()) return; - __t._M_header.swap(this->_M_header); - __t._M_rebind(&this->_M_header._M_data); - this->_M_empty_initialize(); - } - else if (this->empty()) { - __t.swap(*this); - return; - } - else { - this->_M_header.swap(__t._M_header); - this->_M_rebind(&__t._M_header._M_data); - __t._M_rebind(&this->_M_header._M_data); - } - _STLP_STD::swap(_M_node_count, __t._M_node_count); - _STLP_STD::swap(_M_key_compare, __t._M_key_compare); - } - -public: - // insert/erase - pair insert_unique(const value_type& __x); - iterator insert_equal(const value_type& __x); - - iterator insert_unique(iterator __pos, const value_type& __x); - iterator insert_equal(iterator __pos, const value_type& __x); - -#if defined (_STLP_MEMBER_TEMPLATES) - template void insert_equal(_II __first, _II __last) { - for ( ; __first != __last; ++__first) - insert_equal(*__first); - } - template void insert_unique(_II __first, _II __last) { - for ( ; __first != __last; ++__first) - insert_unique(*__first); - } -#else - void insert_unique(const_iterator __first, const_iterator __last) { - for ( ; __first != __last; ++__first) - insert_unique(*__first); - } - void insert_unique(const value_type* __first, const value_type* __last) { - for ( ; __first != __last; ++__first) - insert_unique(*__first); - } - void insert_equal(const_iterator __first, const_iterator __last) { - for ( ; __first != __last; ++__first) - insert_equal(*__first); - } - void insert_equal(const value_type* __first, const value_type* __last) { - for ( ; __first != __last; ++__first) - insert_equal(*__first); - } -#endif - - void erase(iterator __pos) { - _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node, - this->_M_header._M_data._M_parent, - this->_M_header._M_data._M_left, - this->_M_header._M_data._M_right); - _STLP_STD::_Destroy(&_S_value(__x)); - this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1); - --_M_node_count; - } - - size_type erase(const key_type& __x) { - pair __p = equal_range(__x); - size_type __n = distance(__p.first, __p.second); - erase(__p.first, __p.second); - return __n; - } - - size_type erase_unique(const key_type& __x) { - iterator __i = find(__x); - if (__i._M_node != &this->_M_header._M_data) { - erase(__i); - return 1; - } - return 0; - } - - void erase(iterator __first, iterator __last) { - if (__first._M_node == this->_M_header._M_data._M_left && // begin() - __last._M_node == &this->_M_header._M_data) // end() - clear(); - else - while (__first != __last) erase(__first++); - } - - void erase(const key_type* __first, const key_type* __last) { - while (__first != __last) erase(*__first++); - } - - void clear() { - if (_M_node_count != 0) { - _M_erase(_M_root()); - _M_leftmost() = &this->_M_header._M_data; - _M_root() = 0; - _M_rightmost() = &this->_M_header._M_data; - _M_node_count = 0; - } - } - -public: - // set operations: - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __k) { return iterator(_M_find(__k)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); } -private: - _STLP_TEMPLATE_FOR_CONT_EXT - _Base_ptr _M_find(const _KT& __k) const { - _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k. - _Base_ptr __x = _M_root(); // Current node. - - while (__x != 0) - if (!_M_key_compare(_S_key(__x), __k)) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - - if (__y != &this->_M_header._M_data) { - if (_M_key_compare(__k, _S_key(__y))) { - __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); - } - } - return __y; - } - - _STLP_TEMPLATE_FOR_CONT_EXT - _Base_ptr _M_lower_bound(const _KT& __k) const { - _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */ - _Base_ptr __x = _M_root(); /* Current node. */ - - while (__x != 0) - if (!_M_key_compare(_S_key(__x), __k)) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - - return __y; - } - - _STLP_TEMPLATE_FOR_CONT_EXT - _Base_ptr _M_upper_bound(const _KT& __k) const { - _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */ - _Base_ptr __x = _M_root(); /* Current node. */ - - while (__x != 0) - if (_M_key_compare(__k, _S_key(__x))) - __y = __x, __x = _S_left(__x); - else - __x = _S_right(__x); - - return __y; - } - -public: - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const { - pair __p = equal_range(__x); - return distance(__p.first, __p.second); - } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) - { return pair(lower_bound(__x), upper_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const - { return pair(lower_bound(__x), upper_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range_unique(const _KT& __x) { - pair __p; - __p.second = lower_bound(__x); - if (__p.second._M_node != &this->_M_header._M_data && - !_M_key_compare(__x, _S_key(__p.second._M_node))) { - __p.first = __p.second++; - } - else { - __p.first = __p.second; - } - return __p; - } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range_unique(const _KT& __x) const { - pair __p; - __p.second = lower_bound(__x); - if (__p.second._M_node != &this->_M_header._M_data && - !_M_key_compare(__x, _S_key(__p.second._M_node))) { - __p.first = __p.second++; - } - else { - __p.first = __p.second; - } - return __p; - } - -#if defined (_STLP_DEBUG) -public: - // Debugging. - bool __rb_verify() const; -#endif //_STLP_DEBUG -}; - -#if defined (_STLP_DEBUG) -# undef _Rb_tree -#endif - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> > - : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {}; -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_TREE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_typeinfo.h b/SDK/stlport/stl/_typeinfo.h deleted file mode 100644 index 4e602fb5..00000000 --- a/SDK/stlport/stl/_typeinfo.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_INTERNAL_TYPEINFO -#define _STLP_INTERNAL_TYPEINFO - -#if !defined (_STLP_NO_TYPEINFO) - -# if defined (_STLP_NO_NEW_NEW_HEADER) -# include -# else -# ifdef _STLP_BROKEN_BAD_CAST_CLASS -# define bad_cast _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS -# endif -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo) -# ifdef _STLP_BROKEN_BAD_CAST_CLASS -# undef bad_cast -# undef _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS -# endif -# endif - -# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) -// In .NET, actually includes -# undef _STLP_OLDSTD_typeinfo -# endif - -// if already included, do not import anything -# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \ - (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \ - defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG)) -# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET) -class bad_cast : public exception {}; -# endif - -_STLP_BEGIN_NAMESPACE -// VC 6 and eVC 4 have type_info in the global namespace -# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET) -using ::type_info; -# else -using _STLP_VENDOR_EXCEPT_STD::type_info; -# endif - -# if !(defined (__MRC__) || defined (__SC__) || defined (__DMC__)) -using _STLP_VENDOR_EXCEPT_STD::bad_typeid; -# endif - -//#if defined( __xlC__ ) && (__xlC__ < 0x500) -//# include -//struct bad_cast : exception {}; -//#endif -# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET) -using ::bad_cast; -# else -using _STLP_VENDOR_EXCEPT_STD::bad_cast; -# endif - -_STLP_END_NAMESPACE - -# endif - -#else - -# ifndef _STLP_INTERNAL_EXCEPTION -# include -# endif - -_STLP_BEGIN_NAMESPACE -# if !defined (__DMC__) -struct bad_cast : exception {}; -# endif -_STLP_END_NAMESPACE -#endif - -#endif diff --git a/SDK/stlport/stl/_uninitialized.h b/SDK/stlport/stl/_uninitialized.h deleted file mode 100644 index 5bf35781..00000000 --- a/SDK/stlport/stl/_uninitialized.h +++ /dev/null @@ -1,437 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -#define _STLP_INTERNAL_UNINITIALIZED_H - -#ifndef _STLP_INTERNAL_CSTRING -# include -#endif - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -// uninitialized_copy - -template -inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, - _OutputIter __result, _Distance*) { - _OutputIter __cur = __result; - _STLP_TRY { - for ( ; __first != __last; ++__first, ++__cur) - _Param_Construct(&*__cur, *__first); - return __cur; - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) - _STLP_RET_AFTER_THROW(__cur) -} - -template -inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, - _OutputIter __result, const input_iterator_tag &, _Distance* __d) -{ return __ucopy(__first, __last, __result, __d); } - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, - _OutputIter __result, const forward_iterator_tag &, _Distance* __d) -{ return __ucopy(__first, __last, __result, __d); } - -template -inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, - _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d) -{ return __ucopy(__first, __last, __result, __d); } -#endif - -template -inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, - _OutputIter __result, const random_access_iterator_tag &, _Distance*) { - _OutputIter __cur = __result; - _STLP_TRY { - for (_Distance __n = __last - __first; __n > 0; --__n) { - _Param_Construct(&*__cur, *__first); - ++__first; - ++__cur; - } - return __cur; - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) - _STLP_RET_AFTER_THROW(__cur) -} - -//Used internaly -template -inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result) -{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); } - -inline void* -__ucopy_trivial(const void* __first, const void* __last, void* __result) { - //dums: this version can use memcpy (__copy_trivial can't) - return (__last == __first) ? __result : - ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) + - ((const char*)__last - (const char*)__first); -} - -template -inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, - const __false_type& /*TrivialUCopy*/) -{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); } - -template -inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, - const __true_type& /*TrivialUCopy*/) { - // we know they all pointers, so this cast is OK - // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result)); - return (_OutputIter)__ucopy_trivial(__first, __last, __result); -} - -template -inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, - const __true_type& /*BothPtrType*/) { - return __ucopy_ptrs(__first, __last, __result, - _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter), - _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); -} - -template -inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, - const __false_type& /*BothPtrType*/) { - return __ucopy(__first, __last, __result, - _STLP_ITERATOR_CATEGORY(__first, _InputIter), - _STLP_DISTANCE_TYPE(__first, _InputIter)); -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline _ForwardIter -uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result) -{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); } - -inline char* -uninitialized_copy(const char* __first, const char* __last, char* __result) -{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); } - -# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97 -inline wchar_t* -uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result) -{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); } -# endif - -// uninitialized_copy_n (not part of the C++ standard) -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -_STLP_INLINE_LOOP -pair<_InputIter, _ForwardIter> -__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result, - const input_iterator_tag &) { - _ForwardIter __cur = __result; - _STLP_TRY { - for ( ; __count > 0 ; --__count, ++__first, ++__cur) - _Param_Construct(&*__cur, *__first); - return pair<_InputIter, _ForwardIter>(__first, __cur); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) - _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur))) -} - -# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline pair<_InputIter, _ForwardIterator> -__ucopy_n(_InputIter __first, _Size __count, - _ForwardIterator __result, - const forward_iterator_tag &) -{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); } - -template -inline pair<_InputIter, _ForwardIterator> -__ucopy_n(_InputIter __first, _Size __count, - _ForwardIterator __result, - const bidirectional_iterator_tag &) -{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); } -# endif - -template -inline pair<_RandomAccessIter, _ForwardIter> -__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result, - const random_access_iterator_tag &) { - _RandomAccessIter __last = __first + __count; - return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result)); -} - -// This is used internally in , which is extension itself. -template -inline pair<_InputIter, _ForwardIter> -__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result) -{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } - -#if !defined (_STLP_NO_EXTENSIONS) - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline pair<_InputIter, _ForwardIter> -uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) -{ return _STLP_PRIV __ucopy_n(__first, __count, __result); } - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#endif - -template -inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) { - _ForwardIter __cur = __first; - _STLP_TRY { - for ( ; __cur != __last; ++__cur) - _Param_Construct(&*__cur, __x); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) -} - -template -inline void __ufill(_ForwardIter __first, _ForwardIter __last, - const _Tp& __x, const input_iterator_tag &, _Distance* __d) -{ __ufill(__first, __last, __x, __d); } - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline void __ufill(_ForwardIter __first, _ForwardIter __last, - const _Tp& __x, const forward_iterator_tag &, _Distance* __d) -{ __ufill(__first, __last, __x, __d); } - -template -inline void __ufill(_ForwardIter __first, _ForwardIter __last, - const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d) -{ __ufill(__first, __last, __x, __d); } -#endif - -template -inline void __ufill(_ForwardIter __first, _ForwardIter __last, - const _Tp& __x, const random_access_iterator_tag &, _Distance*) { - _ForwardIter __cur = __first; - _STLP_TRY { - for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur) - _Param_Construct(&*__cur, __x); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) -} - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) { - _STLP_PRIV __ufill(__first, __last, __x, - _STLP_ITERATOR_CATEGORY(__first, _ForwardIter), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} - -// Specialization: for one-byte types we can use memset. -inline void uninitialized_fill(unsigned char* __first, unsigned char* __last, - const unsigned char& __val) { - unsigned char __tmp = __val; - memset(__first, __tmp, __last - __first); -} -#if !defined (_STLP_NO_SIGNED_BUILTINS) -inline void uninitialized_fill(signed char* __first, signed char* __last, - const signed char& __val) { - signed char __tmp = __val; - memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); -} -#endif -inline void uninitialized_fill(char* __first, char* __last, const char& __val) { - char __tmp = __val; - memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); -} - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) { - _ForwardIter __cur = __first; - _STLP_TRY { - for ( ; __n > 0; --__n, ++__cur) - _Param_Construct(&*__cur, __x); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) - return __cur; -} - -template -inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, - const input_iterator_tag &) -{ return __ufill_n(__first, __n, __x); } - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, - const forward_iterator_tag &) -{ return __ufill_n(__first, __n, __x); } - -template -inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, - const bidirectional_iterator_tag &) -{ return __ufill_n(__first, __n, __x); } -#endif - -template -inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) { - _ForwardIter __last = __first + __n; - __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0); - return __last; -} - -template -inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, - const random_access_iterator_tag &) -{ return __uninitialized_fill_n(__first, __n, __x); } - -/* __uninitialized_init is an internal algo to init a range with a value - * built using default constructor. It is only called with pointer as - * iterator. - */ -template -inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val, - const __false_type& /*_HasDefaultZero*/) -{ return __uninitialized_fill_n(__first, __n, __val); } - -template -inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val, - const __true_type& /*_HasDefaultZero*/) { - memset((unsigned char*)__first, 0, __n * sizeof(_Tp)); - return __first + __n; -} - -template -inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&, - const __true_type& /*_TrivialInit*/) -{ return __first + __n; } - -template -inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val, - const __false_type& /*_TrivialInit*/) -{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); } - -template -inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val) -{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); } - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline void -uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) -{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); } - -// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill, -// __uninitialized_fill_copy. - -// __uninitialized_copy_copy -// Copies [first1, last1) into [result, result + (last1 - first1)), and -// copies [first2, last2) into -// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)). - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -inline _ForwardIter -__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, - _ForwardIter __result) -{ return uninitialized_copy(__first2, __last2, uninitialized_copy(__first1, __last1, __result)); } - -// __uninitialized_fill_copy -// Fills [result, mid) with x, and copies [first, last) into -// [mid, mid + (last - first)). -template -inline _ForwardIter -__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x, - _InputIter __first, _InputIter __last) { - uninitialized_fill(__result, __mid, __x); - _STLP_TRY { - return uninitialized_copy(__first, __last, __mid); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid)) - _STLP_RET_AFTER_THROW(__result) -} - -// __uninitialized_copy_fill -// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and -// fills [first2 + (last1 - first1), last2) with x. -template -inline void -__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2, - const _Tp& __x) { - _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2); - _STLP_TRY { - uninitialized_fill(__mid2, __last2, __x); - } - _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2)) -} - -/* __uninitialized_move: - * This function is used internaly and only with pointers as iterators. - */ -template -inline _ForwardIter -__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result, - _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/) -{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); } - -template -_STLP_INLINE_LOOP -_ForwardIter -__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result, - _TrivialUCpy , const __true_type& /*_Movable*/) { - //Move constructor should not throw so we do not need to take care of exceptions here. - for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) { - _Move_Construct(&*__result, *__first); - ++__first; ++__result; - } - return __result; -} - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_UNINITIALIZED_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_unordered_map.h b/SDK/stlport/stl/_unordered_map.h deleted file mode 100644 index 3ad328db..00000000 --- a/SDK/stlport/stl/_unordered_map.h +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_UNORDERED_MAP_H -#define _STLP_INTERNAL_UNORDERED_MAP_H - -#ifndef _STLP_INTERNAL_HASHTABLE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class unordered_map -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ -private: - typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; -public: - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; -#if !defined (__DMC__) - typedef pair value_type; -#else - typedef pair value_type; -#endif -private: - //Specific iterator traits creation - typedef _STLP_PRIV _UnorderedMapTraitsT _UnorderedMapTraits; - -public: - typedef hashtable _Ht; - - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - typedef typename _Ht::local_iterator local_iterator; - typedef typename _Ht::const_local_iterator const_local_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_function() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - explicit unordered_map(size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - unordered_map(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - unordered_map(_InputIterator __f, _InputIterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#else - unordered_map(const value_type* __f, const value_type* __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - unordered_map(const_iterator __f, const_iterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - - _Self& operator = (const _Self& __other) - { _M_ht = __other._M_ht; return *this; } - - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - - pair insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } - iterator insert(const_iterator /*__hint*/, const value_type& __obj) - { return _M_ht.insert_unique(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) -#else - void insert(const value_type* __f, const value_type* __l) - { _M_ht.insert_unique(__f,__l); } - void insert(const_iterator __f, const_iterator __l) -#endif /*_STLP_MEMBER_TEMPLATES */ - { _M_ht.insert_unique(__f, __l); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - _Tp& operator[](const _KT& __key) { - iterator __it = _M_ht.find(__key); - return (__it == _M_ht.end() ? - _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second : - (*__it).second ); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - size_type erase(const key_type& __key) {return _M_ht.erase(__key); } - void erase(const_iterator __it) { _M_ht.erase(__it); } - void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } - local_iterator begin(size_type __n) { return _M_ht.begin(__n); } - local_iterator end(size_type __n) { return _M_ht.end(__n); } - const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } - const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } - - float load_factor() const { return _M_ht.load_factor(); } - float max_load_factor() const { return _M_ht.max_load_factor(); } - void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } - void rehash(size_type __hint) { _M_ht.rehash(__hint); } -}; - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), - _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > -class unordered_multimap -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ -private: - typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; -public: - typedef _Key key_type; - typedef _Tp data_type; - typedef _Tp mapped_type; -#if !defined (__DMC__) - typedef pair value_type; -#else - typedef pair value_type; -#endif -private: - //Specific iterator traits creation - typedef _STLP_PRIV _UnorderedMultimapTraitsT _UnorderedMultimapTraits; - -public: - typedef hashtable _Ht; - - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - typedef typename _Ht::local_iterator local_iterator; - typedef typename _Ht::const_local_iterator const_local_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_function() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - explicit unordered_multimap(size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - unordered_multimap(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - unordered_multimap(_InputIterator __f, _InputIterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#else - unordered_multimap(const value_type* __f, const value_type* __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - unordered_multimap(const_iterator __f, const_iterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - - _Self& operator = (const _Self& __other) - { _M_ht = __other._M_ht; return *this; } - - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - - iterator insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - iterator insert(const_iterator /*__hint*/, const value_type& __obj) - { return _M_ht.insert_equal(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) -#else - void insert(const value_type* __f, const value_type* __l) - { _M_ht.insert_equal(__f,__l); } - void insert(const_iterator __f, const_iterator __l) -#endif /*_STLP_MEMBER_TEMPLATES */ - { _M_ht.insert_equal(__f, __l); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - size_type erase(const key_type& __key) {return _M_ht.erase(__key); } - void erase(const_iterator __it) { _M_ht.erase(__it); } - void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } - local_iterator begin(size_type __n) { return _M_ht.begin(__n); } - local_iterator end(size_type __n) { return _M_ht.end(__n); } - const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } - const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } - - float load_factor() const { return _M_ht.load_factor(); } - float max_load_factor() const { return _M_ht.max_load_factor(); } - void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } - void rehash(size_type __hint) { _M_ht.rehash(__hint); } -}; - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> - -#include - -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> - -#include - -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -// Specialization of insert_iterator so that it will work for unordered_map -// and unordered_multimap. - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_help::_Ht> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_help::_Ht> -{}; - -template -class insert_iterator > { -protected: - typedef unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; - _Container* container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; - -template -class insert_iterator > { -protected: - typedef unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; - _Container* container; - typename _Container::iterator iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; - -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_unordered_set.h b/SDK/stlport/stl/_unordered_set.h deleted file mode 100644 index bcd662db..00000000 --- a/SDK/stlport/stl/_unordered_set.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_UNORDERED_SET_H -#define _STLP_INTERNAL_UNORDERED_SET_H - -#ifndef _STLP_INTERNAL_HASHTABLE_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > -class unordered_set -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self; - //Specific iterator traits creation - typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits; -public: - typedef hashtable<_Value, _Value, _HashFcn, - _UnorderedSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; -public: - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - typedef typename _Ht::local_iterator local_iterator; - typedef typename _Ht::const_local_iterator const_local_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_function() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - explicit unordered_set(size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - unordered_set(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - unordered_set(_InputIterator __f, _InputIterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#else - unordered_set(const value_type* __f, const value_type* __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } - - unordered_set(const_iterator __f, const_iterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_unique(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - - _Self& operator = (const _Self& __other) - { _M_ht = __other._M_ht; return *this; } - - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - - pair insert(const value_type& __obj) - { return _M_ht.insert_unique(__obj); } - iterator insert(const_iterator /*__hint*/, const value_type& __obj) - { return _M_ht.insert_unique(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) -#else - void insert(const_iterator __f, const_iterator __l) - {_M_ht.insert_unique(__f, __l); } - void insert(const value_type* __f, const value_type* __l) -#endif - { _M_ht.insert_unique(__f,__l); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - size_type erase(const key_type& __key) {return _M_ht.erase(__key); } - void erase(const_iterator __it) { _M_ht.erase(__it); } - void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } - local_iterator begin(size_type __n) { return _M_ht.begin(__n); } - local_iterator end(size_type __n) { return _M_ht.end(__n); } - const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } - const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } - - float load_factor() const { return _M_ht.load_factor(); } - float max_load_factor() const { return _M_ht.max_load_factor(); } - void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } - void rehash(size_type __hint) { _M_ht.rehash(__hint); } -}; - -//Specific iterator traits creation -_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits) - -template ), - _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > -class unordered_multiset -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self; - //Specific iterator traits creation - typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits; -public: - typedef hashtable<_Value, _Value, _HashFcn, - _UnorderedMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; - - typedef typename _Ht::key_type key_type; - typedef typename _Ht::value_type value_type; - typedef typename _Ht::hasher hasher; - typedef typename _Ht::key_equal key_equal; - - typedef typename _Ht::size_type size_type; - typedef typename _Ht::difference_type difference_type; - typedef typename _Ht::pointer pointer; - typedef typename _Ht::const_pointer const_pointer; - typedef typename _Ht::reference reference; - typedef typename _Ht::const_reference const_reference; - - typedef typename _Ht::iterator iterator; - typedef typename _Ht::const_iterator const_iterator; - typedef typename _Ht::local_iterator local_iterator; - typedef typename _Ht::const_local_iterator const_local_iterator; - - typedef typename _Ht::allocator_type allocator_type; - - hasher hash_function() const { return _M_ht.hash_funct(); } - key_equal key_eq() const { return _M_ht.key_eq(); } - allocator_type get_allocator() const { return _M_ht.get_allocator(); } - -private: - _Ht _M_ht; - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - explicit unordered_multiset(size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) {} - - unordered_multiset(__move_source<_Self> src) - : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - unordered_multiset(_InputIterator __f, _InputIterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#else - unordered_multiset(const value_type* __f, const value_type* __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } - - unordered_multiset(const_iterator __f, const_iterator __l, - size_type __n = 100, const hasher& __hf = hasher(), - const key_equal& __eql = key_equal(), - const allocator_type& __a = allocator_type()) - : _M_ht(__n, __hf, __eql, __a) - { _M_ht.insert_equal(__f, __l); } -#endif /*_STLP_MEMBER_TEMPLATES */ - - _Self& operator = (const _Self& __other) - { _M_ht = __other._M_ht; return *this; } - - size_type size() const { return _M_ht.size(); } - size_type max_size() const { return _M_ht.max_size(); } - bool empty() const { return _M_ht.empty(); } - void swap(_Self& hs) { _M_ht.swap(hs._M_ht); } - - iterator begin() { return _M_ht.begin(); } - iterator end() { return _M_ht.end(); } - const_iterator begin() const { return _M_ht.begin(); } - const_iterator end() const { return _M_ht.end(); } - - iterator insert(const value_type& __obj) - { return _M_ht.insert_equal(__obj); } - iterator insert(const_iterator /*__hint*/, const value_type& __obj) - { return _M_ht.insert_equal(__obj); } -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __f, _InputIterator __l) -#else - void insert(const value_type* __f, const value_type* __l) - { _M_ht.insert_equal(__f,__l); } - void insert(const_iterator __f, const_iterator __l) -#endif /*_STLP_MEMBER_TEMPLATES */ - { _M_ht.insert_equal(__f, __l); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) { return _M_ht.find(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_ht.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) - { return _M_ht.equal_range(__key); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const - { return _M_ht.equal_range(__key); } - - size_type erase(const key_type& __key) {return _M_ht.erase(__key); } - void erase(const_iterator __it) { _M_ht.erase(__it); } - void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } - void clear() { _M_ht.clear(); } - - size_type bucket_count() const { return _M_ht.bucket_count(); } - size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } - size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } - local_iterator begin(size_type __n) { return _M_ht.begin(__n); } - local_iterator end(size_type __n) { return _M_ht.end(__n); } - const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } - const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } - - float load_factor() const { return _M_ht.load_factor(); } - float max_load_factor() const { return _M_ht.max_load_factor(); } - void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } - void rehash(size_type __hint) { _M_ht.rehash(__hint); } -}; - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc> - -#include - -#undef _STLP_TEMPLATE_CONTAINER -#define _STLP_TEMPLATE_CONTAINER unordered_multiset<_Value,_HashFcn,_EqualKey,_Alloc> -#include - -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -// Specialization of insert_iterator so that it will work for unordered_set -// and unordered_multiset. - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Ht> -{}; - -template -struct __move_traits > : - _STLP_PRIV __move_traits_aux::_Ht> -{}; - -template -class insert_iterator > { -protected: - typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; - _Container* container; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; - -template -class insert_iterator > { -protected: - typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; - _Container* container; - typename _Container::iterator iter; -public: - typedef _Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(_Container& __x) : container(&__x) {} - insert_iterator(_Container& __x, typename _Container::iterator) - : container(&__x) {} - insert_iterator<_Container>& - operator=(const typename _Container::value_type& __val) { - container->insert(__val); - return *this; - } - insert_iterator<_Container>& operator*() { return *this; } - insert_iterator<_Container>& operator++() { return *this; } - insert_iterator<_Container>& operator++(int) { return *this; } -}; -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_INTERNAL_UNORDERED_SET_H */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/stl/_valarray.c b/SDK/stlport/stl/_valarray.c deleted file mode 100644 index c841a436..00000000 --- a/SDK/stlport/stl/_valarray.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_VALARRAY_C -#define _STLP_VALARRAY_C - -#ifndef _STLP_VALARRAY_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template -_Valarray_bool valarray<_Tp>:: operator!() const { - _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < this->size(); ++__i) - __tmp[__i] = !(*this)[__i]; - return __tmp; -} - -// Behavior is undefined if __x and *this have different sizes -template -valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x) -{ - size_t __index = __x._M_slice.start(); - for (size_t __i = 0; - __i < __x._M_slice.size(); - ++__i, __index += __x._M_slice.stride()) - (*this)[__i] = __x._M_array[__index]; - return *this; -} - -template -valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const { - valarray<_Tp> __tmp(__slice.size(), _NoInit()); - size_t __index = __slice.start(); - for (size_t __i = 0; - __i < __slice.size(); - ++__i, __index += __slice.stride()) - __tmp[__i] = (*this)[__index]; - return __tmp; -} - -template -bool _Gslice_Iter_tmpl<_Size>::_M_incr() { - size_t __dim = _M_indices.size() - 1; - ++_M_step; - for (;;) { - _M_1d_idx += _M_gslice._M_strides[__dim]; - if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim]) - return true; - else if (__dim != 0) { - _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim]; - _M_indices[__dim] = 0; - --__dim; - } - else - return false; - } -} - -// Behavior is undefined if __x and *this have different sizes, or if -// __x was constructed from a degenerate gslice. -template -valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x) -{ - if (this->size() != 0) { - _Gslice_Iter __i(__x._M_gslice); - do - (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx]; - while(__i._M_incr()); - } - return *this; -} - -template -valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const -{ - valarray<_Tp> __tmp(__slice._M_size(), _NoInit()); - if (__tmp.size() != 0) { - _Gslice_Iter __i(__slice); - do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr()); - } - return __tmp; -} - -template -valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const -{ - size_t _p_size = 0; - { - for (size_t __i = 0; __i < __mask.size(); ++__i) - if (__mask[__i]) ++_p_size; - } - - valarray<_Tp> __tmp(_p_size, _NoInit()); - size_t __idx = 0; - { - for (size_t __i = 0; __i < __mask.size(); ++__i) - if (__mask[__i]) __tmp[__idx++] = (*this)[__i]; - } - - return __tmp; -} - -template -valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) { - for (size_t __i = 0; __i < __x._M_addr.size(); ++__i) - (*this)[__i] = __x._M_array[__x._M_addr[__i]]; - return *this; -} - -template -valarray<_Tp> -valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const -{ - valarray<_Tp> __tmp(__addr.size(), _NoInit()); - for (size_t __i = 0; __i < __addr.size(); ++__i) - __tmp[__i] = (*this)[__addr[__i]]; - return __tmp; -} - -//---------------------------------------------------------------------- -// Other valarray noninline member functions - -// Shift and cshift - -template -valarray<_Tp> valarray<_Tp>::shift(int __n) const -{ - valarray<_Tp> __tmp(this->size()); - - if (__n >= 0) { - if (__n < this->size()) - copy(this->_M_first + __n, this->_M_first + this->size(), - __tmp._M_first); - } - else { - if (-__n < this->size()) - copy(this->_M_first, this->_M_first + this->size() + __n, - __tmp._M_first - __n); - } - return __tmp; -} - -template -valarray<_Tp> valarray<_Tp>::cshift(int __m) const -{ - valarray<_Tp> __tmp(this->size()); - - // Reduce __m to an equivalent number in the range [0, size()). We - // have to be careful with negative numbers, since the sign of a % b - // is unspecified when a < 0. - long __n = __m; - if (this->size() < (numeric_limits::max)()) - __n %= long(this->size()); - if (__n < 0) - __n += this->size(); - - copy(this->_M_first, this->_M_first + __n, - __tmp._M_first + (this->size() - __n)); - copy(this->_M_first + __n, this->_M_first + this->size(), - __tmp._M_first); - - return __tmp; -} - -_STLP_END_NAMESPACE - -#endif /* _STLP_VALARRAY_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_valarray.h b/SDK/stlport/stl/_valarray.h deleted file mode 100644 index 037c5b96..00000000 --- a/SDK/stlport/stl/_valarray.h +++ /dev/null @@ -1,1665 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_VALARRAY_H -#define _STLP_VALARRAY_H - -#ifndef _STLP_INTERNAL_CMATH -# include -#endif - -#ifndef _STLP_INTERNAL_NEW -# include -#endif - -#ifndef _STLP_INTERNAL_ALGO_H -# include -#endif - -#ifndef _STLP_INTERNAL_NUMERIC_H -# include -#endif - -#ifndef _STLP_INTERNAL_LIMITS -# include -#endif - -/* As we only need the _STLP_ASSERT macro from _debug.h we test it to include _debug.h */ -#ifndef _STLP_ASSERT -# include -#endif - -_STLP_BEGIN_NAMESPACE - -class slice; -class gslice; - -template class valarray; -typedef valarray _Valarray_bool; -typedef valarray _Valarray_size_t; - -template class slice_array; -template class gslice_array; -template class mask_array; -template class indirect_array; - -//---------------------------------------------------------------------- -// class valarray - -// Base class to handle memory allocation and deallocation. We can't just -// use vector<>, because vector would be unsuitable as an internal -// representation for valarray. - -template -struct _Valarray_base -{ - _Tp* _M_first; - size_t _M_size; - - _Valarray_base() : _M_first(0), _M_size(0) {} - _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); } - ~_Valarray_base() { _M_deallocate(); } - - void _M_allocate(size_t __n) { - if (__n != 0) { - _M_first = __STATIC_CAST(_Tp*, (malloc(__n * sizeof(_Tp)))); - _M_size = __n; -#if !defined(_STLP_NO_BAD_ALLOC) && defined(_STLP_USE_EXCEPTIONS) - if (_M_first == 0) { - _M_size = 0; - throw _STLP_STD::bad_alloc(); - } -#endif - } - else { - _M_first = 0; - _M_size = 0; - } - } - - void _M_deallocate() { - free(_M_first); - _M_first = 0; - _M_size = 0; - } -}; - -template -class valarray : private _Valarray_base<_Tp> -{ - friend class gslice; - -public: - typedef _Tp value_type; - - // Basic constructors - valarray() : _Valarray_base<_Tp>() {} - explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n) - { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); } - valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n) - { uninitialized_fill_n(this->_M_first, this->_M_size, __x); } - valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n) - { uninitialized_copy(__p, __p + __n, this->_M_first); } - valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) { - uninitialized_copy(__x._M_first, __x._M_first + __x._M_size, - this->_M_first); - } - - // Constructors from auxiliary array types - valarray(const slice_array<_Tp>&); - valarray(const gslice_array<_Tp>&); - valarray(const mask_array<_Tp>&); - valarray(const indirect_array<_Tp>&); - - // Destructor - ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); } - - // Extension: constructor that doesn't initialize valarray elements to a - // specific value. This is faster for types such as int and double. -private: - void _M_initialize(const __true_type&) {} - void _M_initialize(const __false_type&) - { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } - -public: - struct _NoInit {}; - valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) { - typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial; - _M_initialize(_Is_Trivial()); - } - -public: // Assignment - // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size() - valarray<_Tp>& operator=(const valarray<_Tp>& __x) { - _STLP_ASSERT(__x.size() == this->size()) - if (this != &__x) - copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first); - return *this; - } - - // Scalar assignment - valarray<_Tp>& operator=(const value_type& __x) { - fill_n(this->_M_first, this->_M_size, __x); - return *this; - } - - // Assignment of auxiliary array types - valarray<_Tp>& operator=(const slice_array<_Tp>&); - valarray<_Tp>& operator=(const gslice_array<_Tp>&); - valarray<_Tp>& operator=(const mask_array<_Tp>&); - valarray<_Tp>& operator=(const indirect_array<_Tp>&); - -public: // Element access - value_type operator[](size_t __n) const { return this->_M_first[__n]; } - value_type& operator[](size_t __n) { return this->_M_first[__n]; } - size_t size() const { return this->_M_size; } - -public: // Subsetting operations with auxiliary type - valarray<_Tp> operator[](slice) const; - slice_array<_Tp> operator[](slice); - valarray<_Tp> operator[](const gslice&) const; - gslice_array<_Tp> operator[](const gslice&); - valarray<_Tp> operator[](const _Valarray_bool&) const; - mask_array<_Tp> operator[](const _Valarray_bool&); - valarray<_Tp> operator[](const _Valarray_size_t&) const; - indirect_array<_Tp> operator[](const _Valarray_size_t&); - -public: // Unary operators. - valarray<_Tp> operator+() const { return *this; } - - valarray<_Tp> operator-() const { - valarray<_Tp> __tmp(this->size(), _NoInit()); - for (size_t __i = 0; __i < this->size(); ++__i) - __tmp[__i] = -(*this)[__i]; - return __tmp; - } - - valarray<_Tp> operator~() const { - valarray<_Tp> __tmp(this->size(), _NoInit()); - for (size_t __i = 0; __i < this->size(); ++__i) - __tmp[__i] = ~(*this)[__i]; - return __tmp; - } - - _Valarray_bool operator!() const; - -public: // Scalar computed assignment. - valarray<_Tp>& operator*= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] *= __x; - return *this; - } - - valarray<_Tp>& operator/= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] /= __x; - return *this; - } - - valarray<_Tp>& operator%= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] %= __x; - return *this; - } - - valarray<_Tp>& operator+= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] += __x; - return *this; - } - - valarray<_Tp>& operator-= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] -= __x; - return *this; - } - - valarray<_Tp>& operator^= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] ^= __x; - return *this; - } - - valarray<_Tp>& operator&= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] &= __x; - return *this; - } - - valarray<_Tp>& operator|= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] |= __x; - return *this; - } - - valarray<_Tp>& operator<<= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] <<= __x; - return *this; - } - - valarray<_Tp>& operator>>= (const value_type& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] >>= __x; - return *this; - } - -public: // Array computed assignment. - valarray<_Tp>& operator*= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] *= __x[__i]; - return *this; - } - - valarray<_Tp>& operator/= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] /= __x[__i]; - return *this; - } - - valarray<_Tp>& operator%= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] %= __x[__i]; - return *this; - } - - valarray<_Tp>& operator+= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] += __x[__i]; - return *this; - } - - valarray<_Tp>& operator-= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] -= __x[__i]; - return *this; - } - - valarray<_Tp>& operator^= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] ^= __x[__i]; - return *this; - } - - valarray<_Tp>& operator&= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] &= __x[__i]; - return *this; - } - - valarray<_Tp>& operator|= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] |= __x[__i]; - return *this; - } - - valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] <<= __x[__i]; - return *this; - } - - valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) { - for (size_t __i = 0; __i < this->size(); ++__i) - (*this)[__i] >>= __x[__i]; - return *this; - } - -public: // Other member functions. - - // The result is undefined for zero-length arrays - value_type sum() const { - return accumulate(this->_M_first + 1, this->_M_first + this->_M_size, - (*this)[0]); - } - - // The result is undefined for zero-length arrays - value_type (min) () const { - return *min_element(this->_M_first + 0, this->_M_first + this->_M_size); - } - - value_type (max) () const { - return *max_element(this->_M_first + 0, this->_M_first + this->_M_size); - } - - valarray<_Tp> shift(int __n) const; - valarray<_Tp> cshift(int __n) const; - - valarray<_Tp> apply(value_type __f(value_type)) const { - valarray<_Tp> __tmp(this->size()); - transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first, - __f); - return __tmp; - } - valarray<_Tp> apply(value_type __f(const value_type&)) const { - valarray<_Tp> __tmp(this->size()); - transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first, - __f); - return __tmp; - } - - void resize(size_t __n, value_type __x = value_type()) { - _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); - _Valarray_base<_Tp>::_M_deallocate(); - _Valarray_base<_Tp>::_M_allocate(__n); - uninitialized_fill_n(this->_M_first, this->_M_size, __x); - } -}; - -//---------------------------------------------------------------------- -// valarray non-member functions. - -// Binary arithmetic operations between two arrays. Behavior is -// undefined if the two arrays do not have the same length. - -template -inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] * __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] / __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] % __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] + __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] - __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] ^ __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] & __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] | __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] << __y[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] >> __y[__i]; - return __tmp; -} - -// Binary arithmetic operations between an array and a scalar. - -template -inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] * __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c * __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] / __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c / __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] % __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c % __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] + __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c + __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] - __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c - __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] ^ __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c ^ __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] & __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c & __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] | __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c | __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] << __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c << __x[__i]; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] >> __c; - return __tmp; -} - -template -inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c >> __x[__i]; - return __tmp; -} - -// Binary logical operations between two arrays. Behavior is undefined -// if the two arrays have different lengths. Note that operator== does -// not do what you might at first expect. - -template -inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] == __y[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] < __y[__i]; - return __tmp; -} - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE - -template -inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] != __y[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] > __y[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] <= __y[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] >= __y[__i]; - return __tmp; -} - -#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ -// fbp : swap ? - -template -inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] && __y[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] || __y[__i]; - return __tmp; -} - -// Logical operations between an array and a scalar. - -template -inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] == __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c == __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] != __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c != __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] < __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c < __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] > __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c > __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] <= __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c <= __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] >= __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c >= __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] && __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c && __x[__i]; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __x[__i] || __c; - return __tmp; -} - -template -inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x) -{ - _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = __c || __x[__i]; - return __tmp; -} - -// valarray "transcendentals" (the list includes abs and sqrt, which, -// of course, are not transcendental). - -template -inline valarray<_Tp> abs(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::abs(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> acos(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::acos(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> asin(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::asin(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> atan(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::atan(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> atan2(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::atan2(__x[__i], __y[__i]); - return __tmp; -} - -template -inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::atan2(__x[__i], __c); - return __tmp; -} - -template -inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::atan2(__c, __x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> cos(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::cos(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> cosh(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::cosh(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> exp(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::exp(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> log(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::log(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> log10(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::log10(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> pow(const valarray<_Tp>& __x, - const valarray<_Tp>& __y) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::pow(__x[__i], __y[__i]); - return __tmp; -} - -template -inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::pow(__x[__i], __c); - return __tmp; -} - -template -inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::pow(__c, __x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> sin(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::sin(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> sinh(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::sinh(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::sqrt(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> tan(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::tan(__x[__i]); - return __tmp; -} - -template -inline valarray<_Tp> tanh(const valarray<_Tp>& __x) { - typedef typename valarray<_Tp>::_NoInit _NoInit; - valarray<_Tp> __tmp(__x.size(), _NoInit()); - for (size_t __i = 0; __i < __x.size(); ++__i) - __tmp[__i] = ::tanh(__x[__i]); - return __tmp; -} - -//---------------------------------------------------------------------- -// slice and slice_array - -class slice { -public: - slice() : _M_start(0), _M_length(0), _M_stride(0) {} - slice(size_t __start, size_t __length, size_t __stride) - : _M_start(__start), _M_length(__length), _M_stride(__stride) - {} - __TRIVIAL_DESTRUCTOR(slice) - - size_t start() const { return _M_start; } - size_t size() const { return _M_length; } - size_t stride() const { return _M_stride; } - -private: - size_t _M_start; - size_t _M_length; - size_t _M_stride; -}; - -template -class slice_array { - friend class valarray<_Tp>; -public: - typedef _Tp value_type; - - void operator=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] = __x[__i]; - } - - void operator*=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] *= __x[__i]; - } - - void operator/=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] /= __x[__i]; - } - - void operator%=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] %= __x[__i]; - } - - void operator+=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] += __x[__i]; - } - - void operator-=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] -= __x[__i]; - } - - void operator^=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] ^= __x[__i]; - } - - void operator&=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] &= __x[__i]; - } - - void operator|=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] |= __x[__i]; - } - - void operator<<=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] <<= __x[__i]; - } - - void operator>>=(const valarray& __x) const { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] >>= __x[__i]; - } - - void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ { - size_t __index = _M_slice.start(); - for (size_t __i = 0; - __i < _M_slice.size(); - ++__i, __index += _M_slice.stride()) - _M_array[__index] = __c; - } - - ~slice_array() {} - -private: - slice_array(const slice& __slice, valarray<_Tp>& __array) - : _M_slice(__slice), _M_array(__array) - {} - - slice _M_slice; - valarray<_Tp>& _M_array; - -private: // Disable assignment and default constructor - slice_array(); - slice_array(const slice_array&); - slice_array& operator=(const slice_array&); -}; - -// valarray member functions dealing with slice and slice_array - -template -inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x) - : _Valarray_base<_Tp>(__x._M_slice.size()) { - typedef typename __type_traits<_Tp>::has_trivial_default_constructor - _Is_Trivial; - _M_initialize(_Is_Trivial()); - *this = __x; -} - - -template -inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice) { - return slice_array<_Tp>(__slice, *this); -} - -//---------------------------------------------------------------------- -// gslice and gslice_array - -template -struct _Gslice_Iter_tmpl; - -class gslice { - friend struct _Gslice_Iter_tmpl; -public: - gslice() : _M_start(0), _M_lengths(0), _M_strides(0) {} - gslice(size_t __start, - const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides) - : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides) - {} - __TRIVIAL_DESTRUCTOR(gslice) - - size_t start() const { return _M_start; } - _Valarray_size_t size() const { return _M_lengths; } - _Valarray_size_t stride() const { return _M_strides; } - - // Extension: check for an empty gslice. - bool _M_empty() const { return _M_lengths.size() == 0; } - - // Extension: number of indices this gslice represents. (For a degenerate - // gslice, they're not necessarily all distinct.) - size_t _M_size() const { - return !this->_M_empty() - ? accumulate(_M_lengths._M_first + 1, - _M_lengths._M_first + _M_lengths._M_size, - _M_lengths[0], - multiplies()) - : 0; - } - -# ifndef __HP_aCC -private: -# endif - - size_t _M_start; - _Valarray_size_t _M_lengths; - _Valarray_size_t _M_strides; -}; - -// This is not an STL iterator. It is constructed from a gslice, and it -// steps through the gslice indices in sequence. See 23.3.6 of the C++ -// standard, paragraphs 2-3, for an explanation of the sequence. At -// each step we get two things: the ordinal (i.e. number of steps taken), -// and the one-dimensional index. - -template -struct _Gslice_Iter_tmpl { - _Gslice_Iter_tmpl(const gslice& __gslice) - : _M_step(0), _M_1d_idx(__gslice.start()), - _M_indices(size_t(0), __gslice._M_lengths.size()), - _M_gslice(__gslice) - {} - - bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; } - - bool _M_incr(); - - _Size _M_step; - _Size _M_1d_idx; - - valarray<_Size> _M_indices; - const gslice& _M_gslice; -}; - -typedef _Gslice_Iter_tmpl _Gslice_Iter; - -template -class gslice_array { - friend class valarray<_Tp>; -public: - typedef _Tp value_type; - - void operator= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator*= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator/= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator%= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator+= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator-= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator^= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator&= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator|= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator<<= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator>>= (const valarray& __x) const { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr()); - } - } - - void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ { - if (!_M_gslice._M_empty()) { - _Gslice_Iter __i(_M_gslice); - do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr()); - } - } - - ~gslice_array() {} - -private: - gslice_array(const gslice& __gslice, valarray<_Tp>& __array) - : _M_gslice(__gslice), _M_array(__array) - {} - - gslice _M_gslice; - valarray& _M_array; - -private: // Disable assignment - void operator=(const gslice_array<_Tp>&); -}; - -// valarray member functions dealing with gslice and gslice_array. Note -// that it is illegal (behavior is undefined) to construct a gslice_array -// from a degenerate gslice. - -template -inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x) - : _Valarray_base<_Tp>(__x._M_gslice._M_size()) { - typedef typename __type_traits<_Tp>::has_trivial_default_constructor - _Is_Trivial; - _M_initialize(_Is_Trivial()); - *this = __x; -} - -template -inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice) { - return gslice_array<_Tp>(__slice, *this); -} - - -//---------------------------------------------------------------------- -// mask_array - -template -class mask_array { - friend class valarray<_Tp>; -public: - typedef _Tp value_type; - - void operator=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] = __x[__idx++]; - } - - void operator*=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] *= __x[__idx++]; - } - - void operator/=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] /= __x[__idx++]; - } - - void operator%=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] %= __x[__idx++]; - } - - void operator+=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] += __x[__idx++]; - } - - void operator-=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] -= __x[__idx++]; - } - - void operator^=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++]; - } - - void operator&=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] &= __x[__idx++]; - } - - void operator|=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] |= __x[__idx++]; - } - - void operator<<=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++]; - } - - void operator>>=(const valarray& __x) const { - size_t __idx = 0; - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++]; - } - - void operator=(const value_type& __c) const { - for (size_t __i = 0; __i < _M_array.size(); ++__i) - if (_M_mask[__i]) _M_array[__i] = __c; - } - - ~mask_array() {} - - // Extension: number of true values in the mask - size_t _M_num_true() const { - size_t __result = 0; - for (size_t __i = 0; __i < _M_mask.size(); ++__i) - if (_M_mask[__i]) ++__result; - return __result; - } - -private: - mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array) - : _M_mask(__mask), _M_array(__array) - {} - - _Valarray_bool _M_mask; - valarray<_Tp>& _M_array; - -private: // Disable assignment - void operator=(const mask_array<_Tp>&); -}; - -// valarray member functions dealing with mask_array - -template -inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x) - : _Valarray_base<_Tp>(__x._M_num_true()) -{ - typedef typename __type_traits<_Tp>::has_trivial_default_constructor - _Is_Trivial; - _M_initialize(_Is_Trivial()); - *this = __x; -} - -// Behavior is undefined if __x._M_num_true() != this->size() -template -inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) { - size_t __idx = 0; - for (size_t __i = 0; __i < __x._M_array.size(); ++__i) - if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i]; - return *this; -} - -template -inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) -{ - return mask_array<_Tp>(__mask, *this); -} - - -//---------------------------------------------------------------------- -// indirect_array - -template -class indirect_array { - friend class valarray<_Tp>; -public: - typedef _Tp value_type; - - void operator=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] = __x[__i]; - } - - void operator*=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] *= __x[__i]; - } - - void operator/=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] /= __x[__i]; - } - - void operator%=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] %= __x[__i]; - } - - void operator+=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] += __x[__i]; - } - - void operator-=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] -= __x[__i]; - } - - void operator^=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] ^= __x[__i]; - } - - void operator&=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] &= __x[__i]; - } - - void operator|=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] |= __x[__i]; - } - - void operator<<=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] <<= __x[__i]; - } - - void operator>>=(const valarray& __x) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] >>= __x[__i]; - } - - void operator=(const value_type& __c) const { - for (size_t __i = 0; __i < _M_addr.size(); ++__i) - _M_array[_M_addr[__i]] = __c; - } - - ~indirect_array() {} - -private: - indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array) - : _M_addr(__addr), _M_array(__array) - {} - - _Valarray_size_t _M_addr; - valarray<_Tp>& _M_array; - -private: // Disable assignment - void operator=(const indirect_array<_Tp>&); -}; - -// valarray member functions dealing with indirect_array - -template -inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x) - : _Valarray_base<_Tp>(__x._M_addr.size()) -{ - typedef typename __type_traits<_Tp>::has_trivial_default_constructor - _Is_Trivial; - _M_initialize(_Is_Trivial()); - *this = __x; -} - - -template -inline indirect_array<_Tp> -valarray<_Tp>::operator[](const _Valarray_size_t& __addr) -{ - return indirect_array<_Tp>(__addr, *this); -} - -_STLP_END_NAMESPACE - -# if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -# endif - -#endif /* _STLP_VALARRAY */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_vector.c b/SDK/stlport/stl/_vector.c deleted file mode 100644 index c46a23eb..00000000 --- a/SDK/stlport/stl/_vector.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_VECTOR_C -#define _STLP_VECTOR_C - -#if !defined (_STLP_INTERNAL_VECTOR_H) -# include -#endif - -#include - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const { - __stl_throw_length_error("vector"); -} - -template -void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const { - __stl_throw_out_of_range("vector"); -} - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define vector _STLP_PTR_IMPL_NAME(vector) -#elif defined (_STLP_DEBUG) -# define vector _STLP_NON_DBG_NAME(vector) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -# define __iterator__ _Tp* -#else -# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator -#endif - -template -void vector<_Tp, _Alloc>::reserve(size_type __n) { - if (capacity() < __n) { - if (max_size() < __n) { - this->_M_throw_length_error(); - } - - const size_type __old_size = size(); - pointer __tmp; - if (this->_M_start) { - __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish); - _M_clear(); - } else { - __tmp = this->_M_end_of_storage.allocate(__n, __n); - } - _M_set(__tmp, __tmp + __old_size, __tmp + __n); - } -} - -template -void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/, - size_type __fill_len, bool __atend ) { - const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __fill_len); - - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable()); - // handle insertion - if (__fill_len == 1) { - _Copy_Construct(__new_finish, __x); - ++__new_finish; - } else - __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x); - if (!__atend) - __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - _M_clear_after_move(); - _M_set(__new_start, __new_finish, __new_start + __len); -} - -template -void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/, - size_type __fill_len, bool __atend ) { - const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __fill_len); - - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start)); - // handle insertion - __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x); - if (!__atend) - __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder - _M_clear(); - _M_set(__new_start, __new_finish, __new_start + __len); -} - -template -void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, - const _Tp& __x, const __true_type& /*_Movable*/) { - if (_M_is_inside(__x)) { - _Tp __x_copy = __x; - _M_fill_insert_aux(__pos, __n, __x_copy, __true_type()); - return; - } - iterator __src = this->_M_finish - 1; - iterator __dst = __src + __n; - for (; __src >= __pos; --__dst, --__src) { - _STLP_STD::_Move_Construct(__dst, *__src); - _STLP_STD::_Destroy_Moved(__src); - } - _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x); - this->_M_finish += __n; -} - -template -void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n, - const _Tp& __x, const __false_type& /*_Movable*/) { - //Here self referencing needs to be checked even for non movable types. - if (_M_is_inside(__x)) { - _Tp __x_copy = __x; - _M_fill_insert_aux(__pos, __n, __x_copy, __false_type()); - return; - } - const size_type __elems_after = this->_M_finish - __pos; - pointer __old_finish = this->_M_finish; - if (__elems_after > __n) { - _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy()); - this->_M_finish += __n; - _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy()); - _STLP_STD::fill(__pos, __pos + __n, __x); - } else { - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x); - _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy()); - this->_M_finish += __elems_after; - _STLP_STD::fill(__pos, __old_finish, __x); - } -} - -template -void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos, - size_type __n, const _Tp& __x) { - if (__n != 0) { - if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) { - _M_fill_insert_aux(__pos, __n, __x, _Movable()); - } else - _M_insert_overflow(__pos, __x, _TrivialCopy(), __n); - } -} - -template -vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) { - if (&__x != this) { - const size_type __xlen = __x.size(); - if (__xlen > capacity()) { - size_type __len = __xlen; - pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0, - __CONST_CAST(const_pointer, __x._M_finish) + 0); - _M_clear(); - this->_M_start = __tmp; - this->_M_end_of_storage._M_data = this->_M_start + __len; - } else if (size() >= __xlen) { - pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0, - __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy()); - _STLP_STD::_Destroy_Range(__i, this->_M_finish); - } else { - _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start), - __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy()); - _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(), - __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy()); - } - this->_M_finish = this->_M_start + __xlen; - } - return *this; -} - -template -void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) { - if (__n > capacity()) { - vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); - __tmp.swap(*this); - } else if (__n > size()) { - fill(begin(), end(), __val); - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val); - } else - erase(_STLP_PRIV __fill_n(begin(), __n, __val), end()); -} - -template -__iterator__ -vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) { - size_type __n = __pos - begin(); - _M_fill_insert(__pos, 1, __x); - return begin() + __n; -} - -#undef __iterator__ - -#if defined (vector) -# undef vector -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_VECTOR_C */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/_vector.h b/SDK/stlport/stl/_vector.h deleted file mode 100644 index a24e347d..00000000 --- a/SDK/stlport/stl/_vector.h +++ /dev/null @@ -1,735 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_VECTOR_H -#define _STLP_INTERNAL_VECTOR_H - -#ifndef _STLP_INTERNAL_ALGOBASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#ifndef _STLP_INTERNAL_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_UNINITIALIZED_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -// The vector base class serves one purpose, its constructor and -// destructor allocate (but don't initialize) storage. This makes -// exception safety easier. - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class _Vector_base { -public: - typedef _Vector_base<_Tp, _Alloc> _Self; - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; - typedef _Tp* pointer; - typedef _STLP_alloc_proxy _AllocProxy; - - _Vector_base(const _Alloc& __a) - : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {} - - _Vector_base(size_t __n, const _Alloc& __a) - : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) { - _M_start = _M_end_of_storage.allocate(__n, __n); - _M_finish = _M_start; - _M_end_of_storage._M_data = _M_start + __n; - _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH - } - - _Vector_base(__move_source<_Self> src) - : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), - _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) { - //Set the source as empty: - src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0; - } - - ~_Vector_base() { - if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer)) - _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start); - } - -protected: - void _STLP_FUNCTION_THROWS _M_throw_length_error() const; - void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; - - pointer _M_start; - pointer _M_finish; - _AllocProxy _M_end_of_storage; -}; - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define vector _STLP_PTR_IMPL_NAME(vector) -#elif defined (_STLP_DEBUG) -# define vector _STLP_NON_DBG_NAME(vector) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc> -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector) - , public __stlport_class > -#endif -{ -private: - typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base; - typedef vector<_Tp, _Alloc> _Self; -public: - _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) - typedef typename _Base::allocator_type allocator_type; - - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag _Iterator_category; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); } - -private: - typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; - typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; -#if !defined (_STLP_NO_MOVE_SEMANTIC) - typedef typename __move_traits<_Tp>::implemented _Movable; -#else - typedef __false_type _Movable; -#endif - - // handles insertions on overflow - void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/, - size_type __fill_len, bool __atend); - void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/, - size_type __fill_len, bool __atend) { - //We need to take care of self referencing here: - if (_M_is_inside(__x)) { - value_type __x_copy = __x; - _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend); - return; - } - _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend); - } - - void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/, - size_type __fill_len, bool __atend = false) - { _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend); } - void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/, - size_type __fill_len, bool __atend = false); - void _M_range_check(size_type __n) const { - if (__n >= size_type(this->_M_finish - this->_M_start)) - this->_M_throw_out_of_range(); - } - -public: - iterator begin() { return this->_M_start; } - const_iterator begin() const { return this->_M_start; } - iterator end() { return this->_M_finish; } - const_iterator end() const { return this->_M_finish; } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - size_type size() const { return size_type(this->_M_finish - this->_M_start); } - size_type max_size() const { - size_type __vector_max_size = size_type(-1) / sizeof(_Tp); - typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size(); - return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size; - } - - size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); } - bool empty() const { return this->_M_start == this->_M_finish; } - - reference operator[](size_type __n) { return *(begin() + __n); } - const_reference operator[](size_type __n) const { return *(begin() + __n); } - - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - - reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; } - const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit vector(const allocator_type& __a = allocator_type()) -#else - vector() - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {} - vector(const allocator_type& __a) -#endif - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {} - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) -private: - //We always call _M_initialize with only 1 parameter. Default parameter - //is used to allow explicit instanciation of vector with types with no - //default constructor. - void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) - { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); } -public: - explicit vector(size_type __n) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) - { _M_initialize(__n); } - vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type()) -#else - explicit vector(size_type __n) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) - { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } - vector(size_type __n, const _Tp& __val) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) - { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); } - vector(size_type __n, const _Tp& __val, const allocator_type& __a) -#endif - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a) - { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); } - - vector(const _Self& __x) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator()) - { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy()); } - - vector(__move_source<_Self> src) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) - {} - -#if defined (_STLP_MEMBER_TEMPLATES) -private: - template - void _M_initialize_aux(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) { - size_type __real_n; - this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n); - this->_M_end_of_storage._M_data = this->_M_start + __real_n; - this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); - } - - template - void _M_initialize_aux(_InputIterator __first, _InputIterator __last, - const __false_type& /*_IsIntegral*/) - { _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); } - -public: - // Check whether it's an integral type. If so, it's not an iterator. - template - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL ) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_aux(__first, __last, _Integral()); - } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - vector(_InputIterator __first, _InputIterator __last) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_initialize_aux(__first, __last, _Integral()); - } -# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */ - -#else /* _STLP_MEMBER_TEMPLATES */ - vector(const _Tp* __first, const _Tp* __last, - const allocator_type& __a = allocator_type()) - : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a) - { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy()); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - //As the vector container is a back insert oriented container it - //seems rather logical to destroy elements in reverse order. - ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); } - - _Self& operator=(const _Self& __x); - - void reserve(size_type __n); - - // assign(), a generalized assignment member function. Two - // versions: one that takes a count, and one that takes a range. - // The range version is a member template, so we dispatch on whether - // or not the type is an integer. - - void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } - void _M_fill_assign(size_type __n, const _Tp& __val); - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) { -#else - void assign(const_iterator __first, const_iterator __last) { - typedef const_iterator _ForwardIter; -#endif - const size_type __len = distance(__first, __last); - if (__len > capacity()) { - size_type __n = __len; - iterator __tmp = _M_allocate_and_copy(__n, __first, __last); - _M_clear(); - _M_set(__tmp, __tmp + __len, __tmp + __n); - } - else if (size() >= __len) { - iterator __new_finish = copy(__first, __last, this->_M_start); - _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish); - this->_M_finish = __new_finish; - } - else { - _ForwardIter __mid = __first; - advance(__mid, size()); - copy(__first, __mid, this->_M_start); - this->_M_finish = uninitialized_copy(__mid, __last, this->_M_finish); - } - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_assign_aux(_InputIter __first, _InputIter __last, - const input_iterator_tag &) { - iterator __cur = begin(); - for ( ; __first != __last && __cur != end(); ++__cur, ++__first) - *__cur = *__first; - if (__first == __last) - erase(__cur, end()); - else - insert(end(), __first, __last); - } - - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) - { _M_fill_assign(__n, __val); } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) - { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } - - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void push_back(const _Tp& __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - if (this->_M_finish != this->_M_end_of_storage._M_data) { - _Copy_Construct(this->_M_finish, __x); - ++this->_M_finish; - } - else - _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1UL, true); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)); -#else - iterator insert(iterator __pos, const _Tp& __x); -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); } - iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void swap(_Self& __x) { - _STLP_STD::swap(this->_M_start, __x._M_start); - _STLP_STD::swap(this->_M_finish, __x._M_finish); - this->_M_end_of_storage.swap(__x._M_end_of_storage); - } - -private: - void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/); - void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/); - void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x); - - bool _M_is_inside(const value_type& __x) const { - return (&__x >= this->_M_start && &__x < this->_M_finish); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_range_insert_realloc(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, -#else - void _M_range_insert_realloc(iterator __pos, - const_iterator __first, const_iterator __last, -#endif /* _STLP_MEMBER_TEMPLATES */ - size_type __n) { - const size_type __old_size = size(); - size_type __len = __old_size + (max)(__old_size, __n); - pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); - pointer __new_finish = __new_start; - _STLP_TRY { - __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable()); - __new_finish = uninitialized_copy(__first, __last, __new_finish); - __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); - } - _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), - this->_M_end_of_storage.deallocate(__new_start,__len))) - _M_clear_after_move(); - _M_set(__new_start, __new_finish, __new_start + __len); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_range_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, -#else - void _M_range_insert_aux(iterator __pos, - const_iterator __first, const_iterator __last, -#endif /* _STLP_MEMBER_TEMPLATES */ - size_type __n, const __true_type& /*_Movable*/) { - iterator __src = this->_M_finish - 1; - iterator __dst = __src + __n; - for (; __src >= __pos; --__dst, --__src) { - _STLP_STD::_Move_Construct(__dst, *__src); - _STLP_STD::_Destroy_Moved(__src); - } - uninitialized_copy(__first, __last, __pos); - this->_M_finish += __n; - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_range_insert_aux(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, -#else - void _M_range_insert_aux(iterator __pos, - const_iterator __first, const_iterator __last, -#endif /* _STLP_MEMBER_TEMPLATES */ - size_type __n, const __false_type& /*_Movable*/) { - const size_type __elems_after = this->_M_finish - __pos; - pointer __old_finish = this->_M_finish; - if (__elems_after > __n) { - _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy()); - this->_M_finish += __n; - _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy()); - copy(__first, __last, __pos); - } - else { -#if defined ( _STLP_MEMBER_TEMPLATES ) - _ForwardIterator __mid = __first; - advance(__mid, __elems_after); -#else - const_pointer __mid = __first + __elems_after; -#endif - uninitialized_copy(__mid, __last, this->_M_finish); - this->_M_finish += __n - __elems_after; - _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy()); - this->_M_finish += __elems_after; - copy(__first, __mid, __pos); - } /* elems_after */ - } - - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - const __true_type&) - { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) - { _M_range_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); } - -public: - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); - } - -private: - template - void _M_range_insert(iterator __pos, - _InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - for ( ; __first != __last; ++__first) { - __pos = insert(__pos, *__first); - ++__pos; - } - } - - template - void _M_range_insert(iterator __pos, - _ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { -#else /* _STLP_MEMBER_TEMPLATES */ -public: - void insert(iterator __pos, - const_iterator __first, const_iterator __last) { -#endif /* _STLP_MEMBER_TEMPLATES */ - /* This method do not check self referencing. - * Standard forbids it, checked by the debug mode. - */ - if (__first != __last) { - size_type __n = distance(__first, __last); - - if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) { - _M_range_insert_aux(__pos, __first, __last, __n, _Movable()); - } - else { - _M_range_insert_realloc(__pos, __first, __last, __n); - } - } - } - -public: - void insert (iterator __pos, size_type __n, const _Tp& __x) - { _M_fill_insert(__pos, __n, __x); } - - void pop_back() { - --this->_M_finish; - _STLP_STD::_Destroy(this->_M_finish); - } - -private: - iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) { - _STLP_STD::_Destroy(__pos); - iterator __dst = __pos, __src = __dst + 1; - iterator __end = end(); - for (; __src != __end; ++__dst, ++__src) { - _STLP_STD::_Move_Construct(__dst, *__src); - _STLP_STD::_Destroy_Moved(__src); - } - this->_M_finish = __dst; - return __pos; - } - iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) { - if (__pos + 1 != end()) - _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy()); - --this->_M_finish; - _STLP_STD::_Destroy(this->_M_finish); - return __pos; - } - iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) { - iterator __dst = __first, __src = __last; - iterator __end = end(); - for (; __dst != __last && __src != __end; ++__dst, ++__src) { - _STLP_STD::_Destroy(__dst); - _STLP_STD::_Move_Construct(__dst, *__src); - } - if (__dst != __last) { - //There is more elements to erase than element to move: - _STLP_STD::_Destroy_Range(__dst, __last); - _STLP_STD::_Destroy_Moved_Range(__last, __end); - } - else { - //There is more element to move than element to erase: - for (; __src != __end; ++__dst, ++__src) { - _STLP_STD::_Destroy_Moved(__dst); - _STLP_STD::_Move_Construct(__dst, *__src); - } - _STLP_STD::_Destroy_Moved_Range(__dst, __end); - } - this->_M_finish = __dst; - return __first; - } - iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) { - pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy()); - _STLP_STD::_Destroy_Range(__i, this->_M_finish); - this->_M_finish = __i; - return __first; - } - -public: - iterator erase(iterator __pos) { - return _M_erase(__pos, _Movable()); - } - iterator erase(iterator __first, iterator __last) { - if (__first == __last) - return __first; - return _M_erase(__first, __last, _Movable()); - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void resize(size_type __new_size, const _Tp& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - if (__new_size < size()) - erase(begin() + __new_size, end()); - else - insert(end(), __new_size - size(), __x); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void clear() { - erase(begin(), end()); - } - -private: - void _M_clear() { - _STLP_STD::_Destroy_Range(rbegin(), rend()); - this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start); - } - - void _M_clear_after_move() { - _STLP_STD::_Destroy_Moved_Range(rbegin(), rend()); - this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start); - } - - void _M_set(pointer __s, pointer __f, pointer __e) { - this->_M_start = __s; - this->_M_finish = __f; - this->_M_end_of_storage._M_data = __e; - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - pointer _M_allocate_and_copy(size_type& __n, - _ForwardIterator __first, _ForwardIterator __last) -#else /* _STLP_MEMBER_TEMPLATES */ - pointer _M_allocate_and_copy(size_type& __n, - const_pointer __first, const_pointer __last) -#endif /* _STLP_MEMBER_TEMPLATES */ - { - pointer __result = this->_M_end_of_storage.allocate(__n, __n); - _STLP_TRY { - uninitialized_copy(__first, __last, __result); - return __result; - } - _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n)) - _STLP_RET_AFTER_THROW(__result) - } - - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void _M_range_initialize(_InputIterator __first, _InputIterator __last, - const input_iterator_tag &) { - for ( ; __first != __last; ++__first) - push_back(*__first); - } - // This function is only called by the constructor. - template - void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - const forward_iterator_tag &) { - size_type __n = distance(__first, __last); - this->_M_start = this->_M_end_of_storage.allocate(__n, __n); - this->_M_end_of_storage._M_data = this->_M_start + __n; - this->_M_finish = uninitialized_copy(__first, __last, this->_M_start); - } -#endif /* _STLP_MEMBER_TEMPLATES */ -}; - -#if defined (vector) -# undef vector -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -_STLP_END_NAMESPACE - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# include -#endif - -//We define the bool specialization before the debug interfave -//to benefit of the debug version of vector even for the bool -//specialization. -#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS) -# if !defined (_STLP_INTERNAL_BVECTOR_H) -# include -# endif -#endif - -#if defined (_STLP_DEBUG) -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS) -// This typedef is non-standard. It is provided for backward compatibility. -typedef vector > bit_vector; -#endif - -#define _STLP_TEMPLATE_HEADER template -#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc> -#include -#undef _STLP_TEMPLATE_CONTAINER -#undef _STLP_TEMPLATE_HEADER - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __move_traits > { - typedef __stlp_movable implemented; - typedef typename __move_traits<_Alloc>::complete complete; -#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) - // disable incorrect "dependent type qualifier" error - typedef __false_type _Ret; -#endif -}; - -# if !defined (_STLP_DEBUG) -template -struct _DefaultZeroValue > -{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; }; -# endif - -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -_STLP_END_NAMESPACE - -#endif /* _STLP_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/boost_type_traits.h b/SDK/stlport/stl/boost_type_traits.h deleted file mode 100644 index e41cc41a..00000000 --- a/SDK/stlport/stl/boost_type_traits.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_BOOST_TYPE_TRAITS_H -#define _STLP_BOOST_TYPE_TRAITS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * This file mostly wraps boost type_traits in the STLport type_traits. - * When checking a type traits like trivial assign operator for instance - * both the boost value and STLport values has to be taken into account - * as we don't know what the user might have prefer, specializing the boost - * type traits or the STLport one. - */ -_STLP_BEGIN_NAMESPACE - -template struct _IsRef { - enum { _Is = ::boost::is_reference<_Tp>::value }; - typedef typename __bool2type<_Is>::_Ret _Ret; -}; - -template struct _IsPtr { - enum { is_pointer = ::boost::is_pointer<_Tp>::value }; - typedef typename __bool2type::_Ret _Ret; -}; - -template struct _IsIntegral { - enum { is_integral = ::boost::is_integral<_Tp>::value }; - typedef typename __bool2type::_Ret _Ret; -}; - -template struct _IsRational { - enum { is_float = ::boost::is_float<_Tp>::value }; - typedef typename __bool2type::_Ret _Ret; -}; - -template -struct __type_traits { - enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value }; - typedef typename __bool2type::_Ret has_trivial_default_constructor; - - enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value }; - typedef typename __bool2type::_Ret has_trivial_copy_constructor; - - enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value }; - typedef typename __bool2type::_Ret has_trivial_assignment_operator; - - enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value }; - typedef typename __bool2type::_Ret has_trivial_destructor; - - enum { pod = ::boost::is_pod<_Tp>::value }; - typedef typename __bool2type::_Ret is_POD_type; -}; - -template -struct _TrivialCopy { - typedef typename ::boost::remove_cv<_Tp1>::type uncv1; - typedef typename ::boost::remove_cv<_Tp2>::type uncv2; - - enum { same = ::boost::is_same::value }; - typedef typename __bool2type::_Ret _Same; - - enum { boost_trivial_assign = ::boost::has_trivial_assign::value }; - typedef typename __bool2type::_Ret _BoostTrivialAssign; - typedef typename __type_traits::has_trivial_assignment_operator _STLPTrivialAssign; - typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign; - - typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type; - static _Type _Answer() { return _Type(); } -}; - -template -struct _TrivialUCopy { - typedef typename ::boost::remove_cv<_Tp1>::type uncv1; - typedef typename ::boost::remove_cv<_Tp2>::type uncv2; - - enum { same = ::boost::is_same::value }; - typedef typename __bool2type::_Ret _Same; - - enum { boost_trivial_copy = ::boost::has_trivial_copy::value }; - typedef typename __bool2type::_Ret _BoostTrivialCopy; - typedef typename __type_traits::has_trivial_copy_constructor _STLPTrivialCopy; - typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy; - - typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type; - static _Type _Answer() { return _Type(); } -}; - -template -struct _DefaultZeroValue { - enum { is_integral = ::boost::is_integral<_Tp>::value }; - typedef typename __bool2type::_Ret _IsIntegral; - enum { is_float = ::boost::is_float<_Tp>::value }; - typedef typename __bool2type::_Ret _IsFloat; - enum { is_pointer = ::boost::is_pointer<_Tp>::value }; - typedef typename __bool2type::_Ret _IsPointer; - - typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret; -}; - -template -struct _TrivialInit { - typedef typename ::boost::remove_cv<_Tp>::type uncv; - - enum { boost_trivial_constructor = ::boost::has_trivial_constructor::value }; - typedef typename __bool2type::_Ret _BoostTrivialInit; - typedef typename __type_traits::has_trivial_default_constructor _STLPTrivialInit; - typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1; - - typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2; - typedef typename _Not<_Tr2>::_Ret _Tr3; - - typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -_STLP_END_NAMESPACE - -#endif /* _STLP_BOOST_TYPE_TRAITS_H */ diff --git a/SDK/stlport/stl/c_locale.h b/SDK/stlport/stl/c_locale.h deleted file mode 100644 index 9b96ce71..00000000 --- a/SDK/stlport/stl/c_locale.h +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -#ifndef _STLP_C_LOCALE_H -#define _STLP_C_LOCALE_H - -/* - * Implementation dependent definitions. - * Beware: This header is not a purely internal header, it is also included - * from the outside world when building the STLport library. So this header - * should not reference internal headers (stlport/stl/_*.h) directly. - */ -#if defined (__sgi) -# if defined (ROOT_65) /* IRIX 6.5.x */ -# include -# include -# include -# include -# else /* IRIX pre-6.5 */ -# include -# include -# if !defined(_SIZE_T) && !defined(_SIZE_T_) -# define _SIZE_T -# if (_MIPS_SZLONG == 32) -typedef unsigned int size_t; -# endif -# if (_MIPS_SZLONG == 64) -typedef unsigned long size_t; -# endif -# endif -# if !defined (_WCHAR_T) -# define _WCHAR_T -# if (_MIPS_SZLONG == 32) -typedef long wchar_t; -# endif -# if (_MIPS_SZLONG == 64) -typedef __int32_t wchar_t; -# endif -# endif /* _WCHAR_T */ -# if !defined (_WINT_T) -# define _WINT_T -# if (_MIPS_SZLONG == 32) -typedef long wint_t; -# endif -# if (_MIPS_SZLONG == 64) -typedef __int32_t wint_t; -# endif -# endif /* _WINT_T */ -# if !defined (_MBSTATE_T) -# define _MBSTATE_T -/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined - * by Microsoft compilers to give their version and we are currently in a SGI platform scope. - * However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/ -# if defined (_MSC_VER) -typedef int mbstate_t; -# else -typedef char mbstate_t; -# endif -# endif /* _MBSTATE_T */ -# endif /* ROOT65 */ -#else /* __sgi */ -# include -# include -# include -#endif /* __sgi */ - -/* - * GENERAL FRAMEWORK - */ - -/* - * Opaque types, implementation (if there is one) depends - * on platform locale API. - */ -struct _Locale_ctype; -struct _Locale_numeric; -struct _Locale_time; -struct _Locale_collate; -struct _Locale_monetary; -struct _Locale_messages; -struct _Locale_name_hint; - -/* - Bitmask macros. -*/ - -/* - * For narrow characters, we expose the lookup table interface. - */ - -/* Internal bitmask macros, os-specific. */ - -#if defined (__sgi) /* IRIX */ - -# define _Locale_S 0x00000008 /* Spacing character */ -# define _Locale_A 0x00004000 /* Alphabetical characters only */ -# define _Locale_B 0x00000040 /* Obsolete: was space char only */ -# define _Locale_PR 0x00008000 /* Printable characters only */ -# define _Locale_G 0x40000000 /* Graphic characters only */ -# define _Locale_BL 0x80000000 /* The blank character class */ - -/* Public bitmask macros, must be defined for every OS. These values, of - * course, are specific to IRIX. */ - -# define _Locale_CNTRL 0x00000020 /* Control character */ -# define _Locale_UPPER 0x00000001 /* Upper case */ -# define _Locale_LOWER 0x00000002 /* Lower case */ -# define _Locale_DIGIT 0x00000004 /* Numeral (digit) */ -# define _Locale_XDIGIT 0x00000080 /* heXadecimal digit */ -# define _Locale_PUNCT 0x00000010 /* Punctuation */ -# define _Locale_SPACE (_Locale_S | _Locale_BL) -# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \ - _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \ - _Locale_PR) -# define _Locale_ALPHA _Locale_A - -/* -* All of these except for graph and blank are from the C standard; -* graph and blank are XPG4. (graph in XPG4 doesn't mean quite the -* same thing as graph in the C++ library) -*/ - -#endif /* IRIX */ - - -#if defined (__Lynx__) - /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask - * unusable in ctype_table. So we have to redefine it and use hard-coded - * numbers (to avoid potential clashes if system headers change). - * - * P.S. Actually, I see no reason in using platform-specific masks - - * having just one set of masks for all platforms should work just as - * well - we only use them internally and they don't have to be equal - * to whatever defined in local ctype.h - * - */ -# define _Locale_CNTRL 040 /* _C, Control character */ -# define _Locale_UPPER 01 /* _U, Upper case */ -# define _Locale_LOWER 02 /* _L, Lower case */ -# define _Locale_DIGIT 04 /* _N, Numeral (digit) */ -# define _Locale_XDIGIT 0200 /* _X, heXadecimal digit */ -# define _Locale_PUNCT 020 /* _P, Punctuation */ -# define _Locale_SPACE 010 /* _S, Spacing */ -# define _Locale_ALPHA 040000 /* none, Alphanumerical */ -# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \ - _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\ - _Locale_SPACE ) /* Printable */ -#endif /* __Lynx__ */ - -#if defined (__GNUC__) || defined (__BORLANDC__) || defined (__COMO__) - -# if defined (__CYGWIN__) - -# define _Locale_CNTRL 040 -# define _Locale_UPPER 02 -# define _Locale_LOWER 01 -# define _Locale_DIGIT 04 -# define _Locale_XDIGIT ( 0100 | _Locale_DIGIT ) -# define _Locale_PUNCT 020 -# define _Locale_SPACE 010 -# define _Locale_ALPHA 0200 -# define _Locale_PRINT (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0400 ) - -# elif defined (__FreeBSD__) || ( defined (__APPLE__) && defined (__GNUC__) && (__GNUC__ > 3) ) - -# define _Locale_CNTRL _CTYPE_C -# define _Locale_UPPER _CTYPE_U -# define _Locale_LOWER _CTYPE_L -# define _Locale_DIGIT _CTYPE_D -# define _Locale_XDIGIT _CTYPE_X -# define _Locale_PUNCT _CTYPE_P -# define _Locale_SPACE _CTYPE_S -# define _Locale_PRINT _CTYPE_R -# define _Locale_ALPHA _CTYPE_A - -# elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__amigaos__) - -# define _Locale_CNTRL _C -# define _Locale_UPPER _U -# define _Locale_LOWER _L -# define _Locale_DIGIT _N -# define _Locale_XDIGIT (_N|_X) -# define _Locale_PUNCT _P -# define _Locale_SPACE _S -# define _Locale_PRINT (_P|_U|_L|_N|_B) -# define _Locale_ALPHA (_U|_L) -# elif defined (__EMX__) /* OS/2 with emx runtime */ -# define _Locale_CNTRL _CNTRL -# define _Locale_UPPER _UPPER -# define _Locale_LOWER _LOWER -# define _Locale_DIGIT _DIGIT -# define _Locale_XDIGIT _XDIGIT -# define _Locale_PUNCT _PUNCT -# define _Locale_SPACE _SPACE -# define _Locale_PRINT _PRINT -# define _Locale_ALPHA (_UPPER|_LOWER) - -# elif defined (_STLP_USE_GLIBC) /* linux, using the gnu compiler */ - -/* This section uses macros defined in the gnu libc ctype.h header */ - -# define _Locale_CNTRL _IScntrl -# define _Locale_UPPER _ISupper -# define _Locale_LOWER _ISlower -# define _Locale_DIGIT _ISdigit -# define _Locale_XDIGIT _ISxdigit -# define _Locale_PUNCT _ISpunct -# define _Locale_SPACE _ISspace -# define _Locale_PRINT _ISprint -# define _Locale_ALPHA _ISalpha - -# endif /* GLIBC */ - -#endif /* gnu */ - -#if (defined (__sun) && defined (__SVR4)) || \ - (defined (__digital__) && defined (__unix__)) || \ - defined (_AIX) -/* fbp : condition from AT&T code*/ -# if !(defined (__XPG4_CHAR_CLASS__) || defined (_XPG4_2) || \ - (defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL) - /* fbp : on 2.5.1, the defines are different ;( */ - /* # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) ) */ -# define _ISCNTRL _C -# define _ISUPPER _U -# define _ISLOWER _L -# define _ISDIGIT _N -# define _ISXDIGIT _X -# define _ISPUNCT _P -# define _ISSPACE _S -# define _ISPRINT (_P | _U | _L | _N | _B) -# define _ISALPHA (_U | _L) -# endif - -# define _Locale_CNTRL _ISCNTRL -# define _Locale_UPPER _ISUPPER -# define _Locale_LOWER _ISLOWER -# define _Locale_DIGIT _ISDIGIT -# define _Locale_XDIGIT _ISXDIGIT -# define _Locale_PUNCT _ISPUNCT -# define _Locale_SPACE _ISSPACE -# define _Locale_PRINT _ISPRINT -# define _Locale_ALPHA _ISALPHA -#elif defined (__MWERKS__) && defined (N_PLAT_NLM) -# define _Locale_CNTRL _CNTRL_ -# define _Locale_UPPER _UPPER_ -# define _Locale_LOWER _LOWER_ -# define _Locale_DIGIT _DIGIT_ -# define _Locale_XDIGIT _XDIGIT_ -# define _Locale_PUNCT _PUNCT_ -# define _Locale_SPACE _SPACE_ -# define _Locale_PRINT (_PUNCT_|_UPPER_|_LOWER_|_DIGIT_|_BLANK_) -# define _Locale_ALPHA (_UPPER_|_LOWER_) -#elif defined (__MWERKS__) -# define _Locale_CNTRL __control_char -# define _Locale_UPPER __upper_case -# define _Locale_LOWER __lower_case -# define _Locale_DIGIT __digit -# define _Locale_XDIGIT __hex_digit -# define _Locale_PUNCT __punctuation -# define _Locale_SPACE __space_char -# define _Locale_PRINT __printable -# define _Locale_ALPHA __alphanumeric -#elif defined (__BORLANDC__) -# define _Locale_CNTRL _IS_CTL -# define _Locale_UPPER _IS_UPP -# define _Locale_LOWER _IS_LOW -# define _Locale_DIGIT _IS_DIG -# define _Locale_XDIGIT _IS_HEX -# define _Locale_PUNCT _IS_PUN -# define _Locale_SPACE _IS_SP -# define _Locale_PRINT (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG) -# define _Locale_ALPHA _IS_ALPHA -#elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) -# define _Locale_CNTRL _CONTROL -# define _Locale_UPPER _UPPER -# define _Locale_LOWER _LOWER -# define _Locale_DIGIT _DIGIT -# define _Locale_XDIGIT _HEX -# define _Locale_PUNCT _PUNCT -# define _Locale_SPACE _SPACE -# define _Locale_PRINT (_ALPHA | _DIGIT | _BLANK | _PUNCT) -# define _Locale_ALPHA ( _ALPHA & ~ (_UPPER | _LOWER )) -#elif defined (__DMC__) -# define _Locale_CNTRL _CONTROL -# define _Locale_UPPER _UPPER -# define _Locale_LOWER _LOWER -# define _Locale_DIGIT _DIGIT -# define _Locale_XDIGIT _HEX -# define _Locale_PUNCT _PUNCT -# define _Locale_SPACE _SPACE -# define _Locale_PRINT (_UPPER | _LOWER | _DIGIT | _PUNCT | _SPACE) -# define _Locale_ALPHA _ALPHA & ~(_UPPER | _LOWER) -#elif defined (__MRC__) || defined (__SC__) /* *TY 02/24/2000 - added support for MPW */ -# define _Locale_CNTRL _CTL -# define _Locale_UPPER _UPP -# define _Locale_LOWER _LOW -# define _Locale_DIGIT _DIG -# define _Locale_XDIGIT _HEX -# define _Locale_PUNCT _PUN -# define _Locale_SPACE _BLA -# define _Locale_PRINT (_UPP | _LOW | _DIG | _PUN | _BLA) -# define _Locale_ALPHA (_UPP | _LOW) -#elif defined (__MLCCPP__) -# define _Locale_CNTRL 1 -# define _Locale_UPPER 2 -# define _Locale_LOWER 4 -# define _Locale_DIGIT 8 -# define _Locale_XDIGIT 16 -# define _Locale_PUNCT 32 -# define _Locale_SPACE 64 -# define _Locale_PRINT 128 -# define _Locale_ALPHA 256 -#elif defined (__GNUC__) && (__GNUC__ == 3) && defined (__APPLE__) -# define _Locale_CNTRL _C -# define _Locale_UPPER _U -# define _Locale_LOWER _L -# define _Locale_DIGIT _D -# define _Locale_XDIGIT _X -# define _Locale_PUNCT _P -# define _Locale_SPACE _S -# define _Locale_PRINT _R -# define _Locale_ALPHA _A -#elif defined (__hpux) || defined (__osf__) -# if defined (__HP_aCC) && !defined (_INCLUDE_HPUX_SOURCE) -# define _ISALPHA 0x001 -# define _ISALNUM 0x002 -# define _ISBLANK 0x004 -# define _ISCNTRL 0x008 -# define _ISDIGIT 0x010 -# define _ISGRAPH 0x020 -# define _ISLOWER 0x040 -# define _ISPRINT 0x080 -# define _ISPUNCT 0x100 -# define _ISSPACE 0x200 -# define _ISUPPER 0x400 -# define _ISXDIGIT 0x800 -# endif -# define _Locale_CNTRL _ISCNTRL -# define _Locale_UPPER _ISUPPER -# define _Locale_LOWER _ISLOWER -# define _Locale_DIGIT _ISDIGIT -# define _Locale_XDIGIT _ISXDIGIT -# define _Locale_PUNCT _ISPUNCT -# define _Locale_SPACE _ISSPACE -# define _Locale_PRINT _ISPRINT -# define _Locale_ALPHA _ISALPHA -#elif defined (__MVS__) || defined (__OS400__) -# define _Locale_CNTRL __ISCNTRL -# define _Locale_UPPER __ISUPPER -# define _Locale_LOWER __ISLOWER -# define _Locale_DIGIT __ISDIGIT -# define _Locale_XDIGIT __ISXDIGIT -# define _Locale_PUNCT __ISPUNCT -# define _Locale_SPACE __ISSPACE -# define _Locale_PRINT __ISPRINT -# define _Locale_ALPHA __ISALPHA -#elif defined (__QNXNTO__) || defined (__WATCOMC__) -# define _Locale_CNTRL _CNTRL -# define _Locale_UPPER _UPPER -# define _Locale_LOWER _LOWER -# define _Locale_DIGIT _DIGIT -# define _Locale_XDIGIT _XDIGT -# define _Locale_PUNCT _PUNCT -# define _Locale_SPACE _SPACE -# define _Locale_PRINT _PRINT -# define _Locale_ALPHA (_UPPER | _LOWER) -#elif defined (__DJGPP) -# define _Locale_CNTRL __dj_ISCNTRL -# define _Locale_UPPER __dj_ISUPPER -# define _Locale_LOWER __dj_ISLOWER -# define _Locale_DIGIT __dj_ISDIGIT -# define _Locale_XDIGIT __dj_ISXDIGIT -# define _Locale_PUNCT __dj_ISPUNCT -# define _Locale_SPACE __dj_ISSPACE -# define _Locale_PRINT __dj_ISPRINT -# define _Locale_ALPHA __dj_ISALPHA -#elif defined (_STLP_SCO_OPENSERVER) -# define _Locale_CNTRL _C -# define _Locale_UPPER _U -# define _Locale_LOWER _L -# define _Locale_DIGIT _N -# define _Locale_XDIGIT _X -# define _Locale_PUNCT _P -# define _Locale_SPACE _S -# define _Locale_PRINT _R -# define _Locale_ALPHA _A -#elif defined (__NCR_SVR) -# define _Locale_CNTRL _C -# define _Locale_UPPER _U -# define _Locale_LOWER _L -# define _Locale_DIGIT _N -# define _Locale_XDIGIT _X -# define _Locale_PUNCT _P -# define _Locale_SPACE _S -# define _Locale_PRINT (_P | _U | _L | _N | _B) -# define _Locale_ALPHA (_U | _L) -#elif defined (_CRAY) -# define _Locale_CNTRL _CNTRL -# define _Locale_UPPER _UPPER -# define _Locale_LOWER _LOWER -# define _Locale_DIGIT _DIGIT -# define _Locale_XDIGIT _XDIGIT -# define _Locale_PUNCT _PUNCT -# define _Locale_SPACE _SPACE -# define _Locale_PRINT _PRINT -# define _Locale_ALPHA _ALPHA -#endif - -/* We arbitrarily consider _Locale_CNTRL macro to check locale facet numeric - * identifier has been defined for the platform/compiler: - */ -#if !defined (_Locale_CNTRL) -# error Unable to find your platform locale facets definitions, please grant them. -#endif - -#endif /* _STLP_C_LOCALE_H */ diff --git a/SDK/stlport/stl/char_traits.h b/SDK/stlport/stl/char_traits.h deleted file mode 100644 index ad41271d..00000000 --- a/SDK/stlport/stl/char_traits.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_CHAR_TRAITS_H -#define _STLP_CHAR_TRAITS_H - -// Define char_traits - -#ifndef _STLP_INTERNAL_CSTDDEF -# include -#endif - -#ifndef _STLP_INTERNAL_CSTRING -# include -#endif - -#if defined (__unix) || defined (N_PLAT_NLM) -# include // For off_t -#endif /* __unix */ - -#ifdef __BORLANDC__ -# include _STLP_NATIVE_C_HEADER(mem.h) -# include _STLP_NATIVE_C_HEADER(string.h) -# include _STLP_NATIVE_C_HEADER(_stddef.h) -#endif - -#ifndef _STLP_INTERNAL_CONSTRUCT_H -# include -#endif - -#ifndef _STLP_INTERNAL_CWCHAR -# include -#endif - -_STLP_BEGIN_NAMESPACE - -template class allocator; - -#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT) - -#if defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) /* IRIX */ -typedef off64_t streamoff; -#elif defined(_STLP_WCE) -typedef long streamoff; -#elif defined (_STLP_WIN32) -# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__) -//The Win32 file io API support 64 bits access so streamoff and streamsize -//has to reflect that. Do not change the stringbuf behavior. -typedef _STLP_LONG_LONG streamoff; -# else -typedef ptrdiff_t streamoff; -# endif -#else // __unix -# ifdef _STLP_USE_DEFAULT_FILE_OFFSET -typedef off_t streamoff; -# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \ - /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */ -typedef off64_t streamoff; -# else -typedef off_t streamoff; -# endif -#endif /* ___unix */ - -#if defined (_STLP_WIN32) -typedef streamoff streamsize; -#else -typedef ptrdiff_t streamsize; -#endif - -// Class fpos, which represents a position within a file. (The C++ -// standard calls for it to be defined in . This implementation -// moves it to , which is included by .) -template class fpos { -public: // From table 88 of the C++ standard. - fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {} - fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {} - - operator streamoff() const { return _M_pos; } - - bool operator==(const fpos& __y) const - { return _M_pos == __y._M_pos; } - bool operator!=(const fpos& __y) const - { return _M_pos != __y._M_pos; } - - fpos& operator+=(streamoff __off) { - _M_pos += __off; - return *this; - } - fpos& operator-=(streamoff __off) { - _M_pos -= __off; - return *this; - } - - fpos operator+(streamoff __off) { - fpos __tmp(*this); - __tmp += __off; - return __tmp; - } - fpos operator-(streamoff __off) { - fpos __tmp(*this); - __tmp -= __off; - return __tmp; - } - -public: // Manipulation of the state member. - _StateT state() const { return _M_st; } - void state(_StateT __st) { _M_st = __st; } -private: - streamoff _M_pos; - _StateT _M_st; -}; - -#if !defined (_STLP_NO_MBSTATE_T) -typedef fpos streampos; -typedef fpos wstreampos; -#endif - -// Class __char_traits_base. -template -class __char_traits_base { -public: - typedef _CharT char_type; - typedef _IntT int_type; - typedef streamoff off_type; - typedef streampos pos_type; -#if defined (_STLP_NO_MBSTATE_T) - typedef char state_type; -#else - typedef mbstate_t state_type; -#endif - - static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } - static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2) - { return __c1 == __c2; } - static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2) - { return __c1 < __c2; } - - static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) { - for (size_t __i = 0; __i < __n; ++__i) - if (!eq(__s1[__i], __s2[__i])) - return __s1[__i] < __s2[__i] ? -1 : 1; - return 0; - } - - static size_t _STLP_CALL length(const char_type* __s) { - const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type); - size_t __i(0); - for (; !eq(__s[__i], _NullChar); ++__i) {} - return __i; - } - - static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) { - for ( ; __n > 0 ; ++__s, --__n) - if (eq(*__s, __c)) - return __s; - return 0; - } - - static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz) - { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); } - - static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) { - return (__n == 0 ? __s1 : - (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type))); - } - - static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) { - for (size_t __i = 0; __i < __n; ++__i) - __s[__i] = __c; - return __s; - } - - static int_type _STLP_CALL not_eof(const int_type& __c) - { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); } - - static char_type _STLP_CALL to_char_type(const int_type& __c) - { return (char_type)__c; } - - static int_type _STLP_CALL to_int_type(const char_type& __c) - { return (int_type)__c; } - - static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2) - { return __c1 == __c2; } - - static int_type _STLP_CALL eof() - { return (int_type)-1; } -}; - -// Generic char_traits class. Note that this class is provided only -// as a base for explicit specialization; it is unlikely to be useful -// as is for any particular user-defined type. In particular, it -// *will not work* for a non-POD type. - -template -class char_traits - : public __char_traits_base<_CharT, _CharT> {}; - -// Specialization for char. - -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC char_traits - : public __char_traits_base { -public: - typedef char char_type; - typedef int int_type; - typedef streamoff off_type; -#if !defined (_STLP_NO_MBSTATE_T) - typedef streampos pos_type; - typedef mbstate_t state_type; -#endif - - static char _STLP_CALL to_char_type(const int& __c) - { return (char)(unsigned char)__c; } - - static int _STLP_CALL to_int_type(const char& __c) - { return (unsigned char)__c; } - - static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n) - { return memcmp(__s1, __s2, __n); } - - static size_t _STLP_CALL length(const char* __s) - { return strlen(__s); } - - static void _STLP_CALL assign(char& __c1, const char& __c2) - { __c1 = __c2; } - - static char* _STLP_CALL assign(char* __s, size_t __n, char __c) { - memset(__s, __c, __n); - return __s; - } -}; - -#if defined (_STLP_HAS_WCHAR_T) -// Specialization for wchar_t. -_STLP_TEMPLATE_NULL -class _STLP_CLASS_DECLSPEC char_traits - : public __char_traits_base { -# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE) -public: -# if !defined (N_PLAT_NLM) -# if !defined (__BORLANDC__) - static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n) - { return wmemmove(__dest, __src, __n); } -# endif - - static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n) - { return wmemcpy(__dest, __src, __n); } - -# if !defined (__DMC__) && !defined (__BORLANDC__) - static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n) - { return wmemcmp(__s1, __s2, __n); } -# endif - - static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c) - { return wmemset(__s, __c, __n); } -# endif - - static size_t _STLP_CALL length(const wchar_t* __s) - { return wcslen(__s); } - - static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2) - { __c1 = __c2; } -# endif -}; -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_CHAR_TRAITS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/concept_checks.h b/SDK/stlport/stl/concept_checks.h deleted file mode 100644 index 5fe02c29..00000000 --- a/SDK/stlport/stl/concept_checks.h +++ /dev/null @@ -1,810 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#ifndef __CONCEPT_CHECKS_H -#define __CONCEPT_CHECKS_H - -/* - Use these macro like assertions, but they assert properties - on types (usually template arguments). In technical terms they - verify whether a type "models" a "concept". - - This set of requirements and the terminology used here is derived - from the book "Generic Programming and the STL" by Matt Austern - (Addison Wesley). For further information please consult that - book. The requirements also are intended to match the ANSI/ISO C++ - standard. - - This file covers the basic concepts and the iterator concepts. - There are several other files that provide the requirements - for the STL containers: - container_concepts.h - sequence_concepts.h - assoc_container_concepts.h - - Jeremy Siek, 1999 - - TO DO: - - some issues with regards to concept classification and mutability - including AssociativeContianer -> ForwardContainer - and SortedAssociativeContainer -> ReversibleContainer - - HashedAssociativeContainer - - Allocator - - Function Object Concepts - - */ - -#ifndef _STLP_USE_CONCEPT_CHECKS - -// Some compilers lack the features that are necessary for concept checks. -// On those compilers we define the concept check macros to do nothing. -#define _STLP_REQUIRES(__type_var, __concept) do {} while(0) -#define _STLP_CLASS_REQUIRES(__type_var, __concept) \ - static int __##__type_var##_##__concept -#define _STLP_CONVERTIBLE(__type_x, __type_y) do {} while(0) -#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0) -#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ - static int __##__type_x##__type_y##_require_same_type -#define _STLP_GENERATOR_CHECK(__func, __ret) do {} while(0) -#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \ - static int __##__func##__ret##_generator_check -#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0) -#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ - static int __##__func##__ret##__arg##_unary_function_check -#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - do {} while(0) -#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - static int __##__func##__ret##__first##__second##_binary_function_check -#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - do {} while(0) -#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - static int __##__opname##__ret##__first##__second##_require_binary_op - -#else /* _STLP_USE_CONCEPT_CHECKS */ - -// This macro tests whether the template argument "__type_var" -// satisfies the requirements of "__concept". Here is a list of concepts -// that we know how to check: -// _Allocator -// _Assignable -// _DefaultConstructible -// _EqualityComparable -// _LessThanComparable -// _TrivialIterator -// _InputIterator -// _OutputIterator -// _ForwardIterator -// _BidirectionalIterator -// _RandomAccessIterator -// _Mutable_TrivialIterator -// _Mutable_ForwardIterator -// _Mutable_BidirectionalIterator -// _Mutable_RandomAccessIterator - -#define _STLP_REQUIRES(__type_var, __concept) \ -do { \ - void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\ - ::##__concept##_requirement_violation; __x = __x; } while (0) - -// Use this to check whether type X is convertible to type Y -#define _STLP_CONVERTIBLE(__type_x, __type_y) \ -do { \ - void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \ - __type_y >::__type_X_is_not_convertible_to_type_Y; \ - __x = __x; } while (0) - -// Use this to test whether two template arguments are the same type -#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) \ -do { \ - void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \ - __type_y >::__type_X_not_same_as_type_Y; \ - __x = __x; } while (0) - - -// function object checks -#define _STLP_GENERATOR_CHECK(__func, __ret) \ -do { \ - __ret (*__x)( __func&) = \ - _STL_GENERATOR_ERROR< \ - __func, __ret>::__generator_requirement_violation; \ - __x = __x; } while (0) - - -#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ -do { \ - __ret (*__x)( __func&, const __arg& ) = \ - _STL_UNARY_FUNCTION_ERROR< \ - __func, __ret, __arg>::__unary_function_requirement_violation; \ - __x = __x; } while (0) - - -#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ -do { \ - __ret (*__x)( __func&, const __first&, const __second& ) = \ - _STL_BINARY_FUNCTION_ERROR< \ - __func, __ret, __first, __second>::__binary_function_requirement_violation; \ - __x = __x; } while (0) - - -#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - do { \ - __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \ - __ret, __first, __second>::__binary_operator_requirement_violation; \ - __ret (*__y)( const __first&, const __second& ) = \ - _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \ - __const_binary_operator_requirement_violation; \ - __y = __y; __x = __x; } while (0) - - -#ifdef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE - -#define _STLP_CLASS_REQUIRES(__type_var, __concept) -#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) -#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) -#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) -#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) -#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) - -#else - -// Use this macro inside of template classes, where you would -// like to place requirements on the template arguments to the class -// Warning: do not pass pointers and such (e.g. T*) in as the __type_var, -// since the type_var is used to construct identifiers. Instead typedef -// the pointer type, then use the typedef name for the __type_var. -#define _STLP_CLASS_REQUIRES(__type_var, __concept) \ - typedef void (* __func##__type_var##__concept)( __type_var ); \ - template <__func##__type_var##__concept _Tp1> \ - struct __dummy_struct_##__type_var##__concept { }; \ - static __dummy_struct_##__type_var##__concept< \ - __concept##_concept_specification< \ - __type_var>::__concept##_requirement_violation> \ - __dummy_ptr_##__type_var##__concept - - -#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ - typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \ - __type_y ); \ - template < __func_##__type_x##__type_y##same_type _Tp1> \ - struct __dummy_struct_##__type_x##__type_y##_same_type { }; \ - static __dummy_struct_##__type_x##__type_y##_same_type< \ - _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \ - __dummy_ptr_##__type_x##__type_y##_same_type - - -#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \ - typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \ - template <__f_##__func##__ret##_generator _Tp1> \ - struct __dummy_struct_##__func##__ret##_generator { }; \ - static __dummy_struct_##__func##__ret##_generator< \ - _STL_GENERATOR_ERROR< \ - __func, __ret>::__generator_requirement_violation> \ - __dummy_ptr_##__func##__ret##_generator - - -#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ - typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \ - const __arg& ); \ - template <__f_##__func##__ret##__arg##_unary_check _Tp1> \ - struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \ - static __dummy_struct_##__func##__ret##__arg##_unary_check< \ - _STL_UNARY_FUNCTION_ERROR< \ - __func, __ret, __arg>::__unary_function_requirement_violation> \ - __dummy_ptr_##__func##__ret##__arg##_unary_check - - -#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ - typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\ - const __second& ); \ - template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \ - struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \ - static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \ - _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \ - __binary_function_requirement_violation> \ - __dummy_ptr_##__func##__ret##__first##__second##_binary_check - - -#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ - typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \ - const __second& ); \ - template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \ - struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \ - static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \ - _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \ - __binary_operator_requirement_violation> \ - __dummy_ptr_##__func##__ret##__first##__second##_binary_op - -#endif - -/* helper class for finding non-const version of a type. Need to have - something to assign to etc. when testing constant iterators. */ - -template -struct _Mutable_trait { - typedef _Tp _Type; -}; -template -struct _Mutable_trait { - typedef _Tp _Type; -}; - - -/* helper function for avoiding compiler warnings about unused variables */ -template -void __sink_unused_warning(_Type) { } - -template -struct _STL_CONVERT_ERROR { - static void - __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) { - _TypeY __y = __x; - __sink_unused_warning(__y); - } -}; - - -template struct __check_equal { }; - -template -struct _STL_SAME_TYPE_ERROR { - static void - __type_X_not_same_as_type_Y(_TypeX , _TypeY ) { - __check_equal<_TypeX> t1 = __check_equal<_TypeY>(); - } -}; - - -// Some Functon Object Checks - -template -struct _STL_GENERATOR_ERROR { - static _Ret __generator_requirement_violation(_Func& __f) { - return __f(); - } -}; - -template -struct _STL_GENERATOR_ERROR<_Func, void> { - static void __generator_requirement_violation(_Func& __f) { - __f(); - } -}; - - -template -struct _STL_UNARY_FUNCTION_ERROR { - static _Ret - __unary_function_requirement_violation(_Func& __f, - const _Arg& __arg) { - return __f(__arg); - } -}; - -template -struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> { - static void - __unary_function_requirement_violation(_Func& __f, - const _Arg& __arg) { - __f(__arg); - } -}; - -template -struct _STL_BINARY_FUNCTION_ERROR { - static _Ret - __binary_function_requirement_violation(_Func& __f, - const _First& __first, - const _Second& __second) { - return __f(__first, __second); - } -}; - -template -struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> { - static void - __binary_function_requirement_violation(_Func& __f, - const _First& __first, - const _Second& __second) { - __f(__first, __second); - } -}; - - -#define _STLP_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \ -template \ -struct _STL_BINARY##_NAME##_ERROR { \ - static _Ret \ - __const_binary_operator_requirement_violation(const _First& __first, \ - const _Second& __second) { \ - return __first _OP __second; \ - } \ - static _Ret \ - __binary_operator_requirement_violation(_First& __first, \ - _Second& __second) { \ - return __first _OP __second; \ - } \ -} - -_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL); -_STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL); -_STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN); -_STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL); -_STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN); -_STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL); -_STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS); -_STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES); -_STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE); -_STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT); -_STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD); -// ... - -// TODO, add unary operators (prefix and postfix) - -/* - The presence of this class is just to trick EDG into displaying - these error messages before any other errors. Without the - classes, the errors in the functions get reported after - other class errors deep inside the library. The name - choice just makes for an eye catching error message :) - */ -struct _STL_ERROR { - - template - static _Type - __default_constructor_requirement_violation(_Type) { - return _Type(); - } - template - static _Type - __assignment_operator_requirement_violation(_Type __a) { - __a = __a; - return __a; - } - template - static _Type - __copy_constructor_requirement_violation(_Type __a) { - _Type __c(__a); - return __c; - } - template - static _Type - __const_parameter_required_for_copy_constructor(_Type /* __a */, - const _Type& __b) { - _Type __c(__b); - return __c; - } - template - static _Type - __const_parameter_required_for_assignment_operator(_Type __a, - const _Type& __b) { - __a = __b; - return __a; - } - template - static _Type - __less_than_comparable_requirement_violation(_Type __a, _Type __b) { - if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a; - return __b; - } - template - static _Type - __equality_comparable_requirement_violation(_Type __a, _Type __b) { - if (__a == __b || __a != __b) return __a; - return __b; - } - template - static void - __dereference_operator_requirement_violation(_Iterator __i) { - __sink_unused_warning(*__i); - } - template - static void - __dereference_operator_and_assignment_requirement_violation(_Iterator __i) { - *__i = *__i; - } - template - static void - __preincrement_operator_requirement_violation(_Iterator __i) { - ++__i; - } - template - static void - __postincrement_operator_requirement_violation(_Iterator __i) { - __i++; - } - template - static void - __predecrement_operator_requirement_violation(_Iterator __i) { - --__i; - } - template - static void - __postdecrement_operator_requirement_violation(_Iterator __i) { - __i--; - } - template - static void - __postincrement_operator_and_assignment_requirement_violation(_Iterator __i, - _Type __t) { - *__i++ = __t; - } - template - static _Iterator - __iterator_addition_assignment_requirement_violation(_Iterator __i, - _Distance __n) { - __i += __n; - return __i; - } - template - static _Iterator - __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) { - __i = __i + __n; - __i = __n + __i; - return __i; - } - template - static _Iterator - __iterator_subtraction_assignment_requirement_violation(_Iterator __i, - _Distance __n) { - __i -= __n; - return __i; - } - template - static _Iterator - __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) { - __i = __i - __n; - return __i; - } - template - static _Distance - __difference_operator_requirement_violation(_Iterator __i, _Iterator __j, - _Distance __n) { - __n = __i - __j; - return __n; - } - template - static _Type - __element_access_operator_requirement_violation(_Exp __x, _Type*, - _Distance __n) { - return __x[__n]; - } - template - static void - __element_assignment_operator_requirement_violation(_Exp __x, - _Type* __t, - _Distance __n) { - __x[__n] = *__t; - } - -}; /* _STL_ERROR */ - -/* Associated Type Requirements */ - -_STLP_BEGIN_NAMESPACE -template struct iterator_traits; -_STLP_END_NAMESPACE - -template -struct __value_type_type_definition_requirement_violation { - typedef typename __STD::iterator_traits<_Iter>::value_type value_type; -}; - -template -struct __difference_type_type_definition_requirement_violation { - typedef typename __STD::iterator_traits<_Iter>::difference_type - difference_type; -}; - -template -struct __reference_type_definition_requirement_violation { - typedef typename __STD::iterator_traits<_Iter>::reference reference; -}; - -template -struct __pointer_type_definition_requirement_violation { - typedef typename __STD::iterator_traits<_Iter>::pointer pointer; -}; - -template -struct __iterator_category_type_definition_requirement_violation { - typedef typename __STD::iterator_traits<_Iter>::iterator_category - iterator_category; -}; - -/* Assignable Requirements */ - - -template -struct _Assignable_concept_specification { - static void _Assignable_requirement_violation(_Type __a) { - _STL_ERROR::__assignment_operator_requirement_violation(__a); - _STL_ERROR::__copy_constructor_requirement_violation(__a); - _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a); - _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a); - } -}; - -/* DefaultConstructible Requirements */ - - -template -struct _DefaultConstructible_concept_specification { - static void _DefaultConstructible_requirement_violation(_Type __a) { - _STL_ERROR::__default_constructor_requirement_violation(__a); - } -}; - -/* EqualityComparable Requirements */ - -template -struct _EqualityComparable_concept_specification { - static void _EqualityComparable_requirement_violation(_Type __a) { - _STL_ERROR::__equality_comparable_requirement_violation(__a, __a); - } -}; - -/* LessThanComparable Requirements */ -template -struct _LessThanComparable_concept_specification { - static void _LessThanComparable_requirement_violation(_Type __a) { - _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a); - } -}; - -/* TrivialIterator Requirements */ - -template -struct _TrivialIterator_concept_specification { -static void -_TrivialIterator_requirement_violation(_TrivialIterator __i) { - typedef typename - __value_type_type_definition_requirement_violation<_TrivialIterator>:: - value_type __T; - // Refinement of Assignable - _Assignable_concept_specification<_TrivialIterator>:: - _Assignable_requirement_violation(__i); - // Refinement of DefaultConstructible - _DefaultConstructible_concept_specification<_TrivialIterator>:: - _DefaultConstructible_requirement_violation(__i); - // Refinement of EqualityComparable - _EqualityComparable_concept_specification<_TrivialIterator>:: - _EqualityComparable_requirement_violation(__i); - // Valid Expressions - _STL_ERROR::__dereference_operator_requirement_violation(__i); -} -}; - -template -struct _Mutable_TrivialIterator_concept_specification { -static void -_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) { - _TrivialIterator_concept_specification<_TrivialIterator>:: - _TrivialIterator_requirement_violation(__i); - // Valid Expressions - _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i); -} -}; - -/* InputIterator Requirements */ - -template -struct _InputIterator_concept_specification { -static void -_InputIterator_requirement_violation(_InputIterator __i) { - // Refinement of TrivialIterator - _TrivialIterator_concept_specification<_InputIterator>:: - _TrivialIterator_requirement_violation(__i); - // Associated Types - __difference_type_type_definition_requirement_violation<_InputIterator>(); - __reference_type_definition_requirement_violation<_InputIterator>(); - __pointer_type_definition_requirement_violation<_InputIterator>(); - __iterator_category_type_definition_requirement_violation<_InputIterator>(); - // Valid Expressions - _STL_ERROR::__preincrement_operator_requirement_violation(__i); - _STL_ERROR::__postincrement_operator_requirement_violation(__i); -} -}; - -/* OutputIterator Requirements */ - -template -struct _OutputIterator_concept_specification { -static void -_OutputIterator_requirement_violation(_OutputIterator __i) { - // Refinement of Assignable - _Assignable_concept_specification<_OutputIterator>:: - _Assignable_requirement_violation(__i); - // Associated Types - __iterator_category_type_definition_requirement_violation<_OutputIterator>(); - // Valid Expressions - _STL_ERROR::__dereference_operator_requirement_violation(__i); - _STL_ERROR::__preincrement_operator_requirement_violation(__i); - _STL_ERROR::__postincrement_operator_requirement_violation(__i); - _STL_ERROR:: - __postincrement_operator_and_assignment_requirement_violation(__i, *__i); -} -}; - -/* ForwardIterator Requirements */ - -template -struct _ForwardIterator_concept_specification { -static void -_ForwardIterator_requirement_violation(_ForwardIterator __i) { - // Refinement of InputIterator - _InputIterator_concept_specification<_ForwardIterator>:: - _InputIterator_requirement_violation(__i); -} -}; - -template -struct _Mutable_ForwardIterator_concept_specification { -static void -_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) { - _ForwardIterator_concept_specification<_ForwardIterator>:: - _ForwardIterator_requirement_violation(__i); - // Refinement of OutputIterator - _OutputIterator_concept_specification<_ForwardIterator>:: - _OutputIterator_requirement_violation(__i); -} -}; - -/* BidirectionalIterator Requirements */ - -template -struct _BidirectionalIterator_concept_specification { -static void -_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) { - // Refinement of ForwardIterator - _ForwardIterator_concept_specification<_BidirectionalIterator>:: - _ForwardIterator_requirement_violation(__i); - // Valid Expressions - _STL_ERROR::__predecrement_operator_requirement_violation(__i); - _STL_ERROR::__postdecrement_operator_requirement_violation(__i); -} -}; - -template -struct _Mutable_BidirectionalIterator_concept_specification { -static void -_Mutable_BidirectionalIterator_requirement_violation( - _BidirectionalIterator __i) -{ - _BidirectionalIterator_concept_specification<_BidirectionalIterator>:: - _BidirectionalIterator_requirement_violation(__i); - // Refinement of mutable_ForwardIterator - _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>:: - _Mutable_ForwardIterator_requirement_violation(__i); - typedef typename - __value_type_type_definition_requirement_violation< - _BidirectionalIterator>::value_type __T; - typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0; - // Valid Expressions - _STL_ERROR:: - __postincrement_operator_and_assignment_requirement_violation(__i, - *__tmp_ptr); -} -}; - -/* RandomAccessIterator Requirements */ - -template -struct _RandomAccessIterator_concept_specification { -static void -_RandomAccessIterator_requirement_violation(_RandAccIter __i) { - // Refinement of BidirectionalIterator - _BidirectionalIterator_concept_specification<_RandAccIter>:: - _BidirectionalIterator_requirement_violation(__i); - // Refinement of LessThanComparable - _LessThanComparable_concept_specification<_RandAccIter>:: - _LessThanComparable_requirement_violation(__i); - typedef typename - __value_type_type_definition_requirement_violation<_RandAccIter> - ::value_type - value_type; - typedef typename - __difference_type_type_definition_requirement_violation<_RandAccIter> - ::difference_type - _Dist; - typedef typename _Mutable_trait<_Dist>::_Type _MutDist; - - // Valid Expressions - _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i, - _MutDist()); - _STL_ERROR::__iterator_addition_requirement_violation(__i, - _MutDist()); - _STL_ERROR:: - __iterator_subtraction_assignment_requirement_violation(__i, - _MutDist()); - _STL_ERROR::__iterator_subtraction_requirement_violation(__i, - _MutDist()); - _STL_ERROR::__difference_operator_requirement_violation(__i, __i, - _MutDist()); - typename _Mutable_trait::_Type* __dummy_ptr = 0; - _STL_ERROR::__element_access_operator_requirement_violation(__i, - __dummy_ptr, - _MutDist()); -} -}; - -template -struct _Mutable_RandomAccessIterator_concept_specification { -static void -_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i) -{ - _RandomAccessIterator_concept_specification<_RandAccIter>:: - _RandomAccessIterator_requirement_violation(__i); - // Refinement of mutable_BidirectionalIterator - _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>:: - _Mutable_BidirectionalIterator_requirement_violation(__i); - typedef typename - __value_type_type_definition_requirement_violation<_RandAccIter> - ::value_type - value_type; - typedef typename - __difference_type_type_definition_requirement_violation<_RandAccIter> - ::difference_type - _Dist; - - typename _Mutable_trait::_Type* __tmp_ptr = 0; - // Valid Expressions - _STL_ERROR::__element_assignment_operator_requirement_violation(__i, - __tmp_ptr, _Dist()); -} -}; - -#define _STLP_TYPEDEF_REQUIREMENT(__REQUIREMENT) \ -template \ -struct __##__REQUIREMENT##__typedef_requirement_violation { \ - typedef typename Type::__REQUIREMENT __REQUIREMENT; \ -}; - -_STLP_TYPEDEF_REQUIREMENT(value_type); -_STLP_TYPEDEF_REQUIREMENT(difference_type); -_STLP_TYPEDEF_REQUIREMENT(size_type); -_STLP_TYPEDEF_REQUIREMENT(reference); -_STLP_TYPEDEF_REQUIREMENT(const_reference); -_STLP_TYPEDEF_REQUIREMENT(pointer); -_STLP_TYPEDEF_REQUIREMENT(const_pointer); - - -template -struct _Allocator_concept_specification { -static void -_Allocator_requirement_violation(_Alloc __a) { - // Refinement of DefaultConstructible - _DefaultConstructible_concept_specification<_Alloc>:: - _DefaultConstructible_requirement_violation(__a); - // Refinement of EqualityComparable - _EqualityComparable_concept_specification<_Alloc>:: - _EqualityComparable_requirement_violation(__a); - // Associated Types - __value_type__typedef_requirement_violation<_Alloc>(); - __difference_type__typedef_requirement_violation<_Alloc>(); - __size_type__typedef_requirement_violation<_Alloc>(); - __reference__typedef_requirement_violation<_Alloc>(); - __const_reference__typedef_requirement_violation<_Alloc>(); - __pointer__typedef_requirement_violation<_Alloc>(); - __const_pointer__typedef_requirement_violation<_Alloc>(); - typedef typename _Alloc::value_type _Type; - _STLP_REQUIRES_SAME_TYPE(typename _Alloc::rebind<_Type>::other, _Alloc); -} -}; - -#endif /* _STLP_USE_CONCEPT_CHECKS */ - -#endif /* __CONCEPT_CHECKS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/config/_aix.h b/SDK/stlport/stl/config/_aix.h deleted file mode 100644 index bcbcb328..00000000 --- a/SDK/stlport/stl/config/_aix.h +++ /dev/null @@ -1 +0,0 @@ -#define _STLP_PLATFORM "AIX" diff --git a/SDK/stlport/stl/config/_apcc.h b/SDK/stlport/stl/config/_apcc.h deleted file mode 100644 index 5e8b1150..00000000 --- a/SDK/stlport/stl/config/_apcc.h +++ /dev/null @@ -1,31 +0,0 @@ -// STLport config file for Apogee 4.x - -#define _STLP_COMPILER "Apogee" - -#define _STLP_NO_NEW_NEW_HEADER 1 -#define _STLP_HAS_NO_NEW_IOSTREAMS 1 -#define _STLP_HAS_NO_NEW_C_HEADERS 1 - -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif -// # define _STLP_RAND48 1 -#define _STLP_LONG_LONG long long -#define _STLP_NO_BAD_ALLOC 1 -#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -#define _STLP_NO_EXCEPTION_HEADER 1 - -#undef _STLP_LINK_TIME_INSTANTIATION -#define _STLP_LINK_TIME_INSTANTIATION 1 - -#ifdef __STDLIB -# undef _STLP_NO_NEW_C_HEADERS -# undef _STLP_NO_NEW_NEW_HEADER -# undef _STLP_NO_BAD_ALLOC -# undef _STLP_LONG_LONG -#else -# undef _STLP_NO_EXCEPTION_SPEC -# define _STLP_NO_EXCEPTION_SPEC 1 -#endif diff --git a/SDK/stlport/stl/config/_apple.h b/SDK/stlport/stl/config/_apple.h deleted file mode 100644 index 4c030db6..00000000 --- a/SDK/stlport/stl/config/_apple.h +++ /dev/null @@ -1,122 +0,0 @@ -/* STLport configuration file - * It is internal STLport header - DO NOT include it directly - */ - -/* common configuration settings for Apple MPW MrCpp / SCpp */ - -#if defined (__MRC__) -# define _STLP_COMPILER "MPW MrCpp" -#else -# define _STLP_COMPILER "MPW SCpp" -#endif - -#if defined(__MRC__) && __MRC__ < 0x500 -# error Apple's MPW MrCpp v.5.0.0 or better compiler required -#endif -#if defined(__SC__) && __SC__ < 0x890 -# error Apple's MPW SCpp v.8.9.0 or better compiler required -#endif - -/* TODO: Check that this config is necessary for all compiler versions. - * It is here for historical reasons for the moment. - */ -#define _STLP_NO_CONTAINERS_EXTENSION - -#ifdef qMacApp -# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */ -# include -# include -# include -# define _STLP_FILE__ _FILE_AC -# define _STLP_DEBUG_MESSAGE -# define __stl_debug_message ProgramBreak_AC -# include -# endif -# include -#else -# include -# include -#endif - -#define _STLP_UINT32_T UInt32 -typedef int wint_t; - -#ifndef TYPE_BOOL -# error must be included. (TYPE_BOOL) -#endif -#if !TYPE_BOOL -# define _STLP_NO_BOOL -# define _STLP_DONT_USE_BOOL_TYPEDEF -#endif - -#ifndef TYPE_LONGLONG -# error must be included. (TYPE_LONGLONG) -#endif -#if TYPE_LONGLONG -# define _STLP_LONG_LONG long long -#endif - -#if !__option(exceptions) -# define _STLP_HAS_NO_EXCEPTIONS -#endif - -#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail."); -#define _STLP_ASSERT_MSG_TRAILER " " - -#ifdef _STLP_DEBUG -# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x) -#endif - -#if defined(__MRC__) -# ifndef __spillargs -# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ] -# endif -#endif - -#if defined(__SC__) -#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double -#endif - -#ifndef _STLP_NATIVE_INCLUDE_PATH -# if __option(unix_includes) -# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL} -# else -# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL} -# endif -#endif -#if !defined(_STLP_MAKE_HEADER) -# if !__option(unix_includes) -# define _STLP_MAKE_HEADER(path, header) // Mac uses ":" for directory delimiter -# endif -#endif - -# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation - -#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ] -#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet. -#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated -#define _NOTHREADS //*ty 12/07/2001 - - -// native library limitations -#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet -#define _STLP_NO_BAD_ALLOC // known limitation -#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation -#define _STLP_NO_NEW_NEW_HEADER // known limitation -#define _STLP_NO_NATIVE_MBSTATE_T // known limitation -#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation -#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation -#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation -#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation - -// compiler limitations -# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS - -# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround -# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround -# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround -# define _STLP_THROW_RETURN_BUG // known limitation -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation -# define _STLP_NO_RELOPS_NAMESPACE // known limitation -// end of stl_apple.h diff --git a/SDK/stlport/stl/config/_as400.h b/SDK/stlport/stl/config/_as400.h deleted file mode 100644 index a0261a45..00000000 --- a/SDK/stlport/stl/config/_as400.h +++ /dev/null @@ -1,56 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -// AS/400 C++ config - -# ifdef _REENTRANT -# define _PTHREADS -# endif - -# define _STLP_NO_NEW_NEW_HEADER 1 - -# define _STLP_NO_BOOL -# define _STLP_LIMITED_DEFAULT_TEMPLATES - -# define _STLP_HAS_NO_NAMESPACES -# define _STLP_NEED_TYPENAME -# define _STLP_NEED_EXPLICIT -# define _STLP_HAS_NO_EXCEPTIONS -# define _STLP_NO_EXCEPTION_SPEC -# define _STLP_NO_ARROW_OPERATOR -# define _STLP_NO_NEW_STYLE_CASTS - -# define _STLP_NEED_MUTABLE -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX -# define _STLP_NO_BAD_ALLOC -# define _STLP_NO_MEMBER_TEMPLATES -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD -# define _STLP_NO_FRIEND_TEMPLATES -# define _STLP_NO_QUALIFIED_FRIENDS -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER - -# define _STLP_NO_METHOD_SPECIALIZATION -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS - -// # define _STLP_NO_EXCEPTION_HEADER - -# define _STLP_HAS_NO_NEW_C_HEADERS - -# define _STLP_STATIC_CONST_INIT_BUG -# define _STLP_THROW_RETURN_BUG -# define _STLP_LINK_TIME_INSTANTIATION -# define _STLP_NO_TEMPLATE_CONVERSIONS - -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1 - -# if defined(_LONG_LONG) -# define _STLP_LONG_LONG long long -# endif -# if defined(_PTHREADS) -# define _MULTI_THREADED -# endif -// fbp : to fix __partition() problem -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 diff --git a/SDK/stlport/stl/config/_auto_link.h b/SDK/stlport/stl/config/_auto_link.h deleted file mode 100644 index 52b5232c..00000000 --- a/SDK/stlport/stl/config/_auto_link.h +++ /dev/null @@ -1,57 +0,0 @@ -/* We do not use auto link feature when: - * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK) - * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS) - * - we are building a C translation unit, STLport is a C++ Standard library implementation - */ -#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \ - !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \ - defined (__cplusplus) - -# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X) -# define _STLP_STRINGIZE_AUX(X) #X - -# if defined (_STLP_DEBUG) -# define _STLP_LIB_OPTIM_MODE "stld" -# elif defined (_DEBUG) -# define _STLP_LIB_OPTIM_MODE "d" -# else -# define _STLP_LIB_OPTIM_MODE "" -# endif - -# if defined (_STLP_LIB_NAME_MOTIF) -# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF -# else -# define _STLP_LIB_MOTIF "" -# endif - -# if defined (_STLP_USE_DYNAMIC_LIB) -# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# define _STLP_LIB_TYPE "_x" -# else -# define _STLP_LIB_TYPE "" -# endif -# else -# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# define _STLP_LIB_TYPE "_statix" -# else -# define _STLP_LIB_TYPE "_static" -# endif -# endif - -# define _STLP_VERSION_STR _STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR) - -# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF"."_STLP_VERSION_STR".lib" - -# if defined (_STLP_VERBOSE_AUTO_LINK) -# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB) -# endif -# pragma comment (lib, _STLP_STLPORT_LIB) - -# undef _STLP_STLPORT_LIB -# undef _STLP_LIB_OPTIM_MODE -# undef _STLP_LIB_TYPE -# undef _STLP_STRINGIZE_AUX -# undef _STLP_STRINGIZE - -#endif /* _STLP_DONT_USE_AUTO_LINK */ - diff --git a/SDK/stlport/stl/config/_bc.h b/SDK/stlport/stl/config/_bc.h deleted file mode 100644 index b56de07c..00000000 --- a/SDK/stlport/stl/config/_bc.h +++ /dev/null @@ -1,125 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -//#define _STLP_VERBOSE - -#define _STLP_COMPILER "Borland" - -#if (__BORLANDC__ < 0x551) -# error - Borland compilers below version 5.5.1 not supported. -#endif - -#if (__BORLANDC__ >= 0x580) && (__BORLANDC__ < 0x590) -# define _STLP_NO_NEW_C_HEADERS -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header> -# define _STLP_NO_FORCE_INSTANTIATE -#endif - -#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570) -# define _USE_OLD_RW_STL -#endif - -#if (__BORLANDC__ >= 0x560) -# define NOWINBASEINTERLOCK // src/fstream.cpp error in winbase.h -#endif - -#if (__BORLANDC__ < 0x564) -# define _STLP_QUALIFIED_SPECIALIZATION_BUG -#endif - -#if (__BORLANDC__ < 0x560) -# define _STLP_NO_CONTAINERS_EXTENSION -#endif - -#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER -#define _STLP_DONT_USE_PRIV_NAMESPACE -#define _STLP_NO_VENDOR_STDLIB_L -#define _STLP_NO_VENDOR_MATH_F -#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 -#define _STLP_NO_NATIVE_MBSTATE_T -#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION -#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT -#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL) -# define _UNCAUGHT_EXCEPTION 1 -#endif - -// problem -#define _STLP_STATIC_CONST_INIT_BUG - -// problems -#define _STLP_MEMBER_SPECIALIZATION_BUG 1 -#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1 - -#define _STLP_LONG_LONG __int64 - -// auto enable thread safety and exceptions: -#ifndef _CPPUNWIND -# define _STLP_HAS_NO_EXCEPTIONS -#endif - -#if defined (__MT__) && !defined (_NOTHREADS) && !defined (_REENTRANT) -# if defined (_STLP_VERBOSE) -# pragma message ("multi threaded") -# endif -# define _REENTRANT 1 -#else -# if defined (_STLP_VERBOSE) -# pragma message ("single threaded") -# endif -#endif - -#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) -#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) - -#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) -#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) - -#if defined (_DLL) -# define _STLP_DLL -#endif -#if defined (_RTLDLL) -# define _STLP_RUNTIME_DLL -#endif -#include -#undef _STLP_RUNTIME_DLL -#undef _STLP_DLL - -#if defined (_STLP_USE_DYNAMIC_LIB) -# if defined (_STLP_VERBOSE) -# pragma message ("Using/Building STLport dll") -# endif -#elif defined (_STLP_USE_STATIC_LIB) -# if defined (_STLP_VERBOSE) -# pragma message ("Using/Building STLport lib") -# endif -#else -# error Unknown STLport usage config (dll/lib?) -#endif - -#if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# if defined (_STLP_VERBOSE) -# pragma message ("Using cross version of native runtime") -# endif -#endif - -#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD) -//# define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport) -#endif -//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport) - -#if defined (_STLP_USE_DYNAMIC_LIB) -# define _STLP_USE_DECLSPEC 1 -# if (__BORLANDC__ < 0x580) -# if defined (__BUILDING_STLPORT) -# define _STLP_CALL __cdecl __export -# else -# define _STLP_CALL __cdecl __import -# endif -#else -# define _STLP_CALL __cdecl -#endif -#else -# define _STLP_CALL __cdecl -#endif - -#include diff --git a/SDK/stlport/stl/config/_como.h b/SDK/stlport/stl/config/_como.h deleted file mode 100644 index 6076f880..00000000 --- a/SDK/stlport/stl/config/_como.h +++ /dev/null @@ -1,207 +0,0 @@ - -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Comeau" - -#include - -#define _STLP_UINT32_T unsigned int - -#define _STLP_HAS_NO_NEW_C_HEADERS -// #define _STLP_VENDOR_GLOBAL_EXCEPT_STD -#define _STLP_LONG_LONG long long - - -// -// ADDITIONS FOR COMEAU C++, made by Comeau Computing. -// We can be reached through comeau@comeaucomputing.com -// You shouldn't need to change anything below here for Comeau C++. -// If you do, please tell us at comeau@comeaucomputing.com -// -// Changes made here, AND THROUGH ALL FILES, based upon the __COMO__ macro -// (and SIMILAR NAMES INVOLVING COMO).... no doubt some of this will -// change as SGI integrates the changes into their code base since -// some changes are not really Comeau C++ specific, but required to -// make the SGI code compliant with Standard C++). -// -// Testing was done with Comeau C++ 4.2.44 and 4.2.45.2. Changes were made for -// both Comeau relaxed mode and Comeau strict mode, especially for end user code -// (that is, some of the .cxx files cannot compile in strict mode, because they -// contain extensions to Standard C++, however their object code forms can -// be used once compiled in relaxed mode, even if the end user code uses -// strict mode). -// -// These changes may also work for some earlier versions of Comeau C++, -// though we have not tested them. -// -// Actual mods made under RedHat 6.1 LINUX, should be ok with SuSE too and -// other LINUX's, and older Caldera LINUX, Solaris/SPARC, SunOS, SCO UNIX, -// and NetBSD. Other platforms may be added. Comeau will also perform -// custom ports for you. -// -// Check libcomo details at http://www.comeaucomputing.com/libcomo and -// http://www.comeaucomputing.com -// -// History of Comeau changes (this is rough, as work was often going on in parallel): -// BETA1 July 14, 2000, Initial port for RedHat 6.1 INTEL/ELF -// BETA2 Aug 4, 2000, Stronger RedHat support -// Support for Comeau strict mode for end user code -// BETA3 Aug 22, 2000, Support for other LINUX/INTEL/ELF's, including older ones -// BETA4 Sept 2, 2000, Initial support for SCO UNIX + other UNIX x86 SVR3's -// Stronger support for end user Comeau strict mode -// BETA5 Oct 5, 2000, Initial support for Solaris/SPARC -// More SCO support (though still incomplete) -// BETA6 Feb 5, 2001, Minor mods to accomodate Comeau C++ 4.2.45.1 -// BETA7 Mar 13, 2001, Verified with Comeau C++ 4.2.45.2 -// Minor NetBSD support -// BETA8 Apr 1. 2001, Initial support for SunOS/SPARC -// BETA9 Apr 7, 2001, Stronger SCO support + other UNIX x86 SVR3's -// Mods for an fpos_t problem for some LINUXes -// Mods since Destroy did not work in strict mode -// BETA10 Apr 12. 2001, Stronger NetBSD support -// -// PLANNED: -// BETAx TBA TBA, 2001, NetBSD, UNIXWARE, and Windows support expected -// - - -#ifdef __linux__ - -# define _STLP_NO_NATIVE_MBSTATE_T 1 -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -# define _STLP_NO_LONG_DOUBLE 1 - -// Comeau C++ under LINUX/INTEL/ELF -// Preprocess away "long long" routines for now, even in relaxed mode -# define __wcstoull_internal_defined 1 -# define __wcstoll_internal_defined 1 - -#endif /* __COMO__ under __linux__ */ - -#ifdef __USING_x86SVR3x_WITH_COMO /* SCO et al */ -/* UNIX 386+ SVR3 mods made with __USING_x86SVR3x_WITH_COMO - in other sources, not here */ -# define atan2l atan2 -# define cosl cos -# define sinl sin -# define sqrtl sqrt -# include - inline long double expl(long double arg) { return exp(arg); } - inline long double logl(long double arg) { return log(arg); } -# define log10l log10 - -# define sinhl sinh -# define coshl cosh -# define fabsl fabs -namespace std { - inline int min(int a, int b) { return a>b ? b : a; } -} -#endif - -#ifdef sun -// Comeau C++ under Solaris/SPARC or SunOS - -#ifdef solarissparc -#define __USING_SOLARIS_SPARC_WITH_COMO /* show this in the source when grep'ing for COMO */ -// Note comowchar.h for Solaris/SPARC wchar stuff - -#include -# define sinf sin -# define sinl sin -# define sinhf sinh -# define sinhl sinh -# define cosf cos -# define cosl cos -# define coshf cosh -# define coshl cosh -# define atan2l atan2 -# define atan2f atan2 - inline float logf(float arg) { return log(arg); } - inline long double logl(long double arg) { return log(arg); } -# define log10f log10 -# define log10l log10 -# define expf exp - inline long double expl(long double arg) { return exp(arg); } -# define sqrtf sqrt -# define sqrtl sqrt -# define fabsf fabs -# define fabsl fabs -#else -#define __USING_SUNOS_WITH_COMO - -#define __unix 1 -#define __EXTENSIONS__ /* This might create undue noise somewhere */ -#endif -#endif /* sun */ - -#if defined(__NetBSD__) -// From non-como #ifdef __GNUC__ above -#undef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE -#define __unix 1 - -#include -// Some joker #define'd __END_DECLS as }; -#undef __END_DECLS -#define __END_DECLS } - -// prob -#include -#undef __RENAME -#define __RENAME(x) - -#define wchar_t __COMO_WCHAR_T -#include -#undef wchar_t - -#include -# ifdef BORIS_DISABLED -# define atan2l atan2 -# define cosl cos -# define sinl sin -# define sqrtl sqrt - inline long double expl(long double arg) { return exp(arg); } - inline long double logl(long double arg) { return log(arg); } -# define log10l log10 -# define sinhl sinh -# define coshl cosh -# define fabsl fabs -# endif -#endif /* __NetBSD__ under __COMO__ */ - -// Shouldn't need to change anything below here for Comeau C++ -// If so, tell us at comeau@comeaucomputing.com - -#define _STLP_NO_DRAND48 - -#define _STLP_PARTIAL_SPECIALIZATION_SYNTAX -#define _STLP_NO_USING_CLAUSE_IN_CLASS - -#if __COMO_VERSION__ < 4300 -#if __COMO_VERSION__ >= 4245 -#define _STLP_NO_EXCEPTION_HEADER /**/ - // Is this needed? -# include -#endif -#define _STLP_NO_BAD_ALLOC /**/ -#define _STLP_USE_AUTO_PTR_CONVERSIONS /**/ -#endif - -// this one is true only with MS -# if defined (_MSC_VER) -# define _STLP_WCHAR_T_IS_USHORT 1 -# if _MSC_VER <= 1200 -# define _STLP_VENDOR_GLOBAL_CSTD -# endif -# if _MSC_VER < 1100 -# define _STLP_NO_BAD_ALLOC 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_NO_NEW_NEW_HEADER 1 -# define _STLP_USE_NO_IOSTREAMS 1 -# endif -# endif - -// # define __EDG_SWITCHES - - diff --git a/SDK/stlport/stl/config/_cray.h b/SDK/stlport/stl/config/_cray.h deleted file mode 100644 index 32abd4f4..00000000 --- a/SDK/stlport/stl/config/_cray.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#define _STLP_COMPILER "CC" - -// Mostly correct guess, change it for Alpha (and other environments -// that has 64-bit "long") -# define _STLP_UINT32_T unsigned long - -// Uncomment if long long is available -# define _STLP_LONG_LONG long long - -// Uncomment this if your compiler can't inline while(), for() -# define _STLP_LOOP_INLINE_PROBLEMS 1 - -// Uncomment this if your compiler does not support exceptions -// Cray C++ supports exceptions when '-h exceptions' option is user; -// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions' -// is NOT used. -//# define _STLP_HAS_NO_EXCEPTIONS 1 - -// Delete? -// Define this if compiler lacks header -//# define _STLP_NO_EXCEPTION_HEADER 1 - -// Uncomment this if your C library has lrand48() function -# define _STLP_RAND48 1 - -// Uncomment if native new-style C library headers lile , etc are not available. -# define _STLP_HAS_NO_NEW_C_HEADERS 1 - -// uncomment if new-style headers is available -# define _STLP_NO_NEW_NEW_HEADER 1 - -// uncomment this if and other STD headers put their stuff in ::namespace, -// not std:: -# define _STLP_VENDOR_GLOBAL_STD - -// uncomment this if and the like put stuff in ::namespace, -// not std:: -# define _STLP_VENDOR_GLOBAL_CSTD - -# define _STLP_NATIVE_C_HEADER(__x) -// WARNING: Following is hardcoded to the system default C++ include files -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) - - -# define _STLP_NO_NATIVE_MBSTATE_T -# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS -//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD - -#if !defined (_CRAYIEEE) -# define _STLP_NO_IEC559_SUPPORT 1 -#endif diff --git a/SDK/stlport/stl/config/_cygwin.h b/SDK/stlport/stl/config/_cygwin.h deleted file mode 100644 index 7960d01e..00000000 --- a/SDK/stlport/stl/config/_cygwin.h +++ /dev/null @@ -1,6 +0,0 @@ -#define _STLP_PLATFORM "Cygwin" - -/* Glibc is the platform API */ -#if !defined (_STLP_USE_GLIBC) -# define _STLP_USE_GLIBC -#endif diff --git a/SDK/stlport/stl/config/_dec.h b/SDK/stlport/stl/config/_dec.h deleted file mode 100644 index 9f732d9b..00000000 --- a/SDK/stlport/stl/config/_dec.h +++ /dev/null @@ -1,107 +0,0 @@ -#define _STLP_COMPILER "Dec" - -# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG - -# define _STLP_NATIVE_HEADER(header) <../cxx/##header> -# define _STLP_NATIVE_C_HEADER(x) <../include/##x> - -#if (__DECCXX_VER < 60300000) -# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header> -#else -# define _STLP_NATIVE_CPP_C_HEADER(header) -#endif - -# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header> - -// Alpha is little-endian -# define _STLP_LITTLE_ENDIAN - -// collisions -# define _STLP_DONT_PUT_STLPORT_IN_STD - -#if (__DECCXX_VER < 60000000) - -// automatic template instantiation does not -// work with namespaces ;( -# define _STLP_HAS_NO_NAMESPACES 1 - -# define _STLP_NO_NEW_NEW_HEADER 1 - -# define _STLP_NO_WCHAR_T 1 -# define _STLP_NEED_EXPLICIT 1 - -# define _STLP_NO_BOOL 1 -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_BAD_ALLOC 1 - - -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 - -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_BROKEN_USING_DIRECTIVE 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 - -#endif - - -#ifdef __NO_USE_STD_IOSTREAM -# define _STLP_HAS_NO_NEW_IOSTREAMS 1 -# else -// default is to use new iostreams, anyway -# ifndef __USE_STD_IOSTREAM -# define __USE_STD_IOSTREAM -# endif -#endif - -//# ifndef __STD_STRICT_ANSI_ERRORS -//# endif - -#ifndef __EXCEPTIONS -# define _STLP_HAS_NO_EXCEPTIONS 1 -#endif - -# ifdef __IMPLICIT_INCLUDE_ENABLED - -// but, works with ours ;). -# define _STLP_LINK_TIME_INSTANTIATION 1 -# else -# undef _STLP_LINK_TIME_INSTANTIATION -# endif - -# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM) -// we should ban that ! -// # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM" -# endif - -# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS)) -# define _STLP_STRICT_ANSI 1 -# else -// we want to enforce it -# define _STLP_LONG_LONG long long -# endif - -// unsigned 32-bit integer type -# define _STLP_UINT32_T unsigned int -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif -// # define _STLP_RAND48 1 - -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 - -# if (__DECCXX_VER <= 60600000) -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# endif - diff --git a/SDK/stlport/stl/config/_dec_vms.h b/SDK/stlport/stl/config/_dec_vms.h deleted file mode 100644 index 5df8d264..00000000 --- a/SDK/stlport/stl/config/_dec_vms.h +++ /dev/null @@ -1,90 +0,0 @@ -// OpenVMS version - -#define _STLP_COMPILER "Dec Vms" - -# define _STLP_NATIVE_HEADER(header) -# define _STLP_NATIVE_C_HEADER(x) -# define _STLP_NATIVE_CPP_C_HEADER(header) -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) - -#if (__DECCXX_VER < 60000000) - -// automatic template instantiation does not -// work with namespaces ;( -# define _STLP_HAS_NO_NAMESPACES 1 - -# define _STLP_NO_WCHAR_T 1 -# define _STLP_NEED_EXPLICIT 1 - -# define _STLP_NO_BOOL 1 -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_BAD_ALLOC 1 - -# define _STLP_NO_NEW_NEW_HEADER 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 - -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_BROKEN_USING_DIRECTIVE 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 - -#endif - - -#ifdef __NO_USE_STD_IOSTREAM -# define _STLP_USE_NO_IOSTREAMS 1 -# else -// default is to use new iostreams, anyway -# ifndef __USE_STD_IOSTREAM -# define __USE_STD_IOSTREAM -# endif -#endif - -#ifndef __EXCEPTIONS -# define _STLP_HAS_NO_EXCEPTIONS 1 -#endif - -# ifdef __IMPLICIT_INCLUDE_ENABLED - -#ifdef _STLP_USE_NO_IOSTREAMS -// implicit include introduces conflicts -// between stlport and native lib. -# undef __IMPLICIT_INCLUDE_ENABLED -#endif - -// but, works with ours ;). -# define _STLP_LINK_TIME_INSTANTIATION 1 - -# endif - -# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM) -// we should ban that ! -# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM" -# endif - -# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS)) -// we want to enforce it -# define _STLP_LONG_LONG long long -# endif - -// unsigned 32-bit integer type -# define _STLP_UINT32_T unsigned int -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif -// # define _STLP_RAND48 1 - -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 - -#define _STLP_HAS_NO_NEW_C_HEADERS 1 - diff --git a/SDK/stlport/stl/config/_detect_dll_or_lib.h b/SDK/stlport/stl/config/_detect_dll_or_lib.h deleted file mode 100644 index 39049fac..00000000 --- a/SDK/stlport/stl/config/_detect_dll_or_lib.h +++ /dev/null @@ -1,70 +0,0 @@ -/* File used to define macros: - * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the - * STLport dlls. - * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of - * the STLport static libs. - * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime - * in a version different from the STLport one. - * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that - * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB - * will surely be defined otherwise there is no need to force macro defines. - * - * Before including this file the compiler must define: - * _STLP_DLL: If we are building a dll - * _STLP_RUNTIME_DLL: If we are using native runtime as a dll - */ -#if defined (__BUILDING_STLPORT) -# undef _STLP_USE_DYNAMIC_LIB -# undef _STLP_USE_STATIC_LIB -# if defined (_STLP_DLL) -/* We are building the STLport dll */ -# define _STLP_USE_DYNAMIC_LIB -# if !defined (_STLP_RUNTIME_DLL) -# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB -# endif -# else -# define _STLP_USE_STATIC_LIB -# if defined (_STLP_RUNTIME_DLL) -# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB -# endif -# endif -#else -# if !defined (_STLP_NO_IOSTREAMS) -/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing - * the native runtime. - */ -# if defined (_STLP_RUNTIME_DLL) -# if !defined (_STLP_USE_STATIC_LIB) -# if !defined (_STLP_USE_DYNAMIC_LIB) -# define _STLP_USE_DYNAMIC_LIB -# endif -# else -/* The user is forcing use of STLport as a dynamic library. We signal it so - * that the STLport namespace will be modify to report such a combination - * and force the user to link with the rebuilt STLport library. - */ -# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB -# endif -# else -# if !defined(_STLP_USE_DYNAMIC_LIB) -# if !defined (_STLP_USE_STATIC_LIB) -# define _STLP_USE_STATIC_LIB -# endif -# else -/* Idem previous remark but the user forces use of the static native runtime. - */ -# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB -# endif -# endif -# else -/* If we do not build and use STLport libs we consider that we are in a static lib - * mode as only dynamic lib needs additional export/import specifier. - */ -# define _STLP_USE_STATIC_LIB -# endif -#endif - -/* we don't have a static native runtime library on evc3/evc4 */ -#ifdef _STLP_WCE -# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB -#endif diff --git a/SDK/stlport/stl/config/_dm.h b/SDK/stlport/stl/config/_dm.h deleted file mode 100644 index aa027a9e..00000000 --- a/SDK/stlport/stl/config/_dm.h +++ /dev/null @@ -1,109 +0,0 @@ -// STLport configuration file for Digital Mars C++ - -//#define _STLP_VERBOSE - -#define _STLP_COMPILER "DMC" - -#if defined (_STLP_VERBOSE) -# pragma message __DMC_VERSION_STRING__ -#endif - -#if (__DMC__ < 0x846) -# error "Digital Mars C++ versions prior to 8.46 are not supported!" -#endif - -#ifndef _CPPUNWIND -# define _STLP_NO_EXCEPTIONS -#endif -#define _STLP_VENDOR_GLOBAL_CSTD - -//DMC prefer enum to real static const variable because it do not consider -//static const as const enough to be used in switch declaration... -#define _STLP_STATIC_CONST_INIT_BUG - -#if !defined (_WIN32) -// it's not fully supported on non-Win32 platforms -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS -#endif - -/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian - appear to have problems with STLport namespaces. Summary of the issues: - - STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error - if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses - Microsoft OMF format, which limits identifier length to about 512 bytes. - With STLport namespaces, some identifiers such as Category_Map in - src/locale_catalog.cpp may exceed the maximum OMF identifier length. - - DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp. - Exports in Digital Mars 'def' file must match mangled names in iostream.cpp. - With STLport namespaces, the mangled names in the intermediate files no - longer match these pre-defined exports. To use STLport dynamic libraries - and STLport namespaces with Digital Mars, the pre-defined exports in - src/iostream.cpp and the related Digital Mars 'def' files would need to be - revised. */ -#define _STLP_NO_OWN_NAMESPACE 1 - -// select threads strategy -#if defined (_MT) && !defined (_NOTHREADS) -# define _REENTRANT -#else -# define _NOTHREADS -#endif - -#ifndef _BOOL_DEFINED -# define _STLP_NO_BOOL -#else -# define _STLP_DONT_USE_BOOL_TYPEDEF -#endif - -#if _INTEGRAL_MAX_BITS >= 64 -# define _STLP_LONG_LONG long long -#endif - -#define _STLP_DONT_USE_PRIV_NAMESPACE -#define _STLP_NO_BAD_ALLOC -#define _STLP_THROW_RETURN_BUG - -#if !defined (_DLL) -# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT -#endif - -#define _STLP_USE_ABBREVS -#define _STLP_NO_CONTAINERS_EXTENSION -#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER - -#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) -#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) - -#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) -#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) - -#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport) -#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport) - -#if defined (_WINDLL) -# define _STLP_DLL -#endif -#if defined (_DLL) -# define _STLP_RUNTIME_DLL -#endif -#include -#undef _STLP_RUNTIME_DLL -#undef _STLP_DLL - -#if defined (_STLP_USE_DYNAMIC_LIB) -# define _STLP_USE_DECLSPEC 1 -# if defined (__BUILDING_STLPORT) -# define _STLP_CALL __export -# else -# define _STLP_CALL -# endif -#else -# define _STLP_CALL -#endif - -#include - -# undef __SC__ - diff --git a/SDK/stlport/stl/config/_epilog.h b/SDK/stlport/stl/config/_epilog.h deleted file mode 100644 index ecbace5e..00000000 --- a/SDK/stlport/stl/config/_epilog.h +++ /dev/null @@ -1,32 +0,0 @@ -#if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) - -#if defined (__BORLANDC__) -# pragma option pop -# pragma option -w-pow // -w-8062 Previous options and warnings not restored -#else -# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200)) -# pragma warning (pop) -# endif -# pragma pack (pop) -#endif - -#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) - -# pragma reset woff 1174 -# pragma reset woff 1375 -# pragma reset woff 1209 -/* from iterator_base.h */ -# pragma reset woff 1183 - -#elif defined (__DECCXX) - -# ifdef __PRAGMA_ENVIRONMENT -# pragma __environment __restore -# endif - -#elif defined (__IBMCPP__) - -# pragma info(restore) - -#endif - diff --git a/SDK/stlport/stl/config/_evc.h b/SDK/stlport/stl/config/_evc.h deleted file mode 100644 index 4881a9ae..00000000 --- a/SDK/stlport/stl/config/_evc.h +++ /dev/null @@ -1,354 +0,0 @@ -/* - * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport - * May 2004 - * Origin : Zdenek Nemec - zero@mapfactor.com - * Michael Fink - vividos@users.sourceforge.net - */ - -#ifndef _STLP_EVC_H -#define _STLP_EVC_H - -#define _STLP_COMPILER "eMbedded Visual C++" - -// This flag is being used by STLport to support -// old-fashioned Windows CE SDK (see stl_wince.h) -// do not use with eMebedded Visual C++ 3 or 4! -#ifdef _STLP_WINCE -# undef _STLP_WINCE -#endif - -/* Compiler dependent define. The following defines may be available: - * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3 - * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET - * _STLP_WCE always defined when compiling with one of the above - */ -#undef _STLP_WCE_EVC3 -#undef _STLP_WCE_NET - -#if (_WIN32_WCE > 300) -# define _STLP_WCE_NET UNDER_CE -#elif (_WIN32_WCE == 300) -# define _STLP_WCE_EVC3 UNDER_CE -#else -# error No support for Windows CE below 3.0! -#endif - -// This is defined for all platforms using Windows CE -#define _STLP_WCE - -/* All Windows CE versions up to at least version 5 are little-endian, even - * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */ -#define _STLP_LITTLE_ENDIAN - -// Ensure _DEBUG is defined. -#if defined (DEBUG) && !defined (_DEBUG) -# define _DEBUG -#endif - -// in evc3/4, on ARM, check that _STLP_DEBUG is not defined -// the ARM compiler has a bug that prevents that debug mode from working -#if _WIN32_WCE < 500 && defined(ARM) && defined(_STLP_DEBUG) -# error _STLP_DEBUG mode is not supported in evc3 and evc4 on the ARM platform! -#endif - -// inherit all msvc6 options -#include - -// CE up to at least version 5 has no C locale support -#define _STLP_NO_LOCALE_SUPPORT - -#if _WIN32_WCE >= 0x500 - // SDKs built with PB5 have terminate&co in namespace std... -# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD -# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD - // ...and new_handler/set_new_handler in the global namespace. -# define _STLP_GLOBAL_NEW_HANDLER 1 -#endif - -// Always threaded in eMbedded Visual C++ 3.0 and .NET -#ifndef _MT -# define _MT -#endif - -// we don't have a static native runtime library -#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB - -#if _WIN32_WCE < 400 -// no long double under CE3 and older -# define _STLP_NO_LONG_DOUBLE -#endif - -// no *f and *l math functions available -#define _STLP_NO_VENDOR_MATH_F -#define _STLP_NO_VENDOR_MATH_L - -/* - * Redirect cout, cerr and clog: - * If defined redirect cout, cerr and clog to - * files stdout.txt, stderr.txt and stdlog.txt - */ -//# define _STLP_REDIRECT_STDSTREAMS - -/* - * Static class members may generate LNK1179: - * Wrong COMDAT packing may cause LNK1179 error. - * For details see http://groups.google.com/groups?th=8a05c82c4ffee280 - * example P78. This define is not used/needed at this moment - * but may came handy in future... - */ -//# define _STLP_STATIC_MEMBERS_BUG - -// Use wide-string interface of windows native functions (CreateFile...). -// Note that this should be defined all the time while under CE. -#if defined (UNICODE) -# define _STLP_USE_WIDE_INTERFACE -#endif - -// Force exception std to std instead of __std_alias. -#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES) -# ifdef _STLP_VENDOR_EXCEPT_STD -# undef _STLP_VENDOR_EXCEPT_STD -# endif -# define _STLP_VENDOR_EXCEPT_STD std -#endif - -// short string optimization bug under evc3, evc4 using ARM compiler -#if _MSC_VER<1400 && (defined (ARM) || defined (_ARM_)) -# define _STLP_DONT_USE_SHORT_STRING_OPTIM -#endif - -// when using MFC, disable another placement new declaration, since there is one in wcealt.h -#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER) -# define __PLACEMENT_NEW_INLINE -#endif - -// threads -#undef _REENTRANT -#define _REENTRANT -#undef _NOTHREADS - -// Use old fashioned headers (ctime vs. time.h). -#undef _STLP_NO_NEW_C_HEADERS -#define _STLP_NO_NEW_C_HEADERS - -// exception handling support: only on evc4 and user added /GX to project settings -#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND) -# define _STLP_NO_EXCEPTION_HEADER -# define _STLP_NO_EXCEPTIONS -# undef _STLP_USE_EXCEPTIONS -# ifndef __THROW_BAD_ALLOC -# define __THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); } -# endif -#endif - -#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg) - -/* - * eMbedded Visual C++ .NET specific settings - */ -#if defined (_STLP_WCE_NET) - -// evc4 has no locale and time support -# define _STLP_NO_LOCALE_SUPPORT -# define _STLP_NO_TIME_SUPPORT - -// ptrdiff_t is not defined in evc4 headers -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif - -/* - * Helper macros for including the native headers in cases where a file with - * the same name also exists in the STLport include folder. The idea behind - * this is that we first go up one directory and then down into a dir that - * is only present in the native install but not in STLport. - * - */ -# if !defined (_STLP_NATIVE_INCLUDE_PATH) -# if defined (_X86_) -# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR) -# define _STLP_NATIVE_INCLUDE_PATH ../Emulator -# else -# define _STLP_NATIVE_INCLUDE_PATH ../X86 -# endif -# elif defined (_ARM_) -# if _MSC_VER < 1400 - // eVC3/4 -# if defined (ARMV4) -# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 -# elif defined (ARMV4I) -# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i -# elif defined (ARMV4T) -# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t -# else -# error Unknown ARM SDK. -# endif -# else - // VC8 crosscompiling for CE -# if defined (ARMV4) -# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 -# elif defined(ARMV4I) || defined(ARMV4T) -# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i -# else -# error Unknown ARM SDK. -# endif -# endif -# elif defined (_MIPS_) -# if defined (MIPS16) -# define _STLP_NATIVE_INCLUDE_PATH ../mips16 -# elif defined (MIPSII) -# define _STLP_NATIVE_INCLUDE_PATH ../mipsII -# elif defined (MIPSII_FP) -# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp -# elif defined (MIPSIV) -# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV -# elif defined (MIPSIV_FP) -# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp -# else -# error Unknown MIPS SDK. -# endif -# elif defined (SHx) -# if defined (SH3) -# define _STLP_NATIVE_INCLUDE_PATH ../sh3 -# elif defined (SH4) -# define _STLP_NATIVE_INCLUDE_PATH ../sh4 -# else -# error Unknown SHx SDK. -# endif -# else -# error Unknown SDK. -# endif -# endif /* !_STLP_NATIVE_INCLUDE_PATH */ - -/* Workaround when using MFCCE and using together: MFCCE's wcealt.h doesn't - * check for __PLACEMENT_NEW_INLINE before defining operator new, so when - * defines the operatore before, there will be an error C2084: - * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body". - */ -# ifdef _STLP_USE_MFC -# define __PLACEMENT_NEW_INLINE -# endif - -#endif /* _STLP_WCE_NET */ - -/* Workaround in _windows.h needs native headers access macros - * to be defined */ -#include - -/* - * eMbedded Visual C++ 3.0 specific settings - */ -#if defined (_STLP_WCE_EVC3) - -# define _STLP_NO_NATIVE_MBSTATE_T - -// evc3 has no locale and time support -# define _STLP_NO_LOCALE_SUPPORT -# define _STLP_NO_TIME_SUPPORT - -// evc3 has new, but no explicit header -# define _STLP_NO_NEW_HEADER -# define _STLP_NO_NEW_NEW_HEADER - -// evc3 has no bad_alloc and no typeinfo -# undef _STLP_NO_BAD_ALLOC -# define _STLP_NO_BAD_ALLOC - -# undef _STLP_NO_TYPEINFO -# define _STLP_NO_TYPEINFO - -// missing things in eMbedded Visual C++ 3.0 headers -# ifndef _SIZE_T_DEFINED - typedef unsigned int size_t; -# define _SIZE_T_DEFINED -# endif - -# ifndef _WCHAR_T_DEFINED - typedef unsigned short wchar_t; -# define _WCHAR_T_DEFINED -# endif - -// ptrdiff_t is not defined in evc3 headers -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif - -// clock_t is not defined in evc3 headers -# ifndef _CLOCK_T_DEFINED - typedef long clock_t; -# define _CLOCK_T_DEFINED -# endif - -// Struct tm is not defined in evc3 headers -# ifndef _TM_DEFINED -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag */ -}; -# define _TM_DEFINED -# endif - -// define placement new and delete operator -// note: when MFCCE headers are included first, don't define the new operator, -// since it was already defined in wcealt.h -# ifdef __cplusplus -# ifndef __PLACEMENT_NEW_INLINE -# ifndef _MFC_VER -inline void *__cdecl operator new(size_t, void *_P) { return (_P); } -# endif /* _MFC_VER */ -inline void __cdecl operator delete(void *, void *) { return; } -# define __PLACEMENT_NEW_INLINE -# endif -# endif /* __cplusplus */ - -// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS - -// evc3 doesn't have assert.h -# ifndef _ASSERT_DEFINED -# define assert(expr) _STLP_ASSERT(expr) -# define _ASSERT_DEFINED -# endif - -#endif /* _STLP_WCE_EVC3 */ - -// Minimize windows.h includes -#if !defined (WIN32_LEAN_AND_MEAN) -# define WIN32_LEAN_AND_MEAN -#endif -#if !defined (VC_EXTRALEAN) -# define VC_EXTRALEAN -#endif -#if !defined (STRICT) -# define STRICT -#endif - -// Don't let windows.h define its min and max macros. -#if !defined (NOMINMAX) -# define NOMINMAX -#endif - -/* - * original call: TerminateProcess(GetCurrentProcess(), 0); - * we substitute the GetCurrentProcess() with the result of the inline function - * defined in kfuncs.h, since we then can avoid including at all. - * all needed Win32 API functions are defined in - */ -#ifndef _ABORT_DEFINED -# define _STLP_ABORT() TerminateProcess(reinterpret_cast(66), 0) -# define _ABORT_DEFINED -#endif - -// Notice: windows.h isn't included here anymore; all needed defines are in -// stl/_windows.h now - -#endif /* _STLP_EVC_H */ diff --git a/SDK/stlport/stl/config/_freebsd.h b/SDK/stlport/stl/config/_freebsd.h deleted file mode 100644 index 1bb6b58d..00000000 --- a/SDK/stlport/stl/config/_freebsd.h +++ /dev/null @@ -1 +0,0 @@ -#define _STLP_PLATFORM "Free BSD" diff --git a/SDK/stlport/stl/config/_fujitsu.h b/SDK/stlport/stl/config/_fujitsu.h deleted file mode 100644 index cf91e05f..00000000 --- a/SDK/stlport/stl/config/_fujitsu.h +++ /dev/null @@ -1,7 +0,0 @@ -/* STLport configuration for Fujitsu compiler : looks like a perfect one ! */ -#define _STLP_COMPILER "Fujitsu" - -#define _STLP_NATIVE_INCLUDE_PATH ../std -#define _STLP_UINT32_T unsigned int -#define _STLP_LONG_LONG long long -#define _STLP_WCHAR_SUNPRO_EXCLUDE 1 diff --git a/SDK/stlport/stl/config/_gcc.h b/SDK/stlport/stl/config/_gcc.h deleted file mode 100644 index 5d1f7aee..00000000 --- a/SDK/stlport/stl/config/_gcc.h +++ /dev/null @@ -1,462 +0,0 @@ -/* STLport configuration file - * It is internal STLport header - DO NOT include it directly - */ - -#define _STLP_COMPILER "gcc" - -/* Systems having GLIBC installed have different traits */ -#if defined (__linux__) -# ifndef _STLP_USE_GLIBC -# define _STLP_USE_GLIBC 1 -# endif -# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC) -# define _STLP_USE_UCLIBC 1 -# endif -#endif - -#if defined (__CYGWIN__) && \ - (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99) -# define _STLP_NO_VENDOR_MATH_L -# define _STLP_NO_VENDOR_STDLIB_L -#endif - -#if (__GNUC__ < 3) -# define _STLP_NO_VENDOR_STDLIB_L -#endif - -/* We guess if we are using the cygwin distrib that has a special include schema. - * There is no way to distinguish a cygwin distrib used in no-cygwin mode from a - * mingw install. We are forced to use a configuration option - */ -#if !defined (_STLP_NATIVE_INCLUDE_PATH) && \ - (defined (__CYGWIN__) || defined (__MINGW32__) && defined (_STLP_NO_CYGWIN)) -# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3)) -# define _STLP_NATIVE_INCLUDE_PATH ../../../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__/include/c++ -# elif defined (_STLP_NO_CYGWIN) -# define _STLP_NATIVE_INCLUDE_PATH ../mingw -/*# else - * Before version gcc 3.4, the cygwin package include path was conform to the - * GNU convention which is set later in this file. - */ -# endif -#endif - -#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4)) -/* define for gcc versions before 3.4.0. */ -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD -#endif - -/* azov: gcc on lynx have a bug that causes internal - * compiler errors when compiling STLport with namespaces turned on. - * When the compiler gets better - comment out _STLP_HAS_NO_NAMESPACES - */ -#if defined (__Lynx__) && (__GNUC__ < 3) -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NO_STATIC_TEMPLATE_DATA 1 -/* turn off useless warning about including system headers */ -# define __NO_INCLUDE_WARN__ 1 -#endif - -/* Tru64 Unix, AIX, HP : gcc there by default uses native ld and hence cannot auto-instantiate - static template data. If you are using GNU ld, please say so in user_config.h header */ -#if (__GNUC__ < 3) && !defined(_STLP_GCC_USES_GNU_LD) && \ - ((defined (__osf__) && defined (__alpha__)) || defined (_AIX) || defined (__hpux) || defined(__amigaos__) ) -# define _STLP_NO_STATIC_TEMPLATE_DATA -#endif - -#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \ - (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \ - (defined (__MINGW32__) && defined (_MT))) -# define _REENTRANT -#endif - -#if defined (__DJGPP) -# define _STLP_RAND48 1 -# define _NOTHREADS 1 -# undef _PTHREADS -# define _STLP_LITTLE_ENDIAN -#endif - -#if defined (__MINGW32__) -/* Mingw32, egcs compiler using the Microsoft C runtime */ -# define _STLP_VENDOR_GLOBAL_CSTD -# undef _STLP_NO_DRAND48 -# define _STLP_NO_DRAND48 -# define _STLP_CALL - -# if defined (_STLP_NEW_PLATFORM_SDK) -/* For the moment the Windows SDK coming with Mingw still mimik the old platform SDK. */ -# undef _STLP_NEW_PLATFORM_SDK -# endif -#endif /* __MINGW32__ */ - -#if defined (__CYGWIN__) || defined (__MINGW32__) -# if !defined (_STLP_USE_STATIC_LIB) -# define _STLP_USE_DECLSPEC 1 -# if !defined (_STLP_USE_DYNAMIC_LIB) -# define _STLP_USE_DYNAMIC_LIB -# endif -# define _STLP_EXPORT_DECLSPEC __declspec(dllexport) -# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) -# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) -# endif -/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also - * used to import symbols from PSDK under MinGW - */ -# define _STLP_IMPORT_DECLSPEC __declspec(dllimport) -#endif - -#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__)) -# if !defined (__MINGW32__) && !defined (__CYGWIN__) -# define _STLP_NO_NATIVE_MBSTATE_T 1 -# endif -# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4) -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -# endif -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -#endif - -#define _STLP_NORETURN_FUNCTION __attribute__((noreturn)) - -/* Mac OS X is a little different with namespaces and cannot instantiate - * static data members in template classes */ -#if defined (__APPLE__) -# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) -/* Mac OS X is missing a required typedef and standard macro */ -typedef unsigned int wint_t; -# endif - -# define __unix - -# if (__GNUC__ < 3) - - /* Mac OS X needs one and only one source file to initialize all static data - * members in template classes. Only one source file in an executable or - * library can declare instances for such data members, otherwise duplicate - * symbols will be generated. */ - -# define _STLP_NO_STATIC_TEMPLATE_DATA -# define _STLP_STATIC_CONST_INIT_BUG 1 -# define _STLP_STATIC_TEMPLATE_DATA 0 -# define _STLP_WEAK_ATTRIBUTE 1 - /* Workaround for the broken Mac OS X C++ preprocessor which cannot handle - * parameterized macros in #include statements */ -# define _STLP_NATIVE_HEADER(header) <../g++/##header##> -# define _STLP_NATIVE_C_HEADER(header) <../include/##header##> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../g++/##header##> -# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../g++/##header##> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../g++/##header##> -# endif /* __GNUC__ < 3 */ - -# define _STLP_NO_LONG_DOUBLE - -/* Mac OS X needs all "::" scope references to be "std::" */ -# define _STLP_USE_NEW_C_HEADERS - -# define _STLP_NO_VENDOR_STDLIB_L - -#endif /* __APPLE__ */ - - -#if defined(__BEOS__) && defined(__INTEL__) -# define _STLP_NATIVE_HEADER(header) <../stlport/beos/##header##> -# define _STLP_NATIVE_C_HEADER(header) <../stlport/beos/##header##> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../stlport/beos/##header##> -# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../stlport/beos/##header##> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../stlport/beos/##header##> -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -/* -# define _NOTHREADS 1 -*/ -# ifdef _PTHREADS -# undef _PTHREADS -# endif -# ifdef _STLP_PTHREADS -# undef _STLP_PTHREADS -# endif -# define _STLP_USE_STDIO_IO 1 -# define _STLP_USE_GLIBC 1 -#endif - -/* g++ 2.7.x and above */ -#define _STLP_LONG_LONG long long - -#ifdef _STLP_USE_UCLIBC -/* -# ifndef __DO_C99_MATH__ -*/ - /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */ -# define _STLP_NO_VENDOR_MATH_F - /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */ -# define _STLP_NO_VENDOR_MATH_L -# define _STLP_NO_LONG_DOUBLE -/* -# endif -*/ -#endif - -#if defined (__OpenBSD__) || defined (__FreeBSD__) -# define _STLP_NO_VENDOR_MATH_L -# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */ -# ifndef __unix -# define __unix -# endif -#endif - -#if defined (__alpha__) -# define _STLP_NO_VENDOR_MATH_L -# define _STLP_NO_IEC559_SUPPORT -#endif - -#if defined (__hpux) -# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */ - /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */ -# define _STLP_NO_VENDOR_MATH_F -#endif - -#if (__GNUC__ >= 3) -# ifndef _STLP_HAS_NO_NEW_C_HEADERS -/* -# ifndef _STLP_USE_UCLIBC -*/ -# define _STLP_HAS_NATIVE_FLOAT_ABS -/* -# endif -*/ -# else -# ifdef _STLP_USE_GLIBC -# define _STLP_VENDOR_LONG_DOUBLE_MATH 1 -# endif -# endif -#endif - -#if (__GNUC__ < 3) -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1 -# ifndef __HONOR_STD -# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1 -# endif -/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */ -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -#endif - -/* -#define _STLP_VENDOR_GLOBAL_CSTD 1 -*/ - -#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) -# define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT -# define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -#else -# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT -# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT -#endif - -#if (__GNUC_MINOR__ < 9) && (__GNUC__ < 3) /* gcc 2.8 */ -# define _STLP_NO_TEMPLATE_CONVERSIONS -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NO_METHOD_SPECIALIZATION 1 -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS -/* DJGPP doesn't seem to implement it in 2.8.x */ -# ifdef DJGPP -# define _STLP_NO_STATIC_TEMPLATE_DATA 1 -# endif -#endif - -#if __GNUC__ <= 2 && __GNUC_MINOR__ <= 7 && !defined (__CYGWIN32__) -/* Will it work with 2.6 ? I doubt it. */ -# if ( __GNUC_MINOR__ < 6 ) -__GIVE_UP_WITH_STL(GCC_272); -# endif - -# define _STLP_NO_RELOPS_NAMESPACE -# define _STLP_NON_TYPE_TMPL_PARAM_BUG -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_DEFAULT_TYPE_PARAM 1 -# define _STLP_NO_BAD_ALLOC -# define _STLP_NO_ARROW_OPERATOR 1 -# ifndef _STLP_NO_STATIC_TEMPLATE_DATA -# define _STLP_NO_STATIC_TEMPLATE_DATA -# endif -# define _STLP_STATIC_CONST_INIT_BUG 1 -# define _STLP_NO_METHOD_SPECIALIZATION 1 - -# if !defined (__CYGWIN32__) -# define _STLP_NESTED_TYPE_PARAM_BUG 1 -# define _STLP_BASE_MATCH_BUG 1 -/* unused operators are required (forward) */ -# define _STLP_CONST_CONSTRUCTOR_BUG -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM -# endif -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -#else /* ! <= 2.7.* */ -#endif /* ! <= 2.7.* */ - -/* static template data members workaround strategy for gcc tries - * to use weak symbols. - * if you don't want to use that, #define _STLP_WEAK_ATTRIBUTE=0 ( you'll - * have to put "#define __PUT_STATIC_DATA_MEMBERS_HERE" line in one of your - * compilation unit ( or CFLAGS for it ) _before_ including any STL header ). - */ -#if defined (_STLP_NO_STATIC_TEMPLATE_DATA) && ! defined (_STLP_WEAK_ATTRIBUTE ) -/* systems using GNU ld or format that supports weak symbols - may use "weak" attribute - Linux & Solaris ( x86 & SPARC ) are being auto-recognized here */ -# if defined(_STLP_GNU_LD) || defined(__ELF__) || defined (__CYGWIN__) || \ - (( defined (__SVR4) || defined ( __svr4__ )) && \ - ( defined (sun) || defined ( __sun__ ))) -# define _STLP_WEAK_ATTRIBUTE 1 -# endif -#endif /* _STLP_WEAK_ATTRIBUTE */ - - -/* strict ANSI prohibits "long long" ( gcc) */ -#if defined ( __STRICT_ANSI__ ) -# undef _STLP_LONG_LONG -/* -# define _STLP_STRICT_ANSI 1 -*/ -#endif - -/* -#if !defined (__STRICT_ANSI__) || defined (__BUILDING_STLPORT) -# define _STLP_USE_TEMPLATE_EXPORT -# define _STLP_EXPORT_TEMPLATE_KEYWORD extern -# define _STLP_IMPORT_TEMPLATE_KEYWORD extern -#endif -*/ - -#ifndef __EXCEPTIONS -# undef _STLP_DONT_USE_EXCEPTIONS -# define _STLP_DONT_USE_EXCEPTIONS 1 -#endif - -#if (__GNUC__ >= 3) - -# if !defined (_STLP_NATIVE_INCLUDE_PATH) -# if ( (__GNUC__ == 3 ) && ((__GNUC_MINOR__ == 0) || ((__GNUC_MINOR__ < 3) && defined(__APPLE_CC__)))) -# define _STLP_NATIVE_INCLUDE_PATH ../g++-v3 -# else -# if ( ((__GNUC__ == 4 ) || (__GNUC_MINOR__ >= 3)) && defined(__APPLE_CC__)) -# define _STLP_NATIVE_INCLUDE_PATH ../c++ -/* -* Before version 3.4.0 the 0 patch level was not part of the include path: -*/ -# elif defined (__GNUC_PATCHLEVEL__) && ((__GNUC_PATCHLEVEL__ > 0) || \ - (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ > 3)) -# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__ -# else -# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__ -# endif -# endif -# endif - -/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit - instantiation within library: nothing except increased library size. - ptr - */ -# define _STLP_NO_FORCE_INSTANTIATE - -#elif (__GNUC_MINOR__ < 8) - -# if !defined (_STLP_NATIVE_INCLUDE_PATH) -# define _STLP_NATIVE_INCLUDE_PATH ../g++-include -# endif - -/* tuning of static template data members workaround */ -# if ( _STLP_STATIC_TEMPLATE_DATA < 1 ) -# if ( _STLP_WEAK_ATTRIBUTE > 0 ) -# define _STLP_WEAK __attribute__ (( weak )) -# else -# define _STLP_WEAK -# endif /* _STLP_WEAK_ATTRIBUTE */ - -# ifdef __PUT_STATIC_DATA_MEMBERS_HERE -# define __DECLARE_INSTANCE(type,item,init) type item _STLP_WEAK init -# else -# define __DECLARE_INSTANCE(type,item,init) -# endif /* __PUT_STATIC_DATA_MEMBERS_HERE */ -# endif /* _STLP_STATIC_TEMPLATE_DATA */ - -#else - -/* gcc-2.95.0 used to use "g++-3" directory which has been changed to "g++" in - * system-dependent "include" for 2.95.2 except for Cygwin and Mingw packages. - * I expect "g++-3" not being used in later releases. - * If your installation use "g++-3" include directory for any reason (pre-2.95.2 or Win binary kit), - * please change the macro below to point to your directory. - */ - -# if !defined (_STLP_NATIVE_INCLUDE_PATH) -# if defined(__DJGPP) -# define _STLP_NATIVE_INCLUDE_PATH ../lang/cxx -# elif (__GNUC__ >= 3) || (__GNUC_MINOR__ >= 97) -# define _STLP_NATIVE_INCLUDE_PATH ../include/g++-v3 -# elif ((__GNUC_MINOR__ >= 95 && __GNUC_MINOR__ < 97) && \ - !( defined (__FreeBSD__) || defined (__NetBSD__) || defined(__sgi) || defined (__OS2__) ) ) -# define _STLP_NATIVE_INCLUDE_PATH ../g++-3 -# elif (__GNUC_MINOR__ > 8) && (__GNUC_MINOR__ < 95) && (__GNUC__ < 3) && !defined( __Lynx__ ) -/* this really sucks, as GNUpro does not really identifies itself, so we have to guess - * depending on a platform - */ -# ifdef __hpux -# define _STLP_NATIVE_INCLUDE_PATH ../g++-3 -# else -# define _STLP_NATIVE_INCLUDE_PATH ../g++-2 -# endif -# else -# define _STLP_NATIVE_INCLUDE_PATH g++ -# endif -# endif - -/* et al */ -# ifdef __FreeBSD__ -# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 95) -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include -# endif -# else -/* azov */ -# ifndef __Lynx__ -# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97) -/* -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../g++-v3 -*/ -# else -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include -# endif -# endif -# endif - -#endif /* GNUC_MINOR < 8 */ - -#if !defined (_STLP_NATIVE_C_INCLUDE_PATH) -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -#endif - -/* Tune settings for the case where static template data members are not - * instaniated by default - */ -#if defined ( _STLP_NO_STATIC_TEMPLATE_DATA ) -# define _STLP_STATIC_TEMPLATE_DATA 0 -# if !defined ( _STLP_WEAK_ATTRIBUTE ) -# define _STLP_WEAK_ATTRIBUTE 0 -# endif -# ifdef __PUT_STATIC_DATA_MEMBERS_HERE -# define __DECLARE_INSTANCE(type,item,init) type item init -# else -# define __DECLARE_INSTANCE(type,item,init) -# endif -#else -# define _STLP_STATIC_TEMPLATE_DATA 1 -#endif - diff --git a/SDK/stlport/stl/config/_hpacc.h b/SDK/stlport/stl/config/_hpacc.h deleted file mode 100644 index 2cc5cc46..00000000 --- a/SDK/stlport/stl/config/_hpacc.h +++ /dev/null @@ -1,196 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Acc" - -// system C-library dependent -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif -// # define _STLP_RAND48 1 -#define _STLP_NO_NATIVE_MBSTATE_T 1 -#define _STLP_HPACC_BROKEN_BUFEND 1 -#define _STLP_WCHAR_HPACC_EXCLUDE 1 - -// this was reported to help, just as with SUN CC 4.2 -#define _STLP_INLINE_STRING_LITERAL_BUG - -// specific prolog is needed to select correct threads impl -#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG - -// HP aCC with +noeh -#ifdef __HPACC_NOEH -# define _STLP_HAS_NO_EXCEPTIONS 1 -#endif - -// HP compilers -// At that point, we only know we are on HP (and _not_ using gcc, -// according to "stlcomp.h" - -// __HP_aCC indicate HP ANSI C++, but not always (03.xx does not -// define it before 3.13, for example). -// -#if defined (__HP_aCC) - -# define _STLP_NO_FORCE_INSTANTIATE -# define _STLP_LONG_LONG long long -# define _STLP_NO_VENDOR_STDLIB_L - -# if (__HP_aCC <= 30000 && __HP_aCC >= 12100) - -//Special kludge to workaround bug in aCC A.01.23, CR JAGac40634 -# ifdef _STLP_DEBUG -static void _STLP_dummy_literal() { const char *p = "x";} -static void _STLP_dummy_literal_2() { const char *p = "123456789"; } -static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";} -# endif - -# define _STLP_HP_ACC 0123 -# define _STLP_NATIVE_INCLUDE_PATH ../include -# define _STLP_VENDOR_GLOBAL_STD 1 -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_DONT_THROW_RANGE_ERRORS 1 -# define _STLP_STATIC_CONST_INIT_BUG 1 -# if (__HP_aCC < 12700) -//new flag: on most HP compilers cwchar is missing -# define _STLP_NO_CWCHAR -# endif - -# define _STLP_FORCE_ALLOCATORS(t,a) \ - typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ - typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; - -# endif /* 123 */ - -// latest version and up -# if (__HP_aCC >= 32500 ) -# define _STLP_HP_ACC 0325 - -# define _STLP_USE_NEW_C_HEADERS - -# define _STLP_FORCE_ALLOCATORS(t,a) \ - typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ - typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; - -# if !defined ( _INCLUDE__STDC_A1_SOURCE ) // HP-UX 11i only -# define _STLP_HAS_NO_UNIX98_WCHAR_EXTENSIONS -# endif - -# if defined (_HP_NAMESPACE_STD) // option -AA -// from now, we have a full standard lib in namespace std -// -// -AA indicates that we are compiling against Rogue Wave 2.2.1 -// STL shipped with the HP aCC compiler. -AA tells the compiler -// to use the STL defined in the include_std directory. -// -# define _STLP_NATIVE_INCLUDE_PATH ../include_std - -// # define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes -# define _STLP_HP_ACC_COMPAT -1 -# else // option -Aa -# define _STLP_NATIVE_INCLUDE_PATH ../include -# define _STLP_VENDOR_GLOBAL_STD 1 -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_DONT_THROW_RANGE_ERRORS 1 -# endif /* _NAMESPACE_STD */ -# endif - -# if (__HP_aCC >= 31400 && __HP_aCC < 32500) -# define _STLP_HP_ACC 0314 - -# define _STLP_FORCE_ALLOCATORS(t,a) \ -typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ -typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; -# define _STLP_NO_CWCHAR -# if defined (_NAMESPACE_STD) // option -AA -// from now, we have a full standard lib in namespace std -# define _STLP_NATIVE_INCLUDE_PATH ../include_std -//# define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes -# define _STLP_HP_ACC_COMPAT -1 -# else // kind of compatibility mode -# define _STLP_NATIVE_INCLUDE_PATH ../include -# define _STLP_VENDOR_GLOBAL_STD 1 -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_DONT_THROW_RANGE_ERRORS 1 -# define _STLP_NO_ROPE 1 -# endif /* _NAMESPACE_STD */ -# endif /* 314 */ - -# if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1 - -# if (__HP_aCC != 1) -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# endif - -# define _STLP_NO_QUALIFIED_FRIENDS 1 -// aCC bug ? need explicit args on constructors of partial specialized -// classes -# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1 -// ?? fbp : maybe present in some versions ? -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -// and stuff is in global namespace -# define _STLP_VENDOR_GLOBAL_EXCEPT_STD -// fbp : moved here -# define _STLP_VENDOR_GLOBAL_CSTD 1 -// # define _INCLUDE_HPUX_SOURCE -# define _XPG4 -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_AES_SOURCE -# endif /* < 314 */ -# if __HP_aCC == 1 -# define _STLP_BROKEN_USING_IN_CLASS -# define _STLP_USING_BASE_MEMBER -# define _STLP_NO_CWCHAR -// # define _STLP_NO_WCHAR_T 1 -# endif -#endif /* HP_ACC */ - -// -#ifndef __HP_aCC -# define _STLP_NATIVE_INCLUDE_PATH ../CC -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -// it is HP's old cfront-based compiler. -# define _STLP_NO_BOOL 1 -// # define _STLP_DONT_USE_BOOL_TYPEDEF 1 -# define _STLP_NO_NEW_NEW_HEADER 1 -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_NO_SIGNED_BUILTINS -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NO_EXCEPTION_SPEC 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 -# define _STLP_NO_ARROW_OPERATOR 1 -# define _STLP_BASE_MATCH_BUG -# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -// # define _STLP_NO_WCHAR_T 1 -// # define _STLP_LONG_LONG long long -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -# define _STLP_NO_BAD_ALLOC 1 -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_MEMBER_POINTER_PARAM_BUG 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 -// # define _STLP_NO_METHOD_SPECIALIZATION 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -// # define _STLP_STATIC_CONST_INIT_BUG 1 -// # define _STLP_THROW_RETURN_BUG 1 -// # define _STLP_LINK_TIME_INSTANTIATION 1 -// # define _STLP_NO_TEMPLATE_CONVERSIONS 1 -# define _STLP_NO_TYPEINFO 1 -# define _STLP_WCHAR_T_IS_USHORT 1 - -#endif /* cfront */ diff --git a/SDK/stlport/stl/config/_hpux.h b/SDK/stlport/stl/config/_hpux.h deleted file mode 100644 index 51b1234c..00000000 --- a/SDK/stlport/stl/config/_hpux.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __stl_config__hpux_h -#define __stl_config__hpux_h - -#define _STLP_PLATFORM "HP Unix" - -#ifdef __GNUC__ -# define _STLP_NO_WCHAR_T -# define _STLP_NO_CWCHAR -# define _STLP_NO_LONG_DOUBLE -#endif - -#endif /* __stl_config__hpux_h */ diff --git a/SDK/stlport/stl/config/_ibm.h b/SDK/stlport/stl/config/_ibm.h deleted file mode 100644 index 96c504c1..00000000 --- a/SDK/stlport/stl/config/_ibm.h +++ /dev/null @@ -1,146 +0,0 @@ -/* STLport configuration file - * It is internal STLport header - DO NOT include it directly - */ - -#if defined (__IBMCPP__) || defined (__IBMC__) -# define _STLP_COMPILER "Visual Age C++" -#elif defined (__xlC__) -# define _STLP_COMPILER "xlc" -#else -# error "Unknown compiler" -#endif - -#if !defined(__IBMCPP__) || (__IBMCPP__ < 500) -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -#endif - -/* string literal problem, same as with SUN and aCC */ -# define _STLP_INLINE_STRING_LITERAL_BUG 1 -# define _STLP_HAS_NATIVE_FLOAT_ABS - -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 - - -# ifdef __IBMCPP__ -# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG -# endif - -/* # if ( defined (__MULTI__) && defined (__WINDOWS__)) - * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows - * # endif - */ - -# if ( defined (__MULTI__) && defined (__OS2__)) -# define _STLP_OS2THREADS 1 -# endif - -/* __TEMPINC__ is set when /Ft+ option is used */ -# ifdef __TEMPINC__ -# define _STLP_LINK_TIME_INSTANTIATION 1 -# endif - -# if defined (__MVS__) -/* long long support is buggy - reported by Tinny Ng - * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000 - * # define _STLP_LONG_LONG long long - * # endif - */ -/* boris : hstash reported it can be treated like UNIX */ -# define _STLP_UNIX 1 -# define _STLP_NO_TYPEINFO 1 -# undef _STLP_NATIVE_INCLUDE_PATH -# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include -/* same for C headers like */ -# undef _STLP_NATIVE_C_INCLUDE_PATH -# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include - -# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350) - -# define _STLP_LONG_LONG long long - -#endif - -#if !( defined( __xlC__ ) && __xlC__ >= 0x500 ) - -/* AIX xlC 3.1 , 3.0.1 ==0x301 - * Visual Age C++ 3.x - * OS-390 C++ - * fbp : should be more version-specific! - */ - -# define _STLP_NO_BOOL 1 -# define _STLP_DONT_USE_BOOL_TYPEDEF 1 -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NO_ARROW_OPERATOR 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -# define _STLP_NO_WCHAR_T 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -# define _STLP_NO_BAD_ALLOC 1 - -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 - -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 -# define _STLP_NO_METHOD_SPECIALIZATION 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -# define _STLP_NO_EXCEPTION_HEADER 1 - -# define _STLP_NO_NEW_NEW_HEADER 1 - -# if defined (__OS2__) && (__IBMCPP__ <= 350) -# define _STLP_NO_TYPEINFO 1 -# endif -# define _STLP_NO_NEW_NEW_HEADER 1 - -# define _STLP_STATIC_CONST_INIT_BUG 1 -/* # define _STLP_THROW_RETURN_BUG 1 */ - - -# define _STLP_NO_TEMPLATE_CONVERSIONS 1 -# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 - -/* AIX xlC, Visual Age 3.0 for OS/2 and MS */ -# define _STLP_TRIVIAL_DESTRUCTOR_BUG - -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 - -#if __IBMCPP__ <= 350 -# define _STLP_NEED_UNREACHABLE_RETURN 1 -#endif - -#if __IBMCPP__ < 350 -# define _STLP_NO_LONG_DOUBLE 1 -#endif - -#if __IBMCPP__ >= 365 -/* does not have new C headers, but has div() */ -# define _STLP_LDIV -#endif - -#endif /* xlC 5 */ - -/* detect xlC5 by: */ -#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700) -# define _STLP_USE_EXCEPTIONS 1 -# define _STLP_STATIC_CONST_INIT_BUG 1 -/* #pragma report(disable,CPPC1500029) - * unsigned 32-bit integer type - */ -# define _STLP_UINT32_T unsigned int -# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -# endif -/* # define _STLP_RAND48 1 */ -#endif /* __IBMCPP__ == 500 */ diff --git a/SDK/stlport/stl/config/_icc.h b/SDK/stlport/stl/config/_icc.h deleted file mode 100644 index 1fc1bce3..00000000 --- a/SDK/stlport/stl/config/_icc.h +++ /dev/null @@ -1,44 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly -// A list of Intel compiler for Linux portion of STLport settings. - -#define _STLP_COMPILER "Intel ICC" - -#define _STLP_LONG_LONG long long - -// Edit relative path below (or put full path) to get native -// compiler headers included. Default is "../include". -// C headers may reside in different directory, so separate macro is provided. -#if (__INTEL_COMPILER < 800) -# define _STLP_NATIVE_INCLUDE_PATH ../include -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include -#endif - -#if (__INTEL_COMPILER >= 800) -# define _STLP_NATIVE_INCLUDE_PATH ../include/c++ -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include - -#endif /* __INTEL_COMPILER >= 800 */ - -#define _STLP_HAS_NO_NEW_C_HEADERS 1 -#define _STLP_VENDOR_GLOBAL_CSTD 1 - -/* Systems having GLIBC installed have different traits */ -#if !defined (_STLP_USE_GLIBC) && defined (__linux__) -# define _STLP_USE_GLIBC -# define _XOPEN_SOURCE 600 -#endif - -#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT - - -#ifndef __GNUC__ -# define __GNUC__ 3 -#endif - -//#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 - -#define _STLP_NO_FORCE_INSTANTIATE -//#define _REENTRANT diff --git a/SDK/stlport/stl/config/_intel.h b/SDK/stlport/stl/config/_intel.h deleted file mode 100644 index af8022fe..00000000 --- a/SDK/stlport/stl/config/_intel.h +++ /dev/null @@ -1,73 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Intel ICL" - -#define _STLP_IMPORT_TEMPLATE_KEYWORD extern - -/* You need to undef following macro if your icl install is binded to MSVC 6 - * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option. - */ -/* #define _STLP_MSVC_LIB 1200 */ -/* You need to undef following macro if your icl install is binded to MSVC .Net 2002 - * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1 - * or /Qvc8 option. - */ -/* #define _STLP_MSVC_LIB 1300 */ -/* You need to undef following macro if your icl install is binded to MSVC .Net 2002 - * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7 - * or /Qvc8 option. - */ -/* #define _STLP_MSVC_LIB 1310 */ -/* You need to undef following macro if your icl install is binded to MSVC .Net 2002 - * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7 - * or /Qvc7.1 option. - */ -/* #define _STLP_MSVC_LIB 1400 */ - -#include - -#if defined (_STLP_DONT_RETURN_VOID) -# undef _STLP_DONT_RETURN_VOID -#endif - -#if (__ICL >= 900) -/* # undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT */ -# if !defined (_STLP_DONT_USE_EXCEPTIONS) -# define _STLP_NOTHROW throw() -# endif -#endif - -#if (__ICL <= 810) -/* If method specialization is activated, compiler do not export some - * symbols anymore. - */ -# define _STLP_NO_METHOD_SPECIALIZATION 1 -#endif - -#if (__ICL >= 800) -# define _STLP_STATIC_CONST_INIT_BUG 1 -#endif - -#if (__ICL >= 450) -# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 -#endif - -#if (__ICL < 450) -/* only static STLport lib works for ICL */ -# undef _STLP_USE_STATIC_LIB -# undef _STLP_USE_DYNAMIC_LIB -# define _STLP_USE_STATIC_LIB -/* disable hook which makes template symbols to be searched for in the library */ -# undef _STLP_NO_CUSTOM_IO -#endif - -#undef _STLP_LONG_LONG -#define _STLP_LONG_LONG long long - -#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) -namespace std -{ - void _STLP_CALL unexpected(); -} -#endif diff --git a/SDK/stlport/stl/config/_kai.h b/SDK/stlport/stl/config/_kai.h deleted file mode 100644 index 5b2bedbb..00000000 --- a/SDK/stlport/stl/config/_kai.h +++ /dev/null @@ -1,48 +0,0 @@ -// STLport config file for KAI C++ compiler - -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif - -# ifndef __KAI_STRICT /* _NO_LONGLONG */ -# define _STLP_LONG_LONG long long -# endif - -# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS) -# define _STLP_HAS_NO_EXCEPTIONS -# endif - -# ifndef __BUILDING_STLPORT -# define _STLP_LINK_TIME_INSTANTIATION 1 -# endif - -// two levels of macros do not work good with kcc. -# define _STLP_NATIVE_HEADER(header) <../include/##header> -# define _STLP_NATIVE_C_HEADER(header) <../include/##header> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header> - -# ifdef _WIN32 -# define _STLP_MINIMUM_IMPORT_STD -# endif - -// KAI C++ uses EDG front-end, but apparently different switches -// # define __EDG_SWITCHES 1 - - -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_VENDOR_MB_NAMESPACE std - -// boris : some of those may also apply to KCC 3.4 -# if __KCC_VERSION < 4000 -# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1 - -# endif - -# if defined (__sgi) -// this requires some discrimination on whether we are actually on -// a system officially supported by KAI. -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# include -# endif - diff --git a/SDK/stlport/stl/config/_linux.h b/SDK/stlport/stl/config/_linux.h deleted file mode 100644 index 342cd8bb..00000000 --- a/SDK/stlport/stl/config/_linux.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef __stl_config__linux_h -#define __stl_config__linux_h - -#define _STLP_PLATFORM "Linux" - -#include - -/* This is defined wether library in use is glibc or not. - This may be treated as presence of GNU libc compatible - header files (these define is not really intended to check - for the presence of a particular library, but rather is used - to define an INTERFACE.) */ -#ifndef _STLP_USE_GLIBC -# define _STLP_USE_GLIBC 1 -#endif - -#define _STLP_UNIX 1 - -#if defined(_REENTRANT) && !defined(_PTHREADS) -# define _PTHREADS -#endif - -#ifdef __UCLIBC__ /* uClibc 0.9.27 */ -# define _STLP_USE_UCLIBC 1 -# if !defined(__UCLIBC_HAS_WCHAR__) -# ifndef _STLP_NO_WCHAR_T -# define _STLP_NO_WCHAR_T -# endif -# ifndef _STLP_NO_MBSTATE_T -# define _STLP_NO_MBSTATE_T -# endif -# ifndef _STLP_NO_NATIVE_WIDE_STREAMS -# define _STLP_NO_NATIVE_WIDE_STREAMS -# endif -# endif /* __UCLIBC_HAS_WCHAR__ */ - /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */ -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# if defined(_STLP_REAL_LOCALE_IMPLEMENTED) - /* locale in uClibc is very restricted */ - /* recheck if __UCLIBC_HAS_LOCALE__ defined...*/ -# undef _STLP_REAL_LOCALE_IMPLEMENTED -# endif -#endif - - -#if defined(_PTHREADS) -# define _STLP_THREADS -# define _STLP_PTHREADS -/* -# ifndef __USE_UNIX98 -# define __USE_UNIX98 -# endif -*/ -/* This feature exist at least since glibc 2.2.4 */ -/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */ -# ifdef __USE_XOPEN2K -/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */ -# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */ -# define _STLP_USE_PTHREAD_SPINLOCK -# else -# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK - /* in uClibc (0.9.26) pthread_spinlock* declared in headers - * but absent in library */ -# define _STLP_DONT_USE_PTHREAD_SPINLOCK -# endif -# endif -/* # define __FIT_PSHARED_MUTEX */ -# endif -#endif - -/* Endiannes */ -#include -#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN) -# error "One of __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN undefined; Fix me!" -#endif - -#if ( __BYTE_ORDER == __LITTLE_ENDIAN ) -# define _STLP_LITTLE_ENDIAN 1 -#elif ( __BYTE_ORDER == __BIG_ENDIAN ) -# define _STLP_BIG_ENDIAN 1 -#else -# error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!" -#endif - -#if defined(__GNUC__) && (__GNUC__ < 3) -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -/* -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -*/ -#endif - - -#endif /* __stl_config__linux_h */ diff --git a/SDK/stlport/stl/config/_mac.h b/SDK/stlport/stl/config/_mac.h deleted file mode 100644 index d80cc711..00000000 --- a/SDK/stlport/stl/config/_mac.h +++ /dev/null @@ -1 +0,0 @@ -#define _STLP_PLATFORM "Mac" diff --git a/SDK/stlport/stl/config/_macosx.h b/SDK/stlport/stl/config/_macosx.h deleted file mode 100644 index 3d3452b3..00000000 --- a/SDK/stlport/stl/config/_macosx.h +++ /dev/null @@ -1,7 +0,0 @@ -#define _STLP_PLATFORM "Mac OS X" - -#if defined (__BIG_ENDIAN__) -# define _STLP_BIG_ENDIAN 1 -#elif defined (__LITTLE_ENDIAN__) -# define _STLP_LITTLE_ENDIAN 1 -#endif diff --git a/SDK/stlport/stl/config/_mlc.h b/SDK/stlport/stl/config/_mlc.h deleted file mode 100644 index 8687d0bf..00000000 --- a/SDK/stlport/stl/config/_mlc.h +++ /dev/null @@ -1,7 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_NO_MEMBER_TEMPLATES // Compiler does not support member templates -#define _STLP_NO_MEMBER_TEMPLATE_CLASSES // Compiler does not support member template classes - -#define _STLP_HAS_NEW_NEW_HEADER diff --git a/SDK/stlport/stl/config/_msvc.h b/SDK/stlport/stl/config/_msvc.h deleted file mode 100644 index 7c5036f2..00000000 --- a/SDK/stlport/stl/config/_msvc.h +++ /dev/null @@ -1,353 +0,0 @@ -/* STLport configuration file - * It is internal STLport header - DO NOT include it directly - * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL - */ - -#if !defined (_STLP_COMPILER) -# define _STLP_COMPILER "Microsoft Visual Studio C++" -#endif - -#if !defined (__ICL) && !defined (_STLP_MSVC) -# define _STLP_MSVC _MSC_VER -#endif - -#if !defined (_STLP_MSVC_LIB) -# define _STLP_MSVC_LIB _MSC_VER -#endif - -#if defined (__BUILDING_STLPORT) && defined (_MANAGED) -/* Building a managed version of STLport is not supported because we haven't - * found a good reason to support it. However, building a managed translation - * unit using STLport _is_ supported. - */ -# error Sorry but building a managed version of STLport is not supported. -#endif - -#if defined (_STLP_USING_PLATFORM_SDK_COMPILER) -/* This is a specific section for compilers coming with platform SDKs. Native - * library coming with it is different from the one coming with commercial - * MSVC compilers so there is some specific settings. - */ -# define _STLP_NATIVE_INCLUDE_PATH ../crt -# define _STLP_VENDOR_GLOBAL_CSTD -# define _STLP_VENDOR_TERMINATE_STD -# define _STLP_GLOBAL_NEW_HANDLER -# if (_STLP_MSVC_LIB <= 1400) -/* We hope this bug will be fixed in future versions. */ -# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 -# endif -#endif - -#define _STLP_CALL __cdecl - -#ifndef _STLP_LONG_LONG -# define _STLP_LONG_LONG __int64 -#endif - -#define _STLP_PRAGMA_ONCE - -/* These switches depend on compiler flags. We are hoping here that compilers - * simulating MSVC behavior use identical macros to report compilation context. - * Otherwise those macros will have to be undef in specific compiler configuration - * files. - */ -#ifndef _CPPUNWIND -# define _STLP_DONT_USE_EXCEPTIONS 1 -#endif - -#ifndef _CPPRTTI -# define _STLP_NO_RTTI 1 -#endif - -#if defined (_MT) && !defined (_STLP_NO_THREADS) && !defined (_REENTRANT) -# define _REENTRANT 1 -#endif - -#if !defined (_NATIVE_WCHAR_T_DEFINED) -# define _STLP_WCHAR_T_IS_USHORT 1 -#endif - -#define _STLP_MINIMUM_IMPORT_STD -#define _STLP_NO_VENDOR_STDLIB_L 1 - -#if defined (_STLP_MSVC) - -#define _STLP_NORETURN_FUNCTION __declspec(noreturn) - -/* Full compiler version comes from boost library intrinsics.hpp header. */ -# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215) -# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T) -# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) -# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) -# define _STLP_IS_POD(T) __is_pod(T) -# define _STLP_HAS_TYPE_TRAITS_INTRINSICS -# endif - -# ifndef _STLP_MSVC50_COMPATIBILITY -# define _STLP_MSVC50_COMPATIBILITY 1 -# endif - -# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 -# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1 - -/* # ifndef __BUILDING_STLPORT - * # define _STLP_USE_TEMPLATE_EXPORT 1 - * # endif - */ -# if (_STLP_MSVC <= 1401) -# define _STLP_STATIC_CONST_INIT_BUG 1 -# endif - -/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined -unconditionally and undef'ed here when applicable. */ -# if defined(UNDER_CE) -/* eVCx: -uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is -unknown) and they all reside in namespace 'std' there. However, they are not -part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on -an ARMV4I, the uncaught_exception test fails, the function returns the wrong -value. */ -# else -/* VCx: -These are present at least since VC6, but the uncaught_exception() of VC6 is -broken, it returns the wrong value in the unittests. 7.1 and later seem to -work, 7.0 is still unknown (we assume it works until negative report). */ -# if (_STLP_MSVC >= 1300)// VC7 and later -# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT -# if !defined (_STLP_DONT_USE_EXCEPTIONS) -# define _STLP_NOTHROW throw() -# endif -# endif -# endif - -# if (_STLP_MSVC <= 1300) -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */ -# define _STLP_USE_OLD_HP_ITERATOR_QUERIES -# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER -# define _STLP_NO_METHOD_SPECIALIZATION 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1 -/* VC++ cannot handle default allocator argument in template constructors */ -# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_FRIEND_TEMPLATES -/* Fails to properly resolve call to sin() from within sin() */ -# endif - -# if (_STLP_MSVC < 1300) -# define _STLP_NO_IEC559_SUPPORT 1 -# endif - -# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */ -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 -# endif - -# if (_STLP_MSVC >= 1200) -# define _STLP_HAS_NATIVE_FLOAT_ABS 1 -# endif - -// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to? -# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310) -# define _STLP_NO_MOVE_SEMANTIC -# endif - -# if (_STLP_MSVC < 1300) -/* TODO: remove this if it is handled and documented elsewhere - * dums: VC6 do not handle correctly member templates of class that are explicitely - * instanciated to be exported. There is a workaround, seperate the non template methods - * from the template ones within 2 different classes and only export the non template one. - * It is implemented for basic_string and locale at the writing of this note. - * However this problem hos not been considered as important enough to remove template member - * methods for other classes. Moreover Boost (www.boost.org) required it to be granted. - * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined - * later in this config file. - */ -/* -# if defined (_DLL) -# define _STLP_NO_MEMBER_TEMPLATES 1 -# endif -*/ - -/* Boris : not defining this macro for SP5 causes other problems */ -/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */ -# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 -/*# endif */ -# define _STLP_DONT_USE_BOOL_TYPEDEF 1 -# define _STLP_DONT_RETURN_VOID 1 -# endif - -/* - * MSVC6 is known to have many trouble with namespace management but - * MSVC .Net 2003 and 2005 also have a bug difficult to reproduce without - * STLport: - * namespace stlp_std { - * typedef int foo_int; - * } - * #include - * const foo_int bar = 0; - * - * As you can see foo is available without namespace specification as if - * a using namespace stlp_std has been performed. Defining _STLP_USING_NAMESPACE_BUG - * restore the expected compilation error. - */ -# define _STLP_USING_NAMESPACE_BUG 1 - -# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */ -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */ -# define _STLP_USE_ABBREVS -# endif - -// TODO: what is the earliest version for this? If it is 1200, use _STLP_MSVC>=1200. -# if (_STLP_MSVC > 1100) && (_STLP_MSVC < 1300) -typedef char __stl_char; -# define _STLP_DEFAULTCHAR __stl_char -# endif - -# if (_STLP_MSVC < 1200) /* before VC++ 6.0 */ -/* # define _STLP_NO_MEMBER_TEMPLATES 1 */ -# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS 1 -# define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1 -# define _STLP_QUALIFIED_SPECIALIZATION_BUG 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_THROW_RETURN_BUG 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -# endif - -# if (_STLP_MSVC < 1100 ) -# ifndef _STLP_USE_NO_IOSTREAMS -# define _STLP_USE_NO_IOSTREAMS -# endif -/* # define _STLP_NESTED_TYPE_PARAM_BUG 1 */ -/* Debug mode does not work for 4.2 */ -# if defined (_STLP_DEBUG) -# pragma message ("STLport debug mode does not work for VC++ 4.2, turning _STLP_DEBUG off ...") -# undef _STLP_DEBUG -# endif -# define _STLP_NO_BOOL 1 -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 -# define _STLP_BROKEN_USING_DIRECTIVE 1 -# define _STLP_NO_ARROW_OPERATOR 1 -# define _STLP_NO_SIGNED_BUILTINS 1 -# define _STLP_NO_EXCEPTION_SPEC 1 -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NO_AT_MEMBER_FUNCTION 1 -# define _STLP_NO_MEMBER_TEMPLATES 1 -# endif /* 1100 */ - -#endif /* _STLP_MSVC */ - -/** The desktop variants starting with VC8 have a set of more secure replacements -for the error-prone string handling functions of the C standard lib. */ -#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined(UNDER_CE) -# define _STLP_USE_SAFE_STRING_FUNCTIONS 1 -#endif - -#if (_STLP_MSVC_LIB <= 1310) -# define _STLP_VENDOR_GLOBAL_CSTD -#endif - -#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE) -/* Starting with MSVC 7.0 and compilers simulating it, - * we assume that the new SDK is granted: - */ -# define _STLP_NEW_PLATFORM_SDK 1 -#endif - -#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */ -# define _STLP_GLOBAL_NEW_HANDLER 1 -# define _STLP_VENDOR_UNEXPECTED_STD -# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 -#endif - -#if (_STLP_MSVC_LIB < 1100) -/* up to 4.2, library is in global namespace */ -# define _STLP_VENDOR_GLOBAL_STD -#endif - -#if (_STLP_MSVC_LIB <= 1010) -/* "bool" is reserved in MSVC 4.1 while absent, so : */ -# define _STLP_NO_BAD_ALLOC -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# define _STLP_NO_NEW_NEW_HEADER 1 -#elif (_STLP_MSVC_LIB < 1100) -/* VC++ 4.2 and higher */ -# define _STLP_YVALS_H 1 -# define _STLP_USE_NO_IOSTREAMS 1 -#endif - -#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) -#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) - -#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1100) -# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) -# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) -#endif - -#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL) -# define _STLP_RUNTIME_DLL -#endif -#if defined (__BUILDING_STLPORT) && \ - (defined (_STLP_USE_DYNAMIC_LIB) || \ - defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB)) -# define _STLP_DLL -#endif -#include -#undef _STLP_RUNTIME_DLL -#undef _STLP_DLL - -#if defined (_STLP_USE_DYNAMIC_LIB) -# undef _STLP_USE_DECLSPEC -# define _STLP_USE_DECLSPEC 1 -# if (_STLP_MSVC >= 1200) && (_STLP_MSVC < 1300) -# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1 -# endif -#endif - -#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD) -# if !defined (_MSC_EXTENSIONS) || defined(_STLP_MSVC) && _STLP_MSVC >= 1300 -# define _STLP_IMPORT_TEMPLATE_KEYWORD -# else -# define _STLP_IMPORT_TEMPLATE_KEYWORD extern -# endif -#endif -#define _STLP_EXPORT_TEMPLATE_KEYWORD - -#if defined (_STLP_MSVC) && (_STLP_MSVC < 1200) -/* only static STLport lib now works for VC 5.0 */ -# undef _STLP_USE_STATIC_LIB -# undef _STLP_USE_DYNAMIC_LIB -# define _STLP_USE_STATIC_LIB -/* disable hook which makes template symbols to be searched for in the library */ -# undef _STLP_NO_CUSTOM_IO -#endif - -#include - -#if defined (_STLP_USING_PLATFORM_SDK_COMPILER) -/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for - * additional buffer overrun checks. Rather than require the STLport build system and - * users to explicitely link with it we use the MSVC auto link feature. - */ -# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT) -# pragma comment (lib, "bufferoverflowU.lib") -# if defined (_STLP_VERBOSE_AUTO_LINK) -# pragma message ("STLport: Auto linking to bufferoverflowU.lib") -# endif -# endif -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/stl/config/_mwccnlm.h b/SDK/stlport/stl/config/_mwccnlm.h deleted file mode 100644 index 6eaf9b5e..00000000 --- a/SDK/stlport/stl/config/_mwccnlm.h +++ /dev/null @@ -1,88 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Metrowerks CodeWarrior" - -// Bring in definition of __MSL__ and related items -#include -#include - -// *** CodeWarrior Compiler Common Features *** -#if __option(longlong) -# define _STLP_LONG_LONG long long -#endif - -#define _STLP_USE_UNIX_EMULATION_IO 1 - -#define _STLP_USE_AUTO_PTR_CONVERSIONS 1 - -#ifdef __INTEL__ -# define _STLP_LITTLE_ENDIAN -#else -# define _STLP_BIG_ENDIAN -#endif - -#if defined(_MSL_NO_LOCALE) -# define _STLP_NO_IMPORT_LOCALE -#endif - -#if !__option( wchar_type ) -# define _STLP_WCHAR_T_IS_USHORT -#endif - -#if __MWERKS__ < 0x3000 -// *** CodeWarrior Compiler Common Bugs *** -# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this -# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version. -# define _STLP_THROW_RETURN_BUG 1 -#endif - -#if __MWERKS__ >= 0x2405 -# define _STLP_HAS_NATIVE_FLOAT_ABS -#endif - -#if __MWERKS__ < 0x2405 -# define _STLP_STATIC_CONST_INIT_BUG -#endif - -#if __MWERKS__ <= 0x2303 -# define _STLP_NO_TEMPLATE_CONVERSIONS 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -#endif - -#if __MWERKS__ < 0x2301 -# define _STLP_MEMBER_SPECIALIZATION_BUG 1 -#endif - -#if __MWERKS__ < 0x2300 // CW Pro5 features -# define _STLP_INLINE_MEMBER_TEMPLATES 1 -# define _STLP_RELOPS_IN_STD_BUG 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -# define _STLP_NO_TYPENAME_ON_RETURN_TYPE -#endif - -// fixes to native inclusion wrappers. -#if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99 -# define _STLP_NATIVE_INCLUDE_PATH ../nwsdk/include/nlm -# define _STLP_NATIVE_C_INCLUDE_PATH ../nwsdk/include/nlm -# define _STLP_NATIVE_HEADER(header) <../nwsdk/include/nlm/##header> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../Libraries/MSL C++/Include/##header> -# define _STLP_NATIVE_C_HEADER(header) <../nwsdk/include/nlm/##header> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../Libraries/MSL C++/Include/##header> - -# define _STLP_VENDOR_GLOBAL_CSTD 1 -# define _STLP_NO_VENDOR_STDLIB_L 1 -# define _STLP_NO_VENDOR_MATH_F 1 -# define _STLP_NO_VENDOR_MATH_L 1 - //# define _MSL_NO_THROW_SPECS - //# define _STD - //# define _CSTD -#endif - -// fbp -#if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105 -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -# endif - -#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 diff --git a/SDK/stlport/stl/config/_mwerks.h b/SDK/stlport/stl/config/_mwerks.h deleted file mode 100644 index e6da32b6..00000000 --- a/SDK/stlport/stl/config/_mwerks.h +++ /dev/null @@ -1,161 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Metrowerk Codewarrior" - -// Bring in definition of __MSL__ and related items -#include -#include - -// -// Compiler features -// - - -// *** CodeWarrior Compiler Common Features *** -# if __option(longlong) -# define _STLP_LONG_LONG long long -# endif - -# define _STLP_USE_UNIX_EMULATION_IO 1 - -# define _STLP_USE_AUTO_PTR_CONVERSIONS 1 - -# ifdef __INTEL__ -# define _STLP_LITTLE_ENDIAN -# else -# define _STLP_BIG_ENDIAN -# endif - -#if defined(_MSL_NO_LOCALE) -#define _STLP_NO_IMPORT_LOCALE -#endif -#if !__option( wchar_type ) -# define _STLP_WCHAR_T_IS_USHORT -#endif - -# if __MWERKS__ < 0x3000 -// *** CodeWarrior Compiler Common Bugs *** -# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this -# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version. -# define _STLP_THROW_RETURN_BUG 1 -# endif - -// *** Version-specific settings *** - -# if __MWERKS__ >= 0x2405 -# define _STLP_HAS_NATIVE_FLOAT_ABS -# endif - -# if __MWERKS__ < 0x2405 -# define _STLP_STATIC_CONST_INIT_BUG -# endif - -# if __MWERKS__ <= 0x2303 -# define _STLP_NO_TEMPLATE_CONVERSIONS 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# endif - -# if __MWERKS__ < 0x2301 -# define _STLP_MEMBER_SPECIALIZATION_BUG 1 -# endif - -# if __MWERKS__ < 0x2300 // CW Pro5 features -# define _STLP_INLINE_MEMBER_TEMPLATES 1 -# define _STLP_RELOPS_IN_STD_BUG 1 -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -# define _STLP_NO_TYPENAME_ON_RETURN_TYPE -# endif - -# if __MWERKS__ < 0x2200 // CW Pro4 features -# define _STLP_BROKEN_USING_DIRECTIVE 1 -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# endif - -# if __MWERKS__ < 0x2100 // CW Pro3 features -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 - -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NO_ARROW_OPERATOR 1 -# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1 -# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1 -# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1 -# define _STLP_INLINE_NAME_RESOLUTION_BUG 1 -// *** Metrowerks Standard Library Bug *** -# define _STLP_MSVC50_COMPATIBILITY 1 -# endif - -# if __MWERKS__ < 0x2000 // v. 2.0 features -# define _STLP_NO_WCHAR_T 1 -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2 -# endif - -# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_BASE_TYPEDEF_BUG 1 -# define _STLP_BASE_MATCH_BUG 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 -# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters - -# if __MWERKS__ < 0x1800 - __GIVE_UP_WITH_STL(CW_18) -# endif - -# endif - - -// fixes to native inclusion wrappers. -# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99 -# define _STLP_NATIVE_INCLUDE_PATH ../include -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -# define _STLP_NATIVE_HEADER(header) <../include/##header> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header> -# define _STLP_NATIVE_C_HEADER(header) <../include/##header> -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header> -# else - -# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include -# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes -# define _STLP_NATIVE_HEADER(header) -# define _STLP_NATIVE_CPP_C_HEADER(header) -# define _STLP_NATIVE_C_HEADER(header) -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) - -# endif - -//Following block come from boost intrinsics.hpp file: -#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000) - // Metrowerks compiler is acquiring intrinsic type traits support - // post version 8. We hook into the published interface to pick up - // user defined specializations as well as compiler intrinsics as - // and when they become available: -# include -# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor::value -# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor::value -# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment::value -# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor::value -# define _STLP_IS_POD(T) Metrowerks::is_POD::value -# define _STLP_HAS_TYPE_TRAITS_INTRINSICS -#endif - -// fbp -# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105 -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -# endif - -# if defined(__MACH__) -# define _STLP_MAC -# define O_BINARY 0 -# elif defined(macintosh) -# define _NOTHREADS -# endif -# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 diff --git a/SDK/stlport/stl/config/_native_headers.h b/SDK/stlport/stl/config/_native_headers.h deleted file mode 100644 index 4a146022..00000000 --- a/SDK/stlport/stl/config/_native_headers.h +++ /dev/null @@ -1,54 +0,0 @@ - /* - * - * Copyright (c) 2006 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_MAKE_HEADER) -# define _STLP_MAKE_HEADER(path, header) -#endif - -#if !defined (_STLP_NATIVE_HEADER) -# if !defined (_STLP_NATIVE_INCLUDE_PATH) -# ifdef _XBOX -# define _STLP_NATIVE_INCLUDE_PATH ../xbox -# else -# define _STLP_NATIVE_INCLUDE_PATH ../include -# endif -# endif -# define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header) -#endif - -/* For some compilers, C headers like are located in separate directory */ -#if !defined (_STLP_NATIVE_C_HEADER) -# if !defined (_STLP_NATIVE_C_INCLUDE_PATH) -# define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -# endif -# define _STLP_NATIVE_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_C_INCLUDE_PATH,header) -#endif - -/* For some compilers, C-library headers like are located in separate directory */ -#if !defined (_STLP_NATIVE_CPP_C_HEADER) -# if !defined (_STLP_NATIVE_CPP_C_INCLUDE_PATH) -# define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -# endif -# define _STLP_NATIVE_CPP_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_C_INCLUDE_PATH,header) -#endif - -/* Some compilers locate basic C++ runtime support headers (, , ) in separate directory */ -#if !defined ( _STLP_NATIVE_CPP_RUNTIME_HEADER ) -# if !defined (_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH) -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -# endif -# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH,header) -#endif diff --git a/SDK/stlport/stl/config/_netware.h b/SDK/stlport/stl/config/_netware.h deleted file mode 100644 index 14debd2b..00000000 --- a/SDK/stlport/stl/config/_netware.h +++ /dev/null @@ -1 +0,0 @@ -#define _STLP_PLATFORM "Novell Netware" diff --git a/SDK/stlport/stl/config/_openbsd.h b/SDK/stlport/stl/config/_openbsd.h deleted file mode 100644 index cb698254..00000000 --- a/SDK/stlport/stl/config/_openbsd.h +++ /dev/null @@ -1 +0,0 @@ -#define _STLP_PLATFORM "Open BSD" diff --git a/SDK/stlport/stl/config/_prolog.h b/SDK/stlport/stl/config/_prolog.h deleted file mode 100644 index 5ad943f8..00000000 --- a/SDK/stlport/stl/config/_prolog.h +++ /dev/null @@ -1,52 +0,0 @@ - -#if defined (_STLP_MSVC) || defined (__ICL) - -# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1200) -# pragma warning(push) -# endif -# include -/* We are forcing the alignment to guaranty that libraries are use - * with the same alignment as the one use to build them. - */ -# if !defined (_WIN64) -# pragma pack(push, 8) -# else -# pragma pack(push, 16) -# endif - -#elif defined (__BORLANDC__) - -# pragma option push -# pragma option -Vx- -Ve- -a8 -b -pc -# include - -#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) - -# pragma set woff 1209 -# pragma set woff 1174 -# pragma set woff 1375 -/* from iterator_base.h */ -# pragma set woff 1183 - -#elif defined (__DECCXX) - -# ifdef __PRAGMA_ENVIRONMENT -# pragma __environment __save -# pragma __environment __header_defaults -# endif - -#elif defined (__IBMCPP__) -/* supress EDC3130: A constant is being used as a conditional expression */ -# pragma info(nocnd) - -#elif defined (__HP_aCC) -/* _REENTRANT selects Posix 1c threads unless draft4 selected. - * * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */ -# if 0 /* defined (_REENTRANT) && ! defined (_POSIX_C_SOURCE) */ -# define _POSIX_C_SOURCE 199506 -# endif -#elif defined (__WATCOMCPLUSPLUS__) -# pragma warning 604 10 /* must lookahead to determine... */ -# pragma warning 594 10 /* resolved as declaration/type */ -# pragma warning 595 10 /* resolved as an expression */ -#endif diff --git a/SDK/stlport/stl/config/_sgi.h b/SDK/stlport/stl/config/_sgi.h deleted file mode 100644 index 2f7518f6..00000000 --- a/SDK/stlport/stl/config/_sgi.h +++ /dev/null @@ -1,92 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "CC" - -#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG - -// define native include path before trying to include anything - -#define _STLP_NATIVE_HEADER(__x) -#define _STLP_NATIVE_C_HEADER(__x) -#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) -#define _STLP_NATIVE_CPP_C_HEADER(__x) -#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) - -#define _STLP_NO_NATIVE_MBSTATE_T - -#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS -#define _STLP_NO_NATIVE_WIDE_FUNCTIONS -#define _STLP_NO_MEMBER_TEMPLATE_CLASSES - -// #define _STLP_NO_BAD_ALLOC - -#define _STL_HAS_NAMESPACES - -#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS) -# define _STLP_NO_EXCEPTIONS -#endif - -// #define _STLP_NOTHROW throw() - -#define __EDG_SWITCHES - -#define _STLP_USE_SGI_STRING 1 - -#define _STLP_HAS_NO_NEW_C_HEADERS 1 -// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD - -#define _STLP_NO_POST_COMPATIBLE_SECTION - -#include - -#if !(_COMPILER_VERSION >= 730) -# define _STLP_NO_NEW_NEW_HEADER 1 -#endif - -#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) -# define _STLP_EXTERN_RANGE_ERRORS -#endif - -#if !defined(_BOOL) -# define _STLP_NO_BOOL -#endif -#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32 -# define _STLP_STATIC_CONST_INIT_BUG -#endif - -#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) -# define _STLP_DEF_CONST_PLCT_NEW_BUG -# define _STLP_DEF_CONST_DEF_PARAM_BUG -#endif -#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32) -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD -#endif -#if !defined(_STANDARD_C_PLUS_PLUS) -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -#endif -#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES)) -# define _STLP_HAS_NO_NAMESPACES -#endif -#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES) -# define _STLP_NO_EXCEPTION_HEADER -#endif -#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES) -# define _STLP_NO_BAD_ALLOC -#endif -#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI -# define _STLP_LONG_LONG long long -#endif -#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) -# define _STLP_USE_NO_IOSTREAMS -#endif -#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) -# define _STLP_NO_AT_MEMBER_FUNCTION -#endif -// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) -#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS)) -# define _STLP_NO_TEMPLATE_CONVERSIONS -#endif -#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32) -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER -#endif diff --git a/SDK/stlport/stl/config/_solaris.h b/SDK/stlport/stl/config/_solaris.h deleted file mode 100644 index 7e00d9c7..00000000 --- a/SDK/stlport/stl/config/_solaris.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __stl_config__solaris_h -#define __stl_config__solaris_h - -#define _STLP_PLATFORM "Sun Solaris" - -/* include system features file */ -#include - -/* system-dependent defines */ - -/* - * Should be fixed: - * 1. __SunOS_5_x not defined, and no way to derive this from headers only; - * define it with -D on compiler command line is a bad idea too. - * - * 2. Solaris may has, but may hasn't MATH_F and MATH_L functions (even with two - * underscores)---this depends upon system update level and seems legally present - * only in Solaris 10 (i.e. I saw Solaris 9 with and without __acosf in libm.so.1) - * - * - ptr - */ - -#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L) -# define _STLP_HAS_NATIVE_FLOAT_ABS -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) -# define _STLP_RAND48 1 -#endif - -#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6) -# define _STLP_WCHAR_SUNPRO_EXCLUDE 1 -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -#endif - -/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */ -#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \ - ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) )) -# ifndef _STLP_NO_NATIVE_MBSTATE_T -# define _STLP_NO_NATIVE_MBSTATE_T 1 -# endif -#endif /* KCC */ - -/* For SPARC we use lightweight synchronization */ -#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */ -# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \ - defined (__sparcv9) ) \ - && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS) -# define _STLP_SPARC_SOLARIS_THREADS -# define _STLP_THREADS_DEFINED -# endif -#endif - -/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus. - * limits.h contains invalid values for this combination - */ -#ifdef __GNUC__ -# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__) -# define __LONG_MAX__ 2147483647L -# endif -#endif - -/* - * Hmm, I don't found in Solaris 9 system headers definition like __SunOS_5_9 - * (defined in SunPro?); I also can't find functions like fmodf (again, - * I found modff in libc, but no acosf etc.). Strange, I saw __cosf functions - * (built-in?) at least with gcc some time ago, but don't see ones with - * gcc 3.3.2 on SunOS sparc-solaris1 5.9 Generic_112233-03 sun4u sparc SUNW,Ultra-60 - * from Sorceforge's CF. - * 2005-12-15, - ptr - * - * P.S. That's why I add two defines: - */ - -/* #ifdef __GNUC__ */ -#define _STLP_NO_VENDOR_MATH_F -#define _STLP_NO_VENDOR_MATH_L -/* #endif */ - -#ifdef __GNUC__ -# define _STLP_WCHAR_BORLAND_EXCLUDE -# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 -#endif - -#endif /* __stl_config__solaris_h */ diff --git a/SDK/stlport/stl/config/_sunprocc.h b/SDK/stlport/stl/config/_sunprocc.h deleted file mode 100644 index b54e1214..00000000 --- a/SDK/stlport/stl/config/_sunprocc.h +++ /dev/null @@ -1,161 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Sunpro CC" - -#define _STLP_LONG_LONG long long - -// GAB: 11/09/05 -// Starting with 5.0 the STLport code expects to be -// instantiated during compile time. This is due to undefing -// a number of defines that are also used in the c versions -// of the file. When they are undefed the c version fails to -// compile. -// # define _STLP_LINK_TIME_INSTANTIATION 1 - -#if ! defined(_BOOL) -# define _STLP_NO_BOOL 1 -#endif - -// compatibility mode stuff -#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) -# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd -# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC -#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) -# define _STLP_NATIVE_INCLUDE_PATH ../CC -#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4) -# define _STLP_NATIVE_INCLUDE_PATH ../CC4 -#else -# define _STLP_NATIVE_INCLUDE_PATH ../CC -#endif - -#define _STLP_STATIC_CONST_INIT_BUG 1 - -#if (__SUNPRO_CC < 0x530) -// those are tested and proved not to work... -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_USE_OLD_HP_ITERATOR_QUERIES -#endif - -#ifdef _STLP_USE_NO_IOSTREAMS -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -#endif - -// those do not depend on compatibility -#if (__SUNPRO_CC < 0x510) -# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 -#endif - -#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) - -# define _STLP_NO_QUALIFIED_FRIENDS 1 - -// no partial , just for explicit one -# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 - -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 - -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -#endif - -// Features that depend on compatibility switch -#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) - -# ifndef _STLP_USE_NO_IOSTREAMS -# define _STLP_USE_NO_IOSTREAMS 1 -# endif -# define _STLP_NO_NEW_NEW_HEADER 1 -// # define _STLP_NO_RELOPS_NAMESPACE -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_BAD_ALLOC 1 -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_NATIVE_C_INCLUDE_PATH ../include -#elif (__SUNPRO_CC < 0x510) -// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh> -# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh> -# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include -#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 ) -# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std -# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std -#else -# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include -# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std -#endif - -#if ( __SUNPRO_CC < 0x500 ) - -# undef _STLP_NATIVE_C_HEADER -# undef _STLP_NATIVE_CPP_C_HEADER - -# define wint_t __wint_t -// famous CC 4.2 bug -# define _STLP_INLINE_STRING_LITERAL_BUG 1 -// /usr/include -# define _STLP_NATIVE_C_INCLUDE_PATH ../include - -// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;( -# define _STLP_USE_OLD_HP_ITERATOR_QUERIES - -// 4.2 does not like it -# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS - -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 - -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NO_BAD_ALLOC 1 -# define _STLP_NO_ARROW_OPERATOR 1 - -# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 -# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1 -# undef _STLP_HAS_NO_NEW_C_HEADERS -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS - -# if ( __SUNPRO_CC < 0x420 ) -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -# define _STLP_NO_METHOD_SPECIALIZATION 1 -# if ( __SUNPRO_CC > 0x401 ) -# if (__SUNPRO_CC==0x410) -# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 -# endif -# else - // SUNPro C++ 4.0.1 -# define _STLP_BASE_MATCH_BUG 1 -# define _STLP_BASE_TYPEDEF_BUG 1 -# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C)) - __GIVE_UP_WITH_STL(SUNPRO_401) -# endif -# endif /* 4.0.1 */ -# endif /* 4.2 */ -#endif /* < 5.0 */ - -#ifndef _MBSTATET_H -# define _MBSTATET_H -# undef _MBSTATE_T -# define _MBSTATE_T -typedef struct __mbstate_t { -# if defined(_LP64) - long __filler[4]; -# else - int __filler[6]; -# endif -} __mbstate_t; -# ifndef _STLP_HAS_NO_NAMESPACES -namespace std { - typedef __mbstate_t mbstate_t; -} -using std::mbstate_t; -# else -typedef __mbstate_t mbstate_t; -# endif -#endif /* __MBSTATET_H */ diff --git a/SDK/stlport/stl/config/_symantec.h b/SDK/stlport/stl/config/_symantec.h deleted file mode 100644 index 7926bf56..00000000 --- a/SDK/stlport/stl/config/_symantec.h +++ /dev/null @@ -1,48 +0,0 @@ -/* STLport configuration file - * It is internal STLport header - DO NOT include it directly - */ - -#define _STLP_COMPILER "Symantec" - -/* if not using maximum ANSI compatibility ( -A -Ab -Aw), - * uncomment the following two lines: - */ -/*# define _STLP_NO_BOOL 1 */ -/*# define _STLP_NO_WCHAR_T 1 */ - -/* TODO: Check that this config is necessary for all compiler versions. - * It is here for historical reasons for the moment. - */ -#define _STLP_NO_CONTAINERS_EXTENSION - -# define _STLP_HAS_NO_NAMESPACES 1 - -# define _STLP_NEED_TYPENAME 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NO_NEW_STYLE_CASTS 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -/* # define _STLP_NO_BAD_ALLOC 1 */ - -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_QUALIFIED_FRIENDS 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 - -/* # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 */ -# define _STLP_NO_METHOD_SPECIALIZATION 1 -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 -/* # define _STLP_NO_EXCEPTION_HEADER 1 */ - -# define _STLP_HAS_NO_NEW_C_HEADERS 1 - -# define _STLP_STATIC_CONST_INIT_BUG 1 -# define _STLP_THROW_RETURN_BUG 1 -/* # define _STLP_LINK_TIME_INSTANTIATION 1 */ -# define _STLP_NO_TEMPLATE_CONVERSIONS 1 - -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 - diff --git a/SDK/stlport/stl/config/_system.h b/SDK/stlport/stl/config/_system.h deleted file mode 100644 index c0261dff..00000000 --- a/SDK/stlport/stl/config/_system.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* - * Purpose of this file : - * - * To hold COMPILER-SPECIFIC portion of STLport settings. - * In general, user should not edit this file unless - * using the compiler not recognized below. - * - * If your compiler is not being recognized yet, - * please look for definitions of macros in stl_mycomp.h, - * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME, - * adjust flags for your compiler, and add - * to the secton controlled by unique macro defined internaly by your compiler. - * - * To change user-definable settings, please edit - * - */ - -#ifndef __stl_config__system_h -#define __stl_config__system_h - -#if defined (__sun) -# include -# if defined (__GNUC__) -# include -# elif defined (__SUNPRO_CC) -# include -/* -# ifdef __KCC -# include -# endif -*/ -# elif defined (__APOGEE__) /* Apogee 4.x */ -# include -# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */ -# include -# endif -#elif defined (__hpux) -# include -# if defined (__GNUC__) -# include -# elif defined (__HP_aCC) -# include -# endif -#elif defined (linux) || defined (__linux__) -# include -/* Intel's icc define __GNUC__! */ -# if defined (__INTEL_COMPILER) -# include -# elif defined (__GNUC__) -# include -# endif -/* -# ifdef __KCC -# include -# endif -*/ -#elif defined (__FreeBSD__) -# include -# if defined (__GNUC__) -# include -# endif -#elif defined (__OpenBSD__) -# include -# if defined (__GNUC__) -# include -# endif -#elif defined (N_PLAT_NLM) /* Novell NetWare */ -# include -# ifdef __MWERKS__ /* Metrowerks CodeWarrior */ -# include -# endif -#elif defined (__sgi) /* IRIX? */ -# define _STLP_PLATFORM "SGI Irix" -# if defined (__GNUC__) -# include -# else -# include -# endif -#elif defined (__OS400__) /* AS/400 C++ */ -# define _STLP_PLATFORM "OS 400" -# if defined (__GNUC__) -# include -# else -# include -# endif -#elif defined (_AIX) -# include -# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ ) - /* AIX xlC, Visual Age C++ , OS-390 C++ */ -# include -# endif -#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */ -# define _STLP_PLATFORM "Cray" -# include -#elif defined (__DECCXX) || defined (__DECC) -# define _STLP_PLATFORM "DECC" -# ifdef __vms -# include -# else -# include -# endif -#elif defined (macintosh) || defined (_MAC) -# include -# if defined (__MWERKS__) -# include -# elif defined (__MRC__) || (defined (__SC__) && (__SC__ >= 0x882)) - /* Apple MPW SCpp 8.8.2, Apple MPW MrCpp 4.1.0 */ -# include -# endif -#elif defined (__APPLE__) -# include -# ifdef __GNUC__ -# include -# endif -#elif defined (__CYGWIN__) -# include -# if defined (__GNUC__) -# include -# endif -#elif defined (__MINGW32__) -# define _STLP_PLATFORM "MinGW" -# if defined (__GNUC__) -# include -# endif -# include -#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \ - defined (__WIN16) || defined (WIN16) || defined (_WIN16) -# if defined ( __BORLANDC__ ) /* Borland C++ ( 4.x - 5.x ) */ -# include -# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */ -# include -# elif defined (__COMO__) || defined (__COMO_VERSION_) -# include -# elif defined (__DMC__) /* Digital Mars C++ */ -# include -# elif defined (__SC__) && (__SC__ < 0x800) /* Symantec 7.5 */ -# include -# elif defined (__ICL) /* Intel reference compiler for Win */ -# include -# elif defined (__MWERKS__) -# include -# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE) - /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */ -# include -# elif defined (_MSC_VER) - /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */ -# include -# endif - -# include -#else -# error Unknown platform !! -#endif - -#if !defined (_STLP_COMPILER) -/* Unable to identify the compiler, issue error diagnostic. - * Edit to set STLport up for your compiler. */ -# include -#endif - -#endif /* __stl_config__system_h */ diff --git a/SDK/stlport/stl/config/_warnings_off.h b/SDK/stlport/stl/config/_warnings_off.h deleted file mode 100644 index 5618e6e6..00000000 --- a/SDK/stlport/stl/config/_warnings_off.h +++ /dev/null @@ -1,60 +0,0 @@ -/* This header turns off warnings that STLport headers generate for compiled - * user code. - */ - -#if defined (_STLP_MSVC) -# if (_STLP_MSVC > 1000) -# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -/* - * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class - * we have to disable this warning as the string are used as data members type of many iostream classes. - */ -# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's -# endif - -# if (_STLP_MSVC < 1200) // VC5 and earlier -# pragma warning( disable : 4389 ) // '==' : signed/unsigned mismatch -// multiple copy constructors/assignment operators specified, -// with member templates are bogus... -# pragma warning( disable : 4521 ) -# pragma warning( disable : 4522 ) -# endif - -# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4 -# pragma warning( disable : 4097 ) // typedef-name used as based class of (...) -# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation -# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data -# pragma warning( disable : 4284 ) // for -> operator -//This warning is necessary because of the native platform headers: -# pragma warning( disable : 4290 ) // c++ exception specification ignored -# pragma warning( disable : 4514 ) // unreferenced inline function has been removed -# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated -# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized -# pragma warning( disable : 4710 ) // function (...) not inlined -# pragma warning( disable : 4786 ) // identifier truncated to 255 characters -# endif - -# if (_STLP_MSVC < 1400) -# pragma warning( disable : 4511 ) // copy constructor cannot be generated -# endif - -//Pool of common warnings for all MSVC supported versions: -//Many are only useful if warning level is set to 4. -# pragma warning( disable : 4100 ) // unreferenced formal parameter -# pragma warning( disable : 4127 ) // conditional expression is constant -# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned -# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch -# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation) -# pragma warning( disable : 4510 ) // default constructor cannot be generated -# pragma warning( disable : 4512 ) // assignment operator could not be generated -# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions -# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required -# endif -#elif defined (__BORLANDC__) -# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false -# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline -# pragma option -w-ngu // -w-8041 Negating unsigned value -# pragma option -w-pow // -w-8062 Previous options and warnings not restored -# pragma option -w-rch // -w-8066 Unreachable code -# pragma option -w-par // -w-8057 Parameter 'parameter' is never used -#endif diff --git a/SDK/stlport/stl/config/_watcom.h b/SDK/stlport/stl/config/_watcom.h deleted file mode 100644 index f960424c..00000000 --- a/SDK/stlport/stl/config/_watcom.h +++ /dev/null @@ -1,154 +0,0 @@ -// STLport configuration file -// It is internal STLport header - DO NOT include it directly - -#define _STLP_COMPILER "Watcom" - -# ifndef _STLP_USE_NO_IOSTREAMS -# define _STLP_USE_NO_IOSTREAMS -# endif - -# define _STLP_NO_RELOPS_NAMESPACE -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX - -# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG -# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS -# define _STLP_USE_OLD_HP_ITERATOR_QUERIES - -// On QNX, headers are supposed to be found in /usr/include, -// so default "../include" should work. -# ifndef __QNX__ -# define _STLP_NATIVE_INCLUDE_PATH ../h -# endif - -// Inline replacements for locking calls under Watcom -// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using -// standard WIN32 calls -// Define _STL_MULTIPROCESSOR to enable lock -#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK) - -long __stl_InterlockedIncrement( long *var ); -long __stl_InterlockedDecrement( long *var ); - -#ifdef _STL_MULTIPROCESSOR -// Multiple Processors, add lock prefix -#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \ - ".586" \ - "mov eax, 1" \ - "lock xadd [ecx], eax" \ - "inc eax" \ - value [eax]; - - -#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \ - ".586" \ - "mov eax, 0FFFFFFFFh" \ - "lock xadd [ecx], eax" \ - "dec eax" \ - value [eax]; -#else -// Single Processor, lock prefix not needed -#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \ - ".586" \ - "mov eax, 1" \ - "xadd [ecx], eax" \ - "inc eax" \ - value [eax]; - -#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \ - ".586" \ - "mov eax, 0FFFFFFFFh" \ - "xadd [ecx], eax" \ - "dec eax" \ - value [eax]; -#endif // _STL_MULTIPROCESSOR - -long __stl_InterlockedExchange( long *Destination, long Value ); - -// xchg has auto-lock -#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \ - ".586" \ - "xchg eax, [ecx]" \ - value [eax]; -#else - -#define __stl_InterlockedIncrement InterlockedIncrement -#define __stl_InterlockedDecrement InterlockedDecrement -#define __stl_InterlockedExchange InterlockedExchange -#endif /* INLINE INTERLOCK */ - -#define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x) -#define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x) -#define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y) - -// boris : is this true or just the header is not in /usr/include ? -# ifdef __QNX__ -# define _STLP_NO_TYPEINFO 1 -# endif - -# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# define _STLP_NO_MEMBER_TEMPLATES 1 -# define _STLP_NO_FRIEND_TEMPLATES 1 -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 - - -# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 -# define _STLP_HAS_NO_NAMESPACES 1 -# define _STLP_NEED_TYPENAME 1 - -# if __WATCOMC__ < 1100 -# define _STLP_NO_WCHAR_T 1 -# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 -# endif - -# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 - -# define _STLP_STATIC_CONST_INIT_BUG 1 -// # define _STLP_THROW_RETURN_BUG 1 -# define _STLP_NO_TEMPLATE_CONVERSIONS 1 - -# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 - -# define _STLP_HAS_NO_NEW_IOSTREAMS 1 -# define _STLP_HAS_NO_NEW_C_HEADERS 1 -# define _STLP_NO_NEW_NEW_HEADER 1 -# define _STLP_VENDOR_GLOBAL_STD - -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 -# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 -# define _STLP_NONTEMPL_BASE_MATCH_BUG -# define _STLP_NO_EXCEPTION_HEADER 1 -# define _STLP_NO_BAD_ALLOC 1 - -# define _STLP_NESTED_TYPE_PARAM_BUG 1 - -# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 - -# if (__WATCOM_CPLUSPLUS__ < 1100 ) -# define _STLP_NO_BOOL 1 -# define _STLP_NEED_EXPLICIT 1 -# define _STLP_NEED_MUTABLE 1 -# define _STLP_NO_ARROW_OPERATOR 1 -# endif -// This one is present in 11, but apparently has bugs (with auto_ptr). -# define _STLP_NO_NEW_STYLE_CASTS 1 - -// Get rid of Watcom's min and max macros -#undef min -#undef max - -// for switches (-xs, -xss, -xst) -// -#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST)) -# define _STLP_HAS_NO_EXCEPTIONS 1 -# endif - -# if defined ( _MT ) && !defined (_NOTHREADS) && !defined (_REENTRANT) -# define _REENTRANT 1 -# endif - - - - - diff --git a/SDK/stlport/stl/config/_windows.h b/SDK/stlport/stl/config/_windows.h deleted file mode 100644 index 0040b6bf..00000000 --- a/SDK/stlport/stl/config/_windows.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_INTERNAL_WINDOWS_H -#define _STLP_INTERNAL_WINDOWS_H - -#if !defined (_STLP_PLATFORM) -# define _STLP_PLATFORM "Windows" -#endif - -/* _STLP_WIN32_VERSION is used to detect targetted Windows platforms as - * old ones are not supporting some Win32 functions that STLport use. - * Limited OSs are going up to and including Windows 98 so they can be - * detected using WINVER or _WIN32_WINDOWS macros, we do not have to use - * _WINNT_WINDOWS macro for the moment. - */ -#if !defined (_STLP_WIN32_VERSION) -# if defined (WINVER) -# define _STLP_WIN32_VERSION WINVER -# elif defined (_WIN32_WINDOWS) -# define _STLP_WIN32_VERSION _WIN32_WINDOWS -# endif -#endif - -#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN) -# if defined (_MIPSEB) -# define _STLP_BIG_ENDIAN 1 -# endif -# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \ - defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \ - defined (__alpha__) -# define _STLP_LITTLE_ENDIAN 1 -# endif -# if defined (__ia64__) - /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */ -# if defined (__BIG_ENDIAN__) -# define _STLP_BIG_ENDIAN 1 -# else -# define _STLP_LITTLE_ENDIAN 1 -# endif -# endif -#endif /* _STLP_BIG_ENDIAN */ - -#if !defined (_STLP_WINDOWS_H_INCLUDED) -# define _STLP_WINDOWS_H_INCLUDED -# if !(defined ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \ - defined (__MINGW32__) || defined (__DMC__)) -# if defined (_STLP_USE_MFC) -# include -# else -# include -# endif -# else -/* This section serves as a replacement for windows.h header for Visual C++ */ -# if defined (__cplusplus) -extern "C" { -# endif -# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \ - (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED) -# define InterlockedIncrement _InterlockedIncrement -# define InterlockedDecrement _InterlockedDecrement -# define InterlockedExchange _InterlockedExchange -/* Here we use a different macro name than the InterlockedExchangePointer SDK function - * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer - * as a macro. - */ -# define STLPInterlockedExchangePointer _InterlockedExchangePointer -# define _STLP_STDCALL -# else -# if defined (_MAC) -# define _STLP_STDCALL _cdecl -# else -# define _STLP_STDCALL __stdcall -# endif -# endif - -# if defined (_STLP_NEW_PLATFORM_SDK) -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *); -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *); -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long); -# if defined (STLPInterlockedExchangePointer) -_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*); -# endif -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long); -# elif defined (_STLP_WCE) - -/* start of eMbedded Visual C++ specific section */ -# include /* needed for basic windows types */ - - /** in SDKs generated with PB5, windef.h somehow includes headers which then - define setjmp. */ -# if (_WIN32_WCE >= 0x500) -# define _STLP_NATIVE_SETJMP_H_INCLUDED -# endif - -# ifndef _WINBASE_ /* winbase.h already included? */ -long WINAPI InterlockedIncrement(long*); -long WINAPI InterlockedDecrement(long*); -long WINAPI InterlockedExchange(long*, long); -# endif - -# ifndef __WINDOWS__ /* windows.h already included? */ - -# if defined (x86) || defined(_XBOX) -# include /* needed for inline versions of Interlocked* functions */ -# endif - -# ifndef _MFC_VER - -# define MessageBox MessageBoxW -int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); - -# define wvsprintf wvsprintfW -int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList); - -void WINAPI ExitThread(DWORD dwExitCode); - -# if !defined (COREDLL) -# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT -# else -# define _STLP_WCE_WINBASEAPI -# endif - -_STLP_WCE_WINBASEAPI int WINAPI -MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, - int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar); - -_STLP_WCE_WINBASEAPI UINT WINAPI GetACP(); - -_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode); - -# define OutputDebugString OutputDebugStringW -void WINAPI OutputDebugStringW(LPCWSTR); - -_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD); - -# undef _STLP_WCE_WINBASEAPI - -# endif /* !_MFC_VER */ - -# endif /* !__WINDOWS__ */ - -/* end of eMbedded Visual C++ specific section */ - -# else -/* boris : for the latest SDK, you may actually need the other version of the declaration (above) - * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ... - */ -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*); -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*); -_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long); -# endif - -# if !defined (STLPInterlockedExchangePointer) -/* This API function do not exist in the old platform SDK and is equivalent to - * InterlockedExchange on 32 bits platform: - */ -# if defined (__cplusplus) -/* We do not define this function if we are not in a C++ translation unit just - * because of the inline portability issue it would introduce. We will have to - * fix it the day we need this function for a C translation unit. - */ -inline -void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) { -# if defined (_STLP_MSVC) -/* Here MSVC produces warning if 64 bits portability issue is activated. - * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content - * is based on the platform, Win32 or Win64 - */ -# pragma warning (push) -# pragma warning (disable : 4311) // pointer truncation from void* to long -# pragma warning (disable : 4312) // conversion from long to void* of greater size -# endif -# if !defined (_STLP_NO_NEW_STYLE_CASTS) - return reinterpret_cast(InterlockedExchange(reinterpret_cast(const_cast(__a)), - reinterpret_cast(__b))); -# else - return (void*)InterlockedExchange((long*)__a, (long)__b); -# endif -# if defined (_STLP_MSVC) -# pragma warning (pop) -# endif -} -# endif -# endif - -# if !defined (_STLP_WCE) && !defined(_XBOX) -_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long); -_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString); -# endif - -# if defined (InterlockedIncrement) -# pragma intrinsic(_InterlockedIncrement) -# pragma intrinsic(_InterlockedDecrement) -# pragma intrinsic(_InterlockedExchange) -# ifndef _XBOX -# pragma intrinsic(_InterlockedExchangePointer) -# endif // #ifndef _XBOX -# endif -# if defined (__cplusplus) -} /* extern "C" */ -# endif - -# endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/ - -#endif /* _STLP_WINDOWS_H_INCLUDED */ - -#endif /* _STLP_INTERNAL_WINDOWS_H */ diff --git a/SDK/stlport/stl/config/compat.h b/SDK/stlport/stl/config/compat.h deleted file mode 100644 index f03d874b..00000000 --- a/SDK/stlport/stl/config/compat.h +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Compatibility section - * This section sets new-style macros based on old-style ones, for compatibility - */ - -#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG) -# define _STLP_DEBUG __STL_DEBUG -#endif -#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS) -# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS -#endif -#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS) -# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS -#endif -#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) -# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS -#endif -#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES) -# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES -#endif -#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) -# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS -#endif -#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE) -# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE -#endif - -#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE) -# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE -#endif - -#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED) -# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED -#endif -#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE) -# define _STLP_SHRED_BYTE __STL_SHRED_BYTE -#endif -#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC) -# define _STLP_USE_MFC __STL_USE_MFC -#endif - -#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC) -# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC -#endif -#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC) -# define _STLP_USE_MALLOC __STL_USE_MALLOC -#endif - -#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC) -# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC -#endif - -#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE) -# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE -#endif - -#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE) -# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE -#endif - -#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS) -# define _STLP_USE_ABBREVS __STL_USE_ABBREVS -#endif - -#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY) -# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY -#endif - -#if defined (__STL_USE_RAW_SGI_ALLOCATORS) && !defined (_STLP_USE_RAW_SGI_ALLOCATORS) -# define _STLP_USE_RAW_SGI_ALLOCATORS __STL_USE_RAW_SGI_ALLOCATORS -#endif - -/* STLport do not support anymore the iostream wrapper mode so this macro should - * always been define for other libraries that was using it: - */ -#if !defined (_STLP_OWN_IOSTREAMS) -# define _STLP_OWN_IOSTREAMS -#endif - -#if defined (_STLP_NO_OWN_IOSTREAMS) -# error STLport do not support anymore the wrapper mode. If you want to use STLport \ -use its iostreams implementation or no iostreams at all. -#endif diff --git a/SDK/stlport/stl/config/features.h b/SDK/stlport/stl/config/features.h deleted file mode 100644 index d4c9d243..00000000 --- a/SDK/stlport/stl/config/features.h +++ /dev/null @@ -1,1198 +0,0 @@ - /* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_FEATURES_H -#define _STLP_FEATURES_H - -/* - * Purpose of this file: - * - * Defines all STLport settings. - * This file is actually a wrapper : it includes compiler-specific - * settings from - * and user-defined settings from . - * See and for the description - * of those macros - * - */ - -/* Definition of the STLport version informations */ -#include - -/* Other macros defined by this file: - - * bool, true, and false, if _STLP_NO_BOOL is defined. - * typename, as a null macro if it's not already a keyword. - * explicit, as a null macro if it's not already a keyword. - * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.) - * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.) - * _STLP_ASSERT, either as a test or as a null macro, depending on - whether or not _STLP_ASSERTIONS is defined. -*/ - -/* Definition of the 2 STLport debug levels */ -#define _STLP_STLPORT_DBG_LEVEL 1 -#define _STLP_STANDARD_DBG_LEVEL 2 - -/* Placeholder for user to override settings. - * It could be also used to mask settings from - * different directories. - */ -#include - -#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL) -# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL -#endif - -#if defined (__BUILDING_STLPORT) -/* For the STLport implementation we can use everything: - */ -# if defined (_STLP_NO_ANACHRONISMS) -# undef _STLP_NO_ANACHRONISMS -# endif -# if defined (_STLP_NO_EXTENSIONS) -# undef _STLP_NO_EXTENSIONS -# endif -/* Moreover there are things that has no sens: - */ -# if defined (_STLP_NO_IOSTREAMS) -# error If you do not use iostreams you do not need to build the STLport library. -# endif -#endif - -/* ========================================================= */ -/* This file is used for compatibility; it accepts old-style config - switches */ -#include - -/* Common configuration file for this particular installation. */ -#include - -/* Operational Environment specific */ -#include - -/* ========================================================= */ - -/* some fixes to configuration. This also includes modifications - * of STLport switches depending on compiler flags, - * or settings applicable to a group of compilers, such as - * to all who use EDG front-end. - */ -#include - -#ifdef _STLP_USE_BOOST_SUPPORT -/* We are going to use the boost library support. To limit the problem - * of self referencing headers we have to specify clearly to the boost - * library that the Standard lib is STLport: - */ -# ifndef BOOST_STDLIB_CONFIG -# define BOOST_STDLIB_CONFIG -# endif -#endif - - -/* - * Performs integrity check on user-specified parameters - * and site-specific settings. - */ -/* -# include -*/ - -/* SGI terms */ - -#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES) -# define _STLP_MEMBER_TEMPLATES 1 -#endif - -#if !defined (_STLP_NO_FRIEND_TEMPLATES) && !defined (_STLP_FRIEND_TEMPLATES) -# define _STLP_FRIEND_TEMPLATES 1 -#endif - -#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES) -# define _STLP_MEMBER_TEMPLATE_CLASSES 1 -#endif - -#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) -# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 -#endif - -#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1 -#endif - -#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) -# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1 -#endif - -#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM) -# define _STLP_USE_SHORT_STRING_OPTIM 1 -#endif - -#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \ - !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION) -# define _STLP_USE_CONTAINERS_EXTENSION -#endif - -#if defined (_STLP_USE_CONTAINERS_EXTENSION) -# define _STLP_TEMPLATE_FOR_CONT_EXT template -#else -# define _STLP_TEMPLATE_FOR_CONT_EXT -#endif - -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \ - (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) -# error "Sorry but according the STLport settings your compiler can not support the pointer specialization feature." -#endif - -#if defined (_STLP_NO_IOSTREAMS) && \ - !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC) -# define _STLP_USE_NEWALLOC -#endif - -#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN) -# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \ - defined (__hpux) || defined (macintosh) || defined (_MAC) -# define _STLP_BIG_ENDIAN 1 -# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \ - defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \ - defined (__alpha__) -# define _STLP_LITTLE_ENDIAN 1 -# elif defined (__ia64__) - /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */ -# if defined (__BIG_ENDIAN__) -# define _STLP_BIG_ENDIAN 1 -# else -# define _STLP_LITTLE_ENDIAN 1 -# endif -# else -# error "can't determine endianess" -# endif -#endif /* _STLP_BIG_ENDIAN */ - -/* ========================================================== - * final workaround tuning based on given flags - * ========================================================== */ - -#ifndef _STLP_UINT32_T -# define _STLP_UINT32_T unsigned long -#endif -#ifndef _STLP_ABORT -# define _STLP_ABORT() abort() -#endif - -#if !defined (_STLP_HAS_NO_NAMESPACES) -# if defined _STLP_NO_NAMESPACES -# undef _STLP_USE_NAMESPACES -# else -/* assume it as the default, turn it off later if NO_NAMESPACES selected */ -# undef _STLP_USE_NAMESPACES -# define _STLP_USE_NAMESPACES 1 -# endif -#endif - -#if defined (_STLP_NO_IOSTREAMS) -# define _STLP_USE_NO_IOSTREAMS -#endif - -/* Operating system recognition (basic) */ -#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__Lynx__) -# define _STLP_UNIX 1 -#elif defined(macintosh) || defined (_MAC) -# define _STLP_MAC 1 -#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || defined (_XBOX) -# define _STLP_WIN32 1 -#elif defined (__WIN16) || defined (WIN16) || defined (_WIN16) -# define _STLP_WIN16 -#endif /* __unix */ - -#if defined (_STLP_WIN16) -# define _STLP_LDOUBLE_80 -#elif defined(_STLP_WIN32) -# if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) || defined (__CYGWIN__) -# define _STLP_LDOUBLE_64 -# else -# define _STLP_LDOUBLE_96 -# endif -#elif defined (_STLP_UNIX) -# if defined (__CYGWIN__) -# define _STLP_LDOUBLE_96 -# endif -#endif - -#if !defined (_STLP_LDOUBLE_64) && !defined (_STLP_LDOUBLE_80) && !defined (_STLP_LDOUBLE_96) && !defined (_STLP_LDOUBLE_128) -# define _STLP_LDOUBLE_128 -#endif - -#if !defined (_STLP_NO_LONG_DOUBLE) -# define _STLP_LONGEST_FLOAT_TYPE long double -#else -# define _STLP_LONGEST_FLOAT_TYPE double -#endif - -/* Native headers access macros */ -#include - -/* shared library tune-up */ - -#if defined (__BUILDING_STLPORT) -/* if we are rebuilding right now, place everything here */ -# undef _STLP_DESIGNATED_DLL -# define _STLP_DESIGNATED_DLL 1 -#endif - -/* Use own namespace always if possible and not explicitly instructed otherwise */ -#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \ - !defined (_STLP_NO_OWN_NAMESPACE) -# undef _STLP_USE_OWN_NAMESPACE -# define _STLP_USE_OWN_NAMESPACE 1 -#else -# undef _STLP_WHOLE_NATIVE_STD -#endif - -#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) - -# if defined (_PTHREADS) -# define _STLP_PTHREADS -# define _STLP_THREADS -# endif -# if defined (_UITHREADS) -# define _STLP_UITHREADS -# define _STLP_THREADS -# endif - -# if defined (__sgi) && !defined (__KCC) && !defined (__GNUC__) -# define _STLP_SGI_THREADS -# elif defined (__DECC) || defined (__DECCXX) -# define _STLP_DEC_THREADS -# elif defined (_STLP_WIN32) && !defined (_STLP_PTHREADS) -# define _STLP_WIN32THREADS 1 -# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \ - !defined(_STLP_PTHREADS) -# define _STLP_UITHREADS -# elif defined (__OS2__) -# define _STLP_OS2THREADS -# elif defined (__BEOS__) -# define _STLP_BETHREADS -# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* (__dest_os == __netware_os) */ -# define _STLP_NWTHREADS -# else -# define _STLP_PTHREADS -# endif /* __sgi */ -# define _STLP_THREADS_DEFINED -#endif - -#if (defined (_REENTRANT) || defined (_THREAD_SAFE) || \ - (defined (_POSIX_THREADS) && defined (__OpenBSD__))) && \ - !defined (_STLP_THREADS) -# define _STLP_THREADS -#endif /* _REENTRANT */ - -#if defined (__linux__) && defined (_STLP_PTHREADS) -/* # include */ - -# if defined (__USE_XOPEN2K) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK) -# define _STLP_USE_PTHREAD_SPINLOCK -# define _STLP_STATIC_MUTEX _STLP_mutex -# endif /* __USE_XOPEN2K */ -#endif /* __linux__ && _STLP_PTHREADS */ - -#if defined (__OpenBSD__) && defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK) -# define _STLP_USE_PTHREAD_SPINLOCK -# define _STLP_STATIC_MUTEX _STLP_mutex -#endif - -#ifndef _STLP_STATIC_MUTEX -# define _STLP_STATIC_MUTEX _STLP_mutex_base -#endif - -#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC) -# define _STLP_USE_MFC 1 -#endif - -#if defined (_STLP_THREADS) -# define _STLP_VOLATILE volatile -/* windows.h _MUST be included before bool definition ;( */ -# if defined (_STLP_WIN32THREADS) && defined (_STLP_NO_BOOL) -# undef NOMINMAX -# define NOMINMAX -# ifdef _STLP_USE_MFC -# include -# else -# ifdef _XBOX -# include -# else -# include -# endif -# endif -# define _STLP_WINDOWS_H_INCLUDED -# endif -#else -# define _STLP_VOLATILE -#endif - -#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) -# define _STLP_USE_NEW_C_HEADERS -#endif -/* disable new-style headers if requested */ -#if defined (_STLP_NO_NEW_C_HEADERS) -# undef _STLP_USE_NEW_C_HEADERS -#endif - -#if !defined (_STLP_STATIC_TEMPLATE_DATA) -# define _STLP_STATIC_TEMPLATE_DATA 1 -#endif - -#if defined (_STLP_BASE_TYPEDEF_BUG) -# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG -# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 -#endif - -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) || (defined (_STLP_MSVC) && (_STLP_MSVC < 1100)) -# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG -#endif - -/* SUNpro 4.2 inline string literal bug */ -#ifdef _STLP_INLINE_STRING_LITERAL_BUG -# define _STLP_FIX_LITERAL_BUG(__x) __x = __x; -#else -# define _STLP_FIX_LITERAL_BUG(__x) -#endif - -#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) -# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM -# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 -#endif - -#define _STLP_NEW new -#define _STLP_PLACEMENT_NEW new - -#ifdef _STLP_DEBUG -# define _STLP_ASSERTIONS 1 -#endif - -#if !defined (_STLP_STATIC_ASSERT) -/* Some compiler support 0 size array so we use negative size array to generate - * a compilation time error. - */ -# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1]; -#endif - -/* apple mpw exception handling bug */ -#ifndef _STLP_MPWFIX_TRY -# define _STLP_MPWFIX_TRY -#endif -#ifndef _STLP_MPWFIX_CATCH -# define _STLP_MPWFIX_CATCH -#endif -#ifndef _STLP_MPWFIX_CATCH_ACTION -# define _STLP_MPWFIX_CATCH_ACTION(action) -#endif - -/* if _STLP_DEBUG or _STLP_ASSERTIONS are set, stl/debug/_debug.h defines those */ - -#if !defined (_STLP_ASSERTIONS) && !defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_ALLOC) -# define _STLP_ASSERT(expr) -#endif - -#if !defined (_STLP_DEBUG) -# define _STLP_VERBOSE_ASSERT(expr,diagnostic) -# define _STLP_DEBUG_CHECK(expr) -# define _STLP_DEBUG_DO(expr) -#endif - -#if !defined (_STLP_WEAK) -# define _STLP_WEAK -#endif - -/* default parameters as template types derived from arguments ( not always supported ) */ -#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname -#else -# if !defined (_STLP_DEFAULT_TYPE_PARAM) -# define _STLP_DEFAULT_TYPE_PARAM 1 -# endif -# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval -#endif - -/* default parameters as complete types */ -#if defined (_STLP_DEFAULT_TYPE_PARAM) -# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval -# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val -#else -# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname -# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name -#endif - -/* SGI compatibility */ - -#ifdef _STLP_NO_WCHAR_T -# ifndef _STLP_NO_NATIVE_WIDE_STREAMS -# define _STLP_NO_NATIVE_WIDE_STREAMS 1 -# endif -#else -# define _STLP_HAS_WCHAR_T 1 -#endif - -#if !defined (_STLP_NO_AT_MEMBER_FUNCTION) -# define _STLP_CAN_THROW_RANGE_ERRORS 1 -#endif - -#if !defined (_STLP_USE_RAW_SGI_ALLOCATORS) -# define _STLP_DEFAULT_ALLOCATOR(_Tp) allocator< _Tp > -# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TMPL_PARAM(_Alloc, allocator< _Tp >) -# define _STLP_DEFAULT_PAIR_ALLOCATOR(_Key, _Tp) allocator< pair < _Key, _Tp > > -# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) -# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc -# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1 -# else -# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \ - class _Alloc = allocator< pair < _Key, _Tp > > -# endif -#else -# define _STLP_DEFAULT_ALLOCATOR( _Tp ) __sgi_alloc -# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc) -# define _STLP_DEFAULT_PAIR_ALLOCATOR( _Key, _Tp ) __sgi_alloc -# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc) -# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) && !defined (_STLP_DEFAULT_TYPE_PARAM) -# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1 -# endif -#endif - -/* debug mode tool */ -#if defined (_STLP_DEBUG) -# define _STLP_NON_DBG_NAME(X) _NonDbg_##X -#endif - -/* pointer specialization tool */ -#if defined (_STLP_USE_PTR_SPECIALIZATIONS) -# define _STLP_PTR_IMPL_NAME(X) _Impl_##X -#endif - -#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X -# if defined (_STLP_DEBUG) -# define _STLP_NON_DBG_NO_MEM_T_NAME(X) _NonDbg_NoMemT_##X -# endif -#endif - -/* this always mean the C library is in global namespace */ -#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD) -# define _STLP_VENDOR_GLOBAL_CSTD 1 -#endif - -/* Depending of whether compiler supports namespaces, - * tune the parameters for vendor-supplied libraries. - * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES, - * since it depends only on the native features, not on user's preference whether - * to use namespace for STLport or not. - */ -#if !defined (_STLP_HAS_NO_NAMESPACES) -/* Import some vendor's headers into corresponding STLport ones if they might be needed - * (if we wrap native iostreams and use namepace other than std::) */ -# if defined (_STLP_WHOLE_NATIVE_STD) -# define _STLP_IMPORT_VENDOR_STD 1 -# undef _STLP_MINIMUM_IMPORT_STD -# endif - -/* if using stlport:: namespace or if C library stuff is not in vendor's std::, - * try importing 'em. - * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */ -# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD)) -# define _STLP_IMPORT_VENDOR_CSTD 1 -# endif - -# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS) -# define _STLP_NO_CSTD_FUNCTION_IMPORTS -# endif - -# define _STLP_USING_NAMESPACE(x) using namespace x ; - -namespace std { } -namespace __std_alias = std; - -/* assume std:: namespace for C++ std library if not being told otherwise */ -# if defined (_STLP_VENDOR_GLOBAL_STD) -# define _STLP_VENDOR_STD -# else -# define _STLP_VENDOR_STD __std_alias -# endif - -/* tune things that come from C library */ -# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS) -/* in old-style headers, C functions go to global scope. */ -# define _STLP_VENDOR_CSTD -# define _STLP_USING_VENDOR_CSTD -# else -# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD -# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD) -# endif /* _STLP_VENDOR_CSTD */ -/* exception, typeinfo, new - always come from the vendor */ -# if !defined (_STLP_VENDOR_EXCEPT_STD) -# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD) -# define _STLP_VENDOR_EXCEPT_STD -# else -# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD -# endif -# endif -# define _STLP_OLD_IO_NAMESPACE -# if !defined (_STLP_VENDOR_MB_NAMESPACE) -# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD -# endif -#else -/* compiler has no namespace support */ -# define _STLP_VENDOR_STD -# define _STLP_VENDOR_CSTD -# define _STLP_USING_NAMESPACE(x) -# define _STLP_USING_VENDOR_CSTD -# define _STLP_VENDOR_EXCEPT_STD -#endif - -#if defined (_STLP_USE_NAMESPACES) - -# if defined (_STLP_USE_OWN_NAMESPACE) -# if !defined (_STLP_STD_NAME) -# if !defined (_STLP_DEBUG) -# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# ifndef _STLP_THREADS -# define _STLP_STD_NAME stlpmtx_std -# else -# define _STLP_STD_NAME stlp_std -# endif -# else -# ifndef _STLP_THREADS -# define _STLP_STD_NAME stlpxmtx_std -# else -# define _STLP_STD_NAME stlpx_std -# endif -# endif -# else -/* - * The STLport debug mode is binary incompatible with the other modes, - * lets make it clear on the STLport namespace to generate link errors rather - * than runtime. - */ -# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) -# ifndef _STLP_THREADS -# define _STLP_STD_NAME stlpdmtx_std -# else -# define _STLP_STD_NAME stlpd_std -# endif -# else -# ifndef _STLP_THREADS -# define _STLP_STD_NAME stlpdxmtx_std -# else -# define _STLP_STD_NAME stlpdx_std -# endif -# endif -# endif -# endif -namespace _STLP_STD_NAME { } -# else -# if defined (_STLP_DEBUG) -namespace stdD = std; -# endif -# define _STLP_STD_NAME std -# endif /* _STLP_USE_OWN_NAMESPACE */ - -# if !defined (_STLP_USING_NAMESPACE_BUG) -# define _STLP_PRIV_NAME stlp_priv -namespace _STLP_PRIV_NAME { - using namespace _STLP_STD_NAME; -} -# else -# define _STLP_PRIV_NAME priv -# endif - -# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME { -# define _STLP_END_NAMESPACE } - -# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE) -# if !defined (_STLP_USING_NAMESPACE_BUG) -/* We prefer to make private namespace a totaly seperated namespace... - */ -# define _STLP_PRIV ::_STLP_PRIV_NAME:: -# define _STLP_MOVE_TO_PRIV_NAMESPACE } namespace _STLP_PRIV_NAME { -# define _STLP_MOVE_TO_STD_NAMESPACE } namespace _STLP_STD_NAME { -# else -/* but sometimes we can't: - */ -# define _STLP_PRIV _STLP_PRIV_NAME:: -# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME { -# define _STLP_MOVE_TO_STD_NAMESPACE } -# endif -# else -# define _STLP_PRIV -# define _STLP_MOVE_TO_PRIV_NAMESPACE -# define _STLP_MOVE_TO_STD_NAMESPACE -# endif - -/* decide whether or not we use separate namespace for rel ops */ -# if defined (_STLP_NO_RELOPS_NAMESPACE) -# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {} -# define _STLP_END_RELOPS_NAMESPACE } -# else -/* Use std::rel_ops namespace */ -# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops { -# define _STLP_END_RELOPS_NAMESPACE } } -# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE -# endif /* Use std::rel_ops namespace */ - -# define _STLP_STD ::_STLP_STD_NAME - -/* Official STLport namespace when std is not redefined. - * Here we don't use a macro as stlport is used as file name by boost - * and folder name under beos: - */ -namespace stlport = _STLP_STD_NAME; - -/* Backward compatibility: - */ -namespace _STL = _STLP_STD_NAME; -#undef __STLPORT_NAMESPACE -#define __STLPORT_NAMESPACE _STLP_STD_NAME - -#else /* _STLP_USE_NAMESPACES */ -/* STLport is being put into global namespace */ -# define _STLP_STD -# define _STLP_PRIV -# define _STLP_BEGIN_NAMESPACE -# define _STLP_END_NAMESPACE -# define _STLP_MOVE_TO_PRIV_NAMESPACE -# define _STLP_MOVE_TO_STD_NAMESPACE - -/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE - causes less problems than having relational operator templates in global namespace - Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */ -# if !defined (_STLP_NO_RELOPS_NAMESPACE) -# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE -# endif -# define _STLP_BEGIN_RELOPS_NAMESPACE -# define _STLP_END_RELOPS_NAMESPACE -# undef _STLP_USE_OWN_NAMESPACE -#endif /* _STLP_USE_NAMESPACES */ - -#define STLPORT_CSTD _STLP_VENDOR_CSTD -#define STLPORT _STLP_STD_NAME - -#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG) -# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy -#else -# define _STLP_SIMPLE_TYPE(T) T -#endif - -#ifndef _STLP_RAND48 -# define _STLP_NO_DRAND48 -#endif - -/* advanced keywords usage */ -#define __C_CAST(__x, __y) ((__x)(__y)) -#ifndef _STLP_NO_NEW_STYLE_CASTS -# define __CONST_CAST(__x,__y) const_cast<__x>(__y) -# define __STATIC_CAST(__x,__y) static_cast<__x>(__y) -# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y) -# define __DYNAMIC_CAST(__x,__y) dynamic_cast<__x>(__y) -#else -# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y) -# define __CONST_CAST(__x,__y) __C_CAST(__x, __y) -# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y) -# define __DYNAMIC_CAST(__x,__y) __C_CAST(__x, __y) -#endif - -#if defined (_STLP_NEED_TYPENAME) && ! defined (typename) -# define typename -#endif - -#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE ) -# define _STLP_TYPENAME_ON_RETURN_TYPE -#else -# define _STLP_TYPENAME_ON_RETURN_TYPE typename -#endif - -#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER -# define _STLP_HEADER_TYPENAME -#else -# define _STLP_HEADER_TYPENAME typename -#endif - -#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD -# define _STLP_TEMPLATE template -#else -# define _STLP_TEMPLATE -#endif - -#if defined (_STLP_USE_CONTAINERS_EXTENSION) -# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) -# define _STLP_TEMPLATE_FOR_CONT_EXT template -#else -# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT; -# define _STLP_TEMPLATE_FOR_CONT_EXT -#endif - -#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit) -# define explicit -#endif - -#if !defined (_STLP_NEED_MUTABLE) -# define _STLP_ASSIGN_MUTABLE(type,x,y) x = y -#else -# define _STLP_ASSIGN_MUTABLE(type,x,y) __CONST_CAST(type,x)=y -# define mutable -#endif - -#if defined (_STLP_NO_SIGNED_BUILTINS) -/* old HP-UX doesn't understand "signed" keyword */ -# define signed -#endif - -#if defined (_STLP_LOOP_INLINE_PROBLEMS) -# define _STLP_INLINE_LOOP -#else -# define _STLP_INLINE_LOOP inline -#endif - -#define _STLP_PRIVATE public - -#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX -# define _STLP_TEMPLATE_NULL template<> -#else -# define _STLP_TEMPLATE_NULL -#endif - -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -# define _STLP_OPERATOR_TEMPLATE -#else -# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL -#endif - -#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION -/* unless we have other compiler problem, try simulating partial spec here */ -# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) -# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS -# endif -/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */ -# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) -# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES ) -# define _STLP_USE_OLD_HP_ITERATOR_QUERIES -# endif -# elif defined ( _STLP_NO_ANACHRONISMS ) -# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES -# endif -#endif - -#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS -# define _STLP_NULL_TMPL_ARGS <> -# else -# define _STLP_NULL_TMPL_ARGS -#endif - -#if !defined (_STLP_ALLOCATOR_TYPE_DFL) -# if defined (_STLP_DONT_SUP_DFLT_PARAM) -# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS -# endif -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) -# define _STLP_ALLOCATOR_TYPE_DFL -# else -# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type() -# endif -#endif - -/* When the compiler do not correctly initialized the basic types value in default parameters we prefer - * to avoid them to be able to correct this bug. - */ -#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG) -# define _STLP_DONT_SUP_DFLT_PARAM 1 -#endif - -#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR) -# define _STLP_NO_ARROW_OPERATOR -#endif - -#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \ - !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY) -/* this one is needed for proper reverse_iterator<> operator ->() handling */ -# define _STLP_MSVC50_COMPATIBILITY 1 -# endif -#endif - -#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) -# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) ) -# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ - typedef typename _STLP_STD :: reverse_iterator const_reverse_iterator; \ - typedef typename _STLP_STD :: reverse_iterator reverse_iterator -# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__) -# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ - typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator const_reverse_iterator; \ - typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator reverse_iterator -# else -# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ - typedef _STLP_STD::reverse_iterator const_reverse_iterator; \ - typedef _STLP_STD::reverse_iterator reverse_iterator -# endif -#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ -# if defined (_STLP_MSVC50_COMPATIBILITY) -# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ - typedef _STLP_STD::__reverse_iterator const_reverse_iterator; \ - typedef _STLP_STD::__reverse_iterator \ - reverse_iterator -# else -# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ - typedef _STLP_STD::__reverse_iterator const_reverse_iterator; \ - typedef _STLP_STD::__reverse_iterator \ - reverse_iterator -# endif -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \ - _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator) -#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \ - _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator) - -#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \ - typedef typename _Super::value_type value_type; \ - typedef typename _Super::size_type size_type; \ - typedef typename _Super::difference_type difference_type; \ - typedef typename _Super::reference reference; \ - typedef typename _Super::const_reference const_reference; \ - typedef typename _Super::pointer pointer; \ - typedef typename _Super::const_pointer const_pointer; \ - typedef typename _Super::allocator_type allocator_type; - - -#define __IMPORT_ITERATORS(_Super) \ - typedef typename _Super::iterator iterator; \ - typedef typename _Super::const_iterator const_iterator; - -#define __IMPORT_REVERSE_ITERATORS(_Super) \ - typedef typename _Super::const_reverse_iterator const_reverse_iterator; \ - typedef typename _Super::reverse_iterator reverse_iterator; - -#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \ - __derived_name(const _Super& __x) : _SUPER(__x) {} \ - _Self& operator=(const _Super& __x) { \ - *(_Super*)this = __x; \ - return *this; \ - } \ - __derived_name(const _Self& __x) : _SUPER(__x) {} \ - _Self& operator=(const _Self& __x) { \ - *(_Super*)this = __x; \ - return *this; \ - } - -#define __IMPORT_WITH_ITERATORS(_Super) \ - __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super) - -#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \ - __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super) - -#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG) -# define __TRIVIAL_CONSTRUCTOR(__type) __type() {} -#else -# define __TRIVIAL_CONSTRUCTOR(__type) -#endif - -#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG) -# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {} -#else -# define __TRIVIAL_DESTRUCTOR(__type) -#endif - -#define __TRIVIAL_STUFF(__type) \ - __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type) - -#if defined (_STLP_HAS_NO_EXCEPTIONS) -# define _STLP_NO_EXCEPTIONS -#endif - -#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS) -# define _STLP_USE_EXCEPTIONS -#endif - -#if defined (_STLP_USE_EXCEPTIONS) -# define _STLP_TRY try -# define _STLP_CATCH_ALL catch(...) -# ifndef _STLP_THROW -# define _STLP_THROW(x) throw x -# endif -# define _STLP_RETHROW throw - -# define _STLP_UNWIND(action) catch(...) { action; throw; } - -# ifdef _STLP_THROW_RETURN_BUG -# define _STLP_RET_AFTER_THROW(data) return data; -# else -# define _STLP_RET_AFTER_THROW(data) -# endif - -/* We do not use exception throw specifications unless we are forced to */ -# if !defined (_STLP_THROWS) -# define _STLP_THROWS(x) -# endif -# if !defined (_STLP_NOTHROW) -# define _STLP_NOTHROW -# endif -#else -# define _STLP_TRY -# define _STLP_CATCH_ALL if (false) -# ifndef _STLP_THROW -# define _STLP_THROW(x) -# endif -# define _STLP_RETHROW {} -# define _STLP_UNWIND(action) -# define _STLP_THROWS(x) -# define _STLP_NOTHROW -# define _STLP_RET_AFTER_THROW(data) -#endif - -/* - * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no - * exception support but not the _STLP_USE_EXCEPTIONS which simply means - * that the user do not want to use them. - */ -#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC) -# define _STLP_THROWS_INHERENTLY(x) throw x -# define _STLP_NOTHROW_INHERENTLY throw() -#else -# define _STLP_THROWS_INHERENTLY(x) -# define _STLP_NOTHROW_INHERENTLY -#endif - -/* STLport function not returning are functions that throw so we translate - * the noreturn functions in throwing functions taking also into account - * exception support activation. - */ -#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \ - !defined (_STLP_FUNCTION_THROWS) -# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION -#else -# define _STLP_FUNCTION_THROWS -#endif - -#if defined(_STLP_NO_BOOL) -# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX) -# include -# if defined (__OS400__) -typedef int bool; -# elif !( defined (__xlC__) || defined (_AIX)) -typedef Boolean bool; -# endif -# else -# if defined(_STLP_YVALS_H) -# include -# else -# if defined (_STLP_DONT_USE_BOOL_TYPEDEF) -# define bool int -# else -typedef int bool; -# endif -# define true 1 -# define false 0 -# endif -# endif /* __IBMCPP__ */ -#else -# define _STLP_BOOL_KEYWORD 1 -#endif /* _STLP_NO_BOOL */ - -#ifndef _STLP_MPW_EXTRA_CONST -# define _STLP_MPW_EXTRA_CONST -#endif - -#ifndef _STLP_DEFAULTCHAR -# define _STLP_DEFAULTCHAR char -#endif - -#if defined (_STLP_DEBUG_ALLOC) && !defined (_STLP_ASSERTIONS) -# define _STLP_ASSERTIONS 1 -#endif - -/* uninitialized value filler */ -#ifndef _STLP_SHRED_BYTE -/* This value is designed to cause problems if an error occurs */ -# define _STLP_SHRED_BYTE 0xA3 -#endif /* _STLP_SHRED_BYTE */ - -/* shared library tune-up */ -#ifndef _STLP_IMPORT_DECLSPEC -# define _STLP_IMPORT_DECLSPEC -#endif - -/* a keyword used to instantiate export template */ -#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD -# define _STLP_EXPORT_TEMPLATE_KEYWORD -#endif -#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD -# define _STLP_IMPORT_TEMPLATE_KEYWORD -#endif - -#ifdef _STLP_USE_NO_IOSTREAMS -/* - * If we do not use iostreams we do not use the export/import - * techniques to avoid build of the STLport library. - */ -# undef _STLP_USE_DECLSPEC -/* We also undef USE_DYNAMIC_LIB macro as this macro add some code - * to use the dynamic (shared) STLport library for some platform/compiler - * configuration leading to problem when do not link to the STLport lib. - */ -# undef _STLP_USE_DYNAMIC_LIB -#endif - -#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC) -# if ! defined (_STLP_USE_TEMPLATE_EXPORT) -/* this setting turns on "extern template" extension use */ -# define _STLP_USE_TEMPLATE_EXPORT -# endif -# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE) -# define _STLP_NO_FORCE_INSTANTIATE -# endif -#endif - -#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ -# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD -#else -# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD -#endif - -#ifndef _STLP_EXPORT_TEMPLATE -# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template -#endif - -#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */ - -# ifndef _STLP_EXPORT_DECLSPEC -# define _STLP_EXPORT_DECLSPEC -# endif -# ifndef _STLP_IMPORT_DECLSPEC -# define _STLP_IMPORT_DECLSPEC -# endif -# ifndef _STLP_CLASS_EXPORT_DECLSPEC -# define _STLP_CLASS_EXPORT_DECLSPEC -# endif -# ifndef _STLP_CLASS_IMPORT_DECLSPEC -# define _STLP_CLASS_IMPORT_DECLSPEC -# endif -# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ -# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC -# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC -# else -# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */ -# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC -# endif - -#else /* Not using DLL export/import specifications */ - -# define _STLP_DECLSPEC -# define _STLP_CLASS_DECLSPEC - -#endif - -#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC - -#if defined (_STLP_MSVC) || defined (__ICL) -# define _STLP_STATIC_MEMBER_DECLSPEC -#else -# define _STLP_STATIC_MEMBER_DECLSPEC _STLP_DECLSPEC -#endif - -#if !defined (_STLP_CALL) -# define _STLP_CALL -#endif - -#ifndef _STLP_USE_NO_IOSTREAMS - -# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM) -# define __USE_STD_IOSTREAM -# endif - -/* We only need to expose details of streams implementation - if we use non-standard i/o or are building STLport*/ -# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO) -# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1 -# endif - -/* We only need to expose details of global implementation if we are building STLport - or have not instantiated everything in the lib */ -# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) -# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION -# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1 -# endif - -#else /* _STLP_USE_NO_IOSTREAMS */ -/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */ -# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION -#endif /* _STLP_USE_NO_IOSTREAMS */ - -#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS -# define _STLP_PSPEC2(t1,t2) < t1,t2 > -# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 > -#else -# define _STLP_PSPEC2(t1,t2) /* nothing */ -# define _STLP_PSPEC3(t1,t2,t3) /* nothing */ -#endif - -/* Activation of the partial template workaround: - */ -#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\ - (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER)) -# define _STLP_USE_PARTIAL_SPEC_WORKAROUND -#endif - -#ifndef _STLP_USE_NO_IOSTREAMS -# define _STLP_NEW_IO_NAMESPACE _STLP_STD -# define _STLP_NO_WIDE_STREAMS _STLP_NO_WCHAR_T -#endif - -#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE -# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \ -_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\ -_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\ -_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\ -_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);} -#else -# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) -#endif - -#if defined ( _STLP_USE_ABBREVS ) -# include -#endif - -/* A really useful macro */ -#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0]) -#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0]) - -/* some cleanup */ -#undef _STLP_DONT_USE_BOOL_TYPEDEF -#undef _STLP_YVALS_H -#undef _STLP_LOOP_INLINE_PROBLEMS -#undef _STLP_NEED_EXPLICIT -#undef _STLP_NEED_TYPENAME -#undef _STLP_NO_NEW_STYLE_CASTS -#undef __AUTO_CONFIGURED - -#endif /* _STLP_FEATURES_H */ diff --git a/SDK/stlport/stl/config/host.h b/SDK/stlport/stl/config/host.h deleted file mode 100644 index 95b71a3e..00000000 --- a/SDK/stlport/stl/config/host.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * This file defines site configuration. - */ - -/* - * _STLP_NO_THREADS: if defined, STLport don't use any - * multithreading support. Synonym is _NOTHREADS - */ -/* -#define _NOTHREADS -#define _STLP_NO_THREADS -*/ - -/* _PTHREADS: if defined, use POSIX threads for multithreading support. */ -/* -#define _PTHREADS -*/ - -/* compatibility section - */ - -#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS)) -# if !defined (_NOTHREADS) -# define _NOTHREADS -# endif -# if !defined (_STLP_NO_THREADS) -# define _STLP_NO_THREADS -# endif -#endif - -#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB) -/* - * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library. - * NOTE: please do that only if you know what you are doing! - * Changing default will require you to change makefiles in "build" accordingly - * and to rebuild STLPort library! - * On UNIX, this has no effect, see build/lib/README for make tags. - * See STLport configuration file (build/lib/configure.bat) for help in building - * the require library versions. - */ -/* -#define _STLP_USE_DYNAMIC_LIB -*/ - -/* - * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library. - * NOTE: please do that only if you know what you are doing! - * Changing default will require you to change makefile in "build" accordingly - * and to rebuild STLPort library! - * On UNIX, this has no effect, see build/lib/README for make tags. - * See STLport configuration file (build/lib/configure.bat) for help in building - * the require library versions. - */ -/* -#define _STLP_USE_STATIC_LIB -*/ -#endif - -/* - * Signal STLport that we are using the cygwin distrib with the -mno-cygwin option. - * This is similar to a mingw environment except that relative path to native headers - * is different, this is why we need this macro. - */ -/* -#define _STLP_NO_CYGWIN - */ - -/* - * Edit relative path below (or put full path) to get native - * compiler vendor's headers included. Default is "../include" - * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is - * _STLP_NATIVE_INCLUDE_PATH. - * Hint: never install STLport in the directory that ends with "include" - */ -/* -#undef _STLP_NATIVE_INCLUDE_PATH -#define _STLP_NATIVE_INCLUDE_PATH ../include -*/ -/* same for C library headers like */ -/* -#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH -#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -*/ -/* same for C headers like */ -/* -#undef _STLP_NATIVE_C_INCLUDE_PATH -#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -*/ -/* Some compilers locate basic C++ runtime support headers (, , ) in separate directory */ -/* -#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH -#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH -*/ - -/* - * If namespases available, STLport use own namespace (and masquerade - * it as std). Disable own namespace may cause undefined behaviour. - */ -/* -#define _STLP_NO_OWN_NAMESPACE 1 -*/ - -/* - * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated - * memory chunks. Normally not required. But if you worry about quazi-leaks - * (may be reported by some leaks detection tools), use - * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or - * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean - * its internal memory pool but only if STLport is used as a dynamic library - * under Win32 (using MSVC like compilers). - */ -/* -#define _STLP_LEAKS_PEDANTIC 1 -*/ - -/* - * Uncomment _STLP_USE_NEWALLOC to force allocator to use plain "new" - * instead of STLport optimized node allocator engine. - */ -/* -#define _STLP_USE_NEWALLOC 1 -*/ - -/* - * Uncomment _STLP_USE_MALLOC to force allocator to use plain "malloc" - * instead of STLport optimized node allocator engine. - */ -/* -#define _STLP_USE_MALLOC 1 -*/ - -/* - * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator to use - * a specific implementation targetting the massively multi-threaded - * environment. The implementation is based on the POSIX pthread - * interface. - */ -/* -#define _STLP_USE_PERTHREAD_ALLOC 1 -*/ - -/* - * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging, - * such as padding/checking for memory consistency - */ -/* -#define _STLP_DEBUG_ALLOC 1 -*/ - -/* - * For compiler not supporting partial template specialization or ordering of - * template functions STLport implement a workaround based on inheritance - * detection. This inheritance can introduce trouble in client code when - * a user class derived a STL container (which is not advised as STL containers - * do not have virtual destructors). To disable this workaround turn this macro on: - */ -/* -#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1 -*/ - -/* - * Uncomment this to force all debug diagnostic to be directed through a - * user-defined global function: - * void __stl_debug_message(const char * format_str, ...) - * instead of predefined STLport routine. - * This allows you to take control of debug message output. - * Default routine calls fprintf(stderr,...) - * Note : If you set this macro, you must supply __stl_debug_message - * function definition somewhere. - */ -/* -#define _STLP_DEBUG_MESSAGE 1 -*/ - -/* - * Uncomment this to force all failed assertions to be executed through - * user-defined global function: - * void __stl_debug_terminate(void). This allows - * you to take control of assertion behaviour for debugging purposes. - * Default routine calls _STLP_ABORT(). - * Note : If you set this macro, you must supply __stl_debug_terminate - * function definition somewhere. - */ -/* -#define _STLP_DEBUG_TERMINATE 1 -*/ - -/* - * Uncomment that to disable exception handling code - */ -/* -#define _STLP_DONT_USE_EXCEPTIONS 1 -*/ - -/* - * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace - * stlport:: or std::, even if the compiler supports namespaces - */ -/* -#define _STLP_NO_NAMESPACES 1 -*/ - -/*========================================================== - * Compatibility section - *==========================================================*/ - -/* - * Use abbreviated class names for linker benefit (don't affect interface). - * This option is obsolete, but should work in this release. - * - */ -/* -#define _STLP_USE_ABBREVS -*/ - -/* - * This definition precludes STLport reverse_iterator to be compatible with - * other parts of MSVC library. (With partial specialization, it just - * has no effect). - * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly - */ -/* -#define _STLP_NO_MSVC50_COMPATIBILITY 1 -*/ - -/* - * _STLP_USE_RAW_SGI_ALLOCATORS is a hook so that users can disable use of - * allocator as default parameter for containers, and use SGI - * raw allocators as default ones, without having to edit library headers. - * Use of this macro is strongly discouraged. - */ -/* -#define _STLP_USE_RAW_SGI_ALLOCATORS 1 -*/ - -/* - * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type() - * for querying iterator properties. Please note those names are non-standard and are not guaranteed - * to be used by every implementation. However, this setting is on by default when partial specialization - * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set). - * Use of those interfaces for user-defined iterators is strongly discouraged: - * please use public inheritance from iterator<> template to achieve desired effect. - * Second form is to disable old-style queries in any case. - */ -/* -#define _STLP_USE_OLD_HP_ITERATOR_QUERIES -#define _STLP_NO_OLD_HP_ITERATOR_QUERIES -*/ - - -/* - * On systems with support of large files (_LARGEFILE_SOURCE, - * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if - * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS - * less than 64. In the last case sizeof(std::streamoff) may not be equal to - * sizeof(off_t), if you want to force equal size of off_t and streamoff, - * uncomment macro below. But pay attention, this has influence on libstlport - * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro. - */ - -/* -#define _STLP_USE_DEFAULT_FILE_OFFSET -*/ - -/*==========================================================================*/ - -/* This section contains swithes which should be off by default, - * but so few compilers would have it undefined, so that we set them here, - * with the option to be turned off later in compiler-specific file - */ - -#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT -#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT - -/* - Local Variables: - mode:C++ - End: -*/ diff --git a/SDK/stlport/stl/config/stl_confix.h b/SDK/stlport/stl/config/stl_confix.h deleted file mode 100644 index a1be1f2f..00000000 --- a/SDK/stlport/stl/config/stl_confix.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* - * STLport configuration file - * It is internal STLport header - DO NOT include it directly - * Purpose of this file : to define STLport settings that depend on - * compiler flags or can be otherwise missed - * - */ - -#ifndef _STLP_CONFIX_H -# define _STLP_CONFIX_H - -/* If, by any chance, C compiler gets there, try to help it to pass smoothly */ -# if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES) -# define _STLP_HAS_NO_NAMESPACES -# endif - -# if defined(__MINGW32__) -# define _STLP_NO_DRAND48 -# endif - -/* Modena C++ library */ -#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400) -# include -# define _STLP_USE_MSIPL 1 -# if defined (__KCC) || (defined(__MSL_CPP__) && \ - ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \ - (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES ))) \ - ) -# define _STLP_NO_NATIVE_MESSAGE_FACET 1 -# endif -#endif - -/* common switches for EDG front-end */ -# if defined (__EDG_SWITCHES) -# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD)) -# undef _STLP_NEED_TYPENAME -# define _STLP_NEED_TYPENAME 1 -# endif -# if !defined(_WCHAR_T_IS_KEYWORD) -# undef _STLP_NO_WCHAR_T -# define _STLP_NO_WCHAR_T 1 -# endif -# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES -# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION -# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 -# endif -# ifndef _MEMBER_TEMPLATES -# undef _STLP_NO_MEMBER_TEMPLATES -# define _STLP_NO_MEMBER_TEMPLATES 1 -# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES -# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 -# endif -# if !defined(_MEMBER_TEMPLATE_KEYWORD) -# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD -# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 -# endif -# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS) -# undef _STLP_HAS_NO_EXCEPTIONS -# define _STLP_HAS_NO_EXCEPTIONS -# endif -# undef __EDG_SWITCHES -# endif /* EDG */ -#endif diff --git a/SDK/stlport/stl/config/stl_mycomp.h b/SDK/stlport/stl/config/stl_mycomp.h deleted file mode 100644 index 710d5fa8..00000000 --- a/SDK/stlport/stl/config/stl_mycomp.h +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* - * Purpose of this file : - * - * A list of COMPILER-SPECIFIC portion of STLport settings. - * This file is provided to help in manual configuration - * of STLport. This file is being included by stlcomp.h - * when STLport is unable to identify your compiler. - * Please remove the error diagnostic below before adjusting - * macros. - * - */ -#ifndef _STLP_MYCOMP_H -#define _STLP_MYCOMP_H - -#error "Your compiler version is not recognized by STLport. Please edit " - -//========================================================== - -// the values choosen here as defaults try to give -// maximum functionality on the most conservative settings - -// Mostly correct guess, change it for Alpha (and other environments -// that has 64-bit "long") -// # define _STLP_UINT32_T unsigned long - -// Disables wchar_t functionality -// # define _STLP_NO_WCHAR_T 1 - -// Define if wchar_t is not a unique type, and is actually a typedef to unsigned short. -// # define _STLP_WCHAR_T_IS_USHORT 1 - -// Uncomment if long long is available -// # define _STLP_LONG_LONG long long - -// Uncomment if long double is not available -// # define _STLP_NO_LONG_DOUBLE 1 - -// Uncomment this if your compiler does not support "typename" keyword -// # define _STLP_NEED_TYPENAME 1 - -// Uncomment this if your compiler does not support "mutable" keyword -// # define _STLP_NEED_MUTABLE 1 - -// Uncomment this if your compiler does not support "explicit" keyword -// # define _STLP_NEED_EXPLICIT 1 - -// Uncomment if new-style-casts like const_cast<> are not available -// # define _STLP_NO_NEW_STYLE_CASTS 1 - -// Uncomment this if your compiler does not have "bool" type -// # define _STLP_NO_BOOL 1 - -// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved -// # define _STLP_DONT_USE_BOOL_TYPEDEF 1 - -// Uncomment this if your compiler does not have "bool" type, but defines "bool" in -// # define _STLP_YVALS_H 1 - -// Uncomment this if your compiler has limited or no default template arguments for classes -// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1 - -// Uncomment this if your compiler support only complete (not dependent on other parameters) -// types as default parameters for class templates -// # define _STLP_DEFAULT_TYPE_PARAM 1 - -// Uncomment this if your compiler do not support default parameters in template class methods -// # define _STLP_DONT_SUP_DFLT_PARAM 1 - -// Uncomment this if your compiler has problem with not-type -// default template parameters -// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 - -// Define if compiler has -// trouble with functions getting non-type-parameterized classes as parameters -// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 - -// Uncomment this if your compiler lacks static data members. -// Uncomment next line if your compiler supports __attribute__((weak)) -// # define _STLP_NO_STATIC_TEMPLATE_DATA 1 -// # define _STLP_WEAK_ATTRIBUTE 1 - -// Uncomment this if your compiler does not support namespaces -// # define _STLP_HAS_NO_NAMESPACES 1 - -// Uncomment if "using" keyword does not work with template types -// # define _STLP_BROKEN_USING_DIRECTIVE 1 - -// Uncomment this if your compiler does not support exceptions -// # define _STLP_HAS_NO_EXCEPTIONS 1 - -// Uncomment this when you are able to detect that the user do not -// want to use the exceptions feature. -// # define _STLP_DONT_USE_EXCEPTIONS 1 - -// Uncomment this if your compiler does not support exception specifications -// # define _STLP_NO_EXCEPTION_SPEC - -// Define this if your compiler requires return statement after throw() -// # define _STLP_THROW_RETURN_BUG 1 - -// Define this if your compiler do not support return of void -// # define _STLP_DONT_RETURN_VOID 1 - -// Header that comes with the compiler -// does not define bad_alloc exception -// # define _STLP_NO_BAD_ALLOC 1 - -// Define this if your compiler do not throw bad_alloc from the new operator -// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 - -// Uncomment if member template methods are not available -// # define _STLP_NO_MEMBER_TEMPLATES 1 - -// Uncomment if member template classes are not available -// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 - -// Uncomment if your compiler do not support the std::allocator rebind technique -// This is a special case of bad member template classes support, it is automatically -// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined. -// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 - -// Uncomment if no "template" keyword should be used with member template classes -// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 - -// Uncomment if friend member templates are not available -// # define _STLP_NO_FRIEND_TEMPLATES 1 - -// Compiler does not accept friend declaration qualified with namespace name. -// # define _STLP_NO_QUALIFIED_FRIENDS 1 - -// Uncomment if partial specialization is not available -// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 - -// Define if class being partially specialized require full name (template parameters) -// of itself for method declarations -// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS - -// Compiler has problem with qualified specializations (cont int, volatile int...) -// # define _STLP_QUALIFIED_SPECIALIZATION_BUG - -// Compiler has problems specializing members of partially -// specialized class -// # define _STLP_MEMBER_SPECIALIZATION_BUG - -// Uncomment if partial order of template functions is not available -// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 - -// Uncomment if specialization of methods is not allowed -// # define _STLP_NO_METHOD_SPECIALIZATION 1 - -// Uncomment if full specialization does not use partial spec. syntax : template <> struct .... -// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 - -// Uncomment if compiler does not support explicit template arguments for functions -// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS - -// Uncomment this if your compiler can't inline while(), for() -// # define _STLP_LOOP_INLINE_PROBLEMS 1 - -// Define if the compiler fails to match a template function argument of base -// # define _STLP_BASE_MATCH_BUG 1 - -// Define if the compiler fails to match a template function argument of base -// (non-template) -//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 - -// Define if the compiler rejects outline method definition -// explicitly taking nested types/typedefs -// # define _STLP_NESTED_TYPE_PARAM_BUG 1 - -// Compiler requires typename keyword on outline method definition -// explicitly taking nested types/typedefs -// #define _STLP_TYPENAME_ON_RETURN_TYPE - -// Define if the baseclass typedefs not visible from outside -// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 - -// if your compiler have serious problems with typedefs, try this one -// # define _STLP_BASE_TYPEDEF_BUG 1 - -// Uncomment if getting errors compiling mem_fun* adaptors -// # define _STLP_MEMBER_POINTER_PARAM_BUG 1 - -// * _STLP_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a -// constant-initializer in the declaration of a static const data member -// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.) -// # define _STLP_STATIC_CONST_INIT_BUG - -// Define if default constructor for builtin integer type fails to initialize it to 0 -// In expression like new(&char) char(): -//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 -// In default function parameter like _M_method(_Tp __x = _Tp()) -//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 - -// Defined if constructor -// required to explicitly call member's default constructors for const objects -// # define _STLP_CONST_CONSTRUCTOR_BUG 1 - -// Defined if the compiler has trouble calling POD-types constructors/destructors -// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1 -// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1 - -// Define if having problems specializing maps/sets with -// key type being const -// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG - -// Uncomment this to disable -> operators on all iterators -// # define _STLP_NO_ARROW_OPERATOR 1 - -// Uncomment this to disble at() member functions for containers -// # define _STLP_NO_AT_MEMBER_FUNCTION 1 - -// Define this if compiler lacks header -// # define _STLP_NO_EXCEPTION_HEADER 1 - -// Uncomment this if your C library has lrand48() function -// # define _STLP_RAND48 1 - -// Uncomment if native new-style C library headers lile , etc are not available. -// # define _STLP_HAS_NO_NEW_C_HEADERS 1 - -// uncomment if new-style headers is available -// # define _STLP_HAS_NEW_NEW_HEADER 1 - -// uncomment this if and other STD headers put their stuff in ::namespace, -// not std:: -// # define _STLP_VENDOR_GLOBAL_STD - -// uncomment this if and the like put stuff in ::namespace, -// not std:: -// # define _STLP_VENDOR_GLOBAL_CSTD - -// uncomment this if your compiler consider as ambiguous a function imported within -// the stlport namespace and called without scope (:: or std::) -// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 - -// uncomment this if your compiler define all the C math functions C++ additional -// overloads in ::namespace and not only in std::. -// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1 - -// uncomment this if your compiler has problem with the import of a namespace in -// an other one with the using namespace directive -// # define _STLP_USING_NAMESPACE_BUG 1 - -// Edit relative path below (or put full path) to get native -// compiler headers included. Default is "../include". -// C headers may reside in different directory, so separate macro is provided. -// Hint : never install STLport in the directory that ends with "include" -// # define _STLP_NATIVE_INCLUDE_PATH ../include -// # define _STLP_NATIVE_C_INCLUDE_PATH ../include -// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include - -// This macro constructs header path from directory and name. -// You may change it if your compiler does not understand "/". -// # define _STLP_MAKE_HEADER(path, header) - -// This macro constructs native include header path from include path and name. -// You may have do define it if experimenting problems with preprocessor -// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header) - -// Same for C headers -// #define _STLP_NATIVE_C_HEADER(header) - -// uncomment this if your compiler/platform do not fully support the IEC 559 floating point -// numbers specification (also known as IEEE 754 in the US). This specification define the -// infinity and NaN (Not a Number) representation. Unit tests should tell you if your compiler -// support it. -// # define _STLP_NO_IEC559_SUPPORT 1 - - -//========================================================== -#endif diff --git a/SDK/stlport/stl/config/user_config.h b/SDK/stlport/stl/config/user_config.h deleted file mode 100644 index 4f75d900..00000000 --- a/SDK/stlport/stl/config/user_config.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -/* - * Purpose of this file : - * - * To hold user-definable portion of STLport settings which may be overridden - * on per-project basis. - * Please note that if you use STLport iostreams (compiled library) then you have - * to use consistent settings when you compile STLport library and your project. - * Those settings are defined in host.h and have to be the same for a given - * STLport installation. - */ - - -/*========================================================== - * User-settable macros that control compilation: - * Features selection - *==========================================================*/ - -/* - * Use this switch for embedded systems where no iostreams are available - * at all. STLport own iostreams will also get disabled automatically then. - * You can either use STLport iostreams, or no iostreams. - * If you want iostreams, you have to compile library in ../build/lib - * and supply resulting library at link time. - */ -/* -#define _STLP_NO_IOSTREAMS 1 -*/ - -/* - * Set _STLP_DEBUG to turn the "Debug Mode" on. - * That gets you checked iterators/ranges in the manner - * of "Safe STL". Very useful for debugging. Thread-safe. - * Please do not forget to link proper STLport library flavor - * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag - * in STLport iostreams mode, namespace customization guaranty that you - * link to the right library. - */ -/* -#define _STLP_DEBUG 1 -*/ -/* - * You can also choose the debug level: - * STLport debug level: Default value - * Check only what the STLport implementation consider as invalid. - * It also change the iterator invalidation schema. - * Standard debug level: Check for all operations the standard consider as "undefined behavior" - * even if STlport implement it correctly. It also invalidates iterators - * more often. - */ -/* -#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL -#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL -*/ -/* When an inconsistency is detected by the 'safe STL' the program will abort. - * If you prefer an exception define the following macro. The thrown exception - * will be the Standard runtime_error exception. - */ -/* -#define _STLP_DEBUG_MODE_THROWS - */ - -/* - * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream - * classes with custom types (which is most likely the case). Custom means types - * other than char, wchar_t, char_traits<> and allocator<> like - * basic_ostream > or - * basic_string, my_allocator > - * When this option is on, most non-inline template functions definitions for iostreams - * are not seen by the client which saves a lot of compile time for most compilers, - * also object and executable size for some. - * Default is off, just not to break compilation for those who do use those types. - * That also guarantees that you still use optimized standard i/o when you compile - * your program without optimization. Option does not affect STLport library build; you - * may use the same binary library with and without this option, on per-project basis. - */ -/* -#define _STLP_NO_CUSTOM_IO -*/ - -/* - * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational - * operator templates (>, <=. >=, !=) in namespace std::rel_ops, even - * if the compiler supports namespaces. - * Note : if the compiler do not support namespaces, those operators are not be provided by default, - * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity. - */ -/* -#define _STLP_NO_RELOPS_NAMESPACE 1 -*/ - -/* - * If _STLP_USE_OWN_NAMESPACE is in effect, STLport by default will try - * to rename std:: for the user to stlport::. If you do not want this feature, - * please define the following switch and then use stlport:: - */ -/* -#define _STLP_DONT_REDEFINE_STD 1 -*/ - -/* - * _STLP_WHOLE_NATIVE_STD : only meaningful in _STLP_USE_OWN_NAMESPACE mode. - * Normally, STLport only imports necessary components from native std:: namespace - - * those not yet provided by STLport (, , etc.) - * and their dependencies (, ). - * You might want everything from std:: being available in std:: namespace when you - * include corresponding STLport header (like STLport provides std::map as well, etc.), - * if you are going to use both stlport:: and std:: components in your code. - * Otherwise this option is not recommended as it increases the size of your object files - * and slows down compilation. - */ -/* -#define _STLP_WHOLE_NATIVE_STD -*/ - -/* - * Use this option to catch uninitialized members in your classes. - * When it is set, construct() and destroy() fill the class storage - * with _STLP_SHRED_BYTE (see below). - * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically. - */ -/* -#define _STLP_DEBUG_UNINITIALIZED 1 -#define _STLP_DEBUG_ALLOC 1 -*/ - -/* - * Uncomment and provide a definition for the byte with which raw memory - * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined. - * Choose a value which is likely to cause a noticeable problem if dereferenced - * or otherwise abused. A good value may already be defined for your platform. - */ -/* -#define _STLP_SHRED_BYTE 0xA3 -*/ - -/* - * This option is for gcc users only and only affects systems where native linker - * does not let gcc to implement automatic instantiation of static template data members/ - * It is being put in this file as there is no way to check if we are using GNU ld automatically, - * so it becomes user's responsibility. - */ -/* -#define _STLP_GCC_USES_GNU_LD -*/ - -/*========================================================== - * Compatibility section - *==========================================================*/ - -/* - * Define this macro to disable anachronistic constructs (like the ones used in HP STL and - * not included in final standard, etc. - */ -/* -#define _STLP_NO_ANACHRONISMS 1 -*/ - -/* - * Define this macro to disable STLport extensions (for example, to make sure your code will - * compile with some other implementation ) - */ -/* -#define _STLP_NO_EXTENSIONS 1 -*/ - -/* - * You should define this macro if compiling with MFC - STLport - * then include instead of to get synchronisation primitives - */ -/* -#define _STLP_USE_MFC 1 -*/ - -/* - * boris : this setting is here as we cannot detect precense of new Platform SDK automatically - * If you are using new PSDK with VC++ 6.0 or lower, - * please define this to get correct prototypes for InterlockedXXX functions - */ -/* -#define _STLP_NEW_PLATFORM_SDK 1 -*/ - -/* - * For the same reason as the one above we are not able to detect easily use - * of the compiler coming with the Platform SDK instead of the one coming with - * a Microsoft Visual Studio release. This change native C/C++ library location - * and implementation, please define this to get correct STLport configuration. - */ -/* -#define _STLP_USING_PLATFORM_SDK_COMPILER 1 -*/ - -/* - * Some compilers support the automatic linking feature. - * Uncomment the following if you prefer to specify the STLport library - * to link with yourself. - * For the moment, this feature is only supported and implemented within STLport - * by the Microsoft compilers. - */ -/* -#define _STLP_DONT_USE_AUTO_LINK 1 -*/ - -/* - * If you customize the STLport generated library names don't forget to give - * the motif you used during configuration here if you still want the auto link - * to work. (Do not remove double quotes in the macro value) - */ -/* -#define _STLP_LIB_NAME_MOTIF "???" - */ - -/* - * When using automatic linking (see above), output a message that tells the - * user which lib is getting linked via 'pragma message(..)'. - * This setting has no effect if automatic linking is not active. - */ -/* -#define _STLP_VERBOSE_AUTO_LINK 1 -*/ - -/* - * Use minimum set of default arguments on template classes that have more - * than one - for example map<>, set<>. - * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on. - * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile - * set with those compilers, but you'll have to use __set__> - * - * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>, - * queue<>, priority_queue<>, stack<>, istream_iterator<> - */ -/* -#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1 -*/ - -/* - * The agregation of strings using the + operator is an expensive operation - * as it requires construction of temporary objects that need memory allocation - * and deallocation. The problem can be even more important if you are adding - * several strings together in a single expression. To avoid this problem STLport - * implement expression template. With this technique addition of 2 strings is not - * a string anymore but a temporary object having a reference to each of the - * original strings involved in the expression. This object carry information - * directly to the destination string to set its size correctly and only make - * a single call to the allocator. This technique also works for the addition of - * N elements where elements are basic_string, C string or a single character. - * The drawback can be longer compilation time and bigger executable size. - * STLport rebuild: Yes - */ -/* -#define _STLP_USE_TEMPLATE_EXPRESSION 1 -*/ - -/* - * By default the STLport basic_string implementation use a little static buffer - * (of 16 chars when writing this doc) to avoid systematically memory allocation - * in case of little basic_string. The drawback of such a method is bigger - * basic_string size and some performance penalty for method like swap. If you - * prefer systematical dynamic allocation turn on this macro. - * STLport rebuild: Yes - */ -/* -#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 -*/ - -/* - * To reduce the famous code bloat trouble due to the use of templates STLport grant - * a specialization of some containers for pointer types. So all instanciations - * of those containers with a pointer type will use the same implementation based on - * a container of void*. This feature has show very good result on object files size - * but after link phase and optimization you will only experiment benefit if you use - * many container with pointer types. - */ -/* -#define _STLP_USE_PTR_SPECIALIZATIONS 1 -*/ - -/* - * To achieve many different optimizations within the template implementations STLport - * uses some type traits technique. With this macro you can ask STLport to use the famous - * boost type traits rather than the internal one. The advantages are more compiler - * integration and a better support. If you only define this macro once the STLport has been - * built you just have to add the boost install path within your include path. If you want - * to use this feature at STLport built time you will have to define the - * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path. - */ -/* -#define _STLP_USE_BOOST_SUPPORT 1 -*/ - -/*==========================================================*/ - -/* - Local Variables: - mode: C++ - End: -*/ - -#if 1 -# define _STLP_NO_IOSTREAMS 1 -# define _STLP_NO_CUSTOM_IO -# define _STLP_NO_ANACHRONISMS 1 -//# define _STLP_NO_EXTENSIONS 1 -//# define _STLP_VERBOSE_AUTO_LINK 1 -# define _STLP_USE_TEMPLATE_EXPRESSION 1 -# define _STLP_USE_PTR_SPECIALIZATIONS 1 -//# define _STLP_USE_BOOST_SUPPORT 1 -# ifdef NDEBUG -# define _STLP_NO_EXCEPTION_HEADER -# endif // ifdef NDEBUG -#endif // #if 0 - -#if defined (_XBOX) -# define _STLP_BIG_ENDIAN 1 -#endif // #if defined (_XBOX) \ No newline at end of file diff --git a/SDK/stlport/stl/debug/_debug.c b/SDK/stlport/stl/debug/_debug.c deleted file mode 100644 index f932a625..00000000 --- a/SDK/stlport/stl/debug/_debug.c +++ /dev/null @@ -1,639 +0,0 @@ -/* - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_DEBUG_C -#define _STLP_DEBUG_C - -#if defined (_STLP_DEBUG) -#if defined (_STLP_THREADS) -# if !defined (_STLP_NEED_MUTABLE) -# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock(); -# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock(); -# else -# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock(); -# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock(); -# endif /* _STLP_NEED_MUTABLE */ -#else -# define _STLP_ACQUIRE_LOCK(_Lock) -# define _STLP_RELEASE_LOCK(_Lock) -#endif /* _STLP_THREADS */ - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -//========================================================== -// global non-inline functions -//========================================================== -// [ i1, i2) -#if !defined (__DMC__) -template -inline bool _STLP_CALL -__in_range_aux(const _Iterator& __it, const _Iterator& __first, - const _Iterator& __last, const random_access_iterator_tag &) { - return ( __it >= __first && - __it < __last); -} -#endif - -template -#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1100) -inline bool _STLP_CALL __in_range_aux(_Iterator1 __it, const _Iterator& __first, -#else -inline bool _STLP_CALL __in_range_aux(const _Iterator1& __it, const _Iterator& __first, -#endif - const _Iterator& __last, const forward_iterator_tag &) { - _Iterator1 __i(__first); - for (; __i != __last && __i != __it; ++__i); - return (__i != __last); -} - -#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) -template -inline bool _STLP_CALL -__in_range_aux(const _Iterator1& __it, const _Iterator& __first, - const _Iterator& __last, const bidirectional_iterator_tag &) { - _Iterator1 __i(__first); - for (; __i != __last && __i != __it; ++__i); - return (__i != __last); -} -#endif - -template -bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last, - const __false_type& /*_IsIntegral*/) { - _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE ) - return true; -} - -template -bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/, - const __true_type& /*_IsIntegral*/) -{ return true; } - -template -bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) { - typedef typename _IsIntegral<_Iterator>::_Ret _Integral; - return __check_range_aux(__first, __last, _Integral()); -} - -template -bool _STLP_CALL __check_range(const _Iterator& __it, - const _Iterator& __start, const _Iterator& __finish) { - _STLP_VERBOSE_RETURN(__in_range(__it, __start, __finish), - _StlMsg_NOT_IN_RANGE_1) - return true; -} - -template -bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last, - const _Iterator& __start, const _Iterator& __finish) { - _STLP_VERBOSE_RETURN(__in_range(__first, __last, __start, __finish), - _StlMsg_NOT_IN_RANGE_2) - return true; -} - -template -bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) { - _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT) - _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()), - _StlMsg_INVALID_RANGE) - return true; -} - -//=============================================================== -template -void _STLP_CALL __invalidate_range(const __owned_list* __base, - const _Iterator& __first, - const _Iterator& __last) { - typedef __owned_link _L_type; - _STLP_ACQUIRE_LOCK(__base->_M_lock) - _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node); - _L_type* __pos = __prev->_M_next; - - while (__pos != 0) { - if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) && - __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator, - __first._M_iterator, __last._M_iterator, - _STLP_ITERATOR_CATEGORY(__first, _Iterator))) { - __pos->_M_owner = 0; - __prev->_M_next = __pos->_M_next; - } - else { - __prev = __pos; - } - __pos = __prev->_M_next; - } - _STLP_RELEASE_LOCK(__base->_M_lock) -} - -template -void _STLP_CALL __invalidate_iterator(const __owned_list* __base, - const _Iterator& __it) { - typedef __owned_link _L_type; - _STLP_ACQUIRE_LOCK(__base->_M_lock) - _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node); - _L_type* __pos = __prev->_M_next; - while (__pos != 0) { - // this requires safe iterators to be derived from __owned_link - if ((__pos != __STATIC_CAST(const _L_type*, &__it)) && - (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) { - __pos->_M_owner = 0; - __prev->_M_next = __pos->_M_next; - } - else { - __prev = __pos; - } - __pos = __prev->_M_next; - } - _STLP_RELEASE_LOCK(__base->_M_lock) -} - -template -void _STLP_CALL __change_range_owner(const _Iterator& __first, - const _Iterator& __last, - const __owned_list* __dst) { - if (__first._Owner() == __dst) - return; - - typedef __owned_link _L_type; - // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here - //_STLP_ACQUIRE_LOCK(__base->_M_lock) - __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner()); - _L_type* __src_prev = &__base->_M_node; - _L_type* __pos = __src_prev->_M_next; - _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node); - - while (__pos != 0) { - if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) && - __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator, - __first._M_iterator, __last._M_iterator, - _STLP_ITERATOR_CATEGORY(__first, _Iterator))) { - __pos->_M_owner = __CONST_CAST(__owned_list*, __dst); - //remove __pos from __base: - __src_prev->_M_next = __pos->_M_next; - //add __pos to __dst: - __pos->_M_next = __dst_prev->_M_next; - __dst_prev->_M_next = __pos; - } - else { - __src_prev = __pos; - } - __pos = __src_prev->_M_next; - } - //_STLP_RELEASE_LOCK(__base->_M_lock) -} - -template -void _STLP_CALL __change_ite_owner(const _Iterator& __it, - const __owned_list* __dst) { - if (__it._Owner() == __dst) - return; - - typedef __owned_link _L_type; - // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here - //_STLP_ACQUIRE_LOCK(__base->_M_lock) - __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner()); - _L_type* __prev = &__base->_M_node; - _L_type* __pos = __prev->_M_next; - _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node); - - while (__pos != 0) { - // this requires safe iterators to be derived from __owned_link - if ((__pos != __STATIC_CAST(const _L_type*, &__it)) && - (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) { - __pos->_M_owner = __CONST_CAST(__owned_list*, __dst); - //remove __pos from __base: - __prev->_M_next = __pos->_M_next; - //add __pos to __dst: - __pos->_M_next = __dst_prev->_M_next; - __dst_prev->_M_next = __pos; - } - else { - __prev = __pos; - } - __pos = __prev->_M_next; - } - //_STLP_RELEASE_LOCK(__base->_M_lock) -} - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -#endif /* _STLP_DEBUG */ - -#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) - -# ifndef _STLP_INTERNAL_CSTDLIB -# include -# endif - -//========================================================== -// .c section -// owned_list non-inline methods and global functions -//========================================================== - -# if defined (_STLP_ASSERTIONS) - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -# if !defined (_STLP_STRING_LITERAL) -# define _STLP_STRING_LITERAL(__x) __x -# endif - -# if defined (_STLP_USE_WIDE_INTERFACE) -// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message -# define _STLP_PERCENT_S "%hs" -# else -# define _STLP_PERCENT_S "%s" -# endif /* _STLP_USE_WIDE_INTERFACE */ - -# define _STLP_MESSAGE_TABLE_BODY = { \ -_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \ -_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \ -_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \ -_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \ -_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \ -_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\ -_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \ -_STLP_STRING_LITERAL("Index out of bounds"), \ -_STLP_STRING_LITERAL("Container doesn't own the iterator"), \ -_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \ -_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \ -_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \ -_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \ -_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \ -_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \ -_STLP_STRING_LITERAL("Range [first,last) is invalid"), \ -_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \ -_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \ -_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \ -_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \ -_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \ -_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \ -_STLP_STRING_LITERAL("Memory block deallocated twice"), \ -_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \ -_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \ -_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \ -_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \ -_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \ -_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \ -_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \ -_STLP_STRING_LITERAL("Unknown problem") \ - } - -# if (_STLP_STATIC_TEMPLATE_DATA > 0) -template -const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY; - -# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \ - defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT) -/* - * Under cygwin, when STLport is used as a shared library, the id needs - * to be specified as imported otherwise they will be duplicated in the - * calling executable. - */ -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC const char* __stl_debug_engine::_Message_table[_StlMsg_MAX]; -# endif - -# else -__DECLARE_INSTANCE(const char*, __stl_debug_engine::_Message_table[_StlMsg_MAX], - _STLP_MESSAGE_TABLE_BODY); -# endif - -# undef _STLP_STRING_LITERAL -# undef _STLP_PERCENT_S - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -// abort() -# ifndef _STLP_INTERNAL_CSTDLIB -# include -# endif - -# if !defined (_STLP_DEBUG_MESSAGE) -# ifndef _STLP_INTERNAL_CSTDARG -# include -# endif -# ifndef _STLP_INTERNAL_CSTDIO -# include -# endif -# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H) -# include -# endif - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) { - STLPORT_CSTD::va_list __args; - va_start( __args, __format_str ); - -# if !defined (_STLP_DEBUG_MODE_THROWS) -# if defined (_STLP_USE_WIDE_INTERFACE) - TCHAR __buffer[512]; - int _convert = strlen(__format_str) + 1; - LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t)); - _lpw[0] = '\0'; - MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert); - wvsprintf(__buffer, _lpw, __args); - _STLP_WINCE_TRACE(__buffer); -# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL)) - char __buffer [4096]; - -# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) - vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args); -# else - vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args); -# endif - - OutputDebugStringA(__buffer); - -# elif defined (__amigaos__) - STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args); -# else - STLPORT_CSTD::vfprintf(stderr, __format_str, __args); -# endif -# else - char __buffer[4096]; - -# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) - vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args); -# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL)) - vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args); -# else - vsprintf(__buffer, __format_str, __args); -# endif -# endif - -# ifdef _STLP_DEBUG_MESSAGE_POST - _STLP_DEBUG_MESSAGE_POST -# endif - - va_end(__args); - -# if defined (_STLP_DEBUG_MODE_THROWS) - __stl_throw_runtime_error(__buffer); -# endif -} - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -# else -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) -{} -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE -# endif /* _STLP_DEBUG_MESSAGE */ - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) { - __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN], - __f, __l, _Message_table[__error_ind]); -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) { - __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE], - __f, __l, _Message_table[__error_ind], __f, __l, __expr); - __stl_debug_terminate(); -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) { - __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr); - __stl_debug_terminate(); -} - -// if exceptions are present, sends unique exception -// if not, calls abort() to terminate -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Terminate() -{ _STLP_ABORT(); } - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -# endif /* _STLP_ASSERTIONS */ - -# if defined (_STLP_DEBUG) - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -//========================================================== -// owned_list non-inline methods -//========================================================== - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) { - _STLP_ACQUIRE_LOCK(__l->_M_lock); - _Stamp_all(__l, 0); - __l->_M_node._M_next =0; - _STLP_RELEASE_LOCK(__l->_M_lock); -} - -// boris : this is unasafe routine; should be used from within critical section only ! -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) { - // crucial - if (__l->_M_node._M_owner) { - for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next; - __pos != 0; __pos = (__owned_link*)__pos->_M_next) { - _STLP_ASSERT(__pos->_Owner()== __l) - __pos->_M_owner=__o; - } - } -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) { - _STLP_ACQUIRE_LOCK(__l->_M_lock); - if (__l) { - _STLP_ASSERT(__l->_M_node._Owner() != 0) - for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next; - __pos != 0; __pos = (__owned_link*)__pos->_M_next) { - _STLP_ASSERT(__pos->_Owner()== __l) - } - } - _STLP_RELEASE_LOCK(__l->_M_lock); -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) { - /* - * according to the standard : --no swap() function invalidates any references, - * pointers, or iterators referring to the elements of the containers being swapped. - */ - - __owned_link* __tmp; - - /* - * boris : there is a deadlock potential situation here if we lock two containers sequentially. - * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access - * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version - */ - - __tmp = __x._M_node._M_next; - - _Stamp_all(&__x, &__y); - _Stamp_all(&__y, &__x); - - __x._M_node._M_next = __y._M_node._M_next; - __y._M_node._M_next = __tmp; -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) { - if (&__src == &__dst) - return; - - // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here - typedef __owned_link _L_type; - _L_type* __prev = &__src._M_node; - _L_type* __pos = __prev->_M_next; - - while (__pos != 0) { - __pos->_M_owner = &__dst; - __prev = __pos; - __pos = __prev->_M_next; - } - __prev->_M_next = __dst._M_node._M_next; - __dst._M_node._M_next = __src._M_node._M_next; - __src._M_node._M_next = 0; -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) { - if (__l != 0) { - - _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER) - - _STLP_ACQUIRE_LOCK(__l->_M_lock) - // boris : re-test the condition in case someone else already deleted us - if(__c_node->_M_owner != 0) { - __owned_link* __prev, *__next; - - for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node; - __prev = __next) { - _STLP_ASSERT(__next && __next->_Owner() == __l) - } - - __prev->_M_next = __c_node->_M_next; - __c_node->_M_owner=0; - } - _STLP_RELEASE_LOCK(__l->_M_lock) - } -} - -template -void _STLP_CALL -__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) { - if (__l ==0) { - (__c_node)->_M_owner = 0; - } else { - _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER) - _STLP_ACQUIRE_LOCK(__l->_M_lock) - __c_node->_M_owner = __l; - __c_node->_M_next = __l->_M_node._M_next; - __l->_M_node._M_next = __c_node; - _STLP_RELEASE_LOCK(__l->_M_lock) - } -} - -template -void* _STLP_CALL -__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) { - const __owned_list* __owner = __l->_Owner(); - _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR) - void* __ret = __CONST_CAST(void*,__owner->_Owner()); - _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER) - return __ret; -} - -template -bool _STLP_CALL -__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1, - const __owned_link& __i2) { - _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR) - _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR) - _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS) - return true; -} - -template -bool _STLP_CALL -__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1, - const __owned_link& __i2) { - _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS) - return true; -} - -template -bool _STLP_CALL -__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) { - const __owned_list* __owner_ptr = __it._Owner(); - _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR) - _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER) - return true; -} - -template -bool _STLP_CALL -__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) { - const __owned_list* __owner_ptr = __it._Owner(); - _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR) - _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER) - return true; -} - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -# endif /* _STLP_DEBUG */ - -#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */ - -#endif /* header guard */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_debug.h b/SDK/stlport/stl/debug/_debug.h deleted file mode 100644 index 90e6218e..00000000 --- a/SDK/stlport/stl/debug/_debug.h +++ /dev/null @@ -1,460 +0,0 @@ -/* - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_DEBUG_H -#define _STLP_DEBUG_H - -#if defined (_STLP_ASSERTIONS) || defined (_STLP_DEBUG) - -# ifndef _STLP_TYPE_TRAITS_H -# include -# endif - -# if !defined (_STLP_EXTRA_OPERATORS_FOR_DEBUG) && \ - (defined (_STLP_BASE_MATCH_BUG) || (defined (_STLP_MSVC) && _STLP_MSVC < 1100)) -# define _STLP_EXTRA_OPERATORS_FOR_DEBUG -# endif - -# if !defined (_STLP_FILE__) -# define _STLP_FILE__ __FILE__ -# endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -enum { - //General errors - _StlFormat_ERROR_RETURN, - _StlFormat_ASSERTION_FAILURE, - _StlFormat_VERBOSE_ASSERTION_FAILURE, - _StlMsg_INVALID_ARGUMENT, - //Container/Iterator related errors - _StlMsg_INVALID_CONTAINER, - _StlMsg_EMPTY_CONTAINER, - _StlMsg_ERASE_PAST_THE_END, - _StlMsg_OUT_OF_BOUNDS, - _StlMsg_NOT_OWNER, - _StlMsg_SHOULD_NOT_OWNER, - _StlMsg_INVALID_ITERATOR, - _StlMsg_INVALID_LEFTHAND_ITERATOR, - _StlMsg_INVALID_RIGHTHAND_ITERATOR, - _StlMsg_DIFFERENT_OWNERS , - _StlMsg_NOT_DEREFERENCEABLE , - _StlMsg_INVALID_RANGE , - _StlMsg_NOT_IN_RANGE_1 , - _StlMsg_NOT_IN_RANGE_2 , - _StlMsg_INVALID_ADVANCE , - _StlMsg_SINGULAR_ITERATOR , - //Bad predicate for sorting - _StlMsg_INVALID_STRICT_WEAK_PREDICATE, - _StlMsg_INVALID_EQUIVALENT_PREDICATE, - // debug alloc messages - _StlMsg_DBA_DELETED_TWICE , - _StlMsg_DBA_NEVER_ALLOCATED , - _StlMsg_DBA_TYPE_MISMATCH , - _StlMsg_DBA_SIZE_MISMATCH , - _StlMsg_DBA_UNDERRUN , - _StlMsg_DBA_OVERRUN , - // auto_ptr messages - _StlMsg_AUTO_PTR_NULL , - //Memory alignent message - _StlMsg_WRONG_MEMORY_ALIGNMENT, - _StlMsg_UNKNOWN - /* _StlMsg_MAX */ -}; - -/* have to hardcode that ;() */ -# define _StlMsg_MAX 31 - -// This class is unique (not inherited from exception), -// to disallow catch in anything but (...) -struct __stl_debug_exception { - // no members -}; - -class _STLP_CLASS_DECLSPEC __owned_link; -class _STLP_CLASS_DECLSPEC __owned_list; - -#if defined (_STLP_DEBUG_MODE_THROWS) -# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS -#else -# define _STLP_MESSAGE_NORETURN -#endif - -template -struct __stl_debug_engine { - - // Basic routine to report any debug message - // Use _STLP_DEBUG_MESSAGE to override - static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...); - - // Micsellanous function to report indexed error message - static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l); - - // Basic assertion report mechanism. - // Reports failed assertion via __stl_debug_message and calls _Terminate - // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead - static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l); - - // The same, with additional diagnostics - static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l); - - // If exceptions are present, sends unique exception - // If not, calls _STLP_ABORT() to terminate - // Use _STLP_DEBUG_TERMINATE to override - static void _STLP_CALL _Terminate(); - -# if defined (_STLP_DEBUG) - // owned_list/link delegate non-inline functions here - - static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1, - const __owned_link& __i2); - static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1, - const __owned_link& __i2); - static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&); - - static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&); - - static void _STLP_CALL _Verify(const __owned_list*); - - static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&); - - static void _STLP_CALL _Invalidate_all(__owned_list*); - - static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/); - - static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*); - - static void _STLP_CALL _M_detach(__owned_list*, __owned_link*); - - static void _STLP_CALL _M_attach(__owned_list*, __owned_link*); - - // accessor : check and get pointer to the container - static void* _STLP_CALL _Get_container_ptr(const __owned_link*); -# endif - - // debug messages and formats - static _STLP_STATIC_MEMBER_DECLSPEC const char* _Message_table[_StlMsg_MAX]; -}; - -#undef _STLP_MESSAGE_NORETURN - -# if defined (_STLP_USE_TEMPLATE_EXPORT) -_STLP_EXPORT_TEMPLATE struct _STLP_CLASS_DECLSPEC __stl_debug_engine; -# endif /* _STLP_USE_TEMPLATE_EXPORT */ - -typedef __stl_debug_engine __stl_debugger; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -# if !defined (_STLP_ASSERT) -# define _STLP_ASSERT(expr) \ - if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); } -# endif - -#endif /* _STLP_ASSERTIONS || _STLP_DEBUG */ - -// this section is for _STLP_DEBUG only -#if defined (_STLP_DEBUG) - -# if !defined (_STLP_VERBOSE_ASSERT) -// fbp : new form not requiring ";" -# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \ - if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\ - ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \ - } -# endif - -# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr) -# define _STLP_DEBUG_DO(expr) expr; - -# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) -# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr) -# define _STLP_STD_DEBUG_DO(expr) _STLP_DEBUG_DO(expr) -# else -# define _STLP_STD_DEBUG_CHECK(expr) -# define _STLP_STD_DEBUG_DO(expr) -# endif - -# if !defined (_STLP_VERBOSE_RETURN) -# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \ - _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \ - return false; } -# endif - -# if !defined (_STLP_VERBOSE_RETURN_0) -# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \ - _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \ - return 0; } -# endif - -# ifndef _STLP_INTERNAL_THREADS_H -# include -# endif - -# ifndef _STLP_INTERNAL_ITERATOR_BASE_H -# include -# endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -/* - * Special debug iterator traits having an additionnal static member - * method _Check. It is used by the slit debug implementation to check - * the special before_begin iterator. - */ -template -struct _DbgTraits : _Traits { - typedef _DbgTraits _ConstTraits; - typedef _DbgTraits _NonConstTraits; - - template - static bool _Check(const _Iterator&) {return true;} -}; - -//============================================================= -template -inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, - const random_access_iterator_tag&) -{ return (__i1 < __i2) || (__i1 == __i2); } - -template -inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, - const bidirectional_iterator_tag&) { - // check if comparable - bool __dummy(__i1==__i2); - return (__dummy==__dummy); -} - -template -inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, - const forward_iterator_tag&) { - // check if comparable - bool __dummy(__i1==__i2); - return (__dummy==__dummy); -} - -template -inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&, - const input_iterator_tag&) -{ return true; } - -template -inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&, - const output_iterator_tag&) -{ return true; } - -template -inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2) -{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); } - -// Note : that means in range [i1, i2]. -template -inline bool _STLP_CALL __in_range(const _Iterator& _It, - const _Iterator& __i1, const _Iterator& __i2) -{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); } - -template -inline bool _STLP_CALL __in_range(const _Iterator& __first, const _Iterator& __last, - const _Iterator& __start, const _Iterator& __finish) -{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); } - -//========================================================== -class _STLP_CLASS_DECLSPEC __owned_link { -public: - __owned_link() : _M_owner(0) {} - __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0) - { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); } - __owned_link(const __owned_link& __rhs): _M_owner(0) - { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); } - __owned_link& operator=(const __owned_link& __rhs) { - __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner); - __owned_list* __old_owner = _M_owner; - if ( __old_owner != __new_owner ) { - __stl_debugger::_M_detach(__old_owner, this); - __stl_debugger::_M_attach(__new_owner, this); - } - return *this; - } - ~__owned_link() { - __stl_debugger::_M_detach(_M_owner, this); - _Invalidate(); - } - - const __owned_list* _Owner() const { return _M_owner; } - __owned_list* _Owner() { return _M_owner; } - void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); } - bool _Valid() const { return _M_owner != 0; } - void _Invalidate() { _M_owner = 0; _M_next = 0; } - void _Link_to_self() { _M_next = 0; } - - __owned_link* _Next() { return _M_next; } - const __owned_link* _Next() const { return _M_next; } - -public: - __owned_list* _M_owner; - __owned_link* _M_next; -}; - - -class _STLP_CLASS_DECLSPEC __owned_list { -public: - __owned_list(void* __o) { - // fprintf(stderr, "__owned_list(): %p\n",(void*)this); - _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o); - _M_node._M_next = 0; - } - ~__owned_list() { - // fprintf(stderr, "~__owned_list(): %p\n",(void*)this); - _Invalidate_all(); - // that prevents detach - _M_node._Invalidate(); - } - const void* _Owner() const { return (const void*)_M_node._M_owner; } - void* _Owner() { return (void*)_M_node._M_owner; } - bool _Valid() const { return _M_node._M_owner != 0; } - void _Invalidate() { _M_node._M_owner = 0; } - - __owned_link* _First() { return _M_node._Next(); } - __owned_link* _Last() { return 0 ; } - - const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; } - const __owned_link* _Last() const { return 0 ;} - - void _Verify() const { __stl_debugger::_Verify(this); } - void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); } - void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); } - void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); } - - mutable __owned_link _M_node; - mutable _STLP_mutex _M_lock; - -private: - // should never be called, should be left not implemented, - // but some compilers complain about it ;( - __owned_list(const __owned_list&){} - __owned_list& operator = (const __owned_list&) { return *this; } - - friend class __owned_link; - friend struct __stl_debug_engine; -}; - - -//========================================================== - -// forward declaratioins - -template -bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&); -template -bool _STLP_CALL __check_range(const _Iterator&, - const _Iterator&, const _Iterator&); -template -bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& , - const _Iterator&, const _Iterator& ); -template -bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*); - - -template -void _STLP_CALL __invalidate_range(const __owned_list* __base, - const _Iterator& __first, - const _Iterator& __last); - -template -void _STLP_CALL __invalidate_iterator(const __owned_list* __base, - const _Iterator& __it); - -template -void _STLP_CALL __change_range_owner(const _Iterator& __first, - const _Iterator& __last, - const __owned_list* __dst); - -template -void _STLP_CALL __change_ite_owner(const _Iterator& __it, - const __owned_list* __dst); - -//============================================================ -inline bool _STLP_CALL -__check_same_owner(const __owned_link& __i1, const __owned_link& __i2) -{ return __stl_debugger::_Check_same_owner(__i1,__i2); } - -inline bool _STLP_CALL -__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2) -{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); } - -template -inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner, - const _Iterator& __it) -{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); } - -template -inline bool _STLP_CALL __check_if_not_owner( const __owned_list* /*__owner*/, - const _Iterator& /*__it*/, - const __false_type&) -{ return true; } - -template -inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner, - const _Iterator& __it, - const __true_type&) -{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); } - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_DEBUG */ - -#if defined (_STLP_ASSERTIONS) - -# if !defined (_STLP_ASSERT_MSG_TRAILER) -# define _STLP_ASSERT_MSG_TRAILER -# endif - -// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition. -# if !defined (_STLP_DEBUG_MESSAGE) -# define __stl_debug_message __stl_debugger::_Message -# else -extern void __stl_debug_message(const char * format_str, ...); -# endif - -// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition. -# if !defined (_STLP_DEBUG_TERMINATE) -# define __stl_debug_terminate __stl_debugger::_Terminate -# else -extern void __stl_debug_terminate(); -# endif - -#endif - -#if !defined (_STLP_LINK_TIME_INSTANTIATION) -# include -#endif - -#endif /* DEBUG_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_deque.h b/SDK/stlport/stl/debug/_deque.h deleted file mode 100644 index 45595a05..00000000 --- a/SDK/stlport/stl/debug/_deque.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_DEQUE_H -#define _STLP_INTERNAL_DBG_DEQUE_H - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc> - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&) -{ return (_Tp*)0; } -template -inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&) -{ return random_access_iterator_tag(); } -#endif - -template -class deque : -#if !defined (__DMC__) - private -#endif - _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - , public __stlport_class > -#endif -{ - typedef deque<_Tp,_Alloc> _Self; - typedef _STLP_NON_DBG_DEQUE _Base; - typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck; - -public: - // Basic types - __IMPORT_CONTAINER_TYPEDEFS(_Base) - - // Iterators - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -protected: - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - - void _Invalidate_all() - { _M_iter_list._Invalidate_all(); } - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); } - void _Invalidate_iterators(const iterator& __first, const iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - -public: - // Basic accessors - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - reference operator[](size_type __n) { - _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) - return _M_non_dbg_impl[__n]; - } - const_reference operator[](size_type __n) const { - _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) - return _M_non_dbg_impl[__n]; - } - - reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } - const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } - - reference front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - const_reference front() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - reference back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - const_reference back() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - - // Constructor, destructor. - explicit deque(const allocator_type& __a = allocator_type()) : - _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} - deque(const _Self& __x) : - _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), - _M_iter_list(&_M_non_dbg_impl) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit deque(size_type __n, const value_type& __x = _Tp(), -#else - deque(size_type __n, param_type __x, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) : - _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit deque(size_type __n) : - _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - deque(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - deque(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), - _M_iter_list(&_M_non_dbg_impl) { - } -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - deque(_InputIterator __first, _InputIterator __last) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), - _M_iter_list(&_M_non_dbg_impl) { - } -# endif -#else - deque(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first, __last, __a), - _M_iter_list(&_M_non_dbg_impl) { - } - - deque(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), - _M_iter_list(&_M_non_dbg_impl) { - } -#endif - - _Self& operator=(const _Self& __x) { - if (this != &__x) { - _Invalidate_all(); - _M_non_dbg_impl = __x._M_non_dbg_impl; - } - return *this; - } - - bool empty() const { return _M_non_dbg_impl.empty(); } - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - - void swap(_Self& __x) { - _M_iter_list._Swap_owners(__x._M_iter_list); - _M_non_dbg_impl.swap(__x._M_non_dbg_impl); - } - -public: - void assign(size_type __n, const _Tp& __val) { - _Invalidate_all(); - _M_non_dbg_impl.assign(__n, __val); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Invalidate_all(); - _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } -#else - void assign(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Invalidate_all(); - _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); - } - void assign(const value_type *__first, const value_type *__last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _Invalidate_all(); - _M_non_dbg_impl.assign(__first, __last); - } -#endif - -public: // push_* and pop_* - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back(const value_type& __t = _Tp()) { -#else - void push_back(const value_type& __t) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _Invalidate_all(); - _M_non_dbg_impl.push_back(__t); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back() { - _Invalidate_all(); - _M_non_dbg_impl.push_back(); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front(const value_type& __t = _Tp()) { -#else - void push_front(const value_type& __t) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _Invalidate_all(); - _M_non_dbg_impl.push_front(__t); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front() { - _Invalidate_all(); - _M_non_dbg_impl.push_front(); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void pop_back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _Invalidate_iterator(end()); - _M_non_dbg_impl.pop_back(); - } - - void pop_front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _Invalidate_iterator(begin()); - _M_non_dbg_impl.pop_front(); - } - -public: // Insert - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const value_type& __x = _Tp()) { -#else - iterator insert(iterator __pos, const value_type& __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Invalidate_all(); - return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Invalidate_all(); - return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator)); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - if (__n != 0) _Invalidate_all(); - _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { - typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator; - typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck; - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - //Sequence requirements 23.1.1 Table 67: - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck())); - _M_non_dbg_impl.insert(__pos._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - //dums: because of self insertion iterators must be invalidated after insertion. - if (__first != __last) _Invalidate_all(); - } -#else - void insert(iterator __pos, - const value_type* __first, const value_type* __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); - //dums: because of self insertion iterators must be invalidated after insertion. - if (__first != __last) _Invalidate_all(); - } - void insert(iterator __pos, - const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - //Sequence requirements 23.1.1 Table 67: - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type())); - _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); - //dums: because of self insertion iterators must be invalidated after insertion. - if (__first != __last) _Invalidate_all(); - } -#endif - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _Tp()) { -#else - void resize(size_type __new_size, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - if (__new_size != size()) { - if ((__new_size > size()) || (__new_size < size() - 1)) - _Invalidate_all(); - else - _Invalidate_iterator(end()); - } - _M_non_dbg_impl.resize(__new_size, __x); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - // Erase - iterator erase(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - if (__pos._M_iterator == _M_non_dbg_impl.begin()) - _Invalidate_iterator(__pos); - else { - typename _Base::iterator __tmp = --(_M_non_dbg_impl.end()); - if (__pos._M_iterator == __tmp) - _Invalidate_iterator(__pos); - else - _Invalidate_all(); - } - return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); - } - - iterator erase(iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - if (!empty()) { - if (__first._M_iterator == _M_non_dbg_impl.begin() || - __last._M_iterator == _M_non_dbg_impl.end()) - _Invalidate_iterators(__first, __last); - else - _Invalidate_all(); - } - return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); - } - - void clear() { - _Invalidate_all(); - _M_non_dbg_impl.clear(); - } -}; - -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_DEQUE - -#endif /* _STLP_INTERNAL_DEQUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_hashtable.h b/SDK/stlport/stl/debug/_hashtable.h deleted file mode 100644 index b0d64115..00000000 --- a/SDK/stlport/stl/debug/_hashtable.h +++ /dev/null @@ -1,338 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_HASHTABLE_H -#define _STLP_INTERNAL_DBG_HASHTABLE_H - -// Hashtable class, used to implement the hashed associative containers -// hash_set, hash_map, hash_multiset, and hash_multimap, -// unordered_set, unordered_map, unordered_multiset, unordered_multimap - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class _DbgEqual { -public: - _DbgEqual() {} - _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {} - _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {} - -#if !defined (_STLP_USE_CONTAINERS_EXTENSION) - bool operator () (const _Key& __lhs, const _Key& __rhs) const -#else - template - bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const -#endif - { -#if !defined (_STLP_USE_CONTAINERS_EXTENSION) - _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE) -#endif - return _M_non_dbg_eq(__lhs, __rhs) ? true : false; - } - - _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; } -private: - _Equal _M_non_dbg_eq; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -#define _STLP_NON_DBG_HT \ -_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All> - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _Val* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&) -{ return (_Val*)0; } - -template -inline forward_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&) -{ return forward_iterator_tag(); } -#endif - -template -class hashtable { - typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self; - typedef _STLP_NON_DBG_HT _Base; - - typedef typename _Traits::_NonConstTraits _NonConstTraits; - typedef typename _Traits::_ConstTraits _ConstTraits; - typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits; - typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits; - - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - -public: - typedef _Key key_type; - typedef _HF hasher; - typedef _EqK key_equal; - - __IMPORT_CONTAINER_TYPEDEFS(_Base) - - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator; - //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator; - typedef iterator local_iterator; - //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator; - typedef const_iterator const_local_iterator; - - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_iterator _Base_const_iterator; - - hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); } - key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); } - -private: - void _Invalidate_iterator(const const_iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } - void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -public: - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const _ExK& __ext, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - hashtable(size_type __n, - const _HF& __hf, - const _EqK& __eql, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __hf, __eql, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - hashtable(const _Self& __ht) - : _M_non_dbg_impl(__ht._M_non_dbg_impl), - _M_iter_list(&_M_non_dbg_impl) {} - - hashtable(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - bool empty() const { return _M_non_dbg_impl.empty(); } - - _Self& operator=(const _Self& __ht) { - if (this != &__ht) { - //Should not invalidate end iterator - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl = __ht._M_non_dbg_impl; - } - return *this; - } - - void swap(_Self& __ht) { - _M_iter_list._Swap_owners(__ht._M_iter_list); - _M_non_dbg_impl.swap(__ht._M_non_dbg_impl); - } - - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - local_iterator begin(size_type __n) { - //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators - _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) - return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n)); - } - local_iterator end(size_type __n) { - //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators - _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) - return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n)); - } - - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_local_iterator begin(size_type __n) const { - //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators - _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) - return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n)); - } - const_local_iterator end(size_type __n) const { - //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators - _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) - return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n)); - } - - pair insert_unique(const value_type& __obj) { - pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj); - return pair(iterator(&_M_iter_list, __res.first), __res.second); - } - - iterator insert_equal(const value_type& __obj) - { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); } - - pair insert_unique_noresize(const value_type& __obj) { - pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj); - return pair(iterator(&_M_iter_list, __res.first), __res.second); - } - - iterator insert_equal_noresize(const value_type& __obj) - { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert_unique(_InputIterator __f, _InputIterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); - } - - template - void insert_equal(_InputIterator __f, _InputIterator __l){ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); - } - -#else - void insert_unique(const value_type* __f, const value_type* __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) - _M_non_dbg_impl.insert_unique(__f, __l); - } - - void insert_equal(const value_type* __f, const value_type* __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) - _M_non_dbg_impl.insert_equal(__f, __l); - } - - void insert_unique(const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator); - } - - void insert_equal(const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator); - } -#endif - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __key) - { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __key) const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); } - - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) { - pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key); - return pair (iterator(&_M_iter_list,__res.first), - iterator(&_M_iter_list,__res.second)); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __key) const { - pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key); - return pair (const_iterator(&_M_iter_list,__res.first), - const_iterator(&_M_iter_list,__res.second)); - } - - size_type erase(const key_type& __key) { - pair<_Base_iterator, _Base_iterator> __p = _M_non_dbg_impl.equal_range(__key); - size_type __n = _STLP_STD::distance(__p.first, __p.second); - _Invalidate_iterators(const_iterator(&_M_iter_list, __p.first), const_iterator(&_M_iter_list, __p.second)); - _M_non_dbg_impl.erase(__p.first, __p.second); - return __n; - } - - void erase(const const_iterator& __it) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it)) - _Invalidate_iterator(__it); - _M_non_dbg_impl.erase(__it._M_iterator); - } - void erase(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, - const_iterator(begin()), const_iterator(end()))) - _Invalidate_iterators(__first, __last); - _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator); - } - - void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); } - void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); } - - void clear() { - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.clear(); - } - - reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); } - - size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); } - size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); } - size_type elems_in_bucket(size_type __n) const { - _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.elems_in_bucket(__n); - } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); } - - float load_factor() const { return _M_non_dbg_impl.load_factor(); } - float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); } - void max_load_factor(float __z) { - _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT) - _M_non_dbg_impl.max_load_factor(__z); - } -}; - -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_HT - -#endif /* _STLP_INTERNAL_HASHTABLE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_iterator.h b/SDK/stlport/stl/debug/_iterator.h deleted file mode 100644 index 2faaa9f4..00000000 --- a/SDK/stlport/stl/debug/_iterator.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_DBG_ITERATOR_H -#define _STLP_DBG_ITERATOR_H - -#ifndef _STLP_INTERNAL_PAIR_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -#define _STLP_DBG_ALLOCATOR_SELECT( _Tp ) _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -//============================================================ - -template -void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &) -{ --__it; } - -template -void _Decrement(_Iterator& __it, const random_access_iterator_tag &) -{ --__it; } - -template -void _Decrement(_Iterator& __it, const forward_iterator_tag &) -{ _STLP_ASSERT(0) } - -template -void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &) -{ _STLP_ASSERT(0) } - -template -void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &) -{ _STLP_ASSERT(0) } - -template -void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) -{ __it += __n; } - -template -ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &) -{ return __x - __y; } - -template -ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) { - _STLP_ASSERT(0) - return 0; -} - -template -ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) { - _STLP_ASSERT(0) - return 0; -} - -template -bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) { - _STLP_ASSERT(0) - return false; -} - -template -bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) { - _STLP_ASSERT(0) - return false; -} - -template -bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &) -{ return __x < __y; } - -template -bool _Dereferenceable(const _Iterator& __it) -{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); } - -template -bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &) -{ return (__n == 1) && _Dereferenceable(__it); } - -template -bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) { - typedef typename _Iterator::_Container_type __container_type; - __container_type* __c = __it._Get_container_ptr(); - return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) || - (__n == -1 && __it._M_iterator != __c->begin())); -} - -template -bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) { - typedef typename _Iterator::_Container_type __container_type; - __container_type* __c = __it._Get_container_ptr(); - if (__c == 0) return false; - ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n; - return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size()); -} - - -template -struct _DBG_iter_base : public __owned_link { -public: - typedef typename _Container::value_type value_type; - typedef typename _Container::reference reference; - typedef typename _Container::pointer pointer; - typedef ptrdiff_t difference_type; - //private: - typedef typename _Container::iterator _Nonconst_iterator; - typedef typename _Container::const_iterator _Const_iterator; - typedef _Container _Container_type; - -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category; -#else - typedef typename _Container::_Iterator_category _Iterator_category; -#endif - typedef _Iterator_category iterator_category; - - _DBG_iter_base() : __owned_link(0) {} - _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) : -#if defined(__HP_aCC) && (__HP_aCC < 60000) - __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {} -#else - __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {} -#endif - _Container* _Get_container_ptr() const { - return (_Container*)__stl_debugger::_Get_container_ptr(this); - } - - void __increment(); - void __decrement(); - void __advance(ptrdiff_t __n); - -// protected: - _Nonconst_iterator _M_iterator; -}; - -template -inline void _DBG_iter_base<_Container>::__increment() { - _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category())) - ++_M_iterator; -} - -template -inline void _DBG_iter_base<_Container>::__decrement() { - _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category())) - _Decrement(_M_iterator, _Iterator_category()); -} - -template -inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) { - _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category())) - _Advance(_M_iterator, __n, _Iterator_category()); -} - -template -ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x, - const _DBG_iter_base<_Container>& __y ) { - typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category; - _STLP_DEBUG_CHECK(__check_same_owner(__x, __y)) - return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category()); -} - -template -struct _DBG_iter_mid : public _DBG_iter_base<_Container> { - typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self; - typedef typename _Container::iterator _Nonconst_iterator; - typedef typename _Container::const_iterator _Const_iterator; - - _DBG_iter_mid() {} - - explicit _DBG_iter_mid(const _Nonconst_self& __it) : - _DBG_iter_base<_Container>(__it) {} - - _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) : - _DBG_iter_base<_Container>(__c, __it) {} -}; - -template -struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> { - typedef _DBG_iter_base<_Container> _Base; -public: - typedef typename _Base::value_type value_type; - typedef typename _Base::difference_type difference_type; - typedef typename _Traits::reference reference; - typedef typename _Traits::pointer pointer; - - typedef typename _Base::_Nonconst_iterator _Nonconst_iterator; - typedef typename _Base::_Const_iterator _Const_iterator; - -private: - typedef _DBG_iter<_Container, _Traits> _Self; - typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid; - -public: - -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION - typedef typename _Base::iterator_category iterator_category; -#endif - typedef typename _Base::_Iterator_category _Iterator_category; - -public: - _DBG_iter() {} - // boris : real type of iter would be nice - _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) : - _DBG_iter_mid<_Container, _Traits>(__c, __it) {} - - // This allows conversions from iterator to const_iterator without being - // redundant with the copy constructor below. - _DBG_iter(const _Nonconst_mid& __rhs) : - _DBG_iter_mid<_Container, _Traits>(__rhs) {} - - _DBG_iter(const _Self& __rhs) : - _DBG_iter_mid<_Container, _Traits>(__rhs) {} - - // This allows conversions from iterator to const_iterator without being - // redundant with the copy assignment operator below. - _Self& operator=(const _Nonconst_mid& __rhs) { - (_Base&)*this = __rhs; - return *this; - } - - _Self& operator=(const _Self& __rhs) { - (_Base&)*this = __rhs; - return *this; - } - - reference operator*() const; - - _STLP_DEFINE_ARROW_OPERATOR - - _Self& operator++() { - this->__increment(); - return *this; - } - _Self operator++(int) { - _Self __tmp = *this; - this->__increment(); - return __tmp; - } - _Self& operator--() { - this->__decrement(); - return *this; - } - _Self operator--(int) { - _Self __tmp = *this; - this->__decrement(); - return __tmp; - } - - _Self& operator+=(difference_type __n) { - this->__advance(__n); - return *this; - } - - _Self& operator-=(difference_type __n) { - this->__advance(-__n); - return *this; - } - _Self operator+(difference_type __n) const { - _Self __tmp(*this); - __tmp.__advance(__n); - return __tmp; - } - _Self operator-(difference_type __n) const { - _Self __tmp(*this); - __tmp.__advance(-__n); - return __tmp; - } - reference operator[](difference_type __n) const { return *(*this + __n); } -}; - -template -inline -#if defined (_STLP_NESTED_TYPE_PARAM_BUG) -_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference -#else -_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference -#endif -_DBG_iter<_Container, _Traits>::operator*() const { - _STLP_DEBUG_CHECK(_Dereferenceable(*this)) - _STLP_DEBUG_CHECK(_Traits::_Check(*this)) - return *this->_M_iterator; -} - -template -inline bool -operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { - _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) - return __x._M_iterator == __y._M_iterator; -} - -template -inline bool -operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { - _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) - typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; - return _CompareIt(__x._M_iterator , __y._M_iterator, _Category()); -} - -template -inline bool -operator>(const _DBG_iter_base<_Container>& __x, - const _DBG_iter_base<_Container>& __y) { - typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; - return _CompareIt(__y._M_iterator , __x._M_iterator, _Category()); -} - -template -inline bool -operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { - _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) - typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; - return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category()); -} - -template -inline bool -operator<=(const _DBG_iter_base<_Container>& __x, - const _DBG_iter_base<_Container>& __y) { - typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; - return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category()); -} - -template -inline bool -operator!=(const _DBG_iter_base<_Container>& __x, - const _DBG_iter_base<_Container>& __y) { - _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) - return __x._M_iterator != __y._M_iterator; -} - -//------------------------------------------ - -template -inline _DBG_iter<_Container, _Traits> -operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) { - _DBG_iter<_Container, _Traits> __tmp(__it); - return __tmp += __n; -} - - -template -inline _Iterator _Non_Dbg_iter(_Iterator __it) -{ return __it; } - -#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -template -inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator -_Non_Dbg_iter(_DBG_iter<_Container, _Traits> __it) -{ return __it._M_iterator; } -#endif - -/* - * Helper classes to check iterator range or pointer validity - * at construction time. - */ -template -class __construct_checker { - typedef typename _Container::value_type value_type; -protected: - __construct_checker() {} - - __construct_checker(const value_type* __p) { - _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT) - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - __construct_checker(const _InputIter& __f, const _InputIter& __l) { - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - _M_check_dispatch(__f, __l, _Integral()); - } - - template - void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {} - - template - void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) { - _STLP_DEBUG_CHECK(__check_range(__f,__l)) - } -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) - __construct_checker(const value_type* __f, const value_type* __l) { - _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l)) - } - - typedef _DBG_iter_base<_Container> _IteType; - __construct_checker(const _IteType& __f, const _IteType& __l) { - _STLP_DEBUG_CHECK(__check_range(__f,__l)) - } -#endif -}; - -#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) -# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\ - (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600) ||\ - (defined (_STLP_MSVC) && (_STLP_MSVC < 1100)) -# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1 -# endif - -_STLP_MOVE_TO_STD_NAMESPACE - -template -inline ptrdiff_t* -distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; } - -# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type* -value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { - typedef typename _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val; - return (_Val*)0; -} - -template -inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category -iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) { - typedef typename _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category; - return _Category(); -} -# endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* INTERNAL_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_list.h b/SDK/stlport/stl/debug/_list.h deleted file mode 100644 index 322ec1c4..00000000 --- a/SDK/stlport/stl/debug/_list.h +++ /dev/null @@ -1,502 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_LIST_H -#define _STLP_INTERNAL_DBG_LIST_H - -#ifndef _STLP_INTERNAL_ALGO_H -# include -#endif - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc> - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _Tp* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&) -{ return (_Tp*)0; } -template -inline bidirectional_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&) -{ return bidirectional_iterator_tag(); } -#endif - -template -class list : -#if !defined (__DMC__) - private -#endif - _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - , public __stlport_class > -#endif -{ - typedef _STLP_NON_DBG_LIST _Base; - typedef list<_Tp, _Alloc> _Self; - typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck; - -public: - __IMPORT_CONTAINER_TYPEDEFS(_Base) - -public: - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; - - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - -private: - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } - void _Invalidate_iterators(const iterator& __first, const iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - - typedef typename _Base::iterator _Base_iterator; - -public: - explicit list(const allocator_type& __a = allocator_type()) : - _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit list(size_type __n, const _Tp& __x = _Tp(), -#else - list(size_type __n, const _Tp& __x, -#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit list(size_type __n) - : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - list(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because insert does all of - // that anyway. - template - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), - _M_iter_list(&_M_non_dbg_impl) {} -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - list(_InputIterator __first, _InputIterator __last) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), - _M_iter_list(&_M_non_dbg_impl) {} -# endif -#else - - list(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first, __last, __a), - _M_iter_list(&_M_non_dbg_impl) {} - list(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), - _M_iter_list(&_M_non_dbg_impl) {} - -#endif - - list(const _Self& __x) : - _ConstructCheck(__x), - _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {} - - _Self& operator=(const _Self& __x) { - if (this != &__x) { - //Should not invalidate end iterator - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl = __x._M_non_dbg_impl; - } - return *this; - } - - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - bool empty() const { return _M_non_dbg_impl.empty(); } - - // those are here to enforce checking - reference front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - const_reference front() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - reference back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - const_reference back() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - - void swap(_Self& __x) { - _M_iter_list._Swap_owners(__x._M_iter_list); - _M_non_dbg_impl.swap(__x._M_non_dbg_impl); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const _Tp& __x = _Tp()) { -#else - iterator insert(iterator __pos, const _Tp& __x) { -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) ); - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { -# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsListIterator; - typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsListConstIterator; - typedef typename _Lor2<_IsListIterator, _IsListConstIterator>::_Ret _DoCheck; -# endif - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck())) - _M_non_dbg_impl.insert(__pos._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } -#else - void insert(iterator __pos, const _Tp* __first, const _Tp* __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); - } - - void insert(iterator __pos, - const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck())) - _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); - } -#endif - - void insert(iterator __pos, size_type __n, const _Tp& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); - } - - void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); } - void pop_back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _Invalidate_iterator(end()); - _M_non_dbg_impl.pop_back(); - } - - void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); } - void pop_front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _Invalidate_iterator(begin()); - _M_non_dbg_impl.pop_front(); - } - - iterator erase(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _Invalidate_iterator(__pos); - return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator)); - } - iterator erase(iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _Invalidate_iterators(__first, __last); - return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const _Tp& __x = _Tp()) { -#else - void resize(size_type __new_size, const _Tp& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _Base_iterator __i = _M_non_dbg_impl.begin(); - size_type __len = 0; - for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len); - - if (__len == __new_size) - erase(iterator(&_M_iter_list, __i), end()); - else // __i == end() - _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x); - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) { - _M_check_assign(__n); - _M_non_dbg_impl.assign(__n, __val); - } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) { - size_type __len = distance(__first, __last); - _M_check_assign(__len); - _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } - -public: - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#else - void assign(const _Tp* __first, const _Tp* __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _M_non_dbg_impl.assign(__first, __last); - } - - void assign(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); - } -#endif - -private: - void _M_check_assign(size_type __n) { - size_type __size = size(); - if (__n < __size) { - iterator __it = begin(); - advance(__it, __n + 1); - _Invalidate_iterators(__it, end()); - } - } - -public: - void assign(size_type __n, const _Tp& __val) { - _M_check_assign(__n); - _M_non_dbg_impl.assign(__n, __val); - } - - void remove(const _Tp& __x) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - while (__first != __last) { - _Base_iterator __next = __first; - ++__next; - if (__x == *__first) { - _Invalidate_iterator(iterator(&_M_iter_list, __first)); - _M_non_dbg_impl.erase(__first); - } - __first = __next; - } - } - - void clear() { - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.clear(); - } - -public: - void splice(iterator __pos, _Self& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl); -#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) - if (get_allocator() == __x.get_allocator()) - __x._M_iter_list._Set_owner(_M_iter_list); - else -#endif - // Std: 23.2.2.4:4 - // end iterator is not invalidated: - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - - void splice(iterator __pos, _Self& __x, iterator __i) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i)) - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator); -#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) - if (get_allocator() == __x.get_allocator()) - _STLP_PRIV __change_ite_owner(__i, &_M_iter_list); - else -#endif - // Std: 23.2.2.4:7 - __x._Invalidate_iterator(__i); - } - - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end())) - _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true) -#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) - if (this->get_allocator() == __x.get_allocator()) - _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); - else -#endif - // Std: 23.2.2.4:12 - __x._Invalidate_iterators(__first, __last); - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator); - } - - void merge(_Self& __x) { -#if !defined (_STLP_NO_EXTENSIONS) - _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator)) - _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator)) -#endif - _M_non_dbg_impl.merge(__x._M_non_dbg_impl); - if (this->get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - void reverse() { - _M_non_dbg_impl.reverse(); - } - void unique() { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - if (__first == __last) return; - _Base_iterator __next = __first; - while (++__next != __last) { - if (*__first == *__next) { - _Invalidate_iterator(iterator(&_M_iter_list, __next)); - _M_non_dbg_impl.erase(__next); - } - else - __first = __next; - __next = __first; - } - } - void sort() { - _M_non_dbg_impl.sort(); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void remove_if(_Predicate __pred) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - while (__first != __last) { - _Base_iterator __next = __first; - ++__next; - if (__pred(*__first)) { - _Invalidate_iterator(iterator(&_M_iter_list, __first)); - _M_non_dbg_impl.erase(__first); - } - __first = __next; - } - } - - template - void unique(_BinaryPredicate __binary_pred) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - if (__first == __last) return; - _Base_iterator __next = __first; - while (++__next != __last) { - if (__binary_pred(*__first, *__next)) { - _Invalidate_iterator(iterator(&_M_iter_list, __next)); - _M_non_dbg_impl.erase(__next); - } - else - __first = __next; - __next = __first; - } - } - - template - void merge(_Self& __x, _StrictWeakOrdering __comp) { -#if !defined (_STLP_NO_EXTENSIONS) - _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp)) - _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp)) -#endif - _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp); - if (this->get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - - template - void sort(_StrictWeakOrdering __comp) { - _M_non_dbg_impl.sort(__comp); - } -#endif -}; - - -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_LIST - -#endif /* _STLP_INTERNAL_LIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_slist.h b/SDK/stlport/stl/debug/_slist.h deleted file mode 100644 index ef570666..00000000 --- a/SDK/stlport/stl/debug/_slist.h +++ /dev/null @@ -1,612 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_SLIST_H -#define _STLP_INTERNAL_DBG_SLIST_H - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc> - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _Tp* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&) -{ return (_Tp*)0; } - -template -inline forward_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&) -{ return forward_iterator_tag(); } -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -/* - * slist special debug traits version. - */ -template -struct _SlistDbgTraits : _Traits { - typedef _SlistDbgTraits _ConstTraits; - typedef _SlistDbgTraits _NonConstTraits; - - /* - * We don't want the before_begin iterator to return false at _Dereferenceable - * call to do not break the current debug framework but calling * operator should - * fail. - */ - template - static bool _Check(const _Iterator& __it) - { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); } -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -template -class slist : -#if !defined (__DMC__) - private -#endif - _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - , public __stlport_class > -#endif -{ -private: - typedef _STLP_NON_DBG_SLIST _Base; - typedef slist<_Tp,_Alloc> _Self; - typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck; - -public: - - __IMPORT_CONTAINER_TYPEDEFS(_Base) - - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits > > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits > > const_iterator; - - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } -private: - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } - void _Invalidate_iterators(const iterator& __first, const iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - - typedef typename _Base::iterator _Base_iterator; - -public: - explicit slist(const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(size_type __n, const value_type& __x = _Tp(), -#else - slist(size_type __n, const value_type& __x, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - slist(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because _M_insert_after_range - // already does them. - template - slist(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), - _M_iter_list(&_M_non_dbg_impl) {} -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - slist(_InputIterator __first, _InputIterator __last) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), - _M_iter_list(&_M_non_dbg_impl) {} -# endif -#else - - slist(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first, __last, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - slist(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type() ) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), - _M_iter_list(&_M_non_dbg_impl) {} -#endif - - slist(const _Self& __x) : - _ConstructCheck(__x), - _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} - - _Self& operator= (const _Self& __x) { - if (this != &__x) { - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl = __x._M_non_dbg_impl; - } - return *this; - } - - ~slist() {} - - void assign(size_type __n, const value_type& __val) { - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.assign(__n, __val); - } - - iterator before_begin() - { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); } - const_iterator before_begin() const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); } - - iterator begin() - { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator begin() const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());} - - iterator end() - { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator end() const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - bool empty() const { return _M_non_dbg_impl.empty(); } - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - - void swap(_Self& __x) { - _M_iter_list._Swap_owners(__x._M_iter_list); - _M_non_dbg_impl.swap(__x._M_non_dbg_impl); - } - - reference front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return _M_non_dbg_impl.front(); - } - const_reference front() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return _M_non_dbg_impl.front(); - } - void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); } - void pop_front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _M_non_dbg_impl.pop_front(); - } - iterator previous(const_iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator)); - } - const_iterator previous(const_iterator __pos) const { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator)); - } - -public: - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos, const value_type& __x = _Tp()) { -#else - iterator insert_after(iterator __pos, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos) { - return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert_after(iterator __pos, size_type __n, const value_type& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } -#else - void assign(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); - } - void assign(const value_type *__first, const value_type *__last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.assign(__first, __last); - } -#endif - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert_after(iterator __pos, _InIter __first, _InIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _M_non_dbg_impl.insert_after(__pos._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } - - template - void insert(iterator __pos, _InIter __first, _InIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _M_non_dbg_impl.insert(__pos._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } -#else - void insert_after(iterator __pos, - const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator); - } - void insert_after(iterator __pos, - const value_type* __first, const value_type* __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last); - } - - void insert(iterator __pos, const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); - } - void insert(iterator __pos, const value_type* __first, - const value_type* __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) - _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); - } -#endif - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos, const value_type& __x = _Tp()) { -#else - iterator insert(iterator __pos, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos) { - return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); - } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); - } - -public: - iterator erase_after(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - iterator __tmp = __pos; ++__tmp; - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp)) - _Invalidate_iterator(__tmp); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator)); - } - iterator erase_after(iterator __before_first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end())) - iterator __tmp = __before_first; ++__tmp; - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp)) - _Invalidate_iterators(__tmp, __last); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator)); - } - - iterator erase(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Invalidate_iterator(__pos); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); - } - iterator erase(iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _Invalidate_iterators(__first, __last); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _Tp()) { -#else - void resize(size_type __new_size, const value_type& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _M_non_dbg_impl.resize(__new_size, __x); - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void clear() { - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.clear(); - } - -public: - // Removes all of the elements from the list __x to *this, inserting - // them immediately after __pos. __x must not be *this. Complexity: - // linear in __x.size(). - void splice_after(iterator __pos, _Self& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT) - _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl); - if (get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - - // Moves the element that follows __prev to *this, inserting it immediately - // after __pos. This is constant time. - void splice_after(iterator __pos, _Self& __x, iterator __prev) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev)) - iterator __elem = __prev; ++__elem; - _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator); - if (get_allocator() == __x.get_allocator()) { - _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list); - } - else { - __x._Invalidate_iterator(__elem); - } - } - - // Moves the range [__before_first + 1, __before_last + 1) to *this, - // inserting it immediately after __pos. This is constant time. - void splice_after(iterator __pos, _Self& __x, - iterator __before_first, iterator __before_last) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first)) - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first)) - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last)) - iterator __first = __before_first; ++__first; - iterator __last = __before_last; ++__last; - if (get_allocator() == __x.get_allocator()) { - _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); - } - else { - __x._Invalidate_iterators(__first, __last); - } - _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, - __before_first._M_iterator, __before_last._M_iterator); - } - - // Linear in distance(begin(), __pos), and linear in __x.size(). - void splice(iterator __pos, _Self& __x) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT) - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl); - if (get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - - // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). - void splice(iterator __pos, _Self& __x, iterator __i) { - //__pos should be owned by *this and not be the before_begin iterator - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - //__i should be dereferenceable, not before_begin and be owned by __x - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i)) - _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT) - if (get_allocator() == __x.get_allocator()) { - _STLP_PRIV __change_ite_owner(__i, &_M_iter_list); - } - else { - __x._Invalidate_iterator(__i); - } - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator); - } - - // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), - // and in distance(__first, __last). - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) - //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end())) - if (get_allocator() == __x.get_allocator()) { - _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); - } - else { - __x._Invalidate_iterators(__first, __last); - } - _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, - __first._M_iterator, __last._M_iterator); - } - - void reverse() - { _M_non_dbg_impl.reverse(); } - - void remove(const value_type& __val) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - while (__first != __last) { - _Base_iterator __next = __first; - ++__next; - if (__val == *__first) { - _Invalidate_iterator(iterator(&_M_iter_list, __first)); - _M_non_dbg_impl.erase(__first); - } - __first = __next; - } - } - void unique() { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - if (__first == __last) return; - _Base_iterator __next = __first; - while (++__next != __last) { - if (*__first == *__next) { - _Invalidate_iterator(iterator(&_M_iter_list, __next)); - _M_non_dbg_impl.erase(__next); - } - else - __first = __next; - __next = __first; - } - } - void merge(_Self& __x) { - _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) -#if !defined (_STLP_NO_EXTENSIONS) - /* comments below due to bug in GCC compilers: ones eat all memory and die if see - * something like namespace_name::func_name() - ptr - */ - _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end())) - _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator)) -#endif - _M_non_dbg_impl.merge(__x._M_non_dbg_impl); - if (get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - void sort() { - _M_non_dbg_impl.sort(); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void remove_if(_Predicate __pred) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - while (__first != __last) { - _Base_iterator __next = __first; - ++__next; - if (__pred(*__first)) { - _Invalidate_iterator(iterator(&_M_iter_list, __first)); - _M_non_dbg_impl.erase(__first); - } - __first = __next; - } - } - - template - void unique(_BinaryPredicate __pred) { - _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); - if (__first == __last) return; - _Base_iterator __next = __first; - while (++__next != __last) { - if (__binary_pred(*__first, *__next)) { - _Invalidate_iterator(iterator(&_M_iter_list, __next)); - _M_non_dbg_impl.erase(__next); - } - else - __first = __next; - __next = __first; - } - } - - template - void merge(_Self& __x, _StrictWeakOrdering __ord) { - _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) -#if !defined (_STLP_NO_EXTENSIONS) - /* comments below due to bug in GCC compilers: ones eat all memory and die if see - * something like namespace_name::func_name() - ptr - */ - _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord)) - _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord)) -#endif - _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord); - if (get_allocator() == __x.get_allocator()) { - __x._M_iter_list._Set_owner(_M_iter_list); - } - else { - __x._Invalidate_iterators(__x.begin(), __x.end()); - } - } - - template - void sort(_StrictWeakOrdering __comp) - { _M_non_dbg_impl.sort(__comp); } -#endif -}; - -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_SLIST - -#endif /* _STLP_INTERNAL_DBG_SLIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_string.h b/SDK/stlport/stl/debug/_string.h deleted file mode 100644 index 62adc63b..00000000 --- a/SDK/stlport/stl/debug/_string.h +++ /dev/null @@ -1,866 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -#ifndef _STLP_DBG_STRING_H -#define _STLP_DBG_STRING_H - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str) -#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc> - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _CharT* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&) -{ return (_CharT*)0; } -template -inline random_access_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&) -{ return random_access_iterator_tag(); } -#endif - -template -class basic_string : -#if !defined (__DMC__) - private -#else - public -#endif - _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) - , public __stlport_class > -#endif -{ -protected: - typedef _STLP_NON_DBG_STRING _Base; - typedef basic_string<_CharT, _Traits, _Alloc> _Self; - typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck; - typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD; - -public: - __IMPORT_CONTAINER_TYPEDEFS(_Base) - typedef typename _Base::traits_type traits_type; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -public: // Constructor, destructor, assignment. - typedef typename _Base::_Reserve_t _Reserve_t; - -private: - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - - void _Invalidate_all() - { _M_iter_list._Invalidate_all(); } - void _Compare_Capacity (size_type __old_capacity) { - if (this->capacity() > __old_capacity) { - _Invalidate_all(); - } - } - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } - void _Invalidate_iterators(const iterator& __f, const iterator& __l) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); } - -public: -#include - - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - - explicit basic_string(const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(_Reserve_t __r, size_t __n, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(const _Self& __s) - : _ConstructCheck(__s), - _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(const _Self& __s, size_type __pos, size_type __n = npos, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(const _CharT* __s, size_type __n, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(const _CharT* __s, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__s), - _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(size_type __n, _CharT __c, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {} - - basic_string(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - -#if !defined (_STLP_MEMBER_TEMPLATES) || defined(__MRC__) || defined(__SC__) - basic_string(const _CharT* __f, const _CharT* __l, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__f, __l), - _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) { - } - basic_string(const_iterator __f, const_iterator __l, - const allocator_type & __a = allocator_type()) - : _ConstructCheck(__f, __l), - _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) { - } -#else - template - basic_string(_InputIterator __f, _InputIterator __l, - const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) - : _ConstructCheck(__f, __l), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a), - _M_iter_list(&_M_non_dbg_impl) {} -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - basic_string(_InputIterator __f, _InputIterator __l) - : _ConstructCheck(__f, __l), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)), - _M_iter_list(&_M_non_dbg_impl) {} -# endif -#endif - -private: - // constructor from non-debug version for substr - basic_string (const _Base& __x) - : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {} - -public: - _Self& operator=(const _Self& __s) { - if (this != &__s) { - assign(__s); - } - return *this; - } - - _Self& operator=(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return assign(__s); - } - - _Self& operator=(_CharT __c) { - return assign(1, __c); - } - - // Iterators. - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - // Size, capacity, etc. - size_type size() const { return _M_non_dbg_impl.size(); } - size_type length() const { return _M_non_dbg_impl.length(); } - size_t max_size() const { return _M_non_dbg_impl.max_size(); } - - void resize(size_type __n, _CharT __c) { - if (__n > capacity()) - _Invalidate_all(); - else if (__n < size()) - _Invalidate_iterators(begin() + __n, end()); - _M_non_dbg_impl.resize(__n, __c); - } - void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); } - size_type capacity() const { return _M_non_dbg_impl.capacity(); } - - void reserve(size_type __s = 0) { - if (__s > capacity()) _Invalidate_all(); - _M_non_dbg_impl.reserve(__s); - } - - void clear() { - _Invalidate_all(); - _M_non_dbg_impl.clear(); - } - - bool empty() const { return _M_non_dbg_impl.empty(); } - - const_reference operator[](size_type __n) const { - _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS); - return _M_non_dbg_impl[__n]; - } - - reference operator[](size_type __n) { - _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS) - return _M_non_dbg_impl[__n]; - } - - const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } - reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } - - // Append, operator+=, push_back. - _Self& operator+=(const _Self& __s) { return append(__s); } - _Self& operator+=(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return append(__s); - } - _Self& operator+=(_CharT __c) { return append(1, __c); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - _Self& append(_InputIter __first, _InputIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - _Compare_Capacity(__old_capacity); - return *this; - } -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - _Self& append(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__f, __l); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& append(const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator); - _Compare_Capacity(__old_capacity); - return *this; - } -#endif - - _Self& append(const _Self& __s) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__s._M_non_dbg_impl); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& append(const _Self& __s, size_type __pos, size_type __n) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& append(const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__s, __n); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& append(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.append(__s); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& append(size_type __n, _CharT __c) { - size_type __old_capacity = this->capacity(); - _M_non_dbg_impl.append(__n, __c); - _Compare_Capacity(__old_capacity); - return *this; - } - - void push_back(_CharT __c) { - size_type __old_capacity = this->capacity(); - _M_non_dbg_impl.push_back(__c); - _Compare_Capacity(__old_capacity); - } - - void pop_back() { - _Invalidate_iterator(this->end()); - _M_non_dbg_impl.pop_back(); - } - - // Assign -private: - void _M_check_assign(size_type __n) { - if (__n > capacity()) { - _Invalidate_all(); - } - else if (__n < size()) { - _Invalidate_iterators(begin() + __n, end()); - } - } - -public: - _Self& assign(const _Self& __s) { - _M_check_assign(__s.size()); - _M_non_dbg_impl.assign(__s._M_non_dbg_impl); - return *this; - } - - _Self& assign(const _Self& __s, size_type __pos, size_type __n) { - if (__pos < __s.size()) { - _M_check_assign((min) (__n, __s.size() - __pos)); - } - _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n); - return *this; - } - - _Self& assign(const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - _M_check_assign((min) (_Traits::length(__s), __n)); - _M_non_dbg_impl.assign(__s, __s + __n); - return *this; - } - - _Self& assign(const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - _M_check_assign(_Traits::length(__s)); - _M_non_dbg_impl.assign(__s); - return *this; - } - - _Self& assign(size_type __n, _CharT __c) { - _M_check_assign(__n); - _M_non_dbg_impl.assign(__n, __c); - return *this; - } - -#if defined(_STLP_MEMBER_TEMPLATES) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { - _M_check_assign(__n); - _M_non_dbg_impl.assign((size_type)__n, (_CharT)__x); - } - - template - void _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { - _M_check_assign(distance(__f, __l)); - _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); - } -public: - template - inline _Self& assign(_InputIter __first, _InputIter __last) { - _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - typedef typename _IsIntegral<_InputIter>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - return *this; - } -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - _Self& assign(const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) - _M_check_assign(distance(__f, __l)); - _M_non_dbg_impl.assign(__f, __l); - return *this; - } - _Self& assign(const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - _M_check_assign(distance(__f, __l)); - _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator); - return *this; - } -#endif - - // Insert - _Self& insert(size_type __pos, const _Self& __s) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& insert(size_type __pos, const _Self& __s, - size_type __beg, size_type __n) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos, __s, __n); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& insert(size_type __pos, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return insert(__pos, __s, _Traits::length(__s)); - } - - _Self& insert(size_type __pos, size_type __n, _CharT __c) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos, __n, __c); - _Compare_Capacity(__old_capacity); - return *this; - } - - iterator insert(iterator __p, _CharT __c) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) - size_type __old_capacity = capacity(); - typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c); - _Compare_Capacity(__old_capacity); - return iterator(&_M_iter_list, __ret); - } - - void insert(iterator __p, size_t __n, _CharT __c) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__p._M_iterator, __n, __c); - _Compare_Capacity(__old_capacity); - } - -#if defined (_STLP_MEMBER_TEMPLATES) -private: - template - void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last, - const __true_type& /*_IsIterator*/) - { _M_non_dbg_impl.insert(__p._M_iterator, __first._M_iterator, __last._M_iterator); } - - template - void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last, - const __false_type& /*_IsIterator*/) { - _M_non_dbg_impl.insert(__p._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } - -public: - template - void insert(iterator __p, _InputIter __first, _InputIter __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) - - /* In debug mode we are encapsulating non debug string iterators in debug one. - * Doing so the non debug implementation will not check for self insertion - * (x.insert(x.begin(), x.begin(), x.end()). To avoid this problem we try to - * guess when _InputIter is iterator or const_iterator and in this case call - * the non debug insert method with non debug string iterator. - */ - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator; - - size_type __old_capacity = this->capacity(); - _M_insert_aux(__p, __first, __last, _IsIterator()); - _Compare_Capacity(__old_capacity); - } -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - void insert(iterator __p, const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator); - _Compare_Capacity(__old_capacity); - } - void insert(iterator __p, const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__p._M_iterator, __f, __l); - _Compare_Capacity(__old_capacity); - } -#endif - - // Erase. - _Self& erase(size_type __pos = 0, size_type __n = npos) { - if (__pos < size()) { - _Invalidate_iterators(begin() + __pos, end()); - } - _M_non_dbg_impl.erase(__pos, __n); - return *this; - } - iterator erase(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) - _Invalidate_iterators(__pos, end()); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); - } - iterator erase(iterator __f, iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) - _Invalidate_iterators(__f, end()); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator)); - } - - // Substring. - _Self substr(size_type __pos = 0, size_type __n = npos) const - { return _M_non_dbg_impl.substr(__pos, __n); } - - // Replace. (Conceptually equivalent to erase followed by insert.) - _Self& replace(size_type __pos, size_type __n, const _Self& __s) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, - size_type __pos2, size_type __n2) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__pos, __n1, __s, __n2); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__pos, __n1, __s); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__pos, __n1, __n2, __c); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(iterator __f, iterator __l, const _Self& __s) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(iterator __f, iterator __l, const _CharT* __s) { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c); - _Compare_Capacity(__old_capacity); - return *this; - } - -#if defined (_STLP_MEMBER_TEMPLATES) -private: - template - void _M_replace_aux(iterator __first, iterator __last, - _RandomIter __f, _RandomIter __l, __true_type const& /*_IsIterator*/) - { _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f._M_iterator, __l._M_iterator); } - - template - void _M_replace_aux(iterator __first, iterator __last, - _InputIter __f, _InputIter __l, __false_type const& /*_IsIterator*/) { - _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); - } - -public: - template - _Self& replace(iterator __first, iterator __last, - _InputIter __f, _InputIter __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - - /* See insert comment for reson of iterator detection. - */ - typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator; - typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator; - - size_type __old_capacity = capacity(); - _M_replace_aux(__first, __last, __f, __l, _IsIterator()); - _Compare_Capacity(__old_capacity); - return *this; - } -#endif - -#if !defined (_STLP_MEMBER_TEMPLATES) || \ - !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) - _Self& replace(iterator __first, iterator __last, - const_iterator __f, const_iterator __l) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, - __f._M_iterator, __l._M_iterator); - _Compare_Capacity(__old_capacity); - return *this; - } - - _Self& replace(iterator __first, iterator __last, - const _CharT* __f, const _CharT* __l) { - _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l); - _Compare_Capacity(__old_capacity); - return *this; - } -#endif - - // Other modifier member functions. - void swap(_Self& __s) { - _M_iter_list._Swap_owners(__s._M_iter_list); - _M_non_dbg_impl.swap(__s._M_non_dbg_impl); - } - - int compare(const _Self& __s) const - { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); } - int compare(size_type __pos, size_type __n, const _Self& __s) const - { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); } - int compare(size_type __pos1, size_type __n1, const _Self& __s, - size_type __pos2, size_type __n2) const - { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); } - int compare(const _CharT* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return _M_non_dbg_impl.compare(__s); - } - int compare(size_type __pos, size_type __n, const _CharT* __s) const { - _STLP_FIX_LITERAL_BUG(__s) - return _M_non_dbg_impl.compare(__pos, __n, __s); - } - int compare(size_type __pos1, size_type __n1, const _CharT* __s, - size_type __n2) const { - _STLP_FIX_LITERAL_BUG(__s) - return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2); - } - - // Helper functions for compare. - static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, - const _CharT* __f2, const _CharT* __l2) - { return _Base::_M_compare(__f1, __l1, __f2, __l2); } - static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, - const _CharT* __f2, const _CharT* __l2) - { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); } - static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, - const_iterator __f2, const_iterator __l2) - { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); } - static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, - const_iterator __f2, const_iterator __l2) - { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); } - - const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); } - const _CharT* data() const { return _M_non_dbg_impl.data(); } - - size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const - { return _M_non_dbg_impl.copy(__s, __n, __pos); } - - // find. - size_type find(const _Self& __s, size_type __pos = 0) const - { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); } - size_type find(const _CharT* __s, size_type __pos = 0) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find(__s, __pos); - } - size_type find(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find(__s, __pos, __n); - } - // WIE: Versant schema compiler 5.2.2 ICE workaround - size_type find(_CharT __c) const { return find(__c, 0); } - size_type find(_CharT __c, size_type __pos /* = 0 */) const - { return _M_non_dbg_impl.find(__c, __pos); } - - // rfind. - size_type rfind(const _Self& __s, size_type __pos = npos) const - { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); } - size_type rfind(const _CharT* __s, size_type __pos = npos) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.rfind(__s, __pos); - } - size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.rfind(__s, __pos, __n); - } - size_type rfind(_CharT __c, size_type __pos = npos) const - { return _M_non_dbg_impl.rfind(__c, __pos); } - - // find_first_of - size_type find_first_of(const _Self& __s, size_type __pos = 0) const - { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); } - size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_first_of(__s, __pos); - } - size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_first_of(__s, __pos, __n); - } - size_type find_first_of(_CharT __c, size_type __pos = 0) const - { return _M_non_dbg_impl.find_first_of(__c, __pos); } - - // find_last_of - size_type find_last_of(const _Self& __s, size_type __pos = npos) const - { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); } - size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_last_of(__s, __pos); - } - size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_last_of(__s, __pos, __n); - } - size_type find_last_of(_CharT __c, size_type __pos = npos) const - { return _M_non_dbg_impl.rfind(__c, __pos); } - - // find_first_not_of - size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const - { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); } - size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_first_not_of(__s, __pos); - } - size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n); - } - size_type find_first_not_of(_CharT __c, size_type __pos = 0) const - { return _M_non_dbg_impl.find_first_not_of(__c, __pos); } - - // find_last_not_of - size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const - { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); } - size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_last_not_of(__s, __pos); - } - size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { - _STLP_FIX_LITERAL_BUG(__s) - _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) - return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n); - } - size_type find_last_not_of(_CharT __c, size_type __pos = npos) const - { return _M_non_dbg_impl.find_last_not_of(__c, __pos); } - -#if defined (_STLP_USE_TEMPLATE_EXPRESSION) -# include -#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ -}; - -// This is a hook to instantiate STLport exports in a designated DLL -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -_STLP_MOVE_TO_PRIV_NAMESPACE -_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME , allocator > >; -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; -# if defined (_STLP_HAS_WCHAR_T) -_STLP_MOVE_TO_PRIV_NAMESPACE -_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME , allocator > >; -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; -# endif -#endif /* _STLP_USE_TEMPLATE_EXPORT */ - -#undef _STLP_NON_DBG_STRING -#undef _STLP_NON_DBG_STRING_NAME - -#if !defined (_STLP_STATIC_CONST_INIT_BUG) -# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) -template -const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0; -# else -template -const size_t basic_string<_CharT, _Traits, _Alloc>::npos; -# endif -#endif - -#if defined (basic_string) -_STLP_MOVE_TO_STD_NAMESPACE -#undef basic_string -#endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_DBG_STRING */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_string_sum_methods.h b/SDK/stlport/stl/debug/_string_sum_methods.h deleted file mode 100644 index 3fca1948..00000000 --- a/SDK/stlport/stl/debug/_string_sum_methods.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* - * All the necessary methods used for template expressions with basic_string - * This file do not have to be macro guarded as it is only used in the _string.h - * file and it is a part of the basic_string definition. - */ - - template - basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) - : _M_non_dbg_impl(_Reserve_t(), __s.size(), __s.get_allocator()), - _M_iter_list(&_M_non_dbg_impl) - { _M_append_sum(__s, _M_non_dbg_impl); } - - template - basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - size_type __pos, size_type __n = npos, - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a), - _M_iter_list(&_M_non_dbg_impl) { - size_type __size = __s.size(); - if (__pos > __size) - //This call will generate the necessary out of range exception: - _M_non_dbg_impl.at(0); - else - _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos), _M_non_dbg_impl); - } - -private: - _Base& _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str) - { return __str += __c.getValue(); } - _Base& _M_append_fast(_CharT const* __s, size_type __s_size, _Base &__str) - { return __str.append(__s, __s_size); } - _Base& _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str) - { return _M_append_fast(__s.c_str(), __s.size(), __str); } - _Base& _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str) - { return _M_append_fast(__s.b_str(), __str); } - _Base& _M_append_fast(_Self const& __s, _Base &__str) - { return _M_append_fast(__s.data(), __s.size(), __str); } - _Base& _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str) - { return __str; } - template - _Base& _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _Base &__str) - { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __str)); } - - _Base& _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str, size_type /*__pos*/, size_type __n) { - if (__n == 0) - return __str; - return __str += __c.getValue(); - } - _Base& _M_append_fast_pos(_CharT const* __s, size_type __s_size, _Base &__str, - size_type __pos, size_type __n) - { return __str.append(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos)); } - _Base& _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str, - size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.c_str(), __s.size(), __str, __pos, __n); } - _Base& _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str, - size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.b_str(), __str, __pos, __n); } - _Base& _M_append_fast_pos(_Self const& __s, _Base &__str, size_type __pos, size_type __n) - { return _M_append_fast_pos(__s.data(), __s.size(), __str, __pos, __n); } - _Base& _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str, - size_type /*__pos*/, size_type /*__n*/) - { return __str; } - - template - _Base& _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - _Base &__str, size_type __pos, size_type __n) { - if (__n == 0) { - return __str; - } - size_type __lhs_size = __s.getLhs().size(); - if (__pos < __lhs_size) { - if (__n < (__lhs_size - __pos)) { - return _M_append_fast_pos(__s.getLhs(), __str, __pos, __n); - } else { - return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __str, __pos, __n), - 0, __n - (__lhs_size - __pos)); - } - } else { - return _M_append_fast_pos(__s.getRhs(), __str, __pos - __lhs_size, __n); - } - } - - template - _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - _Base &__impl) { - _M_append_fast(__s, __impl); - return *this; - } - - template - _Self& _M_append_sum_pos (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, - size_type __pos, size_type __n, _Base &__impl) { - _M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (min) (__s.size() - __pos, __n)); - _M_append_fast_pos(__s, __impl, __pos, __n); - return *this; - } diff --git a/SDK/stlport/stl/debug/_tree.h b/SDK/stlport/stl/debug/_tree.h deleted file mode 100644 index 3ebb410b..00000000 --- a/SDK/stlport/stl/debug/_tree.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_TREE_H -#define _STLP_INTERNAL_DBG_TREE_H - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -#ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -#endif - -#ifndef _STLP_INTERNAL_ALLOC_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -class _DbgCompare { -public: - _DbgCompare() {} - _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {} - _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {} - -#if !defined (_STLP_USE_CONTAINERS_EXTENSION) - bool operator () (const _Key& __lhs, const _Key& __rhs) const { -#else - template - bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const { -#endif - if (_M_non_dbg_cmp(__lhs, __rhs)) { - _STLP_VERBOSE_ASSERT(!_M_non_dbg_cmp(__rhs, __lhs), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) - return true; - } - return false; - } - - _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; } -private: - _Compare _M_non_dbg_cmp; -}; - -#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc> - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -_STLP_MOVE_TO_STD_NAMESPACE -template -inline _Value* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&) -{ return (_Value*)0; } -template -inline bidirectional_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&) -{ return bidirectional_iterator_tag(); } -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -class _Rb_tree { - typedef _STLP_NON_DBG_TREE _Base; - typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self; - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - -public: - __IMPORT_CONTAINER_TYPEDEFS(_Base) - typedef typename _Base::key_type key_type; - - typedef typename _Traits::_NonConstTraits _NonConstIteTraits; - typedef typename _Traits::_ConstTraits _ConstIteTraits; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator; - typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator; - - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - -private: - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); } - void _Invalidate_iterators(const iterator& __first, const iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - - typedef typename _Base::iterator _Base_iterator; - typedef typename _Base::const_iterator _Base_const_iterator; - -public: - _Rb_tree() - : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {} - _Rb_tree(const _Compare& __comp) - : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {} - _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {} - _Rb_tree(const _Self& __x) - : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} - - _Rb_tree(__move_source<_Self> src): - _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - - ~_Rb_tree() {} - - _Self& operator=(const _Self& __x) { - if (this != &__x) { - //Should not invalidate end iterator: - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl = __x._M_non_dbg_impl; - } - return *this; - } - - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); } - - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - bool empty() const { return _M_non_dbg_impl.empty(); } - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); } - - void swap(_Self& __t) { - _M_non_dbg_impl.swap(__t._M_non_dbg_impl); - _M_iter_list._Swap_owners(__t._M_iter_list); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __k) - { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __k) const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) - { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); } - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) - { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const - { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) { - return pair(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)), - iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x))); - } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const { - return pair(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)), - const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x))); - } - - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range_unique(const _KT& __x) { - _STLP_STD::pair<_Base_iterator, _Base_iterator> __p; - __p = _M_non_dbg_impl.equal_range_unique(__x); - return pair(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second)); - } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range_unique(const _KT& __x) const { - _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p; - __p = _M_non_dbg_impl.equal_range_unique(__x); - return pair(const_iterator(&_M_iter_list, __p.first), - const_iterator(&_M_iter_list, __p.second)); - } - - pair insert_unique(const value_type& __x) { - _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x); - return pair(iterator(&_M_iter_list, __res.first), __res.second); - } - iterator insert_equal(const value_type& __x) - { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); } - - iterator insert_unique(iterator __pos, const value_type& __x) { - _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos)) - return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x)); - } - iterator insert_equal(iterator __pos, const value_type& __x) { - _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos)) - return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x)); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert_equal(_InputIterator __first, _InputIterator __last) { - _STLP_DEBUG_CHECK(__check_range(__first,__last)) - _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } - template - void insert_unique(_InputIterator __first, _InputIterator __last) { - _STLP_DEBUG_CHECK(__check_range(__first,__last)) - _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - } -#else - void insert_unique(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(__check_range(__first,__last)) - _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator); - } - void insert_unique(const value_type* __first, const value_type* __last) { - _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last)) - _M_non_dbg_impl.insert_unique(__first, __last); - } - void insert_equal(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(__check_range(__first,__last)) - _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator); - } - void insert_equal(const value_type* __first, const value_type* __last) { - _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last)) - _M_non_dbg_impl.insert_equal(__first, __last); - } -#endif - - void erase(iterator __pos) { - _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos)) - _STLP_DEBUG_CHECK(_Dereferenceable(__pos)) - _Invalidate_iterator(__pos); - _M_non_dbg_impl.erase(__pos._M_iterator); - } - size_type erase(const key_type& __x) { - pair<_Base_iterator,_Base_iterator> __p = _M_non_dbg_impl.equal_range(__x); - size_type __n = distance(__p.first, __p.second); - _Invalidate_iterators(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second)); - _M_non_dbg_impl.erase(__p.first, __p.second); - return __n; - } - size_type erase_unique(const key_type& __x) { - _Base_iterator __i = _M_non_dbg_impl.find(__x); - if (__i != _M_non_dbg_impl.end()) { - _Invalidate_iterator(iterator(&_M_iter_list, __i)); - _M_non_dbg_impl.erase(__i); - return 1; - } - return 0; - } - - void erase(iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end())) - _Invalidate_iterators(__first, __last); - _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator); - } - void erase(const key_type* __first, const key_type* __last) { - while (__first != __last) erase(*__first++); - } - - void clear() { - //should not invalidate end: - _Invalidate_iterators(begin(), end()); - _M_non_dbg_impl.clear(); - } -}; - -_STLP_MOVE_TO_STD_NAMESPACE -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_TREE - -#endif /* _STLP_INTERNAL_DBG_TREE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/debug/_vector.h b/SDK/stlport/stl/debug/_vector.h deleted file mode 100644 index 171b764d..00000000 --- a/SDK/stlport/stl/debug/_vector.h +++ /dev/null @@ -1,449 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_INTERNAL_DBG_VECTOR_H -#define _STLP_INTERNAL_DBG_VECTOR_H - -#ifndef _STLP_DBG_ITERATOR_H -# include -#endif - -#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc> - -_STLP_BEGIN_NAMESPACE - -#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) -template -inline _Tp* -value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&) -{ return (_Tp*)0; } -template -inline random_access_iterator_tag -iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&) -{ return random_access_iterator_tag(); } -#endif - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _Vector_const_traits; - -template -struct _Vector_nonconst_traits { - typedef _Nonconst_traits<_Tp> _BaseT; - typedef _Tp value_type; - typedef _Tp& reference; - typedef _Tp* pointer; - typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits; - typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits; -}; - -template -struct _Vector_const_traits { - typedef _Const_traits<_Tp> _BaseT; - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits; - typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits; -}; - -_STLP_TEMPLATE_NULL -struct _Vector_nonconst_traits { - typedef _Bit_iterator::value_type value_type; - typedef _Bit_iterator::reference reference; - typedef _Bit_iterator::pointer pointer; - typedef _Vector_const_traits _ConstTraits; - typedef _Vector_nonconst_traits _NonConstTraits; -}; - -_STLP_TEMPLATE_NULL -struct _Vector_const_traits { - typedef _Bit_const_iterator::value_type value_type; - typedef _Bit_const_iterator::reference reference; - typedef _Bit_const_iterator::pointer pointer; - typedef _Vector_const_traits _ConstTraits; - typedef _Vector_nonconst_traits _NonConstTraits; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -template -class vector : -#if !defined (__DMC__) - private -#endif - _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR > -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - , public __stlport_class > -#endif -{ -private: - typedef _STLP_NON_DBG_VECTOR _Base; - typedef vector<_Tp, _Alloc> _Self; - typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck; - _Base _M_non_dbg_impl; - _STLP_PRIV __owned_list _M_iter_list; - -public: - __IMPORT_CONTAINER_TYPEDEFS(_Base) - - typedef _STLP_PRIV _DBG_iter<_Base, - _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits > > iterator; - - typedef _STLP_PRIV _DBG_iter<_Base, - _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits > > const_iterator; - -private: - void _Invalidate_all() - { _M_iter_list._Invalidate_all(); } - void _Invalidate_iterator(const iterator& __it) - { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } - void _Invalidate_iterators(const iterator& __first, const iterator& __last) - { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } - - void _Check_Overflow(size_type __nb) { - if (size() + __nb > capacity()) - _Invalidate_all(); - } - void _Compare_Capacity (size_type __old_capacity) { - if (capacity() > __old_capacity) { - _Invalidate_all(); - } - } - -public: - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - - allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } - - iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } - iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - size_type size() const { return _M_non_dbg_impl.size(); } - size_type max_size() const { return _M_non_dbg_impl.max_size(); } - size_type capacity() const { return _M_non_dbg_impl.capacity(); } - bool empty() const { return _M_non_dbg_impl.empty(); } - - reference operator[](size_type __n) { - _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) - return _M_non_dbg_impl[__n]; - } - - const_reference operator[](size_type __n) const { - _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) - return _M_non_dbg_impl[__n]; - } - - reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } - const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } - - explicit vector(const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit vector(size_type __n, const _Tp& __x = _Tp(), -#else - vector(size_type __n, const _Tp& __x, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit vector(size_type __n) - : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - vector(const _Self& __x) - : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} - - vector(__move_source<_Self> src) - : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), - _M_iter_list(&_M_non_dbg_impl) { -#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) - src.get()._M_iter_list._Invalidate_all(); -#else - src.get()._M_iter_list._Set_owner(_M_iter_list); -#endif - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), - _M_iter_list(&_M_non_dbg_impl) {} - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - vector(_InputIterator __first, _InputIterator __last) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), - _M_iter_list(&_M_non_dbg_impl) {} -# endif -#else - vector(const _Tp* __first, const _Tp* __last, - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a), - _M_iter_list(&_M_non_dbg_impl) {} - - // mysterious VC++ bug ? - vector(const_iterator __first, const_iterator __last , - const allocator_type& __a = allocator_type()) - : _ConstructCheck(__first, __last), - _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), - _M_iter_list(&_M_non_dbg_impl) {} -#endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator=(const _Self& __x) { - if (this != &__x) { - _Invalidate_all(); - _M_non_dbg_impl = __x._M_non_dbg_impl; - } - return *this; - } - - void reserve(size_type __n) { - if (capacity() < __n) - _Invalidate_all(); - _M_non_dbg_impl.reserve(__n); - } - - reference front() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - const_reference front() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *begin(); - } - reference back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - const_reference back() const { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - return *(--end()); - } - - void swap(_Self& __x) { - _M_iter_list._Swap_owners(__x._M_iter_list); - _M_non_dbg_impl.swap(__x._M_non_dbg_impl); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos, const _Tp& __x = _Tp()) { -#else - iterator insert(iterator __pos, const _Tp& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Check_Overflow(1); - return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); - } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos) - { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) - // Check whether it's an integral type. If so, it's not an iterator. - template - void insert(iterator __pos, - _InputIterator __first, _InputIterator __last) { - typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator; - typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator; - typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck; - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - //Sequence requirements 23.1.1 Table 67: - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck())); - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos._M_iterator, - _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - _Compare_Capacity(__old_capacity); - } -#else - void insert (iterator __pos, - const value_type *__first, const value_type *__last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); - _Compare_Capacity(__old_capacity); - } - - void insert(iterator __pos, - const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - //Sequence requirements 23.1.1 Table 67: - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type())); - size_type __old_capacity = capacity(); - _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); - _Compare_Capacity(__old_capacity); -} -#endif - - void insert (iterator __pos, size_type __n, const _Tp& __x){ - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Check_Overflow(__n); - _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); - } - - void pop_back() { - _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) - _Invalidate_iterator(end()); - _M_non_dbg_impl.pop_back(); - } - iterator erase(iterator __pos) { - _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) - _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) - _Invalidate_iterators(__pos, end()); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); - } - iterator erase(iterator __first, iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) - _Invalidate_iterators(__first, end()); - return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); - } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { -#else - void resize(size_type __new_size, const _Tp& __x) { -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - if (__new_size > capacity()) { - _Invalidate_all(); - } - else if (__new_size < size()) { - _Invalidate_iterators(begin() + __new_size, end()); - } - _M_non_dbg_impl.resize(__new_size, __x); - } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type& /*_IsIntegral*/) { - _M_check_assign(__n); - _M_non_dbg_impl.assign(__n, __val); - } - - template - void _M_assign_dispatch(_InputIter __first, _InputIter __last, - const __false_type& /*_IsIntegral*/) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) - size_type __old_size = size(); - size_type __old_capacity = capacity(); - iterator __old_end = end(); - _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); - if (__old_capacity != 0) { - if (empty() || (capacity() > __old_capacity)) { - _Invalidate_all(); - } - else if (size() < __old_size) { - _Invalidate_iterators(begin() + size(), __old_end); - } - } - } - -public: - template - void assign(_InputIterator __first, _InputIterator __last) { - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); - } -#else -private: - void _M_assign(const value_type *__first, const value_type *__last) { - size_type __len = distance(__first, __last); - _M_check_assign(__len); - _M_non_dbg_impl.assign(__first, __last); - } -public: - void assign(const value_type *__first, const value_type *__last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last)) - _M_assign(__first, __last); - } - - void assign(const_iterator __first, const_iterator __last) { - _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) - _M_assign(__first._M_iterator, __last._M_iterator); - } -#endif - -private: - void _M_check_assign(size_type __n) { - if (__n > capacity()) { - _Invalidate_all(); - } - else if (__n < size()) { - _Invalidate_iterators(begin() + __n, end()); - } - } - -public: - void assign(size_type __n, const _Tp& __val) { - _M_check_assign(__n); - _M_non_dbg_impl.assign(__n, __val); - } - - void clear() { - _Invalidate_all(); - _M_non_dbg_impl.clear(); - } - void push_back(const _Tp& __x) { - _Check_Overflow(1); - _M_non_dbg_impl.push_back(__x); - } -}; - -_STLP_END_NAMESPACE - -#undef _STLP_NON_DBG_VECTOR - -#endif /* _STLP_DBG_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/msl_string.h b/SDK/stlport/stl/msl_string.h deleted file mode 100644 index 962768cc..00000000 --- a/SDK/stlport/stl/msl_string.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1998 - * Mark of the Unicorn, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Mark of the Unicorn, Inc. makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ ) -#define _STLP_MSL_STRING_H_ - -//# define char_traits __msl_char_traits -# define basic_string __msl_basic_string -# define b_str_ref __msl_b_str_ref -# define basic_istream __msl_basic_istream -# define basic_ostream __msl_basic_ostream -# define string __msl_string -# define wstring __msl_wstring -# define iterator_traits __msl_iterator_traits - -namespace std -{ - template class basic_istream; - template class basic_ostream; -} - -# include _STLP_NATIVE_HEADER(string) -// # undef char_traits -# undef basic_string -# undef b_str_ref -# undef basic_istream -# undef basic_ostream -# undef string -# undef wstring -# undef iterator_traits - -#endif diff --git a/SDK/stlport/stl/pointers/_deque.h b/SDK/stlport/stl/pointers/_deque.h deleted file mode 100644 index a2c27746..00000000 --- a/SDK/stlport/stl/pointers/_deque.h +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2004 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_SPECIALIZED_DEQUE_H -#define _STLP_SPECIALIZED_DEQUE_H - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE -_STLP_MOVE_TO_PRIV_NAMESPACE - -/* - * struct helper to cast deque iterators: - */ -template -struct _DequeIteCast { - typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator; - typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator; - typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator; - typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator; - typedef _CastTraits<_StorageT, _ValueT> cast_traits; - - static iterator to_value_type_ite (storage_iterator const& __ite) { - iterator tmp; - tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur); - tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first); - tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last); - tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node); - return tmp; - } - static storage_iterator to_storage_type_ite (iterator const& __ite) { - storage_iterator tmp; - tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur); - tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first); - tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last); - tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node); - return tmp; - } - - static const_iterator to_value_type_cite (const_storage_iterator const& __ite) { - const_iterator tmp; - tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur); - tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first); - tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last); - tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node); - return tmp; - } - - static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) { - const_storage_iterator tmp; - tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur); - tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first); - tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last); - tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node); - return tmp; - } -}; - -#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque) - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; -_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator >; -_STLP_EXPORT_TEMPLATE_CLASS _Deque_base >; -_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL >; -#endif - -#if defined (_STLP_DEBUG) -# define deque _STLP_NON_DBG_NAME(deque) -#else -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template -class deque -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque) - : public __stlport_class > -#endif -{ - typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; - typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base; - typedef deque<_Tp, _Alloc> _Self; - - typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; - typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits; - -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag _Iterator_category; - _STLP_FORCE_ALLOCATORS(value_type, _Alloc) - typedef typename _Alloc_traits::allocator_type allocator_type; - typedef _STLP_PRIV _Deque_iterator > iterator; - typedef _STLP_PRIV _Deque_iterator > const_iterator; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - -public: // Basic accessors - iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); } - iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); } - const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); } - const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const - { return const_reverse_iterator(begin()); } - - reference operator[](size_type __n) - { return cast_traits::to_value_type_ref(_M_impl[__n]); } - const_reference operator[](size_type __n) const - { return cast_traits::to_value_type_cref(_M_impl[__n]); } - - reference at(size_type __n) - { return cast_traits::to_value_type_ref(_M_impl.at(__n)); } - const_reference at(size_type __n) const - { return cast_traits::to_value_type_cref(_M_impl.at(__n)); } - - reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); } - reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); } - const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); } - const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); } - - size_type size() const { return _M_impl.size(); } - size_type max_size() const { return _M_impl.max_size(); } - bool empty() const { return _M_impl.empty(); } - allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } - - explicit deque(const allocator_type& __a = allocator_type()) - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - - deque(const _Self& __x) : _M_impl(__x._M_impl) {} - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), -#else - deque(size_type __n, const value_type& __val, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - // int,long variants may be needed -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - explicit deque(size_type __n) : _M_impl(__n) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) - template - deque(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) -#if !defined (_STLP_USE_ITERATOR_WRAPPER) - : _M_impl(__first, __last, - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { -#else - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { -#endif -#if defined (_STLP_USE_ITERATOR_WRAPPER) - insert(end(), __first, __last); -#endif - } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - deque(_InputIterator __first, _InputIterator __last) -# if !defined (_STLP_USE_ITERATOR_WRAPPER) - : _M_impl(__first, __last) {} -# else - { insert(end(), __first, __last); } -# endif -# endif - -#else - deque(const_pointer __first, const_pointer __last, - const allocator_type& __a = allocator_type() ) - : _M_impl(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - - deque(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type() ) - : _M_impl(ite_cast_traits::to_storage_type_cite(__first), - ite_cast_traits::to_storage_type_cite(__last), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} -#endif /* _STLP_MEMBER_TEMPLATES */ - - deque(__move_source<_Self> src) - : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} - - _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } - - void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } - - void assign(size_type __n, const value_type& __val) { - _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); - } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type&) - { _M_impl.assign(__n, __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - template - void assign(_InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); -# else - _M_impl.assign(__first, __last); -# endif - } -#else - void assign(const_pointer __first, const_pointer __last) - { _M_impl.assign(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); } - void assign(const_iterator __first, const_iterator __last) - { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first), - ite_cast_traits::to_storage_type_cite(__last)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void push_back(const value_type& __t) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void push_front(const value_type& __t) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); } - -# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - void push_back() { _M_impl.push_back(); } - void push_front() { _M_impl.push_front(); } -# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void pop_back() { _M_impl.pop_back(); } - void pop_front() { _M_impl.pop_front(); } - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - iterator insert(iterator __pos, const value_type& __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), - cast_traits::to_storage_type_cref(__x))); } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) - { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - const __true_type&) { - _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); -# else - _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last); -# endif - } - -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __pos, - const_pointer __first, const_pointer __last) { - _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), - cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - void insert(iterator __pos, - const_iterator __first, const_iterator __last) { - _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), - ite_cast_traits::to_storage_type_cite(__first), - ite_cast_traits::to_storage_type_cite(__last)); - } - -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void resize(size_type __new_size, const value_type& __x) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { _M_impl.resize(__new_size); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - iterator erase(iterator __pos) - { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); } - - iterator erase(iterator __first, iterator __last) - { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first), - ite_cast_traits::to_storage_type_ite(__last))); } - void clear() { _M_impl.clear(); } - -private: - _Base _M_impl; -}; - -#if defined (deque) -# undef deque -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#undef DEQUE_IMPL - -_STLP_END_NAMESPACE - -#endif /* _STLP_SPECIALIZED_DEQUE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/pointers/_list.h b/SDK/stlport/stl/pointers/_list.h deleted file mode 100644 index 441b11d4..00000000 --- a/SDK/stlport/stl/pointers/_list.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_PTR_SPECIALIZED_LIST_H -#define _STLP_PTR_SPECIALIZED_LIST_H - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define LIST_IMPL _STLP_PTR_IMPL_NAME(list) - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) - -_STLP_MOVE_TO_PRIV_NAMESPACE - -_STLP_EXPORT_TEMPLATE_CLASS _List_node; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node >; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node, allocator<_List_node > >; -_STLP_EXPORT_TEMPLATE_CLASS _List_base >; -_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL >; - -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#if defined (_STLP_DEBUG) -# define list _STLP_NON_DBG_NAME(list) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -class list -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list) - : public __stlport_class > -#endif -{ - typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; - typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base; - typedef typename _Base::iterator _BaseIte; - typedef typename _Base::const_iterator _BaseConstIte; - typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; - typedef list<_Tp, _Alloc> _Self; - -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - _STLP_FORCE_ALLOCATORS(value_type, _Alloc) - typedef typename _Alloc_traits::allocator_type allocator_type; - typedef bidirectional_iterator_tag _Iterator_category; - - typedef _STLP_PRIV _List_iterator > iterator; - typedef _STLP_PRIV _List_iterator > const_iterator; - - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } - -# if !(defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))) - explicit -# endif - list(const allocator_type& __a = allocator_type()) - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), -#else - list(size_type __n, const value_type& __val, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_impl(__n, cast_traits::to_storage_type_cref(__val), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit list(size_type __n) - : _M_impl(__n) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) - template - list(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) -# if !defined (_STLP_USE_ITERATOR_WRAPPER) - : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} -# else - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { - insert(begin(), __first, __last); - } -# endif - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - list(_InputIterator __first, _InputIterator __last) -# if !defined (_STLP_USE_WRAPPER_ITERATOR) - : _M_impl(__first, __last) {} -# else - { insert(begin(), __first, __last); } -# endif -# endif - -#else /* _STLP_MEMBER_TEMPLATES */ - - list(const value_type *__first, const value_type *__last, - const allocator_type& __a = allocator_type()) - : _M_impl(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - list(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#endif /* _STLP_MEMBER_TEMPLATES */ - - list(const _Self& __x) : _M_impl(__x._M_impl) {} - - list(__move_source<_Self> src) - : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} - - iterator begin() { return iterator(_M_impl.begin()._M_node); } - const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); } - - iterator end() { return iterator(_M_impl.end()._M_node); } - const_iterator end() const { return const_iterator(_M_impl.end()._M_node); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - bool empty() const { return _M_impl.empty(); } - size_type size() const { return _M_impl.size(); } - size_type max_size() const { return _M_impl.max_size(); } - - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(--end()); } - const_reference back() const { return *(--end()); } - - void swap(_Self &__x) { _M_impl.swap(__x._M_impl); } - void clear() { _M_impl.clear(); } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - iterator insert(iterator __pos, const_reference __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { return iterator(_M_impl.insert(_BaseIte(__pos._M_node), - cast_traits::to_storage_type_cref(__x))._M_node); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - const __true_type&) - { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.insert(_BaseIte(__pos._M_node), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); -# else - _M_impl.insert(_BaseIte(__pos._M_node), __first, __last); -# endif - } -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __pos, const value_type *__first, const value_type *__last) - { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); } - void insert(iterator __pos, const_iterator __first, const_iterator __last) - { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - void insert(iterator __pos, size_type __n, const value_type& __x) - { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } - - void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); } - void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); } - -#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); } - void push_front() { _M_impl.push_front();} - void push_back() { _M_impl.push_back();} -# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - iterator erase(iterator __pos) - { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); } - iterator erase(iterator __first, iterator __last) - { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void resize(size_type __new_size) { _M_impl.resize(__new_size); } - void resize(size_type __new_size, const value_type& __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ - {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));} - - void pop_front() { _M_impl.pop_front(); } - void pop_back() { _M_impl.pop_back(); } - - _Self& operator=(const _Self& __x) - { _M_impl = __x._M_impl; return *this; } - void assign(size_type __n, const value_type& __val) - { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&) - { _M_impl.assign(__n, __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void assign(_InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); -# else - _M_impl.assign(__first, __last); -# endif - } -#else - void assign(const value_type *__first, const value_type *__last) { - _M_impl.assign(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - void assign(const_iterator __first, const_iterator __last) - { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } -#endif - - void splice(iterator __pos, _Self& __x) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); } - void splice(iterator __pos, _Self& __x, iterator __i) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); } - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, - _BaseIte(__first._M_node), _BaseIte(__last._M_node)); } - - void remove(const_reference __val) - { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); } - void unique() { _M_impl.unique(); } - void merge(_Self& __x) { _M_impl.merge(__x._M_impl); } - void reverse() { _M_impl.reverse(); } - void sort() { _M_impl.sort(); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void remove_if(_Predicate __pred) - { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); } - template - void unique(_BinaryPredicate __bin_pred) - { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); } - - template - void merge(_Self &__x, _StrictWeakOrdering __comp) - { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } - - template - void sort(_StrictWeakOrdering __comp) - { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - -private: - _Base _M_impl; -}; - -#if defined (list) -# undef list -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#undef LIST_IMPL - -_STLP_END_NAMESPACE - -#endif /* _STLP_PTR_SPECIALIZED_LIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/pointers/_set.h b/SDK/stlport/stl/pointers/_set.h deleted file mode 100644 index 4a6fae98..00000000 --- a/SDK/stlport/stl/pointers/_set.h +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) 2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_PTR_SPECIALIZED_SET_H -#define _STLP_PTR_SPECIALIZED_SET_H - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, traits) - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -typedef _Rb_tree_node _Node; -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >; -_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base >; -# if defined (_STLP_DEBUG) -_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare >; -# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) -_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree >, void*, _Identity, - _SetTraitsT, allocator >; -# undef _Rb_tree -# endif -_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree, void*, _Identity, - _SetTraitsT, allocator >; -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -template ), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) > -class set -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes; - typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType; - typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType; - typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits; - - typedef set<_Key, _Compare, _Alloc> _Self; -public: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - -protected: - //Specific iterator traits creation - typedef _STLP_PRIV _SetTraitsT _SetTraits; - typedef _STLP_PRIV _Rb_tree, - _SetTraits, _Alloc> _Priv_Rep_type; - - typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits; - -public: - //dums: need the following public for the __move_traits framework - typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType, - _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>, - _SetStorageTraits, _StorageTypeAlloc> _Rep_type; - -private: - typedef typename _Rep_type::iterator base_iterator; - typedef typename _Rep_type::const_iterator const_base_iterator; - -public: - typedef typename _Priv_Rep_type::pointer pointer; - typedef typename _Priv_Rep_type::const_pointer const_pointer; - typedef typename _Priv_Rep_type::reference reference; - typedef typename _Priv_Rep_type::const_reference const_reference; - typedef typename _Priv_Rep_type::iterator iterator; - typedef typename _Priv_Rep_type::const_iterator const_iterator; - typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator; - typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Priv_Rep_type::size_type size_type; - typedef typename _Priv_Rep_type::difference_type difference_type; - typedef typename _Priv_Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing set - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -#if defined (_STLP_DEBUG) - static iterator _S_to_value_ite(const_base_iterator __ite) - { return iterator(__ite._Owner(), __ite._M_iterator._M_node); } - static base_iterator _S_to_storage_ite(const_iterator __ite) - { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); } -#else - static iterator _S_to_value_ite(const_base_iterator __ite) - { return iterator(__ite._M_node); } - static base_iterator _S_to_storage_ite(const_iterator __ite) - { return base_iterator(__ite._M_node); } -#endif - -public: - set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {} - explicit set(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), _StorageTypeAlloc()) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_unique(__first, __last); -# endif - } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - set(_InputIterator __first, _InputIterator __last, const _Compare& __comp) - : _M_t(__comp, _StorageTypeAlloc()) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_unique(__first, __last); -# endif - } -# endif - template - set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_unique(__first, __last); -# endif - } -#else - set(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), _StorageTypeAlloc()) { - _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - - set(const value_type* __first, const value_type* __last, - const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { - _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - - set(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), _StorageTypeAlloc()) - { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } - - set(const_iterator __first, const_iterator __last, - const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) - { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - set(const _Self& __x) : _M_t(__x._M_t) {} - - set(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - // accessors: - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return _M_t.key_comp(); } - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); } - - iterator begin() { return _S_to_value_ite(_M_t.begin()); } - iterator end() { return _S_to_value_ite(_M_t.end()); } - const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); } - const_iterator end() const { return _S_to_value_ite(_M_t.end()); } - reverse_iterator rbegin() { return reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - pair insert(const value_type& __x) { - pair ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x)); - return pair(_S_to_value_ite(ret.first), ret.second); - } - iterator insert(iterator __pos, const value_type& __x) - { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_unique(__first, __last); -# endif - } -#else - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } - void insert(const value_type* __first, const value_type* __last) { - _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } -#endif - void erase(iterator __pos) - { _M_t.erase(_S_to_storage_ite(__pos)); } - size_type erase(const key_type& __x) - { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); } - void erase(iterator __first, iterator __last) - { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } - void clear() { _M_t.clear(); } - - // set operations: - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const - { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) - { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const - { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) - { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const - { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) - { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const - { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) { - pair __ret; - __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); - return pair(_S_to_value_ite(__ret.first), - _S_to_value_ite(__ret.second)); - } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const { - pair __ret; - __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x)); - return pair(_S_to_value_ite(__ret.first), - _S_to_value_ite(__ret.second)); - } -}; - -//Specific iterator traits creation -_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, traits) - -template ), - _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) > -class multiset -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) - : public __stlport_class > -#endif -{ - typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes; - typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType; - typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType; - typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits; - - typedef multiset<_Key, _Compare, _Alloc> _Self; -public: - // typedefs: - typedef _Key key_type; - typedef _Key value_type; - typedef _Compare key_compare; - typedef _Compare value_compare; - -protected: - //Specific iterator traits creation - typedef _STLP_PRIV _MultisetTraitsT _MultisetTraits; - typedef _STLP_PRIV _Rb_tree, - _MultisetTraits, _Alloc> _Priv_Rep_type; - - typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits; -public: - //dums: need the following public for the __move_traits framework - typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType, - _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>, - _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type; - -private: - typedef typename _Rep_type::iterator base_iterator; - typedef typename _Rep_type::const_iterator const_base_iterator; - -public: - typedef typename _Priv_Rep_type::pointer pointer; - typedef typename _Priv_Rep_type::const_pointer const_pointer; - typedef typename _Priv_Rep_type::reference reference; - typedef typename _Priv_Rep_type::const_reference const_reference; - typedef typename _Priv_Rep_type::iterator iterator; - typedef typename _Priv_Rep_type::const_iterator const_iterator; - typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator; - typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator; - typedef typename _Priv_Rep_type::size_type size_type; - typedef typename _Priv_Rep_type::difference_type difference_type; - typedef typename _Priv_Rep_type::allocator_type allocator_type; - -private: - _Rep_type _M_t; // red-black tree representing multiset - _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) - -#if defined (_STLP_DEBUG) - static iterator _S_to_value_ite(const_base_iterator __ite) - { return iterator(__ite._Owner(), __ite._M_iterator._M_node); } - static base_iterator _S_to_storage_ite(const_iterator __ite) - { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); } -#else - static iterator _S_to_value_ite(const_base_iterator __ite) - { return iterator(__ite._M_node); } - static base_iterator _S_to_storage_ite(const_iterator __ite) - { return base_iterator(__ite._M_node); } -#endif - -public: - multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {} - explicit multiset(const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), _StorageTypeAlloc()) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_equal(__first, __last); -# endif - } - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp) - : _M_t(__comp, _StorageTypeAlloc()) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_equal(__first, __last); -# endif - } -# endif - template - multiset(_InputIterator __first, _InputIterator __last, - const _Compare& __comp, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_equal(__first, __last); -# endif - } - -#else - multiset(const value_type* __first, const value_type* __last) - : _M_t(_Compare(), _StorageTypeAlloc()) { - _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - - multiset(const value_type* __first, const value_type* __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { - _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - - multiset(const_iterator __first, const_iterator __last) - : _M_t(_Compare(), _StorageTypeAlloc()) - { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } - - multiset(const_iterator __first, const_iterator __last, - const _Compare& __comp, - const allocator_type& __a = allocator_type()) - : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) - { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - multiset(const _Self& __x) - : _M_t(__x._M_t) {} - - _Self& operator=(const _Self& __x) { - _M_t = __x._M_t; - return *this; - } - - multiset(__move_source<_Self> src) - : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} - - // accessors: - key_compare key_comp() const { return _M_t.key_comp(); } - value_compare value_comp() const { return _M_t.key_comp(); } - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); } - - iterator begin() { return _S_to_value_ite(_M_t.begin()); } - iterator end() { return _S_to_value_ite(_M_t.end()); } - const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); } - const_iterator end() const { return _S_to_value_ite(_M_t.end()); } - reverse_iterator rbegin() { return reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - bool empty() const { return _M_t.empty(); } - size_type size() const { return _M_t.size(); } - size_type max_size() const { return _M_t.max_size(); } - void swap(_Self& __x) { _M_t.swap(__x._M_t); } - - // insert/erase - iterator insert(const value_type& __x) - { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); } - iterator insert(iterator __pos, const value_type& __x) { - return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos), - cast_traits::to_storage_type_cref(__x))); - } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(_InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); -# else - _M_t.insert_equal(__first, __last); -# endif - } -#else - void insert(const value_type* __first, const value_type* __last) { - _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - void insert(const_iterator __first, const_iterator __last) - { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - void erase(iterator __pos) - { _M_t.erase(_S_to_storage_ite(__pos)); } - size_type erase(const key_type& __x) - { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); } - void erase(iterator __first, iterator __last) - { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } - void clear() { _M_t.clear(); } - - // multiset operations: - - _STLP_TEMPLATE_FOR_CONT_EXT - iterator find(const _KT& __x) - { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator find(const _KT& __x) const - { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - size_type count(const _KT& __x) const - { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator lower_bound(const _KT& __x) - { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator lower_bound(const _KT& __x) const - { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - iterator upper_bound(const _KT& __x) - { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - const_iterator upper_bound(const _KT& __x) const - { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) { - pair __ret; - __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); - return pair(_S_to_value_ite(__ret.first), - _S_to_value_ite(__ret.second)); - } - _STLP_TEMPLATE_FOR_CONT_EXT - pair equal_range(const _KT& __x) const { - pair __ret; - __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); - return pair(_S_to_value_ite(__ret.first), - _S_to_value_ite(__ret.second)); - } -}; - -_STLP_END_NAMESPACE - -#endif /* _STLP_PTR_SPECIALIZED_SET_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/pointers/_slist.h b/SDK/stlport/stl/pointers/_slist.h deleted file mode 100644 index 93ff2115..00000000 --- a/SDK/stlport/stl/pointers/_slist.h +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_SPECIALIZED_SLIST_H -#define _STLP_SPECIALIZED_SLIST_H - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist) - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -_STLP_MOVE_TO_PRIV_NAMESPACE - -_STLP_EXPORT_TEMPLATE_CLASS _Slist_node; -typedef _Slist_node _VoidPtrSNode; -_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >; -_STLP_EXPORT_TEMPLATE_CLASS _Slist_base >; -_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL >; - -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#if defined (_STLP_DEBUG) -# define slist _STLP_NON_DBG_NAME(slist) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -class slist -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist) - : public __stlport_class > -#endif -{ - typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; - typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base; - typedef typename _Base::iterator _BaseIte; - typedef typename _Base::const_iterator _BaseConstIte; - typedef slist<_Tp, _Alloc> _Self; - typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; - typedef _STLP_PRIV _Slist_node_base _Node_base; - -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef forward_iterator_tag _Iterator_category; - - typedef _STLP_PRIV _Slist_iterator > iterator; - typedef _STLP_PRIV _Slist_iterator > const_iterator; - - _STLP_FORCE_ALLOCATORS(value_type, _Alloc) - typedef typename _Alloc_traits::allocator_type allocator_type; - -public: - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } - - explicit slist(const allocator_type& __a = allocator_type()) - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type), -#else - slist(size_type __n, const value_type& __x, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit slist(size_type __n) : _M_impl(__n) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - -#if defined (_STLP_MEMBER_TEMPLATES) - // We don't need any dispatching tricks here, because _M_insert_after_range - // already does them. - template - slist(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) -# if !defined (_STLP_USE_ITERATOR_WRAPPER) - : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} -# else - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { - insert_after(before_begin(), __first, __last); - } -# endif -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - // VC++ needs this crazyness - template - slist(_InputIterator __first, _InputIterator __last) -# if !defined (_STLP_USE_WRAPPER_ITERATOR) - : _M_impl(__first, __last) {} -# else - { insert_after(before_begin(), __first, __last); } -# endif -# endif -#else /* _STLP_MEMBER_TEMPLATES */ - slist(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type() ) - : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - slist(const value_type* __first, const value_type* __last, - const allocator_type& __a = allocator_type()) - : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} -#endif /* _STLP_MEMBER_TEMPLATES */ - - slist(const _Self& __x) : _M_impl(__x._M_impl) {} - slist(__move_source<_Self> src) - : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} - - _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } - - void assign(size_type __n, const value_type& __val) - { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_assign_dispatch(_Integer __n, _Integer __val, - const __true_type&) - { _M_impl.assign(__n, __val); } - - template - void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void assign(_InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_assign_dispatch(__first, __last, _Integral()); -# else - _M_impl.assign(__first, __last); -# endif - } -#else - void assign(const value_type *__first, const value_type *__last) { - _M_impl.assign(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } - void assign(const_iterator __first, const_iterator __last) { - _M_impl.assign(_BaseConstIte(__first._M_node), - _BaseConstIte(__last._M_node)); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - - iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); } - const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); } - - iterator begin() { return iterator(_M_impl.begin()._M_node); } - const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));} - - iterator end() { return iterator(_M_impl.end()._M_node); } - const_iterator end() const { return iterator(_M_impl.end()._M_node); } - - size_type size() const { return _M_impl.size(); } - size_type max_size() const { return _M_impl.max_size(); } - bool empty() const { return _M_impl.empty(); } - - void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } - -public: - reference front() { return *begin(); } - const_reference front() const { return *begin(); } -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - void push_front(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void push_front(const value_type& __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); } - -# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - void push_front() { _M_impl.push_front();} -# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void pop_front() { _M_impl.pop_front(); } - - iterator previous(const_iterator __pos) - { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); } - const_iterator previous(const_iterator __pos) const - { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - iterator insert_after(iterator __pos, const value_type& __x) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node), - cast_traits::to_storage_type_cref(__x))._M_node); } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert_after(iterator __pos) - { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert_after(iterator __pos, size_type __n, const value_type& __x) - { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val, - const __true_type&) { - _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val); - } - - template - void _M_insert_after_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.insert_after(_BaseIte(__pos._M_node), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_after_dispatch(__pos, __first, __last, _Integral()); -# else - _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last); -# endif - } - -#else /* _STLP_MEMBER_TEMPLATES */ - void insert_after(iterator __pos, - const_iterator __first, const_iterator __last) - { _M_impl.insert_after(_BaseIte(__pos._M_node), - _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } - void insert_after(iterator __pos, - const value_type* __first, const value_type* __last) { - _M_impl.insert_after(_BaseIte(__pos._M_node), - cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - iterator insert(iterator __pos, const value_type& __x) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - { return iterator(_M_impl.insert(_BaseIte(__pos._M_node), - cast_traits::to_storage_type_cref(__x))._M_node); } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - iterator insert(iterator __pos) - { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void insert(iterator __pos, size_type __n, const value_type& __x) - { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } - -#if defined (_STLP_MEMBER_TEMPLATES) -# if defined (_STLP_USE_ITERATOR_WRAPPER) -private: - template - void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, - const __true_type&) { - _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); - } - - template - void _M_insert_dispatch(iterator __pos, - _InputIterator __first, _InputIterator __last, - const __false_type&) { - _M_impl.insert(_BaseIte(__pos._M_node), typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), - typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); - } - -public: -# endif - - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { -# if defined (_STLP_USE_ITERATOR_WRAPPER) - // Check whether it's an integral type. If so, it's not an iterator. - typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; - _M_insert_dispatch(__pos, __first, __last, _Integral()); -# else - _M_impl.insert(_BaseIte(__pos._M_node), __first, __last); -# endif - } - -#else /* _STLP_MEMBER_TEMPLATES */ - void insert(iterator __pos, const_iterator __first, const_iterator __last) - { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } - void insert(iterator __pos, const value_type* __first, const value_type* __last) - { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - - iterator erase_after(iterator __pos) - { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); } - iterator erase_after(iterator __before_first, iterator __last) - { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node), - _BaseIte(__last._M_node))._M_node); } - - iterator erase(iterator __pos) - { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); } - iterator erase(iterator __first, iterator __last) - { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void resize(size_type __new_size, const value_type& __x) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { _M_impl.resize(__new_size); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void clear() { _M_impl.clear(); } - - void splice_after(iterator __pos, _Self& __x, - iterator __before_first, iterator __before_last) - { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, - _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); } - void splice_after(iterator __pos, _Self& __x, iterator __prev) - { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); } - void splice_after(iterator __pos, _Self& __x) - { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); } - void splice(iterator __pos, _Self& __x) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); } - void splice(iterator __pos, _Self& __x, iterator __i) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); } - void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) - { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, - _BaseIte(__first._M_node), _BaseIte(__last._M_node)); } - - void reverse() { _M_impl.reverse(); } - - void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); } - void unique() { _M_impl.unique(); } - void merge(_Self& __x) { _M_impl.merge(__x._M_impl); } - void sort() {_M_impl.sort(); } - -#ifdef _STLP_MEMBER_TEMPLATES - template - void remove_if(_Predicate __pred) - { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); } - - template - void unique(_BinaryPredicate __pred) - { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); } - - template - void merge(_Self& __x, _StrictWeakOrdering __comp) - { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } - - template - void sort(_StrictWeakOrdering __comp) - { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } -#endif /* _STLP_MEMBER_TEMPLATES */ - -private: - _Base _M_impl; -}; - -#if defined (slist) -# undef slist -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#undef SLIST_IMPL - -_STLP_END_NAMESPACE - -#endif /* _STLP_SPECIALIZED_SLIST_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/stl/pointers/_tools.h b/SDK/stlport/stl/pointers/_tools.h deleted file mode 100644 index e02fc42a..00000000 --- a/SDK/stlport/stl/pointers/_tools.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -#define _STLP_POINTERS_SPEC_TOOLS_H - -#ifndef _STLP_TYPE_TRAITS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -//Some usefull declarations: -template struct less; - -_STLP_MOVE_TO_PRIV_NAMESPACE - -template -struct _BinaryPredWrapper; - -/* - * Since the compiler only allows at most one non-trivial - * implicit conversion we can make use of a shim class to - * be sure that functions below doesn't accept classes with - * implicit pointer conversion operators - */ -struct _ConstVolatileVoidPointerShim -{ _ConstVolatileVoidPointerShim(const volatile void*); }; - -//The dispatch functions: -struct _VoidPointerShim -{ _VoidPointerShim(void*); }; -struct _ConstVoidPointerShim -{ _ConstVoidPointerShim(const void*); }; -struct _VolatileVoidPointerShim -{ _VolatileVoidPointerShim(volatile void*); }; - -template -char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); -char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...); -char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim); - -template -char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); -char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...); -char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim); - -template -char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); -char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...); -char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim); - -template -char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); -char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...); -char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim); - -template -struct _StorageType { - typedef typename __type_traits<_Tp>::is_POD_type _PODType; - static _Tp __null_rep(); - - enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; - enum { use_const_void_ptr = (sizeof(_UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; - enum { use_volatile_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; - enum { use_const_volatile_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; - - typedef typename __select::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType; - -#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) - /* If the compiler do not support the iterator_traits structure we cannot wrap - * iterators pass to container template methods. The iterator dereferenced value - * has to be storable without any cast in the chosen storage type. To guaranty - * that the void pointer has to be correctly qualified. - */ - typedef _QualifiedType _Type; -#else - /* With iterator_traits we can wrap passed iterators and make the necessary casts. - * We can always use a simple void* storage type: - */ - typedef typename __select::_Ret _Type; -#endif -}; - -template -struct _AssocStorageTypes { - typedef _StorageType<_Tp> _StorageTypeInfo; - typedef typename _StorageTypeInfo::_Type _SType; - - //We need to also check that the comparison functor used to instanciate the assoc container - //is the default Standard less implementation: - typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess; - enum { is_default_less = __type2bool<_STLportLess>::_Ret }; - - typedef typename __select::_Ret _KeyStorageType; - enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr }; - typedef typename __select, - _Compare>::_Ret _CompareStorageType; -}; - - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -/* - * Base struct to deal with qualifiers - */ -template -struct _VoidCastTraitsAux { - typedef _QualifiedStorageT void_cv_type; - typedef _StorageT void_type; - - static void_type * uncv_ptr(void_cv_type *__ptr) - { return __ptr; } - static void_type const* uncv_cptr(void_cv_type const*__ptr) - { return __ptr; } - static void_type ** uncv_pptr(void_cv_type **__ptr) - { return __ptr; } - static void_type & uncv_ref(void_cv_type & __ref) - { return __ref; } - static void_type const& uncv_cref(void_cv_type const& __ref) - { return __ref; } - static void_cv_type* cv_ptr(void_type *__ptr) - { return __ptr; } - static void_cv_type const* cv_cptr(void_type const*__ptr) - { return __ptr; } - static void_cv_type ** cv_pptr(void_type **__ptr) - { return __ptr; } - static void_cv_type & cv_ref(void_type & __ref) - { return __ref; } - static void_cv_type const& cv_cref(void_type const& __ref) - { return __ref; } -}; - -template -struct _VoidCastTraitsAuxBase { - typedef _VoidCVType* void_cv_type; - typedef void* void_type; - - static void_type* uncv_ptr(void_cv_type *__ptr) - { return __CONST_CAST(void_type*, __ptr); } - static void_type const* uncv_cptr(void_cv_type const*__ptr) - { return __CONST_CAST(void_type const*, __ptr); } - static void_type** uncv_pptr(void_cv_type **__ptr) - { return __CONST_CAST(void_type**, __ptr); } - static void_type& uncv_ref(void_cv_type &__ref) - { return __CONST_CAST(void_type&, __ref); } - static void_type const& uncv_cref(void_cv_type const& __ptr) - { return __CONST_CAST(void_type const&, __ptr); } - // The reverse versions - static void_cv_type * cv_ptr(void_type *__ptr) - { return __CONST_CAST(void_cv_type *, __ptr); } - static void_cv_type const* cv_cptr(void_type const*__ptr) - { return __CONST_CAST(void_cv_type const*, __ptr); } - static void_cv_type ** cv_pptr(void_type **__ptr) - { return __CONST_CAST(void_cv_type**, __ptr); } - static void_cv_type & cv_ref(void_type &__ref) - { return __CONST_CAST(void_cv_type &, __ref); } - static void_cv_type const& cv_cref(void_type const& __ref) - { return __CONST_CAST(void_cv_type const&, __ref); } -}; - -_STLP_TEMPLATE_NULL -struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase -{}; -_STLP_TEMPLATE_NULL -struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase -{}; -_STLP_TEMPLATE_NULL -struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase -{}; - -template -struct _CastTraits { - typedef _ValueT value_type; - typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT; - typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits; - typedef typename cv_traits::void_type void_type; - typedef typename cv_traits::void_cv_type void_cv_type; - - static value_type * to_value_type_ptr(void_type *__ptr) - { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); } - static value_type const* to_value_type_cptr(void_type const*__ptr) - { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); } - static value_type ** to_value_type_pptr(void_type **__ptr) - { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); } - static value_type & to_value_type_ref(void_type &__ref) - { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); } - static value_type const& to_value_type_cref(void_type const& __ptr) - { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); } - // Reverse versions - static void_type * to_storage_type_ptr(value_type *__ptr) - { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); } - static void_type const* to_storage_type_cptr(value_type const*__ptr) - { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); } - static void_type ** to_storage_type_pptr(value_type **__ptr) - { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); } - static void_type const& to_storage_type_cref(value_type const& __ref) - { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); } - - //Method used to treat set container template method extension - static void_type const& to_storage_type_crefT(value_type const& __ref) - { return to_storage_type_cref(__ref); } -}; - -template -struct _CastTraits<_Tp, _Tp> { - typedef _Tp storage_type; - typedef _Tp value_type; - - static value_type * to_value_type_ptr(storage_type *__ptr) - { return __ptr; } - static value_type const* to_value_type_cptr(storage_type const*__ptr) - { return __ptr; } - static value_type ** to_value_type_pptr(storage_type **__ptr) - { return __ptr; } - static value_type & to_value_type_ref(storage_type &__ref) - { return __ref; } - static value_type const& to_value_type_cref(storage_type const&__ref) - { return __ref; } - // Reverse versions - static storage_type * to_storage_type_ptr(value_type *__ptr) - { return __ptr; } - static storage_type const* to_storage_type_cptr(value_type const*__ptr) - { return __ptr; } - static storage_type ** to_storage_type_pptr(value_type **__ptr) - { return __ptr; } - static storage_type const& to_storage_type_cref(value_type const& __ref) - { return __ref; } - - //Method used to treat set container template method extension - template - static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref) - { return __ref; } -}; - -#define _STLP_USE_ITERATOR_WRAPPER - -template -struct _IteWrapper { - typedef _CastTraits<_StorageT, _ValueT> cast_traits; - typedef iterator_traits<_Iterator> _IteTraits; - - typedef typename _IteTraits::iterator_category iterator_category; - typedef _StorageT value_type; - typedef typename _IteTraits::difference_type difference_type; - typedef value_type* pointer; - typedef value_type const& const_reference; - //This wrapper won't be used for input so to avoid surprise - //the reference type will be a const reference: - typedef const_reference reference; - - typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self; - typedef _Self _Ite; - - _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {} - - const_reference operator*() const { return cast_traits::to_storage_type_cref(*_M_ite); } - - _Self& operator= (_Self const& __rhs) { - _M_ite = __rhs._M_ite; - return *this; - } - - _Self& operator++() { - ++_M_ite; - return *this; - } - - _Self& operator--() { - --_M_ite; - return *this; - } - - _Self& operator += (difference_type __offset) { - _M_ite += __offset; - return *this; - } - difference_type operator -(_Self const& __other) const - { return _M_ite - __other._M_ite; } - - bool operator == (_Self const& __other) const - { return _M_ite == __other._M_ite; } - - bool operator != (_Self const& __other) const - { return _M_ite != __other._M_ite; } - - bool operator < (_Self const& __rhs) const - { return _M_ite < __rhs._M_ite; } - -private: - _Iterator _M_ite; -}; - -template -struct _IteWrapper<_Tp, _Tp, _Iterator> -{ typedef _Iterator _Ite; }; - -#else - -/* - * In this config the storage type is qualified in respect of the - * value_type qualification. Simple reinterpret_cast is enough. - */ -template -struct _CastTraits { - typedef _StorageT storage_type; - typedef _ValueT value_type; - - static value_type * to_value_type_ptr(storage_type *__ptr) - { return __REINTERPRET_CAST(value_type*, __ptr); } - static value_type const* to_value_type_cptr(storage_type const*__ptr) - { return __REINTERPRET_CAST(value_type const*, __ptr); } - static value_type ** to_value_type_pptr(storage_type **__ptr) - { return __REINTERPRET_CAST(value_type **, __ptr); } - static value_type & to_value_type_ref(storage_type &__ref) - { return __REINTERPRET_CAST(value_type&, __ref); } - static value_type const& to_value_type_cref(storage_type const&__ref) - { return __REINTERPRET_CAST(value_type const&, __ref); } - // Reverse versions - static storage_type * to_storage_type_ptr(value_type *__ptr) - { return __REINTERPRET_CAST(storage_type*, __ptr); } - static storage_type const* to_storage_type_cptr(value_type const*__ptr) - { return __REINTERPRET_CAST(storage_type const*, __ptr); } - static storage_type ** to_storage_type_pptr(value_type **__ptr) - { return __REINTERPRET_CAST(storage_type **, __ptr); } - static storage_type const& to_storage_type_cref(value_type const&__ref) - { return __REINTERPRET_CAST(storage_type const&, __ref); } - template - static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref) - { return __ref; } -}; - -#endif - -//Wrapper functors: -template -struct _UnaryPredWrapper { - typedef _CastTraits<_StorageT, _ValueT> cast_traits; - - _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {} - - bool operator () (_StorageT const& __ref) const - { return _M_pred(cast_traits::to_value_type_cref(__ref)); } - -private: - _UnaryPredicate _M_pred; -}; - -template -struct _BinaryPredWrapper { - typedef _CastTraits<_StorageT, _ValueT> cast_traits; - - _BinaryPredWrapper () {} - _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {} - - _BinaryPredicate get_pred() const { return _M_pred; } - - bool operator () (_StorageT const& __fst, _StorageT const& __snd) const - { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); } - - //Cast operator used to transparently access underlying predicate - //in set::key_comp() method - operator _BinaryPredicate() const - { return _M_pred; } - -private: - _BinaryPredicate _M_pred; -}; - -_STLP_MOVE_TO_STD_NAMESPACE - -_STLP_END_NAMESPACE - -#endif /* _STLP_POINTERS_SPEC_TOOLS_H */ diff --git a/SDK/stlport/stl/pointers/_vector.h b/SDK/stlport/stl/pointers/_vector.h deleted file mode 100644 index 8de4c001..00000000 --- a/SDK/stlport/stl/pointers/_vector.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2003 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* NOTE: This is an internal header file, included by other STL headers. - * You should not attempt to use it directly. - */ - -#ifndef _STLP_SPECIALIZED_VECTOR_H -#define _STLP_SPECIALIZED_VECTOR_H - -#ifndef _STLP_POINTERS_SPEC_TOOLS_H -# include -#endif - -_STLP_BEGIN_NAMESPACE - -#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector) - -#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) -_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base >; -_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL >; -#endif - -#if defined (_STLP_DEBUG) -# define vector _STLP_NON_DBG_NAME(vector) -_STLP_MOVE_TO_PRIV_NAMESPACE -#endif - -template -class vector -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector) - : public __stlport_class > -#endif -{ - /* In the vector implementation iterators are pointer which give a number - * of opportunities for optimization. To not break those optimizations - * iterators passed to template should not be wrapped for casting purpose. - * So vector implementation will always use a qualified void pointer type and - * won't use iterator wrapping. - */ - typedef typename _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType; - typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; - typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base; - typedef vector<_Tp, _Alloc> _Self; - - typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; - -public: - typedef _Tp value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef random_access_iterator_tag _Iterator_category; - - _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; - _STLP_FORCE_ALLOCATORS(value_type, _Alloc) - typedef typename _Alloc_traits::allocator_type allocator_type; - - allocator_type get_allocator() const - { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } - - iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); } - const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); } - iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); } - const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); } - - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } - - size_type size() const { return _M_impl.size(); } - size_type max_size() const { return _M_impl.max_size(); } - - size_type capacity() const { return _M_impl.capacity(); } - bool empty() const { return _M_impl.empty(); } - - reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); } - const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); } - - reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); } - const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); } - reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); } - const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); } - - reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); } - const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); } - - explicit vector(const allocator_type& __a = allocator_type()) - : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), -#else - vector(size_type __n, const value_type& __val, -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - const allocator_type& __a = allocator_type()) - : _M_impl(__n, cast_traits::to_storage_type_cref(__val), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - explicit vector(size_type __n) - : _M_impl(__n, allocator_type() ) {} -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - vector(const _Self& __x) - : _M_impl(__x._M_impl) {} - - explicit vector(__move_source<_Self> src) - : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} - -#if defined (_STLP_MEMBER_TEMPLATES) - template - vector(_InputIterator __first, _InputIterator __last, - const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL ) - : _M_impl(__first, __last, - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} - -# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) - template - vector(_InputIterator __first, _InputIterator __last) - : _M_impl(__first, __last) {} -# endif - -#else - vector(const_iterator __first, const_iterator __last, - const allocator_type& __a = allocator_type()) - : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last), - _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} -#endif /* _STLP_MEMBER_TEMPLATES */ - - _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; } - - void reserve(size_type __n) {_M_impl.reserve(__n);} - void assign(size_type __n, const value_type& __val) - { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void assign(_InputIterator __first, _InputIterator __last) - { _M_impl.assign(__first, __last); } -#else - void assign(const_iterator __first, const_iterator __last) { - _M_impl.assign(cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } -#endif /* _STLP_MEMBER_TEMPLATES */ - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void push_back(const value_type& __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - iterator insert(iterator __pos, const value_type& __x) -#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos), - cast_traits::to_storage_type_cref(__x))); } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) - void push_back() { _M_impl.push_back(); } - iterator insert(iterator __pos) - { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ - - void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } - -#if defined (_STLP_MEMBER_TEMPLATES) - template - void insert(iterator __pos, _InputIterator __first, _InputIterator __last) - { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); } -#else - void insert(iterator __pos, const_iterator __first, const_iterator __last) { - _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first), - cast_traits::to_storage_type_cptr(__last)); - } -#endif - - void insert (iterator __pos, size_type __n, const value_type& __x) { - _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x)); - } - - void pop_back() {_M_impl.pop_back();} - iterator erase(iterator __pos) - {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));} - iterator erase(iterator __first, iterator __last) { - return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first), - cast_traits::to_storage_type_ptr(__last))); - } - -#if !defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) -#else - void resize(size_type __new_size, const value_type& __x) -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); } - -#if defined(_STLP_DONT_SUP_DFLT_PARAM) - void resize(size_type __new_size) { _M_impl.resize(__new_size); } -#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ - - void clear() { _M_impl.clear(); } - -private: - _Base _M_impl; -}; - -#if defined (vector) -# undef vector -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -#undef VECTOR_IMPL - -_STLP_END_NAMESPACE - -#endif /* _STLP_SPECIALIZED_VECTOR_H */ diff --git a/SDK/stlport/stl/type_manips.h b/SDK/stlport/stl/type_manips.h deleted file mode 100644 index 21960e03..00000000 --- a/SDK/stlport/stl/type_manips.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * - * Copyright (c) 2003 - * François Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - - -#ifndef _STLP_TYPE_MANIPS_H -#define _STLP_TYPE_MANIPS_H - -_STLP_BEGIN_NAMESPACE - -struct __true_type {}; -struct __false_type {}; - -#if defined (_STLP_USE_NAMESPACES) -_STLP_MOVE_TO_PRIV_NAMESPACE -using _STLP_STD::__true_type; -using _STLP_STD::__false_type; -_STLP_MOVE_TO_STD_NAMESPACE -#endif - -//bool to type -template -struct __bool2type -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct __bool2type<1> { typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct __bool2type<0> { typedef __false_type _Ret; }; - -//type to bool -template -struct __type2bool { enum {_Ret = 1}; }; - -_STLP_TEMPLATE_NULL -struct __type2bool<__true_type> { enum {_Ret = 1}; }; - -_STLP_TEMPLATE_NULL -struct __type2bool<__false_type> { enum {_Ret = 0}; }; - -//Negation -template -struct _Not { typedef __false_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct _Not<__false_type> { typedef __true_type _Ret; }; - -// logical and of 2 predicated -template -struct _Land2 { typedef __false_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; }; - -// logical and of 3 predicated -template -struct _Land3 { typedef __false_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; }; - -//logical or of 2 predicated -template -struct _Lor2 { typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; }; - -// logical or of 3 predicated -template -struct _Lor3 { typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL -struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; }; - -//////////////////////////////////////////////////////////////////////////////// -// class template __select -// Selects one of two types based upon a boolean constant -// Invocation: __select<_Cond, T, U>::Result -// where: -// flag is a compile-time boolean constant -// T and U are types -// Result evaluates to T if flag is true, and to U otherwise. -//////////////////////////////////////////////////////////////////////////////// -// BEWARE: If the compiler do not support partial template specialization or nested template -//classes the default behavior of the __select is to consider the condition as false and so return -//the second template type!! - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __select { typedef _Tp1 _Ret; }; - -template -struct __select { typedef _Tp2 _Ret; }; - -# if defined (__BORLANDC__) -template -struct __selectT { typedef _Tp1 _Ret; }; - -template -struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; }; -# endif - -#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) -template -struct __select_aux { - template - struct _In { - typedef _Tp1 _Ret; - }; -}; - -_STLP_TEMPLATE_NULL -struct __select_aux<0> { - template - struct _In { - typedef _Tp2 _Ret; - }; -}; - -template -struct __select { - typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret; -}; -# else /* _STLP_MEMBER_TEMPLATE_CLASSES */ -//default behavior -template -struct __select { - typedef _Tp2 _Ret; -}; -# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */ - -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -#if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) -// Boris : simulation technique is used here according to Adobe Open Source License Version 1.0. -// Copyright 2000 Adobe Systems Incorporated and others. All rights reserved. -// Authors: Mat Marcus and Jesse Jones -// The original version of this source code may be found at -// http://opensource.adobe.com. - -// These are the discriminating functions -template -char _STLP_CALL _IsSameFun(bool, _Tp const volatile*, _Tp const volatile*); // no implementation is required -char* _STLP_CALL _IsSameFun(bool, ...); // no implementation is required - -template -struct _IsSame { - static _Tp1* __null_rep1(); - static _Tp2* __null_rep2(); - enum { _Ret = (sizeof(_IsSameFun(false,__null_rep1(), __null_rep2())) == sizeof(char)) }; - typedef typename __bool2type<_Ret>::_Ret _RetT; -}; - -#else - -template -struct _IsSameAux { - typedef __false_type _RetT; - enum { _Ret = 0 }; -}; - -template -struct _UnConstType { typedef _Tp _Type; }; - -template -struct _UnVolatileType { typedef _Tp _Type; }; - -template -struct _UnCVType { - typedef typename _UnVolatileType<_Tp>::_Type _UnVType; - typedef typename _UnConstType<_UnVType>::_Type _Type; -}; - -# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct _IsSameAux<_Tp, _Tp> { - typedef __true_type _RetT; - enum { _Ret = 1 }; -}; - -# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) -template -struct _UnConstType { typedef _Tp _Type; }; - -template -struct _UnVolatileType { typedef _Tp _Type; }; -# endif - -# if defined(__BORLANDC__) -template -struct _UnConstPtr { typedef _Tp _Type; }; - -template -struct _UnConstPtr<_Tp*> { typedef _Tp _Type; }; - -template -struct _UnConstPtr { typedef _Tp _Type; }; -# endif -# endif - -template -struct _IsSame { - typedef typename _UnCVType<_Tp1>::_Type _Type1; - typedef typename _UnCVType<_Tp2>::_Type _Type2; - - typedef _IsSameAux<_Type1, _Type2> _Aux; - enum { _Ret = _Aux::_Ret }; - typedef typename _Aux::_RetT _RetT; -}; -#endif - -/* - * The following struct will tell you if 2 types are the same, the limitations are: - * - it compares the types without the const or volatile qualifiers, int and const int - * will be considered as same for instance. - * - the previous remarks do not apply to pointer types, int* and int const* won't be - * considered as comparable. (int * and int *const are). - */ -template -struct _AreSameUnCVTypes { - enum { _Same = _IsSame<_Tp1, _Tp2>::_Ret }; - typedef typename _IsSame<_Tp1, _Tp2>::_RetT _Ret; -}; - -/* Rather than introducing a new macro for the following constrution we use - * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that - * is used for a similar feature. - */ -#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) -template -struct _ConversionHelper { - static char _Test(bool, _Dst); - static char* _Test(bool, ...); - static _Src _MakeSource(); -}; - -template -struct _IsConvertible { - typedef _ConversionHelper<_Src*, const volatile _Dst*> _H; - enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) }; - typedef typename __bool2type::_Ret _Ret; -}; - -/* This struct is intended to say if a pointer can be convertible to an other - * taking into account cv qualifications. It shouldn't be instanciated with - * something else than pointer type as it uses pass by value parameter that - * results in compilation error when parameter type has a special memory - * alignment - */ -template -struct _IsCVConvertible { -#if !defined (__BORLANDC__) - typedef _ConversionHelper<_Src, _Dst> _H; - enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) }; -#else - enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret }; - enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value }; - enum { value = _Is1 ? 0 : _Is2 }; -#endif - typedef typename __bool2type::_Ret _Ret; -}; - -#else -template -struct _IsConvertible { - enum {value = 0}; - typedef __false_type _Ret; -}; -#endif - -template -struct _IsConst { typedef __false_type _Ret; }; - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) -template -struct _IsConst { typedef __true_type _Ret; }; -#endif - -# if defined(__BORLANDC__) -template -struct _IsConst { typedef __true_type _Ret; }; - -template -struct _IsConst { typedef __true_type _Ret; }; -# endif - -_STLP_END_NAMESPACE - -#endif /* _STLP_TYPE_MANIPS_H */ diff --git a/SDK/stlport/stl/type_traits.h b/SDK/stlport/stl/type_traits.h deleted file mode 100644 index 37bc69f2..00000000 --- a/SDK/stlport/stl/type_traits.h +++ /dev/null @@ -1,577 +0,0 @@ -/* - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1997 - * Moscow Center for SPARC Technology - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_TYPE_TRAITS_H -#define _STLP_TYPE_TRAITS_H - -/* -This header file provides a framework for allowing compile time dispatch -based on type attributes. This is useful when writing template code. -For example, when making a copy of an array of an unknown type, it helps -to know if the type has a trivial copy constructor or not, to help decide -if a memcpy can be used. - -The class template __type_traits provides a series of typedefs each of -which is either __true_type or __false_type. The argument to -__type_traits can be any type. The typedefs within this template will -attain their correct values by one of these means: - 1. The general instantiation contain conservative values which work - for all types. - 2. Specializations may be declared to make distinctions between types. - 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers) - will automatically provide the appropriate specializations for all - types. - -EXAMPLE: - -//Copy an array of elements which have non-trivial copy constructors -template void copy(T* source, T* destination, int n, __false_type); -//Copy an array of elements which have trivial copy constructors. Use memcpy. -template void copy(T* source, T* destination, int n, __true_type); - -//Copy an array of any type by using the most efficient copy mechanism -template inline void copy(T* source,T* destination,int n) { - copy(source, destination, n, - typename __type_traits::has_trivial_copy_constructor()); -} -*/ - -#ifdef __WATCOMC__ -# include -#endif - -#ifndef _STLP_TYPE_MANIPS_H -# include -#endif - -#ifdef _STLP_USE_BOOST_SUPPORT -# include -# include -# include -#endif /* _STLP_USE_BOOST_SUPPORT */ - -_STLP_BEGIN_NAMESPACE - -#if !defined (_STLP_USE_BOOST_SUPPORT) - -// The following could be written in terms of numeric_limits. -// We're doing it separately to reduce the number of dependencies. - -template struct _IsIntegral -{ typedef __false_type _Ret; }; - -# ifndef _STLP_NO_BOOL -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; -# endif /* _STLP_NO_BOOL */ - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -# ifndef _STLP_NO_SIGNED_BUILTINS -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; -# endif - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; -# endif /* _STLP_HAS_WCHAR_T */ - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; - -# ifdef _STLP_LONG_LONG -_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG> -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsIntegral -{ typedef __true_type _Ret; }; -# endif /* _STLP_LONG_LONG */ - -template struct _IsRational -{ typedef __false_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsRational -{ typedef __true_type _Ret; }; - -_STLP_TEMPLATE_NULL struct _IsRational -{ typedef __true_type _Ret; }; - -# if !defined ( _STLP_NO_LONG_DOUBLE ) -_STLP_TEMPLATE_NULL struct _IsRational -{ typedef __true_type _Ret; }; -# endif - -// Forward declarations. -template struct __type_traits; -template struct __type_traits_aux { - typedef __false_type has_trivial_default_constructor; - typedef __false_type has_trivial_copy_constructor; - typedef __false_type has_trivial_assignment_operator; - typedef __false_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; - -_STLP_TEMPLATE_NULL -struct __type_traits_aux<__false_type> { - typedef __false_type has_trivial_default_constructor; - typedef __false_type has_trivial_copy_constructor; - typedef __false_type has_trivial_assignment_operator; - typedef __false_type has_trivial_destructor; - typedef __false_type is_POD_type; -}; - -_STLP_TEMPLATE_NULL -struct __type_traits_aux<__true_type> { - typedef __true_type has_trivial_default_constructor; - typedef __true_type has_trivial_copy_constructor; - typedef __true_type has_trivial_assignment_operator; - typedef __true_type has_trivial_destructor; - typedef __true_type is_POD_type; -}; - -template -struct _IsRef { - typedef __false_type _Ret; -}; - -# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) -/* - * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0. - * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved. - * Authors: Mat Marcus and Jesse Jones - * The original version of this source code may be found at - * http://opensource.adobe.com. - */ - -struct _PointerShim { - /* - * Since the compiler only allows at most one non-trivial - * implicit conversion we can make use of a shim class to - * be sure that IsPtr below doesn't accept classes with - * implicit pointer conversion operators - */ - _PointerShim(const volatile void*); // no implementation -}; - -// These are the discriminating functions -char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required -char* _STLP_CALL _IsP(bool, ...); // no implementation is required - -template -struct _IsPtr { - /* - * This template meta function takes a type T - * and returns true exactly when T is a pointer. - * One can imagine meta-functions discriminating on - * other criteria. - */ - static _Tp& __null_rep(); - enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) }; - typedef typename __bool2type<_Ptr>::_Ret _Ret; - -}; - -// we make general case dependant on the fact the type is actually a pointer. -template -struct __type_traits : __type_traits_aux::_Ret> {}; - -# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */ - -template struct _IsPtr { - typedef __false_type _Ret; -}; - -template -struct __type_traits { - typedef __true_type this_dummy_member_must_be_first; - /* Do not remove this member. It informs a compiler which - automatically specializes __type_traits that this - __type_traits template is special. It just makes sure that - things work if an implementation is using a template - called __type_traits for something unrelated. */ - - /* The following restrictions should be observed for the sake of - compilers which automatically produce type specific specializations - of this class: - - You may reorder the members below if you wish - - You may remove any of the members below if you wish - - You must not rename members without making the corresponding - name change in the compiler - - Members you add will be treated like regular members unless - - you add the appropriate support in the compiler. */ -# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS) - typedef __false_type has_trivial_default_constructor; - typedef __false_type has_trivial_copy_constructor; - typedef __false_type has_trivial_assignment_operator; - typedef __false_type has_trivial_destructor; - typedef __false_type is_POD_type; -# else - typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor; - typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor; - typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator; - typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor; - typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type; -# endif -}; - -# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template struct _IsPtr<_Tp*> -{ typedef __true_type _Ret; }; -template struct _IsRef<_Tp&> -{ typedef __true_type _Ret; }; - -template struct __type_traits<_Tp*> : __type_traits_aux<__true_type> -{}; -# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ - -# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */ - -// Provide some specializations. This is harmless for compilers that -// have built-in __types_traits support, and essential for compilers -// that don't. -# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) -# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \ -_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \ -_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \ -_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \ -_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {} -# else -# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \ -_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; -# endif - -# ifndef _STLP_NO_BOOL -_STLP_DEFINE_TYPE_TRAITS_FOR(bool); -# endif /* _STLP_NO_BOOL */ -_STLP_DEFINE_TYPE_TRAITS_FOR(char); -# ifndef _STLP_NO_SIGNED_BUILTINS -_STLP_DEFINE_TYPE_TRAITS_FOR(signed char); -# endif -_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char); -# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) -_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t); -# endif /* _STLP_HAS_WCHAR_T */ - -_STLP_DEFINE_TYPE_TRAITS_FOR(short); -_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short); -_STLP_DEFINE_TYPE_TRAITS_FOR(int); -_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int); -_STLP_DEFINE_TYPE_TRAITS_FOR(long); -_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long); - -# ifdef _STLP_LONG_LONG -_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG); -_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG); -# endif /* _STLP_LONG_LONG */ - -_STLP_DEFINE_TYPE_TRAITS_FOR(float); -_STLP_DEFINE_TYPE_TRAITS_FOR(double); - -# if !defined ( _STLP_NO_LONG_DOUBLE ) -_STLP_DEFINE_TYPE_TRAITS_FOR(long double); -# endif - -#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct _IsCVConvertibleIf -{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; }; - -template -struct _IsCVConvertibleIf<__false_type, _Src, _Dst> -{ typedef __false_type _Ret; }; -#else -# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) -template -struct _IsCVConvertibleIfAux { - template - struct _In - { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; }; -}; - -_STLP_TEMPLATE_NULL -struct _IsCVConvertibleIfAux<__false_type> { - template - struct _In - { typedef __false_type _Ret; }; -}; - -template -struct _IsCVConvertibleIf { - typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret; -}; -# else -/* default behavior: we prefer to miss an optimization rather than taking the risk of - * a compilation error if playing with types with exotic memory alignment. - */ -template -struct _IsCVConvertibleIf -{ typedef __false_type _Ret; }; -# endif -#endif - -template -struct _TrivialNativeTypeCopy { - typedef typename _IsPtr<_Src>::_Ret _Ptr1; - typedef typename _IsPtr<_Dst>::_Ret _Ptr2; - typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs; - typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible; - typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1; - - typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize; - - typedef typename _IsIntegral<_Src>::_Ret _Int1; - typedef typename _IsIntegral<_Dst>::_Ret _Int2; - typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts; - - typedef typename _IsRational<_Src>::_Ret _Rat1; - typedef typename _IsRational<_Dst>::_Ret _Rat2; - typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats; - - typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives; - typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2; - - typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret; -}; - -template -struct _TrivialCopy { - typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet; - -#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) - typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1; -#else - typedef typename _UnConstPtr<_Src*>::_Type _Tp3; - typedef typename __type_traits<_Tp3>::has_trivial_assignment_operator _Tr1; -#endif - typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2; - typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet; - - typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -template -struct _TrivialUCopy { - typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet; - -#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) - typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1; -#else - typedef typename _UnConstPtr<_Src*>::_Type _Tp3; - typedef typename __type_traits<_Tp3>::has_trivial_copy_constructor _Tr1; -#endif - typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2; - typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet; - - typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -template -struct _DefaultZeroValue { - typedef typename _IsIntegral<_Tp>::_Ret _Tr1; - typedef typename _IsRational<_Tp>::_Ret _Tr2; - typedef typename _IsPtr<_Tp>::_Ret _Tr3; - typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret; -}; - -template -struct _TrivialInit { -#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) - typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1; -#else - typedef typename _UnConstPtr<_Tp*>::_Type _Tp1; - typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1; -#endif - typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2; - typedef typename _Not<_Tr2>::_Ret _Tr3; - typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -#endif /* !_STLP_USE_BOOST_SUPPORT */ - -template -struct _IsPtrType { - typedef typename _IsPtr<_Tp>::_Ret _Type; - static _Type _Ret() { return _Type(); } -}; - -template -struct _IsRefType { - typedef typename _IsRef<_Tp>::_Ret _Type; - static _Type _Ret() { return _Type();} -}; - -template -struct __call_traits { -#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) - typedef typename __select< ::boost::is_reference<_Tp>::value, - _Tp, typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret param_type; -#else - typedef const _Tp& param_type; -#endif /* _STLP_USE_BOOST_SUPPORT */ -}; - -#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) -template -struct __call_traits<_Tp&> -{ typedef _Tp& param_type; }; -#endif - -template -struct _BothPtrType { - typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1; - typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2; - - typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -template -struct _OKToSwap { - typedef typename _AreSameUnCVTypes<_Tp1, _Tp2>::_Ret _Same; - typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type; - static _Type _Answer() { return _Type(); } -}; - -template -inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2> -_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&) -{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); } - -template -inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*) -{ return _TrivialCopy<_Src, _Dst>(); } - -template -inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*) -{ return _TrivialUCopy<_Src, _Dst>(); } - -template -inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*) -{ return _TrivialInit<_Tp>(); } - -template -struct _IsPOD { - typedef typename __type_traits<_Tp>::is_POD_type _Type; - static _Type _Answer() { return _Type(); } -}; - -template -inline _IsPOD<_Tp> _Is_POD(_Tp*) -{ return _IsPOD<_Tp>(); } - -template -struct _DefaultZeroValueQuestion { - typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret; - static _Ret _Answer() { return _Ret(); } -}; - -template -inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*) -{ return _DefaultZeroValueQuestion<_Tp>(); } - -/* - * Base class used: - * - to simulate partial template specialization - * - to simulate partial function ordering - * - to recognize STLport class from user specialized one - */ -template -struct __stlport_class -{ typedef _Tp _Type; }; - -template -struct _IsSTLportClass { - typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret; -#if defined (__BORLANDC__) - enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value }; -#endif -}; - -#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) -template -struct _SwapImplemented { - typedef typename _IsSTLportClass<_Tp>::_Ret _Ret; -# if defined (__BORLANDC__) - enum { _Is = _IsSTLportClass<_Tp>::_Is }; -# endif -}; -#endif - -template -class _TpWithState : private _Tp { - _TpWithState(); - int _state; -}; - -/* This is an internal helper struct used to guess if we are working - * on a stateless class. It can only be instanciated with a class type. */ -template -struct _IsStateless { - enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) }; - typedef typename __bool2type<_Is>::_Ret _Ret; -}; - -_STLP_END_NAMESPACE - -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION -# if defined (__BORLANDC__) || \ - defined (__SUNPRO_CC) || \ - (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \ - (defined (__sgi) && defined (_COMPILER_VERSION)) || \ - defined (__DMC__) -# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type() -# else -# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type() -# endif -#else -# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer() -#endif - -#endif /* _STLP_TYPE_TRAITS_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/streambuf b/SDK/stlport/streambuf deleted file mode 100644 index ead57c96..00000000 --- a/SDK/stlport/streambuf +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_STREAMBUF -#define _STLP_STREAMBUF - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1066 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# include -# include - -# if (_STLP_OUTERMOST_HEADER_ID == 0x1066) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_STREAMBUF */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/streambuf.h b/SDK/stlport/streambuf.h deleted file mode 100644 index ff2bff51..00000000 --- a/SDK/stlport/streambuf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -#ifndef _STLP_STREAMBUF_H -#define _STLP_STREAMBUF_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2067 -# include -#endif - -#include - -#include - -#include - -#ifndef _STLP_HAS_NO_NAMESPACES -# ifdef _STLP_BROKEN_USING_DIRECTIVE -_STLP_USING_NAMESPACE(stlport) -# else -using _STLP_STD::basic_streambuf; -using _STLP_STD::streambuf; -# ifndef _STLP_NO_WCHAR_T -using _STLP_STD::wstreambuf; -# endif -# endif -#endif /* _STLP_HAS_NO_NAMESPACES */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2067) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_STREAMBUF_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/string b/SDK/stlport/string deleted file mode 100644 index c53d67f4..00000000 --- a/SDK/stlport/string +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRING -# define _STLP_STRING - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x68 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#if defined (_STLP_USE_OWN_NAMESPACE) -# include -#endif - -#include - -#if !defined (_STLP_USE_NO_IOSTREAMS) -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x68) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_STRING */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/string.h b/SDK/stlport/string.h deleted file mode 100644 index 737bdb69..00000000 --- a/SDK/stlport/string.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -/* Workaround for a "misbehaviour" when compiling resource scripts using - * eMbedded Visual C++. The standard .rc file includes windows header files, - * which in turn include string.h, which results in warnings and errors - */ -#ifndef _STLP_STRING_H - -#if !defined (RC_INVOKED) - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x269 -# include -# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -# define _STLP_STRING_H -# endif - -# if defined(_STLP_WCE_EVC3) -struct _exception; -# endif -# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID) -# include _STLP_NATIVE_C_HEADER(string.h) -# else -# if defined (__BORLANDC__) -# include _STLP_NATIVE_CPP_C_HEADER(_str.h) -# else -# include _STLP_NATIVE_C_HEADER(string.h) -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x269) -# if defined (__BORLANDC__) && defined (_STLP_IMPORT_VENDOR_CSTD) -# include -# endif /* BORLAND */ -# endif -# endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x269) -# if !defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -# endif -#endif /* RC_INVOKED */ -#endif /* _STLP_STRING_H */ diff --git a/SDK/stlport/strstream b/SDK/stlport/strstream deleted file mode 100644 index 163b5cd6..00000000 --- a/SDK/stlport/strstream +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ -// WARNING: The classes defined in this header are DEPRECATED. This -// header is defined in section D.7.1 of the C++ standard, and it -// MAY BE REMOVED in a future standard revision. You should use the -// header instead. - - -#ifndef _STLP_STRSTREAM -#define _STLP_STRSTREAM - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x1070 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#ifndef _STLP_INTERNAL_STRSTREAM -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x1070) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_STRSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/strstream.h b/SDK/stlport/strstream.h deleted file mode 100644 index e302a168..00000000 --- a/SDK/stlport/strstream.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_STRSTREAM_H -# define _STLP_STRSTREAM_H - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x2071 -# include -#endif - -#include - -#include - - -#ifndef _STLP_HAS_NO_NAMESPACES - -# ifdef _STLP_BROKEN_USING_DIRECTIVE - -using namespace _STLP_STD; - -# else - -using _STLP_STD::strstreambuf; -using _STLP_STD::istrstream; -using _STLP_STD::ostrstream; -using _STLP_STD::strstream; - -# endif /* _STLP_BROKEN_USING_DIRECTIVE */ - -#endif /* _STLP_HAS_NO_NAMESPACES */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x2071) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_STRSTREAM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/time.h b/SDK/stlport/time.h deleted file mode 100644 index 8d10bfcc..00000000 --- a/SDK/stlport/time.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x272 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#ifdef _STLP_WCE_EVC3 -// only show message when directly including this file in a non-library build -# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272) -# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here") -# endif -#else -# include _STLP_NATIVE_C_HEADER(time.h) -#endif - - -#if (_STLP_OUTERMOST_HEADER_ID == 0x272) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/SDK/stlport/typeinfo b/SDK/stlport/typeinfo deleted file mode 100644 index ffa51a74..00000000 --- a/SDK/stlport/typeinfo +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_TYPEINFO - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x473 -# define _STLP_TYPEINFO -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID != 0x473) -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo) -#else -# ifndef _STLP_INTERNAL_TYPEINFO -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x473) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/typeinfo.h b/SDK/stlport/typeinfo.h deleted file mode 100644 index 1b565afc..00000000 --- a/SDK/stlport/typeinfo.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_OLDSTD_typeinfo -#define _STLP_OLDSTD_typeinfo - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x874 -# include -#endif - -#ifndef _STLP_NO_TYPEINFO - -# if defined (__GNUC__) -# undef _STLP_OLDSTD_typeinfo -# include -# define _STLP_OLDSTD_typeinfo -# else -# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580) -# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h) -# else -# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h) -# endif -# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \ - defined (__DMC__) -using std::type_info; -using std::bad_typeid; -using std::bad_cast; -# endif -# endif - -// if already included, do not import anything - -# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER)) - -_STLP_BEGIN_NAMESPACE - -using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info; -# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__))) -using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid; -# endif - -using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast; - -_STLP_END_NAMESPACE - -# endif /* _STLP_OWN_NAMESPACE */ - -#endif /* _STLP_NO_TYPEINFO */ - -#if (_STLP_OUTERMOST_HEADER_ID == 0x874) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_OLDSTD_typeinfo */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/unordered_map b/SDK/stlport/unordered_map deleted file mode 100644 index 09fa0d24..00000000 --- a/SDK/stlport/unordered_map +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004,2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_UNORDERED_MAP -#define _STLP_UNORDERED_MAP - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x4030 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x4030) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_UNORDERED_MAP */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/unordered_set b/SDK/stlport/unordered_set deleted file mode 100644 index 14de4374..00000000 --- a/SDK/stlport/unordered_set +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004,2005 - * Francois Dumont - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_UNORDERED_SET -#define _STLP_UNORDERED_SET - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x4031 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if (_STLP_OUTERMOST_HEADER_ID == 0x4031) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_UNORDERED_SET */ - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/using/cstring b/SDK/stlport/using/cstring deleted file mode 100644 index d082fab1..00000000 --- a/SDK/stlport/using/cstring +++ /dev/null @@ -1,56 +0,0 @@ -using _STLP_VENDOR_CSTD::size_t; - -#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) -# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os -# undef memcpy -# undef memmove -inline void* memcpy(void* dst, const void* src, size_t len) -{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); } -inline void* memmove(void* dst, const void* src, size_t len) -{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); } -# else -using _STLP_VENDOR_CSTD::memmove; -using _STLP_VENDOR_CSTD::memcpy; -# endif - -# if !defined (_STLP_WCE) -// these functions just don't exist on Windows CE -using _STLP_VENDOR_CSTD::strcoll; -using _STLP_VENDOR_CSTD::strerror; -using _STLP_VENDOR_CSTD::strxfrm; -# endif - -# if defined (__BORLANDC__) -extern "C++" { -# endif -using _STLP_VENDOR_CSTD::memchr; -using _STLP_VENDOR_CSTD::strchr; -using _STLP_VENDOR_CSTD::strpbrk; -using _STLP_VENDOR_CSTD::strrchr; -using _STLP_VENDOR_CSTD::strstr; -# if defined (__BORLANDC__) -} -# endif - -using _STLP_VENDOR_CSTD::memcmp; -using _STLP_VENDOR_CSTD::memset; - -using _STLP_VENDOR_CSTD::strcat; - -# if !defined (strcmp) -using _STLP_VENDOR_CSTD::strcmp; -# endif - -# if !defined (strcpy) -using _STLP_VENDOR_CSTD::strcpy; -# endif -using _STLP_VENDOR_CSTD::strcspn; -using _STLP_VENDOR_CSTD::strlen; -using _STLP_VENDOR_CSTD::strncat; -using _STLP_VENDOR_CSTD::strncmp; - -using _STLP_VENDOR_CSTD::strncpy; -using _STLP_VENDOR_CSTD::strspn; - -using _STLP_VENDOR_CSTD::strtok; -#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ diff --git a/SDK/stlport/using/export b/SDK/stlport/using/export deleted file mode 100644 index 2d3afcd9..00000000 --- a/SDK/stlport/using/export +++ /dev/null @@ -1,12 +0,0 @@ -cstring -fstream -iomanip -ios -iosfwd -iostream -istream -locale -ostream -sstream -streambuf -strstream diff --git a/SDK/stlport/using/fstream b/SDK/stlport/using/fstream deleted file mode 100644 index e79e0480..00000000 --- a/SDK/stlport/using/fstream +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef _STLP_BROKEN_USING_DIRECTIVE -using namespace _STLP_STD; -#else -using _STLP_NEW_IO_NAMESPACE::basic_filebuf; -using _STLP_NEW_IO_NAMESPACE::filebuf; -using _STLP_NEW_IO_NAMESPACE::basic_ifstream; -using _STLP_NEW_IO_NAMESPACE::basic_ofstream; -using _STLP_NEW_IO_NAMESPACE::ifstream; -using _STLP_NEW_IO_NAMESPACE::ofstream; -using _STLP_NEW_IO_NAMESPACE::basic_fstream; -using _STLP_NEW_IO_NAMESPACE::fstream; - -# ifndef _STLP_NO_WIDE_STREAMS -using _STLP_NEW_IO_NAMESPACE::wofstream; -using _STLP_NEW_IO_NAMESPACE::wfilebuf; -using _STLP_NEW_IO_NAMESPACE::wifstream; -using _STLP_NEW_IO_NAMESPACE::wfstream; -# endif -#endif diff --git a/SDK/stlport/using/h/fstream.h b/SDK/stlport/using/h/fstream.h deleted file mode 100644 index 66005689..00000000 --- a/SDK/stlport/using/h/fstream.h +++ /dev/null @@ -1,4 +0,0 @@ -using ::streambuf; -using ::ifstream; -using ::ofstream; -using ::fstream; diff --git a/SDK/stlport/using/h/iomanip.h b/SDK/stlport/using/h/iomanip.h deleted file mode 100644 index 99e48d99..00000000 --- a/SDK/stlport/using/h/iomanip.h +++ /dev/null @@ -1,6 +0,0 @@ -using ::setiosflags; -using ::resetiosflags; -// using ::setbase; -using ::setfill; -using ::setprecision; -using ::setw; diff --git a/SDK/stlport/using/h/iostream.h b/SDK/stlport/using/h/iostream.h deleted file mode 100644 index e85f4e2c..00000000 --- a/SDK/stlport/using/h/iostream.h +++ /dev/null @@ -1,24 +0,0 @@ -using _STLP_OLD_IO_NAMESPACE::istream; -using _STLP_OLD_IO_NAMESPACE::ostream; - -/* HP aCC include files re-define these when THREAD_SAFE */ -#if !defined(cin) -using _STLP_OLD_IO_NAMESPACE::cin; -#endif -#if !defined(cout) -using _STLP_OLD_IO_NAMESPACE::cout; -#endif -#if !defined(cerr) -using _STLP_OLD_IO_NAMESPACE::cerr; -#endif -#if !defined(clog) -using _STLP_OLD_IO_NAMESPACE::clog; -#endif - -using _STLP_OLD_IO_NAMESPACE::endl; -using _STLP_OLD_IO_NAMESPACE::ends; - -using _STLP_OLD_IO_NAMESPACE::ios; -using _STLP_OLD_IO_NAMESPACE::flush; - -// using _STLP_OLD_IO_NAMESPACE::ws; diff --git a/SDK/stlport/using/h/ostream.h b/SDK/stlport/using/h/ostream.h deleted file mode 100644 index 6ba3f883..00000000 --- a/SDK/stlport/using/h/ostream.h +++ /dev/null @@ -1,6 +0,0 @@ -using _STLP_OLD_IO_NAMESPACE::ostream; -using _STLP_OLD_IO_NAMESPACE::endl; -using _STLP_OLD_IO_NAMESPACE::ends; -using _STLP_OLD_IO_NAMESPACE::flush; - -// using _STLP_OLD_IO_NAMESPACE::ws; diff --git a/SDK/stlport/using/h/streambuf.h b/SDK/stlport/using/h/streambuf.h deleted file mode 100644 index 459de3db..00000000 --- a/SDK/stlport/using/h/streambuf.h +++ /dev/null @@ -1 +0,0 @@ -using ::streambuf; diff --git a/SDK/stlport/using/h/strstream.h b/SDK/stlport/using/h/strstream.h deleted file mode 100644 index a7d9f119..00000000 --- a/SDK/stlport/using/h/strstream.h +++ /dev/null @@ -1,4 +0,0 @@ -using _STLP_OLD_IO_NAMESPACE::strstreambuf; -using _STLP_OLD_IO_NAMESPACE::istrstream; -using _STLP_OLD_IO_NAMESPACE::ostrstream; -using _STLP_OLD_IO_NAMESPACE::strstream; diff --git a/SDK/stlport/using/iomanip b/SDK/stlport/using/iomanip deleted file mode 100644 index 8a7c792f..00000000 --- a/SDK/stlport/using/iomanip +++ /dev/null @@ -1,6 +0,0 @@ -using _STLP_NEW_IO_NAMESPACE::setiosflags; -using _STLP_NEW_IO_NAMESPACE::resetiosflags; -using _STLP_NEW_IO_NAMESPACE::setbase; -using _STLP_NEW_IO_NAMESPACE::setfill; -using _STLP_NEW_IO_NAMESPACE::setprecision; -using _STLP_NEW_IO_NAMESPACE::setw; diff --git a/SDK/stlport/using/ios b/SDK/stlport/using/ios deleted file mode 100644 index d89b495a..00000000 --- a/SDK/stlport/using/ios +++ /dev/null @@ -1,41 +0,0 @@ -# ifdef _STLP_BROKEN_USING_DIRECTIVE -using namespace _STLP_NEW_IO_NAMESPACE; -# else - -using _STLP_NEW_IO_NAMESPACE::ios; -using _STLP_NEW_IO_NAMESPACE::streamoff; -using _STLP_NEW_IO_NAMESPACE::streamsize; - -using _STLP_NEW_IO_NAMESPACE::ios_base; -using _STLP_NEW_IO_NAMESPACE::basic_ios; - -// _lib.std.ios.manip_, manipulators: -using _STLP_NEW_IO_NAMESPACE::boolalpha; -using _STLP_NEW_IO_NAMESPACE::noboolalpha; -using _STLP_NEW_IO_NAMESPACE::showbase; -using _STLP_NEW_IO_NAMESPACE::noshowbase; -using _STLP_NEW_IO_NAMESPACE::showpoint; -using _STLP_NEW_IO_NAMESPACE::noshowpoint; -using _STLP_NEW_IO_NAMESPACE::showpos; -using _STLP_NEW_IO_NAMESPACE::noshowpos; -using _STLP_NEW_IO_NAMESPACE::skipws; -using _STLP_NEW_IO_NAMESPACE::noskipws; -using _STLP_NEW_IO_NAMESPACE::uppercase; -using _STLP_NEW_IO_NAMESPACE::nouppercase; - -// _lib.adjustfield.manip_ adjustfield: -using _STLP_NEW_IO_NAMESPACE::internal; -using _STLP_NEW_IO_NAMESPACE::left; -using _STLP_NEW_IO_NAMESPACE::right; - -// _lib.basefield.manip_ basefield: -using _STLP_NEW_IO_NAMESPACE::dec; -using _STLP_NEW_IO_NAMESPACE::hex; -using _STLP_NEW_IO_NAMESPACE::oct; - -// _lib.floatfield.manip_ floatfield: -using _STLP_NEW_IO_NAMESPACE::fixed; -using _STLP_NEW_IO_NAMESPACE::scientific; - -# endif /* _STLP_BROKEN_USING_DIRECTIVE */ - diff --git a/SDK/stlport/using/iosfwd b/SDK/stlport/using/iosfwd deleted file mode 100644 index b564e819..00000000 --- a/SDK/stlport/using/iosfwd +++ /dev/null @@ -1,54 +0,0 @@ -# if defined (_STLP_USE_NEW_IOSTREAMS) -using _STLP_NEW_IO_NAMESPACE::char_traits; -using _STLP_NEW_IO_NAMESPACE::basic_ios; -using _STLP_NEW_IO_NAMESPACE::basic_streambuf; -using _STLP_NEW_IO_NAMESPACE::basic_istream; -using _STLP_NEW_IO_NAMESPACE::basic_ostream; -using _STLP_NEW_IO_NAMESPACE::basic_iostream; -using _STLP_NEW_IO_NAMESPACE::basic_stringbuf; -using _STLP_NEW_IO_NAMESPACE::basic_istringstream; -using _STLP_NEW_IO_NAMESPACE::basic_ostringstream; -using _STLP_NEW_IO_NAMESPACE::basic_stringstream; -using _STLP_NEW_IO_NAMESPACE::basic_filebuf; -using _STLP_NEW_IO_NAMESPACE::basic_ifstream; -using _STLP_NEW_IO_NAMESPACE::basic_ofstream; -using _STLP_NEW_IO_NAMESPACE::basic_fstream; -using _STLP_NEW_IO_NAMESPACE::fpos; -using _STLP_NEW_IO_NAMESPACE::istreambuf_iterator; -using _STLP_NEW_IO_NAMESPACE::ostreambuf_iterator; -using _STLP_NEW_IO_NAMESPACE::stringbuf; -using _STLP_NEW_IO_NAMESPACE::istringstream; -using _STLP_NEW_IO_NAMESPACE::ostringstream; -using _STLP_NEW_IO_NAMESPACE::stringstream; -# endif - -using _STLP_NEW_IO_NAMESPACE::ios; -using _STLP_NEW_IO_NAMESPACE::streambuf; -using _STLP_NEW_IO_NAMESPACE::istream; -using _STLP_NEW_IO_NAMESPACE::ostream; -using _STLP_NEW_IO_NAMESPACE::iostream; - -using _STLP_NEW_IO_NAMESPACE::filebuf; -using _STLP_NEW_IO_NAMESPACE::ifstream; -using _STLP_NEW_IO_NAMESPACE::ofstream; -using _STLP_NEW_IO_NAMESPACE::fstream; - -using _STLP_NEW_IO_NAMESPACE::streampos; -using _STLP_NEW_IO_NAMESPACE::streamoff; - -# if !defined (_STLP_NO_WIDE_STREAMS) -using _STLP_NEW_IO_NAMESPACE::wios; -using _STLP_NEW_IO_NAMESPACE::wstreambuf; -using _STLP_NEW_IO_NAMESPACE::wistream; -using _STLP_NEW_IO_NAMESPACE::wostream; -using _STLP_NEW_IO_NAMESPACE::wiostream; -using _STLP_NEW_IO_NAMESPACE::wstringbuf; -using _STLP_NEW_IO_NAMESPACE::wistringstream; -using _STLP_NEW_IO_NAMESPACE::wostringstream; -using _STLP_NEW_IO_NAMESPACE::wstringstream; -using _STLP_NEW_IO_NAMESPACE::wfilebuf; -using _STLP_NEW_IO_NAMESPACE::wifstream; -using _STLP_NEW_IO_NAMESPACE::wofstream; -using _STLP_NEW_IO_NAMESPACE::wfstream; -using _STLP_NEW_IO_NAMESPACE::wstreampos; -# endif diff --git a/SDK/stlport/using/iostream b/SDK/stlport/using/iostream deleted file mode 100644 index 6169afb2..00000000 --- a/SDK/stlport/using/iostream +++ /dev/null @@ -1,14 +0,0 @@ - -# include - -using _STLP_VENDOR_STD::cin; -using _STLP_VENDOR_STD::cout; -using _STLP_VENDOR_STD::cerr; -using _STLP_VENDOR_STD::clog; - -# if ! defined (_STLP_NO_WIDE_STREAMS) -using _STLP_VENDOR_STD::wcin; -using _STLP_VENDOR_STD::wcout; -using _STLP_VENDOR_STD::wcerr; -using _STLP_VENDOR_STD::wclog; -# endif diff --git a/SDK/stlport/using/istream b/SDK/stlport/using/istream deleted file mode 100644 index baf10d28..00000000 --- a/SDK/stlport/using/istream +++ /dev/null @@ -1,16 +0,0 @@ -# include - -using _STLP_NEW_IO_NAMESPACE::basic_istream; -using _STLP_NEW_IO_NAMESPACE::basic_iostream; - -using _STLP_NEW_IO_NAMESPACE::istream; -using _STLP_NEW_IO_NAMESPACE::iostream; - -# if !defined (_STLP_NO_NATIVE_WIDE_STREAMS) -using _STLP_NEW_IO_NAMESPACE::wistream; -using _STLP_NEW_IO_NAMESPACE::wiostream; -# endif - -#if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200)) -using _STLP_NEW_IO_NAMESPACE::ws; -#endif diff --git a/SDK/stlport/using/locale b/SDK/stlport/using/locale deleted file mode 100644 index aa99b5be..00000000 --- a/SDK/stlport/using/locale +++ /dev/null @@ -1,65 +0,0 @@ -#if !defined(_STLP_NO_IMPORT_LOCALE) - -// from -#if !defined (_STLP_NO_MBSTATE_T) -using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; -#endif - -// _lib.locale_, locale: -using _STLP_NEW_IO_NAMESPACE::locale; -using _STLP_NEW_IO_NAMESPACE::use_facet; -using _STLP_NEW_IO_NAMESPACE::has_facet; - -// _lib.locale.convenience_, convenience interfaces: -using _STLP_NEW_IO_NAMESPACE::isspace; -using _STLP_NEW_IO_NAMESPACE::isprint; -using _STLP_NEW_IO_NAMESPACE::iscntrl; -using _STLP_NEW_IO_NAMESPACE::isupper; -using _STLP_NEW_IO_NAMESPACE::islower; -using _STLP_NEW_IO_NAMESPACE::isalpha; -using _STLP_NEW_IO_NAMESPACE::isdigit; -using _STLP_NEW_IO_NAMESPACE::ispunct; -using _STLP_NEW_IO_NAMESPACE::isxdigit; -using _STLP_NEW_IO_NAMESPACE::isalnum; -using _STLP_NEW_IO_NAMESPACE::isgraph; -using _STLP_NEW_IO_NAMESPACE::toupper; -using _STLP_NEW_IO_NAMESPACE::tolower; - -// _lib.category.ctype_ and _lib.facet.ctype.special_, ctype: -using _STLP_NEW_IO_NAMESPACE::ctype_base; -using _STLP_NEW_IO_NAMESPACE::ctype; -using _STLP_NEW_IO_NAMESPACE::ctype_byname; -using _STLP_NEW_IO_NAMESPACE::codecvt_base; -using _STLP_NEW_IO_NAMESPACE::codecvt; -using _STLP_NEW_IO_NAMESPACE::codecvt_byname; - -// _lib.category.numeric_ and _lib.facet.numpunct_, numeric: -using _STLP_NEW_IO_NAMESPACE::num_get; -using _STLP_NEW_IO_NAMESPACE::num_put; -using _STLP_NEW_IO_NAMESPACE::numpunct; -using _STLP_NEW_IO_NAMESPACE::numpunct_byname; - -// _lib.category.collate_, collation: -using _STLP_NEW_IO_NAMESPACE::collate; -using _STLP_NEW_IO_NAMESPACE::collate_byname; - -// _lib.category.time_, date and time: -using _STLP_NEW_IO_NAMESPACE::time_base; -using _STLP_NEW_IO_NAMESPACE::time_get; -using _STLP_NEW_IO_NAMESPACE::time_get_byname; -using _STLP_NEW_IO_NAMESPACE::time_put; -using _STLP_NEW_IO_NAMESPACE::time_put_byname; - -// _lib.category.monetary_, money: -using _STLP_NEW_IO_NAMESPACE::money_base; -using _STLP_NEW_IO_NAMESPACE::money_get; -using _STLP_NEW_IO_NAMESPACE::money_put; -using _STLP_NEW_IO_NAMESPACE::moneypunct; -using _STLP_NEW_IO_NAMESPACE::moneypunct_byname; - -#if !defined (_STLP_OWN_IOSTREAMS) && !defined (_STLP_NO_NATIVE_MESSAGE_FACET) -using _STLP_NEW_IO_NAMESPACE::messages_base; -using _STLP_NEW_IO_NAMESPACE::messages; -using _STLP_NEW_IO_NAMESPACE::messages_byname; -#endif // _MSL_NO_MESSAGE_FACET -#endif /* !defined(_STLP_NO_IMPORT_LOCALE) */ diff --git a/SDK/stlport/using/ostream b/SDK/stlport/using/ostream deleted file mode 100644 index 162b32d8..00000000 --- a/SDK/stlport/using/ostream +++ /dev/null @@ -1,10 +0,0 @@ -using _STLP_NEW_IO_NAMESPACE::basic_ostream; -using _STLP_NEW_IO_NAMESPACE::ostream; - -# ifndef _STLP_NO_WIDE_STREAMS -using _STLP_NEW_IO_NAMESPACE::wostream; -# endif - -using _STLP_NEW_IO_NAMESPACE::endl; -using _STLP_NEW_IO_NAMESPACE::ends; -using _STLP_NEW_IO_NAMESPACE::flush; diff --git a/SDK/stlport/using/sstream b/SDK/stlport/using/sstream deleted file mode 100644 index 925c37e2..00000000 --- a/SDK/stlport/using/sstream +++ /dev/null @@ -1,16 +0,0 @@ -using _STLP_NEW_IO_NAMESPACE::basic_stringbuf; -using _STLP_NEW_IO_NAMESPACE::stringbuf; - -using _STLP_NEW_IO_NAMESPACE::basic_istringstream; -using _STLP_NEW_IO_NAMESPACE::basic_ostringstream; -using _STLP_NEW_IO_NAMESPACE::basic_stringstream; -using _STLP_NEW_IO_NAMESPACE::istringstream; -using _STLP_NEW_IO_NAMESPACE::ostringstream; -using _STLP_NEW_IO_NAMESPACE::stringstream; - -#ifndef _STLP_NO_WIDE_STREAMS -using _STLP_NEW_IO_NAMESPACE::wstringbuf; -using _STLP_NEW_IO_NAMESPACE::wistringstream; -using _STLP_NEW_IO_NAMESPACE::wostringstream; -using _STLP_NEW_IO_NAMESPACE::wstringstream; -#endif diff --git a/SDK/stlport/using/streambuf b/SDK/stlport/using/streambuf deleted file mode 100644 index 308241de..00000000 --- a/SDK/stlport/using/streambuf +++ /dev/null @@ -1,5 +0,0 @@ -using _STLP_NEW_IO_NAMESPACE::basic_streambuf; -using _STLP_NEW_IO_NAMESPACE::streambuf; -#ifndef _STLP_NO_WIDE_STREAMS -using _STLP_NEW_IO_NAMESPACE::wstreambuf; -# endif diff --git a/SDK/stlport/using/strstream b/SDK/stlport/using/strstream deleted file mode 100644 index eb26ac1f..00000000 --- a/SDK/stlport/using/strstream +++ /dev/null @@ -1,4 +0,0 @@ -using _STLP_NEW_IO_NAMESPACE::strstreambuf; -using _STLP_NEW_IO_NAMESPACE::istrstream; -using _STLP_NEW_IO_NAMESPACE::ostrstream; -using _STLP_NEW_IO_NAMESPACE::strstream; diff --git a/SDK/stlport/utility b/SDK/stlport/utility deleted file mode 100644 index 323fe1e3..00000000 --- a/SDK/stlport/utility +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_UTILITY -#define _STLP_UTILITY - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x75 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#ifndef __TYPE_TRAITS_H -# include -#endif - -#if !defined (_STLP_DEBUG_H) && (defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)) -# include -#endif - -#ifndef _STLP_INTERNAL_PAIR_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(utility) -#else -# if defined (_STLP_MSVC) && !defined (_STLP_INTERNAL_ITERATOR_H) -# include -# endif -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x75) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_UTILITY */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/valarray b/SDK/stlport/valarray deleted file mode 100644 index 3cf71f3b..00000000 --- a/SDK/stlport/valarray +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_VALARRAY -#define _STLP_VALARRAY - -#ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x76 -# include -#endif - -#ifdef _STLP_PRAGMA_ONCE -# pragma once -#endif - -#include - -#if defined (_STLP_IMPORT_VENDOR_STD) -# include _STLP_NATIVE_HEADER(valarray) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x76) -# include -# undef _STLP_OUTERMOST_HEADER_ID -#endif - -#endif /* _STLP_VALARRAY */ - - -// Local Variables: -// mode:C++ -// End: diff --git a/SDK/stlport/vector b/SDK/stlport/vector deleted file mode 100644 index 7583b9f9..00000000 --- a/SDK/stlport/vector +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#ifndef _STLP_VECTOR -#define _STLP_VECTOR - -# ifndef _STLP_OUTERMOST_HEADER_ID -# define _STLP_OUTERMOST_HEADER_ID 0x77 -# include -# endif - -# ifdef _STLP_PRAGMA_ONCE -# pragma once -# endif - -# ifndef _STLP_INTERNAL_ALGOBASE_H -# include -# endif - -#ifndef _STLP_INTERNAL_VECTOR_H -# include -#endif - -#if defined (_STLP_IMPORT_VENDOR_STD) && ! defined (_STLP_MINIMUM_IMPORT_STD) -# include _STLP_NATIVE_HEADER(vector) -#endif - -# if (_STLP_OUTERMOST_HEADER_ID == 0x77) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# endif - -#endif /* _STLP_VECTOR */ - -// Local Variables: -// mode:C++ -// End: - diff --git a/SDK/stlport/wchar.h b/SDK/stlport/wchar.h deleted file mode 100644 index 7b49c5df..00000000 --- a/SDK/stlport/wchar.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x278 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) - -# if defined (__BORLANDC__) -/* -# include -*/ -# include _STLP_NATIVE_CPP_C_HEADER(_str.h) -# ifdef __cplusplus -using _STLP_VENDOR_CSTD::strlen; -using _STLP_VENDOR_CSTD::strspn; -# endif -# endif - -# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__) -# include _STLP_NATIVE_C_HEADER(stddef.h) -# elif defined(__MWERKS__) && defined(N_PLAT_NLM) -/* - * MSL library has wrong definition of wint_t (with -wchar_t on) in wchar_t.h header. - * IMHO the best way is to comment line - * typedef wchar_t wint_t; - * (I use this way). - * - * Another solution is to define _WINT_T (to avoid conflict with wint_t definitions in - * Novell SDK headers, _WCHAR_T defined in nlm_prefix.h). But you should define one - * before include any header from Novell's SDK, so this isn't too good choice. - * - * And third solution is don't use anyware (even here) wchar_t.h - * - * - ptr, 2003 and 2005-05-07 - */ -/* -#if __option(wchar_type) -# define _WINT_T -#endif -*/ -# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h) -# include _STLP_NATIVE_C_HEADER(stddef.h) -# include _STLP_NATIVE_C_HEADER(stdio.h) -# include -int wcslen( const wchar_t *_wc ); -int wcscmp( const wchar_t *_wc1, const wchar_t *_wc2 ); -int wcsncmp( const wchar_t *_wc1, const wchar_t *_wc2, size_t n ); -wchar_t *wcsstr( const wchar_t *_wc1, const wchar_t *_wc2 ); -wchar_t *wcschr( const wchar_t *_wc1, wchar_t _wc2 ); -wchar_t *wcsrchr( const wchar_t *_wc1, wchar_t _wc2 ); -wchar_t *wcscpy( wchar_t *_wc1, const wchar_t *_wc2 ); -wchar_t *wcsncpy( wchar_t *_wc1, const wchar_t *_wc2, size_t n ); -wchar_t *wcspbrk( const wchar_t *_wc, const wchar_t *_wc2 ); -# else -# include _STLP_NATIVE_C_HEADER(wchar.h) -# endif -#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */ - -#ifndef _STLP_INTERNAL_MBSTATE_T -# include -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x278) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -/* - Local Variables: - mode:C++ - End: -*/ diff --git a/SDK/stlport/wctype.h b/SDK/stlport/wctype.h deleted file mode 100644 index 365f0d32..00000000 --- a/SDK/stlport/wctype.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1999 - * Boris Fomitchev - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - * - */ - -#if !defined (_STLP_OUTERMOST_HEADER_ID) -# define _STLP_OUTERMOST_HEADER_ID 0x279 -# include -#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID) -# define _STLP_DONT_POP_HEADER_ID -#endif - -/* evc3 doesn't have wctype.h */ -#if !defined(_STLP_WCE_EVC3) && !defined(N_PLAT_NLM) -# include _STLP_NATIVE_C_HEADER(wctype.h) -#endif - -#if (_STLP_OUTERMOST_HEADER_ID == 0x279) -# if ! defined (_STLP_DONT_POP_HEADER_ID) -# include -# undef _STLP_OUTERMOST_HEADER_ID -# else -# undef _STLP_DONT_POP_HEADER_ID -# endif -#endif - -/* Local Variables: - * mode:C++ - * End: - */ diff --git a/_docs/BugTrap/BugTrap.chm b/_docs/BugTrap/BugTrap.chm new file mode 100644 index 00000000..e3925f73 Binary files /dev/null and b/_docs/BugTrap/BugTrap.chm differ diff --git a/_docs/BugTrap/BugTrap_History.txt b/_docs/BugTrap/BugTrap_History.txt new file mode 100644 index 00000000..0c3cfca3 --- /dev/null +++ b/_docs/BugTrap/BugTrap_History.txt @@ -0,0 +1,63 @@ +This document contains a list of fixed bugs and improvements in BugTrap since version 1.2.2826.33101. + + - 1.3.3466.24114 - +[-] Fixed self-installation and de-installation of BugTrapServer as system service. + + - 1.3.3291.42976 - +[+] Added new flag BTF_DESCRIBEERROR that prompts user to briefly describe the error. User feedback is being sent along with other error details. +[+] Added new flag BTF_RESTARTAPP that allows for automatically restarting the application after the crash. +[+] Added new methods InstallSehFilter(), UninstallSehFilter() to .NET code. Now SEH filter can be controlled from managed code w/o having to use PInvoke. +[+] Added new tag to BugTrapServer configuration. This tag allows for overriding default report name. The following tokens are supported: + %n - for auto-incrementing report numbers. + %t - for inserting current time-stamp. + + - 1.3.3277.38126 - +[+] Win64 support on AMD-64 platform, including CrashExplorer. +[+] Multi-monitor support. Screenshots are generated for each monitor. +[+] Log file includes a list of host IP addresses. + + - 1.2.3248.41806 - +[+] Added new functions: BT_SaveSnapshotEx(), BT_SendSnapshotEx(), BT_MailSnapshotEx() that take existing exception info as an argument. +[+] Added new functions: BT_GetExitMode(), BT_SetExitMode() that control app. termination. + + - 1.2.3145.10 - +[+] Error log includes detailed info about inner .NET exception (e.g. if unhandled exception is caused by another exception). + + - 1.2.3139.43028 - +[-] Fixed script that is updating version numbers in multiple files. Now .NET assembly version number matches to product version. + + - 1.2.3117.43057 - +[-] BT_ReadVersionInfo() was not reading file version info due to a type in the source code. + + - 1.2.3109.33582 - +[+] CrashExplorer now saves window state and all control values in Windows registry. In future release this basic functionality will be replaced with profile manager. +[!] BugTrapN.dll got a strong name. Now it can be used by signed assemblies. + + - 1.2.3039.15982 - +[+] Added new method BT_InterceptSeuf() that allows for interception of SetUnhandledExceptionFilter() in dynamically loaded modules. + + - 1.2.3038.39610 - +[+] Added new flag BTF_INTERCEPTSEUF. When this flag is applied, BugTrap injects fake SetUnhandledExceptionFilter() and tricks C runtime library. This option allows BugTrap to handle the most severe runtime errors. +[!] Ported BugTrap projects to Visual Studio 2008 environment. +[-] Fixed a bug in a text view control, that was preventing it from synchronizing scrollbars in certain cases. + + - 1.2.2996.34503 - +[-] BugTrap opens log files and adds them to the report even if these files are not properly closed by the application. Log files have to be opened in shared read/write mode. + + - 1.2.2905.32130 - +[-] Second fix for a problem with dynamically loaded .NET assemblies, again thanks to Tom. B. + + - 1.2.2898.41669 - +[-] Fixed a bug with memory overrun in .NET layer thanks to Tom. B. +[-] Fixed a bug with dynamically loaded .NET assemblies thanks to Tom. B. + + - 1.2.2844.22583 - +[+] New log type BTLF_STREAM optimized for large text log files. Unlike BTLF_XML and BTLF_TEXT log records are not cached in memory. +[+] New example BugTrapLogTest demonstrates the usage of log functions. It could also be used as a performance test. +[!] Improved performance and thread concurrency of existing log functions. + +Legend: + +[+] - new feature +[!] - change of an existing functionality +[-] - bug fix diff --git a/_docs/BugTrap/BugTrap_ReadMe.txt b/_docs/BugTrap/BugTrap_ReadMe.txt new file mode 100644 index 00000000..7a1858ed --- /dev/null +++ b/_docs/BugTrap/BugTrap_ReadMe.txt @@ -0,0 +1,21 @@ +This folder contains all BugTrap components required for Win32 projects: +------------------------------------------------------------------------------------ +BugTrap[U][D][N][-x64].dll - BugTrap DLL module. +BugTrap[U][D][N][-x64].lib - BugTrap library file used by linker. +dbghelp.dll - DbgHelp library (see "BugTrap Developer's Guide" + for details). +BugTrap.h - Header file with BugTrap API definitions. +BTTrace.h - C++ wrapper of custom logging functions. +BTAtlWindow.h - ATL/WTL exception handlers. +BTMfcWindow.h - MFC exception handlers. +CrashExplorer.exe - MAP file analyzer. +BugTrap.chm - BugTrap 1.0 Specification. +------------------------------------------------------------------------------------ +File names may vary by the following signs: + [U] - Unicode aware version has 'U' letter. ANSI version doesn't have 'U' letter. + [D] - Debug version has 'D' letter. Release version doesn't have 'D' letter. + [N] - managed (.NET) version has 'N' letter. Native version doesn't have 'N' letter. + [-x64] - 64 bit version for AMD-64 platform has '-x64' suffix. x86 version doesn't have this suffix. + +Please see "BugTrap Developer's Guide" for additional information about file types +used by BugTrap for Win32. \ No newline at end of file diff --git a/_docs/LuaJIT/contents.html b/_docs/LuaJIT/contents.html new file mode 100644 index 00000000..94c4b315 --- /dev/null +++ b/_docs/LuaJIT/contents.html @@ -0,0 +1,87 @@ + + +Lua 5.1 reference manual - contents + + + + + +
+

+Lua +Lua 5.1 Reference Manual +

+ + +Copyright +© 2005 Lua.org, PUC-Rio. All rights reserved. + +
+ + + +
+ +Last update: +Wed Sep 7 12:55:36 BRST 2005 + + + + diff --git a/_docs/LuaJIT/logo.gif b/_docs/LuaJIT/logo.gif new file mode 100644 index 00000000..2f5e4ac2 Binary files /dev/null and b/_docs/LuaJIT/logo.gif differ diff --git a/_docs/LuaJIT/lua.1 b/_docs/LuaJIT/lua.1 new file mode 100644 index 00000000..39c7d8e4 --- /dev/null +++ b/_docs/LuaJIT/lua.1 @@ -0,0 +1,166 @@ +.\" $Id: lua.man,v 1.9 2005/09/02 16:29:34 lhf Exp $ +.TH LUA 1 "$Date: 2005/09/02 16:29:34 $" +.SH NAME +lua \- Lua interpreter +.SH SYNOPSIS +.B lua +[ +.I options +] +[ +.I script +[ +.I args +] +] +.SH DESCRIPTION +.B lua +is the stand-alone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +.BR luac , +the Lua compiler.) +.B lua +can be used as a batch interpreter and also interactively. +.LP +The given +.I options +(see below) +are executed and then +the Lua program in file +.I script +is loaded and executed. +The given +.I args +are available to +.I script +as strings in a global table named +.BR arg . +If these arguments contain spaces or other characters special to the shell, +then they should be quoted +(but note that the quotes will be removed by the shell). +The arguments in +.B arg +start at 0, +which contains the string +.RI ` script '. +The index of the last argument is stored in +.BR "arg.n" . +The arguments given in the command line before +.IR script , +including the name of the interpreter, +are available in negative indices in +.BR arg . +.LP +At the very start, +before even handling the command line, +.B lua +executes the contents of the environment variable +.BR LUA_INIT , +if it is defined. +If the value of +.B LUA_INIT +is of the form +.RI `@ filename ', +then +.I filename +is executed. +Otherwise, the string is assumed to be a Lua statement and is executed. +.LP +Options start with +.B \- +and are described below. +You can use +.B "\--" +to signal the end of options. +.LP +If no arguments are given, +then +.B "\-v \-i" +is assumed when the standard input is a terminal; +otherwise, +.B "\-" +is assumed. +.LP +In interactive mode, +.B lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +So, one way to interrupt the reading of an incomplete statement is +to force a syntax error: +adding a +.B `;' +in the middle of a statement is a sure way of forcing a syntax error +(except inside multiline strings and comments; these must be closed explicitly). +If a line starts with +.BR `=' , +then +.B lua +displays the values of all the expressions in the remainder of the +line. The expressions must be separated by commas. +The primary prompt is the value of the global variable +.BR _PROMPT , +if this value is a string; +otherwise, the default prompt is used. +Similarly, the secondary prompt is the value of the global variable +.BR _PROMPT2 . +So, +to change the prompts, +set the corresponding variable to a string of your choice. +You can do that after calling the interpreter +or on the command line with +.BR "_PROMPT" "=\'lua: \'" , +for example. +(Note the need for quotes, because the string contains a space.) +The default prompts are ``> '' and ``>> ''. +.SH OPTIONS +.TP +.B \- +load and execute the standard input as a file, +that is, +not interactively, +even when the standard input is a terminal. +.TP +.BI \-e " stat" +execute statement +.IR stat . +You need to quote +.I stat +if it contains spaces, quotes, +or other characters special to the shell. +.TP +.B \-i +enter interactive mode after +.I script +is executed. +.TP +.BI \-l " module" +call +.BI require( module ) +before executing +.IR script. +Typically used to load libraries +(hence the letter +.IR l ). +.TP +.B \-v +show version information. +.SH "SEE ALSO" +.BR luac (1) +.br +http://www.lua.org/ +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +R. Ierusalimschy, +L. H. de Figueiredo, +and +W. Celes +.\" EOF diff --git a/_docs/LuaJIT/lua.css b/_docs/LuaJIT/lua.css new file mode 100644 index 00000000..90f62312 --- /dev/null +++ b/_docs/LuaJIT/lua.css @@ -0,0 +1,15 @@ +body { + color: #000000 ; + background-color: #FFFFFF ; + font-family: sans-serif ; +} + +a:link { + color: #000080 ; +} + +a:link:hover, a:visited:hover { + color: #000080 ; + background-color: #E0E0FF ; +} + diff --git a/_docs/LuaJIT/lua.html b/_docs/LuaJIT/lua.html new file mode 100644 index 00000000..3bc0d8ae --- /dev/null +++ b/_docs/LuaJIT/lua.html @@ -0,0 +1,175 @@ + + + +LUA man page + + + + + +

NAME

+lua - Lua interpreter +

SYNOPSIS

+lua +[ +options +] +[ +script +[ +args +] +] +

DESCRIPTION

+lua +is the stand-alone Lua interpreter. +It loads and executes Lua programs, +either in textual source form or +in precompiled binary form. +(Precompiled binaries are output by +luac, +the Lua compiler.) +lua +can be used as a batch interpreter and also interactively. +

+The given +options +(see below) +are executed and then +the Lua program in file +script +is loaded and executed. +The given +args +are available to +script +as strings in a global table named +arg. +If these arguments contain spaces or other characters special to the shell, +then they should be quoted +(but note that the quotes will be removed by the shell). +The arguments in +arg +start at 0, +which contains the string +`script'. +The index of the last argument is stored in +"arg.n". +The arguments given in the command line before +script, +including the name of the interpreter, +are available in negative indices in +arg. +

+At the very start, +before even handling the command line, +lua +executes the contents of the environment variable +LUA_INIT, +if it is defined. +If the value of +LUA_INIT +is of the form +`@filename', +then +filename +is executed. +Otherwise, the string is assumed to be a Lua statement and is executed. +

+Options start with +- +and are described below. +You can use +"--" +to signal the end of options. +

+If no arguments are given, +then +"-v -i" +is assumed when the standard input is a terminal; +otherwise, +"-" +is assumed. +

+In interactive mode, +lua +prompts the user, +reads lines from the standard input, +and executes them as they are read. +If a line does not contain a complete statement, +then a secondary prompt is displayed and +lines are read until a complete statement is formed or +a syntax error is found. +So, one way to interrupt the reading of an incomplete statement is +to force a syntax error: +adding a +`;' +in the middle of a statement is a sure way of forcing a syntax error +(except inside multiline strings and comments; these must be closed explicitly). +If a line starts with +`=', +then +lua +displays the values of all the expressions in the remainder of the +line. The expressions must be separated by commas. +The primary prompt is the value of the global variable +_PROMPT, +if this value is a string; +otherwise, the default prompt is used. +Similarly, the secondary prompt is the value of the global variable +_PROMPT2. +So, +to change the prompts, +set the corresponding variable to a string of your choice. +You can do that after calling the interpreter +or on the command line with +"_PROMPT" "=\'lua: \'", +for example. +(Note the need for quotes, because the string contains a space.) +The default prompts are ``> '' and ``>> ''. +

OPTIONS

+

+- +load and execute the standard input as a file, +that is, +not interactively, +even when the standard input is a terminal. +

+-e "stat" +execute statement +stat. +You need to quote +stat +if it contains spaces, quotes, +or other characters special to the shell. +

+-i +enter interactive mode after +script +is executed. +

+-l "module" +call +require( module) +before executing +script. +Typically used to load libraries +(hence the letter +l). +

+-v +show version information. +

SEE ALSO

+luac(1) +
+http://www.lua.org/ +

DIAGNOSTICS

+Error messages should be self explanatory. +

AUTHORS

+R. Ierusalimschy, +L. H. de Figueiredo, +and +W. Celes + + + diff --git a/_docs/LuaJIT/luac.1 b/_docs/LuaJIT/luac.1 new file mode 100644 index 00000000..7a44e2f2 --- /dev/null +++ b/_docs/LuaJIT/luac.1 @@ -0,0 +1,128 @@ +.\" $Id: luac.man,v 1.26 2005/09/02 16:29:34 lhf Exp $ +.TH LUAC 1 "$Date: 2005/09/02 16:29:34 $" +.SH NAME +luac \- Lua compiler +.SH SYNOPSIS +.B luac +[ +.I options +] [ +.I filenames +] +.SH DESCRIPTION +.B luac +is the Lua compiler. +It translates programs written in the Lua programming language +into binary files that can be latter loaded and executed. +.LP +The main advantages of precompiling chunks are: +faster loading, +protecting source code from user changes, +and +off-line syntax checking. +.LP +Pre-compiling does not imply faster execution +because in Lua chunks are always compiled into bytecodes before being executed. +.B luac +simply allows those bytecodes to be saved in a file for later execution. +.LP +.B luac +produces a single output file containing the bytecodes +for all source files given. +By default, +the output file is named +.BR luac.out , +but you can change this with the +.B \-o +option. +.LP +The binary files created by +.B luac +are portable only among architectures with the same word size and byte order. +.LP +In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. +This is useful to combine several precompiled chunks, +even from different (but compatible) platforms, +into a single precompiled chunk. +.LP +You can use +.B "\-" +to indicate the standard input as a source file +and +.B "\--" +to signal the end of options +(that is, +all remaining arguments will be treated as files even if they start with +.BR "\-" ). +.LP +The internal format of the binary files produced by +.B luac +is likely to change when a new version of Lua is released. +So, +save the source files of all Lua programs that you precompile. +.LP +.SH OPTIONS +Options must be separate. +.TP +.B \-l +produce a listing of the compiled bytecode for Lua's virtual machine. +Listing bytecodes is useful to learn about Lua's virtual machine. +If no files are given, then +.B luac +loads +.B luac.out +and lists its contents. +.TP +.BI \-o " file" +output to +.IR file , +instead of the default +.BR luac.out . +The output file may be a source file because +all files are loaded before the output file is written. +Be careful not to overwrite precious files. +.TP +.B \-p +load files but do not generate any output file. +Used mainly for syntax checking and for testing precompiled chunks: +corrupted files will probably generate errors when loaded. +Lua always performs a thorough integrity test on precompiled chunks. +Bytecode that passes this test is completely safe, +in the sense that it will not break the interpreter. +However, +there is no guarantee that such code does anything sensible. +(None can be given, because the halting problem is unsolvable.) +If no files are given, then +.B luac +loads +.B luac.out +and tests its contents. +No messages are displayed if the file passes the integrity test. +.TP +.B \-s +strip debug information before writing the output file. +This saves some space in very large chunks, +but if errors occur when running these chunks, +then the error messages may not contain the full information they usually do +(line numbers and names of locals are lost). +.TP +.B \-v +show version information. +.SH FILES +.TP 15 +.B luac.out +default output file +.SH "SEE ALSO" +.BR lua (1) +.br +http://www.lua.org/ +.SH DIAGNOSTICS +Error messages should be self explanatory. +.SH AUTHORS +L. H. de Figueiredo, +R. Ierusalimschy and +W. Celes +.\" EOF diff --git a/_docs/LuaJIT/luac.html b/_docs/LuaJIT/luac.html new file mode 100644 index 00000000..586b38e8 --- /dev/null +++ b/_docs/LuaJIT/luac.html @@ -0,0 +1,137 @@ + + + +LUAC man page + + + + + +

NAME

+luac - Lua compiler +

SYNOPSIS

+luac +[ +options +] [ +filenames +] +

DESCRIPTION

+luac +is the Lua compiler. +It translates programs written in the Lua programming language +into binary files that can be latter loaded and executed. +

+The main advantages of precompiling chunks are: +faster loading, +protecting source code from user changes, +and +off-line syntax checking. +

+Pre-compiling does not imply faster execution +because in Lua chunks are always compiled into bytecodes before being executed. +luac +simply allows those bytecodes to be saved in a file for later execution. +

+luac +produces a single output file containing the bytecodes +for all source files given. +By default, +the output file is named +luac.out, +but you can change this with the +-o +option. +

+The binary files created by +luac +are portable only among architectures with the same word size and byte order. +

+In the command line, +you can mix +text files containing Lua source and +binary files containing precompiled chunks. +This is useful to combine several precompiled chunks, +even from different (but compatible) platforms, +into a single precompiled chunk. +

+You can use +"-" +to indicate the standard input as a source file +and +"--" +to signal the end of options +(that is, +all remaining arguments will be treated as files even if they start with +"-"). +

+The internal format of the binary files produced by +luac +is likely to change when a new version of Lua is released. +So, +save the source files of all Lua programs that you precompile. +

+

OPTIONS

+Options must be separate. +

+-l +produce a listing of the compiled bytecode for Lua's virtual machine. +Listing bytecodes is useful to learn about Lua's virtual machine. +If no files are given, then +luac +loads +luac.out +and lists its contents. +

+-o "file" +output to +file, +instead of the default +luac.out. +The output file may be a source file because +all files are loaded before the output file is written. +Be careful not to overwrite precious files. +

+-p +load files but do not generate any output file. +Used mainly for syntax checking and for testing precompiled chunks: +corrupted files will probably generate errors when loaded. +Lua always performs a thorough integrity test on precompiled chunks. +Bytecode that passes this test is completely safe, +in the sense that it will not break the interpreter. +However, +there is no guarantee that such code does anything sensible. +(None can be given, because the halting problem is unsolvable.) +If no files are given, then +luac +loads +luac.out +and tests its contents. +No messages are displayed if the file passes the integrity test. +

+-s +strip debug information before writing the output file. +This saves some space in very large chunks, +but if errors occur when running these chunks, +then the error messages may not contain the full information they usually do +(line numbers and names of locals are lost). +

+-v +show version information. +

FILES

+

+luac.out +default output file +

SEE ALSO

+lua(1) +
+http://www.lua.org/ +

DIAGNOSTICS

+Error messages should be self explanatory. +

AUTHORS

+L. H. de Figueiredo, +R. Ierusalimschy and +W. Celes + + + diff --git a/_docs/LuaJIT/manual.html b/_docs/LuaJIT/manual.html new file mode 100644 index 00000000..b55232bd --- /dev/null +++ b/_docs/LuaJIT/manual.html @@ -0,0 +1,5980 @@ + + + + +Lua 5.1 Reference Manual + + + + + +
+

+[Lua logo] +Lua 5.1 Reference Manual +

+ +by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes +

+ +Copyright +© 2005 Lua.org, PUC-Rio. All rights reserved. + +


+ +

+

+ + + + +

+

1 - Introduction

+ +

Lua is an extension programming language designed to support +general procedural programming with data description +facilities. +It also offers good support for object-oriented programming, +functional programming, and data-driven programming. +Lua is intended to be used as a powerful, light-weight +configuration language for any program that needs one. +Lua is implemented as a library, written in clean C +(that is, in the common subset of ANSI C and C++). + +

Being an extension language, Lua has no notion of a "main" program: +it only works embedded in a host client, +called the embedding program or simply the host. +This host program can invoke functions to execute a piece of Lua code, +can write and read Lua variables, +and can register C functions to be called by Lua code. +Through the use of C functions, Lua can be augmented to cope with +a wide range of different domains, +thus creating customized programming languages sharing a syntactical framework. + +

The Lua distribution includes a stand-alone embedding program, +lua, that uses the Lua library to offer a complete Lua interpreter. + +

Lua is free software, +and is provided as usual with no guarantees, +as stated in its copyright notice. +The implementation described in this manual is available +at Lua's official web site, www.lua.org. + +

Like any other reference manual, +this document is dry in places. +For a discussion of the decisions behind the design of Lua, +see the papers below, +which are available at Lua's web site. +

    +
  • +R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. +Lua—an extensible extension language. +Software: Practice & Experience 26:6 (1996) 635–652. +
  • +L. H. de Figueiredo, R. Ierusalimschy, and W. Celes. +The design and implementation of a language for extending applications. +Proceedings of XXI Brazilian Seminar on Software and Hardware +(1994) 273–283. +
  • +L. H. de Figueiredo, R. Ierusalimschy, and W. Celes. +Lua: an extensible embedded language. +Dr. Dobb's Journal 21:12 (Dec 1996) 26–33. +
  • +R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. +The evolution of an extension language: a history of Lua, +Proceedings of V Brazilian Symposium on Programming Languages (2001) B-14–B-28. +
+ +

Lua means "moon" in Portuguese and is pronounced LOO-ah. + +

+

2 - The Language

+ +

This section describes the lexis, the syntax, and the semantics of Lua. +In other words, +this section describes +which tokens are valid, +how they can be combined, +and what their combinations mean. + +

The language constructs will be explained using the usual extended BNF, +in which +{a} means 0 or more a's, and +[a] means an optional a. +Non-terminals are shown in italics, +keywords are shown in bold, +and other terminal symbols are shown in typewriter font, +enclosed in single quotes. + +

2.1 - Lexical Conventions

+ +

Names in Lua can be any string of letters, +digits, and underscores, +not beginning with a digit. +This coincides with the definition of names in most languages. +(The definition of letter depends on the current locale: +any character considered alphabetic by the current locale +can be used in an identifier.) + +

The following keywords are reserved +and cannot be used as names: + +

+       and       break     do        else      elseif
+       end       false     for       function  if
+       in        local     nil       not       or
+       repeat    return    then      true      until     while
+
+ +

Lua is a case-sensitive language: +and is a reserved word, but And and AND +are two different, valid names. +As a convention, names starting with an underscore followed by +uppercase letters (such as _VERSION) +are reserved for internal variables used by Lua. + +

The following strings denote other tokens: +

+       +     -     *     /     %     ^     #
+       ==    ~=    <=    >=    <     >     =
+       (     )     {     }     [     ]
+       ;     :     ,     .     ..    ...
+
+ +

Literal strings +can be delimited by matching single or double quotes, +and can contain the following C-like escape sequences: +

    +
  • \a — bell +
  • \b — backspace +
  • \f — form feed +
  • \n — newline +
  • \r — carriage return +
  • \t — horizontal tab +
  • \v — vertical tab +
  • \\ — backslash +
  • \" — quotation mark +
  • \' — apostrophe +
+Moreover, a `\newline´ +(that is, a backslash followed by a real newline) +results in a newline in the string. +A character in a string may also be specified by its numerical value +using the escape sequence `\ddd´, +where ddd is a sequence of up to three decimal digits. +Strings in Lua may contain any 8-bit value, including embedded zeros, +which can be specified as `\0´. + +

Literal strings can also be defined using a long format +enclosed by l-brackets (long brackets). +We define an opening l-bracket of level n as an opening +square bracket followed by n equal signs followed by another +opening square bracket. +So, an opening l-bracket of level 0 is written as [[, +an opening l-bracket of level 1 is written as [=[, +and so on. +A closing l-bracket is defined similarly; +for instance, a closing l-bracket of level 4 is written as ]====]. +A long string starts with an opening l-bracket of any level and +ends at the first closing l-bracket of the same level. +Literals in this bracketed form may run for several lines, +do not interpret any escape sequences, +and ignore l-brackets of any other level. + +

For convenience, +when the opening l-bracket is immediately followed by a newline, +the newline is not included in the string. +As an example, in a system using ASCII +(in which `a´ is coded as 97, +newline is coded as 10, and `1´ is coded as 49), +the four literals below denote the same string: +

+      (1)   "alo\n123\""
+      (2)   '\97lo\10\04923"'
+      (3)   [[alo
+            123"]]
+      (4)   [==[
+            alo
+            123"]==]
+
+ +

Numerical constants may be written with an optional decimal part +and an optional decimal exponent. +Examples of valid numerical constants are +

+       3     3.0     3.1416  314.16e-2   0.31416E1
+
+ +

Comments start anywhere outside a string with a +double hyphen (--). +If the text immediately after -- is not an opening l-bracket, +the comment is a short comment, +which runs until the end of the line. +Otherwise, it is a long comment, +which runs until the corresponding closing l-bracket. + +

2.2 - Values and Types

+ +

Lua is a dynamically typed language. +That means that +variables do not have types; only values do. +There are no type definitions in the language. +All values carry their own type. + +

There are eight basic types in Lua: +nil, boolean, number, +string, function, userdata, +thread, and table. +Nil is the type of the value nil, +whose main property is to be different from any other value; +usually it represents the absence of a useful value. +Boolean is the type of the values false and true. +In Lua, both nil and false make a condition false; +any other value makes it true. +Number represents real (double-precision floating-point) numbers. +(It is easy to build Lua interpreters that use other +internal representations for numbers, +such as single-precision float or long integers. +See file luaconf.h.) +String represents arrays of characters. + +Lua is 8-bit clean: +Strings may contain any 8-bit character, +including embedded zeros ('\0') (see 2.1). + +

Functions are first-class values in Lua. +That means that functions can be stored in variables, +passed as arguments to other functions, and returned as results. +Lua can call (and manipulate) functions written in Lua and +functions written in C +(see 2.5.8). + +

The type userdata is provided to allow arbitrary C data to +be stored in Lua variables. +This type corresponds to a block of raw memory +and has no pre-defined operations in Lua, +except assignment and identity test. +However, by using metatables, +the programmer can define operations for userdata values +(see 2.8). +Userdata values cannot be created or modified in Lua, +only through the C API. +This guarantees the integrity of data owned by the host program. + +

The type thread represents independent threads of execution +and it is used to implement coroutines (see 2.11). + +

The type table implements associative arrays, +that is, arrays that can be indexed not only with numbers, +but with any value (except nil). +Moreover, +tables can be heterogeneous, +that is, they can contain values of all types (except nil). +Tables are the sole data structuring mechanism in Lua; +they may be used to represent ordinary arrays, +symbol tables, sets, records, graphs, trees, etc. +To represent records, Lua uses the field name as an index. +The language supports this representation by +providing a.name as syntactic sugar for a["name"]. +There are several convenient ways to create tables in Lua +(see 2.5.7). + +

Like indices, +the value of a table field can be of any type (except nil). +In particular, +because functions are first class values, +table fields may contain functions. +Thus tables may also carry methods (see 2.5.9). + +

Tables, functions, and userdata values are objects: +variables do not actually contain these values, +only references to them. +Assignment, parameter passing, and function returns +always manipulate references to such values; +these operations do not imply any kind of copy. + +

The library function type returns a string describing the type +of a given value. + +

2.2.1 - Coercion

+ +

Lua provides automatic conversion between +string and number values at run time. +Any arithmetic operation applied to a string tries to convert +that string to a number, following the usual rules. +Conversely, whenever a number is used where a string is expected, +the number is converted to a string, in a reasonable format. +For complete control of how numbers are converted to strings, +use the format function from the string library +(see string.format). + +

2.3 - Variables

+ +

Variables are places that store values. + +There are three kinds of variables in Lua: +global variables, local variables, and table fields. + +

A single name can denote a global variable or a local variable +(or a formal parameter of a function, +which is a particular form of local variable): +

+	var ::= Name
+
+Variables are assumed to be global unless explicitly declared local +(see 2.4.7). +Local variables are lexically scoped: +Local variables can be freely accessed by functions +defined inside their scope (see 2.6). + +

Before the first assignment to a variable, its value is nil. + +

Square brackets are used to index a table: +

+	var ::= prefixexp `[´ exp `]´
+
+The first expression (prefixexp) should result in a table value; +the second expression (exp) +identifies a specific entry inside that table. +The expression denoting the table to be indexed has a restricted syntax; +see 2.5 for details. + +

The syntax var.NAME is just syntactic sugar for +var["NAME"]: +

+	var ::= prefixexp `.´ Name
+
+ +

The meaning of accesses to global variables +and table fields can be changed via metatables. +An access to an indexed variable t[i] is equivalent to +a call gettable_event(t,i). +(See 2.8 for a complete description of the +gettable_event function. +This function is not defined or callable in Lua. +We use it here only for explanatory purposes.) + +

All global variables live as fields in ordinary Lua tables, +called environment tables or simply +environments (see 2.9). +Each function has its own reference to an environment, +so that all global variables in that function +will refer to that environment table. +When a function is created, +it inherits the environment from the function that created it. +To replace or get the environment table of a Lua function, +you call setfenv or getfenv. +(You can only manipulate the environment of C functions +through the debug library; (see 5.9).) + +

An access to a global variable x +is equivalent to _env.x, +which in turn is equivalent to +

+       gettable_event(_env, "x")
+
+where _env is the environment of the running function. +(See 2.8 for a complete description of the +gettable_event function. +This function is not defined or callable in Lua. +Similarly, the _env variable is not defined in Lua. +We use them here only for explanatory purposes.) + +

2.4 - Statements

+ +

Lua supports an almost conventional set of statements, +similar to those in Pascal or C. +This set includes +assignment, control structures, procedure calls, +table constructors, and variable declarations. + +

2.4.1 - Chunks

+ +

The unit of execution of Lua is called a chunk. +A chunk is simply a sequence of statements, +which are executed sequentially. +Each statement can be optionally followed by a semicolon: +

+	chunk ::= {stat [`;´]}
+
+ +

Lua handles a chunk as the body of an anonymous function +with a variable number of arguments +(see 2.5.9). +As such, chunks can define local variables, +receive arguments, and return values. + +

A chunk may be stored in a file or in a string inside the host program. +When a chunk is executed, first it is pre-compiled into opcodes for +a virtual machine, +and then the compiled code is executed +by an interpreter for the virtual machine. + +

Chunks may also be pre-compiled into binary form; +see program luac for details. +Programs in source and compiled forms are interchangeable; +Lua automatically detects the file type and acts accordingly. + + +

2.4.2 - Blocks

+A block is a list of statements; +syntactically, a block is equal to a chunk: +
+	block ::= chunk
+
+ +

A block may be explicitly delimited to produce a single statement: +

+	stat ::= do block end
+
+Explicit blocks are useful +to control the scope of variable declarations. +Explicit blocks are also sometimes used to +add a return or break statement in the middle +of another block (see 2.4.4). + + +

2.4.3 - Assignment

+ +

Lua allows multiple assignment. +Therefore, the syntax for assignment +defines a list of variables on the left side +and a list of expressions on the right side. +The elements in both lists are separated by commas: +

+	stat ::= varlist1 `=´ explist1
+	varlist1 ::= var {`,´ var}
+	explist1 ::= exp {`,´ exp}
+
+Expressions are discussed in 2.5. + +

Before the assignment, +the list of values is adjusted to the length of +the list of variables. +If there are more values than needed, +the excess values are thrown away. +If there are fewer values than needed, +the list is extended with as many nil's as needed. +If the list of expressions ends with a function call, +then all values returned by that function call enter in the list of values, +before the adjustment +(except when the call is enclosed in parentheses; see 2.5). + +

The assignment statement first evaluates all its expressions +and only then are the assignments performed. +Thus the code +

+       i = 3
+       i, a[i] = i+1, 20
+
+sets a[3] to 20, without affecting a[4] +because the i in a[i] is evaluated (to 3) +before it is assigned 4. +Similarly, the line +
+       x, y = y, x
+
+exchanges the values of x and y. + +

The meaning of assignments to global variables +and table fields can be changed via metatables. +An assignment to an indexed variable t[i] = val is equivalent to +settable_event(t,i,val). +(See 2.8 for a complete description of the +settable_event function. +This function is not defined or callable in Lua. +We use it here only for explanatory purposes.) + +

An assignment to a global variable x = val +is equivalent to the assignment +_env.x = val, +which in turn is equivalent to +

+       settable_event(_env, "x", val)
+
+where _env is the environment of the running function. +(The _env variable is not defined in Lua. +We use it here only for explanatory purposes.) + +

2.4.4 - Control Structures

+The control structures +if, while, and repeat have the usual meaning and +familiar syntax: + + + +
+	stat ::= while exp do block end
+	stat ::= repeat block until exp
+	stat ::= if exp then block {elseif exp then block} [else block] end
+
+Lua also has a for statement, in two flavors (see 2.4.5). + +

The condition expression exp of a +control structure may return any value. +Both false and nil are considered false. +All values different from nil and false are considered true +(in particular, the number 0 and the empty string are also true). + +

In the repeatuntil loop, +the inner block does not end at the until keyword, +but only after the condition. +That means the condition can refer to local variables +declared inside the loop. + +

The return statement is used to return values +from a function or from a chunk. + +Functions and chunks may return more than one value, +so the syntax for the return statement is +

+	stat ::= return [explist1]
+
+ +

The break statement can be used to terminate the execution of a +while, repeat, or for loop, +skipping to the next statement after the loop: + +

+	stat ::= break
+
+A break ends the innermost enclosing loop. + +

For syntactic reasons, return and break +statements can only be written as the last statement of a block. +If it is really necessary to return or break in the +middle of a block, +then an explicit inner block can be used, +as in the idioms +`do return end´ and +`do break end´, +because now return and break are the last statements in +their (inner) blocks. + +

2.4.5 - For Statement

+ +

The for statement has two forms: +one numeric and one generic. + + +

The numeric for loop repeats a block of code while a +control variable runs through an arithmetic progression. +It has the following syntax: +

+	stat ::= for Name `=´ exp `,´ exp [`,´ exp] do block end
+
+The block is repeated for name starting at the value of +the first exp, until it passes the second exp by steps of the +third exp. +More precisely, a for statement like +
+       for var = e1, e2, e3 do block end
+
+is equivalent to the code: +
+       do
+         local _var, _limit, _step = tonumber(e1), tonumber(e2), tonumber(e3)
+         if not (_var and _limit and _step) then error() end
+         while (_step>0 and _var<=_limit) or (_step<=0 and _var>=_limit) do
+           local var = _var
+           block
+           _var = _var + _step
+         end
+       end
+
+Note the following: +
    +
  • All three control expressions are evaluated only once, +before the loop starts. +They must all result in numbers. +
  • _var, _limit, and _step are invisible variables. +The names are here for explanatory purposes only. +
  • If the third expression (the step) is absent, +then a step of 1 is used. +
  • You can use break to exit a for loop. +
  • The loop variable var is local to the loop; +you cannot use its value after the for ends or is broken. +If you need the value of the loop variable var, +then assign it to another variable before breaking or exiting the loop. +
+ +

The generic for statement works over functions, +called iterators. +For each iteration, it calls its iterator function to produce a new value, +stopping when the new value is nil. +The generic for loop has the following syntax: +

+	stat ::= for Name {`,´ Name} in explist1 do block end
+
+A for statement like +
+       for var_1, ..., var_n in explist do block end
+
+is equivalent to the code: +
+       do
+         local _f, _s, _var = explist
+         while true do
+           local var_1, ... , var_n = _f(_s, _var)
+           _var = var_1
+           if _var == nil then break end
+           block
+         end
+       end
+
+Note the following: +
    +
  • explist is evaluated only once. +Its results are an iterator function, +a state, and an initial value for the first iterator variable. +
  • _f, _s, and _var are invisible variables. +The names are here for explanatory purposes only. +
  • You can use break to exit a for loop. +
  • The loop variables var_i are local to the loop; +you cannot use their values after the for ends. +If you need these values, +then assign them to other variables before breaking or exiting the loop. +
+ +

2.4.6 - Function Calls as Statements

+To allow possible side-effects, +function calls can be executed as statements: +
+	stat ::= functioncall
+
+In this case, all returned values are thrown away. +Function calls are explained in 2.5.8. + +

2.4.7 - Local Declarations

+Local variables may be declared anywhere inside a block. +The declaration may include an initial assignment: +
+	stat ::= local namelist [`=´ explist1]
+	namelist ::= Name {`,´ Name}
+
+If present, an initial assignment has the same semantics +of a multiple assignment (see 2.4.3). +Otherwise, all variables are initialized with nil. + +

A chunk is also a block (see 2.4.1), +so local variables can be declared in a chunk outside any explicit block. +The scope of such local variables extends until the end of the chunk. + +

The visibility rules for local variables are explained in 2.6. + +

2.5 - Expressions

+ +

+The basic expressions in Lua are the following: +

+	exp ::= prefixexp
+	exp ::= nil | false | true
+	exp ::= Number
+	exp ::= Literal
+	exp ::= function
+	exp ::= tableconstructor
+	exp ::= `...´
+	exp ::= exp binop exp
+	exp ::= unop exp
+	prefixexp ::= var | functioncall | `(´ exp `)´
+
+ +

Numbers and literal strings are explained in 2.1; +variables are explained in 2.3; +function definitions are explained in 2.5.9; +function calls are explained in 2.5.8; +table constructors are explained in 2.5.7. +Vararg expressions, +denoted by three dots (...), can only be used inside +vararg functions; +they are explained in 2.5.9. + + +

Binary operators comprise arithmetic operators (see 2.5.1), +relational operators (see 2.5.2), and logical operators (see 2.5.3). +Unary operators comprise the unary minus (see 2.5.1), +the unary not (see 2.5.3), +and the unary length operator (see 2.5.5). + +

Both function calls and vararg expressions may result in multiple values. +If the expression is used as a statement (see 2.4.6) +(only possible for function calls), +then its return list is adjusted to zero elements, +thus discarding all returned values. +If the expression is used inside another expression +or in the middle of a list of expressions, +then its result list is adjusted to one element, +thus discarding all values except the first one. +If the expression is used as the last element of a list of expressions, +then no adjustment is made, +unless the call is enclosed in parentheses. + +

Here are some examples: +

+       f()                -- adjusted to 0 results
+       g(f(), x)          -- f() is adjusted to 1 result
+       g(x, f())          -- g gets x plus all values returned by f()
+       a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
+       a,b = ...          -- a gets the first vararg parameter, b gets
+                          -- the second (both a and b may get nil if there is
+                          -- no corresponding vararg parameter)
+       a,b,c = x, f()     -- f() is adjusted to 2 results
+       a,b,c = f()        -- f() is adjusted to 3 results
+       return f()         -- returns all values returned by f()
+       return ...         -- returns all received vararg parameters
+       return x,y,f()     -- returns x, y, and all values returned by f()
+       {f()}              -- creates a list with all values returned by f()
+       {...}              -- creates a list with all vararg parameters
+       {f(), nil}         -- f() is adjusted to 1 result
+
+ +

An expression enclosed in parentheses always results in only one value. +Thus, +(f(x,y,z)) is always a single value, +even if f returns several values. +(The value of (f(x,y,z)) is the first value returned by f +or nil if f does not return any values.) + +

2.5.1 - Arithmetic Operators

+Lua supports the usual arithmetic operators: +the binary + (addition), +- (subtraction), * (multiplication), +/ (division), % (modulus), and ^ (exponentiation); +and unary - (negation). +If the operands are numbers, or strings that can be converted to +numbers (see 2.2.1), +then all operations have the usual meaning. +Exponentiation works for any exponent. +For instance, x^-0.5 computes the inverse of the square root of x. +Modulus is defined as +
+  a % b == a - math.floor(a/b)*b
+
+That is, it is the remaining of a division that rounds +the quotient towards minus infinity. + +

2.5.2 - Relational Operators

+The relational operators in Lua are +
+       ==    ~=    <     >     <=    >=
+
+These operators always result in false or true. + +

Equality (==) first compares the type of its operands. +If the types are different, then the result is false. +Otherwise, the values of the operands are compared. +Numbers and strings are compared in the usual way. +Objects (tables, userdata, threads, and functions) +are compared by reference: +Two objects are considered equal only if they are the same object. +Every time you create a new object (a table, userdata, or function), +this new object is different from any previously existing object. + +

You can change the way that Lua compares tables and userdata +using the "eq" metamethod (see 2.8). + +

The conversion rules of 2.2.1 +do not apply to equality comparisons. +Thus, "0"==0 evaluates to false, +and t[0] and t["0"] denote different +entries in a table. + + +

The operator ~= is exactly the negation of equality (==). + +

The order operators work as follows. +If both arguments are numbers, then they are compared as such. +Otherwise, if both arguments are strings, +then their values are compared according to the current locale. +Otherwise, Lua tries to call the "lt" or the "le" +metamethod (see 2.8). + +

2.5.3 - Logical Operators

+The logical operators in Lua are + +
+       and   or    not
+
+Like the control structures (see 2.4.4), +all logical operators consider both false and nil as false +and anything else as true. + + +

The operator not always returns false or true. + +

The conjunction operator and returns its first argument +if this value is false or nil; +otherwise, and returns its second argument. +The disjunction operator or returns its first argument +if this value is different from nil and false; +otherwise, or returns its second argument. +Both and and or use short-cut evaluation, +that is, +the second operand is evaluated only if necessary. +For example, +

+       10 or error()       -> 10
+       nil or "a"          -> "a"
+       nil and 10          -> nil
+       false and error()   -> false
+       false and nil       -> false
+       false or nil        -> nil
+       10 and 20           -> 20
+
+ +

2.5.4 - Concatenation

+The string concatenation operator in Lua is +denoted by two dots (`..´). +If both operands are strings or numbers, then they are converted to +strings according to the rules mentioned in 2.2.1. +Otherwise, the "concat" metamethod is called (see 2.8). + +

2.5.5 - The Length Operator

+ +

The length operator is denoted by the prefix #. +The length of a string is its number of bytes +(that is, the usual meaning of string length when each +character is one byte). +The length of a table t is defined to be any +integer index n +such that t[n] is not nil and t[n+1] is nil; +moreover, if t[1] is nil, n may be zero. + +

For a regular array, with non-nil values from 1 to a given n, +its length is exactly that n, +the index of its last value. +If the array has "holes" +(that is, nil values between other non-nil values), +then #t may be any of the indices that precede a nil value +(that is, it may consider any such nil value as the end of +the array). + +

2.5.6 - Precedence

+Operator precedence in Lua follows the table below, +from lower to higher priority: +
+       or
+       and
+       <     >     <=    >=    ~=    ==
+       ..
+       +     -
+       *     /     %
+       not   #     - (unary)
+       ^
+
+You can use parentheses to change the precedences of an expression. +The concatenation (`..´) and exponentiation (`^´) +operators are right associative. +All other binary operators are left associative. + +

2.5.7 - Table Constructors

+Table constructors are expressions that create tables. +Every time a constructor is evaluated, a new table is created. +Constructors can be used to create empty tables, +or to create a table and initialize some of its fields. +The general syntax for constructors is +
+	tableconstructor ::= `{´ [fieldlist] `}´
+	fieldlist ::= field {fieldsep field} [fieldsep]
+	field ::= `[´ exp `]´ `=´ exp | Name `=´ exp | exp
+	fieldsep ::= `,´ | `;´
+
+ +

Each field of the form [exp1] = exp2 adds to the new table an entry +with key exp1 and value exp2. +A field of the form name = exp is equivalent to +["name"] = exp. +Finally, fields of the form exp are equivalent to +[i] = exp, where i are consecutive numerical integers, +starting with 1. +Fields in the other formats do not affect this counting. +For example, +

+       a = {[f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45}
+
+is equivalent to +
+       do
+         local temp = {}
+         temp[f(1)] = g
+         temp[1] = "x"         -- 1st exp
+         temp[2] = "y"         -- 2nd exp
+         temp.x = 1            -- temp["x"] = 1
+         temp[3] = f(x)        -- 3rd exp
+         temp[30] = 23
+         temp[4] = 45          -- 4th exp
+         a = temp
+       end
+
+ +

If the last field in the list has the form exp +and the expression is a function call or a vararg expression, +then all values returned by that expression enter the list consecutively +(see 2.5.8). +To avoid this, +enclose the function call (or the vararg expression) +in parentheses (see 2.5). + +

The field list may have an optional trailing separator, +as a convenience for machine-generated code. + +

2.5.8 - Function Calls

+A function call in Lua has the following syntax: +
+	functioncall ::= prefixexp args
+
+In a function call, +first prefixexp and args are evaluated. +If the value of prefixexp has type function, +then that function is called +with the given arguments. +Otherwise, its "call" metamethod is called, +having as first parameter the value of prefixexp, +followed by the original call arguments +(see 2.8). + +

The form +

+	functioncall ::= prefixexp `:´ Name args
+
+can be used to call "methods". +A call v:name(...) +is syntactic sugar for v.name(v,...), +except that v is evaluated only once. + +

Arguments have the following syntax: +

+	args ::= `(´ [explist1] `)´
+	args ::= tableconstructor
+	args ::= Literal
+
+All argument expressions are evaluated before the call. +A call of the form f{...} is syntactic sugar for +f({...}), that is, +the argument list is a single new table. +A call of the form f'...' +(or f"..." or f[[...]]) is syntactic sugar for +f('...'), that is, +the argument list is a single literal string. + +

As an exception to the free-format syntax of Lua, +you cannot put a line break before the `(´ in a function call. +That restriction avoids some ambiguities in the language. +If you write +

+       a = f
+       (g).x(a)
+
+Lua would read that as a = f(g).x(a). +So, if you want two statements, you must add a semi-colon between them. +If you actually want to call f, +you must remove the line break before (g). + +

A call of the form return functioncall is called +a tail call. +Lua implements proper tail calls +(or proper tail recursion): +In a tail call, +the called function reuses the stack entry of the calling function. +Therefore, there is no limit on the number of nested tail calls that +a program can execute. +However, a tail call erases any debug information about the +calling function. +Note that a tail call only happens with a particular syntax, +where the return has one single function call as argument; +this syntax makes the calling function returns exactly +the returns of the called function. +So, all the following examples are not tail calls: +

+  return (f(x))        -- results adjusted to 1
+  return 2 * f(x)
+  return x, f(x)       -- additional results
+  f(x); return         -- results discarded
+  return x or f(x)     -- results adjusted to 1
+
+ +

2.5.9 - Function Definitions

+ +

The syntax for function definition is +

+	function ::= function funcbody
+	funcbody ::= `(´ [parlist1] `)´ block end
+
+ +

The following syntactic sugar simplifies function definitions: +

+	stat ::= function funcname funcbody
+	stat ::= local function Name funcbody
+	funcname ::= Name {`.´ Name} [`:´ Name]
+
+The statement +
+       function f () ... end
+
+translates to +
+       f = function () ... end
+
+The statement +
+       function t.a.b.c.f () ... end
+
+translates to +
+       t.a.b.c.f = function () ... end
+
+The statement +
+       local function f () ... end
+
+translates to +
+       local f; f = function () ... end
+
+ +

A function definition is an executable expression, +whose value has type function. +When Lua pre-compiles a chunk, +all its function bodies are pre-compiled too. +Then, whenever Lua executes the function definition, +the function is instantiated (or closed). +This function instance (or closure) +is the final value of the expression. +Different instances of the same function +may refer to different external local variables +and may have different environment tables. + +

Parameters act as local variables that are +initialized with the argument values: +

+	parlist1 ::= namelist [`,´ `...´] | `...´
+
+When a function is called, +the list of arguments is adjusted to +the length of the list of parameters, +unless the function is a variadic or vararg function, +which is +indicated by three dots (`...´) at the end of its parameter list. +A vararg function does not adjust its argument list; +instead, it collects all extra arguments and supplies them +to the function through a vararg expression, +which is also written as three dots. +The value of this expression is a list of all actual extra arguments, +similar to a function with multiple results. +If a vararg expression is used inside another expression +or in the middle of a list of expressions, +then its return list is adjusted to one element. +If the expression is used as the last element of a list of expressions, +then no adjustment is made +(unless the call is enclosed in parentheses). + +

As an example, consider the following definitions: +

+       function f(a, b) end
+       function g(a, b, ...) end
+       function r() return 1,2,3 end
+
+Then, we have the following mapping from arguments to parameters and +to the vararg expression: +
+       CALL            PARAMETERS
+
+       f(3)             a=3, b=nil
+       f(3, 4)          a=3, b=4
+       f(3, 4, 5)       a=3, b=4
+       f(r(), 10)       a=1, b=10
+       f(r())           a=1, b=2
+
+       g(3)             a=3, b=nil, ... ->  (nothing)
+       g(3, 4)          a=3, b=4,   ... ->  (nothing)
+       g(3, 4, 5, 8)    a=3, b=4,   ... ->  5  8
+       g(5, r())        a=5, b=1,   ... ->  2  3
+
+ +

Results are returned using the return statement (see 2.4.4). +If control reaches the end of a function +without encountering a return statement, +then the function returns with no results. + +

The colon syntax +is used for defining methods, +that is, functions that have an implicit extra parameter self. +Thus, the statement +

+       function t.a.b.c:f (...) ... end
+
+is syntactic sugar for +
+       t.a.b.c.f = function (self, ...) ... end
+
+ +

2.6 - Visibility Rules

+ + +

Lua is a lexically scoped language. +The scope of variables begins at the first statement after +their declaration and lasts until the end of the innermost block that +includes the declaration. +For instance: +

+  x = 10                -- global variable
+  do                    -- new block
+    local x = x         -- new `x', with value 10
+    print(x)            --> 10
+    x = x+1
+    do                  -- another block
+      local x = x+1     -- another `x'
+      print(x)          --> 12
+    end
+    print(x)            --> 11
+  end
+  print(x)              --> 10  (the global one)
+
+Notice that, in a declaration like local x = x, +the new x being declared is not in scope yet, +and so the second x refers to the outside variable. + +

Because of the lexical scoping rules, +local variables can be freely accessed by functions +defined inside their scope. +For instance: +

+  local counter = 0
+  function inc (x)
+    counter = counter + x
+    return counter
+  end
+
+A local variable used by an inner function is called +an upvalue, or external local variable, +inside the inner function. + +

Notice that each execution of a local statement +defines new local variables. +Consider the following example: +

+  a = {}
+  local x = 20
+  for i=1,10 do
+    local y = 0
+    a[i] = function () y=y+1; return x+y end
+  end
+
+The loop creates ten closures +(that is, ten instances of the anonymous function). +Each of these closures uses a different y variable, +while all of them share the same x. + +

2.7 - Error Handling

+ +

Because Lua is an extension language, +all Lua actions start from C code in the host program +calling a function from the Lua library (see ). +Whenever an error occurs during Lua compilation or execution, +control returns to C, +which can take appropriate measures +(such as print an error message). + +

Lua code can explicitly generate an error by calling the +error function. +If you need to catch errors in Lua, +you can use the pcall function. + +

2.8 - Metatables

+ +

Every value in Lua may have a metatable. +This metatable is an ordinary Lua table +that defines the behavior of the original value +under certain special operations. +You can change several aspects of the behavior +of operations over a value by setting specific fields in its metatable. +For instance, when a non-numeric value is the operand of an addition, +Lua checks for a function in the field "__add" in its metatable. +If it finds one, +Lua calls that function to perform the addition. + +

We call the keys in a metatable events +and the values metamethods. +In the previous example, the event is "add" +and the metamethod is the function that performs the addition. + +

You can query the metatable of any value +through the getmetatable function. + +

You can replace the metatable of tables +through the setmetatable +function. +You cannot change the metatable of other types from Lua +(except using the debug library); +you must use the C API for that. + +

Tables and userdata have individual metatables +(although multiple tables and userdata can share +a same table as their metatable); +values of all other types share one single metatable per type. +So, there is one single metatable for all numbers, +and for all strings, etc. + +

A metatable may control how an object behaves in arithmetic operations, +order comparisons, concatenation, and indexing. +A metatable can also define a function to be called when a userdata +is garbage collected. +For each of those operations Lua associates a specific key +called an event. +When Lua performs one of those operations over a value, +it checks whether that value has a metatable with the corresponding event. +If so, the value associated with that key (the metamethod) +controls how Lua will perform the operation. + +

Metatables control the operations listed next. +Each operation is identified by its corresponding name. +The key for each operation is a string with its name prefixed by +two underscores; +for instance, the key for operation "add" is the +string "__add". +The semantics of these operations is better explained by a Lua function +describing how the interpreter executes that operation. + +

The code shown here in Lua is only illustrative; +the real behavior is hard coded in the interpreter +and it is much more efficient than this simulation. +All functions used in these descriptions +(rawget, tonumber, etc.) +are described in 5.1. +In particular, to retrieve the metamethod of a given object, +we use the expression +

+  metatable(obj)[event]
+
+This should be read as +
+  rawget(metatable(obj) or {}, event)
+
+That is, the access to a metamethod does not invoke other metamethods, +and the access to objects with no metatables does not fail +(it simply results in nil). + +

    +
  • "add": +the + operation. + +

    The function getbinhandler below defines how Lua chooses a handler +for a binary operation. +First, Lua tries the first operand. +If its type does not define a handler for the operation, +then Lua tries the second operand. +

    + function getbinhandler (op1, op2, event)
    +   return metatable(op1)[event] or metatable(op2)[event]
    + end
    +
    +Using that function, +the behavior of the op1 + op2 is +
    + function add_event (op1, op2)
    +   local o1, o2 = tonumber(op1), tonumber(op2)
    +   if o1 and o2 then  -- both operands are numeric?
    +     return o1 + o2   -- `+' here is the primitive `add'
    +   else  -- at least one of the operands is not numeric
    +     local h = getbinhandler(op1, op2, "__add")
    +     if h then
    +       -- call the handler with both operands
    +       return h(op1, op2)
    +     else  -- no handler available: default behavior
    +       error("...")
    +     end
    +   end
    + end
    +
    + +

  • "sub": +the - operation. +Behavior similar to the "add" operation. + +

  • "mul": +the * operation. +Behavior similar to the "add" operation. + +

  • "div": +the / operation. +Behavior similar to the "add" operation. + +

  • "mod": +the % operation. +Behavior similar to the "add" operation, +with the operation +o1 - floor(o1/o2)*o2 as the primitive operation. + +

  • "pow": +the ^ (exponentiation) operation. +Behavior similar to the "add" operation, +with the function pow (from the C math library) +as the primitive operation. + +

  • "unm": +the unary - operation. +
    + function unm_event (op)
    +   local o = tonumber(op)
    +   if o then  -- operand is numeric?
    +     return -o  -- `-' here is the primitive `unm'
    +   else  -- the operand is not numeric.
    +     -- Try to get a handler from the operand
    +     local h = metatable(op).__unm
    +     if h then
    +       -- call the handler with the operand
    +       return h(op)
    +     else  -- no handler available: default behavior
    +       error("...")
    +     end
    +   end
    + end
    +
    + +

  • "concat": +the .. (concatenation) operation. +
    + function concat_event (op1, op2)
    +   if (type(op1) == "string" or type(op1) == "number") and
    +      (type(op2) == "string" or type(op2) == "number") then
    +     return op1 .. op2  -- primitive string concatenation
    +   else
    +     local h = getbinhandler(op1, op2, "__concat")
    +     if h then
    +       return h(op1, op2)
    +     else
    +       error("...")
    +     end
    +   end
    + end
    +
    + +

  • "len": +the # operation. +
    + function len_event (op)
    +   if type(op) == "string" then
    +     return strlen(op)         -- primitive string length
    +   elseif type(op) == "table" then
    +     return #op                -- primitive table length
    +   else
    +     local h = metatable(op).__len
    +     if h then
    +       -- call the handler with the operand
    +       return h(op)
    +     else  -- no handler available: default behavior
    +       error("...")
    +     end
    +   end
    + end
    +
    +See 2.5.5 for a description of the length of a table. + +

  • "eq": +the == operation. +The function getcomphandler defines how Lua chooses a metamethod +for comparison operators. +A metamethod only is selected when both objects +being compared have the same type +and the same metamethod for the selected operation. +
    + function getcomphandler (op1, op2, event)
    +   if type(op1) ~= type(op2) then return nil end
    +   local mm1 = metatable(op1)[event]
    +   local mm2 = metatable(op2)[event]
    +   if mm1 == mm2 then return mm1 else return nil end
    + end
    +
    +The "eq" event is defined as follows: +
    + function eq_event (op1, op2)
    +   if type(op1) ~= type(op2) then  -- different types?
    +     return false   -- different objects
    +   end
    +   if op1 == op2 then   -- primitive equal?
    +     return true   -- objects are equal
    +   end
    +   -- try metamethod
    +   local h = getcomphandler(op1, op2, "__eq")
    +   if h then
    +     return h(op1, op2)
    +   else
    +     return false
    +   end
    + end
    +
    +a ~= b is equivalent to not (a == b). + +

  • "lt": +the < operation. +
    + function lt_event (op1, op2)
    +   if type(op1) == "number" and type(op2) == "number" then
    +     return op1 < op2   -- numeric comparison
    +   elseif type(op1) == "string" and type(op2) == "string" then
    +     return op1 < op2   -- lexicographic comparison
    +   else
    +     local h = getcomphandler(op1, op2, "__lt")
    +     if h then
    +       return h(op1, op2)
    +     else
    +       error("...");
    +     end
    +   end
    + end
    +
    +a > b is equivalent to b < a. + +

  • "le": +the <= operation. +
    + function le_event (op1, op2)
    +   if type(op1) == "number" and type(op2) == "number" then
    +     return op1 <= op2   -- numeric comparison
    +   elseif type(op1) == "string" and type(op2) == "string" then
    +     return op1 <= op2   -- lexicographic comparison
    +   else
    +     local h = getcomphandler(op1, op2, "__le")
    +     if h then
    +       return h(op1, op2)
    +     else
    +       h = getcomphandler(op1, op2, "__lt")
    +       if h then
    +         return not h(op2, op1)
    +       else
    +         error("...");
    +       end
    +     end
    +   end
    + end
    +
    +a >= b is equivalent to b <= a. +Note that, in the absence of a "le" metamethod, +Lua tries the "lt", assuming that a <= b is +equivalent to not (b < a). + +

  • "index": +The indexing access table[key]. +
    + function gettable_event (table, key)
    +   local h
    +   if type(table) == "table" then
    +     local v = rawget(table, key)
    +     if v ~= nil then return v end
    +     h = metatable(table).__index
    +     if h == nil then return nil end
    +   else
    +     h = metatable(table).__index
    +     if h == nil then
    +       error("...");
    +     end
    +   end
    +   if type(h) == "function" then
    +     return h(table, key)      -- call the handler
    +   else return h[key]          -- or repeat operation on it
    +   end
    + end
    +
    + +

  • "newindex": +The indexing assignment table[key] = value. +
    + function settable_event (table, key, value)
    +   local h
    +   if type(table) == "table" then
    +     local v = rawget(table, key)
    +     if v ~= nil then rawset(table, key, value); return end
    +     h = metatable(table).__newindex
    +     if h == nil then rawset(table, key, value); return end
    +   else
    +     h = metatable(table).__newindex
    +     if h == nil then
    +       error("...");
    +     end
    +   end
    +   if type(h) == "function" then
    +     return h(table, key,value)    -- call the handler
    +   else h[key] = value             -- or repeat operation on it
    +   end
    + end
    +
    + +

  • "call": +called when Lua calls a value. +
    + function function_event (func, ...)
    +   if type(func) == "function" then
    +     return func(unpack(arg))   -- primitive call
    +   else
    +     local h = metatable(func).__call
    +     if h then
    +       return h(func, unpack(arg))
    +     else
    +       error("...")
    +     end
    +   end
    + end
    +
    + +

+ +

2.9 - Environments

+ +

Besides metatables, +objects of types thread, function, and userdata +have another table associated with them, +called environment. +Like metatables, environments are regular tables and +multiple objects can share the same environment. + +

Environments associated with userdata has no meaning for Lua. +It is only a feature for programmers to associate a table to +a userdata. + +

Environments associated with threads are called +global environments. +They are used as the default environment for threads and +non-nested functions created by that thread +(through loadfile, loadstring or load) +and can be directly accessed by C code (see 3.3). + +

Environments associated with C functions can be directly +accessed by C code (see 3.3). +They are used as the default environment for other C functions +created by that function. + +

Environments associated with Lua functions are used to resolve +all accesses to global variables within that function (see 2.3). +They are used as the default environment for other Lua functions +created by that function. + +

You can change the environment of a Lua function of the +running thread calling setfenv. +You can get the environment of a Lua function or the running thread +calling getfenv. +To manipulate the environment of other objects +(userdata, C functions, other threads) you must +use the C API. + +

2.10 - Garbage Collection

+ +

Lua does automatic memory management. +That means that +you do not have to worry about allocating memory for new objects +and freeing it when the objects are no longer needed. +Lua manages memory automatically by running +a garbage collector from time to time +to collect all dead objects +(that is, those objects that are no longer accessible from Lua). +All objects in Lua are subject to automatic management: +tables, userdata, functions, threads, and strings. + +

Lua 5.1 implements an incremental mark-and-sweep collector. +It uses two numbers to control its garbage-collection cycles. +One number, the garbage-collector pause, +controls how long the collector waits before starting a new cycle. +Larger values make the collector less aggressive. +Values smaller than 1 mean the collector will not wait to +start a new cycle. +A value of 2 means that the collector waits more or less to double +the total memory in use before starting a new cycle. + +

The other number, the garbage-collector multiplier, +controls the relative speed of the collector relative to +memory allocation. +Larger values make the collector more aggressive but also increases +the size of each incremental step. +Values smaller than 1 make the collector too slow and +may result in the collector never finishing a cycle. +The default, 2, means that the collector runs at "twice" +the speed of memory allocation. + +

You can change those numbers calling lua_gc in C +or collectgarbage in Lua. +Both get as arguments percentage points +(so an argument 100 means a real value of 1). +With those functions you can also get direct control +of the collector (e.g., stop and restart it). + +

2.10.1 - Garbage-Collection Metamethods

+ +

Using the C API, +you can set garbage-collector metamethods for userdata (see 2.8). +These metamethods are also called finalizers. +Finalizers allow you to coordinate Lua's garbage collection +with external resource management +(such as closing files, network or database connections, +or freeing your own memory). + +

Free userdata with a field __gc in their metatables are not +collected immediately by the garbage collector. +Instead, Lua puts them in a list. +After the collection, +Lua does the equivalent of the following function +for each userdata in that list: +

+ function gc_event (udata)
+   local h = metatable(udata).__gc
+   if h then
+     h(udata)
+   end
+ end
+
+ +

At the end of each garbage-collection cycle, +the finalizers for userdata are called in reverse +order of their creation, +among those collected in that cycle. +That is, the first finalizer to be called is the one associated +with the userdata created last in the program. + +

2.10.2 - Weak Tables

+ +

A weak table is a table whose elements are +weak references. +A weak reference is ignored by the garbage collector. +In other words, +if the only references to an object are weak references, +then the garbage collector will collect that object. + +

A weak table can have weak keys, weak values, or both. +A table with weak keys allows the collection of its keys, +but prevents the collection of its values. +A table with both weak keys and weak values allows the collection of +both keys and values. +In any case, if either the key or the value is collected, +the whole pair is removed from the table. +The weakness of a table is controlled by the value of the +__mode field of its metatable. +If the __mode field is a string containing the character `k´, +the keys in the table are weak. +If __mode contains `v´, +the values in the table are weak. + +

After you use a table as a metatable, +you should not change the value of its field __mode. +Otherwise, the weak behavior of the tables controlled by this +metatable is undefined. + +

2.11 - Coroutines

+ +

Lua supports coroutines, +also called collaborative multithreading. +A coroutine in Lua represents an independent thread of execution. +Unlike threads in multithread systems, however, +a coroutine only suspends its execution by explicitly calling +a yield function. + +

You create a coroutine with a call to coroutine.create. +Its sole argument is a function +that is the main function of the coroutine. +The create function only creates a new coroutine and +returns a handle to it (an object of type thread); +it does not start the coroutine execution. + +

When you first call coroutine.resume, +passing as its first argument +the thread returned by coroutine.create, +the coroutine starts its execution, +at the first line of its main function. +Extra arguments passed to coroutine.resume are given as +parameters for the coroutine main function. +After the coroutine starts running, +it runs until it terminates or yields. + +

A coroutine can terminate its execution in two ways: +Normally, when its main function returns +(explicitly or implicitly, after the last instruction); +and abnormally, if there is an unprotected error. +In the first case, coroutine.resume returns true, +plus any values returned by the coroutine main function. +In case of errors, coroutine.resume returns false +plus an error message. + +

A coroutine yields by calling coroutine.yield. +When a coroutine yields, +the corresponding coroutine.resume returns immediately, +even if the yield happens inside nested function calls +(that is, not in the main function, +but in a function directly or indirectly called by the main function). +In the case of a yield, coroutine.resume also returns true, +plus any values passed to coroutine.yield. +The next time you resume the same coroutine, +it continues its execution from the point where it yielded, +with the call to coroutine.yield returning any extra +arguments passed to coroutine.resume. + +

The coroutine.wrap function creates a coroutine +like coroutine.create, +but instead of returning the coroutine itself, +it returns a function that, when called, resumes the coroutine. +Any arguments passed to that function +go as extra arguments to resume. +The function returns all the values returned by resume, +except the first one (the boolean error code). +Unlike coroutine.resume, +this function does not catch errors; +any error is propagated to the caller. + +

As an example, +consider the next code: +

+function foo1 (a)
+  print("foo", a)
+  return coroutine.yield(2*a)
+end
+
+co = coroutine.create(function (a,b)
+      print("co-body", a, b)
+      local r = foo1(a+1)
+      print("co-body", r)
+      local r, s = coroutine.yield(a+b, a-b)
+      print("co-body", r, s)
+      return b, "end"
+end)
+       
+a, b = coroutine.resume(co, 1, 10)
+print("main", a, b)
+a, b, c = coroutine.resume(co, "r")
+print("main", a, b, c)
+a, b, c = coroutine.resume(co, "x", "y")
+print("main", a, b, c)
+a, b = coroutine.resume(co, "x", "y")
+print("main", a, b)
+
+When you run it, it produces the following output: +
+co-body 1       10
+foo     2
+main    true    4
+co-body r
+main    true    11      -9
+co-body x       y
+main    true    10      end
+main    false   cannot resume dead coroutine
+
+ +

+

3 - The Application Program Interface

+ + +

This section describes the C API for Lua, that is, +the set of C functions available to the host program to communicate +with Lua. +All API functions and related types and constants +are declared in the header file lua.h. + +

Even when we use the term "function", +any facility in the API may be provided as a macro instead. +All such macros use each of its arguments exactly once +(except for the first argument, which is always a Lua state), +and so do not generate hidden side-effects. + +

Like in most C libraries, +the Lua API functions do not check their arguments. +However, you can change this behavior by compiling Lua +with a proper definition for the macro luai_apicheck, +in file luaconf.h. + +

3.1 - The Stack

+ +

Lua uses a virtual stack to pass values to and from C. +Each element in this stack represents a Lua value +(nil, number, string, etc.). + +

Whenever Lua calls C, the called function gets a new stack, +which is independent of previous stacks and of stacks of +C functions that are still active. +That stack initially contains any arguments to the C function, +and it is where the C function pushes its results +to be returned to the caller (see lua_CFunction). + +

For convenience, +most query operations in the API do not follow a strict stack discipline. +Instead, they can refer to any element in the stack +by using an index: +A positive index represents an absolute stack position +(starting at 1); +a negative index represents an offset from the top of the stack. +More specifically, if the stack has n elements, +then index 1 represents the first element +(that is, the element that was pushed onto the stack first) +and +index n represents the last element; +index -1 also represents the last element +(that is, the element at the top) +and index -n represents the first element. +We say that an index is valid +if it lies between 1 and the stack top +(that is, if 1 <= abs(index) <= top). + + +

3.2 - Stack Size

+ +

When you interact with Lua API, +you are responsible for controlling stack overflow. +You can use the function lua_checkstack +to grow the stack size. + +

Whenever Lua calls C, +it ensures that at least LUA_MINSTACK stack positions are available. +LUA_MINSTACK is defined as 20, +so that usually you do not have to worry about stack space +unless your code has loops pushing elements onto the stack. + +

Most query functions accept as indices any value inside the +available stack space, that is, indices up to the maximum stack size +you have set through lua_checkstack. +Such indices are called acceptable indices. +More formally, we define an acceptable index +as follows: +

+     (index < 0 && abs(index) <= top) || (index > 0 && index <= stackspace)
+
+Note that 0 is never an acceptable index. + +

3.3 - Pseudo-Indices

+ +

Unless otherwise noted, +any function that accepts valid indices can also be called with +pseudo-indices, +which represent some Lua values that are accessible to the C code +but are not in the stack. +Pseudo-indices are used to access the thread environment, +the function environment, +the registry, +and the upvalues of a C function (see 3.4). + +

The thread environment (where global variables live) is +always at pseudo-index LUA_GLOBALSINDEX. +The environment of the running C function is always +at pseudo-index LUA_ENVIRONINDEX. + +

To access and change the value of global variables, +you can use regular table operations over an environment table. +For instance, to access the value of a global variable, do +

+       lua_getfield(L, LUA_GLOBALSINDEX, varname);
+
+ +

3.4 - C Closures

+ +

When a C function is created, +it is possible to associate some values with it, +thus creating a C closure; +these values are then accessible to the function whenever it is called +(see lua_pushcclosure). + +

Whenever a C function is called, +its associated values are located at specific pseudo-indices. +Those pseudo-indices are produced by the macro +lua_upvalueindex. +The first value associated with a function is at position +lua_upvalueindex(1), and so on. +Any access to lua_upvalueindex(n), +where n is greater than the number of upvalues of the +current function, +produces an acceptable (but invalid) index. + +

3.5 - Registry

+ +

Lua provides a registry, +a pre-defined table that can be used by any C code to +store whatever Lua value it needs to store. +This table is always located at pseudo-index +LUA_REGISTRYINDEX. +Any C library can store data into this table, +as long as it chooses keys different from other libraries. +Typically, you should use as key a string containing your library name +or a light userdata with the address of a C object in your code. + +

The integer keys in the registry are used by the reference mechanism, +implemented by the auxiliary library, +and therefore should not be used by other purposes. + +

3.6 - Error Handling in C

+ +

Internally, Lua uses the C longjmp facility to handle errors. +When Lua faces any error +(such as memory allocation errors, type errors, syntax errors) +it raises an error, that is, it does a long jump. +A protected environment uses setjmp +to set a recover point; +any error jumps to the most recent active recover point. + +

Almost any function in the API may raise an error, +for instance due to a memory allocation error. +The following functions run in protected mode +(that is, they create a protected environment to run), +so they never raise an error: +lua_newstate, lua_close, lua_load, +lua_pcall, and lua_cpcall. + +

Inside a C function you can raise an error calling lua_error. + +

3.7 - Functions and Types

+ +

Here we list all functions and types from the C API in +alphabetical order. + +

+


lua_Alloc

+
+          typedef void * (*lua_Alloc) (void *ud,
+                                       void *ptr,
+                                       size_t osize,
+                                       size_t nsize);
+
+
+ + +

The allocator function used by Lua states. +The allocator function must provide a +functionality similar to realloc, +but not exactly the same. +Its arguments are ud, +the opaque pointer passed to lua_newstate; +ptr, a pointer to the block being allocated/reallocated/freed; +osize, the original size of the block; +nsize, the new size of the block. +ptr is NULL if and only if osize is zero. +When nsize is zero, the allocator must return NULL; +if osize is not zero, +it should free the block pointed by ptr. +When nsize is not zero, the allocator returns NULL +if and only if it cannot fill the request. +When nsize is not zero and osize is zero, +the allocator behaves like malloc. +When nsize and osize are not zero, +the allocator behaves like realloc. +Lua assumes that the allocator never fails when +osize >= nsize. + +

A simple implementation for the allocator function could be like this: +

+static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
+  (void)ud;     /* not used */
+  (void)osize;  /* not used */
+  if (nsize == 0) {
+    free(ptr);  /* ANSI ensures that free(NULL) has no effect */
+    return NULL;
+  }
+  else
+    /* ANSI ensures that realloc(NULL, size) == malloc(size) */
+    return realloc(ptr, nsize);
+}
+
+ +

+


lua_atpanic

+
+          lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
+
+ + +

Sets a new panic function and returns the old one. + +

If an error happens outside any protected environment, +Lua calls a panic function +and then calls exit(EXIT_FAILURE). +Your new panic function may avoid the application exit by +never returning (e.g., doing a long jump). + +

The panic function can access the error message at the top of the stack. + +

+


lua_call

+
+          void lua_call (lua_State *L, int nargs, int nresults);
+
+ + +

Calls a function. + +

To call a function you must use the following protocol: +First, the function to be called is pushed onto the stack; +then, the arguments to the function are pushed +in direct order, that is, the first argument is pushed first. +Finally you call lua_call; +nargs is the number of arguments that you pushed onto the stack. +All arguments and the function value are popped from the stack, +and the function results are pushed. +The number of results are adjusted to nresults, +unless nresults is LUA_MULTRET. +In that case, all results from the function are pushed. +Lua takes care that the returned values fit into the stack space. +The function results are pushed onto the stack in direct order +(the first result is pushed first), +so that after the call the last result is on the top. + +

Any error inside the called function is propagated upwards +(with a longjmp). + +

The following example shows how the host program may do the +equivalent to this Lua code: +

+       a = f("how", t.x, 14)
+
+Here it is in C: +
+    lua_getfield(L, LUA_GLOBALSINDEX, "t");     /* global `t' (for later use) */
+    lua_getfield(L, LUA_GLOBALSINDEX, "f");          /* function to be called */
+    lua_pushstring(L, "how");                                 /* 1st argument */
+    lua_getfield(L, -3, "x");                 /* push result of t.x (2nd arg) */
+    lua_pushinteger(L, 14);                                   /* 3rd argument */
+    lua_call(L, 3, 1);         /* call function with 3 arguments and 1 result */
+    lua_setfield(L, LUA_GLOBALSINDEX, "a");        /* set global variable `a' */
+    lua_pop(L, 1);                               /* remove `t' from the stack */
+
+Note that the code above is "balanced": +at its end, the stack is back to its original configuration. +This is considered good programming practice. + +

+


lua_CFunction

+
+          typedef int (*lua_CFunction) (lua_State *L);
+
+ + +

Type for C functions. + +

In order to communicate properly with Lua, +a C function must follow the following protocol, +which defines the way parameters and results are passed: +A C function receives its arguments from Lua in its stack +in direct order (the first argument is pushed first). +So, when the function starts, +its first argument (if any) is at index 1. +To return values to Lua, a C function just pushes them onto the stack, +in direct order (the first result is pushed first), +and returns the number of results. +Any other value in the stack below the results will be properly +discharged by Lua. +Like a Lua function, a C function called by Lua can also return +many results. + +

As an example, the following function receives a variable number +of numerical arguments and returns their average and sum: +

+       static int foo (lua_State *L) {
+         int n = lua_gettop(L);    /* number of arguments */
+         lua_Number sum = 0;
+         int i;
+         for (i = 1; i <= n; i++) {
+           if (!lua_isnumber(L, i)) {
+             lua_pushstring(L, "incorrect argument to function `average'");
+             lua_error(L);
+           }
+           sum += lua_tonumber(L, i);
+         }
+         lua_pushnumber(L, sum/n);        /* first result */
+         lua_pushnumber(L, sum);         /* second result */
+         return 2;                   /* number of results */
+       }
+
+ +

+


lua_checkstack

+
+          int lua_checkstack (lua_State *L, int extra);
+
+ + +

Grows the stack size to top + extra elements; +it returns false if it cannot grow the stack to that size. +This function never shrinks the stack; +if the stack is already larger than the new size, +it is left unchanged. + +

+


lua_close

+
+          void lua_close (lua_State *L);
+
+ + +

Destroys all objects in the given Lua state +(calling the corresponding garbage-collection metamethods, if any) +and frees all dynamic memory used by that state. +On several platforms, you may not need to call this function, +because all resources are naturally released when the host program ends. +On the other hand, long-running programs, +such as a daemon or a web server, +might need to release states as soon as they are not needed, +to avoid growing too large. + +

+


lua_concat

+
+          void lua_concat (lua_State *L, int n);
+
+ + +

Concatenates the n values at the top of the stack, +pops them, and leaves the result at the top. +If n is 1, the result is that single string +(that is, the function does nothing); +if n is 0, the result is the empty string. +Concatenation is done following the usual semantics of Lua +(see 2.5.4). + +

+


lua_cpcall

+
+          int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);
+
+ + +

Calls the C function func in protected mode. +func starts with only one element in its stack, +a light userdata containing ud. +In case of errors, +lua_cpcall returns the same error codes as lua_pcall, +plus the error object on the top of the stack; +otherwise, it returns zero, and does not change the stack. +Any value returned by func is discarded. + +

+


lua_createtable

+
+          void lua_createtable (lua_State *L, int narr, int nrec);
+
+ + +

Creates a new empty table and pushes it onto the stack. +The new table has space pre-allocated +for narr array elements plus nrec non-array elements. +This pre-allocation is useful when you know exactly how many elements +the table will have. +Otherwise you can use the function lua_newtable. + +

+


lua_dump

+
+          int lua_dump (lua_State *L, lua_Writer writer, void *data);
+
+ + +

Dumps a function as a binary chunk. +This function receives a Lua function on the top of the stack +and produces a binary chunk that, +if loaded again, +results in a function equivalent to the one dumped. +As it produces parts of the chunk, +lua_dump calls function writer (see lua_Writer) +to write them. + +

The value returned is the error code returned by the last +call to the writer; +0 means no errors. + +

This function does not pop the function from the stack. + +

+


lua_equal

+
+          int lua_equal (lua_State *L, int index1, int index2);
+
+ + +

Returns 1 if the two values in acceptable indices index1 and +index2 are equal, +following the semantics of the Lua = operator +(that is, may call metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices are non valid. + +

+


lua_error

+
+          int lua_error (lua_State *L);
+
+ + +

Generates a Lua error. +The error message (which actually can be any type of object) +must be on the stack top. +This function does a long jump, +and therefore never returns. + +

+


lua_gc

+
+          int lua_gc (lua_State *L, int what, int data);
+
+ + +

Controls the garbage collector. + +

This function performs several tasks, +according to the value of the parameter what: +

    +
  • LUA_GCSTOP— stops the garbage collector. +
  • LUA_GCRESTART— restarts the garbage collector. +
  • LUA_GCCOLLECT— performs a full garbage-collection cycle. +
  • LUA_GCCOUNT— returns the current +amount of memory (in Kbytes) in use by Lua. +
  • LUA_GCSTEP— performs an incremental step of +garbage collection. +The step "size" is controlled by data +(larger values mean more steps) in a non-specified way. +If you want to control the step size +you must tune experimentally the value of data. +The function returns 1 if that step finished a +garbage-collection cycle. +
  • LUA_GCSETPAUSE— +sets data/100 as the new value +for the pause of the collector (see 2.10). +
  • LUA_GCSETSTEPMUL— +sets arg/100 as the new value for the step multiplier of +the collector (see 2.10). +
+ +

+


lua_getallocf

+
+          lua_Alloc lua_getallocf (lua_State *L, void **ud);
+
+ + +

Returns the allocator function of a given state. +If ud is not NULL Lua stores in *ud the +opaque pointer passed to lua_newstate. + +

+


lua_getfenv

+
+          void lua_getfenv (lua_State *L, int index);
+
+ + +

Pushes on the stack the environment table of +the value at the given index. + +

+


lua_getfield

+
+          void lua_getfield (lua_State *L, int index, const char *k);
+
+ + +

Pushes onto the stack the value t[k], +where t is the value at the given valid index index. +As in Lua, this function may trigger a metamethod +for the "index" event (see 2.8). + +

+


lua_getmetatable

+
+          int lua_getmetatable (lua_State *L, int index);
+
+ + +

Pushes onto the stack the metatable of the value at the given +acceptable index. +If the index is not valid, +or if the value does not have a metatable, +returns 0 and pushes nothing on the stack. + +

+


lua_gettable

+
+          void lua_gettable (lua_State *L, int index);
+
+ + +

Pushes onto the stack the value t[k], +where t is the value at the given valid index index +and k is the value at the top of the stack. + +

This function pops the key from the stack +(putting the resulting value in its place). +As in Lua, this function may trigger a metamethod +for the "index" event (see 2.8). + +

+


lua_gettop

+
+          int lua_gettop (lua_State *L);
+
+ + +

Returns the index of the top element in the stack. +Because indices start at 1, +that result is equal to the number of elements in the stack +(and so 0 means an empty stack). + +

+


lua_insert

+
+          void lua_insert (lua_State *L, int index);
+
+ + +

Moves the top element into the given valid index, +shifting up the elements above that position to open space. +Cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + +

+


lua_Integer

+
+          typedef ptrdiff_t lua_Integer;
+
+ + +

The type used by the Lua API to represent integral values. + +

By default it is a ptrdiff_t, +which is usually the largest type the machine handles +"comfortably". + +

+


lua_isboolean

+
+          int lua_isboolean (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index has type boolean, +and 0 otherwise. + +

+


lua_iscfunction

+
+          int lua_iscfunction (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a C function, +and 0 otherwise. + +

+


lua_isfunction

+
+          int lua_isfunction (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a function +(either C or Lua), and 0 otherwise. + +

+


lua_islightuserdata

+
+          int lua_islightuserdata (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a light userdata, +and 0 otherwise. + +

+


lua_isnil

+
+          int lua_isnil (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is nil, +and 0 otherwise. + +

+


lua_isnumber

+
+          int lua_isnumber (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a number +or a string convertible to a number, +and 0 otherwise. + +

+


lua_isstring

+
+          int lua_isstring (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a string +or a number (which is always convertible to a string), +and 0 otherwise. + +

+


lua_istable

+
+          int lua_istable (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a table, +and 0 otherwise. + +

+


lua_isthread

+
+          int lua_isthread (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a thread, +and 0 otherwise. + +

+


lua_isuserdata

+
+          int lua_isuserdata (lua_State *L, int index);
+
+ + +

Returns 1 if the value at the given acceptable index is a userdata +(either full or light), and 0 otherwise. + +

+


lua_lessthan

+
+          int lua_lessthan (lua_State *L, int index1, int index2);
+
+ + +

Returns 1 if the value in acceptable index index1 is smaller +than the value in acceptable index index2, +following the semantics of the Lua < operator +(that is, may call metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices are non valid. + +

+


lua_load

+
+          int lua_load (lua_State *L, lua_Reader reader, void *data,
+                                      const char *chunkname);
+
+
+ + +

Loads a Lua chunk. +If there are no errors, +lua_load pushes the compiled chunk as a Lua +function on top of the stack. +Otherwise, it pushes an error message. +The return values of lua_load are: +

    +
  • 0 — no errors; +
  • LUA_ERRSYNTAX — +syntax error during pre-compilation. +
  • LUA_ERRMEM — +memory allocation error. +
+ +

lua_load automatically detects whether the chunk is text or binary, +and loads it accordingly (see program luac). + +

lua_load uses a user-supplied reader function to read the chunk +(see lua_Reader). +The data argument is an opaque value passed to the reader function. + +

The chunkname argument gives the chunk name. +It is used for error messages and debug information (see 3.8). + +

+


lua_newstate

+
+          lua_State *lua_newstate (lua_Alloc f, void *ud);
+
+ + +

Creates a new, independent state. +Returns NULL if cannot create the state +(not enough memory). +The argument f is the allocator function; +Lua does all memory allocation for that state through that function. +The second argument, ud, is an opaque pointer that Lua +simply passes to the allocator in every call. + +

+


lua_newtable

+
+          void lua_newtable (lua_State *L);
+
+ + +

Creates a new empty table and pushes it onto the stack. +Equivalent to lua_createtable(L, 0, 0). + +

+


lua_newthread

+
+          lua_State *lua_newthread (lua_State *L);
+
+ + +

Creates a new thread, pushes it on the stack, +and returns a pointer to a lua_State that represents this new thread. +The new state returned by this function shares with the original state +all global objects (such as tables), +but has an independent run-time stack. + +

There is no explicit function to close or to destroy a thread. +Threads are subject to garbage collection, +like any Lua object. + +

+


lua_newuserdata

+
+          void *lua_newuserdata (lua_State *L, size_t size);
+
+ + +

This function allocates a new block of memory with the given size, +pushes on the stack a new full userdata with the block address, +and returns this address. + +

Userdata represents C values in Lua. +A full userdata represents a block of memory. +It is an object (like a table): +You must create it, it can have its own metatable, +and you can detect when it is being collected. +A full userdata is only equal to itself (under raw equality). + +

When Lua collects a full userdata, +it calls the userdata's gc metamethod, if any, +and then it frees the userdata's corresponding memory. + +

+


lua_next

+
+          int lua_next (lua_State *L, int index);
+
+ + +

Pops a key from the stack, +and pushes a key-value pair from the table +(the "next" pair after the given key). +If there are no more elements, +then lua_next returns 0 (and pushes nothing). + +

A typical traversal looks like this: +

+       /* table is in the stack at index `t' */
+       lua_pushnil(L);  /* first key */
+       while (lua_next(L, t) != 0) {
+         /* `key' is at index -2 and `value' at index -1 */
+         printf("%s - %s\n",
+           lua_typename(L, lua_type(L, -2)), lua_typename(L, lua_type(L, -1)));
+         lua_pop(L, 1);  /* removes `value'; keeps `key' for next iteration */
+       }
+
+ +

While traversing a table, +do not call lua_tolstring directly on a key, +unless you know that the key is actually a string. +Recall that lua_tolstring changes +the value at the given index; +this confuses the next call to lua_next. + +

+


lua_Number

+
+          typedef double lua_Number;
+
+ + +

The type of numbers in Lua. + +

Through the configuration file you can change +Lua to operate with other type for numbers (e.g., float or long). + +

+


lua_objlen

+
+          size_t lua_objlen (lua_State *L, int index);
+
+ + +

Returns the "length" of the value at the given acceptable index: +For strings, this is the string length; +for tables, this is the result of the length operator (`#´). +for userdata, this is the size of the block of memory allocated +for the userdatum. +For other values, returns 0. + +

+


lua_pcall

+
+          lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
+
+ + +

Calls a function in protected mode. + +

Both nargs and nresults have the same meaning as +in lua_call. +If there are no errors during the call, +lua_pcall behaves exactly like lua_call. +However, if there is any error, +lua_pcall catches it, +pushes a single value on the stack (the error message), +and returns an error code. +Like lua_call, +lua_pcall always removes the function +and its arguments from the stack. + +

If errfunc is 0, +then the error message returned is exactly the original error message. +Otherwise, errfunc is the stack index of an +error handler function. +(In the current implementation, that index cannot be a pseudo-index.) +In case of runtime errors, +that function will be called with the error message +and its return value will be the message returned by lua_pcall. + +

Typically, the error handler function is used to add more debug +information to the error message, such as a stack traceback. +Such information cannot be gathered after the return of lua_pcall, +since by then the stack has unwound. + +

The lua_pcall function returns 0 in case of success +or one of the following error codes +(defined in lua.h): +

    +
  • LUA_ERRRUN — a runtime error. +
  • LUA_ERRMEM — memory allocation error. +For such errors, Lua does not call the error handler function. +
  • LUA_ERRERR — +error while running the error handler function. +
+ +

+


lua_pop

+
+          void lua_pop (lua_State *L, int n);
+
+ + +

Pops n elements from the stack. + +

+


lua_pushboolean

+
+          void lua_pushboolean (lua_State *L, int b);
+
+ + +

Pushes a boolean value with value b onto the stack. + +

+


lua_pushcclosure

+
+          void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
+
+ + +

Pushes a new C closure onto the stack. + +

When a C function is created, +it is possible to associate some values with it, +thus creating a C closure (see 3.4); +these values are then accessible to the function whenever it is called. +To associate values with a C function, +first these values should be pushed onto the stack +(when there are multiple values, the first value is pushed first). +Then the function lua_pushcclosure +is used to create and push the C function onto the stack, +with the argument n telling how many values should be +associated with the function. +lua_pushcclosure also pops these values from the stack. + +

+


lua_pushcfunction

+
+          void lua_pushcfunction (lua_State *L, lua_CFunction f);
+
+ + +

Pushes a C function onto the stack. +This function is equivalent to lua_pushcclosure(L, f, 0);. + +

+


lua_pushfstring

+
+          const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
+
+ + +

Pushes onto the stack a formatted string +and returns a pointer to that string. +It is similar to the C function sprintf +but with some important differences: +

    +
  • You do not have to allocate the space for the result: +The result is a Lua string and Lua takes care of memory allocation +(and deallocation, through garbage collection). +
  • The conversion specifiers are quite restricted. +There are no flags, widths, or precisions. +The conversion specifiers can be simply +`%%´ (inserts a `%´ in the string), +`%s´ (inserts a zero-terminated string, with no size restrictions), +`%f´ (inserts a lua_Number), +`%p´ (inserts a pointer as an hexadecimal numeral), +`%d´ (inserts an int), and +`%c´ (inserts an int as a character). +
+ +

+


lua_pushinteger

+
+          void lua_pushinteger (lua_State *L, lua_Integer n);
+
+ + +

Pushes a number with value n onto the stack. + +

+


lua_pushlightuserdata

+
+          void lua_pushlightuserdata (lua_State *L, void *p);
+
+ + +

Pushes a light userdata onto the stack. + +

Userdata represents C values in Lua. +A light userdata represents a pointer. +It is a value (like a number): +You do not create it, it has no metatables, +it is not collected (as it was never created). +A light userdata is equal to "any" +light userdata with the same C address. + +

+


lua_pushlstring

+
+          void lua_pushlstring (lua_State *L, const char *s, size_t len);
+
+ + +

Pushes the string pointed by s with size len +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. + +

+


lua_pushnil

+
+          void lua_pushnil (lua_State *L);
+
+ + +

Pushes a nil value onto the stack. + +

+


lua_pushnumber

+
+          void lua_pushnumber (lua_State *L, lua_Number n);
+
+ + +

Pushes a number with value n onto the stack. + +

+


lua_pushstring

+
+          void lua_pushstring (lua_State *L, const char *s);
+
+ + +

Pushes the zero-terminated string pointed by s +onto the stack. +Lua makes (or reuses) an internal copy of the given string, +so the memory at s can be freed or reused immediately after +the function returns. + +

+


lua_pushvalue

+
+          void lua_pushvalue (lua_State *L, int index);
+
+ + +

Pushes a copy of the element at the given valid index +onto the stack. + +

+


lua_pushvfstring

+
+          const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp);
+
+ + +

Equivalent to lua_pushfstring, except that it receives a va_list +instead of a variable number of arguments. + +

+


lua_rawequal

+
+          int lua_rawequal (lua_State *L, int index1, int index2);
+
+ + +

Returns 1 if the two values in acceptable indices index1 and +index2 are primitively equal +(that is, without calling metamethods). +Otherwise returns 0. +Also returns 0 if any of the indices are non valid. + +

+


lua_rawget

+
+          void lua_rawget (lua_State *L, int index);
+
+ + +

Similar to lua_gettable, but doing a raw indexing +(i.e., without metamethods). + +

+


lua_rawgeti

+
+          void lua_rawgeti (lua_State *L, int index, int n);
+
+ + +

Pushes onto the stack the value t[n], +where t is the value at the given valid index index. +The access is raw, +that is, it does not invoke metamethods. + +

+


lua_rawset

+
+          void lua_rawset (lua_State *L, int index);
+
+ + +

Similar to lua_settable, but doing a raw assignment +(i.e., without metamethods). + +

+


lua_rawseti

+
+          void lua_rawseti (lua_State *L, int index, int n);
+
+ + +

Does the equivalent to t[n] = v, +where t is the value at the given valid index index +and v is the value at the top of the stack, + +

This function pops the value from the stack. +The assignment is raw, +that is, it does not invoke metamethods. + +

+


lua_Reader

+
+          typedef const char * (*lua_Reader)
+                               (lua_State *L, void *data, size_t *size);
+
+
+ + +

The reader function used by lua_load. +Every time it needs another piece of the chunk, +lua_load calls the reader, +passing along its data parameter. +The reader must return a pointer to a block of memory +with a new piece of the chunk +and set size to the block size. +To signal the end of the chunk, the reader returns NULL. +The reader function may return pieces of any size greater than zero. + +

+


lua_remove

+
+          void lua_remove (lua_State *L, int index);
+
+ + +

Removes the element at the given valid index, +shifting down the elements above that position to fill the gap. +Cannot be called with a pseudo-index, +because a pseudo-index is not an actual stack position. + +

+


lua_replace

+
+          void lua_replace (lua_State *L, int index);
+
+ + +

Moves the top element into the given position (and pops it), +without shifting any element +(therefore replacing the value at the given position). + +

+


lua_resume

+
+          int lua_resume (lua_State *L, int narg);
+
+ + +

Starts and resumes a coroutine in a given thread. + +

To start a coroutine, you first create a new thread +(see lua_newthread); +then you push on its stack the body function plus any eventual arguments; +then you call lua_resume, +with narg being the number of arguments. +This call returns when the coroutine suspends or finishes its execution. +When it returns, the stack contains all values passed to lua_yield, +or all values returned by the body function. +lua_resume returns 0 if there are no errors running the coroutine, +or an error code (see lua_pcall). +In case of errors, +the stack is not unwound, +so you can use the debug API over it; +The error message is on the top of the stack. +To restart a coroutine, you put on its stack only the values to +be passed as results from yield, +and then call lua_resume. + +

+


lua_setfenv

+
+          int lua_setfenv (lua_State *L, int index);
+
+ + +

Pops a table from the stack and sets it as +the new environment for the value at the given index. +If the value at the given index is +neither a function nor a thread nor a userdata, +lua_setfenv returns 0 (false). + +

+


lua_setfield

+
+          void lua_setfield (lua_State *L, int index, const char *k);
+
+ + +

Does the equivalent to t[k] = v, +where t is the value at the given valid index index +and v is the value at the top of the stack, + +

This function pops the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see 2.8). + +

+


lua_setmetatable

+
+          int lua_setmetatable (lua_State *L, int index);
+
+ + +

Pops a table from the stack and +sets it as the new metatable for the value at the given +acceptable index. + +

+


lua_settable

+
+          void lua_settable (lua_State *L, int index);
+
+ + +

Does the equivalent to t[k] = v, +where t is the value at the given valid index index, +v is the value at the top of the stack, +and k is the value just below the top. + +

This function pops both the key and the value from the stack. +As in Lua, this function may trigger a metamethod +for the "newindex" event (see 2.8). + +

+


lua_settop

+
+          void lua_settop (lua_State *L, int index);
+
+ + +

Accepts any acceptable index, or 0, +and sets the stack top to that index. +If the new top is larger than the old one, +then the new elements are filled with nil. +If index is 0, then all stack elements are removed. + +

+


lua_State

+
+          typedef struct lua_State lua_State;
+
+ + +

Opaque structure that keeps the whole state of a Lua interpreter. +The Lua library is fully reentrant: +it has no global variables. +All information about a state is kept in this structure. + +

A pointer to this state must be passed as the first argument to +every function in the library, except to lua_newstate, +which creates a Lua state from scratch. + +

+


lua_toboolean

+
+          int lua_toboolean (lua_State *L, int index);
+
+ + +

Converts the Lua value at the given acceptable index to a C boolean +value ((0 or 1). +Like all tests in Lua, +lua_toboolean returns 1 for any Lua value +different from false and nil; +otherwise it returns 0. +It also returns 0 when called with a non-valid index. +(If you want to accept only real boolean values, +use lua_isboolean to test the value's type.) + +

+


lua_tocfunction

+
+          lua_CFunction lua_tocfunction (lua_State *L, int index);
+
+ + +

Converts a value at the given acceptable index to a C function. +That value must be a C function; +otherwise, returns NULL. + +

+


lua_tointeger

+
+          lua_Integer lua_tointeger (lua_State *L, int idx);
+
+ + +

Converts the Lua value at the given acceptable index +to the signed integral type lua_Integer. +The Lua value must be a number or a string convertible to number +(see 2.2.1); +otherwise, lua_tointeger returns 0. + +

If the number is not an integer, +it is truncated in some non-specified way. + +

+


lua_tolstring

+
+          const char *lua_tolstring (lua_State *L, int index, size_t *len);
+
+ + +

Converts the Lua value at the given acceptable index to a string +(const char*). +If len is not NULL, +it also sets *len with the string length. +The Lua value must be a string or a number; +otherwise, the function returns NULL. +If the value is a number, +then lua_tolstring also +changes the actual value in the stack to a string. +(This change confuses lua_next +when lua_tolstring is applied to keys.) + +

lua_tolstring returns a fully aligned pointer +to a string inside the Lua state. +This string always has a zero ('\0') +after its last character (as in C), +but may contain other zeros in its body. +Because Lua has garbage collection, +there is no guarantee that the pointer returned by lua_tolstring +will be valid after the corresponding value is removed from the stack. + +

+


lua_tonumber

+
+          lua_Number lua_tonumber (lua_State *L, int index);
+
+ + +

Converts the Lua value at the given acceptable index +to a number (see lua_Number). +The Lua value must be a number or a string convertible to number +(see 2.2.1); +otherwise, lua_tonumber returns 0. + +

+


lua_topointer

+
+          const void *lua_topointer (lua_State *L, int index);
+
+ + +

Converts the value at the given acceptable index to a generic +C pointer (void *). +The value may be a userdata, a table, a thread, or a function; +otherwise, lua_topointer returns NULL. +Lua ensures that different objects return different pointers. +There is no direct way to convert the pointer back to its original value. + +

Typically this function is used for debug information. + +

+


lua_tostring

+
+          const char *lua_tostring (lua_State *L, int index);
+
+ + +

Equivalent to lua_tolstring with len equal to NULL. + +

+


lua_tothread

+
+          lua_State *lua_tothread (lua_State *L, int index);
+
+ + +

Converts the value at the given acceptable index to a Lua thread +(represented as lua_State *). +This value must be a thread; +otherwise, the function returns NULL. + +

+


lua_touserdata

+
+          void *lua_touserdata (lua_State *L, int index);
+
+ + +

If the value at the given acceptable index is a full userdata, +returns its block address. +If the value is a light userdata, +returns its pointer. +Otherwise, returns NULL. + +

+


lua_type

+
+          int lua_type (lua_State *L, int index);
+
+ + +

Returns the type of a value in the given acceptable index, +or LUA_TNONE for a non-valid index +(that is, an index to an "empty" stack position). +The types returned by lua_type are coded by the following constants +defined in lua.h: +LUA_TNIL, +LUA_TNUMBER, +LUA_TBOOLEAN, +LUA_TSTRING, +LUA_TTABLE, +LUA_TFUNCTION, +LUA_TUSERDATA, +LUA_TTHREAD, +LUA_TLIGHTUSERDATA. + +

+


lua_Writer

+
+          typedef int (*lua_Writer)
+                          (lua_State *L, const void* p, size_t sz, void* ud);
+
+
+ + +

The writer function used by lua_dump. +Every time it produces another piece of chunk, +lua_dump calls the writer, +passing along the buffer to be written (p), +its size (sz), +and the data parameter supplied to lua_dump. + +

The writer returns an error code: +0 means no errors; +any other value means an error and stops lua_dump from +calling the writer again. + +

+


lua_xmove

+
+          void lua_xmove (lua_State *from, lua_State *to, int n);
+
+ + +

Exchange values between different threads of the same global state. + +

This function pops n values from the stack from, +and pushes them into the stack to. + +

+


lua_yield

+
+          int lua_yield  (lua_State *L, int nresults);
+
+ + +

Yields a coroutine. + +

This function can only be called as the +return expression of a C function, as follows: +

+       return lua_yield (L, nresults);
+
+When a C function calls lua_yield in that way, +the running coroutine suspends its execution, +and the call to lua_resume that started this coroutine returns. +The parameter nresults is the number of values from the stack +that are passed as results to lua_resume. + +

+

3.8 - The Debug Interface

+ +

Lua has no built-in debugging facilities. +Instead, it offers a special interface +by means of functions and hooks. +This interface allows the construction of different +kinds of debuggers, profilers, and other tools +that need "inside information" from the interpreter. + +

+


lua_Debug

+
+          typedef struct lua_Debug {
+            int event;
+            const char *name;      /* (n) */
+            const char *namewhat;  /* (n) */
+            const char *what;      /* (S) */
+            const char *source;    /* (S) */
+            int currentline;       /* (l) */
+            int nups;              /* (u) number of upvalues */
+            int linedefined;       /* (S) */
+            int lastlinedefined;   /* (S) */
+            char short_src[LUA_IDSIZE]; /* (S) */
+
+

/* private part */ + ... + } lua_Debug; + +

+ + +

A structure used to carry different pieces of +information about an active function. +lua_getstack fills only the private part +of this structure, for later use. +To fill the other fields of lua_Debug with useful information, +call lua_getinfo. + +

The fields of lua_Debug have the following meaning: +

    +
  • source +If the function was defined in a string, +then source is that string. +If the function was defined in a file, +then source starts with a `@´ followed by the file name. + +

  • short_src +A "printable" version of source, to be used in error messages. + +

  • linedefined +the line number where the definition of the function starts. + +

  • lastlinedefined +the line number where the definition of the function ends. + +

  • what the string "Lua" if this is a Lua function, +"C" if this is a C function, +"main" if this is the main part of a chunk, +and "tail" if this was a function that did a tail call. +In the latter case, +Lua has no other information about this function. + +

  • currentline +the current line where the given function is executing. +When no line information is available, +currentline is set to -1. + +

  • name +a reasonable name for the given function. +Because functions in Lua are first class values, +they do not have a fixed name: +Some functions may be the value of multiple global variables, +while others may be stored only in a table field. +The lua_getinfo function checks how the function was +called to find a suitable name. +If it cannot find a name, +then name is set to NULL. + +

  • namewhat +Explains the name field. +The value of namewhat can be +"global", "local", "method", +"field", "upvalue", or "" (the empty string), +according to how the function was called. +(Lua uses the empty string when no other option seems to apply.) + +

  • nups +The number of upvalues of the function. + +

+ +

+


lua_gethook

+
+          lua_Hook lua_gethook (lua_State *L);
+
+ + +

Returns the current hook function. + +

+


lua_gethookcount

+
+          int lua_gethookcount (lua_State *L);
+
+ + +

Returns the current hook count. + +

+


lua_gethookmask

+
+          int lua_gethookmask (lua_State *L);
+
+ + +

Returns the current hook mask. + +

+


lua_getinfo

+
+          int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+
+ + +

Fills the fields of lua_Debug with useful information. + +

This function returns 0 on error +(for instance, an invalid option in what). +Each character in the string what +selects some fields of the structure ar to be filled, +as indicated by the letter in parentheses in the definition of lua_Debug: +`S´ fills in the fields source, linedefined, +lastlinedefined, +and what; +`l´ fills in the field currentline, etc. +Moreover, `f´ pushes onto the stack the function that is +running at the given level. + +

To get information about a function that is not active +(that is, not in the stack), +you push it onto the stack +and start the what string with the character `>´. +For instance, to know in which line a function f was defined, +you can write the following code: +

+       lua_Debug ar;
+       lua_getfield(L, LUA_GLOBALSINDEX, "f");  /* get global `f' */
+       lua_getinfo(L, ">S", &ar);
+       printf("%d\n", ar.linedefined);
+
+ +

+


lua_getlocal

+
+          const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+
+ + +

Gets information about a local variable of a given activation record. +The parameter ar must be a valid activation record that was +filled by a previous call to lua_getstack or +given as argument to a hook (see lua_Hook). +The index n selects which local variable to inspect +(1 is the first parameter or active local variable, and so on, +until the last active local variable). +lua_getlocal pushes the variable's value onto the stack, +and returns its name. + +

Returns NULL (and pushes nothing) +when the index is greater than +the number of active local variables. + +

+


lua_getstack

+
+          int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+
+ + +

Get information about the interpreter runtime stack. + +

This function fills parts of a lua_Debug structure with +an identification of the activation record +of the function executing at a given level. +Level 0 is the current running function, +whereas level n+1 is the function that has called level n. +When there are no errors, lua_getstack returns 1; +when called with a level greater than the stack depth, +it returns 0. + +

+


lua_getupvalue

+
+          const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+
+ + +

Gets information about a closure's upvalue. +(For Lua functions, +upvalues are the external local variables that the function uses, +and that consequently are included in its closure.) +lua_getupvalue gets the index n of an upvalue, +pushes the upvalue's value onto the stack, +and returns its name. +funcindex points to the closure in the stack. +(Upvalues have no particular order, +as they are active through the whole function.) + +

Returns NULL (and pushes nothing) +when the index is greater than the number of upvalues. +For C functions, this function uses the empty string "" +as a name for all upvalues. + +

+


lua_Hook

+
+          typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+ + +

Type for debugging hook functions. + +

Whenever a hook is called, its ar argument has its field +event set to the specific event that triggered the hook. +Lua identifies these events with the following constants: +LUA_HOOKCALL, LUA_HOOKRET, +LUA_HOOKTAILRET, LUA_HOOKLINE, +and LUA_HOOKCOUNT. +Moreover, for line events, the field currentline is also set. +To get the value of any other field in ar, +the hook must call lua_getinfo. +For return events, event may be LUA_HOOKRET, +the normal value, or LUA_HOOKTAILRET. +In the latter case, Lua is simulating a return from +a function that did a tail call; +in this case, it is useless to call lua_getinfo. + +

While Lua is running a hook, it disables other calls to hooks. +Therefore, if a hook calls back Lua to execute a function or a chunk, +that execution occurs without any calls to hooks. + +

+


lua_sethook

+
+          int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
+
+ + +

Sets the debugging hook function. + +

func is the hook function. +mask specifies on which events the hook will be called: +It is formed by a disjunction of the constants +LUA_MASKCALL, +LUA_MASKRET, +LUA_MASKLINE, +and LUA_MASKCOUNT. +The count argument is only meaningful when the mask +includes LUA_MASKCOUNT. +For each event, the hook is called as explained below: +

    +
  • The call hook is called when the interpreter calls a function. +The hook is called just after Lua enters the new function. +
  • The return hook is called when the interpreter returns from a function. +The hook is called just before Lua leaves the function. +
  • The line hook is called when the interpreter is about to +start the execution of a new line of code, +or when it jumps back in the code (even to the same line). +(This event only happens while Lua is executing a Lua function.) +
  • The count hook is called after the interpreter executes every +count instructions. +(This event only happens while Lua is executing a Lua function.) +
+ +

A hook is disabled by setting mask to zero. + +

+


lua_setlocal

+
+          const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+
+ + +

Sets the value of a local variable of a given activation record. +Parameters ar and n are like in lua_getlocal +(see ). +lua_setlocal assigns the value at the top of the stack +to the variable and returns its name. +It also pops the value from the stack. + +

Returns NULL (and pops nothing) +when the index is greater than +the number of active local variables. + +

+


lua_setupvalue

+
+          const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+
+ + +

Sets the value of a closure's upvalue. +Parameters funcindex and n are like in lua_getupvalue +(see ). +It assigns the value at the top of the stack +to the upvalue and returns its name. +It also pops the value from the stack. + +

Returns NULL (and pops nothing) +when the index is greater than the number of upvalues. + +

+

4 - The Auxiliary Library

+ +

+The auxiliary library provides several convenient functions +to interface C with Lua. +While the basic API provides the primitive functions for all +interactions between C and Lua, +the auxiliary library provides higher-level functions for some +common tasks. + +

All functions from the auxiliary library +are defined in header file lauxlib.h and +have a prefix luaL_. + +

All functions in the auxiliary library are build on +top of the basic API, so they provide nothing that cannot +be done with that API. + +

Several functions in the auxiliary library are used to +check C function arguments. +Their names are always luaL_check* or luaL_opt*. +All those functions raise an error if the check is not satisfied. +Because the error message is formatted for arguments +(e.g., "bad argument #1"), +you should not use those functions for other stack values. + +

4.1 - Functions and Types

+ +

Here we list all functions and types from the auxiliary library +in alphabetical order. + +

+


luaL_addchar

+
+          void luaL_addchar (luaL_Buffer B, char c);
+
+ + +

Adds the character c to the buffer B +(see luaL_Buffer). + +

+


luaL_addlstring

+
+          void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
+
+ + +

Adds the string pointed by s with length l to +the buffer B +(see luaL_Buffer). + +

+


luaL_addsize

+
+          void luaL_addsize (luaL_Buffer B, size_t n);
+
+ + +

Adds a string of length n previously copied to the +buffer area (see luaL_prepbuffer) to the buffer B +(see luaL_Buffer). + +

+


luaL_addstring

+
+          void luaL_addstring (luaL_Buffer *B, const char *s);
+
+ + +

Adds the zero-terminated string pointed by s +to the buffer B +(see luaL_Buffer). + +

+


luaL_addvalue

+
+          void luaL_addvalue (luaL_Buffer *B);
+
+ + +

Adds the value at the top of the stack +to the buffer B +(see luaL_Buffer). +Pops the value. + +

This is the only function on string buffers that can (and must) +be called with an extra element on the stack, +which is the value to be added to the buffer. + +

+


luaL_argcheck

+
+          void luaL_argcheck (lua_State *L, int cond, int numarg,
+                              const char *extramsg);
+
+ + +

Checks whether cond is true. +If not, raise an error with message +"bad argument #<numarg> to <func> (<extramsg>)", +where func is retrieved from the call stack. + +

+


luaL_argerror

+
+          int luaL_argerror (lua_State *L, int numarg, const char *extramsg);
+
+ + +

Raises an error with message +"bad argument #<numarg> to <func> (<extramsg>)", +where func is retrieved from the call stack. + +

This function never returns. + +

+


luaL_Buffer

+
+          typedef struct luaL_Buffer luaL_Buffer;
+
+ + +

Type for a string buffer. + +

A string buffer allows C code to build Lua strings piecemeal. +Its pattern of use is as follows: +

    +
  • Fist you declare a variable b of type luaL_Buffer. +
  • Then you initialize it with a call luaL_buffinit(L, &b);. +
  • Then you add string pieces to the buffer calling any of +the luaL_add* functions. +
  • You finish calling luaL_pushresult(&b). +That call leaves the final string on the top of the stack. +
+ +

During its normal operation a string buffer uses a +variable number of stack slots. +So, while using a buffer, you cannot assume that you know where +is the top of the stack. +You can use the stack between successive calls to buffer operations, +as long as that use is balanced, that is, +when you call a buffer operation the stack is at the same level +it was immediately after the previous buffer operation. +(The only exception to this rule is luaL_addvalue.) +After calling luaL_pushresult the stack is back to its +level when the buffer was initialized, +plus the final string on its top. + +

+


luaL_buffinit

+
+          void luaL_buffinit (lua_State *L, luaL_Buffer *B);
+
+ + +

Initializes a buffer B. +This function does not allocate any space; +the buffer must be declared as a variable +(see luaL_Buffer). + +

+


luaL_callmeta

+
+          int luaL_callmeta (lua_State *L, int obj, const char *e);
+
+ + +

Calls a metamethod. + +

If the object at index obj has a metatable and that +metatable has a field e, +calls that field passing the object as argument. +In that case the function returns 1 and pushes on the +stack the value returned by the call. +If there is no metatable or no metamethod returns 0 +(without pushing any value on the stack). + +

+


luaL_checkany

+
+          void luaL_checkany (lua_State *L, int narg);
+
+ + +

Checks whether the function has an argument narg. + +

+


luaL_checkint

+
+          int luaL_checkint (lua_State *L, int narg);
+
+ + +

Checks whether the function argument narg is a number +and returns that number casted to an int. + +

+


luaL_checkinteger

+
+          lua_Integer luaL_checkinteger (lua_State *L, int numArg);
+
+ + +

Checks whether the function argument narg is a number +and returns that number casted to a lua_Integer. + +

+


luaL_checklong

+
+          long luaL_checklong (lua_State *L, int narg);
+
+ + +

Checks whether the function argument narg is a number +and returns that number casted to a long. + +

+


luaL_checklstring

+
+          const char *luaL_checklstring (lua_State *L, int numArg, size_t *l);
+
+ + +

Checks whether the function argument narg is a string +and returns that string; +if l is not NULL fills the position *l +with the string's length. + +

+


luaL_checknumber

+
+          lua_Number luaL_checknumber (lua_State *L, int numArg);
+
+ + +

Checks whether the function argument narg is a number +and returns that number. + +

+


luaL_checkoption

+
+          int luaL_checkoption (lua_State *L, int narg, const char *def,
+                                const char *const lst[]);
+
+ + +

Checks whether the function argument narg is a string and +searches for that string into the array lst +(which must be NULL-terminated). +If def is not NULL, +uses def as a default value when +the function has no argument narg or if that argument is nil. + +

Returns the index in the array where the string was found. +Raises an error if the argument is not a string or +if the string cannot be found. + +

+


luaL_checkstack

+
+          void luaL_checkstack (lua_State *L, int sz, const char *msg);
+
+ + +

Grows the stack size to top + sz elements, +raising an error if the stack cannot grow to that size. +msg is an additional text to go into the error message. + +

+


luaL_checkstring

+
+          const char *luaL_checkstring (lua_State *L, int narg);
+
+ + +

Checks whether the function argument narg is a string +and returns that string. + +

+


luaL_checktype

+
+          void luaL_checktype (lua_State *L, int narg, int t);
+
+ + +

Checks whether the function argument narg has type t. + +

+


luaL_checkudata

+
+          void *luaL_checkudata (lua_State *L, int ud, const char *tname);
+
+ + +

Checks whether the function argument narg is a userdata +of the type tname (see luaL_newmetatable). + +

+


luaL_error

+
+          int luaL_error (lua_State *L, const char *fmt, ...);
+
+ + +

Raises an error. +The error message format is given by fmt +plus any extra argument, +following the same rules of lua_pushfstring. +It also adds at the beginning of the message the file name and +the line number where the error occurred, +if that information is available. + +

This function never returns. + +

+


luaL_getmetafield

+
+          int luaL_getmetafield (lua_State *L, int obj, const char *e);
+
+ + +

Pushes on the stack the field e from the metatable +of the object at index obj. +If the object does not have a metatable, +or if the metatable does not have that field, +returns 0 (false) and pushes nothing. + +

+


luaL_getmetatable

+
+          void luaL_getmetatable (lua_State *L, const char *tname);
+
+ + +

Pushes on the stack the metatable associated to name tname +in the registry (see luaL_newmetatable). + +

+


luaL_gsub

+
+          const char *luaL_gsub (lua_State *L, const char *s,
+                                 const char *p, const char *r);
+
+ + +

Creates a copy of string s changing any occurrence of p +by the string r. +Pushes the resulting string on the stack and returns it. + +

+


luaL_loadbuffer

+
+          int luaL_loadbuffer (lua_State *L, const char *buff,
+                               size_t sz, const char *name);
+
+ + +

Loads a buffer as a Lua chunk. +This function uses lua_load to load the chunk in the +buffer pointed by buff with size sz. + +

This function returns the same results as lua_load. +name is the chunk name, +used for debug information and error messages. + +

+


luaL_loadfile

+
+          int luaL_loadfile (lua_State *L, const char *filename);
+
+ + +

Loads a file as a Lua chunk. +This function uses lua_load to load the chunk in the file +named filename. +If the file's first line starts with a # it is ignored. + +

This function returns the same results as lua_load, +but it has an extra error code LUA_ERRFILE +if it cannot open the file. + +

+


luaL_loadstring

+
+          int luaL_loadstring (lua_State *L, const char *s);
+
+ + +

Loads a string as a Lua chunk. +This function uses lua_load to load the chunk in +the zero-terminated string s. + +

This function returns the same results as lua_load. + +

+


luaL_newmetatable

+
+          int luaL_newmetatable (lua_State *L, const char *tname);
+
+ + +

If the register already has the key "tname", +returns 0. +Otherwise, +creates a new table to be used as metatables for userdata, +adds it to the register with key "tname", +and returns 1. + +

In both cases pushes on the stack the final value associated +with "tname" in the registry. + +

+


luaL_newstate

+
+          lua_State *luaL_newstate (void);
+
+ + +

Creates a new Lua state, calling lua_newstate with an +allocation function based on the standard C realloc function +and setting a panic function ((see lua_atpanic)) that prints +an error message to the standard error output in case of fatal +errors. + +

Returns the new state, +or NULL if there is a memory allocation error. + +

+


luaL_optint

+
+          int luaL_optint (lua_State *L, int narg, int d);
+
+ + +

If the function argument narg is a number, +returns that number casted to an int. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

+


luaL_optinteger

+
+          lua_Integer luaL_optinteger (lua_State *L, int nArg, lua_Integer d);
+
+ + +

If the function argument narg is a number, +returns that number casted to a lua_Integer. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

+


luaL_optlong

+
+          long luaL_optlong (lua_State *L, int narg, long d);
+
+ + +

If the function argument narg is a number, +returns that number casted to a long. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

+


luaL_optlstring

+
+          const char *luaL_optlstring (lua_State *L, int numArg,
+                                       const char *d, size_t *l);
+
+ + +

If the function argument narg is a string, +returns that string. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

If l is not NULL fills the position *l +with the results's length. + +

+


luaL_optnumber

+
+          lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number d);
+
+ + +

If the function argument narg is a number, +returns that number. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

+


luaL_optstring

+
+          const char *luaL_optstring (lua_State *L, int narg, const char *d);
+
+ + +

If the function argument narg is a string, +returns that string. +If that argument is absent or is nil, +returns d. +Otherwise, raise an error. + +

+


luaL_prepbuffer

+
+          char *luaL_prepbuffer (luaL_Buffer *B);
+
+ + +

Returns an address to a space of size LUAL_BUFFERSIZE +wherein you can copy a string to be added to buffer B +(see luaL_Buffer). +After copying the string into that space you must call +luaL_addsize with the size of the string to actually add +it to the buffer. + +

+


luaL_pushresult

+
+          void luaL_pushresult (luaL_Buffer *B);
+
+ + +

Finishes the use of buffer B leaving the final string on +the top of the stack. + +

+


luaL_ref

+
+          int luaL_ref (lua_State *L, int t);
+
+ + +

Creates and returns a reference, +in the table at index t, +for the object at the top of the stack (and pops the object). + +

A reference is a unique integer key. +As long as you do not add integer keys into table t, +luaL_ref ensures the uniqueness of the key it returns. +You can retrieve an object referred by reference r +calling lua_rawgeti(L, t, r). +Function luaL_unref frees a reference and its associated object. + +

Whenever the object at the top of the stack is nil, +luaL_ref returns the same reference LUA_REFNIL. +The constant LUA_NOREF is garanteed to be different +from any reference returned by luaL_ref. + +

+


luaL_Reg

+
+          typedef struct luaL_Reg {
+            const char *name;
+            lua_CFunction func;
+          } luaL_Reg;
+
+
+ + +

Format for arrays of functions to be registered by +luaL_register. +name is the function name and func is a pointer to +the function. +Any array of luaL_Reg must end with an sentinel entry +wherein both name and func are NULL. + +

+


luaL_register

+
+          void luaL_register (lua_State *L, const char *libname,
+                              const luaL_Reg *l);
+
+ + +

Opens a library. + +

When called with libname equal to NULL, +simply registers all functions in the list l +(see luaL_Reg) into the table on the top of the stack. + +

When called with a non-null libname, +creates a new table t, +sets it as the value of the variable libname, +sets it as the value of package.loaded[libname], +and registers on it all functions in the list l. +If there is a table in package.loaded[libname] or in +variable libname, +reuses that table instead of creating a new one. + +

In any case the function leaves the table +on the top of the stack. + +

+


luaL_typename

+
+          const char *luaL_typename (lua_State *L, int idx);
+
+ + +

Returns the name of the type of the value at index idx. + +

+


luaL_typerror

+
+          int luaL_typerror (lua_State *L, int narg, const char *tname);
+
+ + +

Generates an error with a message like +

+<location>: bad argument <narg> to <function> (<tname> expected, got <realt>)
+
+where <location> is produced by luaL_where, +<function> is the name of the current function, +and <realt> is the type name of the actual argument. + +

+


luaL_unref

+
+          void luaL_unref (lua_State *L, int t, int ref);
+
+ + +

Releases reference ref from the table at index t +(see luaL_ref). +The entry is removed from the table, +so that the referred object can be collected. +The reference ref is also freed to be used again. + +

If ref is LUA_NOREF or LUA_REFNIL, +luaL_unref does nothing. + +

+


luaL_where

+
+          void luaL_where (lua_State *L, int lvl);
+
+ + +

Pushes on the stack a string identifying the current position +of the control at level lvl in the call stack. +Typically this string has the format <chunkname>:<currentline>:. +Level 0 is the running function, +level 1 is the function that called the running function. + +

This function is used to build a prefix for error messages. + +

+

5 - Standard Libraries

+ +

The standard libraries provide useful functions +that are implemented directly through the C API. +Some of these functions provide essential services to the language +(e.g., type and getmetatable); +others provide access to "outside" services (e.g., I/O); +and others could be implemented in Lua itself, +but are quite useful or have critical performance to +deserve an implementation in C (e.g., sort). + +

All libraries are implemented through the official C API +and are provided as separate C modules. +Currently, Lua has the following standard libraries: +

    +
  • basic library; +
  • package library; +
  • string manipulation; +
  • table manipulation; +
  • mathematical functions (sin, log, etc.); +
  • input and output; +
  • operating system facilities; +
  • debug facilities. +
+Except for the basic and package libraries, +each library provides all its functions as fields of a global table +or as methods of its objects. + +

To have access to these libraries, +the C host program must first call the function +luaL_openlibs; +or else it can open them individually calling +luaopen_base (for the basic library), +luaopen_package (for the package library), +luaopen_string (for the string library), +luaopen_table (for the table library), +luaopen_math (for the mathematical library), +luaopen_io (for the I/O and the Operating System libraries), +and luaopen_debug (for the debug library). +These functions are declared in lualib.h. + +

5.1 - Basic Functions

+ +

The basic library provides some core functions to Lua. +If you do not include this library in your application, +you should check carefully whether you need to provide some alternative +implementation for some of its facilities. + +


assert (v [, message])

+Issues an error when +the value of its argument v is nil or false; +otherwise, returns all its arguments. +message is an error message; +when absent, it defaults to "assertion failed!" + +


collectgarbage (opt [, arg])

+ +

This function is a generic interface to the garbage collector. +It performs different functions according to its first argument, opt: +

    +
  • "stop" stops the garbage collector. +
  • "restart" restarts the garbage collector. +
  • "collect" performs a full garbage-collection cycle. +
  • "count" returns the total memory in use by Lua (in Kbytes). +
  • "step" performs a garbage-collection step. +The step "size" is controlled by arg +(larger values mean more steps) in a non-specified way. +If you want to control the step size +you must tune experimentally the value of arg. +
  • "steppause" +sets arg/100 as the new value for the pause of +the collector (see 2.10). +
  • "setstepmul" +sets arg/100 as the new value for the step multiplier of +the collector (see 2.10). +
+ +


dofile (filename)

+Opens the named file and executes its contents as a Lua chunk. +When called without arguments, +dofile executes the contents of the standard input (stdin). +Returns any value returned by the chunk. +In case of errors, dofile propagates the error +to its caller (that is, it does not run in protected mode). + +


error (message [, level])

+Terminates the last protected function called +and returns message as the error message. +Function error never returns. + +

Usually, error adds some information about the error position +at the beginning of the message. +The level argument specifies how to get the error position. +With level 1 (the default), the error position is where the +error function was called. +Level 2 points the error to where the function +that called error was called; and so on. +Passing a level 0 avoids the addition of error position information +to the message. + +


_G

+A global variable (not a function) that +holds the global environment (that is, _G._G = _G). +Lua itself does not use this variable; +changing its value does not affect any environment. +(Use setfenv to change environments.) + +


getfenv (f)

+Returns the current environment in use by the function. +f can be a Lua function or a number, +which specifies the function at that stack level: +Level 1 is the function calling getfenv. +If the given function is not a Lua function, +or if f is 0, +getfenv returns the global environment. +The default for f is 1. + +


getmetatable (object)

+ +

If object does not have a metatable, returns nil. +Otherwise, +if the object's metatable has a "__metatable" field, +returns the associated value. +Otherwise, returns the metatable of the given object. + +


ipairs (t)

+ +

Returns an iterator function, the table t, and 0, +so that the construction +

+       for i,v in ipairs(t) do ... end
+
+will iterate over the pairs (1,t[1]), (2,t[2]), ..., +up to the first integer key with a nil value in the table. + +


load (func [, chunkname])

+ +

Loads a chunk using function func to get its pieces. +Each call to func must return a string that concatenates +with previous results. +A return of nil (or no value) signals the end of the chunk. + +

If there are no errors, +returns the compiled chunk as a function; +otherwise, returns nil plus the error message. +The environment of the returned function is the global environment. + +

chunkname is used as the chunk name for error messages +and debug information. + +


loadfile (filename)

+ +

Similar to load, +but gets the chunk from file filename. + +


loadstring (string [, chunkname])

+ +

Similar to load, +but gets the chunk from the given string. + +

To load and run a given string, use the idiom +

+      assert(loadstring(s))()
+
+ +


next (table [, index])

+ +

Allows a program to traverse all fields of a table. +Its first argument is a table and its second argument +is an index in this table. +next returns the next index of the table and the +value associated with the index. +When called with nil as its second argument, +next returns the first index +of the table and its associated value. +When called with the last index, +or with nil in an empty table, +next returns nil. +If the second argument is absent, then it is interpreted as nil. + +

Lua has no declaration of fields; +There is no difference between a +field not present in a table or a field with value nil. +Therefore, next only considers fields with non-nil values. +The order in which the indices are enumerated is not specified, +even for numeric indices. +(To traverse a table in numeric order, +use a numerical for or the ipairs function.) + +

The behavior of next is undefined if, +during the traversal, +you assign any value to a non-existent field in the table. + +


pairs (t)

+ +

Returns the next function and the table t (plus a nil), +so that the construction +

+       for k,v in pairs(t) do ... end
+
+will iterate over all key–value pairs of table t. + +


pcall (f, arg1, arg2, ...)

+ +

Calls function f with +the given arguments in protected mode. +That means that any error inside f is not propagated; +instead, pcall catches the error +and returns a status code. +Its first result is the status code (a boolean), +which is true if the call succeeds without errors. +In such case, pcall also returns all results from the call, +after this first result. +In case of any error, pcall returns false plus the error message. + +


print (e1, e2, ...)

+Receives any number of arguments, +and prints their values in stdout, +using the tostring function to convert them to strings. +This function is not intended for formatted output, +but only as a quick way to show a value, +typically for debugging. +For formatted output, use format (see 5.4). + +


rawequal (v1, v2)

+Checks whether v1 is equal to v2, +without invoking any metamethod. +Returns a boolean. + +


rawget (table, index)

+Gets the real value of table[index], +without invoking any metamethod. +table must be a table; +index is any value different from nil. + +


rawset (table, index, value)

+Sets the real value of table[index] to value, +without invoking any metamethod. +table must be a table, +index is any value different from nil, +and value is any Lua value. + +


select (index, ...)

+ +

If index is a number, +returns all argument after argument number index. +Otherwise, index must be the string "#", +and select returns the total number of extra arguments it received. + +


setfenv (f, table)

+ +

Sets the environment to be used by the given function. +f can be a Lua function or a number, +which specifies the function at that stack level: +Level 1 is the function calling setfenv. +setfenv returns the given function. + +

As a special case, when f is 0 setfenv changes +the environment of the running thread. +In this case, setfenv returns no values. + +


setmetatable (table, metatable)

+ +

Sets the metatable for the given table. +(You cannot change the metatable of other types from Lua.) +If metatable is nil, +removes the metatable of the given table. +If the original metatable has a "__metatable" field, +raises an error. + +

This function returns table. + +


tonumber (e [, base])

+Tries to convert its argument to a number. +If the argument is already a number or a string convertible +to a number, then tonumber returns that number; +otherwise, it returns nil. + +

An optional argument specifies the base to interpret the numeral. +The base may be any integer between 2 and 36, inclusive. +In bases above 10, the letter `A´ (in either upper or lower case) +represents 10, `B´ represents 11, and so forth, +with `Z´ representing 35. +In base 10 (the default), the number may have a decimal part, +as well as an optional exponent part (see 2.2.1). +In other bases, only unsigned integers are accepted. + +


tostring (e)

+Receives an argument of any type and +converts it to a string in a reasonable format. +For complete control of how numbers are converted, +use string.format (see 5.4). + +

If the metatable of e has a "__tostring" field, +tostring calls the corresponding value +with e as argument, +and uses the result of the call as its result. + +


type (v)

+Returns the type of its only argument, coded as a string. +The possible results of this function are +"nil" (a string, not the value nil), +"number", +"string", +"boolean, +"table", +"function", +"thread", +and "userdata". + +


unpack (list [, i [, j]])

+Returns the elements from the given list. +This function is equivalent to +
+  return list[i], list[i+1], ..., list[j]
+
+except that the above code can be written only for a fixed number +of elements. +By default, i is 1 and j is the length of the list, +as defined by the length operator. + +


_VERSION

+A global variable (not a function) that +holds a string containing the current interpreter version. +The current contents of this variable is "Lua 5.1". + +


xpcall (f, err)

+ +

This function is similar to pcall, +except that you can set a new error handler. + +

xpcall calls function f in protected mode, +using err as the error handler. +Any error inside f is not propagated; +instead, xpcall catches the error, +calls the err function with the original error object, +and returns a status code. +Its first result is the status code (a boolean), +which is true if the call succeeds without errors. +In such case, xpcall also returns all results from the call, +after this first result. +In case of any error, +xpcall returns false plus the result from err. + +

5.2 - Coroutine Manipulation

+ +

The operations related to coroutines comprise a sub-library of +the basic library and come inside the table coroutine. +See 2.11 for a general description of coroutines. + +


coroutine.create (f)

+ +

Creates a new coroutine, with body f. +f must be a Lua function. +Returns this new coroutine, +an object with type "thread". + +


coroutine.resume (co, val1, ...)

+ +

Starts or continues the execution of coroutine co. +The first time you resume a coroutine, +it starts running its body. +The arguments val1, ... go as the arguments to the body function. +If the coroutine has yielded, +resume restarts it; +the arguments val1, ... go as the results from the yield. + +

If the coroutine runs without any errors, +resume returns true plus any values passed to yield +(if the coroutine yields) or any values returned by the body function +(if the coroutine terminates). +If there is any error, +resume returns false plus the error message. + +


coroutine.running ()

+ +

Returns the running coroutine, +or nil when called by the main thread. + +


coroutine.status (co)

+ +

Returns the status of coroutine co, as a string: +"running", +if the coroutine is running (that is, it called status); +"suspended", if the coroutine is suspended in a call to yield, +or if it has not started running yet; +"normal" if the coroutine is active but not running +(that is, it has resumed another coroutine); +and "dead" if the coroutine has finished its body function, +or if it has stopped with an error. + +


coroutine.wrap (f)

+ +

Creates a new coroutine, with body f. +f must be a Lua function. +Returns a function that resumes the coroutine each time it is called. +Any arguments passed to the function behave as the +extra arguments to resume. +Returns the same values returned by resume, +except the first boolean. +In case of error, propagates the error. + +


coroutine.yield (val1, ...)

+ +

Suspends the execution of the calling coroutine. +The coroutine cannot be running neither a C function, +nor a metamethod, nor an iterator. +Any arguments to yield go as extra results to resume. + +

5.3 - Packages and Modules

+ +

The package library provides basic +facilities for packages and modules in Lua. +It exports two of its functions directly in the global environment: +require and module. +Everything else is exported in a table package. + +


module (name [, ...])

+ +

Creates a module. +If there is a table in package.loaded[name], +that table is the module. +Otherwise, if there is a global table t with the given name, +that table is the module. +Otherwise creates a new table t and +sets it as the value of the global name and +the value of package.loaded[name]. +This function also initializes t._NAME with the given name, +t._M with the module (t itself), +and t._PACKAGE with the package name +(the full module name minus last component; see below). +Finally, module sets t as the new environment +of the current function and the new value of package.loaded[name], +so that require returns t. + +

If name is a compound name +(that is, one with components separated by dots) +module creates (or reuses, if they already exists) +tables for each component. +For instance, if name is a.b.c, +module stores the module table in field c of +field b of global a. + +

This function may receive optional options after +the module name, +where each option is a function to be applied over the module. + +


require (modname)

+ +

Loads the given module. +The function starts by looking into the table package.loaded +to determine whether modname is already loaded. +If it is, then require returns the value stored +at package.loaded[modname]. +Otherwise, it tries to find a loader for that module. + +

To find a loader, +first require queries package.preload[modname]. +If it is a true value, +that value (which should be a function) is the loader. +Otherwise require searches for a Lua loader using the +path stored in package.path. +if that also fails, it searches for a C loader using the +path stored in package.cpath. +If that also fails, +it tries an all-in-one loader. + +

When loading a C library, +require first uses a dynamic link facility to link the +application with the library. +Then it tries to find a C function inside that library to +be used as the loader. +The name of that C function is the string "luaopen_" +concatenated with a copy of the module name wherein each dot +is replaced by an underscore. +Moreover, if the module name has a colon, +its prefix up to (and including) the first colon is removed. +For instance, if the module name is a.v1:b.c, +the function name will be luaopen_b_c. + +

If require finds neither a Lua library nor a +C library for a module, +it calls the all-in-one loader. +That loader searches the C path for a library for +the root name of the given module. +For instance, when requiring a.b.c, +it will search for a C library for a. +If found, it looks into it for an open function for +the submodule; +in our example, that would be luaopen_a_b_c. +With that facility, a package can pack several C submodules +into one single library, +with each submodule keeping its original open function. + +

Once a loader is found, +require calls the loader with a sinle argument, modname. +If the loader returns any value, +require assigns it to package.loaded[modname]. +If the loader returns no value and +has not assigned any value to package.loaded[modname], +require assigns true to that entry. +In any case, require returns the +final value of package.loaded[modname]. + +

If there is any error loading or running the module, +or if it cannot find any loader for that module, +then require signals an error. + +


package.cpath

+ +

The path used by require to search for a C loader. + +

Lua initializes the C path package.cpath in the same way +it initializes the Lua path package.path, +using the environment variable LUA_CPATH +(plus another compiled-defined default path). + +


package.loaded

+ +

A table used by require to control which +modules are already loaded. +When you require a module modname and +package.loaded[modname] is not false, +require simply returns the value stored there. + +


package.loadlib (libname, funcname)

+ +

Links the program with the dynamic C library libname. +Inside this library, looks for a function funcname +and returns this function as a C function. + +

libname must be the complete file name of the C library, +including any eventual path and extension. + +

This function is not supported by ANSI C. +As such, it is only available on some platforms +(Windows, Linux, Solaris, BSD, plus other Unix systems that +support the dlfcn standard). + +


package.path

+ +

The path used by require to search for a Lua loader. + +

At start-up, Lua initializes this variable with +the value of the environment variable LUA_PATH or +with a compiled-defined default path, +if the environment variable is not defined. +Any ";;" in the value of the environment variable +is replaced by the default path. + +

A path is a sequence of templates separated by semicolons. +For each template, require will change each interrogation +mark in the template by filename, +which is modname with each dot replaced by a +"directory separator" (such as "/" in Unix); +then it will try to load the resulting file name. +So, for instance, if the Lua path is +

+  "./?.lua;./?.lc;/usr/local/?/init.lua"
+
+the search for a Lua loader for module mod +will try to load the files +./mod.lua, ./mod.lc, and +/usr/local/mod/init.lua, in that order. + +


package.preload

+ +

A table to store loaders for specific modules +(see require). + +


package.seeall (module)

+ +

Sets a metatable for module with +its __index field refering to the global environment, +so that this module inherits undefined values +from the global environment. +To be used as an option to function module. + +

5.4 - String Manipulation

+ +

This library provides generic functions for string manipulation, +such as finding and extracting substrings, and pattern matching. +When indexing a string in Lua, the first character is at position 1 +(not at 0, as in C). +Indices are allowed to be negative and are interpreted as indexing backwards, +from the end of the string. +Thus, the last character is at position -1, and so on. + +

The string library provides all its functions inside the table +string. +It also sets a metatable for strings +wherein __index points to itself. +Therefore, you can use the string function is object-oriented style. +For instance, string.byte(s, i) +can be written as s:byte(i). + +


string.byte (s [, i [, j]])

+Returns the internal numerical codes of the characters s[i], +s[i+1], ..., s[j]. +The default value for i is 1; +the default value for j is i. + +

Note that numerical codes are not necessarily portable across platforms. + +


string.char (i1, i2, ...)

+Receives 0 or more integers. +Returns a string with length equal to the number of arguments, +in which each character has the internal numerical code equal +to its correspondent argument. + +

Note that numerical codes are not necessarily portable across platforms. + +


string.dump (function)

+ +

Returns a binary representation of the given function, +so that a later loadstring on that string returns +a copy of the function. +function must be a Lua function. + +


string.find (s, pattern [, init [, plain]])

+Looks for the first match of +pattern in the string s. +If it finds one, then find returns the indices of s +where this occurrence starts and ends; +otherwise, it returns nil. +A third, optional numerical argument init specifies +where to start the search; +its default value is 1 and may be negative. +A value of true as a fourth, optional argument plain +turns off the pattern matching facilities, +so the function does a plain "find substring" operation, +with no characters in pattern being considered "magic". +Note that if plain is given, then init must be given too. + +


string.format (formatstring, e1, e2, ...)

+Returns a formatted version of its variable number of arguments +following the description given in its first argument (which must be a string). +The format string follows the same rules as the printf family of +standard C functions. +The only differences are that the options/modifiers +*, l, L, n, p, +and h are not supported, +and there is an extra option, q. +The q option formats a string in a form suitable to be safely read +back by the Lua interpreter: +The string is written between double quotes, +and all double quotes, newlines, and backslashes in the string +are correctly escaped when written. +For instance, the call +
+       string.format('%q', 'a string with "quotes" and \n new line')
+
+will produce the string: +
+"a string with \"quotes\" and \
+ new line"
+
+ +

The options c, d, E, e, f, +g, G, i, o, u, X, and x all +expect a number as argument, +whereas q and s expect a string. + +

This function does not accept string values +containing embedded zeros. + +


string.gmatch (s, pat)

+Returns an iterator function that, +each time it is called, +returns the next captures from pattern pat over string s. + +

If pat specifies no captures, +then the whole match is produced in each call. + +

As an example, the following loop +

+  s = "hello world from Lua"
+  for w in string.gmatch(s, "%a+") do
+    print(w)
+  end
+
+will iterate over all the words from string s, +printing one per line. +The next example collects all pairs key=value from the +given string into a table: +
+  t = {}
+  s = "from=world, to=Lua"
+  for k, v in string.gmatch(s, "(%w+)=(%w+)") do
+    t[k] = v
+  end
+
+ +


string.gsub (s, pat, repl [, n])

+Returns a copy of s +in which all occurrences of the pattern pat have been +replaced by a replacement string specified by repl. +gsub also returns, as a second value, +the total number of substitutions made. + +

If repl is a string, then its value is used for replacement. +The character % works as an escape character: +Any sequence in repl of the form %n, +with n between 1 and 9, +stands for the value of the n-th captured substring (see below). +The sequence %0 stands for the whole match. +The sequence %% stands for a single %. + +

If repl is a function, then this function is called every time a +match occurs, with all captured substrings passed as arguments, +in order; +if the pattern specifies no captures, +then the whole match is passed as a sole argument. +If the value returned by this function is a string, +then it is used as the replacement string; +otherwise, the replacement string is the empty string. + +

The optional last parameter n limits +the maximum number of substitutions to occur. +For instance, when n is 1 only the first occurrence of +pat is replaced. + +

Here are some examples: +

+   x = string.gsub("hello world", "(%w+)", "%1 %1")
+   --> x="hello hello world world"
+
+   x = string.gsub("hello world", "%w+", "%0 %0", 1)
+   --> x="hello hello world"
+
+   x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
+   --> x="world hello Lua from"
+
+   x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
+   --> x="home = /home/roberto, user = roberto"
+
+   x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
+         return loadstring(s)()
+       end)
+   --> x="4+5 = 9"
+
+   local t = {name="lua", version="5.0"}
+   x = string.gsub("$name_$version.tar.gz", "%$(%w+)", function (v)
+         return t[v]
+       end)
+   --> x="lua_5.0.tar.gz"
+
+ +


string.len (s)

+Receives a string and returns its length. +The empty string "" has length 0. +Embedded zeros are counted, +so "a\000bc\000" has length 5. + +


string.lower (s)

+Receives a string and returns a copy of that string with all +uppercase letters changed to lowercase. +All other characters are left unchanged. +The definition of what is an uppercase letter depends on the current locale. + +


string.match (s, pattern [, init])

+Looks for the first match of +pattern in the string s. +If it finds one, then match returns +the captures from the pattern; +otherwise it returns nil. +If pattern specifies no captures, +then the whole match is returned. +A third, optional numerical argument init specifies +where to start the search; +its default value is 1 and may be negative. + +


string.rep (s, n)

+Returns a string that is the concatenation of n copies of +the string s. + +


string.reverse (s)

+Returns a string that is the string s reversed. + +


string.sub (s, i [, j])

+Returns the substring of s that +starts at i and continues until j; +i and j may be negative. +If j is absent, then it is assumed to be equal to -1 +(which is the same as the string length). +In particular, +the call string.sub(s,1,j) returns a prefix of s +with length j, +and string.sub(s, -i) returns a suffix of s +with length i. + +


string.upper (s)

+Receives a string and returns a copy of that string with all +lowercase letters changed to uppercase. +All other characters are left unchanged. +The definition of what is a lowercase letter depends on the current locale. + +

Patterns

+ +

+A character class is used to represent a set of characters. +The following combinations are allowed in describing a character class: +

    +
  • x (where x is not one of the magic characters +^$()%.[]*+-?) +— represents the character x itself. +
  • . — (a dot) represents all characters. +
  • %a — represents all letters. +
  • %c — represents all control characters. +
  • %d — represents all digits. +
  • %l — represents all lowercase letters. +
  • %p — represents all punctuation characters. +
  • %s — represents all space characters. +
  • %u — represents all uppercase letters. +
  • %w — represents all alphanumeric characters. +
  • %x — represents all hexadecimal digits. +
  • %z — represents the character with representation 0. +
  • %x (where x is any non-alphanumeric character) — +represents the character x. +This is the standard way to escape the magic characters. +Any punctuation character (even the non magic) +can be preceded by a `%´ +when used to represent itself in a pattern. + +

  • [set] — +represents the class which is the union of all +characters in set. +A range of characters may be specified by +separating the end characters of the range with a `-´. +All classes %x described above may also be used as +components in set. +All other characters in set represent themselves. +For example, [%w_] (or [_%w]) +represents all alphanumeric characters plus the underscore, +[0-7] represents the octal digits, +and [0-7%l%-] represents the octal digits plus +the lowercase letters plus the `-´ character. + +

    The interaction between ranges and classes is not defined. +Therefore, patterns like [%a-z] or [a-%%] +have no meaning. + +

  • [^set] — +represents the complement of set, +where set is interpreted as above. +
+For all classes represented by single letters (%a, %c, etc.), +the corresponding uppercase letter represents the complement of the class. +For instance, %S represents all non-space characters. + +

The definitions of letter, space, and other character groups +depend on the current locale. +In particular, the class [a-z] may not be equivalent to %l. + +

+A pattern item may be +

    +
  • +a single character class, +which matches any single character in the class; +
  • +a single character class followed by `*´, +which matches 0 or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • +a single character class followed by `+´, +which matches 1 or more repetitions of characters in the class. +These repetition items will always match the longest possible sequence; +
  • +a single character class followed by `-´, +which also matches 0 or more repetitions of characters in the class. +Unlike `*´, +these repetition items will always match the shortest possible sequence; +
  • +a single character class followed by `?´, +which matches 0 or 1 occurrence of a character in the class; +
  • +%n, for n between 1 and 9; +such item matches a substring equal to the n-th captured string +(see below); +
  • +%bxy, where x and y are two distinct characters; +such item matches strings that start with x, end with y, +and where the x and y are balanced. +This means that, if one reads the string from left to right, +counting +1 for an x and -1 for a y, +the ending y is the first y where the count reaches 0. +For instance, the item %b() matches expressions with +balanced parentheses. +
+ +

+A pattern is a sequence of pattern items. +A `^´ at the beginning of a pattern anchors the match at the +beginning of the subject string. +A `$´ at the end of a pattern anchors the match at the +end of the subject string. +At other positions, +`^´ and `$´ have no special meaning and represent themselves. + +

+A pattern may contain sub-patterns enclosed in parentheses; +they describe captures. +When a match succeeds, the substrings of the subject string +that match captures are stored (captured) for future use. +Captures are numbered according to their left parentheses. +For instance, in the pattern "(a*(.)%w(%s*))", +the part of the string matching "a*(.)%w(%s*)" is +stored as the first capture (and therefore has number 1); +the character matching . is captured with number 2, +and the part matching %s* has number 3. + +

As a special case, the empty capture () captures +the current string position (a number). +For instance, if we apply the pattern "()aa()" on the +string "flaaap", there will be two captures: 3 and 5. + +

A pattern cannot contain embedded zeros. Use %z instead. + +

5.5 - Table Manipulation

+This library provides generic functions for table manipulation. +It provides all its functions inside the table table. + +

Most functions in the table library assume that the table +represents an array or a list. +For those functions, when we talk about "the length" of a table +we mean the result of the length operator. + +


table.concat (table [, sep [, i [, j]]])

+Returns table[i]..sep..table[i+1] ... sep..table[j]. +The default value for sep is the empty string, +the default for i is 1, +and the default for j is the length of the table. +If i is greater than j, returns the empty string. + +


table.sort (table [, comp])

+Sorts table elements in a given order, in-place, +from table[1] to table[n], +where n is the length of the table. +If comp is given, +then it must be a function that receives two table elements, +and returns true +when the first is less than the second +(so that not comp(a[i+1],a[i]) will be true after the sort). +If comp is not given, +then the standard Lua operator < is used instead. + +

The sort algorithm is not stable, +that is, elements considered equal by the given order +may have their relative positions changed by the sort. + +


table.insert (table, [pos,] value)

+ +

Inserts element value at position pos in table, +shifting up other elements to open space, if necessary. +The default value for pos is n+1, +where n is the length of the table (see 2.5.5), +so that a call table.insert(t,x) inserts x at the end +of table t. + +


table.remove (table [, pos])

+ +

Removes from table the element at position pos, +shifting down other elements to close the space, if necessary. +Returns the value of the removed element. +The default value for pos is n, +where n is the length of the table, +so that a call table.remove(t) removes the last element +of table t. + +

5.6 - Mathematical Functions

+ +

This library is an interface to the standard C math library. +It provides all its functions inside the table math. +The library provides the following functions: + + + + + + + +

+       math.abs     math.acos    math.asin    math.atan    math.atan2
+       math.ceil    math.cosh    math.cos     math.deg     math.exp
+       math.floor   math.fmod    math.frexp   math.ldexp   math.log
+       math.log10   math.max     math.min     math.modf    math.pow
+       math.rad     math.random  math.randomseed           math.sin
+       math.sinh    math.sqrt    math.tan     math.tanh
+
+plus a variable math.pi and +a variable math.huge, +with the value HUGE_VAL. +Most of those functions +are only interfaces to the corresponding functions in the C library. +All trigonometric functions work in radians. +The functions math.deg and math.rad convert +between radians and degrees. + +

The function math.max returns the maximum +value of its numeric arguments. +Similarly, math.min computes the minimum. +Both can be used with 1, 2, or more arguments. + +

The function math.modf corresponds to the modf C function. +It returns two values: +The integral part and the fractional part of its argument. +The function math.frexp also returns 2 values: +The normalized fraction and the exponent of its argument. + +

The functions math.random and math.randomseed +are interfaces to the simple random generator functions +rand and srand that are provided by ANSI C. +(No guarantees can be given for their statistical properties.) +When called without arguments, +math.random returns a pseudo-random real number +in the range [0,1). +When called with a number n, +math.random returns +a pseudo-random integer in the range [1,n]. +When called with two arguments, +l and u, +math.random returns a pseudo-random +integer in the range [l,u]. +The math.randomseed function sets a "seed" +for the pseudo-random generator: +Equal seeds produce equal sequences of numbers. + +

5.7 - Input and Output Facilities

+ +

The I/O library provides two different styles for file manipulation. +The first one uses implicit file descriptors, +that is, there are operations to set a default input file and a +default output file, +and all input/output operations are over those default files. +The second style uses explicit file descriptors. + +

When using implicit file descriptors, +all operations are supplied by table io. +When using explicit file descriptors, +the operation io.open returns a file descriptor +and then all operations are supplied as methods of the file descriptor. + +

The table io also provides +three predefined file descriptors with their usual meanings from C: +io.stdin, io.stdout, and io.stderr. + +

Unless otherwise stated, +all I/O functions return nil on failure +(plus an error message as a second result) +and some value different from nil on success. + +


io.close ([file])

+ +

Equivalent to file:close(). +Without a file, closes the default output file. + +


io.flush ()

+ +

Equivalent to file:flush over the default output file. + +


io.input ([file])

+ +

When called with a file name, it opens the named file (in text mode), +and sets its handle as the default input file. +When called with a file handle, +it simply sets that file handle as the default input file. +When called without parameters, +it returns the current default input file. + +

In case of errors this function raises the error, +instead of returning an error code. + +


io.lines ([filename])

+ +

Opens the given file name in read mode +and returns an iterator function that, +each time it is called, +returns a new line from the file. +Therefore, the construction +

+       for line in io.lines(filename) do ... end
+
+will iterate over all lines of the file. +When the iterator function detects the end of file, +it returns nil (to finish the loop) and automatically closes the file. + +

The call io.lines() (without a file name) is equivalent +to io.input():lines(), that is, it iterates over the +lines of the default input file. +In that case it does not close the file when the loop ends. + +


io.open (filename [, mode])

+ +

This function opens a file, +in the mode specified in the string mode. +It returns a new file handle, +or, in case of errors, nil plus an error message. + +

The mode string can be any of the following: +

    +
  • "r" read mode (the default); +
  • "w" write mode; +
  • "a" append mode; +
  • "r+" update mode, all previous data is preserved; +
  • "w+" update mode, all previous data is erased; +
  • "a+" append update mode, previous data is preserved, + writing is only allowed at the end of file. +
+The mode string may also have a b at the end, +which is needed in some systems to open the file in binary mode. +This string is exactly what is used in the +standard C function fopen. + +


io.output ([file])

+ +

Similar to io.input, but operates over the default output file. + +


io.popen ([prog [, mode]])

+ +

Starts program prog in a separated process and returns +a file handle that you can use to read data from that program +(if mode is "r", the default) +or to write data to that program +(if mode is "w"). + +

This function is system dependent and is not available +in all platforms. + +


io.read (format1, ...)

+ +

Equivalent to io.input():read. + +


io.tmpfile ()

+ +

Returns a handle for a temporary file. +This file is open in update mode +and it is automatically removed when the program ends. + +


io.type (obj)

+ +

Checks whether obj is a valid file handle. +Returns the string "file" if obj is an open file handle, +"closed file" if obj is a closed file handle, +and nil if obj is not a file handle. + +


io.write (value1, ...)

+ +

Equivalent to io.output():write. + +


file:close ()

+ +

Closes file. +Note that files are automatically closed when garbage collected, +but that takes an unpredictable time to happen. + +


file:flush ()

+ +

Saves any written data to file. + +


file:lines ()

+ +

Returns an iterator function that, +each time it is called, +returns a new line from the file. +Therefore, the construction +

+       for line in file:lines() do ... end
+
+will iterate over all lines of the file. +(Unlike io.lines, this function does not close the file +when the loop ends.) + +


file:read (format1, ...)

+ +

Reads the file file, +according to the given formats, which specify what to read. +For each format, +the function returns a string (or a number) with the characters read, +or nil if it cannot read data with the specified format. +When called without formats, +it uses a default format that reads the entire next line +(see below). + +

The available formats are +

    +
  • "*n" reads a number; +this is the only format that returns a number instead of a string. +
  • "*a" reads the whole file, starting at the current position. +On end of file, it returns the empty string. +
  • "*l" reads the next line (skipping the end of line), +returning nil on end of file. +This is the default format. +
  • number reads a string with up to that number of characters, +returning nil on end of file. +If number is zero, +it reads nothing and returns an empty string, +or nil on end of file. +
+ +


file:seek ([whence] [, offset])

+ +

Sets and gets the file position, +measured from the beginning of the file, +to the position given by offset plus a base +specified by the string whence, as follows: +

    +
  • "set" base is position 0 (beginning of the file); +
  • "cur" base is current position; +
  • "end" base is end of file; +
+In case of success, function seek returns the final file position, +measured in bytes from the beginning of the file. +If this function fails, it returns nil, +plus a string describing the error. + +

The default value for whence is "cur", +and for offset is 0. +Therefore, the call file:seek() returns the current +file position, without changing it; +the call file:seek("set") sets the position to the +beginning of the file (and returns 0); +and the call file:seek("end") sets the position to the +end of the file, and returns its size. + +


file:setvbuf (mode [, size])

+ +

Sets the buffering mode for an output file. +There are three available modes: +

    +
  • "no" no buffering; any output operation appear immediately. +
  • "full" full buffering; output operation is performed only +when the buffer is full (or when you flush the file (see 5.7)). +
  • "line" line buffering; output is buffered until a newline is +output or there is any input from some special files +(such as a terminal device). +
+For the last two cases, sizes +specifies the size of the buffer, in bytes. +The default is an appropriate size. + +


file:write (value1, ...)

+ +

Writes the value of each of its arguments to +the filehandle file. +The arguments must be strings or numbers. +To write other values, +use tostring or string.format before write. + +

5.8 - Operating System Facilities

+ +

This library is implemented through table os. + +


os.clock ()

+ +

Returns an approximation of the amount of CPU time +used by the program, in seconds. + +


os.date ([format [, time]])

+ +

Returns a string or a table containing date and time, +formatted according to the given string format. + +

If the time argument is present, +this is the time to be formatted +(see the os.time function for a description of this value). +Otherwise, date formats the current time. + +

If format starts with `!´, +then the date is formatted in Coordinated Universal Time. +After that optional character, +if format is *t, +then date returns a table with the following fields: +year (four digits), month (1--12), day (1--31), +hour (0--23), min (0--59), sec (0--61), +wday (weekday, Sunday is 1), +yday (day of the year), +and isdst (daylight saving flag, a boolean). + +

If format is not *t, +then date returns the date as a string, +formatted according to the same rules as the C function strftime. + +

When called without arguments, +date returns a reasonable date and time representation that depends on +the host system and on the current locale +(that is, os.date() is equivalent to os.date("%c")). + +


os.difftime (t2, t1)

+ +

Returns the number of seconds from time t1 to time t2. +In Posix, Windows, and some other systems, +this value is exactly t2-t1. + +


os.execute (command)

+ +

This function is equivalent to the C function system. +It passes command to be executed by an operating system shell. +It returns a status code, which is system-dependent. + +


os.exit ([code])

+ +

Calls the C function exit, +with an optional code, +to terminate the host program. +The default value for code is the success code. + +


os.getenv (varname)

+ +

Returns the value of the process environment variable varname, +or nil if the variable is not defined. + +


os.remove (filename)

+ +

Deletes the file with the given name. +If this function fails, it returns nil, +plus a string describing the error. + +


os.rename (oldname, newname)

+ +

Renames file named oldname to newname. +If this function fails, it returns nil, +plus a string describing the error. + +


os.setlocale (locale [, category])

+ +

Sets the current locale of the program. +locale is a string specifying a locale; +category is an optional string describing which category to change: +"all", "collate", "ctype", +"monetary", "numeric", or "time"; +the default category is "all". +The function returns the name of the new locale, +or nil if the request cannot be honored. + +


os.time ([table])

+ +

Returns the current time when called without arguments, +or a time representing the date and time specified by the given table. +This table must have fields year, month, and day, +and may have fields hour, min, sec, and isdst +(for a description of these fields, see the os.date function). + +

The returned value is a number, whose meaning depends on your system. +In Posix, Windows, and some other systems, this number counts the number +of seconds since some given start time (the "epoch"). +In other systems, the meaning is not specified, +and the number returned by time can be used only as an argument to +date and difftime. + +


os.tmpname ()

+ +

Returns a string with a file name that can +be used for a temporary file. +The file must be explicitly opened before its use +and removed when no longer needed. + +

5.9 - The Reflexive Debug Interface

+ +

The debug library provides +the functionality of the debug interface to Lua programs. +You should exert care when using this library. +The functions provided here should be used exclusively for debugging +and similar tasks, such as profiling. +Please resist the temptation to use them as a +usual programming tool: +They can be very slow. +Moreover, several of its functions +violate some assumptions about Lua code +(e.g., that local variables cannot be accessed from outside or +that userdata metatables cannot be changed by Lua code) +and therefore can compromise some otherwise secure code. + +

All functions in this library are provided +inside a debug table. + +


debug.debug ()

+ +

Enters an interactive mode with the user, +running each string that the user enters. +Using simple commands and other debug facilities, +the user can inspect global and local variables, +change their values, evaluate expressions, and so on. +A line containing only the word cont finishes this function, +so that the caller continues its execution. + +

Note that commands for debug.debug are not lexically nested +with any function, so they have no direct access to local variables. + +


debug.getfenv (o)

+Returns the environment of object o. + +


debug.gethook ()

+ +

Returns the current hook settings, as three values: +the current hook function, the current hook mask, +and the current hook count +(as set by the debug.sethook function). + +


debug.getinfo (function [, what])

+ +

This function returns a table with information about a function. +You can give the function directly, +or you can give a number as the value of function, +which means the function running at level function of the call stack: +Level 0 is the current function (getinfo itself); +level 1 is the function that called getinfo; +and so on. +If function is a number larger than the number of active functions, +then getinfo returns nil. + +

The returned table contains all the fields returned by lua_getinfo, +with the string what describing which fields to fill in. +The default for what is to get all information available. +If present, +the option `f´ +adds a field named func with the function itself. + +

For instance, the expression debug.getinfo(1,"n").name returns +the name of the current function, if a reasonable name can be found, +and debug.getinfo(print) returns a table with all available information +about the print function. + +


debug.getlocal (level, local)

+ +

This function returns the name and the value of the local variable +with index local of the function at level level of the stack. +(The first parameter or local variable has index 1, and so on, +until the last active local variable.) +The function returns nil if there is no local +variable with the given index, +and raises an error when called with a level out of range. +(You can call debug.getinfo to check whether the level is valid.) + +


debug.getmetatable (object)

+ +

If object does not have a metatable, returns nil. +Otherwise, returns the metatable of the given object. + +


debug.getupvalue (func, up)

+ +

This function returns the name and the value of the upvalue +with index up of the function func. +The function returns nil if there is no upvalue with the given index. + +


debug.setfenv (o, table)

+ +

Sets the environment of the given object. + +


debug.sethook (hook, mask [, count])

+ +

Sets the given function as a hook. +The string mask and the number count describe +when the hook will be called. +The string mask may have the following characters, +with the given meaning: +

    +
  • "c" The hook is called every time Lua calls a function; +
  • "r" The hook is called every time Lua returns from a function; +
  • "l" The hook is called every time Lua enters a new line of code. +
+With a count different from zero, +the hook is called after every count instructions. + +

When called without arguments, +the debug.sethook function turns off the hook. + +

When the hook is called, its first parameter is always a string +describing the event that triggered its call: +"call", "return" (or "tail return"), +"line", and "count". +Moreover, for line events, +it also gets as its second parameter the new line number. +Inside a hook, +you can call getinfo with level 2 to get more information about +the running function +(level 0 is the getinfo function, +and level 1 is the hook function), +unless the event is "tail return". +In this case, Lua is only simulating the return, +and a call to getinfo will return invalid data. + +


debug.setlocal (level, local, value)

+ +

This function assigns the value value to the local variable +with index local of the function at level level of the stack. +The function returns nil if there is no local +variable with the given index, +and raises an error when called with a level out of range. +(You can call getinfo to check whether the level is valid.) +Otherwise, it returns the name of the local variable. + +


debug.setmetatable (o, metatable)

+ +

Sets the metatable for the given object. + +


debug.setupvalue (func, up, value)

+ +

This function assigns the value value to the upvalue +with index up of the function func. +The function returns nil if there is no upvalue +with the given index. +Otherwise, it returns the name of the upvalue. + +


debug.traceback ([message])

+ +

Returns a string with a traceback of the call stack. +An optional message string is appended +at the beginning of the traceback. +This function is typically used with xpcall to produce +better error messages. + +

+

6 - Lua Stand-alone

+ +

Although Lua has been designed as an extension language, +to be embedded in a host C program, +it is also frequently used as a stand-alone language. +An interpreter for Lua as a stand-alone language, +called simply lua, +is provided with the standard distribution. +The stand-alone interpreter includes +all standard libraries plus the reflexive debug interface. +Its usage is: +

+      lua [options] [script [args]]
+
+The options are: +
    +
  • - executes stdin as a file; +
  • -e stat executes string stat; +
  • -l mod "requires" mod; +
  • -i enters interactive mode after running script; +
  • -v prints version information; +
  • -- stop handling options. +
+After handling its options, lua runs the given script, +passing to it the given args. +When called without arguments, +lua behaves as lua -v -i when stdin is a terminal, +and as lua - otherwise. + +

Before running any argument, +the interpreter checks for an environment variable LUA_INIT. +If its format is @filename, +then lua executes the file. +Otherwise, lua executes the string itself. + +

All options are handled in order, except -i. +For instance, an invocation like +

+       $ lua -e'a=1' -e 'print(a)' script.lua
+
+will first set a to 1, then print a, +and finally run the file script.lua. +(Here $ is the shell prompt. Your prompt may be different.) + +

Before starting to run the script, +lua collects all arguments in the command line +in a global table called arg. +The script name is stored in index 0, +the first argument after the script name goes to index 1, +and so on. +Any arguments before the script name +(that is, the interpreter name plus the options) +go to negative indices. +For instance, in the call +

+       $ lua -la.lua b.lua t1 t2
+
+the interpreter first runs the file a.lua, +then creates a table +
+       arg = { [-2] = "lua", [-1] = "-la.lua", [0] = "b.lua",
+               [1] = "t1", [2] = "t2" }
+
+and finally runs the file b.lua. +The script is called with arg[1], arg[2], ... +as arguments; +it can access those arguments with the vararg expression .... + +

In interactive mode, +if you write an incomplete statement, +the interpreter waits for its completion. + +

If the global variable _PROMPT is defined as a string, +then its value is used as the prompt. +Therefore, the prompt can be changed directly on the command line: +

+       $ lua -e"_PROMPT='myprompt> '" -i
+
+(the outer pair of quotes is for the shell, +the inner is for Lua), +or in any Lua programs by assigning to _PROMPT. +Note the use of -i to enter interactive mode; otherwise, +the program would end just after the assignment to _PROMPT. + +

To allow the use of Lua as a +script interpreter in Unix systems, +the stand-alone interpreter skips +the first line of a chunk if it starts with #. +Therefore, Lua scripts can be made into executable programs +by using chmod +x and the #! form, +as in +

+#!/usr/local/bin/lua
+
+(Of course, +the location of the Lua interpreter may be different in your machine. +If lua is in your PATH, +then +
+#!/usr/bin/env lua
+
+is a more portable solution.) + +


+ +

Incompatibilities with Previous Version

+ + +

Here we list the incompatibilities when moving a program +from Lua 5.0 to Lua 5.1. +You can avoid most of the incompatibilities compiling Lua with +appropriate options. +However, +all those compatibility options will be removed in the next version. + +

Incompatibilities with version 5.0

+ +

Changes in the Language

+
    +
  • +The vararg system changed from the pseudo-argument arg with a +table with the extra arguments to the vararg expression. +(Option LUA_COMPAT_VARARG) + +

  • +There was a subtle change in the scope of the implicit +variables of the for constructor. + +

  • +The long string/long comment syntax ([[...]]) does not allow nesting. +You can use the new syntax ([=[...]=]) in those cases. +(Option LUA_COMPAT_LSTR) + +

+ +

Changes in the Libraries

+
    +
  • +Function string.find does not return its captures. +Use string.match for that. +(Option LUA_COMPAT_FIND) + +

  • +Function string.gfind was renamed string.gmatch. +(Option LUA_COMPAT_GFIND) + +

  • +Function table.setn was deprecated. +Function table.getn corresponds +to the new length operator (#); +use the operator instead of the function. +(Option LUA_COMPAT_GETN) + +

  • +Function loadlib was renamed package.loadlib. +(Option LUA_COMPAT_LOADLIB) + +

  • +Function math.mod was renamed math.fmod. +(Option LUA_COMPAT_MOD) + +

  • +There was substantial changes in function require due to +the new module system. +However, the new behavior is mostly compatible with the old, +but it gets the path from package.path instead +of from LUA_PATH. + +

  • +Function collectgarbage has different arguments. +Function gcinfo is deprecated; +use collectgarbage("count") instead. + +

+ +

Changes in the API

+
    +
  • +Function lua_open was replaced by lua_newstate to +allow the user to set an allocation function. +You can use luaL_newstate from the standard library to +create a state with a standard allocation function +(based on realloc). + +

  • +Functions luaL_getn and luaL_setn +(from the auxiliary library) are deprecated. +Use lua_objlen instead of luaL_getn +and nothing instead of luaL_setn. + +

  • +Function luaL_openlib was replaced by luaL_register. + +

+ +

+ +

The Complete Syntax of Lua

+ + +

+ +

+
+

chunk ::= {stat [`;´]} + +

block ::= chunk + +

stat ::= varlist1 `=´ explist1 | functioncall | do block end | while exp do block end | repeat block until exp | if exp then block {elseif exp then block} [else block] end | return [explist1] | break | for Name `=´ exp `,´ exp [`,´ exp] do block end | for namelist in explist1 do block end | function funcname funcbody | local function Name funcbody | local namelist [init] + +

funcname ::= Name {`.´ Name} [`:´ Name] + +

varlist1 ::= var {`,´ var} + +

var ::= Name | prefixexp `[´ exp `]´ | prefixexp `.´ Name + +

namelist ::= Name {`,´ Name} + +

init ::= `=´ explist1 + +

explist1 ::= {exp `,´} exp + +

exp ::= nil | false | true | Number | Literal | `...´ | function | prefixexp | tableconstructor | exp binop exp | unop exp + +

prefixexp ::= var | functioncall | `(´ exp `)´ + +

functioncall ::= prefixexp args | prefixexp `:´ Name args + +

args ::= `(´ [explist1] `)´ | tableconstructor | Literal + +

function ::= function funcbody + +

funcbody ::= `(´ [parlist1] `)´ block end + +

parlist1 ::= namelist [`,´ `...´] | `...´ + +

tableconstructor ::= `{´ [fieldlist] `}´ + fieldlist ::= field {fieldsep field} [fieldsep] + field ::= `[´ exp `]´ `=´ exp | name `=´ exp | exp + fieldsep ::= `,´ | `;´ + +

binop ::= `+´ | `-´ | `*´ | `/´ | `^´ | `%´ | `..´ | `<´ | `<=´ | `>´ | `>=´ | `==´ | `~=´ | and | or + +

unop ::= `-´ | not | `#´ + +

+ +

+ +

+ +


+ +Last update: +Wed Sep 7 13:53:49 BRT 2005 + + + diff --git a/_docs/LuaJIT/readme.html b/_docs/LuaJIT/readme.html new file mode 100644 index 00000000..db20a69a --- /dev/null +++ b/_docs/LuaJIT/readme.html @@ -0,0 +1,32 @@ + + +Lua documentation + + + + + +
+

+Lua +Documentation +

+ + + +
+ +Last update: +Wed Sep 7 12:57:50 BRST 2005 + + + + diff --git a/_docs/doc Boost/html/any.html b/_docs/doc Boost/html/any.html new file mode 100644 index 00000000..275f936d --- /dev/null +++ b/_docs/doc Boost/html/any.html @@ -0,0 +1,40 @@ + +Boost.Any
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Boost.Any

Kevlin Henney

Introduction

There are times when a generic (in the sense of + general as opposed to + template-based programming) type is needed: + variables that are truly variable, accommodating values of many + other more specific types rather than C++'s normal strict and + static types. We can distinguish three basic kinds of generic + type:

  • Converting types that can hold one of a number of + possible value types, e.g. int and + string, and freely convert between them, for + instance interpreting 5 as "5" or + vice-versa. Such types are common in scripting and other + interpreted + languages. + boost::lexical_cast + supports such conversion functionality.

  • + Discriminated types that contain values of different types but + do not attempt conversion between them, i.e. 5 is + held strictly as an int and is not implicitly + convertible either to "5" or to + 5.0. Their indifference to interpretation but + awareness of type effectively makes them safe, generic + containers of single values, with no scope for surprises from + ambiguous conversions.

  • + Indiscriminate types that can refer to anything but are + oblivious to the actual underlying type, entrusting all forms + of access and interpretation to the programmer. This niche is + dominated by void *, which offers plenty of scope + for surprising, undefined behavior.

The boost::any class + (based on the class of the same name described in "Valued + Conversions" by Kevlin Henney, C++ + Report 12(7), July/August 2000) is a variant value type + based on the second category. It supports copying of any value + type and safe checked extraction of that value strictly against + its type. A similar design, offering more appropriate operators, + can be used for a generalized function adaptor, + any_function, a generalized iterator adaptor, + any_iterator, and other object types that need + uniform runtime treatment but support only compile-time template + parameter conformance.

diff --git a/_docs/doc Boost/html/any.reference.html b/_docs/doc Boost/html/any.reference.html new file mode 100644 index 00000000..80bf9848 --- /dev/null +++ b/_docs/doc Boost/html/any.reference.html @@ -0,0 +1,29 @@ + +Reference
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Reference

ValueType requirements

Values are strongly informational objects for which + identity is not significant, i.e. the focus is principally on + their state content and any behavior organized around + that. Another distinguishing feature of values is their + granularity: normally fine-grained objects representing simple + concepts in the system such as quantities.

As the emphasis of a value lies in its state not its + identity, values can be copied and typically assigned one to + another, requiring the explicit or implicit definition of a + public copy constructor and public assignment operator. Values + typically live within other scopes, i.e. within objects or + blocks, rather than on the heap. Values are therefore normally + passed around and manipulated directly as variables or through + references, but not as pointers that emphasize identity and + indirection.

The specific requirements on value types to be used in an + any + are:

  • A ValueType is + CopyConstructible [20.1.3].
  • A ValueType is + optionally Assignable [23.1]. The strong + exception-safety guarantee is required for all forms of + assignment.
  • The destructor for a + ValueType upholds the no-throw + exception-safety guarantee.
Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/ch01s02.html b/_docs/doc Boost/html/ch01s02.html new file mode 100644 index 00000000..a99b49ab --- /dev/null +++ b/_docs/doc Boost/html/ch01s02.html @@ -0,0 +1,100 @@ + +Examples
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Examples

The following code demonstrates the syntax for using + implicit conversions to and copying of any objects:

+#include <list>
+#include <boost/any.hpp>
+
+using boost::any_cast;
+typedef std::list<boost::any> many;
+
+void append_int(many & values, int value)
+{
+    boost::any to_append = value;
+    values.push_back(to_append);
+}
+
+void append_string(many & values, const std::string & value)
+{
+    values.push_back(value);
+}
+
+void append_char_ptr(many & values, const char * value)
+{
+    values.push_back(value);
+}
+
+void append_any(many & values, const boost::any & value)
+{
+    values.push_back(value);
+}
+
+void append_nothing(many & values)
+{
+    values.push_back(boost::any());
+}
+

The following predicates follow on from the previous + definitions and demonstrate the use of queries on any + objects:

+bool is_empty(const boost::any & operand)
+{
+    return operand.empty();
+}
+
+bool is_int(const boost::any & operand)
+{
+    return operand.type() == typeid(int);
+}
+
+bool is_char_ptr(const boost::any & operand)
+{
+    try
+    {
+        any_cast<const char *>(operand);
+        return true;
+    }
+    catch(const boost::bad_any_cast &)
+    {
+        return false;
+    }
+}
+
+bool is_string(const boost::any & operand)
+{
+    return any_cast<std::string>(&operand);
+}
+
+void count_all(many & values, std::ostream & out)
+{
+    out << "#empty == "
+        << std::count_if(values.begin(), values.end(), is_empty) << std::endl;
+    out << "#int == "
+        << std::count_if(values.begin(), values.end(), is_int) << std::endl;
+    out << "#const char * == "
+        << std::count_if(values.begin(), values.end(), is_char_ptr) << std::endl;
+    out << "#string == "
+        << std::count_if(values.begin(), values.end(), is_string) << std::endl;
+}
+

The following type, patterned after the OMG's Property Service, defines name-value pairs for arbitrary value types:

+struct property
+{
+    property();
+    property(const std::string &, const boost::any &);
+
+    std::string name;
+    boost::any value;
+};
+
+typedef std::list<property> properties;
+

The following base class demonstrates one approach to + runtime polymorphism based callbacks that also require arbitrary + argument types. The absence of virtual member templates requires + that different solutions have different trade-offs in terms of + efficiency, safety, and generality. Using a checked variant type + offers one approach:

+class consumer
+{
+public:
+    virtual void notify(const any &) = 0;
+    ...
+};
+
Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/ch01s04.html b/_docs/doc Boost/html/ch01s04.html new file mode 100644 index 00000000..7f167487 --- /dev/null +++ b/_docs/doc Boost/html/ch01s04.html @@ -0,0 +1,2 @@ + +Acknowledgements
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Acknowledgements

Doug Gregor ported the documentation to the BoostBook format.

Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/ch04s02.html b/_docs/doc Boost/html/ch04s02.html new file mode 100644 index 00000000..f838ae5f --- /dev/null +++ b/_docs/doc Boost/html/ch04s02.html @@ -0,0 +1,575 @@ + +Tutorial
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Tutorial

How to Read this Tutorial

This tutorial is not meant to be read linearly. Its top-level +structure roughly separates different concepts in the library +(e.g., handling calling multiple slots, passing values to and from +slots) and in each of these concepts the basic ideas are presented +first and then more complex uses of the library are described +later. Each of the sections is marked Beginner, +Intermediate, or Advanced to help guide the +reader. The Beginner sections include information that all +library users should know; one can make good use of the Signals +library after having read only the Beginner sections. The +Intermediate sections build on the Beginner +sections with slightly more complex uses of the library. Finally, +the Advanced sections detail very advanced uses of the +Signals library, that often require a solid working knowledge of +the Beginner and Intermediate topics; most users +will not need to read the Advanced sections.

Compatibility Note

Boost.Signals has two syntactical forms: the preferred form and +the compatibility form. The preferred form fits more closely with the +C++ language and reduces the number of separate template parameters +that need to be considered, often improving readability; however, the +preferred form is not supported on all platforms due to compiler +bugs. The compatible form will work on all compilers supported by +Boost.Signals. Consult the table below to determine which syntactic +form to use for your compiler. Users of Boost.Function, please note +that the preferred syntactic form in Signals is equivalent to that of +Function's preferred syntactic form.

If your compiler does not appear in this list, please try the +preferred syntax and report your results to the Boost list so that +we can keep this table up-to-date.

Preferred syntaxPortable syntax
  • GNU C++ 2.95.x, 3.0.x, 3.1.x

  • Comeau C++ 4.2.45.2

  • SGI MIPSpro 7.3.0

  • Intel C++ 5.0, 6.0

  • Compaq's cxx 6.2

  • Any compiler supporting the preferred syntax

  • Microsoft Visual C++ 6.0, 7.0

  • Borland C++ 5.5.1

  • Sun WorkShop 6 update 2 C++ 5.3

  • Metrowerks CodeWarrior 8.1

Hello, World! (Beginner)

The following example writes "Hello, World!" using signals and +slots. First, we create a signal sig, a signal that +takes no arguments and has a void return value. Next, we connect +the hello function object to the signal using the +connect method. Finally, use the signal +sig like a function to call the slots, which in turns +invokes HelloWorld::operator() to print "Hello, +World!".

Preferred syntaxPortable syntax
+struct HelloWorld 
+{
+  void operator()() const 
+  { 
+    std::cout << "Hello, World!" << std::endl;
+  } 
+};
+
+// ...
+
+// Signal with no arguments and a void return value
+boost::signal<void ()> sig;
+
+// Connect a HelloWorld slot
+HelloWorld hello;
+sig.connect(hello);
+
+// Call all of the slots
+sig();
+
+struct HelloWorld 
+{
+  void operator()() const 
+  { 
+    std::cout << "Hello, World!" << std::endl;
+  } 
+};
+
+// ...
+
+// Signal with no arguments and a void return value
+boost::signal0<void> sig;
+
+// Connect a HelloWorld slot
+HelloWorld hello;
+sig.connect(hello);
+
+// Call all of the slots
+sig();
+

Calling multiple slots

Connecting multiple slots (Beginner)

Calling a single slot from a signal isn't very interesting, so +we can make the Hello, World program more interesting by splitting +the work of printing "Hello, World!" into two completely separate +slots. The first slot will print "Hello" and may look like +this:

+struct Hello 
+{
+  void operator()() const
+  {
+    std::cout << "Hello";
+  }
+};
+

The second slot will print ", World!" and a newline, to complete +the program. The second slot may look like this:

+struct World
+{
+  void operator()() const
+  {
+    std::cout << ", World!" << std::endl;
+  }
+};
+

Like in our previous example, we can create a signal +sig that takes no arguments and has a +void return value. This time, we connect both a +hello and a world slot to the same +signal, and when we call the signal both slots will be called.

Preferred syntaxPortable syntax
+boost::signal<void ()> sig;
+
+sig.connect(Hello());
+sig.connect(World());
+
+sig();
+
+boost::signal0<void> sig;
+
+sig.connect(Hello());
+sig.connect(World());
+
+sig();
+

Now, if you compile and run this program, you might see +something strange. It is possible that the output will look like +this:

+  , World!
+Hello
+

The underlying reason is that the ordering of signals isn't +guaranteed. The signal is free to call either the +Hello slot or the World slot first, but +every slot will be called unless something bad (e.g., an exception) +occurs. Read on to learn how to control the ordering so that +"Hello, World!" always prints as expected.

Ordering slot call groups (Intermediate)

Slots are free to have side effects, and that can mean that some +slots will have to be called before others. The Boost.Signals +library allows slots to be placed into groups that are ordered in +some way. For our Hello, World program, we want "Hello" to be +printed before ", World!", so we put "Hello" into a group that must +be executed before the group that ", World!" is in. To do this, we +can supply an extra parameter at the beginning of the +connect call that specifies the group. Group values +are, by default, ints, and are ordered by the integer +< relation. Here's how we construct Hello, World:

Preferred syntaxPortable syntax
+boost::signal<void ()> sig;
+sig.connect(0, Hello());
+sig.connect(1, World());
+sig();
+
+boost::signal0<void> sig;
+sig.connect(0, Hello());
+sig.connect(1, World());
+sig();
+

This program will correctly print "Hello, World!", because the +Hello object is in group 0, which precedes group 1 +where the World object resides.

The group parameter is, in fact, optional. We omitted it in the +first Hello, World example because it was unnecessary when all of +the slots are independent. So what happens if we mix calls to +connect that use the group parameter and those that don't? The +"unnamed" slots (i.e., those that have been connected without +specifying a group name) go into a separate group that is special +in that it follows all other groups. So if we add a new slot to our +example like this:

+struct GoodMorning
+{
+  void operator()() const
+  {
+    std::cout << "... and good morning!" << std::endl;
+  }
+};
+
+sig.connect(GoodMorning());
+

... we will get the result we wanted:

+Hello, World!
+... and good morning!
+

The last interesting point with groups of slots is the behavior +when multiple slots are connected in the same group. Within groups, +calls to slots are unordered: if we connect slots A +and B to the same signal with the same group name, +either A or B will be called first (but +both will be called). This is the same behavior we saw before with +the second version of Hello, World, where the slots could be called +in the wrong order, mangling the output.

Passing values to and from slots

Slot Arguments (Beginner)

Signals can propagate arguments to each of the slots they call. +For instance, a signal that propagates mouse motion events might +want to pass along the new mouse coordinates and whether the mouse +buttons are pressed.

As an example, we'll create a signal that passes two +float arguments to its slots. Then we'll create a few +slots that print the results of various arithmetic operations on +these values.

+void print_sum(float x, float y)
+{
+  std::cout << "The sum is " << x+y << std::endl;
+}
+
+void print_product(float x, float y)
+{
+  std::cout << "The product is " << x*y << std::endl;
+}
+
+void print_difference(float x, float y)
+{
+  std::cout << "The difference is " << x-y << std::endl;
+}
+
+void print_quotient(float x, float y)
+{
+  std::cout << "The quotient is " << x/y << std::endl;
+}
+
Preferred syntaxPortable syntax
+boost::signal<void (float, float)> sig;
+
+sig.connect(&print_sum);
+sig.connect(&print_product);
+sig.connect(&print_difference);
+sig.connect(&print_quotient);
+
+sig(5, 3);
+
+boost::signal2<void, float, float> sig;
+
+sig.connect(&print_sum);
+sig.connect(&print_product);
+sig.connect(&print_difference);
+sig.connect(&print_quotient);
+
+sig(5, 3);
+

This program will print out something like the following, +although the ordering of the lines may differ:

+The sum is 8
+The difference is 2
+The product is 15
+The quotient is 1.66667
+

So any values that are given to sig when it is +called like a function are passed to each of the slots. We have to +declare the types of these values up front when we create the +signal. The type boost::signal<void (float, +float)> means that the signal has a void +return value and takes two float values. Any slot +connected to sig must therefore be able to take two +float values.

Signal Return Values (Advanced)

Just as slots can receive arguments, they can also return +values. These values can then be returned back to the caller of the +signal through a combiner. The combiner is a mechanism +that can take the results of calling slots (there many be no +results or a hundred; we don't know until the program runs) and +coalesces them into a single result to be returned to the caller. +The single result is often a simple function of the results of the +slot calls: the result of the last slot call, the maximum value +returned by any slot, or a container of all of the results are some +possibilities.

We can modify our previous arithmetic operations example +slightly so that the slots all return the results of computing the +product, quotient, sum, or difference. Then the signal itself can +return a value based on these results to be printed:

Preferred syntaxPortable syntax
+float compute_product(float x, float y) { return x*y; }
+float compute_quotient(float x, float y) { return x/y; }
+float compute_sum(float x, float y) { return x+y; }
+float compute_difference(float x, float y) { return x-y; }
+
+boost::signal<float (float x, float y)> sig;
+
+sig.connect(&compute_product);
+sig.connect(&compute_quotient);
+sig.connect(&compute_sum);
+sig.connect(&compute_difference);
+
+std::cout << sig(5, 3) << std::endl;
+
+float compute_product(float x, float y) { return x*y; }
+float compute_quotient(float x, float y) { return x/y; }
+float compute_sum(float x, float y) { return x+y; }
+float compute_difference(float x, float y) { return x-y; }
+
+boost::signal2<float, float, float> sig;
+
+sig.connect(&compute_product);
+sig.connect(&compute_quotient);
+sig.connect(&compute_sum);
+sig.connect(&compute_difference);
+
+std::cout << sig(5, 3) << std::endl;
+

This example program will output either 8, +1.6667, 15, or 2, depending +on the order that the signals are called. This is because the +default behavior of a signal that has a return type +(float, the first template argument given to the +boost::signal class template) is to call all slots and +then return the result returned by the last slot called. This +behavior is admittedly silly for this example, because slots have +no side effects and the result is essentially randomly chosen from +the slots.

A more interesting signal result would be the maximum of the +values returned by any slot. To do this, we create a custom +combiner that looks like this:

+template<typename T>
+struct maximum
+{
+  typedef T result_type;
+
+  template<typename InputIterator>
+  T operator()(InputIterator first, InputIterator last) const
+  {
+    // If there are no slots to call, just return the
+    // default-constructed value
+    if (first == last)
+      return T();
+
+    T max_value = *first++;
+    while (first != last) {
+      if (max_value < *first)
+        max_value = *first;
+      ++first;
+    }
+  
+    return max_value;
+  }
+};
+

The maximum class template acts as a function +object. Its result type is given by its template parameter, and +this is the type it expects to be computing the maximum based on +(e.g., maximum<float> would find the maximum +float in a sequence of floats). When a +maximum object is invoked, it is given an input +iterator sequence [first, last) that includes the +results of calling all of the slots. maximum uses this +input iterator sequence to calculate the maximum element, and +returns that maximum value.

We actually use this new function object type by installing it +as a combiner for our signal. The combiner template argument +follows the signal's calling signature:

Preferred syntaxPortable syntax
+boost::signal<float (float x, float y), 
+              maximum<float> > sig;
+
+boost::signal2<float, float, float, 
+               maximum<float> > sig;
+

Now we can connect slots that perform arithmetic functions and +use the signal:

+sig.connect(&compute_quotient);
+sig.connect(&compute_product);
+sig.connect(&compute_sum);
+sig.connect(&compute_difference);
+
+std::cout << sig(5, 3) << std::endl;
+

The output of this program will be 15, because +regardless of the order in which the slots are called, the product +of 5 and 3 will be larger than the quotient, sum, or +difference.

In other cases we might want to return all of the values +computed by the slots together, in one large data structure. This +is easily done with a different combiner:

+template<typename Container>
+struct aggregate_values
+{
+  typedef Container result_type;
+
+  template<typename InputIterator>
+  Container operator()(InputIterator first, InputIterator last) const
+  {
+    return Container(first, last);
+  }
+};
+

+Again, we can create a signal with this new combiner: +

Preferred syntaxPortable syntax
+boost::signal<float (float, float), 
+              aggregate_values<std::vector<float> > > sig;
+
+sig.connect(&compute_quotient);
+sig.connect(&compute_product);
+sig.connect(&compute_sum);
+sig.connect(&compute_difference);
+
+std::vector<float> results = sig(5, 3);
+std::copy(results.begin(), results.end(), 
+          std::ostream_iterator<float>(cout, " "));
+
+boost::signal2<float, float, float,
+               aggregate_values<std::vector<float> > > sig;
+
+sig.connect(&compute_quotient);
+sig.connect(&compute_product);
+sig.connect(&compute_sum);
+sig.connect(&compute_difference);
+
+std::vector<float> results = sig(5, 3);
+std::copy(results.begin(), results.end(), 
+          std::ostream_iterator<float>(cout, " "));
+

The output of this program will contain 15, 8, 1.6667, and 2 +(but not necessarily in that order). It is interesting here that +the first template argument for the signal class, +float, is not actually the return type of the signal. +Instead, it is the return type used by the connected slots and will +also be the value_type of the input iterators passed +to the combiner. The combiner itself is a function object and its +result_type member type becomes the return type of the +signal.

The input iterators passed to the combiner transform dereference +operations into slot calls. Combiners therefore have the option to +invoke only some slots until some particular criterion is met. For +instance, in a distributed computing system, the combiner may ask +each remote system whether it will handle the request. Only one +remote system needs to handle a particular request, so after a +remote system accepts the work we do not want to ask any other +remote systems to perform the same task. Such a combiner need only +check the value returned when dereferencing the iterator, and +return when the value is acceptable. The following combiner returns +the first non-NULL pointer to a FulfilledRequest data +structure, without asking any later slots to fulfill the +request:

+struct DistributeRequest {
+  typedef FulfilledRequest* result_type;
+
+  template<typename InputIterator>
+  result_type operator()(InputIterator first, InputIterator last) const
+  {
+    while (first != last) {
+      if (result_type fulfilled = *first)
+        return fulfilled;
+      ++first;
+    }
+    return 0;
+  }
+};
+

Connection Management

Disconnecting Slots (Beginner)

Slots aren't expected to exist indefinately after they are +connected. Often slots are only used to receive a few events and +are then disconnected, and the programmer needs control to decide +when a slot should no longer be connected.

The entry point for managing connections explicitly is the +boost::signals::connection class. The +connection class uniquely represents the connection +between a particular signal and a particular slot. The +connected() method checks if the signal and slot are +still connected, and the disconnect() method +disconnects the signal and slot if they are connected before it is +called. Each call to the signal's connect() method +returns a connection object, which can be used to determine if the +connection still exists or to disconnect the signal and slot.

+boost::signals::connection c = sig.connect(HelloWorld());
+if (c.connected()) {
+// c is still connected to the signal
+  sig(); // Prints "Hello, World!"
+}
+
+c.disconnect(); // Disconnect the HelloWorld object
+assert(!c.connected()); c isn't connected any more
+
+sig(); // Does nothing: there are no connected slots
+

Scoped connections (Intermediate)

The boost::signals::scoped_connection class +references a signal/slot connection that will be disconnected when +the scoped_connection class goes out of scope. This +ability is useful when a connection need only be temporary, +e.g.,

+{
+  boost::signals::scoped_connection c = sig.connect(ShortLived());
+  sig(); // will call ShortLived function object
+}
+sig(); // ShortLived function object no longer connected to sig
+

Automatic connection management (Intermediate)

Boost.Signals can automatically track the lifetime of objects +involved in signal/slot connections, including automatic +disconnection of slots when objects involved in the slot call are +destroyed. For instance, consider a simple news delivery service, +where clients connect to a news provider that then sends news to +all connected clients as information arrives. The news delivery +service may be constructed like this:

Preferred syntaxPortable syntax
+class NewsItem { /* ... */ };
+
+boost::signal<void (const NewsItem& latestNews)> deliverNews;
+
+class NewsItem { /* ... */ };
+
+boost::signal1<void, const NewsItem&> deliverNews;
+

Clients that wish to receive news updates need only connect a +function object that can receive news items to the +deliverNews signal. For instance, we may have a +special message area in our application specifically for news, +e.g.,:

+struct NewsMessageArea : public MessageArea
+{
+public:
+  // ...
+
+  void displayNews(const NewsItem& news) const
+  {
+    messageText = news.text();
+    update();
+  }
+};
+
+// ...
+NewsMessageArea newsMessageArea = new NewsMessageArea(/* ... */);
+// ...
+deliverNews.connect(boost::bind(&NewsMessageArea::displayNews, 
+                                newsMessageArea, _1));
+

However, what if the user closes the news message area, +destroying the newsMessageArea object that +deliverNews knows about? Most likely, a segmentation +fault will occur. However, with Boost.Signals one need only make +NewsMessageArea trackable, and the slot +involving newsMessageArea will be disconnected when +newsMessageArea is destroyed. The +NewsMessageArea class is made trackable by deriving +publicly from the boost::signals::trackable class, +e.g.:

+struct NewsMessageArea : public MessageArea, public boost::signals::trackable
+{
+  // ...
+};
+

At this time there is a significant limitation to the use of +trackable objects in making slot connections: function +objects built using Boost.Bind are understood, such that pointers +or references to trackable objects passed to +boost::bind will be found and tracked.

Warning: User-defined function objects and function +objects from other libraries (e.g., Boost.Function or Boost.Lambda) +do not implement the required interfaces for trackable +object detection, and will silently ignore any bound trackable +objects. Future versions of the Boost libraries will address +this limitation.

When can disconnections occur? (Intermediate)

Signal/slot disconnections occur when any of these conditions +occur:

  • The connection is explicitly disconnected via the connection's +disconnect method directly, or indirectly via the +signal's disconnect method or +scoped_connection's destructor.

  • A trackable object bound to the slot is +destroyed.

  • The signal is destroyed.

These events can occur at any time without disrupting a signal's +calling sequence. If a signal/slot connection is disconnected at +any time during a signal's calling sequence, the calling sequence +will still continue but will not invoke the disconnected slot. +Additionally, a signal may be destroyed while it is in a calling +sequence, and which case it will complete its slot call sequence +but may not be accessed directly.

Signals may be invoked recursively (e.g., a signal A calls a +slot B that invokes signal A...). The disconnection behavior does +not change in the recursive case, except that the slot calling +sequence includes slot calls for all nested invocations of the +signal.

Passing slots (Intermediate)

Slots in the Boost.Signals library are created from arbitrary +function objects, and therefore have no fixed type. However, it is +commonplace to require that slots be passed through interfaces that +cannot be templates. Slots can be passed via the +slot_type for each particular signal type and any +function object compatible with the signature of the signal can be +passed to a slot_type parameter. For instance:

Preferred syntaxPortable syntax
+class Button 
+{
+  typedef boost::signal<void (int x, int y)> OnClick;
+
+public:
+  void doOnClick(const OnClick::slot_type& slot);
+
+private:
+  OnClick onClick;
+};
+
+void Button::doOnClick(const OnClick::slot_type& slot)
+{
+  onClick.connect(slot);
+}
+
+void printCoordinates(long x, long y)
+{
+  std::cout << "(" << x << ", " << y << ")\n";
+}
+
+void f(Button& button)
+{
+  button.doOnClick(&printCoordinates);
+}
+
+class Button 
+{
+  typedef boost::signal2<void, int x, int y> OnClick;
+
+public:
+  void doOnClick(const OnClick::slot_type& slot);
+
+private:
+  OnClick onClick;
+};
+
+void Button::doOnClick(const OnClick::slot_type& slot)
+{
+  onClick.connect(slot);
+}
+
+void printCoordinates(long x, long y)
+{
+  std::cout << "(" << x << ", " << y << ")\n";
+}
+
+void f(Button& button)
+{
+  button.doOnClick(&printCoordinates);
+}
+

The doOnClick method is now functionally equivalent +to the connect method of the onClick +signal, but the details of the doOnClick method can be +hidden in an implementation detail file.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/ch04s04.html b/_docs/doc Boost/html/ch04s04.html new file mode 100644 index 00000000..999f976e --- /dev/null +++ b/_docs/doc Boost/html/ch04s04.html @@ -0,0 +1,27 @@ + +Frequently Asked Questions
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Frequently Asked Questions

1. Don't noncopyable signal semantics mean that a class + with a signal member will be noncopyable as well?
2. Is Boost.Signals thread-safe?
3. How do I get Boost.Signals to work with Qt?
1.

Don't noncopyable signal semantics mean that a class + with a signal member will be noncopyable as well?

No. The compiler will not be able to generate a copy + constructor or copy assignment operator for your class if it + has a signal as a member, but you are free to write your own + copy constructor and/or copy assignment operator. Just don't + try to copy the signal.

2.

Is Boost.Signals thread-safe?

No. Using Boost.Signals in a multithreaded concept is + very dangerous, and it is very likely that the results will be + less than satisfying. Boost.Signals will support thread safety + in the future.

3.

How do I get Boost.Signals to work with Qt?

When building with Qt, the Moc keywords + signals and slots are defined using + preprocessor macros, causing programs using Boost.Signals and + Qt together to fail to compile. Although this is a problem + with Qt and not Boost.Signals, a user can use the two systems + together by defining the BOOST_SIGNALS_NAMESPACE + macro to some other identifier (e.g., signalslib) + when building and using the Boost.Signals library. Then the + namespace of the Boost.Signals library will be + boost::BOOST_SIGNALS_NAMESPACE instead of + boost::signals. To retain the original namespace + name in translation units that do not interact with Qt, you + can use a namespace alias:

+  namespace boost {
+    namespace signals = BOOST_SIGNALS_NAMESPACE;
+  }
+
Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/ch04s05.html b/_docs/doc Boost/html/ch04s05.html new file mode 100644 index 00000000..16e2fa7c --- /dev/null +++ b/_docs/doc Boost/html/ch04s05.html @@ -0,0 +1,102 @@ + +Design Overview
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Design Overview

Type Erasure

"Type erasure", where static type information is eliminated + by the use of dynamically dispatched interfaces, is used + extensively within the Boost.Signals library to reduce the amount + of code generated by template instantiation. Each signal must + manage a list of slots and their associated connections, along + with a std::map to map from group identifiers to + their associated connections. However, instantiating this map for + every token type, and perhaps within each translation unit (for + some popular template instantiation strategies) increase compile + time overhead and space overhead.

To combat this so-called "template bloat", we use + Boost.Function and Boost.Any to store unknown types and + operations. Then, all of the code for handling the list of slots + and the mapping from slot identifiers to connections is factored + into the class signal_base + that deals exclusively with the any and + function objects, hiding the + actual implementations using the well-known pimpl idiom. The + actual signalN class templates + deal only with code that will change depending on the number of + arguments or which is inherently template-dependent (such as + connection).

connection class

The connection class is + central to the behavior of the Boost.Signals library. It is the + only entity within the Boost.Signals system that has knowledge of + all objects that are associated by a given connection. To be + specific, the connection class + itself is merely a thin wrapper over a + shared_ptr to a + basic_connection object.

connection objects are + stored by all participants in the Signals system: each + trackable object contains a + list of connection objects + describing all connections it is a part of; similarly, all signals + contain a set of pairs that define a slot. The pairs consist of a + slot function object (generally a Boost.Function object) and a + connection object (that will + disconnect on destruction). Finally, the mapping from slot groups + to slots is based on the key value in a + std::multimap (the stored data + in the std::multimap is the + slot pair).

Slot Call Iterator

The slot call iterator is conceptually a stack of iterator + adaptors that modify the behavior of the underlying iterator + through the list of slots. The following table describes the type + and behavior of each iterator adaptor required. Note that this is + only a conceptual model: the implementation collapses all these + layers into a single iterator adaptor because several popular + compilers failed to compile the implementation of the conceptual + model.

Iterator AdaptorPurpose

Slot List Iterator

An iterator through the list of slots + connected to a signal. The value_type of this + iterator will be + std::pair<any, + connection>, where the + any contains an + instance of the slot function type.

Filter Iterator Adaptor

This filtering iterator adaptor filters out + slots that have been disconnected, so we never see a + disconnected slot in later stages.

Projection Iterator Adaptor

The projection iterator adaptor returns a + reference to the first member of the pair that constitutes + a connected slot (e.g., just the + boost::any object that + holds the slot function).

Transform Iterator Adaptor

This transform iterator adaptor performs an + any_cast to + extract a reference to the slot function with the + appropriate slot function type.

Transform Iterator Adaptor

This transform iterator adaptor calls the + function object returned by dereferencing the underlying + iterator with the set of arguments given to the signal + itself, and returns the result of that slot + call.

Input Caching Iterator Adaptor

This iterator adaptor caches the result of + dereferencing the underlying iterator. Therefore, + dereferencing this iterator multiple times will only + result in the underlying iterator being dereferenced once; + thus, a slot can only be called once but its result can be + used multiple times.

Slot Call Iterator

Iterates over calls to each slot.

visit_each function template

The visit_each + function template is a mechanism for discovering objects that are + stored within another object. Function template + visit_each takes three + arguments: an object to explore, a visitor function object that is + invoked with each subobject, and the int 0.

The third parameter is merely a temporary solution to the + widespread lack of proper function template partial ordering. The + primary visit_each + function template specifies this third parameter type to be + long, whereas any user specializations must specify + their third parameter to be of type int. Thus, even + though a broken compiler cannot tell the ordering between, e.g., a + match against a parameter T and a parameter + A<T>, it can determine that the conversion from + the integer 0 to int is better than the conversion to + long. The ordering determined by this conversion thus + achieves partial ordering of the function templates in a limited, + but successful, way. The following example illustrates the use of + this technique:

+template<typename> class A {};
+template<typename T> void foo(T, long);
+template<typename T> void foo(A<T>, int);
+A<T> at;
+foo(at, 0);
+

In this example, we assume that our compiler can not tell + that A<T> is a better match than + T, and therefore assume that the function templates + cannot be ordered based on that parameter. Then the conversion + from 0 to int is better than the conversion from 0 to + long, and the second function template is + chosen.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/ch04s06.html b/_docs/doc Boost/html/ch04s06.html new file mode 100644 index 00000000..e56a9961 --- /dev/null +++ b/_docs/doc Boost/html/ch04s06.html @@ -0,0 +1,269 @@ + +Design Rationale
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Design Rationale

Choice of Slot Definitions

The definition of a slot differs amongst signals and slots + libraries. Within Boost.Signals, a slot is defined in a very loose + manner: it can be any function object that is callable given + parameters of the types specified by the signal, and whose return + value is convertible to the result type expected by the + signal. However, alternative definitions have associated pros and + cons that were considered prior to the construction of + Boost.Signals.

  • Slots derive from a specific base + class: generally a scheme such as this will require + all user-defined slots to derive from some library-specified + Slot abstract class that defines a virtual + function calling the slot. Adaptors can be used to convert a + definition such as this to a definition similar to that used + by Boost.Signals, but the use of a large number of small + adaptor classes containing virtual functions has been found to + cause an unacceptable increase in the size of executables + (polymorphic class types require more code than + non-polymorphic types).

    This approach does have the benefit of simplicity of + implementation and user interface, from an object-oriented + perspective.

  • Slots constructed from a set of + primitives: in this scheme the slot can have a + limited set of types (often derived from a common abstract + base class) that are constructed from some library-defined set + of primitives that often include conversions from free + function pointers and member function pointers, and a limited + set of binding capabilities. Such an approach is reasonably + simple and cover most common cases, but it does not allow a + large degree of flexibility in slot construction. Libraries + for function object composition have become quite advanced and + it is out of the scope of a signals and slots library to + encorporate such enhancements. Thus Boost.Signals does not + include argument binding or function object composition + primitives, but instead provides a hook (via the + visit_each + mechanism) that allows existing binder/composition libraries + to provide the necessary information to Signals.

Users not satisfied with the slot definition choice may opt + to replace the default slot function type with an alternative that + meets their specific needs.

User-level Connection Management

Users need to have fine control over the connection of + signals to slots and their eventual disconnection. The approach + taken by Boost.Signals is to return a + connection object that enables + connected/disconnected query, manual disconnection, and an + automatic disconnection on destruction mode. Some other possible + interfaces include:

  • Pass slot to + disconnect: in this interface model, the + disconnection of a slot connected with + sig.connect(slot) is + performed via + sig.disconnect(slot). Internally, + a linear search using slot comparison is performed and the + slot, if found, is removed from the list. Unfortunately, + querying connectedness will generally also end up as + linear-time operations. This model also fails for + implementation reasons when slots become more complex than + simple function pointers, member function pointers and a + limited set of compositions and argument binders: to match the + slot given in the call to + disconnect with an + existing slot we would need to be able to compare arbitrary + function objects, which is not feasible.

  • Pass a token to + disconnect: this approach identifies slots with a + token that is easily comparable (e.g., a string), enabling + slots to be arbitrary function objects. While this approach is + essentially equivalent to the approach taken by Boost.Signals, + it is possibly more error-prone for several reasons:

    • Connections and disconnections must be paired, so + the problem becomes similar to the problems incurred when + pairing new and delete for + dynamic memory allocation. While errors of this sort would + not be catastrophic for a signals and slots + implementation, their detection is generally + nontrivial.

    • Tokens must be unique, otherwise two slots will have + the same name and will be indistinguishable. In + environments where many connections will be made + dynamically, name generation becomes an additional task + for the user. Uniqueness of tokens also results in an + additional failure mode when attempting to connect a slot + using a token that has already been used.

    • More parameterization would be required, because the + token type must be user-defined. Additional + parameterization steepens the learning curver and + overcomplicates a simple interface.

    This type of interface is supported in Boost.Signals + via the slot grouping mechanism. It augments the + connection object-based + connection management scheme.

Combiner Interface

The Combiner interface was chosen to mimic a call to an + algorithm in the C++ standard library. It is felt that by viewing + slot call results as merely a sequence of values accessed by input + iterators, the combiner interface would be most natural to a + proficient C++ programmer. Competing interface design generally + required the combiners to be constructed to conform to an + interface that would be customized for (and limited to) the + Signals library. While these interfaces are generally enable more + straighforward implementation of the signals & slots + libraries, the combiners are unfortunately not reusable (either in + other signals & slots libraries or within other generic + algorithms), and the learning curve is steepened slightly to learn + the specific combiner interface.

The Signals formulation of combiners is based on the + combiner using the "pull" mode of communication, instead of the + more complex "push" mechanism. With a "pull" mechanism, the + combiner's state can be kept on the stack and in the program + counter, because whenever new data is required (i.e., calling the + next slot to retrieve its return value), there is a simple + interface to retrieve that data immediately and without returning + from the combiner's code. Contrast this with the "push" mechanism, + where the combiner must keep all state in class members because + the combiner's routines will be invoked for each signal + called. Compare, for example, a combiner that returns the maximum + element from calling the slots. If the maximum element ever + exceeds 100, no more slots are to be called.

Pull

Push

+struct pull_max {
+  typedef int result_type;
+
+  template<typename InputIterator>
+  result_type operator()(InputIterator first,
+                         InputIterator last)
+  {
+    if (first == last)
+      throw std::runtime_error("Empty!");
+
+    int max_value = *first++;
+    while(first != last && *first <= 100) {
+      if (*first > max_value)
+        max_value = *first;
+      ++first;
+    }
+
+    return max_value;
+  }
+};
+
+struct push_max {
+  typedef int result_type;
+
+  push_max() : max_value(), got_first(false) {}
+
+  // returns false when we want to stop
+  bool operator()(int result) {
+    if (result > 100)
+      return false;
+
+    if (!got_first) {
+      got_first = true;
+      max_value = result;
+      return true;
+    }
+
+    if (result > max_value)
+      max_value = result;
+
+    return true;
+  }
+
+  int get_value() const 
+  { 
+    if (!got_first)
+      throw std::runtime_error("Empty!");
+    return max_value; 
+  }
+
+private:
+  int  max_value; 
+  bool got_first;
+};
+

There are several points to note in these examples. The + "pull" version is a reusable function object that is based on an + input iterator sequence with an integer value_type, + and is very straightforward in design. The "push" model, on the + other hand, relies on an interface specific to the caller and is + not generally reusable. It also requires extra state values to + determine, for instance, if any elements have been + received. Though code quality and ease-of-use is generally + subjective, the "pull" model is clearly shorter and more reusable + and will often be construed as easier to write and understand, + even outside the context of a signals & slots library.

The cost of the "pull" combiner interface is paid in the + implementation of the Signals library itself. To correctly handle + slot disconnections during calls (e.g., when the dereference + operator is invoked), one must construct the iterator to skip over + disconnected slots. Additionally, the iterator must carry with it + the set of arguments to pass to each slot (although a reference to + a structure containing those arguments suffices), and must cache + the result of calling the slot so that multiple dereferences don't + result in multiple calls. This apparently requires a large degree + of overhead, though if one considers the entire process of + invoking slots one sees that the overhead is nearly equivalent to + that in the "push" model, but we have inverted the control + structures to make iteration and dereference complex (instead of + making combiner state-finding complex).

Connection Interfaces: += operator

Boost.Signals supports a connection syntax with the form + sig.connect(slot), but a + more terse syntax sig += slot has been suggested (and + has been used by other signals & slots implementations). There + are several reasons as to why this syntax has been + rejected:

  • It's unnecessary: the + connection syntax supplied by Boost.Signals is no less + powerful that that supplied by the += + operator. The savings in typing (connect() + vs. +=) is essentially negligible. Furthermore, + one could argue that calling connect() is more + readable than an overload of +=.

  • Ambiguous return type: + there is an ambiguity concerning the return value of the + += operation: should it be a reference to the + signal itself, to enable sig += slot1 += slot2, + or should it return a + connection for the + newly-created signal/slot connection?

  • Gateway to operators -=, + +: when one has added a connection operator + +=, it seems natural to have a disconnection + operator -=. However, this presents problems when + the library allows arbitrary function objects to implicitly + become slots, because slots are no longer comparable.

    The second obvious addition when one has + operator+= would be to add a + + operator that supports addition of multiple slots, followed by + assignment to a signal. However, this would require + implementing + such that it can accept any two + function objects, which is technically infeasible.

trackable rationale

The trackable + class is the primary user interface to automatic connection + lifetime management, and its design affects users directly. Two + issues stick out most: the odd copying behavior of + trackable, and the limitation requiring users to + derive from trackable to create types that can + participate in automatic connection management.

trackable copying behavior

The copying behavior of + trackable is essentially + that trackable subobjects + are never copied; instead, the copy operation is merely a + no-op. To understand this, we look at the nature of a + signal-slot connection and note that the connection is based on + the entities that are being connected; when one of the entities + is destroyed, the connection is destroyed. Therefore, when a + trackable subobject is + copied, we cannot copy the connections because the connections + don't refer to the target entity - they refer to the source + entity. This reason is dual to the reason signals are + noncopyable: the slots connected to them are connected to that + particular signal, not the data contained in the signal.

Why derivation from trackable?

For trackable to work + properly, there are two constraints:

  • trackable must + have storage space to keep track of all connections made to + this object.

  • trackable must be + notified when the object is being destructed so that it can + disconnect its connections.

Clearly, deriving from + trackable meets these two + guidelines. We have not yet found a superior solution.

Comparison with other Signal/Slot implementations

libsigc++

libsigc++ is a C++ + signals & slots library that originally started as part of + an initiative to wrap the C interfaces to GTK libraries in C++, and has + grown to be a separate library maintained by Karl Nelson. There + are many similarities between libsigc++ and Boost.Signals, and + indeed Boost.Signals was strongly influenced by Karl Nelson and + libsigc++. A cursory inspection of each library will find a + similar syntax for the construction of signals and in the use of + connections and automatic connection lifetime management. There + are some major differences in design that separate these + libraries:

  • Slot definitions: + slots in libsigc++ are created using a set of primitives + defined by the library. These primitives allow binding of + objects (as part of the library), explicit adaptation from + the argument and return types of the signal to the argument + and return types of the slot (libsigc++ is, by default, more + strict about types than Boost.Signals). A discussion of this + approach with a comparison against the approach taken by + Boost.Signals is given in Choice of Slot Definitions.

  • Combiner/Marshaller + interface: the equivalent to Boost.Signals + combiners in libsigc++ are the marshallers. Marshallers are + similar to the "push" interface described in Combiner + Interface, and a proper treatment of the topic is given + there.

.NET delegates

Microsoft + has introduced the .NET Framework and an associated set of + languages and language extensions, one of which is the + delgate. Delegates are similar to signals and slots, but they + are more limited than most C++ signals and slots implemetations + in that they:

  • Require exact type matches between a delegate and what + it is calling.

  • Do not allow return types.

  • Must call a method with this already + bound.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/ch04s07.html b/_docs/doc Boost/html/ch04s07.html new file mode 100644 index 00000000..91edb716 --- /dev/null +++ b/_docs/doc Boost/html/ch04s07.html @@ -0,0 +1,10 @@ + +Testsuite
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Testsuite

Acceptance tests

TestTypeDescriptionIf failing...

dead_slot_test.cpp

run

Ensure that calling connect with a slot +that has already been disconnected via deletion does not actually +connect to the slot.

 

deletion_test.cpp

run

Test deletion of slots.

 

ordering_test.cpp

run

Test slot group ordering.

 

signal_n_test.cpp

run

Basic test of signal/slot connections and invocation using the +boost::signalN class templates.

 

signal_test.cpp

run

Basic test of signal/slot connections and invocation using the +boost::signal class template.

The boost::signal class template may not +be usable on your compiler. However, the +boost::signalN class templates may still be +usable.

trackable_test.cpp

run

Test automatic lifetime management using + boost::trackable objects.

 
Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.any.html b/_docs/doc Boost/html/class.boost.any.html new file mode 100644 index 00000000..7d0a77b1 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.any.html @@ -0,0 +1,72 @@ + +Class any
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class any

boost::any — A class whose instances can hold instances of any + type that satisfies ValueType + requirements.

Description

any construct/copy/destruct

  1. any();

    Postconditions: + this->empty()

  2. any(const any & other);

    Effects: + Copy constructor that copies content of + other into new instance, so that any content + is equivalent in both type and value to the content of + other, or empty if other is + empty.
    Throws: + May fail with a + std::bad_alloc + exception or any exceptions arising from the copy + constructor of the contained type.

  3. template<typename ValueType> any(const ValueType & value);

    Effects: + Makes a copy of value, so + that the initial content of the new instance is equivalent + in both type and value to + value.
    Throws: + std::bad_alloc + or any exceptions arising from the copy constructor of the + contained type.

  4. any & operator=(const any & rhs);

    Effects: + Copies content of rhs into + current instance, discarding previous content, so that the + new content is equivalent in both type and value to the + content of rhs, or empty if + rhs.empty().
    Throws: + std::bad_alloc + or any exceptions arising from the copy constructor of the + contained type. Assignment satisfies the strong guarantee + of exception safety.

  5. template<typename ValueType> any & operator=(const ValueType & rhs);

    Effects: + Makes a copy of rhs, + discarding previous content, so that the new content of is + equivalent in both type and value to + rhs.
    Throws: + std::bad_alloc + or any exceptions arising from the copy constructor of the + contained type. Assignment satisfies the strong guarantee + of exception safety.

  6. ~any();

    Effects: + Releases any and all resources used in + management of instance.
    Throws: + Nothing.

any modifiers

  1. any & swap(any & rhs);

    Effects: + Exchange of the contents of + *this and + rhs.
    Returns: + *this
    Throws: + Nothing.

any queries

  1. bool empty() const;

    Returns: + true if instance is + empty, otherwise false.
    Throws: + Will not throw.

  2. const std::type_info & type() const;

    Returns: + the typeid of the + contained value if instance is non-empty, otherwise + typeid(void).
    Notes: + Useful for querying against types known + either at compile time or only at + runtime.

Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/class.boost.bad_any_cast.html b/_docs/doc Boost/html/class.boost.bad_any_cast.html new file mode 100644 index 00000000..d1b80052 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.bad_any_cast.html @@ -0,0 +1,8 @@ + +Class bad_any_cast
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class bad_any_cast

boost::bad_any_cast — The exception thrown in the event of a failed + any_cast of an + any value.

Synopsis

+class bad_any_cast : public std::bad_cast {
+public:
+  const char * what() const;
+};
Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/class.boost.function.html b/_docs/doc Boost/html/class.boost.function.html new file mode 100644 index 00000000..6ee8be15 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.function.html @@ -0,0 +1,109 @@ + +Class template function
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template function

boost::function — A generalized function pointer that can be used for + callbacks or wrapping function objects.

Synopsis

template<typename Signature,   // Function type R (T1, T2, ..., TN)
+         typename Allocator = std::allocator<void> > 
+class function : public functionN<R, T1, T2, ..., TN, Allocator> {
+public:
+  // types
+  typedef R         result_type;         
+  typedef Allocator allocator_type;      
+  typedef T1        argument_type;         // If N == 1
+  typedef T1        first_argument_type;   // If N == 2
+  typedef T2        second_argument_type;  // If N == 2
+  typedef T1        arg1_type;           
+  typedef T2        arg2_type;           
+     .
+     .
+     .
+  typedef TN        argN_type;           
+
+  // static constants
+  static const int arity = N;
+
+  // construct/copy/destruct
+  function();
+  function(const functionN&);
+  function(const function&);
+  template<typename F> function(F);
+  function& operator=(const functionN&);
+  function& operator=(const function&);
+  ~function();
+
+  // modifiers
+  void swap(const function&);
+  void clear();
+
+  // capacity
+  bool empty() const;
+  operator safe_bool() const;
+  bool operator!() const;
+
+  // invocation
+  result_type operator()(arg1_type, arg2_type, ..., argN_type) const;
+};
+
+// specialized algorithms
+template<typename Signature, typename Allocator> 
+  void swap(function<Signature, Allocator>&, function<Signature, Allocator>&);
+
+// undefined operators
+template<typename Signature1, typename Allocator1, typename Signature2, 
+         typename Allocator2> 
+  void operator==(const function<Signature1, Allocator1>&, 
+                  const function<Signature2, Allocator2>&);
+template<typename Signature1, typename Allocator1, typename Signature2, 
+         typename Allocator2> 
+  void operator!=(const function<Signature1, Allocator1>&, 
+                  const function<Signature2, Allocator2>&);

Description

+ Class template function is a thin wrapper + around the numbered class templates function0, function1, etc. It accepts a + function type with N arguments and will will derive from + functionN instantiated with the arguments it receives. + + The semantics of all operations in class template + function are equivalent to that of the underlying + functionN object, although additional member + functions are required to allow proper copy construction and + copy assignment of function objects. +

function construct/copy/destruct

  1. function();

    Postconditions: + this->empty()
    Throws: + Will not throw.

  2. function(const functionN& f);

    Postconditions: + Contains a copy of the f's target, if it has one, or is empty if f.empty().
    Throws: + Will not throw unless copying the target of f throws.

  3. function(const function& f);

    Postconditions: + Contains a copy of the f's target, if it has one, or is empty if f.empty().
    Throws: + Will not throw unless copying the target of f throws.

  4. template<typename F> function(F f);

    Requires: + F is a function object Callable from this.
    Postconditions: + *this targets a copy of f if f is nonempty, or this->empty() if f is empty.
    Throws: + Will not throw when f is a stateless function object.

  5. function& operator=(const functionN& f);

    Postconditions: + *this targets a copy of f's target, if it has one, or is empty if f.empty()
    Throws: + Will not throw when the target of f is a stateless function object or a reference to the function object.

  6. function& operator=(const function& f);

    Postconditions: + *this targets a copy of f's target, if it has one, or is empty if f.empty()
    Throws: + Will not throw when the target of f is a stateless function object or a reference to the function object.

  7. ~function();

    Effects: + If !this->empty(), destroys the target of this.

function modifiers

  1. void swap(const function& f);

    Effects: + Interchanges the targets of *this and f.
    Throws: + Will not throw.

  2. void clear();

    Postconditions: + this->empty()
    Throws: + Will not throw.

function capacity

  1. bool empty() const;

    Returns: + true if this has a target, and false otherwise.
    Throws: + Will not throw.

  2. operator safe_bool() const;

    Returns: + A safe_bool that evaluates false in a boolean context when this->empty(), and true otherwise.
    Throws: + Will not throw.

  3. bool operator!() const;

    Returns: + this->empty()
    Throws: + Will not throw.

function invocation

  1. result_type operator()(arg1_type a1, arg2_type a2, ... , argN_type aN) const;

    Effects: + f(a1, a2, ..., aN), where f is the target of *this.
    Returns: + if R is void, nothing is returned; otherwise, the return value of the call to f is returned.
    Throws: + bad_function_call if !this->empty(). Otherwise, may through any exception thrown by the target function f.

function specialized algorithms

  1. template<typename Signature, typename Allocator> 
    +  void swap(function<Signature, Allocator>& f1, 
    +            function<Signature, Allocator>& f2);

    Effects: + f1.swap(f2)
    Throws: + Will not throw.

function undefined operators

  1. template<typename Signature1, typename Allocator1, typename Signature2, 
    +         typename Allocator2> 
    +  void operator==(const function<Signature1, Allocator1>& f1, 
    +                  const function<Signature2, Allocator2>& f2);

    Notes: + This function must be left undefined.
    Rationale: + The safe_bool conversion opens a loophole whereby two function instances can be compared via ==. This undefined void operator == closes the loophole and ensures a compile-time or link-time error.

  2. template<typename Signature1, typename Allocator1, typename Signature2, 
    +         typename Allocator2> 
    +  void operator!=(const function<Signature1, Allocator1>& f1, 
    +                  const function<Signature2, Allocator2>& f2);

    Notes: + This function must be left undefined.
    Rationale: + The safe_bool conversion opens a loophole whereby two function instances can be compared via !=. This undefined void operator != closes the loophole and ensures a compile-time or link-time error.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.functionN.html b/_docs/doc Boost/html/class.boost.functionN.html new file mode 100644 index 00000000..b8efaa05 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.functionN.html @@ -0,0 +1,99 @@ + +Class template functionN
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template functionN

boost::functionN — A set of generalized function pointers that can be used for callbacks or wrapping function objects.

Synopsis

template<typename R, typename T1, typename T2, ..., typename TN, 
+         typename Allocator = std::allocator<void> > 
+class functionN : public function_base {
+public:
+  // types
+  typedef R         result_type;         
+  typedef Allocator allocator_type;      
+  typedef T1        argument_type;         // If N == 1
+  typedef T1        first_argument_type;   // If N == 2
+  typedef T2        second_argument_type;  // If N == 2
+  typedef T1        arg1_type;           
+  typedef T2        arg2_type;           
+     .
+     .
+     .
+  typedef TN        argN_type;           
+
+  // static constants
+  static const int arity = N;
+
+  // construct/copy/destruct
+  functionN();
+  functionN(const functionN&);
+  template<typename F> functionN(F);
+  functionN& operator=(const functionN&);
+  ~functionN();
+
+  // modifiers
+  void swap(const functionN&);
+  void clear();
+
+  // capacity
+  bool empty() const;
+  operator safe_bool() const;
+  bool operator!() const;
+
+  // invocation
+  result_type operator()(arg1_type, arg2_type, ..., argN_type) const;
+};
+
+// specialized algorithms
+template<typename T1, typename T2, ..., typename TN, typename Allocator> 
+  void swap(functionN<T1, T2, ..., TN, Allocator>&, 
+            functionN<T1, T2, ..., TN, Allocator>&);
+
+// undefined operators
+template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
+         typename U1, typename U2, ..., typename UN, typename Allocator2> 
+  void operator==(const functionN<T1, T2, ..., TN, Allocator1>&, 
+                  const functionN<U1, U2, ..., UN, Allocator2>&);
+template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
+         typename U1, typename U2, ..., typename UN, typename Allocator2> 
+  void operator!=(const functionN<T1, T2, ..., TN, Allocator1>&, 
+                  const functionN<U1, U2, ..., UN, Allocator2>&);

Description

+ Class template functionN is actually a + family of related classes function0, + function1, etc., up to some + implementation-defined maximum. In this context, + N refers to the number of + parameters. +

functionN construct/copy/destruct

  1. functionN();

    Postconditions: + this->empty()
    Throws: + Will not throw.

  2. functionN(const functionN& f);

    Postconditions: + Contains a copy of the f's target, if it has one, or is empty if f.empty().
    Throws: + Will not throw unless copying the target of f throws.

  3. template<typename F> functionN(F f);

    Requires: + F is a function object Callable from this.
    Postconditions: + *this targets a copy of f if f is nonempty, or this->empty() if f is empty.
    Throws: + Will not throw when f is a stateless function object.

  4. functionN& operator=(const functionN& f);

    Postconditions: + *this targets a copy of f's target, if it has one, or is empty if f.empty().
    Throws: + Will not throw when the target of f is a stateless function object or a reference to the function object.

  5. ~functionN();

    Effects: + If !this->empty(), destroys the target of this.

functionN modifiers

  1. void swap(const functionN& f);

    Effects: + Interchanges the targets of *this and f.
    Throws: + Will not throw.

  2. void clear();

    Postconditions: + this->empty()
    Throws: + Will not throw.

functionN capacity

  1. bool empty() const;

    Returns: + true if this has a target, and false otherwise.
    Throws: + Will not throw.

  2. operator safe_bool() const;

    Returns: + A safe_bool that evaluates false in a boolean context when this->empty(), and true otherwise.
    Throws: + Will not throw.

  3. bool operator!() const;

    Returns: + this->empty()
    Throws: + Will not throw.

functionN invocation

  1. result_type operator()(arg1_type a1, arg2_type a2, ... , argN_type aN) const;

    Effects: + f(a1, a2, ..., aN), where f is the target of *this.
    Returns: + if R is void, nothing is returned; otherwise, the return value of the call to f is returned.
    Throws: + bad_function_call if !this->empty(). Otherwise, may through any exception thrown by the target function f.

functionN specialized algorithms

  1. template<typename T1, typename T2, ..., typename TN, typename Allocator> 
    +  void swap(functionN<T1, T2, ..., TN, Allocator>& f1, 
    +            functionN<T1, T2, ..., TN, Allocator>& f2);

    Effects: + f1.swap(f2)
    Throws: + Will not throw.

functionN undefined operators

  1. template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
    +         typename U1, typename U2, ..., typename UN, typename Allocator2> 
    +  void operator==(const functionN<T1, T2, ..., TN, Allocator1>& f1, 
    +                  const functionN<U1, U2, ..., UN, Allocator2>& f2);

    Notes: + This function must be left undefined.
    Rationale: + The safe_bool conversion opens a loophole whereby two function instances can be compared via ==. This undefined void operator == closes the loophole and ensures a compile-time or link-time error.

  2. template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
    +         typename U1, typename U2, ..., typename UN, typename Allocator2> 
    +  void operator!=(const functionN<T1, T2, ..., TN, Allocator1>& f1, 
    +                  const functionN<U1, U2, ..., UN, Allocator2>& f2);

    Notes: + This function must be left undefined.
    Rationale: + The safe_bool conversion opens a loophole whereby two function instances can be compared via !=. This undefined void operator != closes the loophole and ensures a compile-time or link-time error.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.function_base.html b/_docs/doc Boost/html/class.boost.function_base.html new file mode 100644 index 00000000..f18261a8 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.function_base.html @@ -0,0 +1,12 @@ + +Class function_base
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class function_base

boost::function_base — The common base class for all Boost.Function + objects. Objects of type function_base may not be created + directly.

Synopsis

+class function_base {
+public:
+
+  // capacity
+  bool empty() const;
+};

Description

function_base capacity

  1. bool empty() const;

    Returns: + true if this has a target, and false otherwise.
    Throws: + Will not throw.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.last_value.html b/_docs/doc Boost/html/class.boost.last_value.html new file mode 100644 index 00000000..7caae9fd --- /dev/null +++ b/_docs/doc Boost/html/class.boost.last_value.html @@ -0,0 +1,16 @@ + +Class template last_value
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template last_value

boost::last_value — Evaluate an InputIterator sequence and return the + last value in the sequence.

Synopsis

template<typename T> 
+class last_value {
+public:
+  // types
+  typedef T result_type;
+
+  // invocation
+  template<typename InputIterator> 
+    result_type operator()(InputIterator, InputIterator) const;
+};

Description

last_value invocation

  1. template<typename InputIterator> 
    +  result_type operator()(InputIterator first, InputIterator last) const;

    Requires: + first != last
    Effects: + Dereferences every iterator in the sequence [first, last).
    Returns: + The result of dereferencing the iterator last-1.

Specializations

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.signal.html b/_docs/doc Boost/html/class.boost.signal.html new file mode 100644 index 00000000..670f14dc --- /dev/null +++ b/_docs/doc Boost/html/class.boost.signal.html @@ -0,0 +1,21 @@ + +Class template signal
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template signal

boost::signal — Safe multicast callback.

Synopsis

template<typename Signature,   // Function type R (T1, T2, ..., TN)
+         typename Allocator = std::allocator<void>, 
+         typename Combiner = last_value<R>, 
+         typename Group = int, 
+         typename GroupCompare = std::less<Group>, 
+         typename SlotFunction = functionN<Signature> > 
+class signal : public signalN<R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction> {
+public:
+  // construct/copy/destruct
+  signal(const combiner_type& = combiner_type(), 
+         const group_compare_type& = group_compare_type());
+};

Description

Class template signal is a thin + wrapper around the numbered class templates signal0, signal1, etc. It accepts a function + type with N arguments instead of N separate arguments, and + derives from the appropriate signalN + instantiation.

All functionality of this class template is in its base + class signalN.

signal construct/copy/destruct

  1. signal(const combiner_type& combiner = combiner_type(), 
    +       const group_compare_type& compare = group_compare_type());

    Effects: + Initializes the base class with the given combiner + and comparison objects.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.signalN.html b/_docs/doc Boost/html/class.boost.signalN.html new file mode 100644 index 00000000..7dc22150 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.signalN.html @@ -0,0 +1,134 @@ + +Class template signalN
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template signalN

boost::signalN — Set of safe multicast callback types.

Synopsis

template<typename R, typename T1, typename T2, ..., typename TN, 
+         typename Combiner = last_value<R>, typename Group = int, 
+         typename GroupCompare = std::less<Group>, 
+         typename SlotFunction = functionN<R, T1, T2, ..., TN> > 
+class signalN : public signals::trackable, private noncopyable {
+public:
+  // types
+  typedef typename Combiner::result_type result_type;         
+  typedef Combiner                       combiner_type;       
+  typedef Group                          group_type;          
+  typedef GroupCompare                   group_compare_type;  
+  typedef SlotFunction                   slot_function_type;  
+  typedef slot<SlotFunction>             slot_type;           
+  typedef unspecified                    slot_result_type;    
+  typedef unspecified                    slot_call_iterator;  
+  typedef T1                             argument_type;         // If N == 1
+  typedef T1                             first_argument_type;   // If N == 2
+  typedef T2                             second_argument_type;  // If N == 2
+  typedef T1                             arg1_type;           
+  typedef T2                             arg2_type;           
+     .
+     .
+     .
+  typedef TN                             argN_type;           
+
+  // static constants
+  static const int arity = N;
+
+  // construct/copy/destruct
+  signalN(const combiner_type& = combiner_type(), 
+          const group_compare_type& = group_compare_type());
+  ~signalN();
+
+  // connection management
+  signals::connection connect(const slot_type&);
+  signals::connection connect(const group_type&, const slot_type&);
+  void disconnect(const group_type&);
+  void disconnect_all_slots();
+  bool empty() const;
+
+  // invocation
+  result_type operator()(arg1_type, arg2_type, ..., argN_type);
+  result_type operator()(arg1_type, arg2_type, ..., argN_type) const;
+};

Description

+ The class template signalN covers + several related classes signal0, signal1, signal2, etc., + where the number suffix describes the number of function + parameters the signal and its connected slots will + take. Instead of enumerating all classes, a single pattern + signalN will be described, where N + represents the number of function parameters. +

signalN construct/copy/destruct

  1. signalN(const combiner_type& combiner = combiner_type(), 
    +        const group_compare_type& compare = group_compare_type());

    Effects: + Initializes the signal to contain no slots, copies the given combiner into internal storage, and stores the given group comparison function object to compare groups.
    Postconditions: + this->empty()

  2. ~signalN();

    Effects: + Disconnects all slots connected to *this.

signalN connection management

  1. signals::connection connect(const slot_type& slot);
    +signals::connection connect(const group_type& group, const slot_type& slot);

    Effects: + Connects the signal this to the incoming slot. If + the slot is inactive, i.e., any of the trackable objects + bound by the slot call have been destroyed, then the call to + connect is a no-op. If the second version of + connect is invoked, the + slot is associated with the given group.
    Returns: + A + signals::connection + object that references the newly-created connection between + the signal and the slot; if the slot is inactive, returns a + disconnected connection.
    Throws: + This routine meets the strong exception guarantee, + where any exception thrown will cause the slot to not be + connected to the signal.
    Complexity: + O(lg n) where n is the number of + slots known to the signal.
    Notes: + It is unspecified whether connecting a slot while the + signal is calling will result in the slot being called + immediately.

  2. void disconnect(const group_type& group);

    Effects: + Any slots in the given group are disconnected.
    Throws: + Will not throw unless a user destructor throws. If a + user destructor throws, not all slots in this group may be + disconnected.
    Complexity: + O(lg n) + k where n is the number of slots known + to the signal and k is the number of slots in the + group.

  3. void disconnect_all_slots();

    Effects: + Disconnects all slots connected to the signal.
    Postconditions: + this->empty().
    Throws: + If disconnecting a slot causes an exception to be + thrown, not all slots may be disconnected.
    Complexity: + Linear in the number of slots known to the + signal.
    Notes: + May be called at any time within the lifetime of the + signal, including during calls to the signal's slots.

  4. bool empty() const;

    Returns: + true if no slots + are connected to the signal, and + false otherwise.
    Throws: + Will not throw.
    Complexity: + Linear in the number of slots known to the + signal.
    Rationale: + Slots can disconnect at any point in time, + including while those same slots are being invoked. It is + therefore possible that the implementation must search + through a list of disconnected slots to determine if any + slots are still connected.

signalN invocation

  1. result_type operator()(arg1_type a1, arg2_type a2, ... , argN_type aN);
    +result_type operator()(arg1_type a1, arg2_type a2, ... , argN_type aN) const;

    Effects: + Invokes the combiner with a + slot_call_iterator range + [first, last) corresponding to the sequence of calls to the + slots connected to signal + *this. Dereferencing an + iterator in this range causes a slot call with the given set + of parameters (a1, a2, ..., + aN), the result of which is returned from + the iterator dereference operation.
    Returns: + The result returned by the combiner.
    Throws: + If an exception is thrown by a slot call, or if the + combiner does not dereference any slot past some given slot, + all slots after that slot in the internal list of connected + slots will not be invoked.
    Notes: +

    Only the slots associated with iterators that are + actually dereferenced will be invoked. Multiple dereferences + of the same iterator will not result in multiple slot + invocations, because the return value of the slot will be + cached.

    The const version of + the function call operator will invoke the combiner as + const, whereas the + non-const version will + invoke the combiner as + non-const.

    Ordering between members of a given group or between + ungrouped slots is unspecified.

    Calling the function call operator may invoke undefined + behavior if no slots are connected to the signal, depending + on the combiner used. The default combiner is well-defined + for zero slots when the return type is void but is undefined + when the return type is any other type (because there is no + way to synthesize a return value).

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/class.boost.slot.html b/_docs/doc Boost/html/class.boost.slot.html new file mode 100644 index 00000000..6bcdae51 --- /dev/null +++ b/_docs/doc Boost/html/class.boost.slot.html @@ -0,0 +1,17 @@ + +Class template slot
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template slot

boost::slot — Pass slots as function arguments.

Synopsis

template<typename SlotFunction> 
+class slot {
+public:
+  // construct/copy/destruct
+  template<typename Slot> slot(Slot);
+};

Description

slot construct/copy/destruct

  1. template<typename Slot> slot(Slot target);

    Effects: +

    Invokes + visit_each + (unqualified) to discover pointers and references to + signals::trackable + objects in target.

    Initializes this to + contain the incoming slot + target, which may be any + function object with which a + SlotFunction can be + constructed.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.faq.html b/_docs/doc Boost/html/function.faq.html new file mode 100644 index 00000000..f95d42ea --- /dev/null +++ b/_docs/doc Boost/html/function.faq.html @@ -0,0 +1,24 @@ + +Frequently Asked Questions
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Frequently Asked Questions

1. I see void pointers; is this [mess] type safe?
2. Why are there workarounds for void returns? C++ allows them!
3. Why (function) cloning?
1.

I see void pointers; is this [mess] type safe?

Yes, boost::function is type +safe even though it uses void pointers and pointers to functions +returning void and taking no arguments. Essentially, all type +information is encoded in the functions that manage and invoke +function pointers and function objects. Only these functions are +instantiated with the exact type that is pointed to by the void +pointer or pointer to void function. The reason that both are required +is that one may cast between void pointers and object pointers safely +or between different types of function pointers (provided you don't +invoke a function pointer with the wrong type).

2.

Why are there workarounds for void returns? C++ allows them!

Void returns are permitted by the C++ standard, as in this code snippet: +

void f();
+void g() { return f(); }

+

This is a valid usage of boost::function because void returns are not used. With void returns, we would attempting to compile ill-formed code similar to: +

int f();
+void g() { return f(); }

+

In essence, not using void returns allows +boost::function to swallow a return value. This is +consistent with allowing the user to assign and invoke functions and +function objects with parameters that don't exactly match.

3.

Why (function) cloning?

In November and December of 2000, the issue of cloning + vs. reference counting was debated at length and it was decided + that cloning gave more predictable semantics. I won't rehash the + discussion here, but if it cloning is incorrect for a particular + application a reference-counting allocator could be used.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.history.html b/_docs/doc Boost/html/function.history.html new file mode 100644 index 00000000..5ec0055b --- /dev/null +++ b/_docs/doc Boost/html/function.history.html @@ -0,0 +1,52 @@ + +History & Compatibility Notes
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

History & Compatibility Notes

  • Version 1.30.0:

  • Version 1.29.0: + Boost.Function has been partially redesigned to minimize the + interface and make it cleaner. Several seldom- or never-used + features of the older Boost.Function have been deprecated and will + be removed in the near future. Here is a list of features that have + been deprecated, the likely impact of the deprecations, and how to + adjust your code: + +

    • The boost::function class template syntax has + changed. The old syntax, e.g., boost::function<int, float, + double, std::string>, has been changed to a more natural + syntax boost::function<int (float, double, + std::string)>, where all return and argument types are + encoded in a single function type parameter. Any other template + parameters (e.g., the Allocator) follow this single + parameter.

      The resolution to this change depends on the + abilities of your compiler: if your compiler supports template + partial specialization and can parse function types (most do), modify + your code to use the newer + syntax (preferable) or directly use one of the + functionN classes whose syntax has not + changed. If your compiler does not support template partial + specialization or function types, you must take the latter option and + use the numbered Boost.Function classes. This option merely requires + changing types such as boost::function<void, int, int> + to boost::function2<void, int, int> (adding the number of + function arguments to the end of the class name).

      Support for the old syntax with the + boost::function class template will persist for a short + while, but will eventually be removed so that we can provide better + error messages and link compatibility.

    • The invocation + policy template parameter (Policy) has been deprecated + and will be removed. There is no direct equivalent to this rarely + used feature.

    • The mixin template parameter + (Mixin) has been deprecated and will be removed. There + is not direct equivalent to this rarely used feature.

    • The + set methods have been deprecated and will be + removed. Use the assignment operator instead.

    +

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.html b/_docs/doc Boost/html/function.html new file mode 100644 index 00000000..4c73014c --- /dev/null +++ b/_docs/doc Boost/html/function.html @@ -0,0 +1,21 @@ + +Boost.Function
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Boost.Function

Douglas Gregor

Permission to copy, use, sell and distribute this software + is granted provided this copyright notice appears in all copies. + Permission to modify the code and to distribute modified code is + granted provided this copyright notice appears in all copies, and + a notice that the code was modified is included with the copyright + notice.

This software is provided "as is" without express or + implied warranty, and with no claim as to its suitability for any + purpose.

Introduction

The Boost.Function library contains a family of class templates +that are function object wrappers. The notion is similar to a +generalized callback. It shares features with function pointers in +that both define a call interface (e.g., a function taking two integer +arguments and returning a floating-point value) through which some +implementation can be called, and the implementation that is invoked +may change throughout the course of the program.

Generally, any place in which a function pointer would be used +to defer a call or make a callback, Boost.Function can be used instead +to allow the user greater flexibility in the implementation of the +target. Targets can be any 'compatible' function object (or function +pointer), meaning that the arguments to the interface designated by +Boost.Function can be converted to the arguments of the target +function object.

Last revised: February 19, 2003 at 22:46:09 GMT
diff --git a/_docs/doc Boost/html/function.misc.html b/_docs/doc Boost/html/function.misc.html new file mode 100644 index 00000000..4050114e --- /dev/null +++ b/_docs/doc Boost/html/function.misc.html @@ -0,0 +1,13 @@ + +Miscellaneous Notes
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Miscellaneous Notes

Boost.Function vs. Function Pointers

Boost.Function has several advantages over function pointers, namely: + +

  • Boost.Function allows arbitrary compatible function objects to be targets (instead of requiring an exact function signature).

  • Boost.Function may be used with argument-binding and other function object construction libraries.

  • Boost.Function has predictible behavior when an empty function object is called.

And, of course, function pointers have several advantages over Boost.Function: + +

  • Function pointers are smaller (the size of one pointer instead of three)

  • Function pointers are faster (Boost.Function may require two calls through function pointers)

  • Function pointers are backward-compatible with C libraries.

  • More readable error messages.

+

Performance

Function object wrapper size

Function object wrappers will be the size of two function pointers plus one function pointer or data pointer (whichever is larger). On common 32-bit platforms, this amounts to 12 bytes per wrapper. Additionally, the function object target will be allocated on the heap.

Copying efficiency

Copying function object wrappers may require allocating memory for a copy of the function object target. The default allocator may be replaced with a faster custom allocator or one may choose to allow the function object wrappers to only store function object targets by reference (using ref) if the cost of this cloning becomes prohibitive.

Invocation efficiency

With a properly inlining compiler, an invocation of a function object requires one call through a function pointer. If the call is to a free function pointer, an additional call must be made to that function pointer (unless the compiler has very powerful interprocedural analysis).

Combatting virtual function "bloat"

The use of virtual functions tends to cause 'code bloat' on many compilers. When a class contains a virtual function, it is necessary to emit an additional function that classifies the type of the object. It has been our experience that these auxiliary functions increase the size of the executable significantly when many boost::function objects are used.

In Boost.Function, an alternative but equivalent approach was taken using free functions instead of virtual functions. The Boost.Function object essentially holds two pointers to make a valid target call: a void pointer to the function object it contains and a void pointer to an "invoker" that can call the function object, given the function pointer. This invoker function performs the argument and return value conversions Boost.Function provides. A third pointer points to a free function called the "manager", which handles the cloning and destruction of function objects. The scheme is typesafe because the only functions that actually handle the function object, the invoker and the manager, are instantiated given the type of the function object, so they can safely cast the incoming void pointer (the function object pointer) to the appropriate type.

Acknowledgements

Many people were involved in the construction of this + library. William Kempf, Jesse Jones and Karl Nelson were all + extremely helpful in isolating an interface and scope for the + library. John Maddock managed the formal review, and many + reviewers gave excellent comments on interface, implementation, + and documentation. Peter Dimov led us to the function + declarator-based syntax.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.reference.html b/_docs/doc Boost/html/function.reference.html new file mode 100644 index 00000000..2cc87e7a --- /dev/null +++ b/_docs/doc Boost/html/function.reference.html @@ -0,0 +1,75 @@ + +Reference
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Reference

Definitions

+

  • A function object f is + compatible if for the given set of argument + types Arg1, + Arg2, ..., + ArgN and a + return type ResultType, the + appropriate following function is well-formed: +

    +  // if ResultType is not void
    +  ResultType foo(Arg1 arg1, Arg2 arg2, ..., ArgN argN)
    +  {
    +    return f(arg1, arg2, ..., argN);
    +  }
    +
    +  // if ResultType is void
    +  ResultType foo(Arg1 arg1, Arg2 arg2, ..., ArgN argN)
    +  {
    +    f(arg1, arg2, ..., argN);
    +  }
    +

    A special provision is made for pointers to member + functions. Though they are not function objects, Boost.Function + will adapt them internally to function objects. This requires + that a pointer to member function of the form R + (X::*mf)(Arg1, Arg2, ..., ArgN) + cv-quals be adapted to a + function object with the following function call operator + overloads: +

    +  template<typename P>
    +  R operator()(cv-quals P& x, Arg1 arg1, Arg2 arg2, ..., ArgN argN) const
    +  {
    +    return (*x).*mf(arg1, arg2, ..., argN);
    +  }
    +

    +

  • A function object f of + type F is + stateless if it is a function pointer or if + boost::is_stateless<T> + is true. The construction of or copy to a Boost.Function object + from a stateless function object will not cause exceptions to be + thrown and will not allocate any storage. +

+

namespace boost {
+  class bad_function_call;
+  class function_base;
+  template<typename R, typename T1, typename T2, ..., typename TN, 
+           typename Allocator = std::allocator<void> > 
+    class functionN;
+  template<typename T1, typename T2, ..., typename TN, typename Allocator> 
+    void swap(functionN<T1, T2, ..., TN, Allocator>&, 
+              functionN<T1, T2, ..., TN, Allocator>&);
+  template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
+           typename U1, typename U2, ..., typename UN, typename Allocator2> 
+    void operator==(const functionN<T1, T2, ..., TN, Allocator1>&, 
+                    const functionN<U1, U2, ..., UN, Allocator2>&);
+  template<typename T1, typename T2, ..., typename TN, typename Allocator1, 
+           typename U1, typename U2, ..., typename UN, typename Allocator2> 
+    void operator!=(const functionN<T1, T2, ..., TN, Allocator1>&, 
+                    const functionN<U1, U2, ..., UN, Allocator2>&);
+  template<typename Signature, typename Allocator = std::allocator<void> > 
+    class function;
+  template<typename Signature, typename Allocator> 
+    void swap(function<Signature, Allocator>&, 
+              function<Signature, Allocator>&);
+  template<typename Signature1, typename Allocator1, typename Signature2, 
+           typename Allocator2> 
+    void operator==(const function<Signature1, Allocator1>&, 
+                    const function<Signature2, Allocator2>&);
+  template<typename Signature1, typename Allocator1, typename Signature2, 
+           typename Allocator2> 
+    void operator!=(const function<Signature1, Allocator1>&, 
+                    const function<Signature2, Allocator2>&);
+}
Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.testsuite.html b/_docs/doc Boost/html/function.testsuite.html new file mode 100644 index 00000000..0d3aabed --- /dev/null +++ b/_docs/doc Boost/html/function.testsuite.html @@ -0,0 +1,2 @@ + +Testsuite
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Testsuite

Acceptance tests

TestTypeDescriptionIf failing...

function_test.cpp

run

Test the capabilities of the boost::function class template.

The boost::function class template may not be usable on your compiler. However, the library may still be usable via the boost::functionN class templates.

function_n_test.cpp

run

Test the capabilities of the boost::functionN class templates.

 

allocator_test.cpp

run

Test the use of custom allocators.

Allocators are ignored by the implementation.

stateless_test.cpp

run

Test the optimization of stateless function objects in the Boost.Function library.

The exception-safety and performance guarantees given for stateless function objects may not be met by the implementation.

lambda_test.cpp

run

Test the interaction between Boost.Function and Boost.Lambda.

Either Boost.Lambda does not work on the platform, or Boost.Function cannot safely be applied without the use of boost::unlambda.

function_30.cpp

compile

Test the generation of a Boost.Function function object adaptor accepting 30 arguments.

The Boost.Function library may work for function object adaptors of up to 10 parameters, but will be unable to generate adaptors for an arbitrary number of parameters. Failure often indicates an error in the compiler's preprocessor.

function_arith_cxx98.cpp

run

Test the first tutorial example.

 

function_arith_portable.cpp

run

Test the first tutorial example.

 

sum_avg_cxx98.cpp

run

Test the second tutorial example.

 

sum_avg_portable.cpp

run

Test the second tutorial example.

 

mem_fun_cxx98.cpp

run

Test member function example from tutorial.

 

mem_fun_portable.cpp

run

Test member function example from tutorial.

 

std_bind_cxx98.cpp

run

Test standard binders example from tutorial.

 

std_bind_portable.cpp

run

Test standard binders example from tutorial.

 

function_ref_cxx98.cpp

run

Test boost::ref example from tutorial.

 

function_ref_portable.cpp

run

Test boost::ref example from tutorial.

 

Negative tests

TestTypeDescriptionIf failing...

function_test_fail1.cpp

compile-fail

Test the (incorrect!) use of comparisons between Boost.Function function objects.

Intuitive (but incorrect!) code may compile and will give meaningless results.

function_test_fail2.cpp

compile-fail

Test the use of an incompatible function object with Boost.Function

Incorrect code may compile (with potentially unexpected results).

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/function.tutorial.html b/_docs/doc Boost/html/function.tutorial.html new file mode 100644 index 00000000..ff8bcb38 --- /dev/null +++ b/_docs/doc Boost/html/function.tutorial.html @@ -0,0 +1,135 @@ + +Tutorial
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Tutorial

Boost.Function has two syntactical forms: the preferred form +and the portable form. The preferred form fits more closely with the +C++ language and reduces the number of separate template parameters +that need to be considered, often improving readability; however, the +preferred form is not supported on all platforms due to compiler +bugs. The compatible form will work on all compilers supported by +Boost.Function. Consult the table below to determine which syntactic +form to use for your compiler. + +

Preferred syntaxPortable syntax
  • GNU C++ 2.95.x, 3.0.x, 3.1.x
  • Comeau C++ 4.2.45.2
  • SGI MIPSpro 7.3.0
  • Intel C++ 5.0, 6.0
  • Compaq's cxx 6.2
  • Any compiler supporting the preferred syntax
  • Microsoft Visual C++ 6.0, 7.0
  • Borland C++ 5.5.1
  • Sun WorkShop 6 update 2 C++ 5.3
  • Metrowerks CodeWarrior 8.1

+ +

If your compiler does not appear in this list, please try the preferred syntax and report your results to the Boost list so that we can keep this table up-to-date.

Basic Usage

A function wrapper is defined simply +by instantiating the function class +template with the desired return type and argument types, formulated +as a C++ function type. Any number of arguments may be supplied, up to +some implementation-defined limit (10 is the default maximum). The +following declares a function object wrapper +f that takes two +int parameters and returns a +float: + +

Preferred syntaxPortable syntax
boost::function<float (int x, int y)> f;
boost::function2<float, int, int> f;

+

By default, function object wrappers are empty, so we can create a +function object to assign to f: + +

struct int_div { 
+  float operator()(int x, int y) const { return ((float)x)/y; }; 
+};

+

f = int_div();

+

Now we can use f to execute +the underlying function object +int_div: + +

std::cout << f(5, 3) << std::endl;

+

We are free to assign any compatible function object to +f. If +int_div had been declared to take two +long operands, the implicit +conversions would have been applied to the arguments without any user +interference. The only limit on the types of arguments is that they be +CopyConstructible, so we can even use references and arrays: + +

Preferred syntax
boost::function<void (int values[], int n, int& sum, float& avg)> sum_avg;

+

Portable syntax
boost::function4<void, int[], int, int&, float> sum_avg;

+ +

void do_sum_avg(int values[], int n, int& sum, float& avg)
+{
+  sum = 0;
+  for (int i = 0; i < n; i++)
+    sum += values[i];
+  avg = (float)sum / n;
+}

+ + +

sum_avg = &do_sum_avg;

+

Invoking a function object wrapper that does not actually +contain a function object is a precondition violation, much like +trying to call through a null function pointer, and will throw a bad_function_call exception). We can check for an +empty function object wrapper by using it in a boolean context (it evaluates true if the wrapper is not empty) or compare it against 0. For instance: +

if (f)
+  std::cout << f(5, 3) << std::endl;
+else
+  std::cout << "f has no target, so it is unsafe to call" << std::endl;

+

Alternatively, +empty() +method will return whether or not the wrapper is empty.

Finally, we can clear out a function target by assigning it to 0 or by calling the clear() member function, e.g., +

f = 0;

+

Free functions

Free function pointers can be considered singleton function objects with const function call operators, and can therefore be directly used with the function object wrappers: +

float mul_ints(int x, int y) { return ((float)x) * y; }

+

f = &mul_ints;

+

Note that the & isn't really necessary unless you happen to be using Microsoft Visual C++ version 6.

Member functions

In many systems, callbacks often call to member functions of a +particular object. This is often referred to as "argument binding", +and is beyond the scope of Boost.Function. The use of member functions +directly, however, is supported, so the following code is valid: + +

struct X {
+  int foo(int);
+};

+ +

Preferred syntaxPortable syntax
boost::function<int (X*, int)> f;
+
+f = &X::foo;
+  
+X x;
+f(&x, 5);
boost::function2<int, X*, int> f;
+
+f = &X::foo;
+  
+X x;
+f(&x, 5);

+

Several libraries exist that support argument binding. Three such libraries are summarized below: +

  • Bind. This library allows binding of + arguments for any function object. It is lightweight and very + portable.

  • The C++ Standard library. Using + std::bind1st and + std::mem_fun together one can bind + the object of a pointer-to-member function for use with + Boost.Function: + +

    Preferred syntaxPortable syntax
      boost::function<int (int)> f;
    +  X x;
    +  f = std::bind1st(
    +        std::mem_fun(&X::foo), &x);
    +  f(5); // Call x.foo(5)
      boost::function1<int, int> f;
    +  X x;
    +  f = std::bind1st(
    +        std::mem_fun(&X::foo), &x);
    +  f(5); // Call x.foo(5)

    +

  • The Lambda library. This library provides a powerful composition mechanism to construct function objects that uses very natural C++ syntax. Lambda requires a compiler that is reasonably conformant to the C++ standard.

+

References to Functions

In some cases it is + expensive (or semantically incorrect) to have Boost.Function clone a + function object. In such cases, it is possible to request that + Boost.Function keep only a reference to the actual function + object. This is done using the ref + and cref functions to wrap a + reference to a function object: + +

Preferred syntaxPortable syntax
  stateful_type a_function_object;
+  boost::function<int (int)> f;
+  f = boost::ref(a_function_object);
+
+  boost::function<int (int)> f2(f);
  stateful_type a_function_object;
+  boost::function1<int, int> f;
+  f = boost::ref(a_function_object);
+
+  boost::function1<int, int> f2(f);

+

Here, f will not make a copy +of a_function_object, nor will +f2 when it is targeted to +f's reference to +a_function_object. Additionally, when +using references to function objects, Boost.Function will not throw +exceptions during assignment or construction. +

Last revised: February 18, 2003 at 03:32:15 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2695148.html b/_docs/doc Boost/html/id2695148.html new file mode 100644 index 00000000..be768686 --- /dev/null +++ b/_docs/doc Boost/html/id2695148.html @@ -0,0 +1,7 @@ + +Class template is_reference_wrapper
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template is_reference_wrapper

boost::is_reference_wrapper — Determine if a type T is an instantiation of reference_wrapper.

Synopsis

template<typename T> 
+class is_reference_wrapper {
+public:
+  // static constants
+  static const bool value = unspecified;
+};

Description

The value static constant will be true iff the type T is a specialization of reference_wrapper.

Last revised: February 18, 2003 at 14:32:03 GMTCopyright © 1999, 2000 Jaakko Järvi
Copyright © 2001, 2002 Peter Dimov
Copyright © 2002 David Abrahams
diff --git a/_docs/doc Boost/html/id2695230.html b/_docs/doc Boost/html/id2695230.html new file mode 100644 index 00000000..c2f8d96b --- /dev/null +++ b/_docs/doc Boost/html/id2695230.html @@ -0,0 +1,7 @@ + +Class template unwrap_reference
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template unwrap_reference

boost::unwrap_reference — Find the type in a reference_wrapper.

Synopsis

template<typename T> 
+class unwrap_reference {
+public:
+  // types
+  typedef unspecified T;
+};

Description

The typedef type is T::type if T is a reference_wrapper, T otherwise.

Last revised: February 18, 2003 at 14:32:03 GMTCopyright © 1999, 2000 Jaakko Järvi
Copyright © 2001, 2002 Peter Dimov
Copyright © 2002 David Abrahams
diff --git a/_docs/doc Boost/html/id2827840.html b/_docs/doc Boost/html/id2827840.html new file mode 100644 index 00000000..90e768d9 --- /dev/null +++ b/_docs/doc Boost/html/id2827840.html @@ -0,0 +1,21 @@ + +Function any_cast
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Function any_cast

boost::any_cast — Custom keyword cast for extracting a value + of a given type from an + any.

Synopsis

+template<typename ValueType> ValueType any_cast(const any & operand);
+template<typename ValueType> const ValueType * any_cast(const any * operand);
+template<typename ValueType> ValueType * any_cast(any * operand);

Description

Returns: + If passed a pointer, it returns a + similarly qualified pointer to the value content if + successful, otherwise null is returned. If passed a value or + reference, it returns a copy of the value content if + successful.
Throws: + Overloads taking an + any pointer do not + throw; the overload taking an + any value or reference + throws bad_any_cast if + unsuccessful.
Rationale: + The value/reference version returns a + copy because the C++ keyword casts return + copies.

Copyright © 2001 Kevlin Henney
diff --git a/_docs/doc Boost/html/id2830650.html b/_docs/doc Boost/html/id2830650.html new file mode 100644 index 00000000..33ff9052 --- /dev/null +++ b/_docs/doc Boost/html/id2830650.html @@ -0,0 +1,13 @@ + +Class last_value<void>
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class last_value<void>

boost::last_value<void> — Evaluate an InputIterator sequence.

Synopsis

+class last_value<void> {
+public:
+  // types
+  typedef unspecified result_type;
+
+  // invocation
+  template<typename InputIterator> 
+    result_type operator()(InputIterator, InputIterator) const;
+};

Description

last_value invocation

  1. template<typename InputIterator> 
    +  result_type operator()(InputIterator first, InputIterator last) const;

    Effects: + Dereferences every iterator in the sequence [first, last).

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2833212.html b/_docs/doc Boost/html/id2833212.html new file mode 100644 index 00000000..6f94094e --- /dev/null +++ b/_docs/doc Boost/html/id2833212.html @@ -0,0 +1,44 @@ + +Class template reference_wrapper
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class template reference_wrapper

boost::reference_wrapper — + Contains a reference to an object of type + T. +

Synopsis

template<typename T> 
+class reference_wrapper {
+public:
+  // types
+  typedef T type;
+
+  // construct/copy/destruct
+  reference_wrapper(T&);
+
+  // access
+  operator T&() const;
+  T& get() const;
+  T* get_pointer() const;
+};
+
+// constructors
+reference_wrapper<T> ref(T&);
+reference_wrapper<T const> cref(T const&);

Description

+ reference_wrapper + is primarily used to "feed" references to function templates + (algorithms) that take their parameter by value. It provides + an implicit conversion to + T&, which usually allows + the function templates to work on references unmodified. +

reference_wrapper construct/copy/destruct

  1. reference_wrapper(T& t);

    Effects: + Constructs a + reference_wrapper + object that stores a reference to + t.
    Throws: + Does not throw.

reference_wrapper access

  1. operator T&() const;

    Returns: + The stored reference.
    Throws: + Does not throw.

  2. T& get() const;

    Returns: + The stored reference.
    Throws: + Does not throw.

  3. T* get_pointer() const;

    Returns: + A pointer to the object referenced by the stored reference.
    Throws: + Does not throw.

reference_wrapper constructors

  1. reference_wrapper<T> ref(T& t);

    Returns: + reference_wrapper<T>(t)
    Throws: + Does not throw.

  2. reference_wrapper<T const> cref(T const& t);

    Returns: + reference_wrapper<T const>(t)
    Throws: + Does not throw.

Last revised: February 18, 2003 at 14:32:03 GMTCopyright © 1999, 2000 Jaakko Järvi
Copyright © 2001, 2002 Peter Dimov
Copyright © 2002 David Abrahams
diff --git a/_docs/doc Boost/html/id2837192.html b/_docs/doc Boost/html/id2837192.html new file mode 100644 index 00000000..7e01acc7 --- /dev/null +++ b/_docs/doc Boost/html/id2837192.html @@ -0,0 +1,8 @@ + +Class bad_function_call
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class bad_function_call

boost::bad_function_call — An exception type thrown when an instance of a function object is empty when invoked.

Synopsis

+class bad_function_call : public std::runtime_error {
+public:
+  // construct/copy/destruct
+  bad_function_call();
+};

Description

bad_function_call construct/copy/destruct

  1. bad_function_call();

    Effects: + Constructs a bad_function_call exception object.

Last revised: February 19, 2003 at 22:46:09 GMTCopyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2852290.html b/_docs/doc Boost/html/id2852290.html new file mode 100644 index 00000000..c3b219b2 --- /dev/null +++ b/_docs/doc Boost/html/id2852290.html @@ -0,0 +1,37 @@ + +Class trackable
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class trackable

boost::signals::trackable — Enables safe use of multicast callbacks.

Synopsis

+class trackable {
+public:
+  // construct/copy/destruct
+  trackable();
+  trackable(const trackable&);
+  trackable& operator=(const trackable&);
+  ~trackable();
+};

Description

The trackable class + provides automatic disconnection of signals and slots when + objects bound in slots (via pointer or reference) are + destroyed. The trackable + class may only be used as a public base class for some other + class; when used as such, that class may be bound to function + objects used as part of slots. The manner in which a + trackable object tracks the + set of signal-slot connections it is a part of is + unspecified.

The actual use of + trackable is contingent on + the presence of appropriate + visit_each overloads for any type + that may contain pointers or references to trackable + objects.

trackable construct/copy/destruct

  1. trackable();

    Effects: + Sets the list of connected slots to empty.
    Throws: + Will not throw.

  2. trackable(const trackable& other);

    Effects: + Sets the list of connected slots to empty.
    Throws: + Will not throw.
    Rationale: + Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.

  3. trackable& operator=(const trackable& other);

    Effects: + Sets the list of connected slots to empty.
    Returns: + *this
    Throws: + Will not throw.
    Rationale: + Signal-slot connections can only be created via calls to an explicit connect method, and therefore cannot be created here when trackable objects are copied.

  4. ~trackable();

    Effects: + Disconnects all signal/slot connections that + contain a pointer or reference to this trackable object that + can be found by + visit_each.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2877648.html b/_docs/doc Boost/html/id2877648.html new file mode 100644 index 00000000..d9f2ba96 --- /dev/null +++ b/_docs/doc Boost/html/id2877648.html @@ -0,0 +1,29 @@ + +Class scoped_connection
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class scoped_connection

boost::signals::scoped_connection — Limits a signal-slot connection lifetime to a particular scope.

Synopsis

+class scoped_connection : private noncopyable {
+public:
+  // construct/copy/destruct
+  scoped_connection(const connection&);
+  ~scoped_connection();
+
+  // connection management
+  void disconnect() const;
+  bool connected() const;
+};

Description

scoped_connection construct/copy/destruct

  1. scoped_connection(const connection& other);

    Effects: + this references + the connection referenced by + other.
    Throws: + Will not throw.

  2. ~scoped_connection();

    Effects: + If + this->connected(), + disconnects the signal-slot connection.

scoped_connection connection management

  1. void disconnect() const;

    Effects: + If + this->connected(), + disconnects the signal and slot referenced by this; + otherwise, this operation is a no-op.
    Postconditions: + !this->connected().

  2. bool connected() const;

    Returns: + true if this + references a non-NULL connection that is still active + (connected), and false + otherwise.
    Throws: + Will not throw.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2890015.html b/_docs/doc Boost/html/id2890015.html new file mode 100644 index 00000000..4291126d --- /dev/null +++ b/_docs/doc Boost/html/id2890015.html @@ -0,0 +1,74 @@ + +Class connection
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Class connection

boost::signals::connection — Query/disconnect a signal-slot connection.

Description

+ The connection class represents a + connection between a Signal and a Slot. It is a lightweight + object that has the ability to query whether the signal and + slot are currently connected, and to disconnect the signal + and slot. It is always safe to query or disconnect a + connection. +

connection construct/copy/destruct

  1. connection();

    Effects: + Sets the currently represented connection to the + NULL connection.
    Postconditions: + !this->connected().
    Throws: + Will not throw.

  2. connection(const connection& other);

    Effects: + this references + the connection referenced by + other.
    Throws: + Will not throw.

  3. connection& operator=(const connection& other);

    Effects: + this references + the connection referenced by + other.
    Throws: + Will not throw.

connection connection management

  1. void disconnect() const;

    Effects: + If + this->connected(), + disconnects the signal and slot referenced by this; + otherwise, this operation is a no-op.
    Postconditions: + !this->connected().

  2. bool connected() const;

    Returns: + true if this + references a non-NULL connection that is still active + (connected), and false + otherwise.
    Throws: + Will not throw.

connection modifiers

  1. void swap(const connection& other);

    Effects: + Swaps the connections referenced in + this and + other.
    Throws: + Will not throw.

connection comparisons

  1. bool operator==(const connection& other) const;

    Returns: + true if + this and + other reference the same + connection or both reference the NULL connection, and + false + otherwise.
    Throws: + Will not throw.

  2. bool operator<(const connection& other) const;

    Returns: + true if the + connection referenced by + this precedes the + connection referenced by + other based on some + unspecified ordering, and + false + otherwise.
    Throws: + Will not throw.

connection specialized algorithms

  1. void swap(connection& x, connection& y);

    Effects: + x.swap(y)
    Throws: + Will not throw.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/id2905241.html b/_docs/doc Boost/html/id2905241.html new file mode 100644 index 00000000..29f2454a --- /dev/null +++ b/_docs/doc Boost/html/id2905241.html @@ -0,0 +1,26 @@ + +Function template visit_each
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Function template visit_each

boost::visit_each — Allow limited exploration of class members.

Synopsis

+template<typename Visitor, typename T> 
+  void visit_each(const Visitor& visitor, const T& t, int );

Description

The visit_each mechanism + allows a visitor to be applied to every subobject in a given + object. It is used by the Signals library to discover + signals::trackable objects within a + function object, but other uses may surface if used universally + (e.g., conservative garbage collection). To fit within the + visit_each framework, a + visit_each overload must be supplied for + each object type.

Effects: + visitor(t), and for + every subobject x of + t: +

  • If x is a reference, visit_each(visitor, ref(x), 0)

  • Otherwise, visit_each(visitor, x, 0)

+
Notes: +

The third parameter is + long for the fallback version + of visit_each and the argument + supplied to this third paramter must always be 0. The third + parameter is an artifact of the widespread lack of proper + function template ordering, and will be removed in the future.

Library authors will be expected to add additional + overloads that specialize the T argument for their classes, so + that subobjects can be visited.

Calls to visit_each are required to be unqualified, to + enable argument-dependent lookup.

Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc Boost/html/images/blank.png b/_docs/doc Boost/html/images/blank.png new file mode 100644 index 00000000..764bf4f0 Binary files /dev/null and b/_docs/doc Boost/html/images/blank.png differ diff --git a/_docs/doc Boost/html/images/caution.png b/_docs/doc Boost/html/images/caution.png new file mode 100644 index 00000000..5b7809ca Binary files /dev/null and b/_docs/doc Boost/html/images/caution.png differ diff --git a/_docs/doc Boost/html/images/draft.png b/_docs/doc Boost/html/images/draft.png new file mode 100644 index 00000000..0084708c Binary files /dev/null and b/_docs/doc Boost/html/images/draft.png differ diff --git a/_docs/doc Boost/html/images/home.png b/_docs/doc Boost/html/images/home.png new file mode 100644 index 00000000..cbb711de Binary files /dev/null and b/_docs/doc Boost/html/images/home.png differ diff --git a/_docs/doc Boost/html/images/important.png b/_docs/doc Boost/html/images/important.png new file mode 100644 index 00000000..12c90f60 Binary files /dev/null and b/_docs/doc Boost/html/images/important.png differ diff --git a/_docs/doc Boost/html/images/next.png b/_docs/doc Boost/html/images/next.png new file mode 100644 index 00000000..45835bf8 Binary files /dev/null and b/_docs/doc Boost/html/images/next.png differ diff --git a/_docs/doc Boost/html/images/note.png b/_docs/doc Boost/html/images/note.png new file mode 100644 index 00000000..d0c3c645 Binary files /dev/null and b/_docs/doc Boost/html/images/note.png differ diff --git a/_docs/doc Boost/html/images/prev.png b/_docs/doc Boost/html/images/prev.png new file mode 100644 index 00000000..cf24654f Binary files /dev/null and b/_docs/doc Boost/html/images/prev.png differ diff --git a/_docs/doc Boost/html/images/tip.png b/_docs/doc Boost/html/images/tip.png new file mode 100644 index 00000000..5c4aab3b Binary files /dev/null and b/_docs/doc Boost/html/images/tip.png differ diff --git a/_docs/doc Boost/html/images/toc-blank.png b/_docs/doc Boost/html/images/toc-blank.png new file mode 100644 index 00000000..6ffad17a Binary files /dev/null and b/_docs/doc Boost/html/images/toc-blank.png differ diff --git a/_docs/doc Boost/html/images/toc-minus.png b/_docs/doc Boost/html/images/toc-minus.png new file mode 100644 index 00000000..abbb020c Binary files /dev/null and b/_docs/doc Boost/html/images/toc-minus.png differ diff --git a/_docs/doc Boost/html/images/toc-plus.png b/_docs/doc Boost/html/images/toc-plus.png new file mode 100644 index 00000000..941312ce Binary files /dev/null and b/_docs/doc Boost/html/images/toc-plus.png differ diff --git a/_docs/doc Boost/html/images/up.png b/_docs/doc Boost/html/images/up.png new file mode 100644 index 00000000..07634de2 Binary files /dev/null and b/_docs/doc Boost/html/images/up.png differ diff --git a/_docs/doc Boost/html/images/warning.png b/_docs/doc Boost/html/images/warning.png new file mode 100644 index 00000000..1c33db8f Binary files /dev/null and b/_docs/doc Boost/html/images/warning.png differ diff --git a/_docs/doc Boost/html/index.html b/_docs/doc Boost/html/index.html new file mode 100644 index 00000000..6d948233 --- /dev/null +++ b/_docs/doc Boost/html/index.html @@ -0,0 +1,2 @@ + +The Boost C++ Libraries
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

The Boost C++ Libraries


Table of Contents

Boost.Any
Introduction
Examples
Reference
ValueType requirements
Header <boost/any.hpp>
Acknowledgements
Boost.Function
Introduction
History & Compatibility Notes
Tutorial
Basic Usage
Free functions
Member functions
References to Functions
Reference
Definitions
Header <boost/function.hpp>
Frequently Asked Questions
Miscellaneous Notes
Boost.Function vs. Function Pointers
Performance
Function object wrapper size
Copying efficiency
Invocation efficiency
Combatting virtual function "bloat"
Acknowledgements
Testsuite
Acceptance tests
Negative tests
Boost.Ref
Introduction
Reference
Header <boost/ref.hpp>
Acknowledgements
Boost.Signals
Introduction
Tutorial
How to Read this Tutorial
Compatibility Note
Hello, World! (Beginner)
Calling multiple slots
Connecting multiple slots (Beginner)
Ordering slot call groups (Intermediate)
Passing values to and from slots
Slot Arguments (Beginner)
Signal Return Values (Advanced)
Connection Management
Disconnecting Slots (Beginner)
Scoped connections (Intermediate)
Automatic connection management (Intermediate)
When can disconnections occur? (Intermediate)
Passing slots (Intermediate)
Reference
Header <boost/signal.hpp>
Header <boost/signals/slot.hpp>
Header <boost/signals/trackable.hpp>
Header <boost/signals/connection.hpp>
Header <boost/visit_each.hpp>
Header <boost/last_value.hpp>
Frequently Asked Questions
Design Overview
Type Erasure
connection class
Slot Call Iterator
visit_each function template
Design Rationale
Choice of Slot Definitions
User-level Connection Management
Combiner Interface
Connection Interfaces: += operator
trackable rationale
trackable copying behavior
Why derivation from trackable?
Comparison with other Signal/Slot implementations
libsigc++
.NET delegates
Testsuite
Acceptance tests
diff --git a/_docs/doc Boost/html/ref.ack.html b/_docs/doc Boost/html/ref.ack.html new file mode 100644 index 00000000..0f5bee8c --- /dev/null +++ b/_docs/doc Boost/html/ref.ack.html @@ -0,0 +1,8 @@ + +Acknowledgements
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Acknowledgements

ref and cref + were originally part of the Tuple library + by Jaakko Järvi. They were "promoted to boost:: status" by + Peter Dimov because they are generally useful. Douglas Gregor and + Dave Abrahams contributed + is_reference_wrapper and + unwrap_reference.

Last revised: February 18, 2003 at 14:32:03 GMTCopyright © 1999, 2000 Jaakko Järvi
Copyright © 2001, 2002 Peter Dimov
Copyright © 2002 David Abrahams
diff --git a/_docs/doc Boost/html/ref.html b/_docs/doc Boost/html/ref.html new file mode 100644 index 00000000..a08973a3 --- /dev/null +++ b/_docs/doc Boost/html/ref.html @@ -0,0 +1,37 @@ + +Boost.Ref
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Boost.Ref

Jaakko Järvi

Peter Dimov

Douglas Gregor

Dave Abrahams

Permission to copy, use, modify, sell and distribute this + software is granted provided this copyright notice appears in + all copies. This software is provided "as is" without express + or implied warranty, and with no claim as to its suitability for + any purpose. +

Introduction

The Ref library is a small library that is useful for passing + references to function templates (algorithms) that would usually + take copies of their arguments. It defines the class template + boost::reference_wrapper<T>, + the two functions + boost::ref and + boost::cref that return + instances of boost::reference_wrapper<T>, and the + two traits classes + boost::is_reference_wrapper<T> + and + boost::unwrap_reference<T>.

The purpose of + boost::reference_wrapper<T> is to + contain a reference to an object of type T. It is primarily used to + "feed" references to function templates (algorithms) that take their + parameter by value.

To support this usage, + boost::reference_wrapper<T> provides an implicit + conversion to T&. This usually allows the function + templates to work on references unmodified.

boost::reference_wrapper<T> is + both CopyConstructible and Assignable (ordinary references are not + Assignable).

The expression boost::ref(x) + returns a + boost::reference_wrapper<X>(x) where X + is the type of x. Similarly, + boost::cref(x) returns a + boost::reference_wrapper<X const>(x).

The expression + boost::is_reference_wrapper<T>::value + is true if T is a reference_wrapper, and + false otherwise.

The type-expression + boost::unwrap_reference<T>::type is T::type if T + is a reference_wrapper, T otherwise.

Last revised: February 18, 2003 at 14:32:03 GMT
diff --git a/_docs/doc Boost/html/ref.reference.html b/_docs/doc Boost/html/ref.reference.html new file mode 100644 index 00000000..ecdf6f3a --- /dev/null +++ b/_docs/doc Boost/html/ref.reference.html @@ -0,0 +1,8 @@ + +Reference
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore
Last revised: February 18, 2003 at 14:32:03 GMTCopyright © 1999, 2000 Jaakko Järvi
Copyright © 2001, 2002 Peter Dimov
Copyright © 2002 David Abrahams
diff --git a/_docs/doc Boost/html/reference.css b/_docs/doc Boost/html/reference.css new file mode 100644 index 00000000..be4e64cc --- /dev/null +++ b/_docs/doc Boost/html/reference.css @@ -0,0 +1,5 @@ +PRE.synopsis { + background-color: #e0ffff; + border: thin solid blue; + padding: 1em +} diff --git a/_docs/doc Boost/html/signals.html b/_docs/doc Boost/html/signals.html new file mode 100644 index 00000000..41b6e9f6 --- /dev/null +++ b/_docs/doc Boost/html/signals.html @@ -0,0 +1,24 @@ + +Boost.Signals
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Boost.Signals

Douglas Gregor

Permission to copy, use, sell and distribute this software + is granted provided this copyright notice appears in all copies. + Permission to modify the code and to distribute modified code is + granted provided this copyright notice appears in all copies, and + a notice that the code was modified is included with the copyright + notice.

This software is provided "as is" without express or + implied warranty, and with no claim as to its suitability for any + purpose.

Introduction

The Boost.Signals library is an implementation of a managed +signals and slots system. Signals represent callbacks with multiple +targets, and are also called publishers or events in similar +systems. Signals are connected to some set of slots, which are +callback receivers (also called event targets or subscribers), which +are called when the signal is "emitted."

Signals and slots are managed, in that signals and slots (or, +more properly, objects that occur as part of the slots) track all +connections and are capable of automatically disconnecting signal/slot +connections when either is destroyed. This enables the user to make +signal/slot connections without expending a great effort to manage the +lifetimes of those connections with regard to the lifetimes of all +objects involved.

When signals are connected to multiple slots, there is a +question regarding the relationship between the return values of the +slots and the return value of the signals. Boost.Signals allows the +user to specify the manner in which multiple return values are +combined.

diff --git a/_docs/doc Boost/html/signals.reference.html b/_docs/doc Boost/html/signals.reference.html new file mode 100644 index 00000000..35649bc3 --- /dev/null +++ b/_docs/doc Boost/html/signals.reference.html @@ -0,0 +1,32 @@ + +Reference
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Reference

namespace boost {
+  template<typename R, typename T1, typename T2, ..., typename TN, 
+           typename Combiner = last_value<R>, typename Group = int, 
+           typename GroupCompare = std::less<Group>, 
+           typename SlotFunction = functionN<R, T1, T2, ..., TN> > 
+    class signalN;
+  template<typename Signature, typename Allocator = std::allocator<void>, 
+           typename Combiner = last_value<R>, typename Group = int, 
+           typename GroupCompare = std::less<Group>, 
+           typename SlotFunction = functionN<Signature> > 
+    class signal;
+}
namespace boost {
+  namespace signals {
+    class trackable;
+  }
+}
namespace boost {
+  namespace signals {
+    class connection;
+    void swap(connection&, connection&);
+    class scoped_connection;
+  }
+}
namespace boost {
+  template<typename Visitor, typename T> 
+    void visit_each(const Visitor&, const T&, int);
+}
Copyright © 2001-2003 Douglas Gregor
diff --git a/_docs/doc LuaBind/CVS/Entries b/_docs/doc LuaBind/CVS/Entries new file mode 100644 index 00000000..32ceaee1 --- /dev/null +++ b/_docs/doc LuaBind/CVS/Entries @@ -0,0 +1,17 @@ +/index.html/1.3.2.1/Tue May 4 11:43:08 2004//Tbeta7-devel +/luabind-logo-label.ps/1.1.1.1/Tue Apr 15 22:25:05 2003//Tbeta7-devel +/luabind.png/1.1/Tue Jun 17 05:09:35 2003/-kb/Tbeta7-devel +/adopt.rst/1.1.2.1/Fri May 14 08:06:03 2004//Tbeta7-devel +/copy.rst/1.1.2.1/Fri May 14 08:06:03 2004//Tbeta7-devel +/dependency.rst/1.1.2.2/Fri May 14 08:55:23 2004//Tbeta7-devel +/discard_result.rst/1.1.2.1/Fri May 14 08:06:03 2004//Tbeta7-devel +/out_value.rst/1.1.2.2/Fri Jul 9 09:30:00 2004//Tbeta7-devel +/pure_out_value.rst/1.1.2.2/Fri Jul 9 09:30:00 2004//Tbeta7-devel +/return_reference_to.rst/1.1.2.1/Fri May 14 08:06:03 2004//Tbeta7-devel +/return_stl_iterator.rst/1.1.2.1/Fri May 14 08:06:04 2004//Tbeta7-devel +/style.css/1.4.2.3/Thu Jul 15 09:48:38 2004//Tbeta7-devel +/yield.rst/1.1.2.1/Fri May 14 08:06:04 2004//Tbeta7-devel +/docs.html/1.47.2.16/Mon Aug 16 11:47:02 2004//Tbeta7-devel +/docs.rst/1.19.2.22/Mon Aug 16 11:47:02 2004//Tbeta7-devel +/raw.rst/1.1.2.1/Thu Jul 29 10:37:44 2004//Tbeta7-devel +D diff --git a/_docs/doc LuaBind/CVS/Repository b/_docs/doc LuaBind/CVS/Repository new file mode 100644 index 00000000..45c52f0c --- /dev/null +++ b/_docs/doc LuaBind/CVS/Repository @@ -0,0 +1 @@ +luabind/luabind/doc diff --git a/_docs/doc LuaBind/CVS/Root b/_docs/doc LuaBind/CVS/Root new file mode 100644 index 00000000..27d4f51f --- /dev/null +++ b/_docs/doc LuaBind/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@cvs.sourceforge.net:/cvsroot/luabind diff --git a/_docs/doc LuaBind/CVS/Tag b/_docs/doc LuaBind/CVS/Tag new file mode 100644 index 00000000..2d118389 --- /dev/null +++ b/_docs/doc LuaBind/CVS/Tag @@ -0,0 +1 @@ +Tbeta7-devel diff --git a/_docs/doc LuaBind/adopt.rst b/_docs/doc LuaBind/adopt.rst new file mode 100644 index 00000000..a093642f --- /dev/null +++ b/_docs/doc LuaBind/adopt.rst @@ -0,0 +1,48 @@ +adopt +---------------- + +Motivation +~~~~~~~~~~ + +Used to transfer ownership across language boundaries. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + adopt(index) + +Parameters +~~~~~~~~~~ + +============= =============================================================== +Parameter Purpose +============= =============================================================== +``index`` The index which should transfer ownership, ``_N`` or ``result`` +============= =============================================================== + +Example +~~~~~~~ + +.. parsed-literal:: + + X* create() + { + return new X; + } + + ... + + module(L) + [ + def("create", &create, **adopt(result)**) + ]; + diff --git a/_docs/doc LuaBind/copy.rst b/_docs/doc LuaBind/copy.rst new file mode 100644 index 00000000..8aa882fe --- /dev/null +++ b/_docs/doc LuaBind/copy.rst @@ -0,0 +1,53 @@ +copy +---------------- + +Motivation +~~~~~~~~~~ + +This will make a copy of the parameter. This is the default behavior when +passing parameters by-value. Note that this can only be used when passing from +C++ to Lua. This policy requires that the parameter type has an accessible copy +constructor. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + copy(index) + +Parameters +~~~~~~~~~~ + +============= =============================================================== +Parameter Purpose +============= =============================================================== +``index`` The index to copy. ``result`` when used while wrapping C++ + functions. ``_N`` when passing arguments to Lua. +============= =============================================================== + +Example +~~~~~~~ + +.. parsed-literal:: + + X* get() + { + static X instance; + return &instance; + } + + ... + + module(L) + [ + def("create", &create, **copy(result)**) + ]; + diff --git a/_docs/doc LuaBind/dependency.rst b/_docs/doc LuaBind/dependency.rst new file mode 100644 index 00000000..f28aef0e --- /dev/null +++ b/_docs/doc LuaBind/dependency.rst @@ -0,0 +1,50 @@ +dependency +---------------- + +Motivation +~~~~~~~~~~ + +The dependency policy is used to create life-time dependencies between values. +This is needed for example when returning internal references to some class. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + dependency(nurse_index, patient_index) + +Parameters +~~~~~~~~~~ + +================= ========================================================== +Parameter Purpose +================= ========================================================== +``nurse_index`` The index which will keep the patient alive. +``patient_index`` The index which will be kept alive. +================= ========================================================== + +Example +~~~~~~~ + +.. parsed-literal:: + + struct X + { + B member; + B& get() { return member; } + }; + + module(L) + [ + class_("X") + .def("get", &X::get, **dependency(result, _1)**) + ]; + diff --git a/_docs/doc LuaBind/discard_result.rst b/_docs/doc LuaBind/discard_result.rst new file mode 100644 index 00000000..d148d205 --- /dev/null +++ b/_docs/doc LuaBind/discard_result.rst @@ -0,0 +1,46 @@ +discard_result +---------------- + +Motivation +~~~~~~~~~~ + +This is a very simple policy which makes it possible to throw away +the value returned by a C++ function, instead of converting it to +Lua. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + discard_result + +Example +~~~~~~~ + +.. parsed-literal:: + + struct X + { + X& set(T n) + { + ... + return \*this; + } + }; + + ... + + module(L) + [ + class_("X") + .def("set", &simple::set, **discard_result**) + ]; + diff --git a/_docs/doc LuaBind/docs.html b/_docs/doc LuaBind/docs.html new file mode 100644 index 00000000..1977cc80 --- /dev/null +++ b/_docs/doc LuaBind/docs.html @@ -0,0 +1,2891 @@ + + + + + + +luabind + + + + + + +
+

luabind

+ +++ + + + + + + + + + + + +
Author:Daniel Wallin, Arvid Norberg
Copyright:Copyright Daniel Wallin, Arvid Norberg 2003.
Date:2004-07-29
Revision:1.19.2.21
License:

Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:

+

The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE.

+
+

Note: This library is currently in public beta phase. This documentation +should be considered beta as well. Please report any grammatical +corrections/spelling corrections.

+ +
+

1   Introduction

+

Luabind is a library that helps you create bindings between C++ and Lua. It has +the ability to expose functions and classes, written in C++, to Lua. It will +also supply the functionality to define classes in Lua and let them derive from +other Lua classes or C++ classes. Lua classes can override virtual functions +from their C++ base classes. It is written towards Lua 5.0, and does not work +with Lua 4.

+

It is implemented utilizing template meta programming. That means that you +don't need an extra preprocess pass to compile your project (it is done by the +compiler). It also means you don't (usually) have to know the exact signatureof +each function you register, since the library will generate code depending on +the compile-time type of the function (which includes the signature). The main +drawback of this approach is that the compilation time will increase for the +file that does the registration, it is therefore recommended that you register +everything in the same cpp-file.

+

luabind is released under the terms of the MIT license.

+

We are very interested in hearing about projects that use luabind, please let +us know about your project.

+
+
+

2   Features

+

Luabind supports:

+
+
    +
  • Overloaded free functions
  • +
  • C++ classes in Lua
  • +
  • Overloaded member functions
  • +
  • Operators
  • +
  • Properties
  • +
  • Enums
  • +
  • Lua functions in C++
  • +
  • Lua classes in C++
  • +
  • Lua classes (single inheritance)
  • +
  • Derives from Lua or C++ classes
  • +
  • Override virtual functions from C++ classes
  • +
  • Implicit casts between registered types
  • +
  • Best match signature matching
  • +
  • Return value policies and parameter policies
  • +
+
+
+
+

3   Portability

+

Luabind has been tested to work on the following compilers:

+
+
    +
  • Visual Studio 7.1
  • +
  • Visual Studio 7.0
  • +
  • Visual Studio 6.0 (sp 5)
  • +
  • Intel C++ 6.0 (Windows)
  • +
  • GCC 2.95.3 (cygwin)
  • +
  • GCC 3.0.4 (Debian/Linux)
  • +
  • GCC 3.1 (SunOS 5.8)
  • +
  • GCC 3.2 (cygwin)
  • +
  • GCC 3.3.1 (cygwin)
  • +
+
+

It has been confirmed not to work with:

+
+
    +
  • GCC 2.95.2 (SunOS 5.8)
  • +
+
+

Metrowerks 8.3 (Windows) compiles but fails the const-test. This +means that const member functions are treated as non-const member +functions.

+

If you have tried luabind with a compiler not listed here, let us know +your result with it.

+
+
+

4   Building luabind

+

To keep down the compilation-time luabind is built as a library. This means you +have to either build it and lika against it, or include its source files in +your project. You also have to make sure the luabind directory is somewhere in +your compiler's include path. It requires Boost 1.31.0 to be installed (only +boost headers). It also requires that Lua is installed.

+

The official way of building luabind is with Boost.Build V2. To properly build +luabind with Boost.Build you need to set two environment variables:

+
+
BOOST_ROOT
+
Point this to your Boost installation.
+
LUA_PATH
+
Point this to your Lua directory. The build system will assume that the +include and library files are located in $(LUA_PATH)/include/ and +$(LUA_PATH)/lib/.
+
+

For backward compatibility, there is also a makefile in the root-directory that +will build the library and the test program. If you are using a UNIX-system (or +cygwin) they will make it easy to build luabind as a static library. If you are +using Visual Studio it may be easier to include the files in the src directory +in your project.

+

When building luabind you have several options that may streamline the library +to better suit your needs. It is extremely important that your application has +the same settings as the library was built with. The available options are +found in the Configuration section.

+

If you want to change the settings to differ from the default, it's recommended +that you define the settings on the commandline of all your files (in the +project settings in visual studio).

+
+
+

5   Basic usage

+

To use luabind, you must include lua.h and luabind's main header file:

+
+extern "C"
+{
+    #include "lua.h"
+}
+
+#include <luabind/luabind.hpp>
+
+

This includes support for both registering classes and functions. If you just +want to have support for functions or classes you can include +luabind/function.hpp and luabind/class.hpp separately:

+
+#include <luabind/function.hpp>
+#include <luabind/class.hpp>
+
+

The first thing you need to do is to call luabind::open(lua_State*) which +will register the functions to create classes from Lua, and initialize some +state-global structures used by luabind. If you don't call this function you +will hit asserts later in the library. There is no corresponding close function +because once a class has been registered in Lua, there really isn't any good +way to remove it. Partly because any remaining instances of that class relies +on the class being there. Everything will be cleaned up when the state is +closed though.

+ +

Luabind's headers will never include lua.h directly, but through +<luabind/lua_include.hpp>. If you for some reason need to include another +Lua header, you can modify this file.

+
+

5.1   Hello world

+
+#include <iostream>
+#include <luabind/luabind.hpp>
+
+void greet()
+{
+    std::cout << "hello world!\n";
+}
+
+extern "C" int init(lua_State* L)
+{
+    using namespace luabind;
+
+    open(L);
+
+    module(L)
+    [
+        def("greet", &greet)
+    ];
+
+    return 0;
+}
+
+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> loadlib('hello_world.dll', 'init')()
+> greet()
+Hello world!
+>
+
+
+
+
+

6   Scopes

+

Everything that gets registered in Lua is registered in a namespace (Lua +tables) or in the global scope (called module). All registrations must be +surrounded by its scope. To define a module, the luabind::module class is +used. It is used like this:

+
+module(L)
+[
+    // declarations
+];
+
+

This will register all declared functions or classes in the global namespace in +Lua. If you want to have a namespace for your module (like the standard +libraries) you can give a name to the constructor, like this:

+
+module(L, "my_library")
+[
+    // declarations
+];
+
+

Here all declarations will be put in the my_library table.

+

If you want nested namespaces you can use the luabind::namespace_ class. It +works exactly as luabind::module except that it doesn't take a lua_State* +in it's constructor. An example of its usage could look like this:

+
+module(L, "my_library")
+[
+    // declarations
+
+    namespace_("detail")
+    [
+        // library-private declarations
+    ]
+];
+
+

As you might have figured out, the following declarations are equivalent:

+
+module(L)
+[
+    namespace_("my_library")
+    [
+        // declarations
+    ]
+
+];
+
+
+module(L, "my_library")
+[
+    // declarations
+];
+
+

Each declaration must be separated by a comma, like this:

+
+module(L)
+[
+    def("f", &f),
+    def("g", &g),
+    class_<A>("A")
+        .def(constructor<int, int>),
+    def("h", &h)
+];
+
+

More about the actual declarations in the Binding functions to Lua and +Binding classes to Lua sections.

+

A word of caution, if you are in really bad need for performance, putting your +functions in tables will increase the lookup time.

+
+
+

7   Binding functions to Lua

+

To bind functions to Lua you use the function luabind::def(). It has the +following synopsis:

+
+template<class F, class policies>
+void def(const char* name, F f, const Policies&);
+
+
    +
  • name is the name the function will have within Lua.
  • +
  • F is the function pointer you want to register.
  • +
  • The Policies parameter is used to describe how parameters and return values +are treated by the function, this is an optional parameter. More on this in +the policies section.
  • +
+

An example usage could be if you want to register the function float +std::sin(float):

+
+module(L)
+[
+    def("sin", &std::sin)
+];
+
+
+

7.1   Overloaded functions

+

If you have more than one function with the same name, and want to register +them in Lua, you have to explicitly give the signature. This is to let C++ know +which function you refer to. For example, if you have two functions, int +f(const char*) and void f(int).

+
+module(L)
+[
+    def("f", (int(*)(const char*)) &f),
+    def("f", (void(*)(int)) &f)
+];
+
+
+
+

7.2   Signature matching

+

luabind will generate code that checks the Lua stack to see if the values there +can match your functions' signatures. It will handle implicit typecasts between +derived classes, and it will prefer matches with the least number of implicit +casts. In a function call, if the function is overloaded and there's no +overload that match the parameters better than the other, you have an +ambiguity. This will spawn a run-time error, stating that the function call is +ambiguous. A simple example of this is to register one function that takes an +int and one that takes a float. Since Lua don't distinguish between floats and +integers, both will always match.

+

Since all overloads are tested, it will always find the best match (not the +first match). This also means that it can handle situations where the only +difference in the signature is that one member function is const and the other +isn't.

+ +

For example, if the following function and class is registered:

+
+struct A
+{
+    void f();
+    void f() const;
+};
+
+const A* create_a();
+
+struct B: A {};
+struct C: B {};
+
+void g(A*);
+void g(B*);
+
+

And the following Lua code is executed:

+
+a1 = create_a()
+a1:f() -- the const version is called
+
+a2 = A()
+a2:f() -- the non-const version is called
+
+a = A()
+b = B()
+c = C()
+
+g(a) -- calls g(A*)
+g(b) -- calls g(B*)
+g(c) -- calls g(B*)
+
+
+
+

7.3   Calling Lua functions

+

To call a Lua function, you can either use call_function(), +an object or functor.

+
+template<class Ret>
+Ret call_function(lua_State* L, const char* name, ...)
+template<class Ret>
+Ret call_function(object const& obj, ...)
+
+

There are two overloads of the call_function function, one that calls +a function given its name, and one that takes an object that should be a Lua +value that can be called as a function.

+

The overload that takes a name can only call global Lua functions. The ... +represents a variable number of parameters that are sent to the Lua +function. This function call may throw luabind::error if the function +call fails.

+

The return value isn't actually Ret (the template parameter), but a proxy +object that will do the function call. This enables you to give policies to the +call. You do this with the operator[]. You give the policies within the +brackets, like this:

+
+int ret = call_function<int>(
+    L 
+  , "a_lua_function"
+  , new complex_class()
+)[ adopt(_1) ];
+
+

If you want to pass a parameter as a reference, you have to wrap it with the +Boost.Ref.

+

Like this:

+
+int ret = call_function(L, "fun", boost::ref(val));
+
+
+
+

7.4   Using Lua threads

+

To start a Lua thread, you have to call lua_resume(), this means that you +cannot use the previous function call_function() to start a thread. You have +to use

+
+template<class Ret>
+Ret resume_function(lua_State* L, const char* name, ...)
+template<class Ret>
+Ret resume_function(object const& obj, ...)
+
+

and

+
+template<class Ret>
+Ret resume(lua_State* L, ...)
+
+

The first time you start the thread, you have to give it a function to execute. i.e. you +have to use resume_function, when the Lua function yeilds, it will return the first +value passed in to lua_yield(). When you want to continue the execution, you just call +resume() on your lua_State, since it's already executing a function, you don't pass +it one. The parameters to resume() will be returned by yield() on the Lua side.

+

For yielding C++-functions (without the support of passing data back and forth between the +Lua side and the c++ side), you can use the yield policy.

+

With the overload of resume_function that takes an object, it is important that the +object was constructed with the thread as its lua_State*. Like this:

+
+lua_State* thread = lua_newthread(L);
+object fun = get_global(thread)["my_thread_fun"];
+resume_function(fun);
+
+
+
+
+

8   Binding classes to Lua

+

To register classes you use a class called class_. Its name is supposed to +resemble the C++ keyword, to make it look more intuitive. It has an overloaded +member function def() that is used to register member functions, operators, +constructors, enums and properties on the class. It will return its +this-pointer, to let you register more members directly.

+

Let's start with a simple example. Consider the following C++ class:

+
+class testclass
+{
+public:
+    testclass(const std::string& s): m_string(s) {}
+    void print_string() { std::cout << m_string << "\n"; }
+
+private:
+    std::string m_string;
+};
+
+

To register it with a Lua environment, write as follows (assuming you are using +namespace luabind):

+
+module(L)
+[
+    class_<testclass>("testclass")
+        .def(constructor<const std::string&>())
+        .def("print_string", &testclass::print_string)
+];
+
+

This will register the class with the name testclass and constructor that takes +a string as argument and one member function with the name print_string.

+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> a = testclass('a string')
+> a:print_string()
+a string
+
+

It is also possible to register free functions as member functions. The +requirement on the function is that it takes a pointer, const pointer, +reference or const reference to the class type as the first parameter. The rest +of the parameters are the ones that are visible in Lua, while the object +pointer is given as the first parameter. If we have the following C++ code:

+
+struct A
+{
+    int a;
+};
+
+int plus(A* o, int v) { return o->a + v; }
+
+

You can register plus() as if it was a member function of A like this:

+
+class_<A>("A")
+    .def("plus", &plus)
+
+

plus() can now be called as a member function on A with one parameter, int. +If the object pointer parameter is const, the function will act as if it was a +const member function (it can be called on const objects).

+
+

8.1   Properties

+

To register a global data member with a class is easily done. Consider the +following class:

+
+struct A
+{
+    int a;
+};
+
+

This class is registered like this:

+
+module(L)
+[
+    class_<A>("A")
+        .def_readwrite("a", &A::a)
+];
+
+

This gives read and write access to the member variable A::a. It is also +possible to register attributes with read-only access:

+
+module(L)
+[
+    class_<A>("A")
+    .def_readonly("a", &A::a)
+];
+
+

You can also register getter and setter functions and make them look as if they +were a public data member. Consider the following class:

+
+class A
+{
+public:
+    void set_a(int x) { a = x; }
+    int get_a() const { return a; }
+
+private:
+    int a;
+};
+
+

It can be registered as if it had a public data member a like this:

+
+class_<A>("A")
+    .property("a", &A::get_a, &A::set_a)
+
+

This way the get_a() and set_a() functions will be called instead of +just writing to the data member. If you want to make it read only you can just +omit the last parameter.

+
+
+

8.2   Enums

+

If your class contains enumerated constants (enums), you can register them as +well to make them available in Lua. Note that they will not be type safe, all +enums are integers in Lua, and all functions that takes an enum, will accept +any integer. You register them like this:

+
+module(L)
+[
+    class_<A>("A")
+        .enum_("constants")
+        [
+            value("my_enum", 4),
+            value("my_2nd_enum", 7),
+            value("another_enum", 6)
+        ]
+];
+
+

In Lua they are accessed like any data member, except that they are read-only +and reached on the class itself rather than on an instance of the class.

+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> print(A.my_enum)
+4
+> print(A.another_enum)
+6
+
+
+
+

8.3   Operators

+

The mechanism for registering operators on your class is pretty simple. You use +a global name luabind::self to refer to the class itself and then you just +write the operator expression inside the def() call. This class:

+
+struct vec
+{
+    vec operator+(int s);
+};
+
+

Is registered like this:

+
+module(L)
+[
+    class_<vec>("vec")
+        .def(self + int())
+];
+
+

This will work regardless if your plus operator is defined inside your class or +as a free function.

+

If you operator is const (or, when defined as a free function, takes a const +reference to the class itself) you have to use const_self instead of +self. Like this:

+
+module(L)
+[
+    class_<vec>("vec")
+        .def(const_self + int())
+];
+
+

The operators supported are those available in Lua:

+
++    -    *    /    ==    !=    <    <=    >    >=
+
+

This means, no in-place operators. The equality operator (==) has a little +hitch; it will not be called if the references are equal. This means that the +== operator has to do pretty much what's it's expected to do.

+

In the above example the other operand type is instantiated by writing +int(). If the operand type is a complex type that cannot easily be +instantiated you can wrap the type in a class called other<>. For example:

+

To register this class, we don't want to instantiate a string just to register +the operator.

+
+struct vec
+{
+    vec operator+(std::string);
+};
+
+

Instead we use the other<> wrapper like this:

+
+module(L)
+[
+    class_<vec>("vec")
+        .def(self + other<std::string>())
+];
+
+

To register an application operator:

+
+module(L)
+[
+    class_<vec>("vec")
+        .def( self(int()) )
+];
+
+

There's one special operator. In Lua it's called __tostring, it's not +really an operator. It is used for converting objects to strings in a standard +way in Lua. If you register this functionality, you will be able to use the lua +standard function tostring() for converting you object to a string.

+

To implement this operator in C++ you should supply an operator<< for +ostream. Like this example:

+
+class number {};
+std::ostream& operator<<(std::ostream&, number&);
+
+...
+
+module(L)
+[
+    class_<number>("number")
+        .def(tostring(self))
+];
+
+
+
+

8.4   Nested scopes and static functions

+

It is possible to add nested scopes to a class. This is useful when you need +to wrap a nested class, or a static function.

+
+class_<foo>("foo")
+    .def(constructor<>()
+    .scope
+    [
+        class_<inner>("nested"),
+        def("f", &f)
+    ];
+
+

It's also possible to add namespaces to classes using the same syntax.

+
+
+

8.5   Derived classes

+

If you want to register classes that derives from other classes, you can +specify a template parameter bases<> to the class_ instantiation. The +following hierarchy:

+
+struct A {};
+struct B : A {};
+
+

Would be registered like this:

+
+module(L)
+[
+    class_<A>("A"),
+    class_<B, A>("B")
+];
+
+

If you have multiple inheritance you can specify more than one base. If B would +also derive from a class C, it would be registered like this:

+
+module(L)
+[
+    class_<B, bases<A, C> >("B")
+];
+
+

Note that you can omit bases<> when using single inheritance.

+
+

Note

+If you don't specify that classes derive from each other, luabind will not +be able to implicitly cast pointers between the types.
+
+
+

8.6   Smart pointers

+

When you register a class you can tell luabind that all instances of that class +should be held by some kind of smart pointer (boost::shared_ptr for instance). +You do this by giving the holder type as an extra template parameter to +the class_ you are constructing, like this:

+
+module(L)
+[
+    class_<A, boost::shared_ptr<A> >("A")
+];
+
+

You also have to supply two functions for your smart pointer. One that returns +the type of const version of the smart pointer type (boost::shared_ptr<const A> +in this case). And one function that extracts the raw pointer from the smart +pointer. The first function is needed because luabind has to allow the +non-const -> conversion when passing values from Lua to C++. The second +function is needed when Lua calls member functions on held types, the this +pointer must be a raw pointer, it is also needed to allow the smart_pointer -> +raw_pointer conversion from Lua to C++. They look like this:

+
+namespace luabind {
+
+    template<class T>
+    T* get_pointer(boost::shared_ptr<T> const& p) 
+    {
+        return p.get(); 
+    }
+
+    template<class A>
+    boost::shared_ptr<const A>* 
+    get_const_holder(boost::shared_ptr<A>*)
+    {
+        return 0;
+    }
+}
+
+

The conversion that works are (given that B is a base class of A):

+
+

From Lua to C++

+ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SourceTarget
holder_type<A>A*
holder_type<A>B*
holder_type<A>A const*
holder_type<A>B const*
holder_type<A>holder_type<A>
holder_type<A>holder_type<A const>
holder_type<A const>A const*
holder_type<A const>B const*
holder_type<A const>holder_type<A const>
+
+
+

From C++ to Lua

+ ++++ + + + + + + + + + + + + + + + + + + + +
SourceTarget
holder_type<A>holder_type<A>
holder_type<A const>holder_type<A const>
holder_type<A> const&holder_type<A>
holder_type<A const> const&holder_type<A const>
+
+

When using a holder type, it can be useful to know if the pointer is valid. For +example when using std::auto_ptr, the holder will be invalidated when passed as +a parameter to a function. For this purpose there is a member of all object +instances in luabind: __ok.

+
+struct X {};
+void f(std::auto_ptr<X>);
+
+module(L)
+[
+    class_<X, std::auto_ptr<X> >("X")
+        .def(constructor<>()),
+
+    def("f", &f)
+];
+
+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> a = X()
+> f(a)
+> print a.__ok
+false
+
+
+
+
+

9   Object

+

Since functions have to be able to take Lua values (of variable type) we need a +wrapper around them. This wrapper is called luabind::object. If the +function you register takes an object, it will match any Lua value. To use it, +you need to include luabind/object.hpp.

+
+

Synopsis

+
+class object
+{
+public:
+    class iterator;
+    class raw_iterator;
+    class array_iterator;
+
+    template<class T>
+    object(lua_State*, T const& value);
+    object(object const&);
+    object(lua_State*);
+    object();
+
+    ~object();
+    
+    iterator begin() const;
+    iterator end() const;
+    raw_iterator raw_begin() const;
+    raw_iterator raw_end() const;
+    array_iterator abegin() const;
+    array_iterator aend() const;
+
+    void set();
+    lua_State* lua_state() const;
+    void pushvalue() const;
+    bool is_valid() const;
+    operator safe_bool_type() const;
+
+    template<class Key>
+    implementation-defined operator[](Key const&);
+
+    template<class Key>
+    object at(Key const&) const;
+
+    template<class Key>
+    object raw_at(Key const&) const;
+
+    template<class T>
+    object& operator=(T const&);
+    object& operator=(object const&);
+
+    template<class T>
+    bool operator==(T const&) const;
+    bool operator==(object const&) const;
+    bool operator<(object const&) const;
+    bool operator<=(object const&) const;
+    bool operator>(object const&) const;
+    bool operator>=(object const&) const;
+    bool operator!=(object const&) const;
+
+    void swap(object&);
+    int type() const;
+
+    implementation-defined operator()();
+
+    template<class A0>
+    implementation-defined operator()(A0 const& a0);
+
+    template<class A0, class A1>
+    implementation-defined operator()(A0 const& a0, A1 const& a1);
+
+    /* ... */
+};
+
+
+

When you have a Lua object, you can assign it a new value with the assignment +operator (=). When you do this, the default_policy will be used to make the +conversion from C++ value to Lua. If your luabind::object is a table you +can access its members through the operator[] or the iterators. The value +returned from the operator[] is a proxy object that can be used both for +reading and writing values into the table (using operator=). Note that it is +impossible to know if a Lua value is indexable or not (lua_gettable doesn't +fail, it succeeds or crashes). This means that if you're trying to index +something that cannot be indexed, you're on your own. Lua will call its +panic() function (you can define your own panic function using +lua_setpanicf). The at() and raw_at() functions returns the value at +the given table position (like operator[] but only for reading).

+

The ordinary object::iterator uses lua_gettable to extract the values from +the table, the standard way that will invoke metamethods if any. The +object::raw_iterator uses lua_rawget and object::array_iterator uses +lua_rawgeti. The latter will only iterate over numberical keys starting at 1 +and continue until the first nil value.

+

The lua_state() function returns the Lua state where this object is stored. +If you want to manipulate the object with Lua functions directly you can push +it onto the Lua stack by calling pushvalue(). And set the object's value by +calling set(), which will pop the top value from the Lua stack and assign +it to the object.

+

The operator== will call lua_equal() on the operands and return its result.

+

The type() member function will return the Lua type of the object. It will +return the same values as lua_type().

+

The is_valid() function tells you whether the object has been initialized +or not. When created with its default constructor, objects are invalid. To make +an object valid, you can assign it a value. If you want to invalidate an object +you can simply assign it an invalid object.

+ +

The operator safe_bool_type() is equivalent to is_valid(). This means +that these snippets are equivalent:

+
+object o;
+// ...
+if (o)
+{
+    // ...
+}
+
+...
+
+object o;
+// ...
+if (o.is_valid())
+{
+    // ...
+}
+
+

The application operator will call the value as if it was a function. You can +give it any number of parameters (currently the default_policy will be used +for the conversion). The returned object refers to the return value (currently +only one return value is supported). This operator may throw luabind::error +if the function call fails. If you want to specify policies to your function +call, you can use index-operator (operator[]) on the function call, and give +the policies within the [ and ]. Like this:

+
+my_function_object(
+    2
+  , 8
+  , new my_complex_structure(6)
+) [ adopt(_3) ];
+
+

This tells luabind to make Lua adopt the ownership and responsibility for the +pointer passed in to the lua-function.

+

It's important that all instances of object have been destructed by the time +the Lua state is closed. The object will keep a pointer to the lua state and +release its Lua object in its destructor.

+

Here's an example of how a function can use a table:

+
+void my_function(const object& table)
+{
+    if (table.type() == LUA_TTABLE)
+    {
+        table["time"] = std::clock();
+        table["name"] = std::rand() < 500 ? "unusual" : "usual";
+
+        std::cout << object_cast<std::string>(table[5]) << "\n";
+    }
+}
+
+

If you take a luabind::object as a parameter to a function, any Lua value +will match that parameter. That's why we have to make sure it's a table before +we index into it.

+
+

9.1   Iterators

+

The iterators, that are returned by begin() and end() (and their +variants) are (almost) models of the ForwardIterator concept. The exception +is that post increment doesn't exist on them.

+

They look like this

+
+class object::iterator
+{
+    iterator();
+    iterator(const iterator&);
+
+    iterator& operator++();
+    bool operator!=(const iterator&) const;
+    iterator& operator=(const iterator&);
+
+    object key() const;
+
+    implementation-defined operator*();
+};
+
+

The implementation defined return value from the dereference operator is a +proxy object that can be used as if it was an object, it can also be used to +assign the specific table entry with a new value. If you want to assign a value +to an entry pointed to by an iterator, just use the assignment operator on the +dereferenced iterator:

+
+*iter = 5;
+
+

The key() member returns the key used by the iterator when indexing the +associated Lua table.

+
+ +
+

9.3   Functor

+

The functor class is similar to object, with the exception that it can only +be used to store functions. If you take it as a parameter, it will only match +functions.

+

To use it you need to include its header:

+
+#include <luabind/functor.hpp>
+
+

It takes one template parameter, the return value of the Lua function it +represents. Currently the functor can have at most one return value (unlike Lua +functions).

+
+

Synopsis

+
+template<class Ret>
+class functor
+{
+public:
+
+    functor(lua_State*, char const* name);
+    functor(functor const&);
+    ~functor();
+
+    bool is_valid() const;
+    operator safe_bool_type() const;
+    void reset();
+
+    lua_State* lua_state() const;
+    void pushvalue() const;
+    
+    bool operator==(functor<Ret> const&);
+    bool operator!=(functor<Ret> const&);
+    
+    implementation-defined operator()() const;
+    
+    template<class A0>
+    implementation-defined operator()(A0 const&) const;
+
+    template<class A0, class A1>
+    implementation-defined operator()(A0 const&, A1 const&) const;
+
+    /* ... */
+};
+
+
+

The application operator takes any parameters. The parameters are converted +into Lua and the function is called. The return value will act as if it was the +type Ret, with the exception that you can use the return value to give policies +to the call. You do this the same way as you do with objects, using the +operator[], and giving the policies inside the brackets.

+

The is_valid() function works just like the one on object, it tells you if +the functor has been assigned with a valid Lua function. The operator +safe_bool_type() is an alias for this member function and also works just as +the one found in object.

+

For example, if you have the following Lua function:

+
+function f(a, b)
+    return a + b
+end
+
+

You can expose it to C++ like this:

+
+functor<int> f(L, "f");
+
+std::cout << f(3, 5) << "\n";
+
+

This will print out the sum of 3 and 5. Note that you can pass any parameters +to the application operator of luabind::functor, this is because lua +doesn't have signatures for its functions. All Lua functions take any number of +parameters of any type.

+

If we have a C++ function that takes a luabind::functor and registers it, +it will accept Lua functions passed to it. This enables us to expose APIs that +requires you to register callbacks. For example, if your C++ API looks like +this:

+
+void set_callback(void(*)(int, int));
+
+

And you want to expose it to Lua, you have to wrap the call to the Lua +function inside a real C++ function, like this:

+
+functor<void> lua_callback;
+
+void callback_wrapper(int a, int b)
+{
+    lua_callback(a, b);
+}
+
+void set_callback_wrapper(const functor<void>& f)
+{
+    lua_callback = f;
+    set_callback(&callback_wrapper);
+}
+
+

And then register set_callback_wrapper instead of registering +set_callback. This will have the effect that when one tries to register the +callback from Lua, your set_callback_wrapper will be called instead and +first set the Lua functor to the given function. It will then call the real +set_callback with the callback_wrapper. The callback_wrapper will +be called whenever the callback should be called, and it will simply call the +Lua function that we registered.

+

You can also use object_cast to cast an object to a functor.

+

reset on functor will invalidate the functor (and remove any references +to its Lua value). If the functor object has longer lifetime than the lua state +(e.g. if it's a global).

+
+
+
+

10   Defining classes in Lua

+

In addition to binding C++ functions and classes with Lua, luabind also provide +an OO-system in Lua.

+
+class 'lua_testclass'
+
+function lua_testclass:__init(name)
+    self.name = name
+end
+
+function lua_testclass:print()
+    print(self.name)
+end
+
+a = lua_testclass('example')
+a:print()
+
+

Inheritance can be used between lua-classes:

+
+class 'derived' (lua_testclass)
+
+function derived:__init() super('derived name')
+end
+
+function derived:print()
+    print('Derived:print() -> ')
+    lua_testclass.print(self)
+end
+
+

Here the super keyword is used in the constructor to initialize the base +class. The user is required to call super first in the constructor.

+

As you can see in this example, you can call the base class member functions. +You can find all member functions in the base class, but you will have to give +the this-pointer (self) as first argument.

+
+

10.1   Deriving in lua

+

It is also possible to derive Lua classes from C++ classes, and override +virtual functions with Lua functions. To do this we have to create a wrapper +class for our C++ base class. This is the class that will hold the Lua object +when we instantiate a Lua class.

+
+class base
+{
+public:
+    base(const char* s)
+    { std::cout << s << "\n"; }
+
+    virtual void f(int a) 
+    { std::cout << "f(" << a << ")\n"; }
+};
+
+struct base_wrapper : base, luabind::wrap_base
+{
+    base_wrapper(const char* s)
+        : base(s) 
+    {}
+
+    virtual void f(int a) 
+    { 
+        call<void>("f", a); 
+    }
+
+    static void default_f(base_wraper* ptr, int a)
+    {
+        return ptr->base::f(a);
+    }
+};
+
+...
+
+module(L)
+[
+    class_<base, base_wrapper>("base")
+        .def(constructor<const char*>())
+        .def("f", &base_wrapper::f, &base_wrapper::default_f)
+];
+
+
+

Important

+Since visual studio 6.5 doesn't support explicit template parameters +to member functions, instead of using the member function call() +you call a free function call_member() and pass the this-pointer +as first parameter.
+

Note that if you have both base classes and a base class wrapper, you must give +both bases and the base class wrapper type as template parameter to +class_ (as done in the example above). The order in which you specify +them is not important. You must also register both the static version and the +virtual version of the function from the wrapper, this is necessary in order +to allow luabind to use both dynamic and static dispatch when calling the function.

+
+

Important

+It is extremely important that the signatures of the static (default) function +is identical to the virtual function. The fact that onw of them is a free +function and the other a member function doesn't matter, but the parameters +as seen from lua must match. It would not have worked if the static function +took a base* as its first argument, since the virtual function takes a +base_wrapper* as its first argument (its this pointer). There's currently +no check in luabind to make sure the signatures match.
+

If we didn't have a class wrapper, it would not be possible to pass a Lua class +back to C++. Since the entry points of the virtual functions would still point +to the C++ base class, and not to the functions defined in Lua. That's why we +need one function that calls the base class' real function (used if the lua +class doesn't redefine it) and one virtual function that dispatches the call +into luabind, to allow it to select if a Lua function should be called, or if +the original function should be called. If you don't intend to derive from a +C++ class, or if it doesn't have any virtual member functions, you can register +it without a class wrapper.

+

You don't need to have a class wrapper in order to derive from a class, but if +it has virtual functions you may have silent errors.

+ +

The wrappers must derive from luabind::wrap_base, it contains a Lua reference +that will hold the Lua instance of the object to make it possible to dispatch +virtual function calls into Lua. This is done through an overloaded member function:

+
+template<class Ret>
+Ret call(char const* name, ...)
+
+

Its used in a similar way as call_function, with the exception that it doesn't +take a lua_State pointer, and the name is a member function in the Lua class.

+
+

Warning

+The current implementation of call_member is not able to distinguish const +member functions from non-const. If you have a situation where you have an overloaded +virtual function where the only difference in their signatures is their constness, the +wrong overload will be called by call_member. This is rarely the case though.
+
+

10.1.1   Object identity

+

When a pointer or reference to a registered class with a wrapper is passed +to Lua, luabind will query for it's dynamic type. If the dynamic type +inherits from wrap_base, object identity is preserved.

+
+struct A { .. };
+struct A_wrap : A, wrap_base { .. };
+
+A* f(A* ptr) { return ptr; }
+
+module(L)
+[
+    class_<A, A_wrap>("A"),
+    def("f", &f)
+];
+
+
+> class 'B' (A)
+> x = B()
+> assert(x == f(x)) -- object identity is preserved when object is
+                    -- passed through C++
+
+

This functionality relies on RTTI being enabled (that LUABIND_NO_RTTI is +not defined).

+
+
+
+

10.2   Overloading operators

+

You can overload most operators in Lua for your classes. You do this by simply +declaring a member function with the same name as an operator (the name of the +metamethods in Lua). The operators you can overload are:

+
+
    +
  • __add
  • +
  • __sub
  • +
  • __mul
  • +
  • __div
  • +
  • __pow
  • +
  • __lt
  • +
  • __le
  • +
  • __eq
  • +
  • __call
  • +
  • __unm
  • +
  • __tostring
  • +
+
+

__tostring isn't really an operator, but it's the metamethod that is called +by the standard library's tostring() function. There's one strange behavior +regarding binary operators. You are not guaranteed that the self pointer you +get actually refers to an instance of your class. This is because Lua doesn't +distinguish the two cases where you get the other operand as left hand value or +right hand value. Consider the following examples:

+
+class 'my_class'
+
+  function my_class:__init(v)
+      self.val = v
+  end
+    
+  function my_class:__sub(v)
+      return my_class(self.val - v.val)
+  end
+
+  function my_class:__tostring()
+      return self.val
+  end
+
+

This will work well as long as you only subtracts instances of my_class with +each other. But If you want to be able to subtract ordinary numbers from your +class too, you have to manually check the type of both operands, including the +self object.

+
+function my_class:__sub(v)
+    if (type(self) == 'number') then
+        return my_class(self - v.val)
+
+    elseif (type(v) == 'number') then
+        return my_class(self.val - v)
+    
+    else
+        -- assume both operands are instances of my_class
+        return my_class(self.val - v.val)
+
+    end
+end
+
+

The reason why __sub is used as an example is because subtraction is not +commutative (the order of the operands matter). That's why luabind cannot +change order of the operands to make the self reference always refer to the +actual class instance.

+

If you have two different Lua classes with an overloaded operator, the operator +of the right hand side type will be called. If the other operand is a C++ class +with the same operator overloaded, it will be prioritized over the Lua class' +operator. If none of the C++ overloads matches, the Lua class operator will be +called.

+
+
+

10.3   Finalizers

+

If an object needs to perform actions when it's collected we provide a +__finalize function that can be overridden in lua-classes. The +__finalize functions will be called on all classes in the inheritance +chain, starting with the most derived type.

+
+...
+
+function lua_testclass:__finalize()
+    -- called when the an object is collected
+end
+
+
+
+

10.4   Slicing

+

If your lua C++ classes don't have wrappers (see Deriving in lua) and +you derive from them in lua, they may be sliced. Meaning, if an object +is passed into C++ as a pointer to its base class, the lua part will be +separated from the C++ base part. This means that if you call virtual +functions on that C++ object, thyey will not be dispatched to the lua +class. It also means that if you adopt the object, the lua part will be +garbage collected.

+
++--------------------+
+| C++ object         |    <- ownership of this part is transferred
+|                    |       to c++ when adopted
++--------------------+
+| lua class instance |    <- this part is garbage collected when
+| and lua members    |       instance is adopted, since it cannot
++--------------------+       be held by c++. 
+
+

The problem can be illustrated by this example:

+
+struct A {};
+
+A* filter_a(A* a) { return a; }
+void adopt_a(A* a) { delete a; }
+
+
+using namespace luabind;
+
+module(L)
+[
+    class_<A>("A"),
+    def("filter_a", &filter_a),
+    def("adopt_a", &adopt_a, adopt(_1))
+]
+
+

In lua:

+
+a = A()
+b = filter_a(a)
+adopt_a(b)
+
+

In this example, lua cannot know that b actually is the same object as +a, and it will therefore consider the object to be owned by the C++ side. +When the b pointer then is adopted, a runtime error will be raised because +an object not owned by lua is being adopted to C++.

+

If you have a wrapper for your class, none of this will happen, see +Object identity.

+
+
+
+

11   Exceptions

+

If any of the functions you register throws an exception when called, that +exception will be caught by luabind and converted to an error string and +lua_error() will be invoked. If the exception is a std::exception or a +const char* the string that is pushed on the Lua stack, as error message, +will be the string returned by std::exception::what() or the string itself +respectively. If the exception is unknown, a generic string saying that the +function threw an exception will be pushed.

+

Exceptions thrown from user defined functions have to be caught by luabind. If +they weren't they would be thrown through Lua itself, which is usually compiled +as C code and doesn't support the stack-unwinding that exceptions imply.

+

Any function that invokes Lua code may throw luabind::error. This exception +means that a Lua run-time error occurred. The error message is found on top of +the Lua stack. The reason why the exception doesn't contain the error string +itself is because it would then require heap allocation which may fail. If an +exception class throws an exception while it is being thrown itself, the +application will be terminated.

+

Error's synopsis is:

+
+class error : public std::exception
+{
+public:
+    error(lua_State*);
+    lua_State* state() const throw();
+    virtual const char* what() const throw();
+};
+
+

The state function returns a pointer to the Lua state in which the error was +thrown. This pointer may be invalid if you catch this exception after the lua +state is destructed. If the Lua state is valid you can use it to retrieve the +error message from the top of the Lua stack.

+

An example of where the Lua state pointer may point to an invalid state +follows:

+
+struct lua_state
+{
+    lua_state(lua_State* L): m_L(L) {}
+    ~lua_state() { lua_close(m_L); }
+    operator lua_State*() { return m_L; }
+    lua_State* m_L;
+};
+
+int main()
+{
+    try
+    {
+        lua_state L = lua_open();
+        /* ... */
+    }
+    catch(luabind::error& e)
+    {
+        lua_State* L = e.state();
+        // L will now point to the destructed
+        // Lua state and be invalid
+        /* ... */
+    }
+}
+
+

There's another exception that luabind may throw: luabind::cast_failed, +this exception is thrown from call_function<>, call_member<> or when +functor<> is invoked. It means that the return value from the Lua function +couldn't be converted to a C++ value. It is also thrown from object_cast<> +if the cast cannot be made.

+

The synopsis for luabind::cast_failed is:

+
+class cast_failed : public std::exception
+{
+public:
+    cast_failed(lua_State*);
+    lua_State* state() const throw();
+    LUABIND_TYPE_INFO info() const throw();
+    virtual const char* what() const throw();
+};
+
+

Again, the state member function returns a pointer to the Lua state where the +error occurred. See the example above to see where this pointer may be invalid.

+

The info member function returns the user defined LUABIND_TYPE_INFO, which +defaults to a const std::type_info*. This type info describes the type that +we tried to cast a Lua value to.

+

If you have defined LUABIND_NO_EXCEPTIONS none of these exceptions will be +thrown, instead you can set two callback functions that are called instead. +These two functions are only defined if LUABIND_NO_EXCEPTIONS are defined.

+
+luabind::set_error_callback(void(*)(lua_State*))
+
+

The function you set will be called when a runtime-error occur in Lua code. You +can find an error message on top of the Lua stack. This function is not +expected to return, if it does luabind will call std::terminate().

+
+luabind::set_cast_failed_callback(void(*)(lua_State*, LUABIND_TYPE_INFO))
+
+

The function you set is called instead of throwing cast_failed. This function +is not expected to return, if it does luabind will call std::terminate().

+
+
+

12   Policies

+

Sometimes it is necessary to control how luabind passes arguments and return +value, to do this we have policies. All policies use an index to associate +them with an argument in the function signature. These indices are result +and _N (where N >= 1). When dealing with member functions _1 refers +to the this pointer.

+ +
+

12.1   adopt

+
+

12.1.1   Motivation

+

Used to transfer ownership across language boundaries.

+
+
+

12.1.2   Defined in

+
+#include <luabind/adopt_policy.hpp>
+
+
+
+

12.1.3   Synopsis

+
+adopt(index)
+
+
+
+

12.1.4   Parameters

+ ++++ + + + + + + + + + + +
ParameterPurpose
indexThe index which should transfer ownership, _N or result
+
+
+

12.1.5   Example

+
+X* create()
+{
+    return new X;
+}
+
+...
+
+module(L)
+[
+    def("create", &create, adopt(result))
+];
+
+
+
+
+

12.2   dependency

+
+

12.2.1   Motivation

+

The dependency policy is used to create life-time dependencies between values. +This is needed for example when returning internal references to some class.

+
+
+

12.2.2   Defined in

+
+#include <luabind/dependency_policy.hpp>
+
+
+
+

12.2.3   Synopsis

+
+dependency(nurse_index, patient_index)
+
+
+
+

12.2.4   Parameters

+ ++++ + + + + + + + + + + + + + +
ParameterPurpose
nurse_indexThe index which will keep the patient alive.
patient_indexThe index which will be kept alive.
+
+
+

12.2.5   Example

+
+struct X
+{
+    B member;
+    B& get() { return member; }
+};
+
+module(L)
+[
+    class_<X>("X")
+        .def("get", &X::get, dependency(result, _1))
+];
+
+
+
+
+

12.3   out_value

+
+

12.3.1   Motivation

+

This policy makes it possible to wrap functions that take non-const references +or pointer to non-const as it's parameters with the intention to write return +values to them.

+
+
+

12.3.2   Defined in

+
+#include <luabind/out_value_policy.hpp>
+
+
+
+

12.3.3   Synopsis

+
+out_value(index, policies = none)
+
+
+
+

12.3.4   Parameters

+ ++++ + + + + + + + + + + + + + +
ParameterPurpose
indexThe index of the parameter to be used as an out parameter.
policiesThe policies used internally to convert the out parameter +to/from Lua. _1 means to C++, _2 means from +C++.
+
+
+

12.3.5   Example

+
+void f1(float& val) { val = val + 10.f; }
+void f2(float* val) { *val = *val + 10.f; }
+
+module(L)
+[
+    def("f", &f, out_value(_1))
+];
+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> print(f1(10))
+20
+> print(f2(10))
+20
+
+
+
+
+

12.4   pure_out_value

+
+

12.4.1   Motivation

+

This works exactly like out_value, except that it will pass a +default constructed object instead of converting an argument from +Lua.

+
+
+

12.4.2   Defined in

+
+#include <luabind/out_value_policy.hpp>
+
+
+
+

12.4.3   Synopsis

+
+pure_out_value(index, policies = none)
+
+
+
+

12.4.4   Parameters

+ ++++ + + + + + + + + + + + + + +
ParameterPurpose
indexThe index of the parameter to be used as an out parameter.
policiesThe policies used internally to convert the out parameter +to Lua. _1 is used as the interal index.
+
+
+

12.4.5   Example

+
+void f1(float& val) { val = 10.f; }
+void f2(float* val) { *val = 10.f; }
+
+module(L)
+[
+    def("f", &f, pure_out_value(_1))
+];
+
+Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
+> print(f1())
+10
+> print(f2())
+10
+
+
+
+
+

12.5   return_reference_to

+
+

12.5.1   Motivation

+

It is very common to return references to arguments or the this-pointer to +allow for chaining in C++.

+
+struct A
+{
+    float val;
+
+    A& set(float v)
+    {
+        val = v;
+        return *this;
+    }
+};
+
+

When luabind generates code for this, it will create a new object for the +return-value, pointing to the self-object. This isn't a problem, but could be a +bit inefficient. When using the return_reference_to-policy we have the ability +to tell luabind that the return-value is already on the lua stack.

+
+
+

12.5.2   Defined in

+
+#include <luabind/return_reference_to_policy.hpp>
+
+
+
+

12.5.3   Synopsis

+
+return_reference_to(index)
+
+
+
+

12.5.4   Parameters

+ ++++ + + + + + + + + + + +
ParameterPurpose
indexThe argument index to return a reference to, any argument but +not result.
+
+
+

12.5.5   Example

+
+struct A
+{
+    float val;
+
+    A& set(float v)
+    {
+        val = v;
+        return *this;
+    }
+};
+
+module(L)
+[
+    class_<A>("A")
+        .def(constructor<>())
+        .def("set", &A::set, return_reference_to(_1))
+];
+
+
+

Warning

+This policy ignores all type information and should be used only it +situations where the parameter type is a perfect match to the +return-type (such as in the example).
+
+
+
+

12.6   copy

+
+

12.6.1   Motivation

+

This will make a copy of the parameter. This is the default behavior when +passing parameters by-value. Note that this can only be used when passing from +C++ to Lua. This policy requires that the parameter type has an accessible copy +constructor.

+
+
+

12.6.2   Defined in

+
+#include <luabind/copy_policy.hpp>
+
+
+
+

12.6.3   Synopsis

+
+copy(index)
+
+
+
+

12.6.4   Parameters

+ ++++ + + + + + + + + + + +
ParameterPurpose
indexThe index to copy. result when used while wrapping C++ +functions. _N when passing arguments to Lua.
+
+
+

12.6.5   Example

+
+X* get()
+{
+    static X instance;
+    return &instance;
+}
+
+...
+
+module(L)
+[
+    def("create", &create, copy(result))
+];
+
+
+
+
+

12.7   discard_result

+
+

12.7.1   Motivation

+

This is a very simple policy which makes it possible to throw away +the value returned by a C++ function, instead of converting it to +Lua.

+
+
+

12.7.2   Defined in

+
+#include <luabind/discard_result_policy.hpp>
+
+
+
+

12.7.3   Synopsis

+
+discard_result
+
+
+
+

12.7.4   Example

+
+struct X
+{
+    X& set(T n)
+    {
+        ...
+        return *this;
+    }
+};
+
+...
+
+module(L)
+[
+    class_<X>("X")
+        .def("set", &simple::set, discard_result)
+];
+
+
+
+
+

12.8   return_stl_iterator

+
+

12.8.1   Motivation

+

This policy converts an STL container to a generator function that can be used +in lua to iterate over the container. It works on any container that defines +begin() and end() member functions (they have to return iterators).

+
+
+

12.8.2   Defined in

+
+#include <luabind/iterator_policy.hpp>
+
+
+
+

12.8.3   Synopsis

+
+return_stl_iterator
+
+
+
+

12.8.4   Example

+
+struct X
+{
+    std::vector<std::string> names;
+};
+
+...
+
+module(L)
+[
+    class_<A>("A")
+        .def_readwrite("names", &X::names, return_stl_iterator)
+];
+
+...
+
+> a = A()
+> for name in a.names do
+>  print(name)
+> end
+
+
+
+
+

12.9   raw

+
+

12.9.1   Motivation

+

This converter policy will pass through the lua_State* unmodified. +This can be useful for example when binding functions that need to +return a luabind::object. The parameter will be removed from the +function signature, decreasing the function arity by one.

+
+
+

12.9.2   Defined in

+
+#include <luabind/raw_policy.hpp>
+
+
+
+

12.9.3   Synopsis

+
+raw(index)
+
+
+
+

12.9.4   Parameters

+ ++++ + + + + + + + + + + +
ParameterPurpose
indexThe index of the lua_State* parameter.
+
+
+

12.9.5   Example

+
+void greet(lua_State* L)
+{
+    lua_pushstring(L, "hello");
+}
+
+...
+
+module(L)
+[
+    def("greet", &greet, raw(_1))
+];
+
+> print(greet())
+hello
+
+
+
+
+

12.10   yield

+
+

12.10.1   Motivation

+

Makes a C++ function yield when returning.

+
+
+

12.10.2   Defined in

+
+#include <luabind/yield_policy.hpp>
+
+
+
+

12.10.3   Synopsis

+
+yield
+
+
+
+

12.10.4   Example

+
+void do_thing_that_takes_time()
+{
+    ...
+}
+
+...
+
+module(L)
+[
+    def("do_thing_that_takes_time", &do_thing_that_takes_time, yield)
+];
+
+ +
+
+
+
+

13   Splitting up the registration

+

It is possible to split up a module registration into several +translation units without making each registration dependent +on the module it's being registered in.

+

a.cpp:

+
+luabind::scope register_a()
+{
+    return 
+        class_<a>("a")
+            .def("f", &a::f)
+            ;
+}
+
+

b.cpp:

+
+luabind::scope register_b()
+{
+    return 
+        class_<b>("b")
+            .def("g", &b::g)
+            ;
+}
+
+

module_ab.cpp:

+
+luabind::scope register_a();
+luabind::scope register_b();
+
+void register_module(lua_State* L)
+{
+    module("b", L)
+    [
+        register_a(),
+        register_b()
+    ];
+}
+
+
+
+

14   Configuration

+

As mentioned in the Lua documentation, it is possible to pass an +error handler function to lua_pcall(). Luabind makes use of +lua_pcall() internally when calling methods and functions. It is +possible to set the error handler function that Luabind will use +globally:

+
+typedef void(*pcall_callback_fun)(lua_State*);
+void set_pcall_callback(pcall_callback_fun fn);
+
+

This is primarily useful for adding more information to the error message +returned by a failed protected call.

+
+

14.1   Build options

+

There are a number of configuration options available when building luabind. +It is very important that your project has the exact same conmfiguration +options as the ones given when the library was build! The exceptions are the +LUABIND_MAX_ARITY and LUABIND_MAX_BASES which are template-based +options and only matters when you use the library (which means they can +differ from the settings of the library).

+

The default settings which will be used if no other settings are given +can be found in luabind/config.hpp.

+

If you want to change the settings of the library, you can modify the +config file. It is included and used by all makefiles. You can change paths +to Lua and boost in there as well.

+
+
LUABIND_MAX_ARITY
+
Controls the maximum arity of functions that are registered with luabind. +You can't register functions that takes more parameters than the number +this macro is set to. It defaults to 5, so, if your functions have greater +arity you have to redefine it. A high limit will increase compilation time.
+
LUABIND_MAX_BASES
+
Controls the maximum number of classes one class can derive from in +luabind (the number of classes specified within bases<>). +LUABIND_MAX_BASES defaults to 4. A high limit will increase +compilation time.
+
LUABIND_NO_ERROR_CHECKING
+

If this macro is defined, all the Lua code is expected only to make legal +calls. If illegal function calls are made (e.g. giving parameters that +doesn't match the function signature) they will not be detected by luabind +and the application will probably crash. Error checking could be disabled +when shipping a release build (given that no end-user has access to write +custom Lua code). Note that function parameter matching will be done if a +function is overloaded, since otherwise it's impossible to know which one +was called. Functions will still be able to throw exceptions when error +checking is disabled.

+

If a functions throws an exception it will be caught by luabind and +propagated with lua_error().

+
+
LUABIND_NO_EXCEPTIONS
+

This define will disable all usage of try, catch and throw in luabind. +This will in many cases disable run-time errors, when performing invalid +casts or calling Lua functions that fails or returns values that cannot +be converted by the given policy. luabind requires that no function called +directly or indirectly by luabind throws an exception (throwing exceptions +through Lua has undefined behavior).

+

Where exceptions are the only way to get an error report from luabind, +they will be replaced with calls to the callback functions set with +set_error_callback() and set_cast_failed_callback().

+
+
LUA_API
+
If you want to link dynamically against Lua, you can set this define to +the import-keyword on your compiler and platform. On windows in devstudio +this should be __declspec(dllimport) if you want to link against Lua +as a dll.
+
LUABIND_EXPORT, LUABIND_IMPORT
+
If you want to link against luabind as a dll (in devstudio), you can +define LUABIND_EXPORT to __declspec(dllexport) and +LUABIND_IMPORT to __declspec(dllimport). +Note that you have to link against Lua as a dll aswell, to make it work.
+
LUABIND_NO_RTTI
+
You can define this if you don't want luabind to use dynamic_cast<>. +It will disable Object identity.
+
LUABIND_TYPE_INFO, LUABIND_TYPE_INFO_EQUAL(i1,i2), LUABIND_TYPEID(t), LUABIND_INVALID_TYPE_INFO
+

If you don't want to use the RTTI supplied by C++ you can supply your own +type-info structure with the LUABIND_TYPE_INFO define. Your type-info +structure must be copyable and must be able to compare itself against +other type-info structures. You supply the compare function through the +LUABIND_TYPE_INFO_EQUAL() define. It should compare the two type-info +structures it is given and return true if they represent the same type and +false otherwise. You also have to supply a function to generate your +type-info structure. You do this through the LUABIND_TYPEID() define. +It should return your type-info structure and it takes a type as its +parameter. That is, a compile time parameter. +LUABIND_INVALID_TYPE_INFO macro should be defined to an invalid type. +No other type should be able to produce this type info. To use it you +probably have to make a traits class with specializations for all classes +that you have type-info for. Like this:

+
+class A;
+class B;
+class C;
+
+template<class T> struct typeinfo_trait;
+
+template<> struct typeinfo_trait<A> { enum { type_id = 0 }; };
+template<> struct typeinfo_trait<B> { enum { type_id = 1 }; };
+template<> struct typeinfo_trait<C> { enum { type_id = 2 }; };
+
+

If you have set up your own RTTI system like this (by using integers to +identify types) you can have luabind use it with the following defines:

+
+#define LUABIND_TYPE_INFO const std::type_info*
+#define LUABIND_TYPEID(t) &typeid(t)
+#define LUABIND_TYPE_INFO_EQUAL(i1, i2) *i1 == *i2
+#define LUABIND_INVALID_TYPE_INFO &typeid(detail::null_type)
+
+

Currently the type given through LUABIND_TYPE_INFO must be less-than +comparable!

+
+
NDEBUG
+
This define will disable all asserts and should be defined in a release +build.
+
+
+
+
+

15   Implementation notes

+

The classes and objects are implemented as user data in Lua. To make sure that +the user data really is the internal structure it is supposed to be, we tag +their metatables. A user data who's metatable contains a boolean member named +__luabind_classrep is expected to be a class exported by luabind. A user +data who's metatable contains a boolean member named __luabind_class is +expected to be an instantiation of a luabind class.

+

This means that if you make your own user data and tags its metatable with the +exact same names, you can very easily fool luabind and crash the application.

+

In the Lua registry, luabind keeps an entry called __luabind_classes. It +should not be removed or overwritten.

+

In the global table, a variable called super is used every time a +constructor in a lua-class is called. This is to make it easy for that +constructor to call its base class' constructor. So, if you have a global +variable named super it may be overwritten. This is probably not the best +solution, and this restriction may be removed in the future.

+

Luabind uses two upvalues for functions that it registers. The first is a +userdata containing a list of overloads for the function, the other is a light +userdata with the value 0x1337, this last value is used to identify functions +registered by luabind. It should be virtually impossible to have such a pointer +as secondary upvalue by pure chance. This means, if you are trying to replace +an existing function with a luabind function, luabind will see that the +secondary upvalue isn't the magic id number and replace it. If it can identify +the function to be a luabind function, it won't replace it, but rather add +another overload to it.

+

Inside the luabind namespace, there's another namespace called detail. This +namespace contains non-public classes and are not supposed to be used directly.

+
+
+

16   Error messages

+
    +
  • +the attribute 'class-name.attribute-name' is read only
    +
    +

    There is no data member named attribute-name in the class class-name, +or there's no setter-method registered on that property name. See the +properties section.

    +
  • +
  • +the attribute 'class-name.attribute-name' is of type: (class-name) and does not match (class_name)
    +
    +

    This error is generated if you try to assign an attribute with a value +of a type that cannot be converted to the attribute's type.

    +
  • +
  • +class-name() threw an exception, class-name:function-name() threw an exception
    +
    +

    The class' constructor or member function threw an unknown exception. +Known exceptions are const char*, std::exception. See the +exceptions section.

    +
  • +
  • +no overload of 'class-name:function-name' matched the arguments (parameter-types)
    +no match for function call 'function-name' with the parameters (parameter-types)
    +no constructor of class-name matched the arguments (parameter-types)
    +no operator operator-name matched the arguments (parameter-types)
    +
    +

    No function/operator with the given name takes the parameters you gave +it. You have either misspelled the function name, or given it incorrect +parameters. This error is followed by a list of possible candidate +functions to help you figure out what parameter has the wrong type. If +the candidate list is empty there's no function at all with that name. +See the signature matching section.

    +
  • +
  • +call of overloaded 'class-name:function-name*(*parameter-types)' is ambiguous
    +ambiguous match for function call 'function-name' with the parameters (parameter-types)
    +call of overloaded constructor 'class-name*(*parameter-types)' is ambiguous
    +call of overloaded operator operator-name (parameter-types) is ambiguous
    +
    +

    This means that the function/operator you are trying to call has at least +one other overload that matches the arguments just as good as the first +overload.

    +
  • +
  • +cannot derive from C++ class 'class-name'. It does not have a wrapped type.
    +
    +
  • +
+
+
+

17   FAQ

+
+
What's up with __cdecl and __stdcall?
+
If you're having problem with functions +that cannot be converted from void (__stdcall *)(int,int) to +void (__cdecl*)(int,int). You can change the project settings to make the +compiler generate functions with __cdecl calling conventions. This is +a problem in developer studio.
+
What's wrong with functions taking variable number of arguments?
+
You cannot register a function with ellipses in its signature. Since +ellipses don't preserve type safety, those should be avoided anyway.
+
Internal structure overflow in VC
+
If you, in visual studio, get fatal error C1204: compiler limit : +internal structure overflow. You should try to split that compilation +unit up in smaller ones.
+
+ +
+
What's wrong with precompiled headers in VC?
+
Visual Studio doesn't like anonymous namespaces in its precompiled +headers. If you encounter this problem you can disable precompiled +headers for the compilation unit (cpp-file) that uses luabind.
+
error C1076: compiler limit - internal heap limit reached in VC
+
In visual studio you will probably hit this error. To fix it you have to +increase the internal heap with a command-line option. We managed to +compile the test suit with /Zm300, but you may need a larger heap then +that.
+
error C1055: compiler limit : out of keys in VC
+
It seems that this error occurs when too many assert() are used in a +program, or more specifically, the __LINE__ macro. It seems to be fixed by +changing /ZI (Program database for edit and continue) to /Zi +(Program database).
+
How come my executable is huge?
+

If you're compiling in debug mode, you will probably have a lot of +debug-info and symbols (luabind consists of a lot of functions). Also, +if built in debug mode, no optimizations were applied, luabind relies on +that the compiler is able to inline functions. If you built in release +mode, try running strip on your executable to remove export-symbols, +this will trim down the size.

+

Our tests suggests that cygwin's gcc produces much bigger executables +compared to gcc on other platforms and other compilers.

+
+
+ +
+
Can I register class templates with luabind?
+

Yes you can, but you can only register explicit instantiations of the +class. Because there's no Lua counterpart to C++ templates. For example, +you can register an explicit instantiation of std::vector<> like this:

+
+module(L)
+[
+    class_<std::vector<int> >("vector")
+        .def(constructor<int>)
+        .def("push_back", &std::vector<int>::push_back)
+];
+
+
+
+ +
+
Do I have to register destructors for my classes?
+

No, the destructor of a class is always called by luabind when an +object is collected. Note that Lua has to own the object to collect it. +If you pass it to C++ and gives up ownership (with adopt policy) it will +no longer be owned by Lua, and not collected.

+

If you have a class hierarchy, you should make the destructor virtual if +you want to be sure that the correct destructor is called (this apply to C++ +in general).

+
+
+ +
+
Fatal Error C1063 compiler limit : compiler stack overflow in VC
+
VC6.5 chokes on warnings, if you are getting alot of warnings from your +code try suppressing them with a pragma directive, this should solve the +problem.
+
Crashes when linking against luabind as a dll in windows
+
When you build luabind, Lua and you project, make sure you link against +the runtime dynamically (as a dll).
+
I cannot register a function with a non-const parameter
+
This is because there is no way to get a reference to a Lua value. Have +a look at out_value and pure_out_value policies.
+
+
+
+

18   Known issues

+
    +
  • You cannot use strings with extra nulls in them as member names that refers +to C++ members.
  • +
  • If one class registers two functions with the same name and the same +signature, there's currently no error. The last registered function will +be the one that's used.
  • +
  • In VC7, classes can not be called test.
  • +
  • If you register a function and later rename it, error messages will use the +original function name.
  • +
  • luabind does not support class hierarchies with virtual inheritance. Casts are +done with static pointer offsets.
  • +
+ +
+
+

19   Acknowledgments

+

Written by Daniel Wallin and Arvid Norberg. © Copyright 2003. +All rights reserved.

+

Evan Wies has contributed with thorough testing, countless bug reports +and feature ideas.

+

This library was highly inspired by Dave Abrahams' Boost.Python library.

+
+
+ + + + diff --git a/_docs/doc LuaBind/docs.rst b/_docs/doc LuaBind/docs.rst new file mode 100644 index 00000000..a21be655 --- /dev/null +++ b/_docs/doc LuaBind/docs.rst @@ -0,0 +1,2393 @@ ++++++++++ + luabind ++++++++++ + +:Author: Daniel Wallin, Arvid Norberg +:Copyright: Copyright Daniel Wallin, Arvid Norberg 2003. +:Date: $Date: 2004/08/07 10:18:10 $ +:Revision: $Revision: 1.19.2.22 $ +:License: Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT + SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE + OR OTHER DEALINGS IN THE SOFTWARE. + + +.. _MIT license: http://www.opensource.org/licenses/mit-license.php +.. _Boost: http://www.boost.org + +Note: This library is currently in public beta phase. This documentation +should be considered beta as well. Please report any grammatical +corrections/spelling corrections. + +.. contents:: + :depth: 2 +.. section-numbering:: + +Introduction +============ + +Luabind is a library that helps you create bindings between C++ and Lua. It has +the ability to expose functions and classes, written in C++, to Lua. It will +also supply the functionality to define classes in Lua and let them derive from +other Lua classes or C++ classes. Lua classes can override virtual functions +from their C++ base classes. It is written towards Lua 5.0, and does not work +with Lua 4. + +It is implemented utilizing template meta programming. That means that you +don't need an extra preprocess pass to compile your project (it is done by the +compiler). It also means you don't (usually) have to know the exact signatureof +each function you register, since the library will generate code depending on +the compile-time type of the function (which includes the signature). The main +drawback of this approach is that the compilation time will increase for the +file that does the registration, it is therefore recommended that you register +everything in the same cpp-file. + +luabind is released under the terms of the `MIT license`_. + +We are very interested in hearing about projects that use luabind, please let +us know about your project. + + +Features +======== + +Luabind supports: + + - Overloaded free functions + - C++ classes in Lua + - Overloaded member functions + - Operators + - Properties + - Enums + - Lua functions in C++ + - Lua classes in C++ + - Lua classes (single inheritance) + - Derives from Lua or C++ classes + - Override virtual functions from C++ classes + - Implicit casts between registered types + - Best match signature matching + - Return value policies and parameter policies + + +Portability +=========== + +Luabind has been tested to work on the following compilers: + + - Visual Studio 7.1 + - Visual Studio 7.0 + - Visual Studio 6.0 (sp 5) + - Intel C++ 6.0 (Windows) + - GCC 2.95.3 (cygwin) + - GCC 3.0.4 (Debian/Linux) + - GCC 3.1 (SunOS 5.8) + - GCC 3.2 (cygwin) + - GCC 3.3.1 (cygwin) + +It has been confirmed not to work with: + + - GCC 2.95.2 (SunOS 5.8) + +Metrowerks 8.3 (Windows) compiles but fails the const-test. This +means that const member functions are treated as non-const member +functions. + +If you have tried luabind with a compiler not listed here, let us know +your result with it. + + +Building luabind +================ + +To keep down the compilation-time luabind is built as a library. This means you +have to either build it and lika against it, or include its source files in +your project. You also have to make sure the luabind directory is somewhere in +your compiler's include path. It requires `Boost`_ 1.31.0 to be installed (only +boost headers). It also requires that Lua is installed. + +The official way of building luabind is with `Boost.Build V2`_. To properly build +luabind with Boost.Build you need to set two environment variables: + +BOOST_ROOT + Point this to your Boost installation. + +LUA_PATH + Point this to your Lua directory. The build system will assume that the + include and library files are located in ``$(LUA_PATH)/include/`` and + ``$(LUA_PATH)/lib/.`` + +For backward compatibility, there is also a makefile in the root-directory that +will build the library and the test program. If you are using a UNIX-system (or +cygwin) they will make it easy to build luabind as a static library. If you are +using Visual Studio it may be easier to include the files in the src directory +in your project. + +When building luabind you have several options that may streamline the library +to better suit your needs. It is extremely important that your application has +the same settings as the library was built with. The available options are +found in the `Configuration`_ section. + +If you want to change the settings to differ from the default, it's recommended +that you define the settings on the commandline of all your files (in the +project settings in visual studio). + +.. _`Boost.Build V2`: http://www.boost.org/tools/build/v2/index_v2.html + + +Basic usage +=========== + +To use luabind, you must include ``lua.h`` and luabind's main header file:: + + extern "C" + { + #include "lua.h" + } + + #include + +This includes support for both registering classes and functions. If you just +want to have support for functions or classes you can include +``luabind/function.hpp`` and ``luabind/class.hpp`` separately:: + + #include + #include + +The first thing you need to do is to call ``luabind::open(lua_State*)`` which +will register the functions to create classes from Lua, and initialize some +state-global structures used by luabind. If you don't call this function you +will hit asserts later in the library. There is no corresponding close function +because once a class has been registered in Lua, there really isn't any good +way to remove it. Partly because any remaining instances of that class relies +on the class being there. Everything will be cleaned up when the state is +closed though. + +.. Isn't this wrong? Don't we include lua.h using lua_include.hpp ? + +Luabind's headers will never include ``lua.h`` directly, but through +````. If you for some reason need to include another +Lua header, you can modify this file. + + +Hello world +----------- + +:: + + #include + #include + + void greet() + { + std::cout << "hello world!\n"; + } + + extern "C" int init(lua_State* L) + { + using namespace luabind; + + open(L); + + module(L) + [ + def("greet", &greet) + ]; + + return 0; + } + +:: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > loadlib('hello_world.dll', 'init')() + > greet() + Hello world! + > + +Scopes +====== + +Everything that gets registered in Lua is registered in a namespace (Lua +tables) or in the global scope (called module). All registrations must be +surrounded by its scope. To define a module, the ``luabind::module`` class is +used. It is used like this:: + + module(L) + [ + // declarations + ]; + +This will register all declared functions or classes in the global namespace in +Lua. If you want to have a namespace for your module (like the standard +libraries) you can give a name to the constructor, like this:: + + module(L, "my_library") + [ + // declarations + ]; + +Here all declarations will be put in the my_library table. + +If you want nested namespaces you can use the ``luabind::namespace_`` class. It +works exactly as ``luabind::module`` except that it doesn't take a lua_State* +in it's constructor. An example of its usage could look like this:: + + module(L, "my_library") + [ + // declarations + + namespace_("detail") + [ + // library-private declarations + ] + ]; + +As you might have figured out, the following declarations are equivalent:: + + module(L) + [ + namespace_("my_library") + [ + // declarations + ] + + ]; + +:: + + module(L, "my_library") + [ + // declarations + ]; + +Each declaration must be separated by a comma, like this:: + + module(L) + [ + def("f", &f), + def("g", &g), + class_("A") + .def(constructor), + def("h", &h) + ]; + + +More about the actual declarations in the `Binding functions to Lua`_ and +`Binding classes to Lua`_ sections. + +A word of caution, if you are in really bad need for performance, putting your +functions in tables will increase the lookup time. + + +Binding functions to Lua +======================== + +To bind functions to Lua you use the function ``luabind::def()``. It has the +following synopsis:: + + template + void def(const char* name, F f, const Policies&); + +- name is the name the function will have within Lua. +- F is the function pointer you want to register. +- The Policies parameter is used to describe how parameters and return values + are treated by the function, this is an optional parameter. More on this in + the `policies`_ section. + +An example usage could be if you want to register the function ``float +std::sin(float)``:: + + module(L) + [ + def("sin", &std::sin) + ]; + +Overloaded functions +-------------------- + +If you have more than one function with the same name, and want to register +them in Lua, you have to explicitly give the signature. This is to let C++ know +which function you refer to. For example, if you have two functions, ``int +f(const char*)`` and ``void f(int)``. :: + + module(L) + [ + def("f", (int(*)(const char*)) &f), + def("f", (void(*)(int)) &f) + ]; + +Signature matching +------------------ + +luabind will generate code that checks the Lua stack to see if the values there +can match your functions' signatures. It will handle implicit typecasts between +derived classes, and it will prefer matches with the least number of implicit +casts. In a function call, if the function is overloaded and there's no +overload that match the parameters better than the other, you have an +ambiguity. This will spawn a run-time error, stating that the function call is +ambiguous. A simple example of this is to register one function that takes an +int and one that takes a float. Since Lua don't distinguish between floats and +integers, both will always match. + +Since all overloads are tested, it will always find the best match (not the +first match). This also means that it can handle situations where the only +difference in the signature is that one member function is const and the other +isn't. + +.. sidebar:: Ownership transfer + + To correctly handle ownership transfer, create_a() would need an adopt + return value policy. More on this in the `Policies`_ section. + +For example, if the following function and class is registered: + +:: + + struct A + { + void f(); + void f() const; + }; + + const A* create_a(); + + struct B: A {}; + struct C: B {}; + + void g(A*); + void g(B*); + +And the following Lua code is executed:: + + a1 = create_a() + a1:f() -- the const version is called + + a2 = A() + a2:f() -- the non-const version is called + + a = A() + b = B() + c = C() + + g(a) -- calls g(A*) + g(b) -- calls g(B*) + g(c) -- calls g(B*) + + +Calling Lua functions +--------------------- + +To call a Lua function, you can either use ``call_function()``, +an ``object`` or ``functor``. + +:: + + template + Ret call_function(lua_State* L, const char* name, ...) + template + Ret call_function(object const& obj, ...) + +There are two overloads of the ``call_function`` function, one that calls +a function given its name, and one that takes an object that should be a Lua +value that can be called as a function. + +The overload that takes a name can only call global Lua functions. The ... +represents a variable number of parameters that are sent to the Lua +function. This function call may throw ``luabind::error`` if the function +call fails. + +The return value isn't actually Ret (the template parameter), but a proxy +object that will do the function call. This enables you to give policies to the +call. You do this with the operator[]. You give the policies within the +brackets, like this:: + + int ret = call_function( + L + , "a_lua_function" + , new complex_class() + )[ adopt(_1) ]; + +If you want to pass a parameter as a reference, you have to wrap it with the +`Boost.Ref`__. + +__ http://www.boost.org/doc/html/ref.html + +Like this:: + + int ret = call_function(L, "fun", boost::ref(val)); + + +Using Lua threads +----------------- + +To start a Lua thread, you have to call ``lua_resume()``, this means that you +cannot use the previous function ``call_function()`` to start a thread. You have +to use + +:: + + template + Ret resume_function(lua_State* L, const char* name, ...) + template + Ret resume_function(object const& obj, ...) + +and + +:: + + template + Ret resume(lua_State* L, ...) + +The first time you start the thread, you have to give it a function to execute. i.e. you +have to use ``resume_function``, when the Lua function yeilds, it will return the first +value passed in to ``lua_yield()``. When you want to continue the execution, you just call +``resume()`` on your ``lua_State``, since it's already executing a function, you don't pass +it one. The parameters to ``resume()`` will be returned by ``yield()`` on the Lua side. + +For yielding C++-functions (without the support of passing data back and forth between the +Lua side and the c++ side), you can use the yield_ policy. + +With the overload of ``resume_function`` that takes an object_, it is important that the +object was constructed with the thread as its ``lua_State*``. Like this: + +.. parsed-literal:: + + lua_State* thread = lua_newthread(L); + object fun = get_global(**thread**)["my_thread_fun"]; + resume_function(fun); + + +Binding classes to Lua +====================== + +To register classes you use a class called ``class_``. Its name is supposed to +resemble the C++ keyword, to make it look more intuitive. It has an overloaded +member function ``def()`` that is used to register member functions, operators, +constructors, enums and properties on the class. It will return its +this-pointer, to let you register more members directly. + +Let's start with a simple example. Consider the following C++ class:: + + class testclass + { + public: + testclass(const std::string& s): m_string(s) {} + void print_string() { std::cout << m_string << "\n"; } + + private: + std::string m_string; + }; + +To register it with a Lua environment, write as follows (assuming you are using +namespace luabind):: + + module(L) + [ + class_("testclass") + .def(constructor()) + .def("print_string", &testclass::print_string) + ]; + +This will register the class with the name testclass and constructor that takes +a string as argument and one member function with the name ``print_string``. + +:: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > a = testclass('a string') + > a:print_string() + a string + +It is also possible to register free functions as member functions. The +requirement on the function is that it takes a pointer, const pointer, +reference or const reference to the class type as the first parameter. The rest +of the parameters are the ones that are visible in Lua, while the object +pointer is given as the first parameter. If we have the following C++ code:: + + struct A + { + int a; + }; + + int plus(A* o, int v) { return o->a + v; } + +You can register ``plus()`` as if it was a member function of A like this:: + + class_("A") + .def("plus", &plus) + +``plus()`` can now be called as a member function on A with one parameter, int. +If the object pointer parameter is const, the function will act as if it was a +const member function (it can be called on const objects). + + +Properties +---------- + +To register a global data member with a class is easily done. Consider the +following class:: + + struct A + { + int a; + }; + +This class is registered like this:: + + module(L) + [ + class_("A") + .def_readwrite("a", &A::a) + ]; + +This gives read and write access to the member variable ``A::a``. It is also +possible to register attributes with read-only access:: + + module(L) + [ + class_("A") + .def_readonly("a", &A::a) + ]; + +You can also register getter and setter functions and make them look as if they +were a public data member. Consider the following class:: + + class A + { + public: + void set_a(int x) { a = x; } + int get_a() const { return a; } + + private: + int a; + }; + +It can be registered as if it had a public data member a like this:: + + class_("A") + .property("a", &A::get_a, &A::set_a) + +This way the ``get_a()`` and ``set_a()`` functions will be called instead of +just writing to the data member. If you want to make it read only you can just +omit the last parameter. + + +Enums +----- + +If your class contains enumerated constants (enums), you can register them as +well to make them available in Lua. Note that they will not be type safe, all +enums are integers in Lua, and all functions that takes an enum, will accept +any integer. You register them like this:: + + module(L) + [ + class_("A") + .enum_("constants") + [ + value("my_enum", 4), + value("my_2nd_enum", 7), + value("another_enum", 6) + ] + ]; + +In Lua they are accessed like any data member, except that they are read-only +and reached on the class itself rather than on an instance of the class. + +:: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > print(A.my_enum) + 4 + > print(A.another_enum) + 6 + + +Operators +--------- + +The mechanism for registering operators on your class is pretty simple. You use +a global name ``luabind::self`` to refer to the class itself and then you just +write the operator expression inside the ``def()`` call. This class:: + + struct vec + { + vec operator+(int s); + }; + +Is registered like this: + +.. parsed-literal:: + + module(L) + [ + class_("vec") + .def(**self + int()**) + ]; + +This will work regardless if your plus operator is defined inside your class or +as a free function. + +If you operator is const (or, when defined as a free function, takes a const +reference to the class itself) you have to use ``const_self`` instead of +``self``. Like this: + +.. parsed-literal:: + + module(L) + [ + class_("vec") + .def(**const_self** + int()) + ]; + +The operators supported are those available in Lua: + +.. parsed-literal:: + + + - \* / == != < <= > >= + +This means, no in-place operators. The equality operator (``==``) has a little +hitch; it will not be called if the references are equal. This means that the +``==`` operator has to do pretty much what's it's expected to do. + +In the above example the other operand type is instantiated by writing +``int()``. If the operand type is a complex type that cannot easily be +instantiated you can wrap the type in a class called ``other<>``. For example: + +To register this class, we don't want to instantiate a string just to register +the operator. + +:: + + struct vec + { + vec operator+(std::string); + }; + +Instead we use the ``other<>`` wrapper like this: + +.. parsed-literal:: + + module(L) + [ + class_("vec") + .def(self + **other()**) + ]; + +To register an application operator: + +.. parsed-literal:: + + module(L) + [ + class_("vec") + .def( **self(int())** ) + ]; + +There's one special operator. In Lua it's called ``__tostring``, it's not +really an operator. It is used for converting objects to strings in a standard +way in Lua. If you register this functionality, you will be able to use the lua +standard function ``tostring()`` for converting you object to a string. + +To implement this operator in C++ you should supply an ``operator<<`` for +ostream. Like this example: + +.. parsed-literal:: + + class number {}; + std::ostream& operator<<(std::ostream&, number&); + + ... + + module(L) + [ + class_("number") + .def(**tostring(self)**) + ]; + + +Nested scopes and static functions +---------------------------------- + +It is possible to add nested scopes to a class. This is useful when you need +to wrap a nested class, or a static function. + +.. parsed-literal:: + + class_("foo") + .def(constructor<>() + **.scope + [ + class_("nested"), + def("f", &f) + ]**; + +It's also possible to add namespaces to classes using the same syntax. + + +Derived classes +--------------- + +If you want to register classes that derives from other classes, you can +specify a template parameter ``bases<>`` to the ``class_`` instantiation. The +following hierarchy:: + + struct A {}; + struct B : A {}; + +Would be registered like this:: + + module(L) + [ + class_("A"), + class_("B") + ]; + +If you have multiple inheritance you can specify more than one base. If B would +also derive from a class C, it would be registered like this:: + + module(L) + [ + class_ >("B") + ]; + +Note that you can omit ``bases<>`` when using single inheritance. + +.. note:: + If you don't specify that classes derive from each other, luabind will not + be able to implicitly cast pointers between the types. + + +Smart pointers +-------------- + +When you register a class you can tell luabind that all instances of that class +should be held by some kind of smart pointer (boost::shared_ptr for instance). +You do this by giving the holder type as an extra template parameter to +the ``class_`` you are constructing, like this:: + + module(L) + [ + class_ >("A") + ]; + +You also have to supply two functions for your smart pointer. One that returns +the type of const version of the smart pointer type (boost::shared_ptr +in this case). And one function that extracts the raw pointer from the smart +pointer. The first function is needed because luabind has to allow the +non-const -> conversion when passing values from Lua to C++. The second +function is needed when Lua calls member functions on held types, the this +pointer must be a raw pointer, it is also needed to allow the smart_pointer -> +raw_pointer conversion from Lua to C++. They look like this:: + + namespace luabind { + + template + T* get_pointer(boost::shared_ptr const& p) + { + return p.get(); + } + + template + boost::shared_ptr* + get_const_holder(boost::shared_ptr*) + { + return 0; + } + } + +The conversion that works are (given that B is a base class of A): + +.. topic:: From Lua to C++ + + ========================= ======================== + Source Target + ========================= ======================== + ``holder_type`` ``A*`` + ``holder_type`` ``B*`` + ``holder_type`` ``A const*`` + ``holder_type`` ``B const*`` + ``holder_type`` ``holder_type`` + ``holder_type`` ``holder_type`` + ``holder_type`` ``A const*`` + ``holder_type`` ``B const*`` + ``holder_type`` ``holder_type`` + ========================= ======================== + +.. topic:: From C++ to Lua + + =============================== ======================== + Source Target + =============================== ======================== + ``holder_type`` ``holder_type`` + ``holder_type`` ``holder_type`` + ``holder_type const&`` ``holder_type`` + ``holder_type const&`` ``holder_type`` + =============================== ======================== + +When using a holder type, it can be useful to know if the pointer is valid. For +example when using std::auto_ptr, the holder will be invalidated when passed as +a parameter to a function. For this purpose there is a member of all object +instances in luabind: ``__ok``. :: + + struct X {}; + void f(std::auto_ptr); + + module(L) + [ + class_ >("X") + .def(constructor<>()), + + def("f", &f) + ]; + +:: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > a = X() + > f(a) + > print a.__ok + false + + +Object +====== + +Since functions have to be able to take Lua values (of variable type) we need a +wrapper around them. This wrapper is called ``luabind::object``. If the +function you register takes an object, it will match any Lua value. To use it, +you need to include ``luabind/object.hpp``. + +.. topic:: Synopsis + + .. parsed-literal:: + + class object + { + public: + class iterator; + class raw_iterator; + class array_iterator; + + template + object(lua_State\*, T const& value); + object(object const&); + object(lua_State\*); + object(); + + ~object(); + + iterator begin() const; + iterator end() const; + raw_iterator raw_begin() const; + raw_iterator raw_end() const; + array_iterator abegin() const; + array_iterator aend() const; + + void set(); + lua_State\* lua_state() const; + void pushvalue() const; + bool is_valid() const; + operator safe_bool_type() const; + + template + *implementation-defined* operator[](Key const&); + + template + object at(Key const&) const; + + template + object raw_at(Key const&) const; + + template + object& operator=(T const&); + object& operator=(object const&); + + template + bool operator==(T const&) const; + bool operator==(object const&) const; + bool operator<(object const&) const; + bool operator<=(object const&) const; + bool operator>(object const&) const; + bool operator>=(object const&) const; + bool operator!=(object const&) const; + + void swap(object&); + int type() const; + + *implementation-defined* operator()(); + + template + *implementation-defined* operator()(A0 const& a0); + + template + *implementation-defined* operator()(A0 const& a0, A1 const& a1); + + /\* ... \*/ + }; + +When you have a Lua object, you can assign it a new value with the assignment +operator (=). When you do this, the ``default_policy`` will be used to make the +conversion from C++ value to Lua. If your ``luabind::object`` is a table you +can access its members through the operator[] or the iterators. The value +returned from the operator[] is a proxy object that can be used both for +reading and writing values into the table (using operator=). Note that it is +impossible to know if a Lua value is indexable or not (lua_gettable doesn't +fail, it succeeds or crashes). This means that if you're trying to index +something that cannot be indexed, you're on your own. Lua will call its +``panic()`` function (you can define your own panic function using +``lua_setpanicf``). The ``at()`` and ``raw_at()`` functions returns the value at +the given table position (like operator[] but only for reading). + +The ordinary ``object::iterator`` uses lua_gettable to extract the values from +the table, the standard way that will invoke metamethods if any. The +``object::raw_iterator`` uses lua_rawget and ``object::array_iterator`` uses +lua_rawgeti. The latter will only iterate over numberical keys starting at 1 +and continue until the first nil value. + +The ``lua_state()`` function returns the Lua state where this object is stored. +If you want to manipulate the object with Lua functions directly you can push +it onto the Lua stack by calling ``pushvalue()``. And set the object's value by +calling ``set()``, which will pop the top value from the Lua stack and assign +it to the object. + +The operator== will call lua_equal() on the operands and return its result. + +The ``type()`` member function will return the Lua type of the object. It will +return the same values as lua_type(). + +The ``is_valid()`` function tells you whether the object has been initialized +or not. When created with its default constructor, objects are invalid. To make +an object valid, you can assign it a value. If you want to invalidate an object +you can simply assign it an invalid object. + +.. So what? implementation detail, leave out of docs + isn't really an implicit cast to bool, but an implicit cast + to a member pointer, since member pointers don't have any arithmetic operators + on them (which can cause hard to find errors). The functionality of the cast + operator + +The ``operator safe_bool_type()`` is equivalent to ``is_valid()``. This means +that these snippets are equivalent:: + + object o; + // ... + if (o) + { + // ... + } + + ... + + object o; + // ... + if (o.is_valid()) + { + // ... + } + +The application operator will call the value as if it was a function. You can +give it any number of parameters (currently the ``default_policy`` will be used +for the conversion). The returned object refers to the return value (currently +only one return value is supported). This operator may throw ``luabind::error`` +if the function call fails. If you want to specify policies to your function +call, you can use index-operator (operator[]) on the function call, and give +the policies within the [ and ]. Like this:: + + my_function_object( + 2 + , 8 + , new my_complex_structure(6) + ) [ adopt(_3) ]; + +This tells luabind to make Lua adopt the ownership and responsibility for the +pointer passed in to the lua-function. + +It's important that all instances of object have been destructed by the time +the Lua state is closed. The object will keep a pointer to the lua state and +release its Lua object in its destructor. + +Here's an example of how a function can use a table:: + + void my_function(const object& table) + { + if (table.type() == LUA_TTABLE) + { + table["time"] = std::clock(); + table["name"] = std::rand() < 500 ? "unusual" : "usual"; + + std::cout << object_cast(table[5]) << "\n"; + } + } + +If you take a ``luabind::object`` as a parameter to a function, any Lua value +will match that parameter. That's why we have to make sure it's a table before +we index into it. + + +Iterators +--------- + +The iterators, that are returned by ``begin()`` and ``end()`` (and their +variants) are (almost) models of the ForwardIterator concept. The exception +is that post increment doesn't exist on them. + +They look like this + +.. parsed-literal:: + + class object::iterator + { + iterator(); + iterator(const iterator&); + + iterator& operator++(); + bool operator!=(const iterator&) const; + iterator& operator=(const iterator&); + + object key() const; + + *implementation-defined* operator*(); + }; + +The implementation defined return value from the dereference operator is a +proxy object that can be used as if it was an object, it can also be used to +assign the specific table entry with a new value. If you want to assign a value +to an entry pointed to by an iterator, just use the assignment operator on the +dereferenced iterator:: + + *iter = 5; + +The ``key()`` member returns the key used by the iterator when indexing the +associated Lua table. + + +Related functions +----------------- + +There are a couple of functions related to objects and tables. :: + + T object_cast(object const&); + T object_cast(object const&, Policies); + + boost::optional object_cast_nothrow(object const&); + boost::optional object_cast_nothrow(object const&, Policies); + + +Functor +------- + +The ``functor`` class is similar to object, with the exception that it can only +be used to store functions. If you take it as a parameter, it will only match +functions. + +To use it you need to include its header:: + + #include + +It takes one template parameter, the return value of the Lua function it +represents. Currently the functor can have at most one return value (unlike Lua +functions). + +.. topic:: Synopsis + + .. parsed-literal:: + + template + class functor + { + public: + + functor(lua_State\*, char const* name); + functor(functor const&); + ~functor(); + + bool is_valid() const; + operator safe_bool_type() const; + void reset(); + + lua_State\* lua_state() const; + void pushvalue() const; + + bool operator==(functor const&); + bool operator!=(functor const&); + + *implementation-defined* operator()() const; + + template + *implementation-defined* operator()(A0 const&) const; + + template + *implementation-defined* operator()(A0 const&, A1 const&) const; + + /\* ... \*/ + }; + +The application operator takes any parameters. The parameters are converted +into Lua and the function is called. The return value will act as if it was the +type Ret, with the exception that you can use the return value to give policies +to the call. You do this the same way as you do with objects, using the +operator[], and giving the policies inside the brackets. + +The ``is_valid()`` function works just like the one on object, it tells you if +the functor has been assigned with a valid Lua function. The ``operator +safe_bool_type()`` is an alias for this member function and also works just as +the one found in object. + +For example, if you have the following Lua function:: + + function f(a, b) + return a + b + end + +You can expose it to C++ like this:: + + functor f(L, "f"); + + std::cout << f(3, 5) << "\n"; + +This will print out the sum of 3 and 5. Note that you can pass any parameters +to the application operator of ``luabind::functor``, this is because lua +doesn't have signatures for its functions. All Lua functions take any number of +parameters of any type. + +If we have a C++ function that takes a ``luabind::functor`` and registers it, +it will accept Lua functions passed to it. This enables us to expose APIs that +requires you to register callbacks. For example, if your C++ API looks like +this:: + + void set_callback(void(*)(int, int)); + +And you want to expose it to Lua, you have to wrap the call to the Lua +function inside a real C++ function, like this:: + + functor lua_callback; + + void callback_wrapper(int a, int b) + { + lua_callback(a, b); + } + + void set_callback_wrapper(const functor& f) + { + lua_callback = f; + set_callback(&callback_wrapper); + } + +And then register ``set_callback_wrapper`` instead of registering +``set_callback``. This will have the effect that when one tries to register the +callback from Lua, your ``set_callback_wrapper`` will be called instead and +first set the Lua functor to the given function. It will then call the real +``set_callback`` with the ``callback_wrapper``. The ``callback_wrapper`` will +be called whenever the callback should be called, and it will simply call the +Lua function that we registered. + +You can also use ``object_cast`` to cast an object to a functor. + +``reset`` on ``functor`` will invalidate the functor (and remove any references +to its Lua value). If the functor object has longer lifetime than the lua state +(e.g. if it's a global). + + +Defining classes in Lua +======================= + +In addition to binding C++ functions and classes with Lua, luabind also provide +an OO-system in Lua. :: + + class 'lua_testclass' + + function lua_testclass:__init(name) + self.name = name + end + + function lua_testclass:print() + print(self.name) + end + + a = lua_testclass('example') + a:print() + + +Inheritance can be used between lua-classes:: + + class 'derived' (lua_testclass) + + function derived:__init() super('derived name') + end + + function derived:print() + print('Derived:print() -> ') + lua_testclass.print(self) + end + +Here the ``super`` keyword is used in the constructor to initialize the base +class. The user is required to call ``super`` first in the constructor. + +As you can see in this example, you can call the base class member functions. +You can find all member functions in the base class, but you will have to give +the this-pointer (``self``) as first argument. + + +Deriving in lua +--------------- + +It is also possible to derive Lua classes from C++ classes, and override +virtual functions with Lua functions. To do this we have to create a wrapper +class for our C++ base class. This is the class that will hold the Lua object +when we instantiate a Lua class. + +:: + + class base + { + public: + base(const char* s) + { std::cout << s << "\n"; } + + virtual void f(int a) + { std::cout << "f(" << a << ")\n"; } + }; + + struct base_wrapper : base, luabind::wrap_base + { + base_wrapper(const char* s) + : base(s) + {} + + virtual void f(int a) + { + call("f", a); + } + + static void default_f(base_wraper* ptr, int a) + { + return ptr->base::f(a); + } + }; + + ... + + module(L) + [ + class_("base") + .def(constructor()) + .def("f", &base_wrapper::f, &base_wrapper::default_f) + ]; + +.. Important:: + Since visual studio 6.5 doesn't support explicit template parameters + to member functions, instead of using the member function ``call()`` + you call a free function ``call_member()`` and pass the this-pointer + as first parameter. + +Note that if you have both base classes and a base class wrapper, you must give +both bases and the base class wrapper type as template parameter to +``class_`` (as done in the example above). The order in which you specify +them is not important. You must also register both the static version and the +virtual version of the function from the wrapper, this is necessary in order +to allow luabind to use both dynamic and static dispatch when calling the function. + +.. Important:: + It is extremely important that the signatures of the static (default) function + is identical to the virtual function. The fact that onw of them is a free + function and the other a member function doesn't matter, but the parameters + as seen from lua must match. It would not have worked if the static function + took a ``base*`` as its first argument, since the virtual function takes a + ``base_wrapper*`` as its first argument (its this pointer). There's currently + no check in luabind to make sure the signatures match. + +If we didn't have a class wrapper, it would not be possible to pass a Lua class +back to C++. Since the entry points of the virtual functions would still point +to the C++ base class, and not to the functions defined in Lua. That's why we +need one function that calls the base class' real function (used if the lua +class doesn't redefine it) and one virtual function that dispatches the call +into luabind, to allow it to select if a Lua function should be called, or if +the original function should be called. If you don't intend to derive from a +C++ class, or if it doesn't have any virtual member functions, you can register +it without a class wrapper. + +You don't need to have a class wrapper in order to derive from a class, but if +it has virtual functions you may have silent errors. + +.. Unnecessary? The rule of thumb is: + If your class has virtual functions, create a wrapper type, if it doesn't + don't create a wrapper type. + +The wrappers must derive from ``luabind::wrap_base``, it contains a Lua reference +that will hold the Lua instance of the object to make it possible to dispatch +virtual function calls into Lua. This is done through an overloaded member function:: + + template + Ret call(char const* name, ...) + +Its used in a similar way as ``call_function``, with the exception that it doesn't +take a ``lua_State`` pointer, and the name is a member function in the Lua class. + +.. warning:: + + The current implementation of ``call_member`` is not able to distinguish const + member functions from non-const. If you have a situation where you have an overloaded + virtual function where the only difference in their signatures is their constness, the + wrong overload will be called by ``call_member``. This is rarely the case though. + +Object identity +~~~~~~~~~~~~~~~ + +When a pointer or reference to a registered class with a wrapper is passed +to Lua, luabind will query for it's dynamic type. If the dynamic type +inherits from ``wrap_base``, object identity is preserved. + +:: + + struct A { .. }; + struct A_wrap : A, wrap_base { .. }; + + A* f(A* ptr) { return ptr; } + + module(L) + [ + class_("A"), + def("f", &f) + ]; + +:: + + > class 'B' (A) + > x = B() + > assert(x == f(x)) -- object identity is preserved when object is + -- passed through C++ + +This functionality relies on RTTI being enabled (that ``LUABIND_NO_RTTI`` is +not defined). + +Overloading operators +--------------------- + +You can overload most operators in Lua for your classes. You do this by simply +declaring a member function with the same name as an operator (the name of the +metamethods in Lua). The operators you can overload are: + + - ``__add`` + - ``__sub`` + - ``__mul`` + - ``__div`` + - ``__pow`` + - ``__lt`` + - ``__le`` + - ``__eq`` + - ``__call`` + - ``__unm`` + - ``__tostring`` + +``__tostring`` isn't really an operator, but it's the metamethod that is called +by the standard library's ``tostring()`` function. There's one strange behavior +regarding binary operators. You are not guaranteed that the self pointer you +get actually refers to an instance of your class. This is because Lua doesn't +distinguish the two cases where you get the other operand as left hand value or +right hand value. Consider the following examples:: + + class 'my_class' + + function my_class:__init(v) + self.val = v + end + + function my_class:__sub(v) + return my_class(self.val - v.val) + end + + function my_class:__tostring() + return self.val + end + +This will work well as long as you only subtracts instances of my_class with +each other. But If you want to be able to subtract ordinary numbers from your +class too, you have to manually check the type of both operands, including the +self object. :: + + function my_class:__sub(v) + if (type(self) == 'number') then + return my_class(self - v.val) + + elseif (type(v) == 'number') then + return my_class(self.val - v) + + else + -- assume both operands are instances of my_class + return my_class(self.val - v.val) + + end + end + +The reason why ``__sub`` is used as an example is because subtraction is not +commutative (the order of the operands matter). That's why luabind cannot +change order of the operands to make the self reference always refer to the +actual class instance. + +If you have two different Lua classes with an overloaded operator, the operator +of the right hand side type will be called. If the other operand is a C++ class +with the same operator overloaded, it will be prioritized over the Lua class' +operator. If none of the C++ overloads matches, the Lua class operator will be +called. + + +Finalizers +---------- + +If an object needs to perform actions when it's collected we provide a +``__finalize`` function that can be overridden in lua-classes. The +``__finalize`` functions will be called on all classes in the inheritance +chain, starting with the most derived type. :: + + ... + + function lua_testclass:__finalize() + -- called when the an object is collected + end + + +Slicing +------- + +If your lua C++ classes don't have wrappers (see `Deriving in lua`_) and +you derive from them in lua, they may be sliced. Meaning, if an object +is passed into C++ as a pointer to its base class, the lua part will be +separated from the C++ base part. This means that if you call virtual +functions on that C++ object, thyey will not be dispatched to the lua +class. It also means that if you adopt the object, the lua part will be +garbage collected. + +:: + + +--------------------+ + | C++ object | <- ownership of this part is transferred + | | to c++ when adopted + +--------------------+ + | lua class instance | <- this part is garbage collected when + | and lua members | instance is adopted, since it cannot + +--------------------+ be held by c++. + + +The problem can be illustrated by this example:: + + struct A {}; + + A* filter_a(A* a) { return a; } + void adopt_a(A* a) { delete a; } + + +:: + + using namespace luabind; + + module(L) + [ + class_("A"), + def("filter_a", &filter_a), + def("adopt_a", &adopt_a, adopt(_1)) + ] + + +In lua:: + + a = A() + b = filter_a(a) + adopt_a(b) + +In this example, lua cannot know that ``b`` actually is the same object as +``a``, and it will therefore consider the object to be owned by the C++ side. +When the ``b`` pointer then is adopted, a runtime error will be raised because +an object not owned by lua is being adopted to C++. + +If you have a wrapper for your class, none of this will happen, see +`Object identity`_. + + +Exceptions +========== + +If any of the functions you register throws an exception when called, that +exception will be caught by luabind and converted to an error string and +``lua_error()`` will be invoked. If the exception is a ``std::exception`` or a +``const char*`` the string that is pushed on the Lua stack, as error message, +will be the string returned by ``std::exception::what()`` or the string itself +respectively. If the exception is unknown, a generic string saying that the +function threw an exception will be pushed. + +Exceptions thrown from user defined functions have to be caught by luabind. If +they weren't they would be thrown through Lua itself, which is usually compiled +as C code and doesn't support the stack-unwinding that exceptions imply. + +Any function that invokes Lua code may throw ``luabind::error``. This exception +means that a Lua run-time error occurred. The error message is found on top of +the Lua stack. The reason why the exception doesn't contain the error string +itself is because it would then require heap allocation which may fail. If an +exception class throws an exception while it is being thrown itself, the +application will be terminated. + +Error's synopsis is:: + + class error : public std::exception + { + public: + error(lua_State*); + lua_State* state() const throw(); + virtual const char* what() const throw(); + }; + +The state function returns a pointer to the Lua state in which the error was +thrown. This pointer may be invalid if you catch this exception after the lua +state is destructed. If the Lua state is valid you can use it to retrieve the +error message from the top of the Lua stack. + +An example of where the Lua state pointer may point to an invalid state +follows:: + + struct lua_state + { + lua_state(lua_State* L): m_L(L) {} + ~lua_state() { lua_close(m_L); } + operator lua_State*() { return m_L; } + lua_State* m_L; + }; + + int main() + { + try + { + lua_state L = lua_open(); + /* ... */ + } + catch(luabind::error& e) + { + lua_State* L = e.state(); + // L will now point to the destructed + // Lua state and be invalid + /* ... */ + } + } + +There's another exception that luabind may throw: ``luabind::cast_failed``, +this exception is thrown from ``call_function<>``, ``call_member<>`` or when +``functor<>`` is invoked. It means that the return value from the Lua function +couldn't be converted to a C++ value. It is also thrown from ``object_cast<>`` +if the cast cannot be made. + +The synopsis for ``luabind::cast_failed`` is:: + + class cast_failed : public std::exception + { + public: + cast_failed(lua_State*); + lua_State* state() const throw(); + LUABIND_TYPE_INFO info() const throw(); + virtual const char* what() const throw(); + }; + +Again, the state member function returns a pointer to the Lua state where the +error occurred. See the example above to see where this pointer may be invalid. + +The info member function returns the user defined ``LUABIND_TYPE_INFO``, which +defaults to a ``const std::type_info*``. This type info describes the type that +we tried to cast a Lua value to. + +If you have defined ``LUABIND_NO_EXCEPTIONS`` none of these exceptions will be +thrown, instead you can set two callback functions that are called instead. +These two functions are only defined if ``LUABIND_NO_EXCEPTIONS`` are defined. + +:: + + luabind::set_error_callback(void(*)(lua_State*)) + +The function you set will be called when a runtime-error occur in Lua code. You +can find an error message on top of the Lua stack. This function is not +expected to return, if it does luabind will call ``std::terminate()``. + +:: + + luabind::set_cast_failed_callback(void(*)(lua_State*, LUABIND_TYPE_INFO)) + +The function you set is called instead of throwing ``cast_failed``. This function +is not expected to return, if it does luabind will call ``std::terminate()``. + + +Policies +======== + +Sometimes it is necessary to control how luabind passes arguments and return +value, to do this we have policies. All policies use an index to associate +them with an argument in the function signature. These indices are ``result`` +and ``_N`` (where ``N >= 1``). When dealing with member functions ``_1`` refers +to the ``this`` pointer. + +.. contents:: Policies currently implemented + :local: + :depth: 1 + +.. include:: adopt.rst +.. include:: dependency.rst +.. include:: out_value.rst +.. include:: pure_out_value.rst +.. include:: return_reference_to.rst +.. include:: copy.rst +.. include:: discard_result.rst +.. include:: return_stl_iterator.rst +.. include:: raw.rst +.. include:: yield.rst + +.. old policies section + =================================================== + + Copy + ---- + + This will make a copy of the parameter. This is the default behavior when + passing parameters by-value. Note that this can only be used when passing from + C++ to Lua. This policy requires that the parameter type has a copy + constructor. + + To use this policy you need to include ``luabind/copy_policy.hpp``. + + + Adopt + ----- + + This will transfer ownership of the parameter. + + Consider making a factory function in C++ and exposing it to lua:: + + base* create_base() + { + return new base(); + } + + ... + + module(L) + [ + def("create_base", create_base) + ]; + + Here we need to make sure Lua understands that it should adopt the pointer + returned by the factory-function. This can be done using the adopt-policy. + + :: + + module(L) + [ + def(L, "create_base", adopt(return_value)) + ]; + + To specify multiple policies we just separate them with '+'. + + :: + + base* set_and_get_new(base* ptr) + { + base_ptrs.push_back(ptr); + return new base(); + } + + module(L) + [ + def("set_and_get_new", &set_and_get_new, + adopt(return_value) + adopt(_1)) + ]; + + When Lua adopts a pointer, it will call delete on it. This means that it cannot + adopt pointers allocated with another allocator than new (no malloc for + example). + + To use this policy you need to include ``luabind/adopt_policy.hpp``. + + + Dependency + ---------- + + The dependency policy is used to create life-time dependencies between values. + Consider the following example:: + + struct A + { + B member; + + const B& get_member() + { + return member; + } + }; + + When wrapping this class, we would do something like:: + + module(L) + [ + class_("A") + .def(constructor<>()) + .def("get_member", &A::get_member) + ]; + + + However, since the return value of get_member is a reference to a member of A, + this will create some life-time issues. For example:: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + a = A() + b = a:get_member() -- b points to a member of a + a = nil + collectgarbage(0) -- since there are no references left to a, it is + -- removed + -- at this point, b is pointing into a removed object + + When using the dependency-policy, it is possible to tell luabind to tie the + lifetime of one object to another, like this:: + + module(L) + [ + class_("A") + .def(constructor<>()) + .def("get_member", &A::get_member, dependency(result, _1)) + ]; + + This will create a dependency between the return-value of the function, and the + self-object. This means that the self-object will be kept alive as long as the + result is still alive. :: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + a = A() + b = a:get_member() -- b points to a member of a + a = nil + collectgarbage(0) -- a is dependent on b, so it isn't removed + b = nil + collectgarbage(0) -- all dependencies to a gone, a is removed + + To use this policy you need to include ``luabind/dependency_policy.hpp``. + + + Return reference to + ------------------- + + It is very common to return references to arguments or the this-pointer to + allow for chaining in C++. + + :: + + struct A + { + float val; + + A& set(float v) + { + val = v; + return *this; + } + }; + + When luabind generates code for this, it will create a new object for the + return-value, pointing to the self-object. This isn't a problem, but could be a + bit inefficient. When using the return_reference_to-policy we have the ability + to tell luabind that the return-value is already on the Lua stack. + + :: + + module(L) + [ + class_("A") + .def(constructor<>()) + .def("set", &A::set, return_reference_to(_1)) + ]; + + Instead of creating a new object, luabind will just copy the object that is + already on the stack. + + .. warning:: + This policy ignores all type information and should be used only it + situations where the parameter type is a perfect match to the + return-type (such as in the example). + + To use this policy you need to include ``luabind/return_reference_to_policy.hpp``. + + + Out value + --------- + + This policy makes it possible to wrap functions that take non const references + as its parameters with the intention to write return values to them. + + :: + + void f(float& val) { val = val + 10.f; } + + or + + :: + + void f(float* val) { *val = *val + 10.f; } + + Can be wrapped by doing:: + + module(L) + [ + def("f", &f, out_value(_1)) + ]; + + When invoking this function from Lua it will return the value assigned to its + parameter. + + :: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > a = f(10) + > print(a) + 20 + + When this policy is used in conjunction with user define types we often need + to do ownership transfers. + + :: + + struct A; + + void f1(A*& obj) { obj = new A(); } + void f2(A** obj) { *obj = new A(); } + + Here we need to make sure luabind takes control over object returned, for + this we use the adopt policy:: + + module(L) + [ + class_("A"), + def("f1", &f1, out_value(_1, adopt(_2))) + def("f2", &f2, out_value(_1, adopt(_2))) + ]; + + Here we are using adopt as an internal policy to out_value. The index + specified, _2, means adopt will be used to convert the value back to Lua. + Using _1 means the policy will be used when converting from Lua to C++. + + To use this policy you need to include ``luabind/out_value_policy.hpp``. + + Pure out value + -------------- + + This policy works in exactly the same way as out_value, except that it + replaces the parameters with default-constructed objects. + + :: + + void get(float& x, float& y) + { + x = 3.f; + y = 4.f; + } + + ... + + module(L) + [ + def("get", &get, + pure_out_value(_1) + pure_out_value(_2)) + ]; + + :: + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > x, y = get() + > print(x, y) + 3 5 + + Like out_value, it is possible to specify an internal policy used then + converting the values back to Lua. + + :: + + void get(test_class*& obj) + { + obj = new test_class(); + } + + ... + + module(L) + [ + def("get", &get, pure_out_value(_1, adopt(_1))) + ]; + + + Discard result + -------------- + + This is a very simple policy which makes it possible to throw away + the value returned by a C++ function, instead of converting it to + Lua. This example makes sure the this reference never gets converted + to Lua. + + :: + + struct simple + { + simple& set_name(const std::string& n) + { + name = n; + return *this; + } + + std::string name; + }; + + ... + + module(L) + [ + class_("simple") + .def("set_name", &simple::set_name, discard_result) + ]; + + To use this policy you need to include ``luabind/discard_result_policy.hpp``. + + + Return STL iterator + ------------------- + + This policy converts an STL container to a generator function that can be used + in Lua to iterate over the container. It works on any container that defines + ``begin()`` and ``end()`` member functions (they have to return iterators). It + can be used like this:: + + struct A + { + std::vector names; + }; + + + module(L) + [ + class_("A") + .def_readwrite("names", &A::names, return_stl_iterator) + ]; + + The Lua code to iterate over the container:: + + a = A() + + for name in a.names do + print(name) + end + + + To use this policy you need to include ``luabind/iterator_policy.hpp``. + + + Yield + ----- + + This policy will cause the function to always yield the current thread when + returning. See the Lua manual for restrictions on yield. + + +Splitting up the registration +============================= + +It is possible to split up a module registration into several +translation units without making each registration dependent +on the module it's being registered in. + +``a.cpp``:: + + luabind::scope register_a() + { + return + class_("a") + .def("f", &a::f) + ; + } + +``b.cpp``:: + + luabind::scope register_b() + { + return + class_("b") + .def("g", &b::g) + ; + } + +``module_ab.cpp``:: + + luabind::scope register_a(); + luabind::scope register_b(); + + void register_module(lua_State* L) + { + module("b", L) + [ + register_a(), + register_b() + ]; + } + + +Configuration +============= + +As mentioned in the `Lua documentation`_, it is possible to pass an +error handler function to ``lua_pcall()``. Luabind makes use of +``lua_pcall()`` internally when calling methods and functions. It is +possible to set the error handler function that Luabind will use +globally:: + + typedef void(*pcall_callback_fun)(lua_State*); + void set_pcall_callback(pcall_callback_fun fn); + +This is primarily useful for adding more information to the error message +returned by a failed protected call. + +.. _Lua documentation: http://www.lua.org/manual/5.0/manual.html + +Build options +------------- + +There are a number of configuration options available when building luabind. +It is very important that your project has the exact same conmfiguration +options as the ones given when the library was build! The exceptions are the +``LUABIND_MAX_ARITY`` and ``LUABIND_MAX_BASES`` which are template-based +options and only matters when you use the library (which means they can +differ from the settings of the library). + +The default settings which will be used if no other settings are given +can be found in ``luabind/config.hpp``. + +If you want to change the settings of the library, you can modify the +config file. It is included and used by all makefiles. You can change paths +to Lua and boost in there as well. + +LUABIND_MAX_ARITY + Controls the maximum arity of functions that are registered with luabind. + You can't register functions that takes more parameters than the number + this macro is set to. It defaults to 5, so, if your functions have greater + arity you have to redefine it. A high limit will increase compilation time. + +LUABIND_MAX_BASES + Controls the maximum number of classes one class can derive from in + luabind (the number of classes specified within ``bases<>``). + ``LUABIND_MAX_BASES`` defaults to 4. A high limit will increase + compilation time. + +LUABIND_NO_ERROR_CHECKING + If this macro is defined, all the Lua code is expected only to make legal + calls. If illegal function calls are made (e.g. giving parameters that + doesn't match the function signature) they will not be detected by luabind + and the application will probably crash. Error checking could be disabled + when shipping a release build (given that no end-user has access to write + custom Lua code). Note that function parameter matching will be done if a + function is overloaded, since otherwise it's impossible to know which one + was called. Functions will still be able to throw exceptions when error + checking is disabled. + + If a functions throws an exception it will be caught by luabind and + propagated with ``lua_error()``. + +LUABIND_NO_EXCEPTIONS + This define will disable all usage of try, catch and throw in luabind. + This will in many cases disable run-time errors, when performing invalid + casts or calling Lua functions that fails or returns values that cannot + be converted by the given policy. luabind requires that no function called + directly or indirectly by luabind throws an exception (throwing exceptions + through Lua has undefined behavior). + + Where exceptions are the only way to get an error report from luabind, + they will be replaced with calls to the callback functions set with + ``set_error_callback()`` and ``set_cast_failed_callback()``. + +LUA_API + If you want to link dynamically against Lua, you can set this define to + the import-keyword on your compiler and platform. On windows in devstudio + this should be ``__declspec(dllimport)`` if you want to link against Lua + as a dll. + +LUABIND_EXPORT, LUABIND_IMPORT + If you want to link against luabind as a dll (in devstudio), you can + define ``LUABIND_EXPORT`` to ``__declspec(dllexport)`` and + ``LUABIND_IMPORT`` to ``__declspec(dllimport)``. + Note that you have to link against Lua as a dll aswell, to make it work. + +LUABIND_NO_RTTI + You can define this if you don't want luabind to use ``dynamic_cast<>``. + It will disable `Object identity`_. + +LUABIND_TYPE_INFO, LUABIND_TYPE_INFO_EQUAL(i1,i2), LUABIND_TYPEID(t), LUABIND_INVALID_TYPE_INFO + If you don't want to use the RTTI supplied by C++ you can supply your own + type-info structure with the ``LUABIND_TYPE_INFO`` define. Your type-info + structure must be copyable and must be able to compare itself against + other type-info structures. You supply the compare function through the + ``LUABIND_TYPE_INFO_EQUAL()`` define. It should compare the two type-info + structures it is given and return true if they represent the same type and + false otherwise. You also have to supply a function to generate your + type-info structure. You do this through the ``LUABIND_TYPEID()`` define. + It should return your type-info structure and it takes a type as its + parameter. That is, a compile time parameter. + ``LUABIND_INVALID_TYPE_INFO`` macro should be defined to an invalid type. + No other type should be able to produce this type info. To use it you + probably have to make a traits class with specializations for all classes + that you have type-info for. Like this:: + + class A; + class B; + class C; + + template struct typeinfo_trait; + + template<> struct typeinfo_trait { enum { type_id = 0 }; }; + template<> struct typeinfo_trait { enum { type_id = 1 }; }; + template<> struct typeinfo_trait { enum { type_id = 2 }; }; + + If you have set up your own RTTI system like this (by using integers to + identify types) you can have luabind use it with the following defines:: + + #define LUABIND_TYPE_INFO const std::type_info* + #define LUABIND_TYPEID(t) &typeid(t) + #define LUABIND_TYPE_INFO_EQUAL(i1, i2) *i1 == *i2 + #define LUABIND_INVALID_TYPE_INFO &typeid(detail::null_type) + + Currently the type given through ``LUABIND_TYPE_INFO`` must be less-than + comparable! + +NDEBUG + This define will disable all asserts and should be defined in a release + build. + + +Implementation notes +==================== + +The classes and objects are implemented as user data in Lua. To make sure that +the user data really is the internal structure it is supposed to be, we tag +their metatables. A user data who's metatable contains a boolean member named +``__luabind_classrep`` is expected to be a class exported by luabind. A user +data who's metatable contains a boolean member named ``__luabind_class`` is +expected to be an instantiation of a luabind class. + +This means that if you make your own user data and tags its metatable with the +exact same names, you can very easily fool luabind and crash the application. + +In the Lua registry, luabind keeps an entry called ``__luabind_classes``. It +should not be removed or overwritten. + +In the global table, a variable called ``super`` is used every time a +constructor in a lua-class is called. This is to make it easy for that +constructor to call its base class' constructor. So, if you have a global +variable named super it may be overwritten. This is probably not the best +solution, and this restriction may be removed in the future. + +Luabind uses two upvalues for functions that it registers. The first is a +userdata containing a list of overloads for the function, the other is a light +userdata with the value 0x1337, this last value is used to identify functions +registered by luabind. It should be virtually impossible to have such a pointer +as secondary upvalue by pure chance. This means, if you are trying to replace +an existing function with a luabind function, luabind will see that the +secondary upvalue isn't the magic id number and replace it. If it can identify +the function to be a luabind function, it won't replace it, but rather add +another overload to it. + +Inside the luabind namespace, there's another namespace called detail. This +namespace contains non-public classes and are not supposed to be used directly. + + +Error messages +============== + +- .. parsed-literal:: + + the attribute '*class-name.attribute-name*' is read only + + There is no data member named *attribute-name* in the class *class-name*, + or there's no setter-method registered on that property name. See the + properties section. + +- .. parsed-literal:: + + the attribute '*class-name.attribute-name*' is of type: (*class-name*) and does not match (*class_name*) + + This error is generated if you try to assign an attribute with a value + of a type that cannot be converted to the attribute's type. + + +- .. parsed-literal:: + + *class-name()* threw an exception, *class-name:function-name()* threw an exception + + The class' constructor or member function threw an unknown exception. + Known exceptions are const char*, std::exception. See the + `exceptions`_ section. + +- .. parsed-literal:: + + no overload of '*class-name:function-name*' matched the arguments (*parameter-types*) + no match for function call '*function-name*' with the parameters (*parameter-types*) + no constructor of *class-name* matched the arguments (*parameter-types*) + no operator *operator-name* matched the arguments (*parameter-types*) + + No function/operator with the given name takes the parameters you gave + it. You have either misspelled the function name, or given it incorrect + parameters. This error is followed by a list of possible candidate + functions to help you figure out what parameter has the wrong type. If + the candidate list is empty there's no function at all with that name. + See the signature matching section. + +- .. parsed-literal:: + + call of overloaded '*class-name:function-name*(*parameter-types*)' is ambiguous + ambiguous match for function call '*function-name*' with the parameters (*parameter-types*) + call of overloaded constructor '*class-name*(*parameter-types*)' is ambiguous + call of overloaded operator *operator-name* (*parameter-types*) is ambiguous + + This means that the function/operator you are trying to call has at least + one other overload that matches the arguments just as good as the first + overload. + +- .. parsed-literal:: + + cannot derive from C++ class '*class-name*'. It does not have a wrapped type. + + +FAQ +=== + +What's up with __cdecl and __stdcall? + If you're having problem with functions + that cannot be converted from ``void (__stdcall *)(int,int)`` to + ``void (__cdecl*)(int,int)``. You can change the project settings to make the + compiler generate functions with __cdecl calling conventions. This is + a problem in developer studio. + +What's wrong with functions taking variable number of arguments? + You cannot register a function with ellipses in its signature. Since + ellipses don't preserve type safety, those should be avoided anyway. + +Internal structure overflow in VC + If you, in visual studio, get fatal error C1204: compiler limit : + internal structure overflow. You should try to split that compilation + unit up in smaller ones. + +.. the three entries above were removed, why? + +What's wrong with precompiled headers in VC? + Visual Studio doesn't like anonymous namespaces in its precompiled + headers. If you encounter this problem you can disable precompiled + headers for the compilation unit (cpp-file) that uses luabind. + +error C1076: compiler limit - internal heap limit reached in VC + In visual studio you will probably hit this error. To fix it you have to + increase the internal heap with a command-line option. We managed to + compile the test suit with /Zm300, but you may need a larger heap then + that. + +error C1055: compiler limit \: out of keys in VC + It seems that this error occurs when too many assert() are used in a + program, or more specifically, the __LINE__ macro. It seems to be fixed by + changing /ZI (Program database for edit and continue) to /Zi + (Program database). + +How come my executable is huge? + If you're compiling in debug mode, you will probably have a lot of + debug-info and symbols (luabind consists of a lot of functions). Also, + if built in debug mode, no optimizations were applied, luabind relies on + that the compiler is able to inline functions. If you built in release + mode, try running strip on your executable to remove export-symbols, + this will trim down the size. + + Our tests suggests that cygwin's gcc produces much bigger executables + compared to gcc on other platforms and other compilers. + +.. HUH?! // check the magic number that identifies luabind's functions + +Can I register class templates with luabind? + Yes you can, but you can only register explicit instantiations of the + class. Because there's no Lua counterpart to C++ templates. For example, + you can register an explicit instantiation of std::vector<> like this:: + + module(L) + [ + class_ >("vector") + .def(constructor) + .def("push_back", &std::vector::push_back) + ]; + +.. Again, irrelevant to docs: Note that the space between the two > is required by C++. + +Do I have to register destructors for my classes? + No, the destructor of a class is always called by luabind when an + object is collected. Note that Lua has to own the object to collect it. + If you pass it to C++ and gives up ownership (with adopt policy) it will + no longer be owned by Lua, and not collected. + + If you have a class hierarchy, you should make the destructor virtual if + you want to be sure that the correct destructor is called (this apply to C++ + in general). + +.. And again, the above is irrelevant to docs. This isn't a general C++ FAQ. + +Fatal Error C1063 compiler limit \: compiler stack overflow in VC + VC6.5 chokes on warnings, if you are getting alot of warnings from your + code try suppressing them with a pragma directive, this should solve the + problem. + +Crashes when linking against luabind as a dll in windows + When you build luabind, Lua and you project, make sure you link against + the runtime dynamically (as a dll). + +I cannot register a function with a non-const parameter + This is because there is no way to get a reference to a Lua value. Have + a look at out_value and pure_out_value policies. + + +Known issues +============ + +- You cannot use strings with extra nulls in them as member names that refers + to C++ members. + +- If one class registers two functions with the same name and the same + signature, there's currently no error. The last registered function will + be the one that's used. + +- In VC7, classes can not be called test. + +- If you register a function and later rename it, error messages will use the + original function name. + +- luabind does not support class hierarchies with virtual inheritance. Casts are + done with static pointer offsets. + +.. remove? - Visual studio have problems selecting the correct overload of std::swap() + for luabind::object. + + +Acknowledgments +=============== + +Written by Daniel Wallin and Arvid Norberg. © Copyright 2003. +All rights reserved. + +Evan Wies has contributed with thorough testing, countless bug reports +and feature ideas. + +This library was highly inspired by Dave Abrahams' Boost.Python_ library. + +.. _Boost.Python: http://www.boost.org/libraries/python + diff --git a/_docs/doc LuaBind/index.html b/_docs/doc LuaBind/index.html new file mode 100644 index 00000000..c632bb1f --- /dev/null +++ b/_docs/doc LuaBind/index.html @@ -0,0 +1,64 @@ + + + + + luabind + + + + + +

luabind logo

+ + + + + + + + +
downloaddocumentationmailing listthe sourceforge page
+ +
+ +

It is implemented utilizing template meta programming. +That means that you don't need an extra preprocess pass to compile your project +(it is done by the compiler). It also means you don't (usually) have to know the +exact signature of each function you register, since the library will generate +code depending on the compile-time type of the function (which includes the +signature). The main drawback of this approach is that the compilation time will +increase for the file that does the registration, it is therefore recommended +that you register everything in the same cpp-file.

+ +

luabind is released under the terms of the +MIT license.

+ +

+luabind is hosted by sourceforge.
+ + SourceForge.net Logo + +
+ + + Valid HTML 4.01! + + + Valid CSS! + +

+ + + diff --git a/_docs/doc LuaBind/luabind-logo-label.ps b/_docs/doc LuaBind/luabind-logo-label.ps new file mode 100644 index 00000000..2b2b4535 Binary files /dev/null and b/_docs/doc LuaBind/luabind-logo-label.ps differ diff --git a/_docs/doc LuaBind/luabind.png b/_docs/doc LuaBind/luabind.png new file mode 100644 index 00000000..9dada710 Binary files /dev/null and b/_docs/doc LuaBind/luabind.png differ diff --git a/_docs/doc LuaBind/out_value.rst b/_docs/doc LuaBind/out_value.rst new file mode 100644 index 00000000..443e5a05 --- /dev/null +++ b/_docs/doc LuaBind/out_value.rst @@ -0,0 +1,56 @@ +out_value +---------------- + +Motivation +~~~~~~~~~~ + +This policy makes it possible to wrap functions that take non-const references +or pointer to non-const as it's parameters with the intention to write return +values to them. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + out_value(index, policies = none) + + +Parameters +~~~~~~~~~~ + +=============== ============================================================= +Parameter Purpose +=============== ============================================================= +``index`` The index of the parameter to be used as an out parameter. +``policies`` The policies used internally to convert the out parameter + to/from Lua. ``_1`` means **to** C++, ``_2`` means **from** + C++. +=============== ============================================================= + +Example +~~~~~~~ + +.. parsed-literal:: + + void f1(float& val) { val = val + 10.f; } + void f2(float\* val) { \*val = \*val + 10.f; } + + module(L) + [ + def("f", &f, **out_value(_1)**) + ]; + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > print(f1(10)) + 20 + > print(f2(10)) + 20 + diff --git a/_docs/doc LuaBind/pure_out_value.rst b/_docs/doc LuaBind/pure_out_value.rst new file mode 100644 index 00000000..9b177d9e --- /dev/null +++ b/_docs/doc LuaBind/pure_out_value.rst @@ -0,0 +1,55 @@ +pure_out_value +---------------- + +Motivation +~~~~~~~~~~ + +This works exactly like ``out_value``, except that it will pass a +default constructed object instead of converting an argument from +Lua. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + pure_out_value(index, policies = none) + + +Parameters +~~~~~~~~~~ + +=============== ============================================================= +Parameter Purpose +=============== ============================================================= +``index`` The index of the parameter to be used as an out parameter. +``policies`` The policies used internally to convert the out parameter + to Lua. ``_1`` is used as the interal index. +=============== ============================================================= + +Example +~~~~~~~ + +.. parsed-literal:: + + void f1(float& val) { val = 10.f; } + void f2(float\* val) { \*val = 10.f; } + + module(L) + [ + def("f", &f, **pure_out_value(_1)**) + ]; + + Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio + > print(f1()) + 10 + > print(f2()) + 10 + diff --git a/_docs/doc LuaBind/raw.rst b/_docs/doc LuaBind/raw.rst new file mode 100644 index 00000000..085f0e5e --- /dev/null +++ b/_docs/doc LuaBind/raw.rst @@ -0,0 +1,54 @@ +raw +--- + +Motivation +~~~~~~~~~~ + +This converter policy will pass through the ``lua_State*`` unmodified. +This can be useful for example when binding functions that need to +return a ``luabind::object``. The parameter will be removed from the +function signature, decreasing the function arity by one. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + raw(index) + +Parameters +~~~~~~~~~~ + +============= =============================================================== +Parameter Purpose +============= =============================================================== +``index`` The index of the lua_State* parameter. +============= =============================================================== + +Example +~~~~~~~ + +.. parsed-literal:: + + void greet(lua_State* L) + { + lua_pushstring(L, "hello"); + } + + ... + + module(L) + [ + def("greet", &greet, **raw(_1)**) + ]; + + > print(greet()) + hello + diff --git a/_docs/doc LuaBind/return_reference_to.rst b/_docs/doc LuaBind/return_reference_to.rst new file mode 100644 index 00000000..136dfb90 --- /dev/null +++ b/_docs/doc LuaBind/return_reference_to.rst @@ -0,0 +1,79 @@ +return_reference_to +------------------- + +Motivation +~~~~~~~~~~ + +It is very common to return references to arguments or the this-pointer to +allow for chaining in C++. + +:: + + struct A + { + float val; + + A& set(float v) + { + val = v; + return *this; + } + }; + +When luabind generates code for this, it will create a new object for the +return-value, pointing to the self-object. This isn't a problem, but could be a +bit inefficient. When using the return_reference_to-policy we have the ability +to tell luabind that the return-value is already on the lua stack. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + return_reference_to(index) + +Parameters +~~~~~~~~~~ + +========= ============================================================= +Parameter Purpose +========= ============================================================= +``index`` The argument index to return a reference to, any argument but + not ``result``. +========= ============================================================= + +Example +~~~~~~~ + +.. parsed-literal:: + + struct A + { + float val; + + A& set(float v) + { + val = v; + return \*this; + } + }; + + module(L) + [ + class_("A") + .def(constructor<>()) + .def("set", &A::set, **return_reference_to(_1)**) + ]; + +.. warning:: + This policy ignores all type information and should be used only it + situations where the parameter type is a perfect match to the + return-type (such as in the example). + diff --git a/_docs/doc LuaBind/return_stl_iterator.rst b/_docs/doc LuaBind/return_stl_iterator.rst new file mode 100644 index 00000000..32055310 --- /dev/null +++ b/_docs/doc LuaBind/return_stl_iterator.rst @@ -0,0 +1,49 @@ +return_stl_iterator +------------------- + +Motivation +~~~~~~~~~~ + +This policy converts an STL container to a generator function that can be used +in lua to iterate over the container. It works on any container that defines +``begin()`` and ``end()`` member functions (they have to return iterators). + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + return_stl_iterator + +Example +~~~~~~~ + +.. parsed-literal:: + + struct X + { + std::vector names; + }; + + ... + + module(L) + [ + class_("A") + .def_readwrite("names", &X::names, **return_stl_iterator**) + ]; + + ... + + > a = A() + > for name in a.names do + > print(name) + > end + diff --git a/_docs/doc LuaBind/style.css b/_docs/doc LuaBind/style.css new file mode 100644 index 00000000..8e27b9fe --- /dev/null +++ b/_docs/doc LuaBind/style.css @@ -0,0 +1,292 @@ +/* +:Author: David Goodger +:Contact: goodger@users.sourceforge.net +:date: $Date: 2004/05/14 08:06:04 $ +:version: $Revision: 1.4.2.3 $ +:copyright: This stylesheet has been placed in the public domain. + +Default cascading style sheet for the HTML output of Docutils. +*/ + +p { + text-align: justify; +} + +.first { + margin-top: 0 } + +.last { + margin-bottom: 0 } + +a.toc-backref { + text-decoration: none ; + color: black } + +dt { /* used in FAQ */ + font-weight: bold ; + margin-bottom: 0.2em +} + +dl { + margin-left: 0.5em ; + margin-right: 10em +} + +h3 { + font-size: 90% +} + +dd { + margin-bottom: 0.5em } + +div.abstract { + margin: 2em 5em } + +div.abstract p.topic-title { + font-weight: bold ; + text-align: center } + +div.attention, div.caution, div.danger, div.error, div.hint, +div.important, div.note, div.tip, div.warning, div.admonition { + margin: 2em ; + border: medium outset ; + padding: 1em } + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red ; + font-weight: bold ; + font-family: sans-serif } + +div.hint p.admonition-title, div.important p.admonition-title, +div.note p.admonition-title, div.tip p.admonition-title, +div.admonition p.admonition-title { + font-weight: bold ; + font-family: sans-serif } + +div.dedication { + margin: 2em 5em ; + text-align: center ; + font-style: italic } + +div.dedication p.topic-title { + font-weight: bold ; + font-style: normal } + +div.figure { + margin-left: 2em } + +div.footer, div.header { + font-size: smaller } + +div.sidebar { + margin-left: 1em ; + border: medium outset ; + padding: 0em 1em ; + background-color: #ffffee ; + width: 40% ; + float: right ; + clear: right } + +div.sidebar p.rubric { + font-family: sans-serif ; + font-size: medium } + +div.system-messages { + margin: 5em } + +div.system-messages h1 { + color: red } + +div.system-message { + border: medium outset ; + padding: 1em } + +div.system-message p.system-message-title { + color: red ; + font-weight: bold } + +div.topic { + margin: 2em } + +h1.title { + text-align: center } + +h2.subtitle { + text-align: center } + +hr { + width: 75% } + +ol.simple, ul.simple { + margin-bottom: 1em } + +ol.arabic { + list-style: decimal } + +ol.loweralpha { + list-style: lower-alpha } + +ol.upperalpha { + list-style: upper-alpha } + +ol.lowerroman { + list-style: lower-roman } + +ol.upperroman { + list-style: upper-roman } + +p.attribution { + text-align: right ; + margin-left: 50% } + +p.caption { + font-style: italic } + +p.credits { + font-style: italic ; + font-size: smaller } + +p.label { + white-space: nowrap } + +p.rubric { + font-weight: bold ; + font-size: larger ; + color: maroon ; + text-align: center } + +p.sidebar-title { + font-family: sans-serif ; + font-weight: bold ; + font-size: larger } + +p.sidebar-subtitle { + font-family: sans-serif ; + font-weight: bold } + +p.topic-title { + font-weight: bold } + +pre.address { + margin-bottom: 0 ; + margin-top: 0 ; + font-family: serif ; + font-size: 100% } + +pre.line-block { + font-family: serif ; + font-size: 100% } + +pre.literal-block, pre.doctest-block { + margin-left: 2em ; + margin-right: 2em ; +/* padding-left: 1em ;*/ + background-color: #eeeeee ; +/* border-left: solid 3px #c0c0c0*/ } + +span.classifier { + font-family: sans-serif ; + font-style: oblique } + +span.classifier-delimiter { + font-family: sans-serif ; + font-weight: bold } + +span.interpreted { + font-family: sans-serif } + +span.option { + white-space: nowrap } + +span.option-argument { + font-style: italic } + +span.pre { + white-space: pre } + +span.problematic { + color: red } + +table { + margin-top: 0.5em ; + margin-bottom: 0.5em } + +table.citation { + border-left: solid thin gray ; + padding-left: 0.5ex } + +table.docinfo { + margin: 2em 4em ; + border: none } + +table.footnote { + border-left: solid thin black ; + padding-left: 0.5ex } + +td, th { + padding-left: 0.5em ; + padding-right: 0.5em ; + vertical-align: top } + +th.docinfo-name, th.field-name { + font-weight: bold ; + text-align: left ; + white-space: nowrap ; + border: none ; + background-color: #f0f0f0 + } + +h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + font-size: 100% ; + font-family: serif } + +/*h1 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; text-align: left; font-size: 140%; } +h2 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; text-align: left; font-size: 110%; } +h3 { font-family: "courier new", courier, monospace; font-weight: bold; text-align: left; font-size: 100%; } +*/ +tt { + /*background-color: #eeeeee*/ + color: #102eb0 +} + +ul.auto-toc { + list-style-type: none } + +/* --- */ + +table { + border-collapse: collapse; + border: none; +/* border-bottom: 1px solid black;*/ + margin-left: 1em; +} + +td, th { + border: none; +} + +th { +/* border-top: 1px solid black;*/ + border-bottom: 1px solid black; + text-align: left; +} + +a:link +{ + font-weight: bold; + color: #003366; + text-decoration: none; +} + +a:visited +{ + font-weight: bold; + color: #003366; + text-decoration: none; +} + +h3 { + text-transform: uppercase +} diff --git a/_docs/doc LuaBind/yield.rst b/_docs/doc LuaBind/yield.rst new file mode 100644 index 00000000..3f187825 --- /dev/null +++ b/_docs/doc LuaBind/yield.rst @@ -0,0 +1,39 @@ +yield +---------------- + +Motivation +~~~~~~~~~~ + +Makes a C++ function yield when returning. + +Defined in +~~~~~~~~~~ + +.. parsed-literal:: + + #include + +Synopsis +~~~~~~~~ + +.. parsed-literal:: + + yield + +Example +~~~~~~~ + +.. parsed-literal:: + + void do_thing_that_takes_time() + { + ... + } + + ... + + module(L) + [ + def("do_thing_that_takes_time", &do_thing_that_takes_time, **yield**) + ]; + diff --git a/_docs/doc X-Ray/xray.chi b/_docs/doc X-Ray/xray.chi new file mode 100644 index 00000000..21fdea68 Binary files /dev/null and b/_docs/doc X-Ray/xray.chi differ diff --git a/_docs/doc X-Ray/xray.chm b/_docs/doc X-Ray/xray.chm new file mode 100644 index 00000000..2db5a2ac Binary files /dev/null and b/_docs/doc X-Ray/xray.chm differ diff --git a/_docs/doc X-Ray/xray.chw b/_docs/doc X-Ray/xray.chw new file mode 100644 index 00000000..ca17a18e Binary files /dev/null and b/_docs/doc X-Ray/xray.chw differ diff --git a/_docs/how_to_build_sdk_tutorial_ru.txt b/_docs/how_to_build_sdk_tutorial_ru.txt new file mode 100644 index 00000000..993a37aa --- /dev/null +++ b/_docs/how_to_build_sdk_tutorial_ru.txt @@ -0,0 +1,57 @@ +1)Ñòàâèì CBuilder6 - borland ver 6.0 (build 10.166), ñòàâèì ñåðâèñ ïàê 6. + +2)Îòêëþ÷àåì UAC, îòêëþ÷àåì/íàñòðàèâàåì DEP. íàçíà÷àåì àäìèíñêèå ïðàâà bcb.exe + +http://windata.ru/windows-vista/nachinayushim-v/chto-takoe-uac-i-kak-ego-otklyuchit/ +http://shkolazhizni.ru/archive/0/n-19778/ + +3)ñîçäàåì âðó÷íóþ ïàïêè +X:\intermediate_ed +X:\intermediate_ed\ae +X:\intermediate_ed\ecore +X:\intermediate_ed\core +X:\intermediate_ed\eprops +X:\intermediate_ed\le +X:\intermediate_ed\particles +X:\intermediate_ed\pe +X:\intermediate_ed\se +X:\intermediate_ed\sound + +3) Ðàñïàêîâûâàåì èç CBuilder6_stk_additional.rar ïàïêó Borland â C:\Program Files (x86) èëè ãäå ó âàñ ñòîèò áèëäåð. +Ýòî áèáëèîòåêè äëÿ ëèíêîâêè, ïåðåêîíâåð÷åííûå â ôîðìàò áèëäåðà, òàê êàê ó âèæóàë ñòóäèè è áîðëàíäà íåìíîãî ðàçíûå ïîíÿòèÿ î ñ++. (åñëè èíòåðåñóþò ïîäðîáíîñòè, èùåì â ãóãëå: omf coff) + +4) tools -> environment options -> environment variables óêàçûâàåì ñâîè ïóòè + +DXSDK_DIR C:\STALKER_GAMES_SRC\STALKER\dxsdk +XIPH_DIR C:\STALKER_GAMES_SRC\STALKER\SDK\Xiph\Include +MAGIC_SW_DIR C:\STALKER_GAMES_SRC\STALKER\SDK\MagicSoftware\FreeMagic\include +EAX_DIR C:\STALKER_GAMES_SRC\STALKER\SDK\eax +ALSOC_DIR C:\STALKER_GAMES_SRC\STALKER\SDK\OpenAL\ +ETOOLSSOC_DIR C:\STALKER_GAMES_SRC\STALKER\xray-svn-trunk\ETools +CORESOC_DIR C:\STALKER_GAMES_SRC\STALKER\xray-svn-trunk\xrCore +COMPONENTS_SOC C:\STALKER_GAMES_SRC\STALKER\SDK\components +SOC_SDK_DIR C:\STALKER_GAMES_SRC\STALKER +MAIN_DIR C:\STALKER_GAMES_SRC +SDK_DIR C:\STALKER_GAMES_SRC\STALKER\SDK + +5) íóæíî ñêîïèðîâàòü â windows\SysWOW64 èëè åñëè ó âàñ XP èëè x86 â windows\system32 + +X:\STALKER\SDK\components\ElPack\bpl\elpackB6.BPL +X:\STALKER\SDK\components\ElPack\bpl\elpkdbB6.BPL +X:\STALKER\SDK\components\ElPack\bpl\elpproB6.BPL + +6)component->install packages + +íóæíî óñòàíîâèòü: +(*óñòàðåëî) borland user components - Borland\CBuilder6\Projects\Bpl\dclusr60.bpl +editorB - STALKER\SDK\components\AlexMX\editorB.bpl +eldos DB Aware Controls - STALKER\SDK\components\ElPack\Code\dceldbB6.bpl +eldos Professional Components - STALKER\SDK\components\ElPack\Code\dcelppB6.bpl +eldos Visual Components - STALKER\SDK\components\ElPack\Code\dclelpB6.bpl +âñ¸ åñòü èëè â ñàìîì áîðëàíäå èëè â SDK ñîðöåâ ñòàëêåðà. + +7)ïîñëå óñòàíîâêè êîìïîíåíòîâ ïåðåîòêðûâàåì ôàéë ïðîåêòà + +8)êëèêàåì íà ïðîåêòå ñîáèðàåìîì, xrcoreb.dll íàïðèìåð->options->properties->linker +don't generate state files - âêëþ÷àåì âûêëþ÷àåì ïðè ðàíäîìíûõ áàãàõ êîìïèëÿöèè íà ëèíêîâêå +åùå ïðè ðàíäîìíûõ áàãàõ ïðèâûêàåì äåëàòü ñíà÷àëà make ïîòîì build, ïîìîãàåò â 99% ñëó÷àÿõ \ No newline at end of file diff --git a/_scripts/convert_coff2omf.bat b/_scripts/convert_coff2omf.bat new file mode 100644 index 00000000..4eb42bb7 --- /dev/null +++ b/_scripts/convert_coff2omf.bat @@ -0,0 +1,5 @@ +coff2omf.exe ..\out\libraries\BugTrap.lib ..\out\libraries\BugTrapB.lib +coff2omf.exe ..\out\libraries\ETools.lib ..\out\libraries\EToolsB.lib +coff2omf.exe ..\out\libraries\OpenAL32.lib ..\out\libraries\OpenAL32B.lib +coff2omf.exe ..\out\libraries\LWO.lib coff2omf.exe ..\out\libraries\LWOB.lib +coff2omf.exe ..\out\libraries\DXT.lib coff2omf.exe ..\out\libraries\DXTB.lib \ No newline at end of file diff --git a/_scripts/start sln.bat b/_scripts/start sln.bat new file mode 100644 index 00000000..e9b7b8c3 --- /dev/null +++ b/_scripts/start sln.bat @@ -0,0 +1 @@ +@start ../trunk/xr_3da/xr_3da.sln diff --git a/externals/NVTT/NVTT.vcxproj b/externals/NVTT/NVTT.vcxproj new file mode 100644 index 00000000..a53a7124 --- /dev/null +++ b/externals/NVTT/NVTT.vcxproj @@ -0,0 +1,238 @@ + + + + + Debug + Win32 + + + Mixed + Win32 + + + Release + Win32 + + + + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473} + nvtt + + + + + StaticLibrary + true + MultiByte + v120 + + + StaticLibrary + false + true + MultiByte + v120 + + + StaticLibrary + false + true + MultiByte + v120 + + + + + + + + + + + + + + + + Level3 + $(ProjectDir)include;$(ProjectDir)src;$(ProjectDir)src\nvcore;$(ProjectDir)src\nvtt\squish;%(AdditionalIncludeDirectories) + NVTT_EXPORTS;_MBCS;%(PreprocessorDefinitions) + NotUsing + MultiThreadedDLL + + + + + Level3 + $(ProjectDir)include;$(ProjectDir)src;$(ProjectDir)src\nvcore;$(ProjectDir)src\nvtt\squish;%(AdditionalIncludeDirectories) + NVTT_EXPORTS;_MBCS;%(PreprocessorDefinitions) + StreamingSIMDExtensions2 + true + true + NotUsing + + + + + Level3 + $(ProjectDir)include;$(ProjectDir)src;$(ProjectDir)src\nvcore;$(ProjectDir)src\nvtt\squish;%(AdditionalIncludeDirectories) + NVTT_EXPORTS;_MBCS;%(PreprocessorDefinitions) + StreamingSIMDExtensions2 + true + true + NotUsing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/externals/NVTT/NVTT.vcxproj.filters b/externals/NVTT/NVTT.vcxproj.filters new file mode 100644 index 00000000..113763df --- /dev/null +++ b/externals/NVTT/NVTT.vcxproj.filters @@ -0,0 +1,425 @@ + + + + + {9c8d4fcf-1a0f-4176-9174-17216abeeffe} + + + {e7a9d246-050a-495e-85fe-8159f6514eff} + + + + + include + + + include + + + include + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + src + + + \ No newline at end of file diff --git a/externals/NVTT/NVTT/NVTT.log b/externals/NVTT/NVTT/NVTT.log new file mode 100644 index 00000000..dc849e4f --- /dev/null +++ b/externals/NVTT/NVTT/NVTT.log @@ -0,0 +1,25 @@ +Build started 9/24/2014 2:10:23 PM. + 1>Project "E:\git\xray-16\src\3rd party\NVTT\NVTT.vcxproj" on node 2 (Build target(s)). + 1>Building with tools version "12.0". + Project file contains ToolsVersion="4.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="12.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=293424. + 1>Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "E:\git\xray-16\src\3rd party\NVTT\NVTT.vcxproj" (entry point): + Using "Error" task from assembly "Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". + Task "Error" + 1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(617,5): error : The OutputPath property is not set for project 'NVTT.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Win32'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. + Done executing task "Error" -- FAILED. + 1>Done building target "_CheckForInvalidConfigurationAndPlatform" in project "NVTT.vcxproj" -- FAILED. + 1>Done Building Project "E:\git\xray-16\src\3rd party\NVTT\NVTT.vcxproj" (Build target(s)) -- FAILED. + +Project Performance Summary: + 23 ms E:\git\xray-16\src\3rd party\NVTT\NVTT.vcxproj 1 calls + 23 ms Build 1 calls + +Target Performance Summary: + 23 ms _CheckForInvalidConfigurationAndPlatform 1 calls + +Task Performance Summary: + 20 ms Error 1 calls + +Build FAILED. + +Time Elapsed 00:00:00.01 diff --git a/externals/NVTT/include/nvconfig.h b/externals/NVTT/include/nvconfig.h new file mode 100644 index 00000000..31338fb4 --- /dev/null +++ b/externals/NVTT/include/nvconfig.h @@ -0,0 +1,16 @@ +#ifndef NV_CONFIG +#define NV_CONFIG + +//#cmakedefine HAVE_UNISTD_H +#define HAVE_STDARG_H +//#cmakedefine HAVE_SIGNAL_H +//#cmakedefine HAVE_EXECINFO_H +#define HAVE_MALLOC_H + +#if !defined(_M_X64) +//#define HAVE_PNG +//#define HAVE_JPEG +//#define HAVE_TIFF +#endif + +#endif // NV_CONFIG diff --git a/externals/NVTT/include/nvtt/nvtt.h b/externals/NVTT/include/nvtt/nvtt.h new file mode 100644 index 00000000..6ce6deb9 --- /dev/null +++ b/externals/NVTT/include/nvtt/nvtt.h @@ -0,0 +1,308 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_H +#define NV_TT_H + +// Function linkage +#if NVTT_SHARED + +#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__ +# ifdef NVTT_EXPORTS +# define NVTT_API __declspec(dllexport) +# else +# define NVTT_API __declspec(dllimport) +# endif +#endif + +#if defined __GNUC__ >= 4 +# ifdef NVTT_EXPORTS +# define NVTT_API __attribute__((visibility("default"))) +# endif +#endif + +#endif // NVTT_SHARED + +#if !defined NVTT_API +# define NVTT_API +#endif + +#define NVTT_VERSION 200 + +#define NVTT_DECLARE_PIMPL(Class) \ + private: \ + Class(const Class &); \ + void operator=(const Class &); \ + public: \ + struct Private; \ + Private & m + + +// Public interface. +namespace nvtt +{ + /// Supported compression formats. + enum Format + { + // No compression. + Format_RGB, + Format_RGBA = Format_RGB, + + // DX9 formats. + Format_DXT1, + Format_DXT1a, // DXT1 with binary alpha. + Format_DXT3, + Format_DXT5, + Format_DXT5n, // Compressed HILO: R=1, G=y, B=0, A=x + + // DX10 formats. + Format_BC1 = Format_DXT1, + Format_BC1a = Format_DXT1a, + Format_BC2 = Format_DXT3, + Format_BC3 = Format_DXT5, + Format_BC3n = Format_DXT5n, + Format_BC4, // ATI1 + Format_BC5, // 3DC, ATI2 + }; + + /// Quality modes. + enum Quality + { + Quality_Fastest, + Quality_Normal, + Quality_Production, + Quality_Highest, + }; + + /// Compression options. This class describes the desired compression format and other compression settings. + struct CompressionOptions + { + NVTT_DECLARE_PIMPL(CompressionOptions); + + NVTT_API CompressionOptions(); + NVTT_API ~CompressionOptions(); + + NVTT_API void reset(); + + NVTT_API void setFormat(Format format); + NVTT_API void setQuality(Quality quality); + NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f); + + NVTT_API void setExternalCompressor(const char * name); + + // Set color mask to describe the RGB/RGBA format. + NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask); + + NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127); + }; + + + /// Wrap modes. + enum WrapMode + { + WrapMode_Clamp, + WrapMode_Repeat, + WrapMode_Mirror, + }; + + /// Texture types. + enum TextureType + { + TextureType_2D, + TextureType_Cube, + // TextureType_3D, + }; + + /// Input formats. + enum InputFormat + { + InputFormat_BGRA_8UB, + // InputFormat_RGBE_8UB, + // InputFormat_BGRA_32F, + }; + + /// Mipmap downsampling filters. + enum MipmapFilter + { + MipmapFilter_Box, ///< Box filter is quite good and very fast. + MipmapFilter_Triangle, ///< Triangle filter blurs the results too much, but that might be what you want. + MipmapFilter_Kaiser, ///< Kaiser-windowed Sinc filter is the best downsampling filter. + }; + + /// Color transformation. + enum ColorTransform + { + ColorTransform_None, + ColorTransform_Linear, + }; + + /// Extents rounding mode. + enum RoundMode + { + RoundMode_None, + RoundMode_ToNextPowerOfTwo, + RoundMode_ToNearestPowerOfTwo, + RoundMode_ToPreviousPowerOfTwo, + }; + + /// Alpha mode. + enum AlphaMode + { + AlphaMode_None, + AlphaMode_Transparency, + AlphaMode_Premultiplied, + }; + + /// Input options. Specify format and layout of the input texture. + struct InputOptions + { + NVTT_DECLARE_PIMPL(InputOptions); + + NVTT_API InputOptions(); + NVTT_API ~InputOptions(); + + // Set default options. + NVTT_API void reset(); + + // Setup input layout. + NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1); + NVTT_API void resetTextureLayout(); + + // Set mipmap data. Copies the data. + NVTT_API bool setMipmapData(const void * data, int w, int h, int d = 1, int face = 0, int mipmap = 0); + + // Describe the format of the input. + NVTT_API void setFormat(InputFormat format); + + // Set the way the input alpha channel is interpreted. + NVTT_API void setAlphaMode(AlphaMode alphaMode); + + // Set gamma settings. + NVTT_API void setGamma(float inputGamma, float outputGamma); + + // Set texture wrappign mode. + NVTT_API void setWrapMode(WrapMode mode); + + // Set mipmapping options. + NVTT_API void setMipmapFilter(MipmapFilter filter); + NVTT_API void setMipmapGeneration(bool enabled, int maxLevel = -1); + NVTT_API void setKaiserParameters(float width, float alpha, float stretch); + + // Set normal map options. + NVTT_API void setNormalMap(bool b); + NVTT_API void setConvertToNormalMap(bool convert); + NVTT_API void setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale); + NVTT_API void setNormalFilter(float sm, float medium, float big, float large); + NVTT_API void setNormalizeMipmaps(bool b); + + // Set color transforms. @@ Not implemented! + NVTT_API void setColorTransform(ColorTransform t); + NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3); + + // Set resizing options. + NVTT_API void setMaxExtents(int d); + NVTT_API void setRoundMode(RoundMode mode); + }; + + + /// Output handler. + struct OutputHandler + { + virtual ~OutputHandler() {} + + /// Indicate the start of a new compressed image that's part of the final texture. + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0; + + /// Output data. Compressed data is output as soon as it's generated to minimize memory allocations. + virtual bool writeData(const void * data, int size) = 0; + }; + + /// Error codes. + enum Error + { + Error_Unknown, + Error_InvalidInput, + Error_UnsupportedFeature, + Error_CudaError, + Error_FileOpen, + Error_FileWrite, + }; + + /// Error handler. + struct ErrorHandler + { + virtual ~ErrorHandler() {} + + // Signal error. + virtual void error(Error e) = 0; + }; + + + /// Output Options. This class holds pointers to the interfaces that are used to report the output of + /// the compressor to the user. + struct OutputOptions + { + NVTT_DECLARE_PIMPL(OutputOptions); + + NVTT_API OutputOptions(); + NVTT_API ~OutputOptions(); + + // Set default options. + NVTT_API void reset(); + + NVTT_API void setFileName(const char * fileName); + + NVTT_API void setOutputHandler(OutputHandler * outputHandler); + NVTT_API void setErrorHandler(ErrorHandler * errorHandler); + NVTT_API void setOutputHeader(bool outputHeader); + }; + + + /// Texture compressor. + struct Compressor + { + NVTT_DECLARE_PIMPL(Compressor); + + NVTT_API Compressor(); + NVTT_API ~Compressor(); + + NVTT_API void enableCudaAcceleration(bool enable); + NVTT_API bool isCudaAccelerationEnabled() const; + + // Main entrypoint of the compression library. + NVTT_API bool process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const; + + // Estimate the size of compressing the input with the given options. + NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const; + }; + + + // Return string for the given error code. + NVTT_API const char * errorString(Error e); + + // Return NVTT version. + NVTT_API unsigned int version(); + +} // nvtt namespace + +#endif // NV_TT_H diff --git a/externals/NVTT/include/nvtt/nvtt_wrapper.h b/externals/NVTT/include/nvtt/nvtt_wrapper.h new file mode 100644 index 00000000..b8407e22 --- /dev/null +++ b/externals/NVTT/include/nvtt/nvtt_wrapper.h @@ -0,0 +1,241 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NVTT_WRAPPER_H +#define NVTT_WRAPPER_H + +// Function linkage +#if NVTT_SHARED + +#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__ +# ifdef NVTT_EXPORTS +# define NVTT_API __declspec(dllexport) +# else +# define NVTT_API __declspec(dllimport) +# endif +#endif + +#if defined __GNUC__ >= 4 +# ifdef NVTT_EXPORTS +# define NVTT_API __attribute__((visibility("default"))) +# endif +#endif + +#endif // NVTT_SHARED + +#if !defined NVTT_API +# define NVTT_API +#endif + +#define NVTT_VERSION 200 + +#ifdef __cplusplus +typedef struct nvtt::InputOptions NvttInputOptions; +typedef struct nvtt::CompressionOptions NvttCompressionOptions; +typedef struct nvtt::OutputOptions NvttOutputOptions; +typedef struct nvtt::Compressor NvttCompressor; +#else +typedef struct NvttInputOptions NvttInputOptions; +typedef struct NvttCompressionOptions NvttCompressionOptions; +typedef struct NvttOutputOptions NvttOutputOptions; +typedef struct NvttCompressor NvttCompressor; +#endif + +/// Supported compression formats. +typedef enum +{ + // No compression. + NVTT_Format_RGB, + NVTT_Format_RGBA = NVTT_Format_RGB, + + // DX9 formats. + NVTT_Format_DXT1, + NVTT_Format_DXT1a, + NVTT_Format_DXT3, + NVTT_Format_DXT5, + NVTT_Format_DXT5n, + + // DX10 formats. + NVTT_Format_BC1 = NVTT_Format_DXT1, + NVTT_Format_BC1a = NVTT_Format_DXT1a, + NVTT_Format_BC2 = NVTT_Format_DXT3, + NVTT_Format_BC3 = NVTT_Format_DXT5, + NVTT_Format_BC3n = NVTT_Format_DXT5n, + NVTT_Format_BC4, + NVTT_Format_BC5, +} NvttFormat; + +/// Quality modes. +typedef enum +{ + NVTT_Quality_Fastest, + NVTT_Quality_Normal, + NVTT_Quality_Production, + NVTT_Quality_Highest, +} NvttQuality; + +/// Wrap modes. +typedef enum +{ + NVTT_WrapMode_Clamp, + NVTT_WrapMode_Repeat, + NVTT_WrapMode_Mirror, +} NvttWrapMode; + +/// Texture types. +typedef enum +{ + NVTT_TextureType_2D, + NVTT_TextureType_Cube, +} NvttTextureType; + +/// Input formats. +typedef enum +{ + NVTT_InputFormat_BGRA_8UB, +} NvttInputFormat; + +/// Mipmap downsampling filters. +typedef enum +{ + NVTT_MipmapFilter_Box, + NVTT_MipmapFilter_Triangle, + NVTT_MipmapFilter_Kaiser, +} NvttMipmapFilter; + +/// Color transformation. +typedef enum +{ + NVTT_ColorTransform_None, + NVTT_ColorTransform_Linear, +} NvttColorTransform; + +/// Extents rounding mode. +typedef enum +{ + NVTT_RoundMode_None, + NVTT_RoundMode_ToNextPowerOfTwo, + NVTT_RoundMode_ToNearestPowerOfTwo, + NVTT_RoundMode_ToPreviousPowerOfTwo, +} NvttRoundMode; + +/// Alpha mode. +typedef enum +{ + NVTT_AlphaMode_None, + NVTT_AlphaMode_Transparency, + NVTT_AlphaMode_Premultiplied, +} NvttAlphaMode; + +typedef enum +{ + NVTT_Error_InvalidInput, + NVTT_Error_UserInterruption, + NVTT_Error_UnsupportedFeature, + NVTT_Error_CudaError, + NVTT_Error_Unknown, + NVTT_Error_FileOpen, + NVTT_Error_FileWrite, +} NvttError; + +typedef enum +{ + NVTT_False, + NVTT_True, +} NvttBoolean; + + +#ifdef __cplusplus +extern "C" { +#endif + +// Callbacks +//typedef void (* nvttErrorHandler)(NvttError e); +//typedef void (* nvttOutputHandler)(const void * data, int size); +//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel); + + +// InputOptions class. +NVTT_API NvttInputOptions * nvttCreateInputOptions(); +NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions); + +NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d); +NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions); +NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap); +NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format); +NVTT_API void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode); +NVTT_API void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma); +NVTT_API void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode); +NVTT_API void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter); +NVTT_API void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel); +NVTT_API void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch); +NVTT_API void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b); +NVTT_API void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert); +NVTT_API void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale); +NVTT_API void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float sm, float medium, float big, float large); +NVTT_API void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b); +NVTT_API void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t); +NVTT_API void nvttSetInputOptionsLinearTransform(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3); +NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim); +NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode); + + +// CompressionOptions class. +NVTT_API NvttCompressionOptions * nvttCreateCompressionOptions(); +NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions); + +NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format); +NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality); +NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha); +NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask); +NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold); + + +// OutputOptions class. +NVTT_API NvttOutputOptions * nvttCreateOutputOptions(); +NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions); + +NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName); +NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b); +//NVTT_API void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler); +//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler); + + +// Compressor class. +NVTT_API NvttCompressor * nvttCreateCompressor(); +NVTT_API void nvttDestroyCompressor(NvttCompressor * compressor); + +NVTT_API NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions); +NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions); + + +// Global functions. +NVTT_API const char * nvttErrorString(NvttError e); +NVTT_API unsigned int nvttVersion(); + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // NVTT_WRAPPER_H diff --git a/externals/NVTT/src/nvcore/BitArray.h b/externals/NVTT/src/nvcore/BitArray.h new file mode 100644 index 00000000..01ab141f --- /dev/null +++ b/externals/NVTT/src/nvcore/BitArray.h @@ -0,0 +1,168 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_BITARRAY_H +#define NV_CORE_BITARRAY_H + +#include +#include + +namespace nv +{ + +/// Count the bits of @a x. +inline uint bitsSet(uint8 x) { + uint count = 0; + for(; x != 0; x >>= 1) { + count += (x & 1); + } + return count; +} + + +/// Count the bits of @a x. +inline uint bitsSet(uint32 x, int bits) { + uint count = 0; + for(; x != 0 && bits != 0; x >>= 1, bits--) { + count += (x & 1); + } + return count; +} + + +/// Simple bit array. +class BitArray +{ +public: + + /// Default ctor. + BitArray() {} + + /// Ctor with initial m_size. + BitArray(uint sz) + { + resize(sz); + } + + /// Get array m_size. + uint size() const { return m_size; } + + /// Clear array m_size. + void clear() { resize(0); } + + /// Set array m_size. + void resize(uint sz) + { + m_size = sz; + m_bitArray.resize( (m_size + 7) >> 3 ); + } + + /// Get bit. + bool bitAt(uint b) const + { + nvDebugCheck( b < m_size ); + return (m_bitArray[b >> 3] & (1 << (b & 7))) != 0; + } + + /// Set a bit. + void setBitAt(uint b) + { + nvDebugCheck( b < m_size ); + m_bitArray[b >> 3] |= (1 << (b & 7)); + } + + /// Clear a bit. + void clearBitAt( uint b ) + { + nvDebugCheck( b < m_size ); + m_bitArray[b >> 3] &= ~(1 << (b & 7)); + } + + /// Clear all the bits. + void clearAll() + { + memset(m_bitArray.unsecureBuffer(), 0, m_bitArray.size()); + } + + /// Set all the bits. + void setAll() + { + memset(m_bitArray.unsecureBuffer(), 0xFF, m_bitArray.size()); + } + + /// Toggle all the bits. + void toggleAll() + { + const uint byte_num = m_bitArray.size(); + for(uint b = 0; b < byte_num; b++) { + m_bitArray[b] ^= 0xFF; + } + } + + /// Get a byte of the bit array. + const uint8 & byteAt(uint index) const + { + return m_bitArray[index]; + } + + /// Set the given byte of the byte array. + void setByteAt(uint index, uint8 b) + { + m_bitArray[index] = b; + } + + /// Count the number of bits set. + uint countSetBits() const + { + const uint num = m_bitArray.size(); + if( num == 0 ) { + return 0; + } + + uint count = 0; + for(uint i = 0; i < num - 1; i++) { + count += bitsSet(m_bitArray[i]); + } + count += bitsSet(m_bitArray[num-1], m_size & 0x7); + + //piDebugCheck(count + countClearBits() == m_size); + return count; + } + + /// Count the number of bits clear. + uint countClearBits() const { + + const uint num = m_bitArray.size(); + if( num == 0 ) { + return 0; + } + + uint count = 0; + for(uint i = 0; i < num - 1; i++) { + count += bitsSet(~m_bitArray[i]); + } + count += bitsSet(~m_bitArray[num-1], m_size & 0x7); + + //piDebugCheck(count + countSetBits() == m_size); + return count; + } + + friend void swap(BitArray & a, BitArray & b) + { + swap(a.m_size, b.m_size); + swap(a.m_bitArray, b.m_bitArray); + } + + +private: + + /// Number of bits stored. + uint m_size; + + /// Array of bits. + Array m_bitArray; + +}; + +} // nv namespace + +#endif // _PI_CORE_BITARRAY_H_ diff --git a/externals/NVTT/src/nvcore/CMakeLists.txt b/externals/NVTT/src/nvcore/CMakeLists.txt new file mode 100644 index 00000000..385e2012 --- /dev/null +++ b/externals/NVTT/src/nvcore/CMakeLists.txt @@ -0,0 +1,47 @@ +PROJECT(nvcore) +ADD_SUBDIRECTORY(poshlib) + +SET(CORE_SRCS + nvcore.h + Ptr.h + BitArray.h + Memory.h + Memory.cpp + Debug.h + Debug.cpp + Containers.h + StrLib.h + StrLib.cpp + Stream.h + StdStream.h + TextReader.h + TextReader.cpp + TextWriter.h + TextWriter.cpp + Radix.h + Radix.cpp + Library.h + Library.cpp) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +# targets +ADD_DEFINITIONS(-DNVCORE_EXPORTS) + +IF(UNIX) + SET(LIBS ${LIBS} ${CMAKE_DL_LIBS}) +ENDIF(UNIX) + +IF(NVCORE_SHARED) + ADD_DEFINITIONS(-DNVCORE_SHARED=1) + ADD_LIBRARY(nvcore SHARED ${CORE_SRCS}) +ELSE(NVCORE_SHARED) + ADD_LIBRARY(nvcore ${CORE_SRCS}) +ENDIF(NVCORE_SHARED) + +TARGET_LINK_LIBRARIES(nvcore ${LIBS}) + +INSTALL(TARGETS nvcore + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) diff --git a/externals/NVTT/src/nvcore/Containers.h b/externals/NVTT/src/nvcore/Containers.h new file mode 100644 index 00000000..f0b63d41 --- /dev/null +++ b/externals/NVTT/src/nvcore/Containers.h @@ -0,0 +1,1059 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_CONTAINER_H +#define NV_CORE_CONTAINER_H + +/* +These containers are based on Thatcher Ulrich containers, +donated to the Public Domain. + +I've also borrowed some ideas from the Qt toolkit, specially the cool +foreach iterator. + +TODO +Do not use memmove in insert & remove, use copy ctors instead. +*/ + + +// nvcore +#include +#include +#include + +#include // memmove +#include // for placement new + + +#if NV_CC_GNUC // If typeof is available: + +#define NV_FOREACH(i, container) \ + typedef typeof(container) NV_STRING_JOIN2(cont,__LINE__); \ + for(NV_STRING_JOIN2(cont,__LINE__)::PseudoIndex i((container).start()); !(container).isDone(i); (container).advance(i)) +/* +#define NV_FOREACH(i, container) \ + for(typename typeof(container)::PseudoIndex i((container).start()); !(container).isDone(i); (container).advance(i)) +*/ + +#else // If typeof not available: + +struct PseudoIndexWrapper { + template + PseudoIndexWrapper(const T & container) { + nvStaticCheck(sizeof(typename T::PseudoIndex) <= sizeof(memory)); + new (memory) typename T::PseudoIndex(container.start()); + } + // PseudoIndex cannot have a dtor! + + template typename T::PseudoIndex & operator()(const T * container) { + return *reinterpret_cast(memory); + } + template const typename T::PseudoIndex & operator()(const T * container) const { + return *reinterpret_cast(memory); + } + + uint8 memory[4]; // Increase the size if we have bigger enumerators. +}; + +#define NV_FOREACH(i, container) \ + for(PseudoIndexWrapper i(container); !(container).isDone(i(&(container))); (container).advance(i(&(container)))) + +#endif + +// Declare foreach keyword. +#if !defined NV_NO_USE_KEYWORDS +# define foreach NV_FOREACH +#endif + + + +namespace nv +{ + // Templates + + /// Return the maximum of two values. + template + inline const T & max(const T & a, const T & b) + { + //return std::max(a, b); + if( a < b ) { + return b; + } + return a; + } + + /// Return the minimum of two values. + template + inline const T & min(const T & a, const T & b) + { + //return std::min(a, b); + if( b < a ) { + return b; + } + return a; + } + + /// Clamp between two values. + template + inline const T & clamp(const T & x, const T & a, const T & b) + { + return min(max(x, a), b); + } + + /// Swap two values. + template + inline void swap(T & a, T & b) + { + //return std::swap(a, b); + T temp = a; + a = b; + b = temp; + } + + template struct hash + { + inline uint sdbm_hash(const void * data_in, uint size, uint h = 5381) + { + const uint8 * data = (const uint8 *) data_in; + uint i = 0; + while (i < size) { + h = (h << 16) + (h << 6) - h + (uint) data[i++]; + } + return h; + } + + uint operator()(const Key & k) { + return sdbm_hash(&k, sizeof(Key)); + } + }; + template <> struct hash + { + uint operator()(int x) const { return x; } + }; + template <> struct hash + { + uint operator()(uint x) const { return x; } + }; + + /// Delete all the elements of a container. + template + void deleteAll(T & container) + { + for(typename T::PseudoIndex i = container.start(); !container.isDone(i); container.advance(i)) + { + delete container[i]; + } + } + + + /** Return the next power of two. + * @see http://graphics.stanford.edu/~seander/bithacks.html + * @warning Behaviour for 0 is undefined. + * @note isPowerOfTwo(x) == true -> nextPowerOfTwo(x) == x + * @note nextPowerOfTwo(x) = 2 << log2(x-1) + */ + inline uint nextPowerOfTwo( uint x ) + { + nvDebugCheck( x != 0 ); + #if 1 // On modern CPUs this is as fast as using the bsr instruction. + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; + return x+1; + #else + uint p = 1; + while( x > p ) { + p += p; + } + return p; + #endif + } + + /// Return true if @a n is a power of two. + inline bool isPowerOfTwo( uint n ) + { + return (n & (n-1)) == 0; + } + + /// Simple iterator interface. + template + struct Iterator + { + virtual void advance(); + virtual bool isDone(); + virtual T current(); + }; + + + /** + * Replacement for std::vector that is easier to debug and provides + * some nice foreach enumerators. + */ + template + class NVCORE_CLASS Array { + public: + + /// Ctor. + Array() : m_buffer(NULL), m_size(0), m_buffer_size(0) + { + } + + /// Copy ctor. + Array( const Array & a ) : m_buffer(NULL), m_size(0), m_buffer_size(0) + { + copy(a.m_buffer, a.m_size); + } + + /// Ctor that initializes the vector with the given elements. + Array( const T * ptr, int num ) : m_buffer(NULL), m_size(0), m_buffer_size(0) + { + copy(ptr, num); + } + + /// Allocate array. + explicit Array(uint capacity) : m_buffer(NULL), m_size(0), m_buffer_size(0) + { + allocate(capacity); + } + + + /// Dtor. + ~Array() + { + clear(); + allocate(0); + } + + + /// Const and save vector access. + const T & operator[]( uint index ) const + { + nvDebugCheck(index < m_size); + return m_buffer[index]; + } + + /// Safe vector access. + T & operator[] ( uint index ) + { + nvDebugCheck(index < m_size); + return m_buffer[index]; + } + + + /// Get vector size. + uint size() const { return m_size; } + + /// Get vector size. + uint count() const { return m_size; } + + /// Get const vector pointer. + const T * buffer() const { return m_buffer; } + + /// Get vector pointer. + T * unsecureBuffer() { return m_buffer; } + + /// Is vector empty. + bool isEmpty() const { return m_size == 0; } + + /// Is a null vector. + bool isNull() const { return m_buffer == NULL; } + + + /// Push an element at the end of the vector. + void push_back( const T & val ) + { + uint new_size = m_size + 1; + + if (new_size > m_buffer_size) + { + const T copy(val); // create a copy in case value is inside of this array. + resize(new_size); + m_buffer[new_size-1] = copy; + } + else + { + m_size = new_size; + new(m_buffer+new_size-1) T(val); + } + } + void pushBack( const T & val ) + { + push_back(val); + } + void append( const T & val ) + { + push_back(val); + } + + /// Qt like push operator. + Array & operator<< ( T & t ) + { + push_back(t); + return *this; + } + + /// Pop and return element at the end of the vector. + void pop_back() + { + nvDebugCheck( m_size > 0 ); + resize( m_size - 1 ); + } + void popBack() + { + pop_back(); + } + + /// Get back element. + const T & back() const + { + nvDebugCheck( m_size > 0 ); + return m_buffer[m_size-1]; + } + + /// Get back element. + T & back() + { + nvDebugCheck( m_size > 0 ); + return m_buffer[m_size-1]; + } + + /// Get front element. + const T & front() const + { + nvDebugCheck( m_size > 0 ); + return m_buffer[0]; + } + + /// Get front element. + T & front() + { + nvDebugCheck( m_size > 0 ); + return m_buffer[0]; + } + + /// Check if the given element is contained in the array. + bool contains(const T & e) const + { + for (uint i = 0; i < m_size; i++) { + if (m_buffer[i] == e) return true; + } + return false; + } + + /// Remove the element at the given index. This is an expensive operation! + void removeAt( uint index ) + { + nvCheck(index >= 0 && index < m_size); + + if( m_size == 1 ) { + clear(); + } + else { + m_buffer[index].~T(); + + memmove( m_buffer+index, m_buffer+index+1, sizeof(T) * (m_size - 1 - index) ); + m_size--; + } + } + + /// Remove the first instance of the given element. + void remove(const T & element) + { + for(PseudoIndex i = start(); !isDone(i); advance(i)) { + removeAt(i); + break; + } + } + + /// Insert the given element at the given index shifting all the elements up. + void insertAt( uint index, const T & val = T() ) + { + nvCheck( index >= 0 && index <= m_size ); + + resize( m_size + 1 ); + + if( index < m_size - 1 ) { + memmove( m_buffer+index+1, m_buffer+index, sizeof(T) * (m_size - 1 - index) ); + } + + // Copy-construct into the newly opened slot. + new(m_buffer+index) T(val); + } + + /// Append the given data to our vector. + void append(const Array & other) + { + append(other.m_buffer, other.m_size); + } + + /// Append the given data to our vector. + void append(const T other[], uint count) + { + if( count > 0 ) { + const uint old_size = m_size; + resize(m_size + count); + // Must use operator=() to copy elements, in case of side effects (e.g. ref-counting). + for( uint i = 0; i < count; i++ ) { + m_buffer[old_size + i] = other[i]; + } + } + } + + + /// Remove the given element by replacing it with the last one. + void replaceWithLast(uint index) + { + nvDebugCheck( index < m_size ); + m_buffer[index] = back(); + (m_buffer+m_size-1)->~T(); + m_size--; + } + + + /// Resize the vector preserving existing elements. + void resize(uint new_size) + { + uint i; + uint old_size = m_size; + m_size = new_size; + + // Destruct old elements (if we're shrinking). + for( i = new_size; i < old_size; i++ ) { + (m_buffer+i)->~T(); // Explicit call to the destructor + } + + if( m_size == 0 ) { + //Allocate(0); // Don't shrink automatically. + } + else if( m_size <= m_buffer_size/* && m_size > m_buffer_size >> 1*/) { + // don't compact yet. + nvDebugCheck(m_buffer != NULL); + } + else { + uint new_buffer_size; + if( m_buffer_size == 0 ) { + // first allocation + new_buffer_size = m_size; + } + else { + // growing + new_buffer_size = m_size + (m_size >> 2); + } + allocate( new_buffer_size ); + } + + // Call default constructors + for( i = old_size; i < new_size; i++ ) { + new(m_buffer+i) T; // placement new + } + } + + + /// Resize the vector preserving existing elements and initializing the + /// new ones with the given value. + void resize( uint new_size, const T &elem ) + { + uint i; + uint old_size = m_size; + m_size = new_size; + + // Destruct old elements (if we're shrinking). + for( i = new_size; i < old_size; i++ ) { + (m_buffer+i)->~T(); // Explicit call to the destructor + } + + if( m_size == 0 ) { + //Allocate(0); // Don't shrink automatically. + } + else if( m_size <= m_buffer_size && m_size > m_buffer_size >> 1 ) { + // don't compact yet. + } + else { + uint new_buffer_size; + if( m_buffer_size == 0 ) { + // first allocation + new_buffer_size = m_size; + } + else { + // growing + new_buffer_size = m_size + (m_size >> 2); + } + allocate( new_buffer_size ); + } + + // Call copy constructors + for( i = old_size; i < new_size; i++ ) { + new(m_buffer+i) T( elem ); // placement new + } + } + + /// Tighten the memory used by the container. + void tighten() + { + // TODO Reallocate only if worth. + } + + /// Clear the buffer. + void clear() + { + resize(0); + } + + /// Shrink the allocated vector. + void shrink() + { + if( m_size < m_buffer_size ) { + allocate(m_size); + } + } + + /// Preallocate space. + void reserve(uint desired_size) + { + if( desired_size > m_buffer_size ) { + allocate( desired_size ); + } + } + + /// Copy memory to our vector. Resizes the vector if needed. + void copy( const T * ptr, uint num ) + { + resize( num ); + for(uint i = 0; i < m_size; i++) { + m_buffer[i] = ptr[i]; + } + } + + /// Assignment operator. + void operator=( const Array & a ) + { + copy( a.m_buffer, a.m_size ); + } + + /* + /// Array serialization. + friend Stream & operator<< ( Stream & s, Array & p ) + { + if( s.isLoading() ) { + uint size; + s << size; + p.resize( size ); + } + else { + s << p.m_size; + } + + for( uint i = 0; i < p.m_size; i++ ) { + s << p.m_buffer[i]; + } + + return s; + } + */ + + // Array enumerator. + typedef uint PseudoIndex; + + PseudoIndex start() const { return 0; } + bool isDone(const PseudoIndex & i) const { nvDebugCheck(i <= this->m_size); return i == this->m_size; }; + void advance(PseudoIndex & i) const { nvDebugCheck(i <= this->m_size); i++; } + + #if NV_CC_MSVC + T & operator[]( const PseudoIndexWrapper & i ) { + return m_buffer[i(this)]; + } + const T & operator[]( const PseudoIndexWrapper & i ) const { + return m_buffer[i(this)]; + } + #endif + + + /// Swap the members of this vector and the given vector. + friend void swap(Array & a, Array & b) + { + swap(a.m_buffer, b.m_buffer); + swap(a.m_size, b.m_size); + swap(a.m_buffer_size, b.m_buffer_size); + } + + + private: + + /// Change buffer size. + void allocate( uint rsize ) + { + m_buffer_size = rsize; + + // free the buffer. + if( m_buffer_size == 0 ) { + if( m_buffer ) { + mem::free( m_buffer ); + m_buffer = NULL; + } + } + + // realloc the buffer + else { + if( m_buffer ) m_buffer = (T *) mem::realloc( m_buffer, sizeof(T) * m_buffer_size ); + else m_buffer = (T *) mem::malloc( sizeof(T) * m_buffer_size ); + } + } + + + private: + T * m_buffer; + uint m_size; + uint m_buffer_size; + }; + + + + /** Thatcher Ulrich's hash table. + * + * Hash table, linear probing, internal chaining. One + * interesting/nice thing about this implementation is that the table + * itself is a flat chunk of memory containing no pointers, only + * relative indices. If the key and value types of the hash contain + * no pointers, then the hash can be serialized using raw IO. Could + * come in handy. + * + * Never shrinks, unless you explicitly clear() it. Expands on + * demand, though. For best results, if you know roughly how big your + * table will be, default it to that size when you create it. + */ + template > + class NVCORE_CLASS HashMap + { + NV_FORBID_COPY(HashMap) + public: + + /// Default ctor. + HashMap() : entry_count(0), size_mask(-1), table(NULL) { } + + /// Ctor with size hint. + explicit HashMap(int size_hint) : entry_count(0), size_mask(-1), table(NULL) { setCapacity(size_hint); } + + /// Dtor. + ~HashMap() { clear(); } + + + /// Set a new or existing value under the key, to the value. + void set(const T& key, const U& value) + { + int index = findIndex(key); + if (index >= 0) + { + E(index).value = value; + return; + } + + // Entry under key doesn't exist. + add(key, value); + } + + + /// Add a new value to the hash table, under the specified key. + void add(const T& key, const U& value) + { + nvCheck(findIndex(key) == -1); + + checkExpand(); + nvCheck(table != NULL); + entry_count++; + + const uint hash_value = hash_functor()(key); + const int index = hash_value & size_mask; + + Entry * natural_entry = &(E(index)); + + if (natural_entry->isEmpty()) + { + // Put the new entry in. + new (natural_entry) Entry(key, value, -1, hash_value); + } + else + { + // Find a blank spot. + int blank_index = index; + for (;;) + { + blank_index = (blank_index + 1) & size_mask; + if (E(blank_index).isEmpty()) break; // found it + } + Entry * blank_entry = &E(blank_index); + + if (int(natural_entry->hash_value & size_mask) == index) + { + // Collision. Link into this chain. + + // Move existing list head. + new (blank_entry) Entry(*natural_entry); // placement new, copy ctor + + // Put the new info in the natural entry. + natural_entry->key = key; + natural_entry->value = value; + natural_entry->next_in_chain = blank_index; + natural_entry->hash_value = hash_value; + } + else + { + // Existing entry does not naturally + // belong in this slot. Existing + // entry must be moved. + + // Find natural location of collided element (i.e. root of chain) + int collided_index = natural_entry->hash_value & size_mask; + for (;;) + { + Entry * e = &E(collided_index); + if (e->next_in_chain == index) + { + // Here's where we need to splice. + new (blank_entry) Entry(*natural_entry); + e->next_in_chain = blank_index; + break; + } + collided_index = e->next_in_chain; + nvCheck(collided_index >= 0 && collided_index <= size_mask); + } + + // Put the new data in the natural entry. + natural_entry->key = key; + natural_entry->value = value; + natural_entry->hash_value = hash_value; + natural_entry->next_in_chain = -1; + } + } + } + + + /// Remove the first value under the specified key. + bool remove(const T& key) + { + if (table == NULL) + { + return false; + } + + int index = findIndex(key); + if (index < 0) + { + return false; + } + + Entry * entry = &E(index); + + if( entry->isEndOfChain() ) { + entry->clear(); + } + else { + // Get next entry. + Entry & next_entry = E(entry->next_in_chain); + + // Copy next entry in this place. + new (entry) Entry(next_entry); + + next_entry.clear(); + } + + entry_count--; + + return true; + } + + + /// Remove all entries from the hash table. + void clear() + { + if (table != NULL) + { + // Delete the entries. + for (int i = 0, n = size_mask; i <= n; i++) + { + Entry * e = &E(i); + if (e->isEmpty() == false) + { + e->clear(); + } + } + mem::free(table); + table = NULL; + entry_count = 0; + size_mask = -1; + } + } + + + /// Returns true if the hash is empty. + bool isEmpty() const + { + return table == NULL || entry_count == 0; + } + + + /** Retrieve the value under the given key. + * + * If there's no value under the key, then return false and leave + * *value alone. + * + * If there is a value, return true, and set *value to the entry's + * value. + * + * If value == NULL, return true or false according to the + * presence of the key, but don't touch *value. + */ + bool get(const T& key, U* value = NULL) const + { + int index = findIndex(key); + if (index >= 0) + { + if (value) { + *value = E(index).value; // take care with side-effects! + } + return true; + } + return false; + } + + /// Determine if the given key is contained in the hash. + bool contains(const T & key) const + { + return get(key); + } + + /// Number of entries in the hash. + int size() const + { + return entry_count; + } + + /// Number of entries in the hash. + int count() const + { + return size(); + } + + + /** + * Resize the hash table to fit one more entry. Often this + * doesn't involve any action. + */ + void checkExpand() + { + if (table == NULL) { + // Initial creation of table. Make a minimum-sized table. + setRawCapacity(16); + } + else if (entry_count * 3 > (size_mask + 1) * 2) { + // Table is more than 2/3rds full. Expand. + setRawCapacity(entry_count * 2); + } + } + + + /// Hint the bucket count to >= n. + void resize(int n) + { + // Not really sure what this means in relation to + // STLport's hash_map... they say they "increase the + // bucket count to at least n" -- but does that mean + // their real capacity after resize(n) is more like + // n*2 (since they do linked-list chaining within + // buckets?). + setCapacity(n); + } + + /** + * Size the hash so that it can comfortably contain the given + * number of elements. If the hash already contains more + * elements than new_size, then this may be a no-op. + */ + void setCapacity(int new_size) + { + int new_raw_size = (new_size * 3) / 2; + if (new_raw_size < size()) { return; } + + setRawCapacity(new_raw_size); + } + + /// Behaves much like std::pair. + struct Entry + { + int next_in_chain; // internal chaining for collisions + uint hash_value; // avoids recomputing. Worthwhile? + T key; + U value; + + Entry() : next_in_chain(-2) {} + Entry(const Entry& e) + : next_in_chain(e.next_in_chain), hash_value(e.hash_value), key(e.key), value(e.value) + { + } + Entry(const T& k, const U& v, int next, int hash) + : next_in_chain(next), hash_value(hash), key(k), value(v) + { + } + bool isEmpty() const { return next_in_chain == -2; } + bool isEndOfChain() const { return next_in_chain == -1; } + + void clear() + { + key.~T(); // placement delete + value.~U(); // placement delete + next_in_chain = -2; + } + }; + + + // HashMap enumerator. + typedef int PseudoIndex; + PseudoIndex start() const { PseudoIndex i = 0; findNext(i); return i; } + bool isDone(const PseudoIndex & i) const { nvDebugCheck(i <= size_mask+1); return i == size_mask+1; }; + void advance(PseudoIndex & i) const { nvDebugCheck(i <= size_mask+1); i++; findNext(i); } + + #if NV_CC_GNUC + Entry & operator[]( const PseudoIndex & i ) { + return E(i); + } + const Entry & operator[]( const PseudoIndex & i ) const { + return E(i); + } + #elif NV_CC_MSVC + Entry & operator[]( const PseudoIndexWrapper & i ) { + return E(i(this)); + } + const Entry & operator[]( const PseudoIndexWrapper & i ) const { + return E(i(this)); + } + #endif + + + + private: + + // Find the index of the matching entry. If no match, then return -1. + int findIndex(const T& key) const + { + if (table == NULL) return -1; + + uint hash_value = hash_functor()(key); + int index = hash_value & size_mask; + + const Entry * e = &E(index); + if (e->isEmpty()) return -1; + if (int(e->hash_value & size_mask) != index) return -1; // occupied by a collider + + for (;;) + { + nvCheck((e->hash_value & size_mask) == (hash_value & size_mask)); + + if (e->hash_value == hash_value && e->key == key) + { + // Found it. + return index; + } + nvDebugCheck(! (e->key == key)); // keys are equal, but hash differs! + + // Keep looking through the chain. + index = e->next_in_chain; + if (index == -1) break; // end of chain + + nvCheck(index >= 0 && index <= size_mask); + e = &E(index); + + nvCheck(e->isEmpty() == false); + } + return -1; + } + + // Helpers. + Entry & E(int index) + { + nvDebugCheck(table != NULL); + nvDebugCheck(index >= 0 && index <= size_mask); + return table[index]; + } + const Entry & E(int index) const + { + nvDebugCheck(table != NULL); + nvDebugCheck(index >= 0 && index <= size_mask); + return table[index]; + } + + + /** + * Resize the hash table to the given size (Rehash the + * contents of the current table). The arg is the number of + * hash table entries, not the number of elements we should + * actually contain (which will be less than this). + */ + void setRawCapacity(int new_size) + { + if (new_size <= 0) { + // Special case. + clear(); + return; + } + + // Force new_size to be a power of two. + new_size = nextPowerOfTwo(new_size); + + HashMap new_hash; + new_hash.table = (Entry *) mem::malloc(sizeof(Entry) * new_size); + nvDebugCheck(new_hash.table != NULL); + + new_hash.entry_count = 0; + new_hash.size_mask = new_size - 1; + for (int i = 0; i < new_size; i++) + { + new_hash.E(i).next_in_chain = -2; // mark empty + } + + // Copy stuff to new_hash + if (table != NULL) + { + for (int i = 0, n = size_mask; i <= n; i++) + { + Entry * e = &E(i); + if (e->isEmpty() == false) + { + // Insert old entry into new hash. + new_hash.add(e->key, e->value); + e->clear(); // placement delete of old element + } + } + + // Delete our old data buffer. + mem::free(table); + } + + // Steal new_hash's data. + entry_count = new_hash.entry_count; + size_mask = new_hash.size_mask; + table = new_hash.table; + new_hash.entry_count = 0; + new_hash.size_mask = -1; + new_hash.table = NULL; + } + + // Move the enumerator to the next valid element. + void findNext(PseudoIndex & i) const { + while (i <= size_mask && E(i).isEmpty()) { + i++; + } + } + + + int entry_count; + int size_mask; + Entry * table; + + }; + + + +} // nv namespace + +#endif // NV_CORE_CONTAINER_H diff --git a/externals/NVTT/src/nvcore/Debug.cpp b/externals/NVTT/src/nvcore/Debug.cpp new file mode 100644 index 00000000..0babc0fd --- /dev/null +++ b/externals/NVTT/src/nvcore/Debug.cpp @@ -0,0 +1,537 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include + +// Extern +#if NV_OS_WIN32 //&& NV_CC_MSVC +# define WIN32_LEAN_AND_MEAN +# define VC_EXTRALEAN +# include +# include +# if NV_CC_MSVC +# include +# if _MSC_VER < 1300 +# define DECLSPEC_DEPRECATED + // VC6: change this path to your Platform SDK headers +# include // must be XP version of file +// include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" +# else + // VC7: ships with updated headers +# include +# endif +# endif +#endif + +#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) +# include +#endif + +#if NV_OS_LINUX && defined(HAVE_EXECINFO_H) +# include // backtrace +# if NV_CC_GNUC // defined(HAVE_CXXABI_H) +# include +# endif +#endif + +#if NV_OS_DARWIN +# include // getpid +# include +# include // sysctl +# include +# undef HAVE_EXECINFO_H +# if defined(HAVE_EXECINFO_H) // only after OSX 10.5 +# include // backtrace +# if NV_CC_GNUC // defined(HAVE_CXXABI_H) +# include +# endif +# endif +#endif + +#include // std::runtime_error +#undef assert // defined on mingw + +using namespace nv; + +namespace +{ + + static MessageHandler * s_message_handler = NULL; + static AssertHandler * s_assert_handler = NULL; + + static bool s_sig_handler_enabled = false; + +#if NV_OS_WIN32 && NV_CC_MSVC + + // Old exception filter. + static LPTOP_LEVEL_EXCEPTION_FILTER s_old_exception_filter = NULL; + +#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) + + // Old signal handlers. + struct sigaction s_old_sigsegv; + struct sigaction s_old_sigtrap; + struct sigaction s_old_sigfpe; + struct sigaction s_old_sigbus; + +#endif + + +#if NV_OS_WIN32 && NV_CC_MSVC + + // TODO write minidump + + static LONG WINAPI nvTopLevelFilter( struct _EXCEPTION_POINTERS * pExceptionInfo) + { + NV_UNUSED(pExceptionInfo); + /* BOOL (WINAPI * Dump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION ); + + AutoString dbghelp_path(512); + getcwd(dbghelp_path, 512); + dbghelp_path.Append("\\DbgHelp.dll"); + nvTranslatePath(dbghelp_path); + + PiLibrary DbgHelp_lib(dbghelp_path, true); + + if( !DbgHelp_lib.IsValid() ) { + nvDebug("*** 'DbgHelp.dll' not found.\n"); + return EXCEPTION_CONTINUE_SEARCH; + } + + if( !DbgHelp_lib.BindSymbol( (void **)&Dump, "MiniDumpWriteDump" ) ) { + nvDebug("*** 'DbgHelp.dll' too old.\n"); + return EXCEPTION_CONTINUE_SEARCH; + } + + // create the file + HANDLE hFile = ::CreateFile( "nv.dmp", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); + if( hFile == INVALID_HANDLE_VALUE ) { + nvDebug("*** Failed to create dump file.\n"); + return EXCEPTION_CONTINUE_SEARCH; + } + + + _MINIDUMP_EXCEPTION_INFORMATION ExInfo; + + ExInfo.ThreadId = ::GetCurrentThreadId(); + ExInfo.ExceptionPointers = pExceptionInfo; + ExInfo.ClientPointers = NULL; + + // write the dump + bool ok = Dump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL )!=0; + ::CloseHandle(hFile); + + if( !ok ) { + nvDebug("*** Failed to save dump file.\n"); + return EXCEPTION_CONTINUE_SEARCH; + } + + nvDebug("--- Dump file saved.\n"); + */ + return EXCEPTION_CONTINUE_SEARCH; + } + +#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) // NV_OS_LINUX || NV_OS_DARWIN + +#if defined(HAVE_EXECINFO_H) // NV_OS_LINUX + + static bool nvHasStackTrace() { +#if NV_OS_DARWIN + return backtrace != NULL; +#else + return true; +#endif + } + + static void nvPrintStackTrace(void * trace[], int size, int start=0) { + char ** string_array = backtrace_symbols(trace, size); + + nvDebug( "\nDumping stacktrace:\n" ); + for(int i = start; i < size-1; i++ ) { +# if NV_CC_GNUC // defined(HAVE_CXXABI_H) + char * begin = strchr(string_array[i], '('); + char * end = strchr(string_array[i], '+'); + if( begin != 0 && begin < end ) { + int stat; + *end = '\0'; + *begin = '\0'; + char * module = string_array[i]; + char * name = abi::__cxa_demangle(begin+1, 0, 0, &stat); + if( name == NULL || begin[1] != '_' || begin[2] != 'Z' ) { + nvDebug( " In: [%s] '%s'\n", module, begin+1 ); + } + else { + nvDebug( " In: [%s] '%s'\n", module, name ); + } + free(name); + } + else { + nvDebug( " In: '%s'\n", string_array[i] ); + } +# else + nvDebug( " In: '%s'\n", string_array[i] ); +# endif + } + nvDebug("\n"); + + free(string_array); + } + +#endif // defined(HAVE_EXECINFO_H) + + static void * callerAddress(void * secret) + { +# if NV_OS_DARWIN +# if defined(_STRUCT_MCONTEXT) +# if NV_CPU_PPC + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext->__ss.__srr0; +# elif NV_CPU_X86 + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext->__ss.__eip; +# endif +# else +# if NV_CPU_PPC + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext->ss.srr0; +# elif NV_CPU_X86 + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext->ss.eip; +# endif +# endif +# else +# if NV_CPU_X86_64 + // #define REG_RIP REG_INDEX(rip) // seems to be 16 + ucontext_t * ucp = (ucontext_t *)secret; + return (void *)ucp->uc_mcontext.gregs[REG_RIP]; +# elif NV_CPU_X86 + ucontext_t * ucp = (ucontext_t *)secret; + return (void *)ucp->uc_mcontext.gregs[14/*REG_EIP*/]; +# elif NV_CPU_PPC + ucontext_t * ucp = (ucontext_t *)secret; + return (void *) ucp->uc_mcontext.regs->nip; +# endif +# endif + + // How to obtain the instruction pointers in different platforms, from mlton's source code. + // http://mlton.org/ + // OpenBSD && NetBSD + // ucp->sc_eip + // FreeBSD: + // ucp->uc_mcontext.mc_eip + // HPUX: + // ucp->uc_link + // Solaris: + // ucp->uc_mcontext.gregs[REG_PC] + // Linux hppa: + // uc->uc_mcontext.sc_iaoq[0] & ~0x3UL + // Linux sparc: + // ((struct sigcontext*) secret)->sigc_regs.tpc + // Linux sparc64: + // ((struct sigcontext*) secret)->si_regs.pc + + // potentially correct for other archs: + // Linux alpha: ucp->m_context.sc_pc + // Linux arm: ucp->m_context.ctx.arm_pc + // Linux ia64: ucp->m_context.sc_ip & ~0x3UL + // Linux mips: ucp->m_context.sc_pc + // Linux s390: ucp->m_context.sregs->regs.psw.addr + } + + static void nvSigHandler(int sig, siginfo_t *info, void *secret) + { + void * pnt = callerAddress(secret); + + // Do something useful with siginfo_t + if (sig == SIGSEGV) { + if (pnt != NULL) nvDebug("Got signal %d, faulty address is %p, from %p\n", sig, info->si_addr, pnt); + else nvDebug("Got signal %d, faulty address is %p\n", sig, info->si_addr); + } + else if(sig == SIGTRAP) { + nvDebug("Breakpoint hit.\n"); + } + else { + nvDebug("Got signal %d\n", sig); + } + +# if defined(HAVE_EXECINFO_H) + if (nvHasStackTrace()) // in case of weak linking + { + void * trace[64]; + int size = backtrace(trace, 64); + + if (pnt != NULL) { + // Overwrite sigaction with caller's address. + trace[1] = pnt; + } + + nvPrintStackTrace(trace, size, 1); + } +# endif // defined(HAVE_EXECINFO_H) + + exit(0); + } + +#endif // defined(HAVE_SIGNAL_H) + + + +#if NV_OS_WIN32 //&& NV_CC_MSVC + + /** Win32 asset handler. */ + struct Win32AssertHandler : public AssertHandler + { + // Code from Daniel Vogel. + static bool isDebuggerPresent() + { + bool result = false; + + HINSTANCE kern_lib = LoadLibraryExA( "kernel32.dll", NULL, 0 ); + if( kern_lib ) { + FARPROC lIsDebuggerPresent = GetProcAddress( kern_lib, "IsDebuggerPresent" ); + if( lIsDebuggerPresent && lIsDebuggerPresent() ) { + result = true; + } + + FreeLibrary( kern_lib ); + } + return result; + } + + // Flush the message queue. This is necessary for the message box to show up. + static void flushMessageQueue() + { + MSG msg; + while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { + if( msg.message == WM_QUIT ) break; + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + } + + // Assert handler method. + virtual int assert( const char * exp, const char * file, int line, const char * func/*=NULL*/ ) + { + int ret = NV_ABORT_EXIT; + + StringBuilder error_string; + if( func != NULL ) { + error_string.format( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line ); + nvDebug( error_string ); + } + else { + error_string.format( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line ); + nvDebug( error_string ); + } + + #if _DEBUG + + if( isDebuggerPresent() ) { + return NV_ABORT_DEBUG; + } + + flushMessageQueue(); + int action = MessageBoxA(NULL, error_string, "Assertion failed", MB_ABORTRETRYIGNORE|MB_ICONERROR); + switch( action ) { + case IDRETRY: + ret = NV_ABORT_DEBUG; + break; + case IDIGNORE: + ret = NV_ABORT_IGNORE; + break; + case IDABORT: + default: + ret = NV_ABORT_EXIT; + break; + } + /*if( _CrtDbgReport( _CRT_ASSERT, file, line, module, exp ) == 1 ) { + return NV_ABORT_DEBUG; + }*/ + + #endif + + if( ret == NV_ABORT_EXIT ) { + // Exit cleanly. + throw std::runtime_error("Assertion failed"); + } + + return ret; + } + }; + +#else + + /** Unix asset handler. */ + struct UnixAssertHandler : public AssertHandler + { + bool isDebuggerPresent() + { +# if NV_OS_DARWIN + int mib[4]; + struct kinfo_proc info; + size_t size; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + size = sizeof(info); + info.kp_proc.p_flag = 0; + sysctl(mib,4,&info,&size,NULL,0); + return ((info.kp_proc.p_flag & P_TRACED) == P_TRACED); +# else + // if ppid != sid, some process spawned our app, probably a debugger. + return getsid(getpid()) != getppid(); +# endif + } + + // Assert handler method. + virtual int assert(const char * exp, const char * file, int line, const char * func) + { + if( func != NULL ) { + nvDebug( "*** Assertion failed: %s\n On file: %s\n On function: %s\n On line: %d\n ", exp, file, func, line ); + } + else { + nvDebug( "*** Assertion failed: %s\n On file: %s\n On line: %d\n ", exp, file, line ); + } + +# if _DEBUG + if( isDebuggerPresent() ) { + return NV_ABORT_DEBUG; + } +# endif + +# if defined(HAVE_EXECINFO_H) + if (nvHasStackTrace()) + { + void * trace[64]; + int size = backtrace(trace, 64); + nvPrintStackTrace(trace, size, 2); + } +# endif + + // Exit cleanly. + throw std::runtime_error("Assertion failed"); + } + }; + +#endif + +} // namespace + + +/// Handle assertion through the asset handler. +int nvAbort(const char * exp, const char * file, int line, const char * func) +{ +#if NV_OS_WIN32 //&& NV_CC_MSVC + static Win32AssertHandler s_default_assert_handler; +#else + static UnixAssertHandler s_default_assert_handler; +#endif + + if( s_assert_handler != NULL ) { + return s_assert_handler->assert( exp, file, line, func ); + } + else { + return s_default_assert_handler.assert( exp, file, line, func ); + } +} + + +/// Shows a message through the message handler. +void NV_CDECL nvDebug(const char *msg, ...) +{ + va_list arg; + va_start(arg,msg); + if( s_message_handler != NULL ) { + s_message_handler->log( msg, arg ); + } + va_end(arg); +} + + +/// Dump debug info. +void debug::dumpInfo() +{ +#if !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H) + if (nvHasStackTrace()) + { + void * trace[64]; + int size = backtrace(trace, 64); + nvPrintStackTrace(trace, size, 1); + } +#endif +} + + +/// Set the debug message handler. +void debug::setMessageHandler(MessageHandler * message_handler) +{ + s_message_handler = message_handler; +} + +/// Reset the debug message handler. +void debug::resetMessageHandler() +{ + s_message_handler = NULL; +} + +/// Set the assert handler. +void debug::setAssertHandler(AssertHandler * assert_handler) +{ + s_assert_handler = assert_handler; +} + +/// Reset the assert handler. +void debug::resetAssertHandler() +{ + s_assert_handler = NULL; +} + + +/// Enable signal handler. +void debug::enableSigHandler() +{ + nvCheck(s_sig_handler_enabled != true); + s_sig_handler_enabled = true; + +#if NV_OS_WIN32 && NV_CC_MSVC + + s_old_exception_filter = ::SetUnhandledExceptionFilter( nvTopLevelFilter ); + +#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) + + // Install our signal handler + struct sigaction sa; + sa.sa_sigaction = nvSigHandler; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO; + + sigaction(SIGSEGV, &sa, &s_old_sigsegv); + sigaction(SIGTRAP, &sa, &s_old_sigtrap); + sigaction(SIGFPE, &sa, &s_old_sigfpe); + sigaction(SIGBUS, &sa, &s_old_sigbus); + +#endif +} + +/// Disable signal handler. +void debug::disableSigHandler() +{ + nvCheck(s_sig_handler_enabled == true); + s_sig_handler_enabled = false; + +#if NV_OS_WIN32 && NV_CC_MSVC + + ::SetUnhandledExceptionFilter( s_old_exception_filter ); + s_old_exception_filter = NULL; + +#elif !NV_OS_WIN32 && defined(HAVE_SIGNAL_H) + + sigaction(SIGSEGV, &s_old_sigsegv, NULL); + sigaction(SIGTRAP, &s_old_sigtrap, NULL); + sigaction(SIGFPE, &s_old_sigfpe, NULL); + sigaction(SIGBUS, &s_old_sigbus, NULL); + +#endif +} + diff --git a/externals/NVTT/src/nvcore/Debug.h b/externals/NVTT/src/nvcore/Debug.h new file mode 100644 index 00000000..c1f0ca5d --- /dev/null +++ b/externals/NVTT/src/nvcore/Debug.h @@ -0,0 +1,131 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_DEBUG_H +#define NV_CORE_DEBUG_H + +#include + +#if defined(HAVE_STDARG_H) +# include // va_list +#endif + +#define NV_ABORT_DEBUG 1 +#define NV_ABORT_IGNORE 2 +#define NV_ABORT_EXIT 3 + +#undef assert // avoid conflicts with assert method. + +#define nvNoAssert(exp) \ + do { \ + (void)sizeof(exp); \ + } while(0) + +#if NV_NO_ASSERT + +# define nvAssert(exp) nvNoAssert(exp) +# define nvCheck(exp) nvNoAssert(exp) +# define nvDebugAssert(exp) nvNoAssert(exp) +# define nvDebugCheck(exp) nvNoAssert(exp) +# define nvDebugBreak() nvNoAssert(0) + +#else // NV_NO_ASSERT + +# if NV_CC_MSVC + // @@ Does this work in msvc-6 and earlier? + // @@ Do I have to include ? +# define nvDebugBreak() __debugbreak() + // define nvDebugBreak() __asm int 3 +# elif NV_CC_GNUC && NV_CPU_PPC && NV_OS_DARWIN +# define nvDebugBreak() __asm__ volatile ("trap"); +# elif NV_CC_GNUC && NV_CPU_X86 && NV_OS_DARWIN +# define nvDebugBreak() __asm__ volatile ("int3"); +# elif NV_CC_GNUC && NV_CPU_X86 +# define nvDebugBreak() __asm__ ( "int %0" : :"I"(3) ) +# else +# include +# define nvDebugBreak() raise(SIGTRAP); + // define nvDebugBreak() *((int *)(0)) = 0 +# endif + +# define nvAssertMacro(exp) \ + do { \ + if(!(exp)) { \ + if( nvAbort(#exp, __FILE__, __LINE__, __FUNC__) == NV_ABORT_DEBUG ) { \ + nvDebugBreak(); \ + } \ + } \ + } while(false) + +# define nvAssert(exp) nvAssertMacro(exp) +# define nvCheck(exp) nvAssertMacro(exp) + +# if defined(_DEBUG) +# define nvDebugAssert(exp) nvAssertMacro(exp) +# define nvDebugCheck(exp) nvAssertMacro(exp) +# else // _DEBUG +# define nvDebugAssert(exp) nvNoAssert(exp) +# define nvDebugCheck(exp) nvNoAssert(exp) +# endif // _DEBUG + +#endif // NV_NO_ASSERT + +// Use nvAssume for very simple expresions only: nvAssume(0), nvAssume(value == true), etc. +#if defined(_DEBUG) +# if NV_CC_MSVC +# define nvAssume(exp) __assume(exp) +# else +# define nvAssume(exp) nvCheck(exp) +# endif +#else +# define nvAssume(exp) nvCheck(exp) +#endif + + +#define nvError(x) nvAbort(x, __FILE__, __LINE__, __FUNC__) +#define nvWarning(x) nvDebug("*** Warning %s/%d: %s\n", __FILE__, __LINE__, (x)) + + +#if PI_CC_MSVC +// @@ I'm not sure it's a good idea to use the default static assert. +# define nvStaticCheck(x) _STATIC_ASSERT(x) +#else +# define nvStaticCheck(x) typedef char NV_DO_STRING_JOIN2(__static_assert_,__LINE__)[(x)] +// define nvStaticCheck(x) switch(0) { case 0: case x:; } +#endif + +NVCORE_API int nvAbort(const char *exp, const char *file, int line, const char * func = 0); +NVCORE_API void NV_CDECL nvDebug( const char *msg, ... ) __attribute__((format (printf, 1, 2))); + +namespace nv +{ + /** Message handler interface. */ + struct MessageHandler { + virtual void log(const char * str, va_list arg) = 0; + virtual ~MessageHandler() {} + }; + + /** Assert handler interface. */ + struct AssertHandler { + virtual int assert(const char *exp, const char *file, int line, const char *func = 0) = 0; + virtual ~AssertHandler() {} + }; + + + namespace debug + { + NVCORE_API void dumpInfo(); + + // These functions are not thread safe. + NVCORE_API void setMessageHandler( MessageHandler * messageHandler ); + NVCORE_API void resetMessageHandler(); + + NVCORE_API void setAssertHandler( AssertHandler * assertHanlder ); + NVCORE_API void resetAssertHandler(); + + NVCORE_API void enableSigHandler(); + NVCORE_API void disableSigHandler(); + } + +} // nv namespace + +#endif // NV_CORE_DEBUG_H diff --git a/externals/NVTT/src/nvcore/DefsGnucDarwin.h b/externals/NVTT/src/nvcore/DefsGnucDarwin.h new file mode 100644 index 00000000..5442b790 --- /dev/null +++ b/externals/NVTT/src/nvcore/DefsGnucDarwin.h @@ -0,0 +1,66 @@ +#ifndef NV_CORE_H +#error "Do not include this file directly." +#endif + +#include // uint8_t, int8_t, ... + +// Function linkage +#define DLL_IMPORT +#if __GNUC__ >= 4 +# define DLL_EXPORT __attribute__((visibility("default"))) +# define DLL_EXPORT_CLASS DLL_EXPORT +#else +# define DLL_EXPORT +# define DLL_EXPORT_CLASS +#endif + +// Function calling modes +#if NV_CPU_X86 +# define NV_CDECL __attribute__((cdecl)) +# define NV_STDCALL __attribute__((stdcall)) +#else +# define NV_CDECL +# define NV_STDCALL +#endif + +#define NV_FASTCALL __attribute__((fastcall)) +#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_DEPRECATED __attribute__((deprecated)) + +#if __GNUC__ > 2 +#define NV_PURE __attribute__((pure)) +#define NV_CONST __attribute__((const)) +#else +#define NV_PURE +#define NV_CONST +#endif + +// Define __FUNC__ properly. +#if __STDC_VERSION__ < 199901L +# if __GNUC__ >= 2 +# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ +# else +# define __FUNC__ "" +# endif +#else +# define __FUNC__ __PRETTY_FUNCTION__ +#endif + +#define restrict __restrict__ + + +// Type definitions +typedef uint8_t uint8; +typedef int8_t int8; + +typedef uint16_t uint16; +typedef int16_t int16; + +typedef uint32_t uint32; +typedef int32_t int32; + +typedef uint64_t uint64; +typedef int64_t int64; + +// Aliases +typedef uint32 uint; diff --git a/externals/NVTT/src/nvcore/DefsGnucLinux.h b/externals/NVTT/src/nvcore/DefsGnucLinux.h new file mode 100644 index 00000000..a8e2a29b --- /dev/null +++ b/externals/NVTT/src/nvcore/DefsGnucLinux.h @@ -0,0 +1,65 @@ +#ifndef NV_CORE_H +#error "Do not include this file directly." +#endif + +// Function linkage +#define DLL_IMPORT +#if __GNUC__ >= 4 +# define DLL_EXPORT __attribute__((visibility("default"))) +# define DLL_EXPORT_CLASS DLL_EXPORT +#else +# define DLL_EXPORT +# define DLL_EXPORT_CLASS +#endif + +// Function calling modes +#if NV_CPU_X86 +# define NV_CDECL __attribute__((cdecl)) +# define NV_STDCALL __attribute__((stdcall)) +#else +# define NV_CDECL +# define NV_STDCALL +#endif + +#define NV_FASTCALL __attribute__((fastcall)) +#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_DEPRECATED __attribute__((deprecated)) + + +#if __GNUC__ > 2 +#define NV_PURE __attribute__((pure)) +#define NV_CONST __attribute__((const)) +#else +#define NV_PURE +#define NV_CONST +#endif + +// Define __FUNC__ properly. +#if __STDC_VERSION__ < 199901L +# if __GNUC__ >= 2 +# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ +# else +# define __FUNC__ "" +# endif +#else +# define __FUNC__ __PRETTY_FUNCTION__ +#endif + +#define restrict __restrict__ + + +// Type definitions +typedef unsigned char uint8; +typedef signed char int8; + +typedef unsigned short uint16; +typedef signed short int16; + +typedef unsigned int uint32; +typedef signed int int32; + +typedef unsigned long long uint64; +typedef signed long long int64; + +// Aliases +typedef uint32 uint; diff --git a/externals/NVTT/src/nvcore/DefsGnucWin32.h b/externals/NVTT/src/nvcore/DefsGnucWin32.h new file mode 100644 index 00000000..2f8e3cc5 --- /dev/null +++ b/externals/NVTT/src/nvcore/DefsGnucWin32.h @@ -0,0 +1,59 @@ +#ifndef NV_CORE_H +#error "Do not include this file directly." +#endif + +// Function linkage +#define DLL_IMPORT __declspec(dllimport) +#define DLL_EXPORT __declspec(dllexport) +#define DLL_EXPORT_CLASS DLL_EXPORT + +// Function calling modes +#if NV_CPU_X86 +# define NV_CDECL __attribute__((cdecl)) +# define NV_STDCALL __attribute__((stdcall)) +#else +# define NV_CDECL +# define NV_STDCALL +#endif + +#define NV_FASTCALL __attribute__((fastcall)) +#define NV_FORCEINLINE __attribute__((always_inline)) +#define NV_DEPRECATED __attribute__((deprecated)) + +#if __GNUC__ > 2 +#define NV_PURE __attribute__((pure)) +#define NV_CONST __attribute__((const)) +#else +#define NV_PURE +#define NV_CONST +#endif + +// Define __FUNC__ properly. +#if __STDC_VERSION__ < 199901L +# if __GNUC__ >= 2 +# define __FUNC__ __PRETTY_FUNCTION__ // __FUNCTION__ +# else +# define __FUNC__ "" +# endif +#else +# define __FUNC__ __PRETTY_FUNCTION__ +#endif + +#define restrict __restrict__ + + +// Type definitions +typedef unsigned char uint8; +typedef signed char int8; + +typedef unsigned short uint16; +typedef signed short int16; + +typedef unsigned int uint32; +typedef signed int int32; + +typedef unsigned long long uint64; +typedef signed long long int64; + +// Aliases +typedef uint32 uint; diff --git a/externals/NVTT/src/nvcore/DefsVcWin32.h b/externals/NVTT/src/nvcore/DefsVcWin32.h new file mode 100644 index 00000000..c1b6d36b --- /dev/null +++ b/externals/NVTT/src/nvcore/DefsVcWin32.h @@ -0,0 +1,78 @@ +#ifndef NV_CORE_H +#error "Do not include this file directly." +#endif + +// Function linkage +#define DLL_IMPORT __declspec(dllimport) +#define DLL_EXPORT __declspec(dllexport) +#define DLL_EXPORT_CLASS DLL_EXPORT + +// Function calling modes +#define NV_CDECL __cdecl +#define NV_STDCALL __stdcall +#define NV_FASTCALL __fastcall +#define NV_FORCEINLINE __forceinline +#define NV_DEPRECATED + +#define NV_PURE +#define NV_CONST + +// Set standard function names. +#define snprintf _snprintf +#if _MSC_VER < 1500 +# define vsnprintf _vsnprintf +#endif +#define vsscanf _vsscanf +#define chdir _chdir +#define getcwd _getcwd + +#define va_copy(a, b) a = b + +#if !defined restrict +#define restrict +#endif + +// Ignore gcc attributes. +#define __attribute__(X) + +#if !defined __FUNC__ +#define __FUNC__ __FUNCTION__ +#endif + + +// Type definitions +typedef unsigned char uint8; +typedef signed char int8; + +typedef unsigned short uint16; +typedef signed short int16; + +typedef unsigned int uint32; +typedef signed int int32; + +typedef unsigned __int64 uint64; +typedef signed __int64 int64; + +// Aliases +typedef uint32 uint; + + +// Unwanted VC++ warnings to disable. +/* +#pragma warning(disable : 4244) // conversion to float, possible loss of data +#pragma warning(disable : 4245) // conversion from 'enum ' to 'unsigned long', signed/unsigned mismatch +#pragma warning(disable : 4100) // unreferenced formal parameter +#pragma warning(disable : 4514) // unreferenced inline function has been removed +#pragma warning(disable : 4710) // inline function not expanded +#pragma warning(disable : 4127) // Conditional expression is constant +#pragma warning(disable : 4305) // truncation from 'const double' to 'float' +#pragma warning(disable : 4505) // unreferenced local function has been removed + +#pragma warning(disable : 4702) // unreachable code in inline expanded function +#pragma warning(disable : 4711) // function selected for automatic inlining +#pragma warning(disable : 4725) // Pentium fdiv bug + +#pragma warning(disable : 4786) // Identifier was truncated and cannot be debugged. + +#pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup +*/ diff --git a/externals/NVTT/src/nvcore/Library.cpp b/externals/NVTT/src/nvcore/Library.cpp new file mode 100644 index 00000000..179239cc --- /dev/null +++ b/externals/NVTT/src/nvcore/Library.cpp @@ -0,0 +1,41 @@ + +#include "Library.h" +#include "Debug.h" + +#if NV_OS_WIN32 +#define WIN32_LEAN_AND_MEAN +#define VC_EXTRALEAN +#include +#else +#include +#endif + + + +void * nvLoadLibrary(const char * name) +{ +#if NV_OS_WIN32 + return (void *)LoadLibraryExA( name, NULL, 0 ); +#else + return dlopen(name, RTLD_LAZY); +#endif +} + +void nvUnloadLibrary(void * handle) +{ + nvDebugCheck(handle != NULL); +#if NV_OS_WIN32 + FreeLibrary((HMODULE)handle); +#else + dlclose(handle); +#endif +} + +void * nvBindSymbol(void * handle, const char * symbol) +{ +#if NV_OS_WIN32 + return (void *)GetProcAddress((HMODULE)handle, symbol); +#else + return (void *)dlsym(handle, symbol); +#endif +} diff --git a/externals/NVTT/src/nvcore/Library.h b/externals/NVTT/src/nvcore/Library.h new file mode 100644 index 00000000..ee7d416e --- /dev/null +++ b/externals/NVTT/src/nvcore/Library.h @@ -0,0 +1,50 @@ +// This code is in the public domain -- castano@gmail.com + +#ifndef NV_CORE_LIBRARY_H +#define NV_CORE_LIBRARY_H + +#include + +#if NV_OS_WIN32 +#define LIBRARY_NAME(name) #name ".dll" +#elif NV_OS_DARWIN +#define NV_LIBRARY_NAME(name) "lib" #name ".dylib" +#else +#define NV_LIBRARY_NAME(name) "lib" #name ".so" +#endif + +NVCORE_API void * nvLoadLibrary(const char * name); +NVCORE_API void nvUnloadLibrary(void * lib); +NVCORE_API void * nvBindSymbol(void * lib, const char * symbol); + +class NVCORE_CLASS Library +{ +public: + Library(const char * name) + { + handle = nvLoadLibrary(name); + } + ~Library() + { + if (isValid()) + { + nvUnloadLibrary(handle); + } + } + + bool isValid() const + { + return handle != NULL; + } + + void * bindSymbol(const char * symbol) + { + return nvBindSymbol(handle, symbol); + } + +private: + void * handle; +}; + + +#endif // NV_CORE_LIBRARY_H diff --git a/externals/NVTT/src/nvcore/Memory.cpp b/externals/NVTT/src/nvcore/Memory.cpp new file mode 100644 index 00000000..7ece0185 --- /dev/null +++ b/externals/NVTT/src/nvcore/Memory.cpp @@ -0,0 +1,36 @@ + +#include "Memory.h" +#include "Debug.h" + +//#if HAVE_MALLOC_H +//#include +//#endif + +#include + + +using namespace nv; + +void * nv::mem::malloc(size_t size) +{ + return ::malloc(size); +} + +void * nv::mem::malloc(size_t size, const char * file, int line) +{ + NV_UNUSED(file); + NV_UNUSED(line); + return ::malloc(size); +} + +void nv::mem::free(const void * ptr) +{ + ::free(const_cast(ptr)); +} + +void * nv::mem::realloc(void * ptr, size_t size) +{ + nvDebugCheck(ptr != NULL || size != 0); // undefined realloc behavior. + return ::realloc(ptr, size); +} + diff --git a/externals/NVTT/src/nvcore/Memory.h b/externals/NVTT/src/nvcore/Memory.h new file mode 100644 index 00000000..d6999262 --- /dev/null +++ b/externals/NVTT/src/nvcore/Memory.h @@ -0,0 +1,186 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_MEMORY_H +#define NV_CORE_MEMORY_H + +#include + +#include // malloc(), realloc() and free() +#include // size_t + +#include // new and delete + +// Custom memory allocator +namespace nv +{ + namespace mem + { + NVCORE_API void * malloc(size_t size); + NVCORE_API void * malloc(size_t size, const char * file, int line); + + NVCORE_API void free(const void * ptr); + NVCORE_API void * realloc(void * ptr, size_t size); + + } // mem namespace + +} // nv namespace + + +// Override new/delete + +inline void * operator new (size_t size) throw() +{ + return nv::mem::malloc(size); +} + +inline void operator delete (void *p) throw() +{ + nv::mem::free(p); +} + +inline void * operator new [] (size_t size) throw() +{ + return nv::mem::malloc(size); +} + +inline void operator delete [] (void * p) throw() +{ + nv::mem::free(p); +} + +/* +#ifdef _DEBUG +#define new new(__FILE__, __LINE__) +#define malloc(i) malloc(i, __FILE__, __LINE__) +#endif +*/ + +#if 0 +/* + File: main.cpp + + Version: 1.0 + + Abstract: Overrides the C++ 'operator new' and 'operator delete'. + + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. + ("Apple") in consideration of your agreement to the following terms, and your + use, installation, modification or redistribution of this Apple software + constitutes acceptance of these terms. If you do not agree with these terms, + please do not use, install, modify or redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and subject + to these terms, Apple grants you a personal, non-exclusive license, under Apple’s + copyrights in this original Apple software (the "Apple Software"), to use, + reproduce, modify and redistribute the Apple Software, with or without + modifications, in source and/or binary forms; provided that if you redistribute + the Apple Software in its entirety and without modifications, you must retain + this notice and the following text and disclaimers in all such redistributions of + the Apple Software. Neither the name, trademarks, service marks or logos of + Apple Computer, Inc. may be used to endorse or promote products derived from the + Apple Software without specific prior written permission from Apple. Except as + expressly stated in this notice, no other rights or licenses, express or implied, + are granted by Apple herein, including but not limited to any patent rights that + may be infringed by your derivative works or by other works in which the Apple + Software may be incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN + COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION + OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT + (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Copyright © 2006 Apple Computer, Inc., All Rights Reserved +*/ + +/* This sample shows how to override the C++ global 'new' and 'delete' operators. */ +#include +#include +#include +#include +#include + +/* Some variables and code to make the example do something. */ +namespace { + unsigned long long gNewCounter; // number of times 'new' was called + unsigned long long gDeleteCounter; // number of times 'delete' was called + + void printCounters() // print the counters above + { + std::cout << "new was called " << gNewCounter << " times and delete was called " << gDeleteCounter << " times\n"; + } +} + +/* These are the overridden new and delete routines. + Most applications will want to override at least these four versions of new/delete if they override any of them. + + In Mac OS, it's not necessary to override the array versions of operator new and delete if all + they would do is call the non-array versions; the C++ standard library, as an extension + to the C++ standard, does this for you. + + Developers should consult the section [lib.support.dynamic] in the C++ standard to see the requirements + on the generic operators new and delete; the system may expect that your overridden operators meet all these + requirements. + + Your operators may be called by the system, even early in start-up before constructors have been executed. */ +void* operator new(std::size_t sz) throw (std::bad_alloc) +{ + void *result = std::malloc (sz == 0 ? 1 : sz); + if (result == NULL) + throw std::bad_alloc(); + gNewCounter++; + return result; +} +void operator delete(void* p) throw() +{ + if (p == NULL) + return; + std::free (p); + gDeleteCounter++; +} + +/* These are the 'nothrow' versions of the above operators. + The system version will try to call a std::new_handler if they + fail, but your overriding versions are not required to do this. */ +void* operator new(std::size_t sz, const std::nothrow_t&) throw() +{ + try { + void * result = ::operator new (sz); // calls our overridden operator new + return result; + } catch (std::bad_alloc &) { + return NULL; + } +} +void operator delete(void* p, const std::nothrow_t&) throw() +{ + ::operator delete (p); +} + +/* Bug 4067110 is that if your program has no weak symbols at all, the linker will not set the + WEAK_DEFINES bit in the Mach-O header and as a result the new and delete operators above won't + be seen by system libraries. This is mostly a problem for test programs and small examples, + since almost all real C++ programs complicated enough to override new and delete will have at + least one weak symbol. However, this is a small example, so: */ +void __attribute__((weak, visibility("default"))) workaroundFor4067110 () { } + +/* This is a simple test program that causes the runtime library to call new and delete. */ +int main() +{ + atexit (printCounters); + try { + std::locale example("does_not_exist"); + } catch (std::runtime_error &x) { + } + return 0; +} +#endif // 0 + +#endif // NV_CORE_MEMORY_H diff --git a/externals/NVTT/src/nvcore/Prefetch.h b/externals/NVTT/src/nvcore/Prefetch.h new file mode 100644 index 00000000..71bd0ed8 --- /dev/null +++ b/externals/NVTT/src/nvcore/Prefetch.h @@ -0,0 +1,31 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_PREFETCH_H +#define NV_CORE_PREFETCH_H + +#include + +// nvPrefetch +#if NV_CC_GNUC + +#define nvPrefetch(ptr) __builtin_prefetch(ptr) + +#elif NV_CC_MSVC + +#if NV_CPU_X86 +__forceinline void nvPrefetch(const void * mem) +{ + __asm mov ecx, mem + __asm prefetcht0 [ecx]; +// __asm prefetchnta [ecx]; +} +#endif // NV_CPU_X86 + +#else // NV_CC_MSVC + +// do nothing in other case. +#define nvPrefetch(ptr) + +#endif // NV_CC_MSVC + +#endif // NV_CORE_PREFETCH_H diff --git a/externals/NVTT/src/nvcore/Ptr.h b/externals/NVTT/src/nvcore/Ptr.h new file mode 100644 index 00000000..1d8d9c9a --- /dev/null +++ b/externals/NVTT/src/nvcore/Ptr.h @@ -0,0 +1,364 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_PTR_H +#define NV_CORE_PTR_H + +#include +#include + +#include // NULL + +namespace nv +{ + +/** Simple auto pointer template class. + * + * This is very similar to the standard auto_ptr class, but with some + * additional limitations to make its use less error prone: + * - Copy constructor and assignment operator are disabled. + * - reset method is removed. + * + * The semantics of the standard auto_ptr are not clear and change depending + * on the std implementation. For a discussion of the problems of auto_ptr read: + * http://www.awprofessional.com/content/images/020163371X/autoptrupdate\auto_ptr_update.html + */ +template +class AutoPtr +{ + NV_FORBID_COPY(AutoPtr); + NV_FORBID_HEAPALLOC(); +public: + + /// Default ctor. + AutoPtr() : m_ptr(NULL) { } + + /// Ctor. + explicit AutoPtr( T * p ) : m_ptr(p) { } + + /** Dtor. Deletes owned pointer. */ + ~AutoPtr() { + delete m_ptr; + m_ptr = NULL; + } + + /** Delete owned pointer and assign new one. */ + void operator=( T * p ) { + if (p != m_ptr) + { + delete m_ptr; + m_ptr = p; + } + } + + /** Member access. */ + T * operator -> () const { + nvDebugCheck(m_ptr != NULL); + return m_ptr; + } + + /** Get reference. */ + T & operator*() const { + nvDebugCheck(m_ptr != NULL); + return *m_ptr; + } + + /** Get pointer. */ + T * ptr() const { return m_ptr; } + + /** Relinquish ownership of the underlying pointer and returns that pointer. */ + T * release() { + T * tmp = m_ptr; + m_ptr = NULL; + return tmp; + } + + /** Const pointer equal comparation. */ + friend bool operator == (const AutoPtr & ap, const T * const p) { + return (ap.ptr() == p); + } + + /** Const pointer nequal comparation. */ + friend bool operator != (const AutoPtr & ap, const T * const p) { + return (ap.ptr() != p); + } + + /** Const pointer equal comparation. */ + friend bool operator == (const T * const p, const AutoPtr & ap) { + return (ap.ptr() == p); + } + + /** Const pointer nequal comparation. */ + friend bool operator != (const T * const p, const AutoPtr & ap) { + return (ap.ptr() != p); + } + +private: + T * m_ptr; +}; + +#if 0 +/** Reference counted base class to be used with Pointer. + * + * The only requirement of the Pointer class is that the RefCounted class implements the + * addRef and release methods. + */ +class RefCounted +{ + NV_FORBID_COPY(RefCounted); +public: + + /// Ctor. + RefCounted() : m_count(0), m_weak_proxy(NULL) + { + s_total_obj_count++; + } + + /// Virtual dtor. + virtual ~RefCounted() + { + nvCheck( m_count == 0 ); + nvCheck( s_total_obj_count > 0 ); + s_total_obj_count--; + } + + + /// Increase reference count. + uint addRef() const + { + s_total_ref_count++; + m_count++; + return m_count; + } + + + /// Decrease reference count and remove when 0. + uint release() const + { + nvCheck( m_count > 0 ); + + s_total_ref_count--; + m_count--; + if( m_count == 0 ) { + releaseWeakProxy(); + delete this; + return 0; + } + return m_count; + } + + /// Get weak proxy. + WeakProxy * getWeakProxy() const + { + if (m_weak_proxy == NULL) { + m_weak_proxy = new WeakProxy; + m_weak_proxy->AddRef(); + } + return m_weak_proxy; + } + + /// Release the weak proxy. + void releaseWeakProxy() const + { + if (m_weak_proxy != NULL) { + m_weak_proxy->NotifyObjectDied(); + m_weak_proxy->Release(); + m_weak_proxy = NULL; + } + } + + /** @name Debug methods: */ + //@{ + /// Get reference count. + int refCount() const + { + return m_count; + } + + /// Get total number of objects. + static int totalObjectCount() + { + return s_total_obj_count; + } + + /// Get total number of references. + static int totalReferenceCount() + { + return s_total_ref_count; + } + //@} + + +private: + + NVCORE_API static int s_total_ref_count; + NVCORE_API static int s_total_obj_count; + + mutable int m_count; + mutable WeakProxy * weak_proxy; + +}; +#endif + +/// Smart pointer template class. +template +class Pointer { +public: + + // BaseClass must implement addRef() and release(). + typedef Pointer ThisType; + + /// Default ctor. + Pointer() : m_ptr(NULL) + { + } + + /** Other type assignment. */ + template + Pointer( const Pointer & tc ) + { + m_ptr = static_cast( tc.ptr() ); + if( m_ptr ) { + m_ptr->addRef(); + } + } + + /** Copy ctor. */ + Pointer( const ThisType & bc ) + { + m_ptr = bc.ptr(); + if( m_ptr ) { + m_ptr->addRef(); + } + } + + /** Copy cast ctor. Pointer(NULL) is valid. */ + explicit Pointer( BaseClass * bc ) + { + m_ptr = bc; + if( m_ptr ) { + m_ptr->addRef(); + } + } + + /** Dtor. */ + ~Pointer() + { + set(NULL); + } + + + /** @name Accessors: */ + //@{ + /** -> operator. */ + BaseClass * operator -> () const + { + nvCheck( m_ptr != NULL ); + return m_ptr; + } + + /** * operator. */ + BaseClass & operator*() const + { + nvCheck( m_ptr != NULL ); + return *m_ptr; + } + + /** Get pointer. */ + BaseClass * ptr() const + { + return m_ptr; + } + //@} + + + /** @name Mutators: */ + //@{ + /** Other type assignment. */ + template + void operator = ( const Pointer & tc ) + { + set( static_cast(tc.ptr()) ); + } + + /** This type assignment. */ + void operator = ( const ThisType & bc ) + { + set( bc.ptr() ); + } + + /** Pointer assignment. */ + void operator = ( BaseClass * bc ) + { + set( bc ); + } + //@} + + + /** @name Comparators: */ + //@{ + /** Other type equal comparation. */ + template + bool operator == ( const Pointer & other ) const + { + return m_ptr == other.ptr(); + } + + /** This type equal comparation. */ + bool operator == ( const ThisType & bc ) const + { + return m_ptr == bc.ptr(); + } + + /** Const pointer equal comparation. */ + bool operator == ( const BaseClass * const bc ) const + { + return m_ptr == bc; + } + + /** Other type not equal comparation. */ + template + bool operator != ( const Pointer & other ) const + { + return m_ptr != other.ptr(); + } + + /** Other type not equal comparation. */ + bool operator != ( const ThisType & bc ) const + { + return m_ptr != bc.ptr(); + } + + /** Const pointer not equal comparation. */ + bool operator != (const BaseClass * const bc) const + { + return m_ptr != bc; + } + + /** This type lower than comparation. */ + bool operator < (const ThisType & p) const + { + return m_ptr < p.ptr(); + } + //@} + +private: + + /** Set this pointer. */ + void set( BaseClass * p ) + { + if( m_ptr != p ) { + if( m_ptr ) m_ptr->release(); + if( p ) p->addRef(); + m_ptr = p; + } + } + +private: + + BaseClass * m_ptr; + +}; + +} // nv namespace + +#endif // NV_CORE_PTR_H diff --git a/externals/NVTT/src/nvcore/Radix.cpp b/externals/NVTT/src/nvcore/Radix.cpp new file mode 100644 index 00000000..713215f3 --- /dev/null +++ b/externals/NVTT/src/nvcore/Radix.cpp @@ -0,0 +1,429 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Contains source code from the article "Radix Sort Revisited". + * \file Radix.cpp + * \author Pierre Terdiman + * \date April, 4, 2000 + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Revisited Radix Sort. + * This is my new radix routine: + * - it uses indices and doesn't recopy the values anymore, hence wasting less ram + * - it creates all the histograms in one run instead of four + * - it sorts words faster than dwords and bytes faster than words + * - it correctly sorts negative floating-point values by patching the offsets + * - it automatically takes advantage of temporal coherence + * - multiple keys support is a side effect of temporal coherence + * - it may be worth recoding in asm... (mainly to use FCOMI, FCMOV, etc) [it's probably memory-bound anyway] + * + * History: + * - 08.15.98: very first version + * - 04.04.00: recoded for the radix article + * - 12.xx.00: code lifting + * - 09.18.01: faster CHECK_PASS_VALIDITY thanks to Mark D. Shattuck (who provided other tips, not included here) + * - 10.11.01: added local ram support + * - 01.20.02: bugfix! In very particular cases the last pass was skipped in the float code-path, leading to incorrect sorting...... + * + * \class RadixSort + * \author Pierre Terdiman + * \version 1.3 + * \date August, 15, 1998 + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/* +To do: + - add an offset parameter between two input values (avoid some data recopy sometimes) + - unroll ? asm ? +*/ + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Header + +#include + +#include // memset + +//using namespace IceCore; + +#define DELETEARRAY(a) { delete [] a; a = NULL; } +#define CHECKALLOC(a) + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Constructor. + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +RadixSort::RadixSort() : mCurrentSize(0), mPreviousSize(0), mIndices(NULL), mIndices2(NULL), mTotalCalls(0), mNbHits(0) +{ +#ifndef RADIX_LOCAL_RAM + // Allocate input-independent ram + mHistogram = new uint32[256*4]; + mOffset = new uint32[256]; +#endif + // Initialize indices + resetIndices(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Destructor. + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +RadixSort::~RadixSort() +{ + // Release everything +#ifndef RADIX_LOCAL_RAM + DELETEARRAY(mOffset); + DELETEARRAY(mHistogram); +#endif + DELETEARRAY(mIndices2); + DELETEARRAY(mIndices); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Resizes the inner lists. + * \param nb [in] new size (number of dwords) + * \return true if success + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +bool RadixSort::resize(uint32 nb) +{ + // Free previously used ram + DELETEARRAY(mIndices2); + DELETEARRAY(mIndices); + + // Get some fresh one + mIndices = new uint32[nb]; CHECKALLOC(mIndices); + mIndices2 = new uint32[nb]; CHECKALLOC(mIndices2); + mCurrentSize = nb; + + // Initialize indices so that the input buffer is read in sequential order + resetIndices(); + + return true; +} + +#define CHECK_RESIZE(n) \ + if(n!=mPreviousSize) \ + { \ + if(n>mCurrentSize) resize(n); \ + else resetIndices(); \ + mPreviousSize = n; \ + } + +#define CREATE_HISTOGRAMS(type, buffer) \ + /* Clear counters */ \ + memset(mHistogram, 0, 256*4*sizeof(uint32)); \ + \ + /* Prepare for temporal coherence */ \ + type PrevVal = (type)buffer[mIndices[0]]; \ + bool AlreadySorted = true; /* Optimism... */ \ + uint32* Indices = mIndices; \ + \ + /* Prepare to count */ \ + uint8* p = (uint8*)input; \ + uint8* pe = &p[nb*4]; \ + uint32* h0= &mHistogram[0]; /* Histogram for first pass (LSB) */ \ + uint32* h1= &mHistogram[256]; /* Histogram for second pass */ \ + uint32* h2= &mHistogram[512]; /* Histogram for third pass */ \ + uint32* h3= &mHistogram[768]; /* Histogram for last pass (MSB) */ \ + \ + while(p!=pe) \ + { \ + /* Read input buffer in previous sorted order */ \ + type Val = (type)buffer[*Indices++]; \ + /* Check whether already sorted or not */ \ + if(Val>24; // Radix byte, same as above. AND is useless here (uint32). + // ### cmp to be killed. Not good. Later. + if(Radix<128) mIndices2[mOffset[Radix]++] = mIndices[i]; // Number is positive, same as above + else mIndices2[--mOffset[Radix]] = mIndices[i]; // Number is negative, flip the sorting order + } + // Swap pointers for next pass. Valid indices - the most recent ones - are in mIndices after the swap. + uint32* Tmp = mIndices; mIndices = mIndices2; mIndices2 = Tmp; + } + else + { + // The pass is useless, yet we still have to reverse the order of current list if all values are negative. + if(UniqueVal>=128) + { + for(i=0;i + + +#define RADIX_LOCAL_RAM + + +class NVCORE_API RadixSort { + NV_FORBID_COPY(RadixSort); +public: + // Constructor/Destructor + RadixSort(); + ~RadixSort(); + + // Sorting methods + RadixSort & sort(const uint32* input, uint32 nb, bool signedvalues=true); + RadixSort & sort(const float* input, uint32 nb); + + //! Access to results. mIndices is a list of indices in sorted order, i.e. in the order you may further process your data + inline uint32 * indices() const { return mIndices; } + + //! mIndices2 gets trashed on calling the sort routine, but otherwise you can recycle it the way you want. + inline uint32 * recyclable() const { return mIndices2; } + + // Stats + uint32 usedRam() const; + + //! Returns the total number of calls to the radix sorter. + inline uint32 totalCalls() const { return mTotalCalls; } + + //! Returns the number of premature exits due to temporal coherence. + inline uint32 hits() const { return mNbHits; } + + + private: +#ifndef RADIX_LOCAL_RAM + uint32* mHistogram; //!< Counters for each byte + uint32* mOffset; //!< Offsets (nearly a cumulative distribution function) +#endif + uint32 mCurrentSize; //!< Current size of the indices list + uint32 mPreviousSize; //!< Size involved in previous call + uint32* mIndices; //!< Two lists, swapped each pass + uint32* mIndices2; + + // Stats + uint32 mTotalCalls; + uint32 mNbHits; + + // Internal methods + bool resize(uint32 nb); + void resetIndices(); + +}; + + +#endif // NV_CORE_RADIXSORT_H diff --git a/externals/NVTT/src/nvcore/StdStream.h b/externals/NVTT/src/nvcore/StdStream.h new file mode 100644 index 00000000..43046124 --- /dev/null +++ b/externals/NVTT/src/nvcore/StdStream.h @@ -0,0 +1,369 @@ +#ifndef NV_STDSTREAM_H +#define NV_STDSTREAM_H + +#include + +#include // fopen +#include // memcpy +#include // std::exception + +namespace nv +{ + +// Portable version of fopen. +inline FILE * fileOpen(const char * fileName, const char * mode) +{ + nvCheck(fileName != NULL); +#if NV_CC_MSVC && _MSC_VER >= 1400 + FILE * fp; + if (fopen_s(&fp, fileName, mode) == 0) { + return fp; + } + return NULL; +#else + return fopen(fileName, mode); +#endif +} + + +/// Base stdio stream. +class NVCORE_CLASS StdStream : public Stream +{ + NV_FORBID_COPY(StdStream); +public: + + /// Ctor. + StdStream( FILE * fp, bool autoclose=true ) : + m_fp(fp), m_autoclose(autoclose) { } + + /// Dtor. + virtual ~StdStream() + { + if( m_fp != NULL && m_autoclose ) { + fclose( m_fp ); + } + } + + + /** @name Stream implementation. */ + //@{ + virtual void seek( uint pos ) + { + nvDebugCheck(m_fp != NULL); + nvDebugCheck(pos < size()); + fseek(m_fp, pos, SEEK_SET); + } + + virtual uint tell() const + { + nvDebugCheck(m_fp != NULL); + return ftell(m_fp); + } + + virtual uint size() const + { + nvDebugCheck(m_fp != NULL); + uint pos = ftell(m_fp); + fseek(m_fp, 0, SEEK_END); + uint end = ftell(m_fp); + fseek(m_fp, pos, SEEK_SET); + return end; + } + + virtual bool isError() const + { + return m_fp == NULL || ferror( m_fp ) != 0; + } + + virtual void clearError() + { + nvDebugCheck(m_fp != NULL); + clearerr(m_fp); + } + + virtual bool isAtEnd() const + { + nvDebugCheck(m_fp != NULL); + return feof( m_fp ) != 0; + } + + /// Always true. + virtual bool isSeekable() const { return true; } + //@} + +protected: + + FILE * m_fp; + bool m_autoclose; + +}; + + +/// Standard output stream. +class NVCORE_CLASS StdOutputStream : public StdStream +{ + NV_FORBID_COPY(StdOutputStream); +public: + + /// Construct stream by file name. + StdOutputStream( const char * name ) : + StdStream(fileOpen(name, "wb")) { } + + /// Construct stream by file handle. + StdOutputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose) + { + } + + /** @name Stream implementation. */ + //@{ + /// Write data. + virtual uint serialize( void * data, uint len ) + { + nvDebugCheck(data != NULL); + nvDebugCheck(m_fp != NULL); + return (uint)fwrite(data, 1, len, m_fp); + } + + virtual bool isLoading() const + { + return false; + } + + virtual bool isSaving() const + { + return true; + } + //@} + +}; + + +/// Standard input stream. +class NVCORE_CLASS StdInputStream : public StdStream +{ + NV_FORBID_COPY(StdInputStream); +public: + + /// Construct stream by file name. + StdInputStream( const char * name ) : + StdStream(fileOpen(name, "rb")) { } + + /// Construct stream by file handle. + StdInputStream( FILE * fp, bool autoclose=true ) : StdStream(fp, autoclose) + { + } + + /** @name Stream implementation. */ + //@{ + /// Read data. + virtual uint serialize( void * data, uint len ) + { + nvDebugCheck(data != NULL); + nvDebugCheck(m_fp != NULL); + return (uint)fread(data, 1, len, m_fp); + } + + virtual bool isLoading() const + { + return true; + } + + virtual bool isSaving() const + { + return false; + } + //@} +}; + + + +/// Memory input stream. +class NVCORE_CLASS MemoryInputStream : public Stream +{ + NV_FORBID_COPY(MemoryInputStream); +public: + + /// Ctor. + MemoryInputStream( const uint8 * mem, uint size ) : + m_mem(mem), m_ptr(mem), m_size(size) { } + + /** @name Stream implementation. */ + //@{ + /// Read data. + virtual uint serialize( void * data, uint len ) + { + nvDebugCheck(data != NULL); + nvDebugCheck(!isError()); + + uint left = m_size - tell(); + if (len > left) len = left; + + memcpy( data, m_ptr, len ); + m_ptr += len; + + return len; + } + + virtual void seek( uint pos ) + { + nvDebugCheck(!isError()); + m_ptr = m_mem + pos; + nvDebugCheck(!isError()); + } + + virtual uint tell() const + { + nvDebugCheck(m_ptr >= m_mem); + return uint(m_ptr - m_mem); + } + + virtual uint size() const + { + return m_size; + } + + virtual bool isError() const + { + return m_mem == NULL || m_ptr > m_mem + m_size || m_ptr < m_mem; + } + + virtual void clearError() + { + // Nothing to do. + } + + virtual bool isAtEnd() const + { + return m_ptr == m_mem + m_size; + } + + /// Always true. + virtual bool isSeekable() const + { + return true; + } + + virtual bool isLoading() const + { + return true; + } + + virtual bool isSaving() const + { + return false; + } + //@} + + +private: + + const uint8 * m_mem; + const uint8 * m_ptr; + uint m_size; + +}; + + +/// Protected input stream. +class NVCORE_CLASS ProtectedStream : public Stream +{ + NV_FORBID_COPY(ProtectedStream); +public: + + /// Ctor. + ProtectedStream( Stream & s ) : m_s(&s), m_autodelete(false) + { + } + + /// Ctor. + ProtectedStream( Stream * s, bool autodelete = true ) : + m_s(s), m_autodelete(autodelete) + { + nvDebugCheck(m_s != NULL); + } + + /// Dtor. + virtual ~ProtectedStream() + { + if( m_autodelete ) { + delete m_s; + } + } + + /** @name Stream implementation. */ + //@{ + /// Read data. + virtual uint serialize( void * data, uint len ) + { + nvDebugCheck(data != NULL); + len = m_s->serialize( data, len ); + + if( m_s->isError() ) { + throw std::exception(); + } + + return len; + } + + virtual void seek( uint pos ) + { + m_s->seek( pos ); + + if( m_s->isError() ) { + throw std::exception(); + } + } + + virtual uint tell() const + { + return m_s->tell(); + } + + virtual uint size() const + { + return m_s->size(); + } + + virtual bool isError() const + { + return m_s->isError(); + } + + virtual void clearError() + { + m_s->clearError(); + } + + virtual bool isAtEnd() const + { + return m_s->isAtEnd(); + } + + virtual bool isSeekable() const + { + return m_s->isSeekable(); + } + + virtual bool isLoading() const + { + return m_s->isLoading(); + } + + virtual bool isSaving() const + { + return m_s->isSaving(); + } + //@} + + +private: + + Stream * const m_s; + bool const m_autodelete; + +}; + +} // nv namespace + + +#endif // NV_STDSTREAM_H diff --git a/externals/NVTT/src/nvcore/StrLib.cpp b/externals/NVTT/src/nvcore/StrLib.cpp new file mode 100644 index 00000000..34cf9923 --- /dev/null +++ b/externals/NVTT/src/nvcore/StrLib.cpp @@ -0,0 +1,584 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +#include // log +#include // vsnprintf + +#if NV_CC_MSVC +#include // vsnprintf +#endif + +#if NV_OS_WIN32 +#define NV_PATH_SEPARATOR '\\' +#else +#define NV_PATH_SEPARATOR '/' +#endif + +using namespace nv; + +namespace +{ + static char * strAlloc(uint size) + { + return static_cast(mem::malloc(size)); + } + + static char * strReAlloc(char * str, uint size) + { + return static_cast(mem::realloc(str, size)); + } + + static void strFree(const char * str) + { + return mem::free(const_cast(str)); + } + + /*static char * strDup( const char * str ) + { + nvDebugCheck( str != NULL ); + uint len = uint(strlen( str ) + 1); + char * dup = strAlloc( len ); + memcpy( dup, str, len ); + return dup; + }*/ + + // helper function for integer to string conversion. + static char * i2a( uint i, char *a, uint r ) + { + if( i / r > 0 ) { + a = i2a( i / r, a, r ); + } + *a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r]; + return a + 1; + } + + // Locale independent functions. + static inline char toUpper( char c ) { + return (c<'a' || c>'z') ? (c) : (c+'A'-'a'); + } + static inline char toLower( char c ) { + return (c<'A' || c>'Z') ? (c) : (c+'a'-'A'); + } + static inline bool isAlpha( char c ) { + return (c>='a' && c<='z') || (c>='A' && c<='Z'); + } + static inline bool isDigit( char c ) { + return c>='0' && c<='9'; + } + static inline bool isAlnum( char c ) { + return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9'); + } + +} + +int nv::strCmp(const char * s1, const char * s2) +{ + nvDebugCheck(s1 != NULL); + nvDebugCheck(s2 != NULL); + return strcmp(s1, s2); +} + +int nv::strCaseCmp(const char * s1, const char * s2) +{ + nvDebugCheck(s1 != NULL); + nvDebugCheck(s1 != NULL); +#if NV_CC_MSVC + return _stricmp(s1, s2); +#else + return strcasecmp(s1, s2); +#endif +} + +void nv::strCpy(char * dst, int size, const char * src) +{ + nvDebugCheck(dst != NULL); + nvDebugCheck(src != NULL); +#if NV_CC_MSVC && _MSC_VER >= 1400 + strcpy_s(dst, size, src); +#else + NV_UNUSED(size); + strcpy(dst, src); +#endif +} + +void nv::strCpy(char * dst, int size, const char * src, int len) +{ + nvDebugCheck(dst != NULL); + nvDebugCheck(src != NULL); +#if NV_CC_MSVC && _MSC_VER >= 1400 + strncpy_s(dst, size, src, len); +#else + NV_UNUSED(size); + strncpy(dst, src, len); +#endif +} + +void nv::strCat(char * dst, int size, const char * src) +{ + nvDebugCheck(dst != NULL); + nvDebugCheck(src != NULL); +#if NV_CC_MSVC && _MSC_VER >= 1400 + strcat_s(dst, size, src); +#else + NV_UNUSED(size); + strcat(dst, src); +#endif +} + + +/** Pattern matching routine. I don't remember where did I get this. */ +bool nv::strMatch(const char * str, const char * pat) +{ + nvDebugCheck(str != NULL); + nvDebugCheck(pat != NULL); + + char c2; + + while (true) { + if (*pat==0) { + if (*str==0) return true; + else return false; + } + if ((*str==0) && (*pat!='*')) return false; + if (*pat=='*') { + pat++; + if (*pat==0) return true; + while (true) { + if (strMatch(str, pat)) return true; + if (*str==0) return false; + str++; + } + } + if (*pat=='?') goto match; + if (*pat=='[') { + pat++; + while (true) { + if ((*pat==']') || (*pat==0)) return false; + if (*pat==*str) break; + if (pat[1] == '-') { + c2 = pat[2]; + if (c2==0) return false; + if ((*pat<=*str) && (c2>=*str)) break; + if ((*pat>=*str) && (c2<=*str)) break; + pat+=2; + } + pat++; + } + while (*pat!=']') { + if (*pat==0) { + pat--; + break; + } + pat++; + } + goto match; + } + + if (*pat == NV_PATH_SEPARATOR) { + pat++; + if (*pat==0) return false; + } + if (*pat!=*str) return false; + +match: + pat++; + str++; + } +} + + + +/** Empty string. */ +StringBuilder::StringBuilder() : m_size(0), m_str(NULL) +{ +} + +/** Preallocate space. */ +StringBuilder::StringBuilder( int size_hint ) : m_size(size_hint) +{ + nvDebugCheck(m_size > 0); + m_str = strAlloc(m_size); + *m_str = '\0'; +} + +/** Copy ctor. */ +StringBuilder::StringBuilder( const StringBuilder & s ) : m_size(0), m_str(NULL) +{ + copy(s); +} + +/** Copy string. */ +StringBuilder::StringBuilder( const char * s ) : m_size(0), m_str(NULL) +{ + copy(s); +} + +/** Delete the string. */ +StringBuilder::~StringBuilder() +{ + m_size = 0; + strFree(m_str); + m_str = NULL; +} + + +/** Format a string safely. */ +StringBuilder & StringBuilder::format( const char * fmt, ... ) +{ + nvDebugCheck(fmt != NULL); + va_list arg; + va_start( arg, fmt ); + + format( fmt, arg ); + + va_end( arg ); + + return *this; +} + + +/** Format a string safely. */ +StringBuilder & StringBuilder::format( const char * fmt, va_list arg ) +{ + nvDebugCheck(fmt != NULL); + + if( m_size == 0 ) { + m_size = 64; + m_str = strAlloc( m_size ); + } + + va_list tmp; + va_copy(tmp, arg); +#if NV_CC_MSVC && _MSC_VER >= 1400 + int n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp); +#else + int n = vsnprintf(m_str, m_size, fmt, tmp); +#endif + va_end(tmp); + + while( n < 0 || n >= int(m_size) ) { + if( n > -1 ) { + m_size = n + 1; + } + else { + m_size *= 2; + } + + m_str = strReAlloc(m_str, m_size); + + va_copy(tmp, arg); +#if NV_CC_MSVC && _MSC_VER >= 1400 + n = vsnprintf_s(m_str, m_size, _TRUNCATE, fmt, tmp); +#else + n = vsnprintf(m_str, m_size, fmt, tmp); +#endif + va_end(tmp); + } + + nvDebugCheck(n < int(m_size)); + + // Make sure it's null terminated. + nvDebugCheck(m_str[n] == '\0'); + //str[n] = '\0'; + + return *this; +} + + +/** Append a string. */ +StringBuilder & StringBuilder::append( const char * s ) +{ + nvDebugCheck(s != NULL); + + const uint slen = uint(strlen( s )); + + if( m_str == NULL ) { + m_size = slen + 1; + m_str = strAlloc(m_size); + strCpy( m_str, m_size, s ); + } + else { + + const uint len = uint(strlen( m_str )); + + if( m_size < len + slen + 1 ) { + m_size = len + slen + 1; + m_str = strReAlloc(m_str, m_size); + } + + strCat( m_str, m_size, s ); + } + + return *this; +} + + +/** Append a formatted string. */ +StringBuilder & StringBuilder::appendFormat( const char * format, ... ) +{ + nvDebugCheck( format != NULL ); + + va_list arg; + va_start( arg, format ); + + appendFormat( format, arg ); + + va_end( arg ); + + return *this; +} + + +/** Append a formatted string. */ +StringBuilder & StringBuilder::appendFormat( const char * format, va_list arg ) +{ + nvDebugCheck( format != NULL ); + + va_list tmp; + va_copy(tmp, arg); + + StringBuilder tmp_str; + tmp_str.format( format, tmp ); + append( tmp_str ); + + va_end(tmp); + + return *this; +} + + +/** Convert number to string in the given base. */ +StringBuilder & StringBuilder::number( int i, int base ) +{ + nvCheck( base >= 2 ); + nvCheck( base <= 36 ); + + // @@ This needs to be done correctly. + // length = floor(log(i, base)); + uint len = uint(log(float(i)) / log(float(base)) + 2); // one more if negative + reserve(len); + + if( i < 0 ) { + *m_str = '-'; + *i2a(uint(-i), m_str+1, base) = 0; + } + else { + *i2a(i, m_str, base) = 0; + } + + return *this; +} + + +/** Convert number to string in the given base. */ +StringBuilder & StringBuilder::number( uint i, int base ) +{ + nvCheck( base >= 2 ); + nvCheck( base <= 36 ); + + // @@ This needs to be done correctly. + // length = floor(log(i, base)); + uint len = uint(log(float(i)) / log(float(base)) - 0.5f + 1); + reserve(len); + + *i2a(i, m_str, base) = 0; + + return *this; +} + + +/** Resize the string preserving the contents. */ +StringBuilder & StringBuilder::reserve( uint size_hint ) +{ + nvCheck(size_hint != 0); + if( size_hint > m_size ) { + m_str = strReAlloc(m_str, size_hint); + m_size = size_hint; + } + return *this; +} + + +/** Copy a string safely. */ +StringBuilder & StringBuilder::copy( const char * s ) +{ + nvCheck( s != NULL ); + uint str_size = uint(strlen( s )) + 1; + reserve(str_size); + strCpy( m_str, str_size, s ); + return *this; +} + + +/** Copy an StringBuilder. */ +StringBuilder & StringBuilder::copy( const StringBuilder & s ) +{ + if( s.m_str == NULL ) { + nvCheck( s.m_size == 0 ); + m_size = 0; + strFree( m_str ); + m_str = NULL; + } + else { + reserve( s.m_size ); + strCpy( m_str, s.m_size, s.m_str ); + } + return *this; +} + +/** Reset the string. */ +void StringBuilder::reset() +{ + m_size = 0; + strFree( m_str ); + m_str = NULL; +} + + +/// Get the file name from a path. +const char * Path::fileName() const +{ + return fileName(m_str); +} + + +/// Get the extension from a file path. +const char * Path::extension() const +{ + return extension(m_str); +} + + +/// Toggles path separators (ie. \\ into /). +void Path::translatePath() +{ + nvCheck( m_str != NULL ); + + for(int i = 0; ; i++) { + if( m_str[i] == '\0' ) break; +#if NV_PATH_SEPARATOR == '/' + if( m_str[i] == '\\' ) m_str[i] = NV_PATH_SEPARATOR; +#else + if( m_str[i] == '/' ) m_str[i] = NV_PATH_SEPARATOR; +#endif + } +} + + +/** + * Strip the file name from a path. + * @warning path cannot end with '/' o '\\', can't it? + */ +void Path::stripFileName() +{ + nvCheck( m_str != NULL ); + + int length = (int)strlen(m_str) - 1; + while (length > 0 && m_str[length] != '/' && m_str[length] != '\\'){ + length--; + } + if( length ) { + m_str[length+1] = 0; + } + else { + m_str[0] = 0; + } +} + + +/// Strip the extension from a path name. +void Path::stripExtension() +{ + nvCheck( m_str != NULL ); + + int length = (int)strlen(m_str) - 1; + while( length > 0 && m_str[length] != '.' ) { + length--; + if( m_str[length] == NV_PATH_SEPARATOR ) { + return; // no extension + } + } + if( length ) { + m_str[length] = 0; + } +} + + +/// Get the path separator. +// static +char Path::separator() +{ + return NV_PATH_SEPARATOR; +} + +// static +const char * Path::fileName(const char * str) +{ + nvCheck( str != NULL ); + + int length = (int)strlen(str) - 1; + while( length >= 0 && str[length] != separator() ) { + length--; + } + + return &str[length+1]; +} + +// static +const char * Path::extension(const char * str) +{ + nvCheck( str != NULL ); + + int length, l; + l = length = (int)strlen( str ); + while( length > 0 && str[length] != '.' ) { + length--; + if( str[length] == separator() ) { + return &str[l]; // no extension + } + } + if( length == 0 ) { + return &str[l]; + } + return &str[length]; +} + + + +/// Clone this string +String String::clone() const +{ + String str(data); + return str; +} + +void String::setString(const char * str) +{ + if (str == NULL) { + data = NULL; + } + else { + allocString( str ); + addRef(); + } +} + +void String::setString(const char * str, int length) +{ + nvDebugCheck(str != NULL); + + allocString(str, length); + addRef(); +} + +void String::setString(const StringBuilder & str) +{ + if (str.str() == NULL) { + data = NULL; + } + else { + allocString(str); + addRef(); + } +} diff --git a/externals/NVTT/src/nvcore/StrLib.h b/externals/NVTT/src/nvcore/StrLib.h new file mode 100644 index 00000000..80122714 --- /dev/null +++ b/externals/NVTT/src/nvcore/StrLib.h @@ -0,0 +1,355 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_STRING_H +#define NV_CORE_STRING_H + +#include +#include // swap + +#include // strlen, strcmp, etc. + + +namespace nv +{ + + uint strHash(const char * str, uint h) NV_PURE; + + /// String hash based on Bernstein's hash. + inline uint strHash(const char * data, uint h = 5381) + { + uint i = 0; + while(data[i] != 0) { + h = (33 * h) ^ uint(data[i]); + i++; + } + return h; + } + + template <> struct hash { + uint operator()(const char * str) const { return strHash(str); } + }; + + NVCORE_API int strCaseCmp(const char * s1, const char * s2) NV_PURE; + NVCORE_API int strCmp(const char * s1, const char * s2) NV_PURE; + NVCORE_API void strCpy(char * dst, int size, const char * src); + NVCORE_API void strCpy(char * dst, int size, const char * src, int len); + NVCORE_API void strCat(char * dst, int size, const char * src); + + NVCORE_API bool strMatch(const char * str, const char * pat) NV_PURE; + + + /// String builder. + class NVCORE_CLASS StringBuilder + { + public: + + StringBuilder(); + explicit StringBuilder( int size_hint ); + StringBuilder( const char * str ); + StringBuilder( const StringBuilder & ); + + ~StringBuilder(); + + StringBuilder & format( const char * format, ... ) __attribute__((format (printf, 2, 3))); + StringBuilder & format( const char * format, va_list arg ); + + StringBuilder & append( const char * str ); + StringBuilder & appendFormat( const char * format, ... ) __attribute__((format (printf, 2, 3))); + StringBuilder & appendFormat( const char * format, va_list arg ); + + StringBuilder & number( int i, int base = 10 ); + StringBuilder & number( uint i, int base = 10 ); + + StringBuilder & reserve( uint size_hint ); + StringBuilder & copy( const char * str ); + StringBuilder & copy( const StringBuilder & str ); + + StringBuilder & toLower(); + StringBuilder & toUpper(); + + void reset(); + bool isNull() const { return m_size == 0; } + + // const char * accessors + operator const char * () const { return m_str; } + operator char * () { return m_str; } + const char * str() const { return m_str; } + char * str() { return m_str; } + + /// Implement value semantics. + StringBuilder & operator=( const StringBuilder & s ) { + return copy(s); + } + + /// Implement value semantics. + StringBuilder & operator=( const char * s ) { + return copy(s); + } + + /// Equal operator. + bool operator==( const StringBuilder & s ) const { + if (s.isNull()) return isNull(); + else if (isNull()) return false; + else return strcmp(s.m_str, m_str) != 0; + } + + /// Return the exact length. + uint length() const { return isNull() ? 0 : uint(strlen(m_str)); } + + /// Return the size of the string container. + uint capacity() const { return m_size; } + + /// Return the hash of the string. + uint hash() const { return isNull() ? 0 : strHash(m_str); } + + /// Swap strings. + friend void swap(StringBuilder & a, StringBuilder & b) { + nv::swap(a.m_size, b.m_size); + nv::swap(a.m_str, b.m_str); + } + + protected: + + /// Size of the string container. + uint m_size; + + /// String. + char * m_str; + + }; + + + /// Path string. @@ This should be called PathBuilder. + class NVCORE_CLASS Path : public StringBuilder + { + public: + Path() : StringBuilder() {} + explicit Path(int size_hint) : StringBuilder(size_hint) {} + Path(const char * str) : StringBuilder(str) {} + Path(const Path & path) : StringBuilder(path) {} + + const char * fileName() const; + const char * extension() const; + + void translatePath(); + + void stripFileName(); + void stripExtension(); + + // statics + NVCORE_API static char separator(); + NVCORE_API static const char * fileName(const char *); + NVCORE_API static const char * extension(const char *); + }; + + + /// String class. + class NVCORE_CLASS String + { + public: + + /// Constructs a null string. @sa isNull() + String() + { + data = NULL; + } + + /// Constructs a shared copy of str. + String(const String & str) + { + data = str.data; + if (data != NULL) addRef(); + } + + /// Constructs a shared string from a standard string. + String(const char * str) + { + setString(str); + } + + /// Constructs a shared string from a standard string. + String(const char * str, int length) + { + setString(str, length); + } + + /// Constructs a shared string from a StringBuilder. + String(const StringBuilder & str) + { + setString(str); + } + + /// Dtor. + ~String() + { + release(); + } + + String clone() const; + + /// Release the current string and allocate a new one. + const String & operator=( const char * str ) + { + release(); + setString( str ); + return *this; + } + + /// Release the current string and allocate a new one. + const String & operator=( const StringBuilder & str ) + { + release(); + setString( str ); + return *this; + } + + /// Implement value semantics. + String & operator=( const String & str ) + { + if (str.data != data) + { + release(); + data = str.data; + addRef(); + } + return *this; + } + + /// Equal operator. + bool operator==( const String & str ) const + { + if( str.data == data ) { + return true; + } + if ((data == NULL) != (str.data == NULL)) { + return false; + } + return strcmp(data, str.data) == 0; + } + + /// Equal operator. + bool operator==( const char * str ) const + { + nvCheck(str != NULL); // Use isNull! + if (data == NULL) { + return false; + } + return strcmp(data, str) == 0; + } + + /// Not equal operator. + bool operator!=( const String & str ) const + { + if( str.data == data ) { + return false; + } + if ((data == NULL) != (str.data == NULL)) { + return true; + } + return strcmp(data, str.data) != 0; + } + + /// Not equal operator. + bool operator!=( const char * str ) const + { + nvCheck(str != NULL); // Use isNull! + if (data == NULL) { + return false; + } + return strcmp(data, str) != 0; + } + + /// Returns true if this string is the null string. + bool isNull() const { return data == NULL; } + + /// Return the exact length. + uint length() const { nvDebugCheck(data != NULL); return uint(strlen(data)); } + + /// Return the hash of the string. + uint hash() const { nvDebugCheck(data != NULL); return strHash(data); } + + /// const char * cast operator. + operator const char * () const { return data; } + + /// Get string pointer. + const char * str() const { return data; } + + + private: + + // Add reference count. + void addRef() + { + if (data != NULL) + { + setRefCount(getRefCount() + 1); + } + } + + // Decrease reference count. + void release() + { + if (data != NULL) + { + const uint16 count = getRefCount(); + setRefCount(count - 1); + if (count - 1 == 0) { + mem::free(data - 2); + data = NULL; + } + } + } + + uint16 getRefCount() const + { + nvDebugCheck(data != NULL); + return *reinterpret_cast(data - 2); + } + + void setRefCount(uint16 count) { + nvDebugCheck(data != NULL); + nvCheck(count < 0xFFFF); + *reinterpret_cast(const_cast(data - 2)) = uint16(count); + } + + void setData(const char * str) { + data = str + 2; + } + + void allocString(const char * str) + { + allocString(str, (int)strlen(str)); + } + + void allocString(const char * str, int len) + { + const char * ptr = static_cast(mem::malloc(2 + len + 1)); + + setData( ptr ); + setRefCount( 0 ); + + // Copy string. + strCpy(const_cast(data), len+1, str, len); + + // Add terminating character. + const_cast(data)[len] = '\0'; + } + + void setString(const char * str); + void setString(const char * str, int length); + void setString(const StringBuilder & str); + + /// Swap strings. + friend void swap(String & a, String & b) { + swap(a.data, b.data); + } + + private: + + const char * data; + + }; + +} // nv namespace + +#endif // NV_CORE_STRING_H diff --git a/externals/NVTT/src/nvcore/Stream.h b/externals/NVTT/src/nvcore/Stream.h new file mode 100644 index 00000000..4a35120f --- /dev/null +++ b/externals/NVTT/src/nvcore/Stream.h @@ -0,0 +1,160 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NVCORE_STREAM_H +#define NVCORE_STREAM_H + +#include +#include + +namespace nv +{ + +/// Base stream class. +class NVCORE_CLASS Stream { +public: + + enum ByteOrder { + LittleEndian = false, + BigEndian = true, + }; + + /// Get the byte order of the system. + static ByteOrder getSystemByteOrder() { +# if NV_LITTLE_ENDIAN + return LittleEndian; +# else + return BigEndian; +# endif + } + + + /// Ctor. + Stream() : m_byteOrder(LittleEndian) { } + + /// Virtual destructor. + virtual ~Stream() {} + + /// Set byte order. + void setByteOrder(ByteOrder bo) { m_byteOrder = bo; } + + /// Get byte order. + ByteOrder byteOrder() const { return m_byteOrder; } + + + /// Serialize the given data. + virtual uint serialize( void * data, uint len ) = 0; + + /// Move to the given position in the archive. + virtual void seek( uint pos ) = 0; + + /// Return the current position in the archive. + virtual uint tell() const = 0; + + /// Return the current size of the archive. + virtual uint size() const = 0; + + /// Determine if there has been any error. + virtual bool isError() const = 0; + + /// Clear errors. + virtual void clearError() = 0; + + /// Return true if the stream is at the end. + virtual bool isAtEnd() const = 0; + + /// Return true if the stream is seekable. + virtual bool isSeekable() const = 0; + + /// Return true if this is an input stream. + virtual bool isLoading() const = 0; + + /// Return true if this is an output stream. + virtual bool isSaving() const = 0; + + + // friends + friend Stream & operator<<( Stream & s, bool & c ) { +# if NV_OS_DARWIN + nvStaticCheck(sizeof(bool) == 4); + uint8 b = c ? 1 : 0; + s.serialize( &b, 1 ); + c = (b == 1); +# else + nvStaticCheck(sizeof(bool) == 1); + s.serialize( &c, 1 ); +# endif + return s; + } + friend Stream & operator<<( Stream & s, char & c ) { + nvStaticCheck(sizeof(char) == 1); + s.serialize( &c, 1 ); + return s; + } + friend Stream & operator<<( Stream & s, uint8 & c ) { + nvStaticCheck(sizeof(uint8) == 1); + s.serialize( &c, 1 ); + return s; + } + friend Stream & operator<<( Stream & s, int8 & c ) { + nvStaticCheck(sizeof(int8) == 1); + s.serialize( &c, 1 ); + return s; + } + friend Stream & operator<<( Stream & s, uint16 & c ) { + nvStaticCheck(sizeof(uint16) == 2); + return s.byteOrderSerialize( &c, 2 ); + } + friend Stream & operator<<( Stream & s, int16 & c ) { + nvStaticCheck(sizeof(int16) == 2); + return s.byteOrderSerialize( &c, 2 ); + } + friend Stream & operator<<( Stream & s, uint32 & c ) { + nvStaticCheck(sizeof(uint32) == 4); + return s.byteOrderSerialize( &c, 4 ); + } + friend Stream & operator<<( Stream & s, int32 & c ) { + nvStaticCheck(sizeof(int32) == 4); + return s.byteOrderSerialize( &c, 4 ); + } + friend Stream & operator<<( Stream & s, uint64 & c ) { + nvStaticCheck(sizeof(uint64) == 8); + return s.byteOrderSerialize( &c, 8 ); + } + friend Stream & operator<<( Stream & s, int64 & c ) { + nvStaticCheck(sizeof(int64) == 8); + return s.byteOrderSerialize( &c, 8 ); + } + friend Stream & operator<<( Stream & s, float & c ) { + nvStaticCheck(sizeof(float) == 4); + return s.byteOrderSerialize( &c, 4 ); + } + friend Stream & operator<<( Stream & s, double & c ) { + nvStaticCheck(sizeof(double) == 8); + return s.byteOrderSerialize( &c, 8 ); + } + +protected: + + /// Serialize in the stream byte order. + Stream & byteOrderSerialize( void * v, uint len ) { + if( m_byteOrder == getSystemByteOrder() ) { + serialize( v, len ); + } + else { + for( uint i = len; i > 0; i-- ) { + serialize( (uint8 *)v + i - 1, 1 ); + } + } + return *this; + } + + +private: + + ByteOrder m_byteOrder; + +}; + +} // nv namespace + +#endif // NV_STREAM_H diff --git a/externals/NVTT/src/nvcore/TextReader.cpp b/externals/NVTT/src/nvcore/TextReader.cpp new file mode 100644 index 00000000..8eb74612 --- /dev/null +++ b/externals/NVTT/src/nvcore/TextReader.cpp @@ -0,0 +1,86 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +using namespace nv; + +/// Peek next character. +char TextReader::peek() +{ + nvDebugCheck(m_stream != NULL); + nvDebugCheck(m_stream->isSeekable()); + + if (m_stream->isAtEnd()) { + return 0; + } + + uint pos = m_stream->tell(); + + char c; + m_stream->serialize(&c, 1); + m_stream->seek(pos); + return c; +} + +/// Read a single char. +char TextReader::read() +{ + nvDebugCheck(m_stream != NULL); + + char c; + m_stream->serialize(&c, 1); + + if( m_stream->isAtEnd() ) { + return 0; + } + + return c; +} + +/// Read from the current location to the end of the stream. +const char * TextReader::readToEnd() +{ + nvDebugCheck(m_stream != NULL); + const int size = m_stream->size(); + + m_text.clear(); + + m_text.reserve(size + 1); + m_text.resize(size); + + m_stream->serialize(m_text.unsecureBuffer(), size); + m_text.pushBack('\0'); + + return m_text.buffer(); +} + +/// Read from the current location to the end of the line. +const char * TextReader::readLine() +{ + m_text.clear(); + + if (m_stream->isAtEnd()) { + return NULL; + } + + while (true) { + char c = read(); + + if (c == 0 || c == '\n') { + break; + } + else if (c == '\r') { + if( peek() == '\n' ) { + read(); + } + break; + } + + m_text.pushBack(c); + } + + m_text.pushBack('\0'); + return m_text.buffer(); +} + + diff --git a/externals/NVTT/src/nvcore/TextReader.h b/externals/NVTT/src/nvcore/TextReader.h new file mode 100644 index 00000000..b3d6d374 --- /dev/null +++ b/externals/NVTT/src/nvcore/TextReader.h @@ -0,0 +1,38 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NVCORE_TEXTREADER_H +#define NVCORE_TEXTREADER_H + +#include +#include +#include + +namespace nv +{ + +/// Text reader. +class NVCORE_CLASS TextReader { +public: + + /// Ctor. + TextReader(Stream * stream) : m_stream(stream), m_text(512) { + nvCheck(stream != NULL); + nvCheck(stream->isLoading()); + } + + char peek(); + char read(); + + const char *readToEnd(); + + // Returns a temporary string. + const char * readLine(); + +private: + Stream * m_stream; + Array m_text; +}; + +} // nv namespace + +#endif // NVCORE_TEXTREADER_H diff --git a/externals/NVTT/src/nvcore/TextWriter.cpp b/externals/NVTT/src/nvcore/TextWriter.cpp new file mode 100644 index 00000000..f5e1783a --- /dev/null +++ b/externals/NVTT/src/nvcore/TextWriter.cpp @@ -0,0 +1,45 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +using namespace nv; + + +/// Constructor +TextWriter::TextWriter(Stream * s) : + s(s), + str(1024) +{ + nvCheck(s != NULL); + nvCheck(s->isSaving()); +} + +void TextWriter::writeString(const char * str) +{ + nvDebugCheck(s != NULL); + s->serialize(const_cast(str), (int)strlen(str)); +} + +void TextWriter::writeString(const char * str, uint len) +{ + nvDebugCheck(s != NULL); + s->serialize(const_cast(str), len); +} + +void TextWriter::write(const char * format, ...) +{ + va_list arg; + va_start(arg,format); + str.format(format, arg); + writeString(str.str(), str.length()); + va_end(arg); +} + +void TextWriter::write(const char * format, va_list arg) +{ + va_list tmp; + va_copy(tmp, arg); + str.format(format, arg); + writeString(str.str(), str.length()); + va_end(tmp); +} diff --git a/externals/NVTT/src/nvcore/TextWriter.h b/externals/NVTT/src/nvcore/TextWriter.h new file mode 100644 index 00000000..155373cf --- /dev/null +++ b/externals/NVTT/src/nvcore/TextWriter.h @@ -0,0 +1,65 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NVCORE_TEXTWRITER_H +#define NVCORE_TEXTWRITER_H + +#include +#include +#include + +namespace nv +{ + + /// Text writer. + class NVCORE_CLASS TextWriter + { + public: + + TextWriter(Stream * s); + + void writeString(const char * str); + void writeString(const char * str, uint len); + void write(const char * format, ...) __attribute__((format (printf, 2, 3))); + void write(const char * format, va_list arg); + + private: + + Stream * s; + + // Temporary string. + StringBuilder str; + + }; + + + inline TextWriter & operator<<( TextWriter & tw, int i) + { + tw.write("%d", i); + return tw; + } + + inline TextWriter & operator<<( TextWriter & tw, uint i) + { + tw.write("%u", i); + return tw; + } + + inline TextWriter & operator<<( TextWriter & tw, float f) + { + tw.write("%f", f); + return tw; + } + + inline TextWriter & operator<<( TextWriter & tw, const char * str) + { + tw.writeString(str); + return tw; + } + +} // nv namespace + + + + + +#endif // NVCORE_TEXTWRITER_H diff --git a/externals/NVTT/src/nvcore/Tokenizer.cpp b/externals/NVTT/src/nvcore/Tokenizer.cpp new file mode 100644 index 00000000..466459a8 --- /dev/null +++ b/externals/NVTT/src/nvcore/Tokenizer.cpp @@ -0,0 +1,229 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include + +#include // vsscanf +#include // va_list +#include // atof, atoi + +#if NV_CC_MSVC +#if 0 // This doesn't work on MSVC for x64 +/* vsscanf for Win32 + * Written 5/2003 by + * This code is in the Public Domain + */ + +#include // alloca +//#include + +static int vsscanf(const char * buffer, const char * format, va_list argPtr) +{ + // Get an upper bound for the # of args + size_t count = 0; + const char *p = format; + while(1) { + char c = *(p++); + if(c==0) break; + if(c=='%' && (p[0]!='*' && p[0]!='%')) ++count; + } + + // Make a local stack + size_t stackSize = (2+count)*sizeof(void*); + void **newStack = (void**)alloca(stackSize); + + // Fill local stack the way sscanf likes it + newStack[0] = (void*)buffer; + newStack[1] = (void*)format; + memcpy(newStack+2, argPtr, count*sizeof(void*)); + + // @@ Use: CALL DWORD PTR [sscanf] + + // Warp into system sscanf with new stack + int result; + void *savedESP; + __asm + { + mov savedESP, esp + mov esp, newStack +#if _MSC_VER >= 1400 + call DWORD PTR [sscanf_s] +#else + call DWORD PTR [sscanf] +#endif + mov esp, savedESP + mov result, eax + } + return result; +} +#endif +#endif + +using namespace nv; + +Token::Token() : + m_str(""), m_len(0) +{ +} + +Token::Token(const Token & token) : + m_str(token.m_str), m_len(token.m_len) +{ +} + +Token::Token(const char * str, int len) : + m_str(str), m_len(len) +{ +} + +bool Token::operator==(const char * str) const +{ + return strncmp(m_str, str, m_len) == 0; +} +bool Token::operator!=(const char * str) const +{ + return strncmp(m_str, str, m_len) != 0; +} + +bool Token::isNull() +{ + return m_len != 0; +} + +float Token::toFloat() const +{ + return float(atof(m_str)); +} + +int Token::toInt() const +{ + return atoi(m_str); +} + +uint Token::toUnsignedInt() const +{ + // @@ TBD + return uint(atoi(m_str)); +} + +String Token::toString() const +{ + return String(m_str, m_len); +} + +bool Token::parse(const char * format, int count, ...) const +{ + va_list arg; + va_start(arg, count); + + int readCount = vsscanf(m_str, format, arg); + + va_end(arg); + + return readCount == count; +} + + +Tokenizer::Tokenizer(Stream * stream) : + m_reader(stream), m_lineNumber(0), m_columnNumber(0), m_delimiters("{}()="), m_spaces(" \t") +{ +} + +bool Tokenizer::nextLine(bool skipEmptyLines /*= true*/) +{ + do { + if (!readLine()) { + return false; + } + } + while (!readToken() && skipEmptyLines); + + return true; +} + +bool Tokenizer::nextToken(bool skipEndOfLine /*= false*/) +{ + if (!readToken()) { + if (!skipEndOfLine) { + return false; + } + else { + return nextLine(true); + } + } + return true; +} + +bool Tokenizer::readToken() +{ + skipSpaces(); + + const char * begin = m_line + m_columnNumber; + + if (*begin == '\0') { + return false; + } + + char c = readChar(); + if (isDelimiter(c)) { + m_token = Token(begin, 1); + return true; + } + + // @@ Add support for quoted tokens "", '' + + int len = 0; + while (!isDelimiter(c) && !isSpace(c) && c != '\0') { + c = readChar(); + len++; + } + m_columnNumber--; + + m_token = Token(begin, len); + + return true; +} + +char Tokenizer::readChar() +{ + return m_line[m_columnNumber++]; +} + +bool Tokenizer::readLine() +{ + m_lineNumber++; + m_columnNumber = 0; + m_line = m_reader.readLine(); + return m_line != NULL; +} + +void Tokenizer::skipSpaces() +{ + while (isSpace(readChar())) {} + m_columnNumber--; +} + +bool Tokenizer::isSpace(char c) +{ + uint i = 0; + while (m_spaces[i] != '\0') { + if (c == m_spaces[i]) { + return true; + } + i++; + } + return false; +} + +bool Tokenizer::isDelimiter(char c) +{ + uint i = 0; + while (m_delimiters[i] != '\0') { + if (c == m_delimiters[i]) { + return true; + } + i++; + } + return false; +} + diff --git a/externals/NVTT/src/nvcore/Tokenizer.h b/externals/NVTT/src/nvcore/Tokenizer.h new file mode 100644 index 00000000..48579c88 --- /dev/null +++ b/externals/NVTT/src/nvcore/Tokenizer.h @@ -0,0 +1,99 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_TOKENIZER_H +#define NV_CORE_TOKENIZER_H + +#include +#include +#include +#include + +namespace nv +{ + /// A token produced by the Tokenizer. + class NVCORE_CLASS Token + { + public: + Token(); + Token(const Token & token); + Token(const char * str, int len); + + bool operator==(const char * str) const; + bool operator!=(const char * str) const; + + bool isNull(); + + float toFloat() const; + int toInt() const; + uint toUnsignedInt() const; + String toString() const; + + bool parse(const char * format, int count, ...) const __attribute__((format (scanf, 2, 4))); + + private: + const char * m_str; + int m_len; + }; + + /// Exception thrown by the tokenizer. + class TokenizerException + { + public: + TokenizerException(int line, int column) : m_line(line), m_column(column) {} + + int line() const { return m_line; } + int column() const { return m_column; } + + private: + int m_line; + int m_column; + }; + + // @@ Use enums instead of bools for clarity! + //enum SkipEmptyLines { skipEmptyLines, noSkipEmptyLines }; + //enum SkipEndOfLine { skipEndOfLine, noSkipEndOfLine }; + + /// A simple stream tokenizer. + class NVCORE_CLASS Tokenizer + { + public: + Tokenizer(Stream * stream); + + bool nextLine(bool skipEmptyLines = true); + bool nextToken(bool skipEndOfLine = false); + + const Token & token() const { return m_token; } + + int lineNumber() const { return m_lineNumber; } + int columnNumber() const { return m_columnNumber; } + + void setDelimiters(const char * str) { m_delimiters = str; } + const char * delimiters() const { return m_delimiters; } + + void setSpaces(const char * str) { m_spaces = str; } + const char * spaces() const { return m_spaces; } + + private: + char readChar(); + bool readLine(); + bool readToken(); + void skipSpaces(); + bool isSpace(char c); + bool isDelimiter(char c); + + private: + TextReader m_reader; + const char * m_line; + Token m_token; + + int m_lineNumber; + int m_columnNumber; + + const char * m_delimiters; + const char * m_spaces; + }; + +} // nv namespace + + +#endif // NV_CORE_TOKENIZER_H diff --git a/externals/NVTT/src/nvcore/nvcore.h b/externals/NVTT/src/nvcore/nvcore.h new file mode 100644 index 00000000..469f6adb --- /dev/null +++ b/externals/NVTT/src/nvcore/nvcore.h @@ -0,0 +1,172 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_CORE_H +#define NV_CORE_H + +// cmake config +#include + +// Function linkage +#if NVCORE_SHARED +#ifdef NVCORE_EXPORTS +#define NVCORE_API DLL_EXPORT +#define NVCORE_CLASS DLL_EXPORT_CLASS +#else +#define NVCORE_API DLL_IMPORT +#define NVCORE_CLASS DLL_IMPORT +#endif +#else // NVCORE_SHARED +#define NVCORE_API +#define NVCORE_CLASS +#endif // NVCORE_SHARED + + +// Platform definitions +#include "poshlib/posh.h" + +// OS: +// NV_OS_WIN32 +// NV_OS_WIN64 +// NV_OS_MINGW +// NV_OS_CYGWIN +// NV_OS_LINUX +// NV_OS_UNIX +// NV_OS_DARWIN + +#define NV_OS_STRING POSH_OS_STRING + +#if defined POSH_OS_LINUX +# define NV_OS_LINUX 1 +# define NV_OS_UNIX 1 +#elif defined POSH_OS_CYGWIN32 +# define NV_OS_CYGWIN 1 +#elif defined POSH_OS_MINGW +# define NV_OS_MINGW 1 +# define NV_OS_WIN32 1 +#elif defined POSH_OS_OSX +# define NV_OS_DARWIN 1 +# define NV_OS_UNIX 1 +#elif defined POSH_OS_UNIX +# define NV_OS_UNIX 1 +#elif defined POSH_OS_WIN32 +# define NV_OS_WIN32 1 +#elif defined POSH_OS_WIN64 +# define NV_OS_WIN64 1 +#else +# error "Unsupported OS" +#endif + + +// CPUs: +// NV_CPU_X86 +// NV_CPU_X86_64 +// NV_CPU_PPC + +#define NV_CPU_STRING POSH_CPU_STRING + +#if defined POSH_CPU_X86_64 +# define NV_CPU_X86_64 1 +#elif defined POSH_CPU_X86 +# define NV_CPU_X86 1 +#elif defined POSH_CPU_PPC +# define NV_CPU_PPC 1 +#else +# error "Unsupported CPU" +#endif + + +// Compiler: +// NV_CC_GNUC +// NV_CC_MSVC +// @@ NV_CC_MSVC6 +// @@ NV_CC_MSVC7 +// @@ NV_CC_MSVC8 + +#if defined POSH_COMPILER_GCC +# define NV_CC_GNUC 1 +# define NV_CC_STRING "gcc" +#elif defined POSH_COMPILER_MSVC +# define NV_CC_MSVC 1 +# define NV_CC_STRING "msvc" +#else +# error "Unsupported compiler" +#endif + + +// Endiannes: +#define NV_LITTLE_ENDIAN POSH_LITTLE_ENDIAN +#define NV_BIG_ENDIAN POSH_BIG_ENDIAN +#define NV_ENDIAN_STRING POSH_ENDIAN_STRING + + +// Version string: +#define NV_VERSION_STRING \ + NV_OS_STRING "/" NV_CC_STRING "/" NV_CPU_STRING"/" \ + NV_ENDIAN_STRING"-endian - " __DATE__ "-" __TIME__ + + +/// Disable copy constructor and assignment operator. +/// @hideinitializer +#define NV_FORBID_COPY(C) \ + private: \ + C( const C & ); \ + C &operator=( const C & ); + + +/// Disable dynamic allocation on the heap. +/// See Prohibiting Heap-Based Objects in More Effective C++. +/// @hideinitializer +#define NV_FORBID_HEAPALLOC() \ + private: \ + static void *operator new(size_t size); \ + static void *operator new[](size_t size); + +// String concatenation macros. +#define NV_STRING_JOIN2(arg1, arg2) NV_DO_STRING_JOIN2(arg1, arg2) +#define NV_DO_STRING_JOIN2(arg1, arg2) arg1 ## arg2 +#define NV_STRING_JOIN3(arg1, arg2, arg3) NV_DO_STRING_JOIN3(arg1, arg2, arg3) +#define NV_DO_STRING_JOIN3(arg1, arg2, arg3) arg1 ## arg2 ## arg3 + +// Startup initialization macro. +#define NV_AT_STARTUP(some_code) \ + namespace { \ + static struct NV_STRING_JOIN2(AtStartup_, __LINE__) { \ + NV_STRING_JOIN2(AtStartup_, __LINE__)() { some_code; } \ + } \ + NV_STRING_JOIN3(AtStartup_, __LINE__, Instance); \ + }; + +/// Indicate the compiler that the parameter is not used to suppress compier warnings. +/// @hideinitializer +#define NV_UNUSED(a) ((a)=(a)) + +/// Null index. @@ Move this somewhere else... This could have collisions with other definitions! +#define NIL uint(~0) + +/// Null pointer. +#ifndef NULL +#define NULL 0 +#endif + +// Platform includes +#if NV_CC_MSVC +# if NV_OS_WIN32 +# include "DefsVcWin32.h" +# else +# error "MSVC: Platform not supported" +# endif +#elif NV_CC_GNUC +# if NV_OS_LINUX +# include "DefsGnucLinux.h" +# elif NV_OS_DARWIN +# include "DefsGnucDarwin.h" +# elif NV_OS_MINGW +# include "DefsGnucWin32.h" +# elif NV_OS_CYGWIN +# error "GCC: Cygwin not supported" +# else +# error "GCC: Platform not supported" +# endif +#endif + +#endif // NV_CORE_H diff --git a/externals/NVTT/src/nvcore/poshlib/CMakeLists.txt b/externals/NVTT/src/nvcore/poshlib/CMakeLists.txt new file mode 100644 index 00000000..a0f639ef --- /dev/null +++ b/externals/NVTT/src/nvcore/poshlib/CMakeLists.txt @@ -0,0 +1,7 @@ + +SET(POSHLIB_SRCS + posh.c + posh.h) + +ADD_LIBRARY(posh STATIC ${POSHLIB_SRCS}) + diff --git a/externals/NVTT/src/nvcore/poshlib/posh.c b/externals/NVTT/src/nvcore/poshlib/posh.c new file mode 100644 index 00000000..bd3fcc66 --- /dev/null +++ b/externals/NVTT/src/nvcore/poshlib/posh.c @@ -0,0 +1,1006 @@ +/* +LICENSE: + +Copyright (c) 2004, Brian Hook +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of this package'ss contributors contributors may not + be used to endorse or promote products derived from this + software without specific prior written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/** + @file posh.c + @author Brian Hook + @date 2002 + @brief Portable Open Source Harness primary source file +*/ +#include "posh.h" + +#if !defined FORCE_DOXYGEN + +#if !defined POSH_NO_FLOAT +# define POSH_FLOAT_STRING "enabled" +#else +# define POSH_FLOAT_STRING "disabled" +#endif + +#if defined POSH_64BIT_INTEGER +# define POSH_64BIT_INTEGER_STRING "yes" +#else +# define POSH_64BIT_INTEGER_STRING "no" +#endif + +#if defined POSH_64BIT_POINTER +# define POSH_POINTER_STRING "64-bits" +#else +# define POSH_POINTER_STRING "32-bits" +#endif + +#if defined POSH_LITTLE_ENDIAN +# define IS_BIG_ENDIAN 0 + +# define NATIVE16 POSH_LittleU16 +# define NATIVE32 POSH_LittleU32 +# define NATIVE64 POSH_LittleU64 +# define FOREIGN16 POSH_BigU16 +# define FOREIGN32 POSH_BigU32 +# define FOREIGN64 POSH_BigU64 +#else +# define IS_BIG_ENDIAN 1 + +# define NATIVE16 POSH_BigU16 +# define NATIVE32 POSH_BigU32 +# define NATIVE64 POSH_BigU64 +# define FOREIGN16 POSH_LittleU16 +# define FOREIGN32 POSH_LittleU32 +# define FOREIGN64 POSH_LittleU64 +#endif /* POSH_LITTLE_ENDIAN */ + +static +int +s_testBigEndian( void ) +{ + union + { + posh_byte_t c[ 4 ]; + posh_u32_t i; + } u; + + u.i= 1; + + if ( u.c[ 0 ] == 1 ) + { + return 0; + } + return 1; +} + +static +const char * +s_testSerialization( void ) +{ + posh_byte_t serbuf[ 8 ]; + posh_u16_t tmp16; + posh_u32_t tmp32; + + /* 16-bit serialization */ + POSH_WriteU16ToLittle( serbuf, 0xABCD ); + if ( ( tmp16 = POSH_ReadU16FromLittle( serbuf ) ) != 0xABCD ) + { + return "*ERROR: failed little-endian 16-bit serialization test"; + } + + POSH_WriteU16ToBig( serbuf, 0xABCD ); + if ( ( tmp16 = POSH_ReadU16FromBig( serbuf ) ) != 0xABCD ) + { + return "*ERROR: failed big-endian 16-bit serialization test"; + } + + /* 32-bit serialization */ + POSH_WriteU32ToLittle( serbuf, 0xABCD1234L ); + if ( ( tmp32 = POSH_ReadU32FromLittle( serbuf ) ) != 0xABCD1234 ) + { + return "*ERROR: failed little-endian 32-bit serialization test"; + } + + POSH_WriteU32ToBig( serbuf, 0xABCD1234L ); + if ( ( tmp32 = POSH_ReadU32FromBig( serbuf ) ) != 0xABCD1234 ) + { + return "*ERROR: failed big-endian 32-bit serialization test"; + } + +#if defined POSH_64BIT_INTEGER + { +#define REF64 POSH_U64(0xFEDCBA9876543210) + + posh_u64_t tmp64; + + POSH_WriteU64ToLittle( serbuf, REF64 ); + + if ( ( tmp64 = POSH_ReadU64FromLittle( serbuf ) ) != REF64 ) + { + return "*ERROR: failed little-endian 64-bit serialization test"; + } + + POSH_WriteU64ToBig( serbuf, REF64 ); + + if ( ( tmp64 = POSH_ReadU64FromBig( serbuf ) ) != REF64 ) + { + return "*ERROR: failed big-endian 64-bit serialization test"; + } + } +#endif + + return 0; +} + +#if !defined POSH_NO_FLOAT +static +const char * +s_testFloatingPoint( void ) +{ + float fRef = 10.0f/30.0f; + double dRef = 10.0/30.0; + posh_byte_t dbuf[ 8 ]; + float fTmp; + double dTmp; + + fTmp = POSH_FloatFromLittleBits( POSH_LittleFloatBits( fRef ) ); + + if ( fTmp != fRef ) + { + return "*ERROR: POSH little endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n"; + } + + fTmp = POSH_FloatFromBigBits( POSH_BigFloatBits( fRef ) ); + if ( fTmp != fRef ) + { + return "*ERROR: POSH big endian floating point conversion failed. Please report this to poshlib@poshlib.org!\n"; + } + + POSH_DoubleBits( dRef, dbuf ); + + dTmp = POSH_DoubleFromBits( dbuf ); + + if ( dTmp != dRef ) + { + return "*ERROR: POSH double precision floating point serialization failed. Please report this to poshlib@poshlib.org!\n"; + } + + return 0; +} +#endif /* !defined POSH_NO_FLOAT */ + +static +const char * +s_testEndianess( void ) +{ + /* check endianess */ + if ( s_testBigEndian() != IS_BIG_ENDIAN ) + { + return "*ERROR: POSH compile time endianess does not match run-time endianess verification. Please report this to poshlib@poshlib.org!\n"; + } + + /* make sure our endian swap routines work */ + if ( ( NATIVE32( 0x11223344L ) != 0x11223344L ) || + ( FOREIGN32( 0x11223344L ) != 0x44332211L ) || + ( NATIVE16( 0x1234 ) != 0x1234 ) || + ( FOREIGN16( 0x1234 ) != 0x3412 ) ) + { + return "*ERROR: POSH endianess macro selection failed. Please report this to poshlib@poshlib.org!\n"; + } + + /* test serialization routines */ + + return 0; +} +#endif /* !defined FORCE_DOXYGEN */ + +/** + Returns a string describing this platform's basic attributes. + + POSH_GetArchString() reports on an architecture's statically determined + attributes. In addition, it will perform run-time verification checks + to make sure the various platform specific functions work. If an error + occurs, please contact me at poshlib@poshlib.org so we can try to resolve + what the specific failure case is. + @returns a string describing this platform on success, or a string in the + form "*ERROR: [text]" on failure. You can simply check to see if + the first character returned is '*' to verify an error condition. +*/ +const char * +POSH_GetArchString( void ) +{ + const char *err; + const char *s = "OS:.............."POSH_OS_STRING"\n" + "CPU:............."POSH_CPU_STRING"\n" + "endian:.........."POSH_ENDIAN_STRING"\n" + "ptr size:........"POSH_POINTER_STRING"\n" + "64-bit ints......"POSH_64BIT_INTEGER_STRING"\n" + "floating point..."POSH_FLOAT_STRING"\n" + "compiler........."POSH_COMPILER_STRING"\n"; + + /* test endianess */ + err = s_testEndianess(); + + if ( err != 0 ) + { + return err; + } + + /* test serialization */ + err = s_testSerialization(); + + if ( err != 0 ) + { + return err; + } + +#if !defined POSH_NO_FLOAT + /* check that our floating point support is correct */ + err = s_testFloatingPoint(); + + if ( err != 0 ) + { + return err; + } + +#endif + + return s; +} + +/* ---------------------------------------------------------------------------*/ +/* BYTE SWAPPING SUPPORT */ +/* ---------------------------------------------------------------------------*/ +/** + * Byte swaps a 16-bit unsigned value + * + @ingroup ByteSwapFunctions + @param v [in] unsigned 16-bit input value to swap + @returns a byte swapped version of v + */ +posh_u16_t +POSH_SwapU16( posh_u16_t v ) +{ + posh_u16_t swapped; + + swapped = v << 8; + swapped |= v >> 8; + + return swapped; +} + +/** + * Byte swaps a 16-bit signed value + * + @ingroup ByteSwapFunctions + @param v [in] signed 16-bit input value to swap + @returns a byte swapped version of v + @remarks This just calls back to the unsigned version, since byte swapping + is independent of sign. However, we still provide this function to + avoid signed/unsigned mismatch compiler warnings. + */ +posh_i16_t +POSH_SwapI16( posh_i16_t v ) +{ + return ( posh_i16_t ) POSH_SwapU16( v ); +} + +/** + * Byte swaps a 32-bit unsigned value + * + @ingroup ByteSwapFunctions + @param v [in] unsigned 32-bit input value to swap + @returns a byte swapped version of v + */ +posh_u32_t +POSH_SwapU32( posh_u32_t v ) +{ + posh_u32_t swapped; + + swapped = ( v & 0xFF ) << 24; + swapped |= ( v & 0xFF00 ) << 8; + swapped |= ( v >> 8 ) & 0xFF00; + swapped |= ( v >> 24 ); + + return swapped; +} + +/** + * Byte swaps a 32-bit signed value + * + @ingroup ByteSwapFunctions + @param v [in] signed 32-bit input value to swap + @returns a byte swapped version of v + @remarks This just calls back to the unsigned version, since byte swapping + is independent of sign. However, we still provide this function to + avoid signed/unsigned mismatch compiler warnings. + */ +posh_i32_t +POSH_SwapI32( posh_i32_t v ) +{ + return ( posh_i32_t ) POSH_SwapU32( ( posh_u32_t ) v ); +} + +#if defined POSH_64BIT_INTEGER +/** + * Byte swaps a 64-bit unsigned value + + @param v [in] a 64-bit input value to swap + @ingroup SixtyFourBit + @returns a byte swapped version of v +*/ +posh_u64_t +POSH_SwapU64( posh_u64_t v ) +{ + posh_byte_t tmp; + union { + posh_byte_t bytes[ 8 ]; + posh_u64_t u64; + } u; + + u.u64 = v; + + tmp = u.bytes[ 0 ]; u.bytes[ 0 ] = u.bytes[ 7 ]; u.bytes[ 7 ] = tmp; + tmp = u.bytes[ 1 ]; u.bytes[ 1 ] = u.bytes[ 6 ]; u.bytes[ 6 ] = tmp; + tmp = u.bytes[ 2 ]; u.bytes[ 2 ] = u.bytes[ 5 ]; u.bytes[ 5 ] = tmp; + tmp = u.bytes[ 3 ]; u.bytes[ 3 ] = u.bytes[ 4 ]; u.bytes[ 4 ] = tmp; + + return u.u64; +} + +/** + * Byte swaps a 64-bit signed value + + @param v [in] a 64-bit input value to swap + @ingroup SixtyFourBit + @returns a byte swapped version of v +*/ +posh_i64_t +POSH_SwapI64( posh_i64_t v ) +{ + return ( posh_i64_t ) POSH_SwapU64( ( posh_u64_t ) v ); +} + +#endif /* defined POSH_64BIT_INTEGER */ + +/* ---------------------------------------------------------------------------*/ +/* IN-MEMORY SERIALIZATION */ +/* ---------------------------------------------------------------------------*/ + +/** + * Writes an unsigned 16-bit value to a little endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL. Alignment doesn't matter. + @param value [in] host-endian unsigned 16-bit value + @returns a pointer to the location two bytes after dst + @remarks does no validation of the inputs +*/ +posh_u16_t * +POSH_WriteU16ToLittle( void *dst, posh_u16_t value ) +{ + posh_u16_t *p16 = ( posh_u16_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + + p[ 0 ] = value & 0xFF; + p[ 1 ] = ( value & 0xFF00) >> 8; + + return p16 + 1; +} + +/** + * Writes a signed 16-bit value to a little endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 16-bit value + @returns a pointer to the location two bytes after dst + @remarks does no validation of the inputs. This simply calls + POSH_WriteU16ToLittle() with appropriate casting. +*/ +posh_i16_t * +POSH_WriteI16ToLittle( void *dst, posh_i16_t value ) +{ + return ( posh_i16_t * ) POSH_WriteU16ToLittle( dst, ( posh_u16_t ) value ); +} + +/** + * Writes an unsigned 32-bit value to a little endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 32-bit value + @returns a pointer to the location four bytes after dst + @remarks does no validation of the inputs. +*/ +posh_u32_t * +POSH_WriteU32ToLittle( void *dst, posh_u32_t value ) +{ + posh_u32_t *p32 = ( posh_u32_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + + p[ 0 ] = ( value & 0xFF ); + p[ 1 ] = ( value & 0xFF00 ) >> 8; + p[ 2 ] = ( value & 0xFF0000 ) >> 16; + p[ 3 ] = ( value & 0xFF000000 ) >> 24; + + return p32 + 1; +} + +/** + * Writes a signed 32-bit value to a little endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 32-bit value + @returns a pointer to the location four bytes after dst + @remarks does no validation of the inputs. This simply calls + POSH_WriteU32ToLittle() with appropriate casting. +*/ +posh_i32_t * +POSH_WriteI32ToLittle( void *dst, posh_i32_t value ) +{ + return ( posh_i32_t * ) POSH_WriteU32ToLittle( dst, ( posh_u32_t ) value ); +} + +/** + * Writes an unsigned 16-bit value to a big endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian unsigned 16-bit value + @returns a pointer to the location two bytes after dst + @remarks does no validation of the inputs +*/ +posh_u16_t * +POSH_WriteU16ToBig( void *dst, posh_u16_t value ) +{ + posh_u16_t *p16 = ( posh_u16_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + + p[ 1 ] = ( value & 0xFF ); + p[ 0 ] = ( value & 0xFF00 ) >> 8; + + return p16 + 1; +} + +/** + * Writes a signed 16-bit value to a big endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 16-bit value + @returns a pointer to the location two bytes after dst + @remarks does no validation of the inputs. This simply calls + POSH_WriteU16ToLittle() with appropriate casting. +*/ +posh_i16_t * +POSH_WriteI16ToBig( void *dst, posh_i16_t value ) +{ + return ( posh_i16_t * ) POSH_WriteU16ToBig( dst, ( posh_u16_t ) value ); +} + +/** + * Writes an unsigned 32-bit value to a big endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian unsigned 32-bit value + @returns a pointer to the location four bytes after dst + @remarks does no validation of the inputs. +*/ +posh_u32_t * +POSH_WriteU32ToBig( void *dst, posh_u32_t value ) +{ + posh_u32_t *p32 = ( posh_u32_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + + p[ 3 ] = ( value & 0xFF ); + p[ 2 ] = ( value & 0xFF00 ) >> 8; + p[ 1 ] = ( value & 0xFF0000 ) >> 16; + p[ 0 ] = ( value & 0xFF000000 ) >> 24; + + return p32 + 1; +} + +/** + * Writes a signed 32-bit value to a big endian buffer + + @ingroup MemoryBuffer + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 32-bit value + @returns a pointer to the location four bytes after dst + @remarks does no validation of the inputs. This simply calls + POSH_WriteU32ToBig() with appropriate casting. +*/ +posh_i32_t * +POSH_WriteI32ToBig( void *dst, posh_i32_t value ) +{ + return ( posh_i32_t * ) POSH_WriteU32ToBig( dst, ( posh_u32_t ) value ); +} + +#if defined POSH_64BIT_INTEGER +/** + * Writes an unsigned 64-bit value to a little-endian buffer + + @ingroup SixtyFourBit + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian unsigned 64-bit value + @returns a pointer to the location eight bytes after dst + @remarks does no validation of the inputs. +*/ +posh_u64_t * +POSH_WriteU64ToLittle( void *dst, posh_u64_t value ) +{ + posh_u64_t *p64 = ( posh_u64_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + int i; + + for ( i = 0; i < 8; i++, value >>= 8 ) + { + p[ i ] = ( posh_byte_t ) ( value & 0xFF ); + } + + return p64 + 1; +} + +/** + * Writes a signed 64-bit value to a little-endian buffer + + @ingroup SixtyFourBit + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian unsigned 64-bit value + @returns a pointer to the location eight bytes after dst + @remarks does no validation of the inputs. +*/ +posh_i64_t * +POSH_WriteI64ToLittle( void *dst, posh_i64_t value ) +{ + return ( posh_i64_t * ) POSH_WriteU64ToLittle( dst, ( posh_u64_t ) value ); +} + +/** + * Writes an unsigned 64-bit value to a big-endian buffer + + @ingroup SixtyFourBit + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian unsigned 64-bit value + @returns a pointer to the location eight bytes after dst + @remarks does no validation of the inputs. +*/ +posh_u64_t * +POSH_WriteU64ToBig( void *dst, posh_u64_t value ) +{ + posh_u64_t *p64 = ( posh_u64_t * ) dst; + posh_byte_t *p = ( posh_byte_t * ) dst; + int i; + + for ( i = 0; i < 8; i++, value >>= 8 ) + { + p[ 7-i ] = ( posh_byte_t ) ( value & 0xFF ); + } + + return p64 + 8; +} + +/** + * Writes a signed 64-bit value to a big-endian buffer + + @ingroup SixtyFourBit + @param dst [out] pointer to the destination buffer, may not be NULL + @param value [in] host-endian signed 64-bit value + @returns a pointer to the location eight bytes after dst + @remarks does no validation of the inputs. +*/ +posh_i64_t * +POSH_WriteI64ToBig( void *dst, posh_i64_t value ) +{ + return ( posh_i64_t * ) POSH_WriteU64ToBig( dst, ( posh_u64_t ) value ); +} + +#endif /* POSH_64BIT_INTEGER */ + +/* ---------------------------------------------------------------------------*/ +/* IN-MEMORY DESERIALIZATION */ +/* ---------------------------------------------------------------------------*/ + +/** + * Reads an unsigned 16-bit value from a little-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian unsigned 16-bit value +*/ +posh_u16_t +POSH_ReadU16FromLittle( const void *src ) +{ + posh_u16_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + + v |= p[ 0 ]; + v |= ( ( posh_u16_t ) p[ 1 ] ) << 8; + + return v; +} + +/** + * Reads a signed 16-bit value from a little-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian signed 16-bit value +*/ +posh_i16_t +POSH_ReadI16FromLittle( const void *src ) +{ + return ( posh_i16_t ) POSH_ReadU16FromLittle( src ); +} + +/** + * Reads an unsigned 32-bit value from a little-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian unsigned 32-bit value +*/ +posh_u32_t +POSH_ReadU32FromLittle( const void *src ) +{ + posh_u32_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + + v |= p[ 0 ]; + v |= ( ( posh_u32_t ) p[ 1 ] ) << 8; + v |= ( ( posh_u32_t ) p[ 2 ] ) << 16; + v |= ( ( posh_u32_t ) p[ 3 ] ) << 24; + + return v; +} + +/** + * Reads a signed 32-bit value from a little-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian signed 32-bit value +*/ +posh_i32_t +POSH_ReadI32FromLittle( const void *src ) +{ + return ( posh_i32_t ) POSH_ReadU32FromLittle( src ); +} + + +/** + * Reads an unsigned 16-bit value from a big-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian unsigned 16-bit value +*/ +posh_u16_t +POSH_ReadU16FromBig( const void *src ) +{ + posh_u16_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + + v |= p[ 1 ]; + v |= ( ( posh_u16_t ) p[ 0 ] ) << 8; + + return v; +} + +/** + * Reads a signed 16-bit value from a big-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian signed 16-bit value +*/ +posh_i16_t +POSH_ReadI16FromBig( const void *src ) +{ + return ( posh_i16_t ) POSH_ReadU16FromBig( src ); +} + +/** + * Reads an unsigned 32-bit value from a big-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian unsigned 32-bit value +*/ +posh_u32_t +POSH_ReadU32FromBig( const void *src ) +{ + posh_u32_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + + v |= p[ 3 ]; + v |= ( ( posh_u32_t ) p[ 2 ] ) << 8; + v |= ( ( posh_u32_t ) p[ 1 ] ) << 16; + v |= ( ( posh_u32_t ) p[ 0 ] ) << 24; + + return v; +} + +/** + * Reads a signed 32-bit value from a big-endian buffer + @ingroup MemoryBuffer + @param src [in] source buffer + @returns host-endian signed 32-bit value +*/ +posh_i32_t +POSH_ReadI32FromBig( const void *src ) +{ + return POSH_BigI32( (*(const posh_i32_t*)src ) ); +} + +#if defined POSH_64BIT_INTEGER + +/** + * Reads an unsigned 64-bit value from a little-endian buffer + @param src [in] source buffer + @returns host-endian unsigned 32-bit value +*/ +posh_u64_t +POSH_ReadU64FromLittle( const void *src ) +{ + posh_u64_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + int i; + + for ( i = 0; i < 8; i++ ) + { + v |= ( ( posh_u64_t ) p[ i ] ) << (i*8); + } + + return v; +} + +/** + * Reads a signed 64-bit value from a little-endian buffer + @param src [in] source buffer + @returns host-endian signed 32-bit value +*/ +posh_i64_t +POSH_ReadI64FromLittle( const void *src ) +{ + return ( posh_i64_t ) POSH_ReadU64FromLittle( src ); +} + +/** + * Reads an unsigned 64-bit value from a big-endian buffer + @param src [in] source buffer + @returns host-endian unsigned 32-bit value +*/ +posh_u64_t +POSH_ReadU64FromBig( const void *src ) +{ + posh_u64_t v = 0; + posh_byte_t *p = ( posh_byte_t * ) src; + int i; + + for ( i = 0; i < 8; i++ ) + { + v |= ( ( posh_u64_t ) p[ 7-i ] ) << (i*8); + } + + return v; +} + +/** + * Reads an signed 64-bit value from a big-endian buffer + @param src [in] source buffer + @returns host-endian signed 32-bit value +*/ +posh_i64_t +POSH_ReadI64FromBig( const void *src ) +{ + return ( posh_i64_t ) POSH_ReadU64FromBig( src ); +} + +#endif /* POSH_64BIT_INTEGER */ + +/* ---------------------------------------------------------------------------*/ +/* FLOATING POINT SUPPORT */ +/* ---------------------------------------------------------------------------*/ + +#if !defined POSH_NO_FLOAT + +/** @ingroup FloatingPoint + @param[in] f floating point value + @returns a little-endian bit representation of f + */ +posh_u32_t +POSH_LittleFloatBits( float f ) +{ + union + { + float f32; + posh_u32_t u32; + } u; + + u.f32 = f; + + return POSH_LittleU32( u.u32 ); +} + +/** + * Extracts raw big-endian bits from a 32-bit floating point value + * + @ingroup FloatingPoint + @param f [in] floating point value + @returns a big-endian bit representation of f + */ +posh_u32_t +POSH_BigFloatBits( float f ) +{ + union + { + float f32; + posh_u32_t u32; + } u; + + u.f32 = f; + + return POSH_BigU32( u.u32 ); +} + +/** + * Extracts raw, little-endian bit representation from a 64-bit double. + * + @param d [in] 64-bit double precision value + @param dst [out] 8-byte storage buffer + @ingroup FloatingPoint + @returns the raw bits used to represent the value 'd', in the form dst[0]=LSB + */ +void +POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] ) +{ + union + { + double d64; + posh_byte_t bytes[ 8 ]; + } u; + + u.d64 = d; + +#if defined POSH_LITTLE_ENDIAN + dst[ 0 ] = u.bytes[ 0 ]; + dst[ 1 ] = u.bytes[ 1 ]; + dst[ 2 ] = u.bytes[ 2 ]; + dst[ 3 ] = u.bytes[ 3 ]; + dst[ 4 ] = u.bytes[ 4 ]; + dst[ 5 ] = u.bytes[ 5 ]; + dst[ 6 ] = u.bytes[ 6 ]; + dst[ 7 ] = u.bytes[ 7 ]; +#else + dst[ 0 ] = u.bytes[ 7 ]; + dst[ 1 ] = u.bytes[ 6 ]; + dst[ 2 ] = u.bytes[ 5 ]; + dst[ 3 ] = u.bytes[ 4 ]; + dst[ 4 ] = u.bytes[ 3 ]; + dst[ 5 ] = u.bytes[ 2 ]; + dst[ 6 ] = u.bytes[ 1 ]; + dst[ 7 ] = u.bytes[ 0 ]; +#endif +} + +/** + * Creates a double-precision, 64-bit floating point value from a set of raw, + * little-endian bits + + @ingroup FloatingPoint + @param src [in] little-endian byte representation of 64-bit double precision + floating point value + @returns double precision floating point representation of the raw bits + @remarks No error checking is performed, so there are no guarantees that the + result is a valid number, nor is there any check to ensure that src is + non-NULL. BE CAREFUL USING THIS. + */ +double +POSH_DoubleFromBits( const posh_byte_t src[ 8 ] ) +{ + union + { + double d64; + posh_byte_t bytes[ 8 ]; + } u; + +#if defined POSH_LITTLE_ENDIAN + u.bytes[ 0 ] = src[ 0 ]; + u.bytes[ 1 ] = src[ 1 ]; + u.bytes[ 2 ] = src[ 2 ]; + u.bytes[ 3 ] = src[ 3 ]; + u.bytes[ 4 ] = src[ 4 ]; + u.bytes[ 5 ] = src[ 5 ]; + u.bytes[ 6 ] = src[ 6 ]; + u.bytes[ 7 ] = src[ 7 ]; +#else + u.bytes[ 0 ] = src[ 7 ]; + u.bytes[ 1 ] = src[ 6 ]; + u.bytes[ 2 ] = src[ 5 ]; + u.bytes[ 3 ] = src[ 4 ]; + u.bytes[ 4 ] = src[ 3 ]; + u.bytes[ 5 ] = src[ 2 ]; + u.bytes[ 6 ] = src[ 1 ]; + u.bytes[ 7 ] = src[ 0 ]; +#endif + + return u.d64; +} + +/** + * Creates a floating point number from little endian bits + * + @ingroup FloatingPoint + @param bits [in] raw floating point bits in little-endian form + @returns a floating point number based on the given bit representation + @remarks No error checking is performed, so there are no guarantees that the + result is a valid number. BE CAREFUL USING THIS. + */ +float +POSH_FloatFromLittleBits( posh_u32_t bits ) +{ + union + { + float f32; + posh_u32_t u32; + } u; + + u.u32 = bits; +#if defined POSH_BIG_ENDIAN + u.u32 = POSH_SwapU32( u.u32 ); +#endif + + return u.f32; +} + +/** + * Creates a floating point number from big-endian bits + * + @ingroup FloatingPoint + @param bits [in] raw floating point bits in big-endian form + @returns a floating point number based on the given bit representation + @remarks No error checking is performed, so there are no guarantees that the + result is a valid number. BE CAREFUL USING THIS. + */ +float +POSH_FloatFromBigBits( posh_u32_t bits ) +{ + union + { + float f32; + posh_u32_t u32; + } u; + + u.u32 = bits; +#if defined POSH_LITTLE_ENDIAN + u.u32 = POSH_SwapU32( u.u32 ); +#endif + + return u.f32; +} + +#endif /* !defined POSH_NO_FLOAT */ diff --git a/externals/NVTT/src/nvcore/poshlib/posh.h b/externals/NVTT/src/nvcore/poshlib/posh.h new file mode 100644 index 00000000..3a7c3819 --- /dev/null +++ b/externals/NVTT/src/nvcore/poshlib/posh.h @@ -0,0 +1,1007 @@ +/** +@file posh.h +@author Brian Hook +@version 1.3.001 + +Header file for POSH, the Portable Open Source Harness project. + +NOTE: Unlike most header files, this one is designed to be included +multiple times, which is why it does not have the @#ifndef/@#define +preamble. + +POSH relies on environment specified preprocessor symbols in order +to infer as much as possible about the target OS/architecture and +the host compiler capabilities. + +NOTE: POSH is simple and focused. It attempts to provide basic +functionality and information, but it does NOT attempt to emulate +missing functionality. I am also not willing to make POSH dirty +and hackish to support truly ancient and/or outmoded and/or bizarre +technologies such as non-ANSI compilers, systems with non-IEEE +floating point formats, segmented 16-bit operating systems, etc. + +Please refer to the accompanying HTML documentation or visit +http://www.poshlib.org for more information on how to use POSH. + +LICENSE: + +Copyright (c) 2004, Brian Hook +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of this package'ss contributors contributors may not + be used to endorse or promote products derived from this + software without specific prior written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REVISION: + +I've been lax about revision histories, so this starts at, um, 1.3.001. +Sorry for any inconveniences. + +1.3.001 - 2/23/2006 - Incorporated fix for bug reported by Bill Cary, + where I was not detecting Visual Studio + compilation on x86-64 systems. Added check for + _M_X64 which should fix that. + +*/ +/* +I have yet to find an authoritative reference on preprocessor +symbols, but so far this is what I've gleaned: + +GNU GCC/G++: + - __GNUC__: GNU C version + - __GNUG__: GNU C++ compiler + - __sun__ : on Sun platforms + - __svr4__: on Solaris and other SysV R4 platforms + - __mips__: on MIPS processor platforms + - __sparc_v9__: on Sparc 64-bit CPUs + - __sparcv9: 64-bit Solaris + - __MIPSEL__: mips processor, compiled for little endian + - __MIPSEB__: mips processor, compiled for big endian + - _R5900: MIPS/Sony/Toshiba R5900 (PS2) + - mc68000: 68K + - m68000: 68K + - m68k: 68K + - __palmos__: PalmOS + +Intel C/C++ Compiler: + - __ECC : compiler version, IA64 only + - __EDG__ + - __ELF__ + - __GXX_ABI_VERSION + - __i386 : IA-32 only + - __i386__ : IA-32 only + - i386 : IA-32 only + - __ia64 : IA-64 only + - __ia64__ : IA-64 only + - ia64 : IA-64 only + - __ICC : IA-32 only + - __INTEL_COMPILER : IA-32 or IA-64, newer versions only + +Apple's C/C++ Compiler for OS X: + - __APPLE_CC__ + - __APPLE__ + - __BIG_ENDIAN__ + - __APPLE__ + - __ppc__ + - __MACH__ + +DJGPP: + - __MSDOS__ + - __unix__ + - __unix + - __GNUC__ + - __GO32 + - DJGPP + - __i386, __i386, i386 + +Cray's C compiler: + - _ADDR64: if 64-bit pointers + - _UNICOS: + - __unix: + +SGI's CC compiler predefines the following (and more) with -ansi: + - __sgi + - __unix + - __host_mips + - _SYSTYPE_SVR4 + - __mips + - _MIPSEB + - anyone know if there is a predefined symbol for the compiler?! + +MinGW: + - as GnuC but also defines _WIN32, __WIN32, WIN32, _X86_, __i386, __i386__, and several others + - __MINGW32__ + +Cygwin: + - as Gnu C, but also + - __unix__ + - __CYGWIN32__ + +Microsoft Visual Studio predefines the following: + - _MSC_VER + - _WIN32: on Win32 + - _M_IX6 (on x86 systems) + - _M_X64: on x86-64 systems + - _M_ALPHA (on DEC AXP systems) + - _SH3: WinCE, Hitachi SH-3 + - _MIPS: WinCE, MIPS + - _ARM: WinCE, ARM + +Sun's C Compiler: + - sun and _sun + - unix and _unix + - sparc and _sparc (SPARC systems only) + - i386 and _i386 (x86 systems only) + - __SVR4 (Solaris only) + - __sparcv9: 64-bit solaris + - __SUNPRO_C + - _LP64: defined in 64-bit LP64 mode, but only if is included + +Borland C/C++ predefines the following: + - __BORLANDC__: + +DEC/Compaq C/C++ on Alpha: + - __alpha + - __arch64__ + - __unix__ (on Tru64 Unix) + - __osf__ + - __DECC + - __DECCXX (C++ compilation) + - __DECC_VER + - __DECCXX_VER + +IBM's AIX compiler: + - __64BIT__ if 64-bit mode + - _AIX + - __IBMC__: C compiler version + - __IBMCPP__: C++ compiler version + - _LONG_LONG: compiler allows long long + +Watcom: + - __WATCOMC__ + - __DOS__ : if targeting DOS + - __386__ : if 32-bit support + - __WIN32__ : if targetin 32-bit Windows + +HP-UX C/C++ Compiler: + - __hpux + - __unix + - __hppa (on PA-RISC) + - __LP64__: if compiled in 64-bit mode + +Metrowerks: + - __MWERKS__ + - __powerpc__ + - _powerc + - __MC68K__ + - macintosh when compiling for MacOS + - __INTEL__ for x86 targets + - __POWERPC__ + +*/ + +/* +** ---------------------------------------------------------------------------- +** Include optionally +** ---------------------------------------------------------------------------- +*/ +#ifdef POSH_USE_LIMITS_H +# include +#endif + +/* +** ---------------------------------------------------------------------------- +** Determine compilation environment +** ---------------------------------------------------------------------------- +*/ +#if defined __ECC || defined __ICC || defined __INTEL_COMPILER +# define POSH_COMPILER_STRING "Intel C/C++" +# define POSH_COMPILER_INTEL 1 +#endif + +#if ( defined __host_mips || defined __sgi ) && !defined __GNUC__ +# define POSH_COMPILER_STRING "MIPSpro C/C++" +# define POSH_COMPILER_MIPSPRO 1 +#endif + +#if defined __hpux && !defined __GNUC__ +# define POSH_COMPILER_STRING "HP-UX CC" +# define POSH_COMPILER_HPCC 1 +#endif + +#if defined __GNUC__ +# define POSH_COMPILER_STRING "Gnu GCC" +# define POSH_COMPILER_GCC 1 +#endif + +#if defined __APPLE_CC__ + /* we don't define the compiler string here, let it be GNU */ +# define POSH_COMPILER_APPLECC 1 +#endif + +#if defined __IBMC__ || defined __IBMCPP__ +# define POSH_COMPILER_STRING "IBM C/C++" +# define POSH_COMPILER_IBM 1 +#endif + +#if defined _MSC_VER +# define POSH_COMPILER_STRING "Microsoft Visual C++" +# define POSH_COMPILER_MSVC 1 +#endif + +#if defined __SUNPRO_C +# define POSH_COMPILER_STRING "Sun Pro" +# define POSH_COMPILER_SUN 1 +#endif + +#if defined __BORLANDC__ +# define POSH_COMPILER_STRING "Borland C/C++" +# define POSH_COMPILER_BORLAND 1 +#endif + +#if defined __MWERKS__ +# define POSH_COMPILER_STRING "MetroWerks CodeWarrior" +# define POSH_COMPILER_METROWERKS 1 +#endif + +#if defined __DECC || defined __DECCXX +# define POSH_COMPILER_STRING "Compaq/DEC C/C++" +# define POSH_COMPILER_DEC 1 +#endif + +#if defined __WATCOMC__ +# define POSH_COMPILER_STRING "Watcom C/C++" +# define POSH_COMPILER_WATCOM 1 +#endif + +#if !defined POSH_COMPILER_STRING +# define POSH_COMPILER_STRING "Unknown compiler" +#endif + +/* +** ---------------------------------------------------------------------------- +** Determine target operating system +** ---------------------------------------------------------------------------- +*/ +#if defined linux || defined __linux__ +# define POSH_OS_LINUX 1 +# define POSH_OS_STRING "Linux" +#endif + +#if defined __CYGWIN32__ +# define POSH_OS_CYGWIN32 1 +# define POSH_OS_STRING "Cygwin" +#endif + +#if defined GEKKO +# define POSH_OS_GAMECUBE +# define __powerpc__ +# define POSH_OS_STRING "GameCube" +#endif + +#if defined __MINGW32__ +# define POSH_OS_MINGW 1 +# define POSH_OS_STRING "MinGW" +#endif + +#if defined GO32 && defined DJGPP && defined __MSDOS__ +# define POSH_OS_GO32 1 +# define POSH_OS_STRING "GO32/MS-DOS" +#endif + +/* NOTE: make sure you use /bt=DOS if compiling for 32-bit DOS, + otherwise Watcom assumes host=target */ +#if defined __WATCOMC__ && defined __386__ && defined __DOS__ +# define POSH_OS_DOS32 1 +# define POSH_OS_STRING "DOS/32-bit" +#endif + +#if defined _UNICOS +# define POSH_OS_UNICOS 1 +# define POSH_OS_STRING "UNICOS" +#endif + +#if ( defined __MWERKS__ && defined __powerc && !defined macintosh ) || defined __APPLE_CC__ || defined macosx +# define POSH_OS_OSX 1 +# define POSH_OS_STRING "MacOS X" +#endif + +#if defined __sun__ || defined sun || defined __sun || defined __solaris__ +# if defined __SVR4 || defined __svr4__ || defined __solaris__ +# define POSH_OS_STRING "Solaris" +# define POSH_OS_SOLARIS 1 +# endif +# if !defined POSH_OS_STRING +# define POSH_OS_STRING "SunOS" +# define POSH_OS_SUNOS 1 +# endif +#endif + +#if defined __sgi__ || defined sgi || defined __sgi +# define POSH_OS_IRIX 1 +# define POSH_OS_STRING "Irix" +#endif + +#if defined __hpux__ || defined __hpux +# define POSH_OS_HPUX 1 +# define POSH_OS_STRING "HP-UX" +#endif + +#if defined _AIX +# define POSH_OS_AIX 1 +# define POSH_OS_STRING "AIX" +#endif + +#if ( defined __alpha && defined __osf__ ) +# define POSH_OS_TRU64 1 +# define POSH_OS_STRING "Tru64" +#endif + +#if defined __BEOS__ || defined __beos__ +# define POSH_OS_BEOS 1 +# define POSH_OS_STRING "BeOS" +#endif + +#if defined amiga || defined amigados || defined AMIGA || defined _AMIGA +# define POSH_OS_AMIGA 1 +# define POSH_OS_STRING "Amiga" +#endif + +#if defined __unix__ +# define POSH_OS_UNIX 1 +# if !defined POSH_OS_STRING +# define POSH_OS_STRING "Unix-like(generic)" +# endif +#endif + +#if defined _WIN32_WCE +# define POSH_OS_WINCE 1 +# define POSH_OS_STRING "Windows CE" +#endif + +#if defined _XBOX +# define POSH_OS_XBOX 1 +# define POSH_OS_STRING "XBOX" +#endif + +#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ +# define POSH_OS_WIN32 1 +# if !defined POSH_OS_XBOX +# if defined _WIN64 +# define POSH_OS_WIN64 1 +# define POSH_OS_STRING "Win64" +# else +# if !defined POSH_OS_STRING +# define POSH_OS_STRING "Win32" +# endif +# endif +# endif +#endif + +#if defined __palmos__ +# define POSH_OS_PALM 1 +# define POSH_OS_STRING "PalmOS" +#endif + +#if defined THINK_C || defined macintosh +# define POSH_OS_MACOS 1 +# define POSH_OS_STRING "MacOS" +#endif + +/* +** ----------------------------------------------------------------------------- +** Determine target CPU +** ----------------------------------------------------------------------------- +*/ + +#if defined GEKKO +# define POSH_CPU_PPC750 1 +# define POSH_CPU_STRING "IBM PowerPC 750 (NGC)" +#endif + +#if defined mc68000 || defined m68k || defined __MC68K__ || defined m68000 +# define POSH_CPU_68K 1 +# define POSH_CPU_STRING "MC68000" +#endif + +#if defined __PPC__ || defined __POWERPC__ || defined powerpc || defined _POWER || defined __ppc__ || defined __powerpc__ +# define POSH_CPU_PPC 1 +# if !defined POSH_CPU_STRING +# if defined __powerpc64__ +# define POSH_CPU_STRING "PowerPC64" +# else +# define POSH_CPU_STRING "PowerPC" +# endif +# endif +#endif + +#if defined _CRAYT3E || defined _CRAYMPP +# define POSH_CPU_CRAYT3E 1 /* target processor is a DEC Alpha 21164 used in a Cray T3E*/ +# define POSH_CPU_STRING "Cray T3E (Alpha 21164)" +#endif + +#if defined CRAY || defined _CRAY && !defined _CRAYT3E +# error Non-AXP Cray systems not supported +#endif + +#if defined _SH3 +# define POSH_CPU_SH3 1 +# define POSH_CPU_STRING "Hitachi SH-3" +#endif + +#if defined __sh4__ || defined __SH4__ +# define POSH_CPU_SH3 1 +# define POSH_CPU_SH4 1 +# define POSH_CPU_STRING "Hitachi SH-4" +#endif + +#if defined __sparc__ || defined __sparc +# if defined __arch64__ || defined __sparcv9 || defined __sparc_v9__ +# define POSH_CPU_SPARC64 1 +# define POSH_CPU_STRING "Sparc/64" +# else +# define POSH_CPU_STRING "Sparc/32" +# endif +# define POSH_CPU_SPARC 1 +#endif + +#if defined ARM || defined __arm__ || defined _ARM +# define POSH_CPU_STRONGARM 1 +# define POSH_CPU_STRING "ARM" +#endif + +#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS +# define POSH_CPU_MIPS 1 +# if defined _R5900 +# define POSH_CPU_STRING "MIPS R5900 (PS2)" +# else +# define POSH_CPU_STRING "MIPS" +# endif +#endif + +#if defined __ia64 || defined _M_IA64 || defined __ia64__ +# define POSH_CPU_IA64 1 +# define POSH_CPU_STRING "IA64" +#endif + +#if defined __X86__ || defined __i386__ || defined i386 || defined _M_IX86 || defined __386__ || defined __x86_64__ || defined _M_X64 +# define POSH_CPU_X86 1 +# if defined __x86_64__ || defined _M_X64 +# define POSH_CPU_X86_64 1 +# endif +# if defined POSH_CPU_X86_64 +# define POSH_CPU_STRING "AMD x86-64" +# else +# define POSH_CPU_STRING "Intel 386+" +# endif +#endif + +#if defined __alpha || defined alpha || defined _M_ALPHA || defined __alpha__ +# define POSH_CPU_AXP 1 +# define POSH_CPU_STRING "AXP" +#endif + +#if defined __hppa || defined hppa +# define POSH_CPU_HPPA 1 +# define POSH_CPU_STRING "PA-RISC" +#endif + +#if !defined POSH_CPU_STRING +# error POSH cannot determine target CPU +# define POSH_CPU_STRING "Unknown" /* this is here for Doxygen's benefit */ +#endif + +/* +** ----------------------------------------------------------------------------- +** Attempt to autodetect building for embedded on Sony PS2 +** ----------------------------------------------------------------------------- +*/ +#if !defined POSH_OS_STRING +# if !defined FORCE_DOXYGEN +# define POSH_OS_EMBEDDED 1 +# endif +# if defined _R5900 +# define POSH_OS_STRING "Sony PS2(embedded)" +# else +# define POSH_OS_STRING "Embedded/Unknown" +# endif +#endif + +/* +** --------------------------------------------------------------------------- +** Handle cdecl, stdcall, fastcall, etc. +** --------------------------------------------------------------------------- +*/ +#if defined POSH_CPU_X86 && !defined POSH_CPU_X86_64 +# if defined __GNUC__ +# define POSH_CDECL __attribute__((cdecl)) +# define POSH_STDCALL __attribute__((stdcall)) +# define POSH_FASTCALL __attribute__((fastcall)) +# elif ( defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ || defined __MWERKS__ ) +# define POSH_CDECL __cdecl +# define POSH_STDCALL __stdcall +# define POSH_FASTCALL __fastcall +# endif +#else +# define POSH_CDECL +# define POSH_STDCALL +# define POSH_FASTCALL +#endif + +/* +** --------------------------------------------------------------------------- +** Define POSH_IMPORTEXPORT signature based on POSH_DLL and POSH_BUILDING_LIB +** --------------------------------------------------------------------------- +*/ + +/* +** We undefine this so that multiple inclusions will work +*/ +#if defined POSH_IMPORTEXPORT +# undef POSH_IMPORTEXPORT +#endif + +#if defined POSH_DLL +# if defined POSH_OS_WIN32 +# if defined _MSC_VER +# if ( _MSC_VER >= 800 ) +# if defined POSH_BUILDING_LIB +# define POSH_IMPORTEXPORT __declspec( dllexport ) +# else +# define POSH_IMPORTEXPORT __declspec( dllimport ) +# endif +# else +# if defined POSH_BUILDING_LIB +# define POSH_IMPORTEXPORT __export +# else +# define POSH_IMPORTEXPORT +# endif +# endif +# endif /* defined _MSC_VER */ +# if defined __BORLANDC__ +# if ( __BORLANDC__ >= 0x500 ) +# if defined POSH_BUILDING_LIB +# define POSH_IMPORTEXPORT __declspec( dllexport ) +# else +# define POSH_IMPORTEXPORT __declspec( dllimport ) +# endif +# else +# if defined POSH_BUILDING_LIB +# define POSH_IMPORTEXPORT __export +# else +# define POSH_IMPORTEXPORT +# endif +# endif +# endif /* defined __BORLANDC__ */ + /* for all other compilers, we're just making a blanket assumption */ +# if defined __GNUC__ || defined __WATCOMC__ || defined __MWERKS__ +# if defined POSH_BUILDING_LIB +# define POSH_IMPORTEXPORT __declspec( dllexport ) +# else +# define POSH_IMPORTEXPORT __declspec( dllimport ) +# endif +# endif /* all other compilers */ +# if !defined POSH_IMPORTEXPORT +# error Building DLLs not supported on this compiler (poshlib@poshlib.org if you know how) +# endif +# endif /* defined POSH_OS_WIN32 */ +#endif + +/* On pretty much everything else, we can thankfully just ignore this */ +#if !defined POSH_IMPORTEXPORT +# define POSH_IMPORTEXPORT +#endif + +#if defined FORCE_DOXYGEN +# define POSH_DLL +# define POSH_BUILDING_LIB +# undef POSH_DLL +# undef POSH_BUILDING_LIB +#endif + +/* +** ---------------------------------------------------------------------------- +** (Re)define POSH_PUBLIC_API export signature +** ---------------------------------------------------------------------------- +*/ +#ifdef POSH_PUBLIC_API +# undef POSH_PUBLIC_API +#endif + +#if ( ( defined _MSC_VER ) && ( _MSC_VER < 800 ) ) || ( defined __BORLANDC__ && ( __BORLANDC__ < 0x500 ) ) +# define POSH_PUBLIC_API(rtype) extern rtype POSH_IMPORTEXPORT +#else +# define POSH_PUBLIC_API(rtype) extern POSH_IMPORTEXPORT rtype +#endif + +/* +** ---------------------------------------------------------------------------- +** Try to infer endianess. Basically we just go through the CPUs we know are +** little endian, and assume anything that isn't one of those is big endian. +** As a sanity check, we also do this with operating systems we know are +** little endian, such as Windows. Some processors are bi-endian, such as +** the MIPS series, so we have to be careful about those. +** ---------------------------------------------------------------------------- +*/ +#if defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__ +# define POSH_ENDIAN_STRING "little" +# define POSH_LITTLE_ENDIAN 1 +#else +# define POSH_ENDIAN_STRING "big" +# define POSH_BIG_ENDIAN 1 +#endif + +#if defined FORCE_DOXYGEN +# define POSH_LITTLE_ENDIAN +#endif + +/* +** ---------------------------------------------------------------------------- +** Cross-platform compile time assertion macro +** ---------------------------------------------------------------------------- +*/ +#define POSH_COMPILE_TIME_ASSERT(name, x) typedef int _POSH_dummy_ ## name[(x) ? 1 : -1 ] + +/* +** ---------------------------------------------------------------------------- +** 64-bit Integer +** +** We don't require 64-bit support, nor do we emulate its functionality, we +** simply export it if it's available. Since we can't count on +** for 64-bit support, we ignore the POSH_USE_LIMITS_H directive. +** ---------------------------------------------------------------------------- +*/ +#if defined ( __LP64__ ) || defined ( __powerpc64__ ) || defined POSH_CPU_SPARC64 +# define POSH_64BIT_INTEGER 1 +typedef long posh_i64_t; +typedef unsigned long posh_u64_t; +# define POSH_I64( x ) ((posh_i64_t)x) +# define POSH_U64( x ) ((posh_u64_t)x) +# define POSH_I64_PRINTF_PREFIX "l" +#elif defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__ || ( defined __alpha && defined __DECC ) +# define POSH_64BIT_INTEGER 1 +typedef __int64 posh_i64_t; +typedef unsigned __int64 posh_u64_t; +# define POSH_I64( x ) ((posh_i64_t)x) +# define POSH_U64( x ) ((posh_u64_t)x) +# define POSH_I64_PRINTF_PREFIX "I64" +#elif defined __GNUC__ || defined __MWERKS__ || defined __SUNPRO_C || defined __SUNPRO_CC || defined __APPLE_CC__ || defined POSH_OS_IRIX || defined _LONG_LONG || defined _CRAYC +# define POSH_64BIT_INTEGER 1 +typedef long long posh_i64_t; +typedef unsigned long long posh_u64_t; +# define POSH_U64( x ) ((posh_u64_t)(x##LL)) +# define POSH_I64( x ) ((posh_i64_t)(x##LL)) +# define POSH_I64_PRINTF_PREFIX "ll" +#endif + +/* hack */ +/*#ifdef __MINGW32__ +#undef POSH_I64 +#undef POSH_U64 +#undef POSH_I64_PRINTF_PREFIX +#define POSH_I64( x ) ((posh_i64_t)x) +#define POSH_U64( x ) ((posh_u64_t)x) +#define POSH_I64_PRINTF_PREFIX "I64" +#endif*/ + +#ifdef FORCE_DOXYGEN +typedef long long posh_i64_t; +typedef unsigned long posh_u64_t; +# define POSH_64BIT_INTEGER +# define POSH_I64_PRINTF_PREFIX +# define POSH_I64(x) +# define POSH_U64(x) +#endif + +/** Minimum value for a 64-bit signed integer */ +#define POSH_I64_MIN POSH_I64(0x8000000000000000) +/** Maximum value for a 64-bit signed integer */ +#define POSH_I64_MAX POSH_I64(0x7FFFFFFFFFFFFFFF) +/** Minimum value for a 64-bit unsigned integer */ +#define POSH_U64_MIN POSH_U64(0) +/** Maximum value for a 64-bit unsigned integer */ +#define POSH_U64_MAX POSH_U64(0xFFFFFFFFFFFFFFFF) + +/* ---------------------------------------------------------------------------- +** Basic Sized Types +** +** These types are expected to be EXACTLY sized so you can use them for +** serialization. +** ---------------------------------------------------------------------------- +*/ +#define POSH_FALSE 0 +#define POSH_TRUE 1 + +typedef int posh_bool_t; +typedef unsigned char posh_byte_t; + +/* NOTE: These assume that CHAR_BIT is 8!! */ +typedef unsigned char posh_u8_t; +typedef signed char posh_i8_t; + +#if defined POSH_USE_LIMITS_H +# if CHAR_BITS > 8 +# error This machine uses 9-bit characters. This is a warning, you can comment this out now. +# endif /* CHAR_BITS > 8 */ + +/* 16-bit */ +# if ( USHRT_MAX == 65535 ) + typedef unsigned short posh_u16_t; + typedef short posh_i16_t; +# else + /* Yes, in theory there could still be a 16-bit character type and shorts are + 32-bits in size...if you find such an architecture, let me know =P */ +# error No 16-bit type found +# endif + +/* 32-bit */ +# if ( INT_MAX == 2147483647 ) + typedef unsigned posh_u32_t; + typedef int posh_i32_t; +# elif ( LONG_MAX == 2147483647 ) + typedef unsigned long posh_u32_t; + typedef long posh_i32_t; +# else + error No 32-bit type found +# endif + +#else /* POSH_USE_LIMITS_H */ + + typedef unsigned short posh_u16_t; + typedef short posh_i16_t; + +# if !defined POSH_OS_PALM + typedef unsigned posh_u32_t; + typedef int posh_i32_t; +# else + typedef unsigned long posh_u32_t; + typedef long posh_i32_t; +# endif +#endif + +/** Minimum value for a byte */ +#define POSH_BYTE_MIN 0 +/** Maximum value for an 8-bit unsigned value */ +#define POSH_BYTE_MAX 255 +/** Minimum value for a byte */ +#define POSH_I16_MIN ( ( posh_i16_t ) 0x8000 ) +/** Maximum value for a 16-bit signed value */ +#define POSH_I16_MAX ( ( posh_i16_t ) 0x7FFF ) +/** Minimum value for a 16-bit unsigned value */ +#define POSH_U16_MIN 0 +/** Maximum value for a 16-bit unsigned value */ +#define POSH_U16_MAX ( ( posh_u16_t ) 0xFFFF ) +/** Minimum value for a 32-bit signed value */ +#define POSH_I32_MIN ( ( posh_i32_t ) 0x80000000 ) +/** Maximum value for a 32-bit signed value */ +#define POSH_I32_MAX ( ( posh_i32_t ) 0x7FFFFFFF ) +/** Minimum value for a 32-bit unsigned value */ +#define POSH_U32_MIN 0 +/** Maximum value for a 32-bit unsigned value */ +#define POSH_U32_MAX ( ( posh_u32_t ) 0xFFFFFFFF ) + +/* +** ---------------------------------------------------------------------------- +** Sanity checks on expected sizes +** ---------------------------------------------------------------------------- +*/ +#if !defined FORCE_DOXYGEN + +POSH_COMPILE_TIME_ASSERT(posh_byte_t, sizeof(posh_byte_t) == 1); +POSH_COMPILE_TIME_ASSERT(posh_u8_t, sizeof(posh_u8_t) == 1); +POSH_COMPILE_TIME_ASSERT(posh_i8_t, sizeof(posh_i8_t) == 1); +POSH_COMPILE_TIME_ASSERT(posh_u16_t, sizeof(posh_u16_t) == 2); +POSH_COMPILE_TIME_ASSERT(posh_i16_t, sizeof(posh_i16_t) == 2); +POSH_COMPILE_TIME_ASSERT(posh_u32_t, sizeof(posh_u32_t) == 4); +POSH_COMPILE_TIME_ASSERT(posh_i32_t, sizeof(posh_i32_t) == 4); + +#if !defined POSH_NO_FLOAT + POSH_COMPILE_TIME_ASSERT(posh_testfloat_t, sizeof(float)==4 ); + POSH_COMPILE_TIME_ASSERT(posh_testdouble_t, sizeof(double)==8); +#endif + +#if defined POSH_64BIT_INTEGER + POSH_COMPILE_TIME_ASSERT(posh_u64_t, sizeof(posh_u64_t) == 8); + POSH_COMPILE_TIME_ASSERT(posh_i64_t, sizeof(posh_i64_t) == 8); +#endif + +#endif + +/* +** ---------------------------------------------------------------------------- +** 64-bit pointer support +** ---------------------------------------------------------------------------- +*/ +#if defined POSH_CPU_AXP && ( defined POSH_OS_TRU64 || defined POSH_OS_LINUX ) +# define POSH_64BIT_POINTER 1 +#endif + +#if defined POSH_CPU_X86_64 && defined POSH_OS_LINUX +# define POSH_64BIT_POINTER 1 +#endif + +#if defined POSH_CPU_SPARC64 || defined POSH_OS_WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64 || defined __LP64__ || defined _ADDR64 || defined _CRAYC +# define POSH_64BIT_POINTER 1 +#endif + +#if defined POSH_64BIT_POINTER + POSH_COMPILE_TIME_ASSERT( posh_64bit_pointer, sizeof( void * ) == 8 ); +#elif !defined FORCE_DOXYGEN +/* if this assertion is hit then you're on a system that either has 64-bit + addressing and we didn't catch it, or you're on a system with 16-bit + pointers. In the latter case, POSH doesn't actually care, we're just + triggering this assertion to make sure you're aware of the situation, + so feel free to delete it. + + If this assertion is triggered on a known 32 or 64-bit platform, + please let us know (poshlib@poshlib.org) */ + POSH_COMPILE_TIME_ASSERT( posh_32bit_pointer, sizeof( void * ) == 4 ); +#endif + +#if defined FORCE_DOXYGEN +# define POSH_64BIT_POINTER +#endif + +/* +** ---------------------------------------------------------------------------- +** POSH Utility Functions +** +** These are optional POSH utility functions that are not required if you don't +** need anything except static checking of your host and target environment. +** +** These functions are NOT wrapped with POSH_PUBLIC_API because I didn't want +** to enforce their export if your own library is only using them internally. +** ---------------------------------------------------------------------------- +*/ +#ifdef __cplusplus +extern "C" { +#endif + +const char *POSH_GetArchString( void ); + +#if !defined POSH_NO_FLOAT + +posh_u32_t POSH_LittleFloatBits( float f ); +posh_u32_t POSH_BigFloatBits( float f ); +float POSH_FloatFromLittleBits( posh_u32_t bits ); +float POSH_FloatFromBigBits( posh_u32_t bits ); + +void POSH_DoubleBits( double d, posh_byte_t dst[ 8 ] ); +double POSH_DoubleFromBits( const posh_byte_t src[ 8 ] ); + +/* unimplemented +float *POSH_WriteFloatToLittle( void *dst, float f ); +float *POSH_WriteFloatToBig( void *dst, float f ); +float POSH_ReadFloatFromLittle( const void *src ); +float POSH_ReadFloatFromBig( const void *src ); + +double *POSH_WriteDoubleToLittle( void *dst, double d ); +double *POSH_WriteDoubleToBig( void *dst, double d ); +double POSH_ReadDoubleFromLittle( const void *src ); +double POSH_ReadDoubleFromBig( const void *src ); +*/ +#endif /* !defined POSH_NO_FLOAT */ + +#if defined FORCE_DOXYGEN +# define POSH_NO_FLOAT +# undef POSH_NO_FLOAT +#endif + +extern posh_u16_t POSH_SwapU16( posh_u16_t u ); +extern posh_i16_t POSH_SwapI16( posh_i16_t u ); +extern posh_u32_t POSH_SwapU32( posh_u32_t u ); +extern posh_i32_t POSH_SwapI32( posh_i32_t u ); + +#if defined POSH_64BIT_INTEGER + +extern posh_u64_t POSH_SwapU64( posh_u64_t u ); +extern posh_i64_t POSH_SwapI64( posh_i64_t u ); + +#endif /*POSH_64BIT_INTEGER */ + +extern posh_u16_t *POSH_WriteU16ToLittle( void *dst, posh_u16_t value ); +extern posh_i16_t *POSH_WriteI16ToLittle( void *dst, posh_i16_t value ); +extern posh_u32_t *POSH_WriteU32ToLittle( void *dst, posh_u32_t value ); +extern posh_i32_t *POSH_WriteI32ToLittle( void *dst, posh_i32_t value ); + +extern posh_u16_t *POSH_WriteU16ToBig( void *dst, posh_u16_t value ); +extern posh_i16_t *POSH_WriteI16ToBig( void *dst, posh_i16_t value ); +extern posh_u32_t *POSH_WriteU32ToBig( void *dst, posh_u32_t value ); +extern posh_i32_t *POSH_WriteI32ToBig( void *dst, posh_i32_t value ); + +extern posh_u16_t POSH_ReadU16FromLittle( const void *src ); +extern posh_i16_t POSH_ReadI16FromLittle( const void *src ); +extern posh_u32_t POSH_ReadU32FromLittle( const void *src ); +extern posh_i32_t POSH_ReadI32FromLittle( const void *src ); + +extern posh_u16_t POSH_ReadU16FromBig( const void *src ); +extern posh_i16_t POSH_ReadI16FromBig( const void *src ); +extern posh_u32_t POSH_ReadU32FromBig( const void *src ); +extern posh_i32_t POSH_ReadI32FromBig( const void *src ); + +#if defined POSH_64BIT_INTEGER +extern posh_u64_t *POSH_WriteU64ToLittle( void *dst, posh_u64_t value ); +extern posh_i64_t *POSH_WriteI64ToLittle( void *dst, posh_i64_t value ); +extern posh_u64_t *POSH_WriteU64ToBig( void *dst, posh_u64_t value ); +extern posh_i64_t *POSH_WriteI64ToBig( void *dst, posh_i64_t value ); + +extern posh_u64_t POSH_ReadU64FromLittle( const void *src ); +extern posh_i64_t POSH_ReadI64FromLittle( const void *src ); +extern posh_u64_t POSH_ReadU64FromBig( const void *src ); +extern posh_i64_t POSH_ReadI64FromBig( const void *src ); +#endif /* POSH_64BIT_INTEGER */ + +#if defined POSH_LITTLE_ENDIAN + +# define POSH_LittleU16(x) (x) +# define POSH_LittleU32(x) (x) +# define POSH_LittleI16(x) (x) +# define POSH_LittleI32(x) (x) +# if defined POSH_64BIT_INTEGER +# define POSH_LittleU64(x) (x) +# define POSH_LittleI64(x) (x) +# endif /* defined POSH_64BIT_INTEGER */ + +# define POSH_BigU16(x) POSH_SwapU16(x) +# define POSH_BigU32(x) POSH_SwapU32(x) +# define POSH_BigI16(x) POSH_SwapI16(x) +# define POSH_BigI32(x) POSH_SwapI32(x) +# if defined POSH_64BIT_INTEGER +# define POSH_BigU64(x) POSH_SwapU64(x) +# define POSH_BigI64(x) POSH_SwapI64(x) +# endif /* defined POSH_64BIT_INTEGER */ + +#else + +# define POSH_BigU16(x) (x) +# define POSH_BigU32(x) (x) +# define POSH_BigI16(x) (x) +# define POSH_BigI32(x) (x) + +# if defined POSH_64BIT_INTEGER +# define POSH_BigU64(x) (x) +# define POSH_BigI64(x) (x) +# endif /* POSH_64BIT_INTEGER */ + +# define POSH_LittleU16(x) POSH_SwapU16(x) +# define POSH_LittleU32(x) POSH_SwapU32(x) +# define POSH_LittleI16(x) POSH_SwapI16(x) +# define POSH_LittleI32(x) POSH_SwapI32(x) + +# if defined POSH_64BIT_INTEGER +# define POSH_LittleU64(x) POSH_SwapU64(x) +# define POSH_LittleI64(x) POSH_SwapI64(x) +# endif /* POSH_64BIT_INTEGER */ + +#endif + +#ifdef __cplusplus +} +#endif + + diff --git a/externals/NVTT/src/nvimage/BlockDXT.cpp b/externals/NVTT/src/nvimage/BlockDXT.cpp new file mode 100644 index 00000000..6e185b50 --- /dev/null +++ b/externals/NVTT/src/nvimage/BlockDXT.cpp @@ -0,0 +1,666 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include "ColorBlock.h" +#include "BlockDXT.h" + +using namespace nv; + + +/*---------------------------------------------------------------------------- + BlockDXT1 +----------------------------------------------------------------------------*/ + +uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const +{ + // Does bit expansion before interpolation. + color_array[0].b = (col0.b << 3) | (col0.b >> 2); + color_array[0].g = (col0.g << 2) | (col0.g >> 4); + color_array[0].r = (col0.r << 3) | (col0.r >> 2); + color_array[0].a = 0xFF; + + // @@ Same as above, but faster? +// Color32 c; +// c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000); +// c.u |= (c.u >> 5) & 0x070007; +// c.u |= (c.u >> 6) & 0x000300; +// color_array[0].u = c.u; + + color_array[1].r = (col1.r << 3) | (col1.r >> 2); + color_array[1].g = (col1.g << 2) | (col1.g >> 4); + color_array[1].b = (col1.b << 3) | (col1.b >> 2); + color_array[1].a = 0xFF; + + // @@ Same as above, but faster? +// c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000); +// c.u |= (c.u >> 5) & 0x070007; +// c.u |= (c.u >> 6) & 0x000300; +// color_array[1].u = c.u; + + if( col0.u > col1.u ) { + // Four-color block: derive the other two colors. + color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; + color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; + color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; + color_array[2].a = 0xFF; + + color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3; + color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; + color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; + color_array[3].a = 0xFF; + + return 4; + } + else { + // Three-color block: derive the other color. + color_array[2].r = (color_array[0].r + color_array[1].r) / 2; + color_array[2].g = (color_array[0].g + color_array[1].g) / 2; + color_array[2].b = (color_array[0].b + color_array[1].b) / 2; + color_array[2].a = 0xFF; + + // Set all components to 0 to match DXT specs. + color_array[3].r = 0x00; // color_array[2].r; + color_array[3].g = 0x00; // color_array[2].g; + color_array[3].b = 0x00; // color_array[2].b; + color_array[3].a = 0x00; + + return 3; + } +} + +// Evaluate palette assuming 3 color block. +void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const +{ + color_array[0].b = (col0.b << 3) | (col0.b >> 2); + color_array[0].g = (col0.g << 2) | (col0.g >> 4); + color_array[0].r = (col0.r << 3) | (col0.r >> 2); + color_array[0].a = 0xFF; + + color_array[1].r = (col1.r << 3) | (col1.r >> 2); + color_array[1].g = (col1.g << 2) | (col1.g >> 4); + color_array[1].b = (col1.b << 3) | (col1.b >> 2); + color_array[1].a = 0xFF; + + // Three-color block: derive the other color. + color_array[2].r = (color_array[0].r + color_array[1].r) / 2; + color_array[2].g = (color_array[0].g + color_array[1].g) / 2; + color_array[2].b = (color_array[0].b + color_array[1].b) / 2; + color_array[2].a = 0xFF; + + // Set all components to 0 to match DXT specs. + color_array[3].r = 0x00; // color_array[2].r; + color_array[3].g = 0x00; // color_array[2].g; + color_array[3].b = 0x00; // color_array[2].b; + color_array[3].a = 0x00; +} + +// Evaluate palette assuming 4 color block. +void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const +{ + color_array[0].b = (col0.b << 3) | (col0.b >> 2); + color_array[0].g = (col0.g << 2) | (col0.g >> 4); + color_array[0].r = (col0.r << 3) | (col0.r >> 2); + color_array[0].a = 0xFF; + + color_array[1].r = (col1.r << 3) | (col1.r >> 2); + color_array[1].g = (col1.g << 2) | (col1.g >> 4); + color_array[1].b = (col1.b << 3) | (col1.b >> 2); + color_array[1].a = 0xFF; + + // Four-color block: derive the other two colors. + color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; + color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; + color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; + color_array[2].a = 0xFF; + + color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3; + color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; + color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; + color_array[3].a = 0xFF; +} + + +/* Jason Dorie's code. +// ---------------------------------------------------------------------------- +// Build palette for a 3 color + traparent black block +// ---------------------------------------------------------------------------- +void DXTCGen::BuildCodes3(cbVector *pVects, cbVector &v1, cbVector &v2) +{ + //pVects[0] = v1; + //pVects[2] = v2; + //pVects[1][0] = v1[0]; + //pVects[1][1] = (BYTE)( ((long)v1[1] + (long)v2[1]) / 2 ); + //pVects[1][2] = (BYTE)( ((long)v1[2] + (long)v2[2]) / 2 ); + //pVects[1][3] = (BYTE)( ((long)v1[3] + (long)v2[3]) / 2 ); + + __asm { + mov ecx, dword ptr pVects + mov eax, dword ptr v1 + mov ebx, dword ptr v2 + + movd mm0, [eax] + movd mm1, [ebx] + pxor mm2, mm2 + nop + + movd [ecx], mm0 + movd [ecx+8], mm1 + + punpcklbw mm0, mm2 + punpcklbw mm1, mm2 + + paddw mm0, mm1 + psrlw mm0, 1 + + packuswb mm0, mm0 + movd [ecx+4], mm0 + } + // *(long *)&pVects[1] = r1; +} + +__int64 ScaleOneThird = 0x5500550055005500; + +// ---------------------------------------------------------------------------- +// Build palette for a 4 color block +// ---------------------------------------------------------------------------- +void DXTCGen::BuildCodes4(cbVector *pVects, cbVector &v1, cbVector &v2) +{ +// pVects[0] = v1; +// pVects[3] = v2; +// +// pVects[1][0] = v1[0]; +// pVects[1][1] = (BYTE)( ((long)v1[1] * 2 + (long)v2[1]) / 3 ); +// pVects[1][2] = (BYTE)( ((long)v1[2] * 2 + (long)v2[2]) / 3 ); +// pVects[1][3] = (BYTE)( ((long)v1[3] * 2 + (long)v2[3]) / 3 ); +// +// pVects[2][0] = v1[0]; +// pVects[2][1] = (BYTE)( ((long)v2[1] * 2 + (long)v1[1]) / 3 ); +// pVects[2][2] = (BYTE)( ((long)v2[2] * 2 + (long)v1[2]) / 3 ); +// pVects[2][3] = (BYTE)( ((long)v2[3] * 2 + (long)v1[3]) / 3 ); + + __asm { + mov ecx, dword ptr pVects + mov eax, dword ptr v1 + mov ebx, dword ptr v2 + + movd mm0, [eax] + movd mm1, [ebx] + + pxor mm2, mm2 + movd [ecx], mm0 + movd [ecx+12], mm1 + + punpcklbw mm0, mm2 + punpcklbw mm1, mm2 + movq mm3, mm0 // mm3 = v0 + + paddw mm0, mm1 // mm0 = v0 + v1 + paddw mm3, mm3 // mm3 = v0*2 + + paddw mm0, mm1 // mm0 = v0 + v1*2 + paddw mm1, mm3 // mm1 = v0*2 + v1 + + pmulhw mm0, ScaleOneThird + pmulhw mm1, ScaleOneThird + packuswb mm1, mm0 + + movq [ecx+4], mm1 + } +} +*/ + +void BlockDXT1::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + // Decode color block. + Color32 color_array[4]; + evaluatePalette(color_array); + + // Write color block. + for( uint j = 0; j < 4; j++ ) { + for( uint i = 0; i < 4; i++ ) { + uint idx = (row[j] >> (2 * i)) & 3; + block->color(i, j) = color_array[idx]; + } + } +} + +void BlockDXT1::setIndices(int * idx) +{ + indices = 0; + for(uint i = 0; i < 16; i++) { + indices |= (idx[i] & 3) << (2 * i); + } +} + + +/// Flip DXT1 block vertically. +inline void BlockDXT1::flip4() +{ + swap(row[0], row[3]); + swap(row[1], row[2]); +} + +/// Flip half DXT1 block vertically. +inline void BlockDXT1::flip2() +{ + swap(row[0], row[1]); +} + + +/*---------------------------------------------------------------------------- + BlockDXT3 +----------------------------------------------------------------------------*/ + +void BlockDXT3::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + // Decode color. + color.decodeBlock(block); + + // Decode alpha. + alpha.decodeBlock(block); +} + +void AlphaBlockDXT3::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + block->color(0x0).a = (alpha0 << 4) | alpha0; + block->color(0x1).a = (alpha1 << 4) | alpha1; + block->color(0x2).a = (alpha2 << 4) | alpha2; + block->color(0x3).a = (alpha3 << 4) | alpha3; + block->color(0x4).a = (alpha4 << 4) | alpha4; + block->color(0x5).a = (alpha5 << 4) | alpha5; + block->color(0x6).a = (alpha6 << 4) | alpha6; + block->color(0x7).a = (alpha7 << 4) | alpha7; + block->color(0x8).a = (alpha8 << 4) | alpha8; + block->color(0x9).a = (alpha9 << 4) | alpha9; + block->color(0xA).a = (alphaA << 4) | alphaA; + block->color(0xB).a = (alphaB << 4) | alphaB; + block->color(0xC).a = (alphaC << 4) | alphaC; + block->color(0xD).a = (alphaD << 4) | alphaD; + block->color(0xE).a = (alphaE << 4) | alphaE; + block->color(0xF).a = (alphaF << 4) | alphaF; +} + +/// Flip DXT3 alpha block vertically. +void AlphaBlockDXT3::flip4() +{ + swap(row[0], row[3]); + swap(row[1], row[2]); +} + +/// Flip half DXT3 alpha block vertically. +void AlphaBlockDXT3::flip2() +{ + swap(row[0], row[1]); +} + +/// Flip DXT3 block vertically. +void BlockDXT3::flip4() +{ + alpha.flip4(); + color.flip4(); +} + +/// Flip half DXT3 block vertically. +void BlockDXT3::flip2() +{ + alpha.flip2(); + color.flip2(); +} + + +/*---------------------------------------------------------------------------- + BlockDXT5 +----------------------------------------------------------------------------*/ + +void AlphaBlockDXT5::evaluatePalette(uint8 alpha[8]) const +{ + if (alpha0 > alpha1) { + evaluatePalette8(alpha); + } + else { + evaluatePalette6(alpha); + } +} + +void AlphaBlockDXT5::evaluatePalette8(uint8 alpha[8]) const +{ + // 8-alpha block: derive the other six alphas. + // Bit code 000 = alpha0, 001 = alpha1, others are interpolated. + alpha[0] = alpha0; + alpha[1] = alpha1; + alpha[2] = (6 * alpha[0] + 1 * alpha[1]) / 7; // bit code 010 + alpha[3] = (5 * alpha[0] + 2 * alpha[1]) / 7; // bit code 011 + alpha[4] = (4 * alpha[0] + 3 * alpha[1]) / 7; // bit code 100 + alpha[5] = (3 * alpha[0] + 4 * alpha[1]) / 7; // bit code 101 + alpha[6] = (2 * alpha[0] + 5 * alpha[1]) / 7; // bit code 110 + alpha[7] = (1 * alpha[0] + 6 * alpha[1]) / 7; // bit code 111 +} + +void AlphaBlockDXT5::evaluatePalette6(uint8 alpha[8]) const +{ + // 6-alpha block. + // Bit code 000 = alpha0, 001 = alpha1, others are interpolated. + alpha[0] = alpha0; + alpha[1] = alpha1; + alpha[2] = (4 * alpha[0] + 1 * alpha[1]) / 5; // Bit code 010 + alpha[3] = (3 * alpha[0] + 2 * alpha[1]) / 5; // Bit code 011 + alpha[4] = (2 * alpha[0] + 3 * alpha[1]) / 5; // Bit code 100 + alpha[5] = (1 * alpha[0] + 4 * alpha[1]) / 5; // Bit code 101 + alpha[6] = 0x00; // Bit code 110 + alpha[7] = 0xFF; // Bit code 111 +} + +void AlphaBlockDXT5::indices(uint8 index_array[16]) const +{ + index_array[0x0] = bits0; + index_array[0x1] = bits1; + index_array[0x2] = bits2; + index_array[0x3] = bits3; + index_array[0x4] = bits4; + index_array[0x5] = bits5; + index_array[0x6] = bits6; + index_array[0x7] = bits7; + index_array[0x8] = bits8; + index_array[0x9] = bits9; + index_array[0xA] = bitsA; + index_array[0xB] = bitsB; + index_array[0xC] = bitsC; + index_array[0xD] = bitsD; + index_array[0xE] = bitsE; + index_array[0xF] = bitsF; +} + +uint AlphaBlockDXT5::index(uint index) const +{ + nvDebugCheck(index < 16); + + int offset = (3 * index + 16); + return uint((this->u >> offset) & 0x7); +} + +void AlphaBlockDXT5::setIndex(uint index, uint value) +{ + nvDebugCheck(index < 16); + nvDebugCheck(value < 8); + + int offset = (3 * index + 16); + uint64 mask = uint64(0x7) << offset; + this->u = (this->u & ~mask) | (uint64(value) << offset); +} + +void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + uint8 alpha_array[8]; + evaluatePalette(alpha_array); + + uint8 index_array[16]; + indices(index_array); + + for(uint i = 0; i < 16; i++) { + block->color(i).a = alpha_array[index_array[i]]; + } +} + +void AlphaBlockDXT5::flip4() +{ + uint64 * b = (uint64 *)this; + + // @@ The masks might have to be byte swapped. + uint64 tmp = (*b & POSH_U64(0x000000000000FFFF)); + tmp |= (*b & POSH_U64(0x000000000FFF0000)) << 36; + tmp |= (*b & POSH_U64(0x000000FFF0000000)) << 12; + tmp |= (*b & POSH_U64(0x000FFF0000000000)) >> 12; + tmp |= (*b & POSH_U64(0xFFF0000000000000)) >> 36; + + *b = tmp; +} + +void AlphaBlockDXT5::flip2() +{ + uint * b = (uint *)this; + + // @@ The masks might have to be byte swapped. + uint tmp = (*b & 0xFF000000); + tmp |= (*b & 0x00000FFF) << 12; + tmp |= (*b & 0x00FFF000) >> 12; + + *b = tmp; +} + +void BlockDXT5::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + // Decode color. + color.decodeBlock(block); + + // Decode alpha. + alpha.decodeBlock(block); + +} + +/// Flip DXT5 block vertically. +void BlockDXT5::flip4() +{ + alpha.flip4(); + color.flip4(); +} + +/// Flip half DXT5 block vertically. +void BlockDXT5::flip2() +{ + alpha.flip2(); + color.flip2(); +} + + +/// Decode ATI1 block. +void BlockATI1::decodeBlock(ColorBlock * block) const +{ + uint8 alpha_array[8]; + alpha.evaluatePalette(alpha_array); + + uint8 index_array[16]; + alpha.indices(index_array); + + for(uint i = 0; i < 16; i++) { + Color32 & c = block->color(i); + c.b = c.g = c.r = alpha_array[index_array[i]]; + c.a = 255; + } +} + +/// Flip ATI1 block vertically. +void BlockATI1::flip4() +{ + alpha.flip4(); +} + +/// Flip half ATI1 block vertically. +void BlockATI1::flip2() +{ + alpha.flip2(); +} + + +/// Decode ATI2 block. +void BlockATI2::decodeBlock(ColorBlock * block) const +{ + uint8 alpha_array[8]; + uint8 index_array[16]; + + x.evaluatePalette(alpha_array); + x.indices(index_array); + + for(uint i = 0; i < 16; i++) { + Color32 & c = block->color(i); + c.r = alpha_array[index_array[i]]; + } + + y.evaluatePalette(alpha_array); + y.indices(index_array); + + for(uint i = 0; i < 16; i++) { + Color32 & c = block->color(i); + c.g = alpha_array[index_array[i]]; + c.b = 0; + c.a = 255; + } +} + +/// Flip ATI2 block vertically. +void BlockATI2::flip4() +{ + x.flip4(); + y.flip4(); +} + +/// Flip half ATI2 block vertically. +void BlockATI2::flip2() +{ + x.flip2(); + y.flip2(); +} + + +void BlockCTX1::evaluatePalette(Color32 color_array[4]) const +{ + // Does bit expansion before interpolation. + color_array[0].b = 0x00; + color_array[0].g = col0[1]; + color_array[0].r = col0[0]; + color_array[0].a = 0xFF; + + color_array[1].r = 0x00; + color_array[1].g = col0[1]; + color_array[1].b = col1[0]; + color_array[1].a = 0xFF; + + color_array[2].r = 0x00; + color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; + color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; + color_array[2].a = 0xFF; + + color_array[3].r = 0x00; + color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; + color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; + color_array[3].a = 0xFF; +} + +void BlockCTX1::decodeBlock(ColorBlock * block) const +{ + nvDebugCheck(block != NULL); + + // Decode color block. + Color32 color_array[4]; + evaluatePalette(color_array); + + // Write color block. + for( uint j = 0; j < 4; j++ ) { + for( uint i = 0; i < 4; i++ ) { + uint idx = (row[j] >> (2 * i)) & 3; + block->color(i, j) = color_array[idx]; + } + } +} + +void BlockCTX1::setIndices(int * idx) +{ + indices = 0; + for(uint i = 0; i < 16; i++) { + indices |= (idx[i] & 3) << (2 * i); + } +} + + +/// Flip CTX1 block vertically. +inline void BlockCTX1::flip4() +{ + swap(row[0], row[3]); + swap(row[1], row[2]); +} + +/// Flip half CTX1 block vertically. +inline void BlockCTX1::flip2() +{ + swap(row[0], row[1]); +} + + + + +Stream & nv::operator<<(Stream & stream, BlockDXT1 & block) +{ + stream << block.col0.u << block.col1.u; + stream.serialize(&block.indices, sizeof(block.indices)); + return stream; +} + +Stream & nv::operator<<(Stream & stream, AlphaBlockDXT3 & block) +{ + stream.serialize(&block, sizeof(block)); + return stream; +} + +Stream & nv::operator<<(Stream & stream, BlockDXT3 & block) +{ + return stream << block.alpha << block.color; +} + +Stream & nv::operator<<(Stream & stream, AlphaBlockDXT5 & block) +{ + stream.serialize(&block, sizeof(block)); + return stream; +} + +Stream & nv::operator<<(Stream & stream, BlockDXT5 & block) +{ + return stream << block.alpha << block.color; +} + +Stream & nv::operator<<(Stream & stream, BlockATI1 & block) +{ + return stream << block.alpha; +} + +Stream & nv::operator<<(Stream & stream, BlockATI2 & block) +{ + return stream << block.x << block.y; +} + +Stream & nv::operator<<(Stream & stream, BlockCTX1 & block) +{ + stream.serialize(&block, sizeof(block)); + return stream; +} + diff --git a/externals/NVTT/src/nvimage/BlockDXT.h b/externals/NVTT/src/nvimage/BlockDXT.h new file mode 100644 index 00000000..5a45c408 --- /dev/null +++ b/externals/NVTT/src/nvimage/BlockDXT.h @@ -0,0 +1,223 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_IMAGE_BLOCKDXT_H +#define NV_IMAGE_BLOCKDXT_H + +#include + +#include + +namespace nv +{ + struct ColorBlock; + class Stream; + + + /// DXT1 block. + struct BlockDXT1 + { + Color16 col0; + Color16 col1; + union { + uint8 row[4]; + uint indices; + }; + + bool isFourColorMode() const; + + uint evaluatePalette(Color32 color_array[4]) const; + uint evaluatePaletteFast(Color32 color_array[4]) const; + void evaluatePalette3(Color32 color_array[4]) const; + void evaluatePalette4(Color32 color_array[4]) const; + + void decodeBlock(ColorBlock * block) const; + + void setIndices(int * idx); + + void flip4(); + void flip2(); + }; + + /// Return true if the block uses four color mode, false otherwise. + inline bool BlockDXT1::isFourColorMode() const + { + return col0.u > col1.u; + } + + + /// DXT3 alpha block with explicit alpha. + struct AlphaBlockDXT3 + { + union { + struct { + uint alpha0 : 4; + uint alpha1 : 4; + uint alpha2 : 4; + uint alpha3 : 4; + uint alpha4 : 4; + uint alpha5 : 4; + uint alpha6 : 4; + uint alpha7 : 4; + uint alpha8 : 4; + uint alpha9 : 4; + uint alphaA : 4; + uint alphaB : 4; + uint alphaC : 4; + uint alphaD : 4; + uint alphaE : 4; + uint alphaF : 4; + }; + uint16 row[4]; + }; + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + + /// DXT3 block. + struct BlockDXT3 + { + AlphaBlockDXT3 alpha; + BlockDXT1 color; + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + + /// DXT5 alpha block. + struct AlphaBlockDXT5 + { + union { + struct { + uint64 alpha0 : 8; // 8 + uint64 alpha1 : 8; // 16 + uint64 bits0 : 3; // 3 - 19 + uint64 bits1 : 3; // 6 - 22 + uint64 bits2 : 3; // 9 - 25 + uint64 bits3 : 3; // 12 - 28 + uint64 bits4 : 3; // 15 - 31 + uint64 bits5 : 3; // 18 - 34 + uint64 bits6 : 3; // 21 - 37 + uint64 bits7 : 3; // 24 - 40 + uint64 bits8 : 3; // 27 - 43 + uint64 bits9 : 3; // 30 - 46 + uint64 bitsA : 3; // 33 - 49 + uint64 bitsB : 3; // 36 - 52 + uint64 bitsC : 3; // 39 - 55 + uint64 bitsD : 3; // 42 - 58 + uint64 bitsE : 3; // 45 - 61 + uint64 bitsF : 3; // 48 - 64 + }; + uint64 u; + }; + + void evaluatePalette(uint8 alpha[8]) const; + void evaluatePalette8(uint8 alpha[8]) const; + void evaluatePalette6(uint8 alpha[8]) const; + void indices(uint8 index_array[16]) const; + + uint index(uint index) const; + void setIndex(uint index, uint value); + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + + /// DXT5 block. + struct BlockDXT5 + { + AlphaBlockDXT5 alpha; + BlockDXT1 color; + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + /// ATI1 block. + struct BlockATI1 + { + AlphaBlockDXT5 alpha; + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + /// ATI2 block. + struct BlockATI2 + { + AlphaBlockDXT5 x; + AlphaBlockDXT5 y; + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + /// CTX1 block. + struct BlockCTX1 + { + uint8 col0[2]; + uint8 col1[2]; + union { + uint8 row[4]; + uint indices; + }; + + void evaluatePalette(Color32 color_array[4]) const; + void setIndices(int * idx); + + void decodeBlock(ColorBlock * block) const; + + void flip4(); + void flip2(); + }; + + + // Serialization functions. + NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT1 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT3 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT3 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, AlphaBlockDXT5 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, BlockDXT5 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI1 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, BlockATI2 & block); + NVIMAGE_API Stream & operator<<(Stream & stream, BlockCTX1 & block); + +} // nv namespace + +#endif // NV_IMAGE_BLOCKDXT_H diff --git a/externals/NVTT/src/nvimage/CMakeLists.txt b/externals/NVTT/src/nvimage/CMakeLists.txt new file mode 100644 index 00000000..7b2f197b --- /dev/null +++ b/externals/NVTT/src/nvimage/CMakeLists.txt @@ -0,0 +1,68 @@ +PROJECT(nvimage) + +SET(IMAGE_SRCS + nvimage.h + FloatImage.h + FloatImage.cpp + Filter.h + Filter.cpp + Image.h + Image.cpp + ImageIO.h + ImageIO.cpp + ColorBlock.h + ColorBlock.cpp + BlockDXT.h + BlockDXT.cpp + HoleFilling.h + HoleFilling.cpp + DirectDrawSurface.h + DirectDrawSurface.cpp + Quantize.h + Quantize.cpp + NormalMap.h + NormalMap.cpp + NormalMipmap.h + NormalMipmap.cpp + PsdFile.h + TgaFile.h) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +IF(PNG_FOUND) + SET(LIBS ${LIBS} ${PNG_LIBRARIES}) + INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) +ENDIF(PNG_FOUND) + +IF(JPEG_FOUND) + SET(LIBS ${LIBS} ${JPEG_LIBRARIES}) + INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) +ENDIF(JPEG_FOUND) + +IF(TIFF_FOUND) + SET(LIBS ${LIBS} ${TIFF_LIBRARIES}) + INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) +ENDIF(TIFF_FOUND) + +IF(OPENEXR_FOUND) + SET(LIBS ${LIBS} ${OPENEXR_LIBRARIES}) + INCLUDE_DIRECTORIES(${OPENEXR_INCLUDE_PATHS}) +ENDIF(OPENEXR_FOUND) + +# targets +ADD_DEFINITIONS(-DNVIMAGE_EXPORTS) + +IF(NVIMAGE_SHARED) + ADD_DEFINITIONS(-DNVIMAGE_SHARED=1) + ADD_LIBRARY(nvimage SHARED ${IMAGE_SRCS}) +ELSE(NVIMAGE_SHARED) + ADD_LIBRARY(nvimage ${IMAGE_SRCS}) +ENDIF(NVIMAGE_SHARED) + +TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh) + +INSTALL(TARGETS nvimage + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) + diff --git a/externals/NVTT/src/nvimage/ColorBlock.cpp b/externals/NVTT/src/nvimage/ColorBlock.cpp new file mode 100644 index 00000000..2b100982 --- /dev/null +++ b/externals/NVTT/src/nvimage/ColorBlock.cpp @@ -0,0 +1,404 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include +#include + +using namespace nv; + +namespace { + + // Get approximate luminance. + inline static uint colorLuminance(Color32 c) + { + return c.r + c.g + c.b; + } + + // Get the euclidean distance between the given colors. + inline static uint colorDistance(Color32 c0, Color32 c1) + { + return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b); + } + +} // namespace` + + +/// Default constructor. +ColorBlock::ColorBlock() +{ +} + +/// Init the color block from an array of colors. +ColorBlock::ColorBlock(const uint * linearImage) +{ + for(uint i = 0; i < 16; i++) { + color(i) = Color32(linearImage[i]); + } +} + +/// Init the color block with the contents of the given block. +ColorBlock::ColorBlock(const ColorBlock & block) +{ + for(uint i = 0; i < 16; i++) { + color(i) = block.color(i); + } +} + + +/// Initialize this color block. +ColorBlock::ColorBlock(const Image * img, uint x, uint y) +{ + init(img, x, y); +} + +void ColorBlock::init(const Image * img, uint x, uint y) +{ + nvDebugCheck(img != NULL); + + const uint bw = min(img->width() - x, 4U); + const uint bh = min(img->height() - y, 4U); + + nvDebugCheck(bw != 0); + nvDebugCheck(bh != 0); + + static int remainder[] = { + 0, 0, 0, 0, + 0, 1, 0, 1, + 0, 1, 2, 0, + 0, 1, 2, 3, + }; + + // Blocks that are smaller than 4x4 are handled by repeating the pixels. + // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( + + for(uint i = 0; i < 4; i++) { + //const int by = i % bh; + const int by = remainder[(bh - 1) * 4 + i]; + for(uint e = 0; e < 4; e++) { + //const int bx = e % bw; + const int bx = remainder[(bw - 1) * 4 + e]; + color(e, i) = img->pixel(x + bx, y + by); + } + } +} + + +void ColorBlock::swizzleDXT5n() +{ + for(int i = 0; i < 16; i++) + { + Color32 c = m_color[i]; + m_color[i] = Color32(0xFF, c.g, 0, c.r); + } +} + +void ColorBlock::splatX() +{ + for(int i = 0; i < 16; i++) + { + uint8 x = m_color[i].r; + m_color[i] = Color32(x, x, x, x); + } +} + +void ColorBlock::splatY() +{ + for(int i = 0; i < 16; i++) + { + uint8 y = m_color[i].g; + m_color[i] = Color32(y, y, y, y); + } +} + +/// Returns true if the block has a single color. +bool ColorBlock::isSingleColor() const +{ + Color32 mask(0xFF, 0xFF, 0xFF, 0x00); + uint u = m_color[0].u & mask.u; + + for (int i = 1; i < 16; i++) + { + if (u != (m_color[i].u & mask.u)) + { + return false; + } + } + + return true; +} + +/// Count number of unique colors in this color block. +uint ColorBlock::countUniqueColors() const +{ + uint count = 0; + + // @@ This does not have to be o(n^2) + for(int i = 0; i < 16; i++) + { + bool unique = true; + for(int j = 0; j < i; j++) { + if( m_color[i] != m_color[j] ) { + unique = false; + } + } + + if( unique ) { + count++; + } + } + + return count; +} + +/// Get average color of the block. +Color32 ColorBlock::averageColor() const +{ + uint r, g, b, a; + r = g = b = a = 0; + + for(uint i = 0; i < 16; i++) { + r += m_color[i].r; + g += m_color[i].g; + b += m_color[i].b; + a += m_color[i].a; + } + + return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16)); +} + +/// Return true if the block is not fully opaque. +bool ColorBlock::hasAlpha() const +{ + for (uint i = 0; i < 16; i++) + { + if (m_color[i].a != 255) return true; + } + return false; +} + + +/// Get diameter color range. +void ColorBlock::diameterRange(Color32 * start, Color32 * end) const +{ + nvDebugCheck(start != NULL); + nvDebugCheck(end != NULL); + + Color32 c0, c1; + uint best_dist = 0; + + for(int i = 0; i < 16; i++) { + for (int j = i+1; j < 16; j++) { + uint dist = colorDistance(m_color[i], m_color[j]); + if( dist > best_dist ) { + best_dist = dist; + c0 = m_color[i]; + c1 = m_color[j]; + } + } + } + + *start = c0; + *end = c1; +} + +/// Get luminance color range. +void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const +{ + nvDebugCheck(start != NULL); + nvDebugCheck(end != NULL); + + Color32 minColor, maxColor; + uint minLuminance, maxLuminance; + + maxLuminance = minLuminance = colorLuminance(m_color[0]); + + for(uint i = 1; i < 16; i++) + { + uint luminance = colorLuminance(m_color[i]); + + if (luminance > maxLuminance) { + maxLuminance = luminance; + maxColor = m_color[i]; + } + else if (luminance < minLuminance) { + minLuminance = luminance; + minColor = m_color[i]; + } + } + + *start = minColor; + *end = maxColor; +} + +/// Get color range based on the bounding box. +void ColorBlock::boundsRange(Color32 * start, Color32 * end) const +{ + nvDebugCheck(start != NULL); + nvDebugCheck(end != NULL); + + Color32 minColor(255, 255, 255); + Color32 maxColor(0, 0, 0); + + for(uint i = 0; i < 16; i++) + { + if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } + if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } + if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; } + if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; } + if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; } + if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; } + } + + // Offset range by 1/16 of the extents + Color32 inset; + inset.r = (maxColor.r - minColor.r) >> 4; + inset.g = (maxColor.g - minColor.g) >> 4; + inset.b = (maxColor.b - minColor.b) >> 4; + + minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255; + minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255; + minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255; + + maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0; + maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0; + maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0; + + *start = minColor; + *end = maxColor; +} + +/// Get color range based on the bounding box. +void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const +{ + nvDebugCheck(start != NULL); + nvDebugCheck(end != NULL); + + Color32 minColor(255, 255, 255, 255); + Color32 maxColor(0, 0, 0, 0); + + for(uint i = 0; i < 16; i++) + { + if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } + if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } + if (m_color[i].b < minColor.b) { minColor.b = m_color[i].b; } + if (m_color[i].a < minColor.a) { minColor.a = m_color[i].a; } + if (m_color[i].r > maxColor.r) { maxColor.r = m_color[i].r; } + if (m_color[i].g > maxColor.g) { maxColor.g = m_color[i].g; } + if (m_color[i].b > maxColor.b) { maxColor.b = m_color[i].b; } + if (m_color[i].a > maxColor.a) { maxColor.a = m_color[i].a; } + } + + // Offset range by 1/16 of the extents + Color32 inset; + inset.r = (maxColor.r - minColor.r) >> 4; + inset.g = (maxColor.g - minColor.g) >> 4; + inset.b = (maxColor.b - minColor.b) >> 4; + inset.a = (maxColor.a - minColor.a) >> 4; + + minColor.r = (minColor.r + inset.r <= 255) ? minColor.r + inset.r : 255; + minColor.g = (minColor.g + inset.g <= 255) ? minColor.g + inset.g : 255; + minColor.b = (minColor.b + inset.b <= 255) ? minColor.b + inset.b : 255; + minColor.a = (minColor.a + inset.a <= 255) ? minColor.a + inset.a : 255; + + maxColor.r = (maxColor.r >= inset.r) ? maxColor.r - inset.r : 0; + maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0; + maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0; + maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0; + + *start = minColor; + *end = maxColor; +} + + +/// Sort colors by abosolute value in their 16 bit representation. +void ColorBlock::sortColorsByAbsoluteValue() +{ + // Dummy selection sort. + for( uint a = 0; a < 16; a++ ) { + uint max = a; + Color16 cmax(m_color[a]); + + for( uint b = a+1; b < 16; b++ ) { + Color16 cb(m_color[b]); + + if( cb.u > cmax.u ) { + max = b; + cmax = cb; + } + } + swap( m_color[a], m_color[max] ); + } +} + + +/// Find extreme colors in the given axis. +void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) const +{ + nvDebugCheck(start != NULL); + nvDebugCheck(end != NULL); + + int mini, maxi; + mini = maxi = 0; + + float min, max; + min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis); + + for(uint i = 1; i < 16; i++) + { + const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); + + float val = dot(vec, axis); + if( val < min ) { + mini = i; + min = val; + } + else if( val > max ) { + maxi = i; + max = val; + } + } + + *start = m_color[mini]; + *end = m_color[maxi]; +} + + +/// Sort colors in the given axis. +void ColorBlock::sortColors(const Vector3 & axis) +{ + float luma_array[16]; + + for(uint i = 0; i < 16; i++) { + const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); + luma_array[i] = dot(vec, axis); + } + + // Dummy selection sort. + for( uint a = 0; a < 16; a++ ) { + uint min = a; + for( uint b = a+1; b < 16; b++ ) { + if( luma_array[b] < luma_array[min] ) { + min = b; + } + } + swap( luma_array[a], luma_array[min] ); + swap( m_color[a], m_color[min] ); + } +} + + +/// Get the volume of the color block. +float ColorBlock::volume() const +{ + Box bounds; + bounds.clearBounds(); + + for(int i = 0; i < 16; i++) { + const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b); + bounds.addPointToBounds(point); + } + + return bounds.volume(); +} + + diff --git a/externals/NVTT/src/nvimage/ColorBlock.h b/externals/NVTT/src/nvimage/ColorBlock.h new file mode 100644 index 00000000..00f9c8ee --- /dev/null +++ b/externals/NVTT/src/nvimage/ColorBlock.h @@ -0,0 +1,95 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_COLORBLOCK_H +#define NV_IMAGE_COLORBLOCK_H + +#include + +namespace nv +{ + class Image; + + /// Uncompressed 4x4 color block. + struct ColorBlock + { + ColorBlock(); + ColorBlock(const uint * linearImage); + ColorBlock(const ColorBlock & block); + ColorBlock(const Image * img, uint x, uint y); + + void init(const Image * img, uint x, uint y); + + void swizzleDXT5n(); + void splatX(); + void splatY(); + + bool isSingleColor() const; + uint countUniqueColors() const; + Color32 averageColor() const; + bool hasAlpha() const; + + void diameterRange(Color32 * start, Color32 * end) const; + void luminanceRange(Color32 * start, Color32 * end) const; + void boundsRange(Color32 * start, Color32 * end) const; + void boundsRangeAlpha(Color32 * start, Color32 * end) const; + + void sortColorsByAbsoluteValue(); + + void computeRange(const Vector3 & axis, Color32 * start, Color32 * end) const; + void sortColors(const Vector3 & axis); + + float volume() const; + + // Accessors + const Color32 * colors() const; + + Color32 color(uint i) const; + Color32 & color(uint i); + + Color32 color(uint x, uint y) const; + Color32 & color(uint x, uint y); + + private: + + Color32 m_color[4*4]; + + }; + + + /// Get pointer to block colors. + inline const Color32 * ColorBlock::colors() const + { + return m_color; + } + + /// Get block color. + inline Color32 ColorBlock::color(uint i) const + { + nvDebugCheck(i < 16); + return m_color[i]; + } + + /// Get block color. + inline Color32 & ColorBlock::color(uint i) + { + nvDebugCheck(i < 16); + return m_color[i]; + } + + /// Get block color. + inline Color32 ColorBlock::color(uint x, uint y) const + { + nvDebugCheck(x < 4 && y < 4); + return m_color[y * 4 + x]; + } + + /// Get block color. + inline Color32 & ColorBlock::color(uint x, uint y) + { + nvDebugCheck(x < 4 && y < 4); + return m_color[y * 4 + x]; + } + +} // nv namespace + +#endif // NV_IMAGE_COLORBLOCK_H diff --git a/externals/NVTT/src/nvimage/ConeMap.cpp b/externals/NVTT/src/nvimage/ConeMap.cpp new file mode 100644 index 00000000..0c99efa9 --- /dev/null +++ b/externals/NVTT/src/nvimage/ConeMap.cpp @@ -0,0 +1,122 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include + +#include +#include +#include +#include + +using namespace nv; + + +static float processPixel(const FloatImage * img, uint x, uint y) +{ + nvDebugCheck(img != NULL); + + const uint w = img->width(); + const uint h = img->height(); + + float d = img->pixel(x, y, 0); + + float fx0 = (float) x / w; + float fy0 = (float) y / h; + + float best_ratio = INFINITY; + uint best_x = w; + uint best_y = h; + + for (uint yy = 0; yy < h; yy++) + { + for (uint xx = 0; xx < w; xx++) + { + float ch = d - img->pixel(xx, yy, 0); + + if (ch > 0) + { + float dx = float(xx - x); + float dy = float(yy - y); + + float ratio = (dx * dx + dy * dy) / ch; + + if (ratio < best_ratio) + { + best_x = xx; + best_y = yy; + } + } + } + } + + if (best_x != w) + { + nvDebugCheck(best_y !=h); + + float dx = float(best_x - x) / w; + float dy = float(best_y - y) / h; + + float cw = sqrtf(dx*dx + dy*dy); + float ch = d - img->pixel(best_x, best_y, 0); + + return min(1.0f, sqrtf(cw / ch)); + } + + return 1.0f; +} + + +// Create cone map using the given kernels. +FloatImage * createConeMap(const Image * img, Vector4::Arg heightWeights) +{ + nvCheck(img != NULL); + + const uint w = img->width(); + const uint h = img->height(); + + AutoPtr fimage(new FloatImage()); + //fimage->allocate(2, w, h); + fimage->allocate(4, w, h); + + // Compute height and store in red channel: + float * heightChannel = fimage->channel(0); + for(uint i = 0; i < w*h; i++) + { + Vector4 color = toVector4(img->pixel(i)); + heightChannel[i] = dot(color, heightWeights); + } + + // Compute cones: + for(uint y = 0; y < h; y++) + { + for(uint x = 0; x < w; x++) + { + processPixel(fimage.ptr(), x, y); + } + } + + return fimage.release(); +} + diff --git a/externals/NVTT/src/nvimage/ConeMap.h b/externals/NVTT/src/nvimage/ConeMap.h new file mode 100644 index 00000000..0c79533a --- /dev/null +++ b/externals/NVTT/src/nvimage/ConeMap.h @@ -0,0 +1,39 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_IMAGE_CONEMAP_H +#define NV_IMAGE_CONEMAP_H + +#include +#include + +namespace nv +{ + class Image; + class FloatImage; + + FloatImage * createConeMap(const Image * img, Vector4::Arg heightWeights); + +} // nv namespace + +#endif // NV_IMAGE_CONEMAP_H diff --git a/externals/NVTT/src/nvimage/DirectDrawSurface.cpp b/externals/NVTT/src/nvimage/DirectDrawSurface.cpp new file mode 100644 index 00000000..3580c30f --- /dev/null +++ b/externals/NVTT/src/nvimage/DirectDrawSurface.cpp @@ -0,0 +1,1321 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include // max +#include + +#include +#include +#include +#include +#include + +#include // memset + + +using namespace nv; + +#if !defined(MAKEFOURCC) +# define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + (uint(uint8(ch0)) | (uint(uint8(ch1)) << 8) | \ + (uint(uint8(ch2)) << 16) | (uint(uint8(ch3)) << 24 )) +#endif + +namespace +{ + static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' '); + static const uint FOURCC_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'); + static const uint FOURCC_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'); + static const uint FOURCC_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'); + static const uint FOURCC_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'); + static const uint FOURCC_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'); + static const uint FOURCC_RXGB = MAKEFOURCC('R', 'X', 'G', 'B'); + static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1'); + static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2'); + + static const uint FOURCC_A2XY = MAKEFOURCC('A', '2', 'X', 'Y'); + + static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0'); + + // 32 bit RGB formats. + static const uint D3DFMT_R8G8B8 = 20; + static const uint D3DFMT_A8R8G8B8 = 21; + static const uint D3DFMT_X8R8G8B8 = 22; + static const uint D3DFMT_R5G6B5 = 23; + static const uint D3DFMT_X1R5G5B5 = 24; + static const uint D3DFMT_A1R5G5B5 = 25; + static const uint D3DFMT_A4R4G4B4 = 26; + static const uint D3DFMT_R3G3B2 = 27; + static const uint D3DFMT_A8 = 28; + static const uint D3DFMT_A8R3G3B2 = 29; + static const uint D3DFMT_X4R4G4B4 = 30; + static const uint D3DFMT_A2B10G10R10 = 31; + static const uint D3DFMT_A8B8G8R8 = 32; + static const uint D3DFMT_X8B8G8R8 = 33; + static const uint D3DFMT_G16R16 = 34; + static const uint D3DFMT_A2R10G10B10 = 35; + + static const uint D3DFMT_A16B16G16R16 = 36; + + // Palette formats. + static const uint D3DFMT_A8P8 = 40; + static const uint D3DFMT_P8 = 41; + + // Luminance formats. + static const uint D3DFMT_L8 = 50; + static const uint D3DFMT_A8L8 = 51; + static const uint D3DFMT_A4L4 = 52; + static const uint D3DFMT_L16 = 81; + + // Floating point formats + static const uint D3DFMT_R16F = 111; + static const uint D3DFMT_G16R16F = 112; + static const uint D3DFMT_A16B16G16R16F = 113; + static const uint D3DFMT_R32F = 114; + static const uint D3DFMT_G32R32F = 115; + static const uint D3DFMT_A32B32G32R32F = 116; + + static const uint DDSD_CAPS = 0x00000001U; + static const uint DDSD_PIXELFORMAT = 0x00001000U; + static const uint DDSD_WIDTH = 0x00000004U; + static const uint DDSD_HEIGHT = 0x00000002U; + static const uint DDSD_PITCH = 0x00000008U; + static const uint DDSD_MIPMAPCOUNT = 0x00020000U; + static const uint DDSD_LINEARSIZE = 0x00080000U; + static const uint DDSD_DEPTH = 0x00800000U; + + static const uint DDSCAPS_COMPLEX = 0x00000008U; + static const uint DDSCAPS_TEXTURE = 0x00001000U; + static const uint DDSCAPS_MIPMAP = 0x00400000U; + static const uint DDSCAPS2_VOLUME = 0x00200000U; + static const uint DDSCAPS2_CUBEMAP = 0x00000200U; + + static const uint DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400U; + static const uint DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800U; + static const uint DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000U; + static const uint DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000U; + static const uint DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000U; + static const uint DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000U; + static const uint DDSCAPS2_CUBEMAP_ALL_FACES = 0x0000FC00U; + + static const uint DDPF_ALPHAPIXELS = 0x00000001U; + static const uint DDPF_ALPHA = 0x00000002U; + static const uint DDPF_FOURCC = 0x00000004U; + static const uint DDPF_RGB = 0x00000040U; + static const uint DDPF_PALETTEINDEXED1 = 0x00000800U; + static const uint DDPF_PALETTEINDEXED2 = 0x00001000U; + static const uint DDPF_PALETTEINDEXED4 = 0x00000008U; + static const uint DDPF_PALETTEINDEXED8 = 0x00000020U; + static const uint DDPF_LUMINANCE = 0x00020000U; + static const uint DDPF_ALPHAPREMULT = 0x00008000U; + static const uint DDPF_NORMAL = 0x80000000U; // @@ Custom nv flag. + + // DX10 formats. + enum DXGI_FORMAT + { + DXGI_FORMAT_UNKNOWN = 0, + + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + + DXGI_FORMAT_R11G11B10_FLOAT = 26, + + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + + DXGI_FORMAT_R1_UNORM = 66, + + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + }; + + enum D3D10_RESOURCE_DIMENSION + { + D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D10_RESOURCE_DIMENSION_BUFFER = 1, + D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4, + }; + + + const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat) + { +#define CASE(format) case DXGI_FORMAT_##format: return #format + switch(dxgiFormat) + { + CASE(UNKNOWN); + + CASE(R32G32B32A32_TYPELESS); + CASE(R32G32B32A32_FLOAT); + CASE(R32G32B32A32_UINT); + CASE(R32G32B32A32_SINT); + + CASE(R32G32B32_TYPELESS); + CASE(R32G32B32_FLOAT); + CASE(R32G32B32_UINT); + CASE(R32G32B32_SINT); + + CASE(R16G16B16A16_TYPELESS); + CASE(R16G16B16A16_FLOAT); + CASE(R16G16B16A16_UNORM); + CASE(R16G16B16A16_UINT); + CASE(R16G16B16A16_SNORM); + CASE(R16G16B16A16_SINT); + + CASE(R32G32_TYPELESS); + CASE(R32G32_FLOAT); + CASE(R32G32_UINT); + CASE(R32G32_SINT); + + CASE(R32G8X24_TYPELESS); + CASE(D32_FLOAT_S8X24_UINT); + CASE(R32_FLOAT_X8X24_TYPELESS); + CASE(X32_TYPELESS_G8X24_UINT); + + CASE(R10G10B10A2_TYPELESS); + CASE(R10G10B10A2_UNORM); + CASE(R10G10B10A2_UINT); + + CASE(R11G11B10_FLOAT); + + CASE(R8G8B8A8_TYPELESS); + CASE(R8G8B8A8_UNORM); + CASE(R8G8B8A8_UNORM_SRGB); + CASE(R8G8B8A8_UINT); + CASE(R8G8B8A8_SNORM); + CASE(R8G8B8A8_SINT); + + CASE(R16G16_TYPELESS); + CASE(R16G16_FLOAT); + CASE(R16G16_UNORM); + CASE(R16G16_UINT); + CASE(R16G16_SNORM); + CASE(R16G16_SINT); + + CASE(R32_TYPELESS); + CASE(D32_FLOAT); + CASE(R32_FLOAT); + CASE(R32_UINT); + CASE(R32_SINT); + + CASE(R24G8_TYPELESS); + CASE(D24_UNORM_S8_UINT); + CASE(R24_UNORM_X8_TYPELESS); + CASE(X24_TYPELESS_G8_UINT); + + CASE(R8G8_TYPELESS); + CASE(R8G8_UNORM); + CASE(R8G8_UINT); + CASE(R8G8_SNORM); + CASE(R8G8_SINT); + + CASE(R16_TYPELESS); + CASE(R16_FLOAT); + CASE(D16_UNORM); + CASE(R16_UNORM); + CASE(R16_UINT); + CASE(R16_SNORM); + CASE(R16_SINT); + + CASE(R8_TYPELESS); + CASE(R8_UNORM); + CASE(R8_UINT); + CASE(R8_SNORM); + CASE(R8_SINT); + CASE(A8_UNORM); + + CASE(R1_UNORM); + + CASE(R9G9B9E5_SHAREDEXP); + + CASE(R8G8_B8G8_UNORM); + CASE(G8R8_G8B8_UNORM); + + CASE(BC1_TYPELESS); + CASE(BC1_UNORM); + CASE(BC1_UNORM_SRGB); + + CASE(BC2_TYPELESS); + CASE(BC2_UNORM); + CASE(BC2_UNORM_SRGB); + + CASE(BC3_TYPELESS); + CASE(BC3_UNORM); + CASE(BC3_UNORM_SRGB); + + CASE(BC4_TYPELESS); + CASE(BC4_UNORM); + CASE(BC4_SNORM); + + CASE(BC5_TYPELESS); + CASE(BC5_UNORM); + CASE(BC5_SNORM); + + CASE(B5G6R5_UNORM); + CASE(B5G5R5A1_UNORM); + CASE(B8G8R8A8_UNORM); + CASE(B8G8R8X8_UNORM); + + default: + return "UNKNOWN"; + } +#undef CASE + } + + const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension) + { + switch(resourceDimension) + { + default: + case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN"; + case D3D10_RESOURCE_DIMENSION_BUFFER: return "BUFFER"; + case D3D10_RESOURCE_DIMENSION_TEXTURE1D: return "TEXTURE1D"; + case D3D10_RESOURCE_DIMENSION_TEXTURE2D: return "TEXTURE2D"; + case D3D10_RESOURCE_DIMENSION_TEXTURE3D: return "TEXTURE3D"; + } + } + +} // namespace + +namespace nv +{ + static Stream & operator<< (Stream & s, DDSPixelFormat & pf) + { + nvStaticCheck(sizeof(DDSPixelFormat) == 32); + s << pf.size; + s << pf.flags; + s << pf.fourcc; + s << pf.bitcount; + s << pf.rmask; + s << pf.gmask; + s << pf.bmask; + s << pf.amask; + return s; + } + + static Stream & operator<< (Stream & s, DDSCaps & caps) + { + nvStaticCheck(sizeof(DDSCaps) == 16); + s << caps.caps1; + s << caps.caps2; + s << caps.caps3; + s << caps.caps4; + return s; + } + + static Stream & operator<< (Stream & s, DDSHeader10 & header) + { + nvStaticCheck(sizeof(DDSHeader10) == 20); + s << header.dxgiFormat; + s << header.resourceDimension; + s << header.miscFlag; + s << header.arraySize; + s << header.reserved; + return s; + } + + Stream & operator<< (Stream & s, DDSHeader & header) + { + nvStaticCheck(sizeof(DDSHeader) == 148); + s << header.fourcc; + s << header.size; + s << header.flags; + s << header.height; + s << header.width; + s << header.pitch; + s << header.depth; + s << header.mipmapcount; + s.serialize(header.reserved, 11 * sizeof(uint)); + s << header.pf; + s << header.caps; + s << header.notused; + + if (header.hasDX10Header()) + { + s << header.header10; + } + + return s; + } + +} // nv namespace + +/* Not used! +namespace +{ + struct FormatDescriptor + { + uint format; + uint bitcount; + uint rmask; + uint gmask; + uint bmask; + uint amask; + }; + + static const FormatDescriptor s_d3dFormats[] = + { + { D3DFMT_R8G8B8, 24, 0xFF0000, 0xFF00, 0xFF, 0 }, + { D3DFMT_A8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000 }, // DXGI_FORMAT_B8G8R8A8_UNORM + { D3DFMT_X8R8G8B8, 32, 0xFF0000, 0xFF00, 0xFF, 0 }, // DXGI_FORMAT_B8G8R8X8_UNORM + { D3DFMT_R5G6B5, 16, 0xF800, 0x7E0, 0x1F, 0 }, // DXGI_FORMAT_B5G6R5_UNORM + { D3DFMT_X1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0 }, + { D3DFMT_A1R5G5B5, 16, 0x7C00, 0x3E0, 0x1F, 0x8000 }, // DXGI_FORMAT_B5G5R5A1_UNORM + { D3DFMT_A4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0xF000 }, + { D3DFMT_R3G3B2, 8, 0xE0, 0x1C, 0x3, 0 }, + { D3DFMT_A8, 8, 0, 0, 0, 8 }, // DXGI_FORMAT_A8_UNORM + { D3DFMT_A8R3G3B2, 16, 0xE0, 0x1C, 0x3, 0xFF00 }, + { D3DFMT_X4R4G4B4, 16, 0xF00, 0xF0, 0xF, 0 }, + { D3DFMT_A2B10G10R10, 32, 0x3FF, 0xFFC00, 0x3FF00000, 0xC0000000 }, // DXGI_FORMAT_R10G10B10A2 + { D3DFMT_A8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0xFF000000 }, // DXGI_FORMAT_R8G8B8A8_UNORM + { D3DFMT_X8B8G8R8, 32, 0xFF, 0xFF00, 0xFF0000, 0 }, + { D3DFMT_G16R16, 32, 0xFFFF, 0xFFFF0000, 0, 0 }, // DXGI_FORMAT_R16G16_UNORM + { D3DFMT_A2R10G10B10, 32, 0x3FF00000, 0xFFC00, 0x3FF, 0xC0000000 }, + + { D3DFMT_L8, 8, 8, 0, 0, 0 }, // DXGI_FORMAT_R8_UNORM + { D3DFMT_L16, 16, 16, 0, 0, 0 }, // DXGI_FORMAT_R16_UNORM + }; + + static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]); + + static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) + { + for (int i = 0; i < s_d3dFormatCount; i++) + { + if (s_d3dFormats[i].bitcount == bitcount && + s_d3dFormats[i].rmask == rmask && + s_d3dFormats[i].gmask == gmask && + s_d3dFormats[i].bmask == bmask && + s_d3dFormats[i].amask == amask) + { + return s_d3dFormats[i].format; + } + } + + return 0; + } + +} // nv namespace +*/ + +DDSHeader::DDSHeader() +{ + this->fourcc = FOURCC_DDS; + this->size = 124; + this->flags = (DDSD_CAPS|DDSD_PIXELFORMAT); + this->height = 0; + this->width = 0; + this->pitch = 0; + this->depth = 0; + this->mipmapcount = 0; + memset(this->reserved, 0, sizeof(this->reserved)); + + // Store version information on the reserved header attributes. + this->reserved[9] = MAKEFOURCC('N', 'V', 'T', 'T'); + this->reserved[10] = (2 << 16) | (0 << 8) | (8); // major.minor.revision + + this->pf.size = 32; + this->pf.flags = 0; + this->pf.fourcc = 0; + this->pf.bitcount = 0; + this->pf.rmask = 0; + this->pf.gmask = 0; + this->pf.bmask = 0; + this->pf.amask = 0; + this->caps.caps1 = DDSCAPS_TEXTURE; + this->caps.caps2 = 0; + this->caps.caps3 = 0; + this->caps.caps4 = 0; + this->notused = 0; + + this->header10.dxgiFormat = DXGI_FORMAT_UNKNOWN; + this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_UNKNOWN; + this->header10.miscFlag = 0; + this->header10.arraySize = 0; + this->header10.reserved = 0; +} + +void DDSHeader::setWidth(uint w) +{ + this->flags |= DDSD_WIDTH; + this->width = w; +} + +void DDSHeader::setHeight(uint h) +{ + this->flags |= DDSD_HEIGHT; + this->height = h; +} + +void DDSHeader::setDepth(uint d) +{ + this->flags |= DDSD_DEPTH; + this->height = d; +} + +void DDSHeader::setMipmapCount(uint count) +{ + if (count == 0 || count == 1) + { + this->flags &= ~DDSD_MIPMAPCOUNT; + this->mipmapcount = 0; + + if (this->caps.caps2 == 0) { + this->caps.caps1 = DDSCAPS_TEXTURE; + } + else { + this->caps.caps1 = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX; + } + } + else + { + this->flags |= DDSD_MIPMAPCOUNT; + this->mipmapcount = count; + + this->caps.caps1 |= DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; + } +} + +void DDSHeader::setTexture2D() +{ + this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE2D; +} + +void DDSHeader::setTexture3D() +{ + this->caps.caps2 = DDSCAPS2_VOLUME; + + this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE3D; +} + +void DDSHeader::setTextureCube() +{ + this->caps.caps1 |= DDSCAPS_COMPLEX; + this->caps.caps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALL_FACES; + + this->header10.resourceDimension = D3D10_RESOURCE_DIMENSION_TEXTURE2D; + this->header10.arraySize = 6; +} + +void DDSHeader::setLinearSize(uint size) +{ + this->flags &= ~DDSD_PITCH; + this->flags |= DDSD_LINEARSIZE; + this->pitch = size; +} + +void DDSHeader::setPitch(uint pitch) +{ + this->flags &= ~DDSD_LINEARSIZE; + this->flags |= DDSD_PITCH; + this->pitch = pitch; +} + +void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3) +{ + // set fourcc pixel format. + this->pf.flags = DDPF_FOURCC; + this->pf.fourcc = MAKEFOURCC(c0, c1, c2, c3); + + if (this->pf.fourcc == FOURCC_ATI2) + { + this->pf.bitcount = FOURCC_A2XY; + } + else + { + this->pf.bitcount = 0; + } + + this->pf.rmask = 0; + this->pf.gmask = 0; + this->pf.bmask = 0; + this->pf.amask = 0; +} + +void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) +{ + // Make sure the masks are correct. + nvCheck((rmask & gmask) == 0); + nvCheck((rmask & bmask) == 0); + nvCheck((rmask & amask) == 0); + nvCheck((gmask & bmask) == 0); + nvCheck((gmask & amask) == 0); + nvCheck((bmask & amask) == 0); + + this->pf.flags = DDPF_RGB; + + if (amask != 0) { + this->pf.flags |= DDPF_ALPHAPIXELS; + } + + if (bitcount == 0) + { + // Compute bit count from the masks. + uint total = rmask | gmask | bmask | amask; + while(total != 0) { + bitcount++; + total >>= 1; + } + } + + nvCheck(bitcount > 0 && bitcount <= 32); + + // Align to 8. + if (bitcount <= 8) bitcount = 8; + else if (bitcount <= 16) bitcount = 16; + else if (bitcount <= 24) bitcount = 24; + else bitcount = 32; + + this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask); + this->pf.bitcount = bitcount; + this->pf.rmask = rmask; + this->pf.gmask = gmask; + this->pf.bmask = bmask; + this->pf.amask = amask; +} + +void DDSHeader::setDX10Format(uint format) +{ + //this->pf.flags = 0; + this->pf.fourcc = FOURCC_DX10; + this->header10.dxgiFormat = format; +} + +void DDSHeader::setNormalFlag(bool b) +{ + if (b) this->pf.flags |= DDPF_NORMAL; + else this->pf.flags &= ~DDPF_NORMAL; +} + +void DDSHeader::swapBytes() +{ + this->fourcc = POSH_LittleU32(this->fourcc); + this->size = POSH_LittleU32(this->size); + this->flags = POSH_LittleU32(this->flags); + this->height = POSH_LittleU32(this->height); + this->width = POSH_LittleU32(this->width); + this->pitch = POSH_LittleU32(this->pitch); + this->depth = POSH_LittleU32(this->depth); + this->mipmapcount = POSH_LittleU32(this->mipmapcount); + + for(int i = 0; i < 11; i++) { + this->reserved[i] = POSH_LittleU32(this->reserved[i]); + } + + this->pf.size = POSH_LittleU32(this->pf.size); + this->pf.flags = POSH_LittleU32(this->pf.flags); + this->pf.fourcc = POSH_LittleU32(this->pf.fourcc); + this->pf.bitcount = POSH_LittleU32(this->pf.bitcount); + this->pf.rmask = POSH_LittleU32(this->pf.rmask); + this->pf.gmask = POSH_LittleU32(this->pf.gmask); + this->pf.bmask = POSH_LittleU32(this->pf.bmask); + this->pf.amask = POSH_LittleU32(this->pf.amask); + this->caps.caps1 = POSH_LittleU32(this->caps.caps1); + this->caps.caps2 = POSH_LittleU32(this->caps.caps2); + this->caps.caps3 = POSH_LittleU32(this->caps.caps3); + this->caps.caps4 = POSH_LittleU32(this->caps.caps4); + this->notused = POSH_LittleU32(this->notused); + + this->header10.dxgiFormat = POSH_LittleU32(this->header10.dxgiFormat); + this->header10.resourceDimension = POSH_LittleU32(this->header10.resourceDimension); + this->header10.miscFlag = POSH_LittleU32(this->header10.miscFlag); + this->header10.arraySize = POSH_LittleU32(this->header10.arraySize); + this->header10.reserved = POSH_LittleU32(this->header10.reserved); +} + +bool DDSHeader::hasDX10Header() const +{ + return this->pf.fourcc == FOURCC_DX10; // @@ This is according to AMD + //return this->pf.flags == 0; // @@ This is according to MS +} + + + +DirectDrawSurface::DirectDrawSurface(const char * name) : stream(new StdInputStream(name)) +{ + if (!stream->isError()) + { + (*stream) << header; + } +} + +DirectDrawSurface::~DirectDrawSurface() +{ + delete stream; +} + +bool DirectDrawSurface::isValid() const +{ + if (stream->isError()) + { + return false; + } + + if (header.fourcc != FOURCC_DDS || header.size != 124) + { + return false; + } + + const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/); + if( (header.flags & required) != required ) { + return false; + } + + if (header.pf.size != 32) { + return false; + } + + if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { + return false; + } + + return true; +} + +bool DirectDrawSurface::isSupported() const +{ + nvDebugCheck(isValid()); + + if (header.hasDX10Header()) + { + } + else + { + if (header.pf.flags & DDPF_FOURCC) + { + if (header.pf.fourcc != FOURCC_DXT1 && + header.pf.fourcc != FOURCC_DXT2 && + header.pf.fourcc != FOURCC_DXT3 && + header.pf.fourcc != FOURCC_DXT4 && + header.pf.fourcc != FOURCC_DXT5 && + header.pf.fourcc != FOURCC_RXGB && + header.pf.fourcc != FOURCC_ATI1 && + header.pf.fourcc != FOURCC_ATI2) + { + // Unknown fourcc code. + return false; + } + } + else if (header.pf.flags & DDPF_RGB) + { + // All RGB formats are supported now. + } + else + { + return false; + } + + if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES) + { + // Cubemaps must contain all faces. + return false; + } + + if (isTexture3D()) + { + // @@ 3D textures not supported yet. + return false; + } + } + + return true; +} + + +uint DirectDrawSurface::mipmapCount() const +{ + nvDebugCheck(isValid()); + if (header.flags & DDSD_MIPMAPCOUNT) return header.mipmapcount; + else return 1; +} + + +uint DirectDrawSurface::width() const +{ + nvDebugCheck(isValid()); + if (header.flags & DDSD_WIDTH) return header.width; + else return 1; +} + +uint DirectDrawSurface::height() const +{ + nvDebugCheck(isValid()); + if (header.flags & DDSD_HEIGHT) return header.height; + else return 1; +} + +uint DirectDrawSurface::depth() const +{ + nvDebugCheck(isValid()); + if (header.flags & DDSD_DEPTH) return header.depth; + else return 1; +} + +bool DirectDrawSurface::isTexture1D() const +{ + nvDebugCheck(isValid()); + if (header.hasDX10Header()) + { + return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE1D; + } + return false; +} + +bool DirectDrawSurface::isTexture2D() const +{ + nvDebugCheck(isValid()); + if (header.hasDX10Header()) + { + return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE2D; + } + else + { + return !isTexture3D() && !isTextureCube(); + } +} + +bool DirectDrawSurface::isTexture3D() const +{ + nvDebugCheck(isValid()); + if (header.hasDX10Header()) + { + return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE3D; + } + else + { + return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0; + } +} + +bool DirectDrawSurface::isTextureCube() const +{ + nvDebugCheck(isValid()); + return (header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0; +} + +void DirectDrawSurface::setNormalFlag(bool b) +{ + nvDebugCheck(isValid()); + header.setNormalFlag(b); +} + +void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap) +{ + nvDebugCheck(isValid()); + + stream->seek(offset(face, mipmap)); + + uint w = width(); + uint h = height(); + + // Compute width and height. + for (uint m = 0; m < mipmap; m++) + { + w = max(1U, w / 2); + h = max(1U, h / 2); + } + + img->allocate(w, h); + + if (header.pf.flags & DDPF_RGB) + { + readLinearImage(img); + } + else if (header.pf.flags & DDPF_FOURCC) + { + readBlockImage(img); + } +} + +void DirectDrawSurface::readLinearImage(Image * img) +{ + nvDebugCheck(stream != NULL); + nvDebugCheck(img != NULL); + + const uint w = img->width(); + const uint h = img->height(); + + uint rshift, rsize; + PixelFormat::maskShiftAndSize(header.pf.rmask, &rshift, &rsize); + + uint gshift, gsize; + PixelFormat::maskShiftAndSize(header.pf.gmask, &gshift, &gsize); + + uint bshift, bsize; + PixelFormat::maskShiftAndSize(header.pf.bmask, &bshift, &bsize); + + uint ashift, asize; + PixelFormat::maskShiftAndSize(header.pf.amask, &ashift, &asize); + + uint byteCount = (header.pf.bitcount + 7) / 8; + + // set image format: RGB or ARGB + // alpha channel exists if and only if the alpha mask is non-zero + if (header.pf.amask == 0) + { + img->setFormat(Image::Format_RGB); + } + else + { + img->setFormat(Image::Format_ARGB); + } + + // Read linear RGB images. + for (uint y = 0; y < h; y++) + { + for (uint x = 0; x < w; x++) + { + uint c = 0; + stream->serialize(&c, byteCount); + + Color32 pixel(0, 0, 0, 0xFF); + pixel.r = PixelFormat::convert((c & header.pf.rmask) >> rshift, rsize, 8); + pixel.g = PixelFormat::convert((c & header.pf.gmask) >> gshift, gsize, 8); + pixel.b = PixelFormat::convert((c & header.pf.bmask) >> bshift, bsize, 8); + pixel.a = PixelFormat::convert((c & header.pf.amask) >> ashift, asize, 8); + + img->pixel(x, y) = pixel; + } + } +} + +void DirectDrawSurface::readBlockImage(Image * img) +{ + nvDebugCheck(stream != NULL); + nvDebugCheck(img != NULL); + + // set image format: RGB or ARGB + if (header.pf.fourcc == FOURCC_RXGB || + header.pf.fourcc == FOURCC_ATI1 || + header.pf.fourcc == FOURCC_ATI2 || + header.pf.flags & DDPF_NORMAL) + { + img->setFormat(Image::Format_RGB); + } + else + { + img->setFormat(Image::Format_ARGB); + } + + const uint w = img->width(); + const uint h = img->height(); + + const uint bw = (w + 3) / 4; + const uint bh = (h + 3) / 4; + + for (uint by = 0; by < bh; by++) + { + for (uint bx = 0; bx < bw; bx++) + { + ColorBlock block; + + // Read color block. + readBlock(&block); + + // Write color block. + for (uint y = 0; y < min(4U, h-4*by); y++) + { + for (uint x = 0; x < min(4U, w-4*bx); x++) + { + img->pixel(4*bx+x, 4*by+y) = block.color(x, y); + } + } + } + } +} + +static Color32 buildNormal(uint8 x, uint8 y) +{ + float nx = 2 * (x / 255.0f) - 1; + float ny = 2 * (y / 255.0f) - 1; + float nz = 0.0f; + if (1 - nx*nx - ny*ny > 0) nz = sqrtf(1 - nx*nx - ny*ny); + uint8 z = clamp(int(255.0f * (nz + 1) / 2.0f), 0, 255); + + return Color32(x, y, z); +} + + +void DirectDrawSurface::readBlock(ColorBlock * rgba) +{ + nvDebugCheck(stream != NULL); + nvDebugCheck(rgba != NULL); + + if (header.pf.fourcc == FOURCC_DXT1) + { + BlockDXT1 block; + *stream << block; + block.decodeBlock(rgba); + } + else if (header.pf.fourcc == FOURCC_DXT2 || + header.pf.fourcc == FOURCC_DXT3) + { + BlockDXT3 block; + *stream << block; + block.decodeBlock(rgba); + } + else if (header.pf.fourcc == FOURCC_DXT4 || + header.pf.fourcc == FOURCC_DXT5 || + header.pf.fourcc == FOURCC_RXGB) + { + BlockDXT5 block; + *stream << block; + block.decodeBlock(rgba); + + if (header.pf.fourcc == FOURCC_RXGB) + { + // Swap R & A. + for (int i = 0; i < 16; i++) + { + Color32 & c = rgba->color(i); + uint tmp = c.r; + c.r = c.a; + c.a = tmp; + } + } + } + else if (header.pf.fourcc == FOURCC_ATI1) + { + BlockATI1 block; + *stream << block; + block.decodeBlock(rgba); + } + else if (header.pf.fourcc == FOURCC_ATI2) + { + BlockATI2 block; + *stream << block; + block.decodeBlock(rgba); + } + + // If normal flag set, convert to normal. + if (header.pf.flags & DDPF_NORMAL) + { + if (header.pf.fourcc == FOURCC_ATI2) + { + for (int i = 0; i < 16; i++) + { + Color32 & c = rgba->color(i); + c = buildNormal(c.r, c.g); + } + } + else if (header.pf.fourcc == FOURCC_DXT5) + { + for (int i = 0; i < 16; i++) + { + Color32 & c = rgba->color(i); + c = buildNormal(c.a, c.g); + } + } + } +} + + +uint DirectDrawSurface::blockSize() const +{ + switch(header.pf.fourcc) + { + case FOURCC_DXT1: + case FOURCC_ATI1: + return 8; + case FOURCC_DXT2: + case FOURCC_DXT3: + case FOURCC_DXT4: + case FOURCC_DXT5: + case FOURCC_RXGB: + case FOURCC_ATI2: + return 16; + }; + + // Not a block image. + return 0; +} + +uint DirectDrawSurface::mipmapSize(uint mipmap) const +{ + uint w = width(); + uint h = height(); + uint d = depth(); + + for (uint m = 0; m < mipmap; m++) + { + w = max(1U, w / 2); + h = max(1U, h / 2); + d = max(1U, d / 2); + } + + if (header.pf.flags & DDPF_FOURCC) + { + // @@ How are 3D textures aligned? + w = (w + 3) / 4; + h = (h + 3) / 4; + return blockSize() * w * h; + } + else + { + nvDebugCheck(header.pf.flags & DDPF_RGB); + + // Align pixels to bytes. + uint byteCount = (header.pf.bitcount + 7) / 8; + + // Align pitch to 4 bytes. + uint pitch = 4 * ((w * byteCount + 3) / 4); + + return pitch * h * d; + } +} + +uint DirectDrawSurface::faceSize() const +{ + const uint count = mipmapCount(); + uint size = 0; + + for (uint m = 0; m < count; m++) + { + size += mipmapSize(m); + } + + return size; +} + +uint DirectDrawSurface::offset(const uint face, const uint mipmap) +{ + uint size = 128; // sizeof(DDSHeader); + + if (header.hasDX10Header()) + { + size += 20; // sizeof(DDSHeader10); + } + + if (face != 0) + { + size += face * faceSize(); + } + + for (uint m = 0; m < mipmap; m++) + { + size += mipmapSize(m); + } + + return size; +} + + +void DirectDrawSurface::printInfo() const +{ + printf("Flags: 0x%.8X\n", header.flags); + if (header.flags & DDSD_CAPS) printf("\tDDSD_CAPS\n"); + if (header.flags & DDSD_PIXELFORMAT) printf("\tDDSD_PIXELFORMAT\n"); + if (header.flags & DDSD_WIDTH) printf("\tDDSD_WIDTH\n"); + if (header.flags & DDSD_HEIGHT) printf("\tDDSD_HEIGHT\n"); + if (header.flags & DDSD_DEPTH) printf("\tDDSD_DEPTH\n"); + if (header.flags & DDSD_PITCH) printf("\tDDSD_PITCH\n"); + if (header.flags & DDSD_LINEARSIZE) printf("\tDDSD_LINEARSIZE\n"); + if (header.flags & DDSD_MIPMAPCOUNT) printf("\tDDSD_MIPMAPCOUNT\n"); + + printf("Height: %d\n", header.height); + printf("Width: %d\n", header.width); + printf("Depth: %d\n", header.depth); + if (header.flags & DDSD_PITCH) printf("Pitch: %d\n", header.pitch); + else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %d\n", header.pitch); + printf("Mipmap count: %d\n", header.mipmapcount); + + printf("Pixel Format:\n"); + printf("\tFlags: 0x%.8X\n", header.pf.flags); + if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n"); + if (header.pf.flags & DDPF_FOURCC) printf("\t\tDDPF_FOURCC\n"); + if (header.pf.flags & DDPF_ALPHAPIXELS) printf("\t\tDDPF_ALPHAPIXELS\n"); + if (header.pf.flags & DDPF_ALPHA) printf("\t\tDDPF_ALPHA\n"); + if (header.pf.flags & DDPF_PALETTEINDEXED1) printf("\t\tDDPF_PALETTEINDEXED1\n"); + if (header.pf.flags & DDPF_PALETTEINDEXED2) printf("\t\tDDPF_PALETTEINDEXED2\n"); + if (header.pf.flags & DDPF_PALETTEINDEXED4) printf("\t\tDDPF_PALETTEINDEXED4\n"); + if (header.pf.flags & DDPF_PALETTEINDEXED8) printf("\t\tDDPF_PALETTEINDEXED8\n"); + if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n"); + if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n"); + + printf("\tFourCC: '%c%c%c%c'\n", + ((header.pf.fourcc >> 0) & 0xFF), + ((header.pf.fourcc >> 8) & 0xFF), + ((header.pf.fourcc >> 16) & 0xFF), + ((header.pf.fourcc >> 24) & 0xFF)); + if ((header.pf.fourcc & DDPF_FOURCC) && (header.pf.bitcount != 0)) + { + printf("\tSwizzle: '%c%c%c%c'\n", + (header.pf.bitcount >> 0) & 0xFF, + (header.pf.bitcount >> 8) & 0xFF, + (header.pf.bitcount >> 16) & 0xFF, + (header.pf.bitcount >> 24) & 0xFF); + } + else + { + printf("\tBit count: %d\n", header.pf.bitcount); + } + printf("\tRed mask: 0x%.8X\n", header.pf.rmask); + printf("\tGreen mask: 0x%.8X\n", header.pf.gmask); + printf("\tBlue mask: 0x%.8X\n", header.pf.bmask); + printf("\tAlpha mask: 0x%.8X\n", header.pf.amask); + + printf("Caps:\n"); + printf("\tCaps 1: 0x%.8X\n", header.caps.caps1); + if (header.caps.caps1 & DDSCAPS_COMPLEX) printf("\t\tDDSCAPS_COMPLEX\n"); + if (header.caps.caps1 & DDSCAPS_TEXTURE) printf("\t\tDDSCAPS_TEXTURE\n"); + if (header.caps.caps1 & DDSCAPS_MIPMAP) printf("\t\tDDSCAPS_MIPMAP\n"); + + printf("\tCaps 2: 0x%.8X\n", header.caps.caps2); + if (header.caps.caps2 & DDSCAPS2_VOLUME) printf("\t\tDDSCAPS2_VOLUME\n"); + else if (header.caps.caps2 & DDSCAPS2_CUBEMAP) + { + printf("\t\tDDSCAPS2_CUBEMAP\n"); + if ((header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) == DDSCAPS2_CUBEMAP_ALL_FACES) printf("\t\tDDSCAPS2_CUBEMAP_ALL_FACES\n"); + else { + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEX) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEX\n"); + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEX\n"); + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEY) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEY\n"); + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEY\n"); + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_POSITIVEZ\n"); + if (header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) printf("\t\tDDSCAPS2_CUBEMAP_NEGATIVEZ\n"); + } + } + + printf("\tCaps 3: 0x%.8X\n", header.caps.caps3); + printf("\tCaps 4: 0x%.8X\n", header.caps.caps4); + + if (header.hasDX10Header()) + { + printf("DX10 Header:\n"); + printf("\tDXGI Format: %u (%s)\n", header.header10.dxgiFormat, getDxgiFormatString((DXGI_FORMAT)header.header10.dxgiFormat)); + printf("\tResource dimension: %u (%s)\n", header.header10.resourceDimension, getD3d10ResourceDimensionString((D3D10_RESOURCE_DIMENSION)header.header10.resourceDimension)); + printf("\tMisc flag: %u\n", header.header10.miscFlag); + printf("\tArray size: %u\n", header.header10.arraySize); + } + + if (header.reserved[9] == MAKEFOURCC('N', 'V', 'T', 'T')) + { + int major = (header.reserved[10] >> 16) & 0xFF; + int minor = (header.reserved[10] >> 8) & 0xFF; + int revision= header.reserved[10] & 0xFF; + + printf("Version:\n"); + printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision); + } +} + diff --git a/externals/NVTT/src/nvimage/DirectDrawSurface.h b/externals/NVTT/src/nvimage/DirectDrawSurface.h new file mode 100644 index 00000000..6ea8c4ba --- /dev/null +++ b/externals/NVTT/src/nvimage/DirectDrawSurface.h @@ -0,0 +1,155 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_IMAGE_DIRECTDRAWSURFACE_H +#define NV_IMAGE_DIRECTDRAWSURFACE_H + +#include + +namespace nv +{ + class Image; + class Stream; + struct ColorBlock; + + struct NVIMAGE_CLASS DDSPixelFormat + { + uint size; + uint flags; + uint fourcc; + uint bitcount; + uint rmask; + uint gmask; + uint bmask; + uint amask; + }; + + struct NVIMAGE_CLASS DDSCaps + { + uint caps1; + uint caps2; + uint caps3; + uint caps4; + }; + + /// DDS file header for DX10. + struct NVIMAGE_CLASS DDSHeader10 + { + uint dxgiFormat; + uint resourceDimension; + uint miscFlag; + uint arraySize; + uint reserved; + }; + + /// DDS file header. + struct NVIMAGE_CLASS DDSHeader + { + uint fourcc; + uint size; + uint flags; + uint height; + uint width; + uint pitch; + uint depth; + uint mipmapcount; + uint reserved[11]; + DDSPixelFormat pf; + DDSCaps caps; + uint notused; + DDSHeader10 header10; + + + // Helper methods. + DDSHeader(); + + void setWidth(uint w); + void setHeight(uint h); + void setDepth(uint d); + void setMipmapCount(uint count); + void setTexture2D(); + void setTexture3D(); + void setTextureCube(); + void setLinearSize(uint size); + void setPitch(uint pitch); + void setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3); + void setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask); + void setDX10Format(uint format); + void setNormalFlag(bool b); + + void swapBytes(); + + bool hasDX10Header() const; + }; + + NVIMAGE_API Stream & operator<< (Stream & s, DDSHeader & header); + + + /// DirectDraw Surface. (DDS) + class NVIMAGE_CLASS DirectDrawSurface + { + public: + DirectDrawSurface(const char * file); + ~DirectDrawSurface(); + + bool isValid() const; + bool isSupported() const; + + uint mipmapCount() const; + uint width() const; + uint height() const; + uint depth() const; + bool isTexture1D() const; + bool isTexture2D() const; + bool isTexture3D() const; + bool isTextureCube() const; + + void setNormalFlag(bool b); + + void mipmap(Image * img, uint f, uint m); + // void mipmap(FloatImage * img, uint f, uint m); + + void printInfo() const; + + private: + + uint blockSize() const; + uint faceSize() const; + uint mipmapSize(uint m) const; + + uint offset(uint f, uint m); + + void readLinearImage(Image * img); + void readBlockImage(Image * img); + void readBlock(ColorBlock * rgba); + + + private: + Stream * const stream; + DDSHeader header; + DDSHeader10 header10; + }; + +} // nv namespace + +#endif // NV_IMAGE_DIRECTDRAWSURFACE_H diff --git a/externals/NVTT/src/nvimage/Filter.cpp b/externals/NVTT/src/nvimage/Filter.cpp new file mode 100644 index 00000000..43c9ef72 --- /dev/null +++ b/externals/NVTT/src/nvimage/Filter.cpp @@ -0,0 +1,605 @@ +// This code is in the public domain -- castanyo@yahoo.es + +/** @file Filter.cpp + * @brief Image filters. + * + * Jonathan Blow articles: + * http://number-none.com/product/Mipmapping, Part 1/index.html + * http://number-none.com/product/Mipmapping, Part 2/index.html + * + * References from Thacher Ulrich: + * See _Graphics Gems III_ "General Filtered Image Rescaling", Dale A. Schumacher + * http://tog.acm.org/GraphicsGems/gemsiii/filter.c + * + * References from Paul Heckbert: + * A.V. Oppenheim, R.W. Schafer, Digital Signal Processing, Prentice-Hall, 1975 + * + * R.W. Hamming, Digital Filters, Prentice-Hall, Englewood Cliffs, NJ, 1983 + * + * W.K. Pratt, Digital Image Processing, John Wiley and Sons, 1978 + * + * H.S. Hou, H.C. Andrews, "Cubic Splines for Image Interpolation and + * Digital Filtering", IEEE Trans. Acoustics, Speech, and Signal Proc., + * vol. ASSP-26, no. 6, Dec. 1978, pp. 508-517 + * + * Paul Heckbert's zoom library. + * http://www.xmission.com/~legalize/zoom.html + * + * Reconstruction Filters in Computer Graphics + * http://www.mentallandscape.com/Papers_siggraph88.pdf + * + * More references: + * http://www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf + * http://www.dspguide.com/ch16.htm + */ + +#include "Filter.h" + +#include // Vector4 +#include // swap + +using namespace nv; + +namespace +{ + // Sinc function. + inline static float sincf(const float x) + { + if (fabs(x) < NV_EPSILON) { + //return 1.0; + return 1.0f + x*x*(-1.0f/6.0f + x*x*1.0f/120.0f); + } + else { + return sin(x) / x; + } + } + + // Bessel function of the first kind from Jon Blow's article. + // http://mathworld.wolfram.com/BesselFunctionoftheFirstKind.html + // http://en.wikipedia.org/wiki/Bessel_function + inline static float bessel0(float x) + { + const float EPSILON_RATIO = 1e-6f; + float xh, sum, pow, ds; + int k; + + xh = 0.5f * x; + sum = 1.0f; + pow = 1.0f; + k = 0; + ds = 1.0; + while (ds > sum * EPSILON_RATIO) { + ++k; + pow = pow * (xh / k); + ds = pow * pow; + sum = sum + ds; + } + + return sum; + } + + /*// Alternative bessel function from Paul Heckbert. + static float _bessel0(float x) + { + const float EPSILON_RATIO = 1E-6; + float sum = 1.0f; + float y = x * x / 4.0f; + float t = y; + for(int i = 2; t > EPSILON_RATIO; i++) { + sum += t; + t *= y / float(i * i); + } + return sum; + }*/ + +} // namespace + + +Filter::Filter(float width) : m_width(width) +{ +} + +/*virtual*/ Filter::~Filter() +{ +} + +float Filter::sampleDelta(float x, float scale) const +{ + return evaluate((x + 0.5f)* scale); +} + +float Filter::sampleBox(float x, float scale, int samples) const +{ + float sum = 0; + float isamples = 1.0f / float(samples); + + for(int s = 0; s < samples; s++) + { + float p = (x + (float(s) + 0.5f) * isamples) * scale; + float value = evaluate(p); + sum += value; + } + + return sum * isamples; +} + +float Filter::sampleTriangle(float x, float scale, int samples) const +{ + float sum = 0; + float isamples = 1.0f / float(samples); + + for(int s = 0; s < samples; s++) + { + float offset = (2 * float(s) + 1.0f) * isamples; + float p = (x + offset - 0.5f) * scale; + float value = evaluate(p); + + float weight = offset; + if (weight > 1.0f) weight = 2.0f - weight; + + sum += value * weight; + } + + return 2 * sum * isamples; +} + + + + + +BoxFilter::BoxFilter() : Filter(0.5f) {} +BoxFilter::BoxFilter(float width) : Filter(width) {} + +float BoxFilter::evaluate(float x) const +{ + if (fabs(x) <= m_width) return 1.0f; + else return 0.0f; +} + + +TriangleFilter::TriangleFilter() : Filter(1.0f) {} +TriangleFilter::TriangleFilter(float width) : Filter(width) {} + +float TriangleFilter::evaluate(float x) const +{ + x = fabs(x); + if( x < m_width ) return m_width - x; + return 0.0f; +} + + +QuadraticFilter::QuadraticFilter() : Filter(1.5f) {} + +float QuadraticFilter::evaluate(float x) const +{ + x = fabs(x); + if( x < 0.5f ) return 0.75f - x * x; + if( x < 1.5f ) { + float t = x - 1.5f; + return 0.5f * t * t; + } + return 0.0f; +} + + +CubicFilter::CubicFilter() : Filter(1.0f) {} + +float CubicFilter::evaluate(float x) const +{ + // f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 + x = fabs(x); + if( x < 1.0f ) return((2.0f * x - 3.0f) * x * x + 1.0f); + return 0.0f; +} + + +BSplineFilter::BSplineFilter() : Filter(2.0f) {} + +float BSplineFilter::evaluate(float x) const +{ + x = fabs(x); + if( x < 1.0f ) return (4.0f + x * x * (-6.0f + x * 3.0f)) / 6.0f; + if( x < 2.0f ) { + float t = 2.0f - x; + return t * t * t / 6.0f; + } + return 0.0f; +} + + +MitchellFilter::MitchellFilter() : Filter(2.0f) { setParameters(1.0f/3.0f, 1.0f/3.0f); } + +float MitchellFilter::evaluate(float x) const +{ + x = fabs(x); + if( x < 1.0f ) return p0 + x * x * (p2 + x * p3); + if( x < 2.0f ) return q0 + x * (q1 + x * (q2 + x * q3)); + return 0.0f; +} + +void MitchellFilter::setParameters(float b, float c) +{ + p0 = (6.0f - 2.0f * b) / 6.0f; + p2 = (-18.0f + 12.0f * b + 6.0f * c) / 6.0f; + p3 = (12.0f - 9.0f * b - 6.0f * c) / 6.0f; + q0 = (8.0f * b + 24.0f * c) / 6.0f; + q1 = (-12.0f * b - 48.0f * c) / 6.0f; + q2 = (6.0f * b + 30.0f * c) / 6.0f; + q3 = (-b - 6.0f * c) / 6.0f; +} + + +LanczosFilter::LanczosFilter() : Filter(3.0f) {} + +float LanczosFilter::evaluate(float x) const +{ + x = fabs(x); + if( x < 3.0f ) return sincf(PI * x) * sincf(PI * x / 3.0f); + return 0.0f; +} + + +SincFilter::SincFilter(float w) : Filter(w) {} + +float SincFilter::evaluate(float x) const +{ + return sincf(PI * x); +} + + +KaiserFilter::KaiserFilter(float w) : Filter(w) { setParameters(4.0f, 1.0f); } + +float KaiserFilter::evaluate(float x) const +{ + const float sinc_value = sincf(PI * x * stretch); + const float t = x / m_width; + if ((1 - t * t) >= 0) return sinc_value * bessel0(alpha * sqrtf(1 - t * t)) / bessel0(alpha); + else return 0; +} + +void KaiserFilter::setParameters(float alpha, float stretch) +{ + this->alpha = alpha; + this->stretch = stretch; +} + + + +/// Ctor. +Kernel1::Kernel1(const Filter & f, int iscale, int samples/*= 32*/) +{ + nvDebugCheck(iscale > 1); + nvDebugCheck(samples > 0); + + const float scale = 1.0f / iscale; + + m_width = f.width() * iscale; + m_windowSize = (int)ceilf(2 * m_width); + m_data = new float[m_windowSize]; + + const float offset = float(m_windowSize) / 2; + + float total = 0.0f; + for (int i = 0; i < m_windowSize; i++) + { + const float sample = f.sampleBox(i - offset, scale, samples); + m_data[i] = sample; + total += sample; + } + + const float inv = 1.0f / total; + for (int i = 0; i < m_windowSize; i++) + { + m_data[i] *= inv; + } +} + +/// Dtor. +Kernel1::~Kernel1() +{ + delete m_data; +} + +/// Print the kernel for debugging purposes. +void Kernel1::debugPrint() +{ + for (int i = 0; i < m_windowSize; i++) { + nvDebug("%d: %f\n", i, m_data[i]); + } +} + + + +/// Ctor. +Kernel2::Kernel2(uint ws) : m_windowSize(ws) +{ + m_data = new float[m_windowSize * m_windowSize]; +} + +/// Copy ctor. +Kernel2::Kernel2(const Kernel2 & k) : m_windowSize(k.m_windowSize) +{ + m_data = new float[m_windowSize * m_windowSize]; + for (uint i = 0; i < m_windowSize * m_windowSize; i++) { + m_data[i] = k.m_data[i]; + } +} + + +/// Dtor. +Kernel2::~Kernel2() +{ + delete m_data; +} + +/// Normalize the filter. +void Kernel2::normalize() +{ + float total = 0.0f; + for(uint i = 0; i < m_windowSize*m_windowSize; i++) { + total += fabs(m_data[i]); + } + + float inv = 1.0f / total; + for(uint i = 0; i < m_windowSize*m_windowSize; i++) { + m_data[i] *= inv; + } +} + +/// Transpose the kernel. +void Kernel2::transpose() +{ + for(uint i = 0; i < m_windowSize; i++) { + for(uint j = i+1; j < m_windowSize; j++) { + swap(m_data[i*m_windowSize + j], m_data[j*m_windowSize + i]); + } + } +} + +/// Init laplacian filter, usually used for sharpening. +void Kernel2::initLaplacian() +{ + nvDebugCheck(m_windowSize == 3); +// m_data[0] = -1; m_data[1] = -1; m_data[2] = -1; +// m_data[3] = -1; m_data[4] = +8; m_data[5] = -1; +// m_data[6] = -1; m_data[7] = -1; m_data[8] = -1; + + m_data[0] = +0; m_data[1] = -1; m_data[2] = +0; + m_data[3] = -1; m_data[4] = +4; m_data[5] = -1; + m_data[6] = +0; m_data[7] = -1; m_data[8] = +0; + +// m_data[0] = +1; m_data[1] = -2; m_data[2] = +1; +// m_data[3] = -2; m_data[4] = +4; m_data[5] = -2; +// m_data[6] = +1; m_data[7] = -2; m_data[8] = +1; +} + + +/// Init simple edge detection filter. +void Kernel2::initEdgeDetection() +{ + nvCheck(m_windowSize == 3); + m_data[0] = 0; m_data[1] = 0; m_data[2] = 0; + m_data[3] =-1; m_data[4] = 0; m_data[5] = 1; + m_data[6] = 0; m_data[7] = 0; m_data[8] = 0; +} + +/// Init sobel filter. +void Kernel2::initSobel() +{ + if (m_windowSize == 3) + { + m_data[0] = -1; m_data[1] = 0; m_data[2] = 1; + m_data[3] = -2; m_data[4] = 0; m_data[5] = 2; + m_data[6] = -1; m_data[7] = 0; m_data[8] = 1; + } + else if (m_windowSize == 5) + { + float elements[] = { + -1, -2, 0, 2, 1, + -2, -3, 0, 3, 2, + -3, -4, 0, 4, 3, + -2, -3, 0, 3, 2, + -1, -2, 0, 2, 1 + }; + + for (int i = 0; i < 5*5; i++) { + m_data[i] = elements[i]; + } + } + else if (m_windowSize == 7) + { + float elements[] = { + -1, -2, -3, 0, 3, 2, 1, + -2, -3, -4, 0, 4, 3, 2, + -3, -4, -5, 0, 5, 4, 3, + -4, -5, -6, 0, 6, 5, 4, + -3, -4, -5, 0, 5, 4, 3, + -2, -3, -4, 0, 4, 3, 2, + -1, -2, -3, 0, 3, 2, 1 + }; + + for (int i = 0; i < 7*7; i++) { + m_data[i] = elements[i]; + } + } + else if (m_windowSize == 9) + { + float elements[] = { + -1, -2, -3, -4, 0, 4, 3, 2, 1, + -2, -3, -4, -5, 0, 5, 4, 3, 2, + -3, -4, -5, -6, 0, 6, 5, 4, 3, + -4, -5, -6, -7, 0, 7, 6, 5, 4, + -5, -6, -7, -8, 0, 8, 7, 6, 5, + -4, -5, -6, -7, 0, 7, 6, 5, 4, + -3, -4, -5, -6, 0, 6, 5, 4, 3, + -2, -3, -4, -5, 0, 5, 4, 3, 2, + -1, -2, -3, -4, 0, 4, 3, 2, 1 + }; + + for (int i = 0; i < 9*9; i++) { + m_data[i] = elements[i]; + } + } +} + +/// Init prewitt filter. +void Kernel2::initPrewitt() +{ + if (m_windowSize == 3) + { + m_data[0] = -1; m_data[1] = 0; m_data[2] = -1; + m_data[3] = -1; m_data[4] = 0; m_data[5] = -1; + m_data[6] = -1; m_data[7] = 0; m_data[8] = -1; + } + else if (m_windowSize == 5) + { + // @@ Is this correct? + float elements[] = { + -2, -1, 0, 1, 2, + -2, -1, 0, 1, 2, + -2, -1, 0, 1, 2, + -2, -1, 0, 1, 2, + -2, -1, 0, 1, 2 + }; + + for (int i = 0; i < 5*5; i++) { + m_data[i] = elements[i]; + } + } +} + +/// Init blended sobel filter. +void Kernel2::initBlendedSobel(const Vector4 & scale) +{ + nvCheck(m_windowSize == 9); + + { + const float elements[] = { + -1, -2, -3, -4, 0, 4, 3, 2, 1, + -2, -3, -4, -5, 0, 5, 4, 3, 2, + -3, -4, -5, -6, 0, 6, 5, 4, 3, + -4, -5, -6, -7, 0, 7, 6, 5, 4, + -5, -6, -7, -8, 0, 8, 7, 6, 5, + -4, -5, -6, -7, 0, 7, 6, 5, 4, + -3, -4, -5, -6, 0, 6, 5, 4, 3, + -2, -3, -4, -5, 0, 5, 4, 3, 2, + -1, -2, -3, -4, 0, 4, 3, 2, 1 + }; + + for (int i = 0; i < 9*9; i++) { + m_data[i] = elements[i] * scale.w(); + } + } + { + const float elements[] = { + -1, -2, -3, 0, 3, 2, 1, + -2, -3, -4, 0, 4, 3, 2, + -3, -4, -5, 0, 5, 4, 3, + -4, -5, -6, 0, 6, 5, 4, + -3, -4, -5, 0, 5, 4, 3, + -2, -3, -4, 0, 4, 3, 2, + -1, -2, -3, 0, 3, 2, 1, + }; + + for (int i = 0; i < 7; i++) { + for (int e = 0; e < 7; e++) { + m_data[(i + 1) * 9 + e + 1] += elements[i * 7 + e] * scale.z(); + } + } + } + { + const float elements[] = { + -1, -2, 0, 2, 1, + -2, -3, 0, 3, 2, + -3, -4, 0, 4, 3, + -2, -3, 0, 3, 2, + -1, -2, 0, 2, 1 + }; + + for (int i = 0; i < 5; i++) { + for (int e = 0; e < 5; e++) { + m_data[(i + 2) * 9 + e + 2] += elements[i * 5 + e] * scale.y(); + } + } + } + { + const float elements[] = { + -1, 0, 1, + -2, 0, 2, + -1, 0, 1, + }; + + for (int i = 0; i < 3; i++) { + for (int e = 0; e < 3; e++) { + m_data[(i + 3) * 9 + e + 3] += elements[i * 3 + e] * scale.x(); + } + } + } +} + + +PolyphaseKernel::PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples/*= 32*/) +{ + nvDebugCheck(samples > 0); + + float scale = float(dstLength) / float(srcLength); + const float iscale = 1.0f / scale; + + if (scale > 1) { + // Upsampling. + samples = 1; + scale = 1; + } + + m_length = dstLength; + m_width = f.width() * iscale; + m_windowSize = (int)ceilf(m_width * 2) + 1; + + m_data = new float[m_windowSize * m_length]; + memset(m_data, 0, sizeof(float) * m_windowSize * m_length); + + for (uint i = 0; i < m_length; i++) + { + const float center = (0.5f + i) * iscale; + + const int left = (int)floorf(center - m_width); + const int right = (int)ceilf(center + m_width); + nvDebugCheck(right - left <= m_windowSize); + + float total = 0.0f; + for (int j = 0; j < m_windowSize; j++) + { + const float sample = f.sampleBox(left + j - center, scale, samples); + + m_data[i * m_windowSize + j] = sample; + total += sample; + } + + // normalize weights. + for (int j = 0; j < m_windowSize; j++) + { + m_data[i * m_windowSize + j] /= total; + } + } +} + +PolyphaseKernel::~PolyphaseKernel() +{ + delete [] m_data; +} + + +/// Print the kernel for debugging purposes. +void PolyphaseKernel::debugPrint() const +{ + for (uint i = 0; i < m_length; i++) + { + nvDebug("%d: ", i); + for (int j = 0; j < m_windowSize; j++) + { + nvDebug(" %6.4f", m_data[i * m_windowSize + j]); + } + nvDebug("\n"); + } +} + diff --git a/externals/NVTT/src/nvimage/Filter.h b/externals/NVTT/src/nvimage/Filter.h new file mode 100644 index 00000000..89b56065 --- /dev/null +++ b/externals/NVTT/src/nvimage/Filter.h @@ -0,0 +1,219 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_FILTER_H +#define NV_IMAGE_FILTER_H + +#include +#include + +namespace nv +{ + class Vector4; + + /// Base filter class. + class NVIMAGE_CLASS Filter + { + public: + Filter(float width); + virtual ~Filter(); + + float width() const { return m_width; } + float sampleDelta(float x, float scale) const; + float sampleBox(float x, float scale, int samples) const; + float sampleTriangle(float x, float scale, int samples) const; + + virtual float evaluate(float x) const = 0; + + protected: + const float m_width; + }; + + // Box filter. + class NVIMAGE_CLASS BoxFilter : public Filter + { + public: + BoxFilter(); + BoxFilter(float width); + virtual float evaluate(float x) const; + }; + + // Triangle (bilinear/tent) filter. + class NVIMAGE_CLASS TriangleFilter : public Filter + { + public: + TriangleFilter(); + TriangleFilter(float width); + virtual float evaluate(float x) const; + }; + + // Quadratic (bell) filter. + class NVIMAGE_CLASS QuadraticFilter : public Filter + { + public: + QuadraticFilter(); + virtual float evaluate(float x) const; + }; + + // Cubic filter from Thatcher Ulrich. + class NVIMAGE_CLASS CubicFilter : public Filter + { + public: + CubicFilter(); + virtual float evaluate(float x) const; + }; + + // Cubic b-spline filter from Paul Heckbert. + class NVIMAGE_CLASS BSplineFilter : public Filter + { + public: + BSplineFilter(); + virtual float evaluate(float x) const; + }; + + /// Mitchell & Netravali's two-param cubic + /// @see "Reconstruction Filters in Computer Graphics", SIGGRAPH 88 + class NVIMAGE_CLASS MitchellFilter : public Filter + { + public: + MitchellFilter(); + virtual float evaluate(float x) const; + + void setParameters(float b, float c); + + private: + float p0, p2, p3; + float q0, q1, q2, q3; + }; + + // Lanczos3 filter. + class NVIMAGE_CLASS LanczosFilter : public Filter + { + public: + LanczosFilter(); + virtual float evaluate(float x) const; + }; + + // Sinc filter. + class NVIMAGE_CLASS SincFilter : public Filter + { + public: + SincFilter(float w); + virtual float evaluate(float x) const; + }; + + // Kaiser filter. + class NVIMAGE_CLASS KaiserFilter : public Filter + { + public: + KaiserFilter(float w); + virtual float evaluate(float x) const; + + void setParameters(float a, float stretch); + + private: + float alpha; + float stretch; + }; + + + + /// A 1D kernel. Used to precompute filter weights. + class NVIMAGE_CLASS Kernel1 + { + NV_FORBID_COPY(Kernel1); + public: + Kernel1(const Filter & f, int iscale, int samples = 32); + ~Kernel1(); + + float valueAt(uint x) const { + nvDebugCheck(x < (uint)m_windowSize); + return m_data[x]; + } + + int windowSize() const { + return m_windowSize; + } + + float width() const { + return m_width; + } + + void debugPrint(); + + private: + int m_windowSize; + float m_width; + float * m_data; + }; + + + /// A 2D kernel. + class NVIMAGE_CLASS Kernel2 + { + public: + Kernel2(uint width); + Kernel2(const Kernel2 & k); + ~Kernel2(); + + void normalize(); + void transpose(); + + float valueAt(uint x, uint y) const { + return m_data[y * m_windowSize + x]; + } + + uint windowSize() const { + return m_windowSize; + } + + void initLaplacian(); + void initEdgeDetection(); + void initSobel(); + void initPrewitt(); + + void initBlendedSobel(const Vector4 & scale); + + private: + const uint m_windowSize; + float * m_data; + }; + + + /// A 1D polyphase kernel + class NVIMAGE_CLASS PolyphaseKernel + { + NV_FORBID_COPY(PolyphaseKernel); + public: + PolyphaseKernel(const Filter & f, uint srcLength, uint dstLength, int samples = 32); + ~PolyphaseKernel(); + + int windowSize() const { + return m_windowSize; + } + + uint length() const { + return m_length; + } + + float width() const { + return m_width; + } + + float valueAt(uint column, uint x) const { + nvDebugCheck(column < m_length); + nvDebugCheck(x < (uint)m_windowSize); + return m_data[column * m_windowSize + x]; + } + + void debugPrint() const; + + private: + int m_windowSize; + uint m_length; + float m_width; + float * m_data; + }; + +} // nv namespace + +#endif // NV_IMAGE_FILTER_H diff --git a/externals/NVTT/src/nvimage/FloatImage.cpp b/externals/NVTT/src/nvimage/FloatImage.cpp new file mode 100644 index 00000000..90818cac --- /dev/null +++ b/externals/NVTT/src/nvimage/FloatImage.cpp @@ -0,0 +1,909 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include "FloatImage.h" +#include "Filter.h" +#include "Image.h" + +#include +#include + +#include +#include + +#include + + +using namespace nv; + +namespace +{ + static int iround(float f) + { + return int(f); + } + + static int ifloor(float f) + { + return int(floor(f)); + } + + static float frac(float f) + { + return f - floor(f); + } + + static int mirror(int x, int w) + { + x = abs(x); + while (x >= w) { + x = 2 * w - x - 2; + } + return x; + } +} + + +/// Ctor. +FloatImage::FloatImage() : m_width(0), m_height(0), + m_componentNum(0), m_count(0), m_mem(NULL) +{ +} + +/// Ctor. Init from image. +FloatImage::FloatImage(const Image * img) : m_width(0), m_height(0), + m_componentNum(0), m_count(0), m_mem(NULL) +{ + initFrom(img); +} + +/// Dtor. +FloatImage::~FloatImage() +{ + free(); +} + + +/// Init the floating point image from a regular image. +void FloatImage::initFrom(const Image * img) +{ + nvCheck(img != NULL); + + allocate(4, img->width(), img->height()); + + float * red_channel = channel(0); + float * green_channel = channel(1); + float * blue_channel = channel(2); + float * alpha_channel = channel(3); + + const uint count = m_width * m_height; + for(uint i = 0; i < count; i++) { + Color32 pixel = img->pixel(i); + red_channel[i] = float(pixel.r) / 255.0f; + green_channel[i] = float(pixel.g) / 255.0f; + blue_channel[i] = float(pixel.b) / 255.0f; + alpha_channel[i] = float(pixel.a) / 255.0f; + } +} + +/// Convert the floating point image to a regular image. +Image * FloatImage::createImage(uint base_component/*= 0*/, uint num/*= 4*/) const +{ + nvCheck(num <= 4); + nvCheck(base_component + num <= m_componentNum); + + AutoPtr img(new Image()); + img->allocate(m_width, m_height); + + const uint size = m_width * m_height; + for(uint i = 0; i < size; i++) { + + uint c; + uint8 rgba[4]= {0, 0, 0, 0xff}; + + for(c = 0; c < num; c++) { + float f = m_mem[size * (base_component + c) + i]; + rgba[c] = nv::clamp(int(255.0f * f), 0, 255); + } + + img->pixel(i) = Color32(rgba[0], rgba[1], rgba[2], rgba[3]); + } + + return img.release(); +} + + +/// Convert the floating point image to a regular image. Correct gamma of rgb, but not alpha. +Image * FloatImage::createImageGammaCorrect(float gamma/*= 2.2f*/) const +{ + nvCheck(m_componentNum == 4); + + AutoPtr img(new Image()); + img->allocate(m_width, m_height); + + const float * rChannel = this->channel(0); + const float * gChannel = this->channel(1); + const float * bChannel = this->channel(2); + const float * aChannel = this->channel(3); + + const uint size = m_width * m_height; + for(uint i = 0; i < size; i++) + { + const uint8 r = nv::clamp(int(255.0f * pow(rChannel[i], 1.0f/gamma)), 0, 255); + const uint8 g = nv::clamp(int(255.0f * pow(gChannel[i], 1.0f/gamma)), 0, 255); + const uint8 b = nv::clamp(int(255.0f * pow(bChannel[i], 1.0f/gamma)), 0, 255); + const uint8 a = nv::clamp(int(255.0f * aChannel[i]), 0, 255); + + img->pixel(i) = Color32(r, g, b, a); + } + + return img.release(); +} + +/// Allocate a 2d float image of the given format and the given extents. +void FloatImage::allocate(uint c, uint w, uint h) +{ + free(); + + m_width = w; + m_height = h; + m_componentNum = c; + m_count = w * h * c; + m_mem = reinterpret_cast(nv::mem::malloc(m_count * sizeof(float))); +} + +/// Free the image, but don't clear the members. +void FloatImage::free() +{ + nv::mem::free( reinterpret_cast(m_mem) ); + m_mem = NULL; +} + +void FloatImage::clear(float f/*=0.0f*/) +{ + for(uint i = 0; i < m_count; i++) { + m_mem[i] = f; + } +} + +void FloatImage::normalize(uint base_component) +{ + nvCheck(base_component + 3 <= m_componentNum); + + float * xChannel = this->channel(base_component + 0); + float * yChannel = this->channel(base_component + 1); + float * zChannel = this->channel(base_component + 2); + + const uint size = m_width * m_height; + for(uint i = 0; i < size; i++) { + + Vector3 normal(xChannel[i], yChannel[i], zChannel[i]); + normal = normalizeSafe(normal, Vector3(zero), 0.0f); + + xChannel[i] = normal.x(); + yChannel[i] = normal.y(); + zChannel[i] = normal.z(); + } +} + +void FloatImage::packNormals(uint base_component) +{ + scaleBias(base_component, 3, 0.5f, 1.0f); +} + +void FloatImage::expandNormals(uint base_component) +{ + scaleBias(base_component, 3, 2, -0.5); +} + +void FloatImage::scaleBias(uint base_component, uint num, float scale, float bias) +{ + const uint size = m_width * m_height; + + for(uint c = 0; c < num; c++) { + float * ptr = this->channel(base_component + c); + + for(uint i = 0; i < size; i++) { + ptr[i] = scale * (ptr[i] + bias); + } + } +} + +/// Clamp the elements of the image. +void FloatImage::clamp(float low, float high) +{ + for(uint i = 0; i < m_count; i++) { + m_mem[i] = nv::clamp(m_mem[i], low, high); + } +} + +/// From gamma to linear space. +void FloatImage::toLinear(uint base_component, uint num, float gamma /*= 2.2f*/) +{ + exponentiate(base_component, num, gamma); +} + +/// From linear to gamma space. +void FloatImage::toGamma(uint base_component, uint num, float gamma /*= 2.2f*/) +{ + exponentiate(base_component, num, 1.0f/gamma); +} + +/// Exponentiate the elements of the image. +void FloatImage::exponentiate(uint base_component, uint num, float power) +{ + const uint size = m_width * m_height; + + for(uint c = 0; c < num; c++) { + float * ptr = this->channel(base_component + c); + + for(uint i = 0; i < size; i++) { + ptr[i] = pow(ptr[i], power); + } + } +} + +float FloatImage::sampleNearest(const float x, const float y, const int c, const WrapMode wm) const +{ + if( wm == WrapMode_Clamp ) return sampleNearestClamp(x, y, c); + else if( wm == WrapMode_Repeat ) return sampleNearestRepeat(x, y, c); + else /*if( wm == WrapMode_Mirror )*/ return sampleNearestMirror(x, y, c); +} + +float FloatImage::sampleLinear(const float x, const float y, const int c, const WrapMode wm) const +{ + if( wm == WrapMode_Clamp ) return sampleLinearClamp(x, y, c); + else if( wm == WrapMode_Repeat ) return sampleLinearRepeat(x, y, c); + else /*if( wm == WrapMode_Mirror )*/ return sampleLinearMirror(x, y, c); +} + +float FloatImage::sampleNearestClamp(const float x, const float y, const int c) const +{ + int ix = ::clamp(iround(x * m_width), 0, m_width-1); + int iy = ::clamp(iround(y * m_height), 0, m_height-1); + return pixel(ix, iy, c); +} + +float FloatImage::sampleNearestRepeat(const float x, const float y, const int c) const +{ + int ix = iround(frac(x) * m_width); + int iy = iround(frac(y) * m_height); + return pixel(ix, iy, c); +} + +float FloatImage::sampleNearestMirror(const float x, const float y, const int c) const +{ + int ix = mirror(iround(x * m_width), m_width); + int iy = mirror(iround(y * m_height), m_height); + return pixel(ix, iy, c); +} + +float FloatImage::sampleLinearClamp(float x, float y, const int c) const +{ + const int w = m_width; + const int h = m_height; + + x *= w; + y *= h; + + const float fracX = frac(x); + const float fracY = frac(y); + + const int ix0 = ::clamp(ifloor(x), 0, w-1); + const int iy0 = ::clamp(ifloor(y), 0, h-1); + const int ix1 = ::clamp(ifloor(x)+1, 0, w-1); + const int iy1 = ::clamp(ifloor(y)+1, 0, h-1); + + float f1 = pixel(ix0, iy0, c); + float f2 = pixel(ix1, iy0, c); + float f3 = pixel(ix0, iy1, c); + float f4 = pixel(ix1, iy1, c); + + float i1 = lerp(f1, f2, fracX); + float i2 = lerp(f3, f4, fracX); + + return lerp(i1, i2, fracY); +} + +float FloatImage::sampleLinearRepeat(float x, float y, int c) const +{ + const int w = m_width; + const int h = m_height; + + const float fracX = frac(x * w); + const float fracY = frac(y * h); + + int ix0 = ifloor(frac(x) * w); + int iy0 = ifloor(frac(y) * h); + int ix1 = ifloor(frac(x + 1.0f/w) * w); + int iy1 = ifloor(frac(y + 1.0f/h) * h); + + float f1 = pixel(ix0, iy0, c); + float f2 = pixel(ix1, iy0, c); + float f3 = pixel(ix0, iy1, c); + float f4 = pixel(ix1, iy1, c); + + float i1 = lerp(f1, f2, fracX); + float i2 = lerp(f3, f4, fracX); + + return lerp(i1, i2, fracY); +} + +float FloatImage::sampleLinearMirror(float x, float y, int c) const +{ + const int w = m_width; + const int h = m_height; + + x *= w; + y *= h; + + const float fracX = frac(x); + const float fracY = frac(y); + + int ix0 = mirror(iround(x), w); + int iy0 = mirror(iround(y), h); + int ix1 = mirror(iround(x) + 1, w); + int iy1 = mirror(iround(y) + 1, h); + + float f1 = pixel(ix0, iy0, c); + float f2 = pixel(ix1, iy0, c); + float f3 = pixel(ix0, iy1, c); + float f4 = pixel(ix1, iy1, c); + + float i1 = lerp(f1, f2, fracX); + float i2 = lerp(f3, f4, fracX); + + return lerp(i1, i2, fracY); +} + + +/// Fast downsampling using box filter. +/// +/// The extents of the image are divided by two and rounded down. +/// +/// When the size of the image is odd, this uses a polyphase box filter as explained in: +/// http://developer.nvidia.com/object/np2_mipmapping.html +/// +FloatImage * FloatImage::fastDownSample() const +{ + nvDebugCheck(m_width != 1 || m_height != 1); + + AutoPtr dst_image( new FloatImage() ); + + const uint w = max(1, m_width / 2); + const uint h = max(1, m_height / 2); + dst_image->allocate(m_componentNum, w, h); + + // 1D box filter. + if (m_width == 1 || m_height == 1) + { + const uint n = w * h; + + if ((m_width * m_height) & 1) + { + const float scale = 1.0f / (2 * n + 1); + + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint x = 0; x < n; x++) + { + const float w0 = float(n - x); + const float w1 = float(n - 0); + const float w2 = float(1 + x); + + *dst++ = scale * (w0 * src[0] + w1 * src[1] + w2 * src[2]); + src += 2; + } + } + } + else + { + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint x = 0; x < n; x++) + { + *dst = 0.5f * (src[0] + src[1]); + dst++; + src += 2; + } + } + } + } + + // Regular box filter. + else if ((m_width & 1) == 0 && (m_height & 1) == 0) + { + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint y = 0; y < h; y++) + { + for(uint x = 0; x < w; x++) + { + *dst = 0.25f * (src[0] + src[1] + src[m_width] + src[m_width + 1]); + dst++; + src += 2; + } + + src += m_width; + } + } + } + + // Polyphase filters. + else if (m_width & 1 && m_height & 1) + { + nvDebugCheck(m_width == 2 * w + 1); + nvDebugCheck(m_height == 2 * h + 1); + + const float scale = 1.0f / (m_width * m_height); + + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint y = 0; y < h; y++) + { + const float v0 = float(h - y); + const float v1 = float(h - 0); + const float v2 = float(1 + y); + + for (uint x = 0; x < w; x++) + { + const float w0 = float(w - x); + const float w1 = float(w - 0); + const float w2 = float(1 + x); + + float f = 0.0f; + f += v0 * (w0 * src[0 * m_width + 2 * x] + w1 * src[0 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]); + f += v1 * (w0 * src[1 * m_width + 2 * x] + w1 * src[1 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]); + f += v2 * (w0 * src[2 * m_width + 2 * x] + w1 * src[2 * m_width + 2 * x + 1] + w2 * src[0 * m_width + 2 * x + 2]); + + *dst = f * scale; + dst++; + } + + src += 2 * m_width; + } + } + } + else if (m_width & 1) + { + nvDebugCheck(m_width == 2 * w + 1); + const float scale = 1.0f / (2 * m_width); + + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint y = 0; y < h; y++) + { + for (uint x = 0; x < w; x++) + { + const float w0 = float(w - x); + const float w1 = float(w - 0); + const float w2 = float(1 + x); + + float f = 0.0f; + f += w0 * (src[2 * x + 0] + src[m_width + 2 * x + 0]); + f += w1 * (src[2 * x + 1] + src[m_width + 2 * x + 1]); + f += w2 * (src[2 * x + 2] + src[m_width + 2 * x + 2]); + + *dst = f * scale; + dst++; + } + + src += 2 * m_width; + } + } + } + else if (m_height & 1) + { + nvDebugCheck(m_height == 2 * h + 1); + + const float scale = 1.0f / (2 * m_height); + + for(uint c = 0; c < m_componentNum; c++) + { + const float * src = this->channel(c); + float * dst = dst_image->channel(c); + + for(uint y = 0; y < h; y++) + { + const float v0 = float(h - y); + const float v1 = float(h - 0); + const float v2 = float(1 + y); + + for (uint x = 0; x < w; x++) + { + float f = 0.0f; + f += v0 * (src[0 * m_width + 2 * x] + src[0 * m_width + 2 * x + 1]); + f += v1 * (src[1 * m_width + 2 * x] + src[1 * m_width + 2 * x + 1]); + f += v2 * (src[2 * m_width + 2 * x] + src[2 * m_width + 2 * x + 1]); + + *dst = f * scale; + dst++; + } + + src += 2 * m_width; + } + } + } + + return dst_image.release(); +} + +/// Downsample applying a 1D kernel separately in each dimension. +FloatImage * FloatImage::downSample(const Filter & filter, WrapMode wm) const +{ + const uint w = max(1, m_width / 2); + const uint h = max(1, m_height / 2); + + return resize(filter, w, h, wm); +} + +/// Downsample applying a 1D kernel separately in each dimension. +FloatImage * FloatImage::downSample(const Filter & filter, WrapMode wm, uint alpha) const +{ + const uint w = max(1, m_width / 2); + const uint h = max(1, m_height / 2); + + return resize(filter, w, h, wm, alpha); +} + + +/// Downsample applying a 1D kernel separately in each dimension. +FloatImage * FloatImage::resize(const Filter & filter, uint w, uint h, WrapMode wm) const +{ + // @@ Use monophase filters when frac(m_width / w) == 0 + + AutoPtr tmp_image( new FloatImage() ); + AutoPtr dst_image( new FloatImage() ); + + PolyphaseKernel xkernel(filter, m_width, w, 32); + PolyphaseKernel ykernel(filter, m_height, h, 32); + + // @@ Select fastest filtering order: + //if (w * m_height <= h * m_width) + { + tmp_image->allocate(m_componentNum, w, m_height); + dst_image->allocate(m_componentNum, w, h); + + Array tmp_column(h); + tmp_column.resize(h); + + for (uint c = 0; c < m_componentNum; c++) + { + float * tmp_channel = tmp_image->channel(c); + + for (uint y = 0; y < m_height; y++) { + this->applyKernelHorizontal(xkernel, y, c, wm, tmp_channel + y * w); + } + + float * dst_channel = dst_image->channel(c); + + for (uint x = 0; x < w; x++) { + tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.unsecureBuffer()); + + for (uint y = 0; y < h; y++) { + dst_channel[y * w + x] = tmp_column[y]; + } + } + } + } + /*else + { + tmp_image->allocate(m_componentNum, m_width, h); + dst_image->allocate(m_componentNum, w, h); + + Array tmp_column(h); + tmp_column.resize(h); + + for (uint c = 0; c < m_componentNum; c++) + { + float * tmp_channel = tmp_image->channel(c); + + for (uint x = 0; x < w; x++) { + tmp_image->applyKernelVertical(ykernel, x, c, wm, tmp_column.unsecureBuffer()); + + for (uint y = 0; y < h; y++) { + tmp_channel[y * w + x] = tmp_column[y]; + } + } + + float * dst_channel = dst_image->channel(c); + + for (uint y = 0; y < m_height; y++) { + this->applyKernelHorizontal(xkernel, y, c, wm, dst_channel + y * w); + } + } + }*/ + + return dst_image.release(); +} + +/// Downsample applying a 1D kernel separately in each dimension. +FloatImage * FloatImage::resize(const Filter & filter, uint w, uint h, WrapMode wm, uint alpha) const +{ + nvCheck(alpha < m_componentNum); + + AutoPtr tmp_image( new FloatImage() ); + AutoPtr dst_image( new FloatImage() ); + + PolyphaseKernel xkernel(filter, m_width, w, 32); + PolyphaseKernel ykernel(filter, m_height, h, 32); + + { + tmp_image->allocate(m_componentNum, w, m_height); + dst_image->allocate(m_componentNum, w, h); + + Array tmp_column(h); + tmp_column.resize(h); + + for (uint c = 0; c < m_componentNum; c++) + { + float * tmp_channel = tmp_image->channel(c); + + for (uint y = 0; y < m_height; y++) { + this->applyKernelHorizontal(xkernel, y, c, alpha, wm, tmp_channel + y * w); + } + } + + // Process all channels before applying vertical kernel to make sure alpha has been computed. + + for (uint c = 0; c < m_componentNum; c++) + { + float * dst_channel = dst_image->channel(c); + + for (uint x = 0; x < w; x++) { + tmp_image->applyKernelVertical(ykernel, x, c, alpha, wm, tmp_column.unsecureBuffer()); + + for (uint y = 0; y < h; y++) { + dst_channel[y * w + x] = tmp_column[y]; + } + } + } + } + + return dst_image.release(); +} + + + +/// Apply 2D kernel at the given coordinates and return result. +float FloatImage::applyKernel(const Kernel2 * k, int x, int y, uint c, WrapMode wm) const +{ + nvDebugCheck(k != NULL); + + const uint kernelWindow = k->windowSize(); + const int kernelOffset = int(kernelWindow / 2) - 1; + + const float * channel = this->channel(c); + + float sum = 0.0f; + for (uint i = 0; i < kernelWindow; i++) + { + const int src_y = int(y + i) - kernelOffset; + + for (uint e = 0; e < kernelWindow; e++) + { + const int src_x = int(x + e) - kernelOffset; + + int idx = this->index(src_x, src_y, wm); + + sum += k->valueAt(e, i) * channel[idx]; + } + } + + return sum; +} + + +/// Apply 1D vertical kernel at the given coordinates and return result. +float FloatImage::applyKernelVertical(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const +{ + nvDebugCheck(k != NULL); + + const uint kernelWindow = k->windowSize(); + const int kernelOffset = int(kernelWindow / 2) - 1; + + const float * channel = this->channel(c); + + float sum = 0.0f; + for (uint i = 0; i < kernelWindow; i++) + { + const int src_y = int(y + i) - kernelOffset; + const int idx = this->index(x, src_y, wm); + + sum += k->valueAt(i) * channel[idx]; + } + + return sum; +} + +/// Apply 1D horizontal kernel at the given coordinates and return result. +float FloatImage::applyKernelHorizontal(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const +{ + nvDebugCheck(k != NULL); + + const uint kernelWindow = k->windowSize(); + const int kernelOffset = int(kernelWindow / 2) - 1; + + const float * channel = this->channel(c); + + float sum = 0.0f; + for (uint e = 0; e < kernelWindow; e++) + { + const int src_x = int(x + e) - kernelOffset; + const int idx = this->index(src_x, y, wm); + + sum += k->valueAt(e) * channel[idx]; + } + + return sum; +} + + +/// Apply 1D vertical kernel at the given coordinates and return result. +void FloatImage::applyKernelVertical(const PolyphaseKernel & k, int x, uint c, WrapMode wm, float * __restrict output) const +{ + const uint length = k.length(); + const float scale = float(length) / float(m_height); + const float iscale = 1.0f / scale; + + const float width = k.width(); + const int windowSize = k.windowSize(); + + const float * channel = this->channel(c); + + for (uint i = 0; i < length; i++) + { + const float center = (0.5f + i) * iscale; + + const int left = (int)floorf(center - width); + const int right = (int)ceilf(center + width); + nvCheck(right - left <= windowSize); + + float sum = 0; + for (int j = 0; j < windowSize; ++j) + { + const int idx = this->index(x, j+left, wm); + + sum += k.valueAt(i, j) * channel[idx]; + } + + output[i] = sum; + } +} + +/// Apply 1D horizontal kernel at the given coordinates and return result. +void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, WrapMode wm, float * __restrict output) const +{ + const uint length = k.length(); + const float scale = float(length) / float(m_width); + const float iscale = 1.0f / scale; + + const float width = k.width(); + const int windowSize = k.windowSize(); + + const float * channel = this->channel(c); + + for (uint i = 0; i < length; i++) + { + const float center = (0.5f + i) * iscale; + + const int left = (int)floorf(center - width); + const int right = (int)ceilf(center + width); + nvDebugCheck(right - left <= windowSize); + + float sum = 0; + for (int j = 0; j < windowSize; ++j) + { + const int idx = this->index(left + j, y, wm); + + sum += k.valueAt(i, j) * channel[idx]; + } + + output[i] = sum; + } +} + + +/// Apply 1D vertical kernel at the given coordinates and return result. +void FloatImage::applyKernelVertical(const PolyphaseKernel & k, int x, uint c, uint a, WrapMode wm, float * __restrict output) const +{ + const uint length = k.length(); + const float scale = float(length) / float(m_height); + const float iscale = 1.0f / scale; + + const float width = k.width(); + const int windowSize = k.windowSize(); + + const float * channel = this->channel(c); + const float * alpha = this->channel(a); + + for (uint i = 0; i < length; i++) + { + const float center = (0.5f + i) * iscale; + + const int left = (int)floorf(center - width); + const int right = (int)ceilf(center + width); + nvCheck(right - left <= windowSize); + + float norm = 0; + float sum = 0; + for (int j = 0; j < windowSize; ++j) + { + const int idx = this->index(x, j+left, wm); + + float w = k.valueAt(i, j) * (alpha[idx] + (1.0f / 256.0f)); + norm += w; + sum += w * channel[idx]; + } + + output[i] = sum / norm; + } +} + +/// Apply 1D horizontal kernel at the given coordinates and return result. +void FloatImage::applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, uint a, WrapMode wm, float * __restrict output) const +{ + const uint length = k.length(); + const float scale = float(length) / float(m_width); + const float iscale = 1.0f / scale; + + const float width = k.width(); + const int windowSize = k.windowSize(); + + const float * channel = this->channel(c); + const float * alpha = this->channel(a); + + for (uint i = 0; i < length; i++) + { + const float center = (0.5f + i) * iscale; + + const int left = (int)floorf(center - width); + const int right = (int)ceilf(center + width); + nvDebugCheck(right - left <= windowSize); + + float norm = 0.0f; + float sum = 0; + for (int j = 0; j < windowSize; ++j) + { + const int idx = this->index(left + j, y, wm); + + float w = k.valueAt(i, j) * (alpha[idx] + (1.0f / 256.0f)); + norm += w; + sum += w * channel[idx]; + } + + output[i] = sum / norm; + } +} + +FloatImage* FloatImage::clone() const +{ + FloatImage* copy = new FloatImage(); + copy->m_width = m_width; + copy->m_height = m_height; + copy->m_componentNum = m_componentNum; + copy->m_count = m_count; + + if(m_mem) + { + copy->allocate(m_componentNum, m_width, m_height); + memcpy(copy->m_mem, m_mem, m_count * sizeof(float)); + } + + return copy; +} + diff --git a/externals/NVTT/src/nvimage/FloatImage.h b/externals/NVTT/src/nvimage/FloatImage.h new file mode 100644 index 00000000..96d1630f --- /dev/null +++ b/externals/NVTT/src/nvimage/FloatImage.h @@ -0,0 +1,270 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_FLOATIMAGE_H +#define NV_IMAGE_FLOATIMAGE_H + +#include + +#include + +#include +#include // clamp + +#include // abs + + +namespace nv +{ +class Vector4; +class Matrix; +class Image; +class Filter; +class Kernel1; +class Kernel2; +class PolyphaseKernel; + +/// Multicomponent floating point image class. +class FloatImage +{ +public: + + enum WrapMode { + WrapMode_Clamp, + WrapMode_Repeat, + WrapMode_Mirror + }; + + NVIMAGE_API FloatImage(); + NVIMAGE_API FloatImage(const Image * img); + NVIMAGE_API virtual ~FloatImage(); + + /** @name Conversion. */ + //@{ + NVIMAGE_API void initFrom(const Image * img); + NVIMAGE_API Image * createImage(uint base_component = 0, uint num = 4) const; + NVIMAGE_API Image * createImageGammaCorrect(float gamma = 2.2f) const; + //@} + + /** @name Allocation. */ + //@{ + NVIMAGE_API void allocate(uint c, uint w, uint h); + NVIMAGE_API void free(); // Does not clear members. + //@} + + /** @name Manipulation. */ + //@{ + NVIMAGE_API void clear(float f=0.0f); + + NVIMAGE_API void normalize(uint base_component); + + NVIMAGE_API void packNormals(uint base_component); + NVIMAGE_API void expandNormals(uint base_component); + NVIMAGE_API void scaleBias(uint base_component, uint num, float scale, float add); + + //NVIMAGE_API void clamp(uint base_component, uint num); + NVIMAGE_API void clamp(float low, float high); + + NVIMAGE_API void toLinear(uint base_component, uint num, float gamma = 2.2f); + NVIMAGE_API void toGamma(uint base_component, uint num, float gamma = 2.2f); + NVIMAGE_API void exponentiate(uint base_component, uint num, float power); + + + NVIMAGE_API FloatImage * fastDownSample() const; + NVIMAGE_API FloatImage * downSample(const Filter & filter, WrapMode wm) const; + NVIMAGE_API FloatImage * downSample(const Filter & filter, WrapMode wm, uint alpha) const; + NVIMAGE_API FloatImage * resize(const Filter & filter, uint w, uint h, WrapMode wm) const; + + NVIMAGE_API FloatImage * resize(const Filter & filter, uint w, uint h, WrapMode wm, uint alpha) const; + //@} + + NVIMAGE_API float applyKernel(const Kernel2 * k, int x, int y, uint c, WrapMode wm) const; + NVIMAGE_API float applyKernelVertical(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const; + NVIMAGE_API float applyKernelHorizontal(const Kernel1 * k, int x, int y, uint c, WrapMode wm) const; + NVIMAGE_API void applyKernelVertical(const PolyphaseKernel & k, int x, uint c, WrapMode wm, float * output) const; + NVIMAGE_API void applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, WrapMode wm, float * output) const; + NVIMAGE_API void applyKernelVertical(const PolyphaseKernel & k, int x, uint c, uint a, WrapMode wm, float * output) const; + NVIMAGE_API void applyKernelHorizontal(const PolyphaseKernel & k, int y, uint c, uint a, WrapMode wm, float * output) const; + + + uint width() const { return m_width; } + uint height() const { return m_height; } + uint componentNum() const { return m_componentNum; } + uint count() const { return m_count; } + + + /** @name Pixel access. */ + //@{ + const float * channel(uint c) const; + float * channel(uint c); + + const float * scanline(uint y, uint c) const; + float * scanline(uint y, uint c); + + void setPixel(float f, uint x, uint y, uint c); + void addPixel(float f, uint x, uint y, uint c); + float pixel(uint x, uint y, uint c) const; + + void setPixel(float f, uint idx); + float pixel(uint idx) const; + + float sampleNearest(float x, float y, int c, WrapMode wm) const; + float sampleLinear(float x, float y, int c, WrapMode wm) const; + + float sampleNearestClamp(float x, float y, int c) const; + float sampleNearestRepeat(float x, float y, int c) const; + float sampleNearestMirror(float x, float y, int c) const; + + float sampleLinearClamp(float x, float y, int c) const; + float sampleLinearRepeat(float x, float y, int c) const; + float sampleLinearMirror(float x, float y, int c) const; + //@} + + + FloatImage* clone() const; + +public: + + uint index(uint x, uint y) const; + uint indexClamp(int x, int y) const; + uint indexRepeat(int x, int y) const; + uint indexMirror(int x, int y) const; + uint index(int x, int y, WrapMode wm) const; + +public: + + uint16 m_width; ///< Width of the texture. + uint16 m_height; ///< Height of the texture. + uint32 m_componentNum; ///< Number of components. + uint32 m_count; ///< Image pixel count. + float * m_mem; + +}; + + +/// Get const channel pointer. +inline const float * FloatImage::channel(uint c) const +{ + nvDebugCheck(m_mem != NULL); + nvDebugCheck(c < m_componentNum); + return m_mem + c * m_width * m_height; +} + +/// Get channel pointer. +inline float * FloatImage::channel(uint c) { + nvDebugCheck(m_mem != NULL); + nvDebugCheck(c < m_componentNum); + return m_mem + c * m_width * m_height; +} + +/// Get const scanline pointer. +inline const float * FloatImage::scanline(uint y, uint c) const +{ + nvDebugCheck(y < m_height); + return channel(c) + y * m_width; +} + +/// Get scanline pointer. +inline float * FloatImage::scanline(uint y, uint c) +{ + nvDebugCheck(y < m_height); + return channel(c) + y * m_width; +} + +/// Set pixel component. +inline void FloatImage::setPixel(float f, uint x, uint y, uint c) +{ + nvDebugCheck(m_mem != NULL); + nvDebugCheck(x < m_width); + nvDebugCheck(y < m_height); + nvDebugCheck(c < m_componentNum); + m_mem[(c * m_height + y) * m_width + x] = f; +} + +/// Add to pixel component. +inline void FloatImage::addPixel(float f, uint x, uint y, uint c) +{ + nvDebugCheck(m_mem != NULL); + nvDebugCheck(x < m_width); + nvDebugCheck(y < m_height); + nvDebugCheck(c < m_componentNum); + m_mem[(c * m_height + y) * m_width + x] += f; +} + +/// Get pixel component. +inline float FloatImage::pixel(uint x, uint y, uint c) const +{ + nvDebugCheck(m_mem != NULL); + nvDebugCheck(x < m_width); + nvDebugCheck(y < m_height); + nvDebugCheck(c < m_componentNum); + return m_mem[(c * m_height + y) * m_width + x]; +} + +/// Set pixel component. +inline void FloatImage::setPixel(float f, uint idx) +{ + nvDebugCheck(idx < m_count); + m_mem[idx] = f; +} + +/// Get pixel component. +inline float FloatImage::pixel(uint idx) const +{ + nvDebugCheck(idx < m_count); + return m_mem[idx]; +} + +inline uint FloatImage::index(uint x, uint y) const +{ + nvDebugCheck(x < m_width); + nvDebugCheck(y < m_height); + return y * m_width + x; +} + +inline uint FloatImage::indexClamp(int x, int y) const +{ + return nv::clamp(y, int(0), int(m_height-1)) * m_width + nv::clamp(x, int(0), int(m_width-1)); +} + +inline int repeat_remainder(int a, int b) +{ + if (a >= 0) return a % b; + else return (a + 1) % b + b - 1; +} + +inline uint FloatImage::indexRepeat(int x, int y) const +{ + return repeat_remainder(y, m_height) * m_width + repeat_remainder(x, m_width); +} + +inline uint FloatImage::indexMirror(int x, int y) const +{ + if (m_width == 1) x = 0; + + x = abs(x); + while (x >= m_width) { + x = abs(m_width + m_width - x - 2); + } + + if (m_height == 1) y = 0; + + y = abs(y); + while (y >= m_height) { + y = abs(m_height + m_height - y - 2); + } + + return index(x, y); +} + +inline uint FloatImage::index(int x, int y, WrapMode wm) const +{ + if (wm == WrapMode_Clamp) return indexClamp(x, y); + if (wm == WrapMode_Repeat) return indexRepeat(x, y); + /*if (wm == WrapMode_Mirror)*/ return indexMirror(x, y); +} + +} // nv namespace + + + +#endif // NV_IMAGE_FLOATIMAGE_H diff --git a/externals/NVTT/src/nvimage/HoleFilling.cpp b/externals/NVTT/src/nvimage/HoleFilling.cpp new file mode 100644 index 00000000..863dc163 --- /dev/null +++ b/externals/NVTT/src/nvimage/HoleFilling.cpp @@ -0,0 +1,753 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include + +#include + +#include +#include + +using namespace nv; + + +// This is a variation of Sapiro's inpainting method. +void nv::fillExtrapolate(int passCount, FloatImage * img, BitMap * bmap) +{ + nvCheck(img != NULL); + nvCheck(bmap != NULL); + + const int w = img->width(); + const int h = img->height(); + const int count = img->componentNum(); + + nvCheck(bmap->width() == uint(w)); + nvCheck(bmap->height() == uint(h)); + + AutoPtr newbmap(new BitMap(w, h)); + + for(int p = 0; p < passCount; p++) + { + for(int c = 0; c < count; c++) + { + float * channel = img->channel(c); + + for(int y = 0; y < h; y++) { + for(int x = 0; x < w; x++) { + + if (bmap->bitAt(x, y)) { + // Not a hole. + newbmap->setBitAt(x, y); + continue; + } + + const bool west = bmap->bitAt(img->indexClamp(x-1, y)); + const bool east = bmap->bitAt(img->indexClamp(x+1, y)); + const bool north = bmap->bitAt(img->indexClamp(x, y-1)); + const bool south = bmap->bitAt(img->indexClamp(x, y+1)); + const bool northwest = bmap->bitAt(img->indexClamp(x-1, y-1)); + const bool northeast = bmap->bitAt(img->indexClamp(x+1, y-1)); + const bool southwest = bmap->bitAt(img->indexClamp(x-1, y+1)); + const bool southeast = bmap->bitAt(img->indexClamp(x+1, y+1)); + + int num = west + east + north + south + northwest + northeast + southwest + southeast; + + if (num != 0) { + + float average = 0.0f; + if (num == 3 && west && northwest && southwest) { + average = channel[img->indexClamp(x-1, y)]; + } + else if (num == 3 && east && northeast && southeast) { + average = channel[img->indexClamp(x+1, y)]; + } + else if (num == 3 && north && northwest && northeast) { + average = channel[img->indexClamp(x, y-1)]; + } + else if (num == 3 && south && southwest && southeast) { + average = channel[img->indexClamp(x, y+1)]; + } + else { + float total = 0.0f; + if (west) { average += 1 * channel[img->indexClamp(x-1, y)]; total += 1; } + if (east) { average += 1 * channel[img->indexClamp(x+1, y)]; total += 1; } + if (north) { average += 1 * channel[img->indexClamp(x, y-1)]; total += 1; } + if (south) { average += 1 * channel[img->indexClamp(x, y+1)]; total += 1; } + + if (northwest) { average += channel[img->indexClamp(x-1, y-1)]; ++total; } + if (northeast) { average += channel[img->indexClamp(x+1, y-1)]; ++total; } + if (southwest) { average += channel[img->indexClamp(x-1, y+1)]; ++total; } + if (southeast) { average += channel[img->indexClamp(x+1, y+1)]; ++total; } + + average /= total; + } + + channel[img->indexClamp(x, y)] = average; + newbmap->setBitAt(x, y); + } + } + } + } + + // Update the bit mask. + swap(*newbmap, *bmap); + } +} + + +namespace { + + struct Neighbor { + uint16 x; + uint16 y; + uint32 d; + }; + + // Compute euclidean squared distance. + static uint dist( uint16 ax, uint16 ay, uint16 bx, uint16 by ) { + int dx = bx - ax; + int dy = by - ay; + return uint(dx*dx + dy*dy); + } + + // Check neighbour, this is the core of the EDT algorithm. + static void checkNeighbour( int x, int y, Neighbor * e, const Neighbor & n ) { + nvDebugCheck(e != NULL); + + uint d = dist( x, y, n.x, n.y ); + if( d < e->d ) { + e->x = n.x; + e->y = n.y; + e->d = d; + } + } + +} // namespace + +// Voronoi filling using EDT-4 +void nv::fillVoronoi(FloatImage * img, const BitMap * bmap) +{ + nvCheck(img != NULL); + + const int w = img->width(); + const int h = img->height(); + const int count = img->componentNum(); + + nvCheck(bmap->width() == uint(w)); + nvCheck(bmap->height() == uint(h)); + + Array edm; + edm.resize(w * h); + + int x, y; + int x0, x1, y0, y1; + + // Init edm. + for( y = 0; y < h; y++ ) { + for( x = 0; x < w; x++ ) { + if( bmap->bitAt(x, y) ) { + edm[y * w + x].x = x; + edm[y * w + x].y = y; + edm[y * w + x].d = 0; + } + else { + edm[y * w + x].x = w; + edm[y * w + x].y = h; + edm[y * w + x].d = w*w + h*h; + } + } + } + + // First pass. + for( y = 0; y < h; y++ ) { + for( x = 0; x < w; x++ ) { + x0 = clamp(x-1, 0, w-1); // @@ Wrap? + x1 = clamp(x+1, 0, w-1); + y0 = clamp(y-1, 0, h-1); + + Neighbor & e = edm[y * w + x]; + checkNeighbour(x, y, &e, edm[y0 * w + x0]); + checkNeighbour(x, y, &e, edm[y0 * w + x]); + checkNeighbour(x, y, &e, edm[y0 * w + x1]); + checkNeighbour(x, y, &e, edm[y * w + x0]); + } + + for( x = w-1; x >= 0; x-- ) { + x1 = clamp(x+1, 0, w-1); + + Neighbor & e = edm[y * w + x]; + checkNeighbour(x, y, &e, edm[y * w + x1]); + } + } + + // Third pass. + for( y = h-1; y >= 0; y-- ) { + for( x = w-1; x >= 0; x-- ) { + x0 = clamp(x-1, 0, w-1); + x1 = clamp(x+1, 0, w-1); + y1 = clamp(y+1, 0, h-1); + + Neighbor & e = edm[y * w + x]; + checkNeighbour(x, y, &e, edm[y * w + x1]); + checkNeighbour(x, y, &e, edm[y1 * w + x0]); + checkNeighbour(x, y, &e, edm[y1 * w + x]); + checkNeighbour(x, y, &e, edm[y1 * w + x1]); + } + + for( x = 0; x < w; x++ ) { + x0 = clamp(x-1, 0, w-1); + + Neighbor & e = edm[y * w + x]; + checkNeighbour(x, y, &e, edm[y * w + x0]); + } + } + + // Fill empty holes. + for( y = 0; y < h; y++ ) { + for( x = 0; x < w; x++ ) { + const int sx = edm[y * w + x].x; + const int sy = edm[y * w + x].y; + nvDebugCheck(sx < w && sy < h); + + if( sx != x || sy != y ) { + for(int c = 0; c < count; c++ ) { + img->setPixel(img->pixel(sx, sy, c), x, y, c); + } + } + } + } + +} + + +void nv::fillBlur(FloatImage * img, const BitMap * bmap) +{ + nvCheck(img != NULL); + + // @@ Apply a 3x3 kernel. +} + + +static bool downsample(const FloatImage * src, const BitMap * srcMask, const FloatImage ** _dst, const BitMap ** _dstMask) +{ + const uint w = src->width(); + const uint h = src->height(); + const uint count = src->componentNum(); + + // count holes in srcMask, return false if fully filled. + uint holes = 0; + for(uint y = 0; y < h; y++) { + for(uint x = 0; x < w; x++) { + holes += srcMask->bitAt(x, y) == 0; + } + } + if (holes == 0 || (w == 2 || h == 2)) { + // Stop when no holes or when the texture is very small. + return false; + } + + // Apply box filter to image and mask and return true. + const uint nw = w / 2; + const uint nh = h / 2; + + FloatImage * dst = new FloatImage(); + dst->allocate(count, nw, nh); + BitMap * dstMask = new BitMap(nw, nh); + + for(uint c = 0; c < count; c++) { + for(uint y = 0; y < nh; y++) { + for(uint x = 0; x < nw; x++) { + + const uint x0 = 2 * x + 0; + const uint x1 = 2 * x + 1; + const uint y0 = 2 * y + 0; + const uint y1 = 2 * y + 1; + + const float f0 = src->pixel(x0, y0, c); + const float f1 = src->pixel(x1, y0, c); + const float f2 = src->pixel(x0, y1, c); + const float f3 = src->pixel(x1, y1, c); + + const bool b0 = srcMask->bitAt(x0, y0); + const bool b1 = srcMask->bitAt(x1, y0); + const bool b2 = srcMask->bitAt(x0, y1); + const bool b3 = srcMask->bitAt(x1, y1); + + if (b0 || b1 || b2 || b3) { + // Set bit mask. + dstMask->setBitAt(x, y); + + // Set pixel. + float value = 0.0f; + int total = 0; + if (b0) { value += f0; total++; } + if (b1) { value += f1; total++; } + if (b2) { value += f2; total++; } + if (b3) { value += f3; total++; } + dst->setPixel(value / total, x, y, c); + } + } + } + } + + *_dst = dst; + *_dstMask = dstMask; + + return true; +} + +// This is the filter used in the Lumigraph paper. +void nv::fillPullPush(FloatImage * img, const BitMap * bmap) +{ + nvCheck(img != NULL); + + const uint count = img->componentNum(); + const uint w = img->width(); + const uint h = img->height(); + const uint num = log2(max(w,h)); + + // Build mipmap chain. + Array mipmaps(num); + Array mipmapMasks(num); + + mipmaps.append(img); + mipmapMasks.append(bmap); + + const FloatImage * current; + const BitMap * currentMask; + + // Compute mipmap chain. + while(downsample(mipmaps.back(), mipmapMasks.back(), ¤t, ¤tMask)) + { + mipmaps.append(current); + mipmapMasks.append(currentMask); + } + + // Sample mipmaps until non-hole is found. + for(uint y = 0; y < h; y++) { + for(uint x = 0; x < w; x++) { + + int sx = x; + int sy = y; + //float sx = x; + //float sy = y; + + const uint levelCount = mipmaps.count(); + for (uint l = 0; l < levelCount; l++) + { + //const float fx = sx / mipmaps[l]->width(); + //const float fy = sy / mipmaps[l]->height(); + + if (mipmapMasks[l]->bitAt(sx, sy)) + { + // Sample mipmaps[l](sx, sy) and copy to img(x, y) + for(uint c = 0; c < count; c++) { + //img->setPixel(mipmaps[l]->linear_clamp(fx, fy, c), x, y, c); + img->setPixel(mipmaps[l]->pixel(sx, sy, c), x, y, c); + } + break; + } + + sx /= 2; + sy /= 2; + } + } + } + + // Don't delete the original image and mask. + mipmaps[0] = NULL; + mipmapMasks[0] = NULL; + + // Delete the mipmaps. + deleteAll(mipmaps); + deleteAll(mipmapMasks); +} + + + +/* + +This Code is from Charles Bloom: + +DoPixelSeamFix +10-20-02 + +Looks in the 5x5 local neighborhood (LocalPixels) of the desired pixel to fill. +It tries to build a quadratic model of the neighborhood surface to use in +extrapolating. You need 5 pixels to establish a 2d quadratic curve. + +This is really just a nice generic way to extrapolate pixels. It also happens +to work great for seam-fixing. + +Note that I'm working on normals, but I treat them just as 3 scalars and normalize +at the end. To be more correct, I would work on the surface of a sphere, but that +just seems like way too much work. + +*/ + +struct LocalPixels +{ + // 5x5 neighborhood + // the center is at result + // index [y][x] + bool fill[5][5]; + float data[5][5]; + + mutable float result; + mutable float weight; + + bool Quad3SubH(float * pQ, int row) const + { + const bool * pFill = fill[row]; + const float * pDat = data[row]; + + if ( pFill[1] && pFill[2] && pFill[3] ) + { + // good row + *pQ = pDat[1] - 2.f * pDat[2] + pDat[3]; + return true; + } + else if ( pFill[0] && pFill[1] && pFill[2] ) + { + // good row + *pQ = pDat[0] - 2.f * pDat[1] + pDat[2]; + return true; + } + else if ( pFill[2] && pFill[3] && pFill[4] ) + { + // good row + *pQ = pDat[2] - 2.f * pDat[3] + pDat[4]; + return true; + } + return false; + } + + // improve result with a horizontal quad in row 1 and/or + bool Quad3SubV(float * pQ, int col) const + { + if ( fill[1][col] && fill[2][col] && fill[3][col] ) + { + // good row + *pQ = data[1][col] - 2.f * data[2][col] + data[3][col]; + return true; + } + else if ( fill[0][col] && fill[1][col] && fill[2][col] ) + { + // good row + *pQ = data[0][col] - 2.f * data[1][col] + data[2][col]; + return true; + } + else if ( fill[2][col] && fill[3][col] && fill[4][col] ) + { + // good row + *pQ = data[2][col] - 2.f * data[3][col] + data[4][col]; + return true; + } + return false; + } + + bool Quad3H(float * pQ) const + { + if (!Quad3SubH(pQ,1)) + { + return Quad3SubH(pQ,3); + } + float q = 0.0f; // initializer not needed, just make it shut up + if (Quad3SubH(&q, 3)) + { + // got q and pQ + *pQ = (*pQ+q)*0.5f; + } + return true; + } + + bool Quad3V(float * pQ) const + { + if (!Quad3SubV(pQ, 1)) + { + return Quad3SubV(pQ, 3); + } + float q = 0.0f; // initializer not needed, just make it shut up + if (Quad3SubV(&q, 3)) + { + // got q and pQ + *pQ = (*pQ + q) * 0.5f; + } + return true; + } + // Quad returns ([0]+[2] - 2.f*[1]) + // a common want is [1] - ([0]+[2])*0.5f ; + // so use -0.5f*Quad + + bool tryQuads() const + { + bool res = false; + + // look for a pair that straddles the middle: + if ( fill[2][1] && fill[2][3] ) + { + // got horizontal straddle + float q; + if ( Quad3H(&q) ) + { + result += (data[2][1] + data[2][3] - q) * 0.5f; + weight += 1.f; + res = true; + } + } + if ( fill[1][2] && fill[3][2] ) + { + // got vertical straddle + float q; + if ( Quad3V(&q) ) + { + result += (data[1][2] + data[3][2] - q) * 0.5f; + weight += 1.f; + res = true; + } + } + + // look for pairs that lead into the middle : + if ( fill[2][0] && fill[2][1] ) + { + // got left-side pair + float q; + if ( Quad3H(&q) ) + { + result += data[2][1]*2.f - data[2][0] + q; + weight += 1.f; + res = true; + } + } + if ( fill[2][3] && fill[2][4] ) + { + // got right-side pair + float q; + if ( Quad3H(&q) ) + { + result += data[2][3]*2.f - data[2][4] + q; + weight += 1.f; + res = true; + } + } + if ( fill[0][2] && fill[1][2] ) + { + // got left-side pair + float q; + if ( Quad3V(&q) ) + { + result += data[1][2]*2.f - data[0][2] + q; + weight += 1.f; + res = true; + } + } + if ( fill[3][2] && fill[4][2] ) + { + // got right-side pair + float q; + if ( Quad3V(&q) ) + { + result += data[3][2]*2.f - data[4][2] + q; + weight += 1.f; + res = true; + } + } + return res; + } + + bool tryPlanar() const + { + // four cases : + const int indices[] = + { + 2,1, 1,2, 1,1, + 2,1, 3,2, 3,1, + 2,3, 1,2, 1,3, + 2,3, 3,2, 3,3 + }; + bool res = false; + for (int i = 0; i < 4; i++) + { + const int * I = indices + i*6; + if (!fill[ I[0] ][ I[1] ]) + continue; + if (!fill[ I[2] ][ I[3] ]) + continue; + if (!fill[ I[4] ][ I[5] ]) + continue; + + result += data[ I[0] ][ I[1] ] + data[ I[2] ][ I[3] ] - data[ I[4] ][ I[5] ]; + weight += 1.0f; + res = true; + } + return res; + } + + bool tryTwos() const + { + bool res = false; + + if (fill[2][1] && fill[2][3]) + { + result += (data[2][1] + data[2][3]) * 0.5f; + weight += 1.0f; + res = true; + } + if (fill[1][2] && fill[3][2]) + { + result += (data[1][2] + data[3][2]) * 0.5f; + weight += 1.0f; + res = true; + } + + // four side-rotates : + const int indices[] = + { + 2,1, 2,0, + 2,3, 2,4, + 1,2, 0,2, + 3,2, 4,2, + }; + for (int i = 0; i < 4; i++) + { + const int * I = indices + i*4; + if (!fill[ I[0] ][ I[1] ]) + continue; + if (!fill[ I[2] ][ I[3] ]) + continue; + + result += data[ I[0] ][ I[1] ]*2.0f - data[ I[2] ][ I[3] ]; + weight += 1.0f; + res = true; + } + + return res; + } + + bool doLocalPixelFill() const + { + result = 0.0f; + weight = 0.0f; + + if (tryQuads()) { + return true; + } + + if (tryPlanar()) { + return true; + } + + return tryTwos(); + } + +}; // struct LocalPixels + + + +// This is a quadratic extrapolation filter from Charles Bloom (DoPixelSeamFix). Used with his permission. +void nv::fillQuadraticExtrapolate(int passCount, FloatImage * img, BitMap * bmap, int coverageIndex /*= -1*/) +{ + nvCheck(passCount > 0); + nvCheck(img != NULL); + nvCheck(bmap != NULL); + + const int w = img->width(); + const int h = img->height(); + const int count = img->componentNum(); + + nvCheck(bmap->width() == uint(w)); + nvCheck(bmap->height() == uint(h)); + + AutoPtr newbmap( new BitMap(w, h) ); + + float * coverageChannel = NULL; + if (coverageIndex != -1) + { + coverageChannel = img->channel(coverageIndex); + } + + int firstChannel = -1; + + for (int p = 0; p < passCount; p++) + { + for (int c = 0; c < count; c++) + { + if (c == coverageIndex) continue; + if (firstChannel == -1) firstChannel = c; + + float * channel = img->channel(c); + + for (int yb = 0; yb < h; yb++) { + for (int xb = 0; xb < w; xb++) { + + if (bmap->bitAt(xb, yb)) { + // Not a hole. + newbmap->setBitAt(xb, yb); + continue; + } + + int numFill = 0; + + LocalPixels lp; + for (int ny = 0; ny < 5; ny++) + { + int y = (yb + ny - 2); + if ( y < 0 || y >= h ) + { + // out of range + for(int i = 0; i < 5; i++) + { + lp.fill[ny][i] = false; + } + continue; + } + + for (int nx = 0; nx < 5; nx++) + { + int x = (xb + nx - 2); + if (x < 0 || x >= w) + { + lp.fill[ny][nx] = false; + } + else + { + int idx = img->index(x, y); + if (!bmap->bitAt(idx)) + { + lp.fill[ny][nx] = false; + } + else + { + lp.fill[ny][nx] = true; + lp.data[ny][nx] = channel[idx]; + numFill++; + } + } + } + } + + // need at least 3 to do anything decent + if (numFill < 2) + continue; + + nvDebugCheck(lp.fill[2][2] == false); + + if (lp.doLocalPixelFill()) + { + const int idx = img->index(xb, yb); + channel[idx] = lp.result / lp.weight; + + if (c == firstChannel) + { + //coverageChannel[idx] /= lp.weight; // @@ Not sure what this was for, coverageChannel[idx] is always zero. + newbmap->setBitAt(xb, yb); + } + } + } + } + } + + // Update the bit mask. + swap(*newbmap, *bmap); + } +} diff --git a/externals/NVTT/src/nvimage/HoleFilling.h b/externals/NVTT/src/nvimage/HoleFilling.h new file mode 100644 index 00000000..b437e875 --- /dev/null +++ b/externals/NVTT/src/nvimage/HoleFilling.h @@ -0,0 +1,96 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_HOLEFILLING_H +#define NV_IMAGE_HOLEFILLING_H + +#include +#include + +namespace nv +{ + class FloatImage; + + /// Bit mask. + class BitMap + { + public: + BitMap(uint w, uint h) : + m_width(w), m_height(h), m_bitArray(w*h) + { + } + + const uint width() const { return m_width; } + const uint height() const { return m_height; } + + bool bitAt(uint x, uint y) const + { + nvDebugCheck(x < m_width && y < m_height); + return m_bitArray.bitAt(y * m_width + x); + } + bool bitAt(uint idx) const + { + return m_bitArray.bitAt(idx); + } + + void setBitAt(uint x, uint y) + { + nvDebugCheck(x < m_width && y < m_height); + m_bitArray.setBitAt(y * m_width + x); + } + void setBitAt(uint idx) + { + m_bitArray.setBitAt(idx); + } + + void clearBitAt(uint x, uint y) + { + nvDebugCheck(x < m_width && y < m_height); + m_bitArray.clearBitAt(y * m_width + x); + } + void clearBitAt(uint idx) + { + m_bitArray.clearBitAt(idx); + } + + void clearAll() + { + m_bitArray.clearAll(); + } + + void setAll() + { + m_bitArray.setAll(); + } + + void toggleAll() + { + m_bitArray.toggleAll(); + } + + friend void swap(BitMap & a, BitMap & b) + { + nvCheck(a.m_width == b.m_width); + nvCheck(a.m_height == b.m_height); + //swap(const_cast(a.m_width), const_cast(b.m_width)); + //swap(const_cast(a.m_height), const_cast(b.m_height)); + swap(a.m_bitArray, b.m_bitArray); + } + + private: + + const uint m_width; + const uint m_height; + BitArray m_bitArray; + + }; + + NVIMAGE_API void fillVoronoi(FloatImage * img, const BitMap * bmap); + NVIMAGE_API void fillBlur(FloatImage * img, const BitMap * bmap); + NVIMAGE_API void fillPullPush(FloatImage * img, const BitMap * bmap); + + NVIMAGE_API void fillExtrapolate(int passCount, FloatImage * img, BitMap * bmap); + NVIMAGE_API void fillQuadraticExtrapolate(int passCount, FloatImage * img, BitMap * bmap, int coverageIndex = -1); + +} // nv namespace + +#endif // NV_IMAGE_HOLEFILLING_H diff --git a/externals/NVTT/src/nvimage/Image.cpp b/externals/NVTT/src/nvimage/Image.cpp new file mode 100644 index 00000000..2307d5c3 --- /dev/null +++ b/externals/NVTT/src/nvimage/Image.cpp @@ -0,0 +1,149 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include + +#include + +#include +#include + + +using namespace nv; + +Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(NULL) +{ +} + +Image::Image(const Image & img) : m_data(NULL) +{ + allocate(img.m_width, img.m_height); + m_format = img.m_format; + memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height); +} + +Image::~Image() +{ + free(); +} + +const Image & Image::operator=(const Image & img) +{ + allocate(img.m_width, img.m_height); + m_format = img.m_format; + memcpy(m_data, img.m_data, sizeof(Color32) * m_width * m_height); + return *this; +} + + +void Image::allocate(uint w, uint h) +{ + m_width = w; + m_height = h; + m_data = (Color32 *)realloc(m_data, w * h * sizeof(Color32)); +} + +bool Image::load(const char * name) +{ + free(); + + AutoPtr img(ImageIO::load(name)); + if (img == NULL) { + return false; + } + + swap(m_width, img->m_width); + swap(m_height, img->m_height); + swap(m_format, img->m_format); + swap(m_data, img->m_data); + + return true; +} + +void Image::wrap(void * data, uint w, uint h) +{ + free(); + m_data = (Color32 *)data; + m_width = w; + m_height = h; +} + +void Image::unwrap() +{ + m_data = NULL; + m_width = 0; + m_height = 0; +} + + +void Image::free() +{ + nv::mem::free(m_data); + m_data = NULL; +} + + +uint Image::width() const +{ + return m_width; +} + +uint Image::height() const +{ + return m_height; +} + +const Color32 * Image::scanline(uint h) const +{ + nvDebugCheck(h < m_height); + return m_data + h * m_width; +} + +Color32 * Image::scanline(uint h) +{ + nvDebugCheck(h < m_height); + return m_data + h * m_width; +} + +const Color32 * Image::pixels() const +{ + return m_data; +} + +Color32 * Image::pixels() +{ + return m_data; +} + +const Color32 & Image::pixel(uint idx) const +{ + nvDebugCheck(idx < m_width * m_height); + return m_data[idx]; +} + +Color32 & Image::pixel(uint idx) +{ + nvDebugCheck(idx < m_width * m_height); + return m_data[idx]; +} + + +Image::Format Image::format() const +{ + return m_format; +} + +void Image::setFormat(Image::Format f) +{ + m_format = f; +} + +void Image::fill(Color32 c) +{ + const uint size = m_width * m_height; + for (uint i = 0; i < size; ++i) + { + m_data[i] = c; + } +} + diff --git a/externals/NVTT/src/nvimage/Image.h b/externals/NVTT/src/nvimage/Image.h new file mode 100644 index 00000000..da1b0c5e --- /dev/null +++ b/externals/NVTT/src/nvimage/Image.h @@ -0,0 +1,83 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_IMAGE_H +#define NV_IMAGE_IMAGE_H + +#include +#include + +namespace nv +{ + class Color32; + + /// 32 bit RGBA image. + class NVIMAGE_CLASS Image + { + public: + + enum Format + { + Format_RGB, + Format_ARGB, + }; + + Image(); + Image(const Image & img); + ~Image(); + + const Image & operator=(const Image & img); + + + void allocate(uint w, uint h); + bool load(const char * name); + + void wrap(void * data, uint w, uint h); + void unwrap(); + + uint width() const; + uint height() const; + + const Color32 * scanline(uint h) const; + Color32 * scanline(uint h); + + const Color32 * pixels() const; + Color32 * pixels(); + + const Color32 & pixel(uint idx) const; + Color32 & pixel(uint idx); + + const Color32 & pixel(uint x, uint y) const; + Color32 & pixel(uint x, uint y); + + Format format() const; + void setFormat(Format f); + + void fill(Color32 c); + + private: + void free(); + + private: + uint m_width; + uint m_height; + Format m_format; + Color32 * m_data; + }; + + + inline const Color32 & Image::pixel(uint x, uint y) const + { + nvDebugCheck(x < width() && y < height()); + return pixel(y * width() + x); + } + + inline Color32 & Image::pixel(uint x, uint y) + { + nvDebugCheck(x < width() && y < height()); + return pixel(y * width() + x); + } + +} // nv namespace + + +#endif // NV_IMAGE_IMAGE_H diff --git a/externals/NVTT/src/nvimage/ImageIO.cpp b/externals/NVTT/src/nvimage/ImageIO.cpp new file mode 100644 index 00000000..0b24600b --- /dev/null +++ b/externals/NVTT/src/nvimage/ImageIO.cpp @@ -0,0 +1,1509 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include +#include +#include +//#include // @@ Disable temporarily +#include + +#include + +#include "ImageIO.h" +#include "Image.h" +#include "FloatImage.h" +#include "TgaFile.h" +#include "PsdFile.h" + +// Extern +#if defined(HAVE_JPEG) +extern "C" { +# include +} +#endif + +#if defined(HAVE_PNG) +# include +#endif + +#if defined(HAVE_TIFF) +# define _TIFF_DATA_TYPEDEFS_ +# include +#endif + +#if defined(HAVE_OPENEXR) +# include +# include +# include +# include +# include +# include +#endif + +using namespace nv; + +namespace { + + // Array of image load plugins. +// static HashMap s_plugin_load_map; + + // Array of image save plugins. +// static HashMap s_plugin_save_map; + + struct Color555 { + uint16 b : 5; + uint16 g : 5; + uint16 r : 5; + }; + +} // namespace + + +Image * nv::ImageIO::load(const char * fileName) +{ + nvDebugCheck(fileName != NULL); + + StdInputStream stream(fileName); + + if (stream.isError()) { + return NULL; + } + + return ImageIO::load(fileName, stream); +} + +Image * nv::ImageIO::load(const char * fileName, Stream & s) +{ + nvDebugCheck(fileName != NULL); + nvDebugCheck(s.isLoading()); + + const char * extension = Path::extension(fileName); + + if (strCaseCmp(extension, ".tga") == 0) { + return ImageIO::loadTGA(s); + } +#if defined(HAVE_JPEG) + if (strCaseCmp(extension, ".jpg") == 0 || strCaseCmp(extension, ".jpeg") == 0) { + return loadJPG(s); + } +#endif +#if defined(HAVE_PNG) + if (strCaseCmp(extension, ".png") == 0) { + return loadPNG(s); + } +#endif + if (strCaseCmp(extension, ".psd") == 0) { + return loadPSD(s); + } + // @@ use image plugins? + return NULL; +} + +bool nv::ImageIO::save(const char * fileName, Stream & s, Image * img) +{ + nvDebugCheck(fileName != NULL); + nvDebugCheck(s.isSaving()); + nvDebugCheck(img != NULL); + + const char * extension = Path::extension(fileName); + + if (strCaseCmp(extension, ".tga") == 0) { + return ImageIO::saveTGA(s, img); + } + + return false; +} + +bool nv::ImageIO::save(const char * fileName, Image * img) +{ + nvDebugCheck(fileName != NULL); + nvDebugCheck(img != NULL); + + StdOutputStream stream(fileName); + if (stream.isError()) + { + return false; + } + + return ImageIO::save(fileName, stream, img); +} + +FloatImage * nv::ImageIO::loadFloat(const char * fileName) +{ + nvDebugCheck(fileName != NULL); + + StdInputStream stream(fileName); + + if (stream.isError()) { + return false; + } + + return loadFloat(fileName, stream); +} + +FloatImage * nv::ImageIO::loadFloat(const char * fileName, Stream & s) +{ + nvDebugCheck(fileName != NULL); + + const char * extension = Path::extension(fileName); + +#if defined(HAVE_TIFF) + if (strCaseCmp(extension, ".tif") == 0 || strCaseCmp(extension, ".tiff") == 0) { + return loadFloatTIFF(fileName, s); + } +#endif +#if defined(HAVE_OPENEXR) + if (strCaseCmp(extension, ".exr") == 0) { + return loadFloatEXR(fileName, s); + } +#endif + +/* // @@ Disable temporarily + if (strCaseCmp(extension, ".pfm") == 0) { + return loadFloatPFM(fileName, s); + } +*/ + + return NULL; +} + + +bool nv::ImageIO::saveFloat(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components) +{ + const char * extension = Path::extension(fileName); + +#if defined(HAVE_OPENEXR) + if (strCaseCmp(extension, ".exr") == 0) + { + return ImageIO::saveFloatEXR(fileName, fimage, base_component, num_components); + } +#endif + +#if defined(HAVE_TIFF) + if (strCaseCmp(extension, ".tif") == 0 || strCaseCmp(extension, ".tiff") == 0) + { + return ImageIO::saveFloatTIFF(fileName, fimage, base_component, num_components); + } +#endif + +/* // @@ Disable Temporarily + if (strCaseCmp(extension, ".pfm") == 0) + { +// return ImageIO::saveFloatPFM(fileName, fimage, base_component, num_components); + } +*/ + + if (num_components == 3 || num_components == 4) + { + AutoPtr image(fimage->createImage(base_component, num_components)); + nvCheck(image != NULL); + + if (num_components == 4) + { + image->setFormat(Image::Format_ARGB); + } + + return ImageIO::save(fileName, image.ptr()); + } + + return false; +} + + +/// Load TGA image. +Image * nv::ImageIO::loadTGA(Stream & s) +{ + nvCheck(!s.isError()); + nvCheck(s.isLoading()); + + TgaHeader tga; + s << tga; + s.seek(TgaHeader::Size + tga.id_length); + + // Get header info. + bool rle = false; + bool pal = false; + bool rgb = false; + bool grey = false; + + switch( tga.image_type ) { + case TGA_TYPE_RLE_INDEXED: + rle = true; + // no break is intended! + case TGA_TYPE_INDEXED: + if( tga.colormap_type!=1 || tga.colormap_size!=24 || tga.colormap_length>256 ) { + nvDebug( "*** ImageIO::loadTGA: Error, only 24bit paletted images are supported.\n" ); + return false; + } + pal = true; + break; + + case TGA_TYPE_RLE_RGB: + rle = true; + // no break is intended! + case TGA_TYPE_RGB: + rgb = true; + break; + + case TGA_TYPE_RLE_GREY: + rle = true; + // no break is intended! + case TGA_TYPE_GREY: + grey = true; + break; + + default: + nvDebug( "*** ImageIO::loadTGA: Error, unsupported image type.\n" ); + return false; + } + + const uint pixel_size = (tga.pixel_size/8); + nvDebugCheck(pixel_size <= 4); + + const uint size = tga.width * tga.height * pixel_size; + + + // Read palette + uint8 palette[768]; + if( pal ) { + nvDebugCheck(tga.colormap_length < 256); + s.serialize(palette, 3 * tga.colormap_length); + } + + // Decode image. + uint8 * mem = new uint8[size]; + if( rle ) { + // Decompress image in src. + uint8 * dst = mem; + int num = size; + + while (num > 0) { + // Get packet header + uint8 c; + s << c; + + uint count = (c & 0x7f) + 1; + num -= count * pixel_size; + + if (c & 0x80) { + // RLE pixels. + uint8 pixel[4]; // uint8 pixel[pixel_size]; + s.serialize( pixel, pixel_size ); + do { + memcpy(dst, pixel, pixel_size); + dst += pixel_size; + } while (--count); + } + else { + // Raw pixels. + count *= pixel_size; + //file->Read8(dst, count); + s.serialize(dst, count); + dst += count; + } + } + } + else { + s.serialize(mem, size); + } + + // Allocate image. + AutoPtr img(new Image()); + img->allocate(tga.width, tga.height); + + int lstep; + Color32 * dst; + if( tga.flags & TGA_ORIGIN_UPPER ) { + lstep = tga.width; + dst = img->pixels(); + } + else { + lstep = - tga.width; + dst = img->pixels() + (tga.height-1) * tga.width; + } + + // Write image. + uint8 * src = mem; + if( pal ) { + for( int y = 0; y < tga.height; y++ ) { + for( int x = 0; x < tga.width; x++ ) { + uint8 idx = *src++; + dst[x].setBGRA(palette[3*idx+0], palette[3*idx+1], palette[3*idx+2], 0xFF); + } + dst += lstep; + } + } + else if( grey ) { + img->setFormat(Image::Format_ARGB); + + for( int y = 0; y < tga.height; y++ ) { + for( int x = 0; x < tga.width; x++ ) { + dst[x].setBGRA(*src, *src, *src, *src); + src++; + } + dst += lstep; + } + } + else { + + if( tga.pixel_size == 16 ) { + for( int y = 0; y < tga.height; y++ ) { + for( int x = 0; x < tga.width; x++ ) { + Color555 c = *reinterpret_cast(src); + uint8 b = (c.b << 3) | (c.b >> 2); + uint8 g = (c.g << 3) | (c.g >> 2); + uint8 r = (c.r << 3) | (c.r >> 2); + dst[x].setBGRA(b, g, r, 0xFF); + src += 2; + } + dst += lstep; + } + } + else if( tga.pixel_size == 24 ) { + for( int y = 0; y < tga.height; y++ ) { + for( int x = 0; x < tga.width; x++ ) { + dst[x].setBGRA(src[0], src[1], src[2], 0xFF); + src += 3; + } + dst += lstep; + } + } + else if( tga.pixel_size == 32 ) { + img->setFormat(Image::Format_ARGB); + + for( int y = 0; y < tga.height; y++ ) { + for( int x = 0; x < tga.width; x++ ) { + dst[x].setBGRA(src[0], src[1], src[2], src[3]); + src += 4; + } + dst += lstep; + } + } + } + + // free uncompressed data. + delete [] mem; + + return img.release(); +} + +/// Save TGA image. +bool nv::ImageIO::saveTGA(Stream & s, const Image * img) +{ + nvCheck(!s.isError()); + nvCheck(img != NULL); + nvCheck(img->pixels() != NULL); + + TgaFile tga; + tga.head.id_length = 0; + tga.head.colormap_type = 0; + tga.head.image_type = TGA_TYPE_RGB; + + tga.head.colormap_index = 0; + tga.head.colormap_length = 0; + tga.head.colormap_size = 0; + + tga.head.x_origin = 0; + tga.head.y_origin = 0; + tga.head.width = img->width(); + tga.head.height = img->height(); + if(img->format() == Image::Format_ARGB) { + tga.head.pixel_size = 32; + tga.head.flags = TGA_ORIGIN_UPPER | TGA_HAS_ALPHA; + } + else { + tga.head.pixel_size = 24; + tga.head.flags = TGA_ORIGIN_UPPER; + } + + // @@ Serialize directly. + tga.allocate(); + + const uint n = img->width() * img->height(); + if(img->format() == Image::Format_ARGB) { + for(uint i = 0; i < n; i++) { + Color32 color = img->pixel(i); + tga.mem[4 * i + 0] = color.b; + tga.mem[4 * i + 1] = color.g; + tga.mem[4 * i + 2] = color.r; + tga.mem[4 * i + 3] = color.a; + } + } + else { + for(uint i = 0; i < n; i++) { + Color32 color = img->pixel(i); + tga.mem[3 * i + 0] = color.b; + tga.mem[3 * i + 1] = color.g; + tga.mem[3 * i + 2] = color.r; + } + } + + s << tga; + + tga.free(); + + return true; +} + +/// Load PSD image. +Image * nv::ImageIO::loadPSD(Stream & s) +{ + nvCheck(!s.isError()); + nvCheck(s.isLoading()); + + s.setByteOrder(Stream::BigEndian); + + PsdHeader header; + s << header; + + if (!header.isValid()) + { + printf("invalid header!\n"); + return NULL; + } + + if (!header.isSupported()) + { + printf("unsupported file!\n"); + return NULL; + } + + int tmp; + + // Skip mode data. + s << tmp; + s.seek(s.tell() + tmp); + + // Skip image resources. + s << tmp; + s.seek(s.tell() + tmp); + + // Skip the reserved data. + s << tmp; + s.seek(s.tell() + tmp); + + // Find out if the data is compressed. + // Known values: + // 0: no compression + // 1: RLE compressed + uint16 compression; + s << compression; + + if (compression > 1) { + // Unknown compression type. + return NULL; + } + + uint channel_num = header.channel_count; + + AutoPtr img(new Image()); + img->allocate(header.width, header.height); + + if (channel_num < 4) + { + // Clear the image. + img->fill(Color32(0, 0, 0, 0xFF)); + } + else + { + // Enable alpha. + img->setFormat(Image::Format_ARGB); + + // Ignore remaining channels. + channel_num = 4; + } + + + const uint pixel_count = header.height * header.width; + + static const uint components[4] = {2, 1, 0, 3}; + + if (compression) + { + s.seek(s.tell() + header.height * header.channel_count * sizeof(uint16)); + + // Read RLE data. + for (uint channel = 0; channel < channel_num; channel++) + { + uint8 * ptr = (uint8 *)img->pixels() + components[channel]; + + uint count = 0; + while( count < pixel_count ) + { + if (s.isAtEnd()) return NULL; + + uint8 c; + s << c; + + uint len = c; + if (len < 128) + { + // Copy next len+1 bytes literally. + len++; + count += len; + if (count > pixel_count) return NULL; + + while (len != 0) + { + s << *ptr; + ptr += 4; + len--; + } + } + else if (len > 128) + { + // Next -len+1 bytes in the dest are replicated from next source byte. + // (Interpret len as a negative 8-bit int.) + len ^= 0xFF; + len += 2; + count += len; + if (s.isAtEnd() || count > pixel_count) return NULL; + + uint8 val; + s << val; + while( len != 0 ) { + *ptr = val; + ptr += 4; + len--; + } + } + else if( len == 128 ) { + // No-op. + } + } + } + } + else + { + // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) + // where each channel consists of an 8-bit value for each pixel in the image. + + // Read the data by channel. + for (uint channel = 0; channel < channel_num; channel++) + { + uint8 * ptr = (uint8 *)img->pixels() + components[channel]; + + // Read the data. + uint count = pixel_count; + while (count != 0) + { + s << *ptr; + ptr += 4; + count--; + } + } + } + + return img.release(); +} + +#if defined(HAVE_PNG) + +static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + nvDebugCheck(png_ptr != NULL); + + Stream * s = (Stream *)png_ptr->io_ptr; + s->serialize(data, (int)length); + + if (s->isError()) { + png_error(png_ptr, "Read Error"); + } +} + + +Image * nv::ImageIO::loadPNG(Stream & s) +{ + nvCheck(!s.isError()); + + // Set up a read buffer and check the library version + png_structp png_ptr; + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (png_ptr == NULL) { + // nvDebug( "*** LoadPNG: Error allocating read buffer in file '%s'.\n", name ); + return false; + } + + // Allocate/initialize a memory block for the image information + png_infop info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) { + png_destroy_read_struct(&png_ptr, NULL, NULL); + // nvDebug( "*** LoadPNG: Error allocating image information for '%s'.\n", name ); + return false; + } + + // Set up the error handling + if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + // nvDebug( "*** LoadPNG: Error reading png file '%s'.\n", name ); + return false; + } + + // Set up the I/O functions. + png_set_read_fn(png_ptr, (void*)&s, user_read_data); + + + // Retrieve the image header information + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; + png_read_info(png_ptr, info_ptr); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); + + + if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8) { + // Convert indexed images to RGB. + png_set_expand(png_ptr); + } + else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) { + // Convert grayscale to RGB. + png_set_expand(png_ptr); + } + else if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + // Expand images with transparency to full alpha channels + // so the data will be available as RGBA quartets. + png_set_expand(png_ptr); + } + else if (bit_depth < 8) { + // If we have < 8 scale it up to 8. + //png_set_expand(png_ptr); + png_set_packing(png_ptr); + } + + // Reduce bit depth. + if (bit_depth == 16) { + png_set_strip_16(png_ptr); + } + + // Represent gray as RGB + if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { + png_set_gray_to_rgb(png_ptr); + } + + // Convert to RGBA filling alpha with 0xFF. + if (!(color_type & PNG_COLOR_MASK_ALPHA)) { + png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER); + } + + // @todo Choose gamma according to the platform? + double screen_gamma = 2.2; + int intent; + if (png_get_sRGB(png_ptr, info_ptr, &intent)) { + png_set_gamma(png_ptr, screen_gamma, 0.45455); + } + else { + double image_gamma; + if (png_get_gAMA(png_ptr, info_ptr, &image_gamma)) { + png_set_gamma(png_ptr, screen_gamma, image_gamma); + } + else { + png_set_gamma(png_ptr, screen_gamma, 0.45455); + } + } + + // Perform the selected transforms. + png_read_update_info(png_ptr, info_ptr); + + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); + + AutoPtr img(new Image()); + img->allocate(width, height); + + // Set internal format flags. + if(color_type & PNG_COLOR_MASK_COLOR) { + //img->flags |= PI_IF_HAS_COLOR; + } + if(color_type & PNG_COLOR_MASK_ALPHA) { + //img->flags |= PI_IF_HAS_ALPHA; + img->setFormat(Image::Format_ARGB); + } + + // Read the image + uint8 * pixels = (uint8 *)img->pixels(); + png_bytep * row_data = new png_bytep[sizeof(png_byte) * height]; + for (uint i = 0; i < height; i++) { + row_data[i] = &(pixels[width * 4 * i]); + } + + png_read_image(png_ptr, row_data); + delete [] row_data; + + // Finish things up + png_read_end(png_ptr, info_ptr); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + + // RGBA to BGRA. + uint num = width * height; + for(uint i = 0; i < num; i++) + { + Color32 c = img->pixel(i); + img->pixel(i) = Color32(c.b, c.g, c.r, c.a); + } + + // Compute alpha channel if needed. + /*if( img->flags & PI_IU_BUMPMAP || img->flags & PI_IU_ALPHAMAP ) { + if( img->flags & PI_IF_HAS_COLOR && !(img->flags & PI_IF_HAS_ALPHA)) { + img->ComputeAlphaFromColor(); + } + }*/ + + return img.release(); +} + +#endif // defined(HAVE_PNG) + +#if defined(HAVE_JPEG) + +static void init_source (j_decompress_ptr /*cinfo*/){ +} + +static boolean fill_input_buffer (j_decompress_ptr cinfo){ + struct jpeg_source_mgr * src = cinfo->src; + static JOCTET FakeEOI[] = { 0xFF, JPEG_EOI }; + + // Generate warning + nvDebug("jpeglib: Premature end of file\n"); + + // Insert a fake EOI marker + src->next_input_byte = FakeEOI; + src->bytes_in_buffer = 2; + + return TRUE; +} + +static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) { + struct jpeg_source_mgr * src = cinfo->src; + + if(num_bytes >= (long)src->bytes_in_buffer) { + fill_input_buffer(cinfo); + return; + } + + src->bytes_in_buffer -= num_bytes; + src->next_input_byte += num_bytes; +} + +static void term_source (j_decompress_ptr /*cinfo*/){ + // no work necessary here +} + + +Image * nv::ImageIO::loadJPG(Stream & s) +{ + nvCheck(!s.isError()); + + // Read the entire file. + Array byte_array; + byte_array.resize(s.size()); + s.serialize(byte_array.unsecureBuffer(), s.size()); + + jpeg_decompress_struct cinfo; + jpeg_error_mgr jerr; + + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + + cinfo.src = (struct jpeg_source_mgr *) (*cinfo.mem->alloc_small) + ((j_common_ptr) &cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr)); + cinfo.src->init_source = init_source; + cinfo.src->fill_input_buffer = fill_input_buffer; + cinfo.src->skip_input_data = skip_input_data; + cinfo.src->resync_to_restart = jpeg_resync_to_restart; // use default method + cinfo.src->term_source = term_source; + cinfo.src->bytes_in_buffer = byte_array.size(); + cinfo.src->next_input_byte = byte_array.buffer(); + + jpeg_read_header(&cinfo, TRUE); + jpeg_start_decompress(&cinfo); + + /* + cinfo.do_fancy_upsampling = FALSE; // fast decompression + cinfo.dct_method = JDCT_FLOAT; // Choose floating point DCT method. + */ + + uint8 * tmp_buffer = new uint8 [cinfo.output_width * cinfo.output_height * cinfo.num_components]; + uint8 * scanline = tmp_buffer; + + while( cinfo.output_scanline < cinfo.output_height ){ + int num_scanlines = jpeg_read_scanlines (&cinfo, &scanline, 1); + scanline += num_scanlines * cinfo.output_width * cinfo.num_components; + } + + jpeg_finish_decompress(&cinfo); + + AutoPtr img(new Image()); + img->allocate(cinfo.output_width, cinfo.output_height); + + Color32 * dst = img->pixels(); + const int size = img->height() * img->width(); + const uint8 * src = tmp_buffer; + + if( cinfo.num_components == 3 ) { + img->setFormat(Image::Format_RGB); + for( int i = 0; i < size; i++ ) { + *dst++ = Color32(src[0], src[1], src[2]); + src += 3; + } + } + else { + img->setFormat(Image::Format_ARGB); + for( int i = 0; i < size; i++ ) { + *dst++ = Color32(*src, *src, *src, *src); + src++; + } + } + + delete [] tmp_buffer; + jpeg_destroy_decompress (&cinfo); + + return img.release(); +} + +#endif // defined(HAVE_JPEG) + +#if defined(HAVE_TIFF) + +/* +static tsize_t tiffReadWriteProc(thandle_t h, tdata_t ptr, tsize_t size) +{ + Stream * s = (Stream *)h; + nvDebugCheck(s != NULL); + + s->serialize(ptr, size); + + return size; +} + +static toff_t tiffSeekProc(thandle_t h, toff_t offset, int whence) +{ + Stream * s = (Stream *)h; + nvDebugCheck(s != NULL); + + if (!s->isSeekable()) + { + return (toff_t)-1; + } + + if (whence == SEEK_SET) + { + s->seek(offset); + } + else if (whence == SEEK_CUR) + { + s->seek(s->tell() + offset); + } + else if (whence == SEEK_END) + { + s->seek(s->size() + offset); + } + + return s->tell(); +} + +static int tiffCloseProc(thandle_t) +{ + return 0; +} + +static toff_t tiffSizeProc(thandle_t h) +{ + Stream * s = (Stream *)h; + nvDebugCheck(s != NULL); + return s->size(); +} + +static int tiffMapFileProc(thandle_t, tdata_t*, toff_t*) +{ + // @@ TODO, Implement these functions. + return -1; +} + +static void tiffUnmapFileProc(thandle_t, tdata_t, toff_t) +{ + // @@ TODO, Implement these functions. +} +*/ + +FloatImage * nv::ImageIO::loadFloatTIFF(const char * fileName, Stream & s) +{ + nvCheck(!s.isError()); + + TIFF * tif = TIFFOpen(fileName, "r"); + //TIFF * tif = TIFFClientOpen(fileName, "r", &s, tiffReadWriteProc, tiffReadWriteProc, tiffSeekProc, tiffCloseProc, tiffSizeProc, tiffMapFileProc, tiffUnmapFileProc); + + if (!tif) + { + nvDebug("Can't open '%s' for reading\n", fileName); + return NULL; + } + + ::uint16 spp, bpp, format; + ::uint32 width, height; + TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height); + TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width); + TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp); + TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &spp); + TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &format); + + if (bpp != 8 && bpp != 16 && bpp != 32) { + nvDebug("Can't load '%s', only 1 sample per pixel supported\n", fileName); + TIFFClose(tif); + return NULL; + } + + AutoPtr fimage(new FloatImage()); + fimage->allocate(spp, width, height); + + int linesize = TIFFScanlineSize(tif); + tdata_t buf = (::uint8 *)nv::mem::malloc(linesize); + + for (uint y = 0; y < height; y++) + { + TIFFReadScanline(tif, buf, y, 0); + + for (uint c=0; cscanline(y, c); + + for(uint x = 0; x < width; x++) + { + if (bpp == 8) + { + dst[x] = float(((::uint8 *)buf)[x*spp+c]) / float(0xFF); + } + else if (bpp == 16) + { + dst[x] = float(((::uint16 *)buf)[x*spp+c]) / float(0xFFFF); + } + else if (bpp == 32) + { + if (format==SAMPLEFORMAT_IEEEFP) + { + dst[x] = float(((float *)buf)[x*spp+c]); + } + else + { + dst[x] = float(((::uint32 *)buf)[x*spp+c] >> 8) / float(0xFFFFFF); + } + + } + + } + } + } + + nv::mem::free(buf); + + TIFFClose(tif); + + return fimage.release(); +} + +bool nv::ImageIO::saveFloatTIFF(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components) +{ + nvCheck(fileName != NULL); + nvCheck(fimage != NULL); + nvCheck(base_component + num_components <= fimage->componentNum()); + + const int iW = fimage->width(); + const int iH = fimage->height(); + const int iC = num_components; + + TIFF * image = TIFFOpen(fileName, "w"); + + // Open the TIFF file + if (image == NULL) + { + nvDebug("Could not open '%s' for writing\n", fileName); + return false; + } + + TIFFSetField(image, TIFFTAG_IMAGEWIDTH, iW); + TIFFSetField(image, TIFFTAG_IMAGELENGTH, iH); + TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, iC); + TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); + TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 32); + + uint32 rowsperstrip = TIFFDefaultStripSize(image, (uint32)-1); + + TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip); + TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS); + if (num_components == 3) + { + // Set this so that it can be visualized with pfstools. + TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); + } + TIFFSetField(image, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + + float * scanline = new float[iW * iC]; + for (int y = 0; y < iH; y++) + { + for (int c = 0; c < iC; c++) + { + const float * src = fimage->scanline(y, base_component + c); + for (int x = 0; x < iW; x++) scanline[x * iC + c] = src[x]; + } + if (TIFFWriteScanline(image, scanline, y, 0)==-1) + { + nvDebug("Error writing scanline %d\n", y); + return false; + } + } + delete [] scanline; + + // Close the file + TIFFClose(image); + return true; +} + +#endif + +#if defined(HAVE_OPENEXR) + +namespace +{ + class ExrStream : public Imf::IStream + { + public: + ExrStream(const char * name, Stream & s) : Imf::IStream(name), m_stream(s) + { + nvDebugCheck(s.isLoading()); + } + + virtual bool read(char c[], int n) + { + m_stream.serialize(c, n); + + if (m_stream.isError()) + { + throw Iex::InputExc("I/O error."); + } + + return m_stream.isAtEnd(); + } + + virtual Imf::Int64 tellg() + { + return m_stream.tell(); + } + + virtual void seekg(Imf::Int64 pos) + { + m_stream.seek(pos); + } + + virtual void clear() + { + m_stream.clearError(); + } + + private: + Stream & m_stream; + }; + +} // namespace + +FloatImage * nv::ImageIO::loadFloatEXR(const char * fileName, Stream & s) +{ + nvCheck(s.isLoading()); + nvCheck(!s.isError()); + + ExrStream stream(fileName, s); + Imf::InputFile inputFile(stream); + + Imath::Box2i box = inputFile.header().dataWindow(); + + int width = box.max.x - box.min.y + 1; + int height = box.max.x - box.min.y + 1; + + const Imf::ChannelList & channels = inputFile.header().channels(); + + // Count channels. + uint channelCount= 0; + for (Imf::ChannelList::ConstIterator it = channels.begin(); it != channels.end(); ++it) + { + channelCount++; + } + + // Allocate FloatImage. + AutoPtr fimage(new FloatImage()); + fimage->allocate(channelCount, width, height); + + // Describe image's layout with a framebuffer. + Imf::FrameBuffer frameBuffer; + uint i = 0; + for (Imf::ChannelList::ConstIterator it = channels.begin(); it != channels.end(); ++it, ++i) + { + frameBuffer.insert(it.name(), Imf::Slice(Imf::FLOAT, (char *)fimage->channel(i), sizeof(float), sizeof(float) * width)); + } + + // Read it. + inputFile.setFrameBuffer (frameBuffer); + inputFile.readPixels (box.min.y, box.max.y); + + return fimage.release(); +} + +bool nv::ImageIO::saveFloatEXR(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components) +{ + nvCheck(fileName != NULL); + nvCheck(fimage != NULL); + nvCheck(base_component + num_components <= fimage->componentNum()); + nvCheck(num_components > 0 && num_components <= 4); + + const int w = fimage->width(); + const int h = fimage->height(); + + const char * channelNames[] = {"R", "G", "B", "A"}; + + Imf::Header header (w, h); + + for (uint c = 0; c < num_components; c++) + { + header.channels().insert(channelNames[c], Imf::Channel(Imf::FLOAT)); + } + + Imf::OutputFile file(fileName, header); + Imf::FrameBuffer frameBuffer; + + for (uint c = 0; c < num_components; c++) + { + char * channel = (char *) fimage->channel(base_component + c); + frameBuffer.insert(channelNames[c], Imf::Slice(Imf::FLOAT, channel, sizeof(float), sizeof(float) * w)); + } + + file.setFrameBuffer(frameBuffer); + file.writePixels(h); + + return true; +} + +#endif // defined(HAVE_OPENEXR) + +#if 0 // @@ Disable temporarily. + +FloatImage * nv::ImageIO::loadFloatPFM(const char * fileName, Stream & s) +{ + nvCheck(s.isLoading()); + nvCheck(!s.isError()); + + Tokenizer parser(&s); + + parser.nextToken(); + + bool grayscale; + if (parser.token() == "PF") + { + grayscale = false; + } + else if (parser.token() == "Pf") + { + grayscale = true; + } + else + { + // Invalid file. + return NULL; + } + + parser.nextLine(); + + int width = parser.token().toInt(); parser.nextToken(); + int height = parser.token().toInt(); + + parser.nextLine(); + + float scaleFactor = parser.token().toFloat(); + + if (scaleFactor >= 0) + { + s.setByteOrder(Stream::BigEndian); + } + else + { + s.setByteOrder(Stream::LittleEndian); + } + scaleFactor = fabsf(scaleFactor); + + // Allocate image. + AutoPtr fimage(new FloatImage()); + + if (grayscale) + { + fimage->allocate(1, width, height); + + float * channel = fimage->channel(0); + + for (int i = 0; i < width * height; i++) + { + s << channel[i]; + } + } + else + { + fimage->allocate(3, width, height); + + float * rchannel = fimage->channel(0); + float * gchannel = fimage->channel(1); + float * bchannel = fimage->channel(2); + + for (int i = 0; i < width * height; i++) + { + s << rchannel[i] << gchannel[i] << bchannel[i]; + } + } + + return fimage.release(); +} + +bool nv::ImageIO::saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components) +{ + nvCheck(fileName != NULL); + nvCheck(fimage != NULL); + nvCheck(fimage->componentNum() <= base_component + num_components); + nvCheck(num_components == 1 || num_components == 3); + + StdOutputStream stream(fileName); + TextWriter writer(&stream); + + if (num_components == 1) writer.write("Pf\n"); + else /*if (num_components == 3)*/ writer.write("PF\n"); + + int w = fimage->width(); + int h = fimage->height(); + writer.write("%d %d\n", w, h); + writer.write("%f\n", -1.0f); // little endian with 1.0 scale. + + if (num_components == 1) + { + float * channel = const_cast(fimage->channel(0)); + + for (int i = 0; i < w * h; i++) + { + stream << channel[i]; + } + } + else + { + float * rchannel = const_cast(fimage->channel(0)); + float * gchannel = const_cast(fimage->channel(1)); + float * bchannel = const_cast(fimage->channel(2)); + + for (int i = 0; i < w * h; i++) + { + stream << rchannel[i] << gchannel[i] << bchannel[i]; + } + } + + return true; +} + +#endif + +#if 0 + +/** Save PNG*/ +static bool SavePNG(const PiImage * img, const char * name) { + nvCheck( img != NULL ); + nvCheck( img->mem != NULL ); + + if( piStrCmp(piExtension(name), ".png" ) != 0 ) { + return false; + } + + if( img->flags & PI_IT_CUBEMAP ) { + nvDebug("*** Cannot save cubemaps as PNG."); + return false; + } + if( img->flags & PI_IT_DDS ) { + nvDebug("*** Cannot save DDS surface as PNG."); + return false; + } + + nvDebug( "--- Saving '%s'.\n", name ); + + PiAutoPtr ar( PiFileSystem::CreateFileWriter( name ) ); + if( ar == NULL ) { + nvDebug( "*** SavePNG: Error, cannot save file '%s'.\n", name ); + return false; + } + +/* +public class PNGEnc { + + public static function encode(img:BitmapData):ByteArray { + // Create output byte array + var png:ByteArray = new ByteArray(); + // Write PNG signature + png.writeUnsignedInt(0x89504e47); + png.writeUnsignedInt(0x0D0A1A0A); + // Build IHDR chunk + var IHDR:ByteArray = new ByteArray(); + IHDR.writeInt(img.width); + IHDR.writeInt(img.height); + IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA + IHDR.writeByte(0); + writeChunk(png,0x49484452,IHDR); + // Build IDAT chunk + var IDAT:ByteArray= new ByteArray(); + for(var i:int=0;i < img.height;i++) { + // no filter + IDAT.writeByte(0); + var p:uint; + if ( !img.transparent ) { + for(var j:int=0;j < img.width;j++) { + p = img.getPixel(j,i); + IDAT.writeUnsignedInt( + uint(((p&0xFFFFFF) << 8)|0xFF)); + } + } else { + for(var j:int=0;j < img.width;j++) { + p = img.getPixel32(j,i); + IDAT.writeUnsignedInt( + uint(((p&0xFFFFFF) << 8)| + (shr(p,24)))); + } + } + } + IDAT.compress(); + writeChunk(png,0x49444154,IDAT); + // Build IEND chunk + writeChunk(png,0x49454E44,null); + // return PNG + return png; + } + + private static var crcTable:Array; + private static var crcTableComputed:Boolean = false; + + private static function writeChunk(png:ByteArray, + type:uint, data:ByteArray) { + if (!crcTableComputed) { + crcTableComputed = true; + crcTable = []; + for (var n:uint = 0; n < 256; n++) { + var c:uint = n; + for (var k:uint = 0; k < 8; k++) { + if (c & 1) { + c = uint(uint(0xedb88320) ^ + uint(c >>> 1)); + } else { + c = uint(c >>> 1); + } + } + crcTable[n] = c; + } + } + var len:uint = 0; + if (data != null) { + len = data.length; + } + png.writeUnsignedInt(len); + var p:uint = png.position; + png.writeUnsignedInt(type); + if ( data != null ) { + png.writeBytes(data); + } + var e:uint = png.position; + png.position = p; + var c:uint = 0xffffffff; + for (var i:int = 0; i < (e-p); i++) { + c = uint(crcTable[ + (c ^ png.readUnsignedByte()) & + uint(0xff)] ^ uint(c >>> 8)); + } + c = uint(c^uint(0xffffffff)); + png.position = e; + png.writeUnsignedInt(c); + } +} +*/ +} + +#endif // 0 + +#if 0 + + +namespace ImageIO { + + /** Init ImageIO plugins. */ + void InitPlugins() { + // AddInputPlugin( "", LoadANY ); + AddInputPlugin( "tga", LoadTGA ); +#if HAVE_PNG + AddInputPlugin( "png", LoadPNG ); +#endif +#if HAVE_JPEG + AddInputPlugin( "jpg", LoadJPG ); +#endif + AddInputPlugin( "dds", LoadDDS ); + + AddOutputPlugin( "tga", SaveTGA ); + } + + /** Reset ImageIO plugins. */ + void ResetPlugins() { + s_plugin_load_map.Clear(); + s_plugin_save_map.Clear(); + } + + /** Add an input plugin. */ + void AddInputPlugin( const char * ext, ImageInput_Plugin plugin ) { + s_plugin_load_map.Add(ext, plugin); + } + + /** Add an output plugin. */ + void AddOutputPlugin( const char * ext, ImageOutput_Plugin plugin ) { + s_plugin_save_map.Add(ext, plugin); + } + + + bool Load(PiImage * img, const char * name, PiStream & stream) { + + // Get name extension. + const char * extension = piExtension(name); + + // Skip the dot. + if( *extension == '.' ) { + extension++; + } + + // Lookup plugin in the map. + ImageInput_Plugin plugin = NULL; + if( s_plugin_load_map.Get(extension, &plugin) ) { + return plugin(img, stream); + } + + /*foreach(i, s_plugin_load_map) { + nvDebug("%s %s %d\n", s_plugin_load_map[i].key.GetStr(), extension, 0 == strcmp(extension, s_plugin_load_map[i].key)); + } + + nvDebug("No plugin found for '%s' %d.\n", extension, s_plugin_load_map.Size());*/ + + return false; + } + + bool Save(const PiImage * img, const char * name, PiStream & stream) { + + // Get name extension. + const char * extension = piExtension(name); + + // Skip the dot. + if( *extension == '.' ) { + extension++; + } + + // Lookup plugin in the map. + ImageOutput_Plugin plugin = NULL; + if( s_plugin_save_map.Get(extension, &plugin) ) { + return plugin(img, stream); + } + + return false; + } + +} // ImageIO + +#endif // 0 + diff --git a/externals/NVTT/src/nvimage/ImageIO.h b/externals/NVTT/src/nvimage/ImageIO.h new file mode 100644 index 00000000..0902a5d1 --- /dev/null +++ b/externals/NVTT/src/nvimage/ImageIO.h @@ -0,0 +1,59 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_IMAGEIO_H +#define NV_IMAGE_IMAGEIO_H + +#include + +namespace nv +{ + class Image; + class FloatImage; + class Stream; + + namespace ImageIO + { + NVIMAGE_API Image * load(const char * fileName); + NVIMAGE_API Image * load(const char * fileName, Stream & s); + + NVIMAGE_API FloatImage * loadFloat(const char * fileName); + NVIMAGE_API FloatImage * loadFloat(const char * fileName, Stream & s); + + NVIMAGE_API bool save(const char * fileName, Stream & s, Image * img); + NVIMAGE_API bool save(const char * fileName, Image * img); + NVIMAGE_API bool saveFloat(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); + + NVIMAGE_API Image * loadTGA(Stream & s); + NVIMAGE_API bool saveTGA(Stream & s, const Image * img); + + NVIMAGE_API Image * loadPSD(Stream & s); + +#if defined(HAVE_PNG) + NVIMAGE_API Image * loadPNG(Stream & s); +#endif + +#if defined(HAVE_JPEG) + NVIMAGE_API Image * loadJPG(Stream & s); +#endif + +#if defined(HAVE_TIFF) + NVIMAGE_API FloatImage * loadFloatTIFF(const char * fileName, Stream & s); + + NVIMAGE_API bool saveFloatTIFF(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); +#endif + +#if defined(HAVE_OPENEXR) + NVIMAGE_API FloatImage * loadFloatEXR(const char * fileName, Stream & s); + + NVIMAGE_API bool saveFloatEXR(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); +#endif + + // NVIMAGE_API FloatImage * loadFloatPFM(const char * fileName, Stream & s); + // NVIMAGE_API bool saveFloatPFM(const char * fileName, const FloatImage * fimage, uint base_component, uint num_components); + + } // ImageIO namespace + +} // nv namespace + + +#endif // NV_IMAGE_IMAGEIO_H diff --git a/externals/NVTT/src/nvimage/NormalMap.cpp b/externals/NVTT/src/nvimage/NormalMap.cpp new file mode 100644 index 00000000..2ece5744 --- /dev/null +++ b/externals/NVTT/src/nvimage/NormalMap.cpp @@ -0,0 +1,141 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include + +#include + +#include + + +using namespace nv; + +// Create normal map using the given kernels. +static FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, const Kernel2 * kdu, const Kernel2 * kdv) +{ + nvCheck(kdu != NULL); + nvCheck(kdv != NULL); + nvCheck(img != NULL); + + const uint w = img->width(); + const uint h = img->height(); + + AutoPtr fimage(new FloatImage()); + fimage->allocate(4, w, h); + + // Compute height and store in alpha channel: + float * alphaChannel = fimage->channel(3); + for(uint i = 0; i < w*h; i++) + { + Vector4 color = toVector4(img->pixel(i)); + alphaChannel[i] = dot(color, heightWeights); + } + + float heightScale = 1.0f / 16.0f; // @@ Use a user defined factor. + + for(uint y = 0; y < h; y++) + { + for(uint x = 0; x < w; x++) + { + const float du = fimage->applyKernel(kdu, x, y, 3, wm); + const float dv = fimage->applyKernel(kdv, x, y, 3, wm); + + Vector3 n = normalize(Vector3(du, dv, heightScale)); + + fimage->setPixel(0.5f * n.x() + 0.5f, x, y, 0); + fimage->setPixel(0.5f * n.y() + 0.5f, x, y, 1); + fimage->setPixel(0.5f * n.z() + 0.5f, x, y, 2); + } + } + + return fimage.release(); +} + + +/// Create normal map using the given filter. +FloatImage * nv::createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, NormalMapFilter filter /*= Sobel3x3*/) +{ + nvCheck(img != NULL); + + // Init the kernels. + Kernel2 * kdu = NULL; + Kernel2 * kdv = NULL; + + switch(filter) + { + case NormalMapFilter_Sobel3x3: + kdu = new Kernel2(3); + break; + case NormalMapFilter_Sobel5x5: + kdu = new Kernel2(5); + break; + case NormalMapFilter_Sobel7x7: + kdu = new Kernel2(7); + break; + case NormalMapFilter_Sobel9x9: + kdu = new Kernel2(9); + break; + default: + nvDebugCheck(false); + }; + + kdu->initSobel(); + kdu->normalize(); + + kdv = new Kernel2(*kdu); + kdv->transpose(); + + return ::createNormalMap(img, wm, heightWeights, kdu, kdv); +} + + +/// Create normal map combining multiple sobel filters. +FloatImage * nv::createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, Vector4::Arg filterWeights) +{ + nvCheck(img != NULL); + + Kernel2 * kdu = NULL; + Kernel2 * kdv = NULL; + + kdu = new Kernel2(9); + kdu->initBlendedSobel(filterWeights); + kdu->normalize(); + + kdv = new Kernel2(*kdu); + kdv->transpose(); + + return ::createNormalMap(img, wm, heightWeights, kdu, kdv); +} + +/// Normalize the given image in place. +void nv::normalizeNormalMap(FloatImage * img) +{ + nvCheck(img != NULL); + img->expandNormals(0); + img->normalize(0); + img->packNormals(0); +} + diff --git a/externals/NVTT/src/nvimage/NormalMap.h b/externals/NVTT/src/nvimage/NormalMap.h new file mode 100644 index 00000000..670ead45 --- /dev/null +++ b/externals/NVTT/src/nvimage/NormalMap.h @@ -0,0 +1,55 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_IMAGE_NORMALMAP_H +#define NV_IMAGE_NORMALMAP_H + +#include +#include +#include + + +namespace nv +{ + class Image; + + enum NormalMapFilter + { + NormalMapFilter_Sobel3x3, // fine detail + NormalMapFilter_Sobel5x5, // medium detail + NormalMapFilter_Sobel7x7, // large detail + NormalMapFilter_Sobel9x9, // very large + }; + + FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, NormalMapFilter filter = NormalMapFilter_Sobel3x3); + + FloatImage * createNormalMap(const Image * img, FloatImage::WrapMode wm, Vector4::Arg heightWeights, Vector4::Arg filterWeights); + + void normalizeNormalMap(FloatImage * img); + + // @@ Add generation of DU/DV maps. + + +} // nv namespace + +#endif // NV_IMAGE_NORMALMAP_H diff --git a/externals/NVTT/src/nvimage/NormalMipmap.cpp b/externals/NVTT/src/nvimage/NormalMipmap.cpp new file mode 100644 index 00000000..253c6d41 --- /dev/null +++ b/externals/NVTT/src/nvimage/NormalMipmap.cpp @@ -0,0 +1,98 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +#include +#include + +#include +#include + +using namespace nv; + +FloatImage * nv::createNormalMipmapMap(const FloatImage * img) +{ + nvDebugCheck(img != NULL); + + uint w = img->width(); + uint h = img->height(); + + uint hw = w / 2; + uint hh = h / 2; + + FloatImage dotImg; + dotImg.allocate(1, w, h); + + FloatImage shImg; + shImg.allocate(9, hw, hh); + + SampleDistribution distribution(256); + const uint sampleCount = distribution.sampleCount(); + + for (uint d = 0; d < sampleCount; d++) + { + const float * xChannel = img->channel(0); + const float * yChannel = img->channel(1); + const float * zChannel = img->channel(2); + + Vector3 dir = distribution.sampleDir(d); + + Sh2 basis; + basis.eval(dir); + + for(uint i = 0; i < w*h; i++) + { + Vector3 normal(xChannel[i], yChannel[i], zChannel[i]); + normal = normalizeSafe(normal, Vector3(zero), 0.0f); + + dotImg.setPixel(dot(dir, normal), d); + } + + // @@ It would be nice to have a fastDownSample that took an existing image as an argument, to avoid allocations. + AutoPtr dotMip(dotImg.fastDownSample()); + + for(uint p = 0; p < hw*hh; p++) + { + float f = dotMip->pixel(p); + + // Project irradiance to sh basis and accumulate. + for (uint i = 0; i < 9; i++) + { + float & sum = shImg.channel(i)[p]; + sum += f * basis.elemAt(i); + } + } + } + + + + FloatImage * normalMipmap = new FloatImage; + normalMipmap->allocate(4, hw, hh); + + // Precompute the clamped cosine radiance transfer. + Sh2 prt; + prt.cosineTransfer(); + + // Allocate outside the loop. + Sh2 sh; + + for(uint p = 0; p < hw*hh; p++) + { + for (uint i = 0; i < 9; i++) + { + sh.elemAt(i) = shImg.channel(i)[p]; + } + + // Convolve sh irradiance by radiance transfer. + sh *= prt; + + // Now sh(0) is the ambient occlusion. + // and sh(1) is the normal direction. + + // Should we use SVD to fit only the normals to the SH? + + } + + return normalMipmap; +} + diff --git a/externals/NVTT/src/nvimage/NormalMipmap.h b/externals/NVTT/src/nvimage/NormalMipmap.h new file mode 100644 index 00000000..fc367277 --- /dev/null +++ b/externals/NVTT/src/nvimage/NormalMipmap.h @@ -0,0 +1,17 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_NORMALMIPMAP_H +#define NV_IMAGE_NORMALMIPMAP_H + +#include + + +namespace nv +{ + class FloatImage; + + FloatImage * createNormalMipmapMap(const FloatImage * img); + +} // nv namespace + +#endif // NV_IMAGE_NORMALMIPMAP_H diff --git a/externals/NVTT/src/nvimage/PixelFormat.h b/externals/NVTT/src/nvimage/PixelFormat.h new file mode 100644 index 00000000..0106f3d9 --- /dev/null +++ b/externals/NVTT/src/nvimage/PixelFormat.h @@ -0,0 +1,82 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_IMAGE_PIXELFORMAT_H +#define NV_IMAGE_PIXELFORMAT_H + +#include + + +namespace nv +{ + namespace PixelFormat + { + + // Convert component @a c having @a inbits to the returned value having @a outbits. + inline uint convert(uint c, uint inbits, uint outbits) + { + if (inbits == 0) + { + return 0; + } + else if (inbits >= outbits) + { + // truncate + return c >> (inbits - outbits); + } + else + { + // bitexpand + return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits); + } + } + + // Get pixel component shift and size given its mask. + inline void maskShiftAndSize(uint mask, uint * shift, uint * size) + { + if (!mask) + { + *shift = 0; + *size = 0; + return; + } + + *shift = 0; + while((mask & 1) == 0) { + ++(*shift); + mask >>= 1; + } + + *size = 0; + while((mask & 1) == 1) { + ++(*size); + mask >>= 1; + } + } + + } // PixelFormat namespace + +} // nv namespace + + +#endif // NV_IMAGE_PIXELFORMAT_H diff --git a/externals/NVTT/src/nvimage/PsdFile.h b/externals/NVTT/src/nvimage/PsdFile.h new file mode 100644 index 00000000..41379edd --- /dev/null +++ b/externals/NVTT/src/nvimage/PsdFile.h @@ -0,0 +1,70 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_PSDFILE_H +#define NV_IMAGE_PSDFILE_H + +#include + +namespace nv +{ + enum PsdColorMode + { + PsdColorMode_Bitmap = 0, + PsdColorMode_GrayScale = 1, + PsdColorMode_Indexed = 2, + PsdColorMode_RGB = 3, + PsdColorMode_CMYK = 4, + PsdColorMode_MultiChannel = 7, + PsdColorMode_DuoTone = 8, + PsdColorMode_LabColor = 9 + }; + + /// PSD header. + struct PsdHeader + { + uint32 signature; + uint16 version; + uint8 reserved[6]; + uint16 channel_count; + uint32 height; + uint32 width; + uint16 depth; + uint16 color_mode; + + bool isValid() const + { + return signature == 0x38425053; // '8BPS' + } + + bool isSupported() const + { + if (version != 1) { + nvDebug("*** bad version number %u\n", version); + return false; + } + if (channel_count > 4) { + return false; + } + if (depth != 8) { + return false; + } + if (color_mode != PsdColorMode_RGB) { + return false; + } + return true; + } + }; + + + inline Stream & operator<< (Stream & s, PsdHeader & head) + { + s << head.signature << head.version; + for (int i = 0; i < 6; i++) { + s << head.reserved[i]; + } + return s << head.channel_count << head.height << head.width << head.depth << head.color_mode; + } + +} // nv namespace + +#endif // NV_IMAGE_PSDFILE_H diff --git a/externals/NVTT/src/nvimage/Quantize.cpp b/externals/NVTT/src/nvimage/Quantize.cpp new file mode 100644 index 00000000..56812bd4 --- /dev/null +++ b/externals/NVTT/src/nvimage/Quantize.cpp @@ -0,0 +1,219 @@ +// This code is in the public domain -- castanyo@yahoo.es + +/* +http://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/floyd_steinberg_dithering.html +http://www.gamedev.net/reference/articles/article341.asp + +@@ Look at LPS: http://www.cs.rit.edu/~pga/pics2000/i.html + +This is a really nice guide to dithering algorithms: +http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT + +@@ This code needs to be reviewed, I'm not sure it's correct. +*/ + +#include +#include +#include + +#include + +#include // swap + + +using namespace nv; + + +// Simple quantization. +void nv::Quantize::BinaryAlpha( Image * image, int alpha_threshold /*= 127*/ ) +{ + nvCheck(image != NULL); + + const uint w = image->width(); + const uint h = image->height(); + + for(uint y = 0; y < h; y++) { + for(uint x = 0; x < w; x++) { + + Color32 pixel = image->pixel(x, y); + + // Convert color. + if( pixel.a > alpha_threshold ) pixel.a = 255; + else pixel.a = 0; + + // Store color. + image->pixel(x, y) = pixel; + } + } +} + + +// Simple quantization. +void nv::Quantize::RGB16( Image * image ) +{ + Truncate(image, 5, 6, 5, 8); +} + +// Alpha quantization. +void nv::Quantize::Alpha4( Image * image ) +{ + Truncate(image, 8, 8, 8, 4); +} + + +// Error diffusion. Floyd Steinberg. +void nv::Quantize::FloydSteinberg_RGB16( Image * image ) +{ + FloydSteinberg(image, 5, 6, 5, 8); +} + + +// Error diffusion. Floyd Steinberg. +void nv::Quantize::FloydSteinberg_BinaryAlpha( Image * image, int alpha_threshold /*= 127*/ ) +{ + nvCheck(image != NULL); + + const uint w = image->width(); + const uint h = image->height(); + + // @@ Use fixed point? + float * row0 = new float[(w+2)]; + float * row1 = new float[(w+2)]; + memset(row0, 0, sizeof(float)*(w+2)); + memset(row1, 0, sizeof(float)*(w+2)); + + for(uint y = 0; y < h; y++) { + for(uint x = 0; x < w; x++) { + + Color32 pixel = image->pixel(x, y); + + // Add error. + int alpha = int(pixel.a) + int(row0[1+x]); + + // Convert color. + if( alpha > alpha_threshold ) pixel.a = 255; + else pixel.a = 0; + + // Store color. + image->pixel(x, y) = pixel; + + // Compute new error. + float diff = float(alpha - pixel.a); + + // Propagate new error. + row0[1+x+1] += 7.0f / 16.0f * diff; + row1[1+x-1] += 3.0f / 16.0f * diff; + row1[1+x+0] += 5.0f / 16.0f * diff; + row1[1+x+1] += 1.0f / 16.0f * diff; + } + + swap(row0, row1); + memset(row1, 0, sizeof(float)*(w+2)); + } + + delete [] row0; + delete [] row1; +} + + +// Error diffusion. Floyd Steinberg. +void nv::Quantize::FloydSteinberg_Alpha4( Image * image ) +{ + FloydSteinberg(image, 8, 8, 8, 4); +} + + +void nv::Quantize::Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize) +{ + nvCheck(image != NULL); + + const uint w = image->width(); + const uint h = image->height(); + + for(uint y = 0; y < h; y++) { + for(uint x = 0; x < w; x++) { + + Color32 pixel = image->pixel(x, y); + + // Convert to our desired size, and reconstruct. + pixel.r = PixelFormat::convert(pixel.r, 8, rsize); + pixel.r = PixelFormat::convert(pixel.r, rsize, 8); + + pixel.g = PixelFormat::convert(pixel.g, 8, gsize); + pixel.g = PixelFormat::convert(pixel.g, gsize, 8); + + pixel.b = PixelFormat::convert(pixel.b, 8, bsize); + pixel.b = PixelFormat::convert(pixel.b, bsize, 8); + + pixel.a = PixelFormat::convert(pixel.a, 8, asize); + pixel.a = PixelFormat::convert(pixel.a, asize, 8); + + // Store color. + image->pixel(x, y) = pixel; + } + } +} + + +// Error diffusion. Floyd Steinberg. +void nv::Quantize::FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize) +{ + nvCheck(image != NULL); + + const uint w = image->width(); + const uint h = image->height(); + + Vector4 * row0 = new Vector4[w+2]; + Vector4 * row1 = new Vector4[w+2]; + memset(row0, 0, sizeof(Vector4)*(w+2)); + memset(row1, 0, sizeof(Vector4)*(w+2)); + + for (uint y = 0; y < h; y++) { + for (uint x = 0; x < w; x++) { + + Color32 pixel = image->pixel(x, y); + + // Add error. + pixel.r = clamp(int(pixel.r) + int(row0[1+x].x()), 0, 255); + pixel.g = clamp(int(pixel.g) + int(row0[1+x].y()), 0, 255); + pixel.b = clamp(int(pixel.b) + int(row0[1+x].z()), 0, 255); + pixel.a = clamp(int(pixel.a) + int(row0[1+x].w()), 0, 255); + + int r = pixel.r; + int g = pixel.g; + int b = pixel.b; + int a = pixel.a; + + // Convert to our desired size, and reconstruct. + r = PixelFormat::convert(r, 8, rsize); + r = PixelFormat::convert(r, rsize, 8); + + g = PixelFormat::convert(g, 8, gsize); + g = PixelFormat::convert(g, gsize, 8); + + b = PixelFormat::convert(b, 8, bsize); + b = PixelFormat::convert(b, bsize, 8); + + a = PixelFormat::convert(a, 8, asize); + a = PixelFormat::convert(a, asize, 8); + + // Store color. + image->pixel(x, y) = Color32(r, g, b, a); + + // Compute new error. + Vector4 diff(float(int(pixel.r) - r), float(int(pixel.g) - g), float(int(pixel.b) - b), float(int(pixel.a) - a)); + + // Propagate new error. + row0[1+x+1] += 7.0f / 16.0f * diff; + row1[1+x-1] += 3.0f / 16.0f * diff; + row1[1+x+0] += 5.0f / 16.0f * diff; + row1[1+x+1] += 1.0f / 16.0f * diff; + } + + swap(row0, row1); + memset(row1, 0, sizeof(Vector4)*(w+2)); + } + + delete [] row0; + delete [] row1; +} diff --git a/externals/NVTT/src/nvimage/Quantize.h b/externals/NVTT/src/nvimage/Quantize.h new file mode 100644 index 00000000..5b4a9555 --- /dev/null +++ b/externals/NVTT/src/nvimage/Quantize.h @@ -0,0 +1,31 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_QUANTIZE_H +#define NV_IMAGE_QUANTIZE_H + +#include + + +namespace nv +{ + class Image; + + namespace Quantize + { + void RGB16(Image * img); + void BinaryAlpha(Image * img, int alpha_threshold = 127); + void Alpha4(Image * img); + + void FloydSteinberg_RGB16(Image * img); + void FloydSteinberg_BinaryAlpha(Image * img, int alpha_threshold = 127); + void FloydSteinberg_Alpha4(Image * img); + + void Truncate(Image * image, uint rsize, uint gsize, uint bsize, uint asize); + void FloydSteinberg(Image * image, uint rsize, uint gsize, uint bsize, uint asize); + + // @@ Add palette quantization algorithms! + } +} + + +#endif // NV_IMAGE_QUANTIZE_H diff --git a/externals/NVTT/src/nvimage/TgaFile.h b/externals/NVTT/src/nvimage/TgaFile.h new file mode 100644 index 00000000..bdbfce54 --- /dev/null +++ b/externals/NVTT/src/nvimage/TgaFile.h @@ -0,0 +1,105 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_TGAFILE_H +#define NV_IMAGE_TGAFILE_H + +#include + +namespace nv +{ + +// TGA types +enum TGAType { + TGA_TYPE_INDEXED = 1, + TGA_TYPE_RGB = 2, + TGA_TYPE_GREY = 3, + TGA_TYPE_RLE_INDEXED = 9, + TGA_TYPE_RLE_RGB = 10, + TGA_TYPE_RLE_GREY = 11 +}; + +#define TGA_INTERLEAVE_MASK 0xc0 +#define TGA_INTERLEAVE_NONE 0x00 +#define TGA_INTERLEAVE_2WAY 0x40 +#define TGA_INTERLEAVE_4WAY 0x80 + +#define TGA_ORIGIN_MASK 0x30 +#define TGA_ORIGIN_LEFT 0x00 +#define TGA_ORIGIN_RIGHT 0x10 +#define TGA_ORIGIN_LOWER 0x00 +#define TGA_ORIGIN_UPPER 0x20 + +#define TGA_HAS_ALPHA 0x0F + + +/// Tga Header. +struct TgaHeader { + uint8 id_length; + uint8 colormap_type; + uint8 image_type; + uint16 colormap_index; + uint16 colormap_length; + uint8 colormap_size; + uint16 x_origin; + uint16 y_origin; + uint16 width; + uint16 height; + uint8 pixel_size; + uint8 flags; + + enum { Size = 18 }; //const static int SIZE = 18; +}; + + +/// Tga File. +struct TgaFile { + + TgaFile() { + mem = NULL; + } + ~TgaFile() { + free(); + } + + uint size() const { + return head.width * head.height * (head.pixel_size / 8); + } + void allocate() { + nvCheck( mem == NULL ); + mem = new uint8[size()]; + } + void free() { + delete [] mem; + mem = NULL; + } + + TgaHeader head; + uint8 * mem; +}; + + +inline Stream & operator<< (Stream & s, TgaHeader & head) +{ + s << head.id_length << head.colormap_type << head.image_type; + s << head.colormap_index << head.colormap_length << head.colormap_size; + s << head.x_origin << head.y_origin << head.width << head.height; + s << head.pixel_size << head.flags; + return s; +} + +inline Stream & operator<< (Stream & s, TgaFile & tga) +{ + s << tga.head; + + if( s.isLoading() ) { + tga.allocate(); + } + + s.serialize( tga.mem, tga.size() ); + + return s; +} + +} // nv namespace + +#endif // NV_IMAGE_TGAFILE_H diff --git a/externals/NVTT/src/nvimage/nvimage.h b/externals/NVTT/src/nvimage/nvimage.h new file mode 100644 index 00000000..beb39650 --- /dev/null +++ b/externals/NVTT/src/nvimage/nvimage.h @@ -0,0 +1,22 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_IMAGE_H +#define NV_IMAGE_H + +#include + +// Function linkage +#if NVIMAGE_SHARED +#ifdef NVIMAGE_EXPORTS +#define NVIMAGE_API DLL_EXPORT +#define NVIMAGE_CLASS DLL_EXPORT_CLASS +#else +#define NVIMAGE_API DLL_IMPORT +#define NVIMAGE_CLASS DLL_IMPORT +#endif +#else +#define NVIMAGE_API +#define NVIMAGE_CLASS +#endif + +#endif // NV_IMAGE_H diff --git a/externals/NVTT/src/nvmath/Basis.cpp b/externals/NVTT/src/nvmath/Basis.cpp new file mode 100644 index 00000000..085e25ba --- /dev/null +++ b/externals/NVTT/src/nvmath/Basis.cpp @@ -0,0 +1,173 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +using namespace nv; + + +/// Normalize basis vectors. +void Basis::normalize(float epsilon /*= NV_EPSILON*/) +{ + normal = ::normalize(normal, epsilon); + tangent = ::normalize(tangent, epsilon); + bitangent = ::normalize(bitangent, epsilon); +} + + +/// Gram-Schmidt orthogonalization. +/// @note Works only if the vectors are close to orthogonal. +void Basis::orthonormalize(float epsilon /*= NV_EPSILON*/) +{ + // N' = |N| + // T' = |T - (N' dot T) N'| + // B' = |B - (N' dot B) N' - (T' dot B) T'| + + normal = ::normalize(normal, epsilon); + + tangent -= normal * dot(normal, tangent); + tangent = ::normalize(tangent, epsilon); + + bitangent -= normal * dot(normal, bitangent); + bitangent -= tangent * dot(tangent, bitangent); + bitangent = ::normalize(bitangent, epsilon); +} + + +/// Robust orthonormalization. +/// Returns an orthonormal basis even when the original is degenerate. +void Basis::robustOrthonormalize(float epsilon /*= NV_EPSILON*/) +{ + if (length(normal) < epsilon) + { + normal = cross(tangent, bitangent); + + if (length(normal) < epsilon) + { + tangent = Vector3(1, 0, 0); + bitangent = Vector3(0, 1, 0); + normal = Vector3(0, 0, 1); + return; + } + } + normal = ::normalize(normal, epsilon); + + tangent -= normal * dot(normal, tangent); + bitangent -= normal * dot(normal, bitangent); + + if (length(tangent) < epsilon) + { + if (length(bitangent) < epsilon) + { + buildFrameForDirection(normal); + } + else + { + tangent = cross(bitangent, normal); + nvCheck(isNormalized(tangent, epsilon)); + } + } + else + { + tangent = ::normalize(tangent, epsilon); + bitangent -= tangent * dot(tangent, bitangent); + + if (length(bitangent) < epsilon) + { + bitangent = cross(tangent, normal); + nvCheck(isNormalized(bitangent)); + } + else + { + tangent = ::normalize(tangent, epsilon); + } + } + + // Check vector lengths. + nvCheck(isNormalized(normal, epsilon)); + nvCheck(isNormalized(tangent, epsilon)); + nvCheck(isNormalized(bitangent, epsilon)); + + // Check vector angles. + nvCheck(equal(dot(normal, tangent), 0.0f, epsilon)); + nvCheck(equal(dot(normal, bitangent), 0.0f, epsilon)); + nvCheck(equal(dot(tangent, bitangent), 0.0f, epsilon)); + + // Check vector orientation. + const float det = dot(cross(normal, tangent), bitangent); + nvCheck(equal(det, 1.0f, epsilon) || equal(det, -1.0f, epsilon)); +} + + +/// Build an arbitrary frame for the given direction. +void Basis::buildFrameForDirection(Vector3::Arg d) +{ + nvCheck(isNormalized(d)); + normal = d; + + // Choose minimum axis. + if (fabsf(normal.x()) < fabsf(normal.y()) && fabsf(normal.x()) < fabsf(normal.z())) + { + tangent = Vector3(1, 0, 0); + } + else if (fabsf(normal.y()) < fabsf(normal.z())) + { + tangent = Vector3(0, 1, 0); + } + else + { + tangent = Vector3(0, 0, 1); + } + + // Ortogonalize + tangent -= normal * dot(normal, tangent); + tangent = ::normalize(tangent); + + bitangent = cross(normal, tangent); +} + + + +/* +/// Transform by this basis. (From this basis to object space). +Vector3 Basis::transform(Vector3::Arg v) const +{ + Vector3 o = tangent * v.x(); + o += bitangent * v.y(); + o += normal * v.z(); + return o; +} + +/// Transform by the transpose. (From object space to this basis). +Vector3 Basis::transformT(Vector3::Arg v) +{ + return Vector3(dot(tangent, v), dot(bitangent, v), dot(normal, v)); +} + +/// Transform by the inverse. (From object space to this basis). +/// @note Uses Kramer's rule so the inverse is not accurate if the basis is ill-conditioned. +Vector3 Basis::transformI(Vector3::Arg v) const +{ + const float det = determinant(); + nvCheck(!equalf(det, 0.0f)); + + const float idet = 1.0f / det; + + // Rows of the inverse matrix. + Vector3 r0, r1, r2; + r0.x = (bitangent.y() * normal.z() - bitangent.z() * normal.y()) * idet; + r0.y = -(bitangent.x() * normal.z() - bitangent.z() * normal.x()) * idet; + r0.z = (bitangent.x() * normal.y() - bitangent.y() * normal.x()) * idet; + + r1.x = -(tangent.y() * normal.z() - tangent.z() * normal.y()) * idet; + r1.y = (tangent.x() * normal.z() - tangent.z() * normal.x()) * idet; + r1.z = -(tangent.x() * normal.y() - tangent.y() * normal.x()) * idet; + + r2.x = (tangent.y() * bitangent.z() - tangent.z() * bitangent.y()) * idet; + r2.y = -(tangent.x() * bitangent.z() - tangent.z() * bitangent.x()) * idet; + r2.z = (tangent.x() * bitangent.y() - tangent.y() * bitangent.x()) * idet; + + return Vector3(dot(v, r0), dot(v, r1), dot(v, r2)); +} +*/ + + diff --git a/externals/NVTT/src/nvmath/Basis.h b/externals/NVTT/src/nvmath/Basis.h new file mode 100644 index 00000000..7adde577 --- /dev/null +++ b/externals/NVTT/src/nvmath/Basis.h @@ -0,0 +1,78 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_BASIS_H +#define NV_MATH_BASIS_H + +#include +#include +#include + +namespace nv +{ + + /// Basis class to compute tangent space basis, ortogonalizations and to + /// transform vectors from one space to another. + struct Basis + { + /// Create a null basis. + Basis() : tangent(0, 0, 0), bitangent(0, 0, 0), normal(0, 0, 0) {} + + /// Create a basis given three vectors. + Basis(Vector3::Arg n, Vector3::Arg t, Vector3::Arg b) : tangent(t), bitangent(b), normal(n) {} + + /// Create a basis with the given tangent vectors and the handness. + Basis(Vector3::Arg n, Vector3::Arg t, float sign) + { + build(n, t, sign); + } + + NVMATH_API void normalize(float epsilon = NV_EPSILON); + NVMATH_API void orthonormalize(float epsilon = NV_EPSILON); + NVMATH_API void robustOrthonormalize(float epsilon = NV_EPSILON); + NVMATH_API void buildFrameForDirection(Vector3::Arg d); + + /// Calculate the determinant [ F G N ] to obtain the handness of the basis. + float handness() const + { + return determinant() > 0.0f ? 1.0f : -1.0f; + } + + /// Build a basis from 2 vectors and a handness flag. + void build(Vector3::Arg n, Vector3::Arg t, float sign) + { + normal = n; + tangent = t; + bitangent = sign * cross(t, n); + } + + /// Compute the determinant of this basis. + float determinant() const + { + return + tangent.x() * bitangent.y() * normal.z() - tangent.z() * bitangent.y() * normal.x() + + tangent.y() * bitangent.z() * normal.x() - tangent.y() * bitangent.x() * normal.z() + + tangent.z() * bitangent.x() * normal.y() - tangent.x() * bitangent.z() * normal.y(); + } + + /* + // Get transform matrix for this basis. + NVMATH_API Matrix matrix() const; + + // Transform by this basis. (From this basis to object space). + NVMATH_API Vector3 transform(Vector3::Arg v) const; + + // Transform by the transpose. (From object space to this basis). + NVMATH_API Vector3 transformT(Vector3::Arg v); + + // Transform by the inverse. (From object space to this basis). + NVMATH_API Vector3 transformI(Vector3::Arg v) const; + */ + + Vector3 tangent; + Vector3 bitangent; + Vector3 normal; + }; + +} // nv namespace + +#endif // NV_MATH_BASIS_H diff --git a/externals/NVTT/src/nvmath/Box.h b/externals/NVTT/src/nvmath/Box.h new file mode 100644 index 00000000..212432d8 --- /dev/null +++ b/externals/NVTT/src/nvmath/Box.h @@ -0,0 +1,140 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_BOX_H +#define NV_MATH_BOX_H + +#include + +#include // FLT_MAX + +namespace nv +{ + +/// Axis Aligned Bounding Box. +class Box +{ +public: + + /// Default ctor. + Box() { }; + + /// Copy ctor. + Box( const Box & b ) : m_mins(b.m_mins), m_maxs(b.m_maxs) { } + + /// Init ctor. + Box( Vector3::Arg mins, Vector3::Arg maxs ) : m_mins(mins), m_maxs(maxs) { } + + // Cast operators. + operator const float * () const { return reinterpret_cast(this); } + + /// Min corner of the box. + Vector3 mins() const { return m_mins; } + + /// Max corner of the box. + Vector3 maxs() const { return m_maxs; } + + /// Clear the bounds. + void clearBounds() + { + m_mins.set(FLT_MAX, FLT_MAX, FLT_MAX); + m_maxs.set(-FLT_MAX, -FLT_MAX, -FLT_MAX); + } + + /// Build a cube centered on center and with edge = 2*dist + void cube(Vector3::Arg center, float dist) + { + setCenterExtents(center, Vector3(dist, dist, dist)); + } + + /// Build a box, given center and extents. + void setCenterExtents(Vector3::Arg center, Vector3::Arg extents) + { + m_mins = center - extents; + m_maxs = center + extents; + } + + /// Get box center. + Vector3 center() const + { + return (m_mins + m_maxs) * 0.5f; + } + + /// Return extents of the box. + Vector3 extents() const + { + return (m_maxs - m_mins) * 0.5f; + } + + /// Return extents of the box. + scalar extents(uint axis) const + { + nvDebugCheck(axis < 3); + if (axis == 0) return (m_maxs.x() - m_mins.x()) * 0.5f; + if (axis == 1) return (m_maxs.y() - m_mins.y()) * 0.5f; + if (axis == 2) return (m_maxs.z() - m_mins.z()) * 0.5f; + nvAssume(false); + return 0.0f; + } + + /// Add a point to this box. + void addPointToBounds(Vector3::Arg p) + { + m_mins = min(m_mins, p); + m_maxs = max(m_maxs, p); + } + + /// Add a box to this box. + void addBoxToBounds(const Box & b) + { + m_mins = min(m_mins, b.m_mins); + m_maxs = max(m_maxs, b.m_maxs); + } + + /// Translate box. + void translate(Vector3::Arg v) + { + m_mins += v; + m_maxs += v; + } + + /// Scale the box. + void scale(float s) + { + m_mins *= s; + m_maxs *= s; + } + + /// Get the area of the box. + float area() const + { + const Vector3 d = extents(); + return 8.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z()); + } + + /// Get the volume of the box. + float volume() const + { + Vector3 d = extents(); + return 8.0f * (d.x() * d.y() * d.z()); + } + + /// Return true if the box contains the given point. + bool contains(Vector3::Arg p) const + { + return + m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() && + m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z(); + } + +private: + + Vector3 m_mins; + Vector3 m_maxs; +}; + + + +} // nv namespace + + +#endif // NV_MATH_BOX_H diff --git a/externals/NVTT/src/nvmath/CMakeLists.txt b/externals/NVTT/src/nvmath/CMakeLists.txt new file mode 100644 index 00000000..96aec78d --- /dev/null +++ b/externals/NVTT/src/nvmath/CMakeLists.txt @@ -0,0 +1,33 @@ +PROJECT(nvmath) + +SET(MATH_SRCS + nvmath.h + Vector.h + Matrix.h + Quaternion.h + Box.h + Color.h + Montecarlo.h Montecarlo.cpp + Random.h Random.cpp + SphericalHarmonic.h SphericalHarmonic.cpp + Basis.h Basis.cpp + Triangle.h Triangle.cpp TriBox.cpp) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +# targets +ADD_DEFINITIONS(-DNVMATH_EXPORTS) + +IF(NVMATH_SHARED) + ADD_DEFINITIONS(-DNVMATH_SHARED=1) + ADD_LIBRARY(nvmath SHARED ${MATH_SRCS}) +ELSE(NVMATH_SHARED) + ADD_LIBRARY(nvmath ${MATH_SRCS}) +ENDIF(NVMATH_SHARED) + +TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore) + +INSTALL(TARGETS nvmath + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) diff --git a/externals/NVTT/src/nvmath/Color.h b/externals/NVTT/src/nvmath/Color.h new file mode 100644 index 00000000..b6d548b6 --- /dev/null +++ b/externals/NVTT/src/nvmath/Color.h @@ -0,0 +1,179 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_COLOR_H +#define NV_MATH_COLOR_H + +#include +#include + +namespace nv +{ + +/// 64 bit color stored as BGRA. +class NVMATH_CLASS Color64 +{ +public: + Color64() { } + Color64(const Color64 & c) : u(c.u) { } + Color64(uint16 R, uint16 G, uint16 B, uint16 A) { setRGBA(R, G, B, A); } + explicit Color64(uint64 U) : u(U) { } + + void setRGBA(uint16 R, uint16 G, uint16 B, uint16 A) + { + r = R; + g = G; + b = B; + a = A; + } + + operator uint64 () const { + return u; + } + + union { + struct { +#if NV_LITTLE_ENDIAN + uint16 r, a, b, g; +#else + uint16 a: 16; + uint16 r: 16; + uint16 g: 16; + uint16 b: 16; +#endif + }; + uint64 u; + }; +}; + +/// 32 bit color stored as BGRA. +class NVMATH_CLASS Color32 +{ +public: + Color32() { } + Color32(const Color32 & c) : u(c.u) { } + Color32(uint8 R, uint8 G, uint8 B) { setRGBA(R, G, B, 0xFF); } + Color32(uint8 R, uint8 G, uint8 B, uint8 A) { setRGBA( R, G, B, A); } + //Color32(uint8 c[4]) { setRGBA(c[0], c[1], c[2], c[3]); } + //Color32(float R, float G, float B) { setRGBA(uint(R*255), uint(G*255), uint(B*255), 0xFF); } + //Color32(float R, float G, float B, float A) { setRGBA(uint(R*255), uint(G*255), uint(B*255), uint(A*255)); } + explicit Color32(uint32 U) : u(U) { } + + void setRGBA(uint8 R, uint8 G, uint8 B, uint8 A) + { + r = R; + g = G; + b = B; + a = A; + } + + void setBGRA(uint8 B, uint8 G, uint8 R, uint8 A = 0xFF) + { + r = R; + g = G; + b = B; + a = A; + } + + operator uint32 () const { + return u; + } + + union { + struct { +#if NV_LITTLE_ENDIAN + uint8 b, g, r, a; +#else + uint8 a: 8; + uint8 r: 8; + uint8 g: 8; + uint8 b: 8; +#endif + }; + uint32 u; + }; +}; + + +/// 16 bit 565 BGR color. +class NVMATH_CLASS Color16 +{ +public: + Color16() { } + Color16(const Color16 & c) : u(c.u) { } + explicit Color16(uint16 U) : u(U) { } + + union { + struct { +#if NV_LITTLE_ENDIAN + uint16 b : 5; + uint16 g : 6; + uint16 r : 5; +#else + uint16 r : 5; + uint16 g : 6; + uint16 b : 5; +#endif + }; + uint16 u; + }; +}; + + +/// Clamp color components. +inline Vector3 colorClamp(Vector3::Arg c) +{ + return Vector3(clamp(c.x(), 0.0f, 1.0f), clamp(c.y(), 0.0f, 1.0f), clamp(c.z(), 0.0f, 1.0f)); +} + +/// Clamp without allowing the hue to change. +inline Vector3 colorNormalize(Vector3::Arg c) +{ + float scale = 1.0f; + if (c.x() > scale) scale = c.x(); + if (c.y() > scale) scale = c.y(); + if (c.z() > scale) scale = c.z(); + return c / scale; +} + +/// Convert Color32 to Color16. +inline Color16 toColor16(Color32 c) +{ + Color16 color; + // rrrrrggggggbbbbb + // rrrrr000gggggg00bbbbb000 +// color.u = (c.u >> 3) & 0x1F; +// color.u |= (c.u >> 5) & 0x7E0; +// color.u |= (c.u >> 8) & 0xF800; + + color.r = c.r >> 3; + color.g = c.g >> 2; + color.b = c.b >> 3; + return color; +} + + +/// Promote 16 bit color to 32 bit using regular bit expansion. +inline Color32 toColor32(Color16 c) +{ + Color32 color; +// c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000); +// c.u |= (c.u >> 5) & 0x070007; +// c.u |= (c.u >> 6) & 0x000300; + + color.b = (c.b << 3) | (c.b >> 2); + color.g = (c.g << 2) | (c.g >> 4); + color.r = (c.r << 3) | (c.r >> 2); + color.a = 0xFF; + + return color; +} + +inline Vector4 toVector4(Color32 c) +{ + const float scale = 1.0f / 255.0f; + return Vector4(c.r * scale, c.g * scale, c.b * scale, c.a * scale); +} + +} // nv namespace + +#endif // NV_MATH_COLOR_H diff --git a/externals/NVTT/src/nvmath/Matrix.h b/externals/NVTT/src/nvmath/Matrix.h new file mode 100644 index 00000000..28749bae --- /dev/null +++ b/externals/NVTT/src/nvmath/Matrix.h @@ -0,0 +1,1000 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_MATRIX_H +#define NV_MATH_MATRIX_H + +#include +#include + +namespace nv +{ + +// @@ Use scalar defined in Vector.h, but should use a template instead. + +/// 4x4 transformation matrix. +/// -# Matrices are stored in memory in column major order. +/// -# Points are to be though of as column vectors. +/// -# Transformation of a point p by a matrix M is: p' = M * p +class NVMATH_CLASS Matrix +{ +public: + typedef Matrix const & Arg; + + Matrix(); + Matrix(zero_t); + Matrix(identity_t); + Matrix(const Matrix & m); + + scalar data(uint idx) const; + scalar & data(uint idx); + scalar get(uint row, uint col) const; + scalar operator()(uint row, uint col) const; + scalar & operator()(uint row, uint col); + const scalar * ptr() const; + + Vector4 row(uint i) const; + Vector4 column(uint i) const; + + void scale(scalar s); + void scale(Vector3::Arg s); + void translate(Vector3::Arg t); + void rotate(scalar theta, scalar v0, scalar v1, scalar v2); + scalar determinant() const; + + void apply(Matrix::Arg m); + +private: + scalar m_data[16]; +}; + + +inline Matrix::Matrix() +{ +} + +inline Matrix::Matrix(zero_t) +{ + for(int i = 0; i < 16; i++) { + m_data[i] = 0.0f; + } +} + +inline Matrix::Matrix(identity_t) +{ + for(int i = 0; i < 4; i++) { + for(int j = 0; j < 4; j++) { + m_data[4*j+i] = (i == j) ? 1.0f : 0.0f; + } + } +} + +inline Matrix::Matrix(const Matrix & m) +{ + for(int i = 0; i < 16; i++) { + m_data[i] = m.m_data[i]; + } +} + + +// Accessors +inline scalar Matrix::data(uint idx) const +{ + nvDebugCheck(idx < 16); + return m_data[idx]; +} +inline scalar & Matrix::data(uint idx) +{ + nvDebugCheck(idx < 16); + return m_data[idx]; +} +inline scalar Matrix::get(uint row, uint col) const +{ + nvDebugCheck(row < 4 && col < 4); + return m_data[col * 4 + row]; +} +inline scalar Matrix::operator()(uint row, uint col) const +{ + nvDebugCheck(row < 4 && col < 4); + return m_data[col * 4 + row]; +} +inline scalar & Matrix::operator()(uint row, uint col) +{ + nvDebugCheck(row < 4 && col < 4); + return m_data[col * 4 + row]; +} + +inline const scalar * Matrix::ptr() const +{ + return m_data; +} + +inline Vector4 Matrix::row(uint i) const +{ + nvDebugCheck(i < 4); + return Vector4(get(i, 0), get(i, 1), get(i, 2), get(i, 3)); +} + +inline Vector4 Matrix::column(uint i) const +{ + nvDebugCheck(i < 4); + return Vector4(get(0, i), get(1, i), get(2, i), get(3, i)); +} + +/// Apply scale. +inline void Matrix::scale(scalar s) +{ + m_data[0] *= s; m_data[1] *= s; m_data[2] *= s; m_data[3] *= s; + m_data[4] *= s; m_data[5] *= s; m_data[6] *= s; m_data[7] *= s; + m_data[8] *= s; m_data[9] *= s; m_data[10] *= s; m_data[11] *= s; + m_data[12] *= s; m_data[13] *= s; m_data[14] *= s; m_data[15] *= s; +} + +/// Apply scale. +inline void Matrix::scale(Vector3::Arg s) +{ + m_data[0] *= s.x(); m_data[1] *= s.x(); m_data[2] *= s.x(); m_data[3] *= s.x(); + m_data[4] *= s.y(); m_data[5] *= s.y(); m_data[6] *= s.y(); m_data[7] *= s.y(); + m_data[8] *= s.z(); m_data[9] *= s.z(); m_data[10] *= s.z(); m_data[11] *= s.z(); +} + +/// Apply translation. +inline void Matrix::translate(Vector3::Arg t) +{ + m_data[12] = m_data[0] * t.x() + m_data[4] * t.y() + m_data[8] * t.z() + m_data[12]; + m_data[13] = m_data[1] * t.x() + m_data[5] * t.y() + m_data[9] * t.z() + m_data[13]; + m_data[14] = m_data[2] * t.x() + m_data[6] * t.y() + m_data[10] * t.z() + m_data[14]; + m_data[15] = m_data[3] * t.x() + m_data[7] * t.y() + m_data[11] * t.z() + m_data[15]; +} + +Matrix rotation(scalar theta, scalar v0, scalar v1, scalar v2); + +/// Apply rotation. +inline void Matrix::rotate(scalar theta, scalar v0, scalar v1, scalar v2) +{ + Matrix R(rotation(theta, v0, v1, v2)); + apply(R); +} + +/// Apply transform. +inline void Matrix::apply(Matrix::Arg m) +{ + nvDebugCheck(this != &m); + + for(int i = 0; i < 4; i++) { + const scalar ai0 = get(i,0), ai1 = get(i,1), ai2 = get(i,2), ai3 = get(i,3); + m_data[0 + i] = ai0 * m(0,0) + ai1 * m(1,0) + ai2 * m(2,0) + ai3 * m(3,0); + m_data[4 + i] = ai0 * m(0,1) + ai1 * m(1,1) + ai2 * m(2,1) + ai3 * m(3,1); + m_data[8 + i] = ai0 * m(0,2) + ai1 * m(1,2) + ai2 * m(2,2) + ai3 * m(3,2); + m_data[12+ i] = ai0 * m(0,3) + ai1 * m(1,3) + ai2 * m(2,3) + ai3 * m(3,3); + } +} + +/// Get scale matrix. +inline Matrix scale(Vector3::Arg s) +{ + Matrix m(identity); + m(0,0) = s.x(); + m(1,1) = s.y(); + m(2,2) = s.z(); + return m; +} + +/// Get scale matrix. +inline Matrix scale(scalar s) +{ + Matrix m(identity); + m(0,0) = m(1,1) = m(2,2) = s; + return m; +} + +/// Get translation matrix. +inline Matrix translation(Vector3::Arg t) +{ + Matrix m(identity); + m(0,3) = t.x(); + m(1,3) = t.y(); + m(2,3) = t.z(); + return m; +} + +/// Get rotation matrix. +inline Matrix rotation(scalar theta, scalar v0, scalar v1, scalar v2) +{ + scalar cost = cosf(theta); + scalar sint = sinf(theta); + + Matrix m(identity); + + if( 1 == v0 && 0 == v1 && 0 == v2 ) { + m(1,1) = cost; m(2,1) = -sint; + m(1,2) = sint; m(2,2) = cost; + } + else if( 0 == v0 && 1 == v1 && 0 == v2 ) { + m(0,0) = cost; m(2,0) = sint; + m(1,2) = -sint; m(2,2) = cost; + } + else if( 0 == v0 && 0 == v1 && 1 == v2 ) { + m(0,0) = cost; m(1,0) = -sint; + m(0,1) = sint; m(1,1) = cost; + } + else { + scalar a2, b2, c2; + a2 = v0 * v0; + b2 = v1 * v1; + c2 = v2 * v2; + + scalar iscale = 1.0f / sqrtf(a2 + b2 + c2); + v0 *= iscale; + v1 *= iscale; + v2 *= iscale; + + scalar abm, acm, bcm; + scalar mcos, asin, bsin, csin; + mcos = 1.0f - cost; + abm = v0 * v1 * mcos; + acm = v0 * v2 * mcos; + bcm = v1 * v2 * mcos; + asin = v0 * sint; + bsin = v1 * sint; + csin = v2 * sint; + m(0,0) = a2 * mcos + cost; + m(1,0) = abm - csin; + m(2,0) = acm + bsin; + m(3,0) = abm + csin; + m(1,1) = b2 * mcos + cost; + m(2,1) = bcm - asin; + m(3,1) = acm - bsin; + m(1,2) = bcm + asin; + m(2,2) = c2 * mcos + cost; + } + return m; +} + +//Matrix rotation(scalar yaw, scalar pitch, scalar roll); +//Matrix skew(scalar angle, Vector3::Arg v1, Vector3::Arg v2); + +/// Get frustum matrix. +inline Matrix frustum(scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear, scalar zFar) +{ + Matrix m(zero); + + scalar doubleznear = 2.0f * zNear; + scalar one_deltax = 1.0f / (xmax - xmin); + scalar one_deltay = 1.0f / (ymax - ymin); + scalar one_deltaz = 1.0f / (zFar - zNear); + + m(0,0) = doubleznear * one_deltax; + m(1,1) = doubleznear * one_deltay; + m(0,2) = (xmax + xmin) * one_deltax; + m(1,2) = (ymax + ymin) * one_deltay; + m(2,2) = -(zFar + zNear) * one_deltaz; + m(3,2) = -1.0f; + m(2,3) = -(zFar * doubleznear) * one_deltaz; + + return m; +} + +/// Get infinite frustum matrix. +inline Matrix frustum(scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear) +{ + Matrix m(zero); + + scalar doubleznear = 2.0f * zNear; + scalar one_deltax = 1.0f / (xmax - xmin); + scalar one_deltay = 1.0f / (ymax - ymin); + scalar nudge = 1.0; // 0.999; + + m(0,0) = doubleznear * one_deltax; + m(1,1) = doubleznear * one_deltay; + m(0,2) = (xmax + xmin) * one_deltax; + m(1,2) = (ymax + ymin) * one_deltay; + m(2,2) = -1.0f * nudge; + m(3,2) = -1.0f; + m(2,3) = -doubleznear * nudge; + + return m; +} + +/// Get perspective matrix. +inline Matrix perspective(scalar fovy, scalar aspect, scalar zNear, scalar zFar) +{ + scalar xmax = zNear * tan(fovy / 2); + scalar xmin = -xmax; + + scalar ymax = xmax / aspect; + scalar ymin = -ymax; + + return frustum(xmin, xmax, ymin, ymax, zNear, zFar); +} + +/// Get infinite perspective matrix. +inline Matrix perspective(scalar fovy, scalar aspect, scalar zNear) +{ + scalar x = zNear * tan(fovy / 2); + scalar y = x / aspect; + return frustum( -x, x, -y, y, zNear ); +} + +/// Get matrix determinant. +inline scalar Matrix::determinant() const +{ + return + m_data[3] * m_data[6] * m_data[ 9] * m_data[12] - m_data[2] * m_data[7] * m_data[ 9] * m_data[12] - m_data[3] * m_data[5] * m_data[10] * m_data[12] + m_data[1] * m_data[7] * m_data[10] * m_data[12] + + m_data[2] * m_data[5] * m_data[11] * m_data[12] - m_data[1] * m_data[6] * m_data[11] * m_data[12] - m_data[3] * m_data[6] * m_data[ 8] * m_data[13] + m_data[2] * m_data[7] * m_data[ 8] * m_data[13] + + m_data[3] * m_data[4] * m_data[10] * m_data[13] - m_data[0] * m_data[7] * m_data[10] * m_data[13] - m_data[2] * m_data[4] * m_data[11] * m_data[13] + m_data[0] * m_data[6] * m_data[11] * m_data[13] + + m_data[3] * m_data[5] * m_data[ 8] * m_data[14] - m_data[1] * m_data[7] * m_data[ 8] * m_data[14] - m_data[3] * m_data[4] * m_data[ 9] * m_data[14] + m_data[0] * m_data[7] * m_data[ 9] * m_data[14] + + m_data[1] * m_data[4] * m_data[11] * m_data[14] - m_data[0] * m_data[5] * m_data[11] * m_data[14] - m_data[2] * m_data[5] * m_data[ 8] * m_data[15] + m_data[1] * m_data[6] * m_data[ 8] * m_data[15] + + m_data[2] * m_data[4] * m_data[ 9] * m_data[15] - m_data[0] * m_data[6] * m_data[ 9] * m_data[15] - m_data[1] * m_data[4] * m_data[10] * m_data[15] + m_data[0] * m_data[5] * m_data[10] * m_data[15]; +} + +inline Matrix transpose(Matrix::Arg m) +{ + Matrix r; + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) + { + r(i, j) = m(j, i); + } + } + return r; +} + +inline Matrix inverse(Matrix::Arg m) +{ + Matrix r; + r.data( 0) = m.data(6)*m.data(11)*m.data(13) - m.data(7)*m.data(10)*m.data(13) + m.data(7)*m.data(9)*m.data(14) - m.data(5)*m.data(11)*m.data(14) - m.data(6)*m.data(9)*m.data(15) + m.data(5)*m.data(10)*m.data(15); + r.data( 1) = m.data(3)*m.data(10)*m.data(13) - m.data(2)*m.data(11)*m.data(13) - m.data(3)*m.data(9)*m.data(14) + m.data(1)*m.data(11)*m.data(14) + m.data(2)*m.data(9)*m.data(15) - m.data(1)*m.data(10)*m.data(15); + r.data( 2) = m.data(2)*m.data( 7)*m.data(13) - m.data(3)*m.data( 6)*m.data(13) + m.data(3)*m.data(5)*m.data(14) - m.data(1)*m.data( 7)*m.data(14) - m.data(2)*m.data(5)*m.data(15) + m.data(1)*m.data( 6)*m.data(15); + r.data( 3) = m.data(3)*m.data( 6)*m.data( 9) - m.data(2)*m.data( 7)*m.data( 9) - m.data(3)*m.data(5)*m.data(10) + m.data(1)*m.data( 7)*m.data(10) + m.data(2)*m.data(5)*m.data(11) - m.data(1)*m.data( 6)*m.data(11); + r.data( 4) = m.data(7)*m.data(10)*m.data(12) - m.data(6)*m.data(11)*m.data(12) - m.data(7)*m.data(8)*m.data(14) + m.data(4)*m.data(11)*m.data(14) + m.data(6)*m.data(8)*m.data(15) - m.data(4)*m.data(10)*m.data(15); + r.data( 5) = m.data(2)*m.data(11)*m.data(12) - m.data(3)*m.data(10)*m.data(12) + m.data(3)*m.data(8)*m.data(14) - m.data(0)*m.data(11)*m.data(14) - m.data(2)*m.data(8)*m.data(15) + m.data(0)*m.data(10)*m.data(15); + r.data( 6) = m.data(3)*m.data( 6)*m.data(12) - m.data(2)*m.data( 7)*m.data(12) - m.data(3)*m.data(4)*m.data(14) + m.data(0)*m.data( 7)*m.data(14) + m.data(2)*m.data(4)*m.data(15) - m.data(0)*m.data( 6)*m.data(15); + r.data( 7) = m.data(2)*m.data( 7)*m.data( 8) - m.data(3)*m.data( 6)*m.data( 8) + m.data(3)*m.data(4)*m.data(10) - m.data(0)*m.data( 7)*m.data(10) - m.data(2)*m.data(4)*m.data(11) + m.data(0)*m.data( 6)*m.data(11); + r.data( 8) = m.data(5)*m.data(11)*m.data(12) - m.data(7)*m.data( 9)*m.data(12) + m.data(7)*m.data(8)*m.data(13) - m.data(4)*m.data(11)*m.data(13) - m.data(5)*m.data(8)*m.data(15) + m.data(4)*m.data( 9)*m.data(15); + r.data( 9) = m.data(3)*m.data( 9)*m.data(12) - m.data(1)*m.data(11)*m.data(12) - m.data(3)*m.data(8)*m.data(13) + m.data(0)*m.data(11)*m.data(13) + m.data(1)*m.data(8)*m.data(15) - m.data(0)*m.data( 9)*m.data(15); + r.data(10) = m.data(1)*m.data( 7)*m.data(12) - m.data(3)*m.data( 5)*m.data(12) + m.data(3)*m.data(4)*m.data(13) - m.data(0)*m.data( 7)*m.data(13) - m.data(1)*m.data(4)*m.data(15) + m.data(0)*m.data( 5)*m.data(15); + r.data(11) = m.data(3)*m.data( 5)*m.data( 8) - m.data(1)*m.data( 7)*m.data( 8) - m.data(3)*m.data(4)*m.data( 9) + m.data(0)*m.data( 7)*m.data( 9) + m.data(1)*m.data(4)*m.data(11) - m.data(0)*m.data( 5)*m.data(11); + r.data(12) = m.data(6)*m.data( 9)*m.data(12) - m.data(5)*m.data(10)*m.data(12) - m.data(6)*m.data(8)*m.data(13) + m.data(4)*m.data(10)*m.data(13) + m.data(5)*m.data(8)*m.data(14) - m.data(4)*m.data( 9)*m.data(14); + r.data(13) = m.data(1)*m.data(10)*m.data(12) - m.data(2)*m.data( 9)*m.data(12) + m.data(2)*m.data(8)*m.data(13) - m.data(0)*m.data(10)*m.data(13) - m.data(1)*m.data(8)*m.data(14) + m.data(0)*m.data( 9)*m.data(14); + r.data(14) = m.data(2)*m.data( 5)*m.data(12) - m.data(1)*m.data( 6)*m.data(12) - m.data(2)*m.data(4)*m.data(13) + m.data(0)*m.data( 6)*m.data(13) + m.data(1)*m.data(4)*m.data(14) - m.data(0)*m.data( 5)*m.data(14); + r.data(15) = m.data(1)*m.data( 6)*m.data( 8) - m.data(2)*m.data( 5)*m.data( 8) + m.data(2)*m.data(4)*m.data( 9) - m.data(0)*m.data( 6)*m.data( 9) - m.data(1)*m.data(4)*m.data(10) + m.data(0)*m.data( 5)*m.data(10); + r.scale(1.0f / m.determinant()); + return r; +} + +inline Matrix isometryInverse(Matrix::Arg m) +{ + Matrix r(identity); + + // transposed 3x3 upper left matrix + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + r(i, j) = m(j, i); + } + } + + // translate by the negative offsets + r.translate(-Vector3(m.data(12), m.data(13), m.data(14))); + + return r; +} + +//Matrix affineInverse(Matrix::Arg m); + +/// Transform the given 3d point with the given matrix. +inline Vector3 transformPoint(Matrix::Arg m, Vector3::Arg p) +{ + return Vector3( + p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2) + m(0,3), + p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2) + m(1,3), + p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2) + m(2,3)); +} + +/// Transform the given 3d vector with the given matrix. +inline Vector3 transformVector(Matrix::Arg m, Vector3::Arg p) +{ + return Vector3( + p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2), + p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2), + p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2)); +} + +/// Transform the given 4d vector with the given matrix. +inline Vector4 transform(Matrix::Arg m, Vector4::Arg p) +{ + return Vector4( + p.x() * m(0,0) + p.y() * m(0,1) + p.z() * m(0,2) + p.w() * m(0,3), + p.x() * m(1,0) + p.y() * m(1,1) + p.z() * m(1,2) + p.w() * m(1,3), + p.x() * m(2,0) + p.y() * m(2,1) + p.z() * m(2,2) + p.w() * m(2,3), + p.x() * m(3,0) + p.y() * m(3,1) + p.z() * m(3,2) + p.w() * m(3,3)); +} + +inline Matrix mul(Matrix::Arg a, Matrix::Arg b) +{ + // @@ Is this the right order? mul(a, b) = b * a + Matrix m = a; + m.apply(b); + return m; +} + +} // nv namespace + + + + +#if 0 + /** @name Special matrices. */ + //@{ + /** Generate a translation matrix. */ + void TranslationMatrix(const Vec3 & v) { + data[0] = 1; data[1] = 0; data[2] = 0; data[3] = 0; + data[4] = 0; data[5] = 1; data[6] = 0; data[7] = 0; + data[8] = 0; data[9] = 0; data[10] = 1; data[11] = 0; + data[12] = v.x; data[13] = v.y; data[14] = v.z; data[15] = 1; + } + + /** Rotate theta degrees around v. */ + void RotationMatrix( scalar theta, scalar v0, scalar v1, scalar v2 ) { + scalar cost = cos(theta); + scalar sint = sin(theta); + + if( 1 == v0 && 0 == v1 && 0 == v2 ) { + data[0] = 1.0f; data[1] = 0.0f; data[2] = 0.0f; data[3] = 0.0f; + data[4] = 0.0f; data[5] = cost; data[6] = -sint;data[7] = 0.0f; + data[8] = 0.0f; data[9] = sint; data[10] = cost;data[11] = 0.0f; + data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f; + } + else if( 0 == v0 && 1 == v1 && 0 == v2 ) { + data[0] = cost; data[1] = 0.0f; data[2] = sint; data[3] = 0.0f; + data[4] = 0.0f; data[5] = 1.0f; data[6] = 0.0f; data[7] = 0.0f; + data[8] = -sint;data[9] = 0.0f;data[10] = cost; data[11] = 0.0f; + data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f; + } + else if( 0 == v0 && 0 == v1 && 1 == v2 ) { + data[0] = cost; data[1] = -sint;data[2] = 0.0f; data[3] = 0.0f; + data[4] = sint; data[5] = cost; data[6] = 0.0f; data[7] = 0.0f; + data[8] = 0.0f; data[9] = 0.0f; data[10] = 1.0f;data[11] = 0.0f; + data[12] = 0.0f;data[13] = 0.0f;data[14] = 0.0f;data[15] = 1.0f; + } + else { + //we need scale a,b,c to unit length. + scalar a2, b2, c2; + a2 = v0 * v0; + b2 = v1 * v1; + c2 = v2 * v2; + + scalar iscale = 1.0f / sqrtf(a2 + b2 + c2); + v0 *= iscale; + v1 *= iscale; + v2 *= iscale; + + scalar abm, acm, bcm; + scalar mcos, asin, bsin, csin; + mcos = 1.0f - cost; + abm = v0 * v1 * mcos; + acm = v0 * v2 * mcos; + bcm = v1 * v2 * mcos; + asin = v0 * sint; + bsin = v1 * sint; + csin = v2 * sint; + data[0] = a2 * mcos + cost; + data[1] = abm - csin; + data[2] = acm + bsin; + data[3] = abm + csin; + data[4] = 0.0f; + data[5] = b2 * mcos + cost; + data[6] = bcm - asin; + data[7] = acm - bsin; + data[8] = 0.0f; + data[9] = bcm + asin; + data[10] = c2 * mcos + cost; + data[11] = 0.0f; + data[12] = 0.0f; + data[13] = 0.0f; + data[14] = 0.0f; + data[15] = 1.0f; + } + } + + /* + void SkewMatrix(scalar angle, const Vec3 & v1, const Vec3 & v2) { + v1.Normalize(); + v2.Normalize(); + + Vec3 v3; + v3.Cross(v1, v2); + v3.Normalize(); + + // Get skew factor. + scalar costheta = Vec3DotProduct(v1, v2); + scalar sintheta = Real.Sqrt(1 - costheta * costheta); + scalar skew = tan(Trig.DegreesToRadians(angle) + acos(sintheta)) * sintheta - costheta; + + // Build orthonormal matrix. + v1 = FXVector3.Cross(v3, v2); + v1.Normalize(); + + Matrix R = Matrix::Identity; + R[0, 0] = v3.X; // Not sure this is in the correct order... + R[1, 0] = v3.Y; + R[2, 0] = v3.Z; + R[0, 1] = v1.X; + R[1, 1] = v1.Y; + R[2, 1] = v1.Z; + R[0, 2] = v2.X; + R[1, 2] = v2.Y; + R[2, 2] = v2.Z; + + // Build skew matrix. + Matrix S = Matrix::Identity; + S[2, 1] = -skew; + + // Return skew transform. + return R * S * R.Transpose; // Not sure this is in the correct order... + } + */ + + /** + * Generate rotation matrix for the euler angles. This is the same as computing + * 3 rotation matrices and multiplying them together in our custom order. + * + * @todo Have to recompute this code for our new convention. + **/ + void RotationMatrix( scalar yaw, scalar pitch, scalar roll ) { + scalar sy = sin(yaw+ToRadian(90)); + scalar cy = cos(yaw+ToRadian(90)); + scalar sp = sin(pitch-ToRadian(90)); + scalar cp = cos(pitch-ToRadian(90)); + scalar sr = sin(roll); + scalar cr = cos(roll); + + data[0] = cr*cy + sr*sp*sy; + data[1] = cp*sy; + data[2] = -sr*cy + cr*sp*sy; + data[3] = 0; + + data[4] = -cr*sy + sr*sp*cy; + data[5] = cp*cy; + data[6] = sr*sy + cr*sp*cy; + data[7] = 0; + + data[8] = sr*cp; + data[9] = -sp; + data[10] = cr*cp; + data[11] = 0; + + data[12] = 0; + data[13] = 0; + data[14] = 0; + data[15] = 1; + } + + /** Create a frustum matrix with the far plane at the infinity. */ + void Frustum( scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear, scalar zFar ) { + scalar one_deltax, one_deltay, one_deltaz, doubleznear; + + doubleznear = 2.0f * zNear; + one_deltax = 1.0f / (xmax - xmin); + one_deltay = 1.0f / (ymax - ymin); + one_deltaz = 1.0f / (zFar - zNear); + + data[0] = (scalar)(doubleznear * one_deltax); + data[1] = 0.0f; + data[2] = 0.0f; + data[3] = 0.0f; + data[4] = 0.0f; + data[5] = (scalar)(doubleznear * one_deltay); + data[6] = 0.f; + data[7] = 0.f; + data[8] = (scalar)((xmax + xmin) * one_deltax); + data[9] = (scalar)((ymax + ymin) * one_deltay); + data[10] = (scalar)(-(zFar + zNear) * one_deltaz); + data[11] = -1.f; + data[12] = 0.f; + data[13] = 0.f; + data[14] = (scalar)(-(zFar * doubleznear) * one_deltaz); + data[15] = 0.f; + } + + /** Create a frustum matrix with the far plane at the infinity. */ + void FrustumInf( scalar xmin, scalar xmax, scalar ymin, scalar ymax, scalar zNear ) { + scalar one_deltax, one_deltay, doubleznear, nudge; + + doubleznear = 2.0f * zNear; + one_deltax = 1.0f / (xmax - xmin); + one_deltay = 1.0f / (ymax - ymin); + nudge = 1.0; // 0.999; + + data[0] = doubleznear * one_deltax; + data[1] = 0.0f; + data[2] = 0.0f; + data[3] = 0.0f; + + data[4] = 0.0f; + data[5] = doubleznear * one_deltay; + data[6] = 0.f; + data[7] = 0.f; + + data[8] = (xmax + xmin) * one_deltax; + data[9] = (ymax + ymin) * one_deltay; + data[10] = -1.0f * nudge; + data[11] = -1.0f; + + data[12] = 0.f; + data[13] = 0.f; + data[14] = -doubleznear * nudge; + data[15] = 0.f; + } + + /** Create an inverse frustum matrix with the far plane at the infinity. */ + void FrustumInfInv( scalar left, scalar right, scalar bottom, scalar top, scalar zNear ) { + // this matrix is wrong (not tested scalarly) I think it should be transposed. + data[0] = (right - left) / (2 * zNear); + data[1] = 0; + data[2] = 0; + data[3] = (right + left) / (2 * zNear); + data[4] = 0; + data[5] = (top - bottom) / (2 * zNear); + data[6] = 0; + data[7] = (top + bottom) / (2 * zNear); + data[8] = 0; + data[9] = 0; + data[10] = 0; + data[11] = -1; + data[12] = 0; + data[13] = 0; + data[14] = -1 / (2 * zNear); + data[15] = 1 / (2 * zNear); + } + + /** Create an homogeneous projection matrix. */ + void Perspective( scalar fov, scalar aspect, scalar zNear, scalar zFar ) { + scalar xmin, xmax, ymin, ymax; + + xmax = zNear * tan( fov/2 ); + xmin = -xmax; + + ymax = xmax / aspect; + ymin = -ymax; + + Frustum(xmin, xmax, ymin, ymax, zNear, zFar); + } + + /** Create a projection matrix with the far plane at the infinity. */ + void PerspectiveInf( scalar fov, scalar aspect, scalar zNear ) { + scalar x = zNear * tan( fov/2 ); + scalar y = x / aspect; + FrustumInf( -x, x, -y, y, zNear ); + } + + /** Create an inverse projection matrix with far plane at the infinity. */ + void PerspectiveInfInv( scalar fov, scalar aspect, scalar zNear ) { + scalar x = zNear * tan( fov/2 ); + scalar y = x / aspect; + FrustumInfInv( -x, x, -y, y, zNear ); + } + + /** Build bone matrix from quatertion and offset. */ + void BoneMatrix(const Quat & q, const Vec3 & offset) { + scalar x2, y2, z2, xx, xy, xz, yy, yz, zz, wx, wy, wz; + + // calculate coefficients + x2 = q.x + q.x; + y2 = q.y + q.y; + z2 = q.z + q.z; + + xx = q.x * x2; xy = q.x * y2; xz = q.x * z2; + yy = q.y * y2; yz = q.y * z2; zz = q.z * z2; + wx = q.w * x2; wy = q.w * y2; wz = q.w * z2; + + data[0] = 1.0f - (yy + zz); + data[1] = xy - wz; + data[2] = xz + wy; + data[3] = 0.0f; + + data[4] = xy + wz; + data[5] = 1.0f - (xx + zz); + data[6] = yz - wx; + data[7] = 0.0f; + + data[8] = xz - wy; + data[9] = yz + wx; + data[10] = 1.0f - (xx + yy); + data[11] = 0.0f; + + data[12] = offset.x; + data[13] = offset.y; + data[14] = offset.z; + data[15] = 1.0f; + } + + //@} + + + /** @name Transformations: */ + //@{ + + /** Apply a general scale. */ + void Scale( scalar x, scalar y, scalar z ) { + data[0] *= x; data[4] *= y; data[8] *= z; + data[1] *= x; data[5] *= y; data[9] *= z; + data[2] *= x; data[6] *= y; data[10] *= z; + data[3] *= x; data[7] *= y; data[11] *= z; + } + + /** Apply a rotation of theta degrees around the axis v*/ + void Rotate( scalar theta, const Vec3 & v ) { + Matrix b; + b.RotationMatrix( theta, v[0], v[1], v[2] ); + Multiply4x3( b ); + } + + /** Apply a rotation of theta degrees around the axis v*/ + void Rotate( scalar theta, scalar v0, scalar v1, scalar v2 ) { + Matrix b; + b.RotationMatrix( theta, v0, v1, v2 ); + Multiply4x3( b ); + } + + /** + * Translate the matrix by t. This is the same as multiplying by a + * translation matrix with the given offset. + * this = T * this + */ + void Translate( const Vec3 &t ) { + data[12] = data[0] * t.x + data[4] * t.y + data[8] * t.z + data[12]; + data[13] = data[1] * t.x + data[5] * t.y + data[9] * t.z + data[13]; + data[14] = data[2] * t.x + data[6] * t.y + data[10] * t.z + data[14]; + data[15] = data[3] * t.x + data[7] * t.y + data[11] * t.z + data[15]; + } + + /** + * Translate the matrix by x, y, z. This is the same as multiplying by a + * translation matrix with the given offsets. + */ + void Translate( scalar x, scalar y, scalar z ) { + data[12] = data[0] * x + data[4] * y + data[8] * z + data[12]; + data[13] = data[1] * x + data[5] * y + data[9] * z + data[13]; + data[14] = data[2] * x + data[6] * y + data[10] * z + data[14]; + data[15] = data[3] * x + data[7] * y + data[11] * z + data[15]; + } + + /** Compute the transposed matrix. */ + void Transpose() { + piSwap(data[1], data[4]); + piSwap(data[2], data[8]); + piSwap(data[6], data[9]); + piSwap(data[3], data[12]); + piSwap(data[7], data[13]); + piSwap(data[11], data[14]); + } + + /** Compute the inverse of a rigid-body/isometry/orthonormal matrix. */ + void IsometryInverse() { + // transposed 3x3 upper left matrix + piSwap(data[1], data[4]); + piSwap(data[2], data[8]); + piSwap(data[6], data[9]); + + // translate by the negative offsets + Vec3 v(-data[12], -data[13], -data[14]); + data[12] = data[13] = data[14] = 0; + Translate(v); + } + + /** Compute the inverse of the affine portion of this matrix. */ + void AffineInverse() { + data[12] = data[13] = data[14] = 0; + Transpose(); + } + //@} + + /** @name Matrix operations: */ + //@{ + + /** Return the determinant of this matrix. */ + scalar Determinant() const { + return data[0] * data[5] * data[10] * data[15] + + data[1] * data[6] * data[11] * data[12] + + data[2] * data[7] * data[ 8] * data[13] + + data[3] * data[4] * data[ 9] * data[14] - + data[3] * data[6] * data[ 9] * data[12] - + data[2] * data[5] * data[ 8] * data[15] - + data[1] * data[4] * data[11] * data[14] - + data[0] * data[7] * data[10] * data[12]; + } + + + /** Standard matrix product: this *= B. */ + void Multiply4x4( const Matrix & restrict B ) { + Multiply4x4(*this, B); + } + + /** Standard matrix product: this = A * B. this != B*/ + void Multiply4x4( const Matrix & A, const Matrix & restrict B ) { + piDebugCheck(this != &B); + + for(int i = 0; i < 4; i++) { + const scalar ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3); + GetElem(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); + GetElem(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); + GetElem(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); + GetElem(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); + } + + /* Unrolled but does not allow this == A + data[0] = A.data[0] * B.data[0] + A.data[4] * B.data[1] + A.data[8] * B.data[2] + A.data[12] * B.data[3]; + data[1] = A.data[1] * B.data[0] + A.data[5] * B.data[1] + A.data[9] * B.data[2] + A.data[13] * B.data[3]; + data[2] = A.data[2] * B.data[0] + A.data[6] * B.data[1] + A.data[10] * B.data[2] + A.data[14] * B.data[3]; + data[3] = A.data[3] * B.data[0] + A.data[7] * B.data[1] + A.data[11] * B.data[2] + A.data[15] * B.data[3]; + data[4] = A.data[0] * B.data[4] + A.data[4] * B.data[5] + A.data[8] * B.data[6] + A.data[12] * B.data[7]; + data[5] = A.data[1] * B.data[4] + A.data[5] * B.data[5] + A.data[9] * B.data[6] + A.data[13] * B.data[7]; + data[6] = A.data[2] * B.data[4] + A.data[6] * B.data[5] + A.data[10] * B.data[6] + A.data[14] * B.data[7]; + data[7] = A.data[3] * B.data[4] + A.data[7] * B.data[5] + A.data[11] * B.data[6] + A.data[15] * B.data[7]; + data[8] = A.data[0] * B.data[8] + A.data[4] * B.data[9] + A.data[8] * B.data[10] + A.data[12] * B.data[11]; + data[9] = A.data[1] * B.data[8] + A.data[5] * B.data[9] + A.data[9] * B.data[10] + A.data[13] * B.data[11]; + data[10]= A.data[2] * B.data[8] + A.data[6] * B.data[9] + A.data[10] * B.data[10] + A.data[14] * B.data[11]; + data[11]= A.data[3] * B.data[8] + A.data[7] * B.data[9] + A.data[11] * B.data[10] + A.data[15] * B.data[11]; + data[12]= A.data[0] * B.data[12] + A.data[4] * B.data[13] + A.data[8] * B.data[14] + A.data[12] * B.data[15]; + data[13]= A.data[1] * B.data[12] + A.data[5] * B.data[13] + A.data[9] * B.data[14] + A.data[13] * B.data[15]; + data[14]= A.data[2] * B.data[12] + A.data[6] * B.data[13] + A.data[10] * B.data[14] + A.data[14] * B.data[15]; + data[15]= A.data[3] * B.data[12] + A.data[7] * B.data[13] + A.data[11] * B.data[14] + A.data[15] * B.data[15]; + */ + } + + /** Standard matrix product: this *= B. */ + void Multiply4x3( const Matrix & restrict B ) { + Multiply4x3(*this, B); + } + + /** Standard product of matrices, where the last row is [0 0 0 1]. */ + void Multiply4x3( const Matrix & A, const Matrix & restrict B ) { + piDebugCheck(this != &B); + + for(int i = 0; i < 3; i++) { + const scalar ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3); + GetElem(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); + GetElem(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); + GetElem(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); + GetElem(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); + } + data[3] = 0.0f; data[7] = 0.0f; data[11] = 0.0f; data[15] = 1.0f; + + /* Unrolled but does not allow this == A + data[0] = a.data[0] * b.data[0] + a.data[4] * b.data[1] + a.data[8] * b.data[2] + a.data[12] * b.data[3]; + data[1] = a.data[1] * b.data[0] + a.data[5] * b.data[1] + a.data[9] * b.data[2] + a.data[13] * b.data[3]; + data[2] = a.data[2] * b.data[0] + a.data[6] * b.data[1] + a.data[10] * b.data[2] + a.data[14] * b.data[3]; + data[3] = 0.0f; + data[4] = a.data[0] * b.data[4] + a.data[4] * b.data[5] + a.data[8] * b.data[6] + a.data[12] * b.data[7]; + data[5] = a.data[1] * b.data[4] + a.data[5] * b.data[5] + a.data[9] * b.data[6] + a.data[13] * b.data[7]; + data[6] = a.data[2] * b.data[4] + a.data[6] * b.data[5] + a.data[10] * b.data[6] + a.data[14] * b.data[7]; + data[7] = 0.0f; + data[8] = a.data[0] * b.data[8] + a.data[4] * b.data[9] + a.data[8] * b.data[10] + a.data[12] * b.data[11]; + data[9] = a.data[1] * b.data[8] + a.data[5] * b.data[9] + a.data[9] * b.data[10] + a.data[13] * b.data[11]; + data[10]= a.data[2] * b.data[8] + a.data[6] * b.data[9] + a.data[10] * b.data[10] + a.data[14] * b.data[11]; + data[11]= 0.0f; + data[12]= a.data[0] * b.data[12] + a.data[4] * b.data[13] + a.data[8] * b.data[14] + a.data[12] * b.data[15]; + data[13]= a.data[1] * b.data[12] + a.data[5] * b.data[13] + a.data[9] * b.data[14] + a.data[13] * b.data[15]; + data[14]= a.data[2] * b.data[12] + a.data[6] * b.data[13] + a.data[10] * b.data[14] + a.data[14] * b.data[15]; + data[15]= 1.0f; + */ + } + //@} + + + /** @name Vector operations: */ + //@{ + + /** Transform 3d vector (w=0). */ + void TransformVec3(const Vec3 & restrict orig, Vec3 * restrict dest) const { + piDebugCheck(&orig != dest); + dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8]; + dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9]; + dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10]; + } + /** Transform 3d vector by the transpose (w=0). */ + void TransformVec3T(const Vec3 & restrict orig, Vec3 * restrict dest) const { + piDebugCheck(&orig != dest); + dest->x = orig.x * data[0] + orig.y * data[1] + orig.z * data[2]; + dest->y = orig.x * data[4] + orig.y * data[5] + orig.z * data[6]; + dest->z = orig.x * data[8] + orig.y * data[9] + orig.z * data[10]; + } + + /** Transform a 3d homogeneous vector, where the fourth coordinate is assumed to be 1. */ + void TransformPoint(const Vec3 & restrict orig, Vec3 * restrict dest) const { + piDebugCheck(&orig != dest); + dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12]; + dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13]; + dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14]; + } + + /** Transform a point, normalize it, and return w. */ + scalar TransformPointAndNormalize(const Vec3 & restrict orig, Vec3 * restrict dest) const { + piDebugCheck(&orig != dest); + scalar w; + dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12]; + dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13]; + dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14]; + w = 1 / (orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15]); + *dest *= w; + return w; + } + + /** Transform a point and return w. */ + scalar TransformPointReturnW(const Vec3 & restrict orig, Vec3 * restrict dest) const { + piDebugCheck(&orig != dest); + dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12]; + dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13]; + dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14]; + return orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15]; + } + + /** Transform a normalized 3d point by a 4d matrix and return the resulting 4d vector. */ + void TransformVec4(const Vec3 & orig, Vec4 * dest) const { + dest->x = orig.x * data[0] + orig.y * data[4] + orig.z * data[8] + data[12]; + dest->y = orig.x * data[1] + orig.y * data[5] + orig.z * data[9] + data[13]; + dest->z = orig.x * data[2] + orig.y * data[6] + orig.z * data[10] + data[14]; + dest->w = orig.x * data[3] + orig.y * data[7] + orig.z * data[11] + data[15]; + } + //@} + + /** @name Matrix analysis. */ + //@{ + + /** Get the ZYZ euler angles from the matrix. Assumes the matrix is orthonormal. */ + void GetEulerAnglesZYZ(scalar * s, scalar * t, scalar * r) const { + if( GetElem(2,2) < 1.0f ) { + if( GetElem(2,2) > -1.0f ) { + // cs*ct*cr-ss*sr -ss*ct*cr-cs*sr st*cr + // cs*ct*sr+ss*cr -ss*ct*sr+cs*cr st*sr + // -cs*st ss*st ct + *s = atan2(GetElem(1,2), -GetElem(0,2)); + *t = acos(GetElem(2,2)); + *r = atan2(GetElem(2,1), GetElem(2,0)); + } + else { + // -c(s-r) s(s-r) 0 + // s(s-r) c(s-r) 0 + // 0 0 -1 + *s = atan2(GetElem(0, 1), -GetElem(0, 0)); // = s-r + *t = PI; + *r = 0; + } + } + else { + // c(s+r) -s(s+r) 0 + // s(s+r) c(s+r) 0 + // 0 0 1 + *s = atan2(GetElem(0, 1), GetElem(0, 0)); // = s+r + *t = 0; + *r = 0; + } + } + + //@} + + MATHLIB_API friend PiStream & operator<< ( PiStream & s, Matrix & m ); + + /** Print to debug output. */ + void Print() const { + piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[0], data[4], data[8], data[12] ); + piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[1], data[5], data[9], data[13] ); + piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[2], data[6], data[10], data[14] ); + piDebug( "[ %5.2f %5.2f %5.2f %5.2f ]\n", data[3], data[7], data[11], data[15] ); + } + + +public: + + scalar data[16]; + +}; +#endif + + + + +#endif // NV_MATH_MATRIX_H diff --git a/externals/NVTT/src/nvmath/Montecarlo.cpp b/externals/NVTT/src/nvmath/Montecarlo.cpp new file mode 100644 index 00000000..4cd23a51 --- /dev/null +++ b/externals/NVTT/src/nvmath/Montecarlo.cpp @@ -0,0 +1,156 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +using namespace nv; + + +void SampleDistribution::redistribute(Method method/*=Method_NRook*/, Distribution dist/*=Distribution_Cosine*/) +{ + switch(method) + { + case Method_Random: + redistributeRandom(dist); + break; + case Method_Stratified: + redistributeStratified(dist); + break; + case Method_NRook: + redistributeNRook(dist); + break; + }; +} + +void SampleDistribution::redistributeRandom(const Distribution dist) +{ + const uint sampleCount = m_sampleArray.count(); + + // This is the worst method possible! + for(uint i = 0; i < sampleCount; i++) + { + float x = m_rand.getFloat(); + float y = m_rand.getFloat(); + + // Map uniform distribution in the square to the (hemi)sphere. + if( dist == Distribution_Uniform ) { + m_sampleArray[i].setUV(acosf(1 - 2 * x), 2 * PI * y); + } + else { + nvDebugCheck(dist == Distribution_Cosine); + m_sampleArray[i].setUV(acosf(sqrtf(x)), 2 * PI * y); + } + } +} + + +void SampleDistribution::redistributeStratified(const Distribution dist) +{ + const uint sampleCount = m_sampleArray.count(); + const uint sqrtSampleCount = uint(sqrtf(float(sampleCount))); + + nvDebugCheck(sqrtSampleCount*sqrtSampleCount == sampleCount); // Must use exact powers! + + // Create a uniform distribution of points on the hemisphere with low variance. + for(uint v = 0, i = 0; v < sqrtSampleCount; v++) { + for(uint u = 0; u < sqrtSampleCount; u++, i++) { + float x = (u + m_rand.getFloat()) / float(sqrtSampleCount); + float y = (v + m_rand.getFloat()) / float(sqrtSampleCount); + + // Map uniform distribution in the square to the (hemi)sphere. + if( dist == Distribution_Uniform ) { + m_sampleArray[i].setUV(acosf(1 - 2 * x), 2 * PI * y); + } + else { + nvDebugCheck(dist == Distribution_Cosine); + m_sampleArray[i].setUV(acosf(sqrtf(x)), 2 * PI * y); + } + } + } +} + + +/** Multi-Stage N-rooks Sampling Method. + * See: http://www.acm.org/jgt/papers/WangSung9/9 + */ +void SampleDistribution::multiStageNRooks(const int size, int* cells) +{ + if (size == 1) { + return; + } + + int size1 = size >> 1; + int size2 = size >> 1; + + if (size & 1) { + if (m_rand.getFloat() > 0.5) { + size1++; + } + else { + size2++; + } + } + + int* upper_cells = new int[size1]; + int* lower_cells = new int[size2]; + + int i, j; + for(i = 0, j = 0; i < size - 1; i += 2, j++) { + if (m_rand.get() & 1) { + upper_cells[j] = cells[i]; + lower_cells[j] = cells[i + 1]; + } + else { + upper_cells[j] = cells[i + 1]; + lower_cells[j] = cells[i]; + } + } + + if (size1 != size2) { + if (size1 > size2) { + upper_cells[j] = cells[i]; + } + else { + lower_cells[j] = cells[i]; + } + } + + multiStageNRooks(size1, upper_cells); + memcpy(cells, upper_cells, size1 * sizeof(int)); + delete [] upper_cells; + + multiStageNRooks(size2, lower_cells); + memcpy(cells + size1, lower_cells, size2 * sizeof(int)); + delete [] lower_cells; +} + + +void SampleDistribution::redistributeNRook(const Distribution dist) +{ + const uint sampleCount = m_sampleArray.count(); + + // Generate nrook cells + int * cells = new int[sampleCount]; + for(uint32 i = 0; i < sampleCount; i++) + { + cells[i] = i; + } + multiStageNRooks(sampleCount, cells); + + for(uint i = 0; i < sampleCount; i++) + { + float x = (i + m_rand.getFloat()) / sampleCount; + float y = (cells[i] + m_rand.getFloat()) / sampleCount; + + // Map uniform distribution in the square to the (hemi)sphere. + if( dist == Distribution_Uniform ) { + m_sampleArray[i].setUV(acosf(1 - 2 * x), 2 * PI * y); + } + else { + nvDebugCheck(dist == Distribution_Cosine); + m_sampleArray[i].setUV(acosf(sqrtf(x)), 2 * PI * y); + } + } + + delete [] cells; +} + diff --git a/externals/NVTT/src/nvmath/Montecarlo.h b/externals/NVTT/src/nvmath/Montecarlo.h new file mode 100644 index 00000000..efda3153 --- /dev/null +++ b/externals/NVTT/src/nvmath/Montecarlo.h @@ -0,0 +1,84 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_MONTECARLO_H +#define NV_MATH_MONTECARLO_H + +#include +#include + +namespace nv +{ + +/// A random sample distribution. +class SampleDistribution +{ +public: + + // Sampling method. + enum Method { + Method_Random, + Method_Stratified, + Method_NRook + }; + + // Distribution functions. + enum Distribution { + Distribution_Uniform, + Distribution_Cosine + }; + + /// Constructor. + SampleDistribution(int num) + { + m_sampleArray.resize(num); + } + + void redistribute(Method method=Method_NRook, Distribution dist=Distribution_Cosine); + + /// Get parametric coordinates of the sample. + Vector2 sample(int i) { return m_sampleArray[i].uv; } + + /// Get sample direction. + Vector3 sampleDir(int i) { return m_sampleArray[i].dir; } + + /// Get number of samples. + uint sampleCount() const { return m_sampleArray.count(); } + +private: + + void redistributeRandom(const Distribution dist); + void redistributeStratified(const Distribution dist); + void multiStageNRooks(const int size, int* cells); + void redistributeNRook(const Distribution dist); + + + /// A sample of the random distribution. + struct Sample + { + /// Set sample given the 3d coordinates. + void setDir(float x, float y, float z) { + dir.set(x, y, z); + uv.set(acosf(z), atan2f(y, x)); + } + + /// Set sample given the 2d parametric coordinates. + void setUV(float u, float v) { + uv.set(u, v); + dir.set(sinf(u) * cosf(v), sinf(u) * sinf(v), cosf(u)); + } + + Vector2 uv; + Vector3 dir; + }; + + /// Random seed. + MTRand m_rand; + + /// Samples. + Array m_sampleArray; + +}; + +} // nv namespace + +#endif // NV_MATH_MONTECARLO_H diff --git a/externals/NVTT/src/nvmath/Plane.cpp b/externals/NVTT/src/nvmath/Plane.cpp new file mode 100644 index 00000000..979c099e --- /dev/null +++ b/externals/NVTT/src/nvmath/Plane.cpp @@ -0,0 +1,17 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include "Plane.h" +#include "Matrix.h" + +namespace nv +{ + Plane transformPlane(const Matrix& m, Plane::Arg p) + { + Vector3 newVec = transformVector(m, p.vector()); + + Vector3 ptInPlane = p.offset() * p.vector(); + ptInPlane = transformPoint(m, ptInPlane); + + return Plane(newVec, ptInPlane); + } +} diff --git a/externals/NVTT/src/nvmath/Plane.h b/externals/NVTT/src/nvmath/Plane.h new file mode 100644 index 00000000..bc7128c4 --- /dev/null +++ b/externals/NVTT/src/nvmath/Plane.h @@ -0,0 +1,77 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_PLANE_H +#define NV_MATH_PLANE_H + +#include +#include + +namespace nv +{ + class Matrix; + + + class NVMATH_CLASS Plane + { + public: + typedef Plane const & Arg; + + Plane(); + Plane(float x, float y, float z, float w); + Plane(Vector4::Arg v); + Plane(Vector3::Arg v, float d); + Plane(Vector3::Arg normal, Vector3::Arg point); + + const Plane & operator=(Plane::Arg v); + + Vector3 vector() const; + scalar offset() const; + + const Vector4 & asVector() const; + Vector4 & asVector(); + + void operator*=(scalar s); + + private: + Vector4 p; + }; + + inline Plane::Plane() {} + inline Plane::Plane(float x, float y, float z, float w) : p(x, y, z, w) {} + inline Plane::Plane(Vector4::Arg v) : p(v) {} + inline Plane::Plane(Vector3::Arg v, float d) : p(v, d) {} + inline Plane::Plane(Vector3::Arg normal, Vector3::Arg point) : p(normal, dot(normal, point)) {} + + inline const Plane & Plane::operator=(Plane::Arg v) { p = v.p; return *this; } + + inline Vector3 Plane::vector() const { return p.xyz(); } + inline scalar Plane::offset() const { return p.w(); } + + inline const Vector4 & Plane::asVector() const { return p; } + inline Vector4 & Plane::asVector() { return p; } + + // Normalize plane. + inline Plane normalize(Plane::Arg plane, float epsilon = NV_EPSILON) + { + const float len = length(plane.vector()); + nvDebugCheck(!isZero(len, epsilon)); + const float inv = 1.0f / len; + return Plane(plane.asVector() * inv); + } + + // Get the distance from the given point to this plane. + inline float distance(Plane::Arg plane, Vector3::Arg point) + { + return dot(plane.vector(), point) - plane.offset(); + } + + inline void Plane::operator*=(scalar s) + { + scale(p, s); + } + + Plane transformPlane(const Matrix&, Plane::Arg); + +} // nv namespace + +#endif // NV_MATH_PLANE_H diff --git a/externals/NVTT/src/nvmath/Quaternion.h b/externals/NVTT/src/nvmath/Quaternion.h new file mode 100644 index 00000000..b5007cca --- /dev/null +++ b/externals/NVTT/src/nvmath/Quaternion.h @@ -0,0 +1,128 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_QUATERNION_H +#define NV_MATH_QUATERNION_H + +#include +#include + +namespace nv +{ + + class NVMATH_CLASS Quaternion + { + public: + typedef Quaternion const & Arg; + + Quaternion(); + explicit Quaternion(zero_t); + Quaternion(float x, float y, float z, float w); + Quaternion(Vector4::Arg v); + + const Quaternion & operator=(Quaternion::Arg v); + + scalar x() const; + scalar y() const; + scalar z() const; + scalar w() const; + + const Vector4 & asVector() const; + Vector4 & asVector(); + + private: + Vector4 q; + }; + + inline Quaternion::Quaternion() {} + inline Quaternion::Quaternion(zero_t) : q(zero) {} + inline Quaternion::Quaternion(float x, float y, float z, float w) : q(x, y, z, w) {} + inline Quaternion::Quaternion(Vector4::Arg v) : q(v) {} + + inline const Quaternion & Quaternion::operator=(Quaternion::Arg v) { q = v.q; return *this; } + + inline scalar Quaternion::x() const { return q.x(); } + inline scalar Quaternion::y() const { return q.y(); } + inline scalar Quaternion::z() const { return q.z(); } + inline scalar Quaternion::w() const { return q.w(); } + + inline const Vector4 & Quaternion::asVector() const { return q; } + inline Vector4 & Quaternion::asVector() { return q; } + + + inline Quaternion mul(Quaternion::Arg a, Quaternion::Arg b) + { + // @@ Efficient SIMD implementation? + return Quaternion( + + a.x() * b.w() + a.y()*b.z() - a.z()*b.y() + a.w()*b.x(), + - a.x() * b.z() + a.y()*b.w() + a.z()*b.x() + a.w()*b.y(), + + a.x() * b.y() - a.y()*b.x() + a.z()*b.w() + a.w()*b.z(), + - a.x() * b.x() - a.y()*b.y() - a.z()*b.z() + a.w()*b.w()); + } + + inline Quaternion scale(Quaternion::Arg q, float s) + { + return scale(q.asVector(), s); + } + inline Quaternion operator *(Quaternion::Arg q, float s) + { + return scale(q, s); + } + inline Quaternion operator *(float s, Quaternion::Arg q) + { + return scale(q, s); + } + + inline Quaternion scale(Quaternion::Arg q, Vector4::Arg s) + { + return scale(q.asVector(), s); + } + /*inline Quaternion operator *(Quaternion::Arg q, Vector4::Arg s) + { + return scale(q, s); + } + inline Quaternion operator *(Vector4::Arg s, Quaternion::Arg q) + { + return scale(q, s); + }*/ + + inline Quaternion conjugate(Quaternion::Arg q) + { + return scale(q, Vector4(-1, -1, -1, 1)); + } + + inline float length(Quaternion::Arg q) + { + return length(q.asVector()); + } + + inline bool isNormalized(Quaternion::Arg q, float epsilon = NV_NORMAL_EPSILON) + { + return equal(length(q), 1, epsilon); + } + + inline Quaternion normalize(Quaternion::Arg q, float epsilon = NV_EPSILON) + { + float l = length(q); + nvDebugCheck(!isZero(l, epsilon)); + Quaternion n = scale(q, 1.0f / l); + nvDebugCheck(isNormalized(n)); + return n; + } + + inline Quaternion inverse(Quaternion::Arg q) + { + return conjugate(normalize(q)); + } + + /// Create a rotation quaternion for @a angle alpha around normal vector @a v. + inline Quaternion axisAngle(Vector3::Arg v, float alpha) + { + float s = sinf(alpha * 0.5f); + float c = cosf(alpha * 0.5f); + return Quaternion(Vector4(v * s, c)); + } + + +} // nv namespace + +#endif // NV_MATH_QUATERNION_H diff --git a/externals/NVTT/src/nvmath/Random.cpp b/externals/NVTT/src/nvmath/Random.cpp new file mode 100644 index 00000000..6178134f --- /dev/null +++ b/externals/NVTT/src/nvmath/Random.cpp @@ -0,0 +1,54 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include +#include + +using namespace nv; + +// Statics +const uint16 Rand48::a0 = 0xE66D; +const uint16 Rand48::a1 = 0xDEEC; +const uint16 Rand48::a2 = 0x0005; +const uint16 Rand48::c0 = 0x000B; + + +/// Get a random seed based on the current time. +uint Rand::randomSeed() +{ + return (uint)time(NULL); +} + + +void MTRand::initialize( uint32 seed ) +{ + // Initialize generator state with seed + // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + // In previous versions, most significant bits (MSBs) of the seed affect + // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. + uint32 *s = state; + uint32 *r = state; + int i = 1; + *s++ = seed & 0xffffffffUL; + for( ; i < N; ++i ) + { + *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL; + r++; + } +} + + +void MTRand::reload() +{ + // Generate N new values in state + // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) + uint32 *p = state; + int i; + for( i = N - M; i--; ++p ) + *p = twist( p[M], p[0], p[1] ); + for( i = M; --i; ++p ) + *p = twist( p[M-N], p[0], p[1] ); + *p = twist( p[M-N], p[0], state[0] ); + + left = N, next = state; +} + diff --git a/externals/NVTT/src/nvmath/Random.h b/externals/NVTT/src/nvmath/Random.h new file mode 100644 index 00000000..0f76949e --- /dev/null +++ b/externals/NVTT/src/nvmath/Random.h @@ -0,0 +1,368 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_RANDOM_H +#define NV_MATH_RANDOM_H + +#include // nextPowerOfTwo +#include + +namespace nv +{ + +/// Interface of the random number generators. +class Rand +{ +public: + + virtual ~Rand() {} + + enum time_e { Time }; + + /// Provide a new seed. + virtual void seed( uint s ) { /* empty */ }; + + /// Get an integer random number. + virtual uint get() = 0; + + /// Get a random number on [0, max] interval. + uint getRange( uint max ) + { + uint n; + // uint mask = Bitmask( max ); + // do { n = Get() & mask; } while( n > max ); + uint np2 = nextPowerOfTwo( max ); + do { n = get() & (np2-1); } while( n > max ); + return n; + } + + /// Random number on [0.0, 1.0] interval. + float getFloat() + { + union + { + uint32 i; + float f; + } pun; + + pun.i = 0x3f800000UL | (get() & 0x007fffffUL); + return pun.f - 1.0f; + } + + /* + /// Random number on [0.0, 1.0] interval. + double getReal() + { + return double(get()) * (1.0/4294967295.0); // 2^32-1 + } + + /// Random number on [0.0, 1.0) interval. + double getRealExclusive() + { + return double(get()) * (1.0/4294967296.0); // 2^32 + } + */ + + /// Get the max value of the random number. + uint max() const { return 4294967295U; } + + // Get a random seed. + static uint randomSeed(); + +}; + + +/// Very simple random number generator with low storage requirements. +class SimpleRand : public Rand +{ +public: + + /// Constructor that uses the current time as the seed. + SimpleRand( time_e ) + { + seed(randomSeed()); + } + + /// Constructor that uses the given seed. + SimpleRand( uint s = 0 ) + { + seed(s); + } + + /// Set the given seed. + virtual void seed( uint s ) + { + current = s; + } + + /// Get a random number. + virtual uint get() + { + return current = current * 1103515245 + 12345; + } + +private: + + uint current; + +}; + + +/// Mersenne twister random number generator. +class MTRand : public Rand +{ +public: + + enum { N = 624 }; // length of state vector + enum { M = 397 }; + + /// Constructor that uses the current time as the seed. + MTRand( time_e ) + { + seed(randomSeed()); + } + + /// Constructor that uses the given seed. + MTRand( uint s = 0 ) + { + seed(s); + } + + /// Constructor that uses the given seeds. + NVMATH_API MTRand( const uint * seed_array, uint length ); + + + /// Provide a new seed. + virtual void seed( uint s ) + { + initialize(s); + reload(); + } + + /// Get a random number between 0 - 65536. + virtual uint get() + { + // Pull a 32-bit integer from the generator state + // Every other access function simply transforms the numbers extracted here + if( left == 0 ) { + reload(); + } + left--; + + uint s1; + s1 = *next++; + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9d2c5680U; + s1 ^= (s1 << 15) & 0xefc60000U; + return ( s1 ^ (s1 >> 18) ); + }; + + +private: + + NVMATH_API void initialize( uint32 seed ); + NVMATH_API void reload(); + + uint hiBit( uint u ) const { return u & 0x80000000U; } + uint loBit( uint u ) const { return u & 0x00000001U; } + uint loBits( uint u ) const { return u & 0x7fffffffU; } + uint mixBits( uint u, uint v ) const { return hiBit(u) | loBits(v); } + uint twist( uint m, uint s0, uint s1 ) const { return m ^ (mixBits(s0,s1)>>1) ^ ((~loBit(s1)+1) & 0x9908b0dfU); } + +private: + + uint state[N]; // internal state + uint * next; // next value to get from state + int left; // number of values left before reload needed + +}; + + + +/** George Marsaglia's random number generator. + * Code based on Thatcher Ulrich public domain source code: + * http://cvs.sourceforge.net/viewcvs.py/tu-testbed/tu-testbed/base/tu_random.cpp?rev=1.7&view=auto + * + * PRNG code adapted from the complimentary-multiply-with-carry + * code in the article: George Marsaglia, "Seeds for Random Number + * Generators", Communications of the ACM, May 2003, Vol 46 No 5, + * pp90-93. + * + * The article says: + * + * "Any one of the choices for seed table size and multiplier will + * provide a RNG that has passed extensive tests of randomness, + * particularly those in [3], yet is simple and fast -- + * approximately 30 million random 32-bit integers per second on a + * 850MHz PC. The period is a*b^n, where a is the multiplier, n + * the size of the seed table and b=2^32-1. (a is chosen so that + * b is a primitive root of the prime a*b^n + 1.)" + * + * [3] Marsaglia, G., Zaman, A., and Tsang, W. Toward a universal + * random number generator. _Statistics and Probability Letters + * 8_ (1990), 35-39. + */ +class GMRand : public Rand +{ +public: + + enum { SEED_COUNT = 8 }; + +// const uint64 a = 123471786; // for SEED_COUNT=1024 +// const uint64 a = 123554632; // for SEED_COUNT=512 +// const uint64 a = 8001634; // for SEED_COUNT=255 +// const uint64 a = 8007626; // for SEED_COUNT=128 +// const uint64 a = 647535442; // for SEED_COUNT=64 +// const uint64 a = 547416522; // for SEED_COUNT=32 +// const uint64 a = 487198574; // for SEED_COUNT=16 +// const uint64 a = 716514398U; // for SEED_COUNT=8 + enum { a = 716514398U }; + + + GMRand( time_e ) + { + seed(randomSeed()); + } + + GMRand(uint s = 987654321) + { + seed(s); + } + + + /// Provide a new seed. + virtual void seed( uint s ) + { + c = 362436; + i = SEED_COUNT - 1; + + for(int i = 0; i < SEED_COUNT; i++) { + s = s ^ (s << 13); + s = s ^ (s >> 17); + s = s ^ (s << 5); + Q[i] = s; + } + } + + /// Get a random number between 0 - 65536. + virtual uint get() + { + const uint32 r = 0xFFFFFFFE; + + uint64 t; + uint32 x; + + i = (i + 1) & (SEED_COUNT - 1); + t = a * Q[i] + c; + c = uint32(t >> 32); + x = uint32(t + c); + + if( x < c ) { + x++; + c++; + } + + uint32 val = r - x; + Q[i] = val; + return val; + }; + + +private: + + uint32 c; + uint32 i; + uint32 Q[8]; + +}; + + +/** Random number implementation from the GNU Sci. Lib. (GSL). + * Adapted from Nicholas Chapman version: + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough + * This is the Unix rand48() generator. The generator returns the + * upper 32 bits from each term of the sequence, + * + * x_{n+1} = (a x_n + c) mod m + * + * using 48-bit unsigned arithmetic, with a = 0x5DEECE66D , c = 0xB + * and m = 2^48. The seed specifies the upper 32 bits of the initial + * value, x_1, with the lower 16 bits set to 0x330E. + * + * The theoretical value of x_{10001} is 244131582646046. + * + * The period of this generator is ? FIXME (probably around 2^48). + */ +class Rand48 : public Rand +{ +public: + + Rand48( time_e ) + { + seed(randomSeed()); + } + + Rand48( uint s = 0x1234ABCD ) + { + seed(s); + } + + + /** Set the given seed. */ + virtual void seed( uint s ) { + vstate.x0 = 0x330E; + vstate.x1 = uint16(s & 0xFFFF); + vstate.x2 = uint16((s >> 16) & 0xFFFF); + } + + /** Get a random number. */ + virtual uint get() { + + advance(); + + uint x1 = vstate.x1; + uint x2 = vstate.x2; + return (x2 << 16) + x1; + } + + +private: + + void advance() + { + /* work with unsigned long ints throughout to get correct integer + promotions of any unsigned short ints */ + const uint32 x0 = vstate.x0; + const uint32 x1 = vstate.x1; + const uint32 x2 = vstate.x2; + + uint32 a; + a = a0 * x0 + c0; + + vstate.x0 = uint16(a & 0xFFFF); + a >>= 16; + + /* although the next line may overflow we only need the top 16 bits + in the following stage, so it does not matter */ + + a += a0 * x1 + a1 * x0; + vstate.x1 = uint16(a & 0xFFFF); + + a >>= 16; + a += a0 * x2 + a1 * x1 + a2 * x0; + vstate.x2 = uint16(a & 0xFFFF); + } + + +private: + NVMATH_API static const uint16 a0, a1, a2, c0; + + struct rand48_state_t { + uint16 x0, x1, x2; + } vstate; + +}; + +} // nv namespace + +#endif // NV_MATH_RANDOM_H diff --git a/externals/NVTT/src/nvmath/SphericalHarmonic.cpp b/externals/NVTT/src/nvmath/SphericalHarmonic.cpp new file mode 100644 index 00000000..f005b511 --- /dev/null +++ b/externals/NVTT/src/nvmath/SphericalHarmonic.cpp @@ -0,0 +1,241 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include + +using namespace nv; + + +namespace +{ + + // Basic integer factorial. + inline static int factorial( int v ) + { + if (v == 0) { + return 1; + } + + int result = v; + while (--v > 0) { + result *= v; + } + return result; + } + + + // Double factorial. + // Defined as: n!! = n*(n - 2)*(n - 4)..., n!!(0,-1) = 1. + inline static int doubleFactorial( int x ) + { + if (x == 0 || x == -1) { + return 1; + } + + int result = x; + while ((x -= 2) > 0) { + result *= x; + } + + return result; + } + + /// Normalization constant for spherical harmonic. + /// @param l is the band. + /// @param m is the argument, in the range [0, m] + inline static float K( int l, int m ) + { + nvDebugCheck( m >= 0 ); + return sqrtf(((2 * l + 1) * factorial(l - m)) / (4 * PI * factorial(l + m))); + } + + /// Normalization constant for hemispherical harmonic. + inline static float HK( int l, int m ) + { + nvDebugCheck( m >= 0 ); + return sqrtf(((2 * l + 1) * factorial(l - m)) / (2 * PI * factorial(l + m))); + } + + /// Evaluate Legendre polynomial. */ + static float legendre( int l, int m, float x ) + { + // piDebugCheck( m >= 0 ); + // piDebugCheck( m <= l ); + // piDebugCheck( fabs(x) <= 1 ); + + // Rule 2 needs no previous results + if (l == m) { + return powf(-1.0f, float(m)) * doubleFactorial(2 * m - 1) * powf(1 - x*x, 0.5f * m); + } + + // Rule 3 requires the result for the same argument of the previous band + if (l == m + 1) { + return x * (2 * m + 1) * legendrePolynomial(m, m, x); + } + + // Main reccurence used by rule 1 that uses result of the same argument from + // the previous two bands + return (x * (2 * l - 1) * legendrePolynomial(l - 1, m, x) - (l + m - 1) * legendrePolynomial(l - 2, m, x)) / (l - m); + } + + + template float legendre(float x); + + template <> float legendre<0, 0>(float x) { + return 1; + } + + template <> float legendre<1, 0>(float x) { + return x; + } + template <> float legendre<1, 1>(float x) { + return -sqrtf(1 - x * x); + } + + template <> float legendre<2, 0>(float x) { + return -0.5f + (3 * x * x) / 2; + } + template <> float legendre<2, 1>(float x) { + return -3 * x * sqrtf(1 - x * x); + } + template <> float legendre<2, 2>(float x) { + return -3 * (-1 + x * x); + } + + template <> float legendre<3, 0>(float x) { + return -(3 * x) / 2 + (5 * x * x * x) / 2; + } + template <> float legendre<3, 1>(float x) { + return -3 * sqrtf(1 - x * x) / 2 * (-1 + 5 * x * x); + } + template <> float legendre<3, 2>(float x) { + return -15 * (-x + x * x * x); + } + template <> float legendre<3, 3>(float x) { + return -15 * powf(1 - x * x, 1.5f); + } + + template <> float legendre<4, 0>(float x) { + return 0.125f * (3.0f - 30.0f * x * x + 35.0f * x * x * x * x); + } + template <> float legendre<4, 1>(float x) { + return -2.5f * x * sqrtf(1.0f - x * x) * (7.0f * x * x - 3.0f); + } + template <> float legendre<4, 2>(float x) { + return -7.5f * (1.0f - 8.0f * x * x + 7.0f * x * x * x * x); + } + template <> float legendre<4, 3>(float x) { + return -105.0f * x * powf(1 - x * x, 1.5f); + } + template <> float legendre<4, 4>(float x) { + return 105.0f * (x * x - 1.0f) * (x * x - 1.0f); + } + +} // namespace + + +float nv::legendrePolynomial(int l, int m, float x) +{ + switch(l) + { + case 0: + return legendre<0, 0>(x); + case 1: + if(m == 0) return legendre<1, 0>(x); + return legendre<1, 1>(x); + case 2: + if(m == 0) return legendre<2, 0>(x); + else if(m == 1) return legendre<2, 1>(x); + return legendre<2, 2>(x); + case 3: + if(m == 0) return legendre<3, 0>(x); + else if(m == 1) return legendre<3, 1>(x); + else if(m == 2) return legendre<3, 2>(x); + return legendre<3, 3>(x); + case 4: + if(m == 0) return legendre<4, 0>(x); + else if(m == 1) return legendre<4, 1>(x); + else if(m == 2) return legendre<4, 2>(x); + else if(m == 3) return legendre<4, 3>(x); + else return legendre<4, 4>(x); + } + + // Fallback to the expensive version. + return legendre(l, m, x); +} + + +/** + * Evaluate the spherical harmonic function for the given angles. + * @param l is the band. + * @param m is the argument, in the range [-l,l] + * @param theta is the altitude, in the range [0, PI] + * @param phi is the azimuth, in the range [0, 2*PI] + */ +float nv::y( int l, int m, float theta, float phi ) +{ + if( m == 0 ) { + // K(l, 0) = sqrt((2*l+1)/(4*PI)) + return sqrtf((2 * l + 1) / (4 * PI)) * legendrePolynomial(l, 0, cosf(theta)); + } + else if( m > 0 ) { + return sqrtf(2.0f) * K(l, m) * cosf(m * phi) * legendrePolynomial(l, m, cosf(theta)); + } + else { + return sqrtf(2.0f) * K(l, -m) * sinf(-m * phi) * legendrePolynomial(l, -m, cosf(theta)); + } +} + + +/** + * Real spherical harmonic function of an unit vector. Uses the following + * equalities to call the angular function: + * x = sin(theta)*cos(phi) + * y = sin(theta)*sin(phi) + * z = cos(theta) + */ +float nv::y( int l, int m, Vector3::Arg v ) +{ + float theta = acosf(v.z()); + float phi = atan2f(v.y(), v.x()); + return y( l, m, theta, phi ); +} + + +/** + * Evaluate the hemispherical harmonic function for the given angles. + * @param l is the band. + * @param m is the argument, in the range [-l,l] + * @param theta is the altitude, in the range [0, PI/2] + * @param phi is the azimuth, in the range [0, 2*PI] + */ +float nv::hy( int l, int m, float theta, float phi ) +{ + if( m == 0 ) { + // HK(l, 0) = sqrt((2*l+1)/(2*PI)) + return sqrtf((2 * l + 1) / (2 * PI)) * legendrePolynomial(l, 0, 2*cosf(theta)-1); + } + else if( m > 0 ) { + return sqrtf(2.0f) * HK(l, m) * cosf(m * phi) * legendrePolynomial(l, m, 2*cosf(theta)-1); + } + else { + return sqrtf(2.0f) * HK(l, -m) * sinf(-m * phi) * legendrePolynomial(l, -m, 2*cosf(theta)-1); + } +} + + +/** + * Real hemispherical harmonic function of an unit vector. Uses the following + * equalities to call the angular function: + * x = sin(theta)*cos(phi) + * y = sin(theta)*sin(phi) + * z = cos(theta) + */ +float nv::hy( int l, int m, Vector3::Arg v ) +{ + float theta = acosf(v.z()); + float phi = atan2f(v.y(), v.x()); + return y( l, m, theta, phi ); +} + + + diff --git a/externals/NVTT/src/nvmath/SphericalHarmonic.h b/externals/NVTT/src/nvmath/SphericalHarmonic.h new file mode 100644 index 00000000..7e8341ce --- /dev/null +++ b/externals/NVTT/src/nvmath/SphericalHarmonic.h @@ -0,0 +1,419 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_SPHERICALHARMONIC_H +#define NV_MATH_SPHERICALHARMONIC_H + +#include + +namespace nv +{ + + NVMATH_API float legendrePolynomial( int l, int m, float x ) NV_CONST; + NVMATH_API float y( int l, int m, float theta, float phi ) NV_CONST; + NVMATH_API float y( int l, int m, Vector3::Arg v ) NV_CONST; + NVMATH_API float hy( int l, int m, float theta, float phi ) NV_CONST; + NVMATH_API float hy( int l, int m, Vector3::Arg v ) NV_CONST; + + class Sh; + float dot(const Sh & a, const Sh & b) NV_CONST; + + + /// Spherical harmonic class. + class Sh + { + friend class Sh2; + friend class ShMatrix; + public: + + /// Construct a spherical harmonic of the given order. + Sh(int o) : m_order(o) + { + m_elemArray = new float[basisNum()]; + } + + /// Copy constructor. + Sh(const Sh & sh) : m_order(sh.order()) + { + m_elemArray = new float[basisNum()]; + memcpy(m_elemArray, sh.m_elemArray, sizeof(float) * basisNum()); + } + + /// Destructor. + ~Sh() + { + delete [] m_elemArray; + m_elemArray = NULL; + } + + /// Get number of bands. + static int bandNum(int order) { + return order + 1; + } + + /// Get number of sh basis. + static int basisNum(int order) { + return (order + 1) * (order + 1); + } + + /// Get the index for the given coefficients. + static int index( int l, int m ) { + return l * l + l + m; + } + + /// Get sh order. + int order() const + { + return m_order; + } + + /// Get sh order. + int bandNum() const + { + return bandNum(m_order); + } + + /// Get sh order. + int basisNum() const + { + return basisNum(m_order); + } + + /// Get sh coefficient indexed by l,m. + float elem( int l, int m ) const + { + return m_elemArray[index(l, m)]; + } + + /// Get sh coefficient indexed by l,m. + float & elem( int l, int m ) + { + return m_elemArray[index(l, m)]; + } + + + /// Get sh coefficient indexed by i. + float elemAt( int i ) const { + return m_elemArray[i]; + } + + /// Get sh coefficient indexed by i. + float & elemAt( int i ) + { + return m_elemArray[i]; + } + + + /// Reset the sh coefficients. + void reset() + { + for( int i = 0; i < basisNum(); i++ ) { + m_elemArray[i] = 0.0f; + } + } + + /// Copy spherical harmonic. + void operator= ( const Sh & sh ) + { + nvDebugCheck(order() <= sh.order()); + + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] = sh.m_elemArray[i]; + } + } + + /// Add spherical harmonics. + void operator+= ( const Sh & sh ) + { + nvDebugCheck(order() == sh.order()); + + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] += sh.m_elemArray[i]; + } + } + + /// Substract spherical harmonics. + void operator-= ( const Sh & sh ) + { + nvDebugCheck(order() == sh.order()); + + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] -= sh.m_elemArray[i]; + } + } + + // Not exactly convolution, nor product. + void operator*= ( const Sh & sh ) + { + nvDebugCheck(order() == sh.order()); + + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] *= sh.m_elemArray[i]; + } + } + + /// Scale spherical harmonics. + void operator*= ( float f ) + { + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] *= f; + } + } + + /// Add scaled spherical harmonics. + void addScaled( const Sh & sh, float f ) + { + nvDebugCheck(order() == sh.order()); + + for(int i = 0; i < basisNum(); i++) { + m_elemArray[i] += sh.m_elemArray[i] * f; + } + } + + + /*/// Add a weighted sample to the sh coefficients. + void AddSample( const Vec3 & dir, const Color3f & color, float w=1.0f ) { + for(int l = 0; l <= order; l++) { + for(int m = -l; m <= l; m++) { + Color3f & elem = GetElem(l, m); + elem.Mad( elem, color, w * y(l, m, dir) ); + } + } + }*/ + + /// Evaluate + void eval(Vector3::Arg dir) + { + for(int l = 0; l <= m_order; l++) { + for(int m = -l; m <= l; m++) { + elem(l, m) = y(l, m, dir); + } + } + } + + + /// Evaluate the spherical harmonic function. + float sample(Vector3::Arg dir) const + { + Sh sh(order()); + sh.eval(dir); + + return dot(sh, *this); + } + + + protected: + + const int m_order; + float * m_elemArray; + + }; + + + /// Compute dot product of the spherical harmonics. + inline float dot(const Sh & a, const Sh & b) + { + nvDebugCheck(a.order() == b.order()); + + float sum = 0; + for( int i = 0; i < Sh::basisNum(a.order()); i++ ) { + sum += a.elemAt(i) * b.elemAt(i); + } + + return sum; + } + + + /// Second order spherical harmonic. + class Sh2 : public Sh + { + public: + + /// Constructor. + Sh2() : Sh(2) {} + + /// Copy constructor. + Sh2(const Sh2 & sh) : Sh(sh) {} + + /// Spherical harmonic resulting from projecting the clamped cosine transfer function to the SH basis. + void cosineTransfer() + { + const float c1 = 0.282095f; // K(0, 0) + const float c2 = 0.488603f; // K(1, 0) + const float c3 = 1.092548f; // sqrt(15.0f / PI) / 2.0f = K(2, -2) + const float c4 = 0.315392f; // sqrt(5.0f / PI) / 4.0f) = K(2, 0) + const float c5 = 0.546274f; // sqrt(15.0f / PI) / 4.0f) = K(2, 2) + + const float normalization = PI * 16.0f / 17.0f; + + const float const1 = c1 * normalization * 1.0f; + const float const2 = c2 * normalization * (2.0f / 3.0f); + const float const3 = c3 * normalization * (1.0f / 4.0f); + const float const4 = c4 * normalization * (1.0f / 4.0f); + const float const5 = c5 * normalization * (1.0f / 4.0f); + + m_elemArray[0] = const1; + + m_elemArray[1] = -const2; + m_elemArray[2] = const2; + m_elemArray[3] = -const2; + + m_elemArray[4] = const3; + m_elemArray[5] = -const3; + m_elemArray[6] = const4; + m_elemArray[7] = -const3; + m_elemArray[8] = const5; + } + }; + + + +#if 0 + +/// Spherical harmonic matrix. +class ShMatrix +{ +public: + + /// Create an identity matrix of the given order. + ShMatrix(int o = 2) : order(o), identity(true) + { + nvCheck(order > 0); + e = new float[Size()]; + band = new float *[GetBandNum()]; + setupBands(); + } + + /// Destroy and free matrix elements. + ~ShMatrix() + { + delete e; + delete band; + } + + /// Set identity matrix. + void setIdentity() + { + identity = true; + } + + /// Return true if this is an identity matrix, false in other case. + bool isIdentity() const { + return identity; + } + + /// Get number of bands of this matrix. + int bandNum() const + { + return order+1; + } + + /// Get total number of elements in the matrix. + int size() const + { + int size = 0; + for( int i = 0; i < bandNum(); i++ ) { + size += SQ(i * 2 + 1); + } + return size; + } + + /// Get element at the given raw index. + float elem(const int idx) const + { + return e[idx]; + } + + /// Get element at the given with the given indices. + float & elem( const int b, const int x, const int y ) + { + nvDebugCheck(b >= 0); + nvDebugCheck(b < bandNum()); + return band[b][(b + y) * (b * 2 + 1) + (b + x)]; + } + + /// Get element at the given with the given indices. + float elem( const int b, const int x, const int y ) const + { + nvDebugCheck(b >= 0); + nvDebugCheck(b < bandNum()); + return band[b][(b + y) * (b * 2 + 1) + (b + x)]; + } + + /** Copy matrix. */ + void Copy( const ShMatrix & m ) + { + nvDebugCheck(order == m.order); + memcpy(e, m.e, Size() * sizeof(float)); + } + + /** Rotate the given coefficients. */ + void transform( const Sh & restrict source, Sh * restrict dest ) const { + piCheck( &source != dest ); // Make sure there's no aliasing. + piCheck( dest->order <= order ); + piCheck( order <= source.order ); + + if( identity ) { + *dest = source; + return; + } + + // Loop through each band. + for( int l = 0; l <= dest->order; l++ ) { + + for( int mo = -l; mo <= l; mo++ ) { + + Color3f rgb = Color3f::Black; + + for( int mi = -l; mi <= l; mi++ ) { + rgb.Mad( rgb, source.elem(l, mi), elem(l, mo, mi) ); + } + + dest->elem(l, mo) = rgb; + } + } + } + + + MATHLIB_API void multiply( const ShMatrix &A, const ShMatrix &B ); + MATHLIB_API void rotation( const Matrix & m ); + MATHLIB_API void rotation( int axis, float angles ); + MATHLIB_API void print(); + + +private: + + // @@ These could be static indices precomputed only once. + /// Setup the band pointers. + void setupBands() + { + int size = 0; + for( int i = 0; i < bandNum(); i++ ) { + band[i] = &e[size]; + size += SQ(i * 2 + 1); + } + } + + +private: + + // Matrix order. + const int m_order; + + // Identity flag for quick transform. + bool m_identity; + + // Array of elements. + float * m_e; + + // Band pointers. + float ** m_band; + +}; + +#endif // 0 + + + +} // nv namespace + +#endif // NV_MATH_SPHERICALHARMONIC_H diff --git a/externals/NVTT/src/nvmath/TriBox.cpp b/externals/NVTT/src/nvmath/TriBox.cpp new file mode 100644 index 00000000..61d69bb6 --- /dev/null +++ b/externals/NVTT/src/nvmath/TriBox.cpp @@ -0,0 +1,226 @@ +/********************************************************/ +/* AABB-triangle overlap test code */ +/* by Tomas Akenine-Möller */ +/* Function: int triBoxOverlap(float boxcenter[3], */ +/* float boxhalfsize[3],float triverts[3][3]); */ +/* History: */ +/* 2001-03-05: released the code in its first version */ +/* 2001-06-18: changed the order of the tests, faster */ +/* */ +/* Acknowledgement: Many thanks to Pierre Terdiman for */ +/* suggestions and discussions on how to optimize code. */ +/* Thanks to David Hunt for finding a ">="-bug! */ +/********************************************************/ + +#include +#include + +using namespace nv; + +#define X 0 +#define Y 1 +#define Z 2 + +#define FINDMINMAX(x0,x1,x2,min,max) \ + min = max = x0; \ + if(x1max) max=x1;\ + if(x2max) max=x2; + + +static bool planeBoxOverlap(Vector3::Arg normal, Vector3::Arg vert, Vector3::Arg maxbox) // -NJMP- +{ + Vector3 vmin, vmax; + + float signs[3] = {1, 1, 1}; + if (normal.x() <= 0.0f) signs[0] = -1; + if (normal.y() <= 0.0f) signs[1] = -1; + if (normal.z() <= 0.0f) signs[2] = -1; + + Vector3 sign(signs[0], signs[1], signs[2]); + vmin = -scale(sign, maxbox) - vert; + vmax = scale(sign, maxbox) - vert; + + if (dot(normal, vmin) > 0.0f) return false; + if (dot(normal, vmax) >= 0.0f) return true; + + return false; +} + + +/*======================== X-tests ========================*/ +#define AXISTEST_X01(a, b, fa, fb) \ + p0 = a*v0.y() - b*v0.z(); \ + p2 = a*v2.y() - b*v2.z(); \ + if(p0rad || max<-rad) return false; + +#define AXISTEST_X2(a, b, fa, fb) \ + p0 = a*v0.y() - b*v0.z(); \ + p1 = a*v1.y() - b*v1.z(); \ + if(p0rad || max<-rad) return false; + +/*======================== Y-tests ========================*/ +#define AXISTEST_Y02(a, b, fa, fb) \ + p0 = -a*v0.x() + b*v0.z(); \ + p2 = -a*v2.x() + b*v2.z(); \ + if(p0rad || max<-rad) return false; + +#define AXISTEST_Y1(a, b, fa, fb) \ + p0 = -a*v0.x() + b*v0.z(); \ + p1 = -a*v1.x() + b*v1.z(); \ + if(p0rad || max<-rad) return false; + +/*======================== Z-tests ========================*/ + +#define AXISTEST_Z12(a, b, fa, fb) \ + p1 = a*v1.x() - b*v1.y(); \ + p2 = a*v2.x() - b*v2.y(); \ + if(p2rad || max<-rad) return false; + +#define AXISTEST_Z0(a, b, fa, fb) \ + p0 = a*v0.x() - b*v0.y(); \ + p1 = a*v1.x() - b*v1.y(); \ + if(p0rad || max<-rad) return false; + + +bool triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) +{ + // use separating axis theorem to test overlap between triangle and box + // need to test for overlap in these directions: + // 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle + // we do not even need to test these) + // 2) normal of the triangle + // 3) crossproduct(edge from tri, {x,y,z}-directin) + // this gives 3x3=9 more tests + Vector3 v0, v1, v2; + float min, max, p0, p1, p2, rad, fex, fey, fez; + Vector3 normal, e0, e1, e2; + + // This is the fastest branch on Sun. + // move everything so that the boxcenter is in (0,0,0) + v0 = tri.v[0] - boxcenter; + v1 = tri.v[1] - boxcenter; + v2 = tri.v[2] - boxcenter; + + // Compute triangle edges. + e0 = v1 - v0; // tri edge 0 + e1 = v2 - v1; // tri edge 1 + e2 = v0 - v2; // tri edge 2 + + // Bullet 3: + // test the 9 tests first (this was faster) + fex = fabsf(e0.x()); + fey = fabsf(e0.y()); + fez = fabsf(e0.z()); + AXISTEST_X01(e0.z(), e0.y(), fez, fey); + AXISTEST_Y02(e0.z(), e0.x(), fez, fex); + AXISTEST_Z12(e0.y(), e0.x(), fey, fex); + + fex = fabsf(e1.x()); + fey = fabsf(e1.y()); + fez = fabsf(e1.z()); + AXISTEST_X01(e1.z(), e1.y(), fez, fey); + AXISTEST_Y02(e1.z(), e1.x(), fez, fex); + AXISTEST_Z0(e1.y(), e1.x(), fey, fex); + + fex = fabsf(e2.x()); + fey = fabsf(e2.y()); + fez = fabsf(e2.z()); + AXISTEST_X2(e2.z(), e2.y(), fez, fey); + AXISTEST_Y1(e2.z(), e2.x(), fez, fex); + AXISTEST_Z12(e2.y(), e2.x(), fey, fex); + + // Bullet 1: + // first test overlap in the {x,y,z}-directions + // find min, max of the triangle each direction, and test for overlap in + // that direction -- this is equivalent to testing a minimal AABB around + // the triangle against the AABB + + // test in X-direction + FINDMINMAX(v0.x(), v1.x(), v2.x(), min, max); + if(min > boxhalfsize.x() || max < -boxhalfsize.x()) return false; + + // test in Y-direction + FINDMINMAX(v0.y(), v1.y(), v2.y(), min, max); + if(min > boxhalfsize.y() || max < -boxhalfsize.y()) return false; + + // test in Z-direction + FINDMINMAX(v0.z(), v1.z(), v2.z(), min, max); + if(min > boxhalfsize.z() || max < -boxhalfsize.z()) return false; + + // Bullet 2: + // test if the box intersects the plane of the triangle + // compute plane equation of triangle: normal*x+d=0 + normal = cross(e0, e1); + + return planeBoxOverlap(normal, v0, boxhalfsize); +} + + +bool triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & tri) +{ + // use separating axis theorem to test overlap between triangle and box + // need to test for overlap in these directions: + // 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle + // we do not even need to test these) + // 2) normal of the triangle + // 3) crossproduct(edge from tri, {x,y,z}-directin) + // this gives 3x3=9 more tests + Vector3 v0, v1, v2; + float min, max, p0, p1, p2, rad, fex, fey, fez; + Vector3 normal, e0, e1, e2; + + // This is the fastest branch on Sun. + // move everything so that the boxcenter is in (0,0,0) + v0 = tri.v[0] - boxcenter; + v1 = tri.v[1] - boxcenter; + v2 = tri.v[2] - boxcenter; + + // Compute triangle edges. + e0 = v1 - v0; // tri edge 0 + e1 = v2 - v1; // tri edge 1 + e2 = v0 - v2; // tri edge 2 + + // Bullet 3: + // test the 9 tests first (this was faster) + fex = fabsf(e0.x()); + fey = fabsf(e0.y()); + fez = fabsf(e0.z()); + AXISTEST_X01(e0.z(), e0.y(), fez, fey); + AXISTEST_Y02(e0.z(), e0.x(), fez, fex); + AXISTEST_Z12(e0.y(), e0.x(), fey, fex); + + fex = fabsf(e1.x()); + fey = fabsf(e1.y()); + fez = fabsf(e1.z()); + AXISTEST_X01(e1.z(), e1.y(), fez, fey); + AXISTEST_Y02(e1.z(), e1.x(), fez, fex); + AXISTEST_Z0(e1.y(), e1.x(), fey, fex); + + fex = fabsf(e2.x()); + fey = fabsf(e2.y()); + fez = fabsf(e2.z()); + AXISTEST_X2(e2.z(), e2.y(), fez, fey); + AXISTEST_Y1(e2.z(), e2.x(), fez, fex); + AXISTEST_Z12(e2.y(), e2.x(), fey, fex); + + // Bullet 2: + // test if the box intersects the plane of the triangle + // compute plane equation of triangle: normal*x+d=0 + normal = cross(e0, e1); + + return planeBoxOverlap(normal, v0, boxhalfsize); +} diff --git a/externals/NVTT/src/nvmath/Triangle.cpp b/externals/NVTT/src/nvmath/Triangle.cpp new file mode 100644 index 00000000..f0052979 --- /dev/null +++ b/externals/NVTT/src/nvmath/Triangle.cpp @@ -0,0 +1,168 @@ +// This code is in the public domain -- Ignacio Castaño + +#include + +using namespace nv; + + +/// Tomas Möller, barycentric ray-triangle test. +bool rayTest_Moller(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v) +{ + // find vectors for two edges sharing vert0 + Vector3 e1 = t.v[1] - t.v[0]; + Vector3 e2 = t.v[2] - t.v[0]; + + // begin calculating determinant - also used to calculate U parameter + Vector3 pvec = cross(dir, e2); + + // if determinant is near zero, ray lies in plane of triangle + float det = dot(e1, pvec); + if (det < -NV_EPSILON) { + return false; + } + + // calculate distance from vert0 to ray origin + Vector3 tvec = orig - t.v[0]; + + // calculate U parameter and test bounds + float u = dot(tvec, pvec); + if( u < 0.0f || u > det ) { + return false; + } + + // prepare to test V parameter + Vector3 qvec = cross(tvec, e1); + + // calculate V parameter and test bounds + float v = dot(dir, qvec); + if (v < 0.0f || u + v > det) { + return false; + } + + // calculate t, scale parameters, ray intersects triangle + float inv_det = 1.0f / det; + *out_t = dot(e2, qvec) * inv_det; + *out_u = u * inv_det; // v + *out_v = v * inv_det; // 1-(u+v) + + return true; +} + + + + + +#if 0 + + +// IC: This code is adapted from my Pi.MathLib code, based on Moller-Trumbore triangle test. +FXVector3 edge1, edge2, pvec, tvec, qvec; + +edge1 = tri.V1 - tri.V0; +edge2 = tri.V2 - tri.V0; + +pvec.Cross(ray.Direction, edge2); + +float det = FXVector3.Dot(edge1, pvec); + +// calculate distance from vert0 to ray origin. +FXVector3 tvec = ray.Origin - vert0; + +if( det < 0 ) +{ + // calculate U parameter and test bounds. + float u = FXVector3.Dot(tvec, pvec); + if (u > 0.0 || u < det) + { + return false; + } + + // prepare to test V parameter. + qvec.Cross(tvec, edge1); + + // calculate V parameter and test bounds. + float v = FXVector3.Dot(dir, qvec); + + return v <= 0.0 && u + v >= det; +} +else +{ + // calculate U parameter and test bounds. + float u = FXVector3.Dot(tvec, pvec); + if (u < 0.0 || u > det) + { + return false; + } + + // prepare to test V parameter. + qvec.Cross(tvec, edge1); + + // calculate V parameter and test bounds. + float v = FXVector3.Dot(dir, qvec); + + return v >= 0.0 && u + v <= det; +} + + + +/** + * Dan Sunday, parametric ray-triangle test. + */ +// Output: *I = intersection point (when it exists) +// Return: -1 = triangle is degenerate (a segment or point) +// 0 = disjoint (no intersect) +// 1 = intersect in unique point I1 +// 2 = are in the same plane +bool RayTriangleTest( const Vec3 &p0, const Vec3 &p1, + const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, const Vec3 &n, + Vec3 &I ) { + Vec3 u, v; // triangle vectors + Vec3 dir, w0, w; // ray vectors + float r, a, b; // params to calc ray-plane intersect + + // get triangle edge vectors and plane normal + u.Sub( v1, v0 ); + v.Sub( v2, v0 ); + + dir.Sub( p1, p0 ); // ray direction vector + w0.Sub( p0, v0 ); + a = Vec3DotProduct( n, w0 ); + b = Vec3DotProduct( n, dir ); + + if( fabs(b) < TI_EPSILON ) // ray is parallel to triangle plane + return false; + + + // get intersect point of ray with triangle plane + r = -a / b; + if( r < 0.0f ) // ray goes away from triangle + return false; // => no intersect + + // for a segment, also test if (r > 1.0) => no intersect + + I.Mad( p0, dir, r ); // intersect point of ray and plane + + // is I inside T? + float uu, uv, vv, wu, wv, D; + uu = Vec3DotProduct( u, u ); + uv = Vec3DotProduct( u, v ); + vv = Vec3DotProduct( v, v ); + w = I - v0; + wu = Vec3DotProduct( w, u ); + wv = Vec3DotProduct( w, v ); + D = uv * uv - uu * vv; + + // get and test parametric coords + float s, t; + s = (uv * wv - vv * wu) / D; + if( s<0.0 || s > 1.0) // I is outside T + return false; + t = (uv * wu - uu * wv) / D; + if( t<0.0 || (s + t) > 1.0) // I is outside T + return false; + + return true; // I is in T +} + + +#endif // 0 diff --git a/externals/NVTT/src/nvmath/Triangle.h b/externals/NVTT/src/nvmath/Triangle.h new file mode 100644 index 00000000..7cd8db5e --- /dev/null +++ b/externals/NVTT/src/nvmath/Triangle.h @@ -0,0 +1,81 @@ +// This code is in the public domain -- Ignacio Castaño + +#ifndef NV_MATH_TRIANGLE_H +#define NV_MATH_TRIANGLE_H + +#include +#include +#include + +namespace nv +{ + + /// Triangle class with three vertices. + class Triangle + { + public: + Triangle() {}; + + Triangle(Vector3::Arg v0, Vector3::Arg v1, Vector3::Arg v2) + { + v[0] = v0; + v[1] = v1; + v[2] = v2; + } + + /// Get the bounds of the triangle. + Box bounds() const + { + Box bounds; + bounds.clearBounds(); + bounds.addPointToBounds(v[0]); + bounds.addPointToBounds(v[1]); + bounds.addPointToBounds(v[2]); + return bounds; + } + + Vector4 plane() const + { + Vector3 n = cross(v[1]-v[0], v[2]-v[0]); + return Vector4(n, dot(n, v[0])); + } + + Vector3 v[3]; + }; + + + // Tomas Akenine-Möller box-triangle test. + NVMATH_API bool triBoxOverlap(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & triangle); + NVMATH_API bool triBoxOverlapNoBounds(Vector3::Arg boxcenter, Vector3::Arg boxhalfsize, const Triangle & triangle); + + + // Moller ray triangle test. + NVMATH_API bool rayTest_Moller(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v); + + inline bool rayTest(const Triangle & t, Vector3::Arg orig, Vector3::Arg dir, float * out_t, float * out_u, float * out_v) + { + return rayTest_Moller(t, orig, dir, out_t, out_u, out_v); + } + + inline bool overlap(const Triangle & t, const Box & b) + { + Vector3 center = b.center(); + Vector3 extents = b.extents(); + return triBoxOverlap(center, extents, t); + } + + inline bool overlap(const Box & b, const Triangle & t) + { + return overlap(t, b); + } + + inline bool overlapNoBounds(const Triangle & t, const Box & b) + { + Vector3 center = b.center(); + Vector3 extents = b.extents(); + return triBoxOverlapNoBounds(center, extents, t); + } + +} // nv namespace + +#endif // NV_MATH_TRIANGLE_H diff --git a/externals/NVTT/src/nvmath/Vector.h b/externals/NVTT/src/nvmath/Vector.h new file mode 100644 index 00000000..bffdfbe3 --- /dev/null +++ b/externals/NVTT/src/nvmath/Vector.h @@ -0,0 +1,805 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_VECTOR_H +#define NV_MATH_VECTOR_H + +#include +#include // min, max + +namespace nv +{ + +enum zero_t { zero }; +enum identity_t { identity }; + +// I should probably use templates. +typedef float scalar; + +class NVMATH_CLASS Vector2 +{ +public: + typedef Vector2 const & Arg; + + Vector2(); + explicit Vector2(zero_t); + explicit Vector2(scalar f); + Vector2(scalar x, scalar y); + Vector2(Vector2::Arg v); + + const Vector2 & operator=(Vector2::Arg v); + + scalar x() const; + scalar y() const; + + scalar component(uint idx) const; + + const scalar * ptr() const; + + void set(scalar x, scalar y); + + Vector2 operator-() const; + void operator+=(Vector2::Arg v); + void operator-=(Vector2::Arg v); + void operator*=(scalar s); + void operator*=(Vector2::Arg v); + + friend bool operator==(Vector2::Arg a, Vector2::Arg b); + friend bool operator!=(Vector2::Arg a, Vector2::Arg b); + +private: + scalar m_x, m_y; +}; + + +class NVMATH_CLASS Vector3 +{ +public: + typedef Vector3 const & Arg; + + Vector3(); + explicit Vector3(zero_t); + Vector3(scalar x, scalar y, scalar z); + Vector3(Vector2::Arg v, scalar z); + Vector3(Vector3::Arg v); + + const Vector3 & operator=(Vector3::Arg v); + + scalar x() const; + scalar y() const; + scalar z() const; + + const Vector2 & xy() const; + + scalar component(uint idx) const; + + const scalar * ptr() const; + + void set(scalar x, scalar y, scalar z); + + Vector3 operator-() const; + void operator+=(Vector3::Arg v); + void operator-=(Vector3::Arg v); + void operator*=(scalar s); + void operator/=(scalar s); + void operator*=(Vector3::Arg v); + + friend bool operator==(Vector3::Arg a, Vector3::Arg b); + friend bool operator!=(Vector3::Arg a, Vector3::Arg b); + +private: + scalar m_x, m_y, m_z; +}; + + +class NVMATH_CLASS Vector4 +{ +public: + typedef Vector4 const & Arg; + + Vector4(); + explicit Vector4(zero_t); + Vector4(scalar x, scalar y, scalar z, scalar w); + Vector4(Vector2::Arg v, scalar z, scalar w); + Vector4(Vector3::Arg v, scalar w); + Vector4(Vector4::Arg v); +// Vector4(const Quaternion & v); + + const Vector4 & operator=(Vector4::Arg v); + + scalar x() const; + scalar y() const; + scalar z() const; + scalar w() const; + + const Vector2 & xy() const; + const Vector3 & xyz() const; + + scalar component(uint idx) const; + + const scalar * ptr() const; + + void set(scalar x, scalar y, scalar z, scalar w); + + Vector4 operator-() const; + void operator+=(Vector4::Arg v); + void operator-=(Vector4::Arg v); + void operator*=(scalar s); + void operator*=(Vector4::Arg v); + + friend bool operator==(Vector4::Arg a, Vector4::Arg b); + friend bool operator!=(Vector4::Arg a, Vector4::Arg b); + +private: + scalar m_x, m_y, m_z, m_w; +}; + + +// Vector2 + +inline Vector2::Vector2() {} +inline Vector2::Vector2(zero_t) : m_x(0.0f), m_y(0.0f) {} +inline Vector2::Vector2(scalar f) : m_x(f), m_y(f) {} +inline Vector2::Vector2(scalar x, scalar y) : m_x(x), m_y(y) {} +inline Vector2::Vector2(Vector2::Arg v) : m_x(v.x()), m_y(v.y()) {} + +inline const Vector2 & Vector2::operator=(Vector2::Arg v) +{ + m_x = v.x(); + m_y = v.y(); + return *this; +} + +inline scalar Vector2::x() const { return m_x; } +inline scalar Vector2::y() const { return m_y; } + +inline scalar Vector2::component(uint idx) const +{ + nvDebugCheck(idx < 2); + if (idx == 0) return x(); + if (idx == 1) return y(); + nvAssume(false); + return 0.0f; +} + +inline const scalar * Vector2::ptr() const +{ + return &m_x; +} + +inline void Vector2::set(scalar x, scalar y) +{ + m_x = x; + m_y = y; +} + +inline Vector2 Vector2::operator-() const +{ + return Vector2(-m_x, -m_y); +} + +inline void Vector2::operator+=(Vector2::Arg v) +{ + m_x += v.m_x; + m_y += v.m_y; +} + +inline void Vector2::operator-=(Vector2::Arg v) +{ + m_x -= v.m_x; + m_y -= v.m_y; +} + +inline void Vector2::operator*=(scalar s) +{ + m_x *= s; + m_y *= s; +} + +inline void Vector2::operator*=(Vector2::Arg v) +{ + m_x *= v.m_x; + m_y *= v.m_y; +} + +inline bool operator==(Vector2::Arg a, Vector2::Arg b) +{ + return a.m_x == b.m_x && a.m_y == b.m_y; +} +inline bool operator!=(Vector2::Arg a, Vector2::Arg b) +{ + return a.m_x != b.m_x || a.m_y != b.m_y; +} + + +// Vector3 + +inline Vector3::Vector3() {} +inline Vector3::Vector3(zero_t) : m_x(0.0f), m_y(0.0f), m_z(0.0f) {} +inline Vector3::Vector3(scalar x, scalar y, scalar z) : m_x(x), m_y(y), m_z(z) {} +inline Vector3::Vector3(Vector2::Arg v, scalar z) : m_x(v.x()), m_y(v.y()), m_z(z) {} +inline Vector3::Vector3(Vector3::Arg v) : m_x(v.x()), m_y(v.y()), m_z(v.z()) {} + +inline const Vector3 & Vector3::operator=(Vector3::Arg v) +{ + m_x = v.m_x; + m_y = v.m_y; + m_z = v.m_z; + return *this; +} + +inline scalar Vector3::x() const { return m_x; } +inline scalar Vector3::y() const { return m_y; } +inline scalar Vector3::z() const { return m_z; } + +inline const Vector2 & Vector3::xy() const +{ + return *(Vector2 *)this; +} + +inline scalar Vector3::component(uint idx) const +{ + nvDebugCheck(idx < 3); + if (idx == 0) return x(); + if (idx == 1) return y(); + if (idx == 2) return z(); + nvAssume(false); + return 0.0f; +} + +inline const scalar * Vector3::ptr() const +{ + return &m_x; +} + +inline void Vector3::set(scalar x, scalar y, scalar z) +{ + m_x = x; + m_y = y; + m_z = z; +} + +inline Vector3 Vector3::operator-() const +{ + return Vector3(-m_x, -m_y, -m_z); +} + +inline void Vector3::operator+=(Vector3::Arg v) +{ + m_x += v.m_x; + m_y += v.m_y; + m_z += v.m_z; +} + +inline void Vector3::operator-=(Vector3::Arg v) +{ + m_x -= v.m_x; + m_y -= v.m_y; + m_z -= v.m_z; +} + +inline void Vector3::operator*=(scalar s) +{ + m_x *= s; + m_y *= s; + m_z *= s; +} + +inline void Vector3::operator/=(scalar s) +{ + float is = 1.0f / s; + m_x *= is; + m_y *= is; + m_z *= is; +} + +inline void Vector3::operator*=(Vector3::Arg v) +{ + m_x *= v.m_x; + m_y *= v.m_y; + m_z *= v.m_z; +} + +inline bool operator==(Vector3::Arg a, Vector3::Arg b) +{ + return a.m_x == b.m_x && a.m_y == b.m_y && a.m_z == b.m_z; +} +inline bool operator!=(Vector3::Arg a, Vector3::Arg b) +{ + return a.m_x != b.m_x || a.m_y != b.m_y || a.m_z != b.m_z; +} + + +// Vector4 + +inline Vector4::Vector4() {} +inline Vector4::Vector4(zero_t) : m_x(0.0f), m_y(0.0f), m_z(0.0f), m_w(0.0f) {} +inline Vector4::Vector4(scalar x, scalar y, scalar z, scalar w) : m_x(x), m_y(y), m_z(z), m_w(w) {} +inline Vector4::Vector4(Vector2::Arg v, scalar z, scalar w) : m_x(v.x()), m_y(v.y()), m_z(z), m_w(w) {} +inline Vector4::Vector4(Vector3::Arg v, scalar w) : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_w(w) {} +inline Vector4::Vector4(Vector4::Arg v) : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_w(v.w()) {} + +inline const Vector4 & Vector4::operator=(const Vector4 & v) +{ + m_x = v.m_x; + m_y = v.m_y; + m_z = v.m_z; + m_w = v.m_w; + return *this; +} + +inline scalar Vector4::x() const { return m_x; } +inline scalar Vector4::y() const { return m_y; } +inline scalar Vector4::z() const { return m_z; } +inline scalar Vector4::w() const { return m_w; } + +inline const Vector2 & Vector4::xy() const +{ + return *(Vector2 *)this; +} + +inline const Vector3 & Vector4::xyz() const +{ + return *(Vector3 *)this; +} + +inline scalar Vector4::component(uint idx) const +{ + nvDebugCheck(idx < 4); + if (idx == 0) return x(); + if (idx == 1) return y(); + if (idx == 2) return z(); + if (idx == 3) return w(); + nvAssume(false); + return 0.0f; +} + +inline const scalar * Vector4::ptr() const +{ + return &m_x; +} + +inline void Vector4::set(scalar x, scalar y, scalar z, scalar w) +{ + m_x = x; + m_y = y; + m_z = z; + m_w = w; +} + +inline Vector4 Vector4::operator-() const +{ + return Vector4(-m_x, -m_y, -m_z, -m_w); +} + +inline void Vector4::operator+=(Vector4::Arg v) +{ + m_x += v.m_x; + m_y += v.m_y; + m_z += v.m_z; + m_w += v.m_w; +} + +inline void Vector4::operator-=(Vector4::Arg v) +{ + m_x -= v.m_x; + m_y -= v.m_y; + m_z -= v.m_z; + m_w -= v.m_w; +} + +inline void Vector4::operator*=(scalar s) +{ + m_x *= s; + m_y *= s; + m_z *= s; + m_w *= s; +} + +inline void Vector4::operator*=(Vector4::Arg v) +{ + m_x *= v.m_x; + m_y *= v.m_y; + m_z *= v.m_z; + m_w *= v.m_w; +} + +inline bool operator==(Vector4::Arg a, Vector4::Arg b) +{ + return a.m_x == b.m_x && a.m_y == b.m_y && a.m_z == b.m_z && a.m_w == b.m_w; +} +inline bool operator!=(Vector4::Arg a, Vector4::Arg b) +{ + return a.m_x != b.m_x || a.m_y != b.m_y || a.m_z != b.m_z || a.m_w != b.m_w; +} + + + +// Functions + + +// Vector2 + +inline Vector2 add(Vector2::Arg a, Vector2::Arg b) +{ + return Vector2(a.x() + b.x(), a.y() + b.y()); +} +inline Vector2 operator+(Vector2::Arg a, Vector2::Arg b) +{ + return add(a, b); +} + +inline Vector2 sub(Vector2::Arg a, Vector2::Arg b) +{ + return Vector2(a.x() - b.x(), a.y() - b.y()); +} +inline Vector2 operator-(Vector2::Arg a, Vector2::Arg b) +{ + return sub(a, b); +} + +inline Vector2 scale(Vector2::Arg v, scalar s) +{ + return Vector2(v.x() * s, v.y() * s); +} + +inline Vector2 scale(Vector2::Arg v, Vector2::Arg s) +{ + return Vector2(v.x() * s.x(), v.y() * s.y()); +} + +inline Vector2 operator*(Vector2::Arg v, scalar s) +{ + return scale(v, s); +} + +inline Vector2 operator*(Vector2::Arg v1, Vector2::Arg v2) +{ + return Vector2(v1.x()*v2.x(), v1.y()*v2.y()); +} + +inline Vector2 operator*(scalar s, Vector2::Arg v) +{ + return scale(v, s); +} + +inline scalar dot(Vector2::Arg a, Vector2::Arg b) +{ + return a.x() * b.x() + a.y() * b.y(); +} + +inline scalar length_squared(Vector2::Arg v) +{ + return v.x() * v.x() + v.y() * v.y(); +} + +inline scalar length(Vector2::Arg v) +{ + return sqrtf(length_squared(v)); +} + +inline bool equal(Vector2::Arg v1, Vector2::Arg v2, float epsilon = NV_EPSILON) +{ + return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon); +} + +inline Vector2 min(Vector2::Arg a, Vector2::Arg b) +{ + return Vector2(min(a.x(), b.x()), min(a.y(), b.y())); +} + +inline Vector2 max(Vector2::Arg a, Vector2::Arg b) +{ + return Vector2(max(a.x(), b.x()), max(a.y(), b.y())); +} + +inline bool isValid(Vector2::Arg v) +{ + return isFinite(v.x()) && isFinite(v.y()); +} + + +// Vector3 + +inline Vector3 add(Vector3::Arg a, Vector3::Arg b) +{ + return Vector3(a.x() + b.x(), a.y() + b.y(), a.z() + b.z()); +} +inline Vector3 add(Vector3::Arg a, float b) +{ + return Vector3(a.x() + b, a.y() + b, a.z() + b); +} +inline Vector3 operator+(Vector3::Arg a, Vector3::Arg b) +{ + return add(a, b); +} +inline Vector3 operator+(Vector3::Arg a, float b) +{ + return add(a, b); +} + +inline Vector3 sub(Vector3::Arg a, Vector3::Arg b) +{ + return Vector3(a.x() - b.x(), a.y() - b.y(), a.z() - b.z()); +} +inline Vector3 sub(Vector3::Arg a, float b) +{ + return Vector3(a.x() - b, a.y() - b, a.z() - b); +} +inline Vector3 operator-(Vector3::Arg a, Vector3::Arg b) +{ + return sub(a, b); +} +inline Vector3 operator-(Vector3::Arg a, float b) +{ + return sub(a, b); +} + +inline Vector3 cross(Vector3::Arg a, Vector3::Arg b) +{ + return Vector3(a.y() * b.z() - a.z() * b.y(), a.z() * b.x() - a.x() * b.z(), a.x() * b.y() - a.y() * b.x()); +} + +inline Vector3 scale(Vector3::Arg v, scalar s) +{ + return Vector3(v.x() * s, v.y() * s, v.z() * s); +} + +inline Vector3 scale(Vector3::Arg v, Vector3::Arg s) +{ + return Vector3(v.x() * s.x(), v.y() * s.y(), v.z() * s.z()); +} + +inline Vector3 operator*(Vector3::Arg v, scalar s) +{ + return scale(v, s); +} + +inline Vector3 operator*(scalar s, Vector3::Arg v) +{ + return scale(v, s); +} + +inline Vector3 operator*(Vector3::Arg v, Vector3::Arg s) +{ + return scale(v, s); +} + +inline Vector3 operator/(Vector3::Arg v, scalar s) +{ + return scale(v, 1.0f/s); +} + +inline Vector3 add_scaled(Vector3::Arg a, Vector3::Arg b, scalar s) +{ + return Vector3(a.x() + b.x() * s, a.y() + b.y() * s, a.z() + b.z() * s); +} + +inline Vector3 lerp(Vector3::Arg v1, Vector3::Arg v2, scalar t) +{ + const scalar s = 1.0f - t; + return Vector3(v1.x() * s + t * v2.x(), v1.y() * s + t * v2.y(), v1.z() * s + t * v2.z()); +} + +inline scalar dot(Vector3::Arg a, Vector3::Arg b) +{ + return a.x() * b.x() + a.y() * b.y() + a.z() * b.z(); +} + +inline scalar length_squared(Vector3::Arg v) +{ + return v.x() * v.x() + v.y() * v.y() + v.z() * v.z(); +} + +inline scalar length(Vector3::Arg v) +{ + return sqrtf(length_squared(v)); +} + +inline bool isNormalized(Vector3::Arg v, float epsilon = NV_NORMAL_EPSILON) +{ + return equal(length(v), 1, epsilon); +} + +inline Vector3 normalize(Vector3::Arg v, float epsilon = NV_EPSILON) +{ + float l = length(v); + nvDebugCheck(!isZero(l, epsilon)); + Vector3 n = scale(v, 1.0f / l); + nvDebugCheck(isNormalized(n)); + return n; +} + +inline Vector3 normalizeSafe(Vector3::Arg v, Vector3::Arg fallback, float epsilon = NV_EPSILON) +{ + float l = length(v); + if (isZero(l, epsilon)) { + return fallback; + } + return scale(v, 1.0f / l); +} + +inline bool equal(Vector3::Arg v1, Vector3::Arg v2, float epsilon = NV_EPSILON) +{ + return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon) && equal(v1.z(), v2.z(), epsilon); +} + +inline Vector3 min(Vector3::Arg a, Vector3::Arg b) +{ + return Vector3(min(a.x(), b.x()), min(a.y(), b.y()), min(a.z(), b.z())); +} + +inline Vector3 max(Vector3::Arg a, Vector3::Arg b) +{ + return Vector3(max(a.x(), b.x()), max(a.y(), b.y()), max(a.z(), b.z())); +} + +inline Vector3 clamp(Vector3::Arg v, float min, float max) +{ + return Vector3(clamp(v.x(), min, max), clamp(v.y(), min, max), clamp(v.z(), min, max)); +} + +inline bool isValid(Vector3::Arg v) +{ + return isFinite(v.x()) && isFinite(v.y()) && isFinite(v.z()); +} + +/* +Vector3 transform(Quaternion, vector3); +Vector3 transform_point(matrix34, vector3); +Vector3 transform_vector(matrix34, vector3); +Vector3 transform_point(matrix44, vector3); +Vector3 transform_vector(matrix44, vector3); +*/ + +// Vector4 + +inline Vector4 add(Vector4::Arg a, Vector4::Arg b) +{ + return Vector4(a.x() + b.x(), a.y() + b.y(), a.z() + b.z(), a.w() + b.w()); +} +inline Vector4 operator+(Vector4::Arg a, Vector4::Arg b) +{ + return add(a, b); +} + +inline Vector4 sub(Vector4::Arg a, Vector4::Arg b) +{ + return Vector4(a.x() - b.x(), a.y() - b.y(), a.z() - b.z(), a.w() - b.w()); +} +inline Vector4 operator-(Vector4::Arg a, Vector4::Arg b) +{ + return sub(a, b); +} + +inline Vector4 scale(Vector4::Arg v, scalar s) +{ + return Vector4(v.x() * s, v.y() * s, v.z() * s, v.w() * s); +} + +inline Vector4 scale(Vector4::Arg v, Vector4::Arg s) +{ + return Vector4(v.x() * s.x(), v.y() * s.y(), v.z() * s.z(), v.w() * s.w()); +} + +inline Vector4 operator*(Vector4::Arg v, scalar s) +{ + return scale(v, s); +} + +inline Vector4 operator*(scalar s, Vector4::Arg v) +{ + return scale(v, s); +} + +inline Vector4 operator/(Vector4::Arg v, scalar s) +{ + return scale(v, 1.0f/s); +} + +inline Vector4 add_scaled(Vector4::Arg a, Vector4::Arg b, scalar s) +{ + return Vector4(a.x() + b.x() * s, a.y() + b.y() * s, a.z() + b.z() * s, a.w() + b.w() * s); +} + +inline scalar dot(Vector4::Arg a, Vector4::Arg b) +{ + return a.x() * b.x() + a.y() * b.y() + a.z() * b.z() + a.w() * b.w(); +} + +inline scalar length_squared(Vector4::Arg v) +{ + return v.x() * v.x() + v.y() * v.y() + v.z() * v.z() + v.w() * v.w(); +} + +inline scalar length(Vector4::Arg v) +{ + return sqrtf(length_squared(v)); +} + +inline bool isNormalized(Vector4::Arg v, float epsilon = NV_NORMAL_EPSILON) +{ + return equal(length(v), 1, epsilon); +} + +inline Vector4 normalize(Vector4::Arg v, float epsilon = NV_EPSILON) +{ + float l = length(v); + nvDebugCheck(!isZero(l, epsilon)); + Vector4 n = scale(v, 1.0f / l); + nvDebugCheck(isNormalized(n)); + return n; +} + +inline Vector4 normalizeSafe(Vector4::Arg v, Vector4::Arg fallback, float epsilon = NV_EPSILON) +{ + float l = length(v); + if (isZero(l, epsilon)) { + return fallback; + } + return scale(v, 1.0f / l); +} + +inline bool equal(Vector4::Arg v1, Vector4::Arg v2, float epsilon = NV_EPSILON) +{ + return equal(v1.x(), v2.x(), epsilon) && equal(v1.y(), v2.y(), epsilon) && equal(v1.z(), v2.z(), epsilon) && equal(v1.w(), v2.w(), epsilon); +} + +inline Vector4 min(Vector4::Arg a, Vector4::Arg b) +{ + return Vector4(min(a.x(), b.x()), min(a.y(), b.y()), min(a.z(), b.z()), min(a.w(), b.w())); +} + +inline Vector4 max(Vector4::Arg a, Vector4::Arg b) +{ + return Vector4(max(a.x(), b.x()), max(a.y(), b.y()), max(a.z(), b.z()), max(a.w(), b.w())); +} + +inline bool isValid(Vector4::Arg v) +{ + return isFinite(v.x()) && isFinite(v.y()) && isFinite(v.z()) && isFinite(v.w()); +} + + + +/* +vector4 transform(matrix34, vector4); +vector4 transform(matrix44, vector4); +*/ + +/* +Quaternion mul(Quaternion, Quaternion); // rotational composition +Quaternion conjugate(Quaternion); +Quaternion inverse(Quaternion); +Quaternion axis_angle(const Vector3 & v, scalar s); +*/ + +/* +matrix34 add(matrix34, matrix34); // note: implicit '1' stays as '1' +matrix34 operator+(matrix34, matrix34); +matrix34 sub(matrix34, matrix34); // note: implicit '1' stays as '1' +matrix34 operator-(matrix34, matrix34); +matrix34 mul(matrix34, matrix34); +matrix34 operator*(matrix34, matrix34); +matrix34 mul(matrix34, quaternion4); // rotation multiplication +matrix34 operator*(matrix34, quaternion4); // rotation multiplication +matrix34 translation(vector3); +matrix34 rotation(quaternion4); +matrix34 rotation(vector3, scalar); // axis/angle + +matrix44 add(matrix44, matrix44); +matrix44 operator+(matrix44, matrix44); +matrix44 sub(matrix44, matrix44); +matrix44 operator-(matrix44, matrix44); +matrix44 mul(matrix44, matrix44); +matrix44 operator*(matrix44, matrix44); +matrix44 mul(matrix44, quaternion4); // rotation multiplication +matrix44 operator*(matrix44, quaternion4); // rotation multiplication +matrix44 invert(matrix34); +matrix44 invert(matrix44); +matrix44 transpose(matrix34); +matrix44 transpose(matrix44); +*/ + +} // nv namespace + +#endif // NV_MATH_VECTOR_H diff --git a/externals/NVTT/src/nvmath/nvmath.h b/externals/NVTT/src/nvmath/nvmath.h new file mode 100644 index 00000000..ec086b0d --- /dev/null +++ b/externals/NVTT/src/nvmath/nvmath.h @@ -0,0 +1,166 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#ifndef NV_MATH_H +#define NV_MATH_H + +#include +#include + +#include + +// Function linkage +#if NVMATH_SHARED +#ifdef NVMATH_EXPORTS +#define NVMATH_API DLL_EXPORT +#define NVMATH_CLASS DLL_EXPORT_CLASS +#else +#define NVMATH_API DLL_IMPORT +#define NVMATH_CLASS DLL_IMPORT +#endif +#else // NVMATH_SHARED +#define NVMATH_API +#define NVMATH_CLASS +#endif // NVMATH_SHARED + +#ifndef PI +#define PI float(3.1415926535897932384626433833) +#endif + +#define NV_EPSILON (0.0001f) +#define NV_NORMAL_EPSILON (0.001f) + +/* +#define SQ(r) ((r)*(r)) + +#define SIGN_BITMASK 0x80000000 + +/// Integer representation of a floating-point value. +#define IR(x) ((uint32 &)(x)) + +/// Absolute integer representation of a floating-point value +#define AIR(x) (IR(x) & 0x7fffffff) + +/// Floating-point representation of an integer value. +#define FR(x) ((float&)(x)) + +/// Integer-based comparison of a floating point value. +/// Don't use it blindly, it can be faster or slower than the FPU comparison, depends on the context. +#define IS_NEGATIVE_FLOAT(x) (IR(x)&SIGN_BITMASK) +*/ + +inline double sqrt_assert(const double f) +{ + nvDebugCheck(f >= 0.0f); + return sqrt(f); +} + +inline float sqrtf_assert(const float f) +{ + nvDebugCheck(f >= 0.0f); + return sqrtf(f); +} + +inline double acos_assert(const double f) +{ + nvDebugCheck(f >= -1.0f && f <= 1.0f); + return acos(f); +} + +inline float acosf_assert(const float f) +{ + nvDebugCheck(f >= -1.0f && f <= 1.0f); + return acosf(f); +} + +inline double asin_assert(const double f) +{ + nvDebugCheck(f >= -1.0f && f <= 1.0f); + return asin(f); +} + +inline float asinf_assert(const float f) +{ + nvDebugCheck(f >= -1.0f && f <= 1.0f); + return asinf(f); +} + +// Replace default functions with asserting ones. +#if ! defined(_MSC_VER) || (defined(_MSC_VER) && (_MSC_VER<1700)) +#define sqrt sqrt_assert +#define sqrtf sqrtf_assert +#define acos acos_assert +#define acosf acosf_assert +#define asin asin_assert +#define asinf asinf_assert +#endif + +#if NV_OS_WIN32 +#include +#endif + +namespace nv +{ +inline float toRadian(float degree) { return degree * (PI / 180.0f); } +inline float toDegree(float radian) { return radian * (180.0f / PI); } + +inline bool equal(const float f0, const float f1, const float epsilon = NV_EPSILON) +{ + return fabs(f0-f1) <= epsilon; +} + +inline bool isZero(const float f, const float epsilon = NV_EPSILON) +{ + return fabs(f) <= epsilon; +} + +inline bool isFinite(const float f) +{ +#if NV_OS_WIN32 + return _finite(f) != 0; +#elif NV_OS_DARWIN + return isfinite(f); +#elif NV_OS_LINUX + return finitef(f); +#else +# error "isFinite not supported" +#endif +//return std::isfinite (f); +//return finite (f); +} + +inline bool isNan(const float f) +{ +#if NV_OS_WIN32 + return _isnan(f) != 0; +#elif NV_OS_DARWIN + return isnan(f); +#elif NV_OS_LINUX + return isnanf(f); +#else +# error "isNan not supported" +#endif +} + +inline uint log2(uint i) +{ + uint value = 0; + while( i >>= 1 ) { + value++; + } + return value; +} + +inline float lerp(float f0, float f1, float t) +{ + const float s = 1.0f - t; + return f0 * s + f1 * t; +} + +inline float square(float f) +{ + return f * f; +} + +} // nv + +#endif // NV_MATH_H diff --git a/externals/NVTT/src/nvtt/CMakeLists.txt b/externals/NVTT/src/nvtt/CMakeLists.txt new file mode 100644 index 00000000..9ce93d05 --- /dev/null +++ b/externals/NVTT/src/nvtt/CMakeLists.txt @@ -0,0 +1,113 @@ +PROJECT(nvtt) + +ADD_SUBDIRECTORY(squish) + +SET(NVTT_SRCS + nvtt.h + nvtt.cpp + Compressor.h + Compressor.cpp + nvtt_wrapper.h + nvtt_wrapper.cpp + CompressDXT.h + CompressDXT.cpp + CompressRGB.h + CompressRGB.cpp + QuickCompressDXT.h + QuickCompressDXT.cpp + OptimalCompressDXT.h + OptimalCompressDXT.cpp + SingleColorLookup.h + CompressionOptions.h + CompressionOptions.cpp + InputOptions.h + InputOptions.cpp + OutputOptions.h + OutputOptions.cpp + cuda/CudaUtils.h + cuda/CudaUtils.cpp + cuda/CudaMath.h + cuda/Bitmaps.h + cuda/CudaCompressDXT.h + cuda/CudaCompressDXT.cpp) + +IF(CUDA_FOUND) + ADD_DEFINITIONS(-DHAVE_CUDA) + WRAP_CUDA(CUDA_SRCS cuda/CompressKernel.cu) + SET(NVTT_SRCS ${NVTT_SRCS} ${CUDA_SRCS}) + SET(LIBS ${LIBS} ${CUDA_LIBRARIES}) + INCLUDE_DIRECTORIES(${CUDA_INCLUDE_PATH}) +ENDIF(CUDA_FOUND) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +ADD_DEFINITIONS(-DNVTT_EXPORTS) + +IF(NVTT_SHARED) + ADD_DEFINITIONS(-DNVTT_SHARED=1) + ADD_LIBRARY(nvtt SHARED ${NVTT_SRCS}) +ELSE(NVTT_SHARED) + ADD_LIBRARY(nvtt ${NVTT_SRCS}) +ENDIF(NVTT_SHARED) + +TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage squish) + +INSTALL(TARGETS nvtt + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) + +INSTALL(FILES nvtt.h DESTINATION include/nvtt) + + + +# test executables +ADD_EXECUTABLE(nvcompress tools/compress.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvcompress nvcore nvmath nvimage nvtt) + +ADD_EXECUTABLE(nvdecompress tools/decompress.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvdecompress nvcore nvmath nvimage) + +ADD_EXECUTABLE(nvddsinfo tools/ddsinfo.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvddsinfo nvcore nvmath nvimage) + +ADD_EXECUTABLE(nvimgdiff tools/imgdiff.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvimgdiff nvcore nvmath nvimage) + +ADD_EXECUTABLE(nvassemble tools/assemble.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvassemble nvcore nvmath nvimage) + +ADD_EXECUTABLE(filtertest tests/filtertest.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(filtertest nvcore nvmath nvimage) + +ADD_EXECUTABLE(nvzoom tools/resize.cpp tools/cmdline.h) +TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage) + +INSTALL(TARGETS nvcompress nvdecompress nvddsinfo nvimgdiff nvassemble nvzoom DESTINATION bin) + +# UI tools +IF(QT4_FOUND AND NOT MSVC) + SET(QT_USE_QTOPENGL TRUE) + INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + + SET(SRCS + tools/main.cpp + tools/configdialog.h + tools/configdialog.cpp) + + SET(LIBS + nvtt + ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${QT_QTOPENGL_LIBRARY}) + + QT4_WRAP_UI(UICS tools/configdialog.ui) + QT4_WRAP_CPP(MOCS tools/configdialog.h) + #QT4_ADD_RESOURCES(RCCS tools/configdialog.rc) + + ADD_EXECUTABLE(nvcompressui MACOSX_BUNDLE ${SRCS} ${UICS} ${MOCS}) + TARGET_LINK_LIBRARIES(nvcompressui ${LIBS}) + +ENDIF(QT4_FOUND AND NOT MSVC) + + diff --git a/externals/NVTT/src/nvtt/CompressDXT.cpp b/externals/NVTT/src/nvtt/CompressDXT.cpp new file mode 100644 index 00000000..e6d02c96 --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressDXT.cpp @@ -0,0 +1,597 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include +#include +#include + +#include "nvtt.h" +#include "CompressDXT.h" +#include "QuickCompressDXT.h" +#include "OptimalCompressDXT.h" +#include "CompressionOptions.h" +#include "OutputOptions.h" + +// squish +#include "squish/colourset.h" +//#include "squish/clusterfit.h" +#include "squish/fastclusterfit.h" +#include "squish/weightedclusterfit.h" + + +// s3_quant +#if defined(HAVE_S3QUANT) +#include "s3tc/s3_quant.h" +#endif + +// ati tc +#if defined(HAVE_ATITC) +#include "atitc/ATI_Compress.h" +#endif + +//#include + +using namespace nv; +using namespace nvtt; + + +nv::FastCompressor::FastCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) +{ +} + +nv::FastCompressor::~FastCompressor() +{ +} + +void nv::FastCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) +{ + m_image = image; + m_alphaMode = alphaMode; +} + +void nv::FastCompressor::compressDXT1(const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT1 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + rgba.init(m_image, x, y); + + QuickCompress::compressDXT1(rgba, &block); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::FastCompressor::compressDXT1a(const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT1 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + rgba.init(m_image, x, y); + + QuickCompress::compressDXT1a(rgba, &block); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::FastCompressor::compressDXT3(const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT3 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + rgba.init(m_image, x, y); + + QuickCompress::compressDXT3(rgba, &block); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::FastCompressor::compressDXT5(const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT5 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + rgba.init(m_image, x, y); + + QuickCompress::compressDXT5(rgba, &block, 0); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::FastCompressor::compressDXT5n(const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT5 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + rgba.init(m_image, x, y); + + rgba.swizzleDXT5n(); + + QuickCompress::compressDXT5(rgba, &block, 0); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +nv::SlowCompressor::SlowCompressor() : m_image(NULL), m_alphaMode(AlphaMode_None) +{ +} + +nv::SlowCompressor::~SlowCompressor() +{ +} + +void nv::SlowCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) +{ + m_image = image; + m_alphaMode = alphaMode; +} + +void nv::SlowCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT1 block; + + squish::WeightedClusterFit fit; + //squish::ClusterFit fit; + //squish::FastClusterFit fit; + fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + if (rgba.isSingleColor()) + { + OptimalCompress::compressDXT1(rgba.color(0), &block); + } + else + { + squish::ColourSet colours((uint8 *)rgba.colors(), 0, true); + fit.SetColourSet(&colours, squish::kDxt1); + fit.Compress(&block); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::SlowCompressor::compressDXT1a(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT1 block; + + squish::WeightedClusterFit fit; + fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + bool anyAlpha = false; + bool allAlpha = true; + + for (uint i = 0; i < 16; i++) + { + if (rgba.color(i).a < 128) anyAlpha = true; + else allAlpha = false; + } + + if ((!anyAlpha && rgba.isSingleColor() || allAlpha)) + { + OptimalCompress::compressDXT1a(rgba.color(0), &block); + } + else + { + squish::ColourSet colours((uint8 *)rgba.colors(), squish::kDxt1|squish::kWeightColourByAlpha); + fit.SetColourSet(&colours, squish::kDxt1); + fit.Compress(&block); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::SlowCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT3 block; + + squish::WeightedClusterFit fit; + //squish::FastClusterFit fit; + fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + // Compress explicit alpha. + OptimalCompress::compressDXT3A(rgba, &block.alpha); + + // Compress color. + if (rgba.isSingleColor()) + { + OptimalCompress::compressDXT1(rgba.color(0), &block.color); + } + else + { + squish::ColourSet colours((uint8 *)rgba.colors(), squish::kWeightColourByAlpha); + fit.SetColourSet(&colours, 0); + fit.Compress(&block.color); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + +void nv::SlowCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT5 block; + + squish::WeightedClusterFit fit; + fit.SetMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z()); + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + // Compress alpha. + if (compressionOptions.quality == Quality_Highest) + { + OptimalCompress::compressDXT5A(rgba, &block.alpha); + } + else + { + QuickCompress::compressDXT5A(rgba, &block.alpha); + } + + // Compress color. + if (rgba.isSingleColor()) + { + OptimalCompress::compressDXT1(rgba.color(0), &block.color); + } + else + { + squish::ColourSet colours((uint8 *)rgba.colors(), squish::kWeightColourByAlpha); + fit.SetColourSet(&colours, 0); + fit.Compress(&block.color); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::SlowCompressor::compressDXT5n(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + BlockDXT5 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + rgba.swizzleDXT5n(); + + // Compress X. + if (compressionOptions.quality == Quality_Highest) + { + OptimalCompress::compressDXT5A(rgba, &block.alpha); + } + else + { + QuickCompress::compressDXT5A(rgba, &block.alpha); + } + + // Compress Y. + OptimalCompress::compressDXT1G(rgba, &block.color); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::SlowCompressor::compressBC4(const CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock rgba; + AlphaBlockDXT5 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + rgba.init(m_image, x, y); + + if (compressionOptions.quality == Quality_Highest) + { + OptimalCompress::compressDXT5A(rgba, &block); + } + else + { + QuickCompress::compressDXT5A(rgba, &block); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +void nv::SlowCompressor::compressBC5(const CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = m_image->width(); + const uint h = m_image->height(); + + ColorBlock xcolor; + ColorBlock ycolor; + + BlockATI2 block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + + xcolor.init(m_image, x, y); + xcolor.splatX(); + + ycolor.init(m_image, x, y); + ycolor.splatY(); + + if (compressionOptions.quality == Quality_Highest) + { + OptimalCompress::compressDXT5A(xcolor, &block.x); + OptimalCompress::compressDXT5A(ycolor, &block.y); + } + else + { + QuickCompress::compressDXT5A(xcolor, &block.x); + QuickCompress::compressDXT5A(ycolor, &block.y); + } + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&block, sizeof(block)); + } + } + } +} + + +#if defined(HAVE_S3QUANT) + +void nv::s3CompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions) +{ + const uint w = image->width(); + const uint h = image->height(); + + float error = 0.0f; + + BlockDXT1 dxtBlock3; + BlockDXT1 dxtBlock4; + ColorBlock block; + + for (uint y = 0; y < h; y += 4) { + for (uint x = 0; x < w; x += 4) { + block.init(image, x, y); + + // Init rgb block. + RGBBlock rgbBlock; + rgbBlock.n = 16; + for (uint i = 0; i < 16; i++) { + rgbBlock.colorChannel[i][0] = clamp(float(block.color(i).r) / 255.0f, 0.0f, 1.0f); + rgbBlock.colorChannel[i][1] = clamp(float(block.color(i).g) / 255.0f, 0.0f, 1.0f); + rgbBlock.colorChannel[i][2] = clamp(float(block.color(i).b) / 255.0f, 0.0f, 1.0f); + } + rgbBlock.weight[0] = 1.0f; + rgbBlock.weight[1] = 1.0f; + rgbBlock.weight[2] = 1.0f; + + rgbBlock.inLevel = 4; + CodeRGBBlock(&rgbBlock); + + // Copy results to DXT block. + dxtBlock4.col0.r = rgbBlock.endPoint[0][0]; + dxtBlock4.col0.g = rgbBlock.endPoint[0][1]; + dxtBlock4.col0.b = rgbBlock.endPoint[0][2]; + + dxtBlock4.col1.r = rgbBlock.endPoint[1][0]; + dxtBlock4.col1.g = rgbBlock.endPoint[1][1]; + dxtBlock4.col1.b = rgbBlock.endPoint[1][2]; + + dxtBlock4.setIndices(rgbBlock.index); + + if (dxtBlock4.col0.u < dxtBlock4.col1.u) { + swap(dxtBlock4.col0.u, dxtBlock4.col1.u); + dxtBlock4.indices ^= 0x55555555; + } + + uint error4 = blockError(block, dxtBlock4); + + rgbBlock.inLevel = 3; + + CodeRGBBlock(&rgbBlock); + + // Copy results to DXT block. + dxtBlock3.col0.r = rgbBlock.endPoint[0][0]; + dxtBlock3.col0.g = rgbBlock.endPoint[0][1]; + dxtBlock3.col0.b = rgbBlock.endPoint[0][2]; + + dxtBlock3.col1.r = rgbBlock.endPoint[1][0]; + dxtBlock3.col1.g = rgbBlock.endPoint[1][1]; + dxtBlock3.col1.b = rgbBlock.endPoint[1][2]; + + dxtBlock3.setIndices(rgbBlock.index); + + if (dxtBlock3.col0.u > dxtBlock3.col1.u) { + swap(dxtBlock3.col0.u, dxtBlock3.col1.u); + dxtBlock3.indices ^= (~dxtBlock3.indices >> 1) & 0x55555555; + } + + uint error3 = blockError(block, dxtBlock3); + + if (error3 < error4) { + error += error3; + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&dxtBlock3, sizeof(dxtBlock3)); + } + } + else { + error += error4; + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(&dxtBlock4, sizeof(dxtBlock4)); + } + } + } + } + + printf("error = %f\n", error/((w+3)/4 * (h+3)/4)); +} + +#endif // defined(HAVE_S3QUANT) + + +#if defined(HAVE_ATITC) + +void nv::atiCompressDXT1(const Image * image, const OutputOptions::Private & outputOptions) +{ + // Init source texture + ATI_TC_Texture srcTexture; + srcTexture.dwSize = sizeof(srcTexture); + srcTexture.dwWidth = image->width(); + srcTexture.dwHeight = image->height(); + srcTexture.dwPitch = image->width() * 4; + srcTexture.format = ATI_TC_FORMAT_ARGB_8888; + srcTexture.dwDataSize = ATI_TC_CalculateBufferSize(&srcTexture); + srcTexture.pData = (ATI_TC_BYTE*) image->pixels(); + + // Init dest texture + ATI_TC_Texture destTexture; + destTexture.dwSize = sizeof(destTexture); + destTexture.dwWidth = image->width(); + destTexture.dwHeight = image->height(); + destTexture.dwPitch = 0; + destTexture.format = ATI_TC_FORMAT_DXT1; + destTexture.dwDataSize = ATI_TC_CalculateBufferSize(&destTexture); + destTexture.pData = (ATI_TC_BYTE*) mem::malloc(destTexture.dwDataSize); + + // Compress + ATI_TC_ConvertTexture(&srcTexture, &destTexture, NULL, NULL, NULL, NULL); + + if (outputOptions.outputHandler != NULL) { + outputOptions.outputHandler->writeData(destTexture.pData, destTexture.dwDataSize); + } +} + +#endif // defined(HAVE_ATITC) diff --git a/externals/NVTT/src/nvtt/CompressDXT.h b/externals/NVTT/src/nvtt/CompressDXT.h new file mode 100644 index 00000000..f25112f4 --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressDXT.h @@ -0,0 +1,87 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_COMPRESSDXT_H +#define NV_TT_COMPRESSDXT_H + +#include +#include "nvtt.h" + +namespace nv +{ + class Image; + class FloatImage; + + class FastCompressor + { + public: + FastCompressor(); + ~FastCompressor(); + + void setImage(const Image * image, nvtt::AlphaMode alphaMode); + + void compressDXT1(const nvtt::OutputOptions::Private & outputOptions); + void compressDXT1a(const nvtt::OutputOptions::Private & outputOptions); + void compressDXT3(const nvtt::OutputOptions::Private & outputOptions); + void compressDXT5(const nvtt::OutputOptions::Private & outputOptions); + void compressDXT5n(const nvtt::OutputOptions::Private & outputOptions); + + private: + const Image * m_image; + nvtt::AlphaMode m_alphaMode; + }; + + class SlowCompressor + { + public: + SlowCompressor(); + ~SlowCompressor(); + + void setImage(const Image * image, nvtt::AlphaMode alphaMode); + + void compressDXT1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT1a(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT3(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT5n(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressBC4(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressBC5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + + private: + const Image * m_image; + nvtt::AlphaMode m_alphaMode; + }; + + // External compressors. +#if defined(HAVE_S3QUANT) + void s3CompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions); +#endif + +#if defined(HAVE_ATITC) + void atiCompressDXT1(const Image * image, const nvtt::OutputOptions::Private & outputOptions); +#endif + +} // nv namespace + + +#endif // NV_TT_COMPRESSDXT_H diff --git a/externals/NVTT/src/nvtt/CompressRGB.cpp b/externals/NVTT/src/nvtt/CompressRGB.cpp new file mode 100644 index 00000000..4f0ff660 --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressRGB.cpp @@ -0,0 +1,140 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include +#include +#include + +#include "CompressRGB.h" +#include "CompressionOptions.h" +#include "OutputOptions.h" + +using namespace nv; +using namespace nvtt; + +namespace +{ + + inline uint computePitch(uint w, uint bitsize) + { + uint p = w * ((bitsize + 7) / 8); + + // Align to 32 bits. + return ((p + 3) / 4) * 4; + } + + inline void convert_to_a8r8g8b8(const void * src, void * dst, uint w) + { + memcpy(dst, src, 4 * w); + } + + inline void convert_to_x8r8g8b8(const void * src, void * dst, uint w) + { + memcpy(dst, src, 4 * w); + } + +} // namespace + + +// Pixel format converter. +void nv::compressRGB(const Image * image, const OutputOptions::Private & outputOptions, const CompressionOptions::Private & compressionOptions) +{ + nvCheck(image != NULL); + + const uint w = image->width(); + const uint h = image->height(); + + const uint bitCount = compressionOptions.bitcount; + nvCheck(bitCount == 8 || bitCount == 16 || bitCount == 24 || bitCount == 32); + + const uint byteCount = bitCount / 8; + + const uint rmask = compressionOptions.rmask; + uint rshift, rsize; + PixelFormat::maskShiftAndSize(rmask, &rshift, &rsize); + + const uint gmask = compressionOptions.gmask; + uint gshift, gsize; + PixelFormat::maskShiftAndSize(gmask, &gshift, &gsize); + + const uint bmask = compressionOptions.bmask; + uint bshift, bsize; + PixelFormat::maskShiftAndSize(bmask, &bshift, &bsize); + + const uint amask = compressionOptions.amask; + uint ashift, asize; + PixelFormat::maskShiftAndSize(amask, &ashift, &asize); + + // Determine pitch. + uint pitch = computePitch(w, compressionOptions.bitcount); + + uint8 * dst = (uint8 *)mem::malloc(pitch + 4); + + for (uint y = 0; y < h; y++) + { + const Color32 * src = image->scanline(y); + + if (bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0xFF000000) + { + convert_to_a8r8g8b8(src, dst, w); + } + else if (bitCount == 32 && rmask == 0xFF0000 && gmask == 0xFF00 && bmask == 0xFF && amask == 0) + { + convert_to_x8r8g8b8(src, dst, w); + } + else + { + // Generic pixel format conversion. + for (uint x = 0; x < w; x++) + { + uint c = 0; + c |= PixelFormat::convert(src[x].r, 8, rsize) << rshift; + c |= PixelFormat::convert(src[x].g, 8, gsize) << gshift; + c |= PixelFormat::convert(src[x].b, 8, bsize) << bshift; + c |= PixelFormat::convert(src[x].a, 8, asize) << ashift; + + // Output one byte at a time. + for (uint i = 0; i < byteCount; i++) + { + *(dst + x * byteCount + i) = (c >> (i * 8)) & 0xFF; + } + } + + // Zero padding. + for (uint x = w * byteCount; x < pitch; x++) + { + *(dst + x) = 0; + } + } + + if (outputOptions.outputHandler != NULL) + { + outputOptions.outputHandler->writeData(dst, pitch); + } + } + + mem::free(dst); +} + diff --git a/externals/NVTT/src/nvtt/CompressRGB.h b/externals/NVTT/src/nvtt/CompressRGB.h new file mode 100644 index 00000000..7586254b --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressRGB.h @@ -0,0 +1,39 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_COMPRESSRGB_H +#define NV_TT_COMPRESSRGB_H + +#include "nvtt.h" + +namespace nv +{ + class Image; + + // Pixel format converter. + void compressRGB(const Image * image, const nvtt::OutputOptions::Private & outputOptions, const nvtt::CompressionOptions::Private & compressionOptions); + +} // nv namespace + + +#endif // NV_TT_COMPRESSDXT_H diff --git a/externals/NVTT/src/nvtt/CompressionOptions.cpp b/externals/NVTT/src/nvtt/CompressionOptions.cpp new file mode 100644 index 00000000..cc5fa7ba --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressionOptions.cpp @@ -0,0 +1,143 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include "nvtt.h" +#include "CompressionOptions.h" + +using namespace nv; +using namespace nvtt; + + +/// Constructor. Sets compression options to the default values. +CompressionOptions::CompressionOptions() : m(*new CompressionOptions::Private()) +{ + reset(); +} + + +/// Destructor. +CompressionOptions::~CompressionOptions() +{ + delete &m; +} + + +/// Set default compression options. +void CompressionOptions::reset() +{ + m.format = Format_DXT1; + m.quality = Quality_Normal; + m.colorWeight.set(1.0f, 1.0f, 1.0f, 1.0f); + + m.bitcount = 32; + m.bmask = 0x000000FF; + m.gmask = 0x0000FF00; + m.rmask = 0x00FF0000; + m.amask = 0xFF000000; + + m.enableColorDithering = false; + m.enableAlphaDithering = false; + m.binaryAlpha = false; + m.alphaThreshold = 127; +} + + +/// Set desired compression format. +void CompressionOptions::setFormat(Format format) +{ + m.format = format; +} + + +/// Set compression quality settings. +void CompressionOptions::setQuality(Quality quality) +{ + m.quality = quality; +} + + +/// Set the weights of each color channel. +/// The choice for these values is subjective. In many case uniform color weights +/// (1.0, 1.0, 1.0) work very well. A popular choice is to use the NTSC luma encoding +/// weights (0.2126, 0.7152, 0.0722), but I think that blue contributes to our +/// perception more than a 7%. A better choice in my opinion is (3, 4, 2). +void CompressionOptions::setColorWeights(float red, float green, float blue, float alpha/*=1.0f*/) +{ +// float total = red + green + blue; +// float x = red / total; +// float y = green / total; +// m.colorWeight.set(x, y, 1.0f - x - y); + m.colorWeight.set(red, green, blue, alpha); +} + + +/// Set color mask to describe the RGB/RGBA format. +void CompressionOptions::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) +{ + // Validate arguments. + nvCheck(bitcount == 8 || bitcount == 16 || bitcount == 24 || bitcount == 32); + nvCheck((rmask & gmask) == 0); + nvCheck((rmask & bmask) == 0); + nvCheck((rmask & amask) == 0); + nvCheck((gmask & bmask) == 0); + nvCheck((gmask & amask) == 0); + nvCheck((bmask & amask) == 0); + + if (bitcount != 32) + { + uint maxMask = (1 << bitcount); + nvCheck(maxMask > rmask); + nvCheck(maxMask > gmask); + nvCheck(maxMask > bmask); + nvCheck(maxMask > amask); + } + + m.bitcount = bitcount; + m.rmask = rmask; + m.gmask = gmask; + m.bmask = bmask; + m.amask = amask; +} + +/// Use external compressor. +void CompressionOptions::setExternalCompressor(const char * name) +{ + m.externalCompressor = name; +} + +/// Set quantization options. +/// @warning Do not enable dithering unless you know what you are doing. Quantization +/// introduces errors. It's better to let the compressor quantize the result to +/// minimize the error, instead of quantizing the data before handling it to +/// the compressor. +void CompressionOptions::setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold/*= 127*/) +{ + nvCheck(alphaThreshold >= 0 && alphaThreshold < 256); + m.enableColorDithering = colorDithering; + m.enableAlphaDithering = alphaDithering; + m.binaryAlpha = binaryAlpha; + m.alphaThreshold = alphaThreshold; +} + + + diff --git a/externals/NVTT/src/nvtt/CompressionOptions.h b/externals/NVTT/src/nvtt/CompressionOptions.h new file mode 100644 index 00000000..b0c26779 --- /dev/null +++ b/externals/NVTT/src/nvtt/CompressionOptions.h @@ -0,0 +1,61 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_COMPRESSIONOPTIONS_H +#define NV_TT_COMPRESSIONOPTIONS_H + +#include +#include +#include "nvtt.h" + +namespace nvtt +{ + + struct CompressionOptions::Private + { + Format format; + + Quality quality; + + nv::Vector4 colorWeight; + + // Pixel format description. + uint bitcount; + uint rmask; + uint gmask; + uint bmask; + uint amask; + + nv::String externalCompressor; + + // Quantization. + bool enableColorDithering; + bool enableAlphaDithering; + bool binaryAlpha; + int alphaThreshold; // reference value used for binary alpha quantization. + }; + +} // nvtt namespace + + +#endif // NV_TT_COMPRESSIONOPTIONS_H diff --git a/externals/NVTT/src/nvtt/Compressor.cpp b/externals/NVTT/src/nvtt/Compressor.cpp new file mode 100644 index 00000000..ec788ef2 --- /dev/null +++ b/externals/NVTT/src/nvtt/Compressor.cpp @@ -0,0 +1,853 @@ +// Copyright NVIDIA Corporation 2008 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Compressor.h" +#include "InputOptions.h" +#include "CompressionOptions.h" +#include "OutputOptions.h" + +#include "CompressDXT.h" +#include "CompressRGB.h" +#include "cuda/CudaUtils.h" +#include "cuda/CudaCompressDXT.h" + + +using namespace nv; +using namespace nvtt; + + +namespace +{ + + static int blockSize(Format format) + { + if (format == Format_DXT1 || format == Format_DXT1a) { + return 8; + } + else if (format == Format_DXT3) { + return 16; + } + else if (format == Format_DXT5 || format == Format_DXT5n) { + return 16; + } + else if (format == Format_BC4) { + return 8; + } + else if (format == Format_BC5) { + return 16; + } + return 0; + } + + inline uint computePitch(uint w, uint bitsize) + { + uint p = w * ((bitsize + 7) / 8); + + // Align to 32 bits. + return ((p + 3) / 4) * 4; + } + + static int computeImageSize(uint w, uint h, uint d, uint bitCount, Format format) + { + if (format == Format_RGBA) { + return d * h * computePitch(w, bitCount); + } + else { + // @@ Handle 3D textures. DXT and VTC have different behaviors. + return ((w + 3) / 4) * ((h + 3) / 4) * blockSize(format); + } + } + +} // namespace + +namespace nvtt +{ + // Mipmap could be: + // - a pointer to an input image. + // - a fixed point image. + // - a floating point image. + struct Mipmap + { + Mipmap() : m_inputImage(NULL) {} + ~Mipmap() {} + + // Reference input image. + void setFromInput(const InputOptions::Private & inputOptions, uint idx) + { + m_inputImage = inputOptions.image(idx); + m_fixedImage = NULL; + m_floatImage = NULL; + } + + // Assign and take ownership of given image. + void setImage(FloatImage * image) + { + m_inputImage = NULL; + m_fixedImage = NULL; + m_floatImage = image; + } + + + // Convert linear float image to fixed image ready for compression. + void toFixedImage(const InputOptions::Private & inputOptions) + { + if (m_floatImage != NULL) // apfaffe - We should check that we have a float image, if so convert it! + { + if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f) + { + m_fixedImage = m_floatImage->createImage(); + } + else + { + m_fixedImage = m_floatImage->createImageGammaCorrect(inputOptions.outputGamma); + } + } + } + + // Convert input image to linear float image. + void toFloatImage(const InputOptions::Private & inputOptions) + { + if (m_floatImage == NULL) + { + nvDebugCheck(this->asFixedImage() != NULL); + + m_floatImage = new FloatImage(this->asFixedImage()); + + if (inputOptions.isNormalMap) + { + // Expand normals to [-1, 1] range. + // floatImage->expandNormals(0); + } + else if (inputOptions.inputGamma != 1.0f) + { + // Convert to linear space. + m_floatImage->toLinear(0, 3, inputOptions.inputGamma); + } + } + } + + const FloatImage * asFloatImage() const + { + return m_floatImage.ptr(); + } + + FloatImage * asFloatImage() + { + return m_floatImage.ptr(); + } + + const Image * asFixedImage() const + { + // - apfaffe - switched logic to return the 'processed image' rather than the input! + if (m_fixedImage != NULL && m_fixedImage.ptr() != NULL) + { + return m_fixedImage.ptr(); + } + return m_inputImage; + } + + Image * asMutableFixedImage() + { + if (m_inputImage != NULL) + { + // Do not modify input image, create a copy. + m_fixedImage = new Image(*m_inputImage); + m_inputImage = NULL; + } + return m_fixedImage.ptr(); + } + + + private: + const Image * m_inputImage; + AutoPtr m_fixedImage; + AutoPtr m_floatImage; + }; + +} // nvtt namespace + + +Compressor::Compressor() : m(*new Compressor::Private()) +{ + // CUDA initialization. + m.cudaSupported = cuda::isHardwarePresent(); + m.cudaEnabled = false; + m.cudaDevice = -1; + + enableCudaAcceleration(m.cudaSupported); +} + +Compressor::~Compressor() +{ + enableCudaAcceleration(false); + delete &m; +} + + +/// Enable CUDA acceleration. +void Compressor::enableCudaAcceleration(bool enable) +{ + if (m.cudaSupported) + { + if (m.cudaEnabled && !enable) + { + m.cudaEnabled = false; + m.cuda = NULL; + + if (m.cudaDevice != -1) + { + // Exit device. + cuda::exitDevice(); + } + } + else if (!m.cudaEnabled && enable) + { + // Init the CUDA device. This may return -1 if CUDA was already initialized by the app. + m.cudaEnabled = cuda::initDevice(&m.cudaDevice); + + if (m.cudaEnabled) + { + // Create compressor if initialization succeeds. + m.cuda = new CudaCompressor(); + + // But cleanup if failed. + if (!m.cuda->isValid()) + { + enableCudaAcceleration(false); + } + } + } + } +} + +/// Check if CUDA acceleration is enabled. +bool Compressor::isCudaAccelerationEnabled() const +{ + return m.cudaEnabled; +} + + +/// Compress the input texture with the given compression options. +bool Compressor::process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const +{ + return m.compress(inputOptions.m, compressionOptions.m, outputOptions.m); +} + + +/// Estimate the size of compressing the input with the given options. +int Compressor::estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const +{ + return m.estimateSize(inputOptions.m, compressionOptions.m); +} + + + + +bool Compressor::Private::compress(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const +{ + // Make sure enums match. + nvStaticCheck(FloatImage::WrapMode_Clamp == (FloatImage::WrapMode)WrapMode_Clamp); + nvStaticCheck(FloatImage::WrapMode_Mirror == (FloatImage::WrapMode)WrapMode_Mirror); + nvStaticCheck(FloatImage::WrapMode_Repeat == (FloatImage::WrapMode)WrapMode_Repeat); + + // Get output handler. + if (!outputOptions.openFile()) + { + if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_FileOpen); + return false; + } + + inputOptions.computeTargetExtents(); + + // Output DDS header. + if (!outputHeader(inputOptions, compressionOptions, outputOptions)) + { + return false; + } + + for (uint f = 0; f < inputOptions.faceCount; f++) + { + if (!compressMipmaps(f, inputOptions, compressionOptions, outputOptions)) + { + return false; + } + } + + outputOptions.closeFile(); + + return true; +} + + +// Output DDS header. +bool Compressor::Private::outputHeader(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const +{ + // Output DDS header. + if (outputOptions.outputHandler == NULL || !outputOptions.outputHeader) + { + return true; + } + + DDSHeader header; + + header.setWidth(inputOptions.targetWidth); + header.setHeight(inputOptions.targetHeight); + + int mipmapCount = inputOptions.realMipmapCount(); + nvDebugCheck(mipmapCount > 0); + + header.setMipmapCount(mipmapCount); + + if (inputOptions.textureType == TextureType_2D) { + header.setTexture2D(); + } + else if (inputOptions.textureType == TextureType_Cube) { + header.setTextureCube(); + } + /*else if (inputOptions.textureType == TextureType_3D) { + header.setTexture3D(); + header.setDepth(inputOptions.targetDepth); + }*/ + + if (compressionOptions.format == Format_RGBA) + { + header.setPitch(computePitch(inputOptions.targetWidth, compressionOptions.bitcount)); + header.setPixelFormat(compressionOptions.bitcount, compressionOptions.rmask, compressionOptions.gmask, compressionOptions.bmask, compressionOptions.amask); + } + else + { + header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, inputOptions.targetDepth, compressionOptions.bitcount, compressionOptions.format)); + + if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a) { + header.setFourCC('D', 'X', 'T', '1'); + if (inputOptions.isNormalMap) header.setNormalFlag(true); + } + else if (compressionOptions.format == Format_DXT3) { + header.setFourCC('D', 'X', 'T', '3'); + } + else if (compressionOptions.format == Format_DXT5) { + header.setFourCC('D', 'X', 'T', '5'); + } + else if (compressionOptions.format == Format_DXT5n) { + header.setFourCC('D', 'X', 'T', '5'); + if (inputOptions.isNormalMap) header.setNormalFlag(true); + } + else if (compressionOptions.format == Format_BC4) { + header.setFourCC('A', 'T', 'I', '1'); + } + else if (compressionOptions.format == Format_BC5) { + header.setFourCC('A', 'T', 'I', '2'); + if (inputOptions.isNormalMap) header.setNormalFlag(true); + } + } + + // Swap bytes if necessary. + header.swapBytes(); + + uint headerSize = 128; + if (header.hasDX10Header()) + { + nvStaticCheck(sizeof(DDSHeader) == 128 + 20); + headerSize = 128 + 20; + } + + bool writeSucceed = outputOptions.outputHandler->writeData(&header, headerSize); + if (!writeSucceed && outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_FileWrite); + } + + return writeSucceed; +} + + +bool Compressor::Private::compressMipmaps(uint f, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const +{ + uint w = inputOptions.targetWidth; + uint h = inputOptions.targetHeight; + uint d = inputOptions.targetDepth; + + Mipmap mipmap; + + const uint mipmapCount = inputOptions.realMipmapCount(); + nvDebugCheck(mipmapCount > 0); + + for (uint m = 0; m < mipmapCount; m++) + { + if (outputOptions.outputHandler) + { + int size = computeImageSize(w, h, d, compressionOptions.bitcount, compressionOptions.format); + outputOptions.outputHandler->beginImage(size, w, h, d, f, m); + } + + // @@ Where to do the color transform? + // - Color transform may not be linear, so we cannot do before computing mipmaps. + // - Should be done in linear space, that is, after gamma correction. + + if (!initMipmap(mipmap, inputOptions, w, h, d, f, m)) + { + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_InvalidInput); + return false; + } + } + + quantizeMipmap(mipmap, compressionOptions); + + compressMipmap(mipmap, inputOptions, compressionOptions, outputOptions); + + // Compute extents of next mipmap: + w = max(1U, w / 2); + h = max(1U, h / 2); + d = max(1U, d / 2); + } + + return true; +} + +bool Compressor::Private::initMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f, uint m) const +{ + // Find image from input. + int inputIdx = findExactMipmap(inputOptions, w, h, d, f); + + if ((inputIdx == -1 || inputOptions.convertToNormalMap) && m != 0) + { + // Generate from last, when mipmap not found, or normal map conversion enabled. + downsampleMipmap(mipmap, inputOptions); + } + else + { + if (inputIdx != -1) + { + // If input mipmap found, then get from input. + mipmap.setFromInput(inputOptions, inputIdx); + } + else + { + // If not found, resize closest mipmap. + inputIdx = findClosestMipmap(inputOptions, w, h, d, f); + + if (inputIdx == -1) + { + return false; + } + + mipmap.setFromInput(inputOptions, inputIdx); + + scaleMipmap(mipmap, inputOptions, w, h, d); + } + + processInputImage(mipmap, inputOptions); + } + + // Convert linear float image to fixed image ready for compression. + mipmap.toFixedImage(inputOptions); + + return true; +} + +int Compressor::Private::findExactMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const +{ + for (int m = 0; m < int(inputOptions.mipmapCount); m++) + { + int idx = f * inputOptions.mipmapCount + m; + const InputOptions::Private::InputImage & inputImage = inputOptions.images[idx]; + + if (inputImage.width == int(w) && inputImage.height == int(h) && inputImage.depth == int(d)) + { + if (inputImage.data != NULL) + { + return idx; + } + return -1; + } + else if (inputImage.width < int(w) || inputImage.height < int(h) || inputImage.depth < int(d)) + { + return -1; + } + } + + return -1; +} + +int Compressor::Private::findClosestMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const +{ + int bestIdx = -1; + + for (int m = 0; m < int(inputOptions.mipmapCount); m++) + { + int idx = f * inputOptions.mipmapCount + m; + const InputOptions::Private::InputImage & inputImage = inputOptions.images[idx]; + + if (inputImage.data != NULL) + { + int difference = (inputImage.width - w) + (inputImage.height - h) + (inputImage.depth - d); + + if (difference < 0) + { + if (bestIdx == -1) + { + bestIdx = idx; + } + + return bestIdx; + } + + bestIdx = idx; + } + } + + return bestIdx; +} + +// Create mipmap from the given image. +void Compressor::Private::downsampleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const +{ + // Make sure that floating point linear representation is available. + mipmap.toFloatImage(inputOptions); + + const FloatImage * floatImage = mipmap.asFloatImage(); + + if (inputOptions.mipmapFilter == MipmapFilter_Box) + { + // Use fast downsample. + mipmap.setImage(floatImage->fastDownSample()); + } + else if (inputOptions.mipmapFilter == MipmapFilter_Triangle) + { + TriangleFilter filter; + mipmap.setImage(floatImage->downSample(filter, (FloatImage::WrapMode)inputOptions.wrapMode)); + } + else /*if (inputOptions.mipmapFilter == MipmapFilter_Kaiser)*/ + { + nvDebugCheck(inputOptions.mipmapFilter == MipmapFilter_Kaiser); + KaiserFilter filter(inputOptions.kaiserWidth); + filter.setParameters(inputOptions.kaiserAlpha, inputOptions.kaiserStretch); + mipmap.setImage(floatImage->downSample(filter, (FloatImage::WrapMode)inputOptions.wrapMode)); + } + + // Normalize mipmap. + if ((inputOptions.isNormalMap || inputOptions.convertToNormalMap) && inputOptions.normalizeMipmaps) + { + normalizeNormalMap(mipmap.asFloatImage()); + } +} + + +void Compressor::Private::scaleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d) const +{ + mipmap.toFloatImage(inputOptions); + + // @@ Add more filters. + // @@ Select different filters for downscaling and reconstruction. + + // Resize image. + BoxFilter boxFilter; + mipmap.setImage(mipmap.asFloatImage()->resize(boxFilter, w, h, (FloatImage::WrapMode)inputOptions.wrapMode)); +} + + +// Process an input image: Convert to normal map, normalize, or convert to linear space. +void Compressor::Private::processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const +{ + if (inputOptions.convertToNormalMap) + { + mipmap.toFixedImage(inputOptions); + + Vector4 heightScale = inputOptions.heightFactors; + mipmap.setImage(createNormalMap(mipmap.asFixedImage(), (FloatImage::WrapMode)inputOptions.wrapMode, heightScale, inputOptions.bumpFrequencyScale)); + } + else if (inputOptions.isNormalMap) + { + if (inputOptions.normalizeMipmaps) + { + // If floating point image available, normalize in place. + if (mipmap.asFloatImage() == NULL) + { + FloatImage * floatImage = new FloatImage(mipmap.asFixedImage()); + normalizeNormalMap(floatImage); + mipmap.setImage(floatImage); + } + else + { + normalizeNormalMap(mipmap.asFloatImage()); + mipmap.setImage(mipmap.asFloatImage()); + } + } + } + else + { + if (inputOptions.inputGamma != inputOptions.outputGamma) + { + mipmap.toFloatImage(inputOptions); + } + } +} + + +// Quantize the given mipmap according to the compression options. +void Compressor::Private::quantizeMipmap(Mipmap & mipmap, const CompressionOptions::Private & compressionOptions) const +{ + nvDebugCheck(mipmap.asFixedImage() != NULL); + + if (compressionOptions.binaryAlpha) + { + if (compressionOptions.enableAlphaDithering) + { + Quantize::FloydSteinberg_BinaryAlpha(mipmap.asMutableFixedImage(), compressionOptions.alphaThreshold); + } + else + { + Quantize::BinaryAlpha(mipmap.asMutableFixedImage(), compressionOptions.alphaThreshold); + } + } + + if (compressionOptions.enableColorDithering || compressionOptions.enableAlphaDithering) + { + uint rsize = 8; + uint gsize = 8; + uint bsize = 8; + uint asize = 8; + + if (compressionOptions.enableColorDithering) + { + if (compressionOptions.format >= Format_DXT1 && compressionOptions.format <= Format_DXT5) + { + rsize = 5; + gsize = 6; + bsize = 5; + } + else if (compressionOptions.format == Format_RGB) + { + uint rshift, gshift, bshift; + PixelFormat::maskShiftAndSize(compressionOptions.rmask, &rshift, &rsize); + PixelFormat::maskShiftAndSize(compressionOptions.gmask, &gshift, &gsize); + PixelFormat::maskShiftAndSize(compressionOptions.bmask, &bshift, &bsize); + } + } + + if (compressionOptions.enableAlphaDithering) + { + if (compressionOptions.format == Format_DXT3) + { + asize = 4; + } + else if (compressionOptions.format == Format_RGB) + { + uint ashift; + PixelFormat::maskShiftAndSize(compressionOptions.amask, &ashift, &asize); + } + } + + if (compressionOptions.binaryAlpha) + { + asize = 8; // Already quantized. + } + + Quantize::FloydSteinberg(mipmap.asMutableFixedImage(), rsize, gsize, bsize, asize); + } +} + + +// Compress the given mipmap. +bool Compressor::Private::compressMipmap(const Mipmap & mipmap, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const +{ + const Image * image = mipmap.asFixedImage(); + nvDebugCheck(image != NULL); + + FastCompressor fast; + fast.setImage(image, inputOptions.alphaMode); + + SlowCompressor slow; + slow.setImage(image, inputOptions.alphaMode); + + const bool useCuda = cudaEnabled && image->width() * image->height() >= 512; + + if (compressionOptions.format == Format_RGBA || compressionOptions.format == Format_RGB) + { + compressRGB(image, outputOptions, compressionOptions); + } + else if (compressionOptions.format == Format_DXT1) + { +#if defined(HAVE_S3QUANT) + if (compressionOptions.externalCompressor == "s3") + { + s3CompressDXT1(image, outputOptions); + } + else +#endif + +#if defined(HAVE_ATITC) + if (compressionOptions.externalCompressor == "ati") + { + atiCompressDXT1(image, outputOptions); + } + else +#endif + if (compressionOptions.quality == Quality_Fastest) + { + fast.compressDXT1(outputOptions); + } + else + { + if (useCuda) + { + nvDebugCheck(cudaSupported); + cuda->setImage(image, inputOptions.alphaMode); + cuda->compressDXT1(compressionOptions, outputOptions); + } + else + { + slow.compressDXT1(compressionOptions, outputOptions); + } + } + } + else if (compressionOptions.format == Format_DXT1a) + { + if (compressionOptions.quality == Quality_Fastest) + { + fast.compressDXT1a(outputOptions); + } + else + { + if (useCuda) + { + nvDebugCheck(cudaSupported); + /*cuda*/slow.compressDXT1a(compressionOptions, outputOptions); + } + else + { + slow.compressDXT1a(compressionOptions, outputOptions); + } + } + } + else if (compressionOptions.format == Format_DXT3) + { + if (compressionOptions.quality == Quality_Fastest) + { + fast.compressDXT3(outputOptions); + } + else + { + if (useCuda) + { + nvDebugCheck(cudaSupported); + cuda->setImage(image, inputOptions.alphaMode); + cuda->compressDXT3(compressionOptions, outputOptions); + } + else + { + slow.compressDXT3(compressionOptions, outputOptions); + } + } + } + else if (compressionOptions.format == Format_DXT5) + { + if (compressionOptions.quality == Quality_Fastest) + { + fast.compressDXT5(outputOptions); + } + else + { + if (useCuda) + { + nvDebugCheck(cudaSupported); + cuda->setImage(image, inputOptions.alphaMode); + cuda->compressDXT5(compressionOptions, outputOptions); + } + else + { + slow.compressDXT5(compressionOptions, outputOptions); + } + } + } + else if (compressionOptions.format == Format_DXT5n) + { + if (compressionOptions.quality == Quality_Fastest) + { + fast.compressDXT5n(outputOptions); + } + else + { + slow.compressDXT5n(compressionOptions, outputOptions); + } + } + else if (compressionOptions.format == Format_BC4) + { + slow.compressBC4(compressionOptions, outputOptions); + } + else if (compressionOptions.format == Format_BC5) + { + slow.compressBC5(compressionOptions, outputOptions); + } + + return true; +} + + +int Compressor::Private::estimateSize(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions) const +{ + const Format format = compressionOptions.format; + const uint bitCount = compressionOptions.bitcount; + + inputOptions.computeTargetExtents(); + + uint mipmapCount = inputOptions.realMipmapCount(); + + int size = 0; + + for (uint f = 0; f < inputOptions.faceCount; f++) + { + uint w = inputOptions.targetWidth; + uint h = inputOptions.targetHeight; + uint d = inputOptions.targetDepth; + + for (uint m = 0; m < mipmapCount; m++) + { + size += computeImageSize(w, h, d, bitCount, format); + + // Compute extents of next mipmap: + w = max(1U, w / 2); + h = max(1U, h / 2); + d = max(1U, d / 2); + } + } + + return size; +} diff --git a/externals/NVTT/src/nvtt/Compressor.h b/externals/NVTT/src/nvtt/Compressor.h new file mode 100644 index 00000000..31f59c86 --- /dev/null +++ b/externals/NVTT/src/nvtt/Compressor.h @@ -0,0 +1,80 @@ +// Copyright NVIDIA Corporation 2008 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_COMPRESSOR_H +#define NV_TT_COMPRESSOR_H + +#include + +#include + +#include "nvtt.h" + +namespace nv +{ + class Image; +} + +namespace nvtt +{ + struct Mipmap; + + struct Compressor::Private + { + Private() {} + + bool compress(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const; + int estimateSize(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions) const; + + private: + + bool outputHeader(const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const; + bool compressMipmaps(uint f, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const; + + bool initMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f, uint m) const; + + int findExactMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const; + int findClosestMipmap(const InputOptions::Private & inputOptions, uint w, uint h, uint d, uint f) const; + + void downsampleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions) const; + void scaleMipmap(Mipmap & mipmap, const InputOptions::Private & inputOptions, uint w, uint h, uint d) const; + void processInputImage(Mipmap & mipmap, const InputOptions::Private & inputOptions) const; + void quantizeMipmap(Mipmap & mipmap, const CompressionOptions::Private & compressionOptions) const; + bool compressMipmap(const Mipmap & mipmap, const InputOptions::Private & inputOptions, const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) const; + + + + public: + + bool cudaSupported; + bool cudaEnabled; + int cudaDevice; + + nv::AutoPtr cuda; + + }; + +} // nvtt namespace + + +#endif // NV_TT_COMPRESSOR_H diff --git a/externals/NVTT/src/nvtt/InputOptions.cpp b/externals/NVTT/src/nvtt/InputOptions.cpp new file mode 100644 index 00000000..92177878 --- /dev/null +++ b/externals/NVTT/src/nvtt/InputOptions.cpp @@ -0,0 +1,408 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include // memcpy + +#include + +#include "nvtt.h" +#include "InputOptions.h" + +using namespace nv; +using namespace nvtt; + +namespace +{ + + static uint countMipmaps(int w, int h, int d) + { + uint mipmap = 0; + + while (w != 1 || h != 1 || d != 1) { + w = max(1, w / 2); + h = max(1, h / 2); + d = max(1, d / 2); + mipmap++; + } + + return mipmap + 1; + } + + // 1 -> 1, 2 -> 2, 3 -> 2, 4 -> 4, 5 -> 4, ... + static uint previousPowerOfTwo(const uint v) + { + return nextPowerOfTwo(v + 1) / 2; + } + + static uint nearestPowerOfTwo(const uint v) + { + const uint np2 = nextPowerOfTwo(v); + const uint pp2 = previousPowerOfTwo(v); + + if (np2 - v <= v - pp2) + { + return np2; + } + else + { + return pp2; + } + } + +} // namespace + + +/// Constructor. +InputOptions::InputOptions() : m(*new InputOptions::Private()) +{ + reset(); +} + +// Delete images. +InputOptions::~InputOptions() +{ + resetTextureLayout(); + + delete &m; +} + + +// Reset input options. +void InputOptions::reset() +{ + m.wrapMode = WrapMode_Mirror; + m.textureType = TextureType_2D; + m.inputFormat = InputFormat_BGRA_8UB; + + m.alphaMode = AlphaMode_None; + + m.inputGamma = 2.2f; + m.outputGamma = 2.2f; + + m.colorTransform = ColorTransform_None; + m.linearTransform = Matrix(identity); + + m.generateMipmaps = true; + m.maxLevel = -1; + m.mipmapFilter = MipmapFilter_Box; + + m.kaiserWidth = 3; + m.kaiserAlpha = 4.0f; + m.kaiserStretch = 1.0f; + + m.isNormalMap = false; + m.normalizeMipmaps = true; + m.convertToNormalMap = false; + m.heightFactors.set(0.0f, 0.0f, 0.0f, 1.0f); + m.bumpFrequencyScale = Vector4(1.0f, 0.5f, 0.25f, 0.125f) / (1.0f + 0.5f + 0.25f + 0.125f); + + m.maxExtent = 0; + m.roundMode = RoundMode_None; +} + + +// Setup the input image. +void InputOptions::setTextureLayout(TextureType type, int width, int height, int depth /*= 1*/) +{ + // Validate arguments. + nvCheck(width >= 0); + nvCheck(height >= 0); + nvCheck(depth >= 0); + + // Correct arguments. + if (width == 0) width = 1; + if (height == 0) height = 1; + if (depth == 0) depth = 1; + + // Delete previous images. + resetTextureLayout(); + + m.textureType = type; + + // Allocate images. + m.mipmapCount = countMipmaps(width, height, depth); + m.faceCount = (type == TextureType_Cube) ? 6 : 1; + m.imageCount = m.mipmapCount * m.faceCount; + + m.images = new Private::InputImage[m.imageCount]; + + for(uint f = 0; f < m.faceCount; f++) + { + uint w = width; + uint h = height; + uint d = depth; + + for (uint mipLevel = 0; mipLevel < m.mipmapCount; mipLevel++) + { + Private::InputImage & img = m.images[f * m.mipmapCount + mipLevel]; + img.width = w; + img.height = h; + img.depth = d; + img.mipLevel = mipLevel; + img.face = f; + + img.data = NULL; + + w = max(1U, w / 2); + h = max(1U, h / 2); + d = max(1U, d / 2); + } + } +} + + +void InputOptions::resetTextureLayout() +{ + if (m.images != NULL) + { + // Delete image array. + delete [] m.images; + m.images = NULL; + + m.faceCount = 0; + m.mipmapCount = 0; + m.imageCount = 0; + } +} + + +// Copies the data to our internal structures. +bool InputOptions::setMipmapData(const void * data, int width, int height, int depth /*= 1*/, int face /*= 0*/, int mipLevel /*= 0*/) +{ + nvCheck(depth == 1); + + const int idx = face * m.mipmapCount + mipLevel; + + if (m.images[idx].width != width || m.images[idx].height != height || m.images[idx].depth != depth || m.images[idx].mipLevel != mipLevel || m.images[idx].face != face) + { + // Invalid dimension or index. + return false; + } + + m.images[idx].data = new nv::Image(); + m.images[idx].data->allocate(width, height); + memcpy(m.images[idx].data->pixels(), data, width * height * 4); + + return true; +} + + +/// Describe the format of the input. +void InputOptions::setFormat(InputFormat format) +{ + m.inputFormat = format; +} + + +/// Set the way the input alpha channel is interpreted. +void InputOptions::setAlphaMode(AlphaMode alphaMode) +{ + m.alphaMode = alphaMode; +} + + +/// Set gamma settings. +void InputOptions::setGamma(float inputGamma, float outputGamma) +{ + m.inputGamma = inputGamma; + m.outputGamma = outputGamma; +} + + +/// Set texture wrappign mode. +void InputOptions::setWrapMode(WrapMode mode) +{ + m.wrapMode = mode; +} + + +/// Set mipmap filter. +void InputOptions::setMipmapFilter(MipmapFilter filter) +{ + m.mipmapFilter = filter; +} + +/// Set mipmap generation. +void InputOptions::setMipmapGeneration(bool enabled, int maxLevel/*= -1*/) +{ + m.generateMipmaps = enabled; + m.maxLevel = maxLevel; +} + +/// Set Kaiser filter parameters. +void InputOptions::setKaiserParameters(float width, float alpha, float stretch) +{ + m.kaiserWidth = width; + m.kaiserAlpha = alpha; + m.kaiserStretch = stretch; +} + +/// Indicate whether input is a normal map or not. +void InputOptions::setNormalMap(bool b) +{ + m.isNormalMap = b; +} + +/// Enable normal map conversion. +void InputOptions::setConvertToNormalMap(bool convert) +{ + m.convertToNormalMap = convert; +} + +/// Set height evaluation factors. +void InputOptions::setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale) +{ + // Do not normalize height factors. +// float total = redScale + greenScale + blueScale + alphaScale; + m.heightFactors = Vector4(redScale, greenScale, blueScale, alphaScale); +} + +/// Set normal map conversion filter. +void InputOptions::setNormalFilter(float small, float medium, float big, float large) +{ + float total = small + medium + big + large; + m.bumpFrequencyScale = Vector4(small, medium, big, large) / total; +} + +/// Enable mipmap normalization. +void InputOptions::setNormalizeMipmaps(bool normalize) +{ + m.normalizeMipmaps = normalize; +} + +/// Set color transform. +void InputOptions::setColorTransform(ColorTransform t) +{ + m.colorTransform = t; +} + +// Set linear transform for the given channel. +void InputOptions::setLinearTransform(int channel, float w0, float w1, float w2, float w3) +{ + nvCheck(channel >= 0 && channel < 4); + + Vector4 w(w0, w1, w2, w3); + //m.linearTransform.setRow(channel, w); +} + +void InputOptions::setMaxExtents(int e) +{ + nvDebugCheck(e > 0); + m.maxExtent = e; +} + +void InputOptions::setRoundMode(RoundMode mode) +{ + m.roundMode = mode; +} + + +void InputOptions::Private::computeTargetExtents() const +{ + nvCheck(images != NULL); + + uint maxExtent = this->maxExtent; + if (roundMode != RoundMode_None) + { + // rounded max extent should never be higher than original max extent. + maxExtent = previousPowerOfTwo(maxExtent); + } + + uint w = images->width; + uint h = images->height; + uint d = images->depth; + + nvDebugCheck(w > 0); + nvDebugCheck(h > 0); + nvDebugCheck(d > 0); + + // Scale extents without changing aspect ratio. + uint maxwhd = max(max(w, h), d); + if (maxExtent != 0 && maxwhd > maxExtent) + { + w = max((w * maxExtent) / maxwhd, 1U); + h = max((h * maxExtent) / maxwhd, 1U); + d = max((d * maxExtent) / maxwhd, 1U); + } + + // Round to power of two. + if (roundMode == RoundMode_ToNextPowerOfTwo) + { + w = nextPowerOfTwo(w); + h = nextPowerOfTwo(h); + d = nextPowerOfTwo(d); + } + else if (roundMode == RoundMode_ToNearestPowerOfTwo) + { + w = nearestPowerOfTwo(w); + h = nearestPowerOfTwo(h); + d = nearestPowerOfTwo(d); + } + else if (roundMode == RoundMode_ToPreviousPowerOfTwo) + { + w = previousPowerOfTwo(w); + h = previousPowerOfTwo(h); + d = previousPowerOfTwo(d); + } + + this->targetWidth = w; + this->targetHeight = h; + this->targetDepth = d; + + this->targetMipmapCount = countMipmaps(w, h, d); +} + + +// Return real number of mipmaps, including first level. +// computeTargetExtents should have been called before. +int InputOptions::Private::realMipmapCount() const +{ + int mipmapCount = targetMipmapCount; + + if (!generateMipmaps) mipmapCount = 1; + else if (maxLevel != -1 && maxLevel < mipmapCount - 1) mipmapCount = maxLevel + 1; + + return mipmapCount; +} + + +const Image * InputOptions::Private::image(uint face, uint mipmap) const +{ + nvDebugCheck(face < faceCount); + nvDebugCheck(mipmap < mipmapCount); + + const InputImage & image = this->images[face * mipmapCount + mipmap]; + nvDebugCheck(image.face == face); + nvDebugCheck(image.mipLevel == mipmap); + + return image.data.ptr(); +} + +const Image * InputOptions::Private::image(uint idx) const +{ + nvDebugCheck(idx < faceCount * mipmapCount); + + const InputImage & image = this->images[idx]; + + return image.data.ptr(); +} diff --git a/externals/NVTT/src/nvtt/InputOptions.h b/externals/NVTT/src/nvtt/InputOptions.h new file mode 100644 index 00000000..44915782 --- /dev/null +++ b/externals/NVTT/src/nvtt/InputOptions.h @@ -0,0 +1,113 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_INPUTOPTIONS_H +#define NV_TT_INPUTOPTIONS_H + +#include +#include +#include +#include +#include "nvtt.h" + +namespace nvtt +{ + + struct InputOptions::Private + { + Private() : images(NULL) {} + + WrapMode wrapMode; + TextureType textureType; + InputFormat inputFormat; + AlphaMode alphaMode; + + uint faceCount; + uint mipmapCount; + uint imageCount; + + struct InputImage; + InputImage * images; + + // Gamma conversion. + float inputGamma; + float outputGamma; + + // Color transform. + ColorTransform colorTransform; + nv::Matrix linearTransform; + + // Mipmap generation options. + bool generateMipmaps; + int maxLevel; + MipmapFilter mipmapFilter; + + // Kaiser filter parameters. + float kaiserWidth; + float kaiserAlpha; + float kaiserStretch; + + // Normal map options. + bool isNormalMap; + bool normalizeMipmaps; + bool convertToNormalMap; + nv::Vector4 heightFactors; + nv::Vector4 bumpFrequencyScale; + + // Adjust extents. + uint maxExtent; + RoundMode roundMode; + + // @@ These are computed in nvtt::compress, so they should be mutable or stored elsewhere... + mutable uint targetWidth; + mutable uint targetHeight; + mutable uint targetDepth; + mutable uint targetMipmapCount; + + void computeTargetExtents() const; + + int realMipmapCount() const; + + const nv::Image * image(uint face, uint mipmap) const; + const nv::Image * image(uint idx) const; + + }; + + // Internal image structure. + struct InputOptions::Private::InputImage + { + InputImage() {} + + int mipLevel; + int face; + + int width; + int height; + int depth; + + nv::AutoPtr data; + }; + +} // nvtt namespace + +#endif // NV_TT_INPUTOPTIONS_H diff --git a/externals/NVTT/src/nvtt/OptimalCompressDXT.cpp b/externals/NVTT/src/nvtt/OptimalCompressDXT.cpp new file mode 100644 index 00000000..3445f88a --- /dev/null +++ b/externals/NVTT/src/nvtt/OptimalCompressDXT.cpp @@ -0,0 +1,368 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include // swap + +#include + +#include +#include + +#include "OptimalCompressDXT.h" +#include "SingleColorLookup.h" + + +using namespace nv; +using namespace OptimalCompress; + + + +namespace +{ + static int computeGreenError(const ColorBlock & rgba, const BlockDXT1 * block) + { + nvDebugCheck(block != NULL); + + int palette[4]; + palette[0] = (block->col0.g << 2) | (block->col0.g >> 4); + palette[1] = (block->col1.g << 2) | (block->col1.g >> 4); + palette[2] = (2 * palette[0] + palette[1]) / 3; + palette[3] = (2 * palette[1] + palette[0]) / 3; + + int totalError = 0; + + for (int i = 0; i < 16; i++) + { + const int green = rgba.color(i).g; + + int error = abs(green - palette[0]); + error = min(error, abs(green - palette[1])); + error = min(error, abs(green - palette[2])); + error = min(error, abs(green - palette[3])); + + totalError += error; + } + + return totalError; + } + + static uint computeGreenIndices(const ColorBlock & rgba, const Color32 palette[4]) + { + const int color0 = palette[0].g; + const int color1 = palette[1].g; + const int color2 = palette[2].g; + const int color3 = palette[3].g; + + uint indices = 0; + for (int i = 0; i < 16; i++) + { + const int color = rgba.color(i).g; + + uint d0 = abs(color0 - color); + uint d1 = abs(color1 - color); + uint d2 = abs(color2 - color); + uint d3 = abs(color3 - color); + + uint b0 = d0 > d3; + uint b1 = d1 > d2; + uint b2 = d0 > d2; + uint b3 = d1 > d3; + uint b4 = d2 > d3; + + uint x0 = b1 & b2; + uint x1 = b0 & b3; + uint x2 = b0 & b4; + + indices |= (x2 | ((x0 | x1) << 1)) << (2 * i); + } + + return indices; + } + + // Choose quantized color that produces less error. Used by DXT3 compressor. + inline static uint quantize4(uint8 a) + { + int q0 = (a >> 4) - 1; + int q1 = (a >> 4); + int q2 = (a >> 4) + 1; + + q0 = (q0 << 4) | q0; + q1 = (q1 << 4) | q1; + q2 = (q2 << 4) | q2; + + int d0 = abs(q0 - a); + int d1 = abs(q1 - a); + int d2 = abs(q2 - a); + + if (d0 < d1 && d0 < d2) return q0 >> 4; + if (d1 < d2) return q1 >> 4; + return q2 >> 4; + } + + static uint computeAlphaError(const ColorBlock & rgba, const AlphaBlockDXT5 * block) + { + uint8 alphas[8]; + block->evaluatePalette(alphas); + + uint totalError = 0; + + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + + uint besterror = 256*256; + uint best; + for (uint p = 0; p < 8; p++) + { + int d = alphas[p] - alpha; + uint error = d * d; + + if (error < besterror) + { + besterror = error; + best = p; + } + } + + totalError += besterror; + } + + return totalError; + } + + static void computeAlphaIndices(const ColorBlock & rgba, AlphaBlockDXT5 * block) + { + uint8 alphas[8]; + block->evaluatePalette(alphas); + + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + + uint besterror = 256*256; + uint best = 8; + for(uint p = 0; p < 8; p++) + { + int d = alphas[p] - alpha; + uint error = d * d; + + if (error < besterror) + { + besterror = error; + best = p; + } + } + nvDebugCheck(best < 8); + + block->setIndex(i, best); + } + } + +} // namespace + + + + + +// Single color compressor, based on: +// https://mollyrocket.com/forums/viewtopic.php?t=392 +void OptimalCompress::compressDXT1(Color32 c, BlockDXT1 * dxtBlock) +{ + dxtBlock->col0.r = OMatch5[c.r][0]; + dxtBlock->col0.g = OMatch6[c.g][0]; + dxtBlock->col0.b = OMatch5[c.b][0]; + dxtBlock->col1.r = OMatch5[c.r][1]; + dxtBlock->col1.g = OMatch6[c.g][1]; + dxtBlock->col1.b = OMatch5[c.b][1]; + dxtBlock->indices = 0xaaaaaaaa; + + if (dxtBlock->col0.u < dxtBlock->col1.u) + { + swap(dxtBlock->col0.u, dxtBlock->col1.u); + dxtBlock->indices ^= 0x55555555; + } +} + +void OptimalCompress::compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock) +{ + if (rgba.a < 128) + { + dxtBlock->col0.u = 0; + dxtBlock->col1.u = 0; + dxtBlock->indices = 0xFFFFFFFF; + } + else + { + compressDXT1(rgba, dxtBlock); + } +} + + +// Brute force green channel compressor +void OptimalCompress::compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block) +{ + nvDebugCheck(block != NULL); + + uint8 ming = 63; + uint8 maxg = 0; + + // Get min/max green. + for (uint i = 0; i < 16; i++) + { + uint8 green = rgba.color(i).g >> 2; + ming = min(ming, green); + maxg = max(maxg, green); + } + + block->col0.r = 31; + block->col1.r = 31; + block->col0.g = maxg; + block->col1.g = ming; + block->col0.b = 0; + block->col1.b = 0; + + if (maxg - ming > 4) + { + int besterror = computeGreenError(rgba, block); + int bestg0 = maxg; + int bestg1 = ming; + + for (int g0 = ming+5; g0 < maxg; g0++) + { + for (int g1 = ming; g1 < g0-4; g1++) + { + if ((maxg-g0) + (g1-ming) > besterror) + continue; + + block->col0.g = g0; + block->col1.g = g1; + int error = computeGreenError(rgba, block); + + if (error < besterror) + { + besterror = error; + bestg0 = g0; + bestg1 = g1; + } + } + } + + block->col0.g = bestg0; + block->col1.g = bestg1; + } + + Color32 palette[4]; + block->evaluatePalette(palette); + block->indices = computeGreenIndices(rgba, palette); +} + +void OptimalCompress::compressDXT3A(const ColorBlock & rgba, AlphaBlockDXT3 * dxtBlock) +{ + dxtBlock->alpha0 = quantize4(rgba.color(0).a); + dxtBlock->alpha1 = quantize4(rgba.color(1).a); + dxtBlock->alpha2 = quantize4(rgba.color(2).a); + dxtBlock->alpha3 = quantize4(rgba.color(3).a); + dxtBlock->alpha4 = quantize4(rgba.color(4).a); + dxtBlock->alpha5 = quantize4(rgba.color(5).a); + dxtBlock->alpha6 = quantize4(rgba.color(6).a); + dxtBlock->alpha7 = quantize4(rgba.color(7).a); + dxtBlock->alpha8 = quantize4(rgba.color(8).a); + dxtBlock->alpha9 = quantize4(rgba.color(9).a); + dxtBlock->alphaA = quantize4(rgba.color(10).a); + dxtBlock->alphaB = quantize4(rgba.color(11).a); + dxtBlock->alphaC = quantize4(rgba.color(12).a); + dxtBlock->alphaD = quantize4(rgba.color(13).a); + dxtBlock->alphaE = quantize4(rgba.color(14).a); + dxtBlock->alphaF = quantize4(rgba.color(15).a); +} + + +void OptimalCompress::compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock) +{ + uint8 mina = 255; + uint8 maxa = 0; + + // Get min/max alpha. + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + mina = min(mina, alpha); + maxa = max(maxa, alpha); + } + + dxtBlock->alpha0 = maxa; + dxtBlock->alpha1 = mina; + + /*int centroidDist = 256; + int centroid; + + // Get the closest to the centroid. + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + int dist = abs(alpha - (maxa + mina) / 2); + if (dist < centroidDist) + { + centroidDist = dist; + centroid = alpha; + } + }*/ + + if (maxa - mina > 8) + { + int besterror = computeAlphaError(rgba, dxtBlock); + int besta0 = maxa; + int besta1 = mina; + + for (int a0 = mina+9; a0 < maxa; a0++) + { + for (int a1 = mina; a1 < a0-8; a1++) + //for (int a1 = mina; a1 < maxa; a1++) + { + //nvCheck(abs(a1-a0) > 8); + + //if (abs(a0 - a1) < 8) continue; + //if ((maxa-a0) + (a1-mina) + min(abs(centroid-a0), abs(centroid-a1)) > besterror) + if ((maxa-a0) + (a1-mina) > besterror) + continue; + + dxtBlock->alpha0 = a0; + dxtBlock->alpha1 = a1; + int error = computeAlphaError(rgba, dxtBlock); + + if (error < besterror) + { + besterror = error; + besta0 = a0; + besta1 = a1; + } + } + } + + dxtBlock->alpha0 = besta0; + dxtBlock->alpha1 = besta1; + } + + computeAlphaIndices(rgba, dxtBlock); +} + diff --git a/externals/NVTT/src/nvtt/OptimalCompressDXT.h b/externals/NVTT/src/nvtt/OptimalCompressDXT.h new file mode 100644 index 00000000..3dc7a811 --- /dev/null +++ b/externals/NVTT/src/nvtt/OptimalCompressDXT.h @@ -0,0 +1,49 @@ +// Copyright NVIDIA Corporation 2008 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_OPTIMALCOMPRESSDXT_H +#define NV_TT_OPTIMALCOMPRESSDXT_H + +#include + +namespace nv +{ + struct ColorBlock; + struct BlockDXT1; + struct BlockDXT3; + struct BlockDXT5; + struct AlphaBlockDXT3; + struct AlphaBlockDXT5; + + namespace OptimalCompress + { + void compressDXT1(Color32 rgba, BlockDXT1 * dxtBlock); + void compressDXT1a(Color32 rgba, BlockDXT1 * dxtBlock); + + void compressDXT1G(const ColorBlock & rgba, BlockDXT1 * block); + void compressDXT3A(const ColorBlock & rgba, AlphaBlockDXT3 * dxtBlock); + void compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock); + } +} // nv namespace + +#endif // NV_TT_OPTIMALCOMPRESSDXT_H diff --git a/externals/NVTT/src/nvtt/OutputOptions.cpp b/externals/NVTT/src/nvtt/OutputOptions.cpp new file mode 100644 index 00000000..f3597b09 --- /dev/null +++ b/externals/NVTT/src/nvtt/OutputOptions.cpp @@ -0,0 +1,102 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include "OutputOptions.h" + +using namespace nvtt; + + +OutputOptions::OutputOptions() : m(*new OutputOptions::Private()) +{ + reset(); +} + +OutputOptions::~OutputOptions() +{ + delete &m; +} + +/// Set default output options. +void OutputOptions::reset() +{ + m.fileName.reset(); + m.outputHandler = NULL; + m.errorHandler = NULL; + m.outputHeader = true; +} + + +/// Set output file name. +void OutputOptions::setFileName(const char * fileName) +{ + m.fileName = fileName; + m.outputHandler = NULL; +} + +/// Set output handler. +void OutputOptions::setOutputHandler(OutputHandler * outputHandler) +{ + m.fileName.reset(); + m.outputHandler = outputHandler; +} + +/// Set error handler. +void OutputOptions::setErrorHandler(ErrorHandler * errorHandler) +{ + m.errorHandler = errorHandler; +} + +/// Set output header. +void OutputOptions::setOutputHeader(bool outputHeader) +{ + m.outputHeader = outputHeader; +} + + +bool OutputOptions::Private::openFile() const +{ + if (!fileName.isNull()) + { + nvCheck(outputHandler == NULL); + + DefaultOutputHandler * oh = new DefaultOutputHandler(fileName.str()); + if (oh->stream.isError()) + { + return false; + } + + outputHandler = oh; + } + + return true; +} + +void OutputOptions::Private::closeFile() const +{ + if (!fileName.isNull()) + { + delete outputHandler; + outputHandler = NULL; + } +} + diff --git a/externals/NVTT/src/nvtt/OutputOptions.h b/externals/NVTT/src/nvtt/OutputOptions.h new file mode 100644 index 00000000..3aef72b6 --- /dev/null +++ b/externals/NVTT/src/nvtt/OutputOptions.h @@ -0,0 +1,76 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_OUTPUTOPTIONS_H +#define NV_TT_OUTPUTOPTIONS_H + +#include +#include +#include "nvtt.h" + +namespace nvtt +{ + + struct DefaultOutputHandler : public nvtt::OutputHandler + { + DefaultOutputHandler(const char * fileName) : stream(fileName) {} + + virtual ~DefaultOutputHandler() + { + } + + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) + { + // ignore. + } + + // Output data. + virtual bool writeData(const void * data, int size) + { + stream.serialize(const_cast(data), size); + + //return !stream.isError(); + return true; + } + + nv::StdOutputStream stream; + }; + + + struct OutputOptions::Private + { + nv::Path fileName; + + mutable OutputHandler * outputHandler; + ErrorHandler * errorHandler; + bool outputHeader; + + bool openFile() const; + void closeFile() const; + }; + + +} // nvtt namespace + + +#endif // NV_TT_OUTPUTOPTIONS_H diff --git a/externals/NVTT/src/nvtt/QuickCompressDXT.cpp b/externals/NVTT/src/nvtt/QuickCompressDXT.cpp new file mode 100644 index 00000000..4eb10384 --- /dev/null +++ b/externals/NVTT/src/nvtt/QuickCompressDXT.cpp @@ -0,0 +1,585 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include + +#include +#include + +#include "QuickCompressDXT.h" +#include "OptimalCompressDXT.h" + + +using namespace nv; +using namespace QuickCompress; + + + +inline static void extractColorBlockRGB(const ColorBlock & rgba, Vector3 block[16]) +{ + for (int i = 0; i < 16; i++) + { + const Color32 c = rgba.color(i); + block[i] = Vector3(c.r, c.g, c.b); + } +} + +inline static uint extractColorBlockRGBA(const ColorBlock & rgba, Vector3 block[16]) +{ + int num = 0; + + for (int i = 0; i < 16; i++) + { + const Color32 c = rgba.color(i); + if (c.a > 127) + { + block[num++] = Vector3(c.r, c.g, c.b); + } + } + + return num; +} + + +// find minimum and maximum colors based on bounding box in color space +inline static void findMinMaxColorsBox(const Vector3 * block, uint num, Vector3 * restrict maxColor, Vector3 * restrict minColor) +{ + *maxColor = Vector3(0, 0, 0); + *minColor = Vector3(255, 255, 255); + + for (uint i = 0; i < num; i++) + { + *maxColor = max(*maxColor, block[i]); + *minColor = min(*minColor, block[i]); + } +} + + +inline static void selectDiagonal(const Vector3 * block, uint num, Vector3 * restrict maxColor, Vector3 * restrict minColor) +{ + Vector3 center = (*maxColor + *minColor) * 0.5; + + Vector2 covariance = Vector2(zero); + for (uint i = 0; i < num; i++) + { + Vector3 t = block[i] - center; + covariance += t.xy() * t.z(); + } + + float x0 = maxColor->x(); + float y0 = maxColor->y(); + float x1 = minColor->x(); + float y1 = minColor->y(); + + if (covariance.x() < 0) { + swap(x0, x1); + } + if (covariance.y() < 0) { + swap(y0, y1); + } + + maxColor->set(x0, y0, maxColor->z()); + minColor->set(x1, y1, minColor->z()); +} + +inline static void insetBBox(Vector3 * restrict maxColor, Vector3 * restrict minColor) +{ + Vector3 inset = (*maxColor - *minColor) / 16.0f - (8.0f / 255.0f) / 16.0f; + *maxColor = clamp(*maxColor - inset, 0.0f, 255.0f); + *minColor = clamp(*minColor + inset, 0.0f, 255.0f); +} + +inline static uint16 roundAndExpand(Vector3 * restrict v) +{ + uint r = uint(clamp(v->x() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); + uint g = uint(clamp(v->y() * (63.0f / 255.0f), 0.0f, 63.0f) + 0.5f); + uint b = uint(clamp(v->z() * (31.0f / 255.0f), 0.0f, 31.0f) + 0.5f); + + uint16 w = (r << 11) | (g << 5) | b; + + r = (r << 3) | (r >> 2); + g = (g << 2) | (g >> 4); + b = (b << 3) | (b >> 2); + *v = Vector3(float(r), float(g), float(b)); + + return w; +} + +inline static float colorDistance(Vector3::Arg c0, Vector3::Arg c1) +{ + return dot(c0-c1, c0-c1); +} + +inline static uint computeIndices4(Vector3 block[16], Vector3::Arg maxColor, Vector3::Arg minColor) +{ + Vector3 palette[4]; + palette[0] = maxColor; + palette[1] = minColor; + palette[2] = lerp(palette[0], palette[1], 1.0f / 3.0f); + palette[3] = lerp(palette[0], palette[1], 2.0f / 3.0f); + + uint indices = 0; + for(int i = 0; i < 16; i++) + { + float d0 = colorDistance(palette[0], block[i]); + float d1 = colorDistance(palette[1], block[i]); + float d2 = colorDistance(palette[2], block[i]); + float d3 = colorDistance(palette[3], block[i]); + + uint b0 = d0 > d3; + uint b1 = d1 > d2; + uint b2 = d0 > d2; + uint b3 = d1 > d3; + uint b4 = d2 > d3; + + uint x0 = b1 & b2; + uint x1 = b0 & b3; + uint x2 = b0 & b4; + + indices |= (x2 | ((x0 | x1) << 1)) << (2 * i); + } + + return indices; +} + +inline static uint computeIndices3(const ColorBlock & rgba, Vector3::Arg maxColor, Vector3::Arg minColor) +{ + Vector3 palette[4]; + palette[0] = minColor; + palette[1] = maxColor; + palette[2] = (palette[0] + palette[1]) * 0.5f; + + uint indices = 0; + for(int i = 0; i < 16; i++) + { + Color32 c = rgba.color(i); + Vector3 color = Vector3(c.r, c.g, c.b); + + float d0 = colorDistance(palette[0], color); + float d1 = colorDistance(palette[1], color); + float d2 = colorDistance(palette[2], color); + + uint index; + if (c.a < 128) index = 3; + else if (d0 < d1 && d0 < d2) index = 0; + else if (d1 < d2) index = 1; + else index = 2; + + indices |= index << (2 * i); + } + + return indices; +} + + +static void optimizeEndPoints4(Vector3 block[16], BlockDXT1 * dxtBlock) +{ + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + Vector3 alphax_sum(zero); + Vector3 betax_sum(zero); + + for( int i = 0; i < 16; ++i ) + { + const uint bits = dxtBlock->indices >> (2 * i); + + float beta = float(bits & 1); + if (bits & 2) beta = (1 + beta) / 3.0f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * block[i]; + betax_sum += beta * block[i]; + } + + float denom = alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum; + if (equal(denom, 0.0f)) return; + + float factor = 1.0f / denom; + + Vector3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + Vector3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + a = clamp(a, 0, 255); + b = clamp(b, 0, 255); + + uint16 color0 = roundAndExpand(&a); + uint16 color1 = roundAndExpand(&b); + + if (color0 < color1) + { + swap(a, b); + swap(color0, color1); + } + + dxtBlock->col0 = Color16(color0); + dxtBlock->col1 = Color16(color1); + dxtBlock->indices = computeIndices4(block, a, b); +} + +/*static void optimizeEndPoints3(Vector3 block[16], BlockDXT1 * dxtBlock) +{ + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + Vector3 alphax_sum(zero); + Vector3 betax_sum(zero); + + for( int i = 0; i < 16; ++i ) + { + const uint bits = dxtBlock->indices >> (2 * i); + + float beta = (bits & 1); + if (bits & 2) beta = 0.5f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * block[i]; + betax_sum += beta * block[i]; + } + + float denom = alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum; + if (equal(denom, 0.0f)) return; + + float factor = 1.0f / denom; + + Vector3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + Vector3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + a = clamp(a, 0, 255); + b = clamp(b, 0, 255); + + uint16 color0 = roundAndExpand(&a); + uint16 color1 = roundAndExpand(&b); + + if (color0 < color1) + { + swap(a, b); + swap(color0, color1); + } + + dxtBlock->col0 = Color16(color1); + dxtBlock->col1 = Color16(color0); + dxtBlock->indices = computeIndices3(block, a, b); +}*/ + +namespace +{ + + static uint computeAlphaIndices(const ColorBlock & rgba, AlphaBlockDXT5 * block) + { + uint8 alphas[8]; + block->evaluatePalette(alphas); + + uint totalError = 0; + + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + + uint besterror = 256*256; + uint best = 8; + for(uint p = 0; p < 8; p++) + { + int d = alphas[p] - alpha; + uint error = d * d; + + if (error < besterror) + { + besterror = error; + best = p; + } + } + nvDebugCheck(best < 8); + + totalError += besterror; + block->setIndex(i, best); + } + + return totalError; + } + + static void optimizeAlpha8(const ColorBlock & rgba, AlphaBlockDXT5 * block) + { + float alpha2_sum = 0; + float beta2_sum = 0; + float alphabeta_sum = 0; + float alphax_sum = 0; + float betax_sum = 0; + + for (int i = 0; i < 16; i++) + { + uint idx = block->index(i); + float alpha; + if (idx < 2) alpha = 1.0f - idx; + else alpha = (8.0f - idx) / 7.0f; + + float beta = 1 - alpha; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * rgba.color(i).a; + betax_sum += beta * rgba.color(i).a; + } + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + uint alpha0 = uint(min(max(a, 0.0f), 255.0f)); + uint alpha1 = uint(min(max(b, 0.0f), 255.0f)); + + if (alpha0 < alpha1) + { + swap(alpha0, alpha1); + + // Flip indices: + for (int i = 0; i < 16; i++) + { + uint idx = block->index(i); + if (idx < 2) block->setIndex(i, 1 - idx); + else block->setIndex(i, 9 - idx); + } + } + else if (alpha0 == alpha1) + { + for (int i = 0; i < 16; i++) + { + block->setIndex(i, 0); + } + } + + block->alpha0 = alpha0; + block->alpha1 = alpha1; + } + + /* + static void optimizeAlpha6(const ColorBlock & rgba, AlphaBlockDXT5 * block) + { + float alpha2_sum = 0; + float beta2_sum = 0; + float alphabeta_sum = 0; + float alphax_sum = 0; + float betax_sum = 0; + + for (int i = 0; i < 16; i++) + { + uint8 x = rgba.color(i).a; + if (x == 0 || x == 255) continue; + + uint bits = block->index(i); + if (bits == 6 || bits == 7) continue; + + float alpha; + if (bits == 0) alpha = 1.0f; + else if (bits == 1) alpha = 0.0f; + else alpha = (6.0f - block->index(i)) / 5.0f; + + float beta = 1 - alpha; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * x; + betax_sum += beta * x; + } + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + uint alpha0 = uint(min(max(a, 0.0f), 255.0f)); + uint alpha1 = uint(min(max(b, 0.0f), 255.0f)); + + if (alpha0 > alpha1) + { + swap(alpha0, alpha1); + } + + block->alpha0 = alpha0; + block->alpha1 = alpha1; + } + */ + + static bool sameIndices(const AlphaBlockDXT5 & block0, const AlphaBlockDXT5 & block1) + { + const uint64 mask = ~uint64(0xFFFF); + return (block0.u | mask) == (block1.u | mask); + } + +} // namespace + + + +void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock) +{ + if (rgba.isSingleColor()) + { + OptimalCompress::compressDXT1(rgba.color(0), dxtBlock); + } + else + { + // read block + Vector3 block[16]; + extractColorBlockRGB(rgba, block); + + // find min and max colors + Vector3 maxColor, minColor; + findMinMaxColorsBox(block, 16, &maxColor, &minColor); + + selectDiagonal(block, 16, &maxColor, &minColor); + + insetBBox(&maxColor, &minColor); + + uint16 color0 = roundAndExpand(&maxColor); + uint16 color1 = roundAndExpand(&minColor); + + if (color0 < color1) + { + swap(maxColor, minColor); + swap(color0, color1); + } + + dxtBlock->col0 = Color16(color0); + dxtBlock->col1 = Color16(color1); + dxtBlock->indices = computeIndices4(block, maxColor, minColor); + + optimizeEndPoints4(block, dxtBlock); + } +} + + +void QuickCompress::compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock) +{ + bool hasAlpha = false; + + for (uint i = 0; i < 16; i++) + { + if (rgba.color(i).a < 128) { + hasAlpha = true; + break; + } + } + + if (!hasAlpha) + { + compressDXT1(rgba, dxtBlock); + } + // @@ Handle single RGB, with varying alpha? We need tables for single color compressor in 3 color mode. + //else if (rgba.isSingleColorNoAlpha()) { ... } + else + { + // read block + Vector3 block[16]; + uint num = extractColorBlockRGBA(rgba, block); + + // find min and max colors + Vector3 maxColor, minColor; + findMinMaxColorsBox(block, num, &maxColor, &minColor); + + selectDiagonal(block, num, &maxColor, &minColor); + + insetBBox(&maxColor, &minColor); + + uint16 color0 = roundAndExpand(&maxColor); + uint16 color1 = roundAndExpand(&minColor); + + if (color0 < color1) + { + swap(maxColor, minColor); + swap(color0, color1); + } + + dxtBlock->col0 = Color16(color1); + dxtBlock->col1 = Color16(color0); + dxtBlock->indices = computeIndices3(rgba, maxColor, minColor); + + // optimizeEndPoints(block, dxtBlock); + } +} + + +void QuickCompress::compressDXT3(const ColorBlock & rgba, BlockDXT3 * dxtBlock) +{ + compressDXT1(rgba, &dxtBlock->color); + OptimalCompress::compressDXT3A(rgba, &dxtBlock->alpha); +} + + +void QuickCompress::compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock, int iterationCount/*=8*/) +{ + uint8 alpha0 = 0; + uint8 alpha1 = 255; + + // Get min/max alpha. + for (uint i = 0; i < 16; i++) + { + uint8 alpha = rgba.color(i).a; + alpha0 = max(alpha0, alpha); + alpha1 = min(alpha1, alpha); + } + + AlphaBlockDXT5 block; + block.alpha0 = alpha0 - (alpha0 - alpha1) / 34; + block.alpha1 = alpha1 + (alpha0 - alpha1) / 34; + uint besterror = computeAlphaIndices(rgba, &block); + + AlphaBlockDXT5 bestblock = block; + + for (int i = 0; i < iterationCount; i++) + { + optimizeAlpha8(rgba, &block); + uint error = computeAlphaIndices(rgba, &block); + + if (error >= besterror) + { + // No improvement, stop. + break; + } + if (sameIndices(block, bestblock)) + { + bestblock = block; + break; + } + + besterror = error; + bestblock = block; + }; + + // Copy best block to result; + *dxtBlock = bestblock; +} + +void QuickCompress::compressDXT5(const ColorBlock & rgba, BlockDXT5 * dxtBlock, int iterationCount/*=8*/) +{ + compressDXT1(rgba, &dxtBlock->color); + compressDXT5A(rgba, &dxtBlock->alpha, iterationCount); +} diff --git a/externals/NVTT/src/nvtt/QuickCompressDXT.h b/externals/NVTT/src/nvtt/QuickCompressDXT.h new file mode 100644 index 00000000..1297daae --- /dev/null +++ b/externals/NVTT/src/nvtt/QuickCompressDXT.h @@ -0,0 +1,50 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_QUICKCOMPRESSDXT_H +#define NV_TT_QUICKCOMPRESSDXT_H + +#include + +namespace nv +{ + struct ColorBlock; + struct BlockDXT1; + struct BlockDXT3; + struct BlockDXT5; + struct AlphaBlockDXT3; + struct AlphaBlockDXT5; + + namespace QuickCompress + { + void compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock); + void compressDXT1a(const ColorBlock & rgba, BlockDXT1 * dxtBlock); + + void compressDXT3(const ColorBlock & rgba, BlockDXT3 * dxtBlock); + + void compressDXT5A(const ColorBlock & rgba, AlphaBlockDXT5 * dxtBlock, int iterationCount=8); + void compressDXT5(const ColorBlock & rgba, BlockDXT5 * dxtBlock, int iterationCount=8); + } +} // nv namespace + +#endif // NV_TT_QUICKCOMPRESSDXT_H diff --git a/externals/NVTT/src/nvtt/SingleColorLookup.h b/externals/NVTT/src/nvtt/SingleColorLookup.h new file mode 100644 index 00000000..423d74ef --- /dev/null +++ b/externals/NVTT/src/nvtt/SingleColorLookup.h @@ -0,0 +1,588 @@ + +/* +typedef unsigned char uint8; + +static int Mul8Bit(int a, int b) +{ + int t = a * b + 128; + return (t + (t >> 8)) >> 8; +} + +static inline int Lerp13(int fm, int to) +{ + return (fm * 2 + to) / 3; +} + +static void PrepareOptTable(uint8 * Table, const uint8 * expand, int size) +{ + for (int i = 0; i < 256; i++) + { + float bestErr = 256; + + for (int min = 0; min < size; min++) + { + for (int max = 0; max < size; max++) + { + int mine = expand[min]; + int maxe = expand[max]; + float err = abs(maxe + Mul8Bit(mine-maxe, 0x55) - i); + err += 0.03f * abs(max - min); + + if (err < bestErr) + { + Table[i*2+0] = max; + Table[i*2+1] = min; + bestErr = err; + } + } + } + } +} + + +void initTables() +{ + uint8 Expand5[32]; + uint8 Expand6[64]; + + for(sInt i=0;i<32;i++) + Expand5[i] = (i<<3)|(i>>2); + + for(sInt i=0;i<64;i++) + Expand6[i] = (i<<2)|(i>>4); + + PrepareOptTable(OMatch5, Expand5, 32) + PrepareOptTable(OMatch6, Expand6, 64) +}; +*/ + +#if __CUDACC__ +__constant__ unsigned short +#else +const static uint8 +#endif +OMatch5[256][2] = +{ + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x01}, + {0x00, 0x01}, + {0x01, 0x00}, + {0x01, 0x00}, + {0x01, 0x00}, + {0x01, 0x01}, + {0x01, 0x01}, + {0x01, 0x01}, + {0x01, 0x02}, + {0x00, 0x04}, + {0x02, 0x01}, + {0x02, 0x01}, + {0x02, 0x01}, + {0x02, 0x02}, + {0x02, 0x02}, + {0x02, 0x02}, + {0x02, 0x03}, + {0x01, 0x05}, + {0x03, 0x02}, + {0x03, 0x02}, + {0x04, 0x00}, + {0x03, 0x03}, + {0x03, 0x03}, + {0x03, 0x03}, + {0x03, 0x04}, + {0x03, 0x04}, + {0x03, 0x04}, + {0x03, 0x05}, + {0x04, 0x03}, + {0x04, 0x03}, + {0x05, 0x02}, + {0x04, 0x04}, + {0x04, 0x04}, + {0x04, 0x05}, + {0x04, 0x05}, + {0x05, 0x04}, + {0x05, 0x04}, + {0x05, 0x04}, + {0x06, 0x03}, + {0x05, 0x05}, + {0x05, 0x05}, + {0x05, 0x06}, + {0x04, 0x08}, + {0x06, 0x05}, + {0x06, 0x05}, + {0x06, 0x05}, + {0x06, 0x06}, + {0x06, 0x06}, + {0x06, 0x06}, + {0x06, 0x07}, + {0x05, 0x09}, + {0x07, 0x06}, + {0x07, 0x06}, + {0x08, 0x04}, + {0x07, 0x07}, + {0x07, 0x07}, + {0x07, 0x07}, + {0x07, 0x08}, + {0x07, 0x08}, + {0x07, 0x08}, + {0x07, 0x09}, + {0x08, 0x07}, + {0x08, 0x07}, + {0x09, 0x06}, + {0x08, 0x08}, + {0x08, 0x08}, + {0x08, 0x09}, + {0x08, 0x09}, + {0x09, 0x08}, + {0x09, 0x08}, + {0x09, 0x08}, + {0x0A, 0x07}, + {0x09, 0x09}, + {0x09, 0x09}, + {0x09, 0x0A}, + {0x08, 0x0C}, + {0x0A, 0x09}, + {0x0A, 0x09}, + {0x0A, 0x09}, + {0x0A, 0x0A}, + {0x0A, 0x0A}, + {0x0A, 0x0A}, + {0x0A, 0x0B}, + {0x09, 0x0D}, + {0x0B, 0x0A}, + {0x0B, 0x0A}, + {0x0C, 0x08}, + {0x0B, 0x0B}, + {0x0B, 0x0B}, + {0x0B, 0x0B}, + {0x0B, 0x0C}, + {0x0B, 0x0C}, + {0x0B, 0x0C}, + {0x0B, 0x0D}, + {0x0C, 0x0B}, + {0x0C, 0x0B}, + {0x0D, 0x0A}, + {0x0C, 0x0C}, + {0x0C, 0x0C}, + {0x0C, 0x0D}, + {0x0C, 0x0D}, + {0x0D, 0x0C}, + {0x0D, 0x0C}, + {0x0D, 0x0C}, + {0x0E, 0x0B}, + {0x0D, 0x0D}, + {0x0D, 0x0D}, + {0x0D, 0x0E}, + {0x0C, 0x10}, + {0x0E, 0x0D}, + {0x0E, 0x0D}, + {0x0E, 0x0D}, + {0x0E, 0x0E}, + {0x0E, 0x0E}, + {0x0E, 0x0E}, + {0x0E, 0x0F}, + {0x0D, 0x11}, + {0x0F, 0x0E}, + {0x0F, 0x0E}, + {0x10, 0x0C}, + {0x0F, 0x0F}, + {0x0F, 0x0F}, + {0x0F, 0x0F}, + {0x0F, 0x10}, + {0x0F, 0x10}, + {0x0F, 0x10}, + {0x0F, 0x11}, + {0x10, 0x0F}, + {0x10, 0x0F}, + {0x11, 0x0E}, + {0x10, 0x10}, + {0x10, 0x10}, + {0x10, 0x11}, + {0x10, 0x11}, + {0x11, 0x10}, + {0x11, 0x10}, + {0x11, 0x10}, + {0x12, 0x0F}, + {0x11, 0x11}, + {0x11, 0x11}, + {0x11, 0x12}, + {0x10, 0x14}, + {0x12, 0x11}, + {0x12, 0x11}, + {0x12, 0x11}, + {0x12, 0x12}, + {0x12, 0x12}, + {0x12, 0x12}, + {0x12, 0x13}, + {0x11, 0x15}, + {0x13, 0x12}, + {0x13, 0x12}, + {0x14, 0x10}, + {0x13, 0x13}, + {0x13, 0x13}, + {0x13, 0x13}, + {0x13, 0x14}, + {0x13, 0x14}, + {0x13, 0x14}, + {0x13, 0x15}, + {0x14, 0x13}, + {0x14, 0x13}, + {0x15, 0x12}, + {0x14, 0x14}, + {0x14, 0x14}, + {0x14, 0x15}, + {0x14, 0x15}, + {0x15, 0x14}, + {0x15, 0x14}, + {0x15, 0x14}, + {0x16, 0x13}, + {0x15, 0x15}, + {0x15, 0x15}, + {0x15, 0x16}, + {0x14, 0x18}, + {0x16, 0x15}, + {0x16, 0x15}, + {0x16, 0x15}, + {0x16, 0x16}, + {0x16, 0x16}, + {0x16, 0x16}, + {0x16, 0x17}, + {0x15, 0x19}, + {0x17, 0x16}, + {0x17, 0x16}, + {0x18, 0x14}, + {0x17, 0x17}, + {0x17, 0x17}, + {0x17, 0x17}, + {0x17, 0x18}, + {0x17, 0x18}, + {0x17, 0x18}, + {0x17, 0x19}, + {0x18, 0x17}, + {0x18, 0x17}, + {0x19, 0x16}, + {0x18, 0x18}, + {0x18, 0x18}, + {0x18, 0x19}, + {0x18, 0x19}, + {0x19, 0x18}, + {0x19, 0x18}, + {0x19, 0x18}, + {0x1A, 0x17}, + {0x19, 0x19}, + {0x19, 0x19}, + {0x19, 0x1A}, + {0x18, 0x1C}, + {0x1A, 0x19}, + {0x1A, 0x19}, + {0x1A, 0x19}, + {0x1A, 0x1A}, + {0x1A, 0x1A}, + {0x1A, 0x1A}, + {0x1A, 0x1B}, + {0x19, 0x1D}, + {0x1B, 0x1A}, + {0x1B, 0x1A}, + {0x1C, 0x18}, + {0x1B, 0x1B}, + {0x1B, 0x1B}, + {0x1B, 0x1B}, + {0x1B, 0x1C}, + {0x1B, 0x1C}, + {0x1B, 0x1C}, + {0x1B, 0x1D}, + {0x1C, 0x1B}, + {0x1C, 0x1B}, + {0x1D, 0x1A}, + {0x1C, 0x1C}, + {0x1C, 0x1C}, + {0x1C, 0x1D}, + {0x1C, 0x1D}, + {0x1D, 0x1C}, + {0x1D, 0x1C}, + {0x1D, 0x1C}, + {0x1E, 0x1B}, + {0x1D, 0x1D}, + {0x1D, 0x1D}, + {0x1D, 0x1E}, + {0x1D, 0x1E}, + {0x1E, 0x1D}, + {0x1E, 0x1D}, + {0x1E, 0x1D}, + {0x1E, 0x1E}, + {0x1E, 0x1E}, + {0x1E, 0x1E}, + {0x1E, 0x1F}, + {0x1E, 0x1F}, + {0x1F, 0x1E}, + {0x1F, 0x1E}, + {0x1F, 0x1E}, + {0x1F, 0x1F}, + {0x1F, 0x1F}, +}; + +#if __CUDACC__ +__constant__ unsigned short +#else +const static uint8 +#endif +OMatch6[256][2] = +{ + {0x00, 0x00}, + {0x00, 0x01}, + {0x01, 0x00}, + {0x01, 0x01}, + {0x01, 0x01}, + {0x01, 0x02}, + {0x02, 0x01}, + {0x02, 0x02}, + {0x02, 0x02}, + {0x02, 0x03}, + {0x03, 0x02}, + {0x03, 0x03}, + {0x03, 0x03}, + {0x03, 0x04}, + {0x04, 0x03}, + {0x04, 0x04}, + {0x04, 0x04}, + {0x04, 0x05}, + {0x05, 0x04}, + {0x05, 0x05}, + {0x05, 0x05}, + {0x05, 0x06}, + {0x06, 0x05}, + {0x00, 0x11}, + {0x06, 0x06}, + {0x06, 0x07}, + {0x07, 0x06}, + {0x02, 0x10}, + {0x07, 0x07}, + {0x07, 0x08}, + {0x08, 0x07}, + {0x03, 0x11}, + {0x08, 0x08}, + {0x08, 0x09}, + {0x09, 0x08}, + {0x05, 0x10}, + {0x09, 0x09}, + {0x09, 0x0A}, + {0x0A, 0x09}, + {0x06, 0x11}, + {0x0A, 0x0A}, + {0x0A, 0x0B}, + {0x0B, 0x0A}, + {0x08, 0x10}, + {0x0B, 0x0B}, + {0x0B, 0x0C}, + {0x0C, 0x0B}, + {0x09, 0x11}, + {0x0C, 0x0C}, + {0x0C, 0x0D}, + {0x0D, 0x0C}, + {0x0B, 0x10}, + {0x0D, 0x0D}, + {0x0D, 0x0E}, + {0x0E, 0x0D}, + {0x0C, 0x11}, + {0x0E, 0x0E}, + {0x0E, 0x0F}, + {0x0F, 0x0E}, + {0x0E, 0x10}, + {0x0F, 0x0F}, + {0x0F, 0x10}, + {0x10, 0x0E}, + {0x10, 0x0F}, + {0x11, 0x0E}, + {0x10, 0x10}, + {0x10, 0x11}, + {0x11, 0x10}, + {0x12, 0x0F}, + {0x11, 0x11}, + {0x11, 0x12}, + {0x12, 0x11}, + {0x14, 0x0E}, + {0x12, 0x12}, + {0x12, 0x13}, + {0x13, 0x12}, + {0x15, 0x0F}, + {0x13, 0x13}, + {0x13, 0x14}, + {0x14, 0x13}, + {0x17, 0x0E}, + {0x14, 0x14}, + {0x14, 0x15}, + {0x15, 0x14}, + {0x18, 0x0F}, + {0x15, 0x15}, + {0x15, 0x16}, + {0x16, 0x15}, + {0x1A, 0x0E}, + {0x16, 0x16}, + {0x16, 0x17}, + {0x17, 0x16}, + {0x1B, 0x0F}, + {0x17, 0x17}, + {0x17, 0x18}, + {0x18, 0x17}, + {0x13, 0x21}, + {0x18, 0x18}, + {0x18, 0x19}, + {0x19, 0x18}, + {0x15, 0x20}, + {0x19, 0x19}, + {0x19, 0x1A}, + {0x1A, 0x19}, + {0x16, 0x21}, + {0x1A, 0x1A}, + {0x1A, 0x1B}, + {0x1B, 0x1A}, + {0x18, 0x20}, + {0x1B, 0x1B}, + {0x1B, 0x1C}, + {0x1C, 0x1B}, + {0x19, 0x21}, + {0x1C, 0x1C}, + {0x1C, 0x1D}, + {0x1D, 0x1C}, + {0x1B, 0x20}, + {0x1D, 0x1D}, + {0x1D, 0x1E}, + {0x1E, 0x1D}, + {0x1C, 0x21}, + {0x1E, 0x1E}, + {0x1E, 0x1F}, + {0x1F, 0x1E}, + {0x1E, 0x20}, + {0x1F, 0x1F}, + {0x1F, 0x20}, + {0x20, 0x1E}, + {0x20, 0x1F}, + {0x21, 0x1E}, + {0x20, 0x20}, + {0x20, 0x21}, + {0x21, 0x20}, + {0x22, 0x1F}, + {0x21, 0x21}, + {0x21, 0x22}, + {0x22, 0x21}, + {0x24, 0x1E}, + {0x22, 0x22}, + {0x22, 0x23}, + {0x23, 0x22}, + {0x25, 0x1F}, + {0x23, 0x23}, + {0x23, 0x24}, + {0x24, 0x23}, + {0x27, 0x1E}, + {0x24, 0x24}, + {0x24, 0x25}, + {0x25, 0x24}, + {0x28, 0x1F}, + {0x25, 0x25}, + {0x25, 0x26}, + {0x26, 0x25}, + {0x2A, 0x1E}, + {0x26, 0x26}, + {0x26, 0x27}, + {0x27, 0x26}, + {0x2B, 0x1F}, + {0x27, 0x27}, + {0x27, 0x28}, + {0x28, 0x27}, + {0x23, 0x31}, + {0x28, 0x28}, + {0x28, 0x29}, + {0x29, 0x28}, + {0x25, 0x30}, + {0x29, 0x29}, + {0x29, 0x2A}, + {0x2A, 0x29}, + {0x26, 0x31}, + {0x2A, 0x2A}, + {0x2A, 0x2B}, + {0x2B, 0x2A}, + {0x28, 0x30}, + {0x2B, 0x2B}, + {0x2B, 0x2C}, + {0x2C, 0x2B}, + {0x29, 0x31}, + {0x2C, 0x2C}, + {0x2C, 0x2D}, + {0x2D, 0x2C}, + {0x2B, 0x30}, + {0x2D, 0x2D}, + {0x2D, 0x2E}, + {0x2E, 0x2D}, + {0x2C, 0x31}, + {0x2E, 0x2E}, + {0x2E, 0x2F}, + {0x2F, 0x2E}, + {0x2E, 0x30}, + {0x2F, 0x2F}, + {0x2F, 0x30}, + {0x30, 0x2E}, + {0x30, 0x2F}, + {0x31, 0x2E}, + {0x30, 0x30}, + {0x30, 0x31}, + {0x31, 0x30}, + {0x32, 0x2F}, + {0x31, 0x31}, + {0x31, 0x32}, + {0x32, 0x31}, + {0x34, 0x2E}, + {0x32, 0x32}, + {0x32, 0x33}, + {0x33, 0x32}, + {0x35, 0x2F}, + {0x33, 0x33}, + {0x33, 0x34}, + {0x34, 0x33}, + {0x37, 0x2E}, + {0x34, 0x34}, + {0x34, 0x35}, + {0x35, 0x34}, + {0x38, 0x2F}, + {0x35, 0x35}, + {0x35, 0x36}, + {0x36, 0x35}, + {0x3A, 0x2E}, + {0x36, 0x36}, + {0x36, 0x37}, + {0x37, 0x36}, + {0x3B, 0x2F}, + {0x37, 0x37}, + {0x37, 0x38}, + {0x38, 0x37}, + {0x3D, 0x2E}, + {0x38, 0x38}, + {0x38, 0x39}, + {0x39, 0x38}, + {0x3E, 0x2F}, + {0x39, 0x39}, + {0x39, 0x3A}, + {0x3A, 0x39}, + {0x3A, 0x3A}, + {0x3A, 0x3A}, + {0x3A, 0x3B}, + {0x3B, 0x3A}, + {0x3B, 0x3B}, + {0x3B, 0x3B}, + {0x3B, 0x3C}, + {0x3C, 0x3B}, + {0x3C, 0x3C}, + {0x3C, 0x3C}, + {0x3C, 0x3D}, + {0x3D, 0x3C}, + {0x3D, 0x3D}, + {0x3D, 0x3D}, + {0x3D, 0x3E}, + {0x3E, 0x3D}, + {0x3E, 0x3E}, + {0x3E, 0x3E}, + {0x3E, 0x3F}, + {0x3F, 0x3E}, + {0x3F, 0x3F}, + {0x3F, 0x3F}, +}; + diff --git a/externals/NVTT/src/nvtt/cuda/Bitmaps.h b/externals/NVTT/src/nvtt/cuda/Bitmaps.h new file mode 100644 index 00000000..1494092c --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/Bitmaps.h @@ -0,0 +1,1119 @@ + + +/* +static void doPrecomputation() +{ + uint bitmaps[1024]; + + int indices[16]; + int num = 0; + + // Compute bitmaps with 3 clusters: + + // first cluster [0,i) is at the start + for( int m = 0; m < 16; ++m ) + { + indices[m] = 0; + } + const int imax = 15; + for( int i = imax; i >= 0; --i ) + { + // second cluster [i,j) is half along + for( int m = i; m < 16; ++m ) + { + indices[m] = 2; + } + const int jmax = ( i == 0 ) ? 15 : 16; + for( int j = jmax; j >= i; --j ) + { + // last cluster [j,k) is at the end + if( j < 16 ) + { + indices[j] = 1; + } + + uint bitmap = 0; + + for(int p = 0; p < 16; p++) { + bitmap |= indices[p] << (p * 2); + } + + bitmaps[num] = bitmap; + + num++; + } + } + nvDebugCheck(num == 151); + + // Align to 160. + for(int i = 0; i < 9; i++) + { + bitmaps[num] = 0x555AA000; + num++; + } + nvDebugCheck(num == 160); + + // Append bitmaps with 4 clusters: + + // first cluster [0,i) is at the start + for( int m = 0; m < 16; ++m ) + { + indices[m] = 0; + } + for( int i = imax; i >= 0; --i ) + { + // second cluster [i,j) is one third along + for( int m = i; m < 16; ++m ) + { + indices[m] = 2; + } + const int jmax = ( i == 0 ) ? 15 : 16; + for( int j = jmax; j >= i; --j ) + { + // third cluster [j,k) is two thirds along + for( int m = j; m < 16; ++m ) + { + indices[m] = 3; + } + + int kmax = ( j == 0 ) ? 15 : 16; + for( int k = kmax; k >= j; --k ) + { + // last cluster [k,n) is at the end + if( k < 16 ) + { + indices[k] = 1; + } + + uint bitmap = 0; + + bool hasThree = false; + for(int p = 0; p < 16; p++) { + bitmap |= indices[p] << (p * 2); + + if (indices[p] == 3) hasThree = true; + } + + if (hasThree) { + bitmaps[num] = bitmap; + num++; + } + } + } + } + nvDebugCheck(num == 975); + + // Align to 1024. + for(int i = 0; i < 49; i++) + { + bitmaps[num] = 0x555AA000; + num++; + } + + nvDebugCheck(num == 1024); + + printf("uint bitmaps[992] =\n{\n"); + for (int i = 0; i < 992; i++) + { + printf("\t0x%.8X,\n", bitmaps[i]); + } + printf("};\n"); +} +*/ + + +const static uint s_bitmapTable[992] = +{ + 0x80000000, + 0x40000000, + 0xA0000000, + 0x60000000, + 0x50000000, + 0xA8000000, + 0x68000000, + 0x58000000, + 0x54000000, + 0xAA000000, + 0x6A000000, + 0x5A000000, + 0x56000000, + 0x55000000, + 0xAA800000, + 0x6A800000, + 0x5A800000, + 0x56800000, + 0x55800000, + 0x55400000, + 0xAAA00000, + 0x6AA00000, + 0x5AA00000, + 0x56A00000, + 0x55A00000, + 0x55600000, + 0x55500000, + 0xAAA80000, + 0x6AA80000, + 0x5AA80000, + 0x56A80000, + 0x55A80000, + 0x55680000, + 0x55580000, + 0x55540000, + 0xAAAA0000, + 0x6AAA0000, + 0x5AAA0000, + 0x56AA0000, + 0x55AA0000, + 0x556A0000, + 0x555A0000, + 0x55560000, + 0x55550000, + 0xAAAA8000, + 0x6AAA8000, + 0x5AAA8000, + 0x56AA8000, + 0x55AA8000, + 0x556A8000, + 0x555A8000, + 0x55568000, + 0x55558000, + 0x55554000, + 0xAAAAA000, + 0x6AAAA000, + 0x5AAAA000, + 0x56AAA000, + 0x55AAA000, + 0x556AA000, + 0x555AA000, + 0x5556A000, + 0x5555A000, + 0x55556000, + 0x55555000, + 0xAAAAA800, + 0x6AAAA800, + 0x5AAAA800, + 0x56AAA800, + 0x55AAA800, + 0x556AA800, + 0x555AA800, + 0x5556A800, + 0x5555A800, + 0x55556800, + 0x55555800, + 0x55555400, + 0xAAAAAA00, + 0x6AAAAA00, + 0x5AAAAA00, + 0x56AAAA00, + 0x55AAAA00, + 0x556AAA00, + 0x555AAA00, + 0x5556AA00, + 0x5555AA00, + 0x55556A00, + 0x55555A00, + 0x55555600, + 0x55555500, + 0xAAAAAA80, + 0x6AAAAA80, + 0x5AAAAA80, + 0x56AAAA80, + 0x55AAAA80, + 0x556AAA80, + 0x555AAA80, + 0x5556AA80, + 0x5555AA80, + 0x55556A80, + 0x55555A80, + 0x55555680, + 0x55555580, + 0x55555540, + 0xAAAAAAA0, + 0x6AAAAAA0, + 0x5AAAAAA0, + 0x56AAAAA0, + 0x55AAAAA0, + 0x556AAAA0, + 0x555AAAA0, + 0x5556AAA0, + 0x5555AAA0, + 0x55556AA0, + 0x55555AA0, + 0x555556A0, + 0x555555A0, + 0x55555560, + 0x55555550, + 0xAAAAAAA8, + 0x6AAAAAA8, + 0x5AAAAAA8, + 0x56AAAAA8, + 0x55AAAAA8, + 0x556AAAA8, + 0x555AAAA8, + 0x5556AAA8, + 0x5555AAA8, + 0x55556AA8, + 0x55555AA8, + 0x555556A8, + 0x555555A8, + 0x55555568, + 0x55555558, + 0x55555554, + 0x6AAAAAAA, + 0x5AAAAAAA, + 0x56AAAAAA, + 0x55AAAAAA, + 0x556AAAAA, + 0x555AAAAA, + 0x5556AAAA, + 0x5555AAAA, + 0x55556AAA, + 0x55555AAA, + 0x555556AA, + 0x555555AA, + 0x5555556A, + 0x5555555A, + 0x55555556, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0x55555555, + 0xC0000000, + 0xE0000000, + 0xF0000000, + 0x70000000, + 0xE8000000, + 0xF8000000, + 0x78000000, + 0xFC000000, + 0x7C000000, + 0x5C000000, + 0xEA000000, + 0xFA000000, + 0x7A000000, + 0xFE000000, + 0x7E000000, + 0x5E000000, + 0xFF000000, + 0x7F000000, + 0x5F000000, + 0x57000000, + 0xEA800000, + 0xFA800000, + 0x7A800000, + 0xFE800000, + 0x7E800000, + 0x5E800000, + 0xFF800000, + 0x7F800000, + 0x5F800000, + 0x57800000, + 0xFFC00000, + 0x7FC00000, + 0x5FC00000, + 0x57C00000, + 0x55C00000, + 0xEAA00000, + 0xFAA00000, + 0x7AA00000, + 0xFEA00000, + 0x7EA00000, + 0x5EA00000, + 0xFFA00000, + 0x7FA00000, + 0x5FA00000, + 0x57A00000, + 0xFFE00000, + 0x7FE00000, + 0x5FE00000, + 0x57E00000, + 0x55E00000, + 0xFFF00000, + 0x7FF00000, + 0x5FF00000, + 0x57F00000, + 0x55F00000, + 0x55700000, + 0xEAA80000, + 0xFAA80000, + 0x7AA80000, + 0xFEA80000, + 0x7EA80000, + 0x5EA80000, + 0xFFA80000, + 0x7FA80000, + 0x5FA80000, + 0x57A80000, + 0xFFE80000, + 0x7FE80000, + 0x5FE80000, + 0x57E80000, + 0x55E80000, + 0xFFF80000, + 0x7FF80000, + 0x5FF80000, + 0x57F80000, + 0x55F80000, + 0x55780000, + 0xFFFC0000, + 0x7FFC0000, + 0x5FFC0000, + 0x57FC0000, + 0x55FC0000, + 0x557C0000, + 0x555C0000, + 0xEAAA0000, + 0xFAAA0000, + 0x7AAA0000, + 0xFEAA0000, + 0x7EAA0000, + 0x5EAA0000, + 0xFFAA0000, + 0x7FAA0000, + 0x5FAA0000, + 0x57AA0000, + 0xFFEA0000, + 0x7FEA0000, + 0x5FEA0000, + 0x57EA0000, + 0x55EA0000, + 0xFFFA0000, + 0x7FFA0000, + 0x5FFA0000, + 0x57FA0000, + 0x55FA0000, + 0x557A0000, + 0xFFFE0000, + 0x7FFE0000, + 0x5FFE0000, + 0x57FE0000, + 0x55FE0000, + 0x557E0000, + 0x555E0000, + 0xFFFF0000, + 0x7FFF0000, + 0x5FFF0000, + 0x57FF0000, + 0x55FF0000, + 0x557F0000, + 0x555F0000, + 0x55570000, + 0xEAAA8000, + 0xFAAA8000, + 0x7AAA8000, + 0xFEAA8000, + 0x7EAA8000, + 0x5EAA8000, + 0xFFAA8000, + 0x7FAA8000, + 0x5FAA8000, + 0x57AA8000, + 0xFFEA8000, + 0x7FEA8000, + 0x5FEA8000, + 0x57EA8000, + 0x55EA8000, + 0xFFFA8000, + 0x7FFA8000, + 0x5FFA8000, + 0x57FA8000, + 0x55FA8000, + 0x557A8000, + 0xFFFE8000, + 0x7FFE8000, + 0x5FFE8000, + 0x57FE8000, + 0x55FE8000, + 0x557E8000, + 0x555E8000, + 0xFFFF8000, + 0x7FFF8000, + 0x5FFF8000, + 0x57FF8000, + 0x55FF8000, + 0x557F8000, + 0x555F8000, + 0x55578000, + 0xFFFFC000, + 0x7FFFC000, + 0x5FFFC000, + 0x57FFC000, + 0x55FFC000, + 0x557FC000, + 0x555FC000, + 0x5557C000, + 0x5555C000, + 0xEAAAA000, + 0xFAAAA000, + 0x7AAAA000, + 0xFEAAA000, + 0x7EAAA000, + 0x5EAAA000, + 0xFFAAA000, + 0x7FAAA000, + 0x5FAAA000, + 0x57AAA000, + 0xFFEAA000, + 0x7FEAA000, + 0x5FEAA000, + 0x57EAA000, + 0x55EAA000, + 0xFFFAA000, + 0x7FFAA000, + 0x5FFAA000, + 0x57FAA000, + 0x55FAA000, + 0x557AA000, + 0xFFFEA000, + 0x7FFEA000, + 0x5FFEA000, + 0x57FEA000, + 0x55FEA000, + 0x557EA000, + 0x555EA000, + 0xFFFFA000, + 0x7FFFA000, + 0x5FFFA000, + 0x57FFA000, + 0x55FFA000, + 0x557FA000, + 0x555FA000, + 0x5557A000, + 0xFFFFE000, + 0x7FFFE000, + 0x5FFFE000, + 0x57FFE000, + 0x55FFE000, + 0x557FE000, + 0x555FE000, + 0x5557E000, + 0x5555E000, + 0xFFFFF000, + 0x7FFFF000, + 0x5FFFF000, + 0x57FFF000, + 0x55FFF000, + 0x557FF000, + 0x555FF000, + 0x5557F000, + 0x5555F000, + 0x55557000, + 0xEAAAA800, + 0xFAAAA800, + 0x7AAAA800, + 0xFEAAA800, + 0x7EAAA800, + 0x5EAAA800, + 0xFFAAA800, + 0x7FAAA800, + 0x5FAAA800, + 0x57AAA800, + 0xFFEAA800, + 0x7FEAA800, + 0x5FEAA800, + 0x57EAA800, + 0x55EAA800, + 0xFFFAA800, + 0x7FFAA800, + 0x5FFAA800, + 0x57FAA800, + 0x55FAA800, + 0x557AA800, + 0xFFFEA800, + 0x7FFEA800, + 0x5FFEA800, + 0x57FEA800, + 0x55FEA800, + 0x557EA800, + 0x555EA800, + 0xFFFFA800, + 0x7FFFA800, + 0x5FFFA800, + 0x57FFA800, + 0x55FFA800, + 0x557FA800, + 0x555FA800, + 0x5557A800, + 0xFFFFE800, + 0x7FFFE800, + 0x5FFFE800, + 0x57FFE800, + 0x55FFE800, + 0x557FE800, + 0x555FE800, + 0x5557E800, + 0x5555E800, + 0xFFFFF800, + 0x7FFFF800, + 0x5FFFF800, + 0x57FFF800, + 0x55FFF800, + 0x557FF800, + 0x555FF800, + 0x5557F800, + 0x5555F800, + 0x55557800, + 0xFFFFFC00, + 0x7FFFFC00, + 0x5FFFFC00, + 0x57FFFC00, + 0x55FFFC00, + 0x557FFC00, + 0x555FFC00, + 0x5557FC00, + 0x5555FC00, + 0x55557C00, + 0x55555C00, + 0xEAAAAA00, + 0xFAAAAA00, + 0x7AAAAA00, + 0xFEAAAA00, + 0x7EAAAA00, + 0x5EAAAA00, + 0xFFAAAA00, + 0x7FAAAA00, + 0x5FAAAA00, + 0x57AAAA00, + 0xFFEAAA00, + 0x7FEAAA00, + 0x5FEAAA00, + 0x57EAAA00, + 0x55EAAA00, + 0xFFFAAA00, + 0x7FFAAA00, + 0x5FFAAA00, + 0x57FAAA00, + 0x55FAAA00, + 0x557AAA00, + 0xFFFEAA00, + 0x7FFEAA00, + 0x5FFEAA00, + 0x57FEAA00, + 0x55FEAA00, + 0x557EAA00, + 0x555EAA00, + 0xFFFFAA00, + 0x7FFFAA00, + 0x5FFFAA00, + 0x57FFAA00, + 0x55FFAA00, + 0x557FAA00, + 0x555FAA00, + 0x5557AA00, + 0xFFFFEA00, + 0x7FFFEA00, + 0x5FFFEA00, + 0x57FFEA00, + 0x55FFEA00, + 0x557FEA00, + 0x555FEA00, + 0x5557EA00, + 0x5555EA00, + 0xFFFFFA00, + 0x7FFFFA00, + 0x5FFFFA00, + 0x57FFFA00, + 0x55FFFA00, + 0x557FFA00, + 0x555FFA00, + 0x5557FA00, + 0x5555FA00, + 0x55557A00, + 0xFFFFFE00, + 0x7FFFFE00, + 0x5FFFFE00, + 0x57FFFE00, + 0x55FFFE00, + 0x557FFE00, + 0x555FFE00, + 0x5557FE00, + 0x5555FE00, + 0x55557E00, + 0x55555E00, + 0xFFFFFF00, + 0x7FFFFF00, + 0x5FFFFF00, + 0x57FFFF00, + 0x55FFFF00, + 0x557FFF00, + 0x555FFF00, + 0x5557FF00, + 0x5555FF00, + 0x55557F00, + 0x55555F00, + 0x55555700, + 0xEAAAAA80, + 0xFAAAAA80, + 0x7AAAAA80, + 0xFEAAAA80, + 0x7EAAAA80, + 0x5EAAAA80, + 0xFFAAAA80, + 0x7FAAAA80, + 0x5FAAAA80, + 0x57AAAA80, + 0xFFEAAA80, + 0x7FEAAA80, + 0x5FEAAA80, + 0x57EAAA80, + 0x55EAAA80, + 0xFFFAAA80, + 0x7FFAAA80, + 0x5FFAAA80, + 0x57FAAA80, + 0x55FAAA80, + 0x557AAA80, + 0xFFFEAA80, + 0x7FFEAA80, + 0x5FFEAA80, + 0x57FEAA80, + 0x55FEAA80, + 0x557EAA80, + 0x555EAA80, + 0xFFFFAA80, + 0x7FFFAA80, + 0x5FFFAA80, + 0x57FFAA80, + 0x55FFAA80, + 0x557FAA80, + 0x555FAA80, + 0x5557AA80, + 0xFFFFEA80, + 0x7FFFEA80, + 0x5FFFEA80, + 0x57FFEA80, + 0x55FFEA80, + 0x557FEA80, + 0x555FEA80, + 0x5557EA80, + 0x5555EA80, + 0xFFFFFA80, + 0x7FFFFA80, + 0x5FFFFA80, + 0x57FFFA80, + 0x55FFFA80, + 0x557FFA80, + 0x555FFA80, + 0x5557FA80, + 0x5555FA80, + 0x55557A80, + 0xFFFFFE80, + 0x7FFFFE80, + 0x5FFFFE80, + 0x57FFFE80, + 0x55FFFE80, + 0x557FFE80, + 0x555FFE80, + 0x5557FE80, + 0x5555FE80, + 0x55557E80, + 0x55555E80, + 0xFFFFFF80, + 0x7FFFFF80, + 0x5FFFFF80, + 0x57FFFF80, + 0x55FFFF80, + 0x557FFF80, + 0x555FFF80, + 0x5557FF80, + 0x5555FF80, + 0x55557F80, + 0x55555F80, + 0x55555780, + 0xFFFFFFC0, + 0x7FFFFFC0, + 0x5FFFFFC0, + 0x57FFFFC0, + 0x55FFFFC0, + 0x557FFFC0, + 0x555FFFC0, + 0x5557FFC0, + 0x5555FFC0, + 0x55557FC0, + 0x55555FC0, + 0x555557C0, + 0x555555C0, + 0xEAAAAAA0, + 0xFAAAAAA0, + 0x7AAAAAA0, + 0xFEAAAAA0, + 0x7EAAAAA0, + 0x5EAAAAA0, + 0xFFAAAAA0, + 0x7FAAAAA0, + 0x5FAAAAA0, + 0x57AAAAA0, + 0xFFEAAAA0, + 0x7FEAAAA0, + 0x5FEAAAA0, + 0x57EAAAA0, + 0x55EAAAA0, + 0xFFFAAAA0, + 0x7FFAAAA0, + 0x5FFAAAA0, + 0x57FAAAA0, + 0x55FAAAA0, + 0x557AAAA0, + 0xFFFEAAA0, + 0x7FFEAAA0, + 0x5FFEAAA0, + 0x57FEAAA0, + 0x55FEAAA0, + 0x557EAAA0, + 0x555EAAA0, + 0xFFFFAAA0, + 0x7FFFAAA0, + 0x5FFFAAA0, + 0x57FFAAA0, + 0x55FFAAA0, + 0x557FAAA0, + 0x555FAAA0, + 0x5557AAA0, + 0xFFFFEAA0, + 0x7FFFEAA0, + 0x5FFFEAA0, + 0x57FFEAA0, + 0x55FFEAA0, + 0x557FEAA0, + 0x555FEAA0, + 0x5557EAA0, + 0x5555EAA0, + 0xFFFFFAA0, + 0x7FFFFAA0, + 0x5FFFFAA0, + 0x57FFFAA0, + 0x55FFFAA0, + 0x557FFAA0, + 0x555FFAA0, + 0x5557FAA0, + 0x5555FAA0, + 0x55557AA0, + 0xFFFFFEA0, + 0x7FFFFEA0, + 0x5FFFFEA0, + 0x57FFFEA0, + 0x55FFFEA0, + 0x557FFEA0, + 0x555FFEA0, + 0x5557FEA0, + 0x5555FEA0, + 0x55557EA0, + 0x55555EA0, + 0xFFFFFFA0, + 0x7FFFFFA0, + 0x5FFFFFA0, + 0x57FFFFA0, + 0x55FFFFA0, + 0x557FFFA0, + 0x555FFFA0, + 0x5557FFA0, + 0x5555FFA0, + 0x55557FA0, + 0x55555FA0, + 0x555557A0, + 0xFFFFFFE0, + 0x7FFFFFE0, + 0x5FFFFFE0, + 0x57FFFFE0, + 0x55FFFFE0, + 0x557FFFE0, + 0x555FFFE0, + 0x5557FFE0, + 0x5555FFE0, + 0x55557FE0, + 0x55555FE0, + 0x555557E0, + 0x555555E0, + 0xFFFFFFF0, + 0x7FFFFFF0, + 0x5FFFFFF0, + 0x57FFFFF0, + 0x55FFFFF0, + 0x557FFFF0, + 0x555FFFF0, + 0x5557FFF0, + 0x5555FFF0, + 0x55557FF0, + 0x55555FF0, + 0x555557F0, + 0x555555F0, + 0x55555570, + 0xEAAAAAA8, + 0xFAAAAAA8, + 0x7AAAAAA8, + 0xFEAAAAA8, + 0x7EAAAAA8, + 0x5EAAAAA8, + 0xFFAAAAA8, + 0x7FAAAAA8, + 0x5FAAAAA8, + 0x57AAAAA8, + 0xFFEAAAA8, + 0x7FEAAAA8, + 0x5FEAAAA8, + 0x57EAAAA8, + 0x55EAAAA8, + 0xFFFAAAA8, + 0x7FFAAAA8, + 0x5FFAAAA8, + 0x57FAAAA8, + 0x55FAAAA8, + 0x557AAAA8, + 0xFFFEAAA8, + 0x7FFEAAA8, + 0x5FFEAAA8, + 0x57FEAAA8, + 0x55FEAAA8, + 0x557EAAA8, + 0x555EAAA8, + 0xFFFFAAA8, + 0x7FFFAAA8, + 0x5FFFAAA8, + 0x57FFAAA8, + 0x55FFAAA8, + 0x557FAAA8, + 0x555FAAA8, + 0x5557AAA8, + 0xFFFFEAA8, + 0x7FFFEAA8, + 0x5FFFEAA8, + 0x57FFEAA8, + 0x55FFEAA8, + 0x557FEAA8, + 0x555FEAA8, + 0x5557EAA8, + 0x5555EAA8, + 0xFFFFFAA8, + 0x7FFFFAA8, + 0x5FFFFAA8, + 0x57FFFAA8, + 0x55FFFAA8, + 0x557FFAA8, + 0x555FFAA8, + 0x5557FAA8, + 0x5555FAA8, + 0x55557AA8, + 0xFFFFFEA8, + 0x7FFFFEA8, + 0x5FFFFEA8, + 0x57FFFEA8, + 0x55FFFEA8, + 0x557FFEA8, + 0x555FFEA8, + 0x5557FEA8, + 0x5555FEA8, + 0x55557EA8, + 0x55555EA8, + 0xFFFFFFA8, + 0x7FFFFFA8, + 0x5FFFFFA8, + 0x57FFFFA8, + 0x55FFFFA8, + 0x557FFFA8, + 0x555FFFA8, + 0x5557FFA8, + 0x5555FFA8, + 0x55557FA8, + 0x55555FA8, + 0x555557A8, + 0xFFFFFFE8, + 0x7FFFFFE8, + 0x5FFFFFE8, + 0x57FFFFE8, + 0x55FFFFE8, + 0x557FFFE8, + 0x555FFFE8, + 0x5557FFE8, + 0x5555FFE8, + 0x55557FE8, + 0x55555FE8, + 0x555557E8, + 0x555555E8, + 0xFFFFFFF8, + 0x7FFFFFF8, + 0x5FFFFFF8, + 0x57FFFFF8, + 0x55FFFFF8, + 0x557FFFF8, + 0x555FFFF8, + 0x5557FFF8, + 0x5555FFF8, + 0x55557FF8, + 0x55555FF8, + 0x555557F8, + 0x555555F8, + 0x55555578, + 0xFFFFFFFC, + 0x7FFFFFFC, + 0x5FFFFFFC, + 0x57FFFFFC, + 0x55FFFFFC, + 0x557FFFFC, + 0x555FFFFC, + 0x5557FFFC, + 0x5555FFFC, + 0x55557FFC, + 0x55555FFC, + 0x555557FC, + 0x555555FC, + 0x5555557C, + 0x5555555C, + 0xEAAAAAAA, + 0xFAAAAAAA, + 0x7AAAAAAA, + 0xFEAAAAAA, + 0x7EAAAAAA, + 0x5EAAAAAA, + 0xFFAAAAAA, + 0x7FAAAAAA, + 0x5FAAAAAA, + 0x57AAAAAA, + 0xFFEAAAAA, + 0x7FEAAAAA, + 0x5FEAAAAA, + 0x57EAAAAA, + 0x55EAAAAA, + 0xFFFAAAAA, + 0x7FFAAAAA, + 0x5FFAAAAA, + 0x57FAAAAA, + 0x55FAAAAA, + 0x557AAAAA, + 0xFFFEAAAA, + 0x7FFEAAAA, + 0x5FFEAAAA, + 0x57FEAAAA, + 0x55FEAAAA, + 0x557EAAAA, + 0x555EAAAA, + 0xFFFFAAAA, + 0x7FFFAAAA, + 0x5FFFAAAA, + 0x57FFAAAA, + 0x55FFAAAA, + 0x557FAAAA, + 0x555FAAAA, + 0x5557AAAA, + 0xFFFFEAAA, + 0x7FFFEAAA, + 0x5FFFEAAA, + 0x57FFEAAA, + 0x55FFEAAA, + 0x557FEAAA, + 0x555FEAAA, + 0x5557EAAA, + 0x5555EAAA, + 0xFFFFFAAA, + 0x7FFFFAAA, + 0x5FFFFAAA, + 0x57FFFAAA, + 0x55FFFAAA, + 0x557FFAAA, + 0x555FFAAA, + 0x5557FAAA, + 0x5555FAAA, + 0x55557AAA, + 0xFFFFFEAA, + 0x7FFFFEAA, + 0x5FFFFEAA, + 0x57FFFEAA, + 0x55FFFEAA, + 0x557FFEAA, + 0x555FFEAA, + 0x5557FEAA, + 0x5555FEAA, + 0x55557EAA, + 0x55555EAA, + 0xFFFFFFAA, + 0x7FFFFFAA, + 0x5FFFFFAA, + 0x57FFFFAA, + 0x55FFFFAA, + 0x557FFFAA, + 0x555FFFAA, + 0x5557FFAA, + 0x5555FFAA, + 0x55557FAA, + 0x55555FAA, + 0x555557AA, + 0xFFFFFFEA, + 0x7FFFFFEA, + 0x5FFFFFEA, + 0x57FFFFEA, + 0x55FFFFEA, + 0x557FFFEA, + 0x555FFFEA, + 0x5557FFEA, + 0x5555FFEA, + 0x55557FEA, + 0x55555FEA, + 0x555557EA, + 0x555555EA, + 0xFFFFFFFA, + 0x7FFFFFFA, + 0x5FFFFFFA, + 0x57FFFFFA, + 0x55FFFFFA, + 0x557FFFFA, + 0x555FFFFA, + 0x5557FFFA, + 0x5555FFFA, + 0x55557FFA, + 0x55555FFA, + 0x555557FA, + 0x555555FA, + 0x5555557A, + 0xFFFFFFFE, + 0x7FFFFFFE, + 0x5FFFFFFE, + 0x57FFFFFE, + 0x55FFFFFE, + 0x557FFFFE, + 0x555FFFFE, + 0x5557FFFE, + 0x5555FFFE, + 0x55557FFE, + 0x55555FFE, + 0x555557FE, + 0x555555FE, + 0x5555557E, + 0x5555555E, + 0x7FFFFFFF, + 0x5FFFFFFF, + 0x57FFFFFF, + 0x55FFFFFF, + 0x557FFFFF, + 0x555FFFFF, + 0x5557FFFF, + 0x5555FFFF, + 0x55557FFF, + 0x55555FFF, + 0x555557FF, + 0x555555FF, + 0x5555557F, + 0x5555555F, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, + 0x55555557, +}; diff --git a/externals/NVTT/src/nvtt/cuda/CompressKernel.cu b/externals/NVTT/src/nvtt/cuda/CompressKernel.cu new file mode 100644 index 00000000..e3daf3e0 --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CompressKernel.cu @@ -0,0 +1,1122 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include + +#include "CudaMath.h" + +#include "../SingleColorLookup.h" + +#define NUM_THREADS 64 // Number of threads per block. + +#if __DEVICE_EMULATION__ +#define __debugsync() __syncthreads() +#else +#define __debugsync() +#endif + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; + +template +__device__ inline void swap(T & a, T & b) +{ + T tmp = a; + a = b; + b = tmp; +} + +__constant__ float3 kColorMetric = { 1.0f, 1.0f, 1.0f }; +__constant__ float3 kColorMetricSqr = { 1.0f, 1.0f, 1.0f }; + + + +//////////////////////////////////////////////////////////////////////////////// +// Sort colors +//////////////////////////////////////////////////////////////////////////////// +__device__ void sortColors(const float * values, int * cmp) +{ + int tid = threadIdx.x; + +#if 1 + cmp[tid] = (values[0] < values[tid]); + cmp[tid] += (values[1] < values[tid]); + cmp[tid] += (values[2] < values[tid]); + cmp[tid] += (values[3] < values[tid]); + cmp[tid] += (values[4] < values[tid]); + cmp[tid] += (values[5] < values[tid]); + cmp[tid] += (values[6] < values[tid]); + cmp[tid] += (values[7] < values[tid]); + cmp[tid] += (values[8] < values[tid]); + cmp[tid] += (values[9] < values[tid]); + cmp[tid] += (values[10] < values[tid]); + cmp[tid] += (values[11] < values[tid]); + cmp[tid] += (values[12] < values[tid]); + cmp[tid] += (values[13] < values[tid]); + cmp[tid] += (values[14] < values[tid]); + cmp[tid] += (values[15] < values[tid]); + + // Resolve elements with the same index. + if (tid > 0 && cmp[tid] == cmp[0]) ++cmp[tid]; + if (tid > 1 && cmp[tid] == cmp[1]) ++cmp[tid]; + if (tid > 2 && cmp[tid] == cmp[2]) ++cmp[tid]; + if (tid > 3 && cmp[tid] == cmp[3]) ++cmp[tid]; + if (tid > 4 && cmp[tid] == cmp[4]) ++cmp[tid]; + if (tid > 5 && cmp[tid] == cmp[5]) ++cmp[tid]; + if (tid > 6 && cmp[tid] == cmp[6]) ++cmp[tid]; + if (tid > 7 && cmp[tid] == cmp[7]) ++cmp[tid]; + if (tid > 8 && cmp[tid] == cmp[8]) ++cmp[tid]; + if (tid > 9 && cmp[tid] == cmp[9]) ++cmp[tid]; + if (tid > 10 && cmp[tid] == cmp[10]) ++cmp[tid]; + if (tid > 11 && cmp[tid] == cmp[11]) ++cmp[tid]; + if (tid > 12 && cmp[tid] == cmp[12]) ++cmp[tid]; + if (tid > 13 && cmp[tid] == cmp[13]) ++cmp[tid]; + if (tid > 14 && cmp[tid] == cmp[14]) ++cmp[tid]; +#else + + cmp[tid] = 0; + + #pragma unroll + for (int i = 0; i < 16; i++) + { + cmp[tid] += (values[i] < values[tid]); + } + + // Resolve elements with the same index. + #pragma unroll + for (int i = 0; i < 15; i++) + { + if (tid > 0 && cmp[tid] == cmp[i]) ++cmp[tid]; + } +#endif +} + + +//////////////////////////////////////////////////////////////////////////////// +// Load color block to shared mem +//////////////////////////////////////////////////////////////////////////////// +__device__ void loadColorBlock(const uint * image, float3 colors[16], float3 sums[16], int xrefs[16], int * sameColor) +{ + const int bid = blockIdx.x; + const int idx = threadIdx.x; + + __shared__ float dps[16]; + + if (idx < 16) + { + // Read color and copy to shared mem. + uint c = image[(bid) * 16 + idx]; + + colors[idx].z = ((c >> 0) & 0xFF) * (1.0f / 255.0f); + colors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f); + colors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f); + + // No need to synchronize, 16 < warp size. +#if __DEVICE_EMULATION__ + } __debugsync(); if (idx < 16) { +#endif + + // Sort colors along the best fit line. + colorSums(colors, sums); + float3 axis = bestFitLine(colors, sums[0], kColorMetric); + + *sameColor = (axis == make_float3(0, 0, 0)); + + dps[idx] = dot(colors[idx], axis); + +#if __DEVICE_EMULATION__ + } __debugsync(); if (idx < 16) { +#endif + + sortColors(dps, xrefs); + + float3 tmp = colors[idx]; + colors[xrefs[idx]] = tmp; + } +} + +__device__ void loadColorBlock(const uint * image, float3 colors[16], float3 sums[16], float weights[16], int xrefs[16], int * sameColor) +{ + const int bid = blockIdx.x; + const int idx = threadIdx.x; + + __shared__ float3 rawColors[16]; + __shared__ float dps[16]; + + if (idx < 16) + { + // Read color and copy to shared mem. + uint c = image[(bid) * 16 + idx]; + + rawColors[idx].z = ((c >> 0) & 0xFF) * (1.0f / 255.0f); + rawColors[idx].y = ((c >> 8) & 0xFF) * (1.0f / 255.0f); + rawColors[idx].x = ((c >> 16) & 0xFF) * (1.0f / 255.0f); + weights[idx] = (((c >> 24) & 0xFF) + 1) * (1.0f / 256.0f); + + colors[idx] = rawColors[idx] * weights[idx]; + + + // No need to synchronize, 16 < warp size. +#if __DEVICE_EMULATION__ + } __debugsync(); if (idx < 16) { +#endif + + // Sort colors along the best fit line. + colorSums(colors, sums); + float3 axis = bestFitLine(colors, sums[0], kColorMetric); + + *sameColor = (axis == make_float3(0, 0, 0)); + + // Single color compressor needs unweighted colors. + if (*sameColor) colors[idx] = rawColors[idx]; + + dps[idx] = dot(rawColors[idx], axis); + +#if __DEVICE_EMULATION__ + } __debugsync(); if (idx < 16) { +#endif + + sortColors(dps, xrefs); + + float3 tmp = colors[idx]; + colors[xrefs[idx]] = tmp; + + float w = weights[idx]; + weights[xrefs[idx]] = w; + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// Round color to RGB565 and expand +//////////////////////////////////////////////////////////////////////////////// +inline __device__ float3 roundAndExpand565(float3 v, ushort * w) +{ + v.x = rintf(__saturatef(v.x) * 31.0f); + v.y = rintf(__saturatef(v.y) * 63.0f); + v.z = rintf(__saturatef(v.z) * 31.0f); + *w = ((ushort)v.x << 11) | ((ushort)v.y << 5) | (ushort)v.z; + v.x *= 0.03227752766457f; // approximate integer bit expansion. + v.y *= 0.01583151765563f; + v.z *= 0.03227752766457f; + return v; +} + + +//////////////////////////////////////////////////////////////////////////////// +// Evaluate permutations +//////////////////////////////////////////////////////////////////////////////// +__device__ float evalPermutation4(const float3 * colors, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + float3 betax_sum = make_float3(0.0f, 0.0f, 0.0f); + + // Compute alpha & beta for this permutation. + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + float beta = (bits & 1); + if (bits & 2) beta = (1 + beta) / 3.0f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * colors[i]; + betax_sum += beta * colors[i]; + } + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return dot(e, kColorMetricSqr); +} + +__device__ float evalPermutation3(const float3 * colors, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + float3 betax_sum = make_float3(0.0f, 0.0f, 0.0f); + + // Compute alpha & beta for this permutation. + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + float beta = (bits & 1); + if (bits & 2) beta = 0.5f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * colors[i]; + betax_sum += beta * colors[i]; + } + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return dot(e, kColorMetricSqr); +} + +__constant__ const float alphaTable4[4] = { 9.0f, 0.0f, 6.0f, 3.0f }; +__constant__ const float alphaTable3[4] = { 4.0f, 0.0f, 2.0f, 2.0f }; +__constant__ const uint prods4[4] = { 0x090000,0x000900,0x040102,0x010402 }; +__constant__ const uint prods3[4] = { 0x040000,0x000400,0x040101,0x010401 }; + +__device__ float evalPermutation4(const float3 * colors, float3 color_sum, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + uint akku = 0; + + // Compute alpha & beta for this permutation. + #pragma unroll + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + alphax_sum += alphaTable4[bits & 3] * colors[i]; + akku += prods4[bits & 3]; + } + + float alpha2_sum = float(akku >> 16); + float beta2_sum = float((akku >> 8) & 0xff); + float alphabeta_sum = float(akku & 0xff); + float3 betax_sum = 9.0f * color_sum - alphax_sum; + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return (1.0f / 9.0f) * dot(e, kColorMetricSqr); +} + +__device__ float evalPermutation3(const float3 * colors, float3 color_sum, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + uint akku = 0; + + // Compute alpha & beta for this permutation. + #pragma unroll + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + alphax_sum += alphaTable3[bits & 3] * colors[i]; + akku += prods3[bits & 3]; + } + + float alpha2_sum = float(akku >> 16); + float beta2_sum = float((akku >> 8) & 0xff); + float alphabeta_sum = float(akku & 0xff); + float3 betax_sum = 4.0f * color_sum - alphax_sum; + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return (1.0f / 4.0f) * dot(e, kColorMetricSqr); +} + +__device__ float evalPermutation4(const float3 * colors, const float * weights, float3 color_sum, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + + // Compute alpha & beta for this permutation. + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + float beta = (bits & 1); + if (bits & 2) beta = (1 + beta) / 3.0f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha * weights[i]; + beta2_sum += beta * beta * weights[i]; + alphabeta_sum += alpha * beta * weights[i]; + alphax_sum += alpha * colors[i]; + } + + float3 betax_sum = color_sum - alphax_sum; + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return dot(e, kColorMetricSqr); +} + +/* +__device__ float evalPermutation3(const float3 * colors, const float * weights, uint permutation, ushort * start, ushort * end) +{ + // Compute endpoints using least squares. + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + float3 alphax_sum = make_float3(0.0f, 0.0f, 0.0f); + + // Compute alpha & beta for this permutation. + for (int i = 0; i < 16; i++) + { + const uint bits = permutation >> (2*i); + + float beta = (bits & 1); + if (bits & 2) beta = 0.5f; + float alpha = 1.0f - beta; + + alpha2_sum += alpha * alpha * weights[i]; + beta2_sum += beta * beta * weights[i]; + alphabeta_sum += alpha * beta * weights[i]; + alphax_sum += alpha * colors[i]; + } + + float3 betax_sum = color_sum - alphax_sum; + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float3 a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float3 b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + // Round a, b to the closest 5-6-5 color and expand... + a = roundAndExpand565(a, start); + b = roundAndExpand565(b, end); + + // compute the error + float3 e = a * a * alpha2_sum + b * b * beta2_sum + 2.0f * (a * b * alphabeta_sum - a * alphax_sum - b * betax_sum); + + return dot(e, kColorMetricSqr); +} +*/ + + +//////////////////////////////////////////////////////////////////////////////// +// Evaluate all permutations +//////////////////////////////////////////////////////////////////////////////// +__device__ void evalAllPermutations(const float3 * colors, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) +{ + const int idx = threadIdx.x; + + float bestError = FLT_MAX; + + __shared__ uint s_permutations[160]; + + for(int i = 0; i < 16; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 992) break; + + ushort start, end; + uint permutation = permutations[pidx]; + if (pidx < 160) s_permutations[pidx] = permutation; + + float error = evalPermutation4(colors, colorSum, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + } + } + + if (bestStart < bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= 0x55555555; // Flip indices. + } + + for(int i = 0; i < 3; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 160) break; + + ushort start, end; + uint permutation = s_permutations[pidx]; + float error = evalPermutation3(colors, colorSum, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + + if (bestStart > bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices. + } + } + } + + errors[idx] = bestError; +} + +/* +__device__ void evalAllPermutations(const float3 * colors, const float * weights, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) +{ + const int idx = threadIdx.x; + + float bestError = FLT_MAX; + + __shared__ uint s_permutations[160]; + + for(int i = 0; i < 16; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 992) break; + + ushort start, end; + uint permutation = permutations[pidx]; + if (pidx < 160) s_permutations[pidx] = permutation; + + float error = evalPermutation4(colors, weights, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + } + } + + if (bestStart < bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= 0x55555555; // Flip indices. + } + + for(int i = 0; i < 3; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 160) break; + + ushort start, end; + uint permutation = s_permutations[pidx]; + float error = evalPermutation3(colors, weights, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + + if (bestStart > bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= (~bestPermutation >> 1) & 0x55555555; // Flip indices. + } + } + } + + errors[idx] = bestError; +} +*/ + +__device__ void evalLevel4Permutations(const float3 * colors, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) +{ + const int idx = threadIdx.x; + + float bestError = FLT_MAX; + + for(int i = 0; i < 16; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 992) break; + + ushort start, end; + uint permutation = permutations[pidx]; + + float error = evalPermutation4(colors, colorSum, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + } + } + + if (bestStart < bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= 0x55555555; // Flip indices. + } + + errors[idx] = bestError; +} + +__device__ void evalLevel4Permutations(const float3 * colors, const float * weights, float3 colorSum, const uint * permutations, ushort & bestStart, ushort & bestEnd, uint & bestPermutation, float * errors) +{ + const int idx = threadIdx.x; + + float bestError = FLT_MAX; + + for(int i = 0; i < 16; i++) + { + int pidx = idx + NUM_THREADS * i; + if (pidx >= 992) break; + + ushort start, end; + uint permutation = permutations[pidx]; + + float error = evalPermutation4(colors, weights, colorSum, permutation, &start, &end); + + if (error < bestError) + { + bestError = error; + bestPermutation = permutation; + bestStart = start; + bestEnd = end; + } + } + + if (bestStart < bestEnd) + { + swap(bestEnd, bestStart); + bestPermutation ^= 0x55555555; // Flip indices. + } + + errors[idx] = bestError; +} + + +//////////////////////////////////////////////////////////////////////////////// +// Find index with minimum error +//////////////////////////////////////////////////////////////////////////////// +__device__ int findMinError(float * errors) +{ + const int idx = threadIdx.x; + + __shared__ int indices[NUM_THREADS]; + indices[idx] = idx; + +#if __DEVICE_EMULATION__ + for(int d = NUM_THREADS/2; d > 0; d >>= 1) + { + __syncthreads(); + + if (idx < d) + { + float err0 = errors[idx]; + float err1 = errors[idx + d]; + + if (err1 < err0) { + errors[idx] = err1; + indices[idx] = indices[idx + d]; + } + } + } + +#else + for(int d = NUM_THREADS/2; d > 32; d >>= 1) + { + __syncthreads(); + + if (idx < d) + { + float err0 = errors[idx]; + float err1 = errors[idx + d]; + + if (err1 < err0) { + errors[idx] = err1; + indices[idx] = indices[idx + d]; + } + } + } + + __syncthreads(); + + // unroll last 6 iterations + if (idx < 32) + { + if (errors[idx + 32] < errors[idx]) { + errors[idx] = errors[idx + 32]; + indices[idx] = indices[idx + 32]; + } + if (errors[idx + 16] < errors[idx]) { + errors[idx] = errors[idx + 16]; + indices[idx] = indices[idx + 16]; + } + if (errors[idx + 8] < errors[idx]) { + errors[idx] = errors[idx + 8]; + indices[idx] = indices[idx + 8]; + } + if (errors[idx + 4] < errors[idx]) { + errors[idx] = errors[idx + 4]; + indices[idx] = indices[idx + 4]; + } + if (errors[idx + 2] < errors[idx]) { + errors[idx] = errors[idx + 2]; + indices[idx] = indices[idx + 2]; + } + if (errors[idx + 1] < errors[idx]) { + errors[idx] = errors[idx + 1]; + indices[idx] = indices[idx + 1]; + } + } +#endif + + __syncthreads(); + + return indices[0]; +} + + +//////////////////////////////////////////////////////////////////////////////// +// Save DXT block +//////////////////////////////////////////////////////////////////////////////// +__device__ void saveBlockDXT1(ushort start, ushort end, uint permutation, int xrefs[16], uint2 * result) +{ + const int bid = blockIdx.x; + + if (start == end) + { + permutation = 0; + } + + // Reorder permutation. + uint indices = 0; + for(int i = 0; i < 16; i++) + { + int ref = xrefs[i]; + indices |= ((permutation >> (2 * ref)) & 3) << (2 * i); + } + + // Write endpoints. + result[bid].x = (end << 16) | start; + + // Write palette indices. + result[bid].y = indices; +} + +__device__ void saveSingleColorBlockDXT1(float3 color, uint2 * result) +{ + const int bid = blockIdx.x; + + int r = color.x * 255; + int g = color.y * 255; + int b = color.z * 255; + + ushort color0 = (OMatch5[r][0] << 11) | (OMatch6[g][0] << 5) | OMatch5[b][0]; + ushort color1 = (OMatch5[r][1] << 11) | (OMatch6[g][1] << 5) | OMatch5[b][1]; + + if (color0 < color1) + { + result[bid].x = (color0 << 16) | color1; + result[bid].y = 0xffffffff; + } + else + { + result[bid].x = (color1 << 16) | color0; + result[bid].y = 0xaaaaaaaa; + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// Compress color block +//////////////////////////////////////////////////////////////////////////////// +__global__ void compressDXT1(const uint * permutations, const uint * image, uint2 * result) +{ + __shared__ float3 colors[16]; + __shared__ float3 sums[16]; + __shared__ int xrefs[16]; + __shared__ int sameColor; + + loadColorBlock(image, colors, sums, xrefs, &sameColor); + + __syncthreads(); + + if (sameColor) + { + if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result); + return; + } + + ushort bestStart, bestEnd; + uint bestPermutation; + + __shared__ float errors[NUM_THREADS]; + + evalAllPermutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); + + // Use a parallel reduction to find minimum error. + const int minIdx = findMinError(errors); + + // Only write the result of the winner thread. + if (threadIdx.x == minIdx) + { + saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result); + } +} + +__global__ void compressLevel4DXT1(const uint * permutations, const uint * image, uint2 * result) +{ + __shared__ float3 colors[16]; + __shared__ float3 sums[16]; + __shared__ int xrefs[16]; + __shared__ int sameColor; + + loadColorBlock(image, colors, sums, xrefs, &sameColor); + + __syncthreads(); + + if (sameColor) + { + if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result); + return; + } + + ushort bestStart, bestEnd; + uint bestPermutation; + + __shared__ float errors[NUM_THREADS]; + + evalLevel4Permutations(colors, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); + + // Use a parallel reduction to find minimum error. + const int minIdx = findMinError(errors); + + // Only write the result of the winner thread. + if (threadIdx.x == minIdx) + { + saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result); + } +} + +__global__ void compressWeightedDXT1(const uint * permutations, const uint * image, uint2 * result) +{ + __shared__ float3 colors[16]; + __shared__ float3 sums[16]; + __shared__ float weights[16]; + __shared__ int xrefs[16]; + __shared__ int sameColor; + + loadColorBlock(image, colors, sums, weights, xrefs, &sameColor); + + __syncthreads(); + + if (sameColor) + { + if (threadIdx.x == 0) saveSingleColorBlockDXT1(colors[0], result); + return; + } + + ushort bestStart, bestEnd; + uint bestPermutation; + + __shared__ float errors[NUM_THREADS]; + + evalLevel4Permutations(colors, weights, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); + + // Use a parallel reduction to find minimum error. + int minIdx = findMinError(errors); + + // Only write the result of the winner thread. + if (threadIdx.x == minIdx) + { + saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, result); + } +} + + +/* +__device__ float computeError(const float weights[16], uchar a0, uchar a1) +{ + float palette[6]; + palette[0] = (6.0f/7.0f * a0 + 1.0f/7.0f * a1); + palette[1] = (5.0f/7.0f * a0 + 2.0f/7.0f * a1); + palette[2] = (4.0f/7.0f * a0 + 3.0f/7.0f * a1); + palette[3] = (3.0f/7.0f * a0 + 4.0f/7.0f * a1); + palette[4] = (2.0f/7.0f * a0 + 5.0f/7.0f * a1); + palette[5] = (1.0f/7.0f * a0 + 6.0f/7.0f * a1); + + float total = 0.0f; + + for (uint i = 0; i < 16; i++) + { + float alpha = weights[i]; + + float error = a0 - alpha; + error = min(error, palette[0] - alpha); + error = min(error, palette[1] - alpha); + error = min(error, palette[2] - alpha); + error = min(error, palette[3] - alpha); + error = min(error, palette[4] - alpha); + error = min(error, palette[5] - alpha); + error = min(error, a1 - alpha); + + total += error; + } + + return total; +} + +inline __device__ uchar roundAndExpand(float a) +{ + return rintf(__saturatef(a) * 255.0f); +} +*/ +/* +__device__ void optimizeAlpha8(const float alphas[16], uchar & a0, uchar & a1) +{ + float alpha2_sum = 0; + float beta2_sum = 0; + float alphabeta_sum = 0; + float alphax_sum = 0; + float betax_sum = 0; + + for (int i = 0; i < 16; i++) + { + uint idx = index[i]; + float alpha; + if (idx < 2) alpha = 1.0f - idx; + else alpha = (8.0f - idx) / 7.0f; + + float beta = 1 - alpha; + + alpha2_sum += alpha * alpha; + beta2_sum += beta * beta; + alphabeta_sum += alpha * beta; + alphax_sum += alpha * alphas[i]; + betax_sum += beta * alphas[i]; + } + + const float factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + float a = (alphax_sum * beta2_sum - betax_sum * alphabeta_sum) * factor; + float b = (betax_sum * alpha2_sum - alphax_sum * alphabeta_sum) * factor; + + a0 = roundAndExpand8(a); + a1 = roundAndExpand8(b); +} +*/ +/* +__device__ void compressAlpha(const float alphas[16], uint4 * result) +{ + const int tid = threadIdx.x; + + // Compress alpha block! + // Brute force approach: + // Try all color pairs: 256*256/2 = 32768, 32768/64 = 512 iterations? + + // Determine min & max alphas + + float A0, A1; + + if (tid < 16) + { + __shared__ uint s_alphas[16]; + + s_alphas[tid] = alphas[tid]; + s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^8]); + s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^4]); + s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^2]); + s_alphas[tid] = min(s_alphas[tid], s_alphas[tid^1]); + A0 = s_alphas[tid]; + + s_alphas[tid] = alphas[tid]; + s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^8]); + s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^4]); + s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^2]); + s_alphas[tid] = max(s_alphas[tid], s_alphas[tid^1]); + A1 = s_alphas[tid]; + } + + __syncthreads(); + + int minIdx = 0; + + if (A1 - A0 > 8) + { + float bestError = FLT_MAX; + + // 64 threads -> 8x8 + // divide [A1-A0] in partitions. + // test endpoints + + for (int i = 0; i < 128; i++) + { + uint idx = (i * NUM_THREADS + tid) * 4; + uchar a0 = idx & 255; + uchar a1 = idx >> 8; + + float error = computeError(alphas, a0, a1); + + if (error < bestError) + { + bestError = error; + A0 = a0; + A1 = a1; + } + } + + __shared__ float errors[NUM_THREADS]; + errors[tid] = bestError; + + // Minimize error. + minIdx = findMinError(errors); + + } + + if (minIdx == tid) + { + // @@ Compute indices. + + // @@ Write alpha block. + } +} + +__global__ void compressDXT5(const uint * permutations, const uint * image, uint4 * result) +{ + __shared__ float3 colors[16]; + __shared__ float3 sums[16]; + __shared__ float weights[16]; + __shared__ int xrefs[16]; + + loadColorBlock(image, colors, sums, weights, xrefs); + + __syncthreads(); + + compressAlpha(weights, result); + + ushort bestStart, bestEnd; + uint bestPermutation; + + __shared__ float errors[NUM_THREADS]; + + evalLevel4Permutations(colors, weights, sums[0], permutations, bestStart, bestEnd, bestPermutation, errors); + + // Use a parallel reduction to find minimum error. + int minIdx = findMinError(errors); + + // Only write the result of the winner thread. + if (threadIdx.x == minIdx) + { + saveBlockDXT1(bestStart, bestEnd, bestPermutation, xrefs, (uint2 *)result); + } +} +*/ + +//////////////////////////////////////////////////////////////////////////////// +// Setup kernel +//////////////////////////////////////////////////////////////////////////////// + +extern "C" void setupCompressKernel(const float weights[3]) +{ + // Set constants. + cudaMemcpyToSymbol(kColorMetric, weights, sizeof(float) * 3, 0); + + float weightsSqr[3]; + weightsSqr[0] = weights[0] * weights[0]; + weightsSqr[1] = weights[1] * weights[1]; + weightsSqr[2] = weights[2] * weights[2]; + + cudaMemcpyToSymbol(kColorMetricSqr, weightsSqr, sizeof(float) * 3, 0); +} + + +//////////////////////////////////////////////////////////////////////////////// +// Launch kernel +//////////////////////////////////////////////////////////////////////////////// + +extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps) +{ + compressDXT1<<>>(d_bitmaps, d_data, (uint2 *)d_result); +} + +extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps) +{ + compressLevel4DXT1<<>>(d_bitmaps, d_data, (uint2 *)d_result); +} + +extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps) +{ + compressWeightedDXT1<<>>(d_bitmaps, d_data, (uint2 *)d_result); +} diff --git a/externals/NVTT/src/nvtt/cuda/ConvolveKernel.cu b/externals/NVTT/src/nvtt/cuda/ConvolveKernel.cu new file mode 100644 index 00000000..35f684da --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/ConvolveKernel.cu @@ -0,0 +1,264 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include + +#include "CudaMath.h" + +#define TW 16 +#define TH 16 + +#define THREAD_COUNT (TW * TH) + +#define MAX_KERNEL_WIDTH 32 + +#define KW 4 + + + +#if __DEVICE_EMULATION__ +#define __debugsync() __syncthreads() +#else +#define __debugsync() +#endif + +#define TN 256 +#define WARP_COUNT (TN / 32) +#define HWARP_COUNT (TN / 16) + +// Window size +#define WS 20 + + + +struct WrapClamp +{ + int operator()(int i, int h) + { + i = min(max(i, 0), h-1); + } +}; + +struct WrapRepeat +{ + int operator()(int i, int h) + { + i = abs(i) % h; // :( Non power of two! + } +}; + +struct WrapMirror +{ + int operator()(int i, int h) + { + i = abs(i); + while (i >= h) i = 2 * w - i - 2; + } +}; + + +// Vertical convolution filter that processes vertical strips. +__global__ void convolveStrip(float * d_channel, float * d_kernel, int width, int height) +{ + __shared__ float s_kernel[32 * WS]; + + // Preload kernel in shared memory. + for (int i = 0; i < 32 * WS / TN; i++) + { + int idx = i * TN + tid; + if (idx < 32 * WS) s_kernel[idx] = d_kernel[idx]; + } + + __shared__ float s_strip[32 * WS]; // TN/32 + + int wid = tid / 32 - WS/2; + + Mirror wrap; + int row = wrap(wid); + + // Preload image block. + for (int i = 0; i < 32 * WS / TN; i++) + { + } + + // @@ Apply kernel to TN/32 rows. + + // @@ Load + + +} + + + + + + +__constant__ float inputGamma, outputInverseGamma; +__constant__ float kernel[MAX_KERNEL_WIDTH]; + +// Use texture to access input? +// That's the most simple approach. + +texture<> image; + +//////////////////////////////////////////////////////////////////////////////// +// Combined convolution filter +//////////////////////////////////////////////////////////////////////////////// + +__global__ void convolve(float4 * output) +{ + // @@ Use morton order to assing threads. + int x = threadIdx.x; + int y = threadIdx.y; + + float4 color = make_float4(0.0f, 0.0f, 0.0f, 0.0f); + + // texture coordinate. + int2 t; + t.x = 2 * (blockIdx.x * TW + x) - HW; + t.y = blockIdx.y * TH + y; + + // @@ We might want to loop and process strips, to reuse the results of the horizontal convolutions. + + // Horizontal convolution. @@ Unroll loops. + for (int e = HW; e > 0; e--) + { + t.x++; + float w = kernel[e-1]; + color += w * tex2D(image, tc); + } + + for (int e = 0; e < HW; e++) + { + t.x++; + float w = kernel[e]; + color += w * tex2D(image, tc); + } + + // Write color to shared memory. + __shared__ float tile[4 * THREAD_COUNT]; + + int tileIdx = y * TW + x; + tile[tileIdx + 0 * THREAD_COUNT] = color.x; + tile[tileIdx + 1 * THREAD_COUNT] = color.y; + tile[tileIdx + 2 * THREAD_COUNT] = color.z; + tile[tileIdx + 3 * THREAD_COUNT] = color.w; + + __syncthreads(); + + // tile coordinate. + t.x = x; + t.y = y - HW; + + // Vertical convolution. @@ Unroll loops. + for (int i = HW; i > 0; i--) + { + float w = kernel[i-1]; + + t.y++; + int idx = t.y * TW + t.x; + + color.x += w * tile[idx + 0 * THREAD_COUNT]; + color.y += w * tile[idx + 1 * THREAD_COUNT]; + color.z += w * tile[idx + 2 * THREAD_COUNT]; + color.w += w * tile[idx + 3 * THREAD_COUNT]; + } + + for (int i = 0; i < HW; i++) + { + float w = kernel[i]; + + t.y++; + int idx = t.y * TW + t.x; + + color.x += w * tile[idx + 0 * THREAD_COUNT]; + color.y += w * tile[idx + 1 * THREAD_COUNT]; + color.z += w * tile[idx + 2 * THREAD_COUNT]; + color.w += w * tile[idx + 3 * THREAD_COUNT]; + } + + it (x < w && y < h) + { + // @@ Prevent unaligned writes. + + output[y * w + h] = color; + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// Monophase X convolution filter +//////////////////////////////////////////////////////////////////////////////// + +__device__ void convolveY() +{ + +} + + +//////////////////////////////////////////////////////////////////////////////// +// Mipmap convolution filter +//////////////////////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////////////////// +// Gamma correction +//////////////////////////////////////////////////////////////////////////////// + +/* +__device__ float toLinear(float f, float gamma = 2.2f) +{ + return __pow(f, gamma); +} + +__device__ float toGamma(float f, float gamma = 2.2f) +{ + return pow(f, 1.0f / gamma); +} +*/ + + + + +//////////////////////////////////////////////////////////////////////////////// +// Setup kernel +//////////////////////////////////////////////////////////////////////////////// + +extern "C" void setupConvolveKernel(const float * k, int w) +{ + w = min(w, MAX_KERNEL_WIDTH); + cudaMemcpyToSymbol(kernel, k, sizeof(float) * w, 0); +} + + +//////////////////////////////////////////////////////////////////////////////// +// Launch kernel +//////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.cpp b/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.cpp new file mode 100644 index 00000000..c59bedd1 --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.cpp @@ -0,0 +1,380 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CudaCompressDXT.h" +#include "CudaUtils.h" + + +#if defined HAVE_CUDA +#include +#endif + +#include +#include + +using namespace nv; +using namespace nvtt; + +#if defined HAVE_CUDA + +#define MAX_BLOCKS 8192U // 32768, 65535 + + +extern "C" void setupCompressKernel(const float weights[3]); +extern "C" void compressKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); +extern "C" void compressKernelDXT1_Level4(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); +extern "C" void compressWeightedKernelDXT1(uint blockNum, uint * d_data, uint * d_result, uint * d_bitmaps); + +#include "Bitmaps.h" // @@ Rename to BitmapTable.h + +// Convert linear image to block linear. +static void convertToBlockLinear(const Image * image, uint * blockLinearImage) +{ + const uint w = (image->width() + 3) / 4; + const uint h = (image->height() + 3) / 4; + + for(uint by = 0; by < h; by++) { + for(uint bx = 0; bx < w; bx++) { + const uint bw = min(image->width() - bx * 4, 4U); + const uint bh = min(image->height() - by * 4, 4U); + + for (uint i = 0; i < 16; i++) { + const int x = (i % 4) % bw; + const int y = (i / 4) % bh; + blockLinearImage[(by * w + bx) * 16 + i] = image->pixel(bx * 4 + x, by * 4 + y).u; + } + } + } +} + +#endif + + +CudaCompressor::CudaCompressor() : m_bitmapTable(NULL), m_data(NULL), m_result(NULL) +{ +#if defined HAVE_CUDA + // Allocate and upload bitmaps. + cudaMalloc((void**) &m_bitmapTable, 992 * sizeof(uint)); + if (m_bitmapTable != NULL) + { + cudaMemcpy(m_bitmapTable, s_bitmapTable, 992 * sizeof(uint), cudaMemcpyHostToDevice); + } + + // Allocate scratch buffers. + cudaMalloc((void**) &m_data, MAX_BLOCKS * 64U); + cudaMalloc((void**) &m_result, MAX_BLOCKS * 8U); +#endif +} + +CudaCompressor::~CudaCompressor() +{ +#if defined HAVE_CUDA + // Free device mem allocations. + cudaFree(m_data); + cudaFree(m_result); + cudaFree(m_bitmapTable); +#endif +} + +bool CudaCompressor::isValid() const +{ +#if defined HAVE_CUDA + if (cudaGetLastError() != cudaSuccess) + { + return false; + } +#endif + return m_data != NULL && m_result != NULL && m_bitmapTable != NULL; +} + +// @@ This code is very repetitive and needs to be cleaned up. + +void CudaCompressor::setImage(const Image * image, nvtt::AlphaMode alphaMode) +{ + m_image = image; + m_alphaMode = alphaMode; +} + +/// Compress image using CUDA. +void CudaCompressor::compressDXT1(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); // @@ Do this in parallel with the GPU, or in the GPU! + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + clock_t start = clock(); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + // TODO: Add support for multiple GPUs. + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + compressKernelDXT1(count, m_data, m_result, m_bitmapTable); + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + outputOptions.outputHandler->writeData(blockLinearImage, count * 8); + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + +/// Compress image using CUDA. +void CudaCompressor::compressDXT3(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + AlphaBlockDXT3 * alphaBlocks = NULL; + alphaBlocks = (AlphaBlockDXT3 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + clock_t start = clock(); + + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + if (m_alphaMode == AlphaMode_Transparency) + { + compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); + } + else + { + compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); + } + + // Compress alpha in parallel with the GPU. + for (uint i = 0; i < count; i++) + { + ColorBlock rgba(blockLinearImage + (bn + i) * 16); + OptimalCompress::compressDXT3A(rgba, alphaBlocks + i); + } + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + for (uint i = 0; i < count; i++) + { + outputOptions.outputHandler->writeData(alphaBlocks + i, 8); + outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); + } + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(alphaBlocks); + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + +/// Compress image using CUDA. +void CudaCompressor::compressDXT5(const CompressionOptions::Private & compressionOptions, const OutputOptions::Private & outputOptions) +{ + nvDebugCheck(cuda::isHardwarePresent()); +#if defined HAVE_CUDA + + // Image size in blocks. + const uint w = (m_image->width() + 3) / 4; + const uint h = (m_image->height() + 3) / 4; + + uint imageSize = w * h * 16 * sizeof(Color32); + uint * blockLinearImage = (uint *) malloc(imageSize); + convertToBlockLinear(m_image, blockLinearImage); + + const uint blockNum = w * h; + const uint compressedSize = blockNum * 8; + + AlphaBlockDXT5 * alphaBlocks = NULL; + alphaBlocks = (AlphaBlockDXT5 *)malloc(min(compressedSize, MAX_BLOCKS * 8U)); + + setupCompressKernel(compressionOptions.colorWeight.ptr()); + + clock_t start = clock(); + + uint bn = 0; + while(bn != blockNum) + { + uint count = min(blockNum - bn, MAX_BLOCKS); + + cudaMemcpy(m_data, blockLinearImage + bn * 16, count * 64, cudaMemcpyHostToDevice); + + // Launch kernel. + if (m_alphaMode == AlphaMode_Transparency) + { + compressWeightedKernelDXT1(count, m_data, m_result, m_bitmapTable); + } + else + { + compressKernelDXT1_Level4(count, m_data, m_result, m_bitmapTable); + } + + // Compress alpha in parallel with the GPU. + for (uint i = 0; i < count; i++) + { + ColorBlock rgba(blockLinearImage + (bn + i) * 16); + QuickCompress::compressDXT5A(rgba, alphaBlocks + i); + } + + // Check for errors. + cudaError_t err = cudaGetLastError(); + if (err != cudaSuccess) + { + nvDebug("CUDA Error: %s\n", cudaGetErrorString(err)); + + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } + } + + // Copy result to host, overwrite swizzled image. + cudaMemcpy(blockLinearImage, m_result, count * 8, cudaMemcpyDeviceToHost); + + // Output result. + if (outputOptions.outputHandler != NULL) + { + for (uint i = 0; i < count; i++) + { + outputOptions.outputHandler->writeData(alphaBlocks + i, 8); + outputOptions.outputHandler->writeData(blockLinearImage + i * 2, 8); + } + } + + bn += count; + } + + clock_t end = clock(); + //printf("\rCUDA time taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + free(alphaBlocks); + free(blockLinearImage); + +#else + if (outputOptions.errorHandler != NULL) + { + outputOptions.errorHandler->error(Error_CudaError); + } +#endif +} + + diff --git a/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.h b/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.h new file mode 100644 index 00000000..f72baccd --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CudaCompressDXT.h @@ -0,0 +1,61 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_CUDACOMPRESSDXT_H +#define NV_TT_CUDACOMPRESSDXT_H + +#include +#include + +namespace nv +{ + class Image; + + class CudaCompressor + { + public: + CudaCompressor(); + ~CudaCompressor(); + + bool isValid() const; + + void setImage(const Image * image, nvtt::AlphaMode alphaMode); + + void compressDXT1(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT3(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + void compressDXT5(const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions); + + private: + + uint * m_bitmapTable; + uint * m_data; + uint * m_result; + + const Image * m_image; + nvtt::AlphaMode m_alphaMode; + }; + +} // nv namespace + + +#endif // NV_TT_CUDAUTILS_H diff --git a/externals/NVTT/src/nvtt/cuda/CudaMath.h b/externals/NVTT/src/nvtt/cuda/CudaMath.h new file mode 100644 index 00000000..7158070d --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CudaMath.h @@ -0,0 +1,260 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +// Math functions and operators to be used with vector types. + +#ifndef CUDAMATH_H +#define CUDAMATH_H + +#include + + +inline __device__ __host__ float3 operator *(float3 a, float3 b) +{ + return make_float3(a.x*b.x, a.y*b.y, a.z*b.z); +} + +inline __device__ __host__ float3 operator *(float f, float3 v) +{ + return make_float3(v.x*f, v.y*f, v.z*f); +} + +inline __device__ __host__ float3 operator *(float3 v, float f) +{ + return make_float3(v.x*f, v.y*f, v.z*f); +} + +inline __device__ __host__ float3 operator +(float3 a, float3 b) +{ + return make_float3(a.x+b.x, a.y+b.y, a.z+b.z); +} + +inline __device__ __host__ void operator +=(float3 & b, float3 a) +{ + b.x += a.x; + b.y += a.y; + b.z += a.z; +} + +inline __device__ __host__ float3 operator -(float3 a, float3 b) +{ + return make_float3(a.x-b.x, a.y-b.y, a.z-b.z); +} + +inline __device__ __host__ void operator -=(float3 & b, float3 a) +{ + b.x -= a.x; + b.y -= a.y; + b.z -= a.z; +} + +inline __device__ __host__ float3 operator /(float3 v, float f) +{ + float inv = 1.0f / f; + return v * inv; +} + +inline __device__ __host__ void operator /=(float3 & b, float f) +{ + float inv = 1.0f / f; + b.x *= inv; + b.y *= inv; + b.z *= inv; +} + +inline __device__ __host__ bool operator ==(float3 a, float3 b) +{ + return a.x == b.x && a.y == b.y && a.z == b.z; +} + +inline __device__ __host__ float dot(float3 a, float3 b) +{ + return a.x * b.x + a.y * b.y + a.z * b.z; +} + +inline __device__ __host__ float dot(float4 a, float4 b) +{ + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; +} + +inline __device__ __host__ float clamp(float f, float a, float b) +{ + return max(a, min(f, b)); +} + +inline __device__ __host__ float3 clamp(float3 v, float a, float b) +{ + return make_float3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); +} + +inline __device__ __host__ float3 clamp(float3 v, float3 a, float3 b) +{ + return make_float3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.z, b.z)); +} + + +inline __device__ __host__ float3 normalize(float3 v) +{ + float len = 1.0f / sqrtf(dot(v, v)); + return make_float3(v.x * len, v.y * len, v.z * len); +} + + + + +// Use power method to find the first eigenvector. +// http://www.miislita.com/information-retrieval-tutorial/matrix-tutorial-3-eigenvalues-eigenvectors.html +inline __device__ __host__ float3 firstEigenVector( float matrix[6] ) +{ + // 8 iterations seems to be more than enough. + + float3 row0 = make_float3(matrix[0], matrix[1], matrix[2]); + float3 row1 = make_float3(matrix[1], matrix[3], matrix[4]); + float3 row2 = make_float3(matrix[2], matrix[4], matrix[5]); + + float r0 = dot(row0, row0); + float r1 = dot(row1, row1); + float r2 = dot(row2, row2); + + float3 v; + if (r0 > r1 && r0 > r2) v = row0; + else if (r1 > r2) v = row1; + else v = row2; + + //float3 v = make_float3(1.0f, 1.0f, 1.0f); + for(int i = 0; i < 8; i++) { + float x = v.x * matrix[0] + v.y * matrix[1] + v.z * matrix[2]; + float y = v.x * matrix[1] + v.y * matrix[3] + v.z * matrix[4]; + float z = v.x * matrix[2] + v.y * matrix[4] + v.z * matrix[5]; + float m = max(max(x, y), z); + float iv = 1.0f / m; + if (m == 0.0f) iv = 0.0f; + v = make_float3(x*iv, y*iv, z*iv); + } + + return v; +} + +inline __device__ bool singleColor(const float3 * colors) +{ +#if __DEVICE_EMULATION__ + bool sameColor = false; + for (int i = 0; i < 16; i++) + { + sameColor &= (colors[i] == colors[0]); + } + return sameColor; +#else + __shared__ int sameColor[16]; + + const int idx = threadIdx.x; + + sameColor[idx] = (colors[idx] == colors[0]); + sameColor[idx] &= sameColor[idx^8]; + sameColor[idx] &= sameColor[idx^4]; + sameColor[idx] &= sameColor[idx^2]; + sameColor[idx] &= sameColor[idx^1]; + + return sameColor[0]; +#endif +} + +inline __device__ void colorSums(const float3 * colors, float3 * sums) +{ +#if __DEVICE_EMULATION__ + float3 color_sum = make_float3(0.0f, 0.0f, 0.0f); + for (int i = 0; i < 16; i++) + { + color_sum += colors[i]; + } + + for (int i = 0; i < 16; i++) + { + sums[i] = color_sum; + } +#else + + const int idx = threadIdx.x; + + sums[idx] = colors[idx]; + sums[idx] += sums[idx^8]; + sums[idx] += sums[idx^4]; + sums[idx] += sums[idx^2]; + sums[idx] += sums[idx^1]; + +#endif +} + +inline __device__ float3 bestFitLine(const float3 * colors, float3 color_sum, float3 colorMetric) +{ + // Compute covariance matrix of the given colors. +#if __DEVICE_EMULATION__ + float covariance[6] = {0, 0, 0, 0, 0, 0}; + for (int i = 0; i < 16; i++) + { + float3 a = (colors[i] - color_sum * (1.0f / 16.0f)) * colorMetric; + covariance[0] += a.x * a.x; + covariance[1] += a.x * a.y; + covariance[2] += a.x * a.z; + covariance[3] += a.y * a.y; + covariance[4] += a.y * a.z; + covariance[5] += a.z * a.z; + } +#else + + const int idx = threadIdx.x; + + float3 diff = (colors[idx] - color_sum * (1.0f / 16.0f)) * colorMetric; + + // @@ Eliminate two-way bank conflicts here. + // @@ It seems that doing that and unrolling the reduction doesn't help... + __shared__ float covariance[16*6]; + + covariance[6 * idx + 0] = diff.x * diff.x; // 0, 6, 12, 2, 8, 14, 4, 10, 0 + covariance[6 * idx + 1] = diff.x * diff.y; + covariance[6 * idx + 2] = diff.x * diff.z; + covariance[6 * idx + 3] = diff.y * diff.y; + covariance[6 * idx + 4] = diff.y * diff.z; + covariance[6 * idx + 5] = diff.z * diff.z; + + for(int d = 8; d > 0; d >>= 1) + { + if (idx < d) + { + covariance[6 * idx + 0] += covariance[6 * (idx+d) + 0]; + covariance[6 * idx + 1] += covariance[6 * (idx+d) + 1]; + covariance[6 * idx + 2] += covariance[6 * (idx+d) + 2]; + covariance[6 * idx + 3] += covariance[6 * (idx+d) + 3]; + covariance[6 * idx + 4] += covariance[6 * (idx+d) + 4]; + covariance[6 * idx + 5] += covariance[6 * (idx+d) + 5]; + } + } + +#endif + + // Compute first eigen vector. + return firstEigenVector(covariance); +} + + +#endif // CUDAMATH_H diff --git a/externals/NVTT/src/nvtt/cuda/CudaUtils.cpp b/externals/NVTT/src/nvtt/cuda/CudaUtils.cpp new file mode 100644 index 00000000..49de873c --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CudaUtils.cpp @@ -0,0 +1,300 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include "CudaUtils.h" + +#if defined HAVE_CUDA +#include +#include +#endif + +using namespace nv; +using namespace cuda; + +/* @@ Move this to win32 utils or somewhere else. +#if NV_OS_WIN32 + +#define WINDOWS_LEAN_AND_MEAN +#include + +static bool isWindowsVista() +{ +OSVERSIONINFO osvi; +osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + +::GetVersionEx(&osvi); +return osvi.dwMajorVersion >= 6; +} + + +typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); + +static bool isWow32() +{ +LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process"); + +BOOL bIsWow64 = FALSE; + +if (NULL != fnIsWow64Process) +{ +if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) +{ +// Assume 32 bits. +return true; +} +} + +return !bIsWow64; +} + +#endif +*/ + + +static bool isCudaDriverAvailable(int version) +{ +#if defined HAVE_CUDA +#if NV_OS_WIN32 + Library nvcuda("nvcuda.dll"); +#else + Library nvcuda(NV_LIBRARY_NAME(cuda)); +#endif + + if (!nvcuda.isValid()) + { + nvDebug("*** CUDA driver not found.\n"); + return false; + } + + if (version >= 2000) + { + void * address = nvcuda.bindSymbol("cuStreamCreate"); + if (address == NULL) { + nvDebug("*** CUDA driver version < 2.0.\n"); + return false; + } + } + + if (version >= 2010) + { + void * address = nvcuda.bindSymbol("cuModuleLoadDataEx"); + if (address == NULL) { + nvDebug("*** CUDA driver version < 2.1.\n"); + return false; + } + } + + if (version >= 2020) + { + typedef CUresult (CUDAAPI * PFCU_DRIVERGETVERSION)(int * version); + + PFCU_DRIVERGETVERSION driverGetVersion = (PFCU_DRIVERGETVERSION)nvcuda.bindSymbol("cuDriverGetVersion"); + if (driverGetVersion == NULL) { + nvDebug("*** CUDA driver version < 2.2.\n"); + return false; + } + + int driverVersion; + CUresult err = driverGetVersion(&driverVersion); + if (err != CUDA_SUCCESS) { + nvDebug("*** Error querying driver version: '%s'.\n", cudaGetErrorString((cudaError_t)err)); + return false; + } + + return driverVersion >= version; + } +#endif // HAVE_CUDA + + return true; +} + + +/// Determine if CUDA is available. +bool nv::cuda::isHardwarePresent() +{ +#if defined HAVE_CUDA + // Make sure that CUDA driver matches CUDA runtime. + if (!isCudaDriverAvailable(CUDART_VERSION)) + { + nvDebug("CUDA driver not available for CUDA runtime %d\n", CUDART_VERSION); + return false; + } + + int count = deviceCount(); + if (count == 1) + { + // Make sure it's not an emulation device. + cudaDeviceProp deviceProp; + cudaGetDeviceProperties(&deviceProp, 0); + + // deviceProp.name != Device Emulation (CPU) + if (deviceProp.major == -1 || deviceProp.minor == -1) + { + return false; + } + } + + // @@ Make sure that warp size == 32 + + // @@ Make sure available GPU is faster than the CPU. + + return count > 0; +#else + return false; +#endif +} + +/// Get number of CUDA enabled devices. +int nv::cuda::deviceCount() +{ +#if defined HAVE_CUDA + int gpuCount = 0; + + cudaError_t result = cudaGetDeviceCount(&gpuCount); + + if (result == cudaSuccess) + { + return gpuCount; + } +#endif + return 0; +} + + +// Make sure device meets requirements: +// - Not an emulation device. +// - Not an integrated device? +// - Faster than CPU. +bool nv::cuda::isValidDevice(int i) +{ +#if defined HAVE_CUDA + + cudaDeviceProp device_properties; + cudaGetDeviceProperties(&device_properties, i); + int gflops = device_properties.multiProcessorCount * device_properties.clockRate; + + if (device_properties.major == -1 || device_properties.minor == -1) { + // Emulation device. + return false; + } + +#if CUDART_VERSION >= 2030 // 2.3 + /*if (device_properties.integrated) + { + // Integrated devices. + return false; + }*/ +#endif + + return true; +#else + return false; +#endif +} + +int nv::cuda::getFastestDevice() +{ + int max_gflops_device = -1; +#if defined HAVE_CUDA + int max_gflops = 0; + + const int device_count = deviceCount(); + for (int i = 0; i < device_count; i++) + { + if (isValidDevice(i)) + { + cudaDeviceProp device_properties; + cudaGetDeviceProperties(&device_properties, i); + int gflops = device_properties.multiProcessorCount * device_properties.clockRate; + + if (gflops > max_gflops) + { + max_gflops = gflops; + max_gflops_device = i; + } + } + } +#endif + return max_gflops_device; +} + + +/// Activate the given devices. +bool nv::cuda::initDevice(int * device_ptr) +{ + nvDebugCheck(device_ptr != NULL); +#if defined HAVE_CUDA + +#if CUDART_VERSION >= 2030 // 2.3 + + // Set device flags to yield in order to play nice with other threads and to find out if CUDA was already active. + cudaError_t resul = cudaSetDeviceFlags(cudaDeviceScheduleYield); + +#endif + + int device = getFastestDevice(); + + if (device == -1) + { + // No device is fast enough. + *device_ptr = -1; + return false; + } + + // Select CUDA device. + cudaError_t result = cudaSetDevice(device); + + if (result == cudaErrorSetOnActiveProcess) + { + int device; + result = cudaGetDevice(&device); + + *device_ptr = -1; // No device to cleanup. + return isValidDevice(device); // Return true if device is valid. + } + else if (result != cudaSuccess) + { + nvDebug("*** CUDA Error: %s\n", cudaGetErrorString(result)); + *device_ptr = -1; + return false; + } + + *device_ptr = device; + return true; +#else + return false; +#endif +} + +void nv::cuda::exitDevice() +{ +#if defined HAVE_CUDA + cudaError_t result = cudaThreadExit(); + + if (result != cudaSuccess) { + nvDebug("*** CUDA Error: %s\n", cudaGetErrorString(result)); + } +#endif +} diff --git a/externals/NVTT/src/nvtt/cuda/CudaUtils.h b/externals/NVTT/src/nvtt/cuda/CudaUtils.h new file mode 100644 index 00000000..7128b4d1 --- /dev/null +++ b/externals/NVTT/src/nvtt/cuda/CudaUtils.h @@ -0,0 +1,44 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_CUDAUTILS_H +#define NV_TT_CUDAUTILS_H + +namespace nv +{ + + namespace cuda + { + bool isHardwarePresent(); + int deviceCount(); + int getFastestDevice(); + bool isValidDevice(int i); + + bool initDevice(int * device_ptr); + void exitDevice(); + }; + +} // nv namespace + + +#endif // NV_TT_CUDAUTILS_H diff --git a/externals/NVTT/src/nvtt/nvtt.cpp b/externals/NVTT/src/nvtt/nvtt.cpp new file mode 100644 index 00000000..13140fd1 --- /dev/null +++ b/externals/NVTT/src/nvtt/nvtt.cpp @@ -0,0 +1,55 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include "nvtt.h" + +using namespace nvtt; + +/// Return a string for the given error. +const char * nvtt::errorString(Error e) +{ + switch(e) + { + case Error_Unknown: + return "Unknown error"; + case Error_InvalidInput: + return "Invalid input"; + case Error_UnsupportedFeature: + return "Unsupported feature"; + case Error_CudaError: + return "CUDA error"; + case Error_FileOpen: + return "Error opening file"; + case Error_FileWrite: + return "Error writing through output handler"; + } + + return "Invalid error"; +} + +/// Return NVTT version. +unsigned int nvtt::version() +{ + return NVTT_VERSION; +} + diff --git a/externals/NVTT/src/nvtt/nvtt.h b/externals/NVTT/src/nvtt/nvtt.h new file mode 100644 index 00000000..6ce6deb9 --- /dev/null +++ b/externals/NVTT/src/nvtt/nvtt.h @@ -0,0 +1,308 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NV_TT_H +#define NV_TT_H + +// Function linkage +#if NVTT_SHARED + +#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__ +# ifdef NVTT_EXPORTS +# define NVTT_API __declspec(dllexport) +# else +# define NVTT_API __declspec(dllimport) +# endif +#endif + +#if defined __GNUC__ >= 4 +# ifdef NVTT_EXPORTS +# define NVTT_API __attribute__((visibility("default"))) +# endif +#endif + +#endif // NVTT_SHARED + +#if !defined NVTT_API +# define NVTT_API +#endif + +#define NVTT_VERSION 200 + +#define NVTT_DECLARE_PIMPL(Class) \ + private: \ + Class(const Class &); \ + void operator=(const Class &); \ + public: \ + struct Private; \ + Private & m + + +// Public interface. +namespace nvtt +{ + /// Supported compression formats. + enum Format + { + // No compression. + Format_RGB, + Format_RGBA = Format_RGB, + + // DX9 formats. + Format_DXT1, + Format_DXT1a, // DXT1 with binary alpha. + Format_DXT3, + Format_DXT5, + Format_DXT5n, // Compressed HILO: R=1, G=y, B=0, A=x + + // DX10 formats. + Format_BC1 = Format_DXT1, + Format_BC1a = Format_DXT1a, + Format_BC2 = Format_DXT3, + Format_BC3 = Format_DXT5, + Format_BC3n = Format_DXT5n, + Format_BC4, // ATI1 + Format_BC5, // 3DC, ATI2 + }; + + /// Quality modes. + enum Quality + { + Quality_Fastest, + Quality_Normal, + Quality_Production, + Quality_Highest, + }; + + /// Compression options. This class describes the desired compression format and other compression settings. + struct CompressionOptions + { + NVTT_DECLARE_PIMPL(CompressionOptions); + + NVTT_API CompressionOptions(); + NVTT_API ~CompressionOptions(); + + NVTT_API void reset(); + + NVTT_API void setFormat(Format format); + NVTT_API void setQuality(Quality quality); + NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f); + + NVTT_API void setExternalCompressor(const char * name); + + // Set color mask to describe the RGB/RGBA format. + NVTT_API void setPixelFormat(unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask); + + NVTT_API void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127); + }; + + + /// Wrap modes. + enum WrapMode + { + WrapMode_Clamp, + WrapMode_Repeat, + WrapMode_Mirror, + }; + + /// Texture types. + enum TextureType + { + TextureType_2D, + TextureType_Cube, + // TextureType_3D, + }; + + /// Input formats. + enum InputFormat + { + InputFormat_BGRA_8UB, + // InputFormat_RGBE_8UB, + // InputFormat_BGRA_32F, + }; + + /// Mipmap downsampling filters. + enum MipmapFilter + { + MipmapFilter_Box, ///< Box filter is quite good and very fast. + MipmapFilter_Triangle, ///< Triangle filter blurs the results too much, but that might be what you want. + MipmapFilter_Kaiser, ///< Kaiser-windowed Sinc filter is the best downsampling filter. + }; + + /// Color transformation. + enum ColorTransform + { + ColorTransform_None, + ColorTransform_Linear, + }; + + /// Extents rounding mode. + enum RoundMode + { + RoundMode_None, + RoundMode_ToNextPowerOfTwo, + RoundMode_ToNearestPowerOfTwo, + RoundMode_ToPreviousPowerOfTwo, + }; + + /// Alpha mode. + enum AlphaMode + { + AlphaMode_None, + AlphaMode_Transparency, + AlphaMode_Premultiplied, + }; + + /// Input options. Specify format and layout of the input texture. + struct InputOptions + { + NVTT_DECLARE_PIMPL(InputOptions); + + NVTT_API InputOptions(); + NVTT_API ~InputOptions(); + + // Set default options. + NVTT_API void reset(); + + // Setup input layout. + NVTT_API void setTextureLayout(TextureType type, int w, int h, int d = 1); + NVTT_API void resetTextureLayout(); + + // Set mipmap data. Copies the data. + NVTT_API bool setMipmapData(const void * data, int w, int h, int d = 1, int face = 0, int mipmap = 0); + + // Describe the format of the input. + NVTT_API void setFormat(InputFormat format); + + // Set the way the input alpha channel is interpreted. + NVTT_API void setAlphaMode(AlphaMode alphaMode); + + // Set gamma settings. + NVTT_API void setGamma(float inputGamma, float outputGamma); + + // Set texture wrappign mode. + NVTT_API void setWrapMode(WrapMode mode); + + // Set mipmapping options. + NVTT_API void setMipmapFilter(MipmapFilter filter); + NVTT_API void setMipmapGeneration(bool enabled, int maxLevel = -1); + NVTT_API void setKaiserParameters(float width, float alpha, float stretch); + + // Set normal map options. + NVTT_API void setNormalMap(bool b); + NVTT_API void setConvertToNormalMap(bool convert); + NVTT_API void setHeightEvaluation(float redScale, float greenScale, float blueScale, float alphaScale); + NVTT_API void setNormalFilter(float sm, float medium, float big, float large); + NVTT_API void setNormalizeMipmaps(bool b); + + // Set color transforms. @@ Not implemented! + NVTT_API void setColorTransform(ColorTransform t); + NVTT_API void setLinearTransform(int channel, float w0, float w1, float w2, float w3); + + // Set resizing options. + NVTT_API void setMaxExtents(int d); + NVTT_API void setRoundMode(RoundMode mode); + }; + + + /// Output handler. + struct OutputHandler + { + virtual ~OutputHandler() {} + + /// Indicate the start of a new compressed image that's part of the final texture. + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) = 0; + + /// Output data. Compressed data is output as soon as it's generated to minimize memory allocations. + virtual bool writeData(const void * data, int size) = 0; + }; + + /// Error codes. + enum Error + { + Error_Unknown, + Error_InvalidInput, + Error_UnsupportedFeature, + Error_CudaError, + Error_FileOpen, + Error_FileWrite, + }; + + /// Error handler. + struct ErrorHandler + { + virtual ~ErrorHandler() {} + + // Signal error. + virtual void error(Error e) = 0; + }; + + + /// Output Options. This class holds pointers to the interfaces that are used to report the output of + /// the compressor to the user. + struct OutputOptions + { + NVTT_DECLARE_PIMPL(OutputOptions); + + NVTT_API OutputOptions(); + NVTT_API ~OutputOptions(); + + // Set default options. + NVTT_API void reset(); + + NVTT_API void setFileName(const char * fileName); + + NVTT_API void setOutputHandler(OutputHandler * outputHandler); + NVTT_API void setErrorHandler(ErrorHandler * errorHandler); + NVTT_API void setOutputHeader(bool outputHeader); + }; + + + /// Texture compressor. + struct Compressor + { + NVTT_DECLARE_PIMPL(Compressor); + + NVTT_API Compressor(); + NVTT_API ~Compressor(); + + NVTT_API void enableCudaAcceleration(bool enable); + NVTT_API bool isCudaAccelerationEnabled() const; + + // Main entrypoint of the compression library. + NVTT_API bool process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const; + + // Estimate the size of compressing the input with the given options. + NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const; + }; + + + // Return string for the given error code. + NVTT_API const char * errorString(Error e); + + // Return NVTT version. + NVTT_API unsigned int version(); + +} // nvtt namespace + +#endif // NV_TT_H diff --git a/externals/NVTT/src/nvtt/nvtt_wrapper.cpp b/externals/NVTT/src/nvtt/nvtt_wrapper.cpp new file mode 100644 index 00000000..136a99d7 --- /dev/null +++ b/externals/NVTT/src/nvtt/nvtt_wrapper.cpp @@ -0,0 +1,208 @@ + +#include "nvtt.h" +#include "nvtt_wrapper.h" + + +// InputOptions class. +NvttInputOptions * nvttCreateInputOptions() +{ + return new nvtt::InputOptions(); +} + +void nvttDestroyInputOptions(NvttInputOptions * inputOptions) +{ + delete inputOptions; +} + +void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d) +{ + inputOptions->setTextureLayout((nvtt::TextureType)type, w, h, d); +} + +void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions) +{ + inputOptions->resetTextureLayout(); +} + +NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap) +{ + return (NvttBoolean)inputOptions->setMipmapData(data, w, h, d, face, mipmap); +} + +void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format) +{ + inputOptions->setFormat((nvtt::InputFormat)format); +} + +void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode) +{ + inputOptions->setAlphaMode((nvtt::AlphaMode)alphaMode); +} + +void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma) +{ + inputOptions->setGamma(inputGamma, outputGamma); +} + +void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode) +{ + inputOptions->setWrapMode((nvtt::WrapMode)mode); +} + +void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter) +{ + inputOptions->setMipmapFilter((nvtt::MipmapFilter)filter); +} + +void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel) +{ + inputOptions->setMipmapGeneration(enabled != NVTT_False, maxLevel); +} + +void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch) +{ + inputOptions->setKaiserParameters(width, alpha, stretch); +} + +void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b) +{ + inputOptions->setNormalMap(b != NVTT_False); +} + +void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert) +{ + inputOptions->setConvertToNormalMap(convert != NVTT_False); +} + +void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale) +{ + inputOptions->setHeightEvaluation(redScale, greenScale, blueScale, alphaScale); +} + +void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float small, float medium, float big, float large) +{ + inputOptions->setNormalFilter(small, medium, big, large); +} + +void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b) +{ + inputOptions->setNormalizeMipmaps(b != NVTT_False); +} + +void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t) +{ + inputOptions->setColorTransform((nvtt::ColorTransform)t); +} + +void nvttSetInputOptionsLinearTransfrom(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3) +{ + inputOptions->setLinearTransform(channel, w0, w1, w2, w3); +} + +void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim) +{ + inputOptions->setMaxExtents(dim); +} + +void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode) +{ + inputOptions->setRoundMode((nvtt::RoundMode)mode); +} + + +// CompressionOptions class. +NvttCompressionOptions * nvttCreateCompressionOptions() +{ + return new nvtt::CompressionOptions(); +} + +void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions) +{ + delete compressionOptions; +} + +void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format) +{ + compressionOptions->setFormat((nvtt::Format)format); +} + +void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality) +{ + compressionOptions->setQuality((nvtt::Quality)quality); +} + +void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha) +{ + compressionOptions->setColorWeights(red, green, blue, alpha); +} + +/*void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable) +{ + compressionOptions->enableCudaCompression(enable != NVTT_False); +}*/ + +void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask) +{ + compressionOptions->setPixelFormat(bitcount, rmask, gmask, bmask, amask); +} + +void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold) +{ + compressionOptions->setQuantization(colorDithering != NVTT_False, alphaDithering != NVTT_False, binaryAlpha != NVTT_False, alphaThreshold); +} + + +// OutputOptions class. +NvttOutputOptions * nvttCreateOutputOptions() +{ + return new nvtt::OutputOptions(); +} + +void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions) +{ + delete outputOptions; +} + +void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName) +{ + outputOptions->setFileName(fileName); +} + +void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b) +{ + outputOptions->setOutputHeader(b != NVTT_False); +} +/* +void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler) +{ + outputOptions->setErrorHandler(errorHandler); +} + +void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler) +{ +} +*/ + + +// Compressor class. +NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions) +{ + return (NvttBoolean)compressor->process(*inputOptions, *compressionOptions, *outputOptions); +} + +int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions) +{ + return compressor->estimateSize(*inputOptions, *compressionOptions); +} + + +// Global functions. +const char * nvttErrorString(NvttError e) +{ + return nvtt::errorString((nvtt::Error)e); +} + +unsigned int nvttVersion() +{ + return nvtt::version(); +} diff --git a/externals/NVTT/src/nvtt/nvtt_wrapper.h b/externals/NVTT/src/nvtt/nvtt_wrapper.h new file mode 100644 index 00000000..b8407e22 --- /dev/null +++ b/externals/NVTT/src/nvtt/nvtt_wrapper.h @@ -0,0 +1,241 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef NVTT_WRAPPER_H +#define NVTT_WRAPPER_H + +// Function linkage +#if NVTT_SHARED + +#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__ +# ifdef NVTT_EXPORTS +# define NVTT_API __declspec(dllexport) +# else +# define NVTT_API __declspec(dllimport) +# endif +#endif + +#if defined __GNUC__ >= 4 +# ifdef NVTT_EXPORTS +# define NVTT_API __attribute__((visibility("default"))) +# endif +#endif + +#endif // NVTT_SHARED + +#if !defined NVTT_API +# define NVTT_API +#endif + +#define NVTT_VERSION 200 + +#ifdef __cplusplus +typedef struct nvtt::InputOptions NvttInputOptions; +typedef struct nvtt::CompressionOptions NvttCompressionOptions; +typedef struct nvtt::OutputOptions NvttOutputOptions; +typedef struct nvtt::Compressor NvttCompressor; +#else +typedef struct NvttInputOptions NvttInputOptions; +typedef struct NvttCompressionOptions NvttCompressionOptions; +typedef struct NvttOutputOptions NvttOutputOptions; +typedef struct NvttCompressor NvttCompressor; +#endif + +/// Supported compression formats. +typedef enum +{ + // No compression. + NVTT_Format_RGB, + NVTT_Format_RGBA = NVTT_Format_RGB, + + // DX9 formats. + NVTT_Format_DXT1, + NVTT_Format_DXT1a, + NVTT_Format_DXT3, + NVTT_Format_DXT5, + NVTT_Format_DXT5n, + + // DX10 formats. + NVTT_Format_BC1 = NVTT_Format_DXT1, + NVTT_Format_BC1a = NVTT_Format_DXT1a, + NVTT_Format_BC2 = NVTT_Format_DXT3, + NVTT_Format_BC3 = NVTT_Format_DXT5, + NVTT_Format_BC3n = NVTT_Format_DXT5n, + NVTT_Format_BC4, + NVTT_Format_BC5, +} NvttFormat; + +/// Quality modes. +typedef enum +{ + NVTT_Quality_Fastest, + NVTT_Quality_Normal, + NVTT_Quality_Production, + NVTT_Quality_Highest, +} NvttQuality; + +/// Wrap modes. +typedef enum +{ + NVTT_WrapMode_Clamp, + NVTT_WrapMode_Repeat, + NVTT_WrapMode_Mirror, +} NvttWrapMode; + +/// Texture types. +typedef enum +{ + NVTT_TextureType_2D, + NVTT_TextureType_Cube, +} NvttTextureType; + +/// Input formats. +typedef enum +{ + NVTT_InputFormat_BGRA_8UB, +} NvttInputFormat; + +/// Mipmap downsampling filters. +typedef enum +{ + NVTT_MipmapFilter_Box, + NVTT_MipmapFilter_Triangle, + NVTT_MipmapFilter_Kaiser, +} NvttMipmapFilter; + +/// Color transformation. +typedef enum +{ + NVTT_ColorTransform_None, + NVTT_ColorTransform_Linear, +} NvttColorTransform; + +/// Extents rounding mode. +typedef enum +{ + NVTT_RoundMode_None, + NVTT_RoundMode_ToNextPowerOfTwo, + NVTT_RoundMode_ToNearestPowerOfTwo, + NVTT_RoundMode_ToPreviousPowerOfTwo, +} NvttRoundMode; + +/// Alpha mode. +typedef enum +{ + NVTT_AlphaMode_None, + NVTT_AlphaMode_Transparency, + NVTT_AlphaMode_Premultiplied, +} NvttAlphaMode; + +typedef enum +{ + NVTT_Error_InvalidInput, + NVTT_Error_UserInterruption, + NVTT_Error_UnsupportedFeature, + NVTT_Error_CudaError, + NVTT_Error_Unknown, + NVTT_Error_FileOpen, + NVTT_Error_FileWrite, +} NvttError; + +typedef enum +{ + NVTT_False, + NVTT_True, +} NvttBoolean; + + +#ifdef __cplusplus +extern "C" { +#endif + +// Callbacks +//typedef void (* nvttErrorHandler)(NvttError e); +//typedef void (* nvttOutputHandler)(const void * data, int size); +//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel); + + +// InputOptions class. +NVTT_API NvttInputOptions * nvttCreateInputOptions(); +NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions); + +NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d); +NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions); +NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap); +NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format); +NVTT_API void nvttSetInputOptionsAlphaMode(NvttInputOptions * inputOptions, NvttAlphaMode alphaMode); +NVTT_API void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma, float outputGamma); +NVTT_API void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode); +NVTT_API void nvttSetInputOptionsMipmapFilter(NvttInputOptions * inputOptions, NvttMipmapFilter filter); +NVTT_API void nvttSetInputOptionsMipmapGeneration(NvttInputOptions * inputOptions, NvttBoolean enabled, int maxLevel); +NVTT_API void nvttSetInputOptionsKaiserParameters(NvttInputOptions * inputOptions, float width, float alpha, float stretch); +NVTT_API void nvttSetInputOptionsNormalMap(NvttInputOptions * inputOptions, NvttBoolean b); +NVTT_API void nvttSetInputOptionsConvertToNormalMap(NvttInputOptions * inputOptions, NvttBoolean convert); +NVTT_API void nvttSetInputOptionsHeightEvaluation(NvttInputOptions * inputOptions, float redScale, float greenScale, float blueScale, float alphaScale); +NVTT_API void nvttSetInputOptionsNormalFilter(NvttInputOptions * inputOptions, float sm, float medium, float big, float large); +NVTT_API void nvttSetInputOptionsNormalizeMipmaps(NvttInputOptions * inputOptions, NvttBoolean b); +NVTT_API void nvttSetInputOptionsColorTransform(NvttInputOptions * inputOptions, NvttColorTransform t); +NVTT_API void nvttSetInputOptionsLinearTransform(NvttInputOptions * inputOptions, int channel, float w0, float w1, float w2, float w3); +NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int dim); +NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode); + + +// CompressionOptions class. +NVTT_API NvttCompressionOptions * nvttCreateCompressionOptions(); +NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions); + +NVTT_API void nvttSetCompressionOptionsFormat(NvttCompressionOptions * compressionOptions, NvttFormat format); +NVTT_API void nvttSetCompressionOptionsQuality(NvttCompressionOptions * compressionOptions, NvttQuality quality); +NVTT_API void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionOptions, float red, float green, float blue, float alpha); +NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask); +NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold); + + +// OutputOptions class. +NVTT_API NvttOutputOptions * nvttCreateOutputOptions(); +NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions); + +NVTT_API void nvttSetOutputOptionsFileName(NvttOutputOptions * outputOptions, const char * fileName); +NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions, NvttBoolean b); +//NVTT_API void nvttSetOutputOptionsErrorHandler(NvttOutputOptions * outputOptions, nvttErrorHandler errorHandler); +//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler); + + +// Compressor class. +NVTT_API NvttCompressor * nvttCreateCompressor(); +NVTT_API void nvttDestroyCompressor(NvttCompressor * compressor); + +NVTT_API NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions); +NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions); + + +// Global functions. +NVTT_API const char * nvttErrorString(NvttError e); +NVTT_API unsigned int nvttVersion(); + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // NVTT_WRAPPER_H diff --git a/externals/NVTT/src/nvtt/squish/CMakeLists.txt b/externals/NVTT/src/nvtt/squish/CMakeLists.txt new file mode 100644 index 00000000..2edc683f --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/CMakeLists.txt @@ -0,0 +1,28 @@ +PROJECT(squish) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) + +SET(SQUISH_SRCS + fastclusterfit.cpp + fastclusterfit.h + weightedclusterfit.cpp + weightedclusterfit.h + colourblock.cpp + colourblock.h + colourfit.cpp + colourfit.h + colourset.cpp + colourset.h + config.h + maths.cpp + maths.h + simd.h + simd_sse.h + simd_ve.h) + +ADD_LIBRARY(squish STATIC ${SQUISH_SRCS}) + +IF(CMAKE_COMPILER_IS_GNUCXX) + SET_TARGET_PROPERTIES(squish PROPERTIES COMPILE_FLAGS -fPIC) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) + diff --git a/externals/NVTT/src/nvtt/squish/ChangeLog b/externals/NVTT/src/nvtt/squish/ChangeLog new file mode 100644 index 00000000..e074a891 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/ChangeLog @@ -0,0 +1,38 @@ + +1.7 +* Fixed floating-point equality issue in clusterfit sort (x86 affected only) +* Implemented proper SSE(2) floor function for 50% speedup on SSE builds +* The range fit implementation now uses the correct colour metric + +1.6 +* Fixed bug in CompressImage where masked pixels were not skipped over +* DXT3 and DXT5 alpha compression now properly use the mask to ignore pixels +* Fixed major DXT1 bug that can generate unexpected transparent pixels + +1.5 +* Added CompressMasked function to handle incomplete DXT blocks more cleanly +* Added kWeightColourByAlpha flag for better quality images when alpha blending + +1.4 +* Fixed stack overflow in rangefit + +1.3 +* Worked around SSE floor implementation bug, proper fix needed! +* This release has visual studio and makefile builds that work + +1.2 +* Added provably optimal single colour compressor +* Added extra/squishgen.cpp that generates single colour lookup tables + +1.1 +* Fixed a DXT1 colour output bug +* Changed argument order for Decompress function to match Compress +* Added GetStorageRequirements function +* Added CompressImage function +* Added DecompressImage function +* Moved squishtool.cpp to extra/squishpng.cpp +* Added extra/squishtest.cpp + +1.0 +* Initial release + diff --git a/externals/NVTT/src/nvtt/squish/Doxyfile b/externals/NVTT/src/nvtt/squish/Doxyfile new file mode 100644 index 00000000..3ec51e4b --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/Doxyfile @@ -0,0 +1,223 @@ +# Doxyfile 1.4.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = squish +PROJECT_NUMBER = 1.1 +OUTPUT_DIRECTORY = docs +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = squish.h +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = /Applications/Graphviz.app/Contents/MacOS +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/externals/NVTT/src/nvtt/squish/Makefile b/externals/NVTT/src/nvtt/squish/Makefile new file mode 100644 index 00000000..75a72fec --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/Makefile @@ -0,0 +1,31 @@ + +include config + +SRC = alpha.cpp clusterfit.cpp colourblock.cpp colourfit.cpp colourset.cpp maths.cpp rangefit.cpp singlecolourfit.cpp squish.cpp + +OBJ = $(SRC:%.cpp=%.o) + +LIB = libsquish.a + +all : $(LIB) + +install : $(LIB) + install squish.h $(INSTALL_DIR)/include + install libsquish.a $(INSTALL_DIR)/lib + +uninstall: + $(RM) $(INSTALL_DIR)/include/squish.h + $(RM) $(INSTALL_DIR)/lib/libsquish.a + +$(LIB) : $(OBJ) + $(AR) cr $@ $? + ranlib $@ + +%.o : %.cpp + $(CXX) $(CPPFLAGS) -I. $(CXXFLAGS) -o$@ -c $< + +clean : + $(RM) $(OBJ) $(LIB) + + + diff --git a/externals/NVTT/src/nvtt/squish/README b/externals/NVTT/src/nvtt/squish/README new file mode 100644 index 00000000..62b26747 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/README @@ -0,0 +1,35 @@ +LICENSE +------- + +The squish library is distributed under the terms and conditions of the MIT +license. This license is specified at the top of each source file and must be +preserved in its entirety. + +BUILDING AND INSTALLING THE LIBRARY +----------------------------------- + +If you are using Visual Studio 2003 or above under Windows then load the Visual +Studio 2003 project in the vs7 folder. By default, the library is built using +SSE optimisations. To change this either change or remove the SQUISH_USE_SSE=1 +from the preprocessor symbols. + +If you are using a Mac then load the Xcode 2.2 project in the distribution. By +default, the library is built using Altivec optimisations. To change this +either change or remove SQUISH_USE_ALTIVEC=1 from the preprocessor symbols. I +guess I'll have to think about changing this for the new Intel Macs that are +rolling out... + +If you are using unix then first edit the config file in the base directory of +the distribution, enabling Altivec or SSE with the USE_ALTIVEC or USE_SSE +variables, and editing the optimisation flags passed to the C++ compiler if +necessary. Then make can be used to build the library, and make install (from +the superuser account) can be used to install (into /usr/local by default). + +REPORTING BUGS OR FEATURE REQUESTS +---------------------------------- + +Feedback can be sent to Simon Brown (the developer) at si@sjbrown.co.uk + +New releases are announced on the squish library homepage at +http://sjbrown.co.uk/?code=squish + diff --git a/externals/NVTT/src/nvtt/squish/alpha.cpp b/externals/NVTT/src/nvtt/squish/alpha.cpp new file mode 100644 index 00000000..4242bb8f --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/alpha.cpp @@ -0,0 +1,326 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "alpha.h" +#include + +namespace squish { + +static int FloatToInt( float a, int limit ) +{ + // use ANSI round-to-zero behaviour to get round-to-nearest + int i = ( int )( a + 0.5f ); + + // clamp to the limit + if( i < 0 ) + i = 0; + else if( i > limit ) + i = limit; + + // done + return i; +} + +void CompressAlphaDxt3( u8 const* rgba, void* block ) +{ + u8* bytes = reinterpret_cast< u8* >( block ); + + // quantise and pack the alpha values pairwise + for( int i = 0; i < 8; ++i ) + { + // quantise down to 4 bits + float alpha1 = ( float )rgba[8*i + 3] * ( 15.0f/255.0f ); + float alpha2 = ( float )rgba[8*i + 7] * ( 15.0f/255.0f ); + int quant1 = FloatToInt( alpha1, 15 ); + int quant2 = FloatToInt( alpha2, 15 ); + + // pack into the byte + bytes[i] = ( u8 )( quant1 | ( quant2 << 4 ) ); + } +} + +void DecompressAlphaDxt3( u8* rgba, void const* block ) +{ + u8 const* bytes = reinterpret_cast< u8 const* >( block ); + + // unpack the alpha values pairwise + for( int i = 0; i < 8; ++i ) + { + // quantise down to 4 bits + u8 quant = bytes[i]; + + // unpack the values + u8 lo = quant & 0x0f; + u8 hi = quant & 0xf0; + + // convert back up to bytes + rgba[8*i + 3] = lo | ( lo << 4 ); + rgba[8*i + 7] = hi | ( hi >> 4 ); + } +} + +static void FixRange( int& min, int& max, int steps ) +{ + if( max - min < steps ) + max = std::min( min + steps, 255 ); + if( max - min < steps ) + min = std::max( 0, max - steps ); +} + +static int FitCodes( u8 const* rgba, u8 const* codes, u8* indices ) +{ + // fit each alpha value to the codebook + int err = 0; + for( int i = 0; i < 16; ++i ) + { + // find the least error and corresponding index + int value = rgba[4*i + 3]; + int least = INT_MAX; + int index = 0; + for( int j = 0; j < 8; ++j ) + { + // get the squared error from this code + int dist = ( int )value - ( int )codes[j]; + dist *= dist; + + // compare with the best so far + if( dist < least ) + { + least = dist; + index = j; + } + } + + // save this index and accumulate the error + indices[i] = ( u8 )index; + err += least; + } + + // return the total error + return err; +} + +static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block ) +{ + u8* bytes = reinterpret_cast< u8* >( block ); + + // write the first two bytes + bytes[0] = ( u8 )alpha0; + bytes[1] = ( u8 )alpha1; + + // pack the indices with 3 bits each + u8* dest = bytes + 2; + u8 const* src = indices; + for( int i = 0; i < 2; ++i ) + { + // pack 8 3-bit values + int value = 0; + for( int j = 0; j < 8; ++j ) + { + int index = *src++; + value |= ( index << 3*j ); + } + + // store in 3 bytes + for( int j = 0; j < 3; ++j ) + { + int byte = ( value >> 8*j ) & 0xff; + *dest++ = ( u8 )byte; + } + } +} + +static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block ) +{ + // check the relative values of the endpoints + if( alpha0 > alpha1 ) + { + // swap the indices + u8 swapped[16]; + for( int i = 0; i < 16; ++i ) + { + u8 index = indices[i]; + if( index == 0 ) + swapped[i] = 1; + else if( index == 1 ) + swapped[i] = 0; + else if( index <= 5 ) + swapped[i] = 7 - index; + else + swapped[i] = index; + } + + // write the block + WriteAlphaBlock( alpha1, alpha0, swapped, block ); + } + else + { + // write the block + WriteAlphaBlock( alpha0, alpha1, indices, block ); + } +} + +static void WriteAlphaBlock7( int alpha0, int alpha1, u8 const* indices, void* block ) +{ + // check the relative values of the endpoints + if( alpha0 < alpha1 ) + { + // swap the indices + u8 swapped[16]; + for( int i = 0; i < 16; ++i ) + { + u8 index = indices[i]; + if( index == 0 ) + swapped[i] = 1; + else if( index == 1 ) + swapped[i] = 0; + else + swapped[i] = 9 - index; + } + + // write the block + WriteAlphaBlock( alpha1, alpha0, swapped, block ); + } + else + { + // write the block + WriteAlphaBlock( alpha0, alpha1, indices, block ); + } +} + +void CompressAlphaDxt5( u8 const* rgba, void* block ) +{ + // get the range for 5-alpha and 7-alpha interpolation + int min5 = 255; + int max5 = 0; + int min7 = 255; + int max7 = 0; + for( int i = 0; i < 16; ++i ) + { + // incorporate into the min/max + int value = rgba[4*i + 3]; + if( value < min7 ) + min7 = value; + if( value > max7 ) + max7 = value; + if( value != 0 && value < min5 ) + min5 = value; + if( value != 255 && value > max5 ) + max5 = value; + } + + // handle the case that no valid range was found + if( min5 > max5 ) + min5 = max5; + if( min7 > max7 ) + min7 = max7; + + // fix the range to be the minimum in each case + FixRange( min5, max5, 5 ); + FixRange( min7, max7, 7 ); + + // set up the 5-alpha code book + u8 codes5[8]; + codes5[0] = ( u8 )min5; + codes5[1] = ( u8 )max5; + for( int i = 1; i < 5; ++i ) + codes5[1 + i] = ( u8 )( ( ( 5 - i )*min5 + i*max5 )/5 ); + codes5[6] = 0; + codes5[7] = 255; + + // set up the 7-alpha code book + u8 codes7[8]; + codes7[0] = ( u8 )min7; + codes7[1] = ( u8 )max7; + for( int i = 1; i < 7; ++i ) + codes7[1 + i] = ( u8 )( ( ( 7 - i )*min7 + i*max7 )/7 ); + + // fit the data to both code books + u8 indices5[16]; + u8 indices7[16]; + int err5 = FitCodes( rgba, codes5, indices5 ); + int err7 = FitCodes( rgba, codes7, indices7 ); + + // save the block with least error + if( err5 <= err7 ) + WriteAlphaBlock5( min5, max5, indices5, block ); + else + WriteAlphaBlock7( min7, max7, indices7, block ); +} + +void DecompressAlphaDxt5( u8* rgba, void const* block ) +{ + // get the two alpha values + u8 const* bytes = reinterpret_cast< u8 const* >( block ); + int alpha0 = bytes[0]; + int alpha1 = bytes[1]; + + // compare the values to build the codebook + u8 codes[8]; + codes[0] = ( u8 )alpha0; + codes[1] = ( u8 )alpha1; + if( alpha0 <= alpha1 ) + { + // use 5-alpha codebook + for( int i = 1; i < 5; ++i ) + codes[1 + i] = ( u8 )( ( ( 5 - i )*alpha0 + i*alpha1 )/5 ); + codes[6] = 0; + codes[7] = 255; + } + else + { + // use 7-alpha codebook + for( int i = 1; i < 7; ++i ) + codes[1 + i] = ( u8 )( ( ( 7 - i )*alpha0 + i*alpha1 )/7 ); + } + + // decode the indices + u8 indices[16]; + u8 const* src = bytes + 2; + u8* dest = indices; + for( int i = 0; i < 2; ++i ) + { + // grab 3 bytes + int value = 0; + for( int j = 0; j < 3; ++j ) + { + int byte = *src++; + value |= ( byte << 8*j ); + } + + // unpack 8 3-bit values from it + for( int j = 0; j < 8; ++j ) + { + int index = ( value >> 3*j ) & 0x7; + *dest++ = ( u8 )index; + } + } + + // write out the indexed codebook values + for( int i = 0; i < 16; ++i ) + rgba[4*i + 3] = codes[indices[i]]; +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/alpha.h b/externals/NVTT/src/nvtt/squish/alpha.h new file mode 100644 index 00000000..d09ba0e9 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/alpha.h @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_ALPHA_H +#define SQUISH_ALPHA_H + +#include + +namespace squish { + +void CompressAlphaDxt3( u8 const* rgba, void* block ); +void CompressAlphaDxt5( u8 const* rgba, void* block ); + +void DecompressAlphaDxt3( u8* rgba, void const* block ); +void DecompressAlphaDxt5( u8* rgba, void const* block ); + +} // namespace squish + +#endif // ndef SQUISH_ALPHA_H diff --git a/externals/NVTT/src/nvtt/squish/clusterfit.cpp b/externals/NVTT/src/nvtt/squish/clusterfit.cpp new file mode 100644 index 00000000..186020c5 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/clusterfit.cpp @@ -0,0 +1,493 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "clusterfit.h" +#include "colourset.h" +#include "colourblock.h" +#include + +namespace squish { + +ClusterFit::ClusterFit() +{ +} + +void ClusterFit::SetColourSet( ColourSet const* colours, int flags ) +{ + ColourFit::SetColourSet( colours, flags ); + + // initialise the best error +#if SQUISH_USE_SIMD + m_besterror = VEC4_CONST( FLT_MAX ); + Vec3 metric = m_metric.GetVec3(); +#else + m_besterror = FLT_MAX; + Vec3 metric = m_metric; +#endif + + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // get the covariance matrix + Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric ); + + // compute the principle component + Vec3 principle = ComputePrincipleComponent( covariance ); + + // build the list of values + float dps[16]; + for( int i = 0; i < count; ++i ) + { + dps[i] = Dot( values[i], principle ); + m_order[i] = i; + } + + // stable sort + for( int i = 0; i < count; ++i ) + { + for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j ) + { + std::swap( dps[j], dps[j - 1] ); + std::swap( m_order[j], m_order[j - 1] ); + } + } + + // weight all the points +#if SQUISH_USE_SIMD + Vec4 const* unweighted = m_colours->GetPointsSimd(); + Vec4 const* weights = m_colours->GetWeightsSimd(); + m_xxsum = VEC4_CONST( 0.0f ); +#else + Vec3 const* unweighted = m_colours->GetPoints(); + float const* weights = m_colours->GetWeights(); + m_xxsum = Vec3( 0.0f ); +#endif + for( int i = 0; i < count; ++i ) + { + int p = m_order[i]; + m_unweighted[i] = unweighted[p]; + m_weights[i] = weights[p]; + m_weighted[i] = weights[p]*unweighted[p]; + m_xxsum += m_weighted[i]*m_weighted[i]; + } +} + + +void ClusterFit::SetMetric(float r, float g, float b) +{ +#if SQUISH_USE_SIMD + m_metric = Vec4(r, g, b, 0); +#else + m_metric = Vec3(r, g, b); +#endif + m_metricSqr = m_metric * m_metric; +} + +float ClusterFit::GetBestError() const +{ +#if SQUISH_USE_SIMD + return m_besterror.GetVec3().X(); +#else + return m_besterror; +#endif +} + + +void ClusterFit::Compress3( void* block ) +{ + // declare variables + int const count = m_colours->GetCount(); +#if SQUISH_USE_SIMD + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = VEC4_CONST( FLT_MAX ); + Vec4 const half = VEC4_CONST( 0.5f ); + Vec4 const zero = VEC4_CONST( 0.0f ); +#else + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = FLT_MAX; + float const half = 0.5f; + float const zero = 0.0f; +#endif + + // check all possible clusters for this total order + u8 indices[16]; + u8 bestindices[16]; + + // first cluster [0,i) is at the start + for( int m = 0; m < count; ++m ) + { + indices[m] = 0; + m_alpha[m] = m_weights[m]; + m_beta[m] = zero; + } + for( int i = count; i >= 0; --i ) + { + // second cluster [i,j) is half along + for( int m = i; m < count; ++m ) + { + indices[m] = 2; + m_alpha[m] = m_beta[m] = half*m_weights[m]; + } + for( int j = count; j > i; --j ) + { + // last cluster [j,k) is at the end + if( j < count ) + { + indices[j] = 1; + m_alpha[j] = zero; + m_beta[j] = m_weights[j]; + } + + // solve a least squares problem to place the endpoints +#if SQUISH_USE_SIMD + Vec4 start, end; + Vec4 error = SolveLeastSquares( start, end ); +#else + Vec3 start, end; + float error = SolveLeastSquares( start, end ); +#endif + + // keep the solution if it wins +#if SQUISH_USE_SIMD + if( CompareAnyLessThan( error, besterror ) ) +#else + if( error < besterror ) +#endif + { + beststart = start; + bestend = end; + for( int m = 0; m < 16; ++m ) // TODO: make this faster? + bestindices[m] = indices[m]; + besterror = error; + } + } + } + + // save the block if necessary +#if SQUISH_USE_SIMD + if( CompareAnyLessThan( besterror, m_besterror ) ) +#else + if( besterror < m_besterror ) +#endif + { + // remap the indices + u8 unordered[16]; + for( int i = 0; i < count; ++i ) + unordered[m_order[i]] = bestindices[i]; + m_colours->RemapIndices( unordered, bestindices ); + + // save the block +#if SQUISH_USE_SIMD + WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block ); +#else + WriteColourBlock3( beststart, bestend, bestindices, block ); +#endif + + // save the error + m_besterror = besterror; + } +} + +//static int run = 0; +//static bool debug = false; + +void ClusterFit::Compress4( void* block ) +{ + //debug = (run == 1); + //run++; + + // declare variables + int const count = m_colours->GetCount(); +#if SQUISH_USE_SIMD + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = m_besterror; + Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f ); + Vec4 const onethird = VEC4_CONST( 1.0f/3.0f ); + Vec4 const zero = VEC4_CONST( 0.0f ); +#else + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = m_besterror; + float const twothirds = 2.0f/3.0f; + float const onethird = 1.0f/3.0f; + float const zero = 0.0f; +#endif + + // check all possible clusters for this total order + u8 indices[16]; + u8 bestindices[16]; + + // first cluster [0,i) is at the start + for( int m = 0; m < count; ++m ) + { + indices[m] = 0; + m_alpha[m] = m_weights[m]; + m_beta[m] = zero; + } + for( int i = count; i >= 0; --i ) + { + // second cluster [i,j) is one third along + for( int m = i; m < count; ++m ) + { + indices[m] = 2; + m_alpha[m] = twothirds*m_weights[m]; + m_beta[m] = onethird*m_weights[m]; + } + for( int j = count; j >= i; --j ) + { + // third cluster [j,k) is two thirds along + for( int m = j; m < count; ++m ) + { + indices[m] = 3; + m_alpha[m] = onethird*m_weights[m]; + m_beta[m] = twothirds*m_weights[m]; + } + for( int k = count; k >= j; --k ) + { + if (j + k == 0) continue; + + // last cluster [k,n) is at the end + if( k < count ) + { + indices[k] = 1; + m_alpha[k] = zero; + m_beta[k] = m_weights[k]; + } + + /*unsigned int permutation = 0; + for(int p = 0; p < 16; p++) { + permutation |= indices[p] << (p * 2); + } + if (debug) printf("%X:\t", permutation); + + if (debug && permutation == 0x55FFFFAA) __debugbreak(); + */ + + // solve a least squares problem to place the endpoints +#if SQUISH_USE_SIMD + Vec4 start, end; + Vec4 error = SolveLeastSquares( start, end ); +#else + Vec3 start, end; + float error = SolveLeastSquares( start, end ); +#endif + + // keep the solution if it wins +#if SQUISH_USE_SIMD + if( CompareAnyLessThan( error, besterror ) ) +#else + if( error < besterror ) +#endif + { + beststart = start; + bestend = end; + for( int m = 0; m < 16; ++m ) // TODO: make this faster? + bestindices[m] = indices[m]; + besterror = error; + } + } + } + } + + // save the block if necessary +#if SQUISH_USE_SIMD + if( CompareAnyLessThan( besterror, m_besterror ) ) +#else + if( besterror < m_besterror ) +#endif + { + // remap the indices + u8 unordered[16]; + for( int i = 0; i < count; ++i ) + unordered[m_order[i]] = bestindices[i]; + m_colours->RemapIndices( unordered, bestindices ); + + // save the block +#if SQUISH_USE_SIMD + WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block ); +#else + WriteColourBlock4( beststart, bestend, bestindices, block ); +#endif + + // save the error + m_besterror = besterror; + } +} + +#if SQUISH_USE_SIMD +Vec4 ClusterFit::SolveLeastSquares( Vec4& start, Vec4& end ) const +{ + // accumulate all the quantities we need + int const count = m_colours->GetCount(); + Vec4 alpha2_sum = VEC4_CONST( 0.0f ); + Vec4 beta2_sum = VEC4_CONST( 0.0f ); + Vec4 alphabeta_sum = VEC4_CONST( 0.0f ); + Vec4 alphax_sum = VEC4_CONST( 0.0f ); + Vec4 betax_sum = VEC4_CONST( 0.0f ); + for( int i = 0; i < count; ++i ) + { + Vec4 alpha = m_alpha[i]; + Vec4 beta = m_beta[i]; + Vec4 x = m_weighted[i]; + + alpha2_sum = MultiplyAdd( alpha, alpha, alpha2_sum ); + beta2_sum = MultiplyAdd( beta, beta, beta2_sum ); + alphabeta_sum = MultiplyAdd( alpha, beta, alphabeta_sum ); + alphax_sum = MultiplyAdd( alpha, x, alphax_sum ); + betax_sum = MultiplyAdd( beta, x, betax_sum ); + } + + // select the results + Vec4 const zero = VEC4_CONST( 0.0f ); + Vec4 beta2_sum_zero = CompareEqual( beta2_sum, zero ); + Vec4 alpha2_sum_zero = CompareEqual( alpha2_sum, zero ); + + Vec4 a1 = alphax_sum*Reciprocal( alpha2_sum ); + Vec4 b1 = betax_sum*Reciprocal( beta2_sum ); + + Vec4 factor = Reciprocal( NegativeMultiplySubtract( + alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum + ) ); + Vec4 a2 = NegativeMultiplySubtract( + betax_sum, alphabeta_sum, alphax_sum*beta2_sum + )*factor; + Vec4 b2 = NegativeMultiplySubtract( + alphax_sum, alphabeta_sum, betax_sum*alpha2_sum + )*factor; + + Vec4 a = Select( Select( a2, a1, beta2_sum_zero ), zero, alpha2_sum_zero ); + Vec4 b = Select( Select( b2, b1, alpha2_sum_zero ), zero, beta2_sum_zero ); + + // clamp the output to [0, 1] + Vec4 const one = VEC4_CONST( 1.0f ); + Vec4 const half = VEC4_CONST( 0.5f ); + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f ); +// Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f ); + Vec4 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f, 0.0f ); // IC: use approximate grid fitting. + Vec4 const onethird = VEC4_CONST( 1.0f/3.0f ); + Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f ); + a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp; + b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp; + + // compute the error + Vec4 const two = VEC4_CONST( 2.0 ); + Vec4 e1 = MultiplyAdd( b*b, beta2_sum, m_xxsum ); + Vec4 e2 = MultiplyAdd( a, alphax_sum, b*betax_sum ); + Vec4 e3 = MultiplyAdd( a*a, alpha2_sum, e1 ); + Vec4 e4 = MultiplyAdd( a*b*alphabeta_sum - e2, two, e3 ); + + // apply the metric to the error term + Vec4 e5 = e4*m_metricSqr; + Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ(); + + // save the start and end + start = a; + end = b; + return error; +} +#else +float ClusterFit::SolveLeastSquares( Vec3& start, Vec3& end ) const +{ + // accumulate all the quantities we need + int const count = m_colours->GetCount(); + float alpha2_sum = 0.0f; + float beta2_sum = 0.0f; + float alphabeta_sum = 0.0f; + Vec3 alphax_sum( 0.0f ); + Vec3 betax_sum( 0.0f ); + for( int i = 0; i < count; ++i ) + { + float alpha = m_alpha[i]; + float beta = m_beta[i]; + Vec3 const& x = m_weighted[i]; + + alpha2_sum += alpha*alpha; + beta2_sum += beta*beta; + alphabeta_sum += alpha*beta; + alphax_sum += alpha*x; + betax_sum += beta*x; + } + + //if (debug) printf("%f %f %f", alpha2_sum, beta2_sum, alphabeta_sum); + + // zero where non-determinate + Vec3 a, b; + if( beta2_sum == 0.0f ) + { + a = alphax_sum/alpha2_sum; + b = Vec3( 0.0f ); + } + else if( alpha2_sum == 0.0f ) + { + a = Vec3( 0.0f ); + b = betax_sum/beta2_sum; + } + else + { + float factor = 1.0f/( alpha2_sum*beta2_sum - alphabeta_sum*alphabeta_sum ); + + a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor; + b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor; + } + + // clamp the output to [0, 1] + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + //Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f ); + Vec3 const gridrcp(0.03227752766457f, 0.01583151765563f, 0.03227752766457f); // IC: use approximate grid fitting. + Vec3 const half( 0.5f ); + a = Floor( grid*a + half )*gridrcp; + b = Floor( grid*b + half )*gridrcp; + + // compute the error + Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum /*+ m_xxsum*/ + + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum ); + + // apply the metric to the error term + float error = Dot( e1, m_metricSqr ); + + //if (debug) printf(" - %f\n", error); + + // save the start and end + start = a; + end = b; + return error; +} +#endif + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/clusterfit.h b/externals/NVTT/src/nvtt/squish/clusterfit.h new file mode 100644 index 00000000..a870dc42 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/clusterfit.h @@ -0,0 +1,83 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_CLUSTERFIT_H +#define SQUISH_CLUSTERFIT_H + +#include "squish.h" +#include "maths.h" +#include "simd.h" +#include "colourfit.h" + +namespace squish { + +class ClusterFit : public ColourFit +{ +public: + ClusterFit(); + + void SetColourSet( ColourSet const* colours, int flags ); + + void SetMetric(float r, float g, float b); + float GetBestError() const; + +private: + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + + void Reorder( Vec3::Arg principle ); + + Vec3 m_principle; +#if SQUISH_USE_SIMD + Vec4 SolveLeastSquares( Vec4& start, Vec4& end ) const; + + Vec4 m_weighted[16]; + Vec4 m_unweighted[16]; + Vec4 m_weights[16]; + Vec4 m_metric; + Vec4 m_metricSqr; + Vec4 m_alpha[16]; + Vec4 m_beta[16]; + Vec4 m_xxsum; + Vec4 m_besterror; +#else + float SolveLeastSquares( Vec3& start, Vec3& end ) const; + + Vec3 m_weighted[16]; + Vec3 m_unweighted[16]; + float m_weights[16]; + Vec3 m_metric; + Vec3 m_metricSqr; + float m_alpha[16]; + float m_beta[16]; + Vec3 m_xxsum; + float m_besterror; +#endif + int m_order[16]; +}; + +} // namespace squish + +#endif // ndef SQUISH_CLUSTERFIT_H diff --git a/externals/NVTT/src/nvtt/squish/colourblock.cpp b/externals/NVTT/src/nvtt/squish/colourblock.cpp new file mode 100644 index 00000000..c0a02255 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourblock.cpp @@ -0,0 +1,278 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "colourblock.h" + +namespace squish { + +static int FloatToInt( float a, int limit ) +{ + // use ANSI round-to-zero behaviour to get round-to-nearest + int i = ( int )( a + 0.5f ); + + // clamp to the limit + if( i < 0 ) + i = 0; + else if( i > limit ) + i = limit; + + // done + return i; +} + +static int FloatTo565( Vec3::Arg colour ) +{ + // get the components in the correct range + int r = FloatToInt( 31.0f*colour.X(), 31 ); + int g = FloatToInt( 63.0f*colour.Y(), 63 ); + int b = FloatToInt( 31.0f*colour.Z(), 31 ); + + // pack into a single value + return ( r << 11 ) | ( g << 5 ) | b; +} + +static void WriteColourBlock( int a, int b, u8* indices, void* block ) +{ + // get the block as bytes + u8* bytes = ( u8* )block; + + // write the endpoints + bytes[0] = ( u8 )( a & 0xff ); + bytes[1] = ( u8 )( a >> 8 ); + bytes[2] = ( u8 )( b & 0xff ); + bytes[3] = ( u8 )( b >> 8 ); + + // write the indices + for( int i = 0; i < 4; ++i ) + { + u8 const* ind = indices + 4*i; + bytes[4 + i] = ind[0] | ( ind[1] << 2 ) | ( ind[2] << 4 ) | ( ind[3] << 6 ); + } +} + +void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ) +{ + // get the packed values + int a = FloatTo565( start ); + int b = FloatTo565( end ); + + // remap the indices + u8 remapped[16]; + if( a <= b ) + { + // use the indices directly + for( int i = 0; i < 16; ++i ) + remapped[i] = indices[i]; + } + else + { + // swap a and b + std::swap( a, b ); + for( int i = 0; i < 16; ++i ) + { + if( indices[i] == 0 ) + remapped[i] = 1; + else if( indices[i] == 1 ) + remapped[i] = 0; + else + remapped[i] = indices[i]; + } + } + + // write the block + WriteColourBlock( a, b, remapped, block ); +} + +void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ) +{ + // get the packed values + int a = FloatTo565( start ); + int b = FloatTo565( end ); + + // remap the indices + u8 remapped[16]; + if( a < b ) + { + // swap a and b + std::swap( a, b ); + for( int i = 0; i < 16; ++i ) + remapped[i] = ( indices[i] ^ 0x1 ) & 0x3; + } + else if( a == b ) + { + // use index 0 + for( int i = 0; i < 16; ++i ) + remapped[i] = 0; + } + else + { + // use the indices directly + for( int i = 0; i < 16; ++i ) + remapped[i] = indices[i]; + } + + // write the block + WriteColourBlock( a, b, remapped, block ); +} + +/* +static void WriteColourBlock( int a, int b, uint indices, void* block ) +{ + // get the block as bytes + u8* bytes = ( u8* )block; + + // write the endpoints + bytes[0] = ( u8 )( a & 0xff ); + bytes[1] = ( u8 )( a >> 8 ); + bytes[2] = ( u8 )( b & 0xff ); + bytes[3] = ( u8 )( b >> 8 ); + + // write the indices @@ Not sure that's correct... + bytes[4] = ( u8 )((indices >> 24) & 0xff); + bytes[5] = ( u8 )((indices >> 16) & 0xff); + bytes[6] = ( u8 )((indices >> 8) & 0xff); + bytes[7] = ( u8 )((indices >> 0) & 0xff); +} + +void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ) +{ + // get the packed values + int a = FloatTo565( start ); + int b = FloatTo565( end ); + + // remap the indices + if( a > b ) + { + // swap a and b + std::swap( a, b ); + indices ^= (~indices >> 1) & 0x55555555; + } + else if ( a == b ) + { + indices = 0; + } + + // write the block + WriteColourBlock( a, b, indices, block ); +} + +void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ) +{ + // get the packed values + int a = FloatTo565( start ); + int b = FloatTo565( end ); + + // remap the indices + if( a < b ) + { + // swap a and b + std::swap( a, b ); + indices ^= 0x55555555; + } + else if( a == b ) + { + indices = 0; + } + + // write the block + WriteColourBlock( a, b, indices, block ); +} +*/ + +static int Unpack565( u8 const* packed, u8* colour ) +{ + // build the packed value + int value = ( int )packed[0] | ( ( int )packed[1] << 8 ); + + // get the components in the stored range + u8 red = ( u8 )( ( value >> 11 ) & 0x1f ); + u8 green = ( u8 )( ( value >> 5 ) & 0x3f ); + u8 blue = ( u8 )( value & 0x1f ); + + // scale up to 8 bits + colour[0] = ( red << 3 ) | ( red >> 2 ); + colour[1] = ( green << 2 ) | ( green >> 4 ); + colour[2] = ( blue << 3 ) | ( blue >> 2 ); + colour[3] = 255; + + // return the value + return value; +} + +void DecompressColour( u8* rgba, void const* block, bool isDxt1 ) +{ + // get the block bytes + u8 const* bytes = reinterpret_cast< u8 const* >( block ); + + // unpack the endpoints + u8 codes[16]; + int a = Unpack565( bytes, codes ); + int b = Unpack565( bytes + 2, codes + 4 ); + + // generate the midpoints + for( int i = 0; i < 3; ++i ) + { + int c = codes[i]; + int d = codes[4 + i]; + + if( isDxt1 && a <= b ) + { + codes[8 + i] = ( u8 )( ( c + d )/2 ); + codes[12 + i] = 0; + } + else + { + codes[8 + i] = ( u8 )( ( 2*c + d )/3 ); + codes[12 + i] = ( u8 )( ( c + 2*d )/3 ); + } + } + + // fill in alpha for the intermediate values + codes[8 + 3] = 255; + codes[12 + 3] = ( isDxt1 && a <= b ) ? 0 : 255; + + // unpack the indices + u8 indices[16]; + for( int i = 0; i < 4; ++i ) + { + u8* ind = indices + 4*i; + u8 packed = bytes[4 + i]; + + ind[0] = packed & 0x3; + ind[1] = ( packed >> 2 ) & 0x3; + ind[2] = ( packed >> 4 ) & 0x3; + ind[3] = ( packed >> 6 ) & 0x3; + } + + // store out the colours + for( int i = 0; i < 16; ++i ) + { + u8 offset = 4*indices[i]; + for( int j = 0; j < 4; ++j ) + rgba[4*i + j] = codes[offset + j]; + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/colourblock.h b/externals/NVTT/src/nvtt/squish/colourblock.h new file mode 100644 index 00000000..1a501d6a --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourblock.h @@ -0,0 +1,44 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_COLOURBLOCK_H +#define SQUISH_COLOURBLOCK_H + +#include "squish.h" +#include "maths.h" + +namespace squish { + +void WriteColourBlock( int a, int b, u8* indices, void* block ); +void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); +void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block ); +//void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); +//void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, uint indices, void* block ); + +void DecompressColour( u8* rgba, void const* block, bool isDxt1 ); + +} // namespace squish + +#endif // ndef SQUISH_COLOURBLOCK_H diff --git a/externals/NVTT/src/nvtt/squish/colourfit.cpp b/externals/NVTT/src/nvtt/squish/colourfit.cpp new file mode 100644 index 00000000..15d8a74e --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourfit.cpp @@ -0,0 +1,59 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "colourfit.h" +#include "colourset.h" + +namespace squish { + +ColourFit::ColourFit() +{ +} + +void ColourFit::SetColourSet( ColourSet const* colours, int flags ) +{ + m_colours = colours; + m_flags = flags; +} + +void ColourFit::Compress( void* block ) +{ + bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 ); + if( isDxt1 ) + { + Compress3( block ); + + if( !m_colours->IsTransparent() ) + { + Compress4( block ); + } + } + else + { + Compress4( block ); + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/colourfit.h b/externals/NVTT/src/nvtt/squish/colourfit.h new file mode 100644 index 00000000..23314d89 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourfit.h @@ -0,0 +1,55 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_COLOURFIT_H +#define SQUISH_COLOURFIT_H + +#include "squish.h" +#include "maths.h" + +namespace squish { + +class ColourSet; + +class ColourFit +{ +public: + ColourFit(); + + void SetColourSet( ColourSet const* colours, int flags ); + + void Compress( void* block ); + +protected: + virtual void Compress3( void* block ) = 0; + virtual void Compress4( void* block ) = 0; + + ColourSet const* m_colours; + int m_flags; +}; + +} // namespace squish + +#endif // ndef SQUISH_COLOURFIT_H diff --git a/externals/NVTT/src/nvtt/squish/colourset.cpp b/externals/NVTT/src/nvtt/squish/colourset.cpp new file mode 100644 index 00000000..82a7571c --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourset.cpp @@ -0,0 +1,153 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "colourset.h" + +namespace squish { + +// @@ Add flags: +// - MatchTransparent +// - WeightColorByAlpha + + +ColourSet::ColourSet( u8 const* rgba, int flags, bool createMinimalSet/*=false*/ ) + : m_count( 0 ), + m_transparent( false ) +{ + // check the compression mode for dxt1 + bool isDxt1 = ( ( flags & kDxt1 ) != 0 ); + bool weightByAlpha = ( ( flags & kWeightColourByAlpha ) != 0 ); + + // create the minimal set + for( int i = 0; i < 16; ++i ) + { + if (createMinimalSet) + { + // check for transparent pixels when using dxt1 + if( isDxt1 && rgba[4*i + 3] == 0 ) + { + m_remap[i] = -1; + m_transparent = true; + continue; + } + + // loop over previous points for a match + for( int j = 0;; ++j ) + { + // allocate a new point + if( j == i ) + { + // normalise coordinates to [0,1] + float x = ( float )rgba[4*i + 2] / 255.0f; + float y = ( float )rgba[4*i + 1] / 255.0f; + float z = ( float )rgba[4*i + 0] / 255.0f; + + // ensure there is always non-zero weight even for zero alpha + float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f; + + // add the point + m_points[m_count] = Vec3( x, y, z ); + m_weights[m_count] = ( weightByAlpha ? w : 1.0f ); + m_remap[i] = m_count; + + // advance + ++m_count; + break; + } + + // check for a match + bool match = ( rgba[4*i] == rgba[4*j] ) + && ( rgba[4*i + 1] == rgba[4*j + 1] ) + && ( rgba[4*i + 2] == rgba[4*j + 2] ) + && ( rgba[4*j + 3] != 0 || !isDxt1 ); // @@ I think this check is not necessary. + + if( match ) + { + // get the index of the match + int index = m_remap[j]; + + // ensure there is always non-zero weight even for zero alpha + float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f; + + // map to this point and increase the weight + m_weights[index] += ( weightByAlpha ? w : 1.0f ); + m_remap[i] = index; + break; + } + } + } + else + { + // check for transparent pixels when using dxt1 + if( isDxt1 && rgba[4*i + 3] == 0 ) + { + m_remap[i] = -1; + m_transparent = true; + } + else + { + m_remap[i] = m_count; + } + + // normalise coordinates to [0,1] + float x = ( float )rgba[4*i + 2] / 255.0f; + float y = ( float )rgba[4*i + 1] / 255.0f; + float z = ( float )rgba[4*i + 0] / 255.0f; + + // ensure there is always non-zero weight even for zero alpha + float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f; + + // add the point + m_points[m_count] = Vec3( x, y, z ); + m_weights[m_count] = ( weightByAlpha ? w : 1.0f ); + + // advance + ++m_count; + } + } + +#if SQUISH_USE_SIMD + // generate vector values + for( int i = 0; i < m_count; ++i ) + { + m_points_simd[i] = Vec4(m_points[i].X(), m_points[i].Y(), m_points[i].Z(), 1); + m_weights_simd[i] = VEC4_CONST(m_weights[i]); + } +#endif +} + +void ColourSet::RemapIndices( u8 const* source, u8* target ) const +{ + for( int i = 0; i < 16; ++i ) + { + int j = m_remap[i]; + if( j == -1 ) + target[i] = 3; + else + target[i] = source[j]; + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/colourset.h b/externals/NVTT/src/nvtt/squish/colourset.h new file mode 100644 index 00000000..f96aa21b --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/colourset.h @@ -0,0 +1,69 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_COLOURSET_H +#define SQUISH_COLOURSET_H + +#include "squish.h" +#include "maths.h" +#include "simd.h" + +namespace squish { + +/*! @brief Represents a set of block colours +*/ +class ColourSet +{ +public: + ColourSet( u8 const* rgba, int flags, bool createMinimalSet = false ); + + int GetCount() const { return m_count; } + Vec3 const* GetPoints() const { return m_points; } + float const* GetWeights() const { return m_weights; } + bool IsTransparent() const { return m_transparent; } + + void RemapIndices( u8 const* source, u8* target ) const; + +private: + int m_count; + Vec3 m_points[16]; + float m_weights[16]; + int m_remap[16]; + bool m_transparent; + +#if SQUISH_USE_SIMD +public: + Vec4 const* GetPointsSimd() const { return m_points_simd; } + Vec4 const* GetWeightsSimd() const { return m_weights_simd; } + +private: + Vec4 m_points_simd[16]; + Vec4 m_weights_simd[16]; +#endif +}; + +} // namespace sqish + +#endif // ndef SQUISH_COLOURSET_H diff --git a/externals/NVTT/src/nvtt/squish/config b/externals/NVTT/src/nvtt/squish/config new file mode 100644 index 00000000..3f247da8 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/config @@ -0,0 +1,22 @@ +# config file used for the Makefile only + +# define to 1 to use altivec instructions +USE_ALTIVEC ?= 0 + +# define to 1 to use sse instructions +USE_SSE ?= 0 + +# default flags +CXXFLAGS ?= -O2 +ifeq ($(USE_ALTIVEC),1) +CPPFLAGS += -DSQUISH_USE_ALTIVEC=1 +CXXFLAGS += -maltivec +endif +ifeq ($(USE_SSE),1) +CPPFLAGS += -DSQUISH_USE_SSE=1 +CXXFLAGS += -msse +endif + +# where should we install to +INSTALL_DIR ?= /usr/local + diff --git a/externals/NVTT/src/nvtt/squish/config.h b/externals/NVTT/src/nvtt/squish/config.h new file mode 100644 index 00000000..465aa895 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/config.h @@ -0,0 +1,55 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_CONFIG_H +#define SQUISH_CONFIG_H + +// Set to 1 when building squish to use altivec instructions. +#ifndef SQUISH_USE_ALTIVEC +# define SQUISH_USE_ALTIVEC defined(__VEC__) +#endif + +// Set to 1 when building squish to use sse instructions. +#ifndef SQUISH_USE_SSE +# if defined(__SSE2__) +# define SQUISH_USE_SSE 2 +# elif defined(__SSE__) +# define SQUISH_USE_SSE 1 +# else +# define SQUISH_USE_SSE 0 +# endif +#endif + +// Internally et SQUISH_USE_SIMD when either altivec or sse is available. +#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE +# error "Cannot enable both altivec and sse!" +#endif +#if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE +# define SQUISH_USE_SIMD 1 +#else +# define SQUISH_USE_SIMD 0 +#endif + +#endif // ndef SQUISH_CONFIG_H diff --git a/externals/NVTT/src/nvtt/squish/extra/squishgen.cpp b/externals/NVTT/src/nvtt/squish/extra/squishgen.cpp new file mode 100644 index 00000000..e5bd88c2 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/extra/squishgen.cpp @@ -0,0 +1,158 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include + +struct SourceBlock +{ + int start; + int end; + int error; +}; + +struct TargetValue +{ + SourceBlock sources[4]; +}; + +static void GenerateData( std::string const& name, int bits, int colours ) +{ + TargetValue values[256]; + + // initialise the data + for( int target = 0; target < 256; ++target ) + for( int index = 0; index < colours; ++index ) + values[target].sources[index].error = 255; + + // loop over all possible source points + int count = ( 1 << bits ); + for( int value1 = 0; value1 < count; ++value1 ) + { + for( int value2 = 0; value2 < count; ++value2 ) + { + // compute the 8-bit endpoints + int a = ( value1 << ( 8 - bits ) ) | ( value1 >> ( 2*bits - 8 ) ); + int b = ( value2 << ( 8 - bits ) ) | ( value2 >> ( 2*bits - 8 ) ); + + // fill in the codebook with the these and intermediates + int codes[4]; + codes[0] = a; + codes[1] = b; + if( colours == 3 ) + { + codes[2] = ( a + b )/2; + codes[3] = 0; + } + else + { + codes[2] = ( 2*a + b )/3; + codes[3] = ( a + 2*b )/3; + } + + // mark each target point with the endpoints and index needed for it + for( int index = 0; index < colours; ++index ) + { + int target = codes[index]; + + SourceBlock& block = values[target].sources[index]; + if( block.error != 0 ) + { + block.start = value1; + block.end = value2; + block.error = 0; + } + } + } + } + + // iteratively fill in the missing values + for( ;; ) + { + bool stable = true; + for( int index = 0; index < colours; ++index ) + { + for( int target = 0; target < 256; ++target ) + { + if( target != 255 ) + { + SourceBlock& current = values[target].sources[index]; + SourceBlock& next = values[target + 1].sources[index]; + if( current.error > next.error + 1 ) + { + current.start = next.start; + current.end = next.end; + current.error = next.error + 1; + stable = false; + } + } + if( target != 0 ) + { + SourceBlock& current = values[target].sources[index]; + SourceBlock& previous = values[target - 1].sources[index]; + if( current.error > previous.error + 1 ) + { + current.start = previous.start; + current.end = previous.end; + current.error = previous.error + 1; + stable = false; + } + } + } + } + if( stable ) + break; + } + + // debug + std::cout << "\nstatic SingleColourLookup const " << name << "[] = \n{\n"; + for( int i = 0;; ) + { + std::cout << "\t{ { "; + for( int j = 0;; ) + { + SourceBlock const& block = values[i].sources[j]; + if( j < colours ) + std::cout << "{ " << block.start << ", " << block.end << ", " << block.error << " }"; + else + std::cout << "{ 0, 0, 0 }"; + if( ++j == 4 ) + break; + std::cout << ", "; + } + std::cout << " } }"; + if( ++i == 256 ) + break; + std::cout << ",\n"; + } + std::cout << "\n};\n"; +} + +int main() +{ + GenerateData( "lookup_5_3", 5, 3 ); + GenerateData( "lookup_6_3", 6, 3 ); + GenerateData( "lookup_5_4", 5, 4 ); + GenerateData( "lookup_6_4", 6, 4 ); +} diff --git a/externals/NVTT/src/nvtt/squish/extra/squishpng.cpp b/externals/NVTT/src/nvtt/squish/extra/squishpng.cpp new file mode 100644 index 00000000..81246e81 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/extra/squishpng.cpp @@ -0,0 +1,603 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +/*! @file + + @brief Example program that converts between the PNG and DXT formats. + + This program requires libpng for PNG input and output, and is designed + to show how to prepare data for the squish library when it is not simply + a contiguous block of memory. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning( disable: 4511 4512 ) +#endif // def _MSC_VER + +using namespace squish; + +//! Simple exception class. +class Error : public std::exception +{ +public: + Error( std::string const& excuse ) : m_excuse( excuse ) {} + ~Error() throw() {} + + virtual char const* what() const throw() { return m_excuse.c_str(); } + +private: + std::string m_excuse; +}; + +//! Base class to make derived classes non-copyable +class NonCopyable +{ +public: + NonCopyable() {} + +private: + NonCopyable( NonCopyable const& ); + NonCopyable& operator=( NonCopyable const& ); +}; + +//! Memory object. +class Mem : NonCopyable +{ +public: + explicit Mem( int size ) : m_p( new u8[size] ) {} + ~Mem() { delete[] m_p; } + + u8* Get() const { return m_p; } + +private: + u8* m_p; +}; + +//! File object. +class File : NonCopyable +{ +public: + explicit File( FILE* fp ) : m_fp( fp ) {} + ~File() { if( m_fp ) fclose( m_fp ); } + + bool IsValid() const { return m_fp != 0; } + FILE* Get() const { return m_fp; } + +private: + FILE* m_fp; +}; + +//! PNG read object. +class PngReadStruct : NonCopyable +{ +public: + PngReadStruct() + : m_png( 0 ), + m_info( 0 ), + m_end( 0 ) + { + m_png = png_create_read_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + if( !m_png ) + throw Error( "failed to create png read struct" ); + + m_info = png_create_info_struct( m_png ); + m_end = png_create_info_struct( m_png ); + if( !m_info || !m_end ) + { + png_infopp info = m_info ? &m_info : 0; + png_infopp end = m_end ? &m_end : 0; + png_destroy_read_struct( &m_png, info, end ); + throw Error( "failed to create png info structs" ); + } + } + + ~PngReadStruct() + { + png_destroy_read_struct( &m_png, &m_info, &m_end ); + } + + png_structp GetPng() const { return m_png; } + png_infop GetInfo() const { return m_info; } + +private: + png_structp m_png; + png_infop m_info, m_end; +}; + +//! PNG write object. +class PngWriteStruct : NonCopyable +{ +public: + PngWriteStruct() + : m_png( 0 ), + m_info( 0 ) + { + m_png = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + if( !m_png ) + throw Error( "failed to create png read struct" ); + + m_info = png_create_info_struct( m_png ); + if( !m_info ) + { + png_infopp info = m_info ? &m_info : 0; + png_destroy_write_struct( &m_png, info ); + throw Error( "failed to create png info structs" ); + } + } + + ~PngWriteStruct() + { + png_destroy_write_struct( &m_png, &m_info ); + } + + png_structp GetPng() const { return m_png; } + png_infop GetInfo() const { return m_info; } + +private: + png_structp m_png; + png_infop m_info; +}; + +//! PNG rows object. +class PngRows : NonCopyable +{ +public: + PngRows( int width, int height, int stride ) : m_width( width ), m_height( height ) + { + m_rows = ( png_bytep* )malloc( m_height*sizeof( png_bytep ) ); + for( int i = 0; i < m_height; ++i ) + m_rows[i] = ( png_bytep )malloc( m_width*stride ); + } + + ~PngRows() + { + for( int i = 0; i < m_height; ++i ) + free( m_rows[i] ); + free( m_rows ); + } + + png_bytep* Get() const { return m_rows; } + +private: + png_bytep* m_rows; + int m_width, m_height; +}; + +class PngImage +{ +public: + explicit PngImage( std::string const& fileName ); + + int GetWidth() const { return m_width; } + int GetHeight() const { return m_height; } + int GetStride() const { return m_stride; } + bool IsColour() const { return m_colour; } + bool IsAlpha() const { return m_alpha; } + + u8 const* GetRow( int row ) const { return ( u8* )m_rows[row]; } + +private: + PngReadStruct m_png; + + int m_width; + int m_height; + int m_stride; + bool m_colour; + bool m_alpha; + + png_bytep* m_rows; +}; + +PngImage::PngImage( std::string const& fileName ) +{ + // open the source file + File file( fopen( fileName.c_str(), "rb" ) ); + if( !file.IsValid() ) + { + std::ostringstream oss; + oss << "failed to open \"" << fileName << "\" for reading"; + throw Error( oss.str() ); + } + + // check the signature bytes + png_byte header[8]; + fread( header, 1, 8, file.Get() ); + if( png_sig_cmp( header, 0, 8 ) ) + { + std::ostringstream oss; + oss << "\"" << fileName << "\" does not look like a png file"; + throw Error( oss.str() ); + } + + // read the image into memory + png_init_io( m_png.GetPng(), file.Get() ); + png_set_sig_bytes( m_png.GetPng(), 8 ); + png_read_png( m_png.GetPng(), m_png.GetInfo(), PNG_TRANSFORM_EXPAND, 0 ); + + // get the image info + png_uint_32 width; + png_uint_32 height; + int bitDepth; + int colourType; + png_get_IHDR( m_png.GetPng(), m_png.GetInfo(), &width, &height, &bitDepth, &colourType, 0, 0, 0 ); + + // check the image is 8 bit + if( bitDepth != 8 ) + { + std::ostringstream oss; + oss << "cannot process " << bitDepth << "-bit image (bit depth must be 8)"; + throw Error( oss.str() ); + } + + // save the info + m_width = width; + m_height = height; + m_colour = ( ( colourType & PNG_COLOR_MASK_COLOR ) != 0 ); + m_alpha = ( ( colourType & PNG_COLOR_MASK_ALPHA ) != 0 ); + m_stride = ( m_colour ? 3 : 1 ) + ( m_alpha ? 1 : 0 ); + + // get the image rows + m_rows = png_get_rows( m_png.GetPng(), m_png.GetInfo() ); + if( !m_rows ) + throw Error( "failed to get image rows" ); +} + +static void Compress( std::string const& sourceFileName, std::string const& targetFileName, int flags ) +{ + // load the source image + PngImage sourceImage( sourceFileName ); + + // get the image info + int width = sourceImage.GetWidth(); + int height = sourceImage.GetHeight(); + int stride = sourceImage.GetStride(); + bool colour = sourceImage.IsColour(); + bool alpha = sourceImage.IsAlpha(); + + // check the image dimensions + if( ( width % 4 ) != 0 || ( height % 4 ) != 0 ) + { + std::ostringstream oss; + oss << "cannot compress " << width << "x" << height + << "image (dimensions must be multiples of 4)"; + throw Error( oss.str() ); + } + + // create the target data + int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16; + int targetDataSize = bytesPerBlock*width*height/16; + Mem targetData( targetDataSize ); + + // loop over blocks and compress them + clock_t start = std::clock(); + u8* targetBlock = targetData.Get(); + for( int y = 0; y < height; y += 4 ) + { + // process a row of blocks + for( int x = 0; x < width; x += 4 ) + { + // get the block data + u8 sourceRgba[16*4]; + for( int py = 0, i = 0; py < 4; ++py ) + { + u8 const* row = sourceImage.GetRow( y + py ) + x*stride; + for( int px = 0; px < 4; ++px, ++i ) + { + // get the pixel colour + if( colour ) + { + for( int j = 0; j < 3; ++j ) + sourceRgba[4*i + j] = *row++; + } + else + { + for( int j = 0; j < 3; ++j ) + sourceRgba[4*i + j] = *row; + ++row; + } + + // skip alpha for now + if( alpha ) + sourceRgba[4*i + 3] = *row++; + else + sourceRgba[4*i + 3] = 255; + } + } + + // compress this block + Compress( sourceRgba, targetBlock, flags ); + + // advance + targetBlock += bytesPerBlock; + } + } + clock_t end = std::clock(); + double duration = ( double )( end - start ) / CLOCKS_PER_SEC; + std::cout << "time taken: " << duration << " seconds" << std::endl; + + // open the target file + File targetFile( fopen( targetFileName.c_str(), "wb" ) ); + if( !targetFile.IsValid() ) + { + std::ostringstream oss; + oss << "failed to open \"" << sourceFileName << "\" for writing"; + throw Error( oss.str() ); + } + + // write the header + fwrite( &width, sizeof( int ), 1, targetFile.Get() ); + fwrite( &height, sizeof( int ), 1, targetFile.Get() ); + + // write the data + fwrite( targetData.Get(), 1, targetDataSize, targetFile.Get() ); +} + +static void Decompress( std::string const& sourceFileName, std::string const& targetFileName, int flags ) +{ + // open the source file + File sourceFile( fopen( sourceFileName.c_str(), "rb" ) ); + if( !sourceFile.IsValid() ) + { + std::ostringstream oss; + oss << "failed to open \"" << sourceFileName << "\" for reading"; + throw Error( oss.str() ); + } + + // get the width and height + int width, height; + fread( &width, sizeof( int ), 1, sourceFile.Get() ); + fread( &height, sizeof( int ), 1, sourceFile.Get() ); + + // work out the data size + int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16; + int sourceDataSize = bytesPerBlock*width*height/16; + Mem sourceData( sourceDataSize ); + + // read the source data + fread( sourceData.Get(), 1, sourceDataSize, sourceFile.Get() ); + + // create the target rows + PngRows targetRows( width, height, 4 ); + + // loop over blocks and compress them + u8 const* sourceBlock = sourceData.Get(); + for( int y = 0; y < height; y += 4 ) + { + // process a row of blocks + for( int x = 0; x < width; x += 4 ) + { + // decompress back + u8 targetRgba[16*4]; + Decompress( targetRgba, sourceBlock, flags ); + + // write the data into the target rows + for( int py = 0, i = 0; py < 4; ++py ) + { + u8* row = ( u8* )targetRows.Get()[y + py] + x*4; + for( int px = 0; px < 4; ++px, ++i ) + { + for( int j = 0; j < 4; ++j ) + *row++ = targetRgba[4*i + j]; + } + } + + // advance + sourceBlock += bytesPerBlock; + } + } + + // create the target PNG + PngWriteStruct targetPng; + + // set up the image + png_set_IHDR( + targetPng.GetPng(), targetPng.GetInfo(), width, height, + 8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT + ); + + // open the target file + File targetFile( fopen( targetFileName.c_str(), "wb" ) ); + if( !targetFile.IsValid() ) + { + std::ostringstream oss; + oss << "failed to open \"" << targetFileName << "\" for writing"; + throw Error( oss.str() ); + } + + // write the image + png_set_rows( targetPng.GetPng(), targetPng.GetInfo(), targetRows.Get() ); + png_init_io( targetPng.GetPng(), targetFile.Get() ); + png_write_png( targetPng.GetPng(), targetPng.GetInfo(), PNG_TRANSFORM_IDENTITY, 0 ); +} + +static void Diff( std::string const& sourceFileName, std::string const& targetFileName ) +{ + // load the images + PngImage sourceImage( sourceFileName ); + PngImage targetImage( targetFileName ); + + // get the image info + int width = sourceImage.GetWidth(); + int height = sourceImage.GetHeight(); + int sourceStride = sourceImage.GetStride(); + int targetStride = targetImage.GetStride(); + int stride = std::min( sourceStride, targetStride ); + + // check they match + if( width != targetImage.GetWidth() || height != targetImage.GetHeight() ) + throw Error( "source and target dimensions do not match" ); + + // work out the error + double error = 0.0; + for( int y = 0; y < height; ++y ) + { + u8 const* sourceRow = sourceImage.GetRow( y ); + u8 const* targetRow = targetImage.GetRow( y ); + for( int x = 0; x < width; ++x ) + { + u8 const* sourcePixel = sourceRow + x*sourceStride; + u8 const* targetPixel = targetRow + x*targetStride; + for( int i = 0; i < stride; ++i ) + { + int diff = ( int )sourcePixel[i] - ( int )targetPixel[i]; + error += ( double )( diff*diff ); + } + } + } + error = std::sqrt( error / ( width*height ) ); + + // print it out + std::cout << "rms error: " << error << std::endl; +} + +enum Mode +{ + kCompress, + kDecompress, + kDiff +}; + +int main( int argc, char* argv[] ) +{ + try + { + // parse the command-line + std::string sourceFileName; + std::string targetFileName; + Mode mode = kCompress; + int method = kDxt1; + int metric = kColourMetricPerceptual; + int fit = kColourClusterFit; + int extra = 0; + bool help = false; + bool arguments = true; + for( int i = 1; i < argc; ++i ) + { + // check for options + char const* word = argv[i]; + if( arguments && word[0] == '-' ) + { + for( int j = 1; word[j] != '\0'; ++j ) + { + switch( word[j] ) + { + case 'h': help = true; break; + case 'c': mode = kCompress; break; + case 'd': mode = kDecompress; break; + case 'e': mode = kDiff; break; + case '1': method = kDxt1; break; + case '3': method = kDxt3; break; + case '5': method = kDxt5; break; + case 'u': metric = kColourMetricUniform; break; + case 'r': fit = kColourRangeFit; break; + case 'w': extra = kWeightColourByAlpha; break; + case '-': arguments = false; break; + default: + std::cerr << "unknown option '" << word[j] << "'" << std::endl; + return -1; + } + } + } + else + { + if( sourceFileName.empty() ) + sourceFileName.assign( word ); + else if( targetFileName.empty() ) + targetFileName.assign( word ); + else + { + std::cerr << "unexpected argument \"" << word << "\"" << std::endl; + } + } + } + + // check arguments + if( help ) + { + std::cout + << "SYNTAX" << std::endl + << "\tsquishpng [-cde135] " << std::endl + << "OPTIONS" << std::endl + << "\t-c\tCompress source png to target raw dxt (default)" << std::endl + << "\t-135\tSpecifies whether to use DXT1 (default), DXT3 or DXT5 compression" << std::endl + << "\t-u\tUse a uniform colour metric during colour compression" << std::endl + << "\t-r\tUse the fast but inferior range-based colour compressor" << std::endl + << "\t-w\tWeight colour values by alpha in the cluster colour compressor" << std::endl + << "\t-d\tDecompress source raw dxt to target png" << std::endl + << "\t-e\tDiff source and target png" << std::endl + ; + + return 0; + } + if( sourceFileName.empty() ) + { + std::cerr << "no source file given" << std::endl; + return -1; + } + if( targetFileName.empty() ) + { + std::cerr << "no target file given" << std::endl; + return -1; + } + + // do the work + switch( mode ) + { + case kCompress: + Compress( sourceFileName, targetFileName, method | metric | fit | extra ); + break; + + case kDecompress: + Decompress( sourceFileName, targetFileName, method ); + break; + + case kDiff: + Diff( sourceFileName, targetFileName ); + break; + + default: + std::cerr << "unknown mode" << std::endl; + throw std::exception(); + } + } + catch( std::exception& excuse ) + { + // complain + std::cerr << "squishpng error: " << excuse.what() << std::endl; + return -1; + } + + // done + return 0; +} diff --git a/externals/NVTT/src/nvtt/squish/extra/squishtest.cpp b/externals/NVTT/src/nvtt/squish/extra/squishtest.cpp new file mode 100644 index 00000000..594d8e25 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/extra/squishtest.cpp @@ -0,0 +1,205 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +/*! @file + + @brief This program tests the error for 1 and 2-colour DXT compression. + + This tests the effectiveness of the DXT compression algorithm for all + possible 1 and 2-colour blocks of pixels. +*/ + +#include +#include +#include +#include + +using namespace squish; + +double GetColourError( u8 const* a, u8 const* b ) +{ + double error = 0.0; + for( int i = 0; i < 16; ++i ) + { + for( int j = 0; j < 3; ++j ) + { + int index = 4*i + j; + int diff = ( int )a[index] - ( int )b[index]; + error += ( double )( diff*diff ); + } + } + return error / 16.0; +} + +void TestOneColour( int flags ) +{ + u8 input[4*16]; + u8 output[4*16]; + u8 block[16]; + + double avg = 0.0, min = DBL_MAX, max = -DBL_MAX; + int counter = 0; + + // test all single-channel colours + for( int i = 0; i < 16*4; ++i ) + input[i] = ( ( i % 4 ) == 3 ) ? 255 : 0; + for( int channel = 0; channel < 3; ++channel ) + { + for( int value = 0; value < 255; ++value ) + { + // set the channnel value + for( int i = 0; i < 16; ++i ) + input[4*i + channel] = ( u8 )value; + + // compress and decompress + Compress( input, block, flags ); + Decompress( output, block, flags ); + + // test the results + double rm = GetColourError( input, output ); + double rms = std::sqrt( rm ); + + // accumulate stats + min = std::min( min, rms ); + max = std::max( max, rms ); + avg += rm; + ++counter; + } + + // reset the channel value + for( int i = 0; i < 16; ++i ) + input[4*i + channel] = 0; + } + + // finish stats + avg = std::sqrt( avg/counter ); + + // show stats + std::cout << "one colour error (min, max, avg): " + << min << ", " << max << ", " << avg << std::endl; +} + +void TestOneColourRandom( int flags ) +{ + u8 input[4*16]; + u8 output[4*16]; + u8 block[16]; + + double avg = 0.0, min = DBL_MAX, max = -DBL_MAX; + int counter = 0; + + // test all single-channel colours + for( int test = 0; test < 1000; ++test ) + { + // set a constant random colour + for( int channel = 0; channel < 3; ++channel ) + { + u8 value = ( u8 )( rand() & 0xff ); + for( int i = 0; i < 16; ++i ) + input[4*i + channel] = value; + } + for( int i = 0; i < 16; ++i ) + input[4*i + 3] = 255; + + // compress and decompress + Compress( input, block, flags ); + Decompress( output, block, flags ); + + // test the results + double rm = GetColourError( input, output ); + double rms = std::sqrt( rm ); + + // accumulate stats + min = std::min( min, rms ); + max = std::max( max, rms ); + avg += rm; + ++counter; + } + + // finish stats + avg = std::sqrt( avg/counter ); + + // show stats + std::cout << "random one colour error (min, max, avg): " + << min << ", " << max << ", " << avg << std::endl; +} + +void TestTwoColour( int flags ) +{ + u8 input[4*16]; + u8 output[4*16]; + u8 block[16]; + + double avg = 0.0, min = DBL_MAX, max = -DBL_MAX; + int counter = 0; + + // test all single-channel colours + for( int i = 0; i < 16*4; ++i ) + input[i] = ( ( i % 4 ) == 3 ) ? 255 : 0; + for( int channel = 0; channel < 3; ++channel ) + { + for( int value1 = 0; value1 < 255; ++value1 ) + { + for( int value2 = value1 + 1; value2 < 255; ++value2 ) + { + // set the channnel value + for( int i = 0; i < 16; ++i ) + input[4*i + channel] = ( u8 )( ( i < 8 ) ? value1 : value2 ); + + // compress and decompress + Compress( input, block, flags ); + Decompress( output, block, flags ); + + // test the results + double rm = GetColourError( input, output ); + double rms = std::sqrt( rm ); + + // accumulate stats + min = std::min( min, rms ); + max = std::max( max, rms ); + avg += rm; + ++counter; + } + } + + // reset the channel value + for( int i = 0; i < 16; ++i ) + input[4*i + channel] = 0; + } + + // finish stats + avg = std::sqrt( avg/counter ); + + // show stats + std::cout << "two colour error (min, max, avg): " + << min << ", " << max << ", " << avg << std::endl; +} + +int main() +{ + TestOneColourRandom( kDxt1 | kColourRangeFit ); + TestOneColour( kDxt1 ); + TestTwoColour( kDxt1 ); +} diff --git a/externals/NVTT/src/nvtt/squish/fastclusterfit.cpp b/externals/NVTT/src/nvtt/squish/fastclusterfit.cpp new file mode 100644 index 00000000..8ae8ab59 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/fastclusterfit.cpp @@ -0,0 +1,602 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + Copyright (c) 2006 Ignacio Castano icastano@nvidia.com + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "fastclusterfit.h" +#include "colourset.h" +#include "colourblock.h" +#include + +#include "fastclusterlookup.inl" + +namespace squish { + +FastClusterFit::FastClusterFit() +{ +} + +void FastClusterFit::SetColourSet( ColourSet const* colours, int flags ) +{ + ColourFit::SetColourSet( colours, flags ); + + // initialise the best error +#if SQUISH_USE_SIMD + m_besterror = VEC4_CONST( FLT_MAX ); + Vec3 metric = m_metric.GetVec3(); +#else + m_besterror = FLT_MAX; + Vec3 metric = m_metric; +#endif + + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // get the covariance matrix + Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric ); + + // compute the principle component + Vec3 principle = ComputePrincipleComponent( covariance ); + + // build the list of values + float dps[16]; + for( int i = 0; i < count; ++i ) + { + dps[i] = Dot( values[i], principle ); + m_order[i] = i; + } + + // stable sort + for( int i = 0; i < count; ++i ) + { + for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j ) + { + std::swap( dps[j], dps[j - 1] ); + std::swap( m_order[j], m_order[j - 1] ); + } + } + + // weight all the points +#if SQUISH_USE_SIMD + Vec4 const* unweighted = m_colours->GetPointsSimd(); + m_xxsum = VEC4_CONST( 0.0f ); + m_xsum = VEC4_CONST( 0.0f ); +#else + Vec3 const* unweighted = m_colours->GetPoints(); + m_xxsum = Vec3( 0.0f ); + m_xsum = Vec3( 0.0f ); +#endif + + for( int i = 0; i < count; ++i ) + { + int p = m_order[i]; + m_unweighted[i] = unweighted[p]; + m_xxsum += m_unweighted[i]*m_unweighted[i]; + m_xsum += m_unweighted[i]; + } +} + + +void FastClusterFit::SetMetric(float r, float g, float b) +{ +#if SQUISH_USE_SIMD + m_metric = Vec4(r, g, b, 0); +#else + m_metric = Vec3(r, g, b); +#endif + m_metricSqr = m_metric * m_metric; +} + +float FastClusterFit::GetBestError() const +{ +#if SQUISH_USE_SIMD + Vec4 x = m_xxsum * m_metricSqr; + Vec4 error = m_besterror + x.SplatX() + x.SplatY() + x.SplatZ(); + return error.GetVec3().X(); +#else + return m_besterror + Dot(m_xxsum, m_metricSqr); +#endif + +} + +#if SQUISH_USE_SIMD + +void FastClusterFit::Compress3( void* block ) +{ + Vec4 const one = VEC4_CONST(1.0f); + Vec4 const zero = VEC4_CONST(0.0f); + Vec4 const half = VEC4_CONST(0.5f); + Vec4 const two = VEC4_CONST(2.0); + + // declare variables + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = VEC4_CONST( FLT_MAX ); + + Vec4 x0 = zero; + Vec4 x1; + int b0 = 0, b1 = 0; + int i = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= 16; c0++) + { + x1 = zero; + + for( int c1 = 0; c1 <= 16-c0; c1++) + { + Vec4 const constants = Vec4((const float *)&s_threeElement[i]); + Vec4 const alpha2_sum = constants.SplatX(); + Vec4 const beta2_sum = constants.SplatY(); + Vec4 const alphabeta_sum = constants.SplatZ(); + Vec4 const factor = constants.SplatW(); + i++; + + Vec4 const alphax_sum = MultiplyAdd(half, x1, x0); + Vec4 const betax_sum = m_xsum - alphax_sum; + + Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor; + Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor; + + // clamp the output to [0, 1] + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f ); + Vec4 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f, 0.0f ); + a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp; + b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp; + + // compute the error + Vec4 e1 = MultiplyAdd( a, alphax_sum, b*betax_sum ); + Vec4 e2 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum ); + Vec4 e3 = MultiplyAdd( a*b*alphabeta_sum - e1, two, e2 ); + + // apply the metric to the error term + Vec4 e4 = e3 * m_metricSqr; + Vec4 error = e4.SplatX() + e4.SplatY() + e4.SplatZ(); + + // keep the solution if it wins + if( CompareAnyLessThan( error, besterror ) ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + } + + x1 += m_unweighted[c0+c1]; + } + + x0 += m_unweighted[c0]; + } + + // save the block if necessary + if( CompareAnyLessThan( besterror, m_besterror ) ) + { + // compute indices from cluster sizes. + /*uint bestindices = 0; + { + int i = b0; + for(; i < b0+b1; i++) { + bestindices |= 2 << (2 * i); + } + for(; i < 16; i++) { + bestindices |= 1 << (2 * i); + } + }*/ + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < 16; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < 16; ++i ) + ordered[m_order[i]] = bestindices[i]; + + m_colours->RemapIndices( ordered, bestindices ); // Set alpha indices. + + // save the block + WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), ordered, block ); + + // save the error + m_besterror = besterror; + } +} + +void FastClusterFit::Compress4( void* block ) +{ + Vec4 const one = VEC4_CONST(1.0f); + Vec4 const zero = VEC4_CONST(0.0f); + Vec4 const half = VEC4_CONST(0.5f); + Vec4 const two = VEC4_CONST(2.0); + Vec4 const onethird = VEC4_CONST( 1.0f/3.0f ); + Vec4 const twothirds = VEC4_CONST( 2.0f/3.0f ); + + // declare variables + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = VEC4_CONST( FLT_MAX ); + + Vec4 x0 = zero; + int b0 = 0, b1 = 0, b2 = 0; + int i = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= 16; c0++) + { + Vec4 x1 = zero; + + for( int c1 = 0; c1 <= 16-c0; c1++) + { + Vec4 x2 = zero; + + for( int c2 = 0; c2 <= 16-c0-c1; c2++) + { + Vec4 const constants = Vec4((const float *)&s_fourElement[i]); + Vec4 const alpha2_sum = constants.SplatX(); + Vec4 const beta2_sum = constants.SplatY(); + Vec4 const alphabeta_sum = constants.SplatZ(); + Vec4 const factor = constants.SplatW(); + i++; + + Vec4 const alphax_sum = x0 + MultiplyAdd(x1, twothirds, x2 * onethird); + Vec4 const betax_sum = m_xsum - alphax_sum; + + Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor; + Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor; + + // clamp the output to [0, 1] + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f ); + Vec4 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f, 0.0f ); + a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp; + b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp; + + // compute the error + Vec4 e1 = MultiplyAdd( a, alphax_sum, b*betax_sum ); + Vec4 e2 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum ); + Vec4 e3 = MultiplyAdd( a*b*alphabeta_sum - e1, two, e2 ); + + // apply the metric to the error term + Vec4 e4 = e3 * m_metricSqr; + Vec4 error = e4.SplatX() + e4.SplatY() + e4.SplatZ(); + + // keep the solution if it wins + if( CompareAnyLessThan( error, besterror ) ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + b2 = c2; + } + + x2 += m_unweighted[c0+c1+c2]; + } + + x1 += m_unweighted[c0+c1]; + } + + x0 += m_unweighted[c0]; + } + + // save the block if necessary + if( CompareAnyLessThan( besterror, m_besterror ) ) + { + // compute indices from cluster sizes. + /*uint bestindices = 0; + { + int i = b0; + for(; i < b0+b1; i++) { + bestindices = 2 << (2 * m_order[i]); + } + for(; i < b0+b1+b2; i++) { + bestindices = 3 << (2 * m_order[i]); + } + for(; i < 16; i++) { + bestindices = 1 << (2 * m_order[i]); + } + }*/ + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < b0+b1+b2; i++) { + bestindices[i] = 3; + } + for(; i < 16; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < 16; ++i ) + ordered[m_order[i]] = bestindices[i]; + + // save the block + WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), ordered, block ); + + // save the error + m_besterror = besterror; + } +} + +#else + +void FastClusterFit::Compress3( void* block ) +{ + // declare variables + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = FLT_MAX; + + Vec3 x0(0.0f); + Vec3 x1; + int b0 = 0, b1 = 0; + int i = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= 16; c0++) + { + x1 = Vec3(0); + + for( int c1 = 0; c1 <= 16-c0; c1++) + { + float const alpha2_sum = s_threeElement[i].alpha2_sum; + float const beta2_sum = s_threeElement[i].beta2_sum; + float const alphabeta_sum = s_threeElement[i].alphabeta_sum; + float const factor = s_threeElement[i].factor; + i++; + + Vec3 const alphax_sum = x0 + x1 * 0.5f; + Vec3 const betax_sum = m_xsum - alphax_sum; + + Vec3 a = (alphax_sum*beta2_sum - betax_sum*alphabeta_sum) * factor; + Vec3 b = (betax_sum*alpha2_sum - alphax_sum*alphabeta_sum) * factor; + + // clamp the output to [0, 1] + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + Vec3 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f ); + Vec3 const half( 0.5f ); + a = Floor( grid*a + half )*gridrcp; + b = Floor( grid*b + half )*gridrcp; + + // compute the error + Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum ); + + // apply the metric to the error term + float error = Dot( e1, m_metricSqr ); + + // keep the solution if it wins + if( error < besterror ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + } + + x1 += m_unweighted[c0+c1]; + } + + x0 += m_unweighted[c0]; + } + + // save the block if necessary + if( besterror < m_besterror ) + { + // compute indices from cluster sizes. + /*uint bestindices = 0; + { + int i = b0; + for(; i < b0+b1; i++) { + bestindices |= 2 << (2 * m_order[i]); + } + for(; i < 16; i++) { + bestindices |= 1 << (2 * m_order[i]); + } + }*/ + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < 16; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < 16; ++i ) + ordered[m_order[i]] = bestindices[i]; + + // save the block + WriteColourBlock3( beststart, bestend, ordered, block ); + + // save the error + m_besterror = besterror; + } +} + +void FastClusterFit::Compress4( void* block ) +{ + // declare variables + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = FLT_MAX; + + Vec3 x0(0.0f); + Vec3 x1; + Vec3 x2; + int b0 = 0, b1 = 0, b2 = 0; + int i = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= 16; c0++) + { + x1 = Vec3(0.0f); + + for( int c1 = 0; c1 <= 16-c0; c1++) + { + x2 = Vec3(0.0f); + + for( int c2 = 0; c2 <= 16-c0-c1; c2++) + { + float const alpha2_sum = s_fourElement[i].alpha2_sum; + float const beta2_sum = s_fourElement[i].beta2_sum; + float const alphabeta_sum = s_fourElement[i].alphabeta_sum; + float const factor = s_fourElement[i].factor; + i++; + + Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f); + Vec3 const betax_sum = m_xsum - alphax_sum; + + Vec3 a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor; + Vec3 b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor; + + // clamp the output to [0, 1] + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + + // clamp to the grid + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + Vec3 const gridrcp( 0.03227752766457f, 0.01583151765563f, 0.03227752766457f ); + Vec3 const half( 0.5f ); + a = Floor( grid*a + half )*gridrcp; + b = Floor( grid*b + half )*gridrcp; + + // compute the error + Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum ); + + // apply the metric to the error term + float error = Dot( e1, m_metricSqr ); + + // keep the solution if it wins + if( error < besterror ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + b2 = c2; + } + + x2 += m_unweighted[c0+c1+c2]; + } + + x1 += m_unweighted[c0+c1]; + } + + x0 += m_unweighted[c0]; + } + + // save the block if necessary + if( besterror < m_besterror ) + { + // compute indices from cluster sizes. + /*uint bestindices = 0; + { + int i = b0; + for(; i < b0+b1; i++) { + bestindices = 2 << (2 * m_order[i]); + } + for(; i < b0+b1+b2; i++) { + bestindices = 3 << (2 * m_order[i]); + } + for(; i < 16; i++) { + bestindices = 1 << (2 * m_order[i]); + } + }*/ + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < b0+b1+b2; i++) { + bestindices[i] = 3; + } + for(; i < 16; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < 16; ++i ) + ordered[m_order[i]] = bestindices[i]; + + // save the block + WriteColourBlock4( beststart, bestend, ordered, block ); + + // save the error + m_besterror = besterror; + } +} + +#endif + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/fastclusterfit.h b/externals/NVTT/src/nvtt/squish/fastclusterfit.h new file mode 100644 index 00000000..d0ed9711 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/fastclusterfit.h @@ -0,0 +1,76 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + Copyright (c) 2006 Ignacio Castano icastano@nvidia.com + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_FASTCLUSTERFIT_H +#define SQUISH_FASTCLUSTERFIT_H + +#include "squish.h" +#include "maths.h" +#include "simd.h" +#include "colourfit.h" + +namespace squish { + +class FastClusterFit : public ColourFit +{ +public: + FastClusterFit(); + + void SetColourSet( ColourSet const* colours, int flags ); + + void SetMetric(float r, float g, float b); + float GetBestError() const; + + // Make them public + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + +private: + + Vec3 m_principle; + +#if SQUISH_USE_SIMD + Vec4 m_unweighted[16]; + Vec4 m_metric; + Vec4 m_metricSqr; + Vec4 m_xxsum; + Vec4 m_xsum; + Vec4 m_besterror; +#else + Vec3 m_unweighted[16]; + Vec3 m_metric; + Vec3 m_metricSqr; + Vec3 m_xxsum; + Vec3 m_xsum; + float m_besterror; +#endif + + int m_order[16]; +}; + +} // namespace squish + +#endif // ndef SQUISH_FASTCLUSTERFIT_H diff --git a/externals/NVTT/src/nvtt/squish/fastclusterlookup.inl b/externals/NVTT/src/nvtt/squish/fastclusterlookup.inl new file mode 100644 index 00000000..acdd6801 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/fastclusterlookup.inl @@ -0,0 +1,1135 @@ +struct Precomp { + float alpha2_sum; + float beta2_sum; + float alphabeta_sum; + float factor; +}; + +static const SQUISH_ALIGN_16 Precomp s_threeElement[153] = { + { 0.000000f, 16.000000f, 0.000000f, FLT_MAX }, // 0 (0 0 16) + { 0.250000f, 15.250000f, 0.250000f, 0.266667f }, // 1 (0 1 15) + { 0.500000f, 14.500000f, 0.500000f, 0.142857f }, // 2 (0 2 14) + { 0.750000f, 13.750000f, 0.750000f, 0.102564f }, // 3 (0 3 13) + { 1.000000f, 13.000000f, 1.000000f, 0.083333f }, // 4 (0 4 12) + { 1.250000f, 12.250000f, 1.250000f, 0.072727f }, // 5 (0 5 11) + { 1.500000f, 11.500000f, 1.500000f, 0.066667f }, // 6 (0 6 10) + { 1.750000f, 10.750000f, 1.750000f, 0.063492f }, // 7 (0 7 9) + { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 8 (0 8 8) + { 2.250000f, 9.250000f, 2.250000f, 0.063492f }, // 9 (0 9 7) + { 2.500000f, 8.500000f, 2.500000f, 0.066667f }, // 10 (0 10 6) + { 2.750000f, 7.750000f, 2.750000f, 0.072727f }, // 11 (0 11 5) + { 3.000000f, 7.000000f, 3.000000f, 0.083333f }, // 12 (0 12 4) + { 3.250000f, 6.250000f, 3.250000f, 0.102564f }, // 13 (0 13 3) + { 3.500000f, 5.500000f, 3.500000f, 0.142857f }, // 14 (0 14 2) + { 3.750000f, 4.750000f, 3.750000f, 0.266667f }, // 15 (0 15 1) + { 4.000000f, 4.000000f, 4.000000f, FLT_MAX }, // 16 (0 16 0) + { 1.000000f, 15.000000f, 0.000000f, 0.066667f }, // 17 (1 0 15) + { 1.250000f, 14.250000f, 0.250000f, 0.056338f }, // 18 (1 1 14) + { 1.500000f, 13.500000f, 0.500000f, 0.050000f }, // 19 (1 2 13) + { 1.750000f, 12.750000f, 0.750000f, 0.045977f }, // 20 (1 3 12) + { 2.000000f, 12.000000f, 1.000000f, 0.043478f }, // 21 (1 4 11) + { 2.250000f, 11.250000f, 1.250000f, 0.042105f }, // 22 (1 5 10) + { 2.500000f, 10.500000f, 1.500000f, 0.041667f }, // 23 (1 6 9) + { 2.750000f, 9.750000f, 1.750000f, 0.042105f }, // 24 (1 7 8) + { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 25 (1 8 7) + { 3.250000f, 8.250000f, 2.250000f, 0.045977f }, // 26 (1 9 6) + { 3.500000f, 7.500000f, 2.500000f, 0.050000f }, // 27 (1 10 5) + { 3.750000f, 6.750000f, 2.750000f, 0.056338f }, // 28 (1 11 4) + { 4.000000f, 6.000000f, 3.000000f, 0.066667f }, // 29 (1 12 3) + { 4.250000f, 5.250000f, 3.250000f, 0.085106f }, // 30 (1 13 2) + { 4.500000f, 4.500000f, 3.500000f, 0.125000f }, // 31 (1 14 1) + { 4.750000f, 3.750000f, 3.750000f, 0.266667f }, // 32 (1 15 0) + { 2.000000f, 14.000000f, 0.000000f, 0.035714f }, // 33 (2 0 14) + { 2.250000f, 13.250000f, 0.250000f, 0.033613f }, // 34 (2 1 13) + { 2.500000f, 12.500000f, 0.500000f, 0.032258f }, // 35 (2 2 12) + { 2.750000f, 11.750000f, 0.750000f, 0.031496f }, // 36 (2 3 11) + { 3.000000f, 11.000000f, 1.000000f, 0.031250f }, // 37 (2 4 10) + { 3.250000f, 10.250000f, 1.250000f, 0.031496f }, // 38 (2 5 9) + { 3.500000f, 9.500000f, 1.500000f, 0.032258f }, // 39 (2 6 8) + { 3.750000f, 8.750000f, 1.750000f, 0.033613f }, // 40 (2 7 7) + { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 41 (2 8 6) + { 4.250000f, 7.250000f, 2.250000f, 0.038835f }, // 42 (2 9 5) + { 4.500000f, 6.500000f, 2.500000f, 0.043478f }, // 43 (2 10 4) + { 4.750000f, 5.750000f, 2.750000f, 0.050633f }, // 44 (2 11 3) + { 5.000000f, 5.000000f, 3.000000f, 0.062500f }, // 45 (2 12 2) + { 5.250000f, 4.250000f, 3.250000f, 0.085106f }, // 46 (2 13 1) + { 5.500000f, 3.500000f, 3.500000f, 0.142857f }, // 47 (2 14 0) + { 3.000000f, 13.000000f, 0.000000f, 0.025641f }, // 48 (3 0 13) + { 3.250000f, 12.250000f, 0.250000f, 0.025157f }, // 49 (3 1 12) + { 3.500000f, 11.500000f, 0.500000f, 0.025000f }, // 50 (3 2 11) + { 3.750000f, 10.750000f, 0.750000f, 0.025157f }, // 51 (3 3 10) + { 4.000000f, 10.000000f, 1.000000f, 0.025641f }, // 52 (3 4 9) + { 4.250000f, 9.250000f, 1.250000f, 0.026490f }, // 53 (3 5 8) + { 4.500000f, 8.500000f, 1.500000f, 0.027778f }, // 54 (3 6 7) + { 4.750000f, 7.750000f, 1.750000f, 0.029630f }, // 55 (3 7 6) + { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 56 (3 8 5) + { 5.250000f, 6.250000f, 2.250000f, 0.036036f }, // 57 (3 9 4) + { 5.500000f, 5.500000f, 2.500000f, 0.041667f }, // 58 (3 10 3) + { 5.750000f, 4.750000f, 2.750000f, 0.050633f }, // 59 (3 11 2) + { 6.000000f, 4.000000f, 3.000000f, 0.066667f }, // 60 (3 12 1) + { 6.250000f, 3.250000f, 3.250000f, 0.102564f }, // 61 (3 13 0) + { 4.000000f, 12.000000f, 0.000000f, 0.020833f }, // 62 (4 0 12) + { 4.250000f, 11.250000f, 0.250000f, 0.020942f }, // 63 (4 1 11) + { 4.500000f, 10.500000f, 0.500000f, 0.021277f }, // 64 (4 2 10) + { 4.750000f, 9.750000f, 0.750000f, 0.021858f }, // 65 (4 3 9) + { 5.000000f, 9.000000f, 1.000000f, 0.022727f }, // 66 (4 4 8) + { 5.250000f, 8.250000f, 1.250000f, 0.023952f }, // 67 (4 5 7) + { 5.500000f, 7.500000f, 1.500000f, 0.025641f }, // 68 (4 6 6) + { 5.750000f, 6.750000f, 1.750000f, 0.027972f }, // 69 (4 7 5) + { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 70 (4 8 4) + { 6.250000f, 5.250000f, 2.250000f, 0.036036f }, // 71 (4 9 3) + { 6.500000f, 4.500000f, 2.500000f, 0.043478f }, // 72 (4 10 2) + { 6.750000f, 3.750000f, 2.750000f, 0.056338f }, // 73 (4 11 1) + { 7.000000f, 3.000000f, 3.000000f, 0.083333f }, // 74 (4 12 0) + { 5.000000f, 11.000000f, 0.000000f, 0.018182f }, // 75 (5 0 11) + { 5.250000f, 10.250000f, 0.250000f, 0.018605f }, // 76 (5 1 10) + { 5.500000f, 9.500000f, 0.500000f, 0.019231f }, // 77 (5 2 9) + { 5.750000f, 8.750000f, 0.750000f, 0.020101f }, // 78 (5 3 8) + { 6.000000f, 8.000000f, 1.000000f, 0.021277f }, // 79 (5 4 7) + { 6.250000f, 7.250000f, 1.250000f, 0.022857f }, // 80 (5 5 6) + { 6.500000f, 6.500000f, 1.500000f, 0.025000f }, // 81 (5 6 5) + { 6.750000f, 5.750000f, 1.750000f, 0.027972f }, // 82 (5 7 4) + { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 83 (5 8 3) + { 7.250000f, 4.250000f, 2.250000f, 0.038835f }, // 84 (5 9 2) + { 7.500000f, 3.500000f, 2.500000f, 0.050000f }, // 85 (5 10 1) + { 7.750000f, 2.750000f, 2.750000f, 0.072727f }, // 86 (5 11 0) + { 6.000000f, 10.000000f, 0.000000f, 0.016667f }, // 87 (6 0 10) + { 6.250000f, 9.250000f, 0.250000f, 0.017316f }, // 88 (6 1 9) + { 6.500000f, 8.500000f, 0.500000f, 0.018182f }, // 89 (6 2 8) + { 6.750000f, 7.750000f, 0.750000f, 0.019324f }, // 90 (6 3 7) + { 7.000000f, 7.000000f, 1.000000f, 0.020833f }, // 91 (6 4 6) + { 7.250000f, 6.250000f, 1.250000f, 0.022857f }, // 92 (6 5 5) + { 7.500000f, 5.500000f, 1.500000f, 0.025641f }, // 93 (6 6 4) + { 7.750000f, 4.750000f, 1.750000f, 0.029630f }, // 94 (6 7 3) + { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 95 (6 8 2) + { 8.250000f, 3.250000f, 2.250000f, 0.045977f }, // 96 (6 9 1) + { 8.500000f, 2.500000f, 2.500000f, 0.066667f }, // 97 (6 10 0) + { 7.000000f, 9.000000f, 0.000000f, 0.015873f }, // 98 (7 0 9) + { 7.250000f, 8.250000f, 0.250000f, 0.016736f }, // 99 (7 1 8) + { 7.500000f, 7.500000f, 0.500000f, 0.017857f }, // 100 (7 2 7) + { 7.750000f, 6.750000f, 0.750000f, 0.019324f }, // 101 (7 3 6) + { 8.000000f, 6.000000f, 1.000000f, 0.021277f }, // 102 (7 4 5) + { 8.250000f, 5.250000f, 1.250000f, 0.023952f }, // 103 (7 5 4) + { 8.500000f, 4.500000f, 1.500000f, 0.027778f }, // 104 (7 6 3) + { 8.750000f, 3.750000f, 1.750000f, 0.033613f }, // 105 (7 7 2) + { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 106 (7 8 1) + { 9.250000f, 2.250000f, 2.250000f, 0.063492f }, // 107 (7 9 0) + { 8.000000f, 8.000000f, 0.000000f, 0.015625f }, // 108 (8 0 8) + { 8.250000f, 7.250000f, 0.250000f, 0.016736f }, // 109 (8 1 7) + { 8.500000f, 6.500000f, 0.500000f, 0.018182f }, // 110 (8 2 6) + { 8.750000f, 5.750000f, 0.750000f, 0.020101f }, // 111 (8 3 5) + { 9.000000f, 5.000000f, 1.000000f, 0.022727f }, // 112 (8 4 4) + { 9.250000f, 4.250000f, 1.250000f, 0.026490f }, // 113 (8 5 3) + { 9.500000f, 3.500000f, 1.500000f, 0.032258f }, // 114 (8 6 2) + { 9.750000f, 2.750000f, 1.750000f, 0.042105f }, // 115 (8 7 1) + { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 116 (8 8 0) + { 9.000000f, 7.000000f, 0.000000f, 0.015873f }, // 117 (9 0 7) + { 9.250000f, 6.250000f, 0.250000f, 0.017316f }, // 118 (9 1 6) + { 9.500000f, 5.500000f, 0.500000f, 0.019231f }, // 119 (9 2 5) + { 9.750000f, 4.750000f, 0.750000f, 0.021858f }, // 120 (9 3 4) + { 10.000000f, 4.000000f, 1.000000f, 0.025641f }, // 121 (9 4 3) + { 10.250000f, 3.250000f, 1.250000f, 0.031496f }, // 122 (9 5 2) + { 10.500000f, 2.500000f, 1.500000f, 0.041667f }, // 123 (9 6 1) + { 10.750000f, 1.750000f, 1.750000f, 0.063492f }, // 124 (9 7 0) + { 10.000000f, 6.000000f, 0.000000f, 0.016667f }, // 125 (10 0 6) + { 10.250000f, 5.250000f, 0.250000f, 0.018605f }, // 126 (10 1 5) + { 10.500000f, 4.500000f, 0.500000f, 0.021277f }, // 127 (10 2 4) + { 10.750000f, 3.750000f, 0.750000f, 0.025157f }, // 128 (10 3 3) + { 11.000000f, 3.000000f, 1.000000f, 0.031250f }, // 129 (10 4 2) + { 11.250000f, 2.250000f, 1.250000f, 0.042105f }, // 130 (10 5 1) + { 11.500000f, 1.500000f, 1.500000f, 0.066667f }, // 131 (10 6 0) + { 11.000000f, 5.000000f, 0.000000f, 0.018182f }, // 132 (11 0 5) + { 11.250000f, 4.250000f, 0.250000f, 0.020942f }, // 133 (11 1 4) + { 11.500000f, 3.500000f, 0.500000f, 0.025000f }, // 134 (11 2 3) + { 11.750000f, 2.750000f, 0.750000f, 0.031496f }, // 135 (11 3 2) + { 12.000000f, 2.000000f, 1.000000f, 0.043478f }, // 136 (11 4 1) + { 12.250000f, 1.250000f, 1.250000f, 0.072727f }, // 137 (11 5 0) + { 12.000000f, 4.000000f, 0.000000f, 0.020833f }, // 138 (12 0 4) + { 12.250000f, 3.250000f, 0.250000f, 0.025157f }, // 139 (12 1 3) + { 12.500000f, 2.500000f, 0.500000f, 0.032258f }, // 140 (12 2 2) + { 12.750000f, 1.750000f, 0.750000f, 0.045977f }, // 141 (12 3 1) + { 13.000000f, 1.000000f, 1.000000f, 0.083333f }, // 142 (12 4 0) + { 13.000000f, 3.000000f, 0.000000f, 0.025641f }, // 143 (13 0 3) + { 13.250000f, 2.250000f, 0.250000f, 0.033613f }, // 144 (13 1 2) + { 13.500000f, 1.500000f, 0.500000f, 0.050000f }, // 145 (13 2 1) + { 13.750000f, 0.750000f, 0.750000f, 0.102564f }, // 146 (13 3 0) + { 14.000000f, 2.000000f, 0.000000f, 0.035714f }, // 147 (14 0 2) + { 14.250000f, 1.250000f, 0.250000f, 0.056338f }, // 148 (14 1 1) + { 14.500000f, 0.500000f, 0.500000f, 0.142857f }, // 149 (14 2 0) + { 15.000000f, 1.000000f, 0.000000f, 0.066667f }, // 150 (15 0 1) + { 15.250000f, 0.250000f, 0.250000f, 0.266667f }, // 151 (15 1 0) + { 16.000000f, 0.000000f, 0.000000f, FLT_MAX }, // 152 (16 0 0) +}; // 153 three cluster elements + +static const SQUISH_ALIGN_16 Precomp s_fourElement[969] = { + { 0.000000f, 16.000000f, 0.000000f, FLT_MAX }, // 0 (0 0 0 16) + { 0.111111f, 15.444445f, 0.222222f, 0.600000f }, // 1 (0 0 1 15) + { 0.222222f, 14.888889f, 0.444444f, 0.321429f }, // 2 (0 0 2 14) + { 0.333333f, 14.333333f, 0.666667f, 0.230769f }, // 3 (0 0 3 13) + { 0.444444f, 13.777778f, 0.888889f, 0.187500f }, // 4 (0 0 4 12) + { 0.555556f, 13.222222f, 1.111111f, 0.163636f }, // 5 (0 0 5 11) + { 0.666667f, 12.666667f, 1.333333f, 0.150000f }, // 6 (0 0 6 10) + { 0.777778f, 12.111111f, 1.555556f, 0.142857f }, // 7 (0 0 7 9) + { 0.888889f, 11.555555f, 1.777778f, 0.140625f }, // 8 (0 0 8 8) + { 1.000000f, 11.000000f, 2.000000f, 0.142857f }, // 9 (0 0 9 7) + { 1.111111f, 10.444445f, 2.222222f, 0.150000f }, // 10 (0 0 10 6) + { 1.222222f, 9.888889f, 2.444444f, 0.163636f }, // 11 (0 0 11 5) + { 1.333333f, 9.333333f, 2.666667f, 0.187500f }, // 12 (0 0 12 4) + { 1.444444f, 8.777778f, 2.888889f, 0.230769f }, // 13 (0 0 13 3) + { 1.555556f, 8.222222f, 3.111111f, 0.321429f }, // 14 (0 0 14 2) + { 1.666667f, 7.666667f, 3.333333f, 0.600000f }, // 15 (0 0 15 1) + { 1.777778f, 7.111111f, 3.555556f, FLT_MAX }, // 16 (0 0 16 0) + { 0.444444f, 15.111111f, 0.222222f, 0.150000f }, // 17 (0 1 0 15) + { 0.555556f, 14.555555f, 0.444444f, 0.126761f }, // 18 (0 1 1 14) + { 0.666667f, 14.000000f, 0.666667f, 0.112500f }, // 19 (0 1 2 13) + { 0.777778f, 13.444445f, 0.888889f, 0.103448f }, // 20 (0 1 3 12) + { 0.888889f, 12.888889f, 1.111111f, 0.097826f }, // 21 (0 1 4 11) + { 1.000000f, 12.333333f, 1.333333f, 0.094737f }, // 22 (0 1 5 10) + { 1.111111f, 11.777778f, 1.555556f, 0.093750f }, // 23 (0 1 6 9) + { 1.222222f, 11.222222f, 1.777778f, 0.094737f }, // 24 (0 1 7 8) + { 1.333333f, 10.666667f, 2.000000f, 0.097826f }, // 25 (0 1 8 7) + { 1.444444f, 10.111111f, 2.222222f, 0.103448f }, // 26 (0 1 9 6) + { 1.555556f, 9.555555f, 2.444444f, 0.112500f }, // 27 (0 1 10 5) + { 1.666667f, 9.000000f, 2.666667f, 0.126761f }, // 28 (0 1 11 4) + { 1.777778f, 8.444445f, 2.888889f, 0.150000f }, // 29 (0 1 12 3) + { 1.888889f, 7.888889f, 3.111111f, 0.191489f }, // 30 (0 1 13 2) + { 2.000000f, 7.333333f, 3.333333f, 0.281250f }, // 31 (0 1 14 1) + { 2.111111f, 6.777778f, 3.555556f, 0.600000f }, // 32 (0 1 15 0) + { 0.888889f, 14.222222f, 0.444444f, 0.080357f }, // 33 (0 2 0 14) + { 1.000000f, 13.666667f, 0.666667f, 0.075630f }, // 34 (0 2 1 13) + { 1.111111f, 13.111111f, 0.888889f, 0.072581f }, // 35 (0 2 2 12) + { 1.222222f, 12.555555f, 1.111111f, 0.070866f }, // 36 (0 2 3 11) + { 1.333333f, 12.000000f, 1.333333f, 0.070313f }, // 37 (0 2 4 10) + { 1.444444f, 11.444445f, 1.555556f, 0.070866f }, // 38 (0 2 5 9) + { 1.555556f, 10.888889f, 1.777778f, 0.072581f }, // 39 (0 2 6 8) + { 1.666667f, 10.333333f, 2.000000f, 0.075630f }, // 40 (0 2 7 7) + { 1.777778f, 9.777778f, 2.222222f, 0.080357f }, // 41 (0 2 8 6) + { 1.888889f, 9.222222f, 2.444444f, 0.087379f }, // 42 (0 2 9 5) + { 2.000000f, 8.666667f, 2.666667f, 0.097826f }, // 43 (0 2 10 4) + { 2.111111f, 8.111111f, 2.888889f, 0.113924f }, // 44 (0 2 11 3) + { 2.222222f, 7.555556f, 3.111111f, 0.140625f }, // 45 (0 2 12 2) + { 2.333333f, 7.000000f, 3.333333f, 0.191489f }, // 46 (0 2 13 1) + { 2.444444f, 6.444445f, 3.555556f, 0.321429f }, // 47 (0 2 14 0) + { 1.333333f, 13.333333f, 0.666667f, 0.057692f }, // 48 (0 3 0 13) + { 1.444444f, 12.777778f, 0.888889f, 0.056604f }, // 49 (0 3 1 12) + { 1.555556f, 12.222222f, 1.111111f, 0.056250f }, // 50 (0 3 2 11) + { 1.666667f, 11.666667f, 1.333333f, 0.056604f }, // 51 (0 3 3 10) + { 1.777778f, 11.111111f, 1.555556f, 0.057692f }, // 52 (0 3 4 9) + { 1.888889f, 10.555555f, 1.777778f, 0.059603f }, // 53 (0 3 5 8) + { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 54 (0 3 6 7) + { 2.111111f, 9.444445f, 2.222222f, 0.066667f }, // 55 (0 3 7 6) + { 2.222222f, 8.888889f, 2.444444f, 0.072581f }, // 56 (0 3 8 5) + { 2.333333f, 8.333333f, 2.666667f, 0.081081f }, // 57 (0 3 9 4) + { 2.444444f, 7.777778f, 2.888889f, 0.093750f }, // 58 (0 3 10 3) + { 2.555556f, 7.222222f, 3.111111f, 0.113924f }, // 59 (0 3 11 2) + { 2.666667f, 6.666667f, 3.333333f, 0.150000f }, // 60 (0 3 12 1) + { 2.777778f, 6.111111f, 3.555556f, 0.230769f }, // 61 (0 3 13 0) + { 1.777778f, 12.444445f, 0.888889f, 0.046875f }, // 62 (0 4 0 12) + { 1.888889f, 11.888889f, 1.111111f, 0.047120f }, // 63 (0 4 1 11) + { 2.000000f, 11.333333f, 1.333333f, 0.047872f }, // 64 (0 4 2 10) + { 2.111111f, 10.777778f, 1.555556f, 0.049180f }, // 65 (0 4 3 9) + { 2.222222f, 10.222222f, 1.777778f, 0.051136f }, // 66 (0 4 4 8) + { 2.333333f, 9.666667f, 2.000000f, 0.053892f }, // 67 (0 4 5 7) + { 2.444444f, 9.111111f, 2.222222f, 0.057692f }, // 68 (0 4 6 6) + { 2.555556f, 8.555555f, 2.444444f, 0.062937f }, // 69 (0 4 7 5) + { 2.666667f, 8.000000f, 2.666667f, 0.070313f }, // 70 (0 4 8 4) + { 2.777778f, 7.444445f, 2.888889f, 0.081081f }, // 71 (0 4 9 3) + { 2.888889f, 6.888889f, 3.111111f, 0.097826f }, // 72 (0 4 10 2) + { 3.000000f, 6.333333f, 3.333333f, 0.126761f }, // 73 (0 4 11 1) + { 3.111111f, 5.777778f, 3.555556f, 0.187500f }, // 74 (0 4 12 0) + { 2.222222f, 11.555555f, 1.111111f, 0.040909f }, // 75 (0 5 0 11) + { 2.333333f, 11.000000f, 1.333333f, 0.041860f }, // 76 (0 5 1 10) + { 2.444444f, 10.444445f, 1.555556f, 0.043269f }, // 77 (0 5 2 9) + { 2.555556f, 9.888889f, 1.777778f, 0.045226f }, // 78 (0 5 3 8) + { 2.666667f, 9.333333f, 2.000000f, 0.047872f }, // 79 (0 5 4 7) + { 2.777778f, 8.777778f, 2.222222f, 0.051429f }, // 80 (0 5 5 6) + { 2.888889f, 8.222222f, 2.444444f, 0.056250f }, // 81 (0 5 6 5) + { 3.000000f, 7.666667f, 2.666667f, 0.062937f }, // 82 (0 5 7 4) + { 3.111111f, 7.111111f, 2.888889f, 0.072581f }, // 83 (0 5 8 3) + { 3.222222f, 6.555556f, 3.111111f, 0.087379f }, // 84 (0 5 9 2) + { 3.333333f, 6.000000f, 3.333333f, 0.112500f }, // 85 (0 5 10 1) + { 3.444444f, 5.444445f, 3.555556f, 0.163636f }, // 86 (0 5 11 0) + { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 87 (0 6 0 10) + { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 88 (0 6 1 9) + { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 89 (0 6 2 8) + { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 90 (0 6 3 7) + { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 91 (0 6 4 6) + { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 92 (0 6 5 5) + { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 93 (0 6 6 4) + { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 94 (0 6 7 3) + { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 95 (0 6 8 2) + { 3.666667f, 5.666667f, 3.333333f, 0.103448f }, // 96 (0 6 9 1) + { 3.777778f, 5.111111f, 3.555556f, 0.150000f }, // 97 (0 6 10 0) + { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 98 (0 7 0 9) + { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 99 (0 7 1 8) + { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 100 (0 7 2 7) + { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 101 (0 7 3 6) + { 3.555556f, 7.555555f, 2.444444f, 0.047872f }, // 102 (0 7 4 5) + { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 103 (0 7 5 4) + { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 104 (0 7 6 3) + { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 105 (0 7 7 2) + { 4.000000f, 5.333333f, 3.333333f, 0.097826f }, // 106 (0 7 8 1) + { 4.111111f, 4.777778f, 3.555556f, 0.142857f }, // 107 (0 7 9 0) + { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 108 (0 8 0 8) + { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 109 (0 8 1 7) + { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 110 (0 8 2 6) + { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 111 (0 8 3 5) + { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 112 (0 8 4 4) + { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 113 (0 8 5 3) + { 4.222222f, 5.555555f, 3.111111f, 0.072581f }, // 114 (0 8 6 2) + { 4.333333f, 5.000000f, 3.333333f, 0.094737f }, // 115 (0 8 7 1) + { 4.444445f, 4.444445f, 3.555556f, 0.140625f }, // 116 (0 8 8 0) + { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 117 (0 9 0 7) + { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 118 (0 9 1 6) + { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 119 (0 9 2 5) + { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 120 (0 9 3 4) + { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 121 (0 9 4 3) + { 4.555556f, 5.222222f, 3.111111f, 0.070866f }, // 122 (0 9 5 2) + { 4.666667f, 4.666667f, 3.333333f, 0.093750f }, // 123 (0 9 6 1) + { 4.777778f, 4.111111f, 3.555556f, 0.142857f }, // 124 (0 9 7 0) + { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 125 (0 10 0 6) + { 4.555556f, 6.555555f, 2.444444f, 0.041860f }, // 126 (0 10 1 5) + { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 127 (0 10 2 4) + { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 128 (0 10 3 3) + { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 129 (0 10 4 2) + { 5.000000f, 4.333333f, 3.333333f, 0.094737f }, // 130 (0 10 5 1) + { 5.111111f, 3.777778f, 3.555556f, 0.150000f }, // 131 (0 10 6 0) + { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 132 (0 11 0 5) + { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 133 (0 11 1 4) + { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 134 (0 11 2 3) + { 5.222222f, 4.555555f, 3.111111f, 0.070866f }, // 135 (0 11 3 2) + { 5.333333f, 4.000000f, 3.333333f, 0.097826f }, // 136 (0 11 4 1) + { 5.444445f, 3.444444f, 3.555556f, 0.163636f }, // 137 (0 11 5 0) + { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 138 (0 12 0 4) + { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 139 (0 12 1 3) + { 5.555556f, 4.222222f, 3.111111f, 0.072581f }, // 140 (0 12 2 2) + { 5.666667f, 3.666667f, 3.333333f, 0.103448f }, // 141 (0 12 3 1) + { 5.777778f, 3.111111f, 3.555556f, 0.187500f }, // 142 (0 12 4 0) + { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 143 (0 13 0 3) + { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 144 (0 13 1 2) + { 6.000000f, 3.333333f, 3.333333f, 0.112500f }, // 145 (0 13 2 1) + { 6.111111f, 2.777778f, 3.555556f, 0.230769f }, // 146 (0 13 3 0) + { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 147 (0 14 0 2) + { 6.333333f, 3.000000f, 3.333333f, 0.126761f }, // 148 (0 14 1 1) + { 6.444445f, 2.444444f, 3.555556f, 0.321429f }, // 149 (0 14 2 0) + { 6.666667f, 2.666667f, 3.333333f, 0.150000f }, // 150 (0 15 0 1) + { 6.777778f, 2.111111f, 3.555556f, 0.600000f }, // 151 (0 15 1 0) + { 7.111111f, 1.777778f, 3.555556f, FLT_MAX }, // 152 (0 16 0 0) + { 1.000000f, 15.000000f, 0.000000f, 0.066667f }, // 153 (1 0 0 15) + { 1.111111f, 14.444445f, 0.222222f, 0.062500f }, // 154 (1 0 1 14) + { 1.222222f, 13.888889f, 0.444444f, 0.059603f }, // 155 (1 0 2 13) + { 1.333333f, 13.333333f, 0.666667f, 0.057692f }, // 156 (1 0 3 12) + { 1.444444f, 12.777778f, 0.888889f, 0.056604f }, // 157 (1 0 4 11) + { 1.555556f, 12.222222f, 1.111111f, 0.056250f }, // 158 (1 0 5 10) + { 1.666667f, 11.666667f, 1.333333f, 0.056604f }, // 159 (1 0 6 9) + { 1.777778f, 11.111111f, 1.555556f, 0.057692f }, // 160 (1 0 7 8) + { 1.888889f, 10.555555f, 1.777778f, 0.059603f }, // 161 (1 0 8 7) + { 2.000000f, 10.000000f, 2.000000f, 0.062500f }, // 162 (1 0 9 6) + { 2.111111f, 9.444445f, 2.222222f, 0.066667f }, // 163 (1 0 10 5) + { 2.222222f, 8.888889f, 2.444444f, 0.072581f }, // 164 (1 0 11 4) + { 2.333333f, 8.333333f, 2.666667f, 0.081081f }, // 165 (1 0 12 3) + { 2.444444f, 7.777778f, 2.888889f, 0.093750f }, // 166 (1 0 13 2) + { 2.555556f, 7.222222f, 3.111111f, 0.113924f }, // 167 (1 0 14 1) + { 2.666667f, 6.666667f, 3.333333f, 0.150000f }, // 168 (1 0 15 0) + { 1.444444f, 14.111111f, 0.222222f, 0.049180f }, // 169 (1 1 0 14) + { 1.555556f, 13.555555f, 0.444444f, 0.047872f }, // 170 (1 1 1 13) + { 1.666667f, 13.000000f, 0.666667f, 0.047120f }, // 171 (1 1 2 12) + { 1.777778f, 12.444445f, 0.888889f, 0.046875f }, // 172 (1 1 3 11) + { 1.888889f, 11.888889f, 1.111111f, 0.047120f }, // 173 (1 1 4 10) + { 2.000000f, 11.333333f, 1.333333f, 0.047872f }, // 174 (1 1 5 9) + { 2.111111f, 10.777778f, 1.555556f, 0.049180f }, // 175 (1 1 6 8) + { 2.222222f, 10.222222f, 1.777778f, 0.051136f }, // 176 (1 1 7 7) + { 2.333333f, 9.666667f, 2.000000f, 0.053892f }, // 177 (1 1 8 6) + { 2.444444f, 9.111111f, 2.222222f, 0.057692f }, // 178 (1 1 9 5) + { 2.555556f, 8.555555f, 2.444444f, 0.062937f }, // 179 (1 1 10 4) + { 2.666667f, 8.000000f, 2.666667f, 0.070313f }, // 180 (1 1 11 3) + { 2.777778f, 7.444445f, 2.888889f, 0.081081f }, // 181 (1 1 12 2) + { 2.888889f, 6.888889f, 3.111111f, 0.097826f }, // 182 (1 1 13 1) + { 3.000000f, 6.333333f, 3.333333f, 0.126761f }, // 183 (1 1 14 0) + { 1.888889f, 13.222222f, 0.444444f, 0.040359f }, // 184 (1 2 0 13) + { 2.000000f, 12.666667f, 0.666667f, 0.040179f }, // 185 (1 2 1 12) + { 2.111111f, 12.111111f, 0.888889f, 0.040359f }, // 186 (1 2 2 11) + { 2.222222f, 11.555555f, 1.111111f, 0.040909f }, // 187 (1 2 3 10) + { 2.333333f, 11.000000f, 1.333333f, 0.041860f }, // 188 (1 2 4 9) + { 2.444444f, 10.444445f, 1.555556f, 0.043269f }, // 189 (1 2 5 8) + { 2.555556f, 9.888889f, 1.777778f, 0.045226f }, // 190 (1 2 6 7) + { 2.666667f, 9.333333f, 2.000000f, 0.047872f }, // 191 (1 2 7 6) + { 2.777778f, 8.777778f, 2.222222f, 0.051429f }, // 192 (1 2 8 5) + { 2.888889f, 8.222222f, 2.444444f, 0.056250f }, // 193 (1 2 9 4) + { 3.000000f, 7.666667f, 2.666667f, 0.062937f }, // 194 (1 2 10 3) + { 3.111111f, 7.111111f, 2.888889f, 0.072581f }, // 195 (1 2 11 2) + { 3.222222f, 6.555556f, 3.111111f, 0.087379f }, // 196 (1 2 12 1) + { 3.333333f, 6.000000f, 3.333333f, 0.112500f }, // 197 (1 2 13 0) + { 2.333333f, 12.333333f, 0.666667f, 0.035294f }, // 198 (1 3 0 12) + { 2.444444f, 11.777778f, 0.888889f, 0.035714f }, // 199 (1 3 1 11) + { 2.555556f, 11.222222f, 1.111111f, 0.036437f }, // 200 (1 3 2 10) + { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 201 (1 3 3 9) + { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 202 (1 3 4 8) + { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 203 (1 3 5 7) + { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 204 (1 3 6 6) + { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 205 (1 3 7 5) + { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 206 (1 3 8 4) + { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 207 (1 3 9 3) + { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 208 (1 3 10 2) + { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 209 (1 3 11 1) + { 3.666667f, 5.666667f, 3.333333f, 0.103448f }, // 210 (1 3 12 0) + { 2.777778f, 11.444445f, 0.888889f, 0.032258f }, // 211 (1 4 0 11) + { 2.888889f, 10.888889f, 1.111111f, 0.033088f }, // 212 (1 4 1 10) + { 3.000000f, 10.333333f, 1.333333f, 0.034221f }, // 213 (1 4 2 9) + { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 214 (1 4 3 8) + { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 215 (1 4 4 7) + { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 216 (1 4 5 6) + { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 217 (1 4 6 5) + { 3.555556f, 7.555555f, 2.444444f, 0.047872f }, // 218 (1 4 7 4) + { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 219 (1 4 8 3) + { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 220 (1 4 9 2) + { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 221 (1 4 10 1) + { 4.000000f, 5.333333f, 3.333333f, 0.097826f }, // 222 (1 4 11 0) + { 3.222222f, 10.555555f, 1.111111f, 0.030508f }, // 223 (1 5 0 10) + { 3.333333f, 10.000000f, 1.333333f, 0.031690f }, // 224 (1 5 1 9) + { 3.444444f, 9.444445f, 1.555556f, 0.033210f }, // 225 (1 5 2 8) + { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 226 (1 5 3 7) + { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 227 (1 5 4 6) + { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 228 (1 5 5 5) + { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 229 (1 5 6 4) + { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 230 (1 5 7 3) + { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 231 (1 5 8 2) + { 4.222222f, 5.555556f, 3.111111f, 0.072581f }, // 232 (1 5 9 1) + { 4.333333f, 5.000000f, 3.333333f, 0.094737f }, // 233 (1 5 10 0) + { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 234 (1 6 0 9) + { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 235 (1 6 1 8) + { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 236 (1 6 2 7) + { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 237 (1 6 3 6) + { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 238 (1 6 4 5) + { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 239 (1 6 5 4) + { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 240 (1 6 6 3) + { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 241 (1 6 7 2) + { 4.555555f, 5.222222f, 3.111111f, 0.070866f }, // 242 (1 6 8 1) + { 4.666667f, 4.666667f, 3.333333f, 0.093750f }, // 243 (1 6 9 0) + { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 244 (1 7 0 8) + { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 245 (1 7 1 7) + { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 246 (1 7 2 6) + { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 247 (1 7 3 5) + { 4.555555f, 6.555555f, 2.444444f, 0.041860f }, // 248 (1 7 4 4) + { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 249 (1 7 5 3) + { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 250 (1 7 6 2) + { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 251 (1 7 7 1) + { 5.000000f, 4.333333f, 3.333333f, 0.094737f }, // 252 (1 7 8 0) + { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 253 (1 8 0 7) + { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 254 (1 8 1 6) + { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 255 (1 8 2 5) + { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 256 (1 8 3 4) + { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 257 (1 8 4 3) + { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 258 (1 8 5 2) + { 5.222222f, 4.555555f, 3.111111f, 0.070866f }, // 259 (1 8 6 1) + { 5.333333f, 4.000000f, 3.333333f, 0.097826f }, // 260 (1 8 7 0) + { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 261 (1 9 0 6) + { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 262 (1 9 1 5) + { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 263 (1 9 2 4) + { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 264 (1 9 3 3) + { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 265 (1 9 4 2) + { 5.555556f, 4.222222f, 3.111111f, 0.072581f }, // 266 (1 9 5 1) + { 5.666667f, 3.666667f, 3.333333f, 0.103448f }, // 267 (1 9 6 0) + { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 268 (1 10 0 5) + { 5.555556f, 5.555555f, 2.444444f, 0.040179f }, // 269 (1 10 1 4) + { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 270 (1 10 2 3) + { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 271 (1 10 3 2) + { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 272 (1 10 4 1) + { 6.000000f, 3.333333f, 3.333333f, 0.112500f }, // 273 (1 10 5 0) + { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 274 (1 11 0 4) + { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 275 (1 11 1 3) + { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 276 (1 11 2 2) + { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 277 (1 11 3 1) + { 6.333333f, 3.000000f, 3.333333f, 0.126761f }, // 278 (1 11 4 0) + { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 279 (1 12 0 3) + { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 280 (1 12 1 2) + { 6.555556f, 3.222222f, 3.111111f, 0.087379f }, // 281 (1 12 2 1) + { 6.666667f, 2.666667f, 3.333333f, 0.150000f }, // 282 (1 12 3 0) + { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 283 (1 13 0 2) + { 6.888889f, 2.888889f, 3.111111f, 0.097826f }, // 284 (1 13 1 1) + { 7.000000f, 2.333333f, 3.333333f, 0.191489f }, // 285 (1 13 2 0) + { 7.222222f, 2.555556f, 3.111111f, 0.113924f }, // 286 (1 14 0 1) + { 7.333333f, 2.000000f, 3.333333f, 0.281250f }, // 287 (1 14 1 0) + { 7.666667f, 1.666667f, 3.333333f, 0.600000f }, // 288 (1 15 0 0) + { 2.000000f, 14.000000f, 0.000000f, 0.035714f }, // 289 (2 0 0 14) + { 2.111111f, 13.444445f, 0.222222f, 0.035294f }, // 290 (2 0 1 13) + { 2.222222f, 12.888889f, 0.444444f, 0.035156f }, // 291 (2 0 2 12) + { 2.333333f, 12.333333f, 0.666667f, 0.035294f }, // 292 (2 0 3 11) + { 2.444444f, 11.777778f, 0.888889f, 0.035714f }, // 293 (2 0 4 10) + { 2.555556f, 11.222222f, 1.111111f, 0.036437f }, // 294 (2 0 5 9) + { 2.666667f, 10.666667f, 1.333333f, 0.037500f }, // 295 (2 0 6 8) + { 2.777778f, 10.111111f, 1.555556f, 0.038961f }, // 296 (2 0 7 7) + { 2.888889f, 9.555555f, 1.777778f, 0.040909f }, // 297 (2 0 8 6) + { 3.000000f, 9.000000f, 2.000000f, 0.043478f }, // 298 (2 0 9 5) + { 3.111111f, 8.444445f, 2.222222f, 0.046875f }, // 299 (2 0 10 4) + { 3.222222f, 7.888889f, 2.444444f, 0.051429f }, // 300 (2 0 11 3) + { 3.333333f, 7.333333f, 2.666667f, 0.057692f }, // 301 (2 0 12 2) + { 3.444444f, 6.777778f, 2.888889f, 0.066667f }, // 302 (2 0 13 1) + { 3.555556f, 6.222222f, 3.111111f, 0.080357f }, // 303 (2 0 14 0) + { 2.444444f, 13.111111f, 0.222222f, 0.031250f }, // 304 (2 1 0 13) + { 2.555556f, 12.555555f, 0.444444f, 0.031359f }, // 305 (2 1 1 12) + { 2.666667f, 12.000000f, 0.666667f, 0.031690f }, // 306 (2 1 2 11) + { 2.777778f, 11.444445f, 0.888889f, 0.032258f }, // 307 (2 1 3 10) + { 2.888889f, 10.888889f, 1.111111f, 0.033088f }, // 308 (2 1 4 9) + { 3.000000f, 10.333333f, 1.333333f, 0.034221f }, // 309 (2 1 5 8) + { 3.111111f, 9.777778f, 1.555556f, 0.035714f }, // 310 (2 1 6 7) + { 3.222222f, 9.222222f, 1.777778f, 0.037657f }, // 311 (2 1 7 6) + { 3.333333f, 8.666667f, 2.000000f, 0.040179f }, // 312 (2 1 8 5) + { 3.444444f, 8.111111f, 2.222222f, 0.043478f }, // 313 (2 1 9 4) + { 3.555556f, 7.555556f, 2.444444f, 0.047872f }, // 314 (2 1 10 3) + { 3.666667f, 7.000000f, 2.666667f, 0.053892f }, // 315 (2 1 11 2) + { 3.777778f, 6.444445f, 2.888889f, 0.062500f }, // 316 (2 1 12 1) + { 3.888889f, 5.888889f, 3.111111f, 0.075630f }, // 317 (2 1 13 0) + { 2.888889f, 12.222222f, 0.444444f, 0.028481f }, // 318 (2 2 0 12) + { 3.000000f, 11.666667f, 0.666667f, 0.028939f }, // 319 (2 2 1 11) + { 3.111111f, 11.111111f, 0.888889f, 0.029605f }, // 320 (2 2 2 10) + { 3.222222f, 10.555555f, 1.111111f, 0.030508f }, // 321 (2 2 3 9) + { 3.333333f, 10.000000f, 1.333333f, 0.031690f }, // 322 (2 2 4 8) + { 3.444444f, 9.444445f, 1.555556f, 0.033210f }, // 323 (2 2 5 7) + { 3.555556f, 8.888889f, 1.777778f, 0.035156f }, // 324 (2 2 6 6) + { 3.666667f, 8.333333f, 2.000000f, 0.037657f }, // 325 (2 2 7 5) + { 3.777778f, 7.777778f, 2.222222f, 0.040909f }, // 326 (2 2 8 4) + { 3.888889f, 7.222222f, 2.444444f, 0.045226f }, // 327 (2 2 9 3) + { 4.000000f, 6.666667f, 2.666667f, 0.051136f }, // 328 (2 2 10 2) + { 4.111111f, 6.111111f, 2.888889f, 0.059603f }, // 329 (2 2 11 1) + { 4.222222f, 5.555556f, 3.111111f, 0.072581f }, // 330 (2 2 12 0) + { 3.333333f, 11.333333f, 0.666667f, 0.026786f }, // 331 (2 3 0 11) + { 3.444444f, 10.777778f, 0.888889f, 0.027523f }, // 332 (2 3 1 10) + { 3.555556f, 10.222222f, 1.111111f, 0.028481f }, // 333 (2 3 2 9) + { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 334 (2 3 3 8) + { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 335 (2 3 4 7) + { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 336 (2 3 5 6) + { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 337 (2 3 6 5) + { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 338 (2 3 7 4) + { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 339 (2 3 8 3) + { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 340 (2 3 9 2) + { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 341 (2 3 10 1) + { 4.555555f, 5.222222f, 3.111111f, 0.070866f }, // 342 (2 3 11 0) + { 3.777778f, 10.444445f, 0.888889f, 0.025862f }, // 343 (2 4 0 10) + { 3.888889f, 9.888889f, 1.111111f, 0.026866f }, // 344 (2 4 1 9) + { 4.000000f, 9.333333f, 1.333333f, 0.028125f }, // 345 (2 4 2 8) + { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 346 (2 4 3 7) + { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 347 (2 4 4 6) + { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 348 (2 4 5 5) + { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 349 (2 4 6 4) + { 4.555555f, 6.555555f, 2.444444f, 0.041860f }, // 350 (2 4 7 3) + { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 351 (2 4 8 2) + { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 352 (2 4 9 1) + { 4.888889f, 4.888889f, 3.111111f, 0.070313f }, // 353 (2 4 10 0) + { 4.222222f, 9.555555f, 1.111111f, 0.025568f }, // 354 (2 5 0 9) + { 4.333333f, 9.000000f, 1.333333f, 0.026866f }, // 355 (2 5 1 8) + { 4.444445f, 8.444445f, 1.555556f, 0.028481f }, // 356 (2 5 2 7) + { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 357 (2 5 3 6) + { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 358 (2 5 4 5) + { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 359 (2 5 5 4) + { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 360 (2 5 6 3) + { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 361 (2 5 7 2) + { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 362 (2 5 8 1) + { 5.222222f, 4.555556f, 3.111111f, 0.070866f }, // 363 (2 5 9 0) + { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 364 (2 6 0 8) + { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 365 (2 6 1 7) + { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 366 (2 6 2 6) + { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 367 (2 6 3 5) + { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 368 (2 6 4 4) + { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 369 (2 6 5 3) + { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 370 (2 6 6 2) + { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 371 (2 6 7 1) + { 5.555555f, 4.222222f, 3.111111f, 0.072581f }, // 372 (2 6 8 0) + { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 373 (2 7 0 7) + { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 374 (2 7 1 6) + { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 375 (2 7 2 5) + { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 376 (2 7 3 4) + { 5.555555f, 5.555555f, 2.444444f, 0.040179f }, // 377 (2 7 4 3) + { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 378 (2 7 5 2) + { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 379 (2 7 6 1) + { 5.888889f, 3.888889f, 3.111111f, 0.075630f }, // 380 (2 7 7 0) + { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 381 (2 8 0 6) + { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 382 (2 8 1 5) + { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 383 (2 8 2 4) + { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 384 (2 8 3 3) + { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 385 (2 8 4 2) + { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 386 (2 8 5 1) + { 6.222222f, 3.555556f, 3.111111f, 0.080357f }, // 387 (2 8 6 0) + { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 388 (2 9 0 5) + { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 389 (2 9 1 4) + { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 390 (2 9 2 3) + { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 391 (2 9 3 2) + { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 392 (2 9 4 1) + { 6.555556f, 3.222222f, 3.111111f, 0.087379f }, // 393 (2 9 5 0) + { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 394 (2 10 0 4) + { 6.555556f, 4.555555f, 2.444444f, 0.041860f }, // 395 (2 10 1 3) + { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 396 (2 10 2 2) + { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 397 (2 10 3 1) + { 6.888889f, 2.888889f, 3.111111f, 0.097826f }, // 398 (2 10 4 0) + { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 399 (2 11 0 3) + { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 400 (2 11 1 2) + { 7.111111f, 3.111111f, 2.888889f, 0.072581f }, // 401 (2 11 2 1) + { 7.222222f, 2.555556f, 3.111111f, 0.113924f }, // 402 (2 11 3 0) + { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 403 (2 12 0 2) + { 7.444445f, 2.777778f, 2.888889f, 0.081081f }, // 404 (2 12 1 1) + { 7.555556f, 2.222222f, 3.111111f, 0.140625f }, // 405 (2 12 2 0) + { 7.777778f, 2.444444f, 2.888889f, 0.093750f }, // 406 (2 13 0 1) + { 7.888889f, 1.888889f, 3.111111f, 0.191489f }, // 407 (2 13 1 0) + { 8.222222f, 1.555556f, 3.111111f, 0.321429f }, // 408 (2 14 0 0) + { 3.000000f, 13.000000f, 0.000000f, 0.025641f }, // 409 (3 0 0 13) + { 3.111111f, 12.444445f, 0.222222f, 0.025862f }, // 410 (3 0 1 12) + { 3.222222f, 11.888889f, 0.444444f, 0.026239f }, // 411 (3 0 2 11) + { 3.333333f, 11.333333f, 0.666667f, 0.026786f }, // 412 (3 0 3 10) + { 3.444444f, 10.777778f, 0.888889f, 0.027523f }, // 413 (3 0 4 9) + { 3.555556f, 10.222222f, 1.111111f, 0.028481f }, // 414 (3 0 5 8) + { 3.666667f, 9.666667f, 1.333333f, 0.029703f }, // 415 (3 0 6 7) + { 3.777778f, 9.111111f, 1.555556f, 0.031250f }, // 416 (3 0 7 6) + { 3.888889f, 8.555555f, 1.777778f, 0.033210f }, // 417 (3 0 8 5) + { 4.000000f, 8.000000f, 2.000000f, 0.035714f }, // 418 (3 0 9 4) + { 4.111111f, 7.444445f, 2.222222f, 0.038961f }, // 419 (3 0 10 3) + { 4.222222f, 6.888889f, 2.444444f, 0.043269f }, // 420 (3 0 11 2) + { 4.333333f, 6.333333f, 2.666667f, 0.049180f }, // 421 (3 0 12 1) + { 4.444445f, 5.777778f, 2.888889f, 0.057692f }, // 422 (3 0 13 0) + { 3.444444f, 12.111111f, 0.222222f, 0.024000f }, // 423 (3 1 0 12) + { 3.555556f, 11.555555f, 0.444444f, 0.024457f }, // 424 (3 1 1 11) + { 3.666667f, 11.000000f, 0.666667f, 0.025070f }, // 425 (3 1 2 10) + { 3.777778f, 10.444445f, 0.888889f, 0.025862f }, // 426 (3 1 3 9) + { 3.888889f, 9.888889f, 1.111111f, 0.026866f }, // 427 (3 1 4 8) + { 4.000000f, 9.333333f, 1.333333f, 0.028125f }, // 428 (3 1 5 7) + { 4.111111f, 8.777778f, 1.555556f, 0.029703f }, // 429 (3 1 6 6) + { 4.222222f, 8.222222f, 1.777778f, 0.031690f }, // 430 (3 1 7 5) + { 4.333333f, 7.666667f, 2.000000f, 0.034221f }, // 431 (3 1 8 4) + { 4.444445f, 7.111111f, 2.222222f, 0.037500f }, // 432 (3 1 9 3) + { 4.555555f, 6.555556f, 2.444444f, 0.041860f }, // 433 (3 1 10 2) + { 4.666667f, 6.000000f, 2.666667f, 0.047872f }, // 434 (3 1 11 1) + { 4.777778f, 5.444445f, 2.888889f, 0.056604f }, // 435 (3 1 12 0) + { 3.888889f, 11.222222f, 0.444444f, 0.023018f }, // 436 (3 2 0 11) + { 4.000000f, 10.666667f, 0.666667f, 0.023684f }, // 437 (3 2 1 10) + { 4.111111f, 10.111111f, 0.888889f, 0.024523f }, // 438 (3 2 2 9) + { 4.222222f, 9.555555f, 1.111111f, 0.025568f }, // 439 (3 2 3 8) + { 4.333333f, 9.000000f, 1.333333f, 0.026866f }, // 440 (3 2 4 7) + { 4.444445f, 8.444445f, 1.555556f, 0.028481f }, // 441 (3 2 5 6) + { 4.555555f, 7.888889f, 1.777778f, 0.030508f }, // 442 (3 2 6 5) + { 4.666667f, 7.333333f, 2.000000f, 0.033088f }, // 443 (3 2 7 4) + { 4.777778f, 6.777778f, 2.222222f, 0.036437f }, // 444 (3 2 8 3) + { 4.888889f, 6.222222f, 2.444444f, 0.040909f }, // 445 (3 2 9 2) + { 5.000000f, 5.666667f, 2.666667f, 0.047120f }, // 446 (3 2 10 1) + { 5.111111f, 5.111111f, 2.888889f, 0.056250f }, // 447 (3 2 11 0) + { 4.333333f, 10.333333f, 0.666667f, 0.022556f }, // 448 (3 3 0 10) + { 4.444445f, 9.777778f, 0.888889f, 0.023438f }, // 449 (3 3 1 9) + { 4.555555f, 9.222222f, 1.111111f, 0.024523f }, // 450 (3 3 2 8) + { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 451 (3 3 3 7) + { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 452 (3 3 4 6) + { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 453 (3 3 5 5) + { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 454 (3 3 6 4) + { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 455 (3 3 7 3) + { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 456 (3 3 8 2) + { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 457 (3 3 9 1) + { 5.444445f, 4.777778f, 2.888889f, 0.056604f }, // 458 (3 3 10 0) + { 4.777778f, 9.444445f, 0.888889f, 0.022556f }, // 459 (3 4 0 9) + { 4.888889f, 8.888889f, 1.111111f, 0.023684f }, // 460 (3 4 1 8) + { 5.000000f, 8.333333f, 1.333333f, 0.025070f }, // 461 (3 4 2 7) + { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 462 (3 4 3 6) + { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 463 (3 4 4 5) + { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 464 (3 4 5 4) + { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 465 (3 4 6 3) + { 5.555555f, 5.555555f, 2.444444f, 0.040179f }, // 466 (3 4 7 2) + { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 467 (3 4 8 1) + { 5.777778f, 4.444445f, 2.888889f, 0.057692f }, // 468 (3 4 9 0) + { 5.222222f, 8.555555f, 1.111111f, 0.023018f }, // 469 (3 5 0 8) + { 5.333333f, 8.000000f, 1.333333f, 0.024457f }, // 470 (3 5 1 7) + { 5.444445f, 7.444445f, 1.555556f, 0.026239f }, // 471 (3 5 2 6) + { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 472 (3 5 3 5) + { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 473 (3 5 4 4) + { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 474 (3 5 5 3) + { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 475 (3 5 6 2) + { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 476 (3 5 7 1) + { 6.111111f, 4.111111f, 2.888889f, 0.059603f }, // 477 (3 5 8 0) + { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 478 (3 6 0 7) + { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 479 (3 6 1 6) + { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 480 (3 6 2 5) + { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 481 (3 6 3 4) + { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 482 (3 6 4 3) + { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 483 (3 6 5 2) + { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 484 (3 6 6 1) + { 6.444445f, 3.777778f, 2.888889f, 0.062500f }, // 485 (3 6 7 0) + { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 486 (3 7 0 6) + { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 487 (3 7 1 5) + { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 488 (3 7 2 4) + { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 489 (3 7 3 3) + { 6.555555f, 4.555555f, 2.444444f, 0.041860f }, // 490 (3 7 4 2) + { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 491 (3 7 5 1) + { 6.777778f, 3.444444f, 2.888889f, 0.066667f }, // 492 (3 7 6 0) + { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 493 (3 8 0 5) + { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 494 (3 8 1 4) + { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 495 (3 8 2 3) + { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 496 (3 8 3 2) + { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 497 (3 8 4 1) + { 7.111111f, 3.111111f, 2.888889f, 0.072581f }, // 498 (3 8 5 0) + { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 499 (3 9 0 4) + { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 500 (3 9 1 3) + { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 501 (3 9 2 2) + { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 502 (3 9 3 1) + { 7.444445f, 2.777778f, 2.888889f, 0.081081f }, // 503 (3 9 4 0) + { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 504 (3 10 0 3) + { 7.555556f, 3.555556f, 2.444444f, 0.047872f }, // 505 (3 10 1 2) + { 7.666667f, 3.000000f, 2.666667f, 0.062937f }, // 506 (3 10 2 1) + { 7.777778f, 2.444444f, 2.888889f, 0.093750f }, // 507 (3 10 3 0) + { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 508 (3 11 0 2) + { 8.000000f, 2.666667f, 2.666667f, 0.070313f }, // 509 (3 11 1 1) + { 8.111111f, 2.111111f, 2.888889f, 0.113924f }, // 510 (3 11 2 0) + { 8.333333f, 2.333333f, 2.666667f, 0.081081f }, // 511 (3 12 0 1) + { 8.444445f, 1.777778f, 2.888889f, 0.150000f }, // 512 (3 12 1 0) + { 8.777778f, 1.444444f, 2.888889f, 0.230769f }, // 513 (3 13 0 0) + { 4.000000f, 12.000000f, 0.000000f, 0.020833f }, // 514 (4 0 0 12) + { 4.111111f, 11.444445f, 0.222222f, 0.021277f }, // 515 (4 0 1 11) + { 4.222222f, 10.888889f, 0.444444f, 0.021845f }, // 516 (4 0 2 10) + { 4.333333f, 10.333333f, 0.666667f, 0.022556f }, // 517 (4 0 3 9) + { 4.444445f, 9.777778f, 0.888889f, 0.023438f }, // 518 (4 0 4 8) + { 4.555555f, 9.222222f, 1.111111f, 0.024523f }, // 519 (4 0 5 7) + { 4.666667f, 8.666667f, 1.333333f, 0.025862f }, // 520 (4 0 6 6) + { 4.777778f, 8.111111f, 1.555556f, 0.027523f }, // 521 (4 0 7 5) + { 4.888889f, 7.555555f, 1.777778f, 0.029605f }, // 522 (4 0 8 4) + { 5.000000f, 7.000000f, 2.000000f, 0.032258f }, // 523 (4 0 9 3) + { 5.111111f, 6.444445f, 2.222222f, 0.035714f }, // 524 (4 0 10 2) + { 5.222222f, 5.888889f, 2.444444f, 0.040359f }, // 525 (4 0 11 1) + { 5.333333f, 5.333333f, 2.666667f, 0.046875f }, // 526 (4 0 12 0) + { 4.444445f, 11.111111f, 0.222222f, 0.020270f }, // 527 (4 1 0 11) + { 4.555555f, 10.555555f, 0.444444f, 0.020882f }, // 528 (4 1 1 10) + { 4.666667f, 10.000000f, 0.666667f, 0.021635f }, // 529 (4 1 2 9) + { 4.777778f, 9.444445f, 0.888889f, 0.022556f }, // 530 (4 1 3 8) + { 4.888889f, 8.888889f, 1.111111f, 0.023684f }, // 531 (4 1 4 7) + { 5.000000f, 8.333333f, 1.333333f, 0.025070f }, // 532 (4 1 5 6) + { 5.111111f, 7.777778f, 1.555556f, 0.026786f }, // 533 (4 1 6 5) + { 5.222222f, 7.222222f, 1.777778f, 0.028939f }, // 534 (4 1 7 4) + { 5.333333f, 6.666667f, 2.000000f, 0.031690f }, // 535 (4 1 8 3) + { 5.444445f, 6.111111f, 2.222222f, 0.035294f }, // 536 (4 1 9 2) + { 5.555555f, 5.555556f, 2.444444f, 0.040179f }, // 537 (4 1 10 1) + { 5.666667f, 5.000000f, 2.666667f, 0.047120f }, // 538 (4 1 11 0) + { 4.888889f, 10.222222f, 0.444444f, 0.020089f }, // 539 (4 2 0 10) + { 5.000000f, 9.666667f, 0.666667f, 0.020882f }, // 540 (4 2 1 9) + { 5.111111f, 9.111111f, 0.888889f, 0.021845f }, // 541 (4 2 2 8) + { 5.222222f, 8.555555f, 1.111111f, 0.023018f }, // 542 (4 2 3 7) + { 5.333333f, 8.000000f, 1.333333f, 0.024457f }, // 543 (4 2 4 6) + { 5.444445f, 7.444445f, 1.555556f, 0.026239f }, // 544 (4 2 5 5) + { 5.555555f, 6.888889f, 1.777778f, 0.028481f }, // 545 (4 2 6 4) + { 5.666667f, 6.333333f, 2.000000f, 0.031359f }, // 546 (4 2 7 3) + { 5.777778f, 5.777778f, 2.222222f, 0.035156f }, // 547 (4 2 8 2) + { 5.888889f, 5.222222f, 2.444444f, 0.040359f }, // 548 (4 2 9 1) + { 6.000000f, 4.666667f, 2.666667f, 0.047872f }, // 549 (4 2 10 0) + { 5.333333f, 9.333333f, 0.666667f, 0.020270f }, // 550 (4 3 0 9) + { 5.444445f, 8.777778f, 0.888889f, 0.021277f }, // 551 (4 3 1 8) + { 5.555555f, 8.222222f, 1.111111f, 0.022500f }, // 552 (4 3 2 7) + { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 553 (4 3 3 6) + { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 554 (4 3 4 5) + { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 555 (4 3 5 4) + { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 556 (4 3 6 3) + { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 557 (4 3 7 2) + { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 558 (4 3 8 1) + { 6.333333f, 4.333333f, 2.666667f, 0.049180f }, // 559 (4 3 9 0) + { 5.777778f, 8.444445f, 0.888889f, 0.020833f }, // 560 (4 4 0 8) + { 5.888889f, 7.888889f, 1.111111f, 0.022113f }, // 561 (4 4 1 7) + { 6.000000f, 7.333333f, 1.333333f, 0.023684f }, // 562 (4 4 2 6) + { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 563 (4 4 3 5) + { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 564 (4 4 4 4) + { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 565 (4 4 5 3) + { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 566 (4 4 6 2) + { 6.555555f, 4.555555f, 2.444444f, 0.041860f }, // 567 (4 4 7 1) + { 6.666667f, 4.000000f, 2.666667f, 0.051136f }, // 568 (4 4 8 0) + { 6.222222f, 7.555555f, 1.111111f, 0.021845f }, // 569 (4 5 0 7) + { 6.333333f, 7.000000f, 1.333333f, 0.023499f }, // 570 (4 5 1 6) + { 6.444445f, 6.444445f, 1.555556f, 0.025568f }, // 571 (4 5 2 5) + { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 572 (4 5 3 4) + { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 573 (4 5 4 3) + { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 574 (4 5 5 2) + { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 575 (4 5 6 1) + { 7.000000f, 3.666667f, 2.666667f, 0.053892f }, // 576 (4 5 7 0) + { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 577 (4 6 0 6) + { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 578 (4 6 1 5) + { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 579 (4 6 2 4) + { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 580 (4 6 3 3) + { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 581 (4 6 4 2) + { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 582 (4 6 5 1) + { 7.333333f, 3.333333f, 2.666667f, 0.057692f }, // 583 (4 6 6 0) + { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 584 (4 7 0 5) + { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 585 (4 7 1 4) + { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 586 (4 7 2 3) + { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 587 (4 7 3 2) + { 7.555555f, 3.555556f, 2.444444f, 0.047872f }, // 588 (4 7 4 1) + { 7.666667f, 3.000000f, 2.666667f, 0.062937f }, // 589 (4 7 5 0) + { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 590 (4 8 0 4) + { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 591 (4 8 1 3) + { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 592 (4 8 2 2) + { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 593 (4 8 3 1) + { 8.000000f, 2.666667f, 2.666667f, 0.070313f }, // 594 (4 8 4 0) + { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 595 (4 9 0 3) + { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 596 (4 9 1 2) + { 8.222222f, 2.888889f, 2.444444f, 0.056250f }, // 597 (4 9 2 1) + { 8.333333f, 2.333333f, 2.666667f, 0.081081f }, // 598 (4 9 3 0) + { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 599 (4 10 0 2) + { 8.555555f, 2.555556f, 2.444444f, 0.062937f }, // 600 (4 10 1 1) + { 8.666667f, 2.000000f, 2.666667f, 0.097826f }, // 601 (4 10 2 0) + { 8.888889f, 2.222222f, 2.444444f, 0.072581f }, // 602 (4 11 0 1) + { 9.000000f, 1.666667f, 2.666667f, 0.126761f }, // 603 (4 11 1 0) + { 9.333333f, 1.333333f, 2.666667f, 0.187500f }, // 604 (4 12 0 0) + { 5.000000f, 11.000000f, 0.000000f, 0.018182f }, // 605 (5 0 0 11) + { 5.111111f, 10.444445f, 0.222222f, 0.018750f }, // 606 (5 0 1 10) + { 5.222222f, 9.888889f, 0.444444f, 0.019438f }, // 607 (5 0 2 9) + { 5.333333f, 9.333333f, 0.666667f, 0.020270f }, // 608 (5 0 3 8) + { 5.444445f, 8.777778f, 0.888889f, 0.021277f }, // 609 (5 0 4 7) + { 5.555555f, 8.222222f, 1.111111f, 0.022500f }, // 610 (5 0 5 6) + { 5.666667f, 7.666667f, 1.333333f, 0.024000f }, // 611 (5 0 6 5) + { 5.777778f, 7.111111f, 1.555556f, 0.025862f }, // 612 (5 0 7 4) + { 5.888889f, 6.555555f, 1.777778f, 0.028213f }, // 613 (5 0 8 3) + { 6.000000f, 6.000000f, 2.000000f, 0.031250f }, // 614 (5 0 9 2) + { 6.111111f, 5.444445f, 2.222222f, 0.035294f }, // 615 (5 0 10 1) + { 6.222222f, 4.888889f, 2.444444f, 0.040909f }, // 616 (5 0 11 0) + { 5.444445f, 10.111111f, 0.222222f, 0.018182f }, // 617 (5 1 0 10) + { 5.555555f, 9.555555f, 0.444444f, 0.018908f }, // 618 (5 1 1 9) + { 5.666667f, 9.000000f, 0.666667f, 0.019780f }, // 619 (5 1 2 8) + { 5.777778f, 8.444445f, 0.888889f, 0.020833f }, // 620 (5 1 3 7) + { 5.888889f, 7.888889f, 1.111111f, 0.022113f }, // 621 (5 1 4 6) + { 6.000000f, 7.333333f, 1.333333f, 0.023684f }, // 622 (5 1 5 5) + { 6.111111f, 6.777778f, 1.555556f, 0.025641f }, // 623 (5 1 6 4) + { 6.222222f, 6.222222f, 1.777778f, 0.028125f }, // 624 (5 1 7 3) + { 6.333333f, 5.666667f, 2.000000f, 0.031359f }, // 625 (5 1 8 2) + { 6.444445f, 5.111111f, 2.222222f, 0.035714f }, // 626 (5 1 9 1) + { 6.555555f, 4.555556f, 2.444444f, 0.041860f }, // 627 (5 1 10 0) + { 5.888889f, 9.222222f, 0.444444f, 0.018480f }, // 628 (5 2 0 9) + { 6.000000f, 8.666667f, 0.666667f, 0.019397f }, // 629 (5 2 1 8) + { 6.111111f, 8.111111f, 0.888889f, 0.020501f }, // 630 (5 2 2 7) + { 6.222222f, 7.555555f, 1.111111f, 0.021845f }, // 631 (5 2 3 6) + { 6.333333f, 7.000000f, 1.333333f, 0.023499f }, // 632 (5 2 4 5) + { 6.444445f, 6.444445f, 1.555556f, 0.025568f }, // 633 (5 2 5 4) + { 6.555555f, 5.888889f, 1.777778f, 0.028213f }, // 634 (5 2 6 3) + { 6.666667f, 5.333333f, 2.000000f, 0.031690f }, // 635 (5 2 7 2) + { 6.777778f, 4.777778f, 2.222222f, 0.036437f }, // 636 (5 2 8 1) + { 6.888889f, 4.222222f, 2.444444f, 0.043269f }, // 637 (5 2 9 0) + { 6.333333f, 8.333333f, 0.666667f, 0.019108f }, // 638 (5 3 0 8) + { 6.444445f, 7.777778f, 0.888889f, 0.020270f }, // 639 (5 3 1 7) + { 6.555555f, 7.222222f, 1.111111f, 0.021687f }, // 640 (5 3 2 6) + { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 641 (5 3 3 5) + { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 642 (5 3 4 4) + { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 643 (5 3 5 3) + { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 644 (5 3 6 2) + { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 645 (5 3 7 1) + { 7.222222f, 3.888889f, 2.444444f, 0.045226f }, // 646 (5 3 8 0) + { 6.777778f, 7.444445f, 0.888889f, 0.020134f }, // 647 (5 4 0 7) + { 6.888889f, 6.888889f, 1.111111f, 0.021635f }, // 648 (5 4 1 6) + { 7.000000f, 6.333333f, 1.333333f, 0.023499f }, // 649 (5 4 2 5) + { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 650 (5 4 3 4) + { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 651 (5 4 4 3) + { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 652 (5 4 5 2) + { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 653 (5 4 6 1) + { 7.555555f, 3.555556f, 2.444444f, 0.047872f }, // 654 (5 4 7 0) + { 7.222222f, 6.555555f, 1.111111f, 0.021687f }, // 655 (5 5 0 6) + { 7.333333f, 6.000000f, 1.333333f, 0.023684f }, // 656 (5 5 1 5) + { 7.444445f, 5.444445f, 1.555556f, 0.026239f }, // 657 (5 5 2 4) + { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 658 (5 5 3 3) + { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 659 (5 5 4 2) + { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 660 (5 5 5 1) + { 7.888889f, 3.222222f, 2.444444f, 0.051429f }, // 661 (5 5 6 0) + { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 662 (5 6 0 5) + { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 663 (5 6 1 4) + { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 664 (5 6 2 3) + { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 665 (5 6 3 2) + { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 666 (5 6 4 1) + { 8.222222f, 2.888889f, 2.444444f, 0.056250f }, // 667 (5 6 5 0) + { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 668 (5 7 0 4) + { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 669 (5 7 1 3) + { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 670 (5 7 2 2) + { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 671 (5 7 3 1) + { 8.555555f, 2.555556f, 2.444444f, 0.062937f }, // 672 (5 7 4 0) + { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 673 (5 8 0 3) + { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 674 (5 8 1 2) + { 8.777778f, 2.777778f, 2.222222f, 0.051429f }, // 675 (5 8 2 1) + { 8.888889f, 2.222222f, 2.444444f, 0.072581f }, // 676 (5 8 3 0) + { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 677 (5 9 0 2) + { 9.111111f, 2.444444f, 2.222222f, 0.057692f }, // 678 (5 9 1 1) + { 9.222222f, 1.888889f, 2.444444f, 0.087379f }, // 679 (5 9 2 0) + { 9.444445f, 2.111111f, 2.222222f, 0.066667f }, // 680 (5 10 0 1) + { 9.555555f, 1.555556f, 2.444444f, 0.112500f }, // 681 (5 10 1 0) + { 9.888889f, 1.222222f, 2.444444f, 0.163636f }, // 682 (5 11 0 0) + { 6.000000f, 10.000000f, 0.000000f, 0.016667f }, // 683 (6 0 0 10) + { 6.111111f, 9.444445f, 0.222222f, 0.017341f }, // 684 (6 0 1 9) + { 6.222222f, 8.888889f, 0.444444f, 0.018145f }, // 685 (6 0 2 8) + { 6.333333f, 8.333333f, 0.666667f, 0.019108f }, // 686 (6 0 3 7) + { 6.444445f, 7.777778f, 0.888889f, 0.020270f }, // 687 (6 0 4 6) + { 6.555555f, 7.222222f, 1.111111f, 0.021687f }, // 688 (6 0 5 5) + { 6.666667f, 6.666667f, 1.333333f, 0.023438f }, // 689 (6 0 6 4) + { 6.777778f, 6.111111f, 1.555556f, 0.025641f }, // 690 (6 0 7 3) + { 6.888889f, 5.555555f, 1.777778f, 0.028481f }, // 691 (6 0 8 2) + { 7.000000f, 5.000000f, 2.000000f, 0.032258f }, // 692 (6 0 9 1) + { 7.111111f, 4.444445f, 2.222222f, 0.037500f }, // 693 (6 0 10 0) + { 6.444445f, 9.111111f, 0.222222f, 0.017045f }, // 694 (6 1 0 9) + { 6.555555f, 8.555555f, 0.444444f, 0.017893f }, // 695 (6 1 1 8) + { 6.666667f, 8.000000f, 0.666667f, 0.018908f }, // 696 (6 1 2 7) + { 6.777778f, 7.444445f, 0.888889f, 0.020134f }, // 697 (6 1 3 6) + { 6.888889f, 6.888889f, 1.111111f, 0.021635f }, // 698 (6 1 4 5) + { 7.000000f, 6.333333f, 1.333333f, 0.023499f }, // 699 (6 1 5 4) + { 7.111111f, 5.777778f, 1.555556f, 0.025862f }, // 700 (6 1 6 3) + { 7.222222f, 5.222222f, 1.777778f, 0.028939f }, // 701 (6 1 7 2) + { 7.333333f, 4.666667f, 2.000000f, 0.033088f }, // 702 (6 1 8 1) + { 7.444445f, 4.111111f, 2.222222f, 0.038961f }, // 703 (6 1 9 0) + { 6.888889f, 8.222222f, 0.444444f, 0.017717f }, // 704 (6 2 0 8) + { 7.000000f, 7.666667f, 0.666667f, 0.018789f }, // 705 (6 2 1 7) + { 7.111111f, 7.111111f, 0.888889f, 0.020089f }, // 706 (6 2 2 6) + { 7.222222f, 6.555555f, 1.111111f, 0.021687f }, // 707 (6 2 3 5) + { 7.333333f, 6.000000f, 1.333333f, 0.023684f }, // 708 (6 2 4 4) + { 7.444445f, 5.444445f, 1.555556f, 0.026239f }, // 709 (6 2 5 3) + { 7.555555f, 4.888889f, 1.777778f, 0.029605f }, // 710 (6 2 6 2) + { 7.666667f, 4.333333f, 2.000000f, 0.034221f }, // 711 (6 2 7 1) + { 7.777778f, 3.777778f, 2.222222f, 0.040909f }, // 712 (6 2 8 0) + { 7.333333f, 7.333333f, 0.666667f, 0.018750f }, // 713 (6 3 0 7) + { 7.444445f, 6.777778f, 0.888889f, 0.020134f }, // 714 (6 3 1 6) + { 7.555555f, 6.222222f, 1.111111f, 0.021845f }, // 715 (6 3 2 5) + { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 716 (6 3 3 4) + { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 717 (6 3 4 3) + { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 718 (6 3 5 2) + { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 719 (6 3 6 1) + { 8.111111f, 3.444444f, 2.222222f, 0.043478f }, // 720 (6 3 7 0) + { 7.777778f, 6.444445f, 0.888889f, 0.020270f }, // 721 (6 4 0 6) + { 7.888889f, 5.888889f, 1.111111f, 0.022113f }, // 722 (6 4 1 5) + { 8.000000f, 5.333333f, 1.333333f, 0.024457f }, // 723 (6 4 2 4) + { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 724 (6 4 3 3) + { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 725 (6 4 4 2) + { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 726 (6 4 5 1) + { 8.444445f, 3.111111f, 2.222222f, 0.046875f }, // 727 (6 4 6 0) + { 8.222222f, 5.555555f, 1.111111f, 0.022500f }, // 728 (6 5 0 5) + { 8.333333f, 5.000000f, 1.333333f, 0.025070f }, // 729 (6 5 1 4) + { 8.444445f, 4.444445f, 1.555556f, 0.028481f }, // 730 (6 5 2 3) + { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 731 (6 5 3 2) + { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 732 (6 5 4 1) + { 8.777778f, 2.777778f, 2.222222f, 0.051429f }, // 733 (6 5 5 0) + { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 734 (6 6 0 4) + { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 735 (6 6 1 3) + { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 736 (6 6 2 2) + { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 737 (6 6 3 1) + { 9.111111f, 2.444444f, 2.222222f, 0.057692f }, // 738 (6 6 4 0) + { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 739 (6 7 0 3) + { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 740 (6 7 1 2) + { 9.333333f, 2.666667f, 2.000000f, 0.047872f }, // 741 (6 7 2 1) + { 9.444445f, 2.111111f, 2.222222f, 0.066667f }, // 742 (6 7 3 0) + { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 743 (6 8 0 2) + { 9.666667f, 2.333333f, 2.000000f, 0.053892f }, // 744 (6 8 1 1) + { 9.777778f, 1.777778f, 2.222222f, 0.080357f }, // 745 (6 8 2 0) + { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 746 (6 9 0 1) + { 10.111111f, 1.444444f, 2.222222f, 0.103448f }, // 747 (6 9 1 0) + { 10.444445f, 1.111111f, 2.222222f, 0.150000f }, // 748 (6 10 0 0) + { 7.000000f, 9.000000f, 0.000000f, 0.015873f }, // 749 (7 0 0 9) + { 7.111111f, 8.444445f, 0.222222f, 0.016667f }, // 750 (7 0 1 8) + { 7.222222f, 7.888889f, 0.444444f, 0.017613f }, // 751 (7 0 2 7) + { 7.333333f, 7.333333f, 0.666667f, 0.018750f }, // 752 (7 0 3 6) + { 7.444445f, 6.777778f, 0.888889f, 0.020134f }, // 753 (7 0 4 5) + { 7.555555f, 6.222222f, 1.111111f, 0.021845f }, // 754 (7 0 5 4) + { 7.666667f, 5.666667f, 1.333333f, 0.024000f }, // 755 (7 0 6 3) + { 7.777778f, 5.111111f, 1.555556f, 0.026786f }, // 756 (7 0 7 2) + { 7.888889f, 4.555555f, 1.777778f, 0.030508f }, // 757 (7 0 8 1) + { 8.000000f, 4.000000f, 2.000000f, 0.035714f }, // 758 (7 0 9 0) + { 7.444445f, 8.111111f, 0.222222f, 0.016575f }, // 759 (7 1 0 8) + { 7.555555f, 7.555555f, 0.444444f, 0.017578f }, // 760 (7 1 1 7) + { 7.666667f, 7.000000f, 0.666667f, 0.018789f }, // 761 (7 1 2 6) + { 7.777778f, 6.444445f, 0.888889f, 0.020270f }, // 762 (7 1 3 5) + { 7.888889f, 5.888889f, 1.111111f, 0.022113f }, // 763 (7 1 4 4) + { 8.000000f, 5.333333f, 1.333333f, 0.024457f }, // 764 (7 1 5 3) + { 8.111111f, 4.777778f, 1.555556f, 0.027523f }, // 765 (7 1 6 2) + { 8.222222f, 4.222222f, 1.777778f, 0.031690f }, // 766 (7 1 7 1) + { 8.333333f, 3.666667f, 2.000000f, 0.037657f }, // 767 (7 1 8 0) + { 7.888889f, 7.222222f, 0.444444f, 0.017613f }, // 768 (7 2 0 7) + { 8.000000f, 6.666667f, 0.666667f, 0.018908f }, // 769 (7 2 1 6) + { 8.111111f, 6.111111f, 0.888889f, 0.020501f }, // 770 (7 2 2 5) + { 8.222222f, 5.555555f, 1.111111f, 0.022500f }, // 771 (7 2 3 4) + { 8.333333f, 5.000000f, 1.333333f, 0.025070f }, // 772 (7 2 4 3) + { 8.444445f, 4.444445f, 1.555556f, 0.028481f }, // 773 (7 2 5 2) + { 8.555555f, 3.888889f, 1.777778f, 0.033210f }, // 774 (7 2 6 1) + { 8.666667f, 3.333333f, 2.000000f, 0.040179f }, // 775 (7 2 7 0) + { 8.333333f, 6.333333f, 0.666667f, 0.019108f }, // 776 (7 3 0 6) + { 8.444445f, 5.777778f, 0.888889f, 0.020833f }, // 777 (7 3 1 5) + { 8.555555f, 5.222222f, 1.111111f, 0.023018f }, // 778 (7 3 2 4) + { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 779 (7 3 3 3) + { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 780 (7 3 4 2) + { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 781 (7 3 5 1) + { 9.000000f, 3.000000f, 2.000000f, 0.043478f }, // 782 (7 3 6 0) + { 8.777778f, 5.444445f, 0.888889f, 0.021277f }, // 783 (7 4 0 5) + { 8.888889f, 4.888889f, 1.111111f, 0.023684f }, // 784 (7 4 1 4) + { 9.000000f, 4.333333f, 1.333333f, 0.026866f }, // 785 (7 4 2 3) + { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 786 (7 4 3 2) + { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 787 (7 4 4 1) + { 9.333333f, 2.666667f, 2.000000f, 0.047872f }, // 788 (7 4 5 0) + { 9.222222f, 4.555555f, 1.111111f, 0.024523f }, // 789 (7 5 0 4) + { 9.333333f, 4.000000f, 1.333333f, 0.028125f }, // 790 (7 5 1 3) + { 9.444445f, 3.444444f, 1.555556f, 0.033210f }, // 791 (7 5 2 2) + { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 792 (7 5 3 1) + { 9.666667f, 2.333333f, 2.000000f, 0.053892f }, // 793 (7 5 4 0) + { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 794 (7 6 0 3) + { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 795 (7 6 1 2) + { 9.888889f, 2.555556f, 1.777778f, 0.045226f }, // 796 (7 6 2 1) + { 10.000000f, 2.000000f, 2.000000f, 0.062500f }, // 797 (7 6 3 0) + { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 798 (7 7 0 2) + { 10.222222f, 2.222222f, 1.777778f, 0.051136f }, // 799 (7 7 1 1) + { 10.333333f, 1.666667f, 2.000000f, 0.075630f }, // 800 (7 7 2 0) + { 10.555555f, 1.888889f, 1.777778f, 0.059603f }, // 801 (7 8 0 1) + { 10.666667f, 1.333333f, 2.000000f, 0.097826f }, // 802 (7 8 1 0) + { 11.000000f, 1.000000f, 2.000000f, 0.142857f }, // 803 (7 9 0 0) + { 8.000000f, 8.000000f, 0.000000f, 0.015625f }, // 804 (8 0 0 8) + { 8.111111f, 7.444445f, 0.222222f, 0.016575f }, // 805 (8 0 1 7) + { 8.222222f, 6.888889f, 0.444444f, 0.017717f }, // 806 (8 0 2 6) + { 8.333333f, 6.333333f, 0.666667f, 0.019108f }, // 807 (8 0 3 5) + { 8.444445f, 5.777778f, 0.888889f, 0.020833f }, // 808 (8 0 4 4) + { 8.555555f, 5.222222f, 1.111111f, 0.023018f }, // 809 (8 0 5 3) + { 8.666667f, 4.666667f, 1.333333f, 0.025862f }, // 810 (8 0 6 2) + { 8.777778f, 4.111111f, 1.555556f, 0.029703f }, // 811 (8 0 7 1) + { 8.888889f, 3.555556f, 1.777778f, 0.035156f }, // 812 (8 0 8 0) + { 8.444445f, 7.111111f, 0.222222f, 0.016667f }, // 813 (8 1 0 7) + { 8.555555f, 6.555555f, 0.444444f, 0.017893f }, // 814 (8 1 1 6) + { 8.666667f, 6.000000f, 0.666667f, 0.019397f }, // 815 (8 1 2 5) + { 8.777778f, 5.444445f, 0.888889f, 0.021277f }, // 816 (8 1 3 4) + { 8.888889f, 4.888889f, 1.111111f, 0.023684f }, // 817 (8 1 4 3) + { 9.000000f, 4.333333f, 1.333333f, 0.026866f }, // 818 (8 1 5 2) + { 9.111111f, 3.777778f, 1.555556f, 0.031250f }, // 819 (8 1 6 1) + { 9.222222f, 3.222222f, 1.777778f, 0.037657f }, // 820 (8 1 7 0) + { 8.888889f, 6.222222f, 0.444444f, 0.018145f }, // 821 (8 2 0 6) + { 9.000000f, 5.666667f, 0.666667f, 0.019780f }, // 822 (8 2 1 5) + { 9.111111f, 5.111111f, 0.888889f, 0.021845f }, // 823 (8 2 2 4) + { 9.222222f, 4.555555f, 1.111111f, 0.024523f }, // 824 (8 2 3 3) + { 9.333333f, 4.000000f, 1.333333f, 0.028125f }, // 825 (8 2 4 2) + { 9.444445f, 3.444444f, 1.555556f, 0.033210f }, // 826 (8 2 5 1) + { 9.555555f, 2.888889f, 1.777778f, 0.040909f }, // 827 (8 2 6 0) + { 9.333333f, 5.333333f, 0.666667f, 0.020270f }, // 828 (8 3 0 5) + { 9.444445f, 4.777778f, 0.888889f, 0.022556f }, // 829 (8 3 1 4) + { 9.555555f, 4.222222f, 1.111111f, 0.025568f }, // 830 (8 3 2 3) + { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 831 (8 3 3 2) + { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 832 (8 3 4 1) + { 9.888889f, 2.555556f, 1.777778f, 0.045226f }, // 833 (8 3 5 0) + { 9.777778f, 4.444445f, 0.888889f, 0.023438f }, // 834 (8 4 0 4) + { 9.888889f, 3.888889f, 1.111111f, 0.026866f }, // 835 (8 4 1 3) + { 10.000000f, 3.333333f, 1.333333f, 0.031690f }, // 836 (8 4 2 2) + { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 837 (8 4 3 1) + { 10.222222f, 2.222222f, 1.777778f, 0.051136f }, // 838 (8 4 4 0) + { 10.222222f, 3.555556f, 1.111111f, 0.028481f }, // 839 (8 5 0 3) + { 10.333333f, 3.000000f, 1.333333f, 0.034221f }, // 840 (8 5 1 2) + { 10.444445f, 2.444444f, 1.555556f, 0.043269f }, // 841 (8 5 2 1) + { 10.555555f, 1.888889f, 1.777778f, 0.059603f }, // 842 (8 5 3 0) + { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 843 (8 6 0 2) + { 10.777778f, 2.111111f, 1.555556f, 0.049180f }, // 844 (8 6 1 1) + { 10.888889f, 1.555556f, 1.777778f, 0.072581f }, // 845 (8 6 2 0) + { 11.111111f, 1.777778f, 1.555556f, 0.057692f }, // 846 (8 7 0 1) + { 11.222222f, 1.222222f, 1.777778f, 0.094737f }, // 847 (8 7 1 0) + { 11.555555f, 0.888889f, 1.777778f, 0.140625f }, // 848 (8 8 0 0) + { 9.000000f, 7.000000f, 0.000000f, 0.015873f }, // 849 (9 0 0 7) + { 9.111111f, 6.444445f, 0.222222f, 0.017045f }, // 850 (9 0 1 6) + { 9.222222f, 5.888889f, 0.444444f, 0.018480f }, // 851 (9 0 2 5) + { 9.333333f, 5.333333f, 0.666667f, 0.020270f }, // 852 (9 0 3 4) + { 9.444445f, 4.777778f, 0.888889f, 0.022556f }, // 853 (9 0 4 3) + { 9.555555f, 4.222222f, 1.111111f, 0.025568f }, // 854 (9 0 5 2) + { 9.666667f, 3.666667f, 1.333333f, 0.029703f }, // 855 (9 0 6 1) + { 9.777778f, 3.111111f, 1.555556f, 0.035714f }, // 856 (9 0 7 0) + { 9.444445f, 6.111111f, 0.222222f, 0.017341f }, // 857 (9 1 0 6) + { 9.555555f, 5.555555f, 0.444444f, 0.018908f }, // 858 (9 1 1 5) + { 9.666667f, 5.000000f, 0.666667f, 0.020882f }, // 859 (9 1 2 4) + { 9.777778f, 4.444445f, 0.888889f, 0.023438f }, // 860 (9 1 3 3) + { 9.888889f, 3.888889f, 1.111111f, 0.026866f }, // 861 (9 1 4 2) + { 10.000000f, 3.333333f, 1.333333f, 0.031690f }, // 862 (9 1 5 1) + { 10.111111f, 2.777778f, 1.555556f, 0.038961f }, // 863 (9 1 6 0) + { 9.888889f, 5.222222f, 0.444444f, 0.019438f }, // 864 (9 2 0 5) + { 10.000000f, 4.666667f, 0.666667f, 0.021635f }, // 865 (9 2 1 4) + { 10.111111f, 4.111111f, 0.888889f, 0.024523f }, // 866 (9 2 2 3) + { 10.222222f, 3.555556f, 1.111111f, 0.028481f }, // 867 (9 2 3 2) + { 10.333333f, 3.000000f, 1.333333f, 0.034221f }, // 868 (9 2 4 1) + { 10.444445f, 2.444444f, 1.555556f, 0.043269f }, // 869 (9 2 5 0) + { 10.333333f, 4.333333f, 0.666667f, 0.022556f }, // 870 (9 3 0 4) + { 10.444445f, 3.777778f, 0.888889f, 0.025862f }, // 871 (9 3 1 3) + { 10.555555f, 3.222222f, 1.111111f, 0.030508f }, // 872 (9 3 2 2) + { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 873 (9 3 3 1) + { 10.777778f, 2.111111f, 1.555556f, 0.049180f }, // 874 (9 3 4 0) + { 10.777778f, 3.444444f, 0.888889f, 0.027523f }, // 875 (9 4 0 3) + { 10.888889f, 2.888889f, 1.111111f, 0.033088f }, // 876 (9 4 1 2) + { 11.000000f, 2.333333f, 1.333333f, 0.041860f }, // 877 (9 4 2 1) + { 11.111111f, 1.777778f, 1.555556f, 0.057692f }, // 878 (9 4 3 0) + { 11.222222f, 2.555556f, 1.111111f, 0.036437f }, // 879 (9 5 0 2) + { 11.333333f, 2.000000f, 1.333333f, 0.047872f }, // 880 (9 5 1 1) + { 11.444445f, 1.444444f, 1.555556f, 0.070866f }, // 881 (9 5 2 0) + { 11.666667f, 1.666667f, 1.333333f, 0.056604f }, // 882 (9 6 0 1) + { 11.777778f, 1.111111f, 1.555556f, 0.093750f }, // 883 (9 6 1 0) + { 12.111111f, 0.777778f, 1.555556f, 0.142857f }, // 884 (9 7 0 0) + { 10.000000f, 6.000000f, 0.000000f, 0.016667f }, // 885 (10 0 0 6) + { 10.111111f, 5.444445f, 0.222222f, 0.018182f }, // 886 (10 0 1 5) + { 10.222222f, 4.888889f, 0.444444f, 0.020089f }, // 887 (10 0 2 4) + { 10.333333f, 4.333333f, 0.666667f, 0.022556f }, // 888 (10 0 3 3) + { 10.444445f, 3.777778f, 0.888889f, 0.025862f }, // 889 (10 0 4 2) + { 10.555555f, 3.222222f, 1.111111f, 0.030508f }, // 890 (10 0 5 1) + { 10.666667f, 2.666667f, 1.333333f, 0.037500f }, // 891 (10 0 6 0) + { 10.444445f, 5.111111f, 0.222222f, 0.018750f }, // 892 (10 1 0 5) + { 10.555555f, 4.555555f, 0.444444f, 0.020882f }, // 893 (10 1 1 4) + { 10.666667f, 4.000000f, 0.666667f, 0.023684f }, // 894 (10 1 2 3) + { 10.777778f, 3.444444f, 0.888889f, 0.027523f }, // 895 (10 1 3 2) + { 10.888889f, 2.888889f, 1.111111f, 0.033088f }, // 896 (10 1 4 1) + { 11.000000f, 2.333333f, 1.333333f, 0.041860f }, // 897 (10 1 5 0) + { 10.888889f, 4.222222f, 0.444444f, 0.021845f }, // 898 (10 2 0 4) + { 11.000000f, 3.666667f, 0.666667f, 0.025070f }, // 899 (10 2 1 3) + { 11.111111f, 3.111111f, 0.888889f, 0.029605f }, // 900 (10 2 2 2) + { 11.222222f, 2.555556f, 1.111111f, 0.036437f }, // 901 (10 2 3 1) + { 11.333333f, 2.000000f, 1.333333f, 0.047872f }, // 902 (10 2 4 0) + { 11.333333f, 3.333333f, 0.666667f, 0.026786f }, // 903 (10 3 0 3) + { 11.444445f, 2.777778f, 0.888889f, 0.032258f }, // 904 (10 3 1 2) + { 11.555555f, 2.222222f, 1.111111f, 0.040909f }, // 905 (10 3 2 1) + { 11.666667f, 1.666667f, 1.333333f, 0.056604f }, // 906 (10 3 3 0) + { 11.777778f, 2.444444f, 0.888889f, 0.035714f }, // 907 (10 4 0 2) + { 11.888889f, 1.888889f, 1.111111f, 0.047120f }, // 908 (10 4 1 1) + { 12.000000f, 1.333333f, 1.333333f, 0.070313f }, // 909 (10 4 2 0) + { 12.222222f, 1.555556f, 1.111111f, 0.056250f }, // 910 (10 5 0 1) + { 12.333333f, 1.000000f, 1.333333f, 0.094737f }, // 911 (10 5 1 0) + { 12.666667f, 0.666667f, 1.333333f, 0.150000f }, // 912 (10 6 0 0) + { 11.000000f, 5.000000f, 0.000000f, 0.018182f }, // 913 (11 0 0 5) + { 11.111111f, 4.444445f, 0.222222f, 0.020270f }, // 914 (11 0 1 4) + { 11.222222f, 3.888889f, 0.444444f, 0.023018f }, // 915 (11 0 2 3) + { 11.333333f, 3.333333f, 0.666667f, 0.026786f }, // 916 (11 0 3 2) + { 11.444445f, 2.777778f, 0.888889f, 0.032258f }, // 917 (11 0 4 1) + { 11.555555f, 2.222222f, 1.111111f, 0.040909f }, // 918 (11 0 5 0) + { 11.444445f, 4.111111f, 0.222222f, 0.021277f }, // 919 (11 1 0 4) + { 11.555555f, 3.555556f, 0.444444f, 0.024457f }, // 920 (11 1 1 3) + { 11.666667f, 3.000000f, 0.666667f, 0.028939f }, // 921 (11 1 2 2) + { 11.777778f, 2.444444f, 0.888889f, 0.035714f }, // 922 (11 1 3 1) + { 11.888889f, 1.888889f, 1.111111f, 0.047120f }, // 923 (11 1 4 0) + { 11.888889f, 3.222222f, 0.444444f, 0.026239f }, // 924 (11 2 0 3) + { 12.000000f, 2.666667f, 0.666667f, 0.031690f }, // 925 (11 2 1 2) + { 12.111111f, 2.111111f, 0.888889f, 0.040359f }, // 926 (11 2 2 1) + { 12.222222f, 1.555556f, 1.111111f, 0.056250f }, // 927 (11 2 3 0) + { 12.333333f, 2.333333f, 0.666667f, 0.035294f }, // 928 (11 3 0 2) + { 12.444445f, 1.777778f, 0.888889f, 0.046875f }, // 929 (11 3 1 1) + { 12.555555f, 1.222222f, 1.111111f, 0.070866f }, // 930 (11 3 2 0) + { 12.777778f, 1.444444f, 0.888889f, 0.056604f }, // 931 (11 4 0 1) + { 12.888889f, 0.888889f, 1.111111f, 0.097826f }, // 932 (11 4 1 0) + { 13.222222f, 0.555556f, 1.111111f, 0.163636f }, // 933 (11 5 0 0) + { 12.000000f, 4.000000f, 0.000000f, 0.020833f }, // 934 (12 0 0 4) + { 12.111111f, 3.444444f, 0.222222f, 0.024000f }, // 935 (12 0 1 3) + { 12.222222f, 2.888889f, 0.444444f, 0.028481f }, // 936 (12 0 2 2) + { 12.333333f, 2.333333f, 0.666667f, 0.035294f }, // 937 (12 0 3 1) + { 12.444445f, 1.777778f, 0.888889f, 0.046875f }, // 938 (12 0 4 0) + { 12.444445f, 3.111111f, 0.222222f, 0.025862f }, // 939 (12 1 0 3) + { 12.555555f, 2.555556f, 0.444444f, 0.031359f }, // 940 (12 1 1 2) + { 12.666667f, 2.000000f, 0.666667f, 0.040179f }, // 941 (12 1 2 1) + { 12.777778f, 1.444444f, 0.888889f, 0.056604f }, // 942 (12 1 3 0) + { 12.888889f, 2.222222f, 0.444444f, 0.035156f }, // 943 (12 2 0 2) + { 13.000000f, 1.666667f, 0.666667f, 0.047120f }, // 944 (12 2 1 1) + { 13.111111f, 1.111111f, 0.888889f, 0.072581f }, // 945 (12 2 2 0) + { 13.333333f, 1.333333f, 0.666667f, 0.057692f }, // 946 (12 3 0 1) + { 13.444445f, 0.777778f, 0.888889f, 0.103448f }, // 947 (12 3 1 0) + { 13.777778f, 0.444444f, 0.888889f, 0.187500f }, // 948 (12 4 0 0) + { 13.000000f, 3.000000f, 0.000000f, 0.025641f }, // 949 (13 0 0 3) + { 13.111111f, 2.444444f, 0.222222f, 0.031250f }, // 950 (13 0 1 2) + { 13.222222f, 1.888889f, 0.444444f, 0.040359f }, // 951 (13 0 2 1) + { 13.333333f, 1.333333f, 0.666667f, 0.057692f }, // 952 (13 0 3 0) + { 13.444445f, 2.111111f, 0.222222f, 0.035294f }, // 953 (13 1 0 2) + { 13.555555f, 1.555556f, 0.444444f, 0.047872f }, // 954 (13 1 1 1) + { 13.666667f, 1.000000f, 0.666667f, 0.075630f }, // 955 (13 1 2 0) + { 13.888889f, 1.222222f, 0.444444f, 0.059603f }, // 956 (13 2 0 1) + { 14.000000f, 0.666667f, 0.666667f, 0.112500f }, // 957 (13 2 1 0) + { 14.333333f, 0.333333f, 0.666667f, 0.230769f }, // 958 (13 3 0 0) + { 14.000000f, 2.000000f, 0.000000f, 0.035714f }, // 959 (14 0 0 2) + { 14.111111f, 1.444444f, 0.222222f, 0.049180f }, // 960 (14 0 1 1) + { 14.222222f, 0.888889f, 0.444444f, 0.080357f }, // 961 (14 0 2 0) + { 14.444445f, 1.111111f, 0.222222f, 0.062500f }, // 962 (14 1 0 1) + { 14.555555f, 0.555556f, 0.444444f, 0.126761f }, // 963 (14 1 1 0) + { 14.888889f, 0.222222f, 0.444444f, 0.321429f }, // 964 (14 2 0 0) + { 15.000000f, 1.000000f, 0.000000f, 0.066667f }, // 965 (15 0 0 1) + { 15.111111f, 0.444444f, 0.222222f, 0.150000f }, // 966 (15 0 1 0) + { 15.444445f, 0.111111f, 0.222222f, 0.600000f }, // 967 (15 1 0 0) + { 16.000000f, 0.000000f, 0.000000f, FLT_MAX }, // 968 (16 0 0 0) +}; // 969 four cluster elements + diff --git a/externals/NVTT/src/nvtt/squish/maths.cpp b/externals/NVTT/src/nvtt/squish/maths.cpp new file mode 100644 index 00000000..6a5b4ffc --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/maths.cpp @@ -0,0 +1,137 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "maths.h" +#include "simd.h" +#include + +namespace squish { + +Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights, Vec3::Arg metric ) +{ + // compute the centroid + float total = 0.0f; + Vec3 centroid( 0.0f ); + for( int i = 0; i < n; ++i ) + { + total += weights[i]; + centroid += weights[i]*points[i]; + } + centroid /= total; + + // accumulate the covariance matrix + Sym3x3 covariance( 0.0f ); + for( int i = 0; i < n; ++i ) + { + Vec3 a = (points[i] - centroid) * metric; + Vec3 b = weights[i]*a; + + covariance[0] += a.X()*b.X(); + covariance[1] += a.X()*b.Y(); + covariance[2] += a.X()*b.Z(); + covariance[3] += a.Y()*b.Y(); + covariance[4] += a.Y()*b.Z(); + covariance[5] += a.Z()*b.Z(); + } + + // return it + return covariance; +} + + +static Vec3 EstimatePrincipleComponent( Sym3x3 const& matrix ) +{ + Vec3 const row0(matrix[0], matrix[1], matrix[2]); + Vec3 const row1(matrix[1], matrix[3], matrix[4]); + Vec3 const row2(matrix[2], matrix[4], matrix[5]); + + float r0 = Dot(row0, row0); + float r1 = Dot(row1, row1); + float r2 = Dot(row2, row2); + + if (r0 > r1 && r0 > r2) return row0; + if (r1 > r2) return row1; + return row2; +} + + +#define POWER_ITERATION_COUNT 8 + +#if SQUISH_USE_SIMD + +Vec3 ComputePrincipleComponent( Sym3x3 const& matrix ) +{ + Vec4 const row0( matrix[0], matrix[1], matrix[2], 0.0f ); + Vec4 const row1( matrix[1], matrix[3], matrix[4], 0.0f ); + Vec4 const row2( matrix[2], matrix[4], matrix[5], 0.0f ); + + //Vec4 v = VEC4_CONST( 1.0f ); + //Vec4 v = row0; // row1, row2 + + Vec3 v3 = EstimatePrincipleComponent( matrix ); + Vec4 v( v3.X(), v3.Y(), v3.Z(), 0.0f ); + + for( int i = 0; i < POWER_ITERATION_COUNT; ++i ) + { + // matrix multiply + Vec4 w = row0*v.SplatX(); + w = MultiplyAdd(row1, v.SplatY(), w); + w = MultiplyAdd(row2, v.SplatZ(), w); + + // get max component from xyz in all channels + Vec4 a = Max(w.SplatX(), Max(w.SplatY(), w.SplatZ())); + + // divide through and advance + v = w*Reciprocal(a); + } + return v.GetVec3(); +} + +#else + +Vec3 ComputePrincipleComponent( Sym3x3 const& matrix ) +{ + Vec3 v = EstimatePrincipleComponent( matrix ); + for (int i = 0; i < POWER_ITERATION_COUNT; i++) + { + float x = v.X() * matrix[0] + v.Y() * matrix[1] + v.Z() * matrix[2]; + float y = v.X() * matrix[1] + v.Y() * matrix[3] + v.Z() * matrix[4]; + float z = v.X() * matrix[2] + v.Y() * matrix[4] + v.Z() * matrix[5]; + + float norm = std::max(std::max(x, y), z); + float iv = 1.0f / norm; + if (norm == 0.0f) { // @@ I think this is not necessary in this case!! + return Vec3(0.0f); + } + + v = Vec3(x*iv, y*iv, z*iv); + } + + return v; +} + +#endif + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/maths.h b/externals/NVTT/src/nvtt/squish/maths.h new file mode 100644 index 00000000..087a8890 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/maths.h @@ -0,0 +1,239 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_MATHS_H +#define SQUISH_MATHS_H + +#include +#include +#include "config.h" + +namespace squish { + +class Vec3 +{ +public: + typedef Vec3 const& Arg; + + Vec3() + { + } + + explicit Vec3( float a ) + { + m_x = a; + m_y = a; + m_z = a; + } + + Vec3( float a, float b, float c ) + { + m_x = a; + m_y = b; + m_z = c; + } + + float X() const { return m_x; } + float Y() const { return m_y; } + float Z() const { return m_z; } + + Vec3 operator-() const + { + return Vec3( -m_x, -m_y, -m_z ); + } + + Vec3& operator+=( Arg v ) + { + m_x += v.m_x; + m_y += v.m_y; + m_z += v.m_z; + return *this; + } + + Vec3& operator-=( Arg v ) + { + m_x -= v.m_x; + m_y -= v.m_y; + m_z -= v.m_z; + return *this; + } + + Vec3& operator*=( Arg v ) + { + m_x *= v.m_x; + m_y *= v.m_y; + m_z *= v.m_z; + return *this; + } + + Vec3& operator*=( float s ) + { + m_x *= s; + m_y *= s; + m_z *= s; + return *this; + } + + Vec3& operator/=( Arg v ) + { + m_x /= v.m_x; + m_y /= v.m_y; + m_z /= v.m_z; + return *this; + } + + Vec3& operator/=( float s ) + { + float t = 1.0f/s; + m_x *= t; + m_y *= t; + m_z *= t; + return *this; + } + + friend Vec3 operator+( Arg left, Arg right ) + { + Vec3 copy( left ); + return copy += right; + } + + friend Vec3 operator+( Arg left, float right ) + { + Vec3 copy( left ); + return copy += Vec3(right); + } + + friend Vec3 operator-( Arg left, Arg right ) + { + Vec3 copy( left ); + return copy -= right; + } + + friend Vec3 operator*( Arg left, Arg right ) + { + Vec3 copy( left ); + return copy *= right; + } + + friend Vec3 operator*( Arg left, float right ) + { + Vec3 copy( left ); + return copy *= right; + } + + friend Vec3 operator*( float left, Arg right ) + { + Vec3 copy( right ); + return copy *= left; + } + + friend Vec3 operator/( Arg left, Arg right ) + { + Vec3 copy( left ); + return copy /= right; + } + + friend Vec3 operator/( Arg left, float right ) + { + Vec3 copy( left ); + return copy /= right; + } + + friend float Dot( Arg left, Arg right ) + { + return left.m_x*right.m_x + left.m_y*right.m_y + left.m_z*right.m_z; + } + + friend Vec3 Min( Arg left, Arg right ) + { + return Vec3( + std::min( left.m_x, right.m_x ), + std::min( left.m_y, right.m_y ), + std::min( left.m_z, right.m_z ) + ); + } + + friend Vec3 Max( Arg left, Arg right ) + { + return Vec3( + std::max( left.m_x, right.m_x ), + std::max( left.m_y, right.m_y ), + std::max( left.m_z, right.m_z ) + ); + } + + friend Vec3 Floor( Arg v ) + { + return Vec3( + std::floor( v.m_x ), + std::floor( v.m_y ), + std::floor( v.m_z ) + ); + } + +private: + float m_x; + float m_y; + float m_z; +}; + +inline float LengthSquared( Vec3::Arg v ) +{ + return Dot( v, v ); +} + +class Sym3x3 +{ +public: + Sym3x3() + { + } + + Sym3x3( float a ) + { + for( int i = 0; i < 6; ++i ) + m_x[i] = a; + } + + float operator[]( int index ) const + { + return m_x[index]; + } + + float& operator[]( int index ) + { + return m_x[index]; + } + +private: + float m_x[6]; +}; + +Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights, Vec3::Arg metric ); +Vec3 ComputePrincipleComponent( Sym3x3 const& matrix ); + +} // namespace squish + +#endif // ndef SQUISH_MATHS_H diff --git a/externals/NVTT/src/nvtt/squish/rangefit.cpp b/externals/NVTT/src/nvtt/squish/rangefit.cpp new file mode 100644 index 00000000..a1934f5d --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/rangefit.cpp @@ -0,0 +1,203 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "rangefit.h" +#include "colourset.h" +#include "colourblock.h" +#include + +namespace squish { + +RangeFit::RangeFit( ColourSet const* colours, int flags ) + : ColourFit( /*colours, flags*/ ) +{ + SetColourSet( colours, flags ); + // initialise the metric + bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 ); + if( perceptual ) + m_metric = Vec3( 0.2126f, 0.7152f, 0.0722f ); + else + m_metric = Vec3( 1.0f ); + + // initialise the best error + m_besterror = FLT_MAX; + + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + float const* weights = m_colours->GetWeights(); + + // get the covariance matrix + Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights, m_metric ); + + // compute the principle component + Vec3 principle = ComputePrincipleComponent( covariance ); + + // get the min and max range as the codebook endpoints + Vec3 start( 0.0f ); + Vec3 end( 0.0f ); + if( count > 0 ) + { + float min, max; + + // compute the range + start = end = values[0]; + min = max = Dot( values[0], principle ); + for( int i = 1; i < count; ++i ) + { + float val = Dot( values[i], principle ); + if( val < min ) + { + start = values[i]; + min = val; + } + else if( val > max ) + { + end = values[i]; + max = val; + } + } + } + + // clamp the output to [0, 1] + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + start = Min( one, Max( zero, start ) ); + end = Min( one, Max( zero, end ) ); + + // clamp to the grid and save + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f ); + Vec3 const half( 0.5f ); + m_start = Floor( grid*start + half )*gridrcp; + m_end = Floor( grid*end + half )*gridrcp; +} + +void RangeFit::Compress3( void* block ) +{ + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // create a codebook + Vec3 codes[3]; + codes[0] = m_start; + codes[1] = m_end; + codes[2] = 0.5f*m_start + 0.5f*m_end; + + // match each point to the closest code + u8 closest[16]; + float error = 0.0f; + for( int i = 0; i < count; ++i ) + { + // find the closest code + float dist = FLT_MAX; + int idx = 0; + for( int j = 0; j < 3; ++j ) + { + float d = LengthSquared( m_metric*( values[i] - codes[j] ) ); + if( d < dist ) + { + dist = d; + idx = j; + } + } + + // save the index + closest[i] = ( u8 )idx; + + // accumulate the error + error += dist; + } + + // save this scheme if it wins + if( error < m_besterror ) + { + // remap the indices + u8 indices[16]; + m_colours->RemapIndices( closest, indices ); + + // save the block + WriteColourBlock3( m_start, m_end, indices, block ); + + // save the error + m_besterror = error; + } +} + +void RangeFit::Compress4( void* block ) +{ + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // create a codebook + Vec3 codes[4]; + codes[0] = m_start; + codes[1] = m_end; + codes[2] = ( 2.0f/3.0f )*m_start + ( 1.0f/3.0f )*m_end; + codes[3] = ( 1.0f/3.0f )*m_start + ( 2.0f/3.0f )*m_end; + + // match each point to the closest code + u8 closest[16]; + float error = 0.0f; + for( int i = 0; i < count; ++i ) + { + // find the closest code + float dist = FLT_MAX; + int idx = 0; + for( int j = 0; j < 4; ++j ) + { + float d = LengthSquared( m_metric*( values[i] - codes[j] ) ); + if( d < dist ) + { + dist = d; + idx = j; + } + } + + // save the index + closest[i] = ( u8 )idx; + + // accumulate the error + error += dist; + } + + // save this scheme if it wins + if( error < m_besterror ) + { + // remap the indices + u8 indices[16]; + m_colours->RemapIndices( closest, indices ); + + // save the block + WriteColourBlock4( m_start, m_end, indices, block ); + + // save the error + m_besterror = error; + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/rangefit.h b/externals/NVTT/src/nvtt/squish/rangefit.h new file mode 100644 index 00000000..79520199 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/rangefit.h @@ -0,0 +1,54 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_RANGEFIT_H +#define SQUISH_RANGEFIT_H + +#include +#include "colourfit.h" +#include "maths.h" + +namespace squish { + +class ColourSet; + +class RangeFit : public ColourFit +{ +public: + RangeFit( ColourSet const* colours, int flags ); + +private: + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + + Vec3 m_metric; + Vec3 m_start; + Vec3 m_end; + float m_besterror; +}; + +} // squish + +#endif // ndef SQUISH_RANGEFIT_H diff --git a/externals/NVTT/src/nvtt/squish/simd.h b/externals/NVTT/src/nvtt/squish/simd.h new file mode 100644 index 00000000..cb98e7f1 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/simd.h @@ -0,0 +1,45 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SIMD_H +#define SQUISH_SIMD_H + +#include "maths.h" + +#ifdef __GNUC__ +# define SQUISH_ALIGN_16 __attribute__ ((__aligned__ (16))) +#else +# define SQUISH_ALIGN_16 __declspec(align(16)) +#endif + +#if SQUISH_USE_ALTIVEC +#include "simd_ve.h" +#endif + +#if SQUISH_USE_SSE +#include "simd_sse.h" +#endif + +#endif // ndef SQUISH_SIMD_H diff --git a/externals/NVTT/src/nvtt/squish/simd_3dnow.h b/externals/NVTT/src/nvtt/squish/simd_3dnow.h new file mode 100644 index 00000000..2613630e --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/simd_3dnow.h @@ -0,0 +1,213 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SIMD_3DNOW_H +#define SQUISH_SIMD_3DNOW_H + +//#include +#include +#include + +//#define SQUISH_SSE_SPLAT( a ) \ + ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) ) + +namespace squish { + +//#define VEC4_CONST( X ) Vec4( _mm_set1_ps( X ) ) + +class Vec4 +{ +public: + typedef Vec4 const& Arg; + + Vec4() {} + + Vec4( __m64 v0, __m64 v1 ) : m_v0( v0 ), m_v1( v1 ) {} + + Vec4( Vec4 const& arg ) : m_v0( arg.m_v0 ), m_v1( arg.m_v1 ) {} + + Vec4& operator=( Vec4 const& arg ) + { + m_v0 = arg.m_v0; + m_v1 = arg.m_v1; + return *this; + } + + Vec4( float x, float y, float z, float w ) + { + m_v0 = _mm_set_pi32( *(int *)&x, *(int *)&y ); + m_v1 = _mm_set_pi32( *(int *)&z, *(int *)&w ); + } + +/* Vec3 GetVec3() const + { +#ifdef __GNUC__ + __attribute__ ((__aligned__ (16))) float c[4]; +#else + __declspec(align(16)) float c[4]; +#endif + //_mm_store_ps( c, m_v ); + return Vec3( c[0], c[1], c[2] ); + } +*/ +// Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); } +// Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); } +// Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); } +// Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); } + + Vec4& operator+=( Arg v ) + { + m_v0 = _m_pfadd( m_v0, v.m_v0 ); + m_v1 = _m_pfadd( m_v1, v.m_v1 ); + return *this; + } + + Vec4& operator-=( Arg v ) + { + m_v0 = _m_pfsub( m_v0, v.m_v0 ); + m_v1 = _m_pfsub( m_v1, v.m_v1 ); + return *this; + } + + Vec4& operator*=( Arg v ) + { + m_v0 = _m_pfmul( m_v0, v.m_v0 ); + m_v1 = _m_pfmul( m_v1, v.m_v1 ); + return *this; + } + + friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfadd( left.m_v0, right.m_v0 ), + _m_pfadd( left.m_v1, right.m_v1 )); + } + + friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfsub( left.m_v0, right.m_v0 ), + _m_pfsub( left.m_v1, right.m_v1 )); + } + + friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfmul( left.m_v0, right.m_v0 ), + _m_pfmul( left.m_v1, right.m_v1 )); + } + + //! Returns a*b + c + friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( + _m_pfadd( _m_pfmul( a.m_v0, b.m_v0 ), c.m_v0 ), + _m_pfadd( _m_pfmul( a.m_v1, b.m_v1 ), c.m_v1 )); + } + + //! Returns -( a*b - c ) + friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( + _m_pfsub( c.m_v0, _m_pfmul( a.m_v0, b.m_v0 ) ), + _m_pfsub( c.m_v1, _m_pfmul( a.m_v1, b.m_v1 ) )); + } + + friend Vec4 Reciprocal( Vec4::Arg v ) + { + // get the reciprocal estimate + __m64 x0 = _m_pfrcp(v.m_v0); + __m64 y1 = _m_pfrcp(v.m_v1); + + // Newton-Rhaphson refinement + __m64 x1 = _m_pfrcpit1(v.m_v0, x0); + __m64 y1 = _m_pfrcpit1(v.m_v1, y0); + + __m64 x2 = _m_pfrcpit2(x1, x0); + __m64 y2 = _m_pfrcpit2(y1, y0); + + return Vec4(x2, y2); + } + + friend Vec4 Min( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfmin( left.m_v0, right.m_v0 ), + _m_pfmin( left.m_v1, right.m_v1 )); + } + + friend Vec4 Max( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfmax( left.m_v0, right.m_v0 ), + _m_pfmax( left.m_v1, right.m_v1 )); + } + + friend Vec4 Truncate( Vec4::Arg v ) + { + // convert to ints + __m64 i0 = _m_pf2id( v.m_v0 ); + __m64 i1 = _m_pf2id( v.m_v1 ); + + // convert to floats + __m64 f0 = _m_pi2fd( i0 ); + __m64 f1 = _m_pi2fd( i1 ); + + // clear out the MMX multimedia state to allow FP calls later + //_m_femms(); + + return Vec4( f0, f1 ); + } + + friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( + _m_pfcmpeq( left.m_v0, right.m_v0 ), + _m_pfcmpeq( left.m_v1, right.m_v1 )); + } +/* + friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits ) + { + __m128 a = _mm_andnot_ps( bits.m_v, off.m_v ); + __m128 b = _mm_and_ps( bits.m_v, on.m_v ); + + return Vec4( _mm_or_ps( a, b ) ); + } +*//* + friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right ) + { + __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v ); + int value = _mm_movemask_ps( bits ); + return value != 0; + } +*/ +private: + __m64 m_v0; + __m64 m_v1; +}; + +} // namespace squish + +#endif // ndef SQUISH_SIMD_3DNOW_H diff --git a/externals/NVTT/src/nvtt/squish/simd_sse.h b/externals/NVTT/src/nvtt/squish/simd_sse.h new file mode 100644 index 00000000..853ee7ac --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/simd_sse.h @@ -0,0 +1,193 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SIMD_SSE_H +#define SQUISH_SIMD_SSE_H + +#include +#if ( SQUISH_USE_SSE > 1 ) +#include +#endif +#include + +#define SQUISH_SSE_SPLAT( a ) \ + ( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) ) + +namespace squish { + +#define VEC4_CONST( X ) Vec4( _mm_set1_ps( X ) ) + +class Vec4 +{ +public: + typedef Vec4 const& Arg; + + Vec4() {} + + explicit Vec4( __m128 v ) : m_v( v ) {} + + Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {} + + Vec4& operator=( Vec4 const& arg ) + { + m_v = arg.m_v; + return *this; + } + + Vec4( const float * v ) + { + m_v = _mm_load_ps( v ); + } + + Vec4( float x, float y, float z, float w ) + { + m_v = _mm_setr_ps( x, y, z, w ); + } + + Vec3 GetVec3() const + { + SQUISH_ALIGN_16 float c[4]; + _mm_store_ps( c, m_v ); + return Vec3( c[0], c[1], c[2] ); + } + + Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); } + Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); } + Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); } + Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); } + + Vec4& operator+=( Arg v ) + { + m_v = _mm_add_ps( m_v, v.m_v ); + return *this; + } + + Vec4& operator-=( Arg v ) + { + m_v = _mm_sub_ps( m_v, v.m_v ); + return *this; + } + + Vec4& operator*=( Arg v ) + { + m_v = _mm_mul_ps( m_v, v.m_v ); + return *this; + } + + friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_add_ps( left.m_v, right.m_v ) ); + } + + friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_sub_ps( left.m_v, right.m_v ) ); + } + + friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_mul_ps( left.m_v, right.m_v ) ); + } + + //! Returns a*b + c + friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( _mm_add_ps( _mm_mul_ps( a.m_v, b.m_v ), c.m_v ) ); + } + + //! Returns -( a*b - c ) + friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( _mm_sub_ps( c.m_v, _mm_mul_ps( a.m_v, b.m_v ) ) ); + } + + friend Vec4 Reciprocal( Vec4::Arg v ) + { + // get the reciprocal estimate + __m128 estimate = _mm_rcp_ps( v.m_v ); + + // one round of Newton-Rhaphson refinement + __m128 diff = _mm_sub_ps( _mm_set1_ps( 1.0f ), _mm_mul_ps( estimate, v.m_v ) ); + return Vec4( _mm_add_ps( _mm_mul_ps( diff, estimate ), estimate ) ); + } + + friend Vec4 Min( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_min_ps( left.m_v, right.m_v ) ); + } + + friend Vec4 Max( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_max_ps( left.m_v, right.m_v ) ); + } + + friend Vec4 Truncate( Vec4::Arg v ) + { +#if ( SQUISH_USE_SSE == 1 ) + // convert to ints + __m128 input = v.m_v; + __m64 lo = _mm_cvttps_pi32( input ); + __m64 hi = _mm_cvttps_pi32( _mm_movehl_ps( input, input ) ); + + // convert to floats + __m128 part = _mm_movelh_ps( input, _mm_cvtpi32_ps( input, hi ) ); + __m128 truncated = _mm_cvtpi32_ps( part, lo ); + + // clear out the MMX multimedia state to allow FP calls later + _mm_empty(); + return Vec4( truncated ); +#else + // use SSE2 instructions + return Vec4( _mm_cvtepi32_ps( _mm_cvttps_epi32( v.m_v ) ) ); +#endif + } + + friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( _mm_cmpeq_ps( left.m_v, right.m_v ) ); + } + + friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits ) + { + __m128 a = _mm_andnot_ps( bits.m_v, off.m_v ); + __m128 b = _mm_and_ps( bits.m_v, on.m_v ); + + return Vec4( _mm_or_ps( a, b ) ); + } + + friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right ) + { + __m128 bits = _mm_cmplt_ps( left.m_v, right.m_v ); + int value = _mm_movemask_ps( bits ); + return value != 0; + } + +private: + __m128 m_v; +}; + +} // namespace squish + +#endif // ndef SQUISH_SIMD_SSE_H diff --git a/externals/NVTT/src/nvtt/squish/simd_ve.h b/externals/NVTT/src/nvtt/squish/simd_ve.h new file mode 100644 index 00000000..56ed95e0 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/simd_ve.h @@ -0,0 +1,176 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SIMD_VE_H +#define SQUISH_SIMD_VE_H + +#include +#undef bool + +namespace squish { + +#define VEC4_CONST( X ) Vec4( ( vector float )( X ) ) + +class Vec4 +{ +public: + typedef Vec4 Arg; + + Vec4() {} + + explicit Vec4( vector float v ) : m_v( v ) {} + + Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {} + + Vec4& operator=( Vec4 const& arg ) + { + m_v = arg.m_v; + return *this; + } + + Vec4( const float * v ) + { + union { vector float v; float c[4]; } u; + u.c[0] = v[0]; + u.c[1] = v[1]; + u.c[2] = v[2]; + u.c[3] = v[3]; + m_v = u.v; + } + + Vec4( float x, float y, float z, float w ) + { + union { vector float v; float c[4]; } u; + u.c[0] = x; + u.c[1] = y; + u.c[2] = z; + u.c[3] = w; + m_v = u.v; + } + + Vec3 GetVec3() const + { + union { vector float v; float c[4]; } u; + u.v = m_v; + return Vec3( u.c[0], u.c[1], u.c[2] ); + } + + Vec4 SplatX() const { return Vec4( vec_splat( m_v, 0 ) ); } + Vec4 SplatY() const { return Vec4( vec_splat( m_v, 1 ) ); } + Vec4 SplatZ() const { return Vec4( vec_splat( m_v, 2 ) ); } + Vec4 SplatW() const { return Vec4( vec_splat( m_v, 3 ) ); } + + Vec4& operator+=( Arg v ) + { + m_v = vec_add( m_v, v.m_v ); + return *this; + } + + Vec4& operator-=( Arg v ) + { + m_v = vec_sub( m_v, v.m_v ); + return *this; + } + + Vec4& operator*=( Arg v ) + { + m_v = vec_madd( m_v, v.m_v, ( vector float )( -0.0f ) ); + return *this; + } + + friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( vec_add( left.m_v, right.m_v ) ); + } + + friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( vec_sub( left.m_v, right.m_v ) ); + } + + friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( vec_madd( left.m_v, right.m_v, ( vector float )( -0.0f ) ) ); + } + + //! Returns a*b + c + friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( vec_madd( a.m_v, b.m_v, c.m_v ) ); + } + + //! Returns -( a*b - c ) + friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c ) + { + return Vec4( vec_nmsub( a.m_v, b.m_v, c.m_v ) ); + } + + friend Vec4 Reciprocal( Vec4::Arg v ) + { + // get the reciprocal estimate + vector float estimate = vec_re( v.m_v ); + + // one round of Newton-Rhaphson refinement + vector float diff = vec_nmsub( estimate, v.m_v, ( vector float )( 1.0f ) ); + return Vec4( vec_madd( diff, estimate, estimate ) ); + } + + friend Vec4 Min( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( vec_min( left.m_v, right.m_v ) ); + } + + friend Vec4 Max( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( vec_max( left.m_v, right.m_v ) ); + } + + friend Vec4 Truncate( Vec4::Arg v ) + { + return Vec4( vec_trunc( v.m_v ) ); + } + + friend Vec4 CompareEqual( Vec4::Arg left, Vec4::Arg right ) + { + return Vec4( ( vector float )vec_cmpeq( left.m_v, right.m_v ) ); + } + + friend Vec4 Select( Vec4::Arg off, Vec4::Arg on, Vec4::Arg bits ) + { + return Vec4( vec_sel( off.m_v, on.m_v, ( vector unsigned int )bits.m_v ) ); + } + + friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right ) + { + return vec_any_lt( left.m_v, right.m_v ) != 0; + } + +private: + vector float m_v; +}; + +} // namespace squish + +#endif // ndef SQUISH_SIMD_VE_H diff --git a/externals/NVTT/src/nvtt/squish/singlechannelfit.cpp b/externals/NVTT/src/nvtt/squish/singlechannelfit.cpp new file mode 100644 index 00000000..6070bb5b --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/singlechannelfit.cpp @@ -0,0 +1,145 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "singlechannelfit.h" +#include "colourset.h" +#include "colourblock.h" +#include + +namespace squish { + +SingleChannelFit::SingleChannelFit( ColourSet const* colours, int const flags ) + : ColourFit( /*colours, flags*/ ) +{ + SetColourSet( colours, flags ); + // cache some values + unsigned int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // Find bounds of the search space. + m_g_min = 63; + m_g_max = 0; + + for(unsigned int i = 0; i < count; i++) { + + int grey = int(values[i].Y() * 255.0f); // @@ rounding? + grey = std::min(grey, 255); // clamp to [0, 1) + grey = std::max(grey, 0); + m_greys[i] = u8(grey); + + m_g_min = std::min(m_g_min, grey >> 2); + m_g_max = std::max(m_g_max, grey >> 2); + } + + int const g_pad = m_g_max - m_g_min + 1; + + m_g_min = std::max(0, m_g_min - g_pad); + m_g_max = std::min(63, m_g_max + g_pad); +} + +void SingleChannelFit::Compress3( void* block ) +{ + // do not do anything. +} + +void SingleChannelFit::Compress4( void* block ) +{ + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + float const* weights = m_colours->GetWeights(); + + int best_g0; + int best_g1; + float best_error = FLT_MAX; + + // Brute force approach, try all the possible endpoints with g0 > g1. + for(int g0 = m_g_min+1; g0 <= m_g_max; g0++) { + for(int g1 = m_g_min; g1 < g0; g1++) { + + // Compute palette. + const int c0 = (g0 << 2) | (g0 >> 4); + const int c1 = (g1 << 2) | (g1 >> 4); + const int c2 = (2 * c0 + c1) / 3; + const int c3 = (2 * c1 + c0) / 3; + + // Evaluate palette error. + float error = 0; + for(int i = 0; i < count; i++) { + const int grey = m_greys[i]; + + int min_dist = abs(c0 - grey); // Use absolute distance, not squared. + min_dist = std::min(min_dist, abs(c1 - grey)); + min_dist = std::min(min_dist, abs(c2 - grey)); + min_dist = std::min(min_dist, abs(c3 - grey)); + + error += min_dist * weights[i]; + } + + if(error < best_error) { + best_error = error; + best_g0 = g0; + best_g1 = g1; + } + } + } + + // Compute best palette. + const int best_c0 = (best_g0 << 2) | (best_g0 >> 4); + const int best_c1 = (best_g1 << 2) | (best_g1 >> 4); + const int best_c2 = (2 * best_c0 + best_c1) / 3; + const int best_c3 = (2 * best_c1 + best_c0) / 3; + + // Compute best indices. + u8 closest[16]; + for(int i = 0; i < count; i++) { + const int grey = m_greys[i]; + + int dist = abs(best_c0 - grey); + int min_dist = dist; + int min_i = 0; + + dist = abs(best_c1 - grey); + if( dist < min_dist ) { min_dist = dist; min_i = 1; } + + dist = abs(best_c2 - grey); + if( dist < min_dist ) { min_dist = dist; min_i = 2; } + + dist = abs(best_c3 - grey); + if( dist < min_dist ) { min_dist = dist; min_i = 3; } + + closest[i] = min_i; + } + + // remap the indices + u8 indices[16]; + m_colours->RemapIndices( closest, indices ); + + // Output block. + WriteColourBlock(best_g0 << 5, best_g1 << 5, indices, block); +} + + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/singlechannelfit.h b/externals/NVTT/src/nvtt/squish/singlechannelfit.h new file mode 100644 index 00000000..40de0a2a --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/singlechannelfit.h @@ -0,0 +1,53 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + Copyright (c) 2006 Ignacio Castano castanyo@yahoo.es + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SINGLECHANNELFIT_H +#define SQUISH_SINGLECHANNELFIT_H + +#include +#include "maths.h" +#include "colourfit.h" + +namespace squish { + +class SingleChannelFit : public ColourFit +{ +public: + SingleChannelFit( ColourSet const* colours, int flags ); + +private: + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + +private: + u8 m_greys[16]; + int m_g_min; + int m_g_max; +}; + +} // namespace squish + +#endif // ndef SQUISH_SINGLECHANNELFIT_H diff --git a/externals/NVTT/src/nvtt/squish/singlecolourfit.cpp b/externals/NVTT/src/nvtt/squish/singlecolourfit.cpp new file mode 100644 index 00000000..ab5de3cd --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/singlecolourfit.cpp @@ -0,0 +1,173 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include "singlecolourfit.h" +#include "colourset.h" +#include "colourblock.h" + +namespace squish { + +struct SourceBlock +{ + u8 start; + u8 end; + u8 error; +}; + +struct SingleColourLookup +{ + SourceBlock sources[4]; +}; + +#include "singlecolourlookup.inl" + +static int FloatToInt( float a, int limit ) +{ + // use ANSI round-to-zero behaviour to get round-to-nearest + int i = ( int )( a + 0.5f ); + + // clamp to the limit + if( i < 0 ) + i = 0; + else if( i > limit ) + i = limit; + + // done + return i; +} + +SingleColourFit::SingleColourFit( ColourSet const* colours, int flags ) + : ColourFit( /*colours, flags*/ ) +{ + SetColourSet( colours, flags ); + // grab the single colour + Vec3 const* values = m_colours->GetPoints(); + m_colour[0] = ( u8 )FloatToInt( 255.0f*values->X(), 255 ); + m_colour[1] = ( u8 )FloatToInt( 255.0f*values->Y(), 255 ); + m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 ); + + // initialise the best error + m_besterror = INT_MAX; +} + +void SingleColourFit::Compress3( void* block ) +{ + // build the table of lookups + SingleColourLookup const* const lookups[] = + { + lookup_5_3, + lookup_6_3, + lookup_5_3 + }; + + // find the best end-points and index + ComputeEndPoints( 3, lookups ); + + // build the block if we win + if( m_error < m_besterror ) + { + // remap the indices + u8 indices[16]; + m_colours->RemapIndices( &m_index, indices ); + + // save the block + WriteColourBlock3( m_start, m_end, indices, block ); + + // save the error + m_besterror = m_error; + } +} + +void SingleColourFit::Compress4( void* block ) +{ + // build the table of lookups + SingleColourLookup const* const lookups[] = + { + lookup_5_4, + lookup_6_4, + lookup_5_4 + }; + + // find the best end-points and index + ComputeEndPoints( 4, lookups ); + + // build the block if we win + if( m_error < m_besterror ) + { + // remap the indices + u8 indices[16]; + m_colours->RemapIndices( &m_index, indices ); + + // save the block + WriteColourBlock4( m_start, m_end, indices, block ); + + // save the error + m_besterror = m_error; + } +} + +void SingleColourFit::ComputeEndPoints( int count, SingleColourLookup const* const* lookups ) +{ + // check each index combination + m_error = INT_MAX; + for( int index = 0; index < count; ++index ) + { + // check the error for this codebook index + SourceBlock const* sources[3]; + int error = 0; + for( int channel = 0; channel < 3; ++channel ) + { + // grab the lookup table and index for this channel + SingleColourLookup const* lookup = lookups[channel]; + int target = m_colour[channel]; + + // store a pointer to the source for this channel + sources[channel] = lookup[target].sources + index; + + // accumulate the error + int diff = sources[channel]->error; + error += diff*diff; + } + + // keep it if the error is lower + if( error < m_error ) + { + m_start = Vec3( + ( float )sources[0]->start/31.0f, + ( float )sources[1]->start/63.0f, + ( float )sources[2]->start/31.0f + ); + m_end = Vec3( + ( float )sources[0]->end/31.0f, + ( float )sources[1]->end/63.0f, + ( float )sources[2]->end/31.0f + ); + m_index = ( u8 )index; + m_error = error; + } + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/singlecolourfit.h b/externals/NVTT/src/nvtt/squish/singlecolourfit.h new file mode 100644 index 00000000..3c4a1a38 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/singlecolourfit.h @@ -0,0 +1,58 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_SINGLECOLOURFIT_H +#define SQUISH_SINGLECOLOURFIT_H + +#include +#include "colourfit.h" + +namespace squish { + +class ColourSet; +struct SingleColourLookup; + +class SingleColourFit : public ColourFit +{ +public: + SingleColourFit( ColourSet const* colours, int flags ); + +private: + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + + void ComputeEndPoints( int count, SingleColourLookup const* const* lookups ); + + u8 m_colour[3]; + Vec3 m_start; + Vec3 m_end; + u8 m_index; + int m_error; + int m_besterror; +}; + +} // namespace squish + +#endif // ndef SQUISH_SINGLECOLOURFIT_H diff --git a/externals/NVTT/src/nvtt/squish/singlecolourlookup.inl b/externals/NVTT/src/nvtt/squish/singlecolourlookup.inl new file mode 100644 index 00000000..52800a82 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/singlecolourlookup.inl @@ -0,0 +1,1040 @@ + +static SingleColourLookup const lookup_5_3[] = +{ + { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } }, + { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 0 } } }, + { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 0 } } }, + { { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 1, 1 }, { 0, 0, 0 } } }, + { { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 1, 0 }, { 0, 0, 0 } } }, + { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 1, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 1, 2 }, { 0, 0, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 2, 0 }, { 0, 0, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 2, 2 }, { 0, 0, 0 } } }, + { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 3, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 4 }, { 0, 1, 4 }, { 0, 3, 0 }, { 0, 0, 0 } } }, + { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 3, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 3, 2 }, { 0, 0, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 0, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 4, 2 }, { 0, 0, 0 } } }, + { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 5, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 4 }, { 0, 2, 4 }, { 0, 5, 0 }, { 0, 0, 0 } } }, + { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 5, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 5, 2 }, { 0, 0, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 6, 0 }, { 0, 0, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 6, 2 }, { 0, 0, 0 } } }, + { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 7, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 4 }, { 0, 3, 4 }, { 0, 7, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 7, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 7, 2 }, { 0, 0, 0 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 1, 7, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 1, 7, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 8, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 2, 7, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 3 }, { 0, 4, 3 }, { 2, 7, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 9, 0 }, { 0, 0, 0 } } }, + { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 9, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 3, 7, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 3, 7, 0 }, { 0, 0, 0 } } }, + { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 10, 0 }, { 0, 0, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 10, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 0, 10, 2 }, { 0, 0, 0 } } }, + { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 11, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 4 }, { 0, 5, 4 }, { 0, 11, 0 }, { 0, 0, 0 } } }, + { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 11, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 11, 2 }, { 0, 0, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 12, 0 }, { 0, 0, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 12, 2 }, { 0, 0, 0 } } }, + { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 13, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 4 }, { 0, 6, 4 }, { 0, 13, 0 }, { 0, 0, 0 } } }, + { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 13, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 13, 2 }, { 0, 0, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 14, 0 }, { 0, 0, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 14, 2 }, { 0, 0, 0 } } }, + { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 15, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 4 }, { 0, 7, 4 }, { 0, 15, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 15, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 15, 2 }, { 0, 0, 0 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 1, 15, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 1, 15, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 16, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 2, 15, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 3 }, { 0, 8, 3 }, { 2, 15, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 17, 0 }, { 0, 0, 0 } } }, + { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 17, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 3, 15, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 3, 15, 0 }, { 0, 0, 0 } } }, + { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 18, 0 }, { 0, 0, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 18, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 0, 18, 2 }, { 0, 0, 0 } } }, + { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 19, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 4 }, { 0, 9, 4 }, { 0, 19, 0 }, { 0, 0, 0 } } }, + { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 19, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 19, 2 }, { 0, 0, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 20, 0 }, { 0, 0, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 20, 2 }, { 0, 0, 0 } } }, + { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 21, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 4 }, { 0, 10, 4 }, { 0, 21, 0 }, { 0, 0, 0 } } }, + { { { 11, 0, 3 }, { 0, 11, 3 }, { 0, 21, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 21, 2 }, { 0, 0, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 22, 0 }, { 0, 0, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 22, 2 }, { 0, 0, 0 } } }, + { { { 11, 0, 3 }, { 0, 11, 3 }, { 0, 23, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 4 }, { 0, 11, 4 }, { 0, 23, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 4 }, { 0, 12, 4 }, { 0, 23, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 3 }, { 0, 12, 3 }, { 0, 23, 2 }, { 0, 0, 0 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 1, 23, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 1, 23, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 24, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 2, 23, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 3 }, { 0, 12, 3 }, { 2, 23, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 4 }, { 0, 12, 4 }, { 0, 25, 0 }, { 0, 0, 0 } } }, + { { { 13, 0, 3 }, { 0, 13, 3 }, { 0, 25, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 3, 23, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 3, 23, 0 }, { 0, 0, 0 } } }, + { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 26, 0 }, { 0, 0, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 26, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 26, 2 }, { 0, 0, 0 } } }, + { { { 13, 0, 3 }, { 0, 13, 3 }, { 0, 27, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 4 }, { 0, 13, 4 }, { 0, 27, 0 }, { 0, 0, 0 } } }, + { { { 14, 0, 3 }, { 0, 14, 3 }, { 0, 27, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 27, 2 }, { 0, 0, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 28, 0 }, { 0, 0, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 28, 2 }, { 0, 0, 0 } } }, + { { { 14, 0, 3 }, { 0, 14, 3 }, { 0, 29, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 4 }, { 0, 14, 4 }, { 0, 29, 0 }, { 0, 0, 0 } } }, + { { { 15, 0, 3 }, { 0, 15, 3 }, { 0, 29, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 29, 2 }, { 0, 0, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 30, 0 }, { 0, 0, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 30, 2 }, { 0, 0, 0 } } }, + { { { 15, 0, 3 }, { 0, 15, 3 }, { 0, 31, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 4 }, { 0, 15, 4 }, { 0, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 4 }, { 0, 16, 4 }, { 0, 31, 1 }, { 0, 0, 0 } } }, + { { { 16, 0, 3 }, { 0, 16, 3 }, { 0, 31, 2 }, { 0, 0, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 1, 31, 1 }, { 0, 0, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 0 }, { 0, 16, 0 }, { 4, 28, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 4, 28, 1 }, { 0, 0, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 2, 31, 1 }, { 0, 0, 0 } } }, + { { { 16, 0, 3 }, { 0, 16, 3 }, { 2, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 4 }, { 0, 16, 4 }, { 4, 29, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 3 }, { 0, 17, 3 }, { 4, 29, 1 }, { 0, 0, 0 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 3, 31, 1 }, { 0, 0, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 3, 31, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 0 }, { 0, 17, 0 }, { 4, 30, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 4, 30, 1 }, { 0, 0, 0 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 4, 30, 2 }, { 0, 0, 0 } } }, + { { { 17, 0, 3 }, { 0, 17, 3 }, { 4, 31, 1 }, { 0, 0, 0 } } }, + { { { 17, 0, 4 }, { 0, 17, 4 }, { 4, 31, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 3 }, { 0, 18, 3 }, { 4, 31, 1 }, { 0, 0, 0 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 4, 31, 2 }, { 0, 0, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 1 }, { 0, 0, 0 } } }, + { { { 18, 0, 0 }, { 0, 18, 0 }, { 5, 31, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 1 }, { 0, 0, 0 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 5, 31, 2 }, { 0, 0, 0 } } }, + { { { 18, 0, 3 }, { 0, 18, 3 }, { 6, 31, 1 }, { 0, 0, 0 } } }, + { { { 18, 0, 4 }, { 0, 18, 4 }, { 6, 31, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 3 }, { 0, 19, 3 }, { 6, 31, 1 }, { 0, 0, 0 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 6, 31, 2 }, { 0, 0, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 1 }, { 0, 0, 0 } } }, + { { { 19, 0, 0 }, { 0, 19, 0 }, { 7, 31, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 1 }, { 0, 0, 0 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 7, 31, 2 }, { 0, 0, 0 } } }, + { { { 19, 0, 3 }, { 0, 19, 3 }, { 8, 31, 1 }, { 0, 0, 0 } } }, + { { { 19, 0, 4 }, { 0, 19, 4 }, { 8, 31, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 4 }, { 0, 20, 4 }, { 8, 31, 1 }, { 0, 0, 0 } } }, + { { { 20, 0, 3 }, { 0, 20, 3 }, { 8, 31, 2 }, { 0, 0, 0 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 9, 31, 1 }, { 0, 0, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 9, 31, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 0 }, { 0, 20, 0 }, { 12, 28, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 12, 28, 1 }, { 0, 0, 0 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 10, 31, 1 }, { 0, 0, 0 } } }, + { { { 20, 0, 3 }, { 0, 20, 3 }, { 10, 31, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 4 }, { 0, 20, 4 }, { 12, 29, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 3 }, { 0, 21, 3 }, { 12, 29, 1 }, { 0, 0, 0 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 11, 31, 1 }, { 0, 0, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 11, 31, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 0 }, { 0, 21, 0 }, { 12, 30, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 12, 30, 1 }, { 0, 0, 0 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 12, 30, 2 }, { 0, 0, 0 } } }, + { { { 21, 0, 3 }, { 0, 21, 3 }, { 12, 31, 1 }, { 0, 0, 0 } } }, + { { { 21, 0, 4 }, { 0, 21, 4 }, { 12, 31, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 3 }, { 0, 22, 3 }, { 12, 31, 1 }, { 0, 0, 0 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 12, 31, 2 }, { 0, 0, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 1 }, { 0, 0, 0 } } }, + { { { 22, 0, 0 }, { 0, 22, 0 }, { 13, 31, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 1 }, { 0, 0, 0 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 13, 31, 2 }, { 0, 0, 0 } } }, + { { { 22, 0, 3 }, { 0, 22, 3 }, { 14, 31, 1 }, { 0, 0, 0 } } }, + { { { 22, 0, 4 }, { 0, 22, 4 }, { 14, 31, 0 }, { 0, 0, 0 } } }, + { { { 23, 0, 3 }, { 0, 23, 3 }, { 14, 31, 1 }, { 0, 0, 0 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 14, 31, 2 }, { 0, 0, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 1 }, { 0, 0, 0 } } }, + { { { 23, 0, 0 }, { 0, 23, 0 }, { 15, 31, 0 }, { 0, 0, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 1 }, { 0, 0, 0 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 15, 31, 2 }, { 0, 0, 0 } } }, + { { { 23, 0, 3 }, { 0, 23, 3 }, { 16, 31, 1 }, { 0, 0, 0 } } }, + { { { 23, 0, 4 }, { 0, 23, 4 }, { 16, 31, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 4 }, { 0, 24, 4 }, { 16, 31, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 3 }, { 0, 24, 3 }, { 16, 31, 2 }, { 0, 0, 0 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 17, 31, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 17, 31, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 0 }, { 0, 24, 0 }, { 20, 28, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 20, 28, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 18, 31, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 3 }, { 0, 24, 3 }, { 18, 31, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 4 }, { 0, 24, 4 }, { 20, 29, 0 }, { 0, 0, 0 } } }, + { { { 25, 0, 3 }, { 0, 25, 3 }, { 20, 29, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 19, 31, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 19, 31, 0 }, { 0, 0, 0 } } }, + { { { 25, 0, 0 }, { 0, 25, 0 }, { 20, 30, 0 }, { 0, 0, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 20, 30, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 20, 30, 2 }, { 0, 0, 0 } } }, + { { { 25, 0, 3 }, { 0, 25, 3 }, { 20, 31, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 4 }, { 0, 25, 4 }, { 20, 31, 0 }, { 0, 0, 0 } } }, + { { { 26, 0, 3 }, { 0, 26, 3 }, { 20, 31, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 20, 31, 2 }, { 0, 0, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 21, 31, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 0 }, { 0, 26, 0 }, { 21, 31, 0 }, { 0, 0, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 21, 31, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 21, 31, 2 }, { 0, 0, 0 } } }, + { { { 26, 0, 3 }, { 0, 26, 3 }, { 22, 31, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 4 }, { 0, 26, 4 }, { 22, 31, 0 }, { 0, 0, 0 } } }, + { { { 27, 0, 3 }, { 0, 27, 3 }, { 22, 31, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 22, 31, 2 }, { 0, 0, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 23, 31, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 0 }, { 0, 27, 0 }, { 23, 31, 0 }, { 0, 0, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 23, 31, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 23, 31, 2 }, { 0, 0, 0 } } }, + { { { 27, 0, 3 }, { 0, 27, 3 }, { 24, 31, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 4 }, { 0, 27, 4 }, { 24, 31, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 4 }, { 0, 28, 4 }, { 24, 31, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 3 }, { 0, 28, 3 }, { 24, 31, 2 }, { 0, 0, 0 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 25, 31, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 25, 31, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 0 }, { 0, 28, 0 }, { 28, 28, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 28, 28, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 26, 31, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 3 }, { 0, 28, 3 }, { 26, 31, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 4 }, { 0, 28, 4 }, { 28, 29, 0 }, { 0, 0, 0 } } }, + { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 29, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 27, 31, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 27, 31, 0 }, { 0, 0, 0 } } }, + { { { 29, 0, 0 }, { 0, 29, 0 }, { 28, 30, 0 }, { 0, 0, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 28, 30, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 28, 30, 2 }, { 0, 0, 0 } } }, + { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 31, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 4 }, { 0, 29, 4 }, { 28, 31, 0 }, { 0, 0, 0 } } }, + { { { 30, 0, 3 }, { 0, 30, 3 }, { 28, 31, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 28, 31, 2 }, { 0, 0, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 29, 31, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 0 }, { 0, 30, 0 }, { 29, 31, 0 }, { 0, 0, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 29, 31, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 29, 31, 2 }, { 0, 0, 0 } } }, + { { { 30, 0, 3 }, { 0, 30, 3 }, { 30, 31, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 4 }, { 0, 30, 4 }, { 30, 31, 0 }, { 0, 0, 0 } } }, + { { { 31, 0, 3 }, { 0, 31, 3 }, { 30, 31, 1 }, { 0, 0, 0 } } }, + { { { 31, 0, 2 }, { 0, 31, 2 }, { 30, 31, 2 }, { 0, 0, 0 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 31, 31, 1 }, { 0, 0, 0 } } }, + { { { 31, 0, 0 }, { 0, 31, 0 }, { 31, 31, 0 }, { 0, 0, 0 } } } +}; + +static SingleColourLookup const lookup_6_3[] = +{ + { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } }, + { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 1 }, { 0, 0, 0 } } }, + { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 1, 0 }, { 0, 0, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 2, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 2, 0 }, { 0, 0, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 0, 0, 0 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 3, 0 }, { 0, 0, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 4, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 0, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 5, 1 }, { 0, 0, 0 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 5, 0 }, { 0, 0, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 6, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 6, 0 }, { 0, 0, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 7, 1 }, { 0, 0, 0 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 7, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 8, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 0, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 9, 1 }, { 0, 0, 0 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 9, 0 }, { 0, 0, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 10, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 10, 0 }, { 0, 0, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 11, 1 }, { 0, 0, 0 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 0, 11, 0 }, { 0, 0, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 12, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 12, 0 }, { 0, 0, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 13, 1 }, { 0, 0, 0 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 13, 0 }, { 0, 0, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 14, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 14, 0 }, { 0, 0, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 15, 1 }, { 0, 0, 0 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 15, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 16, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 0, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 17, 1 }, { 0, 0, 0 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 0, 17, 0 }, { 0, 0, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 18, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 18, 0 }, { 0, 0, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 19, 1 }, { 0, 0, 0 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 0, 19, 0 }, { 0, 0, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 20, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 20, 0 }, { 0, 0, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 21, 1 }, { 0, 0, 0 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 21, 0 }, { 0, 0, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 22, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 22, 0 }, { 0, 0, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 23, 1 }, { 0, 0, 0 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 23, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 24, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 0, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 25, 1 }, { 0, 0, 0 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 0, 25, 0 }, { 0, 0, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 26, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 26, 0 }, { 0, 0, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 27, 1 }, { 0, 0, 0 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 27, 0 }, { 0, 0, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 28, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 28, 0 }, { 0, 0, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 29, 1 }, { 0, 0, 0 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 29, 0 }, { 0, 0, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 30, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 30, 0 }, { 0, 0, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 31, 1 }, { 0, 0, 0 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 1, 31, 1 }, { 0, 0, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 2, 31, 0 }, { 0, 0, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 33, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 3, 31, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 0 }, { 0, 17, 0 }, { 0, 34, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 4, 31, 0 }, { 0, 0, 0 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 0, 35, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 5, 31, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 0 }, { 0, 18, 0 }, { 0, 36, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 6, 31, 0 }, { 0, 0, 0 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 0, 37, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 7, 31, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 0 }, { 0, 19, 0 }, { 0, 38, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 8, 31, 0 }, { 0, 0, 0 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 0, 39, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 9, 31, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 0 }, { 0, 20, 0 }, { 0, 40, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 10, 31, 0 }, { 0, 0, 0 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 0, 41, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 11, 31, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 0 }, { 0, 21, 0 }, { 0, 42, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 12, 31, 0 }, { 0, 0, 0 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 0, 43, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 13, 31, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 0 }, { 0, 22, 0 }, { 0, 44, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 14, 31, 0 }, { 0, 0, 0 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 0, 45, 0 }, { 0, 0, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 15, 31, 0 }, { 0, 0, 0 } } }, + { { { 23, 0, 0 }, { 0, 23, 0 }, { 0, 46, 0 }, { 0, 0, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 0, 47, 1 }, { 0, 0, 0 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 0, 47, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 0, 48, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 0 }, { 0, 24, 0 }, { 0, 48, 0 }, { 0, 0, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 0, 49, 1 }, { 0, 0, 0 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 0, 49, 0 }, { 0, 0, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 0, 50, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 0 }, { 0, 25, 0 }, { 0, 50, 0 }, { 0, 0, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 0, 51, 1 }, { 0, 0, 0 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 0, 51, 0 }, { 0, 0, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 0, 52, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 0 }, { 0, 26, 0 }, { 0, 52, 0 }, { 0, 0, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 0, 53, 1 }, { 0, 0, 0 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 0, 53, 0 }, { 0, 0, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 0, 54, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 0 }, { 0, 27, 0 }, { 0, 54, 0 }, { 0, 0, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 0, 55, 1 }, { 0, 0, 0 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 0, 55, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 0, 56, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 0 }, { 0, 28, 0 }, { 0, 56, 0 }, { 0, 0, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 0, 57, 1 }, { 0, 0, 0 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 0, 57, 0 }, { 0, 0, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 0, 58, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 0 }, { 0, 29, 0 }, { 0, 58, 0 }, { 0, 0, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 0, 59, 1 }, { 0, 0, 0 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 0, 59, 0 }, { 0, 0, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 0, 60, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 0 }, { 0, 30, 0 }, { 0, 60, 0 }, { 0, 0, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 0, 61, 1 }, { 0, 0, 0 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 0, 61, 0 }, { 0, 0, 0 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 0, 62, 1 }, { 0, 0, 0 } } }, + { { { 31, 0, 0 }, { 0, 31, 0 }, { 0, 62, 0 }, { 0, 0, 0 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 0, 63, 1 }, { 0, 0, 0 } } }, + { { { 31, 0, 2 }, { 0, 31, 2 }, { 0, 63, 0 }, { 0, 0, 0 } } }, + { { { 32, 0, 2 }, { 0, 32, 2 }, { 1, 63, 1 }, { 0, 0, 0 } } }, + { { { 32, 0, 1 }, { 0, 32, 1 }, { 1, 63, 0 }, { 0, 0, 0 } } }, + { { { 32, 0, 0 }, { 0, 32, 0 }, { 16, 48, 0 }, { 0, 0, 0 } } }, + { { { 32, 0, 1 }, { 0, 32, 1 }, { 2, 63, 0 }, { 0, 0, 0 } } }, + { { { 32, 0, 2 }, { 0, 32, 2 }, { 16, 49, 0 }, { 0, 0, 0 } } }, + { { { 33, 0, 1 }, { 0, 33, 1 }, { 3, 63, 0 }, { 0, 0, 0 } } }, + { { { 33, 0, 0 }, { 0, 33, 0 }, { 16, 50, 0 }, { 0, 0, 0 } } }, + { { { 33, 0, 1 }, { 0, 33, 1 }, { 4, 63, 0 }, { 0, 0, 0 } } }, + { { { 33, 0, 2 }, { 0, 33, 2 }, { 16, 51, 0 }, { 0, 0, 0 } } }, + { { { 34, 0, 1 }, { 0, 34, 1 }, { 5, 63, 0 }, { 0, 0, 0 } } }, + { { { 34, 0, 0 }, { 0, 34, 0 }, { 16, 52, 0 }, { 0, 0, 0 } } }, + { { { 34, 0, 1 }, { 0, 34, 1 }, { 6, 63, 0 }, { 0, 0, 0 } } }, + { { { 34, 0, 2 }, { 0, 34, 2 }, { 16, 53, 0 }, { 0, 0, 0 } } }, + { { { 35, 0, 1 }, { 0, 35, 1 }, { 7, 63, 0 }, { 0, 0, 0 } } }, + { { { 35, 0, 0 }, { 0, 35, 0 }, { 16, 54, 0 }, { 0, 0, 0 } } }, + { { { 35, 0, 1 }, { 0, 35, 1 }, { 8, 63, 0 }, { 0, 0, 0 } } }, + { { { 35, 0, 2 }, { 0, 35, 2 }, { 16, 55, 0 }, { 0, 0, 0 } } }, + { { { 36, 0, 1 }, { 0, 36, 1 }, { 9, 63, 0 }, { 0, 0, 0 } } }, + { { { 36, 0, 0 }, { 0, 36, 0 }, { 16, 56, 0 }, { 0, 0, 0 } } }, + { { { 36, 0, 1 }, { 0, 36, 1 }, { 10, 63, 0 }, { 0, 0, 0 } } }, + { { { 36, 0, 2 }, { 0, 36, 2 }, { 16, 57, 0 }, { 0, 0, 0 } } }, + { { { 37, 0, 1 }, { 0, 37, 1 }, { 11, 63, 0 }, { 0, 0, 0 } } }, + { { { 37, 0, 0 }, { 0, 37, 0 }, { 16, 58, 0 }, { 0, 0, 0 } } }, + { { { 37, 0, 1 }, { 0, 37, 1 }, { 12, 63, 0 }, { 0, 0, 0 } } }, + { { { 37, 0, 2 }, { 0, 37, 2 }, { 16, 59, 0 }, { 0, 0, 0 } } }, + { { { 38, 0, 1 }, { 0, 38, 1 }, { 13, 63, 0 }, { 0, 0, 0 } } }, + { { { 38, 0, 0 }, { 0, 38, 0 }, { 16, 60, 0 }, { 0, 0, 0 } } }, + { { { 38, 0, 1 }, { 0, 38, 1 }, { 14, 63, 0 }, { 0, 0, 0 } } }, + { { { 38, 0, 2 }, { 0, 38, 2 }, { 16, 61, 0 }, { 0, 0, 0 } } }, + { { { 39, 0, 1 }, { 0, 39, 1 }, { 15, 63, 0 }, { 0, 0, 0 } } }, + { { { 39, 0, 0 }, { 0, 39, 0 }, { 16, 62, 0 }, { 0, 0, 0 } } }, + { { { 39, 0, 1 }, { 0, 39, 1 }, { 16, 63, 1 }, { 0, 0, 0 } } }, + { { { 39, 0, 2 }, { 0, 39, 2 }, { 16, 63, 0 }, { 0, 0, 0 } } }, + { { { 40, 0, 1 }, { 0, 40, 1 }, { 17, 63, 1 }, { 0, 0, 0 } } }, + { { { 40, 0, 0 }, { 0, 40, 0 }, { 17, 63, 0 }, { 0, 0, 0 } } }, + { { { 40, 0, 1 }, { 0, 40, 1 }, { 18, 63, 1 }, { 0, 0, 0 } } }, + { { { 40, 0, 2 }, { 0, 40, 2 }, { 18, 63, 0 }, { 0, 0, 0 } } }, + { { { 41, 0, 1 }, { 0, 41, 1 }, { 19, 63, 1 }, { 0, 0, 0 } } }, + { { { 41, 0, 0 }, { 0, 41, 0 }, { 19, 63, 0 }, { 0, 0, 0 } } }, + { { { 41, 0, 1 }, { 0, 41, 1 }, { 20, 63, 1 }, { 0, 0, 0 } } }, + { { { 41, 0, 2 }, { 0, 41, 2 }, { 20, 63, 0 }, { 0, 0, 0 } } }, + { { { 42, 0, 1 }, { 0, 42, 1 }, { 21, 63, 1 }, { 0, 0, 0 } } }, + { { { 42, 0, 0 }, { 0, 42, 0 }, { 21, 63, 0 }, { 0, 0, 0 } } }, + { { { 42, 0, 1 }, { 0, 42, 1 }, { 22, 63, 1 }, { 0, 0, 0 } } }, + { { { 42, 0, 2 }, { 0, 42, 2 }, { 22, 63, 0 }, { 0, 0, 0 } } }, + { { { 43, 0, 1 }, { 0, 43, 1 }, { 23, 63, 1 }, { 0, 0, 0 } } }, + { { { 43, 0, 0 }, { 0, 43, 0 }, { 23, 63, 0 }, { 0, 0, 0 } } }, + { { { 43, 0, 1 }, { 0, 43, 1 }, { 24, 63, 1 }, { 0, 0, 0 } } }, + { { { 43, 0, 2 }, { 0, 43, 2 }, { 24, 63, 0 }, { 0, 0, 0 } } }, + { { { 44, 0, 1 }, { 0, 44, 1 }, { 25, 63, 1 }, { 0, 0, 0 } } }, + { { { 44, 0, 0 }, { 0, 44, 0 }, { 25, 63, 0 }, { 0, 0, 0 } } }, + { { { 44, 0, 1 }, { 0, 44, 1 }, { 26, 63, 1 }, { 0, 0, 0 } } }, + { { { 44, 0, 2 }, { 0, 44, 2 }, { 26, 63, 0 }, { 0, 0, 0 } } }, + { { { 45, 0, 1 }, { 0, 45, 1 }, { 27, 63, 1 }, { 0, 0, 0 } } }, + { { { 45, 0, 0 }, { 0, 45, 0 }, { 27, 63, 0 }, { 0, 0, 0 } } }, + { { { 45, 0, 1 }, { 0, 45, 1 }, { 28, 63, 1 }, { 0, 0, 0 } } }, + { { { 45, 0, 2 }, { 0, 45, 2 }, { 28, 63, 0 }, { 0, 0, 0 } } }, + { { { 46, 0, 1 }, { 0, 46, 1 }, { 29, 63, 1 }, { 0, 0, 0 } } }, + { { { 46, 0, 0 }, { 0, 46, 0 }, { 29, 63, 0 }, { 0, 0, 0 } } }, + { { { 46, 0, 1 }, { 0, 46, 1 }, { 30, 63, 1 }, { 0, 0, 0 } } }, + { { { 46, 0, 2 }, { 0, 46, 2 }, { 30, 63, 0 }, { 0, 0, 0 } } }, + { { { 47, 0, 1 }, { 0, 47, 1 }, { 31, 63, 1 }, { 0, 0, 0 } } }, + { { { 47, 0, 0 }, { 0, 47, 0 }, { 31, 63, 0 }, { 0, 0, 0 } } }, + { { { 47, 0, 1 }, { 0, 47, 1 }, { 32, 63, 1 }, { 0, 0, 0 } } }, + { { { 47, 0, 2 }, { 0, 47, 2 }, { 32, 63, 0 }, { 0, 0, 0 } } }, + { { { 48, 0, 2 }, { 0, 48, 2 }, { 33, 63, 1 }, { 0, 0, 0 } } }, + { { { 48, 0, 1 }, { 0, 48, 1 }, { 33, 63, 0 }, { 0, 0, 0 } } }, + { { { 48, 0, 0 }, { 0, 48, 0 }, { 48, 48, 0 }, { 0, 0, 0 } } }, + { { { 48, 0, 1 }, { 0, 48, 1 }, { 34, 63, 0 }, { 0, 0, 0 } } }, + { { { 48, 0, 2 }, { 0, 48, 2 }, { 48, 49, 0 }, { 0, 0, 0 } } }, + { { { 49, 0, 1 }, { 0, 49, 1 }, { 35, 63, 0 }, { 0, 0, 0 } } }, + { { { 49, 0, 0 }, { 0, 49, 0 }, { 48, 50, 0 }, { 0, 0, 0 } } }, + { { { 49, 0, 1 }, { 0, 49, 1 }, { 36, 63, 0 }, { 0, 0, 0 } } }, + { { { 49, 0, 2 }, { 0, 49, 2 }, { 48, 51, 0 }, { 0, 0, 0 } } }, + { { { 50, 0, 1 }, { 0, 50, 1 }, { 37, 63, 0 }, { 0, 0, 0 } } }, + { { { 50, 0, 0 }, { 0, 50, 0 }, { 48, 52, 0 }, { 0, 0, 0 } } }, + { { { 50, 0, 1 }, { 0, 50, 1 }, { 38, 63, 0 }, { 0, 0, 0 } } }, + { { { 50, 0, 2 }, { 0, 50, 2 }, { 48, 53, 0 }, { 0, 0, 0 } } }, + { { { 51, 0, 1 }, { 0, 51, 1 }, { 39, 63, 0 }, { 0, 0, 0 } } }, + { { { 51, 0, 0 }, { 0, 51, 0 }, { 48, 54, 0 }, { 0, 0, 0 } } }, + { { { 51, 0, 1 }, { 0, 51, 1 }, { 40, 63, 0 }, { 0, 0, 0 } } }, + { { { 51, 0, 2 }, { 0, 51, 2 }, { 48, 55, 0 }, { 0, 0, 0 } } }, + { { { 52, 0, 1 }, { 0, 52, 1 }, { 41, 63, 0 }, { 0, 0, 0 } } }, + { { { 52, 0, 0 }, { 0, 52, 0 }, { 48, 56, 0 }, { 0, 0, 0 } } }, + { { { 52, 0, 1 }, { 0, 52, 1 }, { 42, 63, 0 }, { 0, 0, 0 } } }, + { { { 52, 0, 2 }, { 0, 52, 2 }, { 48, 57, 0 }, { 0, 0, 0 } } }, + { { { 53, 0, 1 }, { 0, 53, 1 }, { 43, 63, 0 }, { 0, 0, 0 } } }, + { { { 53, 0, 0 }, { 0, 53, 0 }, { 48, 58, 0 }, { 0, 0, 0 } } }, + { { { 53, 0, 1 }, { 0, 53, 1 }, { 44, 63, 0 }, { 0, 0, 0 } } }, + { { { 53, 0, 2 }, { 0, 53, 2 }, { 48, 59, 0 }, { 0, 0, 0 } } }, + { { { 54, 0, 1 }, { 0, 54, 1 }, { 45, 63, 0 }, { 0, 0, 0 } } }, + { { { 54, 0, 0 }, { 0, 54, 0 }, { 48, 60, 0 }, { 0, 0, 0 } } }, + { { { 54, 0, 1 }, { 0, 54, 1 }, { 46, 63, 0 }, { 0, 0, 0 } } }, + { { { 54, 0, 2 }, { 0, 54, 2 }, { 48, 61, 0 }, { 0, 0, 0 } } }, + { { { 55, 0, 1 }, { 0, 55, 1 }, { 47, 63, 0 }, { 0, 0, 0 } } }, + { { { 55, 0, 0 }, { 0, 55, 0 }, { 48, 62, 0 }, { 0, 0, 0 } } }, + { { { 55, 0, 1 }, { 0, 55, 1 }, { 48, 63, 1 }, { 0, 0, 0 } } }, + { { { 55, 0, 2 }, { 0, 55, 2 }, { 48, 63, 0 }, { 0, 0, 0 } } }, + { { { 56, 0, 1 }, { 0, 56, 1 }, { 49, 63, 1 }, { 0, 0, 0 } } }, + { { { 56, 0, 0 }, { 0, 56, 0 }, { 49, 63, 0 }, { 0, 0, 0 } } }, + { { { 56, 0, 1 }, { 0, 56, 1 }, { 50, 63, 1 }, { 0, 0, 0 } } }, + { { { 56, 0, 2 }, { 0, 56, 2 }, { 50, 63, 0 }, { 0, 0, 0 } } }, + { { { 57, 0, 1 }, { 0, 57, 1 }, { 51, 63, 1 }, { 0, 0, 0 } } }, + { { { 57, 0, 0 }, { 0, 57, 0 }, { 51, 63, 0 }, { 0, 0, 0 } } }, + { { { 57, 0, 1 }, { 0, 57, 1 }, { 52, 63, 1 }, { 0, 0, 0 } } }, + { { { 57, 0, 2 }, { 0, 57, 2 }, { 52, 63, 0 }, { 0, 0, 0 } } }, + { { { 58, 0, 1 }, { 0, 58, 1 }, { 53, 63, 1 }, { 0, 0, 0 } } }, + { { { 58, 0, 0 }, { 0, 58, 0 }, { 53, 63, 0 }, { 0, 0, 0 } } }, + { { { 58, 0, 1 }, { 0, 58, 1 }, { 54, 63, 1 }, { 0, 0, 0 } } }, + { { { 58, 0, 2 }, { 0, 58, 2 }, { 54, 63, 0 }, { 0, 0, 0 } } }, + { { { 59, 0, 1 }, { 0, 59, 1 }, { 55, 63, 1 }, { 0, 0, 0 } } }, + { { { 59, 0, 0 }, { 0, 59, 0 }, { 55, 63, 0 }, { 0, 0, 0 } } }, + { { { 59, 0, 1 }, { 0, 59, 1 }, { 56, 63, 1 }, { 0, 0, 0 } } }, + { { { 59, 0, 2 }, { 0, 59, 2 }, { 56, 63, 0 }, { 0, 0, 0 } } }, + { { { 60, 0, 1 }, { 0, 60, 1 }, { 57, 63, 1 }, { 0, 0, 0 } } }, + { { { 60, 0, 0 }, { 0, 60, 0 }, { 57, 63, 0 }, { 0, 0, 0 } } }, + { { { 60, 0, 1 }, { 0, 60, 1 }, { 58, 63, 1 }, { 0, 0, 0 } } }, + { { { 60, 0, 2 }, { 0, 60, 2 }, { 58, 63, 0 }, { 0, 0, 0 } } }, + { { { 61, 0, 1 }, { 0, 61, 1 }, { 59, 63, 1 }, { 0, 0, 0 } } }, + { { { 61, 0, 0 }, { 0, 61, 0 }, { 59, 63, 0 }, { 0, 0, 0 } } }, + { { { 61, 0, 1 }, { 0, 61, 1 }, { 60, 63, 1 }, { 0, 0, 0 } } }, + { { { 61, 0, 2 }, { 0, 61, 2 }, { 60, 63, 0 }, { 0, 0, 0 } } }, + { { { 62, 0, 1 }, { 0, 62, 1 }, { 61, 63, 1 }, { 0, 0, 0 } } }, + { { { 62, 0, 0 }, { 0, 62, 0 }, { 61, 63, 0 }, { 0, 0, 0 } } }, + { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 63, 1 }, { 0, 0, 0 } } }, + { { { 62, 0, 2 }, { 0, 62, 2 }, { 62, 63, 0 }, { 0, 0, 0 } } }, + { { { 63, 0, 1 }, { 0, 63, 1 }, { 63, 63, 1 }, { 0, 0, 0 } } }, + { { { 63, 0, 0 }, { 0, 63, 0 }, { 63, 63, 0 }, { 0, 0, 0 } } } +}; + +static SingleColourLookup const lookup_5_4[] = +{ + { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } }, + { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 1 }, { 1, 0, 1 } } }, + { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 1, 0 }, { 1, 0, 0 } } }, + { { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 1, 1 }, { 1, 0, 1 } } }, + { { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 2, 1 }, { 0, 1, 1 } } }, + { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 2, 0 }, { 0, 1, 0 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 2, 1 }, { 0, 1, 1 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 1, 1, 1 } } }, + { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 3, 0 }, { 1, 1, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 1, 2, 1 }, { 0, 2, 1 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 1, 2, 0 }, { 0, 2, 0 } } }, + { { { 1, 0, 3 }, { 0, 1, 3 }, { 0, 4, 0 }, { 4, 0, 0 } } }, + { { { 1, 0, 4 }, { 0, 1, 4 }, { 0, 5, 1 }, { 1, 2, 1 } } }, + { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 5, 0 }, { 1, 2, 0 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 5, 1 }, { 1, 2, 1 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 6, 1 }, { 0, 3, 1 } } }, + { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 6, 0 }, { 0, 3, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 2, 3, 1 }, { 1, 3, 1 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 2, 3, 0 }, { 1, 3, 0 } } }, + { { { 2, 0, 3 }, { 0, 2, 3 }, { 0, 7, 0 }, { 5, 1, 0 } } }, + { { { 2, 0, 4 }, { 0, 2, 4 }, { 1, 6, 1 }, { 2, 3, 1 } } }, + { { { 3, 0, 3 }, { 0, 3, 3 }, { 1, 6, 0 }, { 2, 3, 0 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 8, 0 }, { 0, 4, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } }, + { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 9, 0 }, { 1, 4, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 10, 1 }, { 0, 5, 1 } } }, + { { { 3, 0, 3 }, { 0, 3, 3 }, { 0, 10, 0 }, { 0, 5, 0 } } }, + { { { 3, 0, 4 }, { 0, 3, 4 }, { 2, 7, 1 }, { 5, 3, 1 } } }, + { { { 4, 0, 4 }, { 0, 4, 4 }, { 2, 7, 0 }, { 5, 3, 0 } } }, + { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 11, 0 }, { 1, 5, 0 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 1, 10, 1 }, { 0, 6, 1 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 1, 10, 0 }, { 0, 6, 0 } } }, + { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 12, 0 }, { 4, 4, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 13, 1 }, { 1, 6, 1 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 13, 0 }, { 1, 6, 0 } } }, + { { { 4, 0, 3 }, { 0, 4, 3 }, { 0, 13, 1 }, { 1, 6, 1 } } }, + { { { 4, 0, 4 }, { 0, 4, 4 }, { 0, 14, 1 }, { 0, 7, 1 } } }, + { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 14, 0 }, { 0, 7, 0 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 2, 11, 1 }, { 1, 7, 1 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 2, 11, 0 }, { 1, 7, 0 } } }, + { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 15, 0 }, { 5, 5, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 1, 14, 1 }, { 2, 7, 1 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 1, 14, 0 }, { 2, 7, 0 } } }, + { { { 5, 0, 3 }, { 0, 5, 3 }, { 0, 16, 0 }, { 0, 8, 0 } } }, + { { { 5, 0, 4 }, { 0, 5, 4 }, { 0, 17, 1 }, { 1, 8, 1 } } }, + { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 17, 0 }, { 1, 8, 0 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 0, 17, 1 }, { 1, 8, 1 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 18, 1 }, { 0, 9, 1 } } }, + { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 18, 0 }, { 0, 9, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 2, 15, 1 }, { 5, 7, 1 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 2, 15, 0 }, { 5, 7, 0 } } }, + { { { 6, 0, 3 }, { 0, 6, 3 }, { 0, 19, 0 }, { 1, 9, 0 } } }, + { { { 6, 0, 4 }, { 0, 6, 4 }, { 1, 18, 1 }, { 0, 10, 1 } } }, + { { { 7, 0, 3 }, { 0, 7, 3 }, { 1, 18, 0 }, { 0, 10, 0 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 20, 0 }, { 4, 8, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 21, 1 }, { 1, 10, 1 } } }, + { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 21, 0 }, { 1, 10, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 21, 1 }, { 1, 10, 1 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 0, 22, 1 }, { 0, 11, 1 } } }, + { { { 7, 0, 3 }, { 0, 7, 3 }, { 0, 22, 0 }, { 0, 11, 0 } } }, + { { { 7, 0, 4 }, { 0, 7, 4 }, { 2, 19, 1 }, { 1, 11, 1 } } }, + { { { 8, 0, 4 }, { 0, 8, 4 }, { 2, 19, 0 }, { 1, 11, 0 } } }, + { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 23, 0 }, { 5, 9, 0 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 1, 22, 1 }, { 2, 11, 1 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 1, 22, 0 }, { 2, 11, 0 } } }, + { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 24, 0 }, { 0, 12, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 25, 1 }, { 1, 12, 1 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 0, 25, 0 }, { 1, 12, 0 } } }, + { { { 8, 0, 3 }, { 0, 8, 3 }, { 0, 25, 1 }, { 1, 12, 1 } } }, + { { { 8, 0, 4 }, { 0, 8, 4 }, { 0, 26, 1 }, { 0, 13, 1 } } }, + { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 26, 0 }, { 0, 13, 0 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 2, 23, 1 }, { 5, 11, 1 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 2, 23, 0 }, { 5, 11, 0 } } }, + { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 27, 0 }, { 1, 13, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 1, 26, 1 }, { 0, 14, 1 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 1, 26, 0 }, { 0, 14, 0 } } }, + { { { 9, 0, 3 }, { 0, 9, 3 }, { 0, 28, 0 }, { 4, 12, 0 } } }, + { { { 9, 0, 4 }, { 0, 9, 4 }, { 0, 29, 1 }, { 1, 14, 1 } } }, + { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 29, 0 }, { 1, 14, 0 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 0, 29, 1 }, { 1, 14, 1 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 30, 1 }, { 0, 15, 1 } } }, + { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 30, 0 }, { 0, 15, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 2, 27, 1 }, { 1, 15, 1 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 2, 27, 0 }, { 1, 15, 0 } } }, + { { { 10, 0, 3 }, { 0, 10, 3 }, { 0, 31, 0 }, { 5, 13, 0 } } }, + { { { 10, 0, 4 }, { 0, 10, 4 }, { 1, 30, 1 }, { 2, 15, 1 } } }, + { { { 11, 0, 3 }, { 0, 11, 3 }, { 1, 30, 0 }, { 2, 15, 0 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 4, 24, 0 }, { 0, 16, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 1, 31, 1 }, { 1, 16, 1 } } }, + { { { 11, 0, 0 }, { 0, 11, 0 }, { 1, 31, 0 }, { 1, 16, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 1, 31, 1 }, { 1, 16, 1 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 2, 30, 1 }, { 0, 17, 1 } } }, + { { { 11, 0, 3 }, { 0, 11, 3 }, { 2, 30, 0 }, { 0, 17, 0 } } }, + { { { 11, 0, 4 }, { 0, 11, 4 }, { 2, 31, 1 }, { 5, 15, 1 } } }, + { { { 12, 0, 4 }, { 0, 12, 4 }, { 2, 31, 0 }, { 5, 15, 0 } } }, + { { { 12, 0, 3 }, { 0, 12, 3 }, { 4, 27, 0 }, { 1, 17, 0 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 3, 30, 1 }, { 0, 18, 1 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 30, 0 }, { 0, 18, 0 } } }, + { { { 12, 0, 0 }, { 0, 12, 0 }, { 4, 28, 0 }, { 4, 16, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 31, 1 }, { 1, 18, 1 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 3, 31, 0 }, { 1, 18, 0 } } }, + { { { 12, 0, 3 }, { 0, 12, 3 }, { 3, 31, 1 }, { 1, 18, 1 } } }, + { { { 12, 0, 4 }, { 0, 12, 4 }, { 4, 30, 1 }, { 0, 19, 1 } } }, + { { { 13, 0, 3 }, { 0, 13, 3 }, { 4, 30, 0 }, { 0, 19, 0 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 6, 27, 1 }, { 1, 19, 1 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 6, 27, 0 }, { 1, 19, 0 } } }, + { { { 13, 0, 0 }, { 0, 13, 0 }, { 4, 31, 0 }, { 5, 17, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 5, 30, 1 }, { 2, 19, 1 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 5, 30, 0 }, { 2, 19, 0 } } }, + { { { 13, 0, 3 }, { 0, 13, 3 }, { 8, 24, 0 }, { 0, 20, 0 } } }, + { { { 13, 0, 4 }, { 0, 13, 4 }, { 5, 31, 1 }, { 1, 20, 1 } } }, + { { { 14, 0, 3 }, { 0, 14, 3 }, { 5, 31, 0 }, { 1, 20, 0 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 5, 31, 1 }, { 1, 20, 1 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 30, 1 }, { 0, 21, 1 } } }, + { { { 14, 0, 0 }, { 0, 14, 0 }, { 6, 30, 0 }, { 0, 21, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 31, 1 }, { 5, 19, 1 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 6, 31, 0 }, { 5, 19, 0 } } }, + { { { 14, 0, 3 }, { 0, 14, 3 }, { 8, 27, 0 }, { 1, 21, 0 } } }, + { { { 14, 0, 4 }, { 0, 14, 4 }, { 7, 30, 1 }, { 0, 22, 1 } } }, + { { { 15, 0, 3 }, { 0, 15, 3 }, { 7, 30, 0 }, { 0, 22, 0 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 8, 28, 0 }, { 4, 20, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 7, 31, 1 }, { 1, 22, 1 } } }, + { { { 15, 0, 0 }, { 0, 15, 0 }, { 7, 31, 0 }, { 1, 22, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 7, 31, 1 }, { 1, 22, 1 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 8, 30, 1 }, { 0, 23, 1 } } }, + { { { 15, 0, 3 }, { 0, 15, 3 }, { 8, 30, 0 }, { 0, 23, 0 } } }, + { { { 15, 0, 4 }, { 0, 15, 4 }, { 10, 27, 1 }, { 1, 23, 1 } } }, + { { { 16, 0, 4 }, { 0, 16, 4 }, { 10, 27, 0 }, { 1, 23, 0 } } }, + { { { 16, 0, 3 }, { 0, 16, 3 }, { 8, 31, 0 }, { 5, 21, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 9, 30, 1 }, { 2, 23, 1 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 9, 30, 0 }, { 2, 23, 0 } } }, + { { { 16, 0, 0 }, { 0, 16, 0 }, { 12, 24, 0 }, { 0, 24, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 9, 31, 1 }, { 1, 24, 1 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 9, 31, 0 }, { 1, 24, 0 } } }, + { { { 16, 0, 3 }, { 0, 16, 3 }, { 9, 31, 1 }, { 1, 24, 1 } } }, + { { { 16, 0, 4 }, { 0, 16, 4 }, { 10, 30, 1 }, { 0, 25, 1 } } }, + { { { 17, 0, 3 }, { 0, 17, 3 }, { 10, 30, 0 }, { 0, 25, 0 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 10, 31, 1 }, { 5, 23, 1 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 10, 31, 0 }, { 5, 23, 0 } } }, + { { { 17, 0, 0 }, { 0, 17, 0 }, { 12, 27, 0 }, { 1, 25, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 11, 30, 1 }, { 0, 26, 1 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 11, 30, 0 }, { 0, 26, 0 } } }, + { { { 17, 0, 3 }, { 0, 17, 3 }, { 12, 28, 0 }, { 4, 24, 0 } } }, + { { { 17, 0, 4 }, { 0, 17, 4 }, { 11, 31, 1 }, { 1, 26, 1 } } }, + { { { 18, 0, 3 }, { 0, 18, 3 }, { 11, 31, 0 }, { 1, 26, 0 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 11, 31, 1 }, { 1, 26, 1 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 12, 30, 1 }, { 0, 27, 1 } } }, + { { { 18, 0, 0 }, { 0, 18, 0 }, { 12, 30, 0 }, { 0, 27, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 14, 27, 1 }, { 1, 27, 1 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 14, 27, 0 }, { 1, 27, 0 } } }, + { { { 18, 0, 3 }, { 0, 18, 3 }, { 12, 31, 0 }, { 5, 25, 0 } } }, + { { { 18, 0, 4 }, { 0, 18, 4 }, { 13, 30, 1 }, { 2, 27, 1 } } }, + { { { 19, 0, 3 }, { 0, 19, 3 }, { 13, 30, 0 }, { 2, 27, 0 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 16, 24, 0 }, { 0, 28, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 13, 31, 1 }, { 1, 28, 1 } } }, + { { { 19, 0, 0 }, { 0, 19, 0 }, { 13, 31, 0 }, { 1, 28, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 13, 31, 1 }, { 1, 28, 1 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 14, 30, 1 }, { 0, 29, 1 } } }, + { { { 19, 0, 3 }, { 0, 19, 3 }, { 14, 30, 0 }, { 0, 29, 0 } } }, + { { { 19, 0, 4 }, { 0, 19, 4 }, { 14, 31, 1 }, { 5, 27, 1 } } }, + { { { 20, 0, 4 }, { 0, 20, 4 }, { 14, 31, 0 }, { 5, 27, 0 } } }, + { { { 20, 0, 3 }, { 0, 20, 3 }, { 16, 27, 0 }, { 1, 29, 0 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 15, 30, 1 }, { 0, 30, 1 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 15, 30, 0 }, { 0, 30, 0 } } }, + { { { 20, 0, 0 }, { 0, 20, 0 }, { 16, 28, 0 }, { 4, 28, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 15, 31, 1 }, { 1, 30, 1 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 15, 31, 0 }, { 1, 30, 0 } } }, + { { { 20, 0, 3 }, { 0, 20, 3 }, { 15, 31, 1 }, { 1, 30, 1 } } }, + { { { 20, 0, 4 }, { 0, 20, 4 }, { 16, 30, 1 }, { 0, 31, 1 } } }, + { { { 21, 0, 3 }, { 0, 21, 3 }, { 16, 30, 0 }, { 0, 31, 0 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 18, 27, 1 }, { 1, 31, 1 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 18, 27, 0 }, { 1, 31, 0 } } }, + { { { 21, 0, 0 }, { 0, 21, 0 }, { 16, 31, 0 }, { 5, 29, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 17, 30, 1 }, { 2, 31, 1 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 17, 30, 0 }, { 2, 31, 0 } } }, + { { { 21, 0, 3 }, { 0, 21, 3 }, { 20, 24, 0 }, { 8, 28, 0 } } }, + { { { 21, 0, 4 }, { 0, 21, 4 }, { 17, 31, 1 }, { 3, 31, 1 } } }, + { { { 22, 0, 3 }, { 0, 22, 3 }, { 17, 31, 0 }, { 3, 31, 0 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 17, 31, 1 }, { 3, 31, 1 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 18, 30, 1 }, { 4, 31, 1 } } }, + { { { 22, 0, 0 }, { 0, 22, 0 }, { 18, 30, 0 }, { 4, 31, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 18, 31, 1 }, { 5, 31, 1 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 18, 31, 0 }, { 5, 31, 0 } } }, + { { { 22, 0, 3 }, { 0, 22, 3 }, { 20, 27, 0 }, { 9, 29, 0 } } }, + { { { 22, 0, 4 }, { 0, 22, 4 }, { 19, 30, 1 }, { 6, 31, 1 } } }, + { { { 23, 0, 3 }, { 0, 23, 3 }, { 19, 30, 0 }, { 6, 31, 0 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 20, 28, 0 }, { 12, 28, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 19, 31, 1 }, { 7, 31, 1 } } }, + { { { 23, 0, 0 }, { 0, 23, 0 }, { 19, 31, 0 }, { 7, 31, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 19, 31, 1 }, { 7, 31, 1 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 20, 30, 1 }, { 8, 31, 1 } } }, + { { { 23, 0, 3 }, { 0, 23, 3 }, { 20, 30, 0 }, { 8, 31, 0 } } }, + { { { 23, 0, 4 }, { 0, 23, 4 }, { 22, 27, 1 }, { 9, 31, 1 } } }, + { { { 24, 0, 4 }, { 0, 24, 4 }, { 22, 27, 0 }, { 9, 31, 0 } } }, + { { { 24, 0, 3 }, { 0, 24, 3 }, { 20, 31, 0 }, { 13, 29, 0 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 21, 30, 1 }, { 10, 31, 1 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 21, 30, 0 }, { 10, 31, 0 } } }, + { { { 24, 0, 0 }, { 0, 24, 0 }, { 24, 24, 0 }, { 16, 28, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 21, 31, 1 }, { 11, 31, 1 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 21, 31, 0 }, { 11, 31, 0 } } }, + { { { 24, 0, 3 }, { 0, 24, 3 }, { 21, 31, 1 }, { 11, 31, 1 } } }, + { { { 24, 0, 4 }, { 0, 24, 4 }, { 22, 30, 1 }, { 12, 31, 1 } } }, + { { { 25, 0, 3 }, { 0, 25, 3 }, { 22, 30, 0 }, { 12, 31, 0 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 22, 31, 1 }, { 13, 31, 1 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 22, 31, 0 }, { 13, 31, 0 } } }, + { { { 25, 0, 0 }, { 0, 25, 0 }, { 24, 27, 0 }, { 17, 29, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 23, 30, 1 }, { 14, 31, 1 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 23, 30, 0 }, { 14, 31, 0 } } }, + { { { 25, 0, 3 }, { 0, 25, 3 }, { 24, 28, 0 }, { 20, 28, 0 } } }, + { { { 25, 0, 4 }, { 0, 25, 4 }, { 23, 31, 1 }, { 15, 31, 1 } } }, + { { { 26, 0, 3 }, { 0, 26, 3 }, { 23, 31, 0 }, { 15, 31, 0 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 23, 31, 1 }, { 15, 31, 1 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 24, 30, 1 }, { 16, 31, 1 } } }, + { { { 26, 0, 0 }, { 0, 26, 0 }, { 24, 30, 0 }, { 16, 31, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 26, 27, 1 }, { 17, 31, 1 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 26, 27, 0 }, { 17, 31, 0 } } }, + { { { 26, 0, 3 }, { 0, 26, 3 }, { 24, 31, 0 }, { 21, 29, 0 } } }, + { { { 26, 0, 4 }, { 0, 26, 4 }, { 25, 30, 1 }, { 18, 31, 1 } } }, + { { { 27, 0, 3 }, { 0, 27, 3 }, { 25, 30, 0 }, { 18, 31, 0 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 28, 24, 0 }, { 24, 28, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 25, 31, 1 }, { 19, 31, 1 } } }, + { { { 27, 0, 0 }, { 0, 27, 0 }, { 25, 31, 0 }, { 19, 31, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 25, 31, 1 }, { 19, 31, 1 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 26, 30, 1 }, { 20, 31, 1 } } }, + { { { 27, 0, 3 }, { 0, 27, 3 }, { 26, 30, 0 }, { 20, 31, 0 } } }, + { { { 27, 0, 4 }, { 0, 27, 4 }, { 26, 31, 1 }, { 21, 31, 1 } } }, + { { { 28, 0, 4 }, { 0, 28, 4 }, { 26, 31, 0 }, { 21, 31, 0 } } }, + { { { 28, 0, 3 }, { 0, 28, 3 }, { 28, 27, 0 }, { 25, 29, 0 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 27, 30, 1 }, { 22, 31, 1 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 27, 30, 0 }, { 22, 31, 0 } } }, + { { { 28, 0, 0 }, { 0, 28, 0 }, { 28, 28, 0 }, { 28, 28, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 27, 31, 1 }, { 23, 31, 1 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 27, 31, 0 }, { 23, 31, 0 } } }, + { { { 28, 0, 3 }, { 0, 28, 3 }, { 27, 31, 1 }, { 23, 31, 1 } } }, + { { { 28, 0, 4 }, { 0, 28, 4 }, { 28, 30, 1 }, { 24, 31, 1 } } }, + { { { 29, 0, 3 }, { 0, 29, 3 }, { 28, 30, 0 }, { 24, 31, 0 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 30, 27, 1 }, { 25, 31, 1 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 30, 27, 0 }, { 25, 31, 0 } } }, + { { { 29, 0, 0 }, { 0, 29, 0 }, { 28, 31, 0 }, { 29, 29, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 29, 30, 1 }, { 26, 31, 1 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 29, 30, 0 }, { 26, 31, 0 } } }, + { { { 29, 0, 3 }, { 0, 29, 3 }, { 29, 30, 1 }, { 26, 31, 1 } } }, + { { { 29, 0, 4 }, { 0, 29, 4 }, { 29, 31, 1 }, { 27, 31, 1 } } }, + { { { 30, 0, 3 }, { 0, 30, 3 }, { 29, 31, 0 }, { 27, 31, 0 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 29, 31, 1 }, { 27, 31, 1 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 30, 30, 1 }, { 28, 31, 1 } } }, + { { { 30, 0, 0 }, { 0, 30, 0 }, { 30, 30, 0 }, { 28, 31, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 30, 31, 1 }, { 29, 31, 1 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 30, 31, 0 }, { 29, 31, 0 } } }, + { { { 30, 0, 3 }, { 0, 30, 3 }, { 30, 31, 1 }, { 29, 31, 1 } } }, + { { { 30, 0, 4 }, { 0, 30, 4 }, { 31, 30, 1 }, { 30, 31, 1 } } }, + { { { 31, 0, 3 }, { 0, 31, 3 }, { 31, 30, 0 }, { 30, 31, 0 } } }, + { { { 31, 0, 2 }, { 0, 31, 2 }, { 31, 30, 1 }, { 30, 31, 1 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 31, 31, 1 }, { 31, 31, 1 } } }, + { { { 31, 0, 0 }, { 0, 31, 0 }, { 31, 31, 0 }, { 31, 31, 0 } } } +}; + +static SingleColourLookup const lookup_6_4[] = +{ + { { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } }, + { { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 } } }, + { { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 2, 0 }, { 0, 1, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 3, 1 }, { 1, 1, 1 } } }, + { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 3, 0 }, { 1, 1, 0 } } }, + { { { 1, 0, 1 }, { 0, 1, 1 }, { 0, 4, 0 }, { 0, 2, 0 } } }, + { { { 1, 0, 2 }, { 0, 1, 2 }, { 0, 5, 0 }, { 1, 2, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 6, 1 }, { 0, 3, 1 } } }, + { { { 2, 0, 0 }, { 0, 2, 0 }, { 0, 6, 0 }, { 0, 3, 0 } } }, + { { { 2, 0, 1 }, { 0, 2, 1 }, { 0, 7, 0 }, { 1, 3, 0 } } }, + { { { 2, 0, 2 }, { 0, 2, 2 }, { 0, 8, 0 }, { 0, 4, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 9, 1 }, { 1, 4, 1 } } }, + { { { 3, 0, 0 }, { 0, 3, 0 }, { 0, 9, 0 }, { 1, 4, 0 } } }, + { { { 3, 0, 1 }, { 0, 3, 1 }, { 0, 10, 0 }, { 0, 5, 0 } } }, + { { { 3, 0, 2 }, { 0, 3, 2 }, { 0, 11, 0 }, { 1, 5, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 12, 1 }, { 0, 6, 1 } } }, + { { { 4, 0, 0 }, { 0, 4, 0 }, { 0, 12, 0 }, { 0, 6, 0 } } }, + { { { 4, 0, 1 }, { 0, 4, 1 }, { 0, 13, 0 }, { 1, 6, 0 } } }, + { { { 4, 0, 2 }, { 0, 4, 2 }, { 0, 14, 0 }, { 0, 7, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 15, 1 }, { 1, 7, 1 } } }, + { { { 5, 0, 0 }, { 0, 5, 0 }, { 0, 15, 0 }, { 1, 7, 0 } } }, + { { { 5, 0, 1 }, { 0, 5, 1 }, { 0, 16, 0 }, { 0, 8, 0 } } }, + { { { 5, 0, 2 }, { 0, 5, 2 }, { 1, 15, 0 }, { 1, 8, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 17, 0 }, { 17, 0, 0 } } }, + { { { 6, 0, 0 }, { 0, 6, 0 }, { 0, 18, 0 }, { 0, 9, 0 } } }, + { { { 6, 0, 1 }, { 0, 6, 1 }, { 0, 19, 0 }, { 1, 9, 0 } } }, + { { { 6, 0, 2 }, { 0, 6, 2 }, { 3, 14, 0 }, { 0, 10, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 20, 0 }, { 16, 2, 0 } } }, + { { { 7, 0, 0 }, { 0, 7, 0 }, { 0, 21, 0 }, { 1, 10, 0 } } }, + { { { 7, 0, 1 }, { 0, 7, 1 }, { 0, 22, 0 }, { 0, 11, 0 } } }, + { { { 7, 0, 2 }, { 0, 7, 2 }, { 4, 15, 0 }, { 1, 11, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 23, 0 }, { 17, 3, 0 } } }, + { { { 8, 0, 0 }, { 0, 8, 0 }, { 0, 24, 0 }, { 0, 12, 0 } } }, + { { { 8, 0, 1 }, { 0, 8, 1 }, { 0, 25, 0 }, { 1, 12, 0 } } }, + { { { 8, 0, 2 }, { 0, 8, 2 }, { 6, 14, 0 }, { 0, 13, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 26, 0 }, { 16, 5, 0 } } }, + { { { 9, 0, 0 }, { 0, 9, 0 }, { 0, 27, 0 }, { 1, 13, 0 } } }, + { { { 9, 0, 1 }, { 0, 9, 1 }, { 0, 28, 0 }, { 0, 14, 0 } } }, + { { { 9, 0, 2 }, { 0, 9, 2 }, { 7, 15, 0 }, { 1, 14, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 29, 0 }, { 17, 6, 0 } } }, + { { { 10, 0, 0 }, { 0, 10, 0 }, { 0, 30, 0 }, { 0, 15, 0 } } }, + { { { 10, 0, 1 }, { 0, 10, 1 }, { 0, 31, 0 }, { 1, 15, 0 } } }, + { { { 10, 0, 2 }, { 0, 10, 2 }, { 9, 14, 0 }, { 2, 15, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 0, 32, 0 }, { 0, 16, 0 } } }, + { { { 11, 0, 0 }, { 0, 11, 0 }, { 0, 33, 0 }, { 1, 16, 0 } } }, + { { { 11, 0, 1 }, { 0, 11, 1 }, { 2, 30, 0 }, { 4, 15, 0 } } }, + { { { 11, 0, 2 }, { 0, 11, 2 }, { 0, 34, 0 }, { 0, 17, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 0, 35, 0 }, { 1, 17, 0 } } }, + { { { 12, 0, 0 }, { 0, 12, 0 }, { 0, 36, 0 }, { 0, 18, 0 } } }, + { { { 12, 0, 1 }, { 0, 12, 1 }, { 3, 31, 0 }, { 7, 15, 0 } } }, + { { { 12, 0, 2 }, { 0, 12, 2 }, { 0, 37, 0 }, { 1, 18, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 0, 38, 0 }, { 0, 19, 0 } } }, + { { { 13, 0, 0 }, { 0, 13, 0 }, { 0, 39, 0 }, { 1, 19, 0 } } }, + { { { 13, 0, 1 }, { 0, 13, 1 }, { 5, 30, 0 }, { 10, 15, 0 } } }, + { { { 13, 0, 2 }, { 0, 13, 2 }, { 0, 40, 0 }, { 0, 20, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 0, 41, 0 }, { 1, 20, 0 } } }, + { { { 14, 0, 0 }, { 0, 14, 0 }, { 0, 42, 0 }, { 0, 21, 0 } } }, + { { { 14, 0, 1 }, { 0, 14, 1 }, { 6, 31, 0 }, { 13, 15, 0 } } }, + { { { 14, 0, 2 }, { 0, 14, 2 }, { 0, 43, 0 }, { 1, 21, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 0, 44, 0 }, { 0, 22, 0 } } }, + { { { 15, 0, 0 }, { 0, 15, 0 }, { 0, 45, 0 }, { 1, 22, 0 } } }, + { { { 15, 0, 1 }, { 0, 15, 1 }, { 8, 30, 0 }, { 16, 15, 0 } } }, + { { { 15, 0, 2 }, { 0, 15, 2 }, { 0, 46, 0 }, { 0, 23, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 47, 0 }, { 1, 23, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 1, 46, 0 }, { 0, 24, 0 } } }, + { { { 16, 0, 0 }, { 0, 16, 0 }, { 0, 48, 0 }, { 16, 16, 0 } } }, + { { { 16, 0, 1 }, { 0, 16, 1 }, { 0, 49, 0 }, { 1, 24, 0 } } }, + { { { 16, 0, 2 }, { 0, 16, 2 }, { 0, 50, 0 }, { 0, 25, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 2, 47, 0 }, { 1, 25, 0 } } }, + { { { 17, 0, 0 }, { 0, 17, 0 }, { 0, 51, 0 }, { 17, 17, 0 } } }, + { { { 17, 0, 1 }, { 0, 17, 1 }, { 0, 52, 0 }, { 0, 26, 0 } } }, + { { { 17, 0, 2 }, { 0, 17, 2 }, { 0, 53, 0 }, { 1, 26, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 4, 46, 0 }, { 0, 27, 0 } } }, + { { { 18, 0, 0 }, { 0, 18, 0 }, { 0, 54, 0 }, { 16, 19, 0 } } }, + { { { 18, 0, 1 }, { 0, 18, 1 }, { 0, 55, 0 }, { 1, 27, 0 } } }, + { { { 18, 0, 2 }, { 0, 18, 2 }, { 0, 56, 0 }, { 0, 28, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 5, 47, 0 }, { 1, 28, 0 } } }, + { { { 19, 0, 0 }, { 0, 19, 0 }, { 0, 57, 0 }, { 17, 20, 0 } } }, + { { { 19, 0, 1 }, { 0, 19, 1 }, { 0, 58, 0 }, { 0, 29, 0 } } }, + { { { 19, 0, 2 }, { 0, 19, 2 }, { 0, 59, 0 }, { 1, 29, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 7, 46, 0 }, { 0, 30, 0 } } }, + { { { 20, 0, 0 }, { 0, 20, 0 }, { 0, 60, 0 }, { 16, 22, 0 } } }, + { { { 20, 0, 1 }, { 0, 20, 1 }, { 0, 61, 0 }, { 1, 30, 0 } } }, + { { { 20, 0, 2 }, { 0, 20, 2 }, { 0, 62, 0 }, { 0, 31, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 8, 47, 0 }, { 1, 31, 0 } } }, + { { { 21, 0, 0 }, { 0, 21, 0 }, { 0, 63, 0 }, { 17, 23, 0 } } }, + { { { 21, 0, 1 }, { 0, 21, 1 }, { 1, 62, 0 }, { 0, 32, 0 } } }, + { { { 21, 0, 2 }, { 0, 21, 2 }, { 1, 63, 0 }, { 3, 31, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 10, 46, 0 }, { 1, 32, 0 } } }, + { { { 22, 0, 0 }, { 0, 22, 0 }, { 2, 62, 0 }, { 0, 33, 0 } } }, + { { { 22, 0, 1 }, { 0, 22, 1 }, { 2, 63, 0 }, { 1, 33, 0 } } }, + { { { 22, 0, 2 }, { 0, 22, 2 }, { 3, 62, 0 }, { 6, 31, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 11, 47, 0 }, { 0, 34, 0 } } }, + { { { 23, 0, 0 }, { 0, 23, 0 }, { 3, 63, 0 }, { 1, 34, 0 } } }, + { { { 23, 0, 1 }, { 0, 23, 1 }, { 4, 62, 0 }, { 0, 35, 0 } } }, + { { { 23, 0, 2 }, { 0, 23, 2 }, { 4, 63, 0 }, { 9, 31, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 13, 46, 0 }, { 1, 35, 0 } } }, + { { { 24, 0, 0 }, { 0, 24, 0 }, { 5, 62, 0 }, { 0, 36, 0 } } }, + { { { 24, 0, 1 }, { 0, 24, 1 }, { 5, 63, 0 }, { 1, 36, 0 } } }, + { { { 24, 0, 2 }, { 0, 24, 2 }, { 6, 62, 0 }, { 12, 31, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 14, 47, 0 }, { 0, 37, 0 } } }, + { { { 25, 0, 0 }, { 0, 25, 0 }, { 6, 63, 0 }, { 1, 37, 0 } } }, + { { { 25, 0, 1 }, { 0, 25, 1 }, { 7, 62, 0 }, { 0, 38, 0 } } }, + { { { 25, 0, 2 }, { 0, 25, 2 }, { 7, 63, 0 }, { 15, 31, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 16, 45, 0 }, { 1, 38, 0 } } }, + { { { 26, 0, 0 }, { 0, 26, 0 }, { 8, 62, 0 }, { 0, 39, 0 } } }, + { { { 26, 0, 1 }, { 0, 26, 1 }, { 8, 63, 0 }, { 1, 39, 0 } } }, + { { { 26, 0, 2 }, { 0, 26, 2 }, { 9, 62, 0 }, { 18, 31, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 16, 48, 0 }, { 0, 40, 0 } } }, + { { { 27, 0, 0 }, { 0, 27, 0 }, { 9, 63, 0 }, { 1, 40, 0 } } }, + { { { 27, 0, 1 }, { 0, 27, 1 }, { 10, 62, 0 }, { 0, 41, 0 } } }, + { { { 27, 0, 2 }, { 0, 27, 2 }, { 10, 63, 0 }, { 16, 33, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 16, 51, 0 }, { 1, 41, 0 } } }, + { { { 28, 0, 0 }, { 0, 28, 0 }, { 11, 62, 0 }, { 0, 42, 0 } } }, + { { { 28, 0, 1 }, { 0, 28, 1 }, { 11, 63, 0 }, { 1, 42, 0 } } }, + { { { 28, 0, 2 }, { 0, 28, 2 }, { 12, 62, 0 }, { 17, 34, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 16, 54, 0 }, { 0, 43, 0 } } }, + { { { 29, 0, 0 }, { 0, 29, 0 }, { 12, 63, 0 }, { 1, 43, 0 } } }, + { { { 29, 0, 1 }, { 0, 29, 1 }, { 13, 62, 0 }, { 0, 44, 0 } } }, + { { { 29, 0, 2 }, { 0, 29, 2 }, { 13, 63, 0 }, { 16, 36, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 16, 57, 0 }, { 1, 44, 0 } } }, + { { { 30, 0, 0 }, { 0, 30, 0 }, { 14, 62, 0 }, { 0, 45, 0 } } }, + { { { 30, 0, 1 }, { 0, 30, 1 }, { 14, 63, 0 }, { 1, 45, 0 } } }, + { { { 30, 0, 2 }, { 0, 30, 2 }, { 15, 62, 0 }, { 17, 37, 0 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 16, 60, 0 }, { 0, 46, 0 } } }, + { { { 31, 0, 0 }, { 0, 31, 0 }, { 15, 63, 0 }, { 1, 46, 0 } } }, + { { { 31, 0, 1 }, { 0, 31, 1 }, { 24, 46, 0 }, { 0, 47, 0 } } }, + { { { 31, 0, 2 }, { 0, 31, 2 }, { 16, 62, 0 }, { 16, 39, 0 } } }, + { { { 32, 0, 2 }, { 0, 32, 2 }, { 16, 63, 0 }, { 1, 47, 0 } } }, + { { { 32, 0, 1 }, { 0, 32, 1 }, { 17, 62, 0 }, { 2, 47, 0 } } }, + { { { 32, 0, 0 }, { 0, 32, 0 }, { 25, 47, 0 }, { 0, 48, 0 } } }, + { { { 32, 0, 1 }, { 0, 32, 1 }, { 17, 63, 0 }, { 1, 48, 0 } } }, + { { { 32, 0, 2 }, { 0, 32, 2 }, { 18, 62, 0 }, { 0, 49, 0 } } }, + { { { 33, 0, 1 }, { 0, 33, 1 }, { 18, 63, 0 }, { 5, 47, 0 } } }, + { { { 33, 0, 0 }, { 0, 33, 0 }, { 27, 46, 0 }, { 1, 49, 0 } } }, + { { { 33, 0, 1 }, { 0, 33, 1 }, { 19, 62, 0 }, { 0, 50, 0 } } }, + { { { 33, 0, 2 }, { 0, 33, 2 }, { 19, 63, 0 }, { 1, 50, 0 } } }, + { { { 34, 0, 1 }, { 0, 34, 1 }, { 20, 62, 0 }, { 8, 47, 0 } } }, + { { { 34, 0, 0 }, { 0, 34, 0 }, { 28, 47, 0 }, { 0, 51, 0 } } }, + { { { 34, 0, 1 }, { 0, 34, 1 }, { 20, 63, 0 }, { 1, 51, 0 } } }, + { { { 34, 0, 2 }, { 0, 34, 2 }, { 21, 62, 0 }, { 0, 52, 0 } } }, + { { { 35, 0, 1 }, { 0, 35, 1 }, { 21, 63, 0 }, { 11, 47, 0 } } }, + { { { 35, 0, 0 }, { 0, 35, 0 }, { 30, 46, 0 }, { 1, 52, 0 } } }, + { { { 35, 0, 1 }, { 0, 35, 1 }, { 22, 62, 0 }, { 0, 53, 0 } } }, + { { { 35, 0, 2 }, { 0, 35, 2 }, { 22, 63, 0 }, { 1, 53, 0 } } }, + { { { 36, 0, 1 }, { 0, 36, 1 }, { 23, 62, 0 }, { 14, 47, 0 } } }, + { { { 36, 0, 0 }, { 0, 36, 0 }, { 31, 47, 0 }, { 0, 54, 0 } } }, + { { { 36, 0, 1 }, { 0, 36, 1 }, { 23, 63, 0 }, { 1, 54, 0 } } }, + { { { 36, 0, 2 }, { 0, 36, 2 }, { 24, 62, 0 }, { 0, 55, 0 } } }, + { { { 37, 0, 1 }, { 0, 37, 1 }, { 24, 63, 0 }, { 17, 47, 0 } } }, + { { { 37, 0, 0 }, { 0, 37, 0 }, { 32, 47, 0 }, { 1, 55, 0 } } }, + { { { 37, 0, 1 }, { 0, 37, 1 }, { 25, 62, 0 }, { 0, 56, 0 } } }, + { { { 37, 0, 2 }, { 0, 37, 2 }, { 25, 63, 0 }, { 1, 56, 0 } } }, + { { { 38, 0, 1 }, { 0, 38, 1 }, { 26, 62, 0 }, { 17, 48, 0 } } }, + { { { 38, 0, 0 }, { 0, 38, 0 }, { 32, 50, 0 }, { 0, 57, 0 } } }, + { { { 38, 0, 1 }, { 0, 38, 1 }, { 26, 63, 0 }, { 1, 57, 0 } } }, + { { { 38, 0, 2 }, { 0, 38, 2 }, { 27, 62, 0 }, { 0, 58, 0 } } }, + { { { 39, 0, 1 }, { 0, 39, 1 }, { 27, 63, 0 }, { 16, 50, 0 } } }, + { { { 39, 0, 0 }, { 0, 39, 0 }, { 32, 53, 0 }, { 1, 58, 0 } } }, + { { { 39, 0, 1 }, { 0, 39, 1 }, { 28, 62, 0 }, { 0, 59, 0 } } }, + { { { 39, 0, 2 }, { 0, 39, 2 }, { 28, 63, 0 }, { 1, 59, 0 } } }, + { { { 40, 0, 1 }, { 0, 40, 1 }, { 29, 62, 0 }, { 17, 51, 0 } } }, + { { { 40, 0, 0 }, { 0, 40, 0 }, { 32, 56, 0 }, { 0, 60, 0 } } }, + { { { 40, 0, 1 }, { 0, 40, 1 }, { 29, 63, 0 }, { 1, 60, 0 } } }, + { { { 40, 0, 2 }, { 0, 40, 2 }, { 30, 62, 0 }, { 0, 61, 0 } } }, + { { { 41, 0, 1 }, { 0, 41, 1 }, { 30, 63, 0 }, { 16, 53, 0 } } }, + { { { 41, 0, 0 }, { 0, 41, 0 }, { 32, 59, 0 }, { 1, 61, 0 } } }, + { { { 41, 0, 1 }, { 0, 41, 1 }, { 31, 62, 0 }, { 0, 62, 0 } } }, + { { { 41, 0, 2 }, { 0, 41, 2 }, { 31, 63, 0 }, { 1, 62, 0 } } }, + { { { 42, 0, 1 }, { 0, 42, 1 }, { 32, 61, 0 }, { 17, 54, 0 } } }, + { { { 42, 0, 0 }, { 0, 42, 0 }, { 32, 62, 0 }, { 0, 63, 0 } } }, + { { { 42, 0, 1 }, { 0, 42, 1 }, { 32, 63, 0 }, { 1, 63, 0 } } }, + { { { 42, 0, 2 }, { 0, 42, 2 }, { 41, 46, 0 }, { 2, 63, 0 } } }, + { { { 43, 0, 1 }, { 0, 43, 1 }, { 33, 62, 0 }, { 16, 56, 0 } } }, + { { { 43, 0, 0 }, { 0, 43, 0 }, { 33, 63, 0 }, { 3, 63, 0 } } }, + { { { 43, 0, 1 }, { 0, 43, 1 }, { 34, 62, 0 }, { 4, 63, 0 } } }, + { { { 43, 0, 2 }, { 0, 43, 2 }, { 42, 47, 0 }, { 5, 63, 0 } } }, + { { { 44, 0, 1 }, { 0, 44, 1 }, { 34, 63, 0 }, { 17, 57, 0 } } }, + { { { 44, 0, 0 }, { 0, 44, 0 }, { 35, 62, 0 }, { 6, 63, 0 } } }, + { { { 44, 0, 1 }, { 0, 44, 1 }, { 35, 63, 0 }, { 7, 63, 0 } } }, + { { { 44, 0, 2 }, { 0, 44, 2 }, { 44, 46, 0 }, { 8, 63, 0 } } }, + { { { 45, 0, 1 }, { 0, 45, 1 }, { 36, 62, 0 }, { 16, 59, 0 } } }, + { { { 45, 0, 0 }, { 0, 45, 0 }, { 36, 63, 0 }, { 9, 63, 0 } } }, + { { { 45, 0, 1 }, { 0, 45, 1 }, { 37, 62, 0 }, { 10, 63, 0 } } }, + { { { 45, 0, 2 }, { 0, 45, 2 }, { 45, 47, 0 }, { 11, 63, 0 } } }, + { { { 46, 0, 1 }, { 0, 46, 1 }, { 37, 63, 0 }, { 17, 60, 0 } } }, + { { { 46, 0, 0 }, { 0, 46, 0 }, { 38, 62, 0 }, { 12, 63, 0 } } }, + { { { 46, 0, 1 }, { 0, 46, 1 }, { 38, 63, 0 }, { 13, 63, 0 } } }, + { { { 46, 0, 2 }, { 0, 46, 2 }, { 47, 46, 0 }, { 14, 63, 0 } } }, + { { { 47, 0, 1 }, { 0, 47, 1 }, { 39, 62, 0 }, { 16, 62, 0 } } }, + { { { 47, 0, 0 }, { 0, 47, 0 }, { 39, 63, 0 }, { 15, 63, 0 } } }, + { { { 47, 0, 1 }, { 0, 47, 1 }, { 40, 62, 0 }, { 16, 63, 0 } } }, + { { { 47, 0, 2 }, { 0, 47, 2 }, { 48, 46, 0 }, { 32, 55, 0 } } }, + { { { 48, 0, 2 }, { 0, 48, 2 }, { 40, 63, 0 }, { 17, 63, 0 } } }, + { { { 48, 0, 1 }, { 0, 48, 1 }, { 41, 62, 0 }, { 18, 63, 0 } } }, + { { { 48, 0, 0 }, { 0, 48, 0 }, { 41, 63, 0 }, { 19, 63, 0 } } }, + { { { 48, 0, 1 }, { 0, 48, 1 }, { 48, 49, 0 }, { 33, 56, 0 } } }, + { { { 48, 0, 2 }, { 0, 48, 2 }, { 42, 62, 0 }, { 20, 63, 0 } } }, + { { { 49, 0, 1 }, { 0, 49, 1 }, { 42, 63, 0 }, { 21, 63, 0 } } }, + { { { 49, 0, 0 }, { 0, 49, 0 }, { 43, 62, 0 }, { 22, 63, 0 } } }, + { { { 49, 0, 1 }, { 0, 49, 1 }, { 48, 52, 0 }, { 32, 58, 0 } } }, + { { { 49, 0, 2 }, { 0, 49, 2 }, { 43, 63, 0 }, { 23, 63, 0 } } }, + { { { 50, 0, 1 }, { 0, 50, 1 }, { 44, 62, 0 }, { 24, 63, 0 } } }, + { { { 50, 0, 0 }, { 0, 50, 0 }, { 44, 63, 0 }, { 25, 63, 0 } } }, + { { { 50, 0, 1 }, { 0, 50, 1 }, { 48, 55, 0 }, { 33, 59, 0 } } }, + { { { 50, 0, 2 }, { 0, 50, 2 }, { 45, 62, 0 }, { 26, 63, 0 } } }, + { { { 51, 0, 1 }, { 0, 51, 1 }, { 45, 63, 0 }, { 27, 63, 0 } } }, + { { { 51, 0, 0 }, { 0, 51, 0 }, { 46, 62, 0 }, { 28, 63, 0 } } }, + { { { 51, 0, 1 }, { 0, 51, 1 }, { 48, 58, 0 }, { 32, 61, 0 } } }, + { { { 51, 0, 2 }, { 0, 51, 2 }, { 46, 63, 0 }, { 29, 63, 0 } } }, + { { { 52, 0, 1 }, { 0, 52, 1 }, { 47, 62, 0 }, { 30, 63, 0 } } }, + { { { 52, 0, 0 }, { 0, 52, 0 }, { 47, 63, 0 }, { 31, 63, 0 } } }, + { { { 52, 0, 1 }, { 0, 52, 1 }, { 48, 61, 0 }, { 33, 62, 0 } } }, + { { { 52, 0, 2 }, { 0, 52, 2 }, { 48, 62, 0 }, { 32, 63, 0 } } }, + { { { 53, 0, 1 }, { 0, 53, 1 }, { 56, 47, 0 }, { 33, 63, 0 } } }, + { { { 53, 0, 0 }, { 0, 53, 0 }, { 48, 63, 0 }, { 49, 55, 0 } } }, + { { { 53, 0, 1 }, { 0, 53, 1 }, { 49, 62, 0 }, { 34, 63, 0 } } }, + { { { 53, 0, 2 }, { 0, 53, 2 }, { 49, 63, 0 }, { 35, 63, 0 } } }, + { { { 54, 0, 1 }, { 0, 54, 1 }, { 58, 46, 0 }, { 36, 63, 0 } } }, + { { { 54, 0, 0 }, { 0, 54, 0 }, { 50, 62, 0 }, { 48, 57, 0 } } }, + { { { 54, 0, 1 }, { 0, 54, 1 }, { 50, 63, 0 }, { 37, 63, 0 } } }, + { { { 54, 0, 2 }, { 0, 54, 2 }, { 51, 62, 0 }, { 38, 63, 0 } } }, + { { { 55, 0, 1 }, { 0, 55, 1 }, { 59, 47, 0 }, { 39, 63, 0 } } }, + { { { 55, 0, 0 }, { 0, 55, 0 }, { 51, 63, 0 }, { 49, 58, 0 } } }, + { { { 55, 0, 1 }, { 0, 55, 1 }, { 52, 62, 0 }, { 40, 63, 0 } } }, + { { { 55, 0, 2 }, { 0, 55, 2 }, { 52, 63, 0 }, { 41, 63, 0 } } }, + { { { 56, 0, 1 }, { 0, 56, 1 }, { 61, 46, 0 }, { 42, 63, 0 } } }, + { { { 56, 0, 0 }, { 0, 56, 0 }, { 53, 62, 0 }, { 48, 60, 0 } } }, + { { { 56, 0, 1 }, { 0, 56, 1 }, { 53, 63, 0 }, { 43, 63, 0 } } }, + { { { 56, 0, 2 }, { 0, 56, 2 }, { 54, 62, 0 }, { 44, 63, 0 } } }, + { { { 57, 0, 1 }, { 0, 57, 1 }, { 62, 47, 0 }, { 45, 63, 0 } } }, + { { { 57, 0, 0 }, { 0, 57, 0 }, { 54, 63, 0 }, { 49, 61, 0 } } }, + { { { 57, 0, 1 }, { 0, 57, 1 }, { 55, 62, 0 }, { 46, 63, 0 } } }, + { { { 57, 0, 2 }, { 0, 57, 2 }, { 55, 63, 0 }, { 47, 63, 0 } } }, + { { { 58, 0, 1 }, { 0, 58, 1 }, { 56, 62, 1 }, { 48, 63, 1 } } }, + { { { 58, 0, 0 }, { 0, 58, 0 }, { 56, 62, 0 }, { 48, 63, 0 } } }, + { { { 58, 0, 1 }, { 0, 58, 1 }, { 56, 63, 0 }, { 49, 63, 0 } } }, + { { { 58, 0, 2 }, { 0, 58, 2 }, { 57, 62, 0 }, { 50, 63, 0 } } }, + { { { 59, 0, 1 }, { 0, 59, 1 }, { 57, 63, 1 }, { 51, 63, 1 } } }, + { { { 59, 0, 0 }, { 0, 59, 0 }, { 57, 63, 0 }, { 51, 63, 0 } } }, + { { { 59, 0, 1 }, { 0, 59, 1 }, { 58, 62, 0 }, { 52, 63, 0 } } }, + { { { 59, 0, 2 }, { 0, 59, 2 }, { 58, 63, 0 }, { 53, 63, 0 } } }, + { { { 60, 0, 1 }, { 0, 60, 1 }, { 59, 62, 1 }, { 54, 63, 1 } } }, + { { { 60, 0, 0 }, { 0, 60, 0 }, { 59, 62, 0 }, { 54, 63, 0 } } }, + { { { 60, 0, 1 }, { 0, 60, 1 }, { 59, 63, 0 }, { 55, 63, 0 } } }, + { { { 60, 0, 2 }, { 0, 60, 2 }, { 60, 62, 0 }, { 56, 63, 0 } } }, + { { { 61, 0, 1 }, { 0, 61, 1 }, { 60, 63, 1 }, { 57, 63, 1 } } }, + { { { 61, 0, 0 }, { 0, 61, 0 }, { 60, 63, 0 }, { 57, 63, 0 } } }, + { { { 61, 0, 1 }, { 0, 61, 1 }, { 61, 62, 0 }, { 58, 63, 0 } } }, + { { { 61, 0, 2 }, { 0, 61, 2 }, { 61, 63, 0 }, { 59, 63, 0 } } }, + { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 62, 1 }, { 60, 63, 1 } } }, + { { { 62, 0, 0 }, { 0, 62, 0 }, { 62, 62, 0 }, { 60, 63, 0 } } }, + { { { 62, 0, 1 }, { 0, 62, 1 }, { 62, 63, 0 }, { 61, 63, 0 } } }, + { { { 62, 0, 2 }, { 0, 62, 2 }, { 63, 62, 0 }, { 62, 63, 0 } } }, + { { { 63, 0, 1 }, { 0, 63, 1 }, { 63, 63, 1 }, { 63, 63, 1 } } }, + { { { 63, 0, 0 }, { 0, 63, 0 }, { 63, 63, 0 }, { 63, 63, 0 } } } +}; diff --git a/externals/NVTT/src/nvtt/squish/squish.cpp b/externals/NVTT/src/nvtt/squish/squish.cpp new file mode 100644 index 00000000..515be8d6 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/squish.cpp @@ -0,0 +1,226 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#include +#include "colourset.h" +#include "maths.h" +#include "rangefit.h" +#include "clusterfit.h" +#include "colourblock.h" +#include "alpha.h" +#include "singlecolourfit.h" + +namespace squish { + +static int FixFlags( int flags ) +{ + // grab the flag bits + int method = flags & ( kDxt1 | kDxt3 | kDxt5 ); + int fit = flags & ( kColourClusterFit | kColourRangeFit ); + int metric = flags & ( kColourMetricPerceptual | kColourMetricUniform ); + int extra = flags & kWeightColourByAlpha; + + // set defaults + if( method != kDxt3 && method != kDxt5 ) + method = kDxt1; + if( fit != kColourRangeFit ) + fit = kColourClusterFit; + if( metric != kColourMetricUniform ) + metric = kColourMetricPerceptual; + + // done + return method | fit | metric | extra; +} + + +void Compress( u8 const* rgba, void* block, int flags ) +{ + // fix any bad flags + flags = FixFlags( flags ); + + // get the block locations + void* colourBlock = block; + void* alphaBock = block; + if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 ) + colourBlock = reinterpret_cast< u8* >( block ) + 8; + + // create the minimal point set + ColourSet colours( rgba, flags ); + + // check the compression type and compress colour + if( colours.GetCount() == 1 ) + { + // always do a single colour fit + SingleColourFit fit( &colours, flags ); + fit.Compress( colourBlock ); + } + else if( ( flags & kColourRangeFit ) != 0 ) + { + // do a range fit + RangeFit fit( &colours, flags ); + fit.Compress( colourBlock ); + } + else + { + // default to a cluster fit + ClusterFit fit; + fit.SetColourSet( &colours, flags ); + fit.Compress( colourBlock ); + } + + // compress alpha separately if necessary + if( ( flags & kDxt3 ) != 0 ) + CompressAlphaDxt3( rgba, alphaBock ); + else if( ( flags & kDxt5 ) != 0 ) + CompressAlphaDxt5( rgba, alphaBock ); +} + + +void Decompress( u8* rgba, void const* block, int flags ) +{ + // fix any bad flags + flags = FixFlags( flags ); + + // get the block locations + void const* colourBlock = block; + void const* alphaBock = block; + if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 ) + colourBlock = reinterpret_cast< u8 const* >( block ) + 8; + + // decompress colour + DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 ); + + // decompress alpha separately if necessary + if( ( flags & kDxt3 ) != 0 ) + DecompressAlphaDxt3( rgba, alphaBock ); + else if( ( flags & kDxt5 ) != 0 ) + DecompressAlphaDxt5( rgba, alphaBock ); +} + +int GetStorageRequirements( int width, int height, int flags ) +{ + // fix any bad flags + flags = FixFlags( flags ); + + // compute the storage requirements + int blockcount = ( ( width + 3 )/4 ) * ( ( height + 3 )/4 ); + int blocksize = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16; + return blockcount*blocksize; +} + +void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags ) +{ + // fix any bad flags + flags = FixFlags( flags ); + + // initialise the block output + u8* targetBlock = reinterpret_cast< u8* >( blocks ); + int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16; + + int bh = std::min(width, 4); + int bw = std::min(height, 4); + + // loop over blocks + for( int y = 0; y < height; y += 4 ) + { + for( int x = 0; x < width; x += 4 ) + { + // build the 4x4 block of pixels + u8 sourceRgba[16*4]; + u8* targetPixel = sourceRgba; + for( int py = 0; py < 4; ++py ) + { + for( int px = 0; px < 4; ++px ) + { + // get the source pixel in the image + int sx = x + (px % bw); + int sy = y + (py % bh); + + // copy the rgba value + u8 const* sourcePixel = rgba + 4*( width*sy + sx ); + for( int i = 0; i < 4; ++i ) + *targetPixel++ = *sourcePixel++; + } + } + + // compress it into the output + Compress( sourceRgba, targetBlock, flags ); + + // advance + targetBlock += bytesPerBlock; + } + } +} + +void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags ) +{ + // fix any bad flags + flags = FixFlags( flags ); + + // initialise the block input + u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks ); + int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16; + + // loop over blocks + for( int y = 0; y < height; y += 4 ) + { + for( int x = 0; x < width; x += 4 ) + { + // decompress the block + u8 targetRgba[4*16]; + Decompress( targetRgba, sourceBlock, flags ); + + // write the decompressed pixels to the correct image locations + u8 const* sourcePixel = targetRgba; + for( int py = 0; py < 4; ++py ) + { + for( int px = 0; px < 4; ++px ) + { + // get the target location + int sx = x + px; + int sy = y + py; + if( sx < width && sy < height ) + { + u8* targetPixel = rgba + 4*( width*sy + sx ); + + // copy the rgba value + for( int i = 0; i < 4; ++i ) + *targetPixel++ = *sourcePixel++; + } + else + { + // skip this pixel as its outside the image + sourcePixel += 4; + } + } + } + + // advance + sourceBlock += bytesPerBlock; + } + } +} + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/squish.h b/externals/NVTT/src/nvtt/squish/squish.h new file mode 100644 index 00000000..fdd8fde3 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/squish.h @@ -0,0 +1,244 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_H +#define SQUISH_H + +//! All squish API functions live in this namespace. +namespace squish { + +// ----------------------------------------------------------------------------- + +//! Typedef a quantity that is a single unsigned byte. +typedef unsigned char u8; + +// ----------------------------------------------------------------------------- + +enum +{ + //! Use DXT1 compression. + kDxt1 = ( 1 << 0 ), + + //! Use DXT3 compression. + kDxt3 = ( 1 << 1 ), + + //! Use DXT5 compression. + kDxt5 = ( 1 << 2 ), + + //! Use a slow but high quality colour compressor (the default). + kColourClusterFit = ( 1 << 3 ), + + //! Use a fast but low quality colour compressor. + kColourRangeFit = ( 1 << 4 ), + + //! Use a perceptual metric for colour error (the default). + kColourMetricPerceptual = ( 1 << 5 ), + + //! Use a uniform metric for colour error. + kColourMetricUniform = ( 1 << 6 ), + + //! Weight the colour by alpha during cluster fit (disabled by default). + kWeightColourByAlpha = ( 1 << 7 ) +}; + +// ----------------------------------------------------------------------------- + +/*! @brief Compresses a 4x4 block of pixels. + + @param rgba The rgba values of the 16 source pixels. + @param block Storage for the compressed DXT block. + @param flags Compression flags. + + The source pixels should be presented as a contiguous array of 16 rgba + values, with each component as 1 byte each. In memory this should be: + + { r1, g1, b1, a1, .... , r16, g16, b16, a16 } + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. When using DXT1 + compression, 8 bytes of storage are required for the compressed DXT block. + DXT3 and DXT5 compression require 16 bytes of storage per block. + + The flags parameter can also specify a preferred colour compressor and + colour error metric to use when fitting the RGB components of the data. + Possible colour compressors are: kColourClusterFit (the default) or + kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual + (the default) or kColourMetricUniform. If no flags are specified in any + particular category then the default will be used. Unknown flags are + ignored. + + When using kColourClusterFit, an additional flag can be specified to + weight the colour of each pixel by its alpha value. For images that are + rendered using alpha blending, this can significantly increase the + perceived quality. +*/ +void Compress( u8 const* rgba, void* block, int flags ); + +// ----------------------------------------------------------------------------- + +/*! @brief Compresses a 4x4 block of pixels. + + @param rgba The rgba values of the 16 source pixels. + @param mask The valid pixel mask. + @param block Storage for the compressed DXT block. + @param flags Compression flags. + + The source pixels should be presented as a contiguous array of 16 rgba + values, with each component as 1 byte each. In memory this should be: + + { r1, g1, b1, a1, .... , r16, g16, b16, a16 } + + The mask parameter enables only certain pixels within the block. The lowest + bit enables the first pixel and so on up to the 16th bit. Bits beyond the + 16th bit are ignored. Pixels that are not enabled are allowed to take + arbitrary colours in the output block. An example of how this can be used + is in the CompressImage function to disable pixels outside the bounds of + the image when the width or height is not divisible by 4. + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. When using DXT1 + compression, 8 bytes of storage are required for the compressed DXT block. + DXT3 and DXT5 compression require 16 bytes of storage per block. + + The flags parameter can also specify a preferred colour compressor and + colour error metric to use when fitting the RGB components of the data. + Possible colour compressors are: kColourClusterFit (the default) or + kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual + (the default) or kColourMetricUniform. If no flags are specified in any + particular category then the default will be used. Unknown flags are + ignored. + + When using kColourClusterFit, an additional flag can be specified to + weight the colour of each pixel by its alpha value. For images that are + rendered using alpha blending, this can significantly increase the + perceived quality. +*/ +void CompressMasked( u8 const* rgba, int mask, void* block, int flags ); + +// ----------------------------------------------------------------------------- + +/*! @brief Decompresses a 4x4 block of pixels. + + @param rgba Storage for the 16 decompressed pixels. + @param block The compressed DXT block. + @param flags Compression flags. + + The decompressed pixels will be written as a contiguous array of 16 rgba + values, with each component as 1 byte each. In memory this is: + + { r1, g1, b1, a1, .... , r16, g16, b16, a16 } + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. All other flags + are ignored. +*/ +void Decompress( u8* rgba, void const* block, int flags ); + +// ----------------------------------------------------------------------------- + +/*! @brief Computes the amount of compressed storage required. + + @param width The width of the image. + @param height The height of the image. + @param flags Compression flags. + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. All other flags + are ignored. + + Most DXT images will be a multiple of 4 in each dimension, but this + function supports arbitrary size images by allowing the outer blocks to + be only partially used. +*/ +int GetStorageRequirements( int width, int height, int flags ); + +// ----------------------------------------------------------------------------- + +/*! @brief Compresses an image in memory. + + @param rgba The pixels of the source. + @param width The width of the source image. + @param height The height of the source image. + @param blocks Storage for the compressed output. + @param flags Compression flags. + + The source pixels should be presented as a contiguous array of width*height + rgba values, with each component as 1 byte each. In memory this should be: + + { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. When using DXT1 + compression, 8 bytes of storage are required for each compressed DXT block. + DXT3 and DXT5 compression require 16 bytes of storage per block. + + The flags parameter can also specify a preferred colour compressor and + colour error metric to use when fitting the RGB components of the data. + Possible colour compressors are: kColourClusterFit (the default) or + kColourRangeFit. Possible colour error metrics are: kColourMetricPerceptual + (the default) or kColourMetricUniform. If no flags are specified in any + particular category then the default will be used. Unknown flags are + ignored. + + When using kColourClusterFit, an additional flag can be specified to + weight the colour of each pixel by its alpha value. For images that are + rendered using alpha blending, this can significantly increase the + perceived quality. + + Internally this function calls squish::Compress for each block. To see how + much memory is required in the compressed image, use + squish::GetStorageRequirements. +*/ +void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags ); + +// ----------------------------------------------------------------------------- + +/*! @brief Decompresses an image in memory. + + @param rgba Storage for the decompressed pixels. + @param width The width of the source image. + @param height The height of the source image. + @param blocks The compressed DXT blocks. + @param flags Compression flags. + + The decompressed pixels will be written as a contiguous array of width*height + 16 rgba values, with each component as 1 byte each. In memory this is: + + { r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height + + The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression, + however, DXT1 will be used by default if none is specified. All other flags + are ignored. + + Internally this function calls squish::Decompress for each block. +*/ +void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags ); + +// ----------------------------------------------------------------------------- + +} // namespace squish + +#endif // ndef SQUISH_H + diff --git a/externals/NVTT/src/nvtt/squish/squish.xcodeproj/project.pbxproj b/externals/NVTT/src/nvtt/squish/squish.xcodeproj/project.pbxproj new file mode 100644 index 00000000..7812da80 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/squish.xcodeproj/project.pbxproj @@ -0,0 +1,531 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 133FA0DC096A7B8E0050752E /* alpha.h in Headers */ = {isa = PBXBuildFile; fileRef = 133FA0DA096A7B8E0050752E /* alpha.h */; }; + 133FA0DD096A7B8E0050752E /* alpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 133FA0DB096A7B8E0050752E /* alpha.cpp */; }; + 1342B4160999DF1900152915 /* libsquish.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libsquish.a */; }; + 1342B41A0999DF7000152915 /* squishpng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1342B4190999DF7000152915 /* squishpng.cpp */; }; + 1342B43F0999E0CC00152915 /* squishtest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1342B43E0999E0CC00152915 /* squishtest.cpp */; }; + 1342B4420999E0EC00152915 /* libsquish.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libsquish.a */; }; + 1350D71A092AA858005EE038 /* clusterfit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1350D70B092AA857005EE038 /* clusterfit.cpp */; }; + 1350D71B092AA858005EE038 /* clusterfit.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D70C092AA858005EE038 /* clusterfit.h */; }; + 1350D71E092AA858005EE038 /* colourblock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1350D70F092AA858005EE038 /* colourblock.cpp */; }; + 1350D71F092AA858005EE038 /* colourblock.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D710092AA858005EE038 /* colourblock.h */; }; + 1350D720092AA858005EE038 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D711092AA858005EE038 /* config.h */; }; + 1350D721092AA858005EE038 /* maths.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1350D712092AA858005EE038 /* maths.cpp */; }; + 1350D722092AA858005EE038 /* maths.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D713092AA858005EE038 /* maths.h */; }; + 1350D725092AA858005EE038 /* rangefit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1350D716092AA858005EE038 /* rangefit.cpp */; }; + 1350D726092AA858005EE038 /* rangefit.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D717092AA858005EE038 /* rangefit.h */; }; + 1350D727092AA858005EE038 /* squish.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1350D718092AA858005EE038 /* squish.cpp */; }; + 1350D728092AA858005EE038 /* squish.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350D719092AA858005EE038 /* squish.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 139C21CF09ADAB0800A2500D /* squishgen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139C21CE09ADAB0800A2500D /* squishgen.cpp */; }; + 139C234F09B0602700A2500D /* singlecolourfit.h in Headers */ = {isa = PBXBuildFile; fileRef = 139C234D09B0602700A2500D /* singlecolourfit.h */; }; + 139C235009B0602700A2500D /* singlecolourfit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 139C234E09B0602700A2500D /* singlecolourfit.cpp */; }; + 13A7CCA40952BE63001C963A /* colourfit.h in Headers */ = {isa = PBXBuildFile; fileRef = 13A7CCA20952BE63001C963A /* colourfit.h */; }; + 13A7CCA50952BE63001C963A /* colourfit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13A7CCA30952BE63001C963A /* colourfit.cpp */; }; + 13C4C7AD0941C18000AC5B89 /* colourset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13C4C7AB0941C18000AC5B89 /* colourset.cpp */; }; + 13C4C7AE0941C18000AC5B89 /* colourset.h in Headers */ = {isa = PBXBuildFile; fileRef = 13C4C7AC0941C18000AC5B89 /* colourset.h */; }; + 13CD64C2092BCF8A00488C97 /* simd.h in Headers */ = {isa = PBXBuildFile; fileRef = 13CD64C0092BCF8A00488C97 /* simd.h */; }; + 13D0DC910931F93A00909807 /* simd_ve.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D0DC900931F93A00909807 /* simd_ve.h */; }; + 13D0DC970931F9D600909807 /* simd_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = 13D0DC960931F9D600909807 /* simd_sse.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1342B52B099BF72F00152915 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC045055464E500DB518D; + remoteInfo = squish; + }; + 1342B58E099BF93D00152915 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC045055464E500DB518D; + remoteInfo = squish; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 133FA0DA096A7B8E0050752E /* alpha.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alpha.h; sourceTree = ""; }; + 133FA0DB096A7B8E0050752E /* alpha.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alpha.cpp; sourceTree = ""; }; + 1342B4110999DE7F00152915 /* squishpng */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = squishpng; sourceTree = BUILT_PRODUCTS_DIR; }; + 1342B4190999DF7000152915 /* squishpng.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = squishpng.cpp; path = extra/squishpng.cpp; sourceTree = ""; }; + 1342B4370999E07C00152915 /* squishtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = squishtest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1342B43E0999E0CC00152915 /* squishtest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = squishtest.cpp; path = extra/squishtest.cpp; sourceTree = ""; }; + 1350D70B092AA857005EE038 /* clusterfit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = clusterfit.cpp; sourceTree = ""; }; + 1350D70C092AA858005EE038 /* clusterfit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clusterfit.h; sourceTree = ""; }; + 1350D70F092AA858005EE038 /* colourblock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = colourblock.cpp; sourceTree = ""; }; + 1350D710092AA858005EE038 /* colourblock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = colourblock.h; sourceTree = ""; }; + 1350D711092AA858005EE038 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; + 1350D712092AA858005EE038 /* maths.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = maths.cpp; sourceTree = ""; }; + 1350D713092AA858005EE038 /* maths.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = maths.h; sourceTree = ""; }; + 1350D716092AA858005EE038 /* rangefit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = rangefit.cpp; sourceTree = ""; }; + 1350D717092AA858005EE038 /* rangefit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = rangefit.h; sourceTree = ""; }; + 1350D718092AA858005EE038 /* squish.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = squish.cpp; sourceTree = ""; }; + 1350D719092AA858005EE038 /* squish.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = squish.h; sourceTree = ""; }; + 13906CE3096938880000A6A7 /* texture_compression_s3tc.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = texture_compression_s3tc.txt; sourceTree = ""; }; + 139C21C409ADAA7000A2500D /* squishgen */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = squishgen; sourceTree = BUILT_PRODUCTS_DIR; }; + 139C21CE09ADAB0800A2500D /* squishgen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = squishgen.cpp; path = extra/squishgen.cpp; sourceTree = ""; }; + 139C234D09B0602700A2500D /* singlecolourfit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = singlecolourfit.h; sourceTree = ""; }; + 139C234E09B0602700A2500D /* singlecolourfit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = singlecolourfit.cpp; sourceTree = ""; }; + 139C236D09B060A900A2500D /* singlecolourlookup.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = singlecolourlookup.inl; sourceTree = ""; }; + 13A7CCA20952BE63001C963A /* colourfit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colourfit.h; sourceTree = ""; }; + 13A7CCA30952BE63001C963A /* colourfit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colourfit.cpp; sourceTree = ""; }; + 13C4C7AB0941C18000AC5B89 /* colourset.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = colourset.cpp; sourceTree = ""; }; + 13C4C7AC0941C18000AC5B89 /* colourset.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = colourset.h; sourceTree = ""; }; + 13CD64C0092BCF8A00488C97 /* simd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simd.h; sourceTree = ""; }; + 13D0DC900931F93A00909807 /* simd_ve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simd_ve.h; sourceTree = ""; }; + 13D0DC960931F9D600909807 /* simd_sse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simd_sse.h; sourceTree = ""; }; + D2AAC046055464E500DB518D /* libsquish.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libsquish.a; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1342B40F0999DE7F00152915 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1342B4160999DF1900152915 /* libsquish.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1342B4350999E07C00152915 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1342B4420999E0EC00152915 /* libsquish.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 139C21C209ADAA7000A2500D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D289987405E68DCB004EDB86 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* squish */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6A0FF2B0290797F04C91782 /* Documentation */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = squish; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 133FA0DB096A7B8E0050752E /* alpha.cpp */, + 133FA0DA096A7B8E0050752E /* alpha.h */, + 1350D70B092AA857005EE038 /* clusterfit.cpp */, + 1350D70C092AA858005EE038 /* clusterfit.h */, + 13A7CCA30952BE63001C963A /* colourfit.cpp */, + 13A7CCA20952BE63001C963A /* colourfit.h */, + 13C4C7AB0941C18000AC5B89 /* colourset.cpp */, + 13C4C7AC0941C18000AC5B89 /* colourset.h */, + 1350D70F092AA858005EE038 /* colourblock.cpp */, + 1350D710092AA858005EE038 /* colourblock.h */, + 13906CE3096938880000A6A7 /* texture_compression_s3tc.txt */, + 1350D711092AA858005EE038 /* config.h */, + 1350D712092AA858005EE038 /* maths.cpp */, + 1350D713092AA858005EE038 /* maths.h */, + 1350D716092AA858005EE038 /* rangefit.cpp */, + 1350D717092AA858005EE038 /* rangefit.h */, + 13CD64C0092BCF8A00488C97 /* simd.h */, + 13D0DC960931F9D600909807 /* simd_sse.h */, + 13D0DC900931F93A00909807 /* simd_ve.h */, + 139C234E09B0602700A2500D /* singlecolourfit.cpp */, + 139C234D09B0602700A2500D /* singlecolourfit.h */, + 139C236D09B060A900A2500D /* singlecolourlookup.inl */, + 1350D718092AA858005EE038 /* squish.cpp */, + 1350D719092AA858005EE038 /* squish.h */, + 139C21CE09ADAB0800A2500D /* squishgen.cpp */, + 1342B4190999DF7000152915 /* squishpng.cpp */, + 1342B43E0999E0CC00152915 /* squishtest.cpp */, + ); + name = Source; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + D2AAC046055464E500DB518D /* libsquish.a */, + 1342B4110999DE7F00152915 /* squishpng */, + 1342B4370999E07C00152915 /* squishtest */, + 139C21C409ADAA7000A2500D /* squishgen */, + ); + name = Products; + sourceTree = ""; + }; + C6A0FF2B0290797F04C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D2AAC043055464E500DB518D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1350D71B092AA858005EE038 /* clusterfit.h in Headers */, + 1350D71F092AA858005EE038 /* colourblock.h in Headers */, + 1350D720092AA858005EE038 /* config.h in Headers */, + 1350D722092AA858005EE038 /* maths.h in Headers */, + 1350D726092AA858005EE038 /* rangefit.h in Headers */, + 1350D728092AA858005EE038 /* squish.h in Headers */, + 13CD64C2092BCF8A00488C97 /* simd.h in Headers */, + 13D0DC910931F93A00909807 /* simd_ve.h in Headers */, + 13D0DC970931F9D600909807 /* simd_sse.h in Headers */, + 13C4C7AE0941C18000AC5B89 /* colourset.h in Headers */, + 13A7CCA40952BE63001C963A /* colourfit.h in Headers */, + 133FA0DC096A7B8E0050752E /* alpha.h in Headers */, + 139C234F09B0602700A2500D /* singlecolourfit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 1342B4100999DE7F00152915 /* squishpng */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1342B4130999DE9F00152915 /* Build configuration list for PBXNativeTarget "squishpng" */; + buildPhases = ( + 1342B40E0999DE7F00152915 /* Sources */, + 1342B40F0999DE7F00152915 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 1342B58F099BF93D00152915 /* PBXTargetDependency */, + ); + name = squishpng; + productName = squishpng; + productReference = 1342B4110999DE7F00152915 /* squishpng */; + productType = "com.apple.product-type.tool"; + }; + 1342B4360999E07C00152915 /* squishtest */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1342B43B0999E0C000152915 /* Build configuration list for PBXNativeTarget "squishtest" */; + buildPhases = ( + 1342B4340999E07C00152915 /* Sources */, + 1342B4350999E07C00152915 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 1342B52C099BF72F00152915 /* PBXTargetDependency */, + ); + name = squishtest; + productName = squishtest; + productReference = 1342B4370999E07C00152915 /* squishtest */; + productType = "com.apple.product-type.tool"; + }; + 139C21C309ADAA7000A2500D /* squishgen */ = { + isa = PBXNativeTarget; + buildConfigurationList = 139C21CB09ADAB0300A2500D /* Build configuration list for PBXNativeTarget "squishgen" */; + buildPhases = ( + 139C21C109ADAA7000A2500D /* Sources */, + 139C21C209ADAA7000A2500D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = squishgen; + productName = squishgen; + productReference = 139C21C409ADAA7000A2500D /* squishgen */; + productType = "com.apple.product-type.tool"; + }; + D2AAC045055464E500DB518D /* squish */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "squish" */; + buildPhases = ( + D2AAC043055464E500DB518D /* Headers */, + D2AAC044055464E500DB518D /* Sources */, + D289987405E68DCB004EDB86 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = squish; + productName = squish; + productReference = D2AAC046055464E500DB518D /* libsquish.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "squish" */; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* squish */; + projectDirPath = ""; + targets = ( + D2AAC045055464E500DB518D /* squish */, + 1342B4100999DE7F00152915 /* squishpng */, + 1342B4360999E07C00152915 /* squishtest */, + 139C21C309ADAA7000A2500D /* squishgen */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 1342B40E0999DE7F00152915 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1342B41A0999DF7000152915 /* squishpng.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1342B4340999E07C00152915 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1342B43F0999E0CC00152915 /* squishtest.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 139C21C109ADAA7000A2500D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 139C21CF09ADAB0800A2500D /* squishgen.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D2AAC044055464E500DB518D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1350D71A092AA858005EE038 /* clusterfit.cpp in Sources */, + 1350D71E092AA858005EE038 /* colourblock.cpp in Sources */, + 1350D721092AA858005EE038 /* maths.cpp in Sources */, + 1350D725092AA858005EE038 /* rangefit.cpp in Sources */, + 1350D727092AA858005EE038 /* squish.cpp in Sources */, + 13C4C7AD0941C18000AC5B89 /* colourset.cpp in Sources */, + 13A7CCA50952BE63001C963A /* colourfit.cpp in Sources */, + 133FA0DD096A7B8E0050752E /* alpha.cpp in Sources */, + 139C235009B0602700A2500D /* singlecolourfit.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1342B52C099BF72F00152915 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC045055464E500DB518D /* squish */; + targetProxy = 1342B52B099BF72F00152915 /* PBXContainerItemProxy */; + }; + 1342B58F099BF93D00152915 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC045055464E500DB518D /* squish */; + targetProxy = 1342B58E099BF93D00152915 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1342B4140999DE9F00152915 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + .., + /sw/include, + ); + INSTALL_PATH = "$(HOME)/bin"; + LIBRARY_SEARCH_PATHS = /sw/lib; + OTHER_LDFLAGS = "-lpng"; + PRODUCT_NAME = squishpng; + }; + name = Debug; + }; + 1342B4150999DE9F00152915 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + .., + /sw/include, + ); + INSTALL_PATH = "$(HOME)/bin"; + LIBRARY_SEARCH_PATHS = /sw/lib; + OTHER_LDFLAGS = "-lpng"; + PRODUCT_NAME = squishpng; + }; + name = Release; + }; + 1342B43C0999E0C000152915 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ..; + INSTALL_PATH = "$(HOME)/bin"; + PRODUCT_NAME = squishtest; + }; + name = Debug; + }; + 1342B43D0999E0C000152915 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ..; + INSTALL_PATH = "$(HOME)/bin"; + PRODUCT_NAME = squishtest; + }; + name = Release; + }; + 139C21CC09ADAB0300A2500D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ..; + INSTALL_PATH = "$(HOME)/bin"; + PRODUCT_NAME = squishgen; + }; + name = Debug; + }; + 139C21CD09ADAB0300A2500D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ..; + INSTALL_PATH = "$(HOME)/bin"; + PRODUCT_NAME = squishgen; + }; + name = Release; + }; + 1DEB91EC08733DB70010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_PREPROCESSOR_DEFINITIONS = "SQUISH_USE_ALTIVEC=1"; + INSTALL_PATH = /usr/local/lib; + OTHER_CFLAGS = "-maltivec"; + PRODUCT_NAME = squish; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Debug; + }; + 1DEB91ED08733DB70010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = "SQUISH_USE_ALTIVEC=1"; + INSTALL_PATH = /usr/local/lib; + OTHER_CFLAGS = "-maltivec"; + PRODUCT_NAME = squish; + STRIP_INSTALLED_PRODUCT = YES; + }; + name = Release; + }; + 1DEB91F008733DB70010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_DYNAMIC_NO_PIC = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Debug; + }; + 1DEB91F108733DB70010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_DYNAMIC_NO_PIC = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_UNROLL_LOOPS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_PEDANTIC = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_VALUE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1342B4130999DE9F00152915 /* Build configuration list for PBXNativeTarget "squishpng" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1342B4140999DE9F00152915 /* Debug */, + 1342B4150999DE9F00152915 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1342B43B0999E0C000152915 /* Build configuration list for PBXNativeTarget "squishtest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1342B43C0999E0C000152915 /* Debug */, + 1342B43D0999E0C000152915 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 139C21CB09ADAB0300A2500D /* Build configuration list for PBXNativeTarget "squishgen" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 139C21CC09ADAB0300A2500D /* Debug */, + 139C21CD09ADAB0300A2500D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "squish" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91EC08733DB70010E9CD /* Debug */, + 1DEB91ED08733DB70010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "squish" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91F008733DB70010E9CD /* Debug */, + 1DEB91F108733DB70010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/externals/NVTT/src/nvtt/squish/texture_compression_s3tc.txt b/externals/NVTT/src/nvtt/squish/texture_compression_s3tc.txt new file mode 100644 index 00000000..f229cf36 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/texture_compression_s3tc.txt @@ -0,0 +1,508 @@ +Name + + EXT_texture_compression_s3tc + +Name Strings + + GL_EXT_texture_compression_s3tc + +Contact + + Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com) + +Status + + FINAL + +Version + + 1.1, 16 November 2001 (containing only clarifications relative to + version 1.0, dated 7 July 2000) + +Number + + 198 + +Dependencies + + OpenGL 1.1 is required. + + GL_ARB_texture_compression is required. + + This extension is written against the OpenGL 1.2.1 Specification. + +Overview + + This extension provides additional texture compression functionality + specific to S3's S3TC format (called DXTC in Microsoft's DirectX API), + subject to all the requirements and limitations described by the extension + GL_ARB_texture_compression. + + This extension supports DXT1, DXT3, and DXT5 texture compression formats. + For the DXT1 image format, this specification supports an RGB-only mode + and a special RGBA mode with single-bit "transparent" alpha. + +IP Status + + Contact S3 Incorporated (http://www.s3.com) regarding any intellectual + property issues associated with implementing this extension. + + WARNING: Vendors able to support S3TC texture compression in Direct3D + drivers do not necessarily have the right to use the same functionality in + OpenGL. + +Issues + + (1) Should DXT2 and DXT4 (premultiplied alpha) formats be supported? + + RESOLVED: No -- insufficient interest. Supporting DXT2 and DXT4 + would require some rework to the TexEnv definition (maybe add a new + base internal format RGBA_PREMULTIPLIED_ALPHA) for these formats. + Note that the EXT_texture_env_combine extension (which extends normal + TexEnv modes) can be used to support textures with premultipled alpha. + + (2) Should generic "RGB_S3TC_EXT" and "RGBA_S3TC_EXT" enums be supported + or should we use only the DXT enums? + + RESOLVED: No. A generic RGBA_S3TC_EXT is problematic because DXT3 + and DXT5 are both nominally RGBA (and DXT1 with the 1-bit alpha is + also) yet one format must be chosen up front. + + (3) Should TexSubImage support all block-aligned edits or just the minimal + functionality required by the ARB_texture_compression extension? + + RESOLVED: Allow all valid block-aligned edits. + + (4) A pre-compressed image with a DXT1 format can be used as either an + RGB_S3TC_DXT1 or an RGBA_S3TC_DXT1 image. If the image has + transparent texels, how are they treated in each format? + + RESOLVED: The renderer has to make sure that an RGB_S3TC_DXT1 format + is decoded as RGB (where alpha is effectively one for all texels), + while RGBA_S3TC_DXT1 is decoded as RGBA (where alpha is zero for all + texels with "transparent" encodings). Otherwise, the formats are + identical. + + (5) Is the encoding of the RGB components for DXT1 formats correct in this + spec? MSDN documentation does not specify an RGB color for the + "transparent" encoding. Is it really black? + + RESOLVED: Yes. The specification for the DXT1 format initially + required black, but later changed that requirement to a + recommendation. All vendors involved in the definition of this + specification support black. In addition, specifying black has a + useful behavior. + + When blending multiple texels (GL_LINEAR filtering), mixing opaque and + transparent samples is problematic. Defining a black color on + transparent texels achieves a sensible result that works like a + texture with premultiplied alpha. For example, if three opaque white + and one transparent sample is being averaged, the result would be a + 75% intensity gray (with an alpha of 75%). This is the same result on + the color channels as would be obtained using a white color, 75% + alpha, and a SRC_ALPHA blend factor. + + (6) Is the encoding of the RGB components for DXT3 and DXT5 formats + correct in this spec? MSDN documentation suggests that the RGB blocks + for DXT3 and DXT5 are decoded as described by the DXT1 format. + + RESOLVED: Yes -- this appears to be a bug in the MSDN documentation. + The specification for the DXT2-DXT5 formats require decoding using the + opaque block encoding, regardless of the relative values of "color0" + and "color1". + +New Procedures and Functions + + None. + +New Tokens + + Accepted by the parameter of TexImage2D, CopyTexImage2D, + and CompressedTexImage2DARB and the parameter of + CompressedTexSubImage2DARB: + + COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 + COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 + COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 + COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) + + None. + +Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) + + Add to Table 3.16.1: Specific Compressed Internal Formats + + Compressed Internal Format Base Internal Format + ========================== ==================== + COMPRESSED_RGB_S3TC_DXT1_EXT RGB + COMPRESSED_RGBA_S3TC_DXT1_EXT RGBA + COMPRESSED_RGBA_S3TC_DXT3_EXT RGBA + COMPRESSED_RGBA_S3TC_DXT5_EXT RGBA + + + Modify Section 3.8.2, Alternate Image Specification + + (add to end of TexSubImage discussion, p.123 -- after edit from the + ARB_texture_compression spec) + + If the internal format of the texture image being modified is + COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT, the + texture is stored using one of the several S3TC compressed texture image + formats. Such images are easily edited along 4x4 texel boundaries, so the + limitations on TexSubImage2D or CopyTexSubImage2D parameters are relaxed. + TexSubImage2D and CopyTexSubImage2D will result in an INVALID_OPERATION + error only if one of the following conditions occurs: + + * is not a multiple of four or equal to TEXTURE_WIDTH, + unless and are both zero. + * is not a multiple of four or equal to TEXTURE_HEIGHT, + unless and are both zero. + * or is not a multiple of four. + + The contents of any 4x4 block of texels of an S3TC compressed texture + image that does not intersect the area being modified are preserved during + valid TexSubImage2D and CopyTexSubImage2D calls. + + + Add to Section 3.8.2, Alternate Image Specification (adding to the end of + the CompressedTexImage section introduced by the ARB_texture_compression + spec) + + If is COMPRESSED_RGB_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or + COMPRESSED_RGBA_S3TC_DXT5_EXT, the compressed texture is stored using one + of several S3TC compressed texture image formats. The S3TC texture + compression algorithm supports only 2D images without borders. + CompressedTexImage1DARB and CompressedTexImage3DARB produce an + INVALID_ENUM error if is an S3TC format. + CompressedTexImage2DARB will produce an INVALID_OPERATION error if + is non-zero. + + + Add to Section 3.8.2, Alternate Image Specification (adding to the end of + the CompressedTexSubImage section introduced by the + ARB_texture_compression spec) + + If the internal format of the texture image being modified is + COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT, the + texture is stored using one of the several S3TC compressed texture image + formats. Since the S3TC texture compression algorithm supports only 2D + images, CompressedTexSubImage1DARB and CompressedTexSubImage3DARB produce + an INVALID_ENUM error if is an S3TC format. Since S3TC images + are easily edited along 4x4 texel boundaries, the limitations on + CompressedTexSubImage2D are relaxed. CompressedTexSubImage2D will result + in an INVALID_OPERATION error only if one of the following conditions + occurs: + + * is not a multiple of four or equal to TEXTURE_WIDTH. + * is not a multiple of four or equal to TEXTURE_HEIGHT. + * or is not a multiple of four. + + The contents of any 4x4 block of texels of an S3TC compressed texture + image that does not intersect the area being modified are preserved during + valid TexSubImage2D and CopyTexSubImage2D calls. + +Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment +Operations and the Frame Buffer) + + None. + +Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) + + None. + +Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and +State Requests) + + None. + +Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) + + None. + +Additions to the AGL/GLX/WGL Specifications + + None. + +GLX Protocol + + None. + +Errors + + INVALID_ENUM is generated by CompressedTexImage1DARB or + CompressedTexImage3DARB if is + COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT. + + INVALID_OPERATION is generated by CompressedTexImage2DARB if + is COMPRESSED_RGB_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or + COMPRESSED_RGBA_S3TC_DXT5_EXT and is not equal to zero. + + INVALID_ENUM is generated by CompressedTexSubImage1DARB or + CompressedTexSubImage3DARB if is COMPRESSED_RGB_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, or + COMPRESSED_RGBA_S3TC_DXT5_EXT. + + INVALID_OPERATION is generated by TexSubImage2D CopyTexSubImage2D, or + CompressedTexSubImage2D if TEXTURE_INTERNAL_FORMAT is + COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, + COMPRESSED_RGBA_S3TC_DXT3_EXT, or COMPRESSED_RGBA_S3TC_DXT5_EXT and any of + the following apply: is not a multiple of four or equal to + TEXTURE_WIDTH; is not a multiple of four or equal to + TEXTURE_HEIGHT; or is not a multiple of four. + + + The following restrictions from the ARB_texture_compression specification + do not apply to S3TC texture formats, since subimage modification is + straightforward as long as the subimage is properly aligned. + + DELETE: INVALID_OPERATION is generated by TexSubImage1D, TexSubImage2D, + DELETE: TexSubImage3D, CopyTexSubImage1D, CopyTexSubImage2D, or + DELETE: CopyTexSubImage3D if the internal format of the texture image is + DELETE: compressed and , , or does not equal + DELETE: -b, where b is value of TEXTURE_BORDER. + + DELETE: INVALID_VALUE is generated by CompressedTexSubImage1DARB, + DELETE: CompressedTexSubImage2DARB, or CompressedTexSubImage3DARB if the + DELETE: entire texture image is not being edited: if , + DELETE: , or is greater than -b, + is + DELETE: less than w+b, + is less than h+b, or + DELETE: + is less than d+b, where b is the value of + DELETE: TEXTURE_BORDER, w is the value of TEXTURE_WIDTH, h is the value of + DELETE: TEXTURE_HEIGHT, and d is the value of TEXTURE_DEPTH. + + See also errors in the GL_ARB_texture_compression specification. + +New State + + In the "Textures" state table, increment the TEXTURE_INTERNAL_FORMAT + subscript for Z by 4 in the "Type" row. + +New Implementation Dependent State + + None + +Appendix + + S3TC Compressed Texture Image Formats + + Compressed texture images stored using the S3TC compressed image formats + are represented as a collection of 4x4 texel blocks, where each block + contains 64 or 128 bits of texel data. The image is encoded as a normal + 2D raster image in which each 4x4 block is treated as a single pixel. If + an S3TC image has a width or height less than four, the data corresponding + to texels outside the image are irrelevant and undefined. + + When an S3TC image with a width of , height of , and block size of + (8 or 16 bytes) is decoded, the corresponding image size (in + bytes) is: + + ceil(/4) * ceil(/4) * blocksize. + + When decoding an S3TC image, the block containing the texel at offset + (, ) begins at an offset (in bytes) relative to the base of the + image of: + + blocksize * (ceil(/4) * floor(/4) + floor(/4)). + + The data corresponding to a specific texel (, ) are extracted from a + 4x4 texel block using a relative (x,y) value of + + ( modulo 4, modulo 4). + + There are four distinct S3TC image formats: + + COMPRESSED_RGB_S3TC_DXT1_EXT: Each 4x4 block of texels consists of 64 + bits of RGB image data. + + Each RGB image data block is encoded as a sequence of 8 bytes, called (in + order of increasing address): + + c0_lo, c0_hi, c1_lo, c1_hi, bits_0, bits_1, bits_2, bits_3 + + The 8 bytes of the block are decoded into three quantities: + + color0 = c0_lo + c0_hi * 256 + color1 = c1_lo + c1_hi * 256 + bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * bits_3)) + + color0 and color1 are 16-bit unsigned integers that are unpacked to + RGB colors RGB0 and RGB1 as though they were 16-bit packed pixels with + a of RGB and a type of UNSIGNED_SHORT_5_6_5. + + bits is a 32-bit unsigned integer, from which a two-bit control code + is extracted for a texel at location (x,y) in the block using: + + code(x,y) = bits[2*(4*y+x)+1..2*(4*y+x)+0] + + where bit 31 is the most significant and bit 0 is the least + significant bit. + + The RGB color for a texel at location (x,y) in the block is given by: + + RGB0, if color0 > color1 and code(x,y) == 0 + RGB1, if color0 > color1 and code(x,y) == 1 + (2*RGB0+RGB1)/3, if color0 > color1 and code(x,y) == 2 + (RGB0+2*RGB1)/3, if color0 > color1 and code(x,y) == 3 + + RGB0, if color0 <= color1 and code(x,y) == 0 + RGB1, if color0 <= color1 and code(x,y) == 1 + (RGB0+RGB1)/2, if color0 <= color1 and code(x,y) == 2 + BLACK, if color0 <= color1 and code(x,y) == 3 + + Arithmetic operations are done per component, and BLACK refers to an + RGB color where red, green, and blue are all zero. + + Since this image has an RGB format, there is no alpha component and the + image is considered fully opaque. + + + COMPRESSED_RGBA_S3TC_DXT1_EXT: Each 4x4 block of texels consists of 64 + bits of RGB image data and minimal alpha information. The RGB components + of a texel are extracted in the same way as COMPRESSED_RGB_S3TC_DXT1_EXT. + + The alpha component for a texel at location (x,y) in the block is + given by: + + 0.0, if color0 <= color1 and code(x,y) == 3 + 1.0, otherwise + + IMPORTANT: When encoding an RGBA image into a format using 1-bit + alpha, any texels with an alpha component less than 0.5 end up with an + alpha of 0.0 and any texels with an alpha component greater than or + equal to 0.5 end up with an alpha of 1.0. When encoding an RGBA image + into the COMPRESSED_RGBA_S3TC_DXT1_EXT format, the resulting red, + green, and blue components of any texels with a final alpha of 0.0 + will automatically be zero (black). If this behavior is not desired + by an application, it should not use COMPRESSED_RGBA_S3TC_DXT1_EXT. + This format will never be used when a generic compressed internal + format (Table 3.16.2) is specified, although the nearly identical + format COMPRESSED_RGB_S3TC_DXT1_EXT (above) may be. + + + COMPRESSED_RGBA_S3TC_DXT3_EXT: Each 4x4 block of texels consists of 64 + bits of uncompressed alpha image data followed by 64 bits of RGB image + data. + + Each RGB image data block is encoded according to the + COMPRESSED_RGB_S3TC_DXT1_EXT format, with the exception that the two code + bits always use the non-transparent encodings. In other words, they are + treated as though color0 > color1, regardless of the actual values of + color0 and color1. + + Each alpha image data block is encoded as a sequence of 8 bytes, called + (in order of increasing address): + + a0, a1, a2, a3, a4, a5, a6, a7 + + The 8 bytes of the block are decoded into one 64-bit integer: + + alpha = a0 + 256 * (a1 + 256 * (a2 + 256 * (a3 + 256 * (a4 + + 256 * (a5 + 256 * (a6 + 256 * a7)))))) + + alpha is a 64-bit unsigned integer, from which a four-bit alpha value + is extracted for a texel at location (x,y) in the block using: + + alpha(x,y) = bits[4*(4*y+x)+3..4*(4*y+x)+0] + + where bit 63 is the most significant and bit 0 is the least + significant bit. + + The alpha component for a texel at location (x,y) in the block is + given by alpha(x,y) / 15. + + + COMPRESSED_RGBA_S3TC_DXT5_EXT: Each 4x4 block of texels consists of 64 + bits of compressed alpha image data followed by 64 bits of RGB image data. + + Each RGB image data block is encoded according to the + COMPRESSED_RGB_S3TC_DXT1_EXT format, with the exception that the two code + bits always use the non-transparent encodings. In other words, they are + treated as though color0 > color1, regardless of the actual values of + color0 and color1. + + Each alpha image data block is encoded as a sequence of 8 bytes, called + (in order of increasing address): + + alpha0, alpha1, bits_0, bits_1, bits_2, bits_3, bits_4, bits_5 + + The alpha0 and alpha1 are 8-bit unsigned bytes converted to alpha + components by multiplying by 1/255. + + The 6 "bits" bytes of the block are decoded into one 48-bit integer: + + bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * (bits_3 + + 256 * (bits_4 + 256 * bits_5)))) + + bits is a 48-bit unsigned integer, from which a three-bit control code + is extracted for a texel at location (x,y) in the block using: + + code(x,y) = bits[3*(4*y+x)+1..3*(4*y+x)+0] + + where bit 47 is the most significant and bit 0 is the least + significant bit. + + The alpha component for a texel at location (x,y) in the block is + given by: + + alpha0, code(x,y) == 0 + alpha1, code(x,y) == 1 + + (6*alpha0 + 1*alpha1)/7, alpha0 > alpha1 and code(x,y) == 2 + (5*alpha0 + 2*alpha1)/7, alpha0 > alpha1 and code(x,y) == 3 + (4*alpha0 + 3*alpha1)/7, alpha0 > alpha1 and code(x,y) == 4 + (3*alpha0 + 4*alpha1)/7, alpha0 > alpha1 and code(x,y) == 5 + (2*alpha0 + 5*alpha1)/7, alpha0 > alpha1 and code(x,y) == 6 + (1*alpha0 + 6*alpha1)/7, alpha0 > alpha1 and code(x,y) == 7 + + (4*alpha0 + 1*alpha1)/5, alpha0 <= alpha1 and code(x,y) == 2 + (3*alpha0 + 2*alpha1)/5, alpha0 <= alpha1 and code(x,y) == 3 + (2*alpha0 + 3*alpha1)/5, alpha0 <= alpha1 and code(x,y) == 4 + (1*alpha0 + 4*alpha1)/5, alpha0 <= alpha1 and code(x,y) == 5 + 0.0, alpha0 <= alpha1 and code(x,y) == 6 + 1.0, alpha0 <= alpha1 and code(x,y) == 7 + + +Revision History + + 1.1, 11/16/01 pbrown: Updated contact info, clarified where texels + fall within a single block. + + 1.0, 07/07/00 prbrown1: Published final version agreed to by working + group members. + + 0.9, 06/24/00 prbrown1: Documented that block-aligned TexSubImage calls + do not modify existing texels outside the + modified blocks. Added caveat to allow for a + (0,0)-anchored TexSubImage operation of + arbitrary size. + + 0.7, 04/11/00 prbrown1: Added issues on DXT1, DXT3, and DXT5 encodings + where the MSDN documentation doesn't match what + is really done. Added enum values from the + extension registry. + + 0.4, 03/28/00 prbrown1: Updated to reflect final version of the + ARB_texture_compression extension. Allowed + block-aligned TexSubImage calls. + + 0.3, 03/07/00 prbrown1: Resolved issues pertaining to the format of RGB + blocks in the DXT3 and DXT5 formats (they don't + ever use the "transparent" encoding). Fixed + decoding of DXT1 blocks. Pointed out issue of + "transparent" texels in DXT1 encodings having + different behaviors for RGB and RGBA internal + formats. + + 0.2, 02/23/00 prbrown1: Minor revisions; added several issues. + + 0.11, 02/17/00 prbrown1: Slight modification to error semantics + (INVALID_ENUM instead of INVALID_OPERATION). + + 0.1, 02/15/00 prbrown1: Initial revision. diff --git a/externals/NVTT/src/nvtt/squish/weightedclusterfit.cpp b/externals/NVTT/src/nvtt/squish/weightedclusterfit.cpp new file mode 100644 index 00000000..d200f157 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/weightedclusterfit.cpp @@ -0,0 +1,593 @@ +/* ----------------------------------------------------------------------------- + +Copyright (c) 2006 Simon Brown si@sjbrown.co.uk +Copyright (c) 2006 Ignacio Castano icastano@nvidia.com + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------------------------------------------------------------------- */ + +#include "weightedclusterfit.h" +#include "colourset.h" +#include "colourblock.h" +#include + + +namespace squish { + + WeightedClusterFit::WeightedClusterFit() + { + } + + void WeightedClusterFit::SetColourSet( ColourSet const* colours, int flags ) + { + ColourFit::SetColourSet( colours, flags ); + + // initialise the best error +#if SQUISH_USE_SIMD + m_besterror = VEC4_CONST( FLT_MAX ); + Vec3 metric = m_metric.GetVec3(); +#else + m_besterror = FLT_MAX; + Vec3 metric = m_metric; +#endif + + // cache some values + int const count = m_colours->GetCount(); + Vec3 const* values = m_colours->GetPoints(); + + // get the covariance matrix + Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights(), metric ); + + // compute the principle component + Vec3 principle = ComputePrincipleComponent( covariance ); + + // build the list of values + float dps[16]; + for( int i = 0; i < count; ++i ) + { + dps[i] = Dot( values[i], principle ); + m_order[i] = i; + } + + // stable sort + for( int i = 0; i < count; ++i ) + { + for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j ) + { + std::swap( dps[j], dps[j - 1] ); + std::swap( m_order[j], m_order[j - 1] ); + } + } + + // weight all the points +#if SQUISH_USE_SIMD + Vec4 const* unweighted = m_colours->GetPointsSimd(); + Vec4 const* weights = m_colours->GetWeightsSimd(); + m_xxsum = VEC4_CONST( 0.0f ); + m_xsum = VEC4_CONST( 0.0f ); +#else + Vec3 const* unweighted = m_colours->GetPoints(); + float const* weights = m_colours->GetWeights(); + m_xxsum = Vec3( 0.0f ); + m_xsum = Vec3( 0.0f ); + m_wsum = 0.0f; +#endif + + for( int i = 0; i < count; ++i ) + { + int p = m_order[i]; + m_weighted[i] = weights[p] * unweighted[p]; + m_xxsum += m_weighted[i] * m_weighted[i]; + m_xsum += m_weighted[i]; +#if !SQUISH_USE_SIMD + m_weights[i] = weights[p]; + m_wsum += m_weights[i]; +#endif + } + } + + + void WeightedClusterFit::SetMetric(float r, float g, float b) + { +#if SQUISH_USE_SIMD + m_metric = Vec4(r, g, b, 0); +#else + m_metric = Vec3(r, g, b); +#endif + m_metricSqr = m_metric * m_metric; + } + + float WeightedClusterFit::GetBestError() const + { +#if SQUISH_USE_SIMD + Vec4 x = m_xxsum * m_metricSqr; + Vec4 error = m_besterror + x.SplatX() + x.SplatY() + x.SplatZ(); + return error.GetVec3().X(); +#else + return m_besterror + Dot(m_xxsum, m_metricSqr); +#endif + + } + +#if SQUISH_USE_SIMD + + void WeightedClusterFit::Compress3( void* block ) + { + int const count = m_colours->GetCount(); + Vec4 const one = VEC4_CONST(1.0f); + Vec4 const zero = VEC4_CONST(0.0f); + Vec4 const half(0.5f, 0.5f, 0.5f, 0.25f); + Vec4 const two = VEC4_CONST(2.0); + Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f ); + Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f ); + + // declare variables + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = VEC4_CONST( FLT_MAX ); + + Vec4 x0 = zero; + + int b0 = 0, b1 = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= count; c0++) + { + Vec4 x1 = zero; + + for( int c1 = 0; c1 <= count-c0; c1++) + { + Vec4 const x2 = m_xsum - x1 - x0; + + //Vec3 const alphax_sum = x0 + x1 * 0.5f; + //float const alpha2_sum = w0 + w1 * 0.25f; + Vec4 const alphax_sum = MultiplyAdd(x1, half, x0); // alphax_sum, alpha2_sum + Vec4 const alpha2_sum = alphax_sum.SplatW(); + + //Vec3 const betax_sum = x2 + x1 * 0.5f; + //float const beta2_sum = w2 + w1 * 0.25f; + Vec4 const betax_sum = MultiplyAdd(x1, half, x2); // betax_sum, beta2_sum + Vec4 const beta2_sum = betax_sum.SplatW(); + + //float const alphabeta_sum = w1 * 0.25f; + Vec4 const alphabeta_sum = (x1 * half).SplatW(); // alphabeta_sum + + // float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + Vec4 const factor = Reciprocal( NegativeMultiplySubtract(alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum) ); + + Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor; + Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor; + + // clamp to the grid + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp; + b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp; + + // compute the error (we skip the constant xxsum) + Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum ); + Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum ); + Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 ); + Vec4 e4 = MultiplyAdd( two, e3, e1 ); + + // apply the metric to the error term + Vec4 e5 = e4 * m_metricSqr; + Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ(); + + // keep the solution if it wins + if( CompareAnyLessThan( error, besterror ) ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + } + + x1 += m_weighted[c0+c1]; + } + + x0 += m_weighted[c0]; + } + + // save the block if necessary + if( CompareAnyLessThan( besterror, m_besterror ) ) + { + // compute indices from cluster sizes. + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < count; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < count; ++i ) + ordered[m_order[i]] = bestindices[i]; + + m_colours->RemapIndices( ordered, bestindices ); + + + // save the block + WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block ); + + // save the error + m_besterror = besterror; + } + } + + void WeightedClusterFit::Compress4( void* block ) + { + int const count = m_colours->GetCount(); + Vec4 const one = VEC4_CONST(1.0f); + Vec4 const zero = VEC4_CONST(0.0f); + Vec4 const half = VEC4_CONST(0.5f); + Vec4 const two = VEC4_CONST(2.0); + Vec4 const onethird( 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 1.0f/9.0f ); + Vec4 const twothirds( 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f, 4.0f/9.0f ); + Vec4 const twonineths = VEC4_CONST( 2.0f/9.0f ); + Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f ); + Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f ); + + // declare variables + Vec4 beststart = VEC4_CONST( 0.0f ); + Vec4 bestend = VEC4_CONST( 0.0f ); + Vec4 besterror = VEC4_CONST( FLT_MAX ); + + Vec4 x0 = zero; + int b0 = 0, b1 = 0, b2 = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= count; c0++) + { + Vec4 x1 = zero; + + for( int c1 = 0; c1 <= count-c0; c1++) + { + Vec4 x2 = zero; + + for( int c2 = 0; c2 <= count-c0-c1; c2++) + { + Vec4 const x3 = m_xsum - x2 - x1 - x0; + + //Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f); + //float const alpha2_sum = w0 + w1 * (4.0f/9.0f) + w2 * (1.0f/9.0f); + Vec4 const alphax_sum = MultiplyAdd(x2, onethird, MultiplyAdd(x1, twothirds, x0)); // alphax_sum, alpha2_sum + Vec4 const alpha2_sum = alphax_sum.SplatW(); + + //Vec3 const betax_sum = x3 + x2 * (2.0f / 3.0f) + x1 * (1.0f / 3.0f); + //float const beta2_sum = w3 + w2 * (4.0f/9.0f) + w1 * (1.0f/9.0f); + Vec4 const betax_sum = MultiplyAdd(x2, twothirds, MultiplyAdd(x1, onethird, x3)); // betax_sum, beta2_sum + Vec4 const beta2_sum = betax_sum.SplatW(); + + //float const alphabeta_sum = (w1 + w2) * (2.0f/9.0f); + Vec4 const alphabeta_sum = twonineths*( x1 + x2 ).SplatW(); // alphabeta_sum + + // float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + Vec4 const factor = Reciprocal( NegativeMultiplySubtract(alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum) ); + + Vec4 a = NegativeMultiplySubtract(betax_sum, alphabeta_sum, alphax_sum*beta2_sum) * factor; + Vec4 b = NegativeMultiplySubtract(alphax_sum, alphabeta_sum, betax_sum*alpha2_sum) * factor; + + // clamp to the grid + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + a = Truncate( MultiplyAdd( grid, a, half ) ) * gridrcp; + b = Truncate( MultiplyAdd( grid, b, half ) ) * gridrcp; + + // compute the error (we skip the constant xxsum) + Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum ); + Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum ); + Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 ); + Vec4 e4 = MultiplyAdd( two, e3, e1 ); + + // apply the metric to the error term + Vec4 e5 = e4 * m_metricSqr; + Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ(); + + // keep the solution if it wins + if( CompareAnyLessThan( error, besterror ) ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + b2 = c2; + } + + x2 += m_weighted[c0+c1+c2]; + } + + x1 += m_weighted[c0+c1]; + } + + x0 += m_weighted[c0]; + } + + // save the block if necessary + if( CompareAnyLessThan( besterror, m_besterror ) ) + { + // compute indices from cluster sizes. + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < b0+b1+b2; i++) { + bestindices[i] = 3; + } + for(; i < count; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < count; ++i ) + ordered[m_order[i]] = bestindices[i]; + + m_colours->RemapIndices( ordered, bestindices ); + + // save the block + WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block ); + + // save the error + m_besterror = besterror; + } + } + +#else + + void WeightedClusterFit::Compress3( void* block ) + { + int const count = m_colours->GetCount(); + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + Vec3 const half( 0.5f ); + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f ); + + // declare variables + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = FLT_MAX; + + Vec3 x0(0.0f); + float w0 = 0.0f; + + int b0 = 0, b1 = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= count; c0++) + { + Vec3 x1(0.0f); + float w1 = 0.0f; + + for( int c1 = 0; c1 <= count-c0; c1++) + { + float w2 = m_wsum - w0 - w1; + + // These factors could be entirely precomputed. + float const alpha2_sum = w0 + w1 * 0.25f; + float const beta2_sum = w2 + w1 * 0.25f; + float const alphabeta_sum = w1 * 0.25f; + float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + Vec3 const alphax_sum = x0 + x1 * 0.5f; + Vec3 const betax_sum = m_xsum - alphax_sum; + + Vec3 a = (alphax_sum*beta2_sum - betax_sum*alphabeta_sum) * factor; + Vec3 b = (betax_sum*alpha2_sum - alphax_sum*alphabeta_sum) * factor; + + // clamp to the grid + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + a = Floor( grid*a + half )*gridrcp; + b = Floor( grid*b + half )*gridrcp; + + // compute the error + Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum ); + + // apply the metric to the error term + float error = Dot( e1, m_metricSqr ); + + // keep the solution if it wins + if( error < besterror ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + } + + x1 += m_weighted[c0+c1]; + w1 += m_weights[c0+c1]; + } + + x0 += m_weighted[c0]; + w0 += m_weights[c0]; + } + + // save the block if necessary + if( besterror < m_besterror ) + { + // compute indices from cluster sizes. + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < count; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < count; ++i ) + ordered[m_order[i]] = bestindices[i]; + + m_colours->RemapIndices( ordered, bestindices ); + + // save the block + WriteColourBlock3( beststart, bestend, bestindices, block ); + + // save the error + m_besterror = besterror; + } + } + + void WeightedClusterFit::Compress4( void* block ) + { + int const count = m_colours->GetCount(); + Vec3 const one( 1.0f ); + Vec3 const zero( 0.0f ); + Vec3 const half( 0.5f ); + Vec3 const grid( 31.0f, 63.0f, 31.0f ); + Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f ); + + // declare variables + Vec3 beststart( 0.0f ); + Vec3 bestend( 0.0f ); + float besterror = FLT_MAX; + + Vec3 x0(0.0f); + float w0 = 0.0f; + int b0 = 0, b1 = 0, b2 = 0; + + // check all possible clusters for this total order + for( int c0 = 0; c0 <= count; c0++) + { + Vec3 x1(0.0f); + float w1 = 0.0f; + + for( int c1 = 0; c1 <= count-c0; c1++) + { + Vec3 x2(0.0f); + float w2 = 0.0f; + + for( int c2 = 0; c2 <= count-c0-c1; c2++) + { + float w3 = m_wsum - w0 - w1 - w2; + + float const alpha2_sum = w0 + w1 * (4.0f/9.0f) + w2 * (1.0f/9.0f); + float const beta2_sum = w3 + w2 * (4.0f/9.0f) + w1 * (1.0f/9.0f); + float const alphabeta_sum = (w1 + w2) * (2.0f/9.0f); + float const factor = 1.0f / (alpha2_sum * beta2_sum - alphabeta_sum * alphabeta_sum); + + Vec3 const alphax_sum = x0 + x1 * (2.0f / 3.0f) + x2 * (1.0f / 3.0f); + Vec3 const betax_sum = m_xsum - alphax_sum; + + Vec3 a = ( alphax_sum*beta2_sum - betax_sum*alphabeta_sum )*factor; + Vec3 b = ( betax_sum*alpha2_sum - alphax_sum*alphabeta_sum )*factor; + + // clamp to the grid + a = Min( one, Max( zero, a ) ); + b = Min( one, Max( zero, b ) ); + a = Floor( grid*a + half )*gridrcp; + b = Floor( grid*b + half )*gridrcp; + + // compute the error + Vec3 e1 = a*a*alpha2_sum + b*b*beta2_sum + 2.0f*( a*b*alphabeta_sum - a*alphax_sum - b*betax_sum ); + + // apply the metric to the error term + float error = Dot( e1, m_metricSqr ); + + // keep the solution if it wins + if( error < besterror ) + { + besterror = error; + beststart = a; + bestend = b; + b0 = c0; + b1 = c1; + b2 = c2; + } + + x2 += m_weighted[c0+c1+c2]; + w2 += m_weights[c0+c1+c2]; + } + + x1 += m_weighted[c0+c1]; + w1 += m_weights[c0+c1]; + } + + x0 += m_weighted[c0]; + w0 += m_weights[c0]; + } + + // save the block if necessary + if( besterror < m_besterror ) + { + // compute indices from cluster sizes. + u8 bestindices[16]; + { + int i = 0; + for(; i < b0; i++) { + bestindices[i] = 0; + } + for(; i < b0+b1; i++) { + bestindices[i] = 2; + } + for(; i < b0+b1+b2; i++) { + bestindices[i] = 3; + } + for(; i < count; i++) { + bestindices[i] = 1; + } + } + + // remap the indices + u8 ordered[16]; + for( int i = 0; i < count; ++i ) + ordered[m_order[i]] = bestindices[i]; + + m_colours->RemapIndices( ordered, bestindices ); + + // save the block + WriteColourBlock4( beststart, bestend, bestindices, block ); + + // save the error + m_besterror = besterror; + } + } + +#endif + +} // namespace squish diff --git a/externals/NVTT/src/nvtt/squish/weightedclusterfit.h b/externals/NVTT/src/nvtt/squish/weightedclusterfit.h new file mode 100644 index 00000000..a8f6eea2 --- /dev/null +++ b/externals/NVTT/src/nvtt/squish/weightedclusterfit.h @@ -0,0 +1,78 @@ +/* ----------------------------------------------------------------------------- + + Copyright (c) 2006 Simon Brown si@sjbrown.co.uk + Copyright (c) 2006 Ignacio Castano icastano@nvidia.com + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + -------------------------------------------------------------------------- */ + +#ifndef SQUISH_WEIGHTEDCLUSTERFIT_H +#define SQUISH_WEIGHTEDCLUSTERFIT_H + +#include "squish.h" +#include "maths.h" +#include "simd.h" +#include "colourfit.h" + +namespace squish { + +class WeightedClusterFit : public ColourFit +{ +public: + WeightedClusterFit(); + + void SetColourSet( ColourSet const* colours, int flags ); + + void SetMetric(float r, float g, float b); + float GetBestError() const; + + // Make them public + virtual void Compress3( void* block ); + virtual void Compress4( void* block ); + +private: + + Vec3 m_principle; + +#if SQUISH_USE_SIMD + Vec4 m_weighted[16]; + Vec4 m_metric; + Vec4 m_metricSqr; + Vec4 m_xxsum; + Vec4 m_xsum; + Vec4 m_besterror; +#else + Vec3 m_weighted[16]; + float m_weights[16]; + Vec3 m_metric; + Vec3 m_metricSqr; + Vec3 m_xxsum; + Vec3 m_xsum; + float m_wsum; + float m_besterror; +#endif + + int m_order[16]; +}; + +} // namespace squish + +#endif // ndef SQUISH_WEIGHTEDCLUSTERFIT_H diff --git a/externals/NVTT/src/nvtt/tests/ctest.c b/externals/NVTT/src/nvtt/tests/ctest.c new file mode 100644 index 00000000..a2006410 --- /dev/null +++ b/externals/NVTT/src/nvtt/tests/ctest.c @@ -0,0 +1,35 @@ + +#include + +#include + + +int main(void) +{ + NvttInputOptions inputOptions = 0; + NvttOutputOptions outputOptions = 0; + NvttCompressionOptions compressionOptions = 0; + + const unsigned int img[16*16]; + + memset(img, 0, sizeof(unsigned int) * 16 * 16); + + inputOptions = nvttCreateInputOptions(); + nvttSetInputOptionsTextureLayout(inputOptions, NVTT_TextureType_2D, 16, 16, 1); + nvttSetInputOptionsMipmapData(inputOptions, img, 16, 16, 1, 0, 0); + + outputOptions = nvttCreateOutputOptions(); + nvttSetOutputOptionsFileName(outputOptions, "output.dds"); + + compressionOptions = nvttCreateCompressionOptions(); + nvttSetCompressionOptionsFormat(compressionOptions, NVTT_Format_BC1); + + nvttCompress(inputOptions, outputOptions, compressionOptions); + + nvttDestroyCompressionOptions(compressionOptions); + nvttDestroyOutputOptions(outputOptions); + nvttDestroyInputOptions(inputOptions); + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tests/filtertest.cpp b/externals/NVTT/src/nvtt/tests/filtertest.cpp new file mode 100644 index 00000000..2cb99e09 --- /dev/null +++ b/externals/NVTT/src/nvtt/tests/filtertest.cpp @@ -0,0 +1,80 @@ + +#include +#include "../tools/cmdline.h" + +#include + +using namespace nv; + +int main(void) +{ +// MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + BoxFilter box1(0.5); + Kernel1 k1(box1, 2); + k1.debugPrint(); nvDebug("\n"); + + BoxFilter box2(1); + Kernel1 k2(box2, 2); + k2.debugPrint(); nvDebug("\n"); + + BoxFilter boxr3(1); + Kernel1 k3(boxr3, 2); + k3.debugPrint(); nvDebug("\n"); + + KaiserFilter kai4(5); + kai4.setParameters(4, 2); + Kernel1 k4(kai4, 2); + k4.debugPrint(); nvDebug("\n"); + +/* Kernel1 k3(3); + Kernel1 k4(9); + Kernel1 k5(10); + +// k3.initFilter(Filter::Box); +// k4.initFilter(Filter::Box); +// k5.initFilter(Filter::Box); + +// nvDebug("Box Filter:\n"); +// k3.debugPrint(); nvDebug("\n"); +// k4.debugPrint(); nvDebug("\n"); +// k5.debugPrint(); nvDebug("\n"); + + k3.initSinc(0.75); + k4.initSinc(0.75); + k5.initSinc(0.75); + + nvDebug("Sinc Filter:\n"); + k3.debugPrint(); nvDebug("\n"); + k4.debugPrint(); nvDebug("\n"); + k5.debugPrint(); nvDebug("\n"); + + k3.initKaiser(4, 1, 100); + k4.initKaiser(4, 1, 100); + k5.initKaiser(4, 1, 100); + + nvDebug("Kaiser Filter:\n"); + k3.debugPrint(); nvDebug("\n"); + k4.debugPrint(); nvDebug("\n"); + k5.debugPrint(); nvDebug("\n"); + + k3.initKaiser(4, 1, 10); + k4.initKaiser(4, 1, 10); + k5.initKaiser(4, 1, 10); + + nvDebug("Kaiser Filter 2:\n"); + k3.debugPrint(); nvDebug("\n"); + k4.debugPrint(); nvDebug("\n"); + k5.debugPrint(); nvDebug("\n"); +*/ + int l_start = 4; + int l_end = 2; + + BoxFilter filter; + PolyphaseKernel kp(kai4, l_start, l_end); + + kp.debugPrint(); + + return 0; +} diff --git a/externals/NVTT/src/nvtt/tools/assemble.cpp b/externals/NVTT/src/nvtt/tools/assemble.cpp new file mode 100644 index 00000000..9c39a09e --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/assemble.cpp @@ -0,0 +1,189 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include + +#include + +#include +#include +#include + +#include "cmdline.h" + +// @@ Add decent error messages. +// @@ Add option to resize images. +// @@ Add support for reading DDS files with 2D images and possibly mipmaps. + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + bool assembleCubeMap = true; + bool assembleVolume = false; + bool assembleTextureArray = false; + + nv::Array files; + nv::Path output = "output.dds"; + + // Parse arguments. + for (int i = 1; i < argc; i++) + { + // Input options. + if (strcmp("-cube", argv[i]) == 0) + { + assembleCubeMap = true; + assembleVolume = false; + assembleTextureArray = false; + } + /*if (strcmp("-volume", argv[i]) == 0) + { + assembleCubeMap = false; + assembleVolume = true; + assembleTextureArray = false; + } + if (strcmp("-array", argv[i]) == 0) + { + assembleCubeMap = false; + assembleVolume = false; + assembleTextureArray = true; + }*/ + else if (strcmp("-o", argv[i]) == 0) + { + i++; + if (i < argc && argv[i][0] != '-') + { + output = argv[i]; + } + } + else if (argv[i][0] != '-') + { + files.append(argv[i]); + } + } + + if (files.count() == 0) + { + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + printf("usage: nvassemble [-cube|-volume|-array] 'file0' 'file1' ...\n\n"); + return 1; + } + + if (nv::strCaseCmp(output.extension(), ".dds") != 0) + { + //output.stripExtension(); + output.append(".dds"); + } + + if (assembleCubeMap && files.count() != 6) + { + printf("*** error, 6 files expected, but got %d\n", files.count()); + return 1; + } + + // Load all files. + nv::Array images; + + uint w = 0, h = 0; + bool hasAlpha = false; + + const uint imageCount = files.count(); + images.resize(imageCount); + + for (uint i = 0; i < imageCount; i++) + { + if (!images[i].load(files[i])) + { + printf("*** error loading file\n"); + return 1; + } + + if (i == 0) + { + w = images[i].width(); + h = images[i].height(); + } + else if (images[i].width() != w || images[i].height() != h) + { + printf("*** error, size of image '%s' does not match\n", files[i].str()); + return 1; + } + + if (images[i].format() == nv::Image::Format_ARGB) + { + hasAlpha = true; + } + } + + + nv::StdOutputStream stream(output); + if (stream.isError()) { + printf("Error opening '%s' for writting\n", output.str()); + return 1; + } + + // Output DDS header. + nv::DDSHeader header; + header.setWidth(w); + header.setHeight(h); + + if (assembleCubeMap) + { + header.setTextureCube(); + } + else if (assembleVolume) + { + header.setTexture3D(); + header.setDepth(imageCount); + } + else if (assembleTextureArray) + { + //header.setTextureArray(imageCount); + } + + // @@ It always outputs 32 bpp. + header.setPitch(4 * w); + header.setPixelFormat(32, 0xFF0000, 0xFF00, 0xFF, hasAlpha ? 0xFF000000 : 0); + + stream << header; + + // Output images. + for (uint i = 0; i < imageCount; i++) + { + const uint pixelCount = w * h; + for (uint p = 0; p < pixelCount; p++) + { + nv::Color32 c = images[i].pixel(p); + uint8 r = c.r; + uint8 g = c.g; + uint8 b = c.b; + uint8 a = c.a; + stream << b << g << r << a; + } + } + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tools/benchmark.cpp b/externals/NVTT/src/nvtt/tools/benchmark.cpp new file mode 100644 index 00000000..347a3271 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/benchmark.cpp @@ -0,0 +1,374 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include + +#include +#include + +#include + +#include "cmdline.h" + +#include // clock + + +struct MyErrorHandler : public nvtt::ErrorHandler +{ + virtual void error(nvtt::Error e) + { + nvDebugBreak(); + } +}; + + +// Set color to normal map conversion options. +void setColorToNormalMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(false); + inputOptions.setConvertToNormalMap(true); + inputOptions.setHeightEvaluation(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 0.0f); + //inputOptions.setNormalFilter(1.0f, 0, 0, 0); + //inputOptions.setNormalFilter(0.0f, 0, 0, 1); + inputOptions.setGamma(1.0f, 1.0f); + inputOptions.setNormalizeMipmaps(true); +} + +// Set options for normal maps. +void setNormalMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(true); + inputOptions.setConvertToNormalMap(false); + inputOptions.setGamma(1.0f, 1.0f); + inputOptions.setNormalizeMipmaps(true); +} + +// Set options for color maps. +void setColorMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(false); + inputOptions.setConvertToNormalMap(false); + inputOptions.setGamma(2.2f, 2.2f); + inputOptions.setNormalizeMipmaps(false); +} + + + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + bool normal = false; + bool color2normal = false; + bool wrapRepeat = false; + bool noMipmaps = false; + bool fast = false; + bool nocuda = false; + bool silent = false; + nvtt::Format format = nvtt::Format_BC1; + + const char * externalCompressor = NULL; + + nv::Path input; + nv::Path output; + + + // Parse arguments. + for (int i = 1; i < argc; i++) + { + // Input options. + if (strcmp("-color", argv[i]) == 0) + { + } + else if (strcmp("-normal", argv[i]) == 0) + { + normal = true; + } + else if (strcmp("-tonormal", argv[i]) == 0) + { + color2normal = true; + } + else if (strcmp("-clamp", argv[i]) == 0) + { + } + else if (strcmp("-repeat", argv[i]) == 0) + { + wrapRepeat = true; + } + else if (strcmp("-nomips", argv[i]) == 0) + { + noMipmaps = true; + } + + // Compression options. + else if (strcmp("-fast", argv[i]) == 0) + { + fast = true; + } + else if (strcmp("-nocuda", argv[i]) == 0) + { + nocuda = true; + } + else if (strcmp("-rgb", argv[i]) == 0) + { + format = nvtt::Format_RGB; + } + else if (strcmp("-bc1", argv[i]) == 0) + { + format = nvtt::Format_BC1; + } + else if (strcmp("-bc1a", argv[i]) == 0) + { + format = nvtt::Format_BC1a; + } + else if (strcmp("-bc2", argv[i]) == 0) + { + format = nvtt::Format_BC2; + } + else if (strcmp("-bc3", argv[i]) == 0) + { + format = nvtt::Format_BC3; + } + else if (strcmp("-bc3n", argv[i]) == 0) + { + format = nvtt::Format_BC3n; + } + else if (strcmp("-bc4", argv[i]) == 0) + { + format = nvtt::Format_BC4; + } + else if (strcmp("-bc5", argv[i]) == 0) + { + format = nvtt::Format_BC5; + } + + // Undocumented option. Mainly used for testing. + else if (strcmp("-ext", argv[i]) == 0) + { + if (i+1 < argc && argv[i+1][0] != '-') { + externalCompressor = argv[i+1]; + i++; + } + } + + // Misc options + else if (strcmp("-silent", argv[i]) == 0) + { + silent = true; + } + + else if (argv[i][0] != '-') + { + input = argv[i]; + + if (i+1 < argc && argv[i+1][0] != '-') { + output = argv[i+1]; + } + else + { + output.copy(input.str()); + output.stripExtension(); + output.append(".dds"); + } + + break; + } + } + + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + + if (input.isNull()) + { + printf("usage: nvttbenchmark [options] infile [outfile]\n\n"); + + printf("Input options:\n"); + printf(" -color \tThe input image is a color map (default).\n"); + printf(" -normal \tThe input image is a normal map.\n"); + printf(" -tonormal\tConvert input to normal map.\n"); + printf(" -clamp \tClamp wrapping mode (default).\n"); + printf(" -repeat \tRepeat wrapping mode.\n"); + printf(" -nomips \tDisable mipmap generation.\n\n"); + + printf("Compression options:\n"); + printf(" -fast \tFast compression.\n"); + printf(" -nocuda \tDo not use cuda compressor.\n"); + printf(" -rgb \tRGBA format\n"); + printf(" -bc1 \tBC1 format (DXT1)\n"); + printf(" -bc1a \tBC1 format with binary alpha (DXT1a)\n"); + printf(" -bc2 \tBC2 format (DXT3)\n"); + printf(" -bc3 \tBC3 format (DXT5)\n"); + printf(" -bc3n \tBC3 normal map format (DXT5nm)\n"); + printf(" -bc4 \tBC4 format (ATI1)\n"); + printf(" -bc5 \tBC5 format (3Dc/ATI2)\n\n"); + + return 1; + } + + // @@ Make sure input file exists. + + // Set input options. + nvtt::InputOptions inputOptions; + + if (nv::strCaseCmp(input.extension(), ".dds") == 0) + { + // Load surface. + nv::DirectDrawSurface dds(input); + if (!dds.isValid()) + { + fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str()); + return 1; + } + + if (!dds.isSupported() || dds.isTexture3D()) + { + fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str()); + return 1; + } + + uint faceCount; + if (dds.isTexture2D()) + { + inputOptions.setTextureLayout(nvtt::TextureType_2D, dds.width(), dds.height()); + faceCount = 1; + } + else + { + nvDebugCheck(dds.isTextureCube()); + inputOptions.setTextureLayout(nvtt::TextureType_Cube, dds.width(), dds.height()); + faceCount = 6; + } + + uint mipmapCount = dds.mipmapCount(); + + nv::Image mipmap; + + for (uint f = 0; f < faceCount; f++) + { + for (uint m = 0; m <= mipmapCount; m++) + { + dds.mipmap(&mipmap, f, m); + + inputOptions.setMipmapData(mipmap.pixels(), mipmap.width(), mipmap.height(), 1, f, m); + } + } + } + else + { + // Regular image. + nv::Image image; + if (!image.load(input)) + { + fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str()); + return 1; + } + + inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width(), image.height()); + inputOptions.setMipmapData(image.pixels(), image.width(), image.height()); + } + + if (fast) + { + inputOptions.setMipmapping(true, nvtt::MipmapFilter_Box); + } + else + { + inputOptions.setMipmapping(true, nvtt::MipmapFilter_Box); + //inputOptions.setMipmapping(true, nvtt::MipmapFilter_Kaiser); + } + + if (wrapRepeat) + { + inputOptions.setWrapMode(nvtt::WrapMode_Repeat); + } + else + { + inputOptions.setWrapMode(nvtt::WrapMode_Clamp); + } + + if (normal) + { + setNormalMap(inputOptions); + } + else if (color2normal) + { + setColorToNormalMap(inputOptions); + } + else + { + setColorMap(inputOptions); + } + + if (noMipmaps) + { + inputOptions.setMipmapping(false); + } + + + nvtt::CompressionOptions compressionOptions; + compressionOptions.setFormat(format); + if (fast) + { + compressionOptions.setQuality(nvtt::Quality_Fastest); + } + else + { + compressionOptions.setQuality(nvtt::Quality_Normal); + //compressionOptions.setQuality(nvtt::Quality_Production, 0.5f); + //compressionOptions.setQuality(nvtt::Quality_Highest); + } + compressionOptions.enableHardwareCompression(!nocuda); + compressionOptions.setColorWeights(1, 1, 1); + + if (externalCompressor != NULL) + { + compressionOptions.setExternalCompressor(externalCompressor); + } + + + MyErrorHandler errorHandler; + nvtt::OutputOptions outputOptions(NULL, &errorHandler); + +// printf("Press ENTER.\n"); +// fflush(stdout); +// getchar(); + + clock_t start = clock(); + + const int iterationCount = 20; + for (int i = 0; i < iterationCount; i++) + { + nvtt::compress(inputOptions, outputOptions, compressionOptions); + } + + clock_t end = clock(); + + float seconds = float(end-start) / CLOCKS_PER_SEC + printf("total time taken: %.3f seconds\n", seconds); + printf("time taken per texture: %.3f seconds\n", seconds / iterationCount); + printf("textures per second: %.3f T/s\n", iterationCount / seconds); + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tools/cmdline.h b/externals/NVTT/src/nvtt/tools/cmdline.h new file mode 100644 index 00000000..f4b48b6e --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/cmdline.h @@ -0,0 +1,68 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef CMDLINE_H +#define CMDLINE_H + +#include + +#include // stderr +#include // exit +#include // va_list + + +struct MyMessageHandler : public nv::MessageHandler { + MyMessageHandler() { + nv::debug::setMessageHandler( this ); + } + ~MyMessageHandler() { + nv::debug::resetMessageHandler(); + } + + virtual void log( const char * str, va_list arg ) { + va_list val; + va_copy(val, arg); + vfprintf(stderr, str, arg); + va_end(val); + } +}; + + +struct MyAssertHandler : public nv::AssertHandler { + MyAssertHandler() { + nv::debug::setAssertHandler( this ); + } + ~MyAssertHandler() { + nv::debug::resetAssertHandler(); + } + + // Handler method, note that func might be NULL! + virtual int assert( const char *exp, const char *file, int line, const char *func ) { + fprintf(stderr, "Assertion failed: %s\nIn %s:%d\n", exp, file, line); + nv::debug::dumpInfo(); + exit(1); + } +}; + + +#endif // CMDLINE_H diff --git a/externals/NVTT/src/nvtt/tools/compress.cpp b/externals/NVTT/src/nvtt/tools/compress.cpp new file mode 100644 index 00000000..3f80f8ec --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/compress.cpp @@ -0,0 +1,468 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include + +#include +#include + +#include + +#include "cmdline.h" + +#include // clock + +//#define WINDOWS_LEAN_AND_MEAN +//#include // TIMER + + +struct MyOutputHandler : public nvtt::OutputHandler +{ + MyOutputHandler(const char * name) : total(0), progress(0), percentage(0), stream(new nv::StdOutputStream(name)) {} + virtual ~MyOutputHandler() { delete stream; } + + void setTotal(int64 t) + { + total = t + 128; + } + void setDisplayProgress(bool b) + { + verbose = b; + } + + virtual void beginImage(int size, int width, int height, int depth, int face, int miplevel) + { + // ignore. + } + + // Output data. + virtual bool writeData(const void * data, int size) + { + nvDebugCheck(stream != NULL); + stream->serialize(const_cast(data), size); + + progress += size; + int p = int((100 * progress) / total); + if (verbose && p != percentage) + { + nvCheck(p >= 0); + + percentage = p; + printf("\r%d%%", percentage); + fflush(stdout); + } + + return true; + } + + int64 total; + int64 progress; + int percentage; + bool verbose; + nv::StdOutputStream * stream; +}; + +struct MyErrorHandler : public nvtt::ErrorHandler +{ + virtual void error(nvtt::Error e) + { +#if _DEBUG + nvDebugBreak(); +#endif + printf("Error: '%s'\n", nvtt::errorString(e)); + } +}; + + + + +// Set color to normal map conversion options. +void setColorToNormalMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(false); + inputOptions.setConvertToNormalMap(true); + inputOptions.setHeightEvaluation(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 0.0f); + //inputOptions.setNormalFilter(1.0f, 0, 0, 0); + //inputOptions.setNormalFilter(0.0f, 0, 0, 1); + inputOptions.setGamma(1.0f, 1.0f); + inputOptions.setNormalizeMipmaps(true); +} + +// Set options for normal maps. +void setNormalMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(true); + inputOptions.setConvertToNormalMap(false); + inputOptions.setGamma(1.0f, 1.0f); + inputOptions.setNormalizeMipmaps(true); +} + +// Set options for color maps. +void setColorMap(nvtt::InputOptions & inputOptions) +{ + inputOptions.setNormalMap(false); + inputOptions.setConvertToNormalMap(false); + inputOptions.setGamma(2.2f, 2.2f); + inputOptions.setNormalizeMipmaps(false); +} + + + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + bool alpha = false; + bool normal = false; + bool color2normal = false; + bool wrapRepeat = false; + bool noMipmaps = false; + bool fast = false; + bool nocuda = false; + bool silent = false; + bool bc1n = false; + nvtt::Format format = nvtt::Format_BC1; + + const char * externalCompressor = NULL; + + nv::Path input; + nv::Path output; + + + // Parse arguments. + for (int i = 1; i < argc; i++) + { + // Input options. + if (strcmp("-color", argv[i]) == 0) + { + } + else if (strcmp("-alpha", argv[i]) == 0) + { + alpha = true; + } + else if (strcmp("-normal", argv[i]) == 0) + { + normal = true; + } + else if (strcmp("-tonormal", argv[i]) == 0) + { + color2normal = true; + } + else if (strcmp("-clamp", argv[i]) == 0) + { + } + else if (strcmp("-repeat", argv[i]) == 0) + { + wrapRepeat = true; + } + else if (strcmp("-nomips", argv[i]) == 0) + { + noMipmaps = true; + } + + // Compression options. + else if (strcmp("-fast", argv[i]) == 0) + { + fast = true; + } + else if (strcmp("-nocuda", argv[i]) == 0) + { + nocuda = true; + } + else if (strcmp("-rgb", argv[i]) == 0) + { + format = nvtt::Format_RGB; + } + else if (strcmp("-bc1", argv[i]) == 0) + { + format = nvtt::Format_BC1; + } + else if (strcmp("-bc1n", argv[i]) == 0) + { + format = nvtt::Format_BC1; + bc1n = true; + } + else if (strcmp("-bc1a", argv[i]) == 0) + { + format = nvtt::Format_BC1a; + } + else if (strcmp("-bc2", argv[i]) == 0) + { + format = nvtt::Format_BC2; + } + else if (strcmp("-bc3", argv[i]) == 0) + { + format = nvtt::Format_BC3; + } + else if (strcmp("-bc3n", argv[i]) == 0) + { + format = nvtt::Format_BC3n; + } + else if (strcmp("-bc4", argv[i]) == 0) + { + format = nvtt::Format_BC4; + } + else if (strcmp("-bc5", argv[i]) == 0) + { + format = nvtt::Format_BC5; + } + + // Undocumented option. Mainly used for testing. + else if (strcmp("-ext", argv[i]) == 0) + { + if (i+1 < argc && argv[i+1][0] != '-') { + externalCompressor = argv[i+1]; + i++; + } + } + + // Misc options + else if (strcmp("-silent", argv[i]) == 0) + { + silent = true; + } + + else if (argv[i][0] != '-') + { + input = argv[i]; + + if (i+1 < argc && argv[i+1][0] != '-') { + output = argv[i+1]; + } + else + { + output.copy(input.str()); + output.stripExtension(); + output.append(".dds"); + } + + break; + } + } + + const uint version = nvtt::version(); + const uint major = version / 100; + const uint minor = version % 100; + + + printf("NVIDIA Texture Tools %u.%u - Copyright NVIDIA Corporation 2007\n\n", major, minor); + + if (input.isNull()) + { + printf("usage: nvcompress [options] infile [outfile]\n\n"); + + printf("Input options:\n"); + printf(" -color \tThe input image is a color map (default).\n"); + printf(" -alpha \tThe input image has an alpha channel used for transparency.\n"); + printf(" -normal \tThe input image is a normal map.\n"); + printf(" -tonormal\tConvert input to normal map.\n"); + printf(" -clamp \tClamp wrapping mode (default).\n"); + printf(" -repeat \tRepeat wrapping mode.\n"); + printf(" -nomips \tDisable mipmap generation.\n\n"); + + printf("Compression options:\n"); + printf(" -fast \tFast compression.\n"); + printf(" -nocuda \tDo not use cuda compressor.\n"); + printf(" -rgb \tRGBA format\n"); + printf(" -bc1 \tBC1 format (DXT1)\n"); + printf(" -bc1n \tBC1 normal map format (DXT1nm)\n"); + printf(" -bc1a \tBC1 format with binary alpha (DXT1a)\n"); + printf(" -bc2 \tBC2 format (DXT3)\n"); + printf(" -bc3 \tBC3 format (DXT5)\n"); + printf(" -bc3n \tBC3 normal map format (DXT5nm)\n"); + printf(" -bc4 \tBC4 format (ATI1)\n"); + printf(" -bc5 \tBC5 format (3Dc/ATI2)\n\n"); + + return EXIT_FAILURE; + } + + // @@ Make sure input file exists. + + // Set input options. + nvtt::InputOptions inputOptions; + + if (nv::strCaseCmp(input.extension(), ".dds") == 0) + { + // Load surface. + nv::DirectDrawSurface dds(input); + if (!dds.isValid()) + { + fprintf(stderr, "The file '%s' is not a valid DDS file.\n", input.str()); + return EXIT_FAILURE; + } + + if (!dds.isSupported() || dds.isTexture3D()) + { + fprintf(stderr, "The file '%s' is not a supported DDS file.\n", input.str()); + return EXIT_FAILURE; + } + + uint faceCount; + if (dds.isTexture2D()) + { + inputOptions.setTextureLayout(nvtt::TextureType_2D, dds.width(), dds.height()); + faceCount = 1; + } + else + { + nvDebugCheck(dds.isTextureCube()); + inputOptions.setTextureLayout(nvtt::TextureType_Cube, dds.width(), dds.height()); + faceCount = 6; + } + + uint mipmapCount = dds.mipmapCount(); + + nv::Image mipmap; + + for (uint f = 0; f < faceCount; f++) + { + for (uint m = 0; m < mipmapCount; m++) + { + dds.mipmap(&mipmap, f, m); + + inputOptions.setMipmapData(mipmap.pixels(), mipmap.width(), mipmap.height(), 1, f, m); + } + } + } + else + { + // Regular image. + nv::Image image; + if (!image.load(input)) + { + fprintf(stderr, "The file '%s' is not a supported image type.\n", input.str()); + return EXIT_FAILURE; + } + + inputOptions.setTextureLayout(nvtt::TextureType_2D, image.width(), image.height()); + inputOptions.setMipmapData(image.pixels(), image.width(), image.height()); + } + + if (wrapRepeat) + { + inputOptions.setWrapMode(nvtt::WrapMode_Repeat); + } + else + { + inputOptions.setWrapMode(nvtt::WrapMode_Clamp); + } + + if (alpha) + { + inputOptions.setAlphaMode(nvtt::AlphaMode_Transparency); + } + else + { + inputOptions.setAlphaMode(nvtt::AlphaMode_None); + } + + if (normal) + { + setNormalMap(inputOptions); + } + else if (color2normal) + { + setColorToNormalMap(inputOptions); + } + else + { + setColorMap(inputOptions); + } + + if (noMipmaps) + { + inputOptions.setMipmapGeneration(false); + } + + nvtt::CompressionOptions compressionOptions; + compressionOptions.setFormat(format); + if (fast) + { + compressionOptions.setQuality(nvtt::Quality_Fastest); + } + else + { + compressionOptions.setQuality(nvtt::Quality_Normal); + //compressionOptions.setQuality(nvtt::Quality_Production); + //compressionOptions.setQuality(nvtt::Quality_Highest); + } + + if (bc1n) + { + compressionOptions.setColorWeights(1, 1, 0); + } + + if (externalCompressor != NULL) + { + compressionOptions.setExternalCompressor(externalCompressor); + } + + + MyErrorHandler errorHandler; + MyOutputHandler outputHandler(output); + if (outputHandler.stream->isError()) + { + fprintf(stderr, "Error opening '%s' for writting\n", output.str()); + return EXIT_FAILURE; + } + + nvtt::Compressor compressor; + compressor.enableCudaAcceleration(!nocuda); + + printf("CUDA acceleration "); + if (compressor.isCudaAccelerationEnabled()) + { + printf("ENABLED\n\n"); + } + else + { + printf("DISABLED\n\n"); + } + + outputHandler.setTotal(compressor.estimateSize(inputOptions, compressionOptions)); + outputHandler.setDisplayProgress(!silent); + + nvtt::OutputOptions outputOptions; + //outputOptions.setFileName(output); + outputOptions.setOutputHandler(&outputHandler); + outputOptions.setErrorHandler(&errorHandler); + +// printf("Press ENTER.\n"); +// fflush(stdout); +// getchar(); + + clock_t start = clock(); + + if (!compressor.process(inputOptions, compressionOptions, outputOptions)) + { + return EXIT_FAILURE; + } + + clock_t end = clock(); + printf("\rtime taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC); + + return EXIT_SUCCESS; +} + diff --git a/externals/NVTT/src/nvtt/tools/configdialog.cpp b/externals/NVTT/src/nvtt/tools/configdialog.cpp new file mode 100644 index 00000000..885baa51 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/configdialog.cpp @@ -0,0 +1,170 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include "configdialog.h" + +#include + +#include + + +ConfigDialog::ConfigDialog(QWidget *parent/*=0*/) : QDialog(parent) +{ + init(); +} + +ConfigDialog::ConfigDialog(const char * fileName, QWidget *parent/*=0*/) : QDialog(parent) +{ + init(); + + open(fileName); +} + +void ConfigDialog::init() +{ + ui.setupUi(this); + + connect(ui.openButton, SIGNAL(clicked()), this, SLOT(openClicked())); + connect(ui.generateMipmapsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(generateMipmapsChanged(int))); + connect(ui.mipmapFilterComboBox, SIGNAL(activated(QString)), this, SLOT(mipmapFilterChanged(QString))); + //connect(ui.mipmapFilterSettings, SIGNAL(clicked()), this, SLOT(mipmapFilterSettingsShow())); + + connect(ui.redSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged())); + connect(ui.greenSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged())); + connect(ui.blueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(colorWeightChanged())); + connect(ui.uniformButton, SIGNAL(toggled(bool)), this, SLOT(uniformWeightToggled(bool))); + connect(ui.luminanceButton, SIGNAL(toggled(bool)), this, SLOT(luminanceWeightToggled(bool))); + + //connect(ui.rgbMapRadioButton, SIGNAL(toggled(bool)), this, SLOT(colorModeChanged())); + connect(ui.normalMapRadioButton, SIGNAL(toggled(bool)), this, SLOT(normalMapModeChanged(bool))); +} + + +void ConfigDialog::openClicked() +{ + // @@ Open file dialog. + + QString fileName; + + open(fileName); +} + +void ConfigDialog::generateMipmapsChanged(int state) +{ + Q_UNUSED(state); + + bool generateMipmapEnabled = ui.generateMipmapsCheckBox->isChecked(); + + ui.mipmapFilterLabel->setEnabled(generateMipmapEnabled); + ui.mipmapFilterComboBox->setEnabled(generateMipmapEnabled); + ui.limitMipmapsCheckBox->setEnabled(generateMipmapEnabled); + + bool enableFilterSettings = (ui.mipmapFilterComboBox->currentText() == "Kaiser"); + ui.mipmapFilterSettings->setEnabled(generateMipmapEnabled && enableFilterSettings); + + bool enableMaxLevel = ui.limitMipmapsCheckBox->isChecked(); + ui.maxLevelLabel->setEnabled(generateMipmapEnabled && enableMaxLevel); + ui.maxLevelSpinBox->setEnabled(generateMipmapEnabled && enableMaxLevel); +} + +void ConfigDialog::mipmapFilterChanged(QString name) +{ + bool enableFilterSettings = (name == "Kaiser"); + ui.mipmapFilterSettings->setEnabled(enableFilterSettings); +} + + +void ConfigDialog::colorWeightChanged() +{ + double r = ui.redSpinBox->value(); + double g = ui.greenSpinBox->value(); + double b = ui.blueSpinBox->value(); + + bool uniform = (r == 1.0 && g == 1.0 && b == 1.0); + bool luminance = (r == 0.3 && g == 0.59 && b == 0.11); + + ui.uniformButton->setChecked(uniform); + ui.luminanceButton->setChecked(luminance); +} + +void ConfigDialog::uniformWeightToggled(bool checked) +{ + if (checked) + { + ui.redSpinBox->setValue(1.0); + ui.greenSpinBox->setValue(1.0); + ui.blueSpinBox->setValue(1.0); + } +} + +void ConfigDialog::luminanceWeightToggled(bool checked) +{ + if (checked) + { + ui.redSpinBox->setValue(0.3); + ui.greenSpinBox->setValue(0.59); + ui.blueSpinBox->setValue(0.11); + } +} + +void ConfigDialog::normalMapModeChanged(bool checked) +{ + ui.alphaModeGroupBox->setEnabled(!checked); + ui.inputGammaSpinBox->setEnabled(!checked); + ui.inputGammaLabel->setEnabled(!checked); + ui.outputGammaSpinBox->setEnabled(!checked); + ui.outputGammaLabel->setEnabled(!checked); +} + + +bool ConfigDialog::open(QString fileName) +{ + // @@ Load image. + QImage image; + + // @@ If success. + { + ui.imagePathLineEdit->setText(fileName); + + // @@ Set image in graphics view. + + // @@ Set image description. + + // @@ Provide image to nvtt. + + int w = image.width(); + int h = image.height(); + void * data = NULL; + + inputOptions.setTextureLayout(nvtt::TextureType_2D, w, h); + inputOptions.setMipmapData(data, w, h); + + return true; + } + + return false; +} + + + + diff --git a/externals/NVTT/src/nvtt/tools/configdialog.h b/externals/NVTT/src/nvtt/tools/configdialog.h new file mode 100644 index 00000000..3c44073c --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/configdialog.h @@ -0,0 +1,69 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include + +#include "ui_configdialog.h" + +#include + + +class ConfigDialog : public QDialog +{ + Q_OBJECT +public: + ConfigDialog(QWidget *parent = 0); + ConfigDialog(const char * fileName, QWidget *parent = 0); + +protected slots: + + void openClicked(); + void generateMipmapsChanged(int state); + void mipmapFilterChanged(QString name); + + void colorWeightChanged(); + void uniformWeightToggled(bool checked); + void luminanceWeightToggled(bool checked); + + void normalMapModeChanged(bool checked); + + bool open(QString fileName); + +private: + + void init(); + +private: + Ui::ConfigDialog ui; + + nvtt::InputOptions inputOptions; + nvtt::CompressionOptions compressionOptions; + nvtt::OutputOptions outputOptions; + +}; + + +#endif // CONFIGDIALOG_H diff --git a/externals/NVTT/src/nvtt/tools/configdialog.ui b/externals/NVTT/src/nvtt/tools/configdialog.ui new file mode 100644 index 00000000..a0027985 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/configdialog.ui @@ -0,0 +1,1046 @@ + + ConfigDialog + + + + 0 + 0 + 674 + 475 + + + + NVIDIA Texture Tools + + + + + + true + + + + + + + + + + + 64 + 0 + + + + + 128 + 16777215 + + + + Qt::ScrollBarAlwaysOff + + + QListView::Static + + + QListView::TopToBottom + + + false + + + QListView::Adjust + + + QListView::ListMode + + + + Input Options + + + + + Compression Options + + + + + Output Options + + + + + Preview + + + ../../../../../../castano-stuff/qshaderedit/src/images/colorpicker.png + + + + + + + + + + + 0 + 0 + + + + 3 + + + + + -1 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + Qt::ElideNone + + + false + + + + File Path + + + + + + + + + + + + 0 + 0 + + + + Open + + + + + + + + + + + + + Image Settings + + + + + + + + + 0 + 0 + + + + Color Mode + + + Qt::AlignHCenter + + + + 0 + + + + + RGB + + + true + + + + + + + Normal Map + + + + + + + + + + + 0 + 0 + + + + Alpha Mode + + + Qt::AlignHCenter + + + + 0 + + + + + None + + + false + + + + + + + Transparency + + + true + + + + + + + Premultiplied + + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + Wrap Mode: + + + mipmapFilterComboBox + + + + + + + + 16777215 + 26 + + + + + Mirror + + + + + Repeat + + + + + Clamp + + + + + + + + + + + + + 0 + 0 + + + + Input Gamma: + + + inputGammaSpinBox + + + + + + + + 0 + 0 + + + + QAbstractSpinBox::UpDownArrows + + + 0.050000000000000 + + + 4.000000000000000 + + + 0.050000000000000 + + + 2.200000000000000 + + + + + + + + + + + + 0 + 0 + + + + Output Gamma: + + + inputGammaSpinBox + + + + + + + + 0 + 0 + + + + QAbstractSpinBox::UpDownArrows + + + 0.050000000000000 + + + 4.000000000000000 + + + 0.050000000000000 + + + 2.200000000000000 + + + + + + + + + Qt::Vertical + + + + 433 + 16 + + + + + + + + + Mipmaps + + + + + + Generate mipmaps + + + true + + + + + + + 1 + + + + + + 0 + 0 + + + + Mipmap filter: + + + mipmapFilterComboBox + + + + + + + + 16777215 + 26 + + + + + Box + + + + + Triangle + + + + + Kaiser + + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 24 + + + + false + + + ... + + + Qt::ToolButtonTextOnly + + + + + + + + + + + + 0 + 0 + + + + Limit Mipmaps + + + + + + + false + + + + 0 + 0 + + + + Max Level: + + + + + + + false + + + + 0 + 0 + + + + + 80 + 16777215 + + + + + + + + + + Qt::Vertical + + + + 204 + 71 + + + + + + + + + Normal Map + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + Format: + + + Qt::PlainText + + + Qt::NoTextInteraction + + + formatComboBox + + + + + + + + Uncompressed + + + + + BC1 (DXT1) + + + + + BC1a (DXT1a) + + + + + BC2 (DXT3) + + + + + BC3 (DXT5) + + + + + BC4 + + + + + BC5 + + + + + + + + + + + + + 0 + 0 + + + + Quality: + + + Qt::PlainText + + + Qt::NoTextInteraction + + + formatComboBox + + + + + + + 1 + + + + Fastest + + + + + Normal + + + + + Production + + + + + Highest + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Color Weights + + + Qt::AlignHCenter + + + + + + + + Red + + + redSpinBox + + + + + + + 1.000000000000000 + + + 0.050000000000000 + + + 1.000000000000000 + + + + + + + + + + + Green + + + greenSpinBox + + + + + + + 1.000000000000000 + + + 0.050000000000000 + + + 1.000000000000000 + + + + + + + + + + + Blue + + + blueSpinBox + + + + + + + 1.000000000000000 + + + 0.050000000000000 + + + 1.000000000000000 + + + + + + + + + + + + 16777215 + 22 + + + + Uniform Weights + + + true + + + true + + + + + + + + 16777215 + 22 + + + + Luminance Weights + + + true + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 484 + 31 + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + + Bilinear Filter + + + true + + + + + + + View difference + + + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + + Default + + + + + + + true + + + 0 + + + true + + + Qt::Horizontal + + + false + + + + + + + Quit + + + + + + + + + + + listWidget + currentRowChanged(int) + stackedWidget + setCurrentIndex(int) + + + 118 + 193 + + + 154 + 220 + + + + + pushButton + clicked() + ConfigDialog + accept() + + + 565 + 491 + + + 582 + 506 + + + + + limitMipmapsCheckBox + clicked(bool) + maxLevelSpinBox + setEnabled(bool) + + + 451 + 120 + + + 524 + 120 + + + + + limitMipmapsCheckBox + clicked(bool) + maxLevelLabel + setEnabled(bool) + + + 337 + 120 + + + 482 + 124 + + + + + diff --git a/externals/NVTT/src/nvtt/tools/ddsinfo.cpp b/externals/NVTT/src/nvtt/tools/ddsinfo.cpp new file mode 100644 index 00000000..984ed967 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/ddsinfo.cpp @@ -0,0 +1,57 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include + +#include +#include + +#include "cmdline.h" + + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + if (argc != 2) + { + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + printf("usage: nvddsinfo ddsfile\n\n"); + return 1; + } + + // Load surface. + nv::DirectDrawSurface dds(argv[1]); + if (!dds.isValid()) + { + printf("The file '%s' is not a valid DDS file.\n", argv[1]); + return 1; + } + + dds.printInfo(); + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tools/decompress.cpp b/externals/NVTT/src/nvtt/tools/decompress.cpp new file mode 100644 index 00000000..da0fd211 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/decompress.cpp @@ -0,0 +1,71 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include + +#include +#include + +#include + +#include "cmdline.h" + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + if (argc != 2) + { + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + printf("usage: nvdecompress 'ddsfile'\n\n"); + return 1; + } + + // Load surface. + nv::DirectDrawSurface dds(argv[1]); + if (!dds.isValid()) + { + printf("The file '%s' is not a valid DDS file.\n", argv[1]); + return 1; + } + + nv::Path name(argv[1]); + name.stripExtension(); + name.append(".tga"); + + nv::StdOutputStream stream(name.str()); + if (stream.isError()) { + printf("Error opening '%s' for writting\n", name.str()); + return 1; + } + + // @@ TODO: Add command line options to output mipmaps, cubemap faces, etc. + nv::Image img; + dds.mipmap(&img, 0, 0); // get first image + nv::ImageIO::saveTGA(stream, &img); + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tools/imgdiff.cpp b/externals/NVTT/src/nvtt/tools/imgdiff.cpp new file mode 100644 index 00000000..107ee7db --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/imgdiff.cpp @@ -0,0 +1,296 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "cmdline.h" + +static bool loadImage(nv::Image & image, const char * fileName) +{ + if (nv::strCaseCmp(nv::Path::extension(fileName), ".dds") == 0) + { + nv::DirectDrawSurface dds(fileName); + if (!dds.isValid()) + { + printf("The file '%s' is not a valid DDS file.\n", fileName); + return false; + } + + dds.mipmap(&image, 0, 0); // get first image + } + else + { + // Regular image. + if (!image.load(fileName)) + { + printf("The file '%s' is not a supported image type.\n", fileName); + return false; + } + } + + return true; +} + +// @@ Compute per-tile errors. +struct Error +{ + Error() + { + samples = 0; + mabse = 0.0f; + maxabse = 0.0f; + mse = 0.0f; + } + + void addSample(float e) + { + samples++; + mabse += fabsf(e); + maxabse = nv::max(maxabse, fabsf(e)); + mse += e * e; + } + + void done() + { + mabse /= samples; + mse /= samples; + rmse = sqrtf(mse); + psnr = (rmse == 0) ? 999.0f : 20.0f * log10(255.0f / rmse); + } + + void print() + { + printf(" Mean absolute error: %f\n", mabse); + printf(" Max absolute error: %f\n", maxabse); + printf(" Root mean squared error: %f\n", rmse); + printf(" Peak signal to noise ratio in dB: %f\n", psnr); + } + + int samples; + float mabse; + float maxabse; + float mse; + float rmse; + float psnr; +}; + +struct NormalError +{ + NormalError() + { + samples = 0; + ade = 0.0f; + mse = 0.0f; + } + + void addSample(nv::Color32 o, nv::Color32 c) + { + nv::Vector3 vo = nv::Vector3(o.r, o.g, o.b); + nv::Vector3 vc = nv::Vector3(c.r, c.g, c.b); + + // Unpack and normalize. + vo = nv::normalize(2.0f * (vo / 255.0f) - 1.0f); + vc = nv::normalize(2.0f * (vc / 255.0f) - 1.0f); + + ade += acosf(nv::clamp(dot(vo, vc), -1.0f, 1.0f)); + mse += length_squared((vo - vc) * (255 / 2.0f)); + + samples++; + } + + void done() + { + if (samples) + { + ade /= samples; + mse /= samples * 3; + rmse = sqrtf(mse); + psnr = (rmse == 0) ? 999.0f : 20.0f * log10(255.0f / rmse); + } + } + + void print() + { + printf(" Angular deviation error: %f\n", ade); + printf(" Root mean squared error: %f\n", rmse); + printf(" Peak signal to noise ratio in dB: %f\n", psnr); + } + + int samples; + float ade; + float mse; + float rmse; + float psnr; +}; + + +int main(int argc, char *argv[]) +{ + MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + bool compareNormal = false; + bool compareAlpha = false; + + nv::Path input0; + nv::Path input1; + nv::Path output; + + // Parse arguments. + for (int i = 1; i < argc; i++) + { + // Input options. + if (strcmp("-normal", argv[i]) == 0) + { + compareNormal = true; + } + if (strcmp("-alpha", argv[i]) == 0) + { + compareAlpha = true; + } + + else if (argv[i][0] != '-') + { + input0 = argv[i]; + + if (i+1 < argc && argv[i+1][0] != '-') { + input1 = argv[i+1]; + } + + break; + } + } + + if (input0.isNull() || input1.isNull()) + { + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + + printf("usage: nvimgdiff [options] original_file updated_file [output]\n\n"); + + printf("Diff options:\n"); + printf(" -normal \tCompare images as if they were normal maps.\n"); + printf(" -alpha \tCompare alpha weighted images.\n"); + + return 1; + } + + nv::Image image0, image1; + if (!loadImage(image0, input0)) return 0; + if (!loadImage(image1, input1)) return 0; + + const uint w0 = image0.width(); + const uint h0 = image0.height(); + const uint w1 = image1.width(); + const uint h1 = image1.height(); + const uint w = nv::min(w0, w1); + const uint h = nv::min(h0, h1); + + // Compute errors. + Error error_r; + Error error_g; + Error error_b; + Error error_a; + Error error_total; + NormalError error_normal; + + for (uint i = 0; i < h; i++) + { + for (uint e = 0; e < w; e++) + { + const nv::Color32 c0(image0.pixel(e, i)); + const nv::Color32 c1(image1.pixel(e, i)); + + float r = float(c0.r - c1.r); + float g = float(c0.g - c1.g); + float b = float(c0.b - c1.b); + float a = float(c0.a - c1.a); + + error_r.addSample(r); + error_g.addSample(g); + error_b.addSample(b); + error_a.addSample(a); + + if (compareNormal) + { + error_normal.addSample(c0, c1); + } + + if (compareAlpha) + { + error_total.addSample(r * c0.a / 255.0f); + error_total.addSample(g * c0.a / 255.0f); + error_total.addSample(b * c0.a / 255.0f); + } + else + { + error_total.addSample(r); + error_total.addSample(g); + error_total.addSample(b); + } + } + } + + error_r.done(); + error_g.done(); + error_b.done(); + error_a.done(); + error_total.done(); + error_normal.done(); + + + printf("Image size compared: %dx%d\n", w, h); + if (w != w0 || w != w1 || h != h0 || h != h1) { + printf("--- NOTE: only the overlap between the 2 images (%d,%d) and (%d,%d) was compared\n", w0, h0, w1, h1); + } + printf("Total pixels: %d\n", w*h); + + printf("Color:\n"); + error_total.print(); + + if (compareNormal) + { + printf("Normal:\n"); + error_normal.print(); + } + + if (compareAlpha) + { + printf("Alpha:\n"); + error_a.print(); + } + + // @@ Write image difference. + + return 0; +} + diff --git a/externals/NVTT/src/nvtt/tools/main.cpp b/externals/NVTT/src/nvtt/tools/main.cpp new file mode 100644 index 00000000..48b95326 --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/main.cpp @@ -0,0 +1,34 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include "configdialog.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + ConfigDialog dialog; + return dialog.exec(); +} + + diff --git a/externals/NVTT/src/nvtt/tools/resize.cpp b/externals/NVTT/src/nvtt/tools/resize.cpp new file mode 100644 index 00000000..c7ea21da --- /dev/null +++ b/externals/NVTT/src/nvtt/tools/resize.cpp @@ -0,0 +1,183 @@ +// Copyright NVIDIA Corporation 2007 -- Ignacio Castano +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "cmdline.h" + +static bool loadImage(nv::Image & image, const char * fileName) +{ + if (nv::strCaseCmp(nv::Path::extension(fileName), ".dds") == 0) + { + nv::DirectDrawSurface dds(fileName); + if (!dds.isValid()) + { + printf("The file '%s' is not a valid DDS file.\n", fileName); + return false; + } + + dds.mipmap(&image, 0, 0); // get first image + } + else + { + // Regular image. + if (!image.load(fileName)) + { + printf("The file '%s' is not a supported image type.\n", fileName); + return false; + } + } + + return true; +} + + +int main(int argc, char *argv[]) +{ + //MyAssertHandler assertHandler; + MyMessageHandler messageHandler; + + float scale = 0.5f; + float gamma = 2.2f; + nv::AutoPtr filter; + nv::Path input; + nv::Path output; + + nv::FloatImage::WrapMode wrapMode = nv::FloatImage::WrapMode_Mirror; + + // Parse arguments. + for (int i = 1; i < argc; i++) + { + // Input options. + if (strcmp("-s", argv[i]) == 0) + { + if (i+1 < argc && argv[i+1][0] != '-') { + scale = (float)atof(argv[i+1]); + i++; + } + } + else if (strcmp("-g", argv[i]) == 0) + { + if (i+1 < argc && argv[i+1][0] != '-') { + gamma = (float)atof(argv[i+1]); + i++; + } + } + else if (strcmp("-f", argv[i]) == 0) + { + if (i+1 == argc) break; + i++; + + if (strcmp("box", argv[i]) == 0) filter = new nv::BoxFilter(); + else if (strcmp("triangle", argv[i]) == 0) filter = new nv::TriangleFilter(); + else if (strcmp("quadratic", argv[i]) == 0) filter = new nv::QuadraticFilter(); + else if (strcmp("bspline", argv[i]) == 0) filter = new nv::BSplineFilter(); + else if (strcmp("mitchell", argv[i]) == 0) filter = new nv::MitchellFilter(); + else if (strcmp("lanczos", argv[i]) == 0) filter = new nv::LanczosFilter(); + else if (strcmp("kaiser", argv[i]) == 0) { + filter = new nv::KaiserFilter(3); + ((nv::KaiserFilter *)filter.ptr())->setParameters(4.0f, 1.0f); + } + } + else if (strcmp("-w", argv[i]) == 0) + { + if (i+1 == argc) break; + i++; + + if (strcmp("mirror", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Mirror; + else if (strcmp("repeat", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Repeat; + else if (strcmp("clamp", argv[i]) == 0) wrapMode = nv::FloatImage::WrapMode_Clamp; + } + else if (argv[i][0] != '-') + { + input = argv[i]; + + if (i+1 < argc && argv[i+1][0] != '-') { + output = argv[i+1]; + } + + break; + } + } + + if (input.isNull() || output.isNull()) + { + printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n"); + + printf("usage: nvzoom [options] input [output]\n\n"); + + printf("Options:\n"); + printf(" -s scale Scale factor (default = 0.5)\n"); + printf(" -g gamma Gamma correction (default = 2.2)\n"); + printf(" -f filter One of the following: (default = 'box')\n"); + printf(" * box\n"); + printf(" * triangle\n"); + printf(" * quadratic\n"); + printf(" * bspline\n"); + printf(" * mitchell\n"); + printf(" * lanczos\n"); + printf(" * kaiser\n"); + printf(" -w mode One of the following: (default = 'mirror')\n"); + printf(" * mirror\n"); + printf(" * repeat\n"); + printf(" * clamp\n"); + + return 1; + } + + if (filter == NULL) + { + filter = new nv::BoxFilter(); + } + + nv::Image image; + if (!loadImage(image, input)) return 0; + + nv::FloatImage fimage(&image); + fimage.toLinear(0, 3, gamma); + + nv::AutoPtr fresult(fimage.resize(*filter, uint(image.width() * scale), uint(image.height() * scale), wrapMode)); + + nv::AutoPtr result(fresult->createImageGammaCorrect(gamma)); + result->setFormat(nv::Image::Format_ARGB); + + nv::StdOutputStream stream(output); + nv::ImageIO::saveTGA(stream, result.ptr()); // @@ Add generic save function. Add support for png too. + + return 0; +} + diff --git a/trunk/BugTrap/BugTrap.vcxproj b/trunk/BugTrap/BugTrap.vcxproj new file mode 100644 index 00000000..daffe178 --- /dev/null +++ b/trunk/BugTrap/BugTrap.vcxproj @@ -0,0 +1,279 @@ + + + + + Debug + Win32 + + + Mixed + Win32 + + + Release + Win32 + + + + {E8CF1ADA-264A-4127-86C2-FD7057D3792C} + BugTrap + Win32Proj + + + + + DynamicLibrary + v120 + MultiByte + + + DynamicLibrary + v120 + MultiByte + + + DynamicLibrary + v120 + MultiByte + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + + _USRDLL;BUGTRAP_EXPORTS;%(PreprocessorDefinitions) + true + + EnableFastChecks + MultiThreadedDLL + Level4 + ProgramDatabase + + + 0x0409 + $(IntDir)$(TargetName).res + + + ws2_32.lib;comctl32.lib;shlwapi.lib;version.lib;wininet.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName)D.dll + BugTrap.def + $(OutDir)$(TargetName).pdb + false + + false + MachineX86 + + + + + MinSpace + OnlyExplicitInline + true + _USRDLL;BUGTRAP_EXPORTS;%(PreprocessorDefinitions) + true + + MultiThreadedDLL + Level4 + ProgramDatabase + + + 0x0409 + $(IntDir)$(TargetName).res + + + ws2_32.lib;comctl32.lib;shlwapi.lib;version.lib;wininet.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).dll + BugTrap.def + $(OutDir)$(TargetName).pdb + false + + false + MachineX86 + + + + + MinSpace + OnlyExplicitInline + true + _USRDLL;BUGTRAP_EXPORTS;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + Level4 + ProgramDatabase + + + 0x0409 + $(IntDir)$(TargetName).res + + + ws2_32.lib;comctl32.lib;shlwapi.lib;version.lib;wininet.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).dll + BugTrap.def + $(OutDir)$(TargetName).pdb + false + + + false + MachineX86 + + + + + true + true + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {893279cb-0805-405f-b484-9bb728a18261} + false + + + {ca2604ca-a2ac-49a1-a468-8ab5a2e6cbc9} + false + + + + + + \ No newline at end of file diff --git a/trunk/BugTrap/BugTrap.vcxproj.filters b/trunk/BugTrap/BugTrap.vcxproj.filters new file mode 100644 index 00000000..f4a8b000 --- /dev/null +++ b/trunk/BugTrap/BugTrap.vcxproj.filters @@ -0,0 +1,436 @@ + + + + + {de0f9fbb-2c89-4b65-a9c9-d871ea4e1908} + + + {233d2741-7a49-4049-930b-0d955ee607cd} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {96d76b1b-4770-43c3-a89f-5ffd59629cf3} + h;hpp;hxx;hm;inl;inc + + + {0ff07f1a-68fe-4509-a214-38b9dd9c626a} + + + {5289a45c-0b2e-458c-928f-dfce0b769c37} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {dd27b334-e4cd-4292-9f3d-2724355a4b55} + h;hpp;hxx;hm;inl;inc + + + {67e1df4c-8556-4faa-b16f-1c18c2845f4f} + + + {a553188b-be89-4d87-ace7-50b5a941e05d} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {938dbb74-de93-4f48-baaa-963d903343a4} + h;hpp;hxx;hm;inl;inc + + + {13ff75c5-5c5a-4191-8245-fb712b88f60f} + + + {bda0d81a-3a77-4e87-9784-b2a7048c64f1} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {8642cac0-75b6-43d9-aa62-07f7740122bd} + + + {612f68b6-a087-47f1-a85b-0fe093781f30} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {a68906fb-dbe1-49ff-aef9-6dc00e340057} + h;hpp;hxx;hm;inl;inc + + + {6d8dbb7b-7a0d-4e79-95a1-dbcdb5a3d5bd} + h;hpp;hxx;hm;inl;inc + + + {97e858c7-52c1-4d68-a17f-dea5e09aa3e1} + + + {2aa1bc5b-4717-49d6-b50e-c0dfb31c87f0} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {1cef53b1-6daf-4053-abdd-42ea971f9ffa} + h;hpp;hxx;hm;inl;inc + + + {9647afbb-1399-4595-9cbd-4e7825942424} + + + {06f99633-8a5f-4bfc-a60f-299b7c2d96f5} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {aa7e9549-7d06-482e-b534-2fef89a5d59d} + h;hpp;hxx;hm;inl;inc + + + {fe28afd9-bf1e-4ef3-a4ea-cbe5e205fa85} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + {6a05c7a1-6ae7-4381-a8ab-e84dafe74828} + + + {a3a5a6ee-d572-4582-8662-3a0a131cac87} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {494aa86f-e061-47c1-b7f6-890a617c8238} + h;hpp;hxx;hm;inl;inc + + + {37d7d231-d3eb-4316-9ddc-4bbcb427b262} + + + {5aca7c6f-c0a0-4140-9f86-cf0479f2663c} + cpp;c;cxx;def;odl;idl;hpj;bat;asm + + + {4870e840-d228-4f24-8d14-f9bde2864ace} + h;hpp;hxx;hm;inl;inc + + + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Dialogs\Source Files + + + Collections\Source Files + + + Collections\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + Controls\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files + + + System\Source Files\XML\Source Files + + + System\Source Files\XML\Source Files + + + Main\Source Files + + + Main\Source Files + + + Main\Source Files + + + Main\Source Files + + + Main\Source Files + + + Accessories\Source Files + + + Accessories\Source Files + + + Streams\Source Files + + + Streams\Source Files + + + Streams\Source Files + + + Streams\Source Files + + + Streams\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Dialogs\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Collections\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + Controls\Header Files + + + System\Source Files\XML\Header Files + + + System\Source Files\XML\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + System\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Main\Header Files + + + Accessories\Header Files + + + Accessories\Header Files + + + Accessories\Header Files + + + Accessories\Header Files + + + Accessories\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Streams\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + + + Accessories\Resource Files + + + Accessories\Resource Files + + + Accessories\Resource Files + + + Accessories\Resource Files + + + + + Accessories\Resource Files + + + Accessories\Resource Files + + + + + Accessories\Resource Files + + + \ No newline at end of file diff --git a/trunk/BugTrap/Encoding.h b/trunk/BugTrap/Encoding.h index 064a2356..3720a8b7 100644 --- a/trunk/BugTrap/Encoding.h +++ b/trunk/BugTrap/Encoding.h @@ -17,6 +17,7 @@ #include "Stream.h" #include "StrStream.h" +#ifndef HIGH_SURROGATE_START /// Lower value of Unicode high-surrogate character. #define HIGH_SURROGATE_START 0xD800 /// Higher value of Unicode high-surrogate character. @@ -25,6 +26,7 @@ #define LOW_SURROGATE_START 0xDC00 /// Higher value of Unicode low-surrogate character. #define LOW_SURROGATE_END 0xDFFF +#endif /// Text encoding. enum TEXT_ENCODING diff --git a/trunk/Common.props b/trunk/Common.props new file mode 100644 index 00000000..190315db --- /dev/null +++ b/trunk/Common.props @@ -0,0 +1,130 @@ + + + + + + + + Win32 + + + Win32 + + + Win64 + + + $(Platform) + + + + $(SolutionDir)..\xr_build\ + + + + $(xrBuildDir)bin\ + $(xrBuildDir)lib\ + $(xrBuildDir)bin\$(xrPlatform)\$(Configuration)\ + $(xrBuildDir)lib\$(xrPlatform)\$(Configuration)\ + $(xrBuildDir)intermediate\$(xrPlatform)\$(Configuration)\ + $(SolutionDir)..\SDK\ + $(SolutionDir)..\externals\ + + + + $(xrBinDir) + $(xrBinDir) + $(xrLibDir) + $(xrLibDir) + + $(xrIntDir)$(ProjectName)\ + + + + true + + + + false + + + + + + $(SolutionDir); + $(xrSdkDir)dxSDK/Include; + %(AdditionalIncludeDirectories) + + + + MSVC; + WIN32; + _WINDOWS; + _SECURE_SCL=0; + %(PreprocessorDefinitions) + + Fast + Use + true + + + + + false + Disabled + + + + + Disabled + + + + true + true + false + + + + true + MaxSpeed + Speed + AnySuitable + true + + + + + $(xrLibDir); + $(xrSdkDir)dxSDK\Lib; + %(AdditionalLibraryDirectories) + + $(xrLibDir)$(TargetName).lib + true + Windows + + + + true + + + + true + true + UseLinkTimeCodeGeneration + + + + + $(xrLibDir); + $(xrSdkDir)dxSDK\Lib; + %(AdditionalLibraryDirectories) + + $(xrLibDir)$(TargetName).lib + + + + true + + + \ No newline at end of file diff --git a/trunk/ConfigurationDefs.props b/trunk/ConfigurationDefs.props new file mode 100644 index 00000000..7d2fddb6 --- /dev/null +++ b/trunk/ConfigurationDefs.props @@ -0,0 +1,34 @@ + + + + + + DEBUG;%(PreprocessorDefinitions) + + + + + DEBUG;%(PreprocessorDefinitions) + + + + + DEBUG;MIXED;%(PreprocessorDefinitions) + + + + + DEBUG;MIXED;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + \ No newline at end of file diff --git a/trunk/ETools/ETools.vcxproj b/trunk/ETools/ETools.vcxproj new file mode 100644 index 00000000..fcd23999 --- /dev/null +++ b/trunk/ETools/ETools.vcxproj @@ -0,0 +1,275 @@ + + + + + Debug + Win32 + + + Mixed + Win32 + + + Release + Win32 + + + + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33} + + + + + DynamicLibrary + false + MultiByte + v120 + + + DynamicLibrary + false + MultiByte + v120 + + + DynamicLibrary + false + MultiByte + v120 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + $(SolutionDir)xrCore;$(xrSdkDir)Xiph\Include;$(IncludePath) + $(xrSdkDir)Xiph\Libs;$(LibraryPath) + $(SolutionDir)xrCore;$(xrSdkDir)Xiph\Include;$(IncludePath) + $(xrSdkDir)Xiph\Libs;$(LibraryPath) + $(SolutionDir)xrCore;$(xrSdkDir)Xiph\Include;$(IncludePath) + $(xrSdkDir)Xiph\Libs;$(LibraryPath) + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/CreateDX.tlb + + + true + true + ../xrQslim/src/;%(AdditionalIncludeDirectories) + ETOOLS_EXPORTS;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + StreamingSIMDExtensions + false + stdafx.h + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Cdecl + + + NDEBUG;%(PreprocessorDefinitions) + 0x0422 + + + /MACHINE:I386 %(AdditionalOptions) + ogg_static.lib;vorbis_static.lib;vorbisenc_static.lib;vorbisfile_static.lib;%(AdditionalDependencies) + false + user32.lib;%(IgnoreSpecificDefaultLibraries) + $(OutDir)$(ProjectName).pdb + false + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/CreateDX.tlb + + + true + ../xrQslim/src/;%(AdditionalIncludeDirectories) + _USRDLL;ETOOLS_EXPORTS;%(PreprocessorDefinitions) + Sync + MultiThreadedDLL + false + stdafx.h + $(IntDir) + $(IntDir) + $(IntDir) + + + Level4 + true + ProgramDatabase + Cdecl + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0422 + + + /MACHINE:I386 /NODEFAULTLIB:LIBCMTD %(AdditionalOptions) + ogg_static_d.lib;vorbis_static_d.lib;vorbisenc_static.lib;vorbisfile_static_d.lib;%(AdditionalDependencies) + true + user32.lib;%(IgnoreSpecificDefaultLibraries) + false + + + false + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/CreateDX.tlb + + + true + ../xrQslim/src/;%(AdditionalIncludeDirectories) + ETOOLS_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + stdafx.h + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + ProgramDatabase + Cdecl + + + NDEBUG;%(PreprocessorDefinitions) + 0x0422 + + + /MACHINE:I386 /NODEFAULTLIB:user32 %(AdditionalOptions) + ogg_static.lib;vorbis_static.lib;vorbisenc_static.lib;vorbisfile_static.lib;%(AdditionalDependencies) + true + user32.dll;%(IgnoreSpecificDefaultLibraries) + false + $(OutDir)$(ProjectName).map + + + + + + + + + + + Create + Create + Create + + + Level4 + + + + + true + true + true + + + + Level4 + TurnOffAllWarnings + TurnOffAllWarnings + + + $(IntDir)%(Filename)1.obj + Level4 + $(IntDir)%(Filename)1.obj + TurnOffAllWarnings + $(IntDir)%(Filename)1.obj + TurnOffAllWarnings + + + Level4 + TurnOffAllWarnings + TurnOffAllWarnings + + + Level4 + TurnOffAllWarnings + TurnOffAllWarnings + + + Level4 + TurnOffAllWarnings + TurnOffAllWarnings + + + + + + + + + + + + + + + + + + + + + + + {a19b1df2-82ec-4364-8bdf-85d13a1c89b5} + false + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + false + + + {f1836ce2-59ef-4189-8b9c-d103a511cb27} + false + + + + + + \ No newline at end of file diff --git a/trunk/ETools/ETools.vcxproj.filters b/trunk/ETools/ETools.vcxproj.filters new file mode 100644 index 00000000..98a5399b --- /dev/null +++ b/trunk/ETools/ETools.vcxproj.filters @@ -0,0 +1,113 @@ + + + + + {0dc9a2a1-514f-4206-9499-826ed078f62f} + + + {9dbcfb6b-9215-4f92-9cdd-cf736d0f4e12} + + + {6c04e3bf-03d3-4b8f-b9c8-2831c82d2133} + + + + + Kernel + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + OGG encoder + + + OGG encoder + + + OGG encoder + + + OGG encoder + + + OGG encoder + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + VIPM + + + OGG encoder + + + OGG encoder + + + OGG encoder + + + OGG encoder + + + \ No newline at end of file diff --git a/trunk/LWO/LWO.vcxproj b/trunk/LWO/LWO.vcxproj new file mode 100644 index 00000000..c844a5b1 --- /dev/null +++ b/trunk/LWO/LWO.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Mixed + Win32 + + + Release + Win32 + + + + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED} + + + + + DynamicLibrary + v120 + false + MultiByte + + + DynamicLibrary + v120 + false + MultiByte + + + DynamicLibrary + v120 + false + MultiByte + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + + %(PreprocessorDefinitions) + true + true + Win32 + .\Release/LWO.tlb + + + _USRDLL;LWO_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + StdCall + NotUsing + + + NDEBUG;%(PreprocessorDefinitions) + 0x0419 + + + /MACHINE:I386 %(AdditionalOptions) + odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).dll + true + $(OutDir)$(ProjectName).pdb + + + + + %(PreprocessorDefinitions) + true + true + Win32 + .\Release/LWO.tlb + + + _USRDLL;LWO_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + StdCall + NotUsing + + + NDEBUG;%(PreprocessorDefinitions) + 0x0419 + + + /MACHINE:I386 %(AdditionalOptions) + odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).dll + true + $(OutDir)$(ProjectName).pdb + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/LWO.tlb + + + _USRDLL;LWO_EXPORTS; _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDLL + $(IntDir) + $(IntDir) + $(IntDir) + Level3 + true + EditAndContinue + StdCall + NotUsing + + + _DEBUG;%(PreprocessorDefinitions) + 0x0419 + + + /MACHINE:I386 %(AdditionalOptions) + odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).dll + true + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/LWO/LWO.vcxproj.filters b/trunk/LWO/LWO.vcxproj.filters new file mode 100644 index 00000000..6bdfbb58 --- /dev/null +++ b/trunk/LWO/LWO.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {eeb43554-e517-4aa9-a6ea-8f432b5d72cf} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/trunk/XR_3DA.sln b/trunk/XR_3DA.sln new file mode 100644 index 00000000..237a8684 --- /dev/null +++ b/trunk/XR_3DA.sln @@ -0,0 +1,613 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bugtrap", "bugtrap", "{6BE93BFF-E2B4-43F2-ADBB-F8971E43CD5A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dedicated", "dedicated", "{3FC858CB-4888-42FF-ABC5-82DAECB59C2C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rd party", "3rd party", "{2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XR_3DA", "xr_3da\XR_3DA.vcxproj", "{2578C6D8-660D-48AE-9322-7422F8664F06}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCPU_Pipe", "xr_3da\xrCPU_Pipe\xrCPU_Pipe.vcxproj", "{CA0649DD-D089-423A-981C-46B57A884EB9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrGame", "xr_3da\xrGame\xrGame.vcxproj", "{200652A6-043E-4634-8837-87983B3BD5E0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrSound", "xrSound\xrSound.vcxproj", "{CCCA7859-EB86-493E-9B53-C4235F45B3C5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCore", "xrCore\xrCore.vcxproj", "{A0F7D1FB-59A7-4717-A7E4-96F37E91998E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCDB", "xrCDB\xrCDB.vcxproj", "{A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrRender_R1", "xr_3da\xrRender_R1\xrRender_R1.vcxproj", "{57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrRender_R2", "xr_3da\xrRender_R2\xrRender_R2.vcxproj", "{963BA4E5-499A-454D-B002-1D5ECE0527A6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrXMLParser", "xrXMLParser\xrXMLParser.vcxproj", "{94A1C366-3D19-48E6-8170-4ADC2E70DF98}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ode", "xrODE\contrib\msvc7\ode_default\default.vcxproj", "{1BF75FEB-87DD-486C-880B-227987D191C2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrParticles", "xrParticles\xrParticles.vcxproj", "{94A1C366-3D19-48E6-8170-4ADC2E70DF97}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrNetServer", "xrNetServer\xrNetServer.vcxproj", "{435BAC9A-B225-457D-AB40-C9BD0CC8838C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrSE_Factory", "xrSE_Factory\xrSE_Factory.vcxproj", "{3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCompress", "xrCompress\xrCompress.vcxproj", "{EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXT", "xrDXT\DXT.vcxproj", "{EBF9B543-0830-4866-9B48-DC0740E87E8A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrLC", "xrLC\xrLC.vcxproj", "{A4ABD75E-825B-4D09-B3B2-2709682E40C8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrQSlim", "xrQSlim\xrQSlim.vcxproj", "{F1836CE2-59EF-4189-8B9C-D103A511CB27}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrDO_Light", "xrLC\xrDO_Light\xrDO_Light.vcxproj", "{B730F54D-1199-481A-AAD0-5DB684E067C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrAI", "xrAI\xrAI.vcxproj", "{EA5932F3-02FE-4AD3-89E8-7072DC465D25}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ETools", "ETools\ETools.vcxproj", "{65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrD3D9-Null", "xr_3da\xrGame\xrD3D9-Null\xrD3D9-Null.vcxproj", "{0899B131-F1D4-4876-9BA1-67AC821DB9E1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrGameSpy", "xr_3da\xrGame\xrGameSpy\xrGameSpy.vcxproj", "{5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stalker_net", "xr_3da\Stalker_Net\Stalker_net.vcxproj", "{AF9ACB0D-451A-4878-A04C-0B9E221CC705}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrStatisticConvert", "xr_3da\xrStatisticConvert\xrStatisticConvert.vcxproj", "{2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrLua", "xrLua\xrLua.vcxproj", "{9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openal32", "xrOpenAL\OpenAL-Windows\Router\Router.vcxproj", "{566551F4-4EF1-4CB4-A131-F982E7606907}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BugTrap", "BugTrap\BugTrap.vcxproj", "{E8CF1ADA-264A-4127-86C2-FD7057D3792C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcxproj", "{CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip\minizip.vcxproj", "{893279CB-0805-405F-B484-9BB728A18261}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrCoreStatic", "xrCore\xrCoreStatic.vcxproj", "{F1066EAC-EE25-4C7A-9023-5957A6F7BA27}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LWO", "LWO\LWO.vcxproj", "{A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Render", "Render", "{B49A7C21-376A-4D31-BADB-F69726CB39E0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{259D3FDC-5BA5-46B1-99D3-8C3B1470331C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NVTT", "..\externals\NVTT\NVTT.vcxproj", "{0EB257DC-5CFC-44B0-82C9-CE6B158BE473}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_Dedicated|Win32 = Debug_Dedicated|Win32 + Debug_Priquel|Win32 = Debug_Priquel|Win32 + Debug|Win32 = Debug|Win32 + Mixed_Dedicated|Win32 = Mixed_Dedicated|Win32 + Mixed_Priquel|Win32 = Mixed_Priquel|Win32 + Mixed|Win32 = Mixed|Win32 + Release_Dedicated|Win32 = Release_Dedicated|Win32 + Release_Priquel|Win32 = Release_Priquel|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug_Dedicated|Win32.ActiveCfg = Debug_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug_Dedicated|Win32.Build.0 = Debug_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug|Win32.ActiveCfg = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Debug|Win32.Build.0 = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed_Dedicated|Win32.ActiveCfg = Mixed_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed_Dedicated|Win32.Build.0 = Mixed_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed_Priquel|Win32.ActiveCfg = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed_Priquel|Win32.Build.0 = Debug|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Mixed|Win32.Build.0 = Mixed|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release_Dedicated|Win32.ActiveCfg = Release_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release_Dedicated|Win32.Build.0 = Release_Dedicated|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release_Priquel|Win32.Build.0 = Release|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release|Win32.ActiveCfg = Release|Win32 + {2578C6D8-660D-48AE-9322-7422F8664F06}.Release|Win32.Build.0 = Release|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Debug|Win32.ActiveCfg = Debug|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Debug|Win32.Build.0 = Debug|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Mixed|Win32.Build.0 = Mixed|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Release_Priquel|Win32.Build.0 = Release|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Release|Win32.ActiveCfg = Release|Win32 + {CA0649DD-D089-423A-981C-46B57A884EB9}.Release|Win32.Build.0 = Release|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Debug_Priquel|Win32.ActiveCfg = Debug_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Debug_Priquel|Win32.Build.0 = Debug_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Debug|Win32.Build.0 = Debug|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Mixed_Priquel|Win32.ActiveCfg = Debug_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Mixed_Priquel|Win32.Build.0 = Debug_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Mixed|Win32.Build.0 = Mixed|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Release_Priquel|Win32.ActiveCfg = Release_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Release_Priquel|Win32.Build.0 = Release_Priquel|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Release|Win32.ActiveCfg = Release|Win32 + {200652A6-043E-4634-8837-87983B3BD5E0}.Release|Win32.Build.0 = Release|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Debug|Win32.ActiveCfg = Debug|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Debug|Win32.Build.0 = Debug|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Mixed|Win32.Build.0 = Mixed|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release_Priquel|Win32.Build.0 = Release|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release|Win32.ActiveCfg = Release|Win32 + {CCCA7859-EB86-493E-9B53-C4235F45B3C5}.Release|Win32.Build.0 = Release|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Debug_Priquel|Win32.ActiveCfg = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Debug_Priquel|Win32.Build.0 = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Debug|Win32.ActiveCfg = Debug|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Debug|Win32.Build.0 = Debug|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Mixed|Win32.Build.0 = Mixed|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Release_Priquel|Win32.Build.0 = Release|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Release|Win32.ActiveCfg = Release|Win32 + {A0F7D1FB-59A7-4717-A7E4-96F37E91998E}.Release|Win32.Build.0 = Release|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Debug|Win32.ActiveCfg = Debug|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Debug|Win32.Build.0 = Debug|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Mixed|Win32.Build.0 = Mixed|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Release_Priquel|Win32.Build.0 = Release|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Release|Win32.ActiveCfg = Release|Win32 + {A19B1DF2-82EC-4364-8BDF-85D13A1C89B5}.Release|Win32.Build.0 = Release|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Debug|Win32.ActiveCfg = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Debug|Win32.Build.0 = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Mixed_Priquel|Win32.ActiveCfg = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Mixed_Priquel|Win32.Build.0 = Debug|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Mixed|Win32.Build.0 = Mixed|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Release_Priquel|Win32.Build.0 = Release|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Release|Win32.ActiveCfg = Release|Win32 + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2}.Release|Win32.Build.0 = Release|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Debug|Win32.ActiveCfg = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Debug|Win32.Build.0 = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Mixed_Priquel|Win32.ActiveCfg = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Mixed_Priquel|Win32.Build.0 = Debug|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Mixed|Win32.Build.0 = Mixed|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Release_Priquel|Win32.Build.0 = Release|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Release|Win32.ActiveCfg = Release|Win32 + {963BA4E5-499A-454D-B002-1D5ECE0527A6}.Release|Win32.Build.0 = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Debug|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Debug|Win32.Build.0 = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Mixed|Win32.Build.0 = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Release_Priquel|Win32.Build.0 = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Release|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF98}.Release|Win32.Build.0 = Release|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Debug|Win32.ActiveCfg = Debug|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Debug|Win32.Build.0 = Debug|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Mixed|Win32.Build.0 = Mixed|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Release_Priquel|Win32.Build.0 = Release|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Release|Win32.ActiveCfg = Release|Win32 + {1BF75FEB-87DD-486C-880B-227987D191C2}.Release|Win32.Build.0 = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Debug|Win32.ActiveCfg = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Debug|Win32.Build.0 = Debug|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Mixed|Win32.Build.0 = Mixed|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Release_Priquel|Win32.Build.0 = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Release|Win32.ActiveCfg = Release|Win32 + {94A1C366-3D19-48E6-8170-4ADC2E70DF97}.Release|Win32.Build.0 = Release|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Debug|Win32.ActiveCfg = Debug|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Debug|Win32.Build.0 = Debug|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Mixed|Win32.Build.0 = Mixed|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Release_Priquel|Win32.Build.0 = Release|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Release|Win32.ActiveCfg = Release|Win32 + {435BAC9A-B225-457D-AB40-C9BD0CC8838C}.Release|Win32.Build.0 = Release|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Debug|Win32.ActiveCfg = Debug|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Debug|Win32.Build.0 = Debug|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Mixed|Win32.Build.0 = Mixed|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Release|Win32.ActiveCfg = Release|Win32 + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61}.Release|Win32.Build.0 = Release|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|Win32.ActiveCfg = Debug|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Debug|Win32.Build.0 = Debug|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Mixed|Win32.Build.0 = Mixed|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release_Priquel|Win32.Build.0 = Release|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|Win32.ActiveCfg = Release|Win32 + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B}.Release|Win32.Build.0 = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Debug|Win32.ActiveCfg = Debug|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Debug|Win32.Build.0 = Debug|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Mixed|Win32.Build.0 = Mixed|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Release_Priquel|Win32.Build.0 = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Release|Win32.ActiveCfg = Release|Win32 + {EBF9B543-0830-4866-9B48-DC0740E87E8A}.Release|Win32.Build.0 = Release|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Debug_Priquel|Win32.ActiveCfg = Debug_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Debug_Priquel|Win32.Build.0 = Debug_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Debug|Win32.ActiveCfg = Debug|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Debug|Win32.Build.0 = Debug|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Mixed_Priquel|Win32.ActiveCfg = Mixed_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Mixed_Priquel|Win32.Build.0 = Mixed_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Mixed|Win32.Build.0 = Mixed|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Release_Priquel|Win32.ActiveCfg = Release_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Release_Priquel|Win32.Build.0 = Release_Priquel|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Release|Win32.ActiveCfg = Release|Win32 + {A4ABD75E-825B-4D09-B3B2-2709682E40C8}.Release|Win32.Build.0 = Release|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Debug|Win32.ActiveCfg = Debug|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Debug|Win32.Build.0 = Debug|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Mixed|Win32.Build.0 = Mixed|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Release_Priquel|Win32.Build.0 = Release|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Release|Win32.ActiveCfg = Release|Win32 + {F1836CE2-59EF-4189-8B9C-D103A511CB27}.Release|Win32.Build.0 = Release|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Debug_Priquel|Win32.ActiveCfg = Debug_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Debug_Priquel|Win32.Build.0 = Debug_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Debug|Win32.Build.0 = Debug|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Mixed_Priquel|Win32.ActiveCfg = Mixed_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Mixed_Priquel|Win32.Build.0 = Mixed_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Mixed|Win32.Build.0 = Mixed|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Release_Priquel|Win32.ActiveCfg = Release_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Release_Priquel|Win32.Build.0 = Release_Priquel|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Release|Win32.ActiveCfg = Release|Win32 + {B730F54D-1199-481A-AAD0-5DB684E067C0}.Release|Win32.Build.0 = Release|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Debug_Priquel|Win32.ActiveCfg = Debug_Priquel|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Debug_Priquel|Win32.Build.0 = Debug_Priquel|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Debug|Win32.ActiveCfg = Debug|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Debug|Win32.Build.0 = Debug|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Mixed_Priquel|Win32.ActiveCfg = Mixed_Priquel|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Mixed_Priquel|Win32.Build.0 = Mixed_Priquel|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Mixed|Win32.Build.0 = Mixed|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Release_Priquel|Win32.ActiveCfg = Release_Priquel|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Release|Win32.ActiveCfg = Release|Win32 + {EA5932F3-02FE-4AD3-89E8-7072DC465D25}.Release|Win32.Build.0 = Release|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Debug|Win32.ActiveCfg = Debug|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Debug|Win32.Build.0 = Debug|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Mixed|Win32.Build.0 = Mixed|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Release_Priquel|Win32.Build.0 = Release|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Release|Win32.ActiveCfg = Release|Win32 + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33}.Release|Win32.Build.0 = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Debug|Win32.ActiveCfg = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Debug|Win32.Build.0 = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Mixed_Dedicated|Win32.ActiveCfg = Debug|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Mixed|Win32.Build.0 = Mixed|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release_Priquel|Win32.Build.0 = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|Win32.ActiveCfg = Release|Win32 + {0899B131-F1D4-4876-9BA1-67AC821DB9E1}.Release|Win32.Build.0 = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Debug|Win32.ActiveCfg = Debug|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Debug|Win32.Build.0 = Debug|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Mixed|Win32.Build.0 = Mixed|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Release_Priquel|Win32.Build.0 = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Release|Win32.ActiveCfg = Release|Win32 + {5535F6B4-7AE6-4B66-8AEA-CC31C14D7AB7}.Release|Win32.Build.0 = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Debug|Win32.ActiveCfg = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Debug|Win32.Build.0 = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Mixed_Priquel|Win32.ActiveCfg = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Mixed_Priquel|Win32.Build.0 = Debug|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Mixed|Win32.Build.0 = Mixed|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Release_Priquel|Win32.Build.0 = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Release|Win32.ActiveCfg = Release|Win32 + {AF9ACB0D-451A-4878-A04C-0B9E221CC705}.Release|Win32.Build.0 = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Debug|Win32.ActiveCfg = Debug|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Debug|Win32.Build.0 = Debug|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Release_Priquel|Win32.Build.0 = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Release|Win32.ActiveCfg = Release|Win32 + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1}.Release|Win32.Build.0 = Release|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Debug|Win32.ActiveCfg = Debug|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Debug|Win32.Build.0 = Debug|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Mixed|Win32.Build.0 = Mixed|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Release_Priquel|Win32.Build.0 = Release|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Release|Win32.ActiveCfg = Release|Win32 + {9ACE5473-6D68-4B96-AC42-B39EABA0FE1F}.Release|Win32.Build.0 = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Debug|Win32.ActiveCfg = Debug|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Debug|Win32.Build.0 = Debug|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Mixed|Win32.Build.0 = Mixed|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Release_Priquel|Win32.Build.0 = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Release|Win32.ActiveCfg = Release|Win32 + {566551F4-4EF1-4CB4-A131-F982E7606907}.Release|Win32.Build.0 = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Debug|Win32.ActiveCfg = Debug|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Debug|Win32.Build.0 = Debug|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Mixed|Win32.Build.0 = Mixed|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Release_Priquel|Win32.Build.0 = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Release|Win32.ActiveCfg = Release|Win32 + {E8CF1ADA-264A-4127-86C2-FD7057D3792C}.Release|Win32.Build.0 = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Debug|Win32.ActiveCfg = Debug|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Debug|Win32.Build.0 = Debug|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Mixed|Win32.Build.0 = Mixed|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Release_Priquel|Win32.Build.0 = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Release|Win32.ActiveCfg = Release|Win32 + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9}.Release|Win32.Build.0 = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Debug|Win32.ActiveCfg = Debug|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Debug|Win32.Build.0 = Debug|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Mixed|Win32.Build.0 = Mixed|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Release_Priquel|Win32.Build.0 = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Release|Win32.ActiveCfg = Release|Win32 + {893279CB-0805-405F-B484-9BB728A18261}.Release|Win32.Build.0 = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Dedicated|Win32.Build.0 = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Win32.ActiveCfg = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Debug|Win32.Build.0 = Debug|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|Win32.ActiveCfg = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Dedicated|Win32.Build.0 = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Priquel|Win32.ActiveCfg = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed_Priquel|Win32.Build.0 = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Mixed|Win32.Build.0 = Mixed|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Dedicated|Win32.Build.0 = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release_Priquel|Win32.Build.0 = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Win32.ActiveCfg = Release|Win32 + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27}.Release|Win32.Build.0 = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug_Dedicated|Win32.Build.0 = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug|Win32.ActiveCfg = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Debug|Win32.Build.0 = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed_Dedicated|Win32.ActiveCfg = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed_Dedicated|Win32.Build.0 = Debug|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Mixed|Win32.Build.0 = Mixed|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release_Dedicated|Win32.Build.0 = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release_Priquel|Win32.Build.0 = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release|Win32.ActiveCfg = Release|Win32 + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED}.Release|Win32.Build.0 = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug_Dedicated|Win32.Build.0 = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug_Priquel|Win32.ActiveCfg = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug_Priquel|Win32.Build.0 = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug|Win32.ActiveCfg = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Debug|Win32.Build.0 = Debug|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed_Dedicated|Win32.Build.0 = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed_Priquel|Win32.ActiveCfg = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed_Priquel|Win32.Build.0 = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed|Win32.ActiveCfg = Mixed|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Mixed|Win32.Build.0 = Mixed|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release_Dedicated|Win32.ActiveCfg = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release_Dedicated|Win32.Build.0 = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release_Priquel|Win32.ActiveCfg = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release_Priquel|Win32.Build.0 = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release|Win32.ActiveCfg = Release|Win32 + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6BE93BFF-E2B4-43F2-ADBB-F8971E43CD5A} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} + {57A498C9-A741-4DDF-8EFC-BFB9EB6B00E2} = {B49A7C21-376A-4D31-BADB-F69726CB39E0} + {963BA4E5-499A-454D-B002-1D5ECE0527A6} = {B49A7C21-376A-4D31-BADB-F69726CB39E0} + {1BF75FEB-87DD-486C-880B-227987D191C2} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} + {3AD26FD3-4F52-4E22-A4CF-AD4C49E74C61} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {EF76867B-6EB8-4DC0-A1D6-E964FAD6FC7B} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {EBF9B543-0830-4866-9B48-DC0740E87E8A} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {A4ABD75E-825B-4D09-B3B2-2709682E40C8} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {F1836CE2-59EF-4189-8B9C-D103A511CB27} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {B730F54D-1199-481A-AAD0-5DB684E067C0} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {EA5932F3-02FE-4AD3-89E8-7072DC465D25} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {65CBB9D0-FBC6-41A4-8316-F5E9B5D7FB33} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {0899B131-F1D4-4876-9BA1-67AC821DB9E1} = {3FC858CB-4888-42FF-ABC5-82DAECB59C2C} + {AF9ACB0D-451A-4878-A04C-0B9E221CC705} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {2EA2CBBA-16BD-4B97-80B3-3F824CFBD4F1} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {566551F4-4EF1-4CB4-A131-F982E7606907} = {2BFC806B-CE92-4EA4-8FE8-5F2EA54BA348} + {E8CF1ADA-264A-4127-86C2-FD7057D3792C} = {6BE93BFF-E2B4-43F2-ADBB-F8971E43CD5A} + {CA2604CA-A2AC-49A1-A468-8AB5A2E6CBC9} = {6BE93BFF-E2B4-43F2-ADBB-F8971E43CD5A} + {893279CB-0805-405F-B484-9BB728A18261} = {6BE93BFF-E2B4-43F2-ADBB-F8971E43CD5A} + {F1066EAC-EE25-4C7A-9023-5957A6F7BA27} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {A6EBBBBB-5FEF-4C20-8460-DFAB11734DED} = {89F6A7EE-3BBE-45D3-A8A8-5D9366CD987B} + {0EB257DC-5CFC-44B0-82C9-CE6B158BE473} = {259D3FDC-5BA5-46B1-99D3-8C3B1470331C} + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection +EndGlobal diff --git a/trunk/minizip/minizip.vcxproj b/trunk/minizip/minizip.vcxproj new file mode 100644 index 00000000..1e7f658f --- /dev/null +++ b/trunk/minizip/minizip.vcxproj @@ -0,0 +1,114 @@ + + + + + Debug + Win32 + + + Mixed + Win32 + + + Release + Win32 + + + + {893279CB-0805-405F-B484-9BB728A18261} + minizip + Win32Proj + + + + + StaticLibrary + v120 + MultiByte + + + StaticLibrary + v120 + MultiByte + + + StaticLibrary + v120 + MultiByte + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.21005.1 + + + + _LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDLL + NotUsing + Level3 + EditAndContinue + + + + + _LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + NotUsing + Level3 + ProgramDatabase + + + + + _LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + NotUsing + Level3 + ProgramDatabase + + + + + + + + + + + + + + + + true + true + true + + + + + + + + {ca2604ca-a2ac-49a1-a468-8ab5a2e6cbc9} + false + + + + + + \ No newline at end of file diff --git a/trunk/xrAI/PropertiesListTypes.h b/trunk/xrAI/PropertiesListTypes.h index 56244350..a4cfdd4c 100644 --- a/trunk/xrAI/PropertiesListTypes.h +++ b/trunk/xrAI/PropertiesListTypes.h @@ -42,8 +42,8 @@ class PropItem; DEFINE_VECTOR (PropItem*,PropItemVec,PropItemIt); //------------------------------------------------------------------------------ -#include "ChooseTypes.H" -#include "fastdelegate.h" +#include "../xrCore/ChooseTypes.H" +#include "fastdelegate.h" //------------------------------------------------------------------------------ typedef fastdelegate::FastDelegate2 TOnDrawTextEvent; typedef fastdelegate::FastDelegate1 TOnClick; diff --git a/trunk/xrAI/StdAfx.h b/trunk/xrAI/StdAfx.h index 157662e5..0a8984ee 100644 --- a/trunk/xrAI/StdAfx.h +++ b/trunk/xrAI/StdAfx.h @@ -18,7 +18,7 @@ #define ENGINE_API #define ECORE_API #define XR_EPROPS_API -#include "clsid.h" +#include "../xrCore/clsid.h" #include "defines.h" #include "cl_log.h" #include "xrCDB.h" diff --git a/trunk/xrAI/builder_allocator_constructor.h b/trunk/xrAI/builder_allocator_constructor.h index 61e87b26..f148af2c 100644 --- a/trunk/xrAI/builder_allocator_constructor.h +++ b/trunk/xrAI/builder_allocator_constructor.h @@ -15,13 +15,13 @@ template < struct CBuilderAllocatorConstructor { template

Luabind is a library that helps you create bindings +between C++ and lua. It +has the ability to expose functions and classes, written in C++, to lua. It will +also supply the functionality to define classes in lua and let them derive from +other lua classes or C++ classes. Lua classes can override virtual functions +from their C++ baseclasses. It is written towards lua 5.0, and does not work +with lua 4.