$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r69847 - in trunk/libs/geometry/doc: reference/algorithms src/docutils/tools/implementation_status src/docutils/tools/implementation_status/tmp
From: barend.gehrels_at_[hidden]
Date: 2011-03-11 09:36:52
Author: barendgehrels
Date: 2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
New Revision: 69847
URL: http://svn.boost.org/trac/boost/changeset/69847
Log:
Added tool "implementation_status"
Added:
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.cpp   (contents, props changed)
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.hpp   (contents, props changed)
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.sln   (contents, props changed)
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.vcproj   (contents, props changed)
   trunk/libs/geometry/doc/src/docutils/tools/implementation_status/tmp/
Text files modified: 
   trunk/libs/geometry/doc/reference/algorithms/area.qbk |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
Modified: trunk/libs/geometry/doc/reference/algorithms/area.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/algorithms/area.qbk	(original)
+++ trunk/libs/geometry/doc/reference/algorithms/area.qbk	2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
@@ -24,3 +24,4 @@
 [heading Complexity]
 Linear
 
+
Added: trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.cpp	2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,336 @@
+// implementation_status (developed in the context of Boost.Geometry documentation)
+//
+// Copyright Barend Gehrels 2010, 2011, Geodan, Amsterdam, the Netherlands
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+#include <vector>
+
+#include <direct.h>
+#include <stdlib.h>
+
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/algorithm/string/trim.hpp>
+
+static const int point = 0;
+static const int segment = 1;
+static const int box = 2;
+static const int linestring = 3;
+static const int ring = 4;
+static const int polygon = 5;
+static const int multi_point = 6;
+static const int multi_linestring = 7;
+static const int multi_polygon = 8;
+static const int geometry_count = 9;
+
+
+struct algorithm
+{
+    std::string name;
+    int arity;
+
+    explicit algorithm(std::string const& n, int a = 1)
+        : name(n)
+        , arity(a)
+    {}
+};
+
+
+inline std::string bool_string(bool v)
+{
+    return v ? "true" : "false";
+}
+
+inline std::string typedef_string(int type, bool clockwise, bool open)
+{
+    std::ostringstream out;
+    switch(type)
+    {
+        case point : return "P";
+        case linestring : return "bg::model::linestring<P>";
+        case box : return "bg::model::box<P>";
+        case segment : return "bg::model::segment<P>";
+        case ring :
+            out << "bg::model::ring<P, "
+                << bool_string(clockwise) << ", " << bool_string(open) << ">";
+            break;
+        case polygon : 
+            out << "bg::model::polygon<P, "
+                << bool_string(clockwise) << ", " << bool_string(open) << ">";
+            break;
+        case multi_point : return "bg::model::multi_point<P>";
+        case multi_linestring : 
+            out << "bg::model::multi_linestring<bg::model::linestring<P> >";
+            break;
+        case multi_polygon : 
+            out << "bg::model::multi_polygon<bg::model::polygon<P, "
+                << bool_string(clockwise) << ", " << bool_string(open) << "> >";
+            break;
+    }
+    return out.str();
+}
+
+inline std::string wkt_string(int type)
+{
+    switch(type)
+    {
+        case point : return "POINT(1 1)";
+        case linestring : return "LINESTRING(1 1,2 2)";
+        case segment : return "LINESTRING(1 1,2 2)";
+        case box : return "POLYGON((1 1,2 2)";
+        case polygon : 
+        case ring :
+            return "POLYGON((0 0,0 1,1 1,0 0))";
+        case multi_point : return "MULTIPOINT((1 1),(2 2))";
+        case multi_linestring : return "MULTILINESTRING((1 1,2 2))";
+        case multi_polygon : return "MULTIPOLYGON(((0 0,0 1,1 1,0 0)))";
+    }
+    return "";
+}
+
+inline std::string geometry_string(int type)
+{
+    switch(type)
+    {
+        case point : return "Point";
+        case linestring : return "Linestring";
+        case box : return "Box";
+        case polygon : return "Polygon"; 
+        case ring : return "Ring";
+        case segment : return "Segment";
+        case multi_point : return "MultiPoint";
+        case multi_linestring : return "MultiLinestring";
+        case multi_polygon : return "MultiPolygon";
+    }
+    return "";
+}
+
+
+
+void report_library(std::ostream& report, int type, algorithm const& algo, 
+    bool clockwise, bool open, int dimensions, std::string const& cs,
+    int type2 = -1, int type3 = -1)
+{
+    std::string lit;
+    {
+        std::ostringstream out;
+        out << geometry_string(type);
+        if (type2 != -1)
+        {
+            out << "_" << geometry_string(type2);
+        }
+        out 
+            << "_" << algo.name
+            << "_" << bool_string(clockwise) 
+            << "_" << bool_string(open)
+            << "_" << boost::replace_all_copy
+                        (
+                            boost::replace_all_copy
+                                (
+                                    boost::replace_all_copy(cs, "bg::", "")
+                                , "<", "_"
+                                )
+                            , ">", "_"
+                        );
+        lit = out.str();
+    }
+
+    //report << lit << std::endl;
+    std::cout << lit;
+
+    {
+        std::ofstream out("tmp/t.cpp");
+
+        out
+            << "#include <implementation_status.hpp>" << std::endl
+            << "template <typename P>" << std::endl
+            << "inline void test()" << std::endl
+            << "{" << std::endl
+            << "  namespace bg = boost::geometry;" << std::endl
+            << "  " << typedef_string(type, clockwise, open) << " geometry;" << std::endl
+            << "  bg::read_wkt(\"" << wkt_string(type) << "\", geometry);" << std::endl;
+
+        
+        if (algo.arity > 1)
+        {
+            out 
+                << "  " << typedef_string(type2, clockwise, open) << " geometry2;" << std::endl
+                << "  bg::read_wkt(\"" << wkt_string(type2) << "\", geometry2);" << std::endl;
+        }
+
+        switch(algo.arity)
+        {
+            case 1 : 
+                out << "  bg::" << algo.name << "(geometry);" << std::endl; 
+                break;
+            case 2 : 
+                out << "  bg::" << algo.name << "(geometry, geometry2);" << std::endl; 
+                break;
+        }
+
+        out
+            << "}" << std::endl
+            << std::endl
+            ;
+
+        out
+            << "int main()" << std::endl
+            << "{" << std::endl
+            << "  namespace bg = boost::geometry;" << std::endl
+            << "  test<bg::model::point< double, " << dimensions << ", bg::cs::" << cs << " > >();" << std::endl
+            << "  return 0;" << std::endl
+            << "}" << std::endl
+            << std::endl
+            ;
+    }
+
+    std::string command = "cl /nologo -I. -I/_svn/boost/trunk /EHsc /Y";
+    static bool first = true;
+    if (first)
+    {
+        std::cout << " (creating PCH)";
+        command += "c";
+        first = false;
+    }
+    else
+    {
+        command += "u";
+    }
+
+    system((command + "implementation_status.hpp tmp/t.cpp > tmp/t.out").c_str());
+
+    {
+        std::ifstream result("tmp/t.out");
+		while (! result.eof() )
+		{
+			std::string line;
+			std::getline(result, line);
+            boost::trim(line);
+            if (boost::contains(line, "error")) 
+            {
+                //report << algo.name << std::endl;
+                report << " [$img/nyi.png] ";// << line << std::endl;
+                std::cout << " ERROR" << std::endl;
+                return;
+            }
+        }
+    }
+    report << " [$img/ok.png ] ";
+    std::cout << std::endl;
+
+}
+
+void report(std::ostream& out, int type, algorithm const& algo, 
+    bool clockwise, bool open, int dimensions, std::string const& cs)
+{
+    switch(algo.arity)
+    {
+        case 1 :
+            out << "[";
+            report_library(out, type, algo, clockwise, open, dimensions, cs);
+            out << "]";
+            break;
+        case 2 :
+            for (int type2 = point; type2 < geometry_count; type2++)
+            {
+                out << "[";
+                report_library(out, type, algo, clockwise, open, dimensions, cs, type2);
+                out << "]";
+            }
+            break;
+    }
+}
+
+
+struct cs
+{
+    std::string name;
+
+    cs(std::string const& n)
+        : name(n)
+    {}
+};
+
+
+int main(int argc, char** argv)
+{
+    typedef std::vector<algorithm> v_a_type;
+    v_a_type algorithms;
+    algorithms.push_back(algorithm("area"));
+    algorithms.push_back(algorithm("length"));
+    //algorithms.push_back(algorithm("perimeter"));
+    //algorithms.push_back(algorithm("correct"));
+    algorithms.push_back(algorithm("distance", 2));
+    //algorithms.push_back(algorithm("centroid", 2));
+
+    typedef std::vector<cs> cs_type;
+    cs_type css;
+    css.push_back(cs("cartesian"));
+    // css.push_back(cs("spherical<bg::degree>"));
+    // css.push_back(cs("spherical<bg::radian>"));
+
+    for (v_a_type::const_iterator it = algorithms.begin(); it != algorithms.end(); ++it)
+    {
+/*([heading Behavior]
+[table
+[[Case] [Behavior] ]
+[[__2dim__][All combinations of: box, ring, polygon, multi_polygon]]
+[[__other__][__nyiversion__]]
+[[__sph__][__nyiversion__]]
+[[Three dimensional][__nyiversion__]]
+]*/
+
+        std::ostringstream name;
+        name << "../../../../generated/" << it->name << "_status.qbk";
+
+        std::ofstream out(name.str().c_str());
+        out << "[heading Supported geometries]" << std::endl;
+        //for (cs_type::const_iterator cit = css.begin(); cit != css.end(); ++cit)
+
+        cs_type::const_iterator cit = css.begin();
+
+        {
+            int closed = 1;
+            int order = 1;
+
+            out << "[table" << std::endl;
+
+            // Table header
+            out << "[";
+            if (it->arity > 1)
+            {
+                out << "[ ]";
+                for (int type = point; type < geometry_count; type++)
+                {
+                    out << "[" << geometry_string(type) << "]";
+                }
+            }
+            else
+            {
+                out << "[Geometry][Status]";
+            }
+            out << "]" << std::endl;
+
+            // Table body
+            for (int type = point; type < geometry_count; type++)
+            {
+                out << "[";
+                out << "[" << geometry_string(type) << "]";
+                report(out, type, *it, order == 1, closed == 1, 2, cit->name);
+                out << "]" << std::endl; 
+            }
+            // End table
+            out << "]" << std::endl;  
+           
+        }
+   }
+
+    return 0;
+}
\ No newline at end of file
Added: trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.hpp	2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,12 @@
+// implementation_status (developed in the context of Boost.Geometry documentation)
+//
+// Copyright Barend Gehrels 2010, 2011, Geodan, Amsterdam, the Netherlands
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/multi/multi.hpp>
+#include <boost/geometry/multi/geometries/multi_point.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
Added: trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.sln
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.sln	2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "implementation_status", "implementation_status.vcproj", "{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}.Debug|Win32.Build.0 = Debug|Win32
+		{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}.Release|Win32.ActiveCfg = Release|Win32
+		{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Added: trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/docutils/tools/implementation_status/implementation_status.vcproj	2011-03-11 09:36:50 EST (Fri, 11 Mar 2011)
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="implementation_status"
+	ProjectGUID="{2A4F2616-8F8B-4BA0-A2F6-7E41135EC7B8}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../../../../../.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../../../.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\implementation_status.cpp"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>