|
From: <cn...@us...> - 2009-05-26 02:23:52
|
Revision: 276
http://hgengine.svn.sourceforge.net/hgengine/?rev=276&view=rev
Author: cnlohr
Date: 2009-05-26 02:23:47 +0000 (Tue, 26 May 2009)
Log Message:
-----------
modularize things
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/src/Mercury2.cpp
Mercury2/src/MercuryNode.h
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Added Paths:
-----------
Mercury2/modules/
Mercury2/modules/BillboardNode.cpp
Mercury2/modules/BillboardNode.h
Mercury2/modules/Makefile
Mercury2/modules.xml
Mercury2/src/MercuryHash.h
Mercury2/src/MercuryVector.h
Mercury2/src/ModuleManager.cpp
Mercury2/src/ModuleManager.h
Removed Paths:
-------------
Mercury2/src/BillboardNode.cpp
Mercury2/src/BillboardNode.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/adv_set.c 2009-05-26 02:23:47 UTC (rev 276)
@@ -11,7 +11,7 @@
src/HGMDLModel.cpp src/MercuryString.cpp src/MercuryCrash.c src/MercuryBacktrace.c \
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
- src/BillboardNode.cpp src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp"
+ src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Added: Mercury2/modules/BillboardNode.cpp
===================================================================
--- Mercury2/modules/BillboardNode.cpp (rev 0)
+++ Mercury2/modules/BillboardNode.cpp 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,95 @@
+#include "BillboardNode.h"
+#include <MercuryVertex.h>
+#include <Viewport.h>
+
+REGISTER_NODE_TYPE(BillboardNode);
+
+MercuryMatrix BillboardNode::ManipulateMatrix(const MercuryMatrix& matrix)
+{
+ MercuryMatrix m = RenderableNode::ManipulateMatrix( matrix );
+
+ //Compute the object's center point (position?) in world space
+ MercuryVertex center(0,0,0,1);
+ center = matrix * center;
+
+ MercuryVector objToEye = (EYE - center);
+ MercuryVector objToEyeProj( objToEye );
+
+ //vector from object to eye projected on XZ
+ objToEyeProj[1] = 0; objToEyeProj.NormalizeSelf();
+
+// MercuryVector objLookAt(0,0,1); //origional look vector of object
+// objLookAt = matrix * objLookAt; //convert to world space
+// objLookAt.NormalizeSelf();
+
+// objLookAt.Print();
+
+// MercuryVector up = (objLookAt.CrossProduct( objToEyeProj )).Normalize();
+// up = objLookAt;
+// up.Print();
+
+ MercuryVector up(0,0,1); //we wan't the camera's up
+
+ float angleCos = LOOKAT.DotProduct(objToEyeProj);
+
+ if ((angleCos < 0.99990) && (angleCos > -0.9999))
+ {
+ float f = ACOS(angleCos)*RADDEG;
+ MercuryMatrix mtmp;
+ mtmp.RotateAngAxis(f, up[0], up[1], up[2]);
+ m = m * mtmp;
+ }
+
+ //spherical below
+ objToEye.NormalizeSelf();
+ angleCos = objToEyeProj.DotProduct( objToEye );
+ if ((angleCos < 0.99990) && (angleCos > -0.9999))
+ {
+ printf("%f\n", angleCos);
+ float f = ACOS(angleCos)*RADDEG;
+ MercuryMatrix mtmp;
+ if (objToEye[1] < 0)
+ mtmp.RotateAngAxis(f, 1, 0, 0);
+ else
+ mtmp.RotateAngAxis(f, -1, 0, 0);
+// m.Print();
+ m = m * mtmp;
+// m.Print();
+ printf("********************\n");
+// mtmp.Print();
+ }
+
+ return m;
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * 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. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may 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. *
+ ***************************************************************************/
Added: Mercury2/modules/BillboardNode.h
===================================================================
--- Mercury2/modules/BillboardNode.h (rev 0)
+++ Mercury2/modules/BillboardNode.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,47 @@
+#ifndef BILLBOARDNODE_H
+#define BILLBOARDNODE_H
+
+#include <RenderableNode.h>
+
+class BillboardNode : public RenderableNode
+{
+ public:
+ virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
+
+ private:
+};
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * 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. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may 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. *
+ ***************************************************************************/
Added: Mercury2/modules/Makefile
===================================================================
--- Mercury2/modules/Makefile (rev 0)
+++ Mercury2/modules/Makefile 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,12 @@
+CFLAGS=-O2 -g0 -Wall -I/usr/include/libxml2 -DHAVE_CONFIG -DHGENGINE -fno-exceptions -fPIC -I../src -g
+CXXFLAGS=${CFLAGS}
+LDFLAGS=-shared
+
+all : BillboardNode.so
+
+clean :
+ rm -rf *~ *.o *.so
+
+BillboardNode.so : BillboardNode.o
+ g++ -o$@ $^ ${LDFLAGS}
+
Added: Mercury2/modules.xml
===================================================================
--- Mercury2/modules.xml (rev 0)
+++ Mercury2/modules.xml 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,3 @@
+<Modules>
+ <Module src="modules/BillboardNode.c" obj="modules/BillboardNode" func="InstallBillboardNode" />
+</Modules>
Deleted: Mercury2/src/BillboardNode.cpp
===================================================================
--- Mercury2/src/BillboardNode.cpp 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/BillboardNode.cpp 2009-05-26 02:23:47 UTC (rev 276)
@@ -1,95 +0,0 @@
-#include <BillboardNode.h>
-#include <MercuryVertex.h>
-#include <Viewport.h>
-
-REGISTER_NODE_TYPE(Billboard);
-
-MercuryMatrix Billboard::ManipulateMatrix(const MercuryMatrix& matrix)
-{
- MercuryMatrix m = RenderableNode::ManipulateMatrix( matrix );
-
- //Compute the object's center point (position?) in world space
- MercuryVertex center(0,0,0,1);
- center = matrix * center;
-
- MercuryVector objToEye = (EYE - center);
- MercuryVector objToEyeProj( objToEye );
-
- //vector from object to eye projected on XZ
- objToEyeProj[1] = 0; objToEyeProj.NormalizeSelf();
-
-// MercuryVector objLookAt(0,0,1); //origional look vector of object
-// objLookAt = matrix * objLookAt; //convert to world space
-// objLookAt.NormalizeSelf();
-
-// objLookAt.Print();
-
-// MercuryVector up = (objLookAt.CrossProduct( objToEyeProj )).Normalize();
-// up = objLookAt;
-// up.Print();
-
- MercuryVector up(0,0,1); //we wan't the camera's up
-
- float angleCos = LOOKAT.DotProduct(objToEyeProj);
-
- if ((angleCos < 0.99990) && (angleCos > -0.9999))
- {
- float f = ACOS(angleCos)*RADDEG;
- MercuryMatrix mtmp;
- mtmp.RotateAngAxis(f, up[0], up[1], up[2]);
- m = m * mtmp;
- }
-
- //spherical below
- objToEye.NormalizeSelf();
- angleCos = objToEyeProj.DotProduct( objToEye );
- if ((angleCos < 0.99990) && (angleCos > -0.9999))
- {
- printf("%f\n", angleCos);
- float f = ACOS(angleCos)*RADDEG;
- MercuryMatrix mtmp;
- if (objToEye[1] < 0)
- mtmp.RotateAngAxis(f, 1, 0, 0);
- else
- mtmp.RotateAngAxis(f, -1, 0, 0);
-// m.Print();
- m = m * mtmp;
-// m.Print();
- printf("********************\n");
-// mtmp.Print();
- }
-
- return m;
-}
-
-/****************************************************************************
- * Copyright (C) 2009 by Joshua Allen *
- * *
- * *
- * 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. *
- * * Neither the name of the Mercury Engine nor the names of its *
- * contributors may 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. *
- ***************************************************************************/
Deleted: Mercury2/src/BillboardNode.h
===================================================================
--- Mercury2/src/BillboardNode.h 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/BillboardNode.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -1,47 +0,0 @@
-#ifndef BILLBOARDNODE_H
-#define BILLBOARDNODE_H
-
-#include <RenderableNode.h>
-
-class Billboard : public RenderableNode
-{
- public:
- virtual MercuryMatrix ManipulateMatrix(const MercuryMatrix& matrix);
-
- private:
-};
-
-#endif
-
-
-/****************************************************************************
- * Copyright (C) 2009 by Joshua Allen *
- * *
- * *
- * 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. *
- * * Neither the name of the Mercury Engine nor the names of its *
- * contributors may 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. *
- ***************************************************************************/
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/Mercury2.cpp 2009-05-26 02:23:47 UTC (rev 276)
@@ -16,6 +16,7 @@
#include <RenderGraph.h>
#include <Texture.h>
#include <GLHeaders.h>
+#include <ModuleManager.h>
bool SHOWBOUNDINGVOLUME = false;
@@ -52,13 +53,14 @@
SetupOGLExtensions();
#endif
+ ModuleManager::GetInstance().InitializeAllModules();
+
MercuryNode* root = new MercuryNode();
XMLDocument* doc = XMLDocument::Load("scenegraph.xml");
-
XMLNode r = doc->GetRootNode();
root->LoadFromXML( r );
-
+
SAFE_DELETE(doc);
MercuryTimer timer;
Added: Mercury2/src/MercuryHash.h
===================================================================
--- Mercury2/src/MercuryHash.h (rev 0)
+++ Mercury2/src/MercuryHash.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,254 @@
+#ifndef MERCURYHASH_H
+#define MERCURYHASH_H
+
+#include "global.h"
+#include <MercuryVector.h>
+
+///Mercury Hash Table for Strings
+template<typename T>
+class MHash
+{
+public:
+ MHash( ) : m_iSize( GetAPrime( m_iPrimest = 1 ) )
+ {
+ m_pTable = new MHashNode<T> * [m_iSize]; ///XXX what? and how does this affect delete?
+ memset( m_pTable, 0, m_iSize * sizeof( MHashNode<T>* ) );
+ m_iCount = 0;
+ }
+
+ MHash( const MHash & rhs )
+ {
+ m_iPrimest = rhs.m_iPrimest;
+ m_iCount = rhs.m_iCount;
+ m_pTable = new MHashNode<T> * [rhs.m_iSize];
+ m_iSize = rhs.m_iSize;
+
+ memset( m_pTable, 0, m_iSize * sizeof( MHashNode<T>* ) );
+
+ for( unsigned i = 0; i < m_iSize; ++i )
+ {
+ MHashNode <T> * TMP = rhs.m_pTable[i];
+ while (TMP)
+ {
+ m_pTable[i] = new MHashNode<T>( m_pTable[i], TMP->Index, TMP->Data );
+ TMP = TMP->Next;
+ }
+ }
+ }
+
+ MHash & operator = ( const MHash & rhs )
+ {
+ m_iPrimest = rhs.m_iPrimest;
+ m_iCount = rhs.m_iCount;
+ m_pTable = new MHashNode<T> * [rhs.m_iSize];
+ m_iSize = rhs.m_iSize;
+
+ memset( m_pTable, 0, m_iSize * sizeof( MHashNode<T>* ) );
+
+ for( unsigned i = 0; i < m_iSize; ++i )
+ {
+ MHashNode <T> * TMP = rhs.m_pTable[i];
+ while (TMP)
+ {
+ m_pTable[i] = new MHashNode<T>( m_pTable[i], TMP->Index, TMP->Data );
+ TMP = TMP->Next;
+ }
+ }
+ return *this;
+ }
+
+ void resize( int iNewSize )
+ {
+ MHashNode <T> ** pOldTable = m_pTable;
+ int iOldSize = m_iSize;
+
+ m_pTable = new MHashNode<T> * [iNewSize];
+ m_iSize = iNewSize;
+ memset( m_pTable, 0, iNewSize * sizeof( MHashNode<T>* ) );
+
+ for( int i = 0; i < iOldSize; ++i )
+ {
+ while (pOldTable[i])
+ {
+ MHashNode <T> * TMP = pOldTable[i];
+ pOldTable[i] = TMP->Next;
+
+ int iNewHash = TMP->Index.hash();
+ MHashNode <T> * TMP2 = m_pTable[iNewHash%m_iSize];
+ m_pTable[iNewHash%m_iSize] = TMP;
+ TMP->Next = TMP2;
+ }
+ }
+
+ //I think a delete[] is OK here because its an allocated array of pointers. No destructors are called
+ SAFE_DELETE_ARRAY(pOldTable);
+ }
+
+ ~MHash()
+ {
+ for( unsigned i = 0; i < m_iSize; ++i )
+ while (m_pTable[i])
+ {
+ MHashNode <T> * TMP = m_pTable[i];
+ m_pTable[i] = TMP->Next;
+ SAFE_DELETE( TMP );
+ }
+ SAFE_DELETE_ARRAY( m_pTable );
+ }
+
+ void clear()
+ {
+ for( unsigned i = 0; i < m_iSize; ++i )
+ {
+ while (m_pTable[i])
+ {
+ MHashNode <T> * TMP = m_pTable[i];
+ m_pTable[i] = TMP->Next;
+ SAFE_DELETE( TMP );
+ }
+ m_pTable[i] = 0;
+ }
+ m_iCount = 0;
+ }
+
+ ///Return reference to data in the index's cell, if no data exists, it is generated
+ T & operator[]( const MString & pIndex )
+ {
+ unsigned int iHash = pIndex.hash();
+ MHashNode<T> * m_pTmp = m_pTable[iHash%m_iSize];
+
+ while( m_pTmp )
+ if( m_pTmp->Index == pIndex )
+ return m_pTmp->Data;
+ else
+ m_pTmp = m_pTmp->Next;
+
+ insert( pIndex, T() );
+
+ m_pTmp = m_pTable[iHash%m_iSize];
+
+ while( m_pTmp )
+ if( m_pTmp->Index == pIndex )
+ return m_pTmp->Data;
+ else
+ m_pTmp = m_pTmp->Next;
+
+ //This should NEVER HAPPEN.
+ assert( "FAIL! Hash insertion failed!" );
+ return m_pNil;
+ }
+
+ ///Insert pData into pIndex's cell
+ void insert( const MString & pIndex, const T & pData )
+ {
+ unsigned int iHash = pIndex.hash();
+ m_pTable[iHash%m_iSize] = new MHashNode<T>( m_pTable[iHash%m_iSize], pIndex, pData );
+
+ if( ++m_iCount > m_iSize + 5 )
+ resize( GetAPrime( ++m_iPrimest ) );
+ }
+
+ ///Get pointer to pIndex's cell, if no data exists, NULL is returned.
+ T * get( const MString & pIndex )
+ {
+ unsigned int iHash = pIndex.hash();
+ MHashNode<T> * m_pTmp = m_pTable[iHash%m_iSize];
+
+ while( m_pTmp )
+ if( m_pTmp->Index == pIndex )
+ return &m_pTmp->Data;
+ else
+ m_pTmp = m_pTmp->Next;
+
+ return 0;
+ }
+
+ bool remove( const MString & pIndex )
+ {
+ unsigned int iHash = pIndex.hash();
+ MHashNode<T> * m_pPrev = 0;
+ MHashNode<T> * m_pTmp = m_pTable[iHash%m_iSize];
+
+ while( m_pTmp )
+ if( m_pTmp->Index == pIndex )
+ {
+ if( m_pPrev )
+ m_pPrev->Next = m_pTmp->Next;
+ else
+ m_pTable[iHash%m_iSize] = m_pTable[iHash%m_iSize]->Next;
+ SAFE_DELETE( m_pTmp );
+ m_iCount--;
+ return true;
+ }
+ else
+ {
+ m_pPrev = m_pTmp;
+ m_pTmp = m_pTmp->Next;
+ }
+
+ return false;
+ }
+
+ void VectorIndicies( MVector < MString > & vOut )
+ {
+ unsigned int i;
+ MHashNode<T> * m_pTmp;
+ for( i = 0; i < m_iSize; i++ )
+ {
+ m_pTmp = m_pTable[i];
+ while( m_pTmp )
+ {
+ vOut.push_back( m_pTmp->Index );
+ m_pTmp = m_pTmp->Next;
+ }
+ }
+ }
+
+private:
+ template<typename TC>
+ struct MHashNode
+ {
+ MHashNode() : Next(0) { }
+ MHashNode( MHashNode<TC> * pA, const MString & pIn, const TC & pD ) : Next( pA ), Index( pIn ), Data( pD ) { }
+
+ MHashNode <TC> * Next;
+ MString Index;
+ TC Data;
+ };
+
+ MHashNode <T> ** m_pTable;
+ T m_pNil;
+ unsigned int m_iSize;
+ unsigned int m_iPrimest;
+ unsigned int m_iCount;
+};
+
+#endif
+
+/*
+ * Copyright (c) 2006-2009 Joshua Allen, Charles Lohr
+ * 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.
+ * - Neither the name of the Mercury Engine nor the names of its
+ * contributors may 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.
+ */
Modified: Mercury2/src/MercuryNode.h
===================================================================
--- Mercury2/src/MercuryNode.h 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/MercuryNode.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -92,8 +92,10 @@
#define REGISTER_NODE_TYPE(class)\
MercuryNode* FactoryFunct##class() { return new class(); } \
Callback0R<MercuryNode*> factoryclbk##class( FactoryFunct##class ); \
- bool GlobalRegisterSuccess##class = NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class);
+ bool GlobalRegisterSuccess##class = NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class); \
+ extern "C" { int Install##class() { printf( "Installing "#class ); return NodeFactory::GetInstance().RegisterFactoryCallback(#class, factoryclbk##class); } }
+
#endif
/***************************************************************************
Modified: Mercury2/src/MercuryUtil.cpp
===================================================================
--- Mercury2/src/MercuryUtil.cpp 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/MercuryUtil.cpp 2009-05-26 02:23:47 UTC (rev 276)
@@ -80,26 +80,36 @@
return length;
}
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * 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. *
- * * Neither the name of the <ORGANIZATION> nor the names of its contributors may 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. *
- ***************************************************************************/
+int GeneralUsePrimes[] = { 3, 13, 37, 73, 131, 229, 337, 821, 2477, 4594, 8941, 14797, 24953, 39041, 60811, 104729 };
+
+int GetAPrime( int ith )
+{
+ return (ith<0)?3:(ith>15)?GeneralUsePrimes[15]:GeneralUsePrimes[ith];
+}
+
+/* Copyright (c) 2009, Joshua Allen and Charles Lohr
+ * 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.
+ * - Neither the name of the Mercury Engine nor the names of its
+ * contributors may 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.
+ */
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2009-05-26 00:28:09 UTC (rev 275)
+++ Mercury2/src/MercuryUtil.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -85,9 +85,20 @@
///The return value is -1 if there was an issue, otherwise it is valid.
long FileToString( const MString & sFileName, char * & data );
+/* These two functions are very different */
+/// nextPow2 will go to the NEXT power of 2 even if x is already a power of 2.
+inline int nextPow2(int x) { int num = 1; while(num <= x) num <<= 1; return num; }
+///makePow2 will make sure the number is a power of 2 at least equal to x.
+inline int makePow2(int x) { int num = 1; while(num < x) num <<= 1; return num; }
+inline bool isPow2(int x) { int num = 1; while(num < x) num<<=1; return num==x; }
+
+///Return a prime number. Note this is NOT sequential. The general(but not guarenteed)
+///pattern is the next prime number that's roughly two times the last.
+int GetAPrime( int ith );
+
#endif
-/* Copyright (c) 2008, Joshua Allen
+/* Copyright (c) 2009, Joshua Allen and Charles Lohr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
Added: Mercury2/src/MercuryVector.h
===================================================================
--- Mercury2/src/MercuryVector.h (rev 0)
+++ Mercury2/src/MercuryVector.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,233 @@
+#ifndef _MERCURY_VECTOR_H
+#define _MERCURY_VECTOR_H
+
+#include <string.h>
+
+///Stripped down and fast vector class
+template<typename T>
+class MVector
+{
+ public:
+ MVector()
+ :m_reserved(0), m_size(0), m_data(0)
+ { }
+ ~MVector()
+ {
+ clear();
+ }
+ MVector(const MVector<T>& v)
+ :m_reserved(v.m_reserved), m_size(v.m_size)
+ {
+ m_data = (T*)malloc(sizeof(T)*m_reserved);
+ for (unsigned int i = 0; i < m_size; ++i)
+ {
+ new( &m_data[i] ) T (v.m_data[i]);
+ #if defined( _DEBUG_MEMORY )
+ MercuryAFree( &m_data[i] );
+ #endif
+ }
+ }
+ void push_back(const T& element);
+ inline unsigned int size() const { return m_size; }
+ inline bool empty() const { return m_size == 0; }
+ void resize(unsigned int newSize);
+ void reserve(unsigned int newSize);
+ inline T& operator[](unsigned int x) { return m_data[x]; }
+ inline const T& operator[](unsigned int x) const { return m_data[x]; }
+ inline T& at( unsigned int x ) { return m_data[x]; }
+ inline const T& at( unsigned int x ) const { return m_data[x]; }
+ const MVector<T>& operator=(const MVector<T>& v);
+ void clear();
+ void remove( int iPlace );
+ void insert( int iPlace, const T & data );
+ private:
+ unsigned int m_reserved; //available space
+ unsigned int m_size; //number of valid (constructed) objects
+ T * m_data;
+};
+
+#include "MercuryUtil.h"
+
+template<typename T>
+void MVector<T>::push_back(const T& element)
+{
+ if (m_size >= m_reserved)
+ {
+ if (m_reserved <= 0)
+ {
+ SAFE_FREE( m_data );
+ m_data = (T*)malloc(sizeof(T));
+ m_reserved = 1;
+ }
+ else
+ {
+ int tsize = nextPow2(m_reserved);
+ int size = m_size;
+ reserve(tsize);
+ m_size = size;
+ }
+ }
+
+ new( &m_data[m_size] ) T ( element );
+
+ ++m_size;
+}
+
+template<typename T>
+void MVector<T>::resize(unsigned int newSize)
+{
+ if (newSize == 0)
+ {
+ clear();
+ return;
+ }
+ //Fully reserve space and initalize constructors
+ //Make larger and reserve space
+ if (newSize == m_size)
+ {
+ return;
+ }
+ else if(newSize > m_size)
+ {
+ if (newSize > m_reserved)
+ {
+ m_reserved = newSize;
+ m_data = (T*)realloc(m_data, sizeof(T)*m_reserved);
+ }
+
+ for (unsigned int i = m_size; i < newSize; ++i)
+ {
+ new (&m_data[i]) (T);
+ #if defined( _DEBUG_MEMORY )
+ MercuryAFree( &m_data[i] );
+ #endif
+
+ }
+ }
+ else
+ {
+ //get smaller
+ m_reserved = newSize;
+
+ //destroy data that will be lost
+ for (unsigned int i = m_reserved; i < m_size; ++i)
+ (&m_data[i])->~T();
+
+ m_data = (T*)realloc(m_data, sizeof(T)*m_reserved);
+ }
+ m_size = newSize;
+}
+
+template<typename T>
+void MVector<T>::reserve(unsigned int newSize)
+{
+ if (newSize == 0)
+ {
+ clear();
+ return;
+ }
+ if (newSize == m_reserved)
+ {
+ return;
+ }
+ else if (newSize > m_reserved)
+ {
+ m_reserved = newSize;
+ m_data = (T*)realloc(m_data, sizeof(T)*m_reserved);
+ }
+ else
+ {
+ m_reserved = newSize;
+
+ //destroy data that will be lost
+ for (unsigned int i = m_reserved; i < m_size; ++i)
+ (&m_data[i])->~T();
+
+ m_data = (T*)realloc(m_data, sizeof(T)*m_reserved);
+ m_size = newSize;
+ }
+}
+
+template<typename T>
+void MVector<T>::remove( int iPlace )
+{
+ m_size--;
+ (&m_data[iPlace])->~T();
+ for (unsigned long i = iPlace; i < m_size; ++i)
+ memcpy( &m_data[i], &m_data[i+1], sizeof(T) );
+}
+
+#include <stdio.h>
+#include <new>
+template<typename T>
+void MVector<T>::insert( int iPlace, const T & data )
+{
+ int i;
+ resize( m_size + 1 );
+
+ (&m_data[m_size-1])->~T();
+ for( i = m_size - 1; i > iPlace; i-- )
+ memcpy( &m_data[i], &m_data[i-1], sizeof (T) );
+
+ new ( &m_data[iPlace] ) T( data );
+ #if defined( _DEBUG_MEMORY )
+ MercuryAFree( &m_data[iPlace] );
+ #endif
+
+}
+
+template<typename T>
+void MVector<T>::clear()
+{
+ for (unsigned int i = 0; i < m_size; ++i)
+ (&m_data[i])->~T();
+
+ SAFE_FREE(m_data);
+ m_size = m_reserved = 0;
+}
+template<typename T>
+const MVector<T>& MVector<T>::operator=(const MVector<T>& v)
+{
+ clear();
+ m_reserved = v.m_reserved;
+ m_size = v.m_size;
+ m_data = (T*)malloc(sizeof(T)*m_reserved);
+ for (unsigned int i = 0; i < m_size; ++i)
+ {
+ new( &m_data[i]) T( v.m_data[i] );
+#if defined( _DEBUG_MEMORY )
+ MercuryAFree( &m_data[i] );
+#endif
+ }
+ return *this;
+}
+
+
+#endif
+/*
+ * Copyright (c) 2006-2009 Joshua Allen, Charles Lohr
+ * 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.
+ * - Neither the name of the Mercury Engine nor the names of its
+ * contributors may 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.
+ */
Added: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp (rev 0)
+++ Mercury2/src/ModuleManager.cpp 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,125 @@
+#include <ModuleManager.h>
+#include <XMLParser.h>
+
+#ifndef WIN32
+#include <dlfcn.h>
+#else
+#include <windows.h>
+
+//These are only synonyms for the POSIX stuff.
+#define RTLD_NOW 0
+#define RTLD_GLOBAL 0
+
+void * dlopen( const char * sFile, int dummy ) { return LoadLibrary( sFile ); }
+void dlclose( void * handle ) { FreeLibrary( (HMODULE)handle ); }
+void * dlsym( void * handle, const char * sym ) { return GetProcAddress( (HMODULE) handle, sym ); }
+
+#endif
+
+
+extern "C"
+{
+typedef int (*LoaderFunction)();
+};
+
+ModuleManager::ModuleManager()
+{
+}
+
+ModuleManager & ModuleManager::GetInstance()
+{
+ static ModuleManager *instance = NULL;
+ if (!instance)
+ instance = new ModuleManager();
+ return *instance;
+}
+
+void ModuleManager::InitializeAllModules()
+{
+ XMLDocument* doc = XMLDocument::Load("modules.xml");
+ XMLNode r = doc->GetRootNode();
+ for (XMLNode child = r.Child(); child.IsValid(); child = r.NextNode())
+ {
+ if( child.Name() != "Module" )
+ {
+ fprintf( stderr, "Invalid element in modules: %s\n", child.Name().c_str() );
+ }
+#ifdef WIN32
+ MString ModuleName = child.Attribute( "obj" ) + ".dll";
+#else
+ MString ModuleName = child.Attribute( "obj" ) + ".so";
+#endif
+ MString LoadFunct = child.Attribute( "func" );
+ LoadModule( ModuleName, LoadFunct );
+ }
+}
+
+void ModuleManager::UnloadModule( const MString & ModuleName )
+{
+ if( m_hAllHandles[ModuleName] )
+ dlclose( m_hAllHandles[ModuleName] );
+}
+
+bool ModuleManager::LoadModule( const MString & ModuleName, const MString & LoadFunction )
+{
+ if( m_hAllHandles[ModuleName] ) UnloadModule( ModuleName );
+ m_hAllHandles[ModuleName] = dlopen( ModuleName.c_str(), RTLD_NOW | RTLD_GLOBAL );
+
+ if( !m_hAllHandles[ModuleName] )
+ {
+ fprintf( stderr, "Error opening: %s\n", ModuleName.c_str() );
+ return false;
+ }
+
+ //If no load funct, just exit early.
+ if( LoadFunction == "" )
+ return true;
+
+ LoaderFunction T = (LoaderFunction)dlsym( m_hAllHandles[ModuleName], LoadFunction.c_str() );
+ if( !T )
+ {
+ fprintf( stderr, "Error finding: %s() in %s\n", LoadFunction.c_str(), ModuleName.c_str() );
+ return false;
+ }
+
+ int ret = T();
+ if( ret )
+ {
+ fprintf( stderr, "Error executing (Returned error %d): %s() in %s\n", ret, LoadFunction.c_str(), ModuleName.c_str() );
+ return false;
+ }
+
+ return true;
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * 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. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may 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. *
+ ***************************************************************************/
Added: Mercury2/src/ModuleManager.h
===================================================================
--- Mercury2/src/ModuleManager.h (rev 0)
+++ Mercury2/src/ModuleManager.h 2009-05-26 02:23:47 UTC (rev 276)
@@ -0,0 +1,59 @@
+#ifndef _MODULE_LOADER_H
+#define _MODULE_LOADER_H
+
+#include <MercuryUtil.h>
+#include <MercuryHash.h>
+
+/* This is the module loader mechanism. This allows for run-time loading of
+ new modules. Eventually, it will allow for run-time re-loading of modules.
+ For now, it uses modules to determine what to load at startup. */
+
+class ModuleManager
+{
+public:
+ ModuleManager();
+ static ModuleManager & GetInstance();
+ void InitializeAllModules();
+
+ bool LoadModule( const MString & ModuleName, const MString & LoadFunction );
+ void UnloadModule( const MString & ModuleName );
+ MHash< void * > m_hAllHandles;
+};
+
+static InstanceCounter<ModuleManager> ModMancounter("ModuleManager");
+
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * 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. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may 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. *
+ ***************************************************************************/
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|