You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(140) |
Feb
(98) |
Mar
(152) |
Apr
(104) |
May
(71) |
Jun
(94) |
Jul
(169) |
Aug
(83) |
Sep
(47) |
Oct
(134) |
Nov
(7) |
Dec
(20) |
2004 |
Jan
(41) |
Feb
(14) |
Mar
(42) |
Apr
(47) |
May
(68) |
Jun
(143) |
Jul
(65) |
Aug
(29) |
Sep
(40) |
Oct
(34) |
Nov
(33) |
Dec
(97) |
2005 |
Jan
(29) |
Feb
(30) |
Mar
(9) |
Apr
(37) |
May
(13) |
Jun
(31) |
Jul
(22) |
Aug
(23) |
Sep
|
Oct
(37) |
Nov
(34) |
Dec
(117) |
2006 |
Jan
(48) |
Feb
(6) |
Mar
(2) |
Apr
(71) |
May
(10) |
Jun
(16) |
Jul
(7) |
Aug
(1) |
Sep
(14) |
Oct
(17) |
Nov
(25) |
Dec
(26) |
2007 |
Jan
(8) |
Feb
(2) |
Mar
(7) |
Apr
(26) |
May
|
Jun
(12) |
Jul
(30) |
Aug
(14) |
Sep
(9) |
Oct
(4) |
Nov
(7) |
Dec
(6) |
2008 |
Jan
(10) |
Feb
(10) |
Mar
(6) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(18) |
Aug
(15) |
Sep
(16) |
Oct
(5) |
Nov
(3) |
Dec
(10) |
2009 |
Jan
(11) |
Feb
(2) |
Mar
|
Apr
(15) |
May
(31) |
Jun
(18) |
Jul
(11) |
Aug
(26) |
Sep
(52) |
Oct
(17) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ww...> - 2005-12-23 19:53:06
|
Author: mkrose Date: 2005-12-23 11:52:58 -0800 (Fri, 23 Dec 2005) New Revision: 1803 Modified: trunk/CSP/csp/cspsim/AircraftPhysicsModel.cpp Log: Add very basic modeling of the engine gyroscopic effect. For now it is simply a fixed angular momentum, independent of engine rpm. Also eliminated some dead code. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1803 Modified: trunk/CSP/csp/cspsim/AircraftPhysicsModel.cpp =================================================================== --- trunk/CSP/csp/cspsim/AircraftPhysicsModel.cpp 2005-12-23 19:51:02 UTC (rev 1802) +++ trunk/CSP/csp/cspsim/AircraftPhysicsModel.cpp 2005-12-23 19:52:58 UTC (rev 1803) @@ -62,16 +62,6 @@ m_ForcesBody = m_MomentsBody = Vector3::ZERO; m_WeightBody = localToBody(m_WeightLocal); -/* XXX - if (m_GroundCollisionDynamics.valid() && (m_NearGround || m_GroundCollisionDynamics->hasContact())) { - m_GroundCollisionDynamics->computeForceAndMoment(x); - if (m_GroundCollisionDynamics->hasContact()) { - m_ForcesBody += m_GroundCollisionDynamics->getForce(); - m_MomentsBody += m_GroundCollisionDynamics->getMoment(); - } - } -*/ - std::vector< Ref<BaseDynamics> >::iterator bd = m_Dynamics.begin(); std::vector< Ref<BaseDynamics> >::const_iterator bdEnd = m_Dynamics.end(); for (; bd != bdEnd; ++bd) { @@ -89,19 +79,23 @@ if ((*bd)->needsImpulse()) m_NeedsImpulse = true; } - // Add weight; null moment + // add weight; null moment m_ForcesBody += m_WeightBody; + // add engine gyroscopic effect + // TODO model L_e based on engine rpm (also 216.9 kg-m^2/sec seems much too small!) + const double engine_angular_momentum = 216.9; // nasa-79 value, kg-m^2/sec + m_MomentsBody += Vector3(0.0, engine_angular_momentum, 0.0) ^ m_AngularVelocityBody; + // linear acceleration body: calculate v' = F/m - w^v m_LinearAccelBody = m_ForcesBody / b_Mass->value() - (m_AngularVelocityBody ^ m_VelocityBody); // angular acceleration body: calculate Iw' = M - w^Iw - m_AngularAccelBody = b_InertiaInverse->value() * - (m_MomentsBody - (m_AngularVelocityBody^(b_Inertia->value() * m_AngularVelocityBody))); - + m_AngularAccelBody = b_InertiaInverse->value() * (m_MomentsBody - (m_AngularVelocityBody^(b_Inertia->value() * m_AngularVelocityBody))); + // quaternion derivative and w in body coordinates: q' = 0.5 * q * w Quat qprim = 0.5 * m_Attitude * m_AngularVelocityBody; - + // p' = v m_dy[0] = y[3]; m_dy[1] = y[4]; m_dy[2] = y[5]; // v' @@ -110,7 +104,7 @@ m_dy[6] = m_AngularAccelBody.x(); m_dy[7] = m_AngularAccelBody.y(); m_dy[8] = m_AngularAccelBody.z(); // q' m_dy[9] = qprim.w(); m_dy[10] = qprim.x(); m_dy[11] = qprim.y(); m_dy[12] = qprim.z(); - + return m_dy; } @@ -166,14 +160,6 @@ // solution to body data members YToBody(y); - -/* XXX - // correct an eventual underground position - if (m_GroundCollisionDynamics.valid() && m_GroundCollisionDynamics->needsImpulse()) { - double scale = 1.0 - std::min(1.0, dtlocal * 100.0); - m_VelocityBody *= scale; - } -*/ if (m_NeedsImpulse) { double scale = 1.0 - std::min(1.0, dtlocal * 100.0); m_VelocityBody *= scale; |
From: <sv...@ww...> - 2005-12-23 19:51:10
|
Author: mkrose Date: 2005-12-23 11:51:02 -0800 (Fri, 23 Dec 2005) New Revision: 1802 Modified: trunk/CSP/csp/cspsim/views/ExternalViews.cpp Log: Tweak the flyby view to reposition the viewpoint based on the target objects instantaneous velocity rather than orientation. This improves the view placement during high alpha maneuvers. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1802 Modified: trunk/CSP/csp/cspsim/views/ExternalViews.cpp =================================================================== --- trunk/CSP/csp/cspsim/views/ExternalViews.cpp 2005-12-23 19:48:55 UTC (rev 1801) +++ trunk/CSP/csp/cspsim/views/ExternalViews.cpp 2005-12-23 19:51:02 UTC (rev 1802) @@ -81,8 +81,7 @@ DynamicObject* dynamic = dynamic_cast<DynamicObject*>(target); if (dynamic) { Vector3 up = dynamic->getUpDirection(); - Vector3 object_dir = dynamic->getDirection(); - //double speed_level = dynamic->getSpeed()/50.0; + Vector3 object_dir = dynamic->getVelocity().normalized(); m_FixedCameraPosition = object_pos - 20.0 * object_dir; } else { m_FixedCameraPosition = object_pos + 100.0 * Vector3::ZAXIS + 100.0 * Vector3::XAXIS; @@ -99,8 +98,7 @@ DynamicObject* dynamic = dynamic_cast<DynamicObject*>(target); if (dynamic) { Vector3 up = dynamic->getUpDirection(); - Vector3 object_dir = dynamic->getDirection(); - //double speed_level = dynamic->getSpeed()/50.0; + Vector3 object_dir = dynamic->getVelocity().normalized(); m_FixedCameraPosition = object_pos + 900.0* object_dir + ( 12.0 - (rand() % 5) ) * (object_dir^up) + ( 6.0 + (rand () % 3) ) * up; } else { m_FixedCameraPosition = object_pos + 100.0 * Vector3::ZAXIS + 100.0 * Vector3::XAXIS; |
From: <sv...@ww...> - 2005-12-23 19:49:15
|
Author: mkrose Date: 2005-12-23 11:48:55 -0800 (Fri, 23 Dec 2005) New Revision: 1801 Modified: trunk/CSP/csp/cspsim/Bus.h Log: Add convenience method for pushing data channels only when the value changes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1801 Modified: trunk/CSP/csp/cspsim/Bus.h =================================================================== --- trunk/CSP/csp/cspsim/Bus.h 2005-12-23 05:53:48 UTC (rev 1800) +++ trunk/CSP/csp/cspsim/Bus.h 2005-12-23 19:48:55 UTC (rev 1801) @@ -380,6 +380,18 @@ push(); } + /** Set the channel value and signal the change to listeners if the value has + * changed. + * + * Should only be called for push channels (asserts false otherwise). + */ + void pushOnChange(const T& value) { + if (m_Value != value) { + m_Value = value; + push(); + } + } + /** Set a handler for a non-shared data channel that will be called when * a holder of a const reference to the channel requests that a new value * be set. The handler can honor this request by setting the channel |
From: <sv...@ww...> - 2005-12-23 05:53:54
|
Author: mkrose Date: 2005-12-22 21:53:48 -0800 (Thu, 22 Dec 2005) New Revision: 1800 Modified: trunk/CSP/csp/modules/chunklod/SConscript trunk/CSP/csp/modules/demeter/SConscript Log: Fix demeter and chunklod targets so that they are built when running 'scons all'. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1800 Modified: trunk/CSP/csp/modules/chunklod/SConscript =================================================================== --- trunk/CSP/csp/modules/chunklod/SConscript 2005-12-23 05:52:57 UTC (rev 1799) +++ trunk/CSP/csp/modules/chunklod/SConscript 2005-12-23 05:53:48 UTC (rev 1800) @@ -35,7 +35,7 @@ 'Version.cpp', ], deps = ['cspsim', 'jpeg'], - alias = 'all') + aliases = 'all') # TODO enable/disable osgNV in config.h Modified: trunk/CSP/csp/modules/demeter/SConscript =================================================================== --- trunk/CSP/csp/modules/demeter/SConscript 2005-12-23 05:52:57 UTC (rev 1799) +++ trunk/CSP/csp/modules/demeter/SConscript 2005-12-23 05:53:48 UTC (rev 1800) @@ -30,6 +30,6 @@ 'TerrainTextureFactory.cpp', ], deps = ['cspsim'], - alias = 'all') + aliases = 'all') |
From: <sv...@ww...> - 2005-12-23 05:53:05
|
Author: mkrose Date: 2005-12-22 21:52:57 -0800 (Thu, 22 Dec 2005) New Revision: 1799 Modified: trunk/CSP/csp/modules/demeter/Terrain.cpp Log: Remove an unnecessary print statement from demeter. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1799 Modified: trunk/CSP/csp/modules/demeter/Terrain.cpp =================================================================== --- trunk/CSP/csp/modules/demeter/Terrain.cpp 2005-12-23 05:49:10 UTC (rev 1798) +++ trunk/CSP/csp/modules/demeter/Terrain.cpp 2005-12-23 05:52:57 UTC (rev 1799) @@ -3161,7 +3161,7 @@ TerrainLattice::~TerrainLattice() { - cout << "~TerrainLattice()\n"; + //cout << "~TerrainLattice()\n"; if (Settings::GetInstance()->IsVerbose()) { m_Logfile << "Removing TerrainLattice" << std::endl; |
From: <sv...@ww...> - 2005-12-23 05:49:18
|
Author: mkrose Date: 2005-12-22 21:49:10 -0800 (Thu, 22 Dec 2005) New Revision: 1798 Modified: trunk/CSP/csp/csplib/util/Log.h trunk/CSP/csp/csplib/util/LogStream.cpp trunk/CSP/csp/csplib/util/LogStream.h Log: A somewhat more robust solution to ensure that logs are properly flushed on exit. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1798 Modified: trunk/CSP/csp/csplib/util/Log.h =================================================================== --- trunk/CSP/csp/csplib/util/Log.h 2005-12-23 04:34:08 UTC (rev 1797) +++ trunk/CSP/csp/csplib/util/Log.h 2005-12-23 05:49:10 UTC (rev 1798) @@ -49,6 +49,7 @@ // it is safe to log messages from static destructors. log_stream = LogStream::getOrCreateNamedLog("CSP"); log_stream->initFromEnvironment("CSPLOG_FILE", "CSPLOG_PRIORITY", "CSPLOG_FLAGS"); + log_stream->setNeverDeleted(); } return *log_stream; } Modified: trunk/CSP/csp/csplib/util/LogStream.cpp =================================================================== --- trunk/CSP/csp/csplib/util/LogStream.cpp 2005-12-23 04:34:08 UTC (rev 1797) +++ trunk/CSP/csp/csplib/util/LogStream.cpp 2005-12-23 05:49:10 UTC (rev 1798) @@ -89,9 +89,55 @@ *buffer = 0; } +/** A private singleton used as a hook at static destruction to force + * logstreams that will never be deleted to enter autoflush mode. + * This ensures that the log will not be truncated when the program + * terminates. LogStreams that are allocated on the heap and never + * deleted should be registered with this helper by calling + * setNeverDeleted(). + */ +class AutoFlushAtExitHelper { + // lazy construction to ensure proper initialization during static + // construction. + static std::vector<LogStream*> *m_streams; + static Mutex *m_mutex; +public: + // warning: this is not thread-safe! + static void registerStream(LogStream* stream) { + if (!m_mutex) m_mutex = new Mutex; + if (!m_streams) m_streams = new std::vector<LogStream*>; + m_mutex->lock(); + m_streams->push_back(stream); + m_mutex->unlock(); + } + AutoFlushAtExitHelper() { + // force initialization in case no streams are registered during + // static construction. + if (!m_mutex) m_mutex = new Mutex; + if (!m_streams) m_streams = new std::vector<LogStream*>; + } + ~AutoFlushAtExitHelper() { + for (std::vector<LogStream*>::iterator iter = m_streams->begin(); iter != m_streams->end(); ++iter) { + (*iter)->setAlwaysFlush(true); + (*iter)->flush(); + } + delete m_streams; + delete m_mutex; + } +} AutoFlushAtExit; // static instance + +std::vector<LogStream*> *AutoFlushAtExitHelper::m_streams; +Mutex *AutoFlushAtExitHelper::m_mutex; + +} // namespace + +void LogStream::setNeverDeleted() { + if (!m_never_deleted) { + AutoFlushAtExitHelper::registerStream(this); + m_never_deleted = true; + } } - void LogStream::initFromEnvironment(const char *log_file, const char *log_priority, const char *log_flags) { if (log_file) { char *env_logfile = getenv(log_file); @@ -187,7 +233,9 @@ m_stream(&std::cerr), m_fstream(0), m_mutex(0), - m_throw_on_fatal(false) { + m_throw_on_fatal(false), + m_autoflush(false), + m_never_deleted(false) { init(); } @@ -197,13 +245,16 @@ m_categories(~0), m_stream(&stream), m_fstream(0), - m_mutex(0) { + m_mutex(0), + m_autoflush(false), + m_never_deleted(false) { init(); } LogStream::~LogStream() { close(); delete m_mutex; + assert(!m_never_deleted); } void LogStream::setStream(std::ostream &stream) { Modified: trunk/CSP/csp/csplib/util/LogStream.h =================================================================== --- trunk/CSP/csp/csplib/util/LogStream.h 2005-12-23 04:34:08 UTC (rev 1797) +++ trunk/CSP/csp/csplib/util/LogStream.h 2005-12-23 05:49:10 UTC (rev 1798) @@ -115,7 +115,6 @@ */ void setThrowOnFatal(bool throw_on_fatal=true) { m_throw_on_fatal = throw_on_fatal; } - /** Test if a given priority and category should be logged. */ inline bool isNoteworthy(int priority, int category=~0) { @@ -133,13 +132,25 @@ */ static LogStream *getOrCreateNamedLog(const std::string &name); - /** Helper class used to write a single entry to the log stream. The * class constructs the log entry as a string internally, then writes * it to the LogStream when it goes out of scope. */ class LogEntry; + /** Call for logstreams that are allocated on the heap and never deleted + * to ensure that log messages will be properly flushed during static + * destruction at program exit. + */ + void setNeverDeleted(); + + /** Call to force the log to be flushed after each entry. Note that + * constant flushing is very inefficient. This method is primarily + * used internally in conjunction with setNeverDeleted. + */ + void setAlwaysFlush(bool flush) { m_autoflush = flush; } + inline bool autoflush() const { return m_autoflush; } + private: void init(); void close(); @@ -154,6 +165,9 @@ bool m_threadsafe; uint64 m_initial_thread; bool m_throw_on_fatal; + + bool m_autoflush; + bool m_never_deleted; }; @@ -221,7 +235,7 @@ ~LogEntry() { m_stream.lock(); m_stream.getStream() << m_buffer.get() << "\n"; - if (m_priority >= LogStream::cWarning) m_stream.flush(); + if (m_priority >= LogStream::cWarning || m_stream.autoflush()) m_stream.flush(); m_stream.unlock(); if (m_priority == LogStream::cFatal) die(); } |
From: <sv...@ww...> - 2005-12-23 04:34:20
|
Author: mkrose Date: 2005-12-22 20:34:08 -0800 (Thu, 22 Dec 2005) New Revision: 1797 Modified: trunk/CSP/csp/csplib/util/LogStream.cpp Log: Ensure that the log is flushed before being closed, and timestamp (rather than datestamp) log entries by default. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1797 Modified: trunk/CSP/csp/csplib/util/LogStream.cpp =================================================================== --- trunk/CSP/csp/csplib/util/LogStream.cpp 2005-12-23 04:25:36 UTC (rev 1796) +++ trunk/CSP/csp/csplib/util/LogStream.cpp 2005-12-23 04:34:08 UTC (rev 1797) @@ -54,7 +54,7 @@ // Replaced gmtime_r and strftime with logTime, mainly because gmtime_r isn't // available on win32. This implementation should also be faster. - void logTime(const time_t t, char *buffer, bool date, bool time) { + void logTime(const time_t t, char *buffer, bool time, bool date) { if (date) { const uint32 days = static_cast<uint32>(t / 86400); @@ -214,6 +214,7 @@ } void LogStream::close() { + flush(); if (m_fstream) { m_fstream->close(); delete m_fstream; |
From: <sv...@ww...> - 2005-12-23 04:25:43
|
Author: mkrose Date: 2005-12-22 20:25:36 -0800 (Thu, 22 Dec 2005) New Revision: 1796 Added: trunk/CSP/csp/modules/demeter/DemeterTerrain.cpp trunk/CSP/csp/modules/demeter/DemeterTerrain.h Modified: trunk/CSP/csp/modules/demeter/SConscript Log: Move DemeterTerrain to the demeter directory so that demeter is a fully independent module of cspsim. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1796 Copied: trunk/CSP/csp/modules/demeter/DemeterTerrain.cpp (from rev 1748, trunk/CSP/csp/cspsim/DemeterTerrain.cpp) Copied: trunk/CSP/csp/modules/demeter/DemeterTerrain.h (from rev 1748, trunk/CSP/csp/cspsim/DemeterTerrain.h) Modified: trunk/CSP/csp/modules/demeter/SConscript =================================================================== --- trunk/CSP/csp/modules/demeter/SConscript 2005-12-23 03:43:20 UTC (rev 1795) +++ trunk/CSP/csp/modules/demeter/SConscript 2005-12-23 04:25:36 UTC (rev 1796) @@ -33,47 +33,3 @@ alias = 'all') -''' -class PlatformSettings: - def config_win(self, env): - env.AppendUnique(LIBS=[ - 'csplib', - 'cspsim', - 'glu32', - 'opengl32', - 'OpenThreadsWin32', - 'osg', - 'SDL', - 'SDL_image']) - env.AppendUnique(LIBPATH=[ - '#/csplib/.bin', - '#/cspsim/.bin']) - - def config_default(self, env): - print ':: csp.modules.demeter config' - conf = build.CustomConfigure(env) - valid = 1 - valid = conf.CheckCommandVersion('sdl', 'sdl-config --version', '1.2.5') and valid - valid = conf.CheckLib('SDL_image', 'IMG_Load') and valid - if not valid: - print 'Missing dependencies; see http://csp.sf.net/wiki/Current_build_dependencies for more information.' - Exit(1) - env = conf.Finish() - env.ParseConfig('sdl-config --cflags --libs') - - -env = env.Copy() -env.Append(CPPDEFINES=Split('TERRAIN_EXPORTS')) -env.CustomizeForPlatform(PlatformSettings) - - -SOURCES = [ - 'DemeterDrawable.cpp', - 'DemeterTerrain.cpp', - 'Terrain.cpp', - 'TerrainTextureFactory.cpp', -] - -libdemeter = env.SharedLibrary('demeter', SOURCES) -Alias(['all', 'demeter'], [libdemeter]) -''' |
From: <sv...@ww...> - 2005-12-23 03:43:34
|
Author: mkrose Date: 2005-12-22 19:43:20 -0800 (Thu, 22 Dec 2005) New Revision: 1795 Added: trunk/CSP/csp/cspsim/Bus.cpp Modified: trunk/CSP/csp/csplib/numeric/NumericalMethod.cpp trunk/CSP/csp/csplib/numeric/NumericalMethod.h trunk/CSP/csp/csplib/spatial/QuadTree.cpp trunk/CSP/csp/csplib/spatial/QuadTree.h trunk/CSP/csp/csplib/thread/Synchronization.h trunk/CSP/csp/csplib/util/Callback.h trunk/CSP/csp/csplib/util/LogConstants.h trunk/CSP/csp/csplib/util/LogStream.cpp trunk/CSP/csp/csplib/util/LogStream.h trunk/CSP/csp/csplib/util/Modules.cpp trunk/CSP/csp/csplib/util/SimpleConfig.h trunk/CSP/csp/csplib/util/StringTools.cpp trunk/CSP/csp/csplib/util/StringTools.h trunk/CSP/csp/cspsim/AircraftPhysicsModel.cpp trunk/CSP/csp/cspsim/Bus.h trunk/CSP/csp/cspsim/CockpitInterface.cpp trunk/CSP/csp/cspsim/Colorspace.cpp trunk/CSP/csp/cspsim/Config.cpp trunk/CSP/csp/cspsim/InputEvent.cpp trunk/CSP/csp/cspsim/ObjectModel.cpp trunk/CSP/csp/cspsim/SConscript Log: Minor cleanups, mainly reducing header dependencies. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1795 Diff omitted (35181 bytes). |
From: <sv...@ww...> - 2005-12-21 08:23:17
|
Author: mkrose Date: 2005-12-21 00:23:09 -0800 (Wed, 21 Dec 2005) New Revision: 1794 Added: trunk/CSP/csp/cspsim/cspsim.footer Log: Add an html footer for the cspsim doxygen pages. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1794 Added: trunk/CSP/csp/cspsim/cspsim.footer =================================================================== --- trunk/CSP/csp/cspsim/cspsim.footer 2005-12-21 08:22:40 UTC (rev 1793) +++ trunk/CSP/csp/cspsim/cspsim.footer 2005-12-21 08:23:09 UTC (rev 1794) @@ -0,0 +1,7 @@ +<hr/> +<table width="100%"><tr><td> +For more information on csplib, visit the <a href='https://www.zerobar.net/csp'>CSP development server</a>.<br/> +<i>Generated on $datetime, using Doxygen $doxygenversion.</i> +</td></tr></table> +</body> +</html> |
From: <sv...@ww...> - 2005-12-21 08:22:48
|
Author: mkrose Date: 2005-12-21 00:22:40 -0800 (Wed, 21 Dec 2005) New Revision: 1793 Modified: trunk/CSP/csp/cspsim/TerrainObject.h Log: Export the TerrainObject interface so that it can be subclassed in external modules. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1793 Modified: trunk/CSP/csp/cspsim/TerrainObject.h =================================================================== --- trunk/CSP/csp/cspsim/TerrainObject.h 2005-12-21 08:22:00 UTC (rev 1792) +++ trunk/CSP/csp/cspsim/TerrainObject.h 2005-12-21 08:22:40 UTC (rev 1793) @@ -52,6 +52,7 @@ */ class CSPSIM_EXPORT TerrainObject: public Object { public: + CSP_EXPORT_OBJECT(CSPSIM_EXPORT) CSP_DECLARE_ABSTRACT_OBJECT(TerrainObject) /* currently the only two terrain engines are demeter and |
From: <sv...@ww...> - 2005-12-21 08:22:08
|
Author: mkrose Date: 2005-12-21 00:22:00 -0800 (Wed, 21 Dec 2005) New Revision: 1792 Modified: trunk/CSP/csp/cspsim/IndexServer.h Log: Build fix for the indexserver under Windows. Not sure why but vc complains about forward Ref declarations in IndexServer unless the copy ctor/operators are defined. Presumably the default methods are trying to modify the reference counts (and so need access to the referenced classes to delete the pointers), but this problem doesn't arise for other (similar) classes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1792 Modified: trunk/CSP/csp/cspsim/IndexServer.h =================================================================== --- trunk/CSP/csp/cspsim/IndexServer.h 2005-12-21 08:16:21 UTC (rev 1791) +++ trunk/CSP/csp/cspsim/IndexServer.h 2005-12-21 08:22:00 UTC (rev 1792) @@ -47,6 +47,9 @@ Ref<Server> m_NetworkServer; Ref<GlobalBattlefield> m_Battlefield; + + IndexServer(const IndexServer&); + IndexServer const &operator=(const IndexServer&); }; CSP_NAMESPACE_END |
From: <sv...@ww...> - 2005-12-21 08:16:30
|
Author: mkrose Date: 2005-12-21 00:16:21 -0800 (Wed, 21 Dec 2005) New Revision: 1791 Modified: trunk/CSP/csp/cspsim/SConscript Log: Windows export tweak for building the indexserver. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1791 Modified: trunk/CSP/csp/cspsim/SConscript =================================================================== --- trunk/CSP/csp/cspsim/SConscript 2005-12-21 04:53:09 UTC (rev 1790) +++ trunk/CSP/csp/cspsim/SConscript 2005-12-21 08:16:21 UTC (rev 1791) @@ -316,7 +316,7 @@ SHLIBPREFIX = '_') -build.SharedLibrary(env, +build.SharedLibrary(expenv, name = 'indexserver', sources = [ 'indexserver.i', |
From: <sv...@ww...> - 2005-12-21 04:53:33
|
Author: mkrose Date: 2005-12-20 20:53:09 -0800 (Tue, 20 Dec 2005) New Revision: 1790 Added: trunk/CSP/csp/bin/ trunk/CSP/csp/bin/sim.ini trunk/CSP/csp/bin/sim.py trunk/CSP/csp/bin/test_objects.py Log: Add the sim startup script and configuration. This is equivalent to CSPSim/Bin/CSPSim.py in the old directory structure. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1790 Diff omitted (15658 bytes). |
From: <sv...@ww...> - 2005-12-21 04:52:14
|
Author: mkrose Date: 2005-12-20 20:52:06 -0800 (Tue, 20 Dec 2005) New Revision: 1789 Modified: trunk/CSP/csp/csplib/data/InterfaceProxy.h Log: Add support subclassing csplib Objects in other modules. To do so under windows the corresponding (internal) object interface classes must be tagged with __declspec. Use the CSP_EXPORT_OBJECT macro to do this as needed (see the doxygen comments for details). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1789 Modified: trunk/CSP/csp/csplib/data/InterfaceProxy.h =================================================================== --- trunk/CSP/csp/csplib/data/InterfaceProxy.h 2005-12-21 04:50:06 UTC (rev 1788) +++ trunk/CSP/csp/csplib/data/InterfaceProxy.h 2005-12-21 04:52:06 UTC (rev 1789) @@ -320,6 +320,24 @@ * objects provide only const access to internal data and keep no dynamic state. * The last macro is used for abstract base classes that cannot be instantiated. * + * If the object will be subclassed outside of the shared library in which it is + * defined, a @c CSP_EXPORT_OBJECT macro must be included before the + * @c CSP_DECLARE_* macro. Although this is technically only a requirement on + * Windows, it should always be done to ensure portability. Typically a + * module will use a macro to select between @c __declspec(dllimport) and + * @c __declspec(dllexport) tags (or no tag on non-windows platforms). + * Assuming this macro is named @c MY_EXPORT, the following ensures that @c Foo + * can be subclassed in other modules: + * + * @code + * class MY_EXPORT Foo { + * public: + * CSP_EXPORT_OBJECT(MY_EXPORT) + * CSP_DECLARE_OBJECT(Foo) + * ... + * }; + * @endcode + * * If any of the @c CSP_DECLARE_ macros is included in an object class, the * object must define an XML interface in the corresponding source file (outside * of the class declaration and not in a header file). The format of the XML @@ -442,6 +460,9 @@ virtual void _serialize(CSP(Reader) &reader); \ static __csp_interface_proxy__M_classname __csp_interface_proxy__M_classname_instance; +#define CSP_EXPORT_OBJECT(_M_export_spec) \ + class _M_export_spec __csp_interface_proxy__M_classname; + #define CSP_DECLARE_OBJECT(_M_classname) \ __CSP_CLASS_DEFINE(_M_classname, false, false) |
From: <sv...@ww...> - 2005-12-21 04:50:14
|
Author: mkrose Date: 2005-12-20 20:50:06 -0800 (Tue, 20 Dec 2005) New Revision: 1788 Modified: trunk/CSP/csp/data/xml/theater/balkan.xml Log: Comment out some experimental fields in the terrain data files since the corresponding code is not yet ready for prime time. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1788 Modified: trunk/CSP/csp/data/xml/theater/balkan.xml =================================================================== --- trunk/CSP/csp/data/xml/theater/balkan.xml 2005-12-21 04:49:05 UTC (rev 1787) +++ trunk/CSP/csp/data/xml/theater/balkan.xml 2005-12-21 04:50:06 UTC (rev 1788) @@ -1,19 +1,19 @@ <?xml version="1.0" standalone="no"?> <Object class="Theater"> - <String name="name">Balkan Theater</String> + <!--String name="name">Balkan Theater</String> <String name="description"/> <String name="credits"/> <List name="modules"> - <!--Object class="Module"> + <Object class="Module"> <String name="path">modules/demeter/libdemeter.so</String> <String name="name">demeter_csp</String> <String name="brief">Demeter Terrain Engine for CSP</String> <String name="description"/> <String name="copyright"/> <String name="credits"/> - </Object--> - </List> + </Object> + </List--> <Path name="terrain">.terrain.balkan</Path> <Path name="feature_group_list">balkan.objectives</Path> </Object> |
From: <sv...@ww...> - 2005-12-21 04:49:12
|
Author: mkrose Date: 2005-12-20 20:49:05 -0800 (Tue, 20 Dec 2005) New Revision: 1787 Modified: trunk/CSP/csp/tools/build.py Log: Tweak the build tools so that dependent targets aren't removed when running scons -c. So 'scons cspsim' will cause both csplib and cspsim to be built, but 'scons -c cspsim' will only clean the cspsim build files. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1787 Modified: trunk/CSP/csp/tools/build.py =================================================================== --- trunk/CSP/csp/tools/build.py 2005-12-21 04:46:37 UTC (rev 1786) +++ trunk/CSP/csp/tools/build.py 2005-12-21 04:49:05 UTC (rev 1787) @@ -1281,7 +1281,7 @@ if self._always_build: AlwaysBuild(shlib) self._output = shlib - if bdeps: + if bdeps and not self._env.GetOption('clean'): Depends(shlib, bdeps) return shlib[0] |
From: <sv...@ww...> - 2005-12-21 04:46:45
|
Author: mkrose Date: 2005-12-20 20:46:37 -0800 (Tue, 20 Dec 2005) New Revision: 1786 Modified: trunk/CSP/csp/SConstruct trunk/CSP/csp/modules/chunklod/SConscript Log: Fix build scripts for chunklod, adding libjpeg dependency for windows. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1786 Modified: trunk/CSP/csp/SConstruct =================================================================== --- trunk/CSP/csp/SConstruct 2005-12-19 06:55:36 UTC (rev 1785) +++ trunk/CSP/csp/SConstruct 2005-12-21 04:46:37 UTC (rev 1786) @@ -61,6 +61,12 @@ build.ExternalLibrary( + name = 'jpeg', + config = [ + build.WindowsLibConfig('libjpeg'), + ]) + +build.ExternalLibrary( name = 'opengl', config = [ build.WindowsLibConfig('glu32'), @@ -135,7 +141,7 @@ class PlatformSettings: def customize_win(self, env): env['CXXFLAGS'] = Split('/GR /MT /O2 /EHsc /nologo') - env.AppendUnique(CPPDEFINES=Split('WIN32 _USRDLL _DLL NDEBUG')) + env.AppendUnique(CPPDEFINES=Split('WIN32 __WIN32__ _USRDLL _DLL NDEBUG')) env.AppendUnique(LINKFLAGS=Split('/INCREMENTAL:NO /RELEASE /nologo')) env.AppendUnique(SHLINKFLAGS=Split('/INCREMENTAL:NO /RELEASE /nologo')) env.CopyEnvironment(Split('PATH INCLUDE LIB')) # FIXME Modified: trunk/CSP/csp/modules/chunklod/SConscript =================================================================== --- trunk/CSP/csp/modules/chunklod/SConscript 2005-12-19 06:55:36 UTC (rev 1785) +++ trunk/CSP/csp/modules/chunklod/SConscript 2005-12-21 04:46:37 UTC (rev 1786) @@ -19,6 +19,7 @@ Import('env build') env = env.Copy() +env.AppendUnique(CPPDEFINES=Split('OSGCHUNKLOD_LIBRARY')) # cspchunklod generates lots of warnings; feel free to clean it up and then remove this line env.RemoveFlags(CXXFLAGS=Split('-pedantic -W /W3')) @@ -33,7 +34,7 @@ 'TextureQuadTree.cpp', 'Version.cpp', ], - deps = ['cspsim'], + deps = ['cspsim', 'jpeg'], alias = 'all') |
From: <sv...@ww...> - 2005-12-19 06:55:43
|
Author: mkrose Date: 2005-12-18 22:55:36 -0800 (Sun, 18 Dec 2005) New Revision: 1785 Added: trunk/CSP/csp/cspsim/indexserver.i Modified: trunk/CSP/csp/cspsim/SConscript Log: Add indexserver swig interface. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1785 Modified: trunk/CSP/csp/cspsim/SConscript =================================================================== --- trunk/CSP/csp/cspsim/SConscript 2005-12-19 06:53:42 UTC (rev 1784) +++ trunk/CSP/csp/cspsim/SConscript 2005-12-19 06:55:36 UTC (rev 1785) @@ -319,7 +319,7 @@ build.SharedLibrary(env, name = 'indexserver', sources = [ - 'IndexServer.i', + 'indexserver.i', 'IndexServer.h', 'IndexServer.cpp', '@cspsim/battlefield', Added: trunk/CSP/csp/cspsim/indexserver.i =================================================================== --- trunk/CSP/csp/cspsim/indexserver.i 2005-12-19 06:53:42 UTC (rev 1784) +++ trunk/CSP/csp/cspsim/indexserver.i 2005-12-19 06:55:36 UTC (rev 1785) @@ -0,0 +1,28 @@ +// Combat Simulator Project +// Copyright (C) 2004 The Combat Simulator Project +// http://csp.sourceforge.net +// +// 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 2 +// 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, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%module indexserver +%{ +#include <csp/cspsim/IndexServer.h> +%} + +%import <csp/csplib/util/Namespace.h> +%include <csp/cspsim/Export.h> +%include <csp/cspsim/IndexServer.h> + |
From: <sv...@ww...> - 2005-12-19 06:53:49
|
Author: mkrose Date: 2005-12-18 22:53:42 -0800 (Sun, 18 Dec 2005) New Revision: 1784 Modified: trunk/CSP/csp/tools/build.py Log: Fix syntax error in windows build config logic. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1784 Modified: trunk/CSP/csp/tools/build.py =================================================================== --- trunk/CSP/csp/tools/build.py 2005-12-19 06:23:53 UTC (rev 1783) +++ trunk/CSP/csp/tools/build.py 2005-12-19 06:53:42 UTC (rev 1784) @@ -1114,7 +1114,7 @@ print 'CSPDEVPACK environment variable not set.' sys.exit(1) try: - v = map(int, re.search(r'[0-9.]+$').group().split('.')) + v = map(int, re.search(r'[0-9.]+$', path).group().split('.')) except Exception: print 'CSPDEVPACK environment variable (%s) is does not look like a valid devpack path.' % path sys.exit(1) |
From: <sv...@ww...> - 2005-12-19 06:24:00
|
Author: mkrose Date: 2005-12-18 22:23:53 -0800 (Sun, 18 Dec 2005) New Revision: 1783 Modified: trunk/CSP/csp/csplib/util/Testing.h Log: Remove dll export tags from a few inline classes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1783 Modified: trunk/CSP/csp/csplib/util/Testing.h =================================================================== --- trunk/CSP/csp/csplib/util/Testing.h 2005-12-19 06:19:43 UTC (rev 1782) +++ trunk/CSP/csp/csplib/util/Testing.h 2005-12-19 06:23:53 UTC (rev 1783) @@ -157,7 +157,7 @@ /** Base class for all test fixtures. */ -class CSPLIB_EXPORT TestFixture: public NonCopyable { +class TestFixture: public NonCopyable { public: virtual ~TestFixture() {} virtual void setup() {} @@ -171,7 +171,7 @@ * CSP_TESTCASE macro to identify the enclosing fixture class. */ template <class tCLASS> -class CSPLIB_EXPORT TypedTestFixture : public TestFixture { +class TypedTestFixture : public TestFixture { protected: typedef tCLASS TestFixtureClass; }; @@ -184,7 +184,7 @@ * by the CSP_TESTCASE macro. */ template <class tFIXTURE> -class CSPLIB_EXPORT TestCase { +class TestCase { std::string m_name; void (tFIXTURE::*m_test)(); @@ -260,7 +260,7 @@ * fixture class. */ template <class tFIXTURE> -class CSPLIB_EXPORT TypedTestRunner: public TestRunner { +class TypedTestRunner: public TestRunner { typedef std::map<std::string, TestCase<tFIXTURE> > TestCaseMap; static TestCaseMap *m_testcases; public: |
From: <sv...@ww...> - 2005-12-19 06:19:51
|
Author: mkrose Date: 2005-12-18 22:19:43 -0800 (Sun, 18 Dec 2005) New Revision: 1782 Modified: trunk/CSP/csp/csplib/data/Archive.h Log: Hide stream operators from swig. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1782 Modified: trunk/CSP/csp/csplib/data/Archive.h =================================================================== --- trunk/CSP/csp/csplib/data/Archive.h 2005-12-19 06:13:28 UTC (rev 1781) +++ trunk/CSP/csp/csplib/data/Archive.h 2005-12-19 06:19:43 UTC (rev 1782) @@ -117,6 +117,7 @@ bool _loadAll() const { return _load_all; } bool isComplete() const { return _read >= _end; } +#ifndef SWIG Reader& operator>>(char &x) { if (_read >= _end) throw DataUnderflow(); x = *_read++; @@ -218,6 +219,7 @@ _read += n; return *this; } +#endif // SWIG // old, fixed-width length implementation (DISABLED) // int32 _readLength() { int32 n; operator>>(n); return n; } @@ -321,6 +323,7 @@ public: virtual ~Writer() {} +#ifndef SWIG Writer& operator<<(const char y) { write(&y, sizeof(y)); return *this; @@ -388,6 +391,7 @@ write(y.data(), n); return *this; } +#endif // SWIG void writeLength(int32 length) { assert(length >= 0 && length <= 1073741823); |
From: <sv...@ww...> - 2005-12-19 06:13:39
|
Author: mkrose Date: 2005-12-18 22:13:28 -0800 (Sun, 18 Dec 2005) New Revision: 1781 Modified: trunk/CSP/csp/csplib/util/LogConstants.h trunk/CSP/csp/cspsim/Config.h trunk/CSP/csp/cspsim/TerrainObject.h Log: A few more windows tweaks. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1781 Modified: trunk/CSP/csp/csplib/util/LogConstants.h =================================================================== --- trunk/CSP/csp/csplib/util/LogConstants.h 2005-12-19 05:56:52 UTC (rev 1780) +++ trunk/CSP/csp/csplib/util/LogConstants.h 2005-12-19 06:13:28 UTC (rev 1781) @@ -27,6 +27,26 @@ #include <csp/csplib/util/Namespace.h> +// the following symbols are used in the logging macros, so +// previous macro declarations must be deleted. note that we +// do *not* redefine these macros, the symbols are ## joined +// with cLogPriority_ to construct the priority constants below. +#ifdef DEBUG +#undef DEBUG +#endif +#ifdef INFO +#undef INFO +#endif +#ifdef WARNING +#undef WARNING +#endif +#ifdef ERROR +#undef ERROR +#endif +#ifdef FATAL +#undef FATAL +#endif + CSP_NAMESPACE /** Log message priorities Modified: trunk/CSP/csp/cspsim/Config.h =================================================================== --- trunk/CSP/csp/cspsim/Config.h 2005-12-19 05:56:52 UTC (rev 1780) +++ trunk/CSP/csp/cspsim/Config.h 2005-12-19 06:13:28 UTC (rev 1781) @@ -25,46 +25,48 @@ #ifndef __CSPSIM_CONFIG_H__ #define __CSPSIM_CONFIG_H__ +#include <csp/cspsim/Export.h> #include <csp/csplib/util/Namespace.h> #include <csp/csplib/util/SimpleConfig.h> #include <string> CSP_NAMESPACE +// TODO move to CSPSim? /** * Global configuration file */ -extern SimpleConfig g_Config; +extern CSPSIM_EXPORT SimpleConfig g_Config; /** * Open the global configuration file. */ -extern bool openConfig(std::string path, bool report_error); //=true); +extern CSPSIM_EXPORT bool openConfig(std::string path, bool report_error); //=true); /** * Get the main cache path. */ -extern std::string getCachePath(); +extern CSPSIM_EXPORT std::string getCachePath(); /** * Get the main configuration path. */ -extern std::string getConfigPath(); +extern CSPSIM_EXPORT std::string getConfigPath(); /** * Get the specific configuration path. */ -extern std::string getConfigPath(std::string const &); +extern CSPSIM_EXPORT std::string getConfigPath(std::string const &); /** * Get the main data path. */ -extern std::string getDataPath(); +extern CSPSIM_EXPORT std::string getDataPath(); /** * Get the specific data path. */ -extern std::string getDataPath(std::string const &); +extern CSPSIM_EXPORT std::string getDataPath(std::string const &); CSP_NAMESPACE_END Modified: trunk/CSP/csp/cspsim/TerrainObject.h =================================================================== --- trunk/CSP/csp/cspsim/TerrainObject.h 2005-12-19 05:56:52 UTC (rev 1780) +++ trunk/CSP/csp/cspsim/TerrainObject.h 2005-12-19 06:13:28 UTC (rev 1781) @@ -29,7 +29,7 @@ #ifndef __CSPSIM_TERRAINOBJECT_H__ #define __CSPSIM_TERRAINOBJECT_H__ - +#include <csp/cspsim/Export.h> #include <csp/csplib/util/Ref.h> #include <csp/csplib/data/Object.h> #include <csp/csplib/data/GeoPos.h> @@ -48,13 +48,9 @@ /** - * class TerrainObject - * - * @author unknown + * Abstract base class for all terrain modules. */ - -class TerrainObject: public Object -{ +class CSPSIM_EXPORT TerrainObject: public Object { public: CSP_DECLARE_ABSTRACT_OBJECT(TerrainObject) |
From: <sv...@ww...> - 2005-12-19 05:56:57
|
Author: mkrose Date: 2005-12-18 21:56:52 -0800 (Sun, 18 Dec 2005) New Revision: 1780 Modified: trunk/CSP/csp/cspsim/LogoScreen.cpp Log: Remove some stdout spam. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1780 Modified: trunk/CSP/csp/cspsim/LogoScreen.cpp =================================================================== --- trunk/CSP/csp/cspsim/LogoScreen.cpp 2005-12-19 05:56:15 UTC (rev 1779) +++ trunk/CSP/csp/cspsim/LogoScreen.cpp 2005-12-19 05:56:52 UTC (rev 1780) @@ -77,10 +77,8 @@ ospath::DirectoryContents dir = ospath::getDirectoryContents(logo_path); for (unsigned i = 0; i < dir.size(); ++i) { std::string ext = ospath::getFileExtension(dir[i]); - std::cout << ext << "\n"; if (osgDB::Registry::instance()->getReaderWriterForExtension(ext)) { std::string path = ospath::join("logo", dir[i]); - std::cout << path << "\n"; osg::ref_ptr<osg::Image> image = osgDB::readImageFile(path); if (image.valid()) m_ImageList.push_back(image); } |
From: <sv...@ww...> - 2005-12-19 05:56:23
|
Author: mkrose Date: 2005-12-18 21:56:15 -0800 (Sun, 18 Dec 2005) New Revision: 1779 Added: trunk/CSP/csp/cspsim/IndexServer.cpp trunk/CSP/csp/cspsim/IndexServer.h Modified: trunk/CSP/csp/SConstruct trunk/CSP/csp/csplib/SConscript trunk/CSP/csp/cspsim/SConscript trunk/CSP/csp/tools/build.py Log: Differentiate python module linking on linux and windows. On windows, e.g., _cspsim.dll must link against _csplib.lib. On linux, _cspsim.so must *not* link against _csplib.so to avoid problems telling the dynamic loader how to find _csplib.so. Runtime library resolution is managed explicitly by loading the corresponding python modules; everything works as long as _csplib.so is loaded before _cspsim.so. Added an option softlink parameters to the build.SharedLibrary tool to handle this case. Modules that will always be loaded explicitly in python should set softlink=1. At the same time, ported the indexserver code to csp/cspsim. The indexserver is now built as a python module. The following python script can be used to run the server: import csp.csplib import csp.indexserver csp.indexserver.IndexServer.main() Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1779 Modified: trunk/CSP/csp/SConstruct =================================================================== --- trunk/CSP/csp/SConstruct 2005-12-19 05:29:22 UTC (rev 1778) +++ trunk/CSP/csp/SConstruct 2005-12-19 05:56:15 UTC (rev 1779) @@ -51,7 +51,6 @@ PACKAGES = [ 'csplib', 'cspsim', - 'indexserver', 'modules', ] Modified: trunk/CSP/csp/csplib/SConscript =================================================================== --- trunk/CSP/csp/csplib/SConscript 2005-12-19 05:29:22 UTC (rev 1778) +++ trunk/CSP/csp/csplib/SConscript 2005-12-19 05:56:15 UTC (rev 1779) @@ -188,6 +188,7 @@ sources = ['@csplib'], aliases = 'all', doxygen = 'csplib.dox', + softlink = 1, SHLIBPREFIX='_') Copied: trunk/CSP/csp/cspsim/IndexServer.cpp (from rev 1678, trunk/CSP/IndexServer/IndexServer.cpp) =================================================================== --- trunk/CSP/IndexServer/IndexServer.cpp 2005-11-19 21:47:20 UTC (rev 1678) +++ trunk/CSP/csp/cspsim/IndexServer.cpp 2005-12-19 05:56:15 UTC (rev 1779) @@ -0,0 +1,125 @@ +// Combat Simulator Project +// Copyright (C) 2004 The Combat Simulator Project +// http://csp.sourceforge.net +// +// 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 2 +// 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, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file IndexServer.cpp + * + **/ + +#include <csp/cspsim/battlefield/GlobalBattlefield.h> +#include <csp/cspsim/IndexServer.h> +#include <csp/cspsim/Config.h> + +#include <csp/csplib/net/ClientServer.h> +#include <csp/csplib/thread/Thread.h> +#include <csp/csplib/util/Log.h> +#include <csp/csplib/util/SimpleConfig.h> +#include <csp/csplib/util/Trace.h> + + +CSP_NAMESPACE + +IndexServer::IndexServer() { + CSPLOG(INFO, APP) << "IndexServer()"; +} + +IndexServer::~IndexServer() { +} + +void IndexServer::initPrimaryInterface() { + assert(m_NetworkServer.isNull()); + NetworkNode default_node; + const std::string server_interface = g_Config.getString("Network", "Bind", default_node.getIpString() + ":3160", true); + const std::string external_ip = g_Config.getString("Network", "ExternalIp", "", false); + const std::string::size_type colon = server_interface.find(':'); + std::string address; + Port port = 0; + if (colon != std::string::npos) { + port = static_cast<Port>(atoi(server_interface.substr(colon + 1).c_str())); + address = server_interface.substr(0, colon); + } + if (address.size() == 0 || port == 0) { + std::cerr << "Invalid value for Network.Bind in .ini file: " << server_interface << "\n"; + std::cerr << "Should be of the form www.xxx.yyy.zzz:port\n"; + ::exit(1); + } + NetworkNode local_node(address, port); + CSPLOG(INFO, APP) << "binding to interface " << local_node; + + const int incoming_bw = g_Config.getInt("Network", "IncomingBandwidth", 12000, true); + const int outgoing_bw = g_Config.getInt("Network", "OutgoingBandwidth", 12000, true); + m_NetworkServer = new Server(local_node, incoming_bw, outgoing_bw); + + if (external_ip.empty()) { + if (!local_node.isRoutable()) { + CSPLOG(WARNING, APP) << "no external ip address specified; accepting only local (LAN) connections"; + } + } else { + if (!local_node.isRoutable()) { + NetworkNode external_node(external_ip, port); + CSPLOG(INFO, APP) << "external interface is " << external_node; + if (external_node.isRoutable()) { + m_NetworkServer->setExternalNode(external_node); + } else { + CSPLOG(ERROR, APP) << "external interface is not routable; ignoring ExternalIp and accepting only local (LAN) connections"; + } + } else { + if (external_ip != address) { + CSPLOG(ERROR, APP) << "binding to a routable interface that does not match the specified external ip (" << external_ip << "); ignoring ExternalIp"; + } + } + } +} + +void IndexServer::initialize() { + initPrimaryInterface(); + m_Battlefield = new GlobalBattlefield(); + m_Battlefield->setNetworkServer(m_NetworkServer); +} + +void IndexServer::run() { + initialize(); + CSPLOG(INFO, APP) << "starting network loop"; + Timer timer; + timer.start(); + for (;;) { + m_NetworkServer->processAndWait(0.01, 0.01, 0.10); + m_Battlefield->update(timer.incremental()); + } +} + +int IndexServer::main() { + csp::AutoTrace::install(); + + if (!csp::openConfig("IndexServer.ini", false)) { + std::cerr << "Unable to open config file 'IndexServer.ini'\n"; + return 1; + } + + csp::log().logToFile("IndexServer.log"); + csp::log().setCategories(csp::cLogCategory_ALL); + csp::log().setPriority(csp::g_Config.getInt("Debug", "LogPriority", csp::cLogPriority_INFO, true)); + + csp::IndexServer server; + server.run(); + return 0; +} + +CSP_NAMESPACE_END + Copied: trunk/CSP/csp/cspsim/IndexServer.h (from rev 1678, trunk/CSP/IndexServer/IndexServer.h) =================================================================== --- trunk/CSP/IndexServer/IndexServer.h 2005-11-19 21:47:20 UTC (rev 1678) +++ trunk/CSP/csp/cspsim/IndexServer.h 2005-12-19 05:56:15 UTC (rev 1779) @@ -0,0 +1,54 @@ +// Combat Simulator Project +// Copyright (C) 2004 The Combat Simulator Project +// http://csp.sourceforge.net +// +// 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 2 +// 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, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file IndexServer.h + * + **/ + +#ifndef __CSPSIM_INDEXSERVER_H__ +#define __CSPSIM_INDEXSERVER_H__ + +#include <csp/csplib/util/Ref.h> +#include <csp/cspsim/Export.h> + +CSP_NAMESPACE + +class Server; +class GlobalBattlefield; + + +class CSPSIM_EXPORT IndexServer { +public: + IndexServer(); + ~IndexServer(); + void run(); + static int main(); + +private: + void initialize(); + void initPrimaryInterface(); + + Ref<Server> m_NetworkServer; + Ref<GlobalBattlefield> m_Battlefield; +}; + +CSP_NAMESPACE_END + +#endif // __CSPSIM_INDEXSERVER_H__ Modified: trunk/CSP/csp/cspsim/SConscript =================================================================== --- trunk/CSP/csp/cspsim/SConscript 2005-12-19 05:29:22 UTC (rev 1778) +++ trunk/CSP/csp/cspsim/SConscript 2005-12-19 05:56:15 UTC (rev 1779) @@ -41,7 +41,7 @@ deps = ['csplib']) -cspsim = build.SourceGroup(expenv, +build.SourceGroup(expenv, name = 'cspsim', sources = [ 'cspsim.i', @@ -129,8 +129,8 @@ 'LogoScreen.cpp', 'LogoScreen.h', 'MapEvent.h', - 'Module.cpp', - 'Module.h', +# 'Module.cpp', +# 'Module.h', 'NavigationChannels.h', 'ObjectModel.cpp', 'ObjectModel.h', @@ -303,13 +303,29 @@ deps = ['csplib', 'opengl', 'osg', 'sdl']) -build.SharedLibrary(expenv, 'cspsim', - sources=[ +build.SharedLibrary(expenv, + name = 'cspsim', + sources = [ '@cspsim', '@cspsim/battlefield', '@cspsim/config', ], - aliases='all', - doxygen='cspsim.dox', - SHLIBPREFIX='_') + aliases = 'all', + doxygen = 'cspsim.dox', + softlink = 1, + SHLIBPREFIX = '_') + +build.SharedLibrary(env, + name = 'indexserver', + sources = [ + 'IndexServer.i', + 'IndexServer.h', + 'IndexServer.cpp', + '@cspsim/battlefield', + '@cspsim/config', + ], + deps = ['csplib'], + aliases = 'all', + SHLIBPREFIX = '_') + Modified: trunk/CSP/csp/tools/build.py =================================================================== --- trunk/CSP/csp/tools/build.py 2005-12-19 05:29:22 UTC (rev 1778) +++ trunk/CSP/csp/tools/build.py 2005-12-19 05:56:15 UTC (rev 1779) @@ -1226,7 +1226,7 @@ class SharedLibrary: - def __init__(self, env, name, sources=[], aliases=[], deps=[], always_build=0, doxygen=None, **kw): + def __init__(self, env, name, sources=[], aliases=[], deps=[], always_build=0, softlink=0, doxygen=None, **kw): self._env = env.Copy() self._name = name self._sources = [s for s in sources if s.startswith('@')] @@ -1237,6 +1237,7 @@ self._target = os.path.join(env.Dir('.').path, name) # a bit ugly self._aliases = aliases self._always_build = always_build + self._softlink = softlink self._doxygen = None if doxygen: self._dox = env.Dir('.dox').srcnode() @@ -1306,5 +1307,6 @@ self._findSources() for group in self._groups: group._addSettings(settings, bdeps) - settings.merge(LIBPATH=[os.path.dirname(self._target)], LIBS=[os.path.basename(self._target)]) + if IsWindows(self._env) or not self._softlink: + settings.merge(LIBPATH=[os.path.dirname(self._target)], LIBS=[os.path.basename(self._target)]) |