From: Oliver O. <fr...@us...> - 2007-06-17 13:38:48
|
Update of /cvsroot/simspark/simspark/spark/salt In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21072/salt Modified Files: bounds.h defines.h fileclasses.cpp fileclasses.h gmath.h matrix.h path.h rect.h sharedlibrary.cpp sharedlibrary.h tvector.h vector.h Log Message: merge from projectx branch Index: defines.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/defines.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** defines.h 5 Dec 2005 20:56:00 -0000 1.1 --- defines.h 17 Jun 2007 13:38:39 -0000 1.2 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 30,34 **** #ifdef HAVE_CONFIG_H ! #include <config.h> #endif --- 30,34 ---- #ifdef HAVE_CONFIG_H ! #include <sparkconfig.h> #endif Index: sharedlibrary.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/sharedlibrary.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sharedlibrary.h 22 Jan 2006 12:13:08 -0000 1.2 --- sharedlibrary.h 17 Jun 2007 13:38:39 -0000 1.3 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 30,37 **** #define SALT_SHAREDLIBRARY_H - #ifdef HAVE_CONFIG_H - #include <config.h> - #endif - #include "defines.h" #include <string> --- 30,33 ---- *************** *** 86,90 **** private: /** a platform dependent handle to the managed library */ ! void *mLibHandle; /** the name of the library */ --- 82,86 ---- private: /** a platform dependent handle to the managed library */ ! void *mLibHandle; /** the name of the library */ Index: fileclasses.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/fileclasses.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fileclasses.h 15 Mar 2007 07:26:29 -0000 1.2 --- fileclasses.h 17 Jun 2007 13:38:39 -0000 1.3 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 32,41 **** #define SALT_FILECLASSES_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include <cstdio> #include <cstdlib> #ifndef PATH_MAX --- 32,38 ---- #define SALT_FILECLASSES_H #include <cstdio> #include <cstdlib> + #include <string> #ifndef PATH_MAX *************** *** 46,59 **** { - /** Defines the native path separator character for the - platform - */ - static const char* PathSeparator = - #ifdef WIN32 - "\\"; - #else - "/"; - #endif - /** RFile defines an interface and some basic support functions for * classes providing read only file services --- 43,46 ---- *************** *** 64,67 **** --- 51,63 ---- virtual ~RFile() {}; + /** The separator for path names (depends on the platform) + * @return path separator + */ + static std::string Sep(); + /** A (platform specific) "bundle path", i.e. a hint where files of the package might be found. + * @return the bundle path name with a trailing path separator + */ + static std::string BundlePath(); + // a bunch of pure virtual functions which a file must implement Index: gmath.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/gmath.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gmath.h 15 Mar 2007 07:26:29 -0000 1.3 --- gmath.h 17 Jun 2007 13:38:39 -0000 1.4 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 27,34 **** #define SALT_GMATH_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include "defines.h" #include <cmath> --- 27,30 ---- *************** *** 180,191 **** { while (angle > 180) ! { ! angle -= 360; ! } while (angle < -180) ! { ! angle += 360; ! } return angle; --- 176,187 ---- { while (angle > 180) ! { ! angle -= 360; ! } while (angle < -180) ! { ! angle += 360; ! } return angle; Index: bounds.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/bounds.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bounds.h 5 Dec 2005 20:56:00 -0000 1.1 --- bounds.h 17 Jun 2007 13:38:39 -0000 1.2 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 23,30 **** #define SALT_BOUNDS_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include "defines.h" #include "matrix.h" --- 23,26 ---- Index: rect.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/rect.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rect.h 5 Dec 2005 20:56:00 -0000 1.1 --- rect.h 17 Jun 2007 13:38:39 -0000 1.2 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 23,30 **** #define SALT_RECT_H - #ifdef HAVE_CONFIG_H - #include <config.h> - #endif - #include "defines.h" --- 23,26 ---- Index: vector.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/vector.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vector.h 15 Mar 2007 07:26:29 -0000 1.2 --- vector.h 17 Jun 2007 13:38:39 -0000 1.3 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 31,38 **** #define SALT_VECTOR_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include "tvector.h" #include <cstdlib> --- 31,34 ---- Index: fileclasses.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/fileclasses.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fileclasses.cpp 15 Mar 2007 07:26:29 -0000 1.2 --- fileclasses.cpp 17 Jun 2007 13:38:39 -0000 1.3 *************** *** 1,5 **** ! /* -*- mode: c++ -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2003 Koblenz University --- 1,5 ---- ! /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2003 Koblenz University *************** *** 23,26 **** --- 23,34 ---- #include <cstring> + #if HAVE_CONFIG_H + #include <sparkconfig.h> + #endif + + #if HAVE_COREFOUNDATION_COREFOUNDATION_H + #include <CoreFoundation/CoreFoundation.h> + #endif + namespace salt { *************** *** 40,43 **** --- 48,89 ---- using namespace salt; + std::string + RFile::Sep() + { + #ifdef WIN32 + return "\\"; + #else + return "/"; + #endif + } + + std::string + RFile::BundlePath() + { + #if HAVE_COREFOUNDATION_COREFOUNDATION_H + char path[1024]; + CFBundleRef mainBundle = CFBundleGetMainBundle(); + assert(mainBundle); + + CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); + assert(mainBundleURL); + + CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); + assert(cfStringRef); + + CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); + + CFRelease(mainBundleURL); + CFRelease(cfStringRef); + + return std::string(path) + Sep(); + #else + # ifdef PREFIX + return PREFIX + Sep() + "share" + Sep() + PACKAGE_NAME; + # else + return "." + Sep(); + # endif + #endif + } //------------------------------------------------------------------------------------------------ *************** *** 294,298 **** long size = ftell((FILE*)mHandle); fseek((FILE*)mHandle,pos,SEEK_SET); ! return size; } --- 340,344 ---- long size = ftell((FILE*)mHandle); fseek((FILE*)mHandle,pos,SEEK_SET); ! return size; } Index: matrix.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/matrix.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** matrix.h 15 Jun 2007 08:48:18 -0000 1.2 --- matrix.h 17 Jun 2007 13:38:39 -0000 1.3 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 23,30 **** #define SALT_MATRIX_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include "defines.h" #include "vector.h" --- 23,26 ---- Index: sharedlibrary.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/sharedlibrary.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sharedlibrary.cpp 15 Mar 2007 07:26:29 -0000 1.4 --- sharedlibrary.cpp 17 Jun 2007 13:38:39 -0000 1.5 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 21,24 **** --- 21,25 ---- */ #include "sharedlibrary.h" + #include "fileclasses.h" #include <iostream> *************** *** 80,84 **** mLibHandle = ::dlopen((libName + ".so").c_str(), RTLD_LAZY); ! if (mLibHandle == NULL) { std::cerr << "(SharedLibrary) ERROR: dlopen failed for " << libName --- 81,98 ---- mLibHandle = ::dlopen((libName + ".so").c_str(), RTLD_LAZY); ! if (mLibHandle == 0) ! { // we didn't find the plugin, so we try again... ! /* mainly to work with MacOS bundles, so that plugins can be located like this: ! application.app/ ! | ! \- Contents/ ! | ! --MacOS/ < - application lives here - > ! | ! --plugins/ < - plugins live here - > ! */ ! mLibHandle = ::dlopen((RFile::BundlePath() + "Contents/plugins/" + libName + ".so").c_str(), RTLD_LAZY); ! } ! if (mLibHandle == 0) { std::cerr << "(SharedLibrary) ERROR: dlopen failed for " << libName Index: tvector.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/tvector.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tvector.h 5 Dec 2005 20:56:00 -0000 1.1 --- tvector.h 17 Jun 2007 13:38:39 -0000 1.2 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 34,41 **** #define SALT_TVECTOR_H - // #ifdef HAVE_CONFIG_H - // #include <config.h> - // #endif - #include "defines.h" #include "gmath.h" --- 34,37 ---- Index: path.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/salt/path.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** path.h 5 Dec 2005 20:56:00 -0000 1.1 --- path.h 17 Jun 2007 13:38:39 -0000 1.2 *************** *** 1,5 **** /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University --- 1,5 ---- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- ! this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University *************** *** 32,51 **** #ifdef HAVE_CONFIG_H ! # ifdef PACKAGE_BUGREPORT ! # undef PACKAGE_BUGREPORT ! # endif ! # ifdef PACKAGE_NAME ! # undef PACKAGE_NAME ! # endif ! # ifdef PACKAGE_STRING ! # undef PACKAGE_STRING ! # endif ! # ifdef PACKAGE_TARNAME ! # undef PACKAGE_TARNAME ! # endif ! # ifdef PACKAGE_VERSION ! # undef PACKAGE_VERSION ! # endif ! #include "config.h" #endif --- 32,46 ---- #ifdef HAVE_CONFIG_H ! # undef EXTERN ! # undef HAVE_VPRINTF ! # undef PACKAGE ! # undef PACKAGE_BUGREPORT ! # undef PACKAGE_NAME ! # undef PACKAGE_STRING ! # undef PACKAGE_TARNAME ! # undef PACKAGE_VERSION ! # undef PREFIX ! # undef VERSION ! #include <sparkconfig.h> #endif |