From 65b75f0667be43ac297fbbbd47ce2ad5d185e0aa Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 28 Jan 2012 23:15:16 -0800 Subject: [PATCH] Don't throw errors when including pnUtils stuff. --- Sources/Plasma/NucleusLib/pnUUID/pnUUID.h | 2 +- .../Plasma/NucleusLib/pnUtils/CMakeLists.txt | 1 - Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h | 5 +- .../NucleusLib/pnUtils/pnUtAllIncludes.h | 7 +- .../Plasma/NucleusLib/pnUtils/pnUtBase64.h | 5 +- .../Plasma/NucleusLib/pnUtils/pnUtBigNum.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtList.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h | 5 +- .../Plasma/NucleusLib/pnUtils/pnUtSkipList.h | 477 ------------------ Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h | 5 +- .../Plasma/NucleusLib/pnUtils/pnUtSpareList.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h | 5 +- Sources/Plasma/NucleusLib/pnUtils/pnUtTypes.h | 57 --- Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h | 6 +- 25 files changed, 47 insertions(+), 598 deletions(-) delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/pnUtSkipList.h delete mode 100644 Sources/Plasma/NucleusLib/pnUtils/pnUtTypes.h diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h index a07cbb43..91878faa 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID.h @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "hsStlUtils.h" #ifdef HS_BUILD_FOR_WIN32 -#include "pnUtils/pnUtils.h" +#include "pnUtils/pnUtUuid.h" #endif class hsStream; diff --git a/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt index e2655a48..56366de6 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt @@ -21,7 +21,6 @@ set(pnUtils_HEADERS pnUtPriQ.h pnUtRand.h pnUtRef.h - pnUtSkipList.h pnUtSort.h pnUtSpareList.h pnUtStr.h diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h index 9bc935a1..d0c28e9e 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtAddr.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTADDR_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAddr.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTADDR_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTADDR_H #include "Pch.h" @@ -169,3 +167,4 @@ unsigned NetAddressGetLocal ( unsigned count, NetAddressNode addresses[] ); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h index 6c06150a..8a0d9e12 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h @@ -52,16 +52,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUtCoreLib.h" // must be first in list #include "pnUtPragma.h" #include "pnUtAddr.h" +#if HS_BUILD_FOR_WIN32 #include "pnUtUuid.h" +#endif #include "pnUtMath.h" #include "pnUtSort.h" #include "pnUtArray.h" #include "pnUtList.h" #include "pnUtHash.h" #include "pnUtPriQ.h" +#if HS_BUILD_FOR_WIN32 #include "pnUtSync.h" +#endif #include "pnUtTime.h" +#if HS_BUILD_FOR_WIN32 #include "pnUtTls.h" +#endif #include "pnUtStr.h" #include "pnUtRef.h" #include "pnUtPath.h" @@ -72,6 +78,5 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnUtSpareList.h" #include "pnUtRand.h" #include "pnUtBase64.h" -#include "pnUtSkipList.h" #endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTALLINCLUDES_H diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.h index f4ba8756..f6635ebe 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtBase64.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBASE64_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBase64.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBASE64_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBASE64_H #include "Pch.h" @@ -84,3 +82,4 @@ unsigned Base64Decode ( unsigned dstChars, uint8_t * dstData ); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.h index 0d2ca4b9..c6e6f94d 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtBigNum.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBIGNUM_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtBigNum.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBIGNUM_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTBIGNUM_H #include "Pch.h" @@ -228,3 +226,4 @@ public: BN_sub(&m_number, &a.m_number, &b.m_number); } }; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h index a6f940b7..08c83364 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCMD_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCmd.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCMD_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCMD_H #include "Pch.h" @@ -145,3 +143,4 @@ public: ); }; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h index c922fc88..fcce7340 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCRYPT_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtCrypt.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCRYPT_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTCRYPT_H #include "Pch.h" @@ -182,3 +180,4 @@ void CryptDecrypt ( unsigned bytes, void * data ); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h index 9e87817c..04c3797d 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtHash.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTHASH_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTHASH_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTHASH_H #include "Pch.h" @@ -746,3 +744,4 @@ typedef THashKeyStr< wchar_t, THashKeyStrCmp > CHashKeyStr; typedef THashKeyStr< wchar_t, THashKeyStrCmpI > CHashKeyStrI; typedef THashKeyStr< char, THashKeyStrCmp > CHashKeyStrChar; typedef THashKeyStr< char, THashKeyStrCmpI > CHashKeyStrCharI; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtList.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtList.h index 0bfd4c35..f9a17bb1 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtList.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTLIST_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtList.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTLIST_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTLIST_H #include "Pch.h" @@ -641,3 +639,4 @@ template void TListDyn::Initialize (int linkOffset) { this->SetLinkOffset(linkOffset); } +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h index 0dd99599..ae1e67b2 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtMath.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMATH_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMath.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMATH_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMATH_H #include "Pch.h" @@ -115,3 +113,4 @@ inline unsigned MathNextMultiplePow2 (unsigned val, unsigned multiple) { inline uint32_t MathNextPow2 (uint32_t val) { return MathIsPow2(val) ? val : 1 << (MathHighBitPos(val) + 1); } +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h index 69e83f2c..5e400013 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtMisc.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMISC_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMISC_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTMISC_H #include "Pch.h" @@ -166,3 +164,4 @@ const unsigned kCpuCapTsc = 1<<9; // time stamp counter #define CPU_SIGNATURE_FAMILY(sig) ((sig >> 8) & 0xf) #define CPU_SIGNATURE_MODEL(sig) ((sig >> 4) & 0xf) #define CPU_SIGNATURE_STEPPING(sig) (sig & 0xf) +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h index 2c984069..5eb8c9a4 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtPath.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPATH_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPath.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPATH_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPATH_H #include "Pch.h" @@ -325,3 +323,4 @@ void PathSplitEmail ( unsigned subDomainChars, // arrsize(subs[0]) --> 256 unsigned subDomainCount // arrsize(subs) --> 16 ); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h index cdaa2e5a..862970bd 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPRIQ_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtPriQ.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPRIQ_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTPRIQ_H #include "Pch.h" @@ -486,3 +484,4 @@ public: private: unsigned m_time; }; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h index 4ed1bfcf..5383d49d 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtRand.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTRAND_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRand.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTRAND_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTRAND_H #include "Pch.h" @@ -66,3 +64,4 @@ float RandFloat (); float RandFloat (float minVal, float maxVal); unsigned RandUnsigned (); unsigned RandUnsigned (unsigned minVal, unsigned maxVal); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h index 2473c415..5b1f50f3 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H @@ -179,3 +177,4 @@ protected: private: long m_ref; }; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtSkipList.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtSkipList.h deleted file mode 100644 index df4668dd..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtSkipList.h +++ /dev/null @@ -1,477 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSKIPLIST_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSkipList.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSKIPLIST_H - - -/***************************************************************************** -* -* Macros -* -***/ - -#define SKIPLIST(type, keyType, keyField, cmp) TSkipList< type, keyType, offsetof(type, keyField), cmp > -#define SKIPLIST_NUMERIC(type, keyType, keyField) SKIPLIST(type, keyType, keyField, TSkipListNumericCmp) -#define SKIPLIST_STRING(type, keyType, keyField) SKIPLIST(type, keyType, keyField, TSkipListStringCmp) -#define SKIPLIST_STRINGI(type, keyType, keyField) SKIPLIST(type, keyType, keyField, TSkipListStringCmpI) - - - -/***************************************************************************** -* -* Typedefs -* -***/ - -typedef void * SkipListTag; - - -/***************************************************************************** -* -* Comparers -* -***/ - - -template -class TSkipListNumericCmp { -public: - static bool Eq (const K & a, const K & b) { return a == b; } - static bool Lt (const K & a, const K & b) { return a < b; } -}; - -template -class TSkipListStringCmp { -public: - static bool Eq (const K & a, const K & b) { return StrCmp(a, b, (unsigned)-1) == 0; } - static bool Lt (const K & a, const K & b) { return StrCmp(a, b, (unsigned)-1) < 0; } -}; - -template -class TSkipListStringCmpI { -public: - static bool Eq (const K & a, const K & b) { return StrCmpI(a, b, (unsigned)-1) == 0; } - static bool Lt (const K & a, const K & b) { return StrCmpI(a, b, (unsigned)-1) < 0; } -}; - - -/***************************************************************************** -* -* TSkipList -* -***/ - -template -class TSkipList { -private: - enum { kMaxLevels = 32 }; - - template - struct TNode { - const K2 * key; - T2 * object; - unsigned level; - TNode * prev; - TNode * next[1]; // variable size array - }; - typedef TNode Node; - - unsigned m_level; - Node * m_head; - Node * m_stop; - unsigned m_randomBits; - unsigned m_randomsLeft; - - Node * AllocNode (unsigned levels); - void FreeNode (Node * node); - unsigned RandomLevel (); - -public: - inline TSkipList (); - inline ~TSkipList (); - inline void Clear (); - inline void Delete (T * object); - inline T * Find (const K & key, SkipListTag * tag = nil) const; - inline T * FindNext (SkipListTag * tag) const; - inline T * Head (SkipListTag * tag) const; - inline T * Next (SkipListTag * tag) const; - inline T * Prev (SkipListTag * tag) const; - inline T * Tail (SkipListTag * tag) const; - inline void Link (T * object); - inline void Unlink (T * object); - inline void Unlink (SkipListTag * tag); - inline void UnlinkAll (); - - #ifdef HS_DEBUGGING - inline void Print () const; - #endif -}; - - -/***************************************************************************** -* -* TSkipList private member functions -* -***/ - -//============================================================================ -template -typename TSkipList::Node* TSkipList::AllocNode (unsigned level) { - - unsigned size = offsetof(Node, next) + (level + 1) * sizeof(Node); - Node * node = (Node *)malloc(size); - node->level = level; - return node; -} - -//============================================================================ -template -void TSkipList::FreeNode (TNode * node) { - - free(node); -} - -//============================================================================ -template -unsigned TSkipList::RandomLevel () { - - unsigned level = 0; - unsigned bits = 0; - - while (!bits) { - bits = m_randomBits % 4; - if (!bits) - ++level; - m_randomBits >>= 2; - m_randomsLeft -= 2; - if (!m_randomsLeft) { - m_randomBits = RandUnsigned(); - m_randomsLeft = 30; - } - } - - return level; -} - - -/***************************************************************************** -* -* TSkipList public member functions -* -***/ - -//============================================================================ -template -TSkipList::TSkipList () { - - m_level = 0; - m_head = AllocNode(kMaxLevels); - m_stop = AllocNode(0); - m_randomBits = RandUnsigned(); - m_randomsLeft = 30; - - // Initialize header and stop skip node pointers - m_stop->prev = m_head; - m_stop->object = nil; - m_stop->next[0] = nil; - m_head->object = nil; - for (unsigned index = 0; index < kMaxLevels; ++index) - m_head->next[index] = m_stop; -} - -//============================================================================ -template -TSkipList::~TSkipList () { - - UnlinkAll(); - ASSERT(m_stop->prev == m_head); - FreeNode(m_head); - FreeNode(m_stop); -} - -//============================================================================ -template -void TSkipList::Clear () { - - Node * ptr = m_head->next[0]; - while (ptr != m_stop) { - Node * next = ptr->next[0]; - delete ptr->object; - FreeNode(ptr); - ptr = next; - } - - m_stop->prev = m_head; - for (unsigned index = 0; index < kMaxLevels; ++index) - m_head->next[index] = m_stop; - m_level = 0; -} - -//============================================================================ -template -void TSkipList::Delete (T * object) { - - Unlink(object); - delete object; -} - -//============================================================================ -template -T * TSkipList::Find (const K & key, SkipListTag * tag) const { - - Node * node = m_head; - - m_stop->key = &key; - for (int level = (int)m_level; level >= 0; --level) - while (Cmp::Lt(*node->next[level]->key, key)) - node = node->next[level]; - - node = node->next[0]; - if (node != m_stop && Cmp::Eq(*node->key, *m_stop->key)) { - if (tag) - *tag = node; - return node->object; - } - else { - if (tag) - *tag = nil; - return nil; - } -} - -//============================================================================ -template -T * TSkipList::FindNext (SkipListTag * tag) const { - - Node * node = (Node *)*tag; - - m_stop->key = node->key; - for (int level = (int)node->level; level >= 0; --level) - while (Cmp::Lt(*node->next[level]->key, *m_stop->key)) - node = node->next[level]; - - node = node->next[0]; - if (node != m_stop && Cmp::Eq(*node->key, *m_stop->key)) { - *tag = node; - return node->object; - } - else { - *tag = nil; - return nil; - } -} - -//============================================================================ -template -T * TSkipList::Head (SkipListTag * tag) const { - - ASSERT(tag); - Node * first = m_head->next[0]; - if (first == m_stop) { - *tag = nil; - return nil; - } - - *tag = first; - return first->object; -} - -//============================================================================ -template -T * TSkipList::Next (SkipListTag * tag) const { - - ASSERT(tag); - Node * node = (Node *)*tag; - ASSERT(node); - if (node->next[0] == m_stop) { - *tag = nil; - return nil; - } - - *tag = node->next[0]; - return node->next[0]->object; -} - -//============================================================================ -template -T * TSkipList::Prev (SkipListTag * tag) const { - - ASSERT(tag); - Node * node = (Node *)*tag; - ASSERT(node); - if (node->prev == m_head) { - *tag = nil; - return nil; - } - - *tag = node->prev; - return node->prev->object; -} - -//============================================================================ -template -T * TSkipList::Tail (SkipListTag * tag) const { - - ASSERT(tag); - Node * last = m_stop->prev; - if (last == m_head) { - *tag = nil; - return nil; - } - - *tag = last; - return last->object; -} - -//============================================================================ -template -void TSkipList::Link (T * object) { - - const K * key = (const K *)((const uint8_t *)object + keyOffset); - - // Find the node's insertion point - m_stop->key = key; - Node * update[kMaxLevels]; - Node * node = m_head; - for (int level = (int)m_level; level >= 0; --level) { - while (Cmp::Lt(*node->next[level]->key, *key)) - node = node->next[level]; - update[level] = node; - } - node = node->next[0]; - - { - // Select a level for the skip node - unsigned newLevel = RandomLevel(); - if (newLevel > m_level) { - if (m_level < kMaxLevels - 1) { - newLevel = ++m_level; - update[newLevel] = m_head; - } - else - newLevel = m_level; - } - - // Create the node and insert it into the skip list - Node * node = AllocNode(newLevel); - node->key = key; - node->object = object; - for (unsigned level = newLevel; level >= 1; --level) { - node->next[level] = update[level]->next[level]; - update[level]->next[level] = node; - } - node->prev = update[0]; - node->next[0] = update[0]->next[0]; - update[0]->next[0]->prev = node; - update[0]->next[0] = node; - } -} - -//============================================================================ -template -void TSkipList::Unlink (T * object) { - - const K * key = (const K *)((const uint8_t *)object + keyOffset); - - Node * node = m_head; - Node * update[kMaxLevels]; - int level = m_level; - - for (;;) { - // Find the node being unlinked - m_stop->key = key; - for (; level >= 0; --level) { - while (Cmp::Lt(*node->next[level]->key, *key)) - node = node->next[level]; - update[level] = node; - } - node = node->next[0]; - - // Node wasn't found so do nothing - if (*node->key != *key || node == m_stop) - return; - - if (node->object == object) - break; - } - - // Update all links - for (level = m_level; level >= 1; --level) { - if (update[level]->next[level] != node) - continue; - update[level]->next[level] = node->next[level]; - } - ASSERT(update[0]->next[0] == node); - node->next[0]->prev = update[0]; - update[0]->next[0] = node->next[0]; - - // Update header - while (m_level && m_head->next[m_level] == m_stop) - --m_level; - - FreeNode(node); -} - -//============================================================================ -template -void TSkipList::UnlinkAll () { - - Node * ptr = m_head->next[0]; - while (ptr != m_stop) { - Node * next = ptr->next[0]; - FreeNode(ptr); - ptr = next; - } - - m_stop->prev = m_head; - for (unsigned index = 0; index < kMaxLevels; ++index) - m_head->next[index] = m_stop; - m_level = 0; -} diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h index a26d8fb9..bd1752ec 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtSort.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSORT_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSort.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSORT_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSORT_H @@ -239,3 +237,4 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *(addrOfIndex) = high - (ptr); \ \ } +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.h index 5ea63803..ba660284 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtSpareList.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSPARELIST_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSpareList.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSPARELIST_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSPARELIST_H #include "Pch.h" @@ -147,3 +145,4 @@ template T * TSpareList::New () { return new(CBaseSpareList::Alloc(OBJECT_SIZE, typeid(T).name())) T; } +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h index 64b86309..02649403 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSTR_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtStr.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSTR_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSTR_H #include "Pch.h" @@ -156,3 +154,4 @@ bool StrTokenize (const char * source[], char * dest, unsigned chars, const char bool StrTokenize (const wchar_t * source[], wchar_t * dest, unsigned chars, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); bool StrTokenize (const char * source[], ARRAY(char) * destArray, const char whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); bool StrTokenize (const wchar_t * source[], ARRAY(wchar_t) * destArray, const wchar_t whitespace[], unsigned maxWhitespaceSkipCount = (unsigned)-1); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h index 0800e505..d2dc4977 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtSync.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSYNC_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSync.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSYNC_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTSYNC_H #include "Pch.h" @@ -133,3 +131,4 @@ public: const EventHandle & Handle () const { return m_handle; } }; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h index fda2a145..6140683c 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtTime.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTIME_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTime.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTIME_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTIME_H #include "Pch.h" @@ -128,3 +126,4 @@ uint32_t TimeGetSecondsSince1970Utc (); static const uint64_t kTime1601To1970 = 11644473600 * kTimeIntervalsPerSecond; static const uint64_t kTime1601To2001 = 12622780800 * kTimeIntervalsPerSecond; +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h index 61ffb6d5..815c22f6 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtTls.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTLS_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTls.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTLS_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTLS_H #include "Pch.h" @@ -71,3 +69,4 @@ void ThreadLocalSetValue (unsigned id, void * value); void ThreadAllowBlock (); void ThreadDenyBlock (); void ThreadAssertCanBlock (const char file[], int line); +#endif diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtTypes.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtTypes.h deleted file mode 100644 index f383f432..00000000 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtTypes.h +++ /dev/null @@ -1,57 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/***************************************************************************** -* -* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTypes.h -* -* -* By Eric Anderson (10/10/2005) -* Copyright 2005 Cyan Worlds, Inc. -* -***/ - -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTYPES_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtTypes.h included more than once" -#endif -#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTTYPES_H - - diff --git a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h index ac163a0e..4f0f20be 100644 --- a/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h +++ b/Sources/Plasma/NucleusLib/pnUtils/pnUtUuid.h @@ -45,9 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com * ***/ -#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H -#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtUuid.h included more than once" -#endif +#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTUUID_H #include "Pch.h" @@ -117,4 +115,4 @@ struct Uuid { }; #include - +#endif