Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-05-08 23:16:40 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-05-08 23:16:40 +0400
commit64e4a3ec9aed6c8abe095e2cd1fe1552f7cde51c (patch)
tree6c77358bd447b6c2d215324ef48fc12d1f5ae5ca /source/blender/freestyle/intern/system
parentcf2e1e2857cfc5b3c2848c7fc6c9d919ac72fabb (diff)
parent106974a9d2d5caa5188322507980e3d57d2e3517 (diff)
soc-2008-mxcurioni: merged changes to revision 14747, cosmetic changes for source/blender/freestyle
Diffstat (limited to 'source/blender/freestyle/intern/system')
-rwxr-xr-xsource/blender/freestyle/intern/system/BaseIterator.h90
-rwxr-xr-xsource/blender/freestyle/intern/system/BaseObject.cpp1
-rwxr-xr-xsource/blender/freestyle/intern/system/BaseObject.h73
-rwxr-xr-xsource/blender/freestyle/intern/system/Cast.h44
-rwxr-xr-xsource/blender/freestyle/intern/system/Exception.cpp24
-rwxr-xr-xsource/blender/freestyle/intern/system/Exception.h64
-rwxr-xr-xsource/blender/freestyle/intern/system/FreestyleConfig.h152
-rwxr-xr-xsource/blender/freestyle/intern/system/Id.h126
-rwxr-xr-xsource/blender/freestyle/intern/system/Interpreter.h56
-rwxr-xr-xsource/blender/freestyle/intern/system/Precision.h39
-rwxr-xr-xsource/blender/freestyle/intern/system/ProgressBar.h85
-rwxr-xr-xsource/blender/freestyle/intern/system/PseudoNoise.cpp108
-rwxr-xr-xsource/blender/freestyle/intern/system/PseudoNoise.h58
-rwxr-xr-xsource/blender/freestyle/intern/system/PythonInterpreter.cpp25
-rwxr-xr-xsource/blender/freestyle/intern/system/PythonInterpreter.h111
-rwxr-xr-xsource/blender/freestyle/intern/system/RandGen.cpp86
-rwxr-xr-xsource/blender/freestyle/intern/system/RandGen.h48
-rwxr-xr-xsource/blender/freestyle/intern/system/StringUtils.cpp46
-rwxr-xr-xsource/blender/freestyle/intern/system/StringUtils.h51
-rwxr-xr-xsource/blender/freestyle/intern/system/TimeStamp.cpp25
-rwxr-xr-xsource/blender/freestyle/intern/system/TimeStamp.h71
-rwxr-xr-xsource/blender/freestyle/intern/system/TimeUtils.h58
-rwxr-xr-xsource/blender/freestyle/intern/system/src.pri30
-rwxr-xr-xsource/blender/freestyle/intern/system/system.pro73
24 files changed, 1544 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/system/BaseIterator.h b/source/blender/freestyle/intern/system/BaseIterator.h
new file mode 100755
index 00000000000..45cc19df4fe
--- /dev/null
+++ b/source/blender/freestyle/intern/system/BaseIterator.h
@@ -0,0 +1,90 @@
+//
+// Filename : BaseIterator.h
+// Author(s) : Stephane Grabli
+// Purpose : Classes defining the basic "Iterator" design pattern
+// Date of creation : 18/03/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef BASEITERATOR_H
+# define BASEITERATOR_H
+
+# include <iterator>
+
+// use for iterators defintions
+template <class Element>
+class Nonconst_traits;
+
+template <class Element>
+class Const_traits {
+public:
+ typedef Element value_type;
+ typedef const Element& reference;
+ typedef const Element* pointer;
+ typedef ptrdiff_t difference_type;
+ typedef Nonconst_traits<Element> Non_const_traits;
+};
+
+template <class Element>
+class Nonconst_traits {
+public:
+ typedef Element value_type;
+ typedef Element& reference;
+ typedef Element* pointer;
+ typedef ptrdiff_t difference_type;
+ typedef Nonconst_traits<Element> Non_const_traits;
+};
+
+class InputIteratorTag_Traits {
+public:
+ typedef std::input_iterator_tag iterator_category;
+};
+
+class BidirectionalIteratorTag_Traits {
+public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+};
+
+template<class Traits, class IteratorTagTraits>
+class IteratorBase
+{
+public:
+
+ virtual ~IteratorBase() {}
+
+ virtual bool begin() const = 0;
+ virtual bool end() const = 0;
+
+ typedef typename IteratorTagTraits::iterator_category iterator_category;
+ typedef typename Traits::value_type value_type;
+ typedef typename Traits::difference_type difference_type;
+ typedef typename Traits::pointer pointer;
+ typedef typename Traits::reference reference;
+
+protected:
+
+ IteratorBase() {}
+};
+
+#endif // BASEITERATOR_H
diff --git a/source/blender/freestyle/intern/system/BaseObject.cpp b/source/blender/freestyle/intern/system/BaseObject.cpp
new file mode 100755
index 00000000000..21d8a77b268
--- /dev/null
+++ b/source/blender/freestyle/intern/system/BaseObject.cpp
@@ -0,0 +1 @@
+#include "BaseObject.h" \ No newline at end of file
diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h
new file mode 100755
index 00000000000..a8515f98385
--- /dev/null
+++ b/source/blender/freestyle/intern/system/BaseObject.h
@@ -0,0 +1,73 @@
+//
+// Filename : BaseObject.h
+// Author(s) : Stephane Grabli
+// Purpose : Base Class for most shared objects (Node, Rep).
+// Defines the addRef, release system.
+// Inspired by COM IUnknown system.
+// Date of creation : 06/02/2002
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef BASEOBJECT_H
+# define BASEOBJECT_H
+
+#include "FreestyleConfig.h"
+
+class LIB_SYSTEM_EXPORT BaseObject
+{
+public:
+
+ inline BaseObject() {
+ _ref_counter = 0;
+ }
+
+ virtual ~BaseObject() {}
+
+ /*! At least makes a release on this.
+ * The BaseObject::destroy method must be
+ * explicitely called at the end of any
+ * overloaded destroy
+ */
+ virtual int destroy() {
+ return release();
+ }
+
+ /*! Increments the reference counter */
+ inline int addRef() {
+ return ++_ref_counter;
+ }
+
+ /*! Decrements the reference counter */
+ inline int release() {
+ if (_ref_counter)
+ _ref_counter--;
+ return _ref_counter;
+ }
+
+private:
+
+ unsigned _ref_counter;
+};
+
+#endif // BASEOBJECT_H
diff --git a/source/blender/freestyle/intern/system/Cast.h b/source/blender/freestyle/intern/system/Cast.h
new file mode 100755
index 00000000000..15af767443e
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Cast.h
@@ -0,0 +1,44 @@
+//
+// Filename : Cast.h
+// Author(s) : Emmanuel Turquin
+// Purpose : Cast function
+// Date of creation : 01/07/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef CAST_HPP
+# define CAST_HPP
+
+namespace Cast {
+
+ template <class T, class U>
+ U* cast(T* in) {
+ if (!in)
+ return NULL;
+ return dynamic_cast<U*>(in);
+ }
+
+} // end of namespace Cast
+
+#endif // CAST_HPP
diff --git a/source/blender/freestyle/intern/system/Exception.cpp b/source/blender/freestyle/intern/system/Exception.cpp
new file mode 100755
index 00000000000..d1d12d18297
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Exception.cpp
@@ -0,0 +1,24 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "Exception.h"
+
+Exception::exception_type Exception::_exception = Exception::NO_EXCEPTION;
diff --git a/source/blender/freestyle/intern/system/Exception.h b/source/blender/freestyle/intern/system/Exception.h
new file mode 100755
index 00000000000..378de6b558f
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Exception.h
@@ -0,0 +1,64 @@
+//
+// Filename : Exception.h
+// Author(s) : Stephane Grabli
+// Purpose : Singleton to manage exceptions
+// Date of creation : 10/01/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef EXCEPTION_H
+# define EXCEPTION_H
+
+# include "FreestyleConfig.h"
+
+class LIB_SYSTEM_EXPORT Exception
+{
+public:
+
+ typedef enum {
+ NO_EXCEPTION,
+ UNDEFINED
+ } exception_type;
+
+ static int getException() {
+ exception_type e = _exception;
+ _exception = NO_EXCEPTION;
+ return e;
+ }
+
+ static int raiseException(exception_type exception = UNDEFINED) {
+ _exception = exception;
+ return _exception;
+ }
+
+ static void reset() {
+ _exception = NO_EXCEPTION;
+ }
+
+private:
+
+ static exception_type _exception;
+};
+
+#endif // EXCEPTION_H
diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h
new file mode 100755
index 00000000000..45bd00a402e
--- /dev/null
+++ b/source/blender/freestyle/intern/system/FreestyleConfig.h
@@ -0,0 +1,152 @@
+//
+// Filename : Config.h
+// Author(s) : Emmanuel Turquin
+// Purpose : Configuration definitions
+// Date of creation : 25/02/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef CONFIG_H
+# define CONFIG_H
+
+# include <string>
+
+using namespace std;
+
+namespace Config {
+
+ // Pi definition
+# ifndef M_PI
+# define M_PI 3.14159265
+# endif // M_PI
+
+ // Directory separators
+# ifdef WIN32
+ static const string DIR_SEP("\\");
+ static const string PATH_SEP(";");
+# else
+ static const string DIR_SEP("/");
+ static const string PATH_SEP(":");
+# endif // WIN32
+
+ // DLL import/export macros for Win32
+
+# ifdef WIN32
+# ifdef MAKE_LIB_SYSTEM_DLL
+# define LIB_SYSTEM_EXPORT __declspec(dllexport)
+# else
+# define LIB_SYSTEM_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_SYSTEM_DLL
+
+# ifdef MAKE_LIB_IMAGE_DLL
+# define LIB_IMAGE_EXPORT __declspec(dllexport)
+# else
+# define LIB_IMAGE_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_IMAGE_DLL
+
+# ifdef MAKE_LIB_GEOMETRY_DLL
+# define LIB_GEOMETRY_EXPORT __declspec(dllexport)
+# else
+# define LIB_GEOMETRY_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_GEOMETRY_DLL
+
+# ifdef MAKE_LIB_SCENE_GRAPH_DLL
+# define LIB_SCENE_GRAPH_EXPORT __declspec(dllexport)
+# else
+# define LIB_SCENE_GRAPH_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_SCENE_GRAPH_DLL
+
+# ifdef MAKE_LIB_WINGED_EDGE_DLL
+# define LIB_WINGED_EDGE_EXPORT __declspec(dllexport)
+# else
+# define LIB_WINGED_EDGE_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_WINGED_EDGE_DLL
+
+# ifdef MAKE_LIB_VIEW_MAP_DLL
+# define LIB_VIEW_MAP_EXPORT __declspec(dllexport)
+# else
+# define LIB_VIEW_MAP_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_VIEW_MAP_DLL
+
+# ifdef MAKE_LIB_STROKE_DLL
+# define LIB_STROKE_EXPORT __declspec(dllexport)
+# else
+# define LIB_STROKE_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_STROKE_DLL
+
+# ifdef MAKE_LIB_RENDERING_DLL
+# define LIB_RENDERING_EXPORT __declspec(dllexport)
+# else
+# define LIB_RENDERING_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_RENDERING_DLL
+
+# ifdef MAKE_LIB_WRAPPER_DLL
+# define LIB_WRAPPER_EXPORT __declspec(dllexport)
+# else
+# define LIB_WRAPPER_EXPORT __declspec(dllimport)
+# endif // MAKE_LIB_WRAPPER_DLL
+
+# else
+# ifndef LIB_SYSTEM_EXPORT
+# define LIB_SYSTEM_EXPORT
+# endif // LIB_SYSTEM_EXPORT
+
+# ifndef LIB_IMAGE_EXPORT
+# define LIB_IMAGE_EXPORT
+# endif // LIB_IMAGE_EXPORT
+
+# ifndef LIB_GEOMETRY_EXPORT
+# define LIB_GEOMETRY_EXPORT
+# endif // LIB_GEOMETRY_EXPORT
+
+# ifndef LIB_SCENE_GRAPH_EXPORT
+# define LIB_SCENE_GRAPH_EXPORT
+# endif // LIB_SCENE_GRAPH_EXPORT
+
+# ifndef LIB_WINGED_EDGE_EXPORT
+# define LIB_WINGED_EDGE_EXPORT
+# endif // LIB_WINGED_EDGE_EXPORT
+
+# ifndef LIB_VIEW_MAP_EXPORT
+# define LIB_VIEW_MAP_EXPORT
+# endif // LIB_VIEW_MAP_EXPORT
+
+# ifndef LIB_STROKE_EXPORT
+# define LIB_STROKE_EXPORT
+# endif // LIB_STROKE_EXPORT
+
+# ifndef LIB_RENDERING_EXPORT
+# define LIB_RENDERING_EXPORT
+# endif // LIB_RENDERING_EXPORT
+
+# ifndef LIB_WRAPPER_EXPORT
+# define LIB_WRAPPER_EXPORT
+# endif // LIB_WRAPPER_EXPORT
+
+# endif // WIN32
+
+} // end of namespace Config
+
+#endif // CONFIG_H
diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h
new file mode 100755
index 00000000000..1f2206ed337
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Id.h
@@ -0,0 +1,126 @@
+//
+// Filename : Id.h
+// Author(s) : Emmanuel Turquin
+// Purpose : Identification system
+// Date of creation : 01/07/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef ID_H
+# define ID_H
+
+/*! Class used to tag any object by an id .
+ * It is made of two unsigned integers.
+ */
+class Id
+{
+public:
+
+ typedef unsigned id_type;
+
+ /*! Default constructor */
+ Id() {
+ _first = 0;
+ _second = 0;
+ }
+
+ /*! Builds an Id from an integer.
+ * The second number is set to 0.
+ */
+ Id(id_type id) {
+ _first = id;
+ _second = 0;
+ }
+
+ /*! Builds the Id from the two numbers */
+ Id(id_type ifirst, id_type isecond) {
+ _first = ifirst;
+ _second = isecond;
+ }
+
+ /*! Copy constructor */
+ Id(const Id& iBrother) {
+ _first = iBrother._first;
+ _second = iBrother._second;
+ }
+
+ /*! Operator= */
+ Id& operator=(const Id& iBrother) {
+ _first = iBrother._first;
+ _second = iBrother._second;
+ return *this;
+ }
+
+ /*! Returns the first Id number */
+ id_type getFirst() const {
+ return _first;
+ }
+
+ /*! Returns the second Id number */
+ id_type getSecond() const {
+ return _second;
+ }
+
+ /*! Sets the first number constituing the Id */
+ void setFirst(id_type first) {
+ _first = first;
+ }
+
+ /*! Sets the second number constituing the Id */
+ void setSecond(id_type second) {
+ _second = second;
+ }
+
+ /*! Operator== */
+ bool operator==(const Id& id) const {
+ return ((_first == id._first) && (_second == id._second));
+ }
+
+ /*! Operator!= */
+ bool operator!=(const Id& id) const {
+ return !((*this)==id);
+ }
+
+ /*! Operator< */
+ bool operator<(const Id& id) const {
+ if (_first < id._first)
+ return true;
+ if (_first == id._first && _second < id._second)
+ return true;
+ return false;
+}
+
+private:
+
+ id_type _first;
+ id_type _second;
+};
+
+// stream operator
+inline std::ostream& operator<<(std::ostream& s, const Id& id) {
+ s << "[" << id.getFirst() << ", " << id.getSecond() << "]";
+ return s;
+}
+
+# endif // ID_H
diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h
new file mode 100755
index 00000000000..ce603b17238
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Interpreter.h
@@ -0,0 +1,56 @@
+//
+// Filename : Interpreter.h
+// Author(s) : Emmanuel Turquin
+// Purpose : Base Class of all script interpreters
+// Date of creation : 17/04/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef INTERPRETER_H
+# define INTERPRETER_H
+
+# include <string>
+
+using namespace std;
+
+class LIB_SYSTEM_EXPORT Interpreter
+{
+ public:
+
+ Interpreter() { _language = "Unknown"; }
+
+ virtual int interpretCmd(const string& cmd) = 0;
+
+ virtual int interpretFile(const string& filename) = 0;
+
+ virtual string getLanguage() const { return _language; }
+
+ virtual void reset() = 0;
+
+ protected:
+
+ string _language;
+};
+
+#endif // INTERPRETER_H
diff --git a/source/blender/freestyle/intern/system/Precision.h b/source/blender/freestyle/intern/system/Precision.h
new file mode 100755
index 00000000000..24327a280df
--- /dev/null
+++ b/source/blender/freestyle/intern/system/Precision.h
@@ -0,0 +1,39 @@
+//
+// Filename : Precision.h
+// Author(s) : Stephane Grabli
+// Purpose : Define the float precision used in the program
+// Date of creation : 30/07/2002
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PRECISION_H
+# define PRECISION_H
+
+typedef double real;
+
+# ifndef SWIG
+static const real M_EPSILON = 0.00000001;
+# endif // SWIG
+
+#endif // PRECISION_H
diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h
new file mode 100755
index 00000000000..5b61f936c90
--- /dev/null
+++ b/source/blender/freestyle/intern/system/ProgressBar.h
@@ -0,0 +1,85 @@
+//
+// Filename : ProgressBar.h
+// Author(s) : Stephane Grabli
+// Purpose : Class to encapsulate a progress bar
+// Date of creation : 27/08/2002
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PROGRESSBAR_H
+# define PROGRESSBAR_H
+
+# include <string>
+
+using namespace std;
+
+class ProgressBar
+{
+public:
+
+ inline ProgressBar() {
+ _numtotalsteps = 0;
+ _progress = 0;
+ }
+
+ virtual ~ProgressBar() {}
+
+ virtual void reset() {
+ _numtotalsteps = 0;
+ _progress = 0;
+ }
+
+ virtual void setTotalSteps(unsigned n) {
+ _numtotalsteps = n;
+ }
+
+ virtual void setProgress(unsigned i) {
+ _progress = i;
+ }
+
+ virtual void setLabelText(const string& s) {
+ _label = s;
+ }
+
+ /*! accessors */
+ inline unsigned int getTotalSteps() const {
+ return _numtotalsteps;
+ }
+
+ inline unsigned int getProgress() const {
+ return _progress;
+ }
+
+ inline string getLabelText() const {
+ return _label;
+ }
+
+protected:
+
+ unsigned _numtotalsteps;
+ unsigned _progress;
+ string _label;
+};
+
+#endif // PROGRESSBAR_H
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp
new file mode 100755
index 00000000000..59332229ae2
--- /dev/null
+++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp
@@ -0,0 +1,108 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <math.h>
+#include "RandGen.h"
+#include "PseudoNoise.h"
+
+static const unsigned NB_VALUE_NOISE = 512;
+
+real *PseudoNoise::_values;
+
+PseudoNoise::PseudoNoise ()
+{
+}
+
+void
+PseudoNoise::init (long seed)
+{
+ _values = new real[NB_VALUE_NOISE];
+ RandGen::srand48(seed);
+ for (int i=0; i<NB_VALUE_NOISE; i++)
+ _values[i] = -1.0 + 2.0 * RandGen::drand48();
+}
+
+real
+PseudoNoise::linearNoise (real x)
+{
+ int i = x*NB_VALUE_NOISE;
+ real x1=_values[i%NB_VALUE_NOISE], x2=_values[(i+1)%NB_VALUE_NOISE];
+ real t=x*real(NB_VALUE_NOISE)-real(i);
+ return x1*(1-t)+x2*t;
+}
+
+real
+LanczosWindowed(real t)
+{
+ if (fabs(t)>2) return 0;
+ if (fabs(t)<M_EPSILON) return 1.0;
+ return sin(M_PI*t)/(M_PI*t) * sin(M_PI*t/2.0)/(M_PI*t/2.0);
+}
+
+real
+PseudoNoise::smoothNoise (real x)
+{
+ int i = x*NB_VALUE_NOISE;
+ real t=x*real(NB_VALUE_NOISE)-real(i);
+ if (i - 1 < 0)
+ {
+ int plus=-i/NB_VALUE_NOISE;
+ i=i+NB_VALUE_NOISE*(plus+2);
+ t=(x+plus+2)*real(NB_VALUE_NOISE)-real(i);
+ }
+
+ real x1=_values[i%NB_VALUE_NOISE], x2=_values[(i+1)%NB_VALUE_NOISE];
+ real x0=_values[(i-1)%NB_VALUE_NOISE], x3=_values[(i+2)%NB_VALUE_NOISE];
+
+ real y0=LanczosWindowed(-1-t);
+ real y1=LanczosWindowed(-t);
+ real y2=LanczosWindowed(1-t);
+ real y3=LanczosWindowed(2-t);
+ // cerr<<"x0="<<x0<<" x1="<<x1<<" x2="<<x2<<" x3="<<x3<<endl;
+ // cerr<<"y0="<<y0<<" y1="<<y1<<" y2="<<y2<<" y3="<<y3<<" :";
+ return (x0*y0+x1*y1+x2*y2+x3*y3)/(y0+y1+y2+y3);
+}
+
+real
+PseudoNoise::turbulenceSmooth (real x, unsigned nbOctave)
+{
+ real y=0;
+ real k=1.0;
+ for (unsigned i=0; i<nbOctave; i++)
+ {
+ y=y+k*smoothNoise(x*k);
+ k=k/2.0;
+ }
+ return y;
+}
+
+real
+PseudoNoise::turbulenceLinear (real x, unsigned nbOctave)
+{
+ real y=0;
+ real k=1.0;
+ for (unsigned i=0; i<nbOctave; i++)
+ {
+ y=y+k*linearNoise(x*k);
+ k=k/2.0;
+ }
+ return y;
+}
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h
new file mode 100755
index 00000000000..43143865600
--- /dev/null
+++ b/source/blender/freestyle/intern/system/PseudoNoise.h
@@ -0,0 +1,58 @@
+//
+// Filename : PseudoNoise.h
+// Author(s) : Fredo Durand
+// Purpose : Class to define a pseudo Perlin noise
+// Date of creation : 16/06/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PSEUDONOISE_H
+# define PSEUDONOISE_H
+
+# include "FreestyleConfig.h"
+# include "Precision.h"
+
+class LIB_SYSTEM_EXPORT PseudoNoise
+{
+public:
+
+ PseudoNoise ();
+
+ virtual ~PseudoNoise () {}
+
+ real smoothNoise (real x);
+ real linearNoise (real x);
+
+ real turbulenceSmooth (real x, unsigned nbOctave = 8);
+ real turbulenceLinear (real x, unsigned nbOctave = 8);
+
+ static void init (long seed);
+
+protected:
+
+ static real *_values;
+};
+
+#endif // PSEUDONOISE_H
+
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.cpp b/source/blender/freestyle/intern/system/PythonInterpreter.cpp
new file mode 100755
index 00000000000..821bd32b40b
--- /dev/null
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.cpp
@@ -0,0 +1,25 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "PythonInterpreter.h"
+
+string PythonInterpreter::_path = "";
+bool PythonInterpreter::_initialized = false;
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
new file mode 100755
index 00000000000..f9a573ffb86
--- /dev/null
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -0,0 +1,111 @@
+//
+// Filename : PythonInterpreter.h
+// Author(s) : Emmanuel Turquin
+// Purpose : Python Interpreter
+// Date of creation : 17/04/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PYTHON_INTERPRETER_H
+# define PYTHON_INTERPRETER_H
+
+# include <iostream>
+# include <Python.h>
+# include "StringUtils.h"
+# include "Interpreter.h"
+
+class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter
+{
+ public:
+
+ PythonInterpreter() {
+ _language = "Python";
+ Py_Initialize();
+ }
+
+ virtual ~PythonInterpreter() {
+ Py_Finalize();
+ }
+
+ int interpretCmd(const string& cmd) {
+ initPath();
+ char* c_cmd = strdup(cmd.c_str());
+ int err = PyRun_SimpleString(c_cmd);
+ free(c_cmd);
+ return err;
+ }
+
+ int interpretFile(const string& filename) {
+ initPath();
+ string cmd("execfile(\"" + filename + "\")");
+ char* c_cmd = strdup(cmd.c_str());
+ int err = PyRun_SimpleString(c_cmd);
+ free(c_cmd);
+ return err;
+ }
+
+ struct Options
+ {
+ static void setPythonPath(const string& path) {
+ _path = path;
+ }
+
+ static string getPythonPath() {
+ return _path;
+ }
+ };
+
+ void reset() {
+ Py_Finalize();
+ Py_Initialize();
+ _initialized = false;
+ }
+
+private:
+
+ static void initPath() {
+ if (_initialized)
+ return;
+ PyRun_SimpleString("import sys");
+ vector<string> pathnames;
+ StringUtils::getPathName(_path, "", pathnames);
+ string cmd;
+ char* c_cmd;
+ for (vector<string>::const_iterator it = pathnames.begin();
+ it != pathnames.end();
+ ++it) {
+ cmd = "sys.path.append(\"" + *it + "\")";
+ c_cmd = strdup(cmd.c_str());
+ PyRun_SimpleString(c_cmd);
+ free(c_cmd);
+ }
+ // PyRun_SimpleString("from Freestyle import *");
+ _initialized = true;
+ }
+
+ static bool _initialized;
+ static string _path;
+};
+
+#endif // PYTHON_INTERPRETER_H
diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp
new file mode 100755
index 00000000000..a328cb7f583
--- /dev/null
+++ b/source/blender/freestyle/intern/system/RandGen.cpp
@@ -0,0 +1,86 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "RandGen.h"
+
+//
+// Macro definitions
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#define N 16
+#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1)
+#define X0 0x330E
+#define X1 0xABCD
+#define X2 0x1234
+#define A0 0xE66D
+#define A1 0xDEEC
+#define A2 0x5
+#define C 0xB
+#define HI_BIT (1L << (2 * N - 1))
+
+#define LOW(x) ((unsigned)(x) & MASK)
+#define HIGH(x) LOW((x) >> N)
+#define MUL(x, y, z) { long l = (long)(x) * (long)(y); \
+ (z)[0] = LOW(l); (z)[1] = HIGH(l); }
+#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK)
+#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y)))
+#define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2))
+#define SETLOW(x, y, n) SET3(x, LOW((y)[n]), LOW((y)[(n)+1]), LOW((y)[(n)+2]))
+#define SEED(x0, x1, x2) (SET3(x, x0, x1, x2), SET3(a, A0, A1, A2), c = C)
+#define REST(v) for (i = 0; i < 3; i++) { xsubi[i] = x[i]; x[i] = temp[i]; } \
+ return (v);
+#define NEST(TYPE, f, F) TYPE f(register unsigned short *xsubi) { \
+ register int i; register TYPE v; unsigned temp[3]; \
+ for (i = 0; i < 3; i++) { temp[i] = x[i]; x[i] = LOW(xsubi[i]); } \
+ v = F(); REST(v); }
+
+static unsigned x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C;
+
+//
+// Methods implementation
+//
+///////////////////////////////////////////////////////////////////////////////
+
+real RandGen::drand48() {
+ static real two16m = 1.0 / (1L << N);
+ next();
+ return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2]));
+}
+
+void RandGen::srand48(long seedval) {
+ SEED(X0, LOW(seedval), HIGH(seedval));
+}
+
+void RandGen::next() {
+ unsigned p[2], q[2], r[2], carry0, carry1;
+
+ MUL(a[0], x[0], p);
+ ADDEQU(p[0], c, carry0);
+ ADDEQU(p[1], carry0, carry1);
+ MUL(a[0], x[1], q);
+ ADDEQU(p[1], q[0], carry0);
+ MUL(a[1], x[0], r);
+ x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] +
+ a[0] * x[2] + a[1] * x[1] + a[2] * x[0]);
+ x[1] = LOW(p[1] + r[0]);
+ x[0] = LOW(p[0]);
+}
diff --git a/source/blender/freestyle/intern/system/RandGen.h b/source/blender/freestyle/intern/system/RandGen.h
new file mode 100755
index 00000000000..409d3b79609
--- /dev/null
+++ b/source/blender/freestyle/intern/system/RandGen.h
@@ -0,0 +1,48 @@
+//
+// Filename : RandGen.h
+// Author(s) : Fredo Durand
+// Purpose : Pseudo-random number generator
+// Date of creation : 20/05/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef RAND_GEN_H
+# define RAND_GEN_H
+
+# include "FreestyleConfig.h"
+# include "../system/Precision.h"
+
+class LIB_SYSTEM_EXPORT RandGen
+{
+public:
+
+ static real drand48();
+ static void srand48(long value);
+
+private:
+
+ static void next();
+};
+
+#endif // RAND_GEN_H
diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp
new file mode 100755
index 00000000000..2af76feeb37
--- /dev/null
+++ b/source/blender/freestyle/intern/system/StringUtils.cpp
@@ -0,0 +1,46 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <qfileinfo.h>
+#include "FreestyleConfig.h"
+#include "StringUtils.h"
+
+namespace StringUtils {
+
+ void getPathName(const string& path, const string& base, vector<string>& pathnames) {
+ string dir;
+ unsigned size = path.size();
+ pathnames.push_back(base);
+ for (unsigned pos = 0, sep = path.find(Config::PATH_SEP, pos);
+ pos < size;
+ pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) {
+ if (sep == (unsigned)string::npos)
+ sep = size;
+ dir = path.substr(pos, sep - pos);
+ QFileInfo fi(dir.c_str());
+ string res = (const char*)fi.absoluteFilePath().toAscii();
+ if (!base.empty())
+ res += Config::DIR_SEP + base;
+ pathnames.push_back(res);
+ }
+ }
+
+} // end of namespace StringUtils
diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h
new file mode 100755
index 00000000000..44adfc2b044
--- /dev/null
+++ b/source/blender/freestyle/intern/system/StringUtils.h
@@ -0,0 +1,51 @@
+//
+// Filename : StringUtils.h
+// Author(s) : Emmanuel Turquin
+// Purpose : String utilities
+// Date of creation : 20/05/2003
+//
+///////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef STRING_UTILS_H
+# define STRING_UTILS_H
+
+# include <vector>
+# include <string>
+# include "FreestyleConfig.h"
+
+using namespace std;
+
+namespace StringUtils {
+
+ LIB_SYSTEM_EXPORT
+ void getPathName(const string& path, const string& base, vector<string>& pathnames);
+
+ // STL related
+ struct ltstr{
+ bool operator()(const char* s1, const char* s2) const{
+ return strcmp(s1, s2) < 0;
+ }
+};
+
+} // end of namespace StringUtils
+
+#endif // STRING_UTILS_H
diff --git a/source/blender/freestyle/intern/system/TimeStamp.cpp b/source/blender/freestyle/intern/system/TimeStamp.cpp
new file mode 100755
index 00000000000..c66e1131611
--- /dev/null
+++ b/source/blender/freestyle/intern/system/TimeStamp.cpp
@@ -0,0 +1,25 @@
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TimeStamp.h"
+
+LIB_SYSTEM_EXPORT
+TimeStamp* TimeStamp::_instance = 0;
diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h
new file mode 100755
index 00000000000..568a7851e30
--- /dev/null
+++ b/source/blender/freestyle/intern/system/TimeStamp.h
@@ -0,0 +1,71 @@
+//
+// Filename : TimeStamp.h
+// Author(s) : Stephane Grabli
+// Purpose : Class defining a singleton used as timestamp
+// Date of creation : 12/12/2002
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef TIMESTAMP_H
+# define TIMESTAMP_H
+
+# include "FreestyleConfig.h"
+
+class LIB_SYSTEM_EXPORT TimeStamp
+{
+ public:
+
+ static inline TimeStamp* instance() {
+ if (_instance == 0)
+ _instance = new TimeStamp;
+ return _instance;
+ }
+
+ inline unsigned getTimeStamp() const {
+ return _time_stamp;
+ }
+
+ inline void increment() {
+ ++_time_stamp;
+ }
+
+ inline void reset() {
+ _time_stamp = 1;
+ }
+
+ protected:
+
+ TimeStamp() {
+ _time_stamp = 1;
+ }
+
+ TimeStamp(const TimeStamp&) {}
+
+ private:
+
+ static TimeStamp* _instance;
+ unsigned _time_stamp;
+};
+
+#endif // TIMESTAMP_H
diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h
new file mode 100755
index 00000000000..99dd5b0a669
--- /dev/null
+++ b/source/blender/freestyle/intern/system/TimeUtils.h
@@ -0,0 +1,58 @@
+//
+// Filename : TimeUtils.h
+// Author(s) : Stephane Grabli
+// Purpose : Class to measure ellapsed time
+// Date of creation : 10/04/2002
+//
+///////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Copyright (C) : Please refer to the COPYRIGHT file distributed
+// with this source distribution.
+//
+// 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef TIMEUTILS_H
+# define TIMEUTILS_H
+
+#include <time.h>
+#include "FreestyleConfig.h"
+
+class Chronometer
+{
+ public:
+
+ inline Chronometer() {}
+ inline ~Chronometer() {}
+
+ inline clock_t start() {
+ _start = clock();
+ return _start;
+ }
+
+ inline double stop() {
+ clock_t stop = clock();
+ return (double)(stop - _start) / CLOCKS_PER_SEC ;
+ }
+
+ private:
+
+ clock_t _start;
+};
+
+#endif // TIMEUTILS_H
diff --git a/source/blender/freestyle/intern/system/src.pri b/source/blender/freestyle/intern/system/src.pri
new file mode 100755
index 00000000000..e7d69e142b4
--- /dev/null
+++ b/source/blender/freestyle/intern/system/src.pri
@@ -0,0 +1,30 @@
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# W A R N I N G ! ! ! #
+# a u t h o r i z e d p e r s o n a l o n l y #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+SYSTEM_DIR = ../system
+
+SOURCES *= $${SYSTEM_DIR}/Exception.cpp \
+ $${SYSTEM_DIR}/PythonInterpreter.cpp \
+ $${SYSTEM_DIR}/RandGen.cpp \
+ $${SYSTEM_DIR}/StringUtils.cpp \
+ $${SYSTEM_DIR}/TimeStamp.cpp \
+ $${SYSTEM_DIR}/PseudoNoise.cpp \
+ $${SYSTEM_DIR}/BaseObject.cpp
+
+HEADERS *= $${SYSTEM_DIR}/BaseObject.h \
+ $${SYSTEM_DIR}/BaseIterator.h \
+ $${SYSTEM_DIR}/Cast.h \
+ $${SYSTEM_DIR}/FreestyleConfig.h \
+ $${SYSTEM_DIR}/Exception.h \
+ $${SYSTEM_DIR}/Id.h \
+ $${SYSTEM_DIR}/Interpreter.h \
+ $${SYSTEM_DIR}/ProgressBar.h \
+ $${SYSTEM_DIR}/PythonInterpreter.h \
+ $${SYSTEM_DIR}/RandGen.h \
+ $${SYSTEM_DIR}/StringUtils.h \
+ $${SYSTEM_DIR}/TimeStamp.h \
+ $${SYSTEM_DIR}/TimeUtils.h \
+ $${SYSTEM_DIR}/PseudoNoise.h \
+ $${SYSTEM_DIR}/Precision.h
diff --git a/source/blender/freestyle/intern/system/system.pro b/source/blender/freestyle/intern/system/system.pro
new file mode 100755
index 00000000000..495cdf47105
--- /dev/null
+++ b/source/blender/freestyle/intern/system/system.pro
@@ -0,0 +1,73 @@
+# This file should be viewed as a -*- mode: Makefile -*-
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# W A R N I N G ! ! ! #
+# a u t h o r i z e d p e r s o n a l o n l y #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+include(../Config.pri)
+
+FOO_LIB_VERSION = $${APPVERSION_MAJ}$${APPVERSION_MID}
+TEMPLATE = lib
+TARGET = $${LIB_SYSTEM}
+VERSION = $${APPVERSION}
+TARGET_VERSION_EXT = $${APPVERSION_MAJ}.$${APPVERSION_MID}
+
+#
+# CONFIG
+#
+#######################################
+
+CONFIG *= dll python$${PYTHON_VERSION_MAJ}.$${PYTHON_VERSION_MIN}
+QT += xml
+
+exists (../libconfig.pri) {
+ include (../libconfig.pri)
+}
+#
+# INCLUDE PATH
+#
+#######################################
+
+
+#
+# DEFINES
+#
+#######################################
+
+win32:DEFINES *= MAKE_LIB_SYSTEM_DLL
+
+#
+# BUILD DIRECTORIES
+#
+#######################################
+
+BUILD_DIR = ../../build/
+
+OBJECTS_DIR = $${BUILD_DIR}/$${REL_OBJECTS_DIR}
+!win32:DESTDIR = $${BUILD_DIR}/$${REL_DESTDIR}/lib
+win32:DESTDIR = $${BUILD_DIR}/$${REL_DESTDIR}
+
+#win32:QMAKE_POST_LINK = "$$QMAKE_MOVE $${DESTDIR}/$${TARGET}$${LIBVERSION}.lib $${DESTDIR}\$${TARGET}$${FOO_LIB_VERSION}.lib"
+
+#
+# INSTALL
+#
+#######################################
+
+LIB_DIR = ../../lib
+# install library
+target.path = $$LIB_DIR
+# "make install" configuration options
+INSTALLS += target
+
+
+#
+# SOURCES & HEADERS
+#
+#######################################
+
+!static {
+ include(src.pri)
+}
+