[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15540] branches/soc-2008-mxcurioni: soc-2008-mxcurioni: first part of the Freestyle Python implementation.

Maxime Curioni maxime.curioni at gmail.com
Sat Jul 12 06:02:15 CEST 2008


Revision: 15540
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15540
Author:   mxcurioni
Date:     2008-07-12 06:02:08 +0200 (Sat, 12 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: first part of the Freestyle Python implementation. A new Freestyle module is added. The following modules are implemented: BinaryPredicate0D, BinaryPredicate1D, Id, Interface0D, Interface1D. I added a Convert module to help in the creation of Python objects for Freestyle's data structures. I also added a missing file for guarded_alloc needed for compilation on Windows.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D/FalseBP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D/Length2DBP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D/SameShapeIdBP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D/TrueBP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D/ViewMapGradientNormBP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/CurvePointIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Id.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/StrokeVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/SVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex/NonTVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex/TVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0DIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/Curve.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/FEdgeSharp.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/FEdgeSmooth.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/Stroke.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/ViewEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Material.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Noise.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Operators.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/SShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeAttribute.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/BackboneStretcherShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/BezierCurveShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/CalligraphicShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ColorNoiseShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ColorVariationPatternShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ConstantColorShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ConstantThicknessShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ConstrainedIncreasingThicknessShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/GuidingLinesShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/IncreasingColorShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/IncreasingThicknessShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/PolygonalizationShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/SamplingShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/SpatialNoiseShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/StrokeTextureShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/TextureAssignerShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ThicknessNoiseShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/ThicknessVariationPatternShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/TipRemoverShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/fstreamShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/streamShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeVertexIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DDouble.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DFloat.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DId.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DUnsigned.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DVec2f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DVec3f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DVectorViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0DViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/ShapeIdF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/MaterialF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/CurveNatureF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/Normal2DF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/VertexOrientation2DF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/VertexOrientation3DF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/GetOccludeeF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/GetShapeF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/GetCurvilinearAbscissaF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/GetParameterF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/GetViewMapGradientNormF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/ReadCompleteViewMapPixelF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/ReadMapPixelF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/ReadSteerableViewMapPixelF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/Curvature2DAngleF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetProjectedXF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetProjectedYF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetProjectedZF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetXF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetYF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/GetZF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_real/ZDiscontinuityF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/QuantitativeInvisibilityF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/GetOccludersF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0DVoid.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DDouble.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DFloat.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DUnsigned.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DVec2f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DVec3f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1DVectorViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/CurveNatureF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/Normal2DF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/Orientation2DF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/Orientation3DF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/DensityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/GetCompleteViewMapDensityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/GetDirectionalViewMapDensityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/LocalAverageDepthF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/Curvature2DAngleF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetProjectedXF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetProjectedYF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetProjectedZF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetSteerableViewMapDensityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetViewMapGradientNormF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetXF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetYF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/GetZF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_real/ZDiscontinuityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned/QuantitativeInvisibilityF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/GetOccludeeF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/GetOccludersF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/GetShapeF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/ChainingTimeStampF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/IncrementChainingTimeStampF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/TimeStampF1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1DVoid.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate0D/FalseUP0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate0D/TrueUP0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/ContourUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/DensityLowerThanUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/EqualToChainingTimeStampUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/EqualToTimeStampUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/ExternalContourUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/FalseUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/QuantitativeInvisibilityUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/ShapeUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D/TrueUP1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryPredicate1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/ChainPredicateIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/ChainSilhouetteIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/ViewMap.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/ViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/python/SConscript
    branches/soc-2008-mxcurioni/source/blender/python/api2_2x/Blender.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/pipeline.c

Added Paths:
-----------
    branches/soc-2008-mxcurioni/intern/guardedalloc/intern/mmap_win.c
    branches/soc-2008-mxcurioni/intern/guardedalloc/mmap_win.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate0D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BinaryPredicate1D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Convert.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Convert.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Freestyle.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Freestyle.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Id.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/DensityF0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/LocalAverageDepthF0D.cpp

Added: branches/soc-2008-mxcurioni/intern/guardedalloc/intern/mmap_win.c
===================================================================
--- branches/soc-2008-mxcurioni/intern/guardedalloc/intern/mmap_win.c	                        (rev 0)
+++ branches/soc-2008-mxcurioni/intern/guardedalloc/intern/mmap_win.c	2008-07-12 04:02:08 UTC (rev 15540)
@@ -0,0 +1,260 @@
+/**
+ * $Id: $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Andrea Weikert.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+ 
+#if defined(WIN32)
+
+#include <windows.h>
+#include <errno.h>
+#include <io.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+#include "mmap_win.h"
+
+#ifndef FILE_MAP_EXECUTE
+//not defined in earlier versions of the Platform  SDK (before February 2003)
+#define FILE_MAP_EXECUTE 0x0020
+#endif
+
+/* --------------------------------------------------------------------- */
+/* local storage definitions                                                    */
+/* --------------------------------------------------------------------- */
+/* all memory mapped chunks are put in linked lists */
+typedef struct mmapLink
+{
+	struct mmapLink *next,*prev;
+} mmapLink;
+
+typedef struct mmapListBase 
+{
+	void *first, *last;
+} mmapListBase;
+
+typedef struct MemMap {
+	struct MemMap *next,*prev;
+	void *mmap;
+	HANDLE fhandle;
+	HANDLE maphandle;
+} MemMap;
+
+/* --------------------------------------------------------------------- */
+/* local functions                                                       */
+/* --------------------------------------------------------------------- */
+
+static void mmap_addtail(volatile mmapListBase *listbase, void *vlink);
+static void mmap_remlink(volatile mmapListBase *listbase, void *vlink);
+static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr);
+
+static int mmap_get_prot_flags (int flags);
+static int mmap_get_access_flags (int flags);
+
+/* --------------------------------------------------------------------- */
+/* vars                                                                  */
+/* --------------------------------------------------------------------- */
+volatile static struct mmapListBase _mmapbase;
+volatile static struct mmapListBase *mmapbase = &_mmapbase;
+
+
+/* --------------------------------------------------------------------- */
+/* implementation                                                        */
+/* --------------------------------------------------------------------- */
+
+/* mmap for windows */
+void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
+{
+	HANDLE fhandle = INVALID_HANDLE_VALUE;
+	HANDLE maphandle;
+	int prot_flags = mmap_get_prot_flags(prot);
+	int access_flags = mmap_get_access_flags(prot);
+	MemMap *mm = NULL;
+	void *ptr = NULL;
+
+	if ( flags & MAP_FIXED ) {
+		return MAP_FAILED;
+	}
+
+	/*
+	if ( fd == -1 ) {
+		_set_errno( EBADF );
+        return MAP_FAILED;
+	}
+	*/
+
+	if ( fd != -1 ) {
+		fhandle = (HANDLE) _get_osfhandle (fd);
+	}
+	if ( fhandle == INVALID_HANDLE_VALUE ) {
+		if (!(flags & MAP_ANONYMOUS)) {
+			errno = EBADF;
+			return MAP_FAILED;
+		}
+	} else {
+		if ( !DuplicateHandle( GetCurrentProcess(), fhandle, GetCurrentProcess(),
+							&fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS ) ) {
+			return MAP_FAILED;
+		}
+	}
+
+	maphandle = CreateFileMapping(fhandle, NULL, prot_flags, 0, len, NULL);
+	if ( maphandle == 0 ) {
+        errno = EBADF;
+		return MAP_FAILED;
+    }
+
+	ptr = MapViewOfFile(maphandle, access_flags, 0, offset, 0);
+	if ( ptr == NULL ) {
+		DWORD dwLastErr = GetLastError();
+		if ( dwLastErr == ERROR_MAPPED_ALIGNMENT )
+			errno=EINVAL;
+		else
+			errno=EACCES;
+		CloseHandle(maphandle);
+		return MAP_FAILED;
+	}
+
+	mm= (MemMap *)malloc(sizeof(MemMap));
+	if (!mm) {
+		errno=ENOMEM;
+	}
+	mm->fhandle = fhandle;
+	mm->maphandle = maphandle;
+	mm->mmap = ptr;
+	mmap_addtail(mmapbase, mm);
+
+    return ptr;
+}
+
+/* munmap for windows */
+long munmap(void *ptr, long size)
+{
+	MemMap *mm = mmap_findlink(mmapbase, ptr);
+	if (!mm) {
+		errno=EINVAL;
+        return -1; 
+	}
+	UnmapViewOfFile( mm->mmap );
+	CloseHandle( mm->maphandle );
+	CloseHandle( mm->fhandle);
+	mmap_remlink(mmapbase, mm);
+    return 0;
+}
+
+/* --------------------------------------------------------------------- */
+/* local functions                                                       */
+/* --------------------------------------------------------------------- */
+
+static void mmap_addtail(volatile mmapListBase *listbase, void *vlink)
+{
+	struct mmapLink *link= vlink;
+
+	if (link == 0) return;
+	if (listbase == 0) return;
+
+	link->next = 0;
+	link->prev = listbase->last;
+
+	if (listbase->last) ((struct mmapLink *)listbase->last)->next = link;
+	if (listbase->first == 0) listbase->first = link;
+	listbase->last = link;
+}
+
+static void mmap_remlink(volatile mmapListBase *listbase, void *vlink)
+{
+	struct mmapLink *link= vlink;
+
+	if (link == 0) return;
+	if (listbase == 0) return;
+
+	if (link->next) link->next->prev = link->prev;
+	if (link->prev) link->prev->next = link->next;
+
+	if (listbase->last == link) listbase->last = link->prev;
+	if (listbase->first == link) listbase->first = link->next;
+}
+
+static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr)
+{
+	MemMap *mm;
+
+	if (ptr == 0) return NULL;
+	if (listbase == 0) return NULL;
+	
+	mm = (MemMap *)listbase->first;
+	while (mm) {
+		if (mm->mmap == ptr) {
+			return mm;
+		}
+		mm = mm->next;
+	}
+	return NULL;
+}
+
+static int mmap_get_prot_flags (int flags)
+{
+	int prot = PAGE_NOACCESS;
+
+	if ( ( flags & PROT_READ ) == PROT_READ ) {
+        if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+            prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
+		} else {
+			prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_READONLY;
+		}
+    } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+		prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_WRITECOPY;
+    } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
+        prot = PAGE_EXECUTE_READ;
+    }
+	return prot;
+}
+
+static int mmap_get_access_flags (int flags)
+{
+	int access = 0;
+
+	if ( ( flags & PROT_READ ) == PROT_READ ) {
+        if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+            access = FILE_MAP_WRITE;
+		} else {
+			access = (flags & PROT_EXEC) ? FILE_MAP_EXECUTE : FILE_MAP_READ;
+		}
+    } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+		access = FILE_MAP_COPY;
+    } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
+        access = FILE_MAP_EXECUTE;
+    }
+	return access;
+}
+
+
+#endif // WIN32
+
+
+
+
+

Added: branches/soc-2008-mxcurioni/intern/guardedalloc/mmap_win.h
===================================================================
--- branches/soc-2008-mxcurioni/intern/guardedalloc/mmap_win.h	                        (rev 0)
+++ branches/soc-2008-mxcurioni/intern/guardedalloc/mmap_win.h	2008-07-12 04:02:08 UTC (rev 15540)
@@ -0,0 +1,51 @@
+/**
+ * $Id: $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Andrea Weikert.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+ 
+#ifndef MMAP_WIN_H
+#define MMAP_WIN_H
+
+#define PROT_NONE 0
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define PROT_EXEC 4
+
+#define MAP_FILE 0
+#define MAP_SHARED 1
+#define MAP_PRIVATE 2
+#define MAP_TYPE 0xF
+#define MAP_FIXED 0x10
+#define MAP_ANONYMOUS 0x20
+#define MAP_ANON MAP_ANONYMOUS
+
+#define MAP_FAILED ((void *)-1)
+
+void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset);
+long munmap(void *ptr, long size);
+
+#endif
\ No newline at end of file

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-07-12 03:30:49 UTC (rev 15539)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-07-12 04:02:08 UTC (rev 15540)
@@ -56,10 +56,22 @@
 prefix = 'intern/app_blender'
 app_sources = env.Glob(prefix + '/*.cpp')
 
+#	Python
+prefix = 'intern/python'
+# python_sources = env.Glob(prefix + '/*.cpp')
+python_sources = [
+					prefix + '/Freestyle.cpp',
+					prefix + '/Convert.cpp',
+					prefix + '/BinaryPredicate0D.cpp',
+					prefix + '/BinaryPredicate1D.cpp',
+					prefix + '/Id.cpp',
+					prefix + '/Interface0D.cpp',
+					prefix + '/Interface1D.cpp'
+				]
 
 sources = 	system_sources + image_sources + geometry_sources + scene_graph_sources \
 		  +	winged_edge_sources + view_map_sources + stroke_sources + rendering_sources \
-		  + app_sources
+		  + app_sources + python_sources
 
 env.BlenderLib (libname="bf_freestyle",
 				sources=sources,

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list