summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/source
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/base/source')
-rw-r--r--graphics/pgf/base/source/BalloonLayout_script.h32
-rw-r--r--graphics/pgf/base/source/BarycenterHeuristic_script.h20
-rw-r--r--graphics/pgf/base/source/BarycenterPlacer_script.h32
-rw-r--r--graphics/pgf/base/source/CirclePlacer_script.h56
-rw-r--r--graphics/pgf/base/source/CircularLayout_script.h47
-rw-r--r--graphics/pgf/base/source/CoffmanGrahamRanking_script.h34
-rw-r--r--graphics/pgf/base/source/DfsAcyclicSubgraph_script.h20
-rw-r--r--graphics/pgf/base/source/EdgeCoverMerger_script.h32
-rw-r--r--graphics/pgf/base/source/ExampleLocalMakefileConfig.mk7
-rw-r--r--graphics/pgf/base/source/FMMMLayout_script.h44
-rw-r--r--graphics/pgf/base/source/FastHierarchyLayout_script.h48
-rw-r--r--graphics/pgf/base/source/FastMultipoleEmbedder_script.h51
-rw-r--r--graphics/pgf/base/source/FastSimpleHierarchyLayout_script.h41
-rw-r--r--graphics/pgf/base/source/GEMLayout_script.h101
-rw-r--r--graphics/pgf/base/source/GreedyCycleRemoval_script.h20
-rw-r--r--graphics/pgf/base/source/GreedyInsertHeuristic_script.h20
-rw-r--r--graphics/pgf/base/source/INSTALL28
-rw-r--r--graphics/pgf/base/source/IndependentSetMerger_script.h32
-rw-r--r--graphics/pgf/base/source/InterfaceFromC++.c++215
-rw-r--r--graphics/pgf/base/source/InterfaceFromC++.h190
-rw-r--r--graphics/pgf/base/source/InterfaceFromC.c1189
-rw-r--r--graphics/pgf/base/source/InterfaceFromC.h613
-rw-r--r--graphics/pgf/base/source/InterfaceFromOGDF.c++105
-rw-r--r--graphics/pgf/base/source/InterfaceFromOGDF.h45
-rw-r--r--graphics/pgf/base/source/LocalBiconnectedMerger_script.h32
-rw-r--r--graphics/pgf/base/source/LongestPathRanking_script.h50
-rw-r--r--graphics/pgf/base/source/MakefileConfig.mk45
-rw-r--r--graphics/pgf/base/source/MatchingMerger_script.h32
-rw-r--r--graphics/pgf/base/source/MedianHeuristic_script.h20
-rw-r--r--graphics/pgf/base/source/MedianPlacer_script.h26
-rw-r--r--graphics/pgf/base/source/MultilevelLayout_script.h33
-rw-r--r--graphics/pgf/base/source/OptimalRanking_script.h34
-rw-r--r--graphics/pgf/base/source/PlanarizationLayout_script.h43
-rw-r--r--graphics/pgf/base/source/RandomMerger_script.h32
-rw-r--r--graphics/pgf/base/source/RandomPlacer_script.h32
-rw-r--r--graphics/pgf/base/source/SiftingHeuristic_script.h40
-rw-r--r--graphics/pgf/base/source/SimpleDemoC.c42
-rw-r--r--graphics/pgf/base/source/SimpleDemoCPlusPlus.c++47
-rw-r--r--graphics/pgf/base/source/SimpleDemoOGDF.c++43
-rw-r--r--graphics/pgf/base/source/SolarMerger_script.h36
-rw-r--r--graphics/pgf/base/source/SolarPlacer_script.h26
-rw-r--r--graphics/pgf/base/source/SplitHeuristic_script.h20
-rw-r--r--graphics/pgf/base/source/SpringEmbedderFRExact_script.h66
-rw-r--r--graphics/pgf/base/source/SpringEmbedderFR_script.h45
-rw-r--r--graphics/pgf/base/source/SpringEmbedderKK_script.h39
-rw-r--r--graphics/pgf/base/source/SugiyamaLayout_script.h54
-rw-r--r--graphics/pgf/base/source/ZeroPlacer_script.h32
-rw-r--r--graphics/pgf/base/source/energybased_script.h31
-rw-r--r--graphics/pgf/base/source/layered_script.h46
-rw-r--r--graphics/pgf/base/source/misclayout_script.h13
-rw-r--r--graphics/pgf/base/source/module_script.h27
-rw-r--r--graphics/pgf/base/source/multilevelmixer_script.h33
-rw-r--r--graphics/pgf/base/source/ogdf_script.c++23
-rw-r--r--graphics/pgf/base/source/pgfmathtestsuite.tex1264
-rw-r--r--graphics/pgf/base/source/planarity_script.h11
-rw-r--r--graphics/pgf/base/source/tikzexternaltest.code.tex41
-rw-r--r--graphics/pgf/base/source/tikzexternaltest.sharedpreamble.tex20
-rw-r--r--graphics/pgf/base/source/tikzexternaltest.tex12
-rw-r--r--graphics/pgf/base/source/tikzexternaltestmakefile.tex12
-rw-r--r--graphics/pgf/base/source/unittest_luamathparser.tex562
60 files changed, 0 insertions, 5986 deletions
diff --git a/graphics/pgf/base/source/BalloonLayout_script.h b/graphics/pgf/base/source/BalloonLayout_script.h
deleted file mode 100644
index 311bee3e09..0000000000
--- a/graphics/pgf/base/source/BalloonLayout_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/misclayout/BalloonLayout.h>
-
-struct BalloonLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- BalloonLayout layout;
-
- parameters->configure_option ("BalloonLayout.evenAngles",
- &BalloonLayout::setEvenAngles, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("BalloonLayout")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.misclayout.BalloonLayout"));
-
- s.declare (key ("BalloonLayout.evenAngles")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.misclayout.BalloonLayout"));
- }
-};
-
diff --git a/graphics/pgf/base/source/BarycenterHeuristic_script.h b/graphics/pgf/base/source/BarycenterHeuristic_script.h
deleted file mode 100644
index 709e91d3de..0000000000
--- a/graphics/pgf/base/source/BarycenterHeuristic_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/BarycenterHeuristic.h>
-
-struct BarycenterHeuristic_script :
- scripting::declarations,
- scripting::factory<ogdf::BarycenterHeuristic>
-{
-
- ogdf::BarycenterHeuristic* make (scripting::run_parameters* parameters) {
- return new ogdf::BarycenterHeuristic;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("BarycenterHeuristic")
- .documentation_in ("pgf.gd.doc.ogdf.layered.BarycenterHeuristic")
- .set_module ("TwoLayerCrossMin", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/BarycenterPlacer_script.h b/graphics/pgf/base/source/BarycenterPlacer_script.h
deleted file mode 100644
index 19ac75d314..0000000000
--- a/graphics/pgf/base/source/BarycenterPlacer_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/BarycenterPlacer.h>
-
-struct BarycenterPlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::BarycenterPlacer>
-{
- ogdf::BarycenterPlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- BarycenterPlacer* r = new BarycenterPlacer;
-
- parameters->configure_option ("BarycenterPlacer.weightedPositionPriority",
- &BarycenterPlacer::weightedPositionPriority, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("BarycenterPlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.BarycenterPlacer"));
-
- s.declare (key ("BarycenterPlacer.weightedPositionPriority")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.BarycenterPlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/CirclePlacer_script.h b/graphics/pgf/base/source/CirclePlacer_script.h
deleted file mode 100644
index f208dbdecf..0000000000
--- a/graphics/pgf/base/source/CirclePlacer_script.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/CirclePlacer.h>
-
-struct CirclePlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::CirclePlacer>
-{
- ogdf::CirclePlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- CirclePlacer* r = new CirclePlacer;
-
- parameters->configure_option ("CirclePlacer.circleSize",
- &CirclePlacer::setCircleSize, *r);
- parameters->configure_option ("CirclePlacer.radiusFixed",
- &CirclePlacer::setRadiusFixed, *r);
-
-
- char* s = 0;
-
- if (parameters->option("CirclePlacer.nodeSelection", s)) {
- if (strcmp(s, "new") == 0)
- r->setNodeSelection(CirclePlacer::nsNew);
- else if (strcmp(s, "old") == 0)
- r->setNodeSelection(CirclePlacer::nsOld);
- else if (strcmp(s, "all") == 0)
- r->setNodeSelection(CirclePlacer::nsAll);
-
- free(s);
- }
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("CirclePlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.CirclePlacer"));
-
- s.declare (key ("CirclePlacer.circleSize")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.CirclePlacer"));
-
- s.declare (key ("CirclePlacer.radiusFixed")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.CirclePlacer"));
-
- s.declare (key ("CirclePlacer.nodeSelection")
- .type ("string")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.CirclePlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/CircularLayout_script.h b/graphics/pgf/base/source/CircularLayout_script.h
deleted file mode 100644
index d0840e64f6..0000000000
--- a/graphics/pgf/base/source/CircularLayout_script.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/misclayout/CircularLayout.h>
-
-struct CircularLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- CircularLayout layout;
-
- parameters->configure_option ("CircularLayout.minDistCircle",
- &CircularLayout::minDistCircle, layout);
- parameters->configure_option ("CircularLayout.minDistLevel",
- &CircularLayout::minDistLevel, layout);
- parameters->configure_option ("CircularLayout.minDistSibling",
- &CircularLayout::minDistSibling, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("CircularLayout")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.misclayout.CircularLayout"));
-
- s.declare (key ("CircularLayout.minDistCircle")
- .type ("length")
- .alias_function ("function (o) return o['part pre sep'] + o['part post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.layered.CircularLayout"));
-
- s.declare (key ("CircularLayout.minDistLevel")
- .type ("length")
- .alias_function ("function (o) return o['level pre sep'] + o['level post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.layered.CircularLayout"));
-
- s.declare (key ("CircularLayout.minDistSibling")
- .type ("length")
- .alias_function ("function (o) return o['sibling pre sep'] + o['sibling post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.layered.CircularLayout"));
- }
-};
-
diff --git a/graphics/pgf/base/source/CoffmanGrahamRanking_script.h b/graphics/pgf/base/source/CoffmanGrahamRanking_script.h
deleted file mode 100644
index d8cb01a771..0000000000
--- a/graphics/pgf/base/source/CoffmanGrahamRanking_script.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/CoffmanGrahamRanking.h>
-
-struct CoffmanGrahamRanking_script :
- scripting::declarations,
- scripting::factory<ogdf::CoffmanGrahamRanking>
-{
-
- ogdf::CoffmanGrahamRanking* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- CoffmanGrahamRanking* r = new CoffmanGrahamRanking;
-
- parameters->configure_option ("CoffmanGrahamRanking.width",
- &CoffmanGrahamRanking::width, *r);
- parameters->configure_module ("AcyclicSubgraphModule",
- &CoffmanGrahamRanking::setSubgraph, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("CoffmanGrahamRanking")
- .documentation_in ("pgf.gd.doc.ogdf.layered.CoffmanGrahamRanking")
- .set_module ("RankingModule", this));
-
- s.declare (key ("CoffmanGrahamRanking.width")
- .type ("number")
- .initial ("3")
- .documentation_in ("pgf.gd.doc.ogdf.layered.CoffmanGrahamRanking"));
- }
-};
-
diff --git a/graphics/pgf/base/source/DfsAcyclicSubgraph_script.h b/graphics/pgf/base/source/DfsAcyclicSubgraph_script.h
deleted file mode 100644
index 0d784ff3f5..0000000000
--- a/graphics/pgf/base/source/DfsAcyclicSubgraph_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/DfsAcyclicSubgraph.h>
-
-struct DfsAcyclicSubgraph_script :
- scripting::declarations,
- scripting::factory<ogdf::DfsAcyclicSubgraph>
-{
-
- ogdf::DfsAcyclicSubgraph* make (scripting::run_parameters* parameters) {
- return new ogdf::DfsAcyclicSubgraph;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("DfsAcyclicSubgraph")
- .documentation_in ("pgf.gd.doc.ogdf.layered.DfsAcyclicSubgraph")
- .set_module ("AcyclicSubgraphModule", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/EdgeCoverMerger_script.h b/graphics/pgf/base/source/EdgeCoverMerger_script.h
deleted file mode 100644
index cb91637d5d..0000000000
--- a/graphics/pgf/base/source/EdgeCoverMerger_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/EdgeCoverMerger.h>
-
-struct EdgeCoverMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::EdgeCoverMerger>
-{
- ogdf::EdgeCoverMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- EdgeCoverMerger* r = new EdgeCoverMerger;
-
- parameters->configure_option ("EdgeCoverMerger.factor",
- &EdgeCoverMerger::setFactor, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("EdgeCoverMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.EdgeCoverMerger"));
-
- s.declare (key ("EdgeCoverMerger.factor")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.EdgeCoverMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/ExampleLocalMakefileConfig.mk b/graphics/pgf/base/source/ExampleLocalMakefileConfig.mk
deleted file mode 100644
index b42f097f54..0000000000
--- a/graphics/pgf/base/source/ExampleLocalMakefileConfig.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-MYCFLAGS=-isysroot/Developer/SDKs/MacOSX10.7.sdk
-MYLDFLAGS=
-
-ARCHFLAGS=-arch x86_64
-
-SHAREDFLAGS=-undefined dynamic_lookup -bundle -llua -L$(LUALIBPATH)
-
diff --git a/graphics/pgf/base/source/FMMMLayout_script.h b/graphics/pgf/base/source/FMMMLayout_script.h
deleted file mode 100644
index bdaf26bf67..0000000000
--- a/graphics/pgf/base/source/FMMMLayout_script.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/FMMMLayout.h>
-
-struct FMMMLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- FMMMLayout layout;
-
- layout.newInitialPlacement(false);
- layout.qualityVersusSpeed(FMMMLayout::qvsGorgeousAndEfficient);
-
- parameters->configure_option ("FMMMLayout.unitEdgeLength",
- &FMMMLayout::unitEdgeLength, layout);
- parameters->configure_option ("FMMMLayout.randSeed",
- &FMMMLayout::randSeed, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("FMMMLayout")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout"));
-
- s.declare (key ("FMMMLayout.randSeed")
- .type ("number")
- .initial ("42")
- .alias ("random seed")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout"));
-
- s.declare (key ("FMMMLayout.unitEdgeLength")
- .type ("length")
- .initial ("1cm")
- .alias_function ("function (o) return o['node pre sep'] + o['node post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout"));
- }
-
-};
diff --git a/graphics/pgf/base/source/FastHierarchyLayout_script.h b/graphics/pgf/base/source/FastHierarchyLayout_script.h
deleted file mode 100644
index c8063e063a..0000000000
--- a/graphics/pgf/base/source/FastHierarchyLayout_script.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/FastHierarchyLayout.h>
-
-struct FastHierarchyLayout_script :
- scripting::declarations,
- scripting::factory<ogdf::FastHierarchyLayout>
-{
-
- ogdf::FastHierarchyLayout* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- FastHierarchyLayout* r = new FastHierarchyLayout;
-
- parameters->configure_option ("FastHierarchyLayout.fixedLayerDistance",
- &FastHierarchyLayout::fixedLayerDistance, *r);
- parameters->configure_option ("FastHierarchyLayout.layerDistance",
- &FastHierarchyLayout::layerDistance, *r);
- parameters->configure_option ("FastHierarchyLayout.nodeDistance",
- &FastHierarchyLayout::nodeDistance, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("FastHierarchyLayout")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastHierarchyLayout")
- .set_module ("HierarchyLayoutModule", this));
-
- s.declare (key ("FastHierarchyLayout.fixedLayerDistance")
- .type ("boolean")
- .initial ("false")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastHierarchyLayout"));
-
- s.declare (key ("FastHierarchyLayout.layerDistance")
- .type ("length")
- .alias_function ("function (o) return o['level pre sep'] + o['level post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastHierarchyLayout"));
-
- s.declare (key ("FastHierarchyLayout.nodeDistance")
- .type ("length")
- .alias_function ("function (o) return o['sibling pre sep'] + o['sibling post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastHierarchyLayout"));
- }
-};
-
-
diff --git a/graphics/pgf/base/source/FastMultipoleEmbedder_script.h b/graphics/pgf/base/source/FastMultipoleEmbedder_script.h
deleted file mode 100644
index 38d9b032c9..0000000000
--- a/graphics/pgf/base/source/FastMultipoleEmbedder_script.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/FastMultipoleEmbedder.h>
-
-struct FastMultipoleEmbedder_script :
- scripting::declarations,
- scripting::factory<ogdf::FastMultipoleEmbedder>
-{
- ogdf::FastMultipoleEmbedder* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- FastMultipoleEmbedder* r = new FastMultipoleEmbedder;
-
- parameters->configure_option ("FastMultipoleEmbedder.numIterations",
- &FastMultipoleEmbedder::setNumIterations, *r);
- parameters->configure_option ("FastMultipoleEmbedder.multipolePrec",
- &FastMultipoleEmbedder::setMultipolePrec, *r);
- parameters->configure_option ("FastMultipoleEmbedder.defaultEdgeLength",
- &FastMultipoleEmbedder::setDefaultEdgeLength, *r);
- parameters->configure_option ("FastMultipoleEmbedder.defaultNodeSize",
- &FastMultipoleEmbedder::setDefaultNodeSize, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("FastMultipoleEmbedder")
- .set_module ("LayoutModule", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FastMultipoleEmbedder"));
-
- s.declare (key ("FastMultipoleEmbedder.numIterations")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FastMultipoleEmbedder"));
-
- s.declare (key ("FastMultipoleEmbedder.multipolePrec")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FastMultipoleEmbedder"));
-
- s.declare (key ("FastMultipoleEmbedder.defaultEdgeLength")
- .type ("length")
- .alias_function ("function (o) return o['node pre sep'] + o['node post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FastMultipoleEmbedder"));
-
- s.declare (key ("FastMultipoleEmbedder.defaultNodeSize")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.FastMultipoleEmbedder"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/FastSimpleHierarchyLayout_script.h b/graphics/pgf/base/source/FastSimpleHierarchyLayout_script.h
deleted file mode 100644
index 37c6c94bc0..0000000000
--- a/graphics/pgf/base/source/FastSimpleHierarchyLayout_script.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/FastSimpleHierarchyLayout.h>
-
-struct FastSimpleHierarchyLayout_script :
- scripting::declarations,
- scripting::factory<ogdf::FastSimpleHierarchyLayout>
-{
-
- ogdf::FastSimpleHierarchyLayout* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
-
- FastSimpleHierarchyLayout* r = new FastSimpleHierarchyLayout
- (
- parameters->option<int> ("FastSimpleHierarchyLayout.siblingDistance"),
- parameters->option<int> ("FastSimpleHierarchyLayout.layerDistance")
- );
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("FastSimpleHierarchyLayout")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastSimpleHierarchyLayout")
- .set_module ("HierarchyLayoutModule", this));
-
- s.declare (key ("FastSimpleHierarchyLayout.layerDistance")
- .type ("length")
- .alias ("level distance")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastSimpleHierarchyLayout"));
-
- s.declare (key ("FastSimpleHierarchyLayout.siblingDistance")
- .type ("length")
- .alias ("sibling distance")
- .documentation_in ("pgf.gd.doc.ogdf.layered.FastSimpleHierarchyLayout"));
- }
-};
-
-
diff --git a/graphics/pgf/base/source/GEMLayout_script.h b/graphics/pgf/base/source/GEMLayout_script.h
deleted file mode 100644
index 7b4fda7e68..0000000000
--- a/graphics/pgf/base/source/GEMLayout_script.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/GEMLayout.h>
-
-struct GEMLayout_script :
- scripting::declarations,
- scripting::factory<ogdf::GEMLayout>
-{
- ogdf::GEMLayout* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- GEMLayout* r = new GEMLayout;
-
- parameters->configure_option ("GEMLayout.numberOfRounds",
- &GEMLayout::numberOfRounds, *r);
- parameters->configure_option ("GEMLayout.minimalTemperature",
- &GEMLayout::minimalTemperature, *r);
- parameters->configure_option ("GEMLayout.initialTemperature",
- &GEMLayout::initialTemperature, *r);
- parameters->configure_option ("GEMLayout.gravitationalConstant",
- &GEMLayout::gravitationalConstant, *r);
- parameters->configure_option ("GEMLayout.desiredLength",
- &GEMLayout::desiredLength, *r);
- parameters->configure_option ("GEMLayout.maximalDisturbance",
- &GEMLayout::maximalDisturbance, *r);
- parameters->configure_option ("GEMLayout.rotationAngle",
- &GEMLayout::rotationAngle, *r);
- parameters->configure_option ("GEMLayout.oscillationAngle",
- &GEMLayout::oscillationAngle, *r);
- parameters->configure_option ("GEMLayout.rotationSensitivity",
- &GEMLayout::rotationSensitivity, *r);
- parameters->configure_option ("GEMLayout.oscillationSensitivity",
- &GEMLayout::oscillationSensitivity, *r);
- parameters->configure_option ("GEMLayout.attractionFormula",
- &GEMLayout::attractionFormula, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("GEMLayout")
- .set_module ("LayoutModule", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.numberOfRounds")
- .type ("number")
- .initial ("20000")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.minimalTemperature")
- .type ("number")
- .initial ("0.005")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.initialTemperature")
- .type ("number")
- .initial ("10")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.gravitationalConstant")
- .type ("number")
- .initial ("0.0625")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.desiredLength")
- .type ("length")
- .alias_function ("function (o) return o['node pre sep'] + o['node post sep'] end")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.maximalDisturbance")
- .type ("number")
- .initial ("0")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.rotationAngle")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.oscillationAngle")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.rotationSensitivity")
- .type ("number")
- .initial ("0.01")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.oscillationSensitivity")
- .type ("number")
- .initial ("0.3")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- s.declare (key ("GEMLayout.attractionFormula")
- .type ("number")
- .initial ("1")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.GEMLayout"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/GreedyCycleRemoval_script.h b/graphics/pgf/base/source/GreedyCycleRemoval_script.h
deleted file mode 100644
index 7461698141..0000000000
--- a/graphics/pgf/base/source/GreedyCycleRemoval_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/GreedyCycleRemoval.h>
-
-struct GreedyCycleRemoval_script :
- scripting::declarations,
- scripting::factory<ogdf::GreedyCycleRemoval>
-{
-
- ogdf::GreedyCycleRemoval* make (scripting::run_parameters* parameters) {
- return new ogdf::GreedyCycleRemoval;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("GreedyCycleRemoval")
- .documentation_in ("pgf.gd.doc.ogdf.layered.GreedyCycleRemoval")
- .set_module ("AcyclicSubgraphModule", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/GreedyInsertHeuristic_script.h b/graphics/pgf/base/source/GreedyInsertHeuristic_script.h
deleted file mode 100644
index 4ab2675b5a..0000000000
--- a/graphics/pgf/base/source/GreedyInsertHeuristic_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/GreedyInsertHeuristic.h>
-
-struct GreedyInsertHeuristic_script :
- scripting::declarations,
- scripting::factory<ogdf::GreedyInsertHeuristic>
-{
-
- ogdf::GreedyInsertHeuristic* make (scripting::run_parameters* parameters) {
- return new ogdf::GreedyInsertHeuristic;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("GreedyInsertHeuristic")
- .documentation_in ("pgf.gd.doc.ogdf.layered.GreedyInsertHeuristic")
- .set_module ("TwoLayerCrossMin", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/INSTALL b/graphics/pgf/base/source/INSTALL
deleted file mode 100644
index 0690faba7d..0000000000
--- a/graphics/pgf/base/source/INSTALL
+++ /dev/null
@@ -1,28 +0,0 @@
-In order to use the C code in these directories, you should first
-modify / setup the file config/LocalMakefileConfig.mk, which is
-included by the main Makefiles and allows you to overwrite the
-settings from config/Makefile.mk.
-
-Once this is done, run make.
-
-You must then use the install targets to copy / link the resulting
-shared libraries with their full paths into the "luatex/lib"
-subdirectory of the directory where your TeX executable resides. For
-instance, if the luatex program is in
-
-/usr/texbin
-
-then you would put SimpleDemoC.so into
-
-/usr/texbin/lib/luatex/lua/pgf/gd/examples/c
-
-
-Due to bugs in the LuaTeX code, you currently need to append the paths
-of the libraries to their name as done in the Makefiles.
-
-Note that, currently, the Makefile will link the Lua library
-statically into the shared graph drawing library (at least on
-MacOS). This is conceptually wrong and, indeed, a lot of effort was
-need to avoid having LuaTeX crash on a TeX run because of two Lua
-libraries being used simultaneously. It works, but hopefully, in the
-fututure, this will be fixed. \ No newline at end of file
diff --git a/graphics/pgf/base/source/IndependentSetMerger_script.h b/graphics/pgf/base/source/IndependentSetMerger_script.h
deleted file mode 100644
index 2d950f8b9c..0000000000
--- a/graphics/pgf/base/source/IndependentSetMerger_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/IndependentSetMerger.h>
-
-struct IndependentSetMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::IndependentSetMerger>
-{
- ogdf::IndependentSetMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- IndependentSetMerger* r = new IndependentSetMerger;
-
- parameters->configure_option ("IndependentSetMerger.searchDepthBase",
- &IndependentSetMerger::setSearchDepthBase, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("IndependentSetMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.IndependentSetMerger"));
-
- s.declare (key ("IndependentSetMerger.searchDepthBase")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.IndependentSetMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/InterfaceFromC++.c++ b/graphics/pgf/base/source/InterfaceFromC++.c++
deleted file mode 100644
index 11c1f99dee..0000000000
--- a/graphics/pgf/base/source/InterfaceFromC++.c++
+++ /dev/null
@@ -1,215 +0,0 @@
-
-// Own header:
-#include <pgf/gd/interface/c/InterfaceFromC++.h>
-
-extern "C" {
-
-// Own C header:
-#include <pgf/gd/interface/c/InterfaceFromC.h>
-
-// Lua stuff:
-#include <lauxlib.h>
-
-}
-
-
-namespace {
-
- void cpp_caller(pgfgd_SyntacticDigraph* g, void* f)
- {
- using namespace scripting;
-
- run_parameters p;
- p.syntactic_digraph = g;
-
- runner* algo = static_cast<runner*> (f);
-
- algo->prepare(&p);
- algo->bridge();
- algo->run();
- algo->unbridge();
- }
-
-}
-
-
-namespace scripting {
-
- // The key class
-
- key::key(const char* key) : d (pgfgd_new_key(key)) {}
- key::key(struct pgfgd_Declaration* dec) : d (dec) {}
- key::~key() {pgfgd_free_key(d); }
-
- const key& key::summary (const char* x) const {
- pgfgd_key_summary(d, x);
- return *this;
- }
-
- const key& key::initial (const char* x) const {
- pgfgd_key_initial(d, x);
- return *this;
- }
-
- const key& key::initial (factory_base* fac) const {
- pgfgd_key_initial_user(d, static_cast<void*>(fac));
- return *this;
- }
-
- const key& key::type (const char* x) const {
- pgfgd_key_type(d, x);
- return *this;
- }
-
- const key& key::module_type () const {
- pgfgd_key_type(d, "user value");
- return *this;
- }
-
- const key& key::default_value (const char* x) const {
- pgfgd_key_default(d, x);
- return *this;
- }
-
- const key& key::alias (const char* x) const {
- pgfgd_key_alias(d, x);
- return *this;
- }
-
- const key& key::alias_function (const char* x) const {
- pgfgd_key_alias_function(d, x);
- return *this;
- }
-
- const key& key::documentation (const char* x) const {
- pgfgd_key_documentation(d, x);
- return *this;
- }
-
- const key& key::documentation_in (const char* x) const {
- pgfgd_key_documentation_in(d, x);
- return *this;
- }
-
- const key& key::phase (const char* x) const {
- pgfgd_key_phase(d, x);
- return *this;
- }
-
- const key& key::set_key (const char* k, const char* v) const {
- pgfgd_key_add_use(d, k, v);
- return *this;
- }
-
- const key& key::set_module (const char* k, factory_base* fac) const {
- pgfgd_key_add_use_user(d, k, static_cast<void*>(fac));
- return *this;
- }
-
- const key& key::example (const char* x) const {
- pgfgd_key_add_example(d, x);
- return *this;
- }
-
- const key& key::precondition (const char* x) const {
- pgfgd_key_add_precondition(d, x);
- return *this;
- }
-
- const key& key::postcondition (const char* x) const {
- pgfgd_key_add_postcondition(d, x);
- return *this;
- }
-
- const key& key::algorithm (runner* a) const {
- pgfgd_key_algorithm(d, cpp_caller, static_cast<void*>(a));
- return *this;
- }
-
-
- // The script class
-
- script::script (struct lua_State* s) : state(s) {}
-
- void script::declare (const key& k) {
- pgfgd_declare(state, k.d);
- }
-
- void script::declare (declarations* d) {
- d->declare(*this);
- }
-
- void script::declare (declarations& d) {
- d.declare(*this);
- }
-
-
- // The run_parameters class
-
- namespace {
-
- // Helpers:
- template <class T>
- bool fromnumber (pgfgd_SyntacticDigraph* g, const char* k, T& t)
- {
- if (pgfgd_isnumber(g->options, k)) {
- t = static_cast<T>(pgfgd_tonumber(g->options, k));
- return true;
- }
- return false;
- }
-
- };
-
- template <> bool run_parameters::option<bool> (const char* k, bool& t)
- {
- if (pgfgd_isboolean(syntactic_digraph->options, k)) {
- t = static_cast<bool>(pgfgd_toboolean(syntactic_digraph->options, k));
- return true;
- }
- return false;
- }
-
- template <> bool run_parameters::option<char*> (const char* k, char*& t)
- {
- if (pgfgd_isstring(syntactic_digraph->options, k)) {
- t = pgfgd_tostring(syntactic_digraph->options, k);
- return true;
- }
- return false;
- }
-
- template <> bool run_parameters::option<short> (const char* k, short& t)
- { return fromnumber<short> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<unsigned short> (const char* k, unsigned short& t)
- { return fromnumber<unsigned short> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<int> (const char* k, int& t)
- { return fromnumber<int> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<unsigned int> (const char* k, unsigned int& t)
- { return fromnumber<unsigned int> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<long> (const char* k, long& t)
- { return fromnumber<long> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<unsigned long> (const char* k, unsigned long& t)
- { return fromnumber<unsigned long> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<float> (const char* k, float& t)
- { return fromnumber<float> (syntactic_digraph, k, t); }
-
- template <> bool run_parameters::option<double> (const char* k, double& t)
- { return fromnumber<double> (syntactic_digraph, k, t); }
-
- void* run_parameters::invoke_void_factory_for (const char* k)
- {
- if (pgfgd_isuser (syntactic_digraph->options, k)) {
- factory_base* user = static_cast<factory_base *>(pgfgd_touser (syntactic_digraph->options, k));
- return user->make_void(this);
- }
- return 0;
- }
-
-}
diff --git a/graphics/pgf/base/source/InterfaceFromC++.h b/graphics/pgf/base/source/InterfaceFromC++.h
deleted file mode 100644
index 40cccb7884..0000000000
--- a/graphics/pgf/base/source/InterfaceFromC++.h
+++ /dev/null
@@ -1,190 +0,0 @@
-#ifndef PGF_GD_INTERFACE_C_INTERFACEFROMCPP_H
-#define PGF_GD_INTERFACE_C_INTERFACEFROMCPP_H
-
-/** \file pgf/gd/interface/c/InterfaceFromC++.h
-
- The C++-header file that should be used by algorithms written
- in C++ for graph drawing in Lua.
-*/
-
-
-struct lua_State;
-struct pgfgd_Declaration;
-struct pgfgd_SyntacticDigraph;
-
-namespace scripting {
-
- // Forward;
- class script;
- class run_parameters;
-
-
- class runner {
- public:
-
- void prepare (run_parameters* p) { parameters = p; }
-
- virtual void bridge () {}
- virtual void run () = 0;
- virtual void unbridge () {}
-
- virtual ~runner () {}
-
- protected:
-
- run_parameters* parameters;
-
- };
-
- class factory_base {
- public:
- virtual void* make_void (run_parameters*) = 0;
- virtual ~factory_base () {}
- };
-
- template <class T> class factory : public factory_base {
- virtual void* make_void (run_parameters*r) { return static_cast<void*>(make(r)); }
- virtual T* make (run_parameters*) { return new T(); }
- };
-
- class key {
- public:
-
- key (const char*);
- key (struct pgfgd_Declaration*);
- ~key ();
-
- const key& summary (const char*) const;
- const key& initial (const char*) const;
- const key& initial (factory_base*) const;
- const key& type (const char*) const;
- const key& module_type () const;
- const key& default_value (const char*) const;
- const key& alias (const char*) const;
- const key& alias_function (const char*) const;
- const key& documentation (const char*) const;
- const key& documentation_in (const char*) const;
- const key& phase (const char*) const;
- const key& set_key (const char*, const char*) const;
- const key& set_module (const char*, factory_base*) const;
- const key& example (const char*) const;
- const key& precondition (const char*) const;
- const key& postcondition (const char*) const;
- const key& algorithm (runner*) const;
-
- private:
-
- struct pgfgd_Declaration* d;
- friend class script;
-
- key (const key& k); // Not implemented.
- key& operator = (const key& k); // Not implemented.
-
- };
-
-
- // Declarations are useful for scripting:
-
- class declarations {
-
- public:
-
- virtual void declare (script) = 0;
- virtual ~declarations () {}
-
- };
-
-
- // The script class
-
- class script {
-
- public:
-
- script (struct lua_State*);
-
- // Declares a key
- void declare (const key&);
- void declare (declarations&);
- void declare (declarations*);
-
- private:
-
- struct lua_State* state;
-
- };
-
-
-
- // Declaring algorithms defined in a function
-
- class function_runner : public runner {
- public:
- function_runner (void (*f) (run_parameters&)) : fun(f) {}
- virtual void run () { fun(*parameters); }
-
- private:
- void (*fun) (run_parameters&);
- };
-
-
- // Configuring a class
-
- class run_parameters {
- public:
-
- struct pgfgd_SyntacticDigraph* syntactic_digraph;
-
- template <class Layout, class T>
- void configure_option (const char*, void (Layout::*) (T), Layout&);
-
- template <class Layout, class T>
- void configure_module (const char*, void (Layout::*) (T*), Layout&);
-
- template <class T> bool option (const char*, T&);
- template <class T> T option (const char*);
- template <class T> bool option_is_set (const char*);
-
- template <class T> T* make (const char*);
-
- protected:
- void* invoke_void_factory_for (const char*);
- };
-
- template <class T>
- T run_parameters::option (const char* k)
- {
- T t;
- option (k, t);
- return t;
- }
-
- template <class T>
- bool run_parameters::option_is_set (const char* k)
- {
- T t;
- return option(k, t);
- }
-
- template <class Layout, class T>
- void run_parameters::configure_option (const char* k, void (Layout::*f) (T), Layout& l)
- {
- T t;
- if (option<T> (k, t))
- (l.*f) (t);
- }
-
- template <class Layout, class T>
- void run_parameters::configure_module (const char* k, void (Layout::*f) (T*), Layout& l)
- {
- if (void* obj = invoke_void_factory_for(k))
- (l.*f) (static_cast<T*> (obj));
- }
-
- template <class T>
- T* run_parameters::make (const char* k) { return static_cast<T*>(invoke_void_factory_for(k)); }
-
-}
-
-
-#endif
diff --git a/graphics/pgf/base/source/InterfaceFromC.c b/graphics/pgf/base/source/InterfaceFromC.c
deleted file mode 100644
index b5606f2f39..0000000000
--- a/graphics/pgf/base/source/InterfaceFromC.c
+++ /dev/null
@@ -1,1189 +0,0 @@
-
-// Own header:
-#include <pgf/gd/interface/c/InterfaceFromC.h>
-
-// Lua stuff:
-#include <lauxlib.h>
-
-// C stuff:
-#include <stdlib.h>
-#include <string.h>
-
-
-// Remove once Lua Link Bug is fixed:
-//
-// The following is a hack to avoid a problem with the Lua lib being linked twice.
-// When this happens, two version of "dummynode" exist in Lua and we must ensure that
-// we never create a table using such a dummynode while using a second lib.
-// The following should later be set to 0 and replaced everywhere, once this is fixed.
-#define MIN_HASH_SIZE_FIX 1
-
-
-
-// Help functions
-
-static void set_field (lua_State* L, const char* what, const char* where)
-{
- if (what) {
- lua_pushstring(L, what);
- lua_setfield(L, -2, where);
- }
-}
-
-
-static void init_vertex_array(pgfgd_Vertex_array* a, int count)
-{
- a->length = count;
- a->array = (pgfgd_Vertex**) calloc(count, sizeof(pgfgd_Vertex*));
-}
-
-static void init_edge_array(pgfgd_Edge_array* a, int count)
-{
- a->length = count;
- a->array = (pgfgd_Edge**) calloc(count, sizeof(pgfgd_Edge*));
-}
-
-static void init_arcs_array(pgfgd_Arc_array* arcs, int length)
-{
- arcs->length = length;
- arcs->tails = (int*) calloc(length, sizeof(int));
- arcs->heads = (int*) calloc(length, sizeof(int));
-}
-
-static void init_path(pgfgd_Path* a, int count)
-{
- a->length = count;
- a->coordinates = (pgfgd_Coordinate*) calloc(count, sizeof(pgfgd_Coordinate));
- a->strings = (char**) calloc(count, sizeof(char*));
-}
-
-static void clear_path(pgfgd_Path* p)
-{
- int i;
- for (i=0; i < p->length; i++)
- free(p->strings[i]);
-
- free(p->strings);
- free(p->coordinates);
-
- p->length = 0;
- p->strings = 0;
- p->coordinates = 0;
-}
-
-
-
-// Option handling
-
-struct pgfgd_OptionTable {
- lua_State* state;
-
- int kind;
- int index;
-};
-
-// These are the indices of the parameters during a run of the main
-// algorithm:
-#define GRAPH_INDEX 1
-#define VERTICES_INDEX 2
-#define EDGES_INDEX 3
-#define ALGORITHM_INDEX 4
-
-// This is the index of a special table mapping vertices back to the
-// index they have. It is created in the C code, but stays on the
-// stack during the computations.
-#define BACKINDEX_STORAGE_INDEX 5
-
-// These are the positions of different upvalues for the C closure of
-// a C algorithm.
-#define FUNCTION_UPVALUE 1
-#define USER_UPVALUE 2
-#define DIGRAPH_OBJECT_UPVALUE 3
-
-
-static pgfgd_OptionTable* make_option_table(lua_State* L, int kind, int index)
-{
- pgfgd_OptionTable* t = (pgfgd_OptionTable*) malloc(sizeof(pgfgd_OptionTable));
-
- t->state = L;
- t->kind = kind;
- t->index = index;
-
- return t;
-}
-
-static void push_option_table(pgfgd_OptionTable* t)
-{
- switch (t->kind) {
- case GRAPH_INDEX:
- lua_getfield(t->state, GRAPH_INDEX, "options");
- break;
- case VERTICES_INDEX:
- lua_rawgeti(t->state, VERTICES_INDEX, t->index);
- lua_getfield(t->state, -1, "options");
- lua_replace(t->state, -2);
- break;
- case EDGES_INDEX:
- lua_rawgeti(t->state, EDGES_INDEX, t->index);
- lua_getfield(t->state, -1, "options");
- lua_replace(t->state, -2);
- break;
- }
-}
-
-int pgfgd_isset(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int is_nil = lua_isnil(t->state, -1);
- lua_pop(t->state, 2);
- return !is_nil;
-}
-
-int pgfgd_isnumber(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int is_number = lua_isnumber(t->state, -1);
- lua_pop(t->state, 2);
- return is_number;
-}
-
-int pgfgd_isboolean(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int is_bool = lua_isboolean(t->state, -1);
- lua_pop(t->state, 2);
- return is_bool;
-}
-
-int pgfgd_isstring(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int is_string = lua_isstring(t->state, -1);
- lua_pop(t->state, 2);
- return is_string;
-}
-
-int pgfgd_isuser(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int is_user = lua_isuserdata(t->state, -1);
- lua_pop(t->state, 2);
- return is_user;
-}
-
-
-double pgfgd_tonumber(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- double d = lua_tonumber(t->state, -1);
- lua_pop(t->state, 2);
- return d;
-}
-
-int pgfgd_toboolean(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- int d = lua_toboolean(t->state, -1);
- lua_pop(t->state, 2);
- return d;
-}
-
-char* pgfgd_tostring(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- const char* s = lua_tostring(t->state, -1);
- char* copy = strcpy((char*) malloc(strlen(s)+1), s);
- lua_pop(t->state, 2);
- return copy;
-}
-
-void* pgfgd_touser(pgfgd_OptionTable* t, const char* key)
-{
- push_option_table(t);
- lua_getfield(t->state, -1, key);
- void* d = lua_touserdata(t->state, -1);
- lua_pop(t->state, 2);
- return d;
-}
-
-
-// Handling algorithms
-
-struct pgfgd_SyntacticDigraph_internals {
- lua_State* state;
-};
-
-static char* make_string_from(lua_State* L, const char* name)
-{
- lua_getfield(L, -1, name);
- if (lua_isnil(L, -1)) {
- // Field not set; return emtpy string.
- lua_pop(L, 1);
- return (char*) calloc(1, sizeof(char));
- }
- else {
- const char* s = lua_tostring(L, -1);
- char* copy = strcpy((char*) malloc(strlen(s)+1), s);
- lua_pop(L, 1);
- return copy;
- }
-}
-
-static void make_coordinate(lua_State* L, pgfgd_Coordinate* c)
-{
- lua_getfield(L, -1, "x");
- c->x = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "y");
- c->y = lua_tonumber(L, -1);
- lua_pop(L, 1);
-}
-
-static pgfgd_Path* make_empty_path(lua_State* L)
-{
- return (pgfgd_Path*) calloc(1, sizeof(pgfgd_Path));
-}
-
-static pgfgd_Path* make_path(lua_State* L)
-{
- /* Path object must be on top of stack. */
- pgfgd_Path* p = make_empty_path(L);
-
- // Fill path:
- int path_length = lua_rawlen(L, -1);
- if (path_length > 0) {
- init_path(p, path_length);
- int i;
- for (i = 0; i < path_length; i++) {
- lua_rawgeti(L, -1, i+1);
- if (lua_isstring(L, -1)) {
- const char* s = lua_tostring(L, -1);
- p->strings[i] = strcpy((char*) malloc(strlen(s)+1), s);
- } else {
- lua_getfield(L, -1, "x");
- p->coordinates[i].x = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "y");
- p->coordinates[i].y = lua_tonumber(L, -1);
- lua_pop(L, 1);
- }
- lua_pop(L, 1);
- }
- }
-
- return p;
-}
-
-static void construct_digraph(lua_State* L, pgfgd_SyntacticDigraph* d)
-{
- d->internals = (pgfgd_SyntacticDigraph_internals*) calloc(1, sizeof(pgfgd_SyntacticDigraph_internals));
- d->internals->state = L;
-
- // Create the options table:
- d->options = make_option_table(L, GRAPH_INDEX, 0);
-
- // Create the vertex table
- init_vertex_array(&d->vertices, lua_rawlen(L, VERTICES_INDEX));
-
- // Create the vertices
- int i;
- for (i=0; i<d->vertices.length; i++) {
- pgfgd_Vertex* v = (pgfgd_Vertex*) calloc(1, sizeof(pgfgd_Vertex));
-
- // Push the vertex onto the Lua stack:
- lua_rawgeti(L, VERTICES_INDEX, i+1);
-
- // Fill v with information:
- v->name = make_string_from(L, "name");
- v->shape = make_string_from(L, "shape");
- v->kind = make_string_from(L, "kind");
-
- // Options:
- v->options = make_option_table(L, VERTICES_INDEX, i+1);
-
- // Index:
- v->array_index = i;
-
- // Setup pos field
- lua_getfield(L, -1, "pos");
- make_coordinate(L, &v->pos);
- lua_pop(L, 1);
-
- // Setup path array:
- lua_getfield(L, -1, "path");
- v->path = make_path(L);
- lua_pop(L, 1);
-
- // Pop the vertex
- lua_pop(L, 1);
-
- d->vertices.array[i] = v;
- }
-
- // Construct the edges:
- init_edge_array(&d->syntactic_edges, lua_rawlen(L, EDGES_INDEX));
-
- int edge_index;
- for (edge_index = 0; edge_index < d->syntactic_edges.length; edge_index++) {
- pgfgd_Edge* e = (pgfgd_Edge*) calloc(1, sizeof(pgfgd_Edge));
-
- lua_rawgeti(L, EDGES_INDEX, edge_index+1);
-
- e->direction = make_string_from(L, "direction");
- e->options = make_option_table(L, EDGES_INDEX, edge_index+1);
-
- // Index:
- e->array_index = edge_index;
-
- // Compute the tail vertex index:
- lua_getfield(L, -1, "tail");
- lua_gettable(L, VERTICES_INDEX);
- e->tail = d->vertices.array[lua_tointeger(L, -1) - 1];
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "head");
- lua_gettable(L, VERTICES_INDEX);
- e->head = d->vertices.array[lua_tointeger(L, -1) - 1];
- lua_pop(L, 1);
-
- // Fill path:
- e->path = make_empty_path(L);
- e->path->length = -1; // Means that a default path should be created.
-
- // Pop the edge form the Lua stack:
- lua_pop(L, 1);
-
- d->syntactic_edges.array[edge_index] = e;
- }
-}
-
-
-static void sync_digraph(lua_State* L, pgfgd_SyntacticDigraph* d)
-{
- // Writes back the computed position information to the digraph:
- int i;
- for (i=0; i<d->vertices.length; i++) {
-
- // Push pos field of vertex:
- lua_rawgeti(L, VERTICES_INDEX, i+1);
- lua_getfield(L, -1, "pos");
-
- // Set x and y coordinates:
- pgfgd_Vertex* v = d->vertices.array[i];
- lua_pushnumber(L, v->pos.x);
- lua_setfield(L, -2, "x");
- lua_pushnumber(L, v->pos.y);
- lua_setfield(L, -2, "y");
-
- // pop pos and vertex
- lua_pop(L, 2);
- }
-
- // Write back the paths
-
- int tos = lua_gettop(L);
-
- // First, get "Coordinate.new" as a "local"
- lua_getglobal(L, "require");
- lua_pushstring(L, "pgf.gd.model.Path");
- lua_call(L, 1, 1);
- int Path_index = lua_gettop(L);
-
- lua_getglobal(L, "require");
- lua_pushstring(L, "pgf.gd.model.Coordinate");
- lua_call(L, 1, 1);
- lua_getfield(L, -1, "new");
-
- int Coordinate_new_index = lua_gettop(L);
-
- for (i=0; i < d->syntactic_edges.length; i++) {
- pgfgd_Edge* e = d->syntactic_edges.array[i];
-
- lua_rawgeti(L, EDGES_INDEX, i+1);
-
- if (e->path->length == -1) {
- // Create default path
- pgfgd_path_append_moveto_tail(e);
- pgfgd_path_append_lineto_head(e);
- }
-
- lua_createtable(L, e->path->length ? e->path->length : 1, MIN_HASH_SIZE_FIX);
- lua_pushvalue(L, Path_index);
- lua_setmetatable(L, -2);
-
- int j;
- for (j=0; j<e->path->length; j++) {
- if (e->path->strings[j]) {
- lua_pushstring(L, e->path->strings[j]);
- lua_rawseti(L, -2, j+1);
- } else {
- lua_pushvalue(L, Coordinate_new_index);
- lua_pushnumber(L, e->path->coordinates[j].x);
- lua_pushnumber(L, e->path->coordinates[j].y);
- lua_call(L, 2, 1);
-
- lua_rawseti(L, -2, j+1);
- }
- }
-
- lua_setfield(L, -2, "path");
- lua_pop(L, 1); // The edge object
- }
-
- lua_settop(L, tos); // Cleanup
-}
-
-
-static void free_digraph(pgfgd_SyntacticDigraph* digraph)
-{
- int i;
- for (i=0; i < digraph->vertices.length; i++) {
- pgfgd_Vertex* v = digraph->vertices.array[i];
-
- clear_path(v->path);
- free(v->path);
- free(v->name);
- free(v->shape);
- free(v->kind);
- free(v->options);
- free(v->incoming.array);
- free(v->outgoing.array);
- free(v);
- }
-
- for (i=0; i < digraph->syntactic_edges.length; i++) {
- pgfgd_Edge* e = digraph->syntactic_edges.array[i];
-
- clear_path(e->path);
- free(e->path);
- free(e->direction);
- free(e->options);
- free(e);
- }
-
- free(digraph->vertices.array);
- free(digraph->syntactic_edges.array);
- free(digraph->options);
- free(digraph->internals);
- free(digraph);
-}
-
-static int algorithm_dispatcher(lua_State* L)
-{
- // Create the back index table. It will be at index BACKINDEX_STORAGE_INDEX
- lua_createtable(L, 0, MIN_HASH_SIZE_FIX);
-
- // The actual function is stored in an upvalue.
- pgfgd_SyntacticDigraph* digraph = (pgfgd_SyntacticDigraph*) calloc(1, sizeof(pgfgd_SyntacticDigraph));
-
- construct_digraph(L, digraph);
-
- pgfgd_algorithm_fun fun = lua_touserdata(L, lua_upvalueindex(FUNCTION_UPVALUE));
- fun(digraph, lua_touserdata(L, lua_upvalueindex(USER_UPVALUE)));
-
- sync_digraph(L, digraph);
-
- free_digraph(digraph);
-
- return 0;
-}
-
-
-int pgfgd_vertex_anchor(pgfgd_Vertex* v, const char* anchor, double* x, double* y)
-{
- lua_State* L = v->options->state;
-
- // Ok, first, find the vertex:
- lua_rawgeti(L, VERTICES_INDEX, v->array_index+1);
-
- // Find the anchor function:
- lua_getfield(L, -1, "anchor");
- lua_pushvalue(L, -2);
- lua_pushstring(L, anchor);
-
- // Find the anchor:
- lua_call(L, 2, 1);
-
- if (lua_isnil(L, -1)) {
- // Failed. Cleanup!
- lua_pop(L, 2);
- *x = 0;
- *y = 0;
- return 0;
- } else {
- lua_getfield(L, -1, "x");
- *x = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "y");
- *y = lua_tonumber(L, -1);
- lua_pop(L, 1);
-
- lua_pop(L, 2);
- return 1;
- }
- return 0;
-}
-
-
-
-void pgfgd_path_clear(pgfgd_Edge* e)
-{
- clear_path (e->path);
-}
-
-static void path_add_segment(pgfgd_Edge* edge, const char* s, int num, double a, double b, double c, double d, double e, double f)
-{
- if (edge->path->length == -1)
- pgfgd_path_clear(edge);
-
- int start = edge->path->length;
-
- edge->path->length += num + 1;
- edge->path->strings = (char **)
- realloc(edge->path->strings, edge->path->length*sizeof(char*));
- edge->path->coordinates = (pgfgd_Coordinate*)
- realloc(edge->path->coordinates, edge->path->length*sizeof(pgfgd_Coordinate));
-
- edge->path->coordinates[start].x = 0;
- edge->path->coordinates[start].y = 0;
- edge->path->strings[start] = strcpy((char*) malloc(strlen(s)+1), s);
-
- if (num > 0) {
- edge->path->coordinates[start+1].x = a;
- edge->path->coordinates[start+1].y = b;
- edge->path->strings[start+1] = 0;
- }
-
- if (num > 1) {
- edge->path->coordinates[start+2].x = c;
- edge->path->coordinates[start+2].y = d;
- edge->path->strings[start+2] = 0;
- }
-
- if (num > 2) {
- edge->path->coordinates[start+3].x = e;
- edge->path->coordinates[start+3].y = f;
- edge->path->strings[start+3] = 0;
- }
-}
-
-
-void pgfgd_path_append_moveto(pgfgd_Edge* e, double x, double y)
-{
- path_add_segment(e, "moveto", 1, x, y, 0, 0, 0, 0);
-}
-
-void pgfgd_path_append_moveto_tail (pgfgd_Edge* e)
-{
- double x, y;
- char* tail_anchor = pgfgd_tostring(e->tail->options, "tail anchor");
-
- pgfgd_vertex_anchor(e->tail, tail_anchor, &x, &y);
- x += e->tail->pos.x;
- y += e->tail->pos.y;
-
- pgfgd_path_append_moveto(e, x, y);
- free(tail_anchor);
-}
-
-void pgfgd_path_append_lineto(pgfgd_Edge* e, double x, double y)
-{
- path_add_segment(e, "lineto", 1, x, y, 0, 0, 0, 0);
-}
-
-void pgfgd_path_append_lineto_head (pgfgd_Edge* e)
-{
- double x, y;
- char* head_anchor = pgfgd_tostring(e->head->options, "head anchor");
-
- pgfgd_vertex_anchor(e->head, head_anchor, &x, &y);
- x += e->head->pos.x;
- y += e->head->pos.y;
-
- pgfgd_path_append_lineto(e, x, y);
- free(head_anchor);
-}
-
-void pgfgd_path_append_curveto(pgfgd_Edge* edge, double a, double b, double c, double d, double e, double f)
-{
- path_add_segment(edge, "curveto", 3, a, b, c, d, e, f);
-}
-
-void pgfgd_path_append_closepath(pgfgd_Edge* e)
-{
- path_add_segment(e, "closepath", 0, 0, 0, 0, 0, 0, 0);
-}
-
-
-
-// Handling digraphs
-
-struct pgfgd_Digraph {
- lua_State* state;
- const char* name;
- pgfgd_SyntacticDigraph* syntactic_digraph;
-};
-
-
-pgfgd_Digraph* pgfgd_get_digraph (pgfgd_SyntacticDigraph* g, const char* graph_name)
-{
- lua_State* L = g->internals->state;
-
- lua_getfield(L, ALGORITHM_INDEX, graph_name);
- if (lua_isnil(L, -1))
- luaL_error(L, "digraph named %s not found in algorithm class", graph_name);
- lua_pop(L, 1);
-
- pgfgd_Digraph* new = (pgfgd_Digraph*) calloc(1, sizeof(pgfgd_Digraph));
-
- new->state = L;
- new->name = graph_name;
- new->syntactic_digraph = g;
-
- return new;
-}
-
-int pgfgd_digraph_num_vertices (pgfgd_Digraph* g)
-{
- lua_getfield(g->state, ALGORITHM_INDEX, g->name);
- lua_getfield(g->state, -1, "vertices");
- int num = lua_rawlen(g->state, -1);
- lua_pop(g->state, 2);
-
- return num;
-}
-
-static void push_digraph_and_backindex(pgfgd_Digraph* g)
-{
- lua_State* L = g->state;
-
- // Get digraph
- lua_getfield(L, ALGORITHM_INDEX, g->name);
- int digraph_pos = lua_gettop(L);
-
- // Get entry in back index table
- lua_pushvalue(L, digraph_pos);
- lua_gettable(L, BACKINDEX_STORAGE_INDEX);
- int backtable_pos = lua_gettop(L);
- if (lua_isnil(L, backtable_pos)) {
- // Aha. We need to install a new table:
- lua_pop(L, 1); // Get rid of nil
-
- lua_createtable(L, 0, MIN_HASH_SIZE_FIX);
-
- lua_pushvalue(L, digraph_pos); // The digraph object
- lua_pushvalue(L, backtable_pos); // The new table
- lua_settable(L, BACKINDEX_STORAGE_INDEX);
-
- // Fill the table:
- lua_getfield(L, digraph_pos, "vertices");
- int vertex_pos = lua_gettop(L);
- int i;
- int n = lua_rawlen(L, -1);
- for (i = 1; i <= n; i++) {
- lua_rawgeti(L, vertex_pos, i);
- lua_pushinteger(L, i);
- lua_settable(L, backtable_pos);
- }
- lua_pop(L, 1);
- }
-}
-
-static pgfgd_Arc_array* build_c_array_of_arcs_from_lua_array_of_arcs(pgfgd_Digraph* g)
-{
- lua_State* L = g->state;
-
- pgfgd_Arc_array* arcs = (pgfgd_Arc_array*) calloc(1, sizeof(pgfgd_Arc_array));
-
- int array_pos = lua_gettop(L);
-
- push_digraph_and_backindex(g);
- int backtable_pos = lua_gettop(L);
-
- // Get number of arcs:
- init_arcs_array(arcs, lua_rawlen(L, array_pos));
- int i;
- for (i = 1; i<=arcs->length; i++) {
- lua_rawgeti(L, array_pos, i); // Get arcs[i]
-
- // The tail field:
- lua_getfield(L, -1, "tail");
- lua_gettable(L, backtable_pos);
-
- arcs->tails[i-1] = lua_tointeger(L, -1);
- lua_pop(L, 1); // The number
-
- // The head field:
- lua_getfield(L, -1, "head");
- lua_gettable(L, backtable_pos);
- arcs->heads[i-1] = lua_tointeger(L, -1);
- lua_pop(L, 1); // The number
-
- lua_pop(L, 1); // Pop arcs[i]
- }
-
- lua_settop(L, array_pos);
-
- return arcs;
-}
-
-
-pgfgd_Arc_array* pgfgd_digraph_arcs (pgfgd_Digraph* g)
-{
- lua_getfield(g->state, ALGORITHM_INDEX, g->name);
- lua_getfield(g->state, -1, "arcs");
-
- pgfgd_Arc_array* a = build_c_array_of_arcs_from_lua_array_of_arcs(g);
-
- lua_pop(g->state, 2);
-
- return a;
-}
-
-
-pgfgd_Vertex* pgfgd_digraph_syntactic_vertex (pgfgd_Digraph* g, int v)
-{
- int tos = lua_gettop(g->state);
- pgfgd_Vertex* return_me = 0;
-
- lua_getfield(g->state, ALGORITHM_INDEX, g->name);
- lua_getfield(g->state, -1, "vertices");
- lua_rawgeti(g->state, -1, v);
-
- lua_gettable(g->state, VERTICES_INDEX);
- if (lua_isnumber(g->state, -1)) {
- return_me = g->syntactic_digraph->vertices.array[lua_tointeger(g->state, -1)-1];
- }
-
- lua_settop(g->state, tos);
- return return_me;
-}
-
-
-int pgfgd_digraph_isarc (pgfgd_Digraph* g, int tail, int head)
-{
- lua_State* L = g->state;
- int is_arc = 0;
-
- lua_getfield(L, ALGORITHM_INDEX, g->name);
- int digraph_pos = lua_gettop(L);
-
- lua_getfield(L, digraph_pos, "vertices");
- int vertices_pos = lua_gettop(L);
-
- // Call digraph:connected(tail, head)
- lua_pushvalue(L, lua_upvalueindex(DIGRAPH_OBJECT_UPVALUE));
- lua_getfield(L, -1, "arc");
- lua_pushvalue(L, digraph_pos);
- lua_rawgeti(L, vertices_pos, tail);
- lua_rawgeti(L, vertices_pos, head);
- lua_call(L, 3, 1);
-
- is_arc = !lua_isnil(L, -1);
-
- lua_settop(L, digraph_pos-1);
-
- return is_arc;
-}
-
-pgfgd_Arc_array* pgfgd_digraph_incoming (pgfgd_Digraph* g, int v)
-{
- lua_State* L = g->state;
-
- lua_getfield(L, ALGORITHM_INDEX, g->name);
- int digraph_pos = lua_gettop(L);
-
- lua_getfield(L, digraph_pos, "vertices");
- int vertices_pos = lua_gettop(L);
-
- // Call digraph:connected(tail, head)
- lua_pushvalue(L, lua_upvalueindex(DIGRAPH_OBJECT_UPVALUE));
- lua_getfield(L, -1, "incoming");
- lua_pushvalue(L, digraph_pos);
- lua_rawgeti(L, vertices_pos, v);
- lua_call(L, 2, 1);
-
- pgfgd_Arc_array* a = build_c_array_of_arcs_from_lua_array_of_arcs(g);
-
- lua_settop(L, digraph_pos-1);
-
- return a;
-}
-
-pgfgd_Arc_array* pgfgd_digraph_outgoing (pgfgd_Digraph* g, int v)
-{
- lua_State* L = g->state;
-
- lua_getfield(L, ALGORITHM_INDEX, g->name);
- int digraph_pos = lua_gettop(L);
-
- lua_getfield(L, digraph_pos, "vertices");
- int vertices_pos = lua_gettop(L);
-
- // Call digraph:connected(tail, head)
- lua_pushvalue(L, lua_upvalueindex(DIGRAPH_OBJECT_UPVALUE));
- lua_getfield(L, -1, "outgoing");
- lua_pushvalue(L, digraph_pos);
- lua_rawgeti(L, vertices_pos, v);
- lua_call(L, 2, 1);
-
- pgfgd_Arc_array* a = build_c_array_of_arcs_from_lua_array_of_arcs(g);
-
- lua_settop(L, digraph_pos-1);
-
- return a;
-}
-
-pgfgd_Edge_array* pgfgd_digraph_syntactic_edges (pgfgd_Digraph* g, int tail, int head)
-{
- pgfgd_Edge_array* edges = (pgfgd_Edge_array*) calloc(1, sizeof(pgfgd_Edge_array));
-
- // First, get the arc in the syntatic digraph.
- lua_State* L = g->state;
- int tos = lua_gettop(L);
-
- lua_getfield(L, ALGORITHM_INDEX, g->name);
- int digraph_pos = lua_gettop(L);
-
- lua_getfield(L, digraph_pos, "vertices");
- int vertices_pos = lua_gettop(L);
-
- // Call digraph:arc(tail, head)
- lua_pushvalue(L, lua_upvalueindex(DIGRAPH_OBJECT_UPVALUE));
- int digraph_class_index = lua_gettop(L);
-
- lua_getfield(L, digraph_class_index, "arc");
- lua_pushvalue(L, digraph_pos);
- lua_rawgeti(L, vertices_pos, tail);
- lua_rawgeti(L, vertices_pos, head);
- lua_call(L, 3, 1);
-
- if (!lua_isnil(L, -1)) {
- // Get syntactic_digraph of the arc:
- lua_getfield(L, -1, "syntactic_digraph");
-
- // Call syntactic_digraph:arc(tail, head)
- lua_getfield(L, digraph_class_index, "arc");
- lua_pushvalue(L, -2);
- lua_rawgeti(L, vertices_pos, tail);
- lua_rawgeti(L, vertices_pos, head);
- lua_call(L, 3, 1);
-
- if (!lua_isnil(L, -1)) {
- lua_getfield(L, -1, "syntactic_edges");
- int syntactic_edges_index = lua_gettop(L);
-
- int n = lua_rawlen(L, syntactic_edges_index);
- init_edge_array(edges, n);
- int i;
- for (i=1; i<=n; i++) {
- lua_rawgeti(L, syntactic_edges_index, i);
- lua_gettable(L, EDGES_INDEX);
- if (!lua_isnumber(L, -1)) {
- pgfgd_digraph_free_edge_array(edges);
- luaL_error(L, "syntactic edge index not found");
- }
- int p = lua_tonumber(L, -1);
- edges->array[i-1] = g->syntactic_digraph->syntactic_edges.array[p-1];
- }
- }
- }
-
- lua_settop(L, tos);
-
- return edges;
-}
-
-
-
-void pgfgd_digraph_free (pgfgd_Digraph* g)
-{
- free(g);
-}
-
-void pgfgd_digraph_free_arc_array (pgfgd_Arc_array* arcs)
-{
- free (arcs->tails);
- free (arcs->heads);
- free (arcs);
-}
-
-void pgfgd_digraph_free_edge_array (pgfgd_Edge_array* edges)
-{
- free (edges->array);
- free (edges);
-}
-
-
-
-// Handling declarations
-
-
-struct pgfgd_Declaration {
- const char* key;
- const char* summary;
- const char* type;
- const char* initial;
- void* initial_user;
- const char* default_value;
- const char* alias;
- const char* alias_function_string;
- const char* documentation;
- const char* documentation_in;
- pgfgd_algorithm_fun algorithm;
- void* algorithm_user;
- const char* phase;
-
- int use_length;
- const char** use_keys;
- const char** use_values_strings;
- void** use_values_user;
-
- int examples_length;
- const char** examples;
-
- int pre_length;
- const char** pre;
-
- int post_length;
- const char** post;
-};
-
-
-pgfgd_Declaration* pgfgd_new_key (const char* key)
-{
- pgfgd_Declaration* d = (pgfgd_Declaration*) calloc(1, sizeof(pgfgd_Declaration));
-
- d->key = key;
-
- return d;
-}
-
-void pgfgd_declare(struct lua_State* state, pgfgd_Declaration* d)
-{
- if (d && d->key) {
- int tos = lua_gettop(state);
-
- lua_gc(state, LUA_GCSTOP, 0); // Remove once Lua Link Bug is fixed
-
- // Find declare function:
- lua_getglobal(state, "require");
- lua_pushstring(state, "pgf.gd.interface.InterfaceToAlgorithms");
- lua_call(state, 1, 1);
- lua_getfield(state, -1, "declare");
-
- // Build a Lua table:
- lua_createtable(state, 0, 11);
-
- set_field (state, d->key, "key");
- set_field (state, d->summary, "summary");
- set_field (state, d->type, "type");
- set_field (state, d->initial, "initial");
- set_field (state, d->documentation, "documentation");
- set_field (state, d->documentation_in, "documentation_in");
- set_field (state, d->default_value, "default");
- set_field (state, d->alias, "alias");
- set_field (state, d->alias_function_string, "alias_function_string");
- set_field (state, d->phase, "phase");
-
- if (d->initial_user) {
- lua_pushlightuserdata(state, d->initial_user);
- lua_setfield(state, -2, "initial");
- }
-
- if (d->use_length > 0) {
- lua_createtable(state, d->use_length, MIN_HASH_SIZE_FIX);
- int i;
- for (i=0; i < d->use_length; i++) {
- lua_createtable(state, 0, 2);
- set_field(state, d->use_keys[i], "key");
- if (d->use_values_strings[i])
- set_field(state, d->use_values_strings[i], "value");
- if (d->use_values_user[i]) {
- lua_pushlightuserdata(state, d->use_values_user[i]);
- lua_setfield(state, -2, "value");
- }
- lua_rawseti(state, -2, i+1);
- }
- lua_setfield(state, -2, "use");
- }
-
- if (d->pre) {
- lua_createtable(state, 0, d->pre_length);
- int i;
- for (i=0; i < d->pre_length; i++) {
- lua_pushboolean(state, 1);
- lua_setfield(state, -2, d->pre[i]);
- }
- lua_setfield(state, -2, "preconditions");
- }
-
- if (d->post) {
- lua_createtable(state, 0, d->post_length);
- int i;
- for (i=0; i < d->post_length; i++) {
- lua_pushboolean(state, 1);
- lua_setfield(state, -2, d->post[i]);
- }
- lua_setfield(state, -2, "postconditions");
- }
-
- if (d->examples) {
- lua_createtable(state, d->examples_length, MIN_HASH_SIZE_FIX);
- int i;
- for (i=0; i < d->examples_length; i++) {
- lua_pushstring(state, d->examples[i]);
- lua_rawseti(state, -2, i+1);
- }
- lua_setfield(state, -2, "examples");
- }
-
- if (d->algorithm) {
- // The algorithm function and the user data is stored as lightuserdate upvalue
- lua_pushlightuserdata(state, (void *) d->algorithm);
- lua_pushlightuserdata(state, (void *) d->algorithm_user);
-
- // Find the Digraph.arc function and store it as the second upvalue:
- lua_getglobal(state, "require");
- lua_pushstring(state, "pgf.gd.model.Digraph");
- lua_call(state, 1, 1);
-
- lua_pushcclosure(state, algorithm_dispatcher, 3);
- lua_setfield(state, -2, "algorithm_written_in_c");
- }
-
- // Call the declare function:
- lua_call(state, 1, 0);
-
- // Cleanup:
- lua_settop(state, tos);
-
- lua_gc(state, LUA_GCRESTART, 0); // Remove once Lua Link Bug is fixed
- }
-}
-
-void pgfgd_key_add_use(pgfgd_Declaration* d, const char* key, const char* value)
-{
- d->use_length++;
- d->use_keys = (const char **) realloc(d->use_keys, d->use_length*sizeof(const char*));
- d->use_values_strings = (const char **) realloc(d->use_values_strings, d->use_length*sizeof(const char*));
- d->use_values_user = (void **) realloc(d->use_values_user, d->use_length*sizeof(void*));
-
- d->use_keys [d->use_length-1] = key;
- d->use_values_strings[d->use_length-1] = value;
- d->use_values_user [d->use_length-1] = 0;
-}
-
-void pgfgd_key_add_use_user(pgfgd_Declaration* d, const char* key, void* value)
-{
- d->use_length++;
- d->use_keys = (const char **) realloc(d->use_keys, d->use_length*sizeof(const char*));
- d->use_values_strings = (const char **) realloc(d->use_values_strings, d->use_length*sizeof(const char*));
- d->use_values_user = (void **) realloc(d->use_values_user, d->use_length*sizeof(void*));
-
- d->use_keys [d->use_length-1] = key;
- d->use_values_strings[d->use_length-1] = 0;
- d->use_values_user [d->use_length-1] = value;
-}
-
-void pgfgd_key_add_example(pgfgd_Declaration* d, const char* s)
-{
- d->examples_length++;
- d->examples = (const char **) realloc(d->examples, d->examples_length*sizeof(const char*));
-
- d->examples[d->examples_length-1] = s;
-}
-
-void pgfgd_key_add_precondition(pgfgd_Declaration* d, const char* s)
-{
- d->pre_length++;
- d->pre = (const char **) realloc(d->pre, d->pre_length*sizeof(const char*));
-
- d->pre[d->pre_length-1] = s;
-}
-
-void pgfgd_key_add_postcondition(pgfgd_Declaration* d, const char* s)
-{
- d->post_length++;
- d->post = (const char **) realloc(d->post, d->post_length*sizeof(const char*));
-
- d->post[d->post_length-1] = s;
-}
-
-void pgfgd_key_summary(pgfgd_Declaration* d, const char* s)
-{
- d->summary = s;
-}
-
-void pgfgd_key_type(pgfgd_Declaration* d, const char* s)
-{
- d->type = s;
-}
-
-void pgfgd_key_initial(pgfgd_Declaration* d, const char* s)
-{
- d->initial = s;
-}
-
-void pgfgd_key_initial_user(pgfgd_Declaration* d, void* s)
-{
- d->initial_user = s;
-}
-
-void pgfgd_key_default(pgfgd_Declaration* d, const char* s)
-{
- d->default_value = s;
-}
-
-void pgfgd_key_alias(pgfgd_Declaration* d, const char* s)
-{
- d->alias = s;
-}
-
-void pgfgd_key_alias_function(pgfgd_Declaration* d, const char* s)
-{
- d->alias_function_string = s;
-}
-
-void pgfgd_key_documentation(pgfgd_Declaration* d, const char* s)
-{
- d->documentation = s;
-}
-
-void pgfgd_key_documentation_in(pgfgd_Declaration* d, const char* s)
-{
- d->documentation_in = s;
-}
-
-void pgfgd_key_phase(pgfgd_Declaration* d, const char* s)
-{
- d->phase = s;
-}
-
-void pgfgd_key_algorithm(pgfgd_Declaration* d, pgfgd_algorithm_fun f, void* user_data)
-{
- d->algorithm = f;
- d->algorithm_user = user_data;
-}
-
-void pgfgd_free_key(pgfgd_Declaration* d)
-{
- if (d) {
- free(d->examples);
- free(d->use_keys);
- free(d->use_values_user);
- free(d->use_values_strings);
- free(d);
- }
-}
diff --git a/graphics/pgf/base/source/InterfaceFromC.h b/graphics/pgf/base/source/InterfaceFromC.h
deleted file mode 100644
index 40495dbdc2..0000000000
--- a/graphics/pgf/base/source/InterfaceFromC.h
+++ /dev/null
@@ -1,613 +0,0 @@
-#ifndef PGF_GD_INTERFACE_C_INTERFACEFROMC_H
-#define PGF_GD_INTERFACE_C_INTERFACEFROMC_H
-
-/** \file pgf/gd/interface/c/InterfaceFromC.h
-
- The C-header file that should be used by algorithms written
- in C for graph drawing in Lua.
-*/
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-
-
-// Option handling
-
-/** Abstraction of a Lua option table.
- You cannot access it directly, but only through the function
- pgfgd_isset and so on. Note that pointers to such option tables
- will only be valid during a run of the algorithm; you cannot store
- a point to an option table past the run of an algorithm.
-*/
-
-typedef struct pgfgd_OptionTable pgfgd_OptionTable;
-
-
-/** Returns 1 if the key is actually set in the option table to any
- non-nil value; otherwise 0. */
-int pgfgd_isset(pgfgd_OptionTable* t, const char* key);
-
-/** Returns 1 if the key is a number (or can be converted to a
- number) in the option table. */
-int pgfgd_isnumber(pgfgd_OptionTable* t, const char* key);
-
-/** Returns 1 if the key is a string in the option table. */
-int pgfgd_isstring(pgfgd_OptionTable* t, const char* key);
-
-/** Returns 1 if the key is a Boolean value in the option table. */
-int pgfgd_isboolean(pgfgd_OptionTable* t, const char* key);
-
-/** Returns 1 if the key is a user value in the option table. */
-int pgfgd_isuser(pgfgd_OptionTable* t, const char* key);
-
-/** Provided that pgfgd_isnumber returns 1 for the key, this funciton
- will return the number stored in the key (otherwise, the function
- may crash). Note that integers are also retrieved through this function. */
-double pgfgd_tonumber(pgfgd_OptionTable* t, const char* key);
-
-/** Provided that pgfgd_isstring returns 1 for this key, this function
- returns a copy of the string stored in the key. You must free the
- returned string yourself. */
-char* pgfgd_tostring(pgfgd_OptionTable* t, const char* key);
-
-/** Provided that pgfgd_isboolean returns 1 for this key, the function
- returns this Boolean value. */
-int pgfgd_toboolean(pgfgd_OptionTable* t, const char* key);
-
-/** Provided that pgfgd_isuser returns 1 for this key, the function
- returns this user value. */
-void* pgfgd_touser(pgfgd_OptionTable* t, const char* key);
-
-
-
-// Graph model
-
-/** An abstraction of a pgf.gd.model.Coordinate object. */
-typedef struct pgfgd_Coordinate {
- double x;
- double y;
-} pgfgd_Coordinate;
-
-
-/** Used to pass around arrays of Coordinate objects. The main purpose
- of the structure is to provide access to the length of the
- array. Note that numbering starts with 0.
-*/
-typedef struct pgfgd_Coordinate_array {
- int length;
- pgfgd_Coordinate* array;
-} pgfgd_Coordinate_array;
-
-
-typedef struct pgfgd_Edge pgfgd_Edge;
-
-/** An array of Edge objects. */
-typedef struct pgfgd_Edge_array {
-
- int length;
- pgfgd_Edge** array;
-
-} pgfgd_Edge_array;
-
-
-/** This struct is used to model a Lua Path. In Lua, a path is an
- array where each entry is either a Coordinate object or a
- string. This is modeled on the C layer by having
- two arrays and for each position, either the coordinates array or
- the strings array is set (the strings
- array is set at position i if, and only if, it is not null).
-
- Graph drawing functions may wish to modify Edge paths, namely
- whenever they wish to setup a special routing for an edge. In this
- case, you may not directly modify the object, but, rather, you
- must use the functions pgfgd_path_xxx to modify the path
- field. When the graph drawing function is done, the values stored
- in the the path fields of the Edges of the syntactic digraph are
- copied back to Lua.
-
- Note that numbering starts at 0. Also note that you have to set
- the path field for each syntactic edge individually.
-
- The |length| field will be |-1| for the ``default path'' of an
- edge. The actual path (a straight line from the tail to the head
- vertex) is generated only when the graph is written back, because
- only then the coordinates of the nodes will be known.
-*/
-
-typedef struct pgfgd_Path {
-
- /** Both arrays of this struct will have this length, except when
- this field is set to -1, indicating that a default path should
- be generated when this path is written back to the graph. */
- int length;
-
- /** An array of coordinates. Not all entries of this array are
- relevant, namely only those for which the strings array is null
- at the some position.
- */
- pgfgd_Coordinate* coordinates;
-
- /** An array of strings. Whenever an entry in this array is not
- null, the entry in the coordinates array at the same position is
- ignored. */
- char** strings;
-
-} pgfgd_Path;
-
-
-
-/** An abstraction of a pgf.gd.model.Vertex. These objects are
- managed by the library (including creation and deletion), you
- should not create them yourself or modify them, except for the pos
- field, which you should modify (indeed, this is the whole purpose
- of your graph drawing algorithm).
-*/
-
-typedef struct pgfgd_Vertex {
-
- /** The name field of the Lua Vertex class. */
- char* name;
-
- /** The path field of the Lua Vertex class. */
- pgfgd_Path* path;
-
- /** The shape field of the Lua Vertex class. */
- char* shape;
-
- /** The kind field of the Lua Vertex class. */
- char* kind;
-
- /** The pos field of the Lua Vertex class. Unlike the other fields
- of this struct, you can write pos.x and pos.y. When the graph
- drawing function returns, the values stored in theses fields
- will be written back to the Lua layer.
- */
- pgfgd_Coordinate pos;
-
- /** The options fields of the Lua Vertex class. Note that you do
- not have direct access to theses options. Rather, all access to
- them must go through functions like pgfgd_isset that take a
- pgfgd_OptionsTable* as input. Also note that you cannot store a
- pointer to an options table: At the end of the graph drawing
- function, all option table pointers will loose their
- meaning. If you really wish to store an options table, you need
- to retrieve all information stored in it while the point is
- still active and then store the retrieved information in your
- own table.
- */
- pgfgd_OptionTable* options;
-
- /** Similar to the incoming field of the Lua Vertex class, but it
- stores abstractions of the syntactic Edges objects of the
- syntactic digraph, rather than the table of Arc objects that are
- really stored in a Vertex. Also note that in a Lua Vertex
- object, the incoming and outgoing arcs depend on the graph,
- while a pgfgd_Vertex always only stores the incoming and
- outgoing edges of the syntactic digraph. The order of the edges
- in the incoming array will be the same as on the Lua layer, but
- numbering starts with 0 (since these are C arrays).
- */
- pgfgd_Edge_array incoming;
-
- /** Like the incoming fields. */
- pgfgd_Edge_array outgoing;
-
- /** The index of this vertex in the array entry of the syntactic
- digraph. */
- int array_index;
-
-} pgfgd_Vertex;
-
-
-
-/** Used to pass around arrays of Vertex objects (more precisely, of
- arrays of pointers to pgfgd_Vertex objects). Note that numbering
- starts with 0.
-*/
-
-typedef struct pgfgd_Vertex_array {
- int length;
- pgfgd_Vertex** array;
-} pgfgd_Vertex_array;
-
-
-
-/** This function allows you to query an anchor of a vertex (like a
- call to |Vertex:anchor|). The function returns
- |1| if there is such an anchor, otherwise |0| is returned and
- both |x| and |y| will be set to 0. */
-extern int pgfgd_vertex_anchor(pgfgd_Vertex* v, const char* anchor, double* x, double* y);
-
-
-
-/** An abstraction of pgf.gd.model.Edge. */
-
-struct pgfgd_Edge {
-
- /** The tail field of the Lua Edge class. */
- pgfgd_Vertex* tail;
-
- /** The head field of the Lua Edge class. */
- pgfgd_Vertex* head;
-
- /** The direction field of the Lua Edge class. */
- char* direction;
-
- /** The path field of the Lua Edge class. You can read this field
- directly, but you can write it only through the function whose
- names start with pgfgd_path.
-
- For each pgfgd_Edge object, at the end of the graph drawing
- routinge, the value stored in this field will be written back to
- the path field of the original syntactic edge.
- */
- pgfgd_Path* path;
-
- /** A pointer to the options table of the Edge. This works like the
- options table of pgdgd_Vertex and the same restrictions apply.
- */
- pgfgd_OptionTable* options;
-
- /** The index of this edge in the array entry of the syntactic
- digraph. */
- int array_index;
-
-};
-
-
-typedef struct pgfgd_SyntacticDigraph_internals pgfgd_SyntacticDigraph_internals;
-
-
-/** The class pgf.gd.model.Digraph is modeled using two different C
- structs: First, we have pgfgd_SyntacticDigraph and, second, we
- have pgfgd_Digraph. The first is used, only, to model the (single)
- syntactic digraph that is passed to the graph drawing function,
- while the second is used to model different, more light weight
- digraphs that are computed be the graph drawing system prior to
- the call of the graph drawing routine. For instance, the spanning
- tree computed by the graph drawing system for algorithms whose
- preconditions included "tree" will be modeled as a pgfgd_Digraph.
-
- There is only one pgfgd_SyntacticDigraph during a call of
- the graph drawing routine and you can access its properties
- directly by accessing the fields of the struct. You cannot,
- however, modify the syntactic digraph, except for setting the pos
- fields of the vertices and for setting the path field arrays of
- the syntactic edges (through the pgfgd_path_xxx functions). When
- the graph drawing function is done, the modifications will be
- written back to the Lua layer.
-
- Note that the syntactic digraph only stores the syntactic edges,
- not the Arc objects. In particular, when you write
- |graph { a <- b }| on the TikZ layer, you will get one syntactic
- edge from a to b (not the other way round) with its direction
- field set to "<-" in the syntactic digraph object.
- */
-
-typedef struct pgfgd_SyntacticDigraph {
-
- /** The vertices field of a Lua (syntactic) digraph. You may not
- modify this array, except for changing the pos fields of the
- vertices. */
- pgfgd_Vertex_array vertices;
-
- /** All syntactic edges of the graph. You cannot modify this array,
- but you can use the pgfgd_path_xxx funtion to change the routing
- of the edges stored here. Note that, since you get access to
- syntactic edges, the direction of these edges may not be what
- you expect and there may be several syntactic edges between the
- same vertices.
- */
- pgfgd_Edge_array syntactic_edges;
-
- /** The syntactic digraph's options field. Like all options fields,
- it will go out of scope at the end of the graph drawing
- routine.
- */
- pgfgd_OptionTable* options;
-
- pgfgd_SyntacticDigraph_internals* internals;
-
-} pgfgd_SyntacticDigraph;
-
-
-
-
-// Modifying edge bend paths
-
-/** You can apply this function to an Edge to clear the routing path
- stored in it.
-*/
-extern void pgfgd_path_clear (pgfgd_Edge* e);
-
-/** This function adds a moveto at the end of a path. */
-extern void pgfgd_path_append_moveto (pgfgd_Edge* e, double x, double y);
-
-/** This function adds a moveto to the |tail anchor| of the tail of
- the edge. This call is useful for ``starting'' a path. This
- function is a ``service function,'' you can achieve the same
- effect by directly reading the option table of the tail vertex
- and then using the pgfgd_vertex_anchor method. */
-extern void pgfgd_path_append_moveto_tail (pgfgd_Edge* e);
-
-/** This function adds a lineto at the end of a path. */
-extern void pgfgd_path_append_lineto (pgfgd_Edge* e, double x, double y);
-
-/** This function adds a linto to the |head anchor| of the head of
- the edge. This call is useful for ``ending'' a path. */
-extern void pgfgd_path_append_lineto_head (pgfgd_Edge* e);
-
-/** This function adds a closepath at the end of a path. */
-extern void pgfgd_path_append_closepath (pgfgd_Edge* e);
-
-/** This function adds a curevto at the end of a path. */
-extern void pgfgd_path_append_curveto (pgfgd_Edge* e, double x1, double y1, double x2, double y2, double x, double y);
-
-
-
-
-// Querying graphs other than the syntactic digraph
-
-/** A pgfgd_Digraph is a light-weight abstraction of a Lua Digraph
- object. Unlike a pgfgd_SyntacticDigraph, you cannot access the
- fields such an object directly, rather, all information is
- retrieved through functions starting with pgfgd_digraph.
-
- When the graph drawing function is called, the graph drawing
- system will already have computed a number of special digraphs in
- addition to the syntactic digraph passed to the function. For
- instance, there is always the "ugraph", which is the undirected
- graph underlying the syntactic digraph. To access these special
- graphs, you first call pgfgd_get_digraph and then use the
- pgfgd_digraph_xxx function to retrieve information about them.
-
- Unlike the pgfgd_SyntacticDigraph object, which is managed by the
- library, you must free pgfgd_Digraph objects yourself through the
- pgfgd_digraph_free function.
-*/
-
-typedef struct pgfgd_Digraph pgfgd_Digraph;
-
-/** There is no abstraction of an Arc object on the C layer. Rather,
- an arc is simply the index of the tail vertex plus the index of
- the head vertex, where the indices are relative to the array of
- vertices making up the digraph under consideration.
-
- You may wonder why we store indices rather than pointers to
- pgfgd_Vertex objects. The reason is that a pgfgd_Digraph may
- actually contain vertices that are not present in the syntactic
- digraph (for instance, dummy vertices in a spanning tree) and for
- which no pgfgd_Vertex obejct exists. For this reason, we only use
- indices and there is a special function
- (pgfgd_digraph_syntactic_vertex) that can be used to retrieve the
- pgfgd_Vertex object, provided it exists.
-
- Note that the numbers stored in the tails and heads arrays, which
- refer to positions inside a Lua vertices array, start numbering
- with 1. The arrays themselves, however, start numbering with
- 0. So, tails[0] == 1 and heads[0] == 2 would mean that there is an
- Arc from the first to the second vertex. You can pass the numbers
- stored in these arrays directly to the pgfgd_digraph_xxx
- functions.
-
- You must free pgfgd_Arc_array objects yourself via
- pgfgd_digraph_free_arc_array.
- */
-typedef struct pgfgd_Arc_array {
-
- /** The length of both arrays. */
- int length;
-
- /** The array of the numbers of the tail vertices of the arcs. The
- array itself starts numbering with 0, but its entries refer to
- positions inside Lua array, so their numbering starts with 1. */
- int* tails;
-
- /** Like tails. */
- int* heads;
-
-} pgfgd_Arc_array;
-
-
-/** In order to access special digraphs like the |ugraph| or the
- |spanning_tree| computed by the graph drawing system, you first
- need to call this function. In detail, the graph_name must be the
- name of a field of the Lua algorithm object and this field must
- store a |Digraph| object. Examples are "digraph" or "ugraph". The
- function will then return a handle to this digraph which you can
- subsequently access. The handle will become invalid at the end of
- the graph drawing funciton and you must free it explicitly using
- pgfgd_digraph_free.
- */
-extern pgfgd_Digraph* pgfgd_get_digraph (pgfgd_SyntacticDigraph* g, const char* graph_name);
-
-/** Returns the number of vertices in the digraph. Note that this
- number needs not be the same as the number of vertices in the
- syntactic digraph and that the ordering need not be the
- same as in the syntactic digraph. */
-extern int pgfgd_digraph_num_vertices (pgfgd_Digraph* g);
-
-/** Returns a newly allocated array of all arcs present in the
- digraph. You must free this array explicitly using
- pgfgd_digraph_free_arc_array.
-*/
-extern pgfgd_Arc_array* pgfgd_digraph_arcs (pgfgd_Digraph* g);
-
-/** This function allows you to retrieve the syntatic vertex that
- corresponds to a given index in the digraph. Normally, the first
- vertex of a digraph like the ugraph will also be the first entry
- of the vertices field of the syntactic digraph, but this need not
- always be the case. For instance, for a spanning_tree digraph,
- there will be more vertices in the graph than there are syntactic
- vertices and the order may be quite different. For theses reaons,
- you must use this function to convert a vertex index into the
- digraph g into a pgfgd_Vertex object. It may happen that the index
- does not refer to any syntactic vertex, in this case 0 is
- returned.
-
- Note that v is an index into a Lua array and, thus, numbering
- starts with 1.
-*/
-extern pgfgd_Vertex* pgfgd_digraph_syntactic_vertex (pgfgd_Digraph* g, int v);
-
-/** Tests whether there is an arc between two vertices in the digraph
- g. The tail and head are indices starting with 1. This operation
- takes time $O(1)$.
-*/
-extern int pgfgd_digraph_isarc (pgfgd_Digraph* g, int tail, int head);
-
-/** Returns an array of all syntactic edges present between two
- vertices (whose indices are given as input). You must free the
- returned array explicitly using
- pgfgd_digraph_free_edge_array. Typically, this array will have at
- most one entry, but it may happen that the user has specified
- several syntatic edges between the same vertices, in which case
- you get a larger array here.
-
- Note that tail and head are indices (starting with 1) into the
- digraph's vertices array, which the return value is an array of
- syntactic edges present in the syntactic digraph between the
- vertices corresponding to these indices. In particular, if the
- vertices do not correspond to syntactic vertices, the returned
- array will always be empty.
-*/
-extern pgfgd_Edge_array* pgfgd_digraph_syntactic_edges (pgfgd_Digraph* g, int tail, int head);
-
-/** Returns an array of all incoming arcs of the given vertex. (As
- always, the vertex is coded as an index starting with 1 into the
- vertices array of the digraph.) You must free this array
- yourself using pgfgd_digraph_free_arc_array. In the returned
- array, all entries of the head array will equal v.
- */
-extern pgfgd_Arc_array* pgfgd_digraph_incoming (pgfgd_Digraph* g, int v);
-
-/** Like pgfgd_digraph_incoming. */
-extern pgfgd_Arc_array* pgfgd_digraph_outgoing (pgfgd_Digraph* g, int v);
-
-/** Frees a pgfgd_Digraph object previously allocated by the
- pgfgd_get_digraph function. */
-extern void pgfgd_digraph_free (pgfgd_Digraph* d);
-
-/** Frees a pgfgd_Arc_array object; in particular, the arrays stored
- inside it are freed. You should call this function once at some
- point for all objects of this kind returned by any library function.
-*/
-extern void pgfgd_digraph_free_arc_array (pgfgd_Arc_array* arcs);
-
-/** Like pgfgd_digraph_free_arc_array, but for the Edge arrays
- returned by pgfgd_digraph_syntactic_edges. Do not call this
- function for the syntactic_edges field of a syntactic digraph.
-*/
-extern void pgfgd_digraph_free_edge_array (pgfgd_Edge_array* edges);
-
-
-
-// Declarations
-
-struct lua_State;
-typedef void (*pgfgd_algorithm_fun) (pgfgd_SyntacticDigraph* component, void* user_data);
-typedef struct pgfgd_Declaration pgfgd_Declaration;
-
-
-/** Each declaration of a new option starts with a call to this
- function. The function returns an object whose properties you can
- set subsequently through the pgfgd_key_xxx function. Once all
- properties of the key have been set, you call pgfgd_declare to
- make Lua aware of the option. Then, you need to call
- pgfgd_free_key on it.
- */
-
-extern pgfgd_Declaration* pgfgd_new_key (const char* key);
-
-/** Sets the summary field of the key. You should always call this
- function. */
-extern void pgfgd_key_summary (pgfgd_Declaration* d, const char* s);
-
-/** Sets the type field of the key. */
-extern void pgfgd_key_type (pgfgd_Declaration* d, const char* s);
-
-/** Sets the initial field of the key to a string. */
-extern void pgfgd_key_initial (pgfgd_Declaration* d, const char* s);
-
-/** Sets the initial field of the key to void* value (a light userdata
- in Lua-speak). */
-extern void pgfgd_key_initial_user (pgfgd_Declaration* d, void* v);
-
-/** Sets the default field of the key. */
-extern void pgfgd_key_default (pgfgd_Declaration* d, const char* s);
-
-/** Sets the alias field of the key. */
-extern void pgfgd_key_alias (pgfgd_Declaration* d, const char* s);
-
-/** Sets the alias_function_string field of the key. */
-extern void pgfgd_key_alias_function (pgfgd_Declaration* d, const char* s);
-
-/** Sets the documentation field of the key. */
-extern void pgfgd_key_documentation (pgfgd_Declaration* d, const char* s);
-
-/** Sets the documentation_in field of the key. */
-extern void pgfgd_key_documentation_in (pgfgd_Declaration* d, const char* s);
-
-/** Sets the phase field of the key. */
-extern void pgfgd_key_phase (pgfgd_Declaration* d, const char* s);
-
-/** Sets the algorithm field of the key. The function f must conform
- to the function prototype pgfgd_algorithm_fun, which prescribes
- that the function takes a syntactic digraph as input
- (pgfgd_SyntacticDigraph*) and some user data and does not return
- anything. The user data that is passed to the function is the
- datum passed here.
-
- Whenever the key is now used on the Lua layer, the graph drawing
- system will run the normal layout pipeline on the graph. Then, at
- some point, it would call the actual Lua graph drawing
- algorithm. At that point, the function f is called instead. The
- parameter of this function will be a representation of the
- to-be-drawn syntatic digraph as a C pgfgd_SyntacticDigraph.
-*/
-extern void pgfgd_key_algorithm (pgfgd_Declaration* d,
- pgfgd_algorithm_fun f,
- void* user_data);
-
-/** Adds a use to the key. This means that whenever the key is used,
- the given key--value pairs will also be set. This is used, in
- particular, to create aliases for keys (but is not to be confused
- with the |alias| field, whose semantics are slightly different).
- */
-extern void pgfgd_key_add_use (pgfgd_Declaration* d, const char* key, const char* value);
-
-/** Adds a use to the key, but with the value being a user value in
- Lua-speak.
- */
-extern void pgfgd_key_add_use_user (pgfgd_Declaration* d, const char* key, void* value);
-
-/** Adds an example to the examples field of the key. */
-extern void pgfgd_key_add_example (pgfgd_Declaration* d, const char* s);
-
-/** Adds a precondition (the field s of the precondition table is set
- to true) to the key. */
-extern void pgfgd_key_add_precondition (pgfgd_Declaration* d, const char* s);
-
-/** Adds a postcondition to the key. */
-extern void pgfgd_key_add_postcondition (pgfgd_Declaration* d, const char* s);
-
-/** After all properties of an option key have been set, call this
- function once to actually declare the key inside the state that
- your graph drawing library's main function gets
- passed by the Lua dynamic linkage code. */
-extern void pgfgd_declare (struct lua_State* s, pgfgd_Declaration* d);
-
-/** Frees the memory used by the key object. */
-extern void pgfgd_free_key (pgfgd_Declaration* d);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/graphics/pgf/base/source/InterfaceFromOGDF.c++ b/graphics/pgf/base/source/InterfaceFromOGDF.c++
deleted file mode 100644
index 248ee0b19e..0000000000
--- a/graphics/pgf/base/source/InterfaceFromOGDF.c++
+++ /dev/null
@@ -1,105 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <pgf/gd/interface/c/InterfaceFromC.h>
-
-#include <ogdf/basic/geometry.h>
-
-
-using namespace ogdf;
-
-namespace scripting {
-
-
- void ogdf_runner::bridge ()
- {
- graph = Graph();
- graph_attributes = GraphAttributes (graph,
- GraphAttributes::nodeGraphics |
- GraphAttributes::edgeGraphics |
- GraphAttributes::nodeLevel |
- GraphAttributes::edgeIntWeight |
- GraphAttributes::edgeDoubleWeight |
- GraphAttributes::nodeWeight);
-
- pgfgd_SyntacticDigraph* g = parameters->syntactic_digraph;
-
- int n = g->vertices.length;
- int m = g->syntactic_edges.length;
-
- node* nodes = new node [n];
-
- for (int i=0; i < n; i++) {
- nodes[i] = graph.newNode();
-
- // Compute width and height
- double x1, x2,y1,y2;
- x1 = x2 = y1 = y2 = 0;
-
- int first = 1;
-
- pgfgd_Path* path = g->vertices.array[i]->path;
-
- for (int j = 1; j < path->length; j++)
- if (!path->strings[j]) {
- double x = path->coordinates[j].x;
- double y = path->coordinates[j].y;
-
- if (first) {
- x1 = x2 = x;
- y1 = y2 = y;
- first = 0;
- } else {
- x1 = x < x1 ? x : x1;
- x2 = x > x2 ? x : x2;
- y1 = y < y1 ? y : y1;
- y2 = y > y2 ? y : y2;
- }
- }
-
- graph_attributes.width(nodes[i]) = x2-x1;
- graph_attributes.height(nodes[i]) = y2-y1;
- }
-
- for (int i=0; i < m; i++) {
- int tail = g->syntactic_edges.array[i]->tail->array_index;
- int head = g->syntactic_edges.array[i]->head->array_index;
-
- graph.newEdge(nodes[tail], nodes[head]);
- }
- }
-
- void ogdf_runner::unbridge ()
- {
- pgfgd_SyntacticDigraph* g = parameters->syntactic_digraph;
-
- node v;
- int i;
- for (i = 0, v = graph.firstNode(); v; v=v->succ(), i++) {
- g->vertices.array[i]->pos.x = graph_attributes.x(v);
- g->vertices.array[i]->pos.y = graph_attributes.y(v);
- }
-
- edge e;
- for (i = 0, e = graph.firstEdge(); e; e=e->succ(), i++) {
- pgfgd_Edge* ed = g->syntactic_edges.array[i];
-
- DPolyline bend = graph_attributes.bends(e);
-
- if (bend.begin().valid()) {
- bend.unify();
- bend.normalize();
-
- // We start with a moveto:
- pgfgd_path_clear (ed);
-
- pgfgd_path_append_moveto_tail(ed);
-
- for (List<DPoint>::iterator it = bend.begin(); it.valid(); it++)
- pgfgd_path_append_lineto(ed, (*it).m_x, (*it).m_y);
-
- // We end with a lineto:
- pgfgd_path_append_lineto_head(ed);
- }
- }
- }
-
-}
diff --git a/graphics/pgf/base/source/InterfaceFromOGDF.h b/graphics/pgf/base/source/InterfaceFromOGDF.h
deleted file mode 100644
index bd742eb161..0000000000
--- a/graphics/pgf/base/source/InterfaceFromOGDF.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PGF_GD_INTERFACE_C_INTERFACEFROMOGDF_H
-#define PGF_GD_INTERFACE_C_INTERFACEFROMOGDF_H
-
-/** \file pgf/gd/interface/c/InterfaceFromOGDF.h
-
- The C++-header file that should be used by algorithms written
- for the OGFD library when the algorithm should be included in Lua.
-*/
-
-#include <pgf/gd/interface/c/InterfaceFromC++.h>
-#include <ogdf/basic/Graph.h>
-#include <ogdf/basic/GraphAttributes.h>
-
-namespace scripting {
-
- class ogdf_runner : public runner {
- public:
-
- void bridge ();
- void unbridge ();
-
- protected:
-
- ogdf::Graph graph;
- ogdf::GraphAttributes graph_attributes;
-
- };
-
-
- class ogdf_function_runner : public ogdf_runner {
- public:
- typedef void (*function) (run_parameters&,
- ogdf::Graph&,
- ogdf::GraphAttributes&);
-
- ogdf_function_runner (function f) : fun(f) {}
- virtual void run () { fun(*parameters, graph, graph_attributes); }
-
- private:
- function fun;
- };
-}
-
-
-#endif
diff --git a/graphics/pgf/base/source/LocalBiconnectedMerger_script.h b/graphics/pgf/base/source/LocalBiconnectedMerger_script.h
deleted file mode 100644
index 898822e0c0..0000000000
--- a/graphics/pgf/base/source/LocalBiconnectedMerger_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.h>
-
-struct LocalBiconnectedMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::LocalBiconnectedMerger>
-{
- ogdf::LocalBiconnectedMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- LocalBiconnectedMerger* r = new LocalBiconnectedMerger;
-
- parameters->configure_option ("LocalBiconnectedMerger.factor",
- &LocalBiconnectedMerger::setFactor, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("LocalBiconnectedMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.LocalBiconnectedMerger"));
-
- s.declare (key ("LocalBiconnectedMerger.factor")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.LocalBiconnectedMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/LongestPathRanking_script.h b/graphics/pgf/base/source/LongestPathRanking_script.h
deleted file mode 100644
index ca2e634485..0000000000
--- a/graphics/pgf/base/source/LongestPathRanking_script.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/LongestPathRanking.h>
-
-struct LongestPathRanking_script :
- scripting::declarations,
- scripting::factory<ogdf::LongestPathRanking>
-{
-
- ogdf::LongestPathRanking* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- LongestPathRanking* r = new LongestPathRanking;
-
- parameters->configure_option ("LongestPathRanking.separateDeg0Layer",
- &LongestPathRanking::separateDeg0Layer, *r);
- parameters->configure_option ("LongestPathRanking.separateMultiEdges",
- &LongestPathRanking::separateMultiEdges, *r);
- parameters->configure_option ("LongestPathRanking.optimizeEdgeLength",
- &LongestPathRanking::optimizeEdgeLength, *r);
-
- parameters->configure_module ("AcyclicSubgraphModule",
- &LongestPathRanking::setSubgraph, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("LongestPathRanking")
- .documentation_in ("pgf.gd.doc.ogdf.layered.LongestPathRanking")
- .set_module ("RankingModule", this));
-
- s.declare (key ("LongestPathRanking.separateDeg0Layer")
- .type ("boolean")
- .initial ("true")
- .documentation_in ("pgf.gd.doc.ogdf.layered.LongestPathRanking"));
-
- s.declare (key ("LongestPathRanking.separateMultiEdges")
- .type ("boolean")
- .initial ("true")
- .documentation_in ("pgf.gd.doc.ogdf.layered.LongestPathRanking"));
-
- s.declare (key ("LongestPathRanking.optimizeEdgeLength")
- .type ("boolean")
- .initial ("true")
- .documentation_in ("pgf.gd.doc.ogdf.layered.LongestPathRanking"));
- }
-};
-
-
diff --git a/graphics/pgf/base/source/MakefileConfig.mk b/graphics/pgf/base/source/MakefileConfig.mk
deleted file mode 100644
index 25310b6987..0000000000
--- a/graphics/pgf/base/source/MakefileConfig.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-
-# Where Lua is installed
-LUAPATH=/usr/local/lua52
-
-LUAINCLUDES = $(LUAPATH)/include
-LUALIBPATH = $(LUAPATH)/lib
-
-
-# Where ogdf is installed
-OGDFPATH=/usr/local/ogdf
-
-OGDFINCLUDES = $(OGDFPATH)
-OGDFLIBPATH = $(OGDFPATH)/_release
-
-
-# Where the pgf C includes are found
-PGFINCLUDES=../../../..
-
-
-# Where the shared libraries should be installed (base dir)
-INSTALLDIR=/usr/texbin/lib/luatex/lua
-
-
-# If you need special flags:
-MYCFLAGS=
-MYLDFLAGS=
-
-# Link flags for building a shared library
-SHAREDFLAGS=
-
-# Link flags for linking against the shared Lua lib
-LINKSHAREDLUA=
-
-# Architecture flags:
-ARCHFLAGS=
-
-# The to-be-used compiler
-CC=gcc
-
-
-# Now read local definition, which may overwrite the above
--include $(CONFIGDIR)/LocalMakefileConfig.mk
-
-
-
diff --git a/graphics/pgf/base/source/MatchingMerger_script.h b/graphics/pgf/base/source/MatchingMerger_script.h
deleted file mode 100644
index 1d50c273cd..0000000000
--- a/graphics/pgf/base/source/MatchingMerger_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/MatchingMerger.h>
-
-struct MatchingMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::MatchingMerger>
-{
- ogdf::MatchingMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- MatchingMerger* r = new MatchingMerger;
-
- parameters->configure_option ("MatchingMerger.selectByNodeMass",
- &MatchingMerger::selectByNodeMass, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("MatchingMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.MatchingMerger"));
-
- s.declare (key ("MatchingMerger.selectByNodeMass")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.MatchingMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/MedianHeuristic_script.h b/graphics/pgf/base/source/MedianHeuristic_script.h
deleted file mode 100644
index 8ce4a610e7..0000000000
--- a/graphics/pgf/base/source/MedianHeuristic_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/MedianHeuristic.h>
-
-struct MedianHeuristic_script :
- scripting::declarations,
- scripting::factory<ogdf::MedianHeuristic>
-{
-
- ogdf::MedianHeuristic* make (scripting::run_parameters* parameters) {
- return new ogdf::MedianHeuristic;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("MedianHeuristic")
- .documentation_in ("pgf.gd.doc.ogdf.layered.MedianHeuristic")
- .set_module ("TwoLayerCrossMin", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/MedianPlacer_script.h b/graphics/pgf/base/source/MedianPlacer_script.h
deleted file mode 100644
index 4670554393..0000000000
--- a/graphics/pgf/base/source/MedianPlacer_script.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/MedianPlacer.h>
-
-struct MedianPlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::MedianPlacer>
-{
- ogdf::MedianPlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- MedianPlacer* r = new MedianPlacer;
-
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("MedianPlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.MedianPlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/MultilevelLayout_script.h b/graphics/pgf/base/source/MultilevelLayout_script.h
deleted file mode 100644
index 091ab9766c..0000000000
--- a/graphics/pgf/base/source/MultilevelLayout_script.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/MultilevelLayout.h>
-
-struct MultilevelLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- MultilevelLayout layout;
-
- parameters->configure_module ("LayoutModule",
- &MultilevelLayout::setLayout, layout);
- parameters->configure_module ("MultilevelBuilder",
- &MultilevelLayout::setMultilevelBuilder, layout);
- parameters->configure_module ("InitialPlacer",
- &MultilevelLayout::setPlacer, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("MultilevelLayout")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.MultilevelLayout"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/OptimalRanking_script.h b/graphics/pgf/base/source/OptimalRanking_script.h
deleted file mode 100644
index f35fc67da7..0000000000
--- a/graphics/pgf/base/source/OptimalRanking_script.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/OptimalRanking.h>
-
-struct OptimalRanking_script :
- scripting::declarations,
- scripting::factory<ogdf::OptimalRanking>
-{
-
- ogdf::OptimalRanking* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- OptimalRanking* r = new OptimalRanking;
-
- parameters->configure_option ("OptimalRanking.separateMultiEdges",
- &OptimalRanking::separateMultiEdges, *r);
- parameters->configure_module ("AcyclicSubgraphModule",
- &OptimalRanking::setSubgraph, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("OptimalRanking")
- .documentation_in ("pgf.gd.doc.ogdf.layered.OptimalRanking")
- .set_module ("RankingModule", this));
-
- s.declare (key ("OptimalRanking.separateMultiEdges")
- .type ("boolean")
- .initial ("true")
- .documentation_in ("pgf.gd.doc.ogdf.layered.OptimalRanking"));
- }
-};
-
diff --git a/graphics/pgf/base/source/PlanarizationLayout_script.h b/graphics/pgf/base/source/PlanarizationLayout_script.h
deleted file mode 100644
index 4fa89d5d19..0000000000
--- a/graphics/pgf/base/source/PlanarizationLayout_script.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/planarity/PlanarizationLayout.h>
-
-struct PlanarizationLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
-
- void run () {
- using namespace ogdf;
- PlanarizationLayout layout;
-
- parameters->configure_option ("PlanarizationLayout.preprocessCliques",
- &PlanarizationLayout::preprocessCliques, layout);
- parameters->configure_option ("PlanarizationLayout.minCliqueSize",
- &PlanarizationLayout::minCliqueSize, layout);
-
- // .. TODO: configure modules
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("PlanarizationLayout")
- .precondition ("connected")
- .postcondition ("fixed")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.planarity.PlanarizationLayout"));
-
- s.declare (key ("PlanarizationLayout.preprocessCliques")
- .type ("boolean")
- .initial ("false")
- .documentation_in ("pgf.gd.doc.ogdf.planarity.PlanarizationLayout"));
-
- s.declare (key ("PlanarizationLayout.minCliqueSize")
- .type ("number")
- .initial ("10")
- .documentation_in ("pgf.gd.doc.ogdf.planarity.PlanarizationLayout"));
- }
-
-};
diff --git a/graphics/pgf/base/source/RandomMerger_script.h b/graphics/pgf/base/source/RandomMerger_script.h
deleted file mode 100644
index 8acc53bbef..0000000000
--- a/graphics/pgf/base/source/RandomMerger_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/RandomMerger.h>
-
-struct RandomMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::RandomMerger>
-{
- ogdf::RandomMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- RandomMerger* r = new RandomMerger;
-
- parameters->configure_option ("RandomMerger.factor",
- &RandomMerger::setFactor, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("RandomMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.RandomMerger"));
-
- s.declare (key ("RandomMerger.factor")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.RandomMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/RandomPlacer_script.h b/graphics/pgf/base/source/RandomPlacer_script.h
deleted file mode 100644
index a92873ff47..0000000000
--- a/graphics/pgf/base/source/RandomPlacer_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/RandomPlacer.h>
-
-struct RandomPlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::RandomPlacer>
-{
- ogdf::RandomPlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- RandomPlacer* r = new RandomPlacer;
-
- parameters->configure_option ("RandomPlacer.circleSize",
- &RandomPlacer::setCircleSize, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("RandomPlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.RandomPlacer"));
-
- s.declare (key ("RandomPlacer.circleSize")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.RandomPlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SiftingHeuristic_script.h b/graphics/pgf/base/source/SiftingHeuristic_script.h
deleted file mode 100644
index 653432f52b..0000000000
--- a/graphics/pgf/base/source/SiftingHeuristic_script.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/SiftingHeuristic.h>
-
-struct SiftingHeuristic_script :
- scripting::declarations,
- scripting::factory<ogdf::SiftingHeuristic>
-{
-
- ogdf::SiftingHeuristic* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
-
- SiftingHeuristic* h = new SiftingHeuristic;
-
- char* strategy = 0;
-
- if (parameters->option("SiftingHeuristic.strategy", strategy)) {
- if (strcmp(strategy, "left_to_right") == 0)
- h->strategy(SiftingHeuristic::left_to_right);
- else if (strcmp(strategy, "desc_degree") == 0)
- h->strategy(SiftingHeuristic::desc_degree);
- else if (strcmp(strategy, "random") == 0)
- h->strategy(SiftingHeuristic::random);
-
- free(strategy);
- }
- return h;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("SiftingHeuristic")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SiftingHeuristic")
- .set_module ("TwoLayerCrossMin", this));
-
- s.declare (key ("SiftingHeuristic.strategy")
- .type ("string")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SiftingHeuristic"));
- }
-};
-
diff --git a/graphics/pgf/base/source/SimpleDemoC.c b/graphics/pgf/base/source/SimpleDemoC.c
deleted file mode 100644
index 18e5889ad1..0000000000
--- a/graphics/pgf/base/source/SimpleDemoC.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <pgf/gd/interface/c/InterfaceFromC.h>
-#include <math.h>
-
-static void fast_hello_world (pgfgd_SyntacticDigraph* graph, void* v) {
- double angle = 6.28318530718 / graph->vertices.length;
- double radius = pgfgd_tonumber(graph->options, "fast simple demo radius");
-
- int i;
- for (i = 0; i < graph->vertices.length; i++) {
- pgfgd_Vertex* v = graph->vertices.array[i];
- v->pos.x = cos(angle*i) * radius;
- v->pos.y = sin(angle*i) * radius;
- }
-}
-
-int luaopen_pgf_gd_examples_c_SimpleDemoC (struct lua_State *state) {
- pgfgd_Declaration* d;
-
- // The main layout key
- d = pgfgd_new_key ("fast simple demo layout");
- pgfgd_key_summary (d, "The C version of the hello world of graph drawing.");
- pgfgd_key_algorithm (d, fast_hello_world, 0);
- pgfgd_key_documentation (d,
- "Just like the |SimpleDemo| algorithm, this algorithm arranges \
- the nodes of a graph in a circle (without paying heed to the sizes of the \
- nodes or to the edges). Its main purpose is to show how C code \
- can access the Lua representation of graphs. See \
- Section~\ref{section-algorithms-in-c} of the manual for detais.");
- pgfgd_key_add_precondition (d, "connected");
- pgfgd_declare (state, d);
- pgfgd_free_key (d);
-
- // The radius key
- d = pgfgd_new_key ("fast simple demo radius");
- pgfgd_key_summary (d, "A radius value for the hello world of graph drawing");
- pgfgd_key_type (d, "length");
- pgfgd_key_initial (d, "1cm");
- pgfgd_declare (state, d);
- pgfgd_free_key (d);
-
- return 0;
-}
diff --git a/graphics/pgf/base/source/SimpleDemoCPlusPlus.c++ b/graphics/pgf/base/source/SimpleDemoCPlusPlus.c++
deleted file mode 100644
index 0c810d2570..0000000000
--- a/graphics/pgf/base/source/SimpleDemoCPlusPlus.c++
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <pgf/gd/interface/c/InterfaceFromC++.h>
-#include <pgf/gd/interface/c/InterfaceFromC.h>
-
-#include <math.h>
-
-
-struct FastLayout : scripting::declarations, scripting::runner {
-
- void run () {
- pgfgd_SyntacticDigraph* graph = parameters->syntactic_digraph;
-
- double angle = 6.28318530718 / graph->vertices.length;
- double radius = parameters->option<double>("fast simple demo radius c++");
-
- for (int i = 0; i < graph->vertices.length; i++) {
- pgfgd_Vertex* v = graph->vertices.array[i];
- v->pos.x = cos(angle*i) * radius;
- v->pos.y = sin(angle*i) * radius;
- }
- }
-
- void declare(scripting::script s) {
- using namespace scripting;
-
- s.declare(key ("fast simple demo layout c++")
- .summary ("The C++ version of the hello world of graph drawing")
- .precondition ("connected")
- .precondition ("tree")
- .algorithm (this));
-
- s.declare(key ("fast simple demo radius c++")
- .summary ("A radius value for the hello world of graph drawing")
- .type ("length")
- .initial ("1cm"));
- }
-
-};
-
-extern "C" int luaopen_pgf_gd_examples_c_SimpleDemoCPlusPlus (struct lua_State *state) {
-
- scripting::script s (state);
-
- s.declare (new FastLayout);
-
- return 0;
-}
-
diff --git a/graphics/pgf/base/source/SimpleDemoOGDF.c++ b/graphics/pgf/base/source/SimpleDemoOGDF.c++
deleted file mode 100644
index b7d914c520..0000000000
--- a/graphics/pgf/base/source/SimpleDemoOGDF.c++
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include <math.h>
-
-using namespace ogdf;
-using namespace scripting;
-
-struct FastLayoutOGDF : declarations, ogdf_runner {
-
- void run () {
- double angle = 6.28318530718 / graph.numberOfNodes();
- double radius = parameters->option<double>("my radius ogdf");
-
- int i = 0;
- for (node v = graph.firstNode(); v; v=v->succ(), i++) {
- graph_attributes.x(v) = cos(angle*i) * radius;
- graph_attributes.y(v) = sin(angle*i) * radius;
- }
- }
-
- void declare(script s) {
- using namespace scripting;
-
- s.declare(key ("fast simple demo layout ogdf")
- .summary ("The OGDF version of the hello world of graph drawing")
- .precondition ("connected")
- .algorithm (this));
-
- s.declare(key ("my radius ogdf")
- .summary ("A radius value for the hello world of graph drawing")
- .type ("length")
- .initial ("1cm"));
- }
-
-};
-
-extern "C" int luaopen_pgf_gd_ogdf_c_SimpleDemoOGDF (struct lua_State *state) {
-
- script (state).declare (new FastLayoutOGDF);
-
- return 0;
-}
-
diff --git a/graphics/pgf/base/source/SolarMerger_script.h b/graphics/pgf/base/source/SolarMerger_script.h
deleted file mode 100644
index 8453241bd6..0000000000
--- a/graphics/pgf/base/source/SolarMerger_script.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/SolarMerger.h>
-
-struct SolarMerger_script :
- scripting::declarations,
- scripting::factory<ogdf::SolarMerger>
-{
- ogdf::SolarMerger* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- SolarMerger* r = new SolarMerger (parameters->option<bool>("SolarMerger.simple"),
- parameters->option<bool>("SolarMerger.massAsNodeRadius"));
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("SolarMerger")
- .set_module ("MultilevelBuilder", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.SolarMerger"));
-
- s.declare (key ("SolarMerger.simple")
- .type ("boolean")
- .initial ("false")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.SolarMerger"));
-
- s.declare (key ("SolarMerger.massAsNodeRadius")
- .type ("boolean")
- .initial ("false")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.SolarMerger"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SolarPlacer_script.h b/graphics/pgf/base/source/SolarPlacer_script.h
deleted file mode 100644
index 5f9191251c..0000000000
--- a/graphics/pgf/base/source/SolarPlacer_script.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/SolarPlacer.h>
-
-struct SolarPlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::SolarPlacer>
-{
- ogdf::SolarPlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- SolarPlacer* r = new SolarPlacer;
-
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("SolarPlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.SolarPlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SplitHeuristic_script.h b/graphics/pgf/base/source/SplitHeuristic_script.h
deleted file mode 100644
index 6799be36e9..0000000000
--- a/graphics/pgf/base/source/SplitHeuristic_script.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/SplitHeuristic.h>
-
-struct SplitHeuristic_script :
- scripting::declarations,
- scripting::factory<ogdf::SplitHeuristic>
-{
-
- ogdf::SplitHeuristic* make (scripting::run_parameters* parameters) {
- return new ogdf::SplitHeuristic;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- s.declare (key ("SplitHeuristic")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SplitHeuristic")
- .set_module ("TwoLayerCrossMin", this));
- }
-};
-
diff --git a/graphics/pgf/base/source/SpringEmbedderFRExact_script.h b/graphics/pgf/base/source/SpringEmbedderFRExact_script.h
deleted file mode 100644
index 4e9fbfb3f1..0000000000
--- a/graphics/pgf/base/source/SpringEmbedderFRExact_script.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/SpringEmbedderFRExact.h>
-
-struct SpringEmbedderFRExact_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- SpringEmbedderFRExact layout;
-
- parameters->configure_option ("SpringEmbedderFRExact.iterations",
- &SpringEmbedderFRExact::iterations, layout);
- parameters->configure_option ("SpringEmbedderFRExact.noise",
- &SpringEmbedderFRExact::noise, layout);
- parameters->configure_option ("SpringEmbedderFRExact.idealEdgeLength",
- &SpringEmbedderFRExact::idealEdgeLength, layout);
- parameters->configure_option ("SpringEmbedderFRExact.convTolerance",
- &SpringEmbedderFRExact::convTolerance, layout);
-
- char* s = 0;
-
- if (parameters->option("SpringEmbedderFRExact.coolingFunction", s)) {
- if (strcmp(s, "factor") == 0)
- layout.coolingFunction(SpringEmbedderFRExact::cfFactor);
- else if (strcmp(s, "logarithmic") == 0)
- layout.coolingFunction(SpringEmbedderFRExact::cfLogarithmic);
-
- free(s);
- }
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("SpringEmbedderFRExact")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- s.declare (key ("SpringEmbedderFRExact.iterations")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- s.declare (key ("SpringEmbedderFRExact.noise")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- s.declare (key ("SpringEmbedderFRExact.coolingFunction")
- .type ("string")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- s.declare (key ("SpringEmbedderFRExact.idealEdgeLength")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- s.declare (key ("SpringEmbedderFRExact.convTolerance")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SpringEmbedderFR_script.h b/graphics/pgf/base/source/SpringEmbedderFR_script.h
deleted file mode 100644
index 5ae182e589..0000000000
--- a/graphics/pgf/base/source/SpringEmbedderFR_script.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/SpringEmbedderFR.h>
-
-struct SpringEmbedderFR_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- SpringEmbedderFR layout;
-
- parameters->configure_option ("SpringEmbedderFR.iterations",
- &SpringEmbedderFR::iterations, layout);
- parameters->configure_option ("SpringEmbedderFR.noise",
- &SpringEmbedderFR::noise, layout);
- parameters->configure_option ("SpringEmbedderFR.scaleFunctionFactor",
- &SpringEmbedderFR::scaleFunctionFactor, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("SpringEmbedderFR")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFR"));
-
- s.declare (key ("SpringEmbedderFR.iterations")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFR"));
-
- s.declare (key ("SpringEmbedderFR.noise")
- .type ("boolean")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFR"));
-
- s.declare (key ("SpringEmbedderFR.scaleFunctionFactor")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFR"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SpringEmbedderKK_script.h b/graphics/pgf/base/source/SpringEmbedderKK_script.h
deleted file mode 100644
index 2b1586a546..0000000000
--- a/graphics/pgf/base/source/SpringEmbedderKK_script.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/SpringEmbedderKK.h>
-
-struct SpringEmbedderKK_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- SpringEmbedderKK layout;
-
- parameters->configure_option ("SpringEmbedderKK.stopTolerance",
- &SpringEmbedderKK::setStopTolerance, layout);
- parameters->configure_option ("SpringEmbedderKK.desLength",
- &SpringEmbedderKK::setDesLength, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("SpringEmbedderKK")
- .precondition ("connected")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderKK"));
-
- s.declare (key ("SpringEmbedderKK.stopTolerance")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderKK"));
-
- s.declare (key ("SpringEmbedderKK.desLength")
- .type ("length")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderKK"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/SugiyamaLayout_script.h b/graphics/pgf/base/source/SugiyamaLayout_script.h
deleted file mode 100644
index c9cf097373..0000000000
--- a/graphics/pgf/base/source/SugiyamaLayout_script.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/layered/SugiyamaLayout.h>
-
-struct SugiyamaLayout_script :
- scripting::declarations,
- scripting::ogdf_runner
-{
- void run () {
- using namespace ogdf;
- SugiyamaLayout layout;
-
- parameters->configure_option ("SugiyamaLayout.runs",
- &SugiyamaLayout::runs, layout);
- parameters->configure_option ("SugiyamaLayout.transpose",
- &SugiyamaLayout::transpose, layout);
- parameters->configure_option ("SugiyamaLayout.fails",
- &SugiyamaLayout::fails, layout);
-
- parameters->configure_module ("RankingModule",
- &SugiyamaLayout::setRanking, layout);
- parameters->configure_module ("TwoLayerCrossMin",
- &SugiyamaLayout::setCrossMin, layout);
- parameters->configure_module ("HierarchyLayoutModule",
- &SugiyamaLayout::setLayout, layout);
-
- layout.call (graph_attributes);
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
- s.declare (key ("SugiyamaLayout")
- .precondition ("connected")
- .postcondition ("upward_oriented_swapped")
- .algorithm (this)
- .documentation_in ("pgf.gd.doc.ogdf.layered.SugiyamaLayout"));
-
- s.declare (key ("SugiyamaLayout.runs")
- .type ("number")
- .initial ("15")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SugiyamaLayout"));
-
- s.declare (key ("SugiyamaLayout.transpose")
- .type ("boolean")
- .initial ("true")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SugiyamaLayout"));
-
- s.declare (key ("SugiyamaLayout.fails")
- .type ("number")
- .initial ("4")
- .documentation_in ("pgf.gd.doc.ogdf.layered.SugiyamaLayout"));
- }
-
-};
diff --git a/graphics/pgf/base/source/ZeroPlacer_script.h b/graphics/pgf/base/source/ZeroPlacer_script.h
deleted file mode 100644
index 255ac34bd8..0000000000
--- a/graphics/pgf/base/source/ZeroPlacer_script.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-#include <ogdf/energybased/multilevelmixer/ZeroPlacer.h>
-
-struct ZeroPlacer_script :
- scripting::declarations,
- scripting::factory<ogdf::ZeroPlacer>
-{
- ogdf::ZeroPlacer* make (scripting::run_parameters* parameters) {
- using namespace ogdf;
- ZeroPlacer* r = new ZeroPlacer;
-
- parameters->configure_option ("ZeroPlacer.randomRange",
- &ZeroPlacer::setRandomRange, *r);
-
- return r;
- }
-
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (key ("ZeroPlacer")
- .set_module ("InitialPlacer", this)
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.ZeroPlacer"));
-
- s.declare (key ("ZeroPlacer.randomRange")
- .type ("number")
- .documentation_in ("pgf.gd.doc.ogdf.energybased.multilevelmixer.ZeroPlacer"));
-
- }
-
-};
diff --git a/graphics/pgf/base/source/energybased_script.h b/graphics/pgf/base/source/energybased_script.h
deleted file mode 100644
index fdcd92565e..0000000000
--- a/graphics/pgf/base/source/energybased_script.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "FMMMLayout_script.h"
-#include "GEMLayout_script.h"
-#include "FastMultipoleEmbedder_script.h"
-
-#include "SpringEmbedderFR_script.h"
-#include "SpringEmbedderFRExact_script.h"
-#include "SpringEmbedderKK_script.h"
-
-#include "MultilevelLayout_script.h"
-
-#include "multilevelmixer/multilevelmixer_script.h"
-
-struct energybased_script :
- scripting::declarations
-{
- void declare (scripting::script s) {
- s.declare (new FMMMLayout_script);
- s.declare (new GEMLayout_script);
- s.declare (new FastMultipoleEmbedder_script);
-
- s.declare (new SpringEmbedderFR_script);
- s.declare (new SpringEmbedderFRExact_script);
- s.declare (new SpringEmbedderKK_script);
-
- s.declare (new MultilevelLayout_script);
-
- s.declare (new multilevelmixer_script);
- }
-};
diff --git a/graphics/pgf/base/source/layered_script.h b/graphics/pgf/base/source/layered_script.h
deleted file mode 100644
index 8a117f1fc6..0000000000
--- a/graphics/pgf/base/source/layered_script.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "SugiyamaLayout_script.h"
-
-#include "LongestPathRanking_script.h"
-#include "OptimalRanking_script.h"
-#include "CoffmanGrahamRanking_script.h"
-
-#include "DfsAcyclicSubgraph_script.h"
-#include "GreedyCycleRemoval_script.h"
-
-#include "BarycenterHeuristic_script.h"
-#include "GreedyInsertHeuristic_script.h"
-#include "SiftingHeuristic_script.h"
-#include "MedianHeuristic_script.h"
-#include "SplitHeuristic_script.h"
-
-#include "FastHierarchyLayout_script.h"
-#include "FastSimpleHierarchyLayout_script.h"
-
-struct layered_script :
- scripting::declarations
-{
- void declare (scripting::script s) {
- using namespace scripting;
- using namespace ogdf;
-
- s.declare (new SugiyamaLayout_script);
-
- s.declare (new LongestPathRanking_script);
- s.declare (new OptimalRanking_script);
- s.declare (new CoffmanGrahamRanking_script);
-
- s.declare (new DfsAcyclicSubgraph_script);
- s.declare (new GreedyCycleRemoval_script);
-
- s.declare (new BarycenterHeuristic_script);
- s.declare (new GreedyInsertHeuristic_script);
- s.declare (new SiftingHeuristic_script);
- s.declare (new MedianHeuristic_script);
- s.declare (new SplitHeuristic_script);
-
- s.declare (new FastHierarchyLayout_script);
- s.declare (new FastSimpleHierarchyLayout_script);
- }
-};
diff --git a/graphics/pgf/base/source/misclayout_script.h b/graphics/pgf/base/source/misclayout_script.h
deleted file mode 100644
index 22ac039b7f..0000000000
--- a/graphics/pgf/base/source/misclayout_script.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "BalloonLayout_script.h"
-#include "CircularLayout_script.h"
-
-struct misclayout_script :
- scripting::declarations
-{
- void declare (scripting::script s) {
- s.declare (new BalloonLayout_script);
- s.declare (new CircularLayout_script);
- }
-};
diff --git a/graphics/pgf/base/source/module_script.h b/graphics/pgf/base/source/module_script.h
deleted file mode 100644
index 97579ecdd9..0000000000
--- a/graphics/pgf/base/source/module_script.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-struct module_script : scripting::declarations {
- void declare (scripting::script s)
- {
- using namespace scripting;
-
- s.declare (key ("RankingModule")
- .module_type ());
-
- s.declare (key ("AcyclicSubgraphModule")
- .module_type ());
-
- s.declare (key ("HierarchyLayoutModule")
- .module_type ());
-
- s.declare (key ("TwoLayerCrossMin")
- .module_type ());
-
- s.declare (key ("InitialPlacer")
- .module_type ());
-
- s.declare (key ("MultilevelBuilder")
- .module_type ());
- }
-};
-
diff --git a/graphics/pgf/base/source/multilevelmixer_script.h b/graphics/pgf/base/source/multilevelmixer_script.h
deleted file mode 100644
index 499406bc33..0000000000
--- a/graphics/pgf/base/source/multilevelmixer_script.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "BarycenterPlacer_script.h"
-#include "IndependentSetMerger_script.h"
-#include "MedianPlacer_script.h"
-#include "SolarMerger_script.h"
-#include "CirclePlacer_script.h"
-#include "LocalBiconnectedMerger_script.h"
-#include "RandomMerger_script.h"
-#include "SolarPlacer_script.h"
-#include "EdgeCoverMerger_script.h"
-#include "MatchingMerger_script.h"
-#include "RandomPlacer_script.h"
-#include "ZeroPlacer_script.h"
-
-struct multilevelmixer_script :
- scripting::declarations
-{
- void declare (scripting::script s) {
- s.declare (new BarycenterPlacer_script);
- s.declare (new IndependentSetMerger_script);
- s.declare (new MedianPlacer_script);
- s.declare (new SolarMerger_script);
- s.declare (new CirclePlacer_script);
- s.declare (new LocalBiconnectedMerger_script);
- s.declare (new RandomMerger_script);
- s.declare (new SolarPlacer_script);
- s.declare (new EdgeCoverMerger_script);
- s.declare (new MatchingMerger_script);
- s.declare (new RandomPlacer_script);
- s.declare (new ZeroPlacer_script);
- }
-};
diff --git a/graphics/pgf/base/source/ogdf_script.c++ b/graphics/pgf/base/source/ogdf_script.c++
deleted file mode 100644
index 12a5f6bfeb..0000000000
--- a/graphics/pgf/base/source/ogdf_script.c++
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "module/module_script.h"
-
-#include "layered/layered_script.h"
-#include "energybased/energybased_script.h"
-#include "misclayout/misclayout_script.h"
-#include "planarity/planarity_script.h"
-
-
-extern "C" int luaopen_pgf_gd_ogdf_c_ogdf_script (struct lua_State *state) {
-
- scripting::script s (state);
-
- s.declare (new module_script);
- s.declare (new layered_script);
- s.declare (new energybased_script);
- s.declare (new misclayout_script);
- s.declare (new planarity_script);
-
- return 0;
-}
-
diff --git a/graphics/pgf/base/source/pgfmathtestsuite.tex b/graphics/pgf/base/source/pgfmathtestsuite.tex
deleted file mode 100644
index 6baf5ddba4..0000000000
--- a/graphics/pgf/base/source/pgfmathtestsuite.tex
+++ /dev/null
@@ -1,1264 +0,0 @@
-% FIXME: this class is MESSY.
-%
-% rewrite with proper assertions ... it goes back to a time where I
-% merely wanted to inspect the results!
-%
-% --> see 'assertEquals' in this file
-%
-\documentclass[a4paper]{article}
-
-\usepackage[intlimits]{amsmath}
-\usepackage{amssymb}
-\usepackage{amsfonts}
-\usepackage{ifpdf}
-
-\ifpdf
- \usepackage{hyperref}
-\else
- \def\pgfsysdriver{pgfsys-dvipdfm.def}
- \usepackage[dvipdfm]{hyperref}
-\fi
-\usepackage{tikz}
-\usepackage{fp}
-
-\makeatletter
-\pgfutil@ifundefined{pgfmathdeclarefunction}{
- % load pgfplots with its pgf 2.00 compatibility code:
- \usepackage{pgfplots}
-}{
- \usepgflibrary{fpu}
-}
-\makeatother
-
-\pgfmathfloatcreate{1}{5.0}{-4}
-\let\THRESH=\pgfmathresult
-
-
-\parindent=0pt
-
-
-\author{Christian Feuers\"anger}
-\title{Test cases for pgffloatmath.code.tex}
-
-\def\testsection#1{\message{---------- STARTING TEST SECTION '#1'}\section{#1}}
-\def\testsubsection#1{\message{-------STARTING TEST SUBSECTION '#1'}\subsection{#1}}
-\def\testsubsubsection#1{\message{------STARTING TEST SUBSUBSECTION '#1'}\subsubsection{#1}}
-
-
-\def\compare#1#2{%
- \begingroup
- \message{COMPUTING LOG(#1)}%
- \pgfmathlog{#1}%
- \let\actual=\pgfmathresult
- \def\expected{#2}%
- \pgfmathsubtract\actual\expected%
- \let\abserr=\pgfmathresult
- \pgfmathdivide\abserr\expected
- \let\relerr=\pgfmathresult
- \noindent
- log(#1)\hfill=
- \expected;\hfill%
- actual=\actual;\hfill%
- abserr=\abserr;\hfill%
- relerr=\relerr;\hfill%
- \endgroup
- \par
-}%
-%--------------------------------------------------
-% \def\showlowlevelfloat#1#2e#3\relax{%
-% \ensuremath{[#1] \cdot #2 \cdot 10^{#3}}%
-% }%
-%--------------------------------------------------
-\long\def\showlowlevelfloatmacro#1{#1}
-
-\long\def\showlowlevelfloatmacrolong#1{%
- #1 is decomposed into
-
- {%
- \gdef\testerror{}%
- \pgfmathfloattoregisters{#1}{\count0 }{\dimen0 }{\count1 }%
- pgfmathfloattoregisters: flags \the\count0; M=\the\dimen0; E=\the\count1
- \ifx\testerror\empty
- \else
- \par (caught \texttt{\testerror})%
- \fi
- }%
-
- {%
- \gdef\testerror{}%
- pgfmathfloattoregisterstok: \pgfmathfloattoregisterstok{#1}{\count0 }{\toks0 }{\count1 }%
- flags \the\count0; M=\the\toks0; E=\the\count1
- \ifx\testerror\empty
- \else
- \par (caught \texttt{\testerror})%
- \fi
- }%
-
- {%
- \gdef\testerror{}%
- pgfmathfloatgetflags \pgfmathfloatgetflags{#1}{\count0 }
- flags \the\count0;
- \ifx\testerror\empty
- \else
- \par (caught \texttt{\testerror})%
- \fi
- }%
-
- \medskip
- %\expandafter\showlowlevelfloat#1\relax
-}%
-
-\def\showsinglenumberparsing#1{%
-%\tracingmacros=2\tracingcommands=2
- \begingroup
- \message{PARSING NUMBER #1...}%
- \gdef\testerror{}%
- \pgfmathfloatparsenumber{#1}%
- \let\resultasfloat=\pgfmathresult
- \pgfmathfloattofixed\resultasfloat
- \let\resultasfixed=\pgfmathresult
- \[ #1 \mapsto \resultasfloat = \showlowlevelfloatmacro\resultasfloat \mapsto \resultasfixed
- \]
- \ifx\testerror\empty
- \else
- \par (caught \texttt{\testerror})%
- \fi
- \endgroup
-%\tracingmacros=0\tracingcommands=0
-}
-
-\def\pretty#1{%
- \message{Pretty-printing #1...}%
- \pgfmathprintnumberto{#1}\result
- {\pgfkeys{/pgf/number format/showpos}\pgfmathprintnumberto{#1}\resultpos\global\let\resultpos=\resultpos}%
- \[ #1 \mapsto \pgfmathprintnumber{#1} [=\resultpos] \]
- \message{#1 mapsto \meaning\result}%
-}
-
-\begin{document}
-\maketitle
-
-
-%--------------------------------------------------
-% \showit{2.8128}
-% log(12)=\pgfmathlog{1.2}\pgfmathadd{\pgfmathresult}{2.30258}\pgfmathresult\par
-% \showit{1.2}
-% \showit{4.0}
-% log(1200)=\pgfmathlog{1.2}\pgfmathadd{\pgfmathresult}{6.9077}\pgfmathresult\par
-% log(6.241e-7)=\pgfmathlog{6.241}\pgfmathadd{\pgfmathresult}{-16.11809}\pgfmathresult\par
-%--------------------------------------------------
-
-\testsection{Conversion to normalised floating point numbers basis 10}
-\showsinglenumberparsing{123.41251}%
-\showsinglenumberparsing{1023.52}
-\showsinglenumberparsing{123412.51}%
-\showsinglenumberparsing{12341251.0}%
-\showsinglenumberparsing{-12341251.0}%
-\showsinglenumberparsing{1.2341251}%
-\showsinglenumberparsing{8.02410024}
-\showsinglenumberparsing{8.024100}
-\showsinglenumberparsing{0001234.3100}
-\showsinglenumberparsing{0001234.00001}
-\showsinglenumberparsing{0001000.00001}
-\showsinglenumberparsing{0001000.00001000}
-\showsinglenumberparsing{0.12341251}%
-\showsinglenumberparsing{0.0012341251}%
-\showsinglenumberparsing{0.00000012341251}%
-\showsinglenumberparsing{-0.00000012341251}%
-\showsinglenumberparsing{10}
-\showsinglenumberparsing{100.351}
-\showsinglenumberparsing{100.35100}
-\showsinglenumberparsing{100.35100234}
-\showsinglenumberparsing{100.0035100234}
-\showsinglenumberparsing{100}
-\showsinglenumberparsing{99999}
-\showsinglenumberparsing{999.000}
-
-%\tracingmacros=2 \tracingcommands=2
-\showsinglenumberparsing{8.31160034e-02}%
-\showsinglenumberparsing{2.54685628e-02}%
-\showsinglenumberparsing{7.40715288e-03}%
-\showsinglenumberparsing{2.10192154e-03}%
-\showsinglenumberparsing{5.87352989e-04}%
-\showsinglenumberparsing{-1.62269942e-04}%
-\showsinglenumberparsing{4.44248889e-05}%
-\showsinglenumberparsing{1.20714122e-05}%
-\showsinglenumberparsing{3.26101452e-06}%
-\showsinglenumberparsing{3261.01452e-06}%
-\showsinglenumberparsing{0.000326101452e-06}%
-\showsinglenumberparsing{1.2345e-12}%
-\showsinglenumberparsing{1.2345e+12}%
-
-\message{SPECIAL CASE 0}%
-\showsinglenumberparsing{0}
-\showsinglenumberparsing{-0}
-\showsinglenumberparsing{-0.000}
-\showsinglenumberparsing{+0.000}
-\showsinglenumberparsing{+0}
-\showsinglenumberparsing{-1}
-\showsinglenumberparsing{1.0e1}
-\showsinglenumberparsing{1e1}
-\showsinglenumberparsing{1141}
-\showsinglenumberparsing{-53e-5}
-
-\testsubsection{Error handling}
-{
- \pgfkeys{
- /pgf/fpu/handlers/empty number/.code 2 args={%
- \gdef\testerror{handlers/empty number=\{#1\}\{#2\}}%
- },
- /pgf/fpu/handlers/invalid number/.code 2 args={%
- \gdef\testerror{handlers/invalid number=\{#1\}\{#2\}}%
- },
- /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={%
- \gdef\testerror{handlers/wrong lowlevel format=\{#1\}\{#2\}}%
- },
- }
- \showsinglenumberparsing{-53e-5 not terminated}
- %\showsinglenumberparsing{-53e-}
- \showsinglenumberparsing{}
- \showsinglenumberparsing{ ASDZ@414e12}
-
- This one has trailing spaces and should work:
- \showsinglenumberparsing{10 }
-
- This one has leading spaces and should work:
- \showsinglenumberparsing{ 10}
-
- \testsubsection{Error handling of decompose routines}
-
- \pgfmathfloatparsenumber{100}
- \showlowlevelfloatmacrolong{\pgfmathresult}
-
- \showlowlevelfloatmacrolong{132}
-
- \showlowlevelfloatmacrolong{Z}
-}
-
-\testsection{logarithms, compared with PGF arithmetics}
-
-\compare{0.1}{-2.30259}
-\compare{0.12}{-2.12026}
-\compare{0.2}{-1.60944}
-\compare{0.3}{-1.20397}
-\compare{0.4}{-0.916291}
-\compare{0.5}{-0.693147}
-\compare{0.6}{-0.510826}
-\compare{0.7}{-0.356675}
-\compare{0.75}{-0.287682}
-\compare{0.8}{-0.223144}
-\compare{0.823}{-0.194799}
-\compare{0.9}{-0.105361}
-\compare{0.96}{-0.040822}
-\compare{1.2}{0.182322}
-\compare{1.5}{0.405465}
-\compare{1.6}{0.470004}
-\compare{9.0}{2.1972245773}
-\compare{9.2}{2.2192034}
-\compare{9.3}{2.23001440}
-\compare{9.7}{2.27212588}
-\compare{10.0}{2.302585092}
-\compare{100.0}{4.605170185}
-\compare{1351.0}{7.208600337}
-\compare{9752.0}{9.185227671}
-\compare{9600.0}{9.169518377}
-
-\vskip1cm
-\compare{0.000142}{-8.8596835}
-\compare{0.0054124}{-5.219062661}
-\compare{0.000912697124}{-6.9991064}
-
-\vskip1cm
-\compare{8.31160034e-02}{-2.48751801563782}%
-\compare{2.54685628e-02}{-3.67031041875206}%
-\compare{7.40715288e-03}{-4.90530914022879}%
-\compare{2.10192154e-03}{-6.16490333357987}%
-\compare{5.87352989e-04}{-7.43988457474844}%
-\compare{1.62269942e-04}{-8.72624930084187}%
-\compare{4.44248889e-05}{-10.0217106847708}%
-\compare{1.20714122e-05}{-11.3246705288704}%
-\compare{3.26101452e-06}{-12.6334722085451}%
-
-\vskip1cm
-\compare{5}{1.6094379124341}%
-\compare{17}{2.83321334405622}%
-\compare{39}{3.66356164612965}%
-\compare{49}{3.89182029811063}%
-\compare{129}{4.85981240436167}%
-\compare{321}{5.77144112313002}%
-\compare{769}{6.64509096950564}%
-\compare{1793}{7.49164547360513}%
-\compare{4097}{8.31801027754687}%
-\compare{9217}{9.12880488399366}%
-
-
-\testsection{Test for prettyprinter}
-%\tracingmacros=2\tracingcommands=2
-\message{PRETTY PRINTING}
-{
-\twocolumn
-\def\prettytest{%
- \pretty{1}
- \pretty{1.0}
- \pretty{-1.02311}
- \pretty{-11241.02311}
- \pretty{-11241}
- \pretty{8124.99999}
- \pretty{8124.849999}
- \pretty{8124.843333}
- \pretty{8.82}
- \pretty{8.5}
- \pretty{9.}
- \pretty{5.9}
- \pretty{-0.00001}
- \pretty{-1.00001}
- \pretty{-0.559}
- \pretty{-0.554}
- \pretty{-0.00000141}
- \pretty{1.234e10}
- \pretty{123456781}
- \pretty{1234}
- \pretty{8}
- \pretty{-9.995}
- \pretty{-0.015}
- \pretty{-0.1}
- \pretty{-0.15}
- \pretty{0.15}
- \pretty{-0}
- \pretty{0}
- \pretty{9.00}
- \pretty{200.01}
- \pretty{200.0000}
- \pretty{1.5e-7}
- \pretty{0.00035}
- \pretty{0.00005}
- \pretty{nan}
- \pretty{inf}
- \pretty{-inf}
- \pretty{10}
- \pretty{100}
- \pretty{200}
- \pretty{500}
- \pretty{1000}
- \pretty{30000}
- \pretty{600000}
- \pretty{1000000}
- \pretty{30000000}
- \pretty{600000000}
- \pretty{1000000000}
- \pretty{-10}
- \pretty{-100}
- \pretty{-200}
- \pretty{-500}
- \pretty{-1000}
- \pretty{-30000}
- \pretty{-600000}
- \pretty{-1000000}
- \pretty{-30000000}
- \pretty{-600000000}
- \pretty{-1000000000}
-}
-
-\testsubsection{STD format}
-\pgfqkeys{/pgf/number format}{std}
-\prettytest
-
-{
-\testsubsubsection{precision 0}
-\pgfqkeys{/pgf/number format}{precision=0}
-\prettytest
-}
-
-{
-\testsubsection{FIXED format}
-\testsubsubsection{with period}
-\pgfqkeys{/pgf/number format}{fixed,use period}
-\prettytest
-
-{
-\testsubsubsection{precision 0}
-\pgfqkeys{/pgf/number format}{precision=0}
-\prettytest
-}
-{
-\testsubsubsection{skip 0.=true}
-\pgfqkeys{/pgf/number format}{skip 0.=true}
-\prettytest
-}
-
-{
-\testsubsubsection{1000 sep; min exponent for 1000 sep=4}
-\pgfqkeys{/pgf/number format}{1000 sep=',min exponent for 1000 sep=4}
-\prettytest
-}
-
-\testsubsubsection{with comma}
-\pgfqkeys{/pgf/number format}{fixed,use comma}
-\prettytest
-}
-
-
-{
-\testsubsection{FIXED ZEROFILL format}
-\testsubsubsection{with period}
-\pgfqkeys{/pgf/number format}{fixed,fixed zerofill,use period}
-\prettytest
-
-{
-\testsubsubsection{precision 0}
-\pgfqkeys{/pgf/number format}{precision=0}
-\prettytest
-}
-
-\testsubsubsection{with comma}
-\pgfqkeys{/pgf/number format}{fixed,fixed zerofill,use comma}
-%\tracingmacros=2\tracingcommands=2
-\prettytest
-%\tracingmacros=0\tracingcommands=0
-}
-
-{
-\testsubsection{sci format}
-\testsubsubsection{with period}
-\pgfqkeys{/pgf/number format}{sci,use period}
-\prettytest
-
-{
-\testsubsubsection{precision 0}
-\pgfqkeys{/pgf/number format}{precision=0}
-\prettytest
-}
-
-\testsubsubsection{with comma}
-\pgfqkeys{/pgf/number format}{sci,use comma}
-\prettytest
-
-%\testsubsection{may skip mantisse}
-%\pgfqkeys{/pgf/number format}{sci may skip mantisse=true}
-%\prettytest
-
-}{
-\testsubsection{sci format zerofill}
-\testsubsubsection{with period}
-\pgfqkeys{/pgf/number format}{sci,sci zerofill,use period}
-\prettytest
-
-\testsubsubsection{with comma}
-\pgfqkeys{/pgf/number format}{sci,sci zerofill,use comma}
-\prettytest
-
-\testsubsubsection{e-style}
-\pgfqkeys{/pgf/number format}{sci e}
-\prettytest
-
-\testsubsubsection{subscript-style}
-\pgfqkeys{/pgf/number format}{sci subscript}
-\prettytest
-
-\testsubsubsection{subscript-style + period + no zero fill}
-\pgfqkeys{/pgf/number format}{sci subscript,use period,sci}
-\prettytest
-
-\testsubsubsection{subscript-style precision 4}
-\pgfqkeys{/pgf/number format}{sci subscript,precision=4}
-\prettytest
-}
-
-\testsubsection{int trunc format}
-\pgfqkeys{/pgf/number format}{int trunc}
-\prettytest
-
-\testsubsection{int detect format}
-\pgfqkeys{/pgf/number format}{int detect}
-\prettytest
-
-\testsubsection{frac}
-\pgfqkeys{/pgf/number format}{frac}
-\pretty{0.333333333333333}
-\pretty{0.5}
-\pretty{2.133333333333325e-01}%
-\pretty{0.12}
-\pretty{2.666666666666646e-02}%
-\pretty{-1.333333333333334e-02}%
-\pretty{7.200000000000000e-01}%
-\pretty{6.666666666666667e-02}%
-\pretty{1.333333333333333e-01}%
-\pretty{-1.333333333333333e-02}%
-\pretty{8.533333333333298e-01}
-\pretty{8.533333e-01}
-}
-\onecolumn
-
-\testsection{Pretty printing using the relative style}
-{
-\long\def\TESTIT#1#2{%
- \gdef\temptable{\begin{tabular}}%
- \gdef\header{l}%
- \def\n{\noexpand\n}%
- \foreach \number in {#2} {%
- \xdef\header{\header c}%
- }%
- \toks0=\expandafter{\temptable}%
- \xdef\temptable{\the\toks0 {\header}\n}%
- %
- \toks0=\expandafter{\temptable}%
- \toks1={}%
- \xdef\temptable{\the\toks0 \the\toks1}%
- \foreach \number in {#2} {%
- \toks0=\expandafter{\temptable}%
- \toks1=\expandafter{\number}%
- \xdef\temptable{\the\toks0 & \noexpand\texttt{\the\toks1}}%
- }%
- \toks0=\expandafter{\temptable}%
- \xdef\temptable{\the\toks0 \noexpand\\\n}%
- %
- \toks0=\expandafter{\temptable}%
- \toks1={With actual config:}%
- \xdef\temptable{\the\toks0 \the\toks1}%
- \foreach \number in {#2} {%
- \toks0=\expandafter{\temptable}%
- \toks1=\expandafter{\number}%
- \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber{\the\toks1}}%
- }%
- \toks0=\expandafter{\temptable}%
- \xdef\temptable{\the\toks0 \noexpand\\\n}%
- %
- \foreach \relativeto in {#1} {%
- \toks0=\expandafter{\temptable}%
- \xdef\temptable{\the\toks0 Relative to $10^{\relativeto}$:}%
- \foreach \number in {#2} {%
- \toks0=\expandafter{\temptable}%
- \toks1=\expandafter{\number}%
- \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber[relative={\relativeto}]{\the\toks1}}%
- }%
- \toks0=\expandafter{\temptable}%
- \xdef\temptable{\the\toks0 \noexpand\\\n}%
- }%
- %
- %
- \toks0=\expandafter{\temptable}%
- \toks1={\end{tabular}\n}%
- \xdef\temptable{\the\toks0 \the\toks1}%
- %
- \def\n{^^J}%
-%\message{TEMP-TABLE: \n\meaning\temptable\n}%
- %
- \let\n=\relax
- \noindent
- \temptable
-}%
-%\tracingmacros=2 \tracingcommands=2
-
-\TESTIT{1,3}{1e-16,0,15,17,20}
-
-\TESTIT{0,1,3,4,5,6,7,8,9}{-100.123456,1e-16,1431,2000.1234,123456789.1234}
-
-
-
-\TESTIT{-4,-3,-2,-1,0,1,2,3}{0.0001,0.00012678,0.00013678,0.00016678,1.23,2.345,123.4,1234.5}
-
-{
-\subsection*{every relative/.style={sci}}
-\pgfkeys{/pgf/number format/every relative/.style={sci}}
-\TESTIT{-4,-3,-2,-1,0,1,2,3}{0.0001,0.00012678,0.00013678,0.00016678,1.23,2.345,123.4,1234.5}
-}
-
-\TESTIT{-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9}{-123.123456,123.1234565}
-{
-\subsection*{precision=4}
-\pgfkeys{/pgf/number format/precision=4}
-\TESTIT{-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9}{-123.123456,123.1234565}
-}
-}
-
-\begingroup
-\testsection{testing pgfmathfloatadd}
-\def\testfloataddnonsymmetric#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\first=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\second=\pgfmathresult
- \message{computing #1 + #2; \first + \second}%
- \pgfmathfloatadd\first\second
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \let\resultfixed=\pgfmathresult
- \[ \text{pgfmathfloatadd: } \showlowlevelfloatmacro\first + \showlowlevelfloatmacro\second = \showlowlevelfloatmacro\result \; \bigl( #1 + #2 = \resultfixed \bigr). \]
-}%
-\def\testfloatadd#1#2{%
- \testfloataddnonsymmetric{#1}{#2}%
- \testfloataddnonsymmetric{#2}{#1}%
-}%
-
-\testfloatadd{1}{100}
-\testfloatadd{100}{100}
-\testfloatadd{1}{2}
-\testfloatadd{1}{0}
-\testfloatadd{9.999999}{0}
-\testfloatadd{9.9999}{0.0001}
-\testfloatadd{9.9999e-5}{0.0001e-5}
-\testfloatadd{1e6}{1e5}
-\testfloatadd{1e6}{1e3}
-\testfloatadd{1e6}{1}
-\testfloatadd{1e6}{0.1}
-
-\testfloatadd{1}{-100}
-\testfloatadd{100}{-100}
-\testfloatadd{1}{-2}
-\testfloatadd{1e6}{-1e5}
-\testfloatadd{1e6}{-1e3}
-\testfloatadd{1e6}{-1}
-\testfloatadd{1e6}{-0.1}
-
-\testfloatadd{1e-3}{0}
-
-\testfloatadd{inf}{0}
-\testfloatadd{inf}{5}
-\testfloatadd{nan}{5}
-\testfloatadd{0}{0}
-\testfloatadd{-inf}{inf}
-\testfloatadd{-inf}{40}
-\endgroup
-
-\begingroup
-\testsection{testing pgfmathfloatmultiplyfixed}
-\def\testfloatmultiplyfixed#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\first=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \pgfmathfloattofixed\pgfmathresult
- \let\second=\pgfmathresult
- \message{computing #1 * #2; \first * \second}%
- \pgfmathfloatmultiplyfixed\first\second
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \let\resultfixed=\pgfmathresult
- \[ \text{pgfmathfloatmultiplyfixed: } \showlowlevelfloatmacro\first \cdot \second = \showlowlevelfloatmacro\result \; \bigl( #1 \cdot #2 = \resultfixed \bigr). \]
-}%
-
-\testfloatmultiplyfixed{1}{100}
-\testfloatmultiplyfixed{100}{100}
-\testfloatmultiplyfixed{1}{2}
-\testfloatmultiplyfixed{5}{2}
-\testfloatmultiplyfixed{5e4}{10}
-\testfloatmultiplyfixed{1}{0}
-\testfloatmultiplyfixed{9.999999}{0}
-\testfloatmultiplyfixed{9.9999}{0.0001}
-\testfloatmultiplyfixed{9.9999e-5}{0.001}
-\testfloatmultiplyfixed{1e6}{4}
-\testfloatmultiplyfixed{1e6}{100}
-\testfloatmultiplyfixed{1e6}{1}
-\testfloatmultiplyfixed{1e6}{0.1}
-
-\testfloatmultiplyfixed{1}{-100}
-\testfloatmultiplyfixed{100}{-100}
-\testfloatmultiplyfixed{1}{-2}
-\testfloatmultiplyfixed{1e6}{-9}
-\testfloatmultiplyfixed{1e6}{-100}
-\testfloatmultiplyfixed{1e6}{-1}
-\testfloatmultiplyfixed{1e6}{-0.1}
-
-\testfloatmultiplyfixed{1e-3}{0}
-
-\testfloatmultiplyfixed{inf}{0}
-\testfloatmultiplyfixed{inf}{5}
-\testfloatmultiplyfixed{nan}{5}
-\testfloatmultiplyfixed{0}{0}
-\testfloatmultiplyfixed{-inf}{40}
-\endgroup
-
-
-\testsection{testing pgfmathfloatlessthan}
-\def\testfloatlessthan#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\first=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\second=\pgfmathresult
- \message{checking #1 <= #2; \first <= \second}%
- \pgfmathfloatlessthan\first\second
- \ifpgfmathfloatcomparison
- \def\result{<}%
- \else
- \def\result{\ge}%
- \fi
- \[ \text{pgfmathfloatlessthan: } \bigl( \showlowlevelfloatmacro\first \bigr)\; = #1 \result #2\; \bigl( = \showlowlevelfloatmacro\second \big). \]
-}%
-
-\testfloatlessthan{4}{5}
-\testfloatlessthan{0}{2}
-\testfloatlessthan{91751123}{241924}
-\testfloatlessthan{-1}{-1}
-\testfloatlessthan{-1231}{0}
-\testfloatlessthan{10}{-5}
-\testfloatlessthan{0}{0}
-\testfloatlessthan{-0}{-0}
-\testfloatlessthan{0}{14}
-\testfloatlessthan{114812}{-123124123}
-\testfloatlessthan{114812}{1241231451}
-\testfloatlessthan{-141285}{29}
-\testfloatlessthan{-141285}{0}
-\testfloatlessthan{-141285}{-50}
-\testfloatlessthan{-141285}{-12498149012}
-
-\testsection{float to fixed test}
-\def\testpgfmathfloattofixed#1{%
- \pgfmathfloatparsenumber{#1}%
-%\tracingmacros=2\tracingcommands=2
- \let\argument=\pgfmathresult
- \message{converting #1 = \argument\ to fixed point}%
- \pgfmathfloattofixed\argument
- \let\result=\pgfmathresult
- \message{-> \result}%
-%\tracingmacros=0\tracingcommands=0
- \[ \bigl( \showlowlevelfloatmacro\argument \bigr)\; = #1 \mapsto \result \]
-}%
-\testpgfmathfloattofixed{0}
-\testpgfmathfloattofixed{5}
-\testpgfmathfloattofixed{5.520241}
-\testpgfmathfloattofixed{124.10241}
-\testpgfmathfloattofixed{-121.248}
-\testpgfmathfloattofixed{-12e-5}
-\testpgfmathfloattofixed{412e3}
-\testpgfmathfloattofixed{0.0001}
-\testpgfmathfloattofixed{0.0}
-\testpgfmathfloattofixed{-0.012125}
-\testpgfmathfloattofixed{1.2e-1}
-\testpgfmathfloattofixed{1.2e-2}
-\testpgfmathfloattofixed{1.2e4}
-\testpgfmathfloattofixed{1.2345e4}
-\testpgfmathfloattofixed{1.234567e4}
-\testpgfmathfloattofixed{1.51234e0}
-\testpgfmathfloattofixed{15}
-\testpgfmathfloattofixed{-20}
-
-\testsection{Testing pgfmathfloatmin and pgfmathfloatmax}
-\def\testfloatminmax#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\first=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\second=\pgfmathresult
-%\tracingmacros=2\tracingcommands=2
- \message{computing min/max #1 and #2}%
- \pgfmathfloatmin\first\second
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \[ \min\{#1,#2\} = \min\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \]
- %
- \pgfmathfloatmax\first\second
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \[ \max\{#1,#2\} = \max\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \]
-}%
-\testfloatminmax{42}{56}
-\testfloatminmax{-4122}{1256}
-\testfloatminmax{1e12}{5.235412e24}
-\testfloatminmax{-12}{-145}
-
-\testsection{Testing pgfmathfloatshift}
-\def\pgfmathfloatshifttest#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\argument=\pgfmathresult
- \message{computing mathshift #1 by #2}%
- \pgfmathfloatshift\argument{#2}%
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \[ #1 \cdot 10^{#2} = \showlowlevelfloatmacro\argument \cdot 10^{#2} = \showlowlevelfloatmacro\result = \pgfmathresult \]
-}%
-\pgfmathfloatshifttest{4}{1}
-\pgfmathfloatshifttest{4}{2}
-\pgfmathfloatshifttest{4}{-1}
-\pgfmathfloatshifttest{4}{-2}
-\pgfmathfloatshifttest{0}{-2}
-\pgfmathfloatshifttest{1.1415130}{-2}
-\pgfmathfloatshifttest{1.1415130}{5}
-
-\testsection{Testing pgfmathfloatmultiply}
-\begingroup
-\def\pgfmathfloatmultiplytest#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\argumentb=\pgfmathresult
- \message{computing mathmultiply #1 by #2}%
- \pgfmathfloatmultiply\argumenta\argumentb%
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \[ #1 \cdot #2 = \showlowlevelfloatmacro\result = \pgfmathresult \]
-}%
-\def\tests{%
- \pgfmathfloatmultiplytest{4}{1}
- \pgfmathfloatmultiplytest{4}{2}
- \pgfmathfloatmultiplytest{4}{-1}
- \pgfmathfloatmultiplytest{4}{-2}
- \pgfmathfloatmultiplytest{0}{-2}
- \pgfmathfloatmultiplytest{1.1415130}{-2}
- \pgfmathfloatmultiplytest{1.1415130}{5}
- \pgfmathfloatmultiplytest{10}{10}
- \pgfmathfloatmultiplytest{100}{100}
- \pgfmathfloatmultiplytest{9999999}{9999999}
- gnuplot for $\cdot$: $99999980000001.0$
- \pgfmathfloatmultiplytest{-10}{10}
- \pgfmathfloatmultiplytest{-90}{3}
- \pgfmathfloatmultiplytest{-90}{-3}
- \pgfmathfloatmultiplytest{-inf}{nan}
- \pgfmathfloatmultiplytest{-inf}{+inf}
- \pgfmathfloatmultiplytest{1}{0}
- \pgfmathfloatmultiplytest{1}{0}
- \pgfmathfloatmultiplytest{1}{-0}
- \pgfmathfloatmultiplytest{3.14159265358979}{2}
-}%
-\tests
-
-\testsection{Testing pgfmathfloatdivide}
-
-\def\pgfmathfloatmultiplytest#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\argumentb=\pgfmathresult
- \message{computing mathdivide #1 by #2}%
- \pgfmathfloatdivide\argumenta\argumentb%
- \let\result=\pgfmathresult
- \pgfmathfloattofixed\result
- \[ #1 / #2 = \showlowlevelfloatmacro\result = \pgfmathresult \]
-}%
-\tests
-
-% #1/#2 expected #3
-\def\pgfmathfloattest#1#2#3{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\argumentb=\pgfmathresult
- \pgfmathfloatparsenumber{#3}%
- \let\reference=\pgfmathresult
- \message{computing (#1/#2)}%
- \pgfmathfloatdivide\argumenta\argumentb%
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \pgfmathfloattosci\pgfmathresult
- \[ #1/#2 = \result\quad (\text{error/r to }#3 = \pgfmathprintnumber\pgfmathresult)\]
-}%
-\pgfmathfloattest{83407811.0}{166815640.0}{0.499999946048224}
-\endgroup
-
-
-{
-\testsection{Testing pgfmathfloatsqrt}
-% #1 : number
-% #2 : the reference, sqrt (#1)
-\def\pgfmathfloatsqrttest#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\reference=\pgfmathresult
- \message{computing sqrt(#1)}%
- \pgfmathfloatsqrt\argumenta%
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \pgfmathfloattosci\pgfmathresult
- \[ \sqrt{#1} = \result\quad (\text{rel. error } \pgfmathresult)\]
-}%
-\def\tests{%
- \pgfmathfloatsqrttest{0}{0}
- \pgfmathfloatsqrttest{1}{1}
- \pgfmathfloatsqrttest{2}{1.414213562373}
- \pgfmathfloatsqrttest{4}{2}
- \pgfmathfloatsqrttest{16}{4}
- \pgfmathfloatsqrttest{10}{3.162277660168}
- \pgfmathfloatsqrttest{1000000}{1000}
- \pgfmathfloatsqrttest{123456789}{1.111111106055556e+04}
-}%
-\tests
-}
-
-{
-\testsection{Testing pgfmathfloatint}
-% #1 : number
-\def\pgfmathfloatinttest#1{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \message{computing int(#1)}%
- \pgfmathfloatint\argumenta%
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \[ int(#1) = \result \]
- %
- \pgfmathfloatparsenumber{-#1}%
- \let\argumenta=\pgfmathresult
- \message{computing int(-#1)}%
- \pgfmathfloatint\argumenta%
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \[ int(-#1) = \result \]
-}%
-\def\tests{%
- \pgfmathfloatinttest{1.23}
- \pgfmathfloatinttest{12.34}
- \pgfmathfloatinttest{123.4}
- \pgfmathfloatinttest{1234.}
- \pgfmathfloatinttest{1234.1}
- \pgfmathfloatinttest{1e-2}
- \pgfmathfloatinttest{0}
- \pgfmathfloatinttest{3.456789e4}
- \pgfmathfloatinttest{3.456789e10}
-}%
-\tests
-}
-
-{
-\testsection{Testing pgfmathfloatexp}
-% #1 : number
-% #2 : the reference, sqrt (#1)
-\def\pgfmathfloattest#1#2{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\reference=\pgfmathresult
- \message{computing (#1)}%
- \pgfmathfloatexp\argumenta%
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \pgfmathfloattosci\pgfmathresult
- \[ \exp(#1) = \result\quad (\text{error/r to }#2 = \pgfmathresult)\]
-}%
-%\tracingmacros=2\tracingcommands=2
- \pgfmathfloattest{-700}{9.85967654375977e-305}
- \pgfmathfloattest{-1.0000000e+02}{3.7200760e-44}
- \pgfmathfloattest{-9.5918367e+01}{2.2038516e-42}
- \pgfmathfloattest{-9.1836735e+01}{1.3056083e-40}
- \pgfmathfloattest{-8.7755102e+01}{7.7346991e-39}
- \pgfmathfloattest{-8.3673469e+01}{4.5821992e-37}
- \pgfmathfloattest{-7.9591837e+01}{2.7145916e-35}
- \pgfmathfloattest{-7.5510204e+01}{1.6081814e-33}
- \pgfmathfloattest{-7.1428571e+01}{9.5272065e-32}
- \pgfmathfloattest{-6.7346939e+01}{5.6441184e-30}
- \pgfmathfloattest{-6.3265306e+01}{3.3436950e-28}
- \pgfmathfloattest{-5.9183673e+01}{1.9808756e-26}
- \pgfmathfloattest{-5.5102041e+01}{1.1735125e-24}
- \pgfmathfloattest{-5.1020408e+01}{6.9521362e-23}
- \pgfmathfloattest{-4.6938776e+01}{4.1185924e-21}
- \pgfmathfloattest{-4.2857143e+01}{2.4399411e-19}
- \pgfmathfloattest{-3.8775510e+01}{1.4454727e-17}
- \pgfmathfloattest{-3.4693878e+01}{8.5632855e-16}
- \pgfmathfloattest{-3.0612245e+01}{5.0730713e-14}
- \pgfmathfloattest{-2.6530612e+01}{3.0053946e-12}
- \pgfmathfloattest{-2.2448980e+01}{1.7804593e-10}
- \pgfmathfloattest{-1.8367347e+01}{1.0547817e-08}
- \pgfmathfloattest{-1.4285714e+01}{6.2487495e-07}
- \pgfmathfloattest{-1.0204082e+01}{3.7018912e-05}
- \pgfmathfloattest{-6.1224490e+00}{2.1930786e-03}
- \pgfmathfloattest{-2.0408163e+00}{1.2992261e-01}
- \pgfmathfloattest{2.0408163e+00}{7.6968898e+00}
- \pgfmathfloattest{6.1224490e+00}{4.5598001e+02}
- \pgfmathfloattest{1.0204082e+01}{2.7013219e+04}
- \pgfmathfloattest{1.4285714e+01}{1.6003202e+06}
- \pgfmathfloattest{1.8367347e+01}{9.4806349e+07}
- \pgfmathfloattest{2.2448980e+01}{5.6165284e+09}
- \pgfmathfloattest{2.6530612e+01}{3.3273501e+11}
- \pgfmathfloattest{3.0612245e+01}{1.9711925e+13}
- \pgfmathfloattest{3.4693878e+01}{1.1677761e+15}
- \pgfmathfloattest{3.8775510e+01}{6.9181522e+16}
- \pgfmathfloattest{4.2857143e+01}{4.0984595e+18}
- \pgfmathfloattest{4.6938776e+01}{2.4280140e+20}
- \pgfmathfloattest{5.1020408e+01}{1.4384068e+22}
- \pgfmathfloattest{5.5102041e+01}{8.5214258e+23}
- \pgfmathfloattest{5.9183673e+01}{5.0482727e+25}
- \pgfmathfloattest{6.3265306e+01}{2.9907034e+27}
- \pgfmathfloattest{6.7346939e+01}{1.7717559e+29}
- \pgfmathfloattest{7.1428571e+01}{1.0496256e+31}
- \pgfmathfloattest{7.5510204e+01}{6.2182039e+32}
- \pgfmathfloattest{7.9591837e+01}{3.6837954e+34}
- \pgfmathfloattest{8.3673469e+01}{2.1823582e+36}
- \pgfmathfloattest{8.7755102e+01}{1.2928751e+38}
- \pgfmathfloattest{9.1836735e+01}{7.6592653e+39}
- \pgfmathfloattest{9.5918367e+01}{4.5375106e+41}
- \pgfmathfloattest{1.0000000e+02}{2.6881171e+43}
- \pgfmathfloattest{700}{1.014232054735e+304}
-}
-
-{
-\testsection{Testing pgfmathfloatmod}
-% #1 : operand 1
-% #2 : operand 2
-% #3 : the reference, #1 mod #2
-\def\pgfmathfloattest#1#2#3{%
- \pgfmathfloatparsenumber{#1}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \let\argumentb=\pgfmathresult
- \pgfmathfloatparsenumber{#3}%
- \let\reference=\pgfmathresult
- \message{computing #1 mod #2}%
- \pgfmathfloatmod\argumenta\argumentb%
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \pgfmathfloattosci\pgfmathresult
- \[ #1\text{ mod }#2 = \result\quad (\text{error/r to }#3 = \pgfmathresult)\]
-}%
-%\tracingmacros=2\tracingcommands=2
- \pgfmathfloattest{4}{3}{1}
- \pgfmathfloattest{10}{10}{0}
- \pgfmathfloattest{20}{6}{2}
- \pgfmathfloattest{-100}{30}{-10}
- \pgfmathfloattest{10.5}{5}{0.5}
- \pgfmathfloattest{300.63}{360}{300.63}
- \pgfmathfloattest{-20}{30}{-20}
-}
-
-{
-\testsection{Testing Trigonometric functions}
-% #1 : operator
-% #2 : operand
-% #3 : the reference, #2(#1)
-\def\pgfmathfloattest#1#2#3{%
- \pgfmathfloatparsenumber{#2}%
- \let\argumenta=\pgfmathresult
- \pgfmathfloatparsenumber{#3}%
- \let\reference=\pgfmathresult
- \message{computing \string#1(#2)}%
- #1\argumenta%
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \pgfmathfloattosci\pgfmathresult
- \[ \string#1(#2) = \result\quad (\text{error/r to }#3 = \pgfmathresult)\]
-}%
-%\tracingmacros=2\tracingcommands=2
-\testsubsection{SIN}
- \pgfmathfloattest\pgfmathfloatsin{-7.2000000e+02}{4.8985872e-16}
- \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+02}{9.0963200e-01}
- \pgfmathfloattest\pgfmathfloatsin{-5.8909091e+02}{7.5574957e-01}
- \pgfmathfloattest\pgfmathfloatsin{-5.2363636e+02}{-2.8173256e-01}
- \pgfmathfloattest\pgfmathfloatsin{-4.5818182e+02}{-9.8982144e-01}
- \pgfmathfloattest\pgfmathfloatsin{-3.9272727e+02}{-5.4064082e-01}
- \pgfmathfloattest\pgfmathfloatsin{-3.2727273e+02}{5.4064082e-01}
- \pgfmathfloattest\pgfmathfloatsin{-2.6181818e+02}{9.8982144e-01}
- \pgfmathfloattest\pgfmathfloatsin{-1.9636364e+02}{2.8173256e-01}
- \pgfmathfloattest\pgfmathfloatsin{-1.3090909e+02}{-7.5574957e-01}
- \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+01}{-9.0963200e-01}
- \pgfmathfloattest\pgfmathfloatsin{0.0000000e+00}{0.0000000e+00}
- \pgfmathfloattest\pgfmathfloatsin{6.5454545e+01}{9.0963200e-01}
- \pgfmathfloattest\pgfmathfloatsin{1.3090909e+02}{7.5574957e-01}
- \pgfmathfloattest\pgfmathfloatsin{1.9636364e+02}{-2.8173256e-01}
- \pgfmathfloattest\pgfmathfloatsin{2.6181818e+02}{-9.8982144e-01}
- \pgfmathfloattest\pgfmathfloatsin{3.2727273e+02}{-5.4064082e-01}
- \pgfmathfloattest\pgfmathfloatsin{3.9272727e+02}{5.4064082e-01}
- \pgfmathfloattest\pgfmathfloatsin{4.5818182e+02}{9.8982144e-01}
- \pgfmathfloattest\pgfmathfloatsin{5.2363636e+02}{2.8173256e-01}
- \pgfmathfloattest\pgfmathfloatsin{5.8909091e+02}{-7.5574957e-01}
- \pgfmathfloattest\pgfmathfloatsin{6.5454545e+02}{-9.0963200e-01}
- \pgfmathfloattest\pgfmathfloatsin{7.2000000e+02}{-4.8985872e-16}
-
-
-
-\testsubsection{COS}
- \pgfmathfloattest\pgfmathfloatcos{-7.2000000e+02}{1.0000000e+00}
- \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+02}{4.1541501e-01}
- \pgfmathfloattest\pgfmathfloatcos{-5.8909091e+02}{-6.5486073e-01}
- \pgfmathfloattest\pgfmathfloatcos{-5.2363636e+02}{-9.5949297e-01}
- \pgfmathfloattest\pgfmathfloatcos{-4.5818182e+02}{-1.4231484e-01}
- \pgfmathfloattest\pgfmathfloatcos{-3.9272727e+02}{8.4125353e-01}
- \pgfmathfloattest\pgfmathfloatcos{-3.2727273e+02}{8.4125353e-01}
- \pgfmathfloattest\pgfmathfloatcos{-2.6181818e+02}{-1.4231484e-01}
- \pgfmathfloattest\pgfmathfloatcos{-1.9636364e+02}{-9.5949297e-01}
- \pgfmathfloattest\pgfmathfloatcos{-1.3090909e+02}{-6.5486073e-01}
- \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+01}{4.1541501e-01}
- \pgfmathfloattest\pgfmathfloatcos{0.0000000e+00}{1.0000000e+00}
- \pgfmathfloattest\pgfmathfloatcos{6.5454545e+01}{4.1541501e-01}
- \pgfmathfloattest\pgfmathfloatcos{1.3090909e+02}{-6.5486073e-01}
- \pgfmathfloattest\pgfmathfloatcos{1.9636364e+02}{-9.5949297e-01}
- \pgfmathfloattest\pgfmathfloatcos{2.6181818e+02}{-1.4231484e-01}
- \pgfmathfloattest\pgfmathfloatcos{3.2727273e+02}{8.4125353e-01}
- \pgfmathfloattest\pgfmathfloatcos{3.9272727e+02}{8.4125353e-01}
- \pgfmathfloattest\pgfmathfloatcos{4.5818182e+02}{-1.4231484e-01}
- \pgfmathfloattest\pgfmathfloatcos{5.2363636e+02}{-9.5949297e-01}
- \pgfmathfloattest\pgfmathfloatcos{5.8909091e+02}{-6.5486073e-01}
- \pgfmathfloattest\pgfmathfloatcos{6.5454545e+02}{4.1541501e-01}
- \pgfmathfloattest\pgfmathfloatcos{7.2000000e+02}{1.0000000e+00}
-
-
-\testsubsection{TAN}
- \pgfmathfloattest\pgfmathfloattan{-7.2000000e+02}{4.8985872e-16}
- \pgfmathfloattest\pgfmathfloattan{-6.5454545e+02}{2.1896946e+00}
- \pgfmathfloattest\pgfmathfloattan{-5.8909091e+02}{-1.1540615e+00}
- \pgfmathfloattest\pgfmathfloattan{-5.2363636e+02}{2.9362649e-01}
- \pgfmathfloattest\pgfmathfloattan{-4.5818182e+02}{6.9551528e+00}
- \pgfmathfloattest\pgfmathfloattan{-3.9272727e+02}{-6.4266098e-01}
- \pgfmathfloattest\pgfmathfloattan{-3.2727273e+02}{6.4266098e-01}
- \pgfmathfloattest\pgfmathfloattan{-2.6181818e+02}{-6.9551528e+00}
- \pgfmathfloattest\pgfmathfloattan{-1.9636364e+02}{-2.9362649e-01}
- \pgfmathfloattest\pgfmathfloattan{-1.3090909e+02}{1.1540615e+00}
- \pgfmathfloattest\pgfmathfloattan{-6.5454545e+01}{-2.1896946e+00}
- \pgfmathfloattest\pgfmathfloattan{0.0000000e+00}{0.0000000e+00}
- \pgfmathfloattest\pgfmathfloattan{6.5454545e+01}{2.1896946e+00}
- \pgfmathfloattest\pgfmathfloattan{1.3090909e+02}{-1.1540615e+00}
- \pgfmathfloattest\pgfmathfloattan{1.9636364e+02}{2.9362649e-01}
- \pgfmathfloattest\pgfmathfloattan{2.6181818e+02}{6.9551528e+00}
- \pgfmathfloattest\pgfmathfloattan{3.2727273e+02}{-6.4266098e-01}
- \pgfmathfloattest\pgfmathfloattan{3.9272727e+02}{6.4266098e-01}
- \pgfmathfloattest\pgfmathfloattan{4.5818182e+02}{-6.9551528e+00}
- \pgfmathfloattest\pgfmathfloattan{5.2363636e+02}{-2.9362649e-01}
- \pgfmathfloattest\pgfmathfloattan{5.8909091e+02}{1.1540615e+00}
- \pgfmathfloattest\pgfmathfloattan{6.5454545e+02}{-2.1896946e+00}
- \pgfmathfloattest\pgfmathfloattan{7.2000000e+02}{-4.8985872e-16}
-
-
-
-}
-
-{
- % #1 : expression
- % #2 : the reference
- \def\assertEquals#1#2{%
- \pgfmathfloatparsenumber{#2}%
- \let\reference=\pgfmathresult
- \message{parsing expression #1...}%
- \pgfmathparse{#1}%
- \pgfmathfloatparsenumber{\pgfmathresult}%
- \let\argumenta=\pgfmathresult
- \let\resultfloat=\pgfmathresult
- \pgfmathfloattosci\pgfmathresult
- \let\result=\pgfmathresult
- \pgfmathfloatrelerror\resultfloat\reference
- \let\actualerror=\pgfmathresult
- \pgfmathfloatgreaterthan{\pgfmathresult}{\THRESH}%
- \ifpgfmathfloatcomparison
- \begingroup
- \pgfkeys{/pgf/fpu=false}%
- \pgfmathparse{#1}%
- \global\let\actualBasic=\pgfmathresult
- \endgroup
- \PackageError{pgf-fpu}{Got error: expected #1=#2, but was \result\space (error \actualerror; basic level returns \actualBasic)}{}%
- \fi
- \pgfmathfloattosci\actualerror
- \[ #1 = \result \quad[= \resultfloat] \quad (\text{error/r to }#2 = \pgfmathresult)\]
- }%
- \def\mathparserTestCases{%
- \assertEquals{1+1}{2}
- \assertEquals{1234567*4}{4938268}
- \assertEquals{exp(200)}{7.22597376812575e+86}
- \assertEquals{rad(360)}{6.28318530717959}
- \assertEquals{rad(180)}{3.14159265358979}
- \assertEquals{deg(2*pi)}{360}
- \assertEquals{deg(pi)}{180}
- \assertEquals{ln(1)}{0}
- \assertEquals{round(1.5)}{2}
- \assertEquals{round(-1.5)}{-2}
- \assertEquals{- (1.5)}{-1.5}
- \assertEquals{(1e4 - 1e3) * 1e5}{900000000.0}
- \assertEquals{4^2}{16}
- \assertEquals{4^3}{64}
- \assertEquals{4^-3}{0.015625}
- \assertEquals{4^-6}{0.000244140625}
- \assertEquals{111^4}{151807041}
- \assertEquals{8^10}{1073741824}
- \assertEquals{3^1.5}{5.19615242270663}
- \assertEquals{16^5.5}{4194304}
- \assertEquals{15^-0.25}{0.508132748154615}
- \assertEquals{sec(45)}{1.4142136e+00}
- \assertEquals{cot(30)}{1.7320508e+00}
- \assertEquals{asin(7.0710678e-01)}{45}
- \assertEquals{acos(8.6602540e-01)}{30}
- \assertEquals{atan(5.7735027e-01)}{30}
- \assertEquals{atan(16000)}{89.9964}
- \assertEquals{atan(1e6)}{8.9999943e+01}
- \assertEquals{atan(-1e6)}{-8.9999943e+01}
- \assertEquals{-12^2}{-144}%
- \assertEquals{0-12^2}{-144}%
- \assertEquals{-(12)^2}{-144}%
- \assertEquals{exp(-12^2)}{2.8946e-63}%
- \assertEquals{round(98.8)}{99}%
- \assertEquals{-pi}{-3.14159265358979}%
- \assertEquals{2*(-pi)}{-6.28318530717959}%
- \assertEquals{2*(-3)}{-6}%
- \assertEquals{veclen(1,1)}{1.414213562373095}%
- \assertEquals{veclen(1e5,6e5)}{6.082762530298220e+05}%
- \assertEquals{cosh(5)}{74.20994852478784}%
- \assertEquals{sinh(0.6)}{0.636653582148241}%
- \assertEquals{tanh(0.6)}{0.537049566998035}%
-
- {\pgfkeys{/pgf/trig format=rad}
- \assertEquals{atan2(4,5)}{0.674740942223553}%
- \assertEquals{atan2(-4,5)}{-0.674740942223553}%
- \assertEquals{atan2(4,-5)}{2.46685171136624}%
- \assertEquals{atan2(-4,-5)}{-2.46685171136624}%
- %
- \assertEquals{atan2(5,4)}{0.89605538457134}%
- \assertEquals{atan2(-5,4)}{-0.89605538457134}%
- \assertEquals{atan2(5,-4)}{2.24553726901845}%
- \assertEquals{atan2(-5,-4)}{-2.24553726901845}%
- %
- \assertEquals{atan2(4e-5,5)}{0}%
- \assertEquals{atan2(4e-5,-5)}{3.1415126535899}%
- }
- % \assertEquals{ceil(1.5)}{2}
- }
-
-
- {
- \testsection{Testing the FPU library (and math parser)}
- \pgfkeys{/pgf/fpu}
- %\tracingmacros=2\tracingcommands=2
- \mathparserTestCases
- }
-
- {
- \def\mathparserTestCases{%
- \assertEquals{sin(90)}{1.0}%
- \assertEquals{cos(90)}{0.0}%
- \assertEquals{tan(45)}{1.0}%
- \assertEquals{sec(45)}{1.41429}%
- \assertEquals{cosec(30)}{2.0}%
- \assertEquals{cot(15)}{3.73215}%
- \assertEquals{asin(0.7071)}{44.99945}%
- \assertEquals{acos(0.5)}{60}%
- \assertEquals{atan(1)}{45}%
- \assertEquals{atan(16001)}{90}%
- \assertEquals{atan(-16001)}{-90}%
- %\assertEquals{atan2(-4,3)}{-53.13011}%
- }%
- \testsection{Testing trig format=deg, basic layer (selected examples)}
- %\tracingmacros=2\tracingcommands=2
- \mathparserTestCases
-
- \testsection{Testing trig format=deg, FPU (selected examples)}
- \pgfkeys{/pgf/fpu}
- \mathparserTestCases
- }
-
- {
- \pgfkeys{/pgf/trig format=rad}
- \def\mathparserTestCases{%
- \assertEquals{sin(pi/2)}{1.0}%
- \assertEquals{cos(pi/2)}{0.0}%
- \assertEquals{tan(pi/4)}{1.0}%
- \assertEquals{sec(pi/4)}{1.41429}%
- \assertEquals{cosec(rad(30))}{2.0}%
- \assertEquals{cot(rad(15))}{3.73215}%
- \assertEquals{asin(0.7071)}{0.785388564086562}% 44.99945}%
- \assertEquals{acos(0.5)}{1.0471975511966}%
- \assertEquals{atan(1)}{0.785398163397448}%45}%
- \assertEquals{atan(16001)}{1.570796326794}%
- \assertEquals{atan(-16001)}{-1.570796326794}%
- %\assertEquals{atan2(-4,3)}{-53.13011}%
- }%
- \testsection{Testing trig format=rad, basic layer (selected examples)}
- %\tracingmacros=2\tracingcommands=2
- \mathparserTestCases
-
- \testsection{Testing trig format=rad, FPU (selected examples)}
- \pgfkeys{/pgf/fpu}
- \mathparserTestCases
- }
-}
-\end{document}
diff --git a/graphics/pgf/base/source/planarity_script.h b/graphics/pgf/base/source/planarity_script.h
deleted file mode 100644
index dd337fcc0e..0000000000
--- a/graphics/pgf/base/source/planarity_script.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
-
-#include "PlanarizationLayout_script.h"
-
-struct planarity_script :
- scripting::declarations
-{
- void declare (scripting::script s) {
- s.declare (new PlanarizationLayout_script);
- }
-};
diff --git a/graphics/pgf/base/source/tikzexternaltest.code.tex b/graphics/pgf/base/source/tikzexternaltest.code.tex
deleted file mode 100644
index 153a074255..0000000000
--- a/graphics/pgf/base/source/tikzexternaltest.code.tex
+++ /dev/null
@@ -1,41 +0,0 @@
-\parskip=1cm
-\parindent=0pt
-
-A small image with a filled circle follows here (with baseline): \tikz[baseline] \fill[red] (0,1cm) circle(2pt);
-
-\tikzsetnextfilename{\tikzexternalrealjob-setnextfilename}
-The next one uses
-\begin{tikzpicture}[baseline]
- \draw (0,0) grid (4,4);
-\end{tikzpicture}
-an explizit file name.
-
-\begin{tikzpicture}
- \node[draw,rounded corners] {A node with a ref (\ref{eq:1})};
-\end{tikzpicture}
-
-\begin{equation}
- 1+1=3
- \label{eq:1}
-\end{equation}
-
-\begin{tikzpicture}
- \node[draw,rounded corners] {A node which contains a label\label{a:label:in:a:picture}};
-\end{tikzpicture}
-
-The label inside of a node is on page~\pageref{a:label:in:a:picture}.
-
-\expandafter\ifx\csname pgfplotslegendfromname\endcsname\relax
-\else
-The following picture exports a legend to the aux file (if possible).
-\begin{tikzpicture}
- \begin{axis}[legend entries={1,2,3,4},legend to name=legend:name]
- \addplot {x};
- \addplot {x+1};
- \addplot {x+2};
- \addplot {x+3};
- \end{axis}
-\end{tikzpicture}
-
-Here is the legend: \pgfplotslegendfromname{legend:name}.
-\fi
diff --git a/graphics/pgf/base/source/tikzexternaltest.sharedpreamble.tex b/graphics/pgf/base/source/tikzexternaltest.sharedpreamble.tex
deleted file mode 100644
index d2577b01b1..0000000000
--- a/graphics/pgf/base/source/tikzexternaltest.sharedpreamble.tex
+++ /dev/null
@@ -1,20 +0,0 @@
-\documentclass[a4paper]{article}
-\usepackage[utf8]{inputenc}
-
-\usepackage{tikz}
-\usepackage{hyperref}
-
-\IfFileExists{pgfplots.sty}{%
- \usepackage{pgfplots}
-}{}%
-
-\IfFileExists{tikzlibraryexternal.code.tex}{%
- \usetikzlibrary{external}
-}{%
- \message{TEST IS RUNNING IN COMPATIBILITY MODE}%
- % a test to check for pgf 2.00 compatibility, to check whether the
- % external library copy shipped with pgfplots works:
- \usepgfplotslibrary{external}
-}%
-
-\pgfkeys{/pgf/images/include external/.code={\href{file:#1}{\pgfimage{#1}}}}
diff --git a/graphics/pgf/base/source/tikzexternaltest.tex b/graphics/pgf/base/source/tikzexternaltest.tex
deleted file mode 100644
index 2aaef55eff..0000000000
--- a/graphics/pgf/base/source/tikzexternaltest.tex
+++ /dev/null
@@ -1,12 +0,0 @@
-\input tikzexternaltest.sharedpreamble.tex
-
-\tikzexternalize{tikzexternaltest}
-
-\author{Christian Feuers\"anger}
-\title{Test with default config and Provided Basefilename}
-
-\begin{document}
-\maketitle
-\input{tikzexternaltest.code.tex}
-\end{document}
-
diff --git a/graphics/pgf/base/source/tikzexternaltestmakefile.tex b/graphics/pgf/base/source/tikzexternaltestmakefile.tex
deleted file mode 100644
index 232489823e..0000000000
--- a/graphics/pgf/base/source/tikzexternaltestmakefile.tex
+++ /dev/null
@@ -1,12 +0,0 @@
-\input tikzexternaltest.sharedpreamble.tex
-
-\tikzexternalize[mode=list and make]
-
-\author{Christian Feuers\"anger}
-\title{Test with mode list and make, automatic Basefilename}
-
-\begin{document}
-\maketitle
-\input{tikzexternaltest.code.tex}
-\end{document}
-
diff --git a/graphics/pgf/base/source/unittest_luamathparser.tex b/graphics/pgf/base/source/unittest_luamathparser.tex
deleted file mode 100644
index 225927eb41..0000000000
--- a/graphics/pgf/base/source/unittest_luamathparser.tex
+++ /dev/null
@@ -1,562 +0,0 @@
-\documentclass{article}
-
-\makeatletter
-\usepackage{pgf}
-\usepgflibrary{luamath,fpu}
-
-\begin{document}
-
-X
-
-\def\SHOW#1{%
- \dimen0=#1 %
- #1 = \the\dimen0
-}
-
-\SHOW{1pt}
-
-\SHOW{1mm}
-
-\SHOW{1cm}
-
-\SHOW{1in}
-
-\SHOW{1ex}
-
-\SHOW{1em}
-
-\SHOW{1bp}
-
-\SHOW{1pc}
-
-\SHOW{1dd}
-
-\SHOW{1cc}
-
-\SHOW{1sp}
-
-%\tracingmacros=2 \tracingcommands=2
-%
-\newif\ifcomparewithtex
-\newif\ifcomparewithfpu
-\pgfkeys{
- /ut/compare with TeX/.is if=comparewithtex,
- /ut/compare with TeX=true,
- /ut/compare with fpu/.is if=comparewithfpu,
- /ut/compare with fpu=true,
- /ut/.search also={/pgf/luamath},
- /pgf/luamath/show error message=true,
- /pgf/luamath/enable TeX fallback=false,
-}
-
-\newcount\numErrors
-
-% #1: options
-% #2: expression
-% #3: expected result
-% #4: expected 'units declared' (1 or 0)
-\def\parsertest{\pgfutil@ifnextchar[\parsertest@{\parsertest@[]}}%
-\def\parsertest@[#1]#2#3#4{%
- \begingroup
- \pgfqkeys{/ut}{#1}%
- \pgfluamathparse{#2}%
- \let\actual=\pgfmathresult
- \ifpgfmathunitsdeclared
- \def\actualunitsdeclared{1}%
- \else
- \def\actualunitsdeclared{0}%
- \fi
- %
- \ifcomparewithtex
- \ifpgfluamathusedTeXfallback
- \let\expectedTeX=\actual
- \else
- \pgfmathparse{#2}%
- \let\expectedTeX=\pgfmathresult
- \fi
- \else
- \def\expectedTeX{--}%
- \fi
- %
- \edef\expected{#3}%
- \def\success{1}%
- \ifx\expected\empty
- \ifx\actual\empty
- \else
- \def\success{0}%
- \fi
- \else
- \ifx\actual\expected
- \else
- \def\success{0}%
- \fi
- \fi
- %
- \if1\success
- \else
- \message{FAILURE for #2 expected \expected\space but was \actual^^J}%
- \global\advance\numErrors by1
- \fi
- %
- \if1\success
- \def\expectedunitsdeclared{#4}%
- \ifx\actualunitsdeclared\expectedunitsdeclared
- \else
- \def\success{0}%
- \message{FAILURE for #2 expected units declared #4 but was \actualunitsdeclared^^J}%
- \global\advance\numErrors by1
- \fi
- \fi
- %
- \if1\success
- \ifcomparewithtex
- % check against PGF's basic layer as reference:
- \dimen0=\actual pt %
- \dimen1=\expectedTeX pt %
- \advance\dimen0 by-\dimen1
- \ifdim\dimen0<0sp
- \dimen0=-\dimen0
- \fi
- \ifdim\dimen0 > 0.004pt %
- \def\success{0}%
- \message{FAILURE for #2 : matches expectations, but does NOT match TeX output (error \the\dimen0). expected \expectedTeX\space but was \actual^^J}%
- \global\advance\numErrors by1
- \fi
- %
- %
- \ifpgfmathunitsdeclared
- \def\actualTeXunitsdeclared{1}%
- \else
- \def\actualTeXunitsdeclared{0}%
- \fi
- \ifx\actualTeXunitsdeclared\actualunitsdeclared
- \else
- \message{WARNING for #2 : matches ALL expectations, but TeX's output does NOT match TeX expected units declared (TeX returns \actualTeXunitsdeclared, expectation = LUA is \actualunitsdeclared)^^J}%
- \fi
- \fi
- %
- \ifcomparewithfpu
- % check that FPU works as well. This
- % * tests the FPU
- % * tests that FPU values can be injected into the LUA backend:
- \begingroup
- \pgfkeys{/pgf/fpu,/pgf/fpu/output format=float}%
- \pgfmathparse{#2}%
- \xdef\actualfpu{\pgfmathresult}%
- \ifpgfmathunitsdeclared
- \xdef\actualfpuunitsdeclared{1}%
- \else
- \xdef\actualfpuunitsdeclared{0}%
- \fi
- \endgroup
- %
- \pgfkeys{/pgf/luamath/output format=fixed}%
- \pgfluamathparse{abs(\actual - \actualfpu) > 0.004}%
- \ifdim\pgfmathresult pt=1pt
- \def\success{0}%
- \pgfluamathparse{abs(\actual - \actualfpu)}%
- \message{FAILURE for #2 : matches expectations, but does NOT match output of FPU (error \pgfmathresult). fpu=\actualfpu\space lua=\actual^^J}%
- \global\advance\numErrors by1
- \fi
- \fi
- %
- \fi
- %
- \message{#2 = \actual\space (pgf=\expectedTeX) \if1\success OK\else FAILURE\fi^^J}%
- \endgroup
-}%
-
-\parsertest{1}{1.0}{0}
-\parsertest{ 1}{1.0}{0}
-\parsertest{-123}{-123.0}{0}
-\parsertest{+123}{123.0}{0}
-\parsertest{+1.23}{1.23}{0}
-\parsertest{+.123}{0.123}{0}
-\parsertest{1.23}{1.23}{0}
-\parsertest{1.}{1.0}{0}
-\parsertest{0.123}{0.123}{0}
-\parsertest{.123}{0.123}{0}
-\parsertest{1e4}{10000.0}{0}
-\parsertest{1e-4}{0.0001}{0}
-\parsertest{1e+4}{10000.0}{0}
-% only supported by FPU
-\parsertest[compare with TeX=false]{1Y1.23e4]}{12300.0}{0}
-\parsertest{1.23e-004}{0.000123}{0}
-\parsertest{004}{4.0}{0}
-\parsertest{1 + 10}{11.0}{0}
-\parsertest{1 - 10}{-9.0}{0}
-\parsertest{(1)}{1.0}{0}
-\parsertest{3 + 5*9 / (1+1) - 12}{13.5}{0}
-\parsertest{pi}{3.141593}{0}
-\parsertest{sin(0)}{0.0}{0}
-\parsertest{max(0,1)}{1.0}{0}
-\parsertest{min(0.01,-5)}{-5.0}{0}
-\parsertest{sin(90)}{1.0}{0}
-\parsertest{cos(90)}{0.0}{0}
-\parsertest{pow(2,3)}{8.0}{0}
-\parsertest{-pow(2,3)}{-8.0}{0}
-\parsertest{-pi}{-3.141593}{0}
-% this is actually UNSUPPORTED by TeX:
-\parsertest[compare with TeX=false]{inf}{inf}{0}
-\parsertest[compare with TeX=false]{INF}{inf}{0}
-\parsertest{not(100)}{0.0}{0}% non-trivial since the function is pgfluamathfunctions.notPGF
-\parsertest{2^2}{4.0}{0}
-% only supported by FPU
-\parsertest[compare with TeX=false]{1Y2.0e0]^2}{4.0}{0}
-\parsertest{0-2^2}{-4.0}{0}
-\parsertest{-2^2}{-4.0}{0}
-\parsertest{pi^2}{9.869604}{0}
-\parsertest{2^2+2}{6.0}{0}
-\parsertest{2^2-1}{3.0}{0}
-\parsertest{-1 + 4}{3.0}{0}
-\parsertest{2^2*5}{20.0}{0}
-\parsertest{2^(2+2)}{16.0}{0}
-\parsertest{multiply(2,3)^2}{36.0}{0}
-\parsertest{(2+3)^2}{25.0}{0}
-\parsertest{(2 + 3 ) ^ 2}{25.0}{0}
-\parsertest{2^add(1,1)}{4.0}{0}
-\parsertest{3!}{6.0}{0}
-\parsertest{1+3!}{7.0}{0}
-\parsertest{2*3!}{12.0}{0}
-\parsertest{3! + 1}{7.0}{0}
-\parsertest{3 !}{6.0}{0}
-\parsertest{3*2+4}{10.0}{0}
-\pgfmathdeclarefunction{x}{0}{\def\pgfmathresult{4}}%
-\pgfmathdeclarefunction{N1}{3}{\pgfmathparse{#1+#2+#3}}%
-\directlua{
-function pgfluamathfunctions.x()
- return 4
-end
-function pgfluamathfunctions.N1(x,m,n)
- return x+m+n
-end
-}
-\parsertest{2^x}{16.0}{0}
-\parsertest{exp(-x^2)}{0.0}{0} % requires output format=fpu
-\parsertest{N1(1,2,3)}{6.0}{0}
-\parsertest{ 1 + 2 * 4 ^ 2 }{33.0}{0}
-\parsertest{-x + 4}{0.0}{0}
-\parsertest{-x * 4}{-16.0}{0}
-\parsertest{-x * - 4}{16.0}{0}
-\parsertest{2*pi r}{360.0}{0}
-\parsertest{6.28318530717959 r}{360.0}{0}
-\parsertest{sin(2*pi r)}{-0.0}{0}
-\parsertest{1.5707963267949r + 1.5707963267949r}{180.0}{0}
-\parsertest{1 ? 42 : 0}{42.0}{0}
-\parsertest{0 ? 42 : 0}{0.0}{0}
-\parsertest{-1 + 1 ? 42 : 0}{0.0}{0}
-\parsertest{1 + (1 ? 42 : 0)}{43.0}{0}
-\parsertest{1 ? 42 : 0 ? 5 : 6}{5.0}{0}
-\parsertest{(1 ? 42 : 0) ? 5 : 6}{5.0}{0}
-\parsertest{43 == 43}{1.0}{0}
-\parsertest{43 == 42}{0.0}{0}
-\parsertest{43 != 43}{0.0}{0}
-\parsertest{43 != 42}{1.0}{0}
-\parsertest{43 > 42}{1.0}{0}
-\parsertest{43 > 44}{0.0}{0}
-\parsertest{43 < 42}{0.0}{0}
-\parsertest{43 < 44}{1.0}{0}
-\parsertest{43 <= 44}{1.0}{0}
-\parsertest{43 >= 44}{0.0}{0}
-\parsertest{43 >= 44 == 1}{0.0}{0}
-\parsertest{!1}{0.0}{0}
-\parsertest{! 1}{0.0}{0}
-\parsertest{! -1}{0.0}{0}
-\parsertest{--1}{1.0}{0}
-\parsertest{! !1}{1.0}{0}
-\parsertest{3! - !0}{5.0}{0}
-\parsertest{1 && 1 }{1.0}{0}
-\parsertest{1 && 0 || 1 }{1.0}{0}
-\parsertest{1 && 0 && 1 }{0.0}{0}
-\parsertest{1 || 0 }{1.0}{0}
-\parsertest{0 || 0 || 1 }{1.0}{0}
-
-% I test every function here to see that it is connected correctly
-\parsertest{abs(1)}{1.0}{0}
-\parsertest{add(1,2)}{3.0}{0}
-\parsertest{and(1,1)}{1.0}{0}
-% \parsertest{array(1)}{1.0}{0}
-\parsertest{asin(0.7071)}{44.999451}{0}
-\parsertest{atan(1)}{45.0}{0}
-\parsertest{atan2(-4,3)}{-53.130102}{0}
-% \parsertest{bin(1)}{1.0}{0}
-\parsertest{cos(60)}{0.5}{0}
-\parsertest{cosec(30)}{2.0}{0}
-\parsertest{cosh(0.5)}{1.127626}{0}
-\parsertest{cot(15)}{3.732051}{0}
-\parsertest{deg(2*pi)}{360.0}{0}
-% \parsertest{depth(1)}{1.0}{0}
-\parsertest[compare with fpu=false]{div(1,2)}{0.0}{0}
-\parsertest{divide(1,2)}{0.5}{0}
-\parsertest{e}{2.718282}{0}
-\parsertest{equal(1,2)}{0.0}{0}
-\parsertest{factorial(3)}{6.0}{0}
-\parsertest{false}{0.0}{0}
-\parsertest{floor(0)}{0.0}{0}
-\parsertest{floor(0.6)}{0.0}{0}
-\parsertest{floor(1.6)}{1.0}{0}
-\parsertest{floor(1)}{1.0}{0}
-\parsertest{floor(100)}{100.0}{0}
-\parsertest{floor(-100)}{-100.0}{0}
-\parsertest{floor(-0.6)}{-1.0}{0}
-\parsertest{floor(-1.6)}{-2.0}{0}
-\parsertest{floor(-15000.6)}{-15001.0}{0}
-\parsertest{floor(15000.6)}{15000.0}{0}
-\parsertest{ceil(0)}{0.0}{0}
-\parsertest{ceil(0.6)}{1.0}{0}
-\parsertest{ceil(1.6)}{2.0}{0}
-\parsertest{ceil(-0.6)}{-0.0}{0}
-\parsertest{ceil(-1.6)}{-1.0}{0}
-\parsertest{ceil(1)}{1.0}{0}
-\parsertest{ceil(100)}{100.0}{0}
-\parsertest{ceil(-100)}{-100.0}{0}
-\parsertest{ceil(-15000.6)}{-15000.0}{0}
-\parsertest{ceil(15000.6)}{15001.0}{0}
-\parsertest[compare with fpu=false]{frac(1.1)}{0.1}{0}
-\parsertest[compare with fpu=false]{frac(-1.1)}{0.1}{0}
-\parsertest[compare with fpu=false]{gcd(42,56)}{14.0}{0}
-\parsertest{greater(1,0)}{1.0}{0}
-% \parsertest{height(1)}{1.0}{0}
-% \parsertest{hex(1)}{1.0}{0}
-% \parsertest{Hex(1)}{1.0}{0}
-\parsertest{int(1.2)}{1.0}{0}
-\parsertest{int(-1.2)}{-1.0}{0}
-\parsertest{ifthenelse(1,2,3)}{2.0}{0}
-\parsertest[compare with fpu=false]{iseven(2)}{1.0}{0}
-\parsertest{isodd(1)}{1.0}{0}
-\parsertest[compare with fpu=false]{isprime(3)}{1.0}{0}
-\parsertest{less(1,2)}{1.0}{0}
-\parsertest{ln(e)}{1.0}{0}
-\parsertest{log10(100)}{2.0}{0}
-\parsertest{log2(2)}{1.0}{0}
-\parsertest{max(1,2)}{2.0}{0}
-\parsertest{min(1,2)}{1.0}{0}
-\parsertest{mod(20,6)}{2.0}{0}
-\parsertest{mod(-100,30)}{-10.0}{0}
-\parsertest[compare with fpu=false]{Mod(-100,30)}{20.0}{0}
-\parsertest{multiply(1,2)}{2.0}{0}
-\parsertest{neg(1)}{-1.0}{0}
-\parsertest{not(1)}{0.0}{0}
-\parsertest{notequal(1,1)}{0.0}{0}
-\parsertest{notgreater(1,1)}{1.0}{0}
-\parsertest{notless(1,1)}{1.0}{0}
-%\parsertest{oct(1)}{1.0}{0}
-\parsertest{or(1,0)}{1.0}{0}
-\parsertest{pi}{3.141593}{0}
-\parsertest{pow(2,2)}{4.0}{0}
-\parsertest{rad(180)}{3.141593}{0}
-% done below \parsertest{rand(1)}{1.0}{0}
-% done below \parsertest{random(1)}{1.0}{0}
-\parsertest[compare with fpu=false]{real(1)}{1.0}{0}
-% done below \parsertest{rnd(1)}{1.0}{0}
-\parsertest{round(1.5)}{2.0}{0}
-\parsertest{round(1.2)}{1.0}{0}
-\parsertest{round(1.9)}{2.0}{0}
-\parsertest{round(-1.9)}{-2.0}{0}
-\parsertest{round(-1.2)}{-1.0}{0}
-% \parsertest{scalar(1)}{1.0}{0}
-\parsertest{sec(45)}{1.414214}{0}
-\parsertest{sign(-1)}{-1.0}{0}
-\parsertest{sin(60)}{0.866025}{0}
-\parsertest{sinh(0.5)}{0.521095}{0}
-\parsertest{sqrt(4)}{2.0}{0}
-\parsertest{subtract(1,1)}{0.0}{0}
-\parsertest{tan(45)}{1.0}{0}
-\parsertest{tanh(0.5)}{0.462117}{0}
-\parsertest{true}{1.0}{0}
-\parsertest{veclen(12,5)}{13.0}{0}
-%\parsertest{width(1)}{1.0}{0}
-
-\parsertest{0 <0.1 && 4 <0.1}{0.0}{0}
-\parsertest{0 <0.1 || 4 <0.1}{1.0}{0}
-{
-\pgfkeys{/pgf/declare function={
- xx=4;
- yy=4;
-}}
-\parsertest{abs(xx-yy)<0.1 ? -42 : 42}{-42.0}{0}
-\parsertest{abs(xx-yy)<0.1 || abs(xx-0.5)<0.1}{1.0}{0}
-\parsertest{0 <0.1 || 4 <0.1}{1.0}{0}
-\parsertest{(abs(xx-yy)<0.1) || (abs(xx-0.5)<0.1)}{1.0}{0}
-\parsertest{abs(xx-yy)<0.1 || abs(xx-0.5)<0.1 ? -42 : 42}{-42.0}{0}
-\parsertest{4 < 2 || 5==5 ? -42 : 42}{-42.0}{0}
-}
-
-\parsertest{1pt}{1.0}{1}
-\parsertest{1mm}{2.845261}{1}
-\parsertest{1cm}{28.452744}{1}
-\parsertest{1in}{72.269989}{1}
-% \parsertest{1ex}{4.305542}{1}
-% \parsertest{1em}{10.000015}{1}
-\parsertest{1bp}{1.003738}{1}
-\parsertest{1dd}{1.070007}{1}
-\parsertest{1cc}{12.840103}{1}
-\parsertest{1sp}{0.000015}{1}
-\parsertest{1pc}{12.0}{1}
-% these TeX macros must be defined and set, of course!
-
-
-
-\count1=43
-% this is actually UNSUPPORTED by TeX:
-\parsertest[compare with TeX=false,compare with fpu=false]{\count1}{43.0}{0}
-%
-\newdimen\luamathparse@dimen
-\luamathparse@dimen=42pt
-\parsertest{1*\luamathparse@dimen}{42.0}{1}
-\parsertest{2\luamathparse@dimen}{84.0}{1}
-%
-\newcount\luamathparse@count
-\luamathparse@count=42
-\parsertest{1*\luamathparse@count}{42.0}{0}
-
-% this is a BUG in TeX, but works in LUA...:
-\parsertest[compare with TeX=false,compare with fpu=false]{0.5\luamathparse@count}{21.0}{0}
-%
-\setbox0=\hbox{1233}
-\parsertest{\wd0}{20.000061}{1}
-\parsertest{\ht0}{6.444443}{1}
-\parsertest{\dp0}{0.0}{1}
-
-%--------------------------------------------------
-% FIXME : these cases are still missing:
-% if false then
-% -- arrays created via '{}' and indexed with '[]'
-% -- strings with "<str>"
-% -- 'scalar' function
-% -- hex/octal/binary input
-% -- tex registers
-% -- What happens for undefined functions!? --> return nil and let TeX invoke its parser (no warning!?)
-% -- width/height/depth
-% end
-%--------------------------------------------------
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% The following tests are just for the TeX part, not for the LUA part.
-%
-%
-
-\parsertest[output format=float,compare with TeX=false]{4+4}{1Y8.0e+00]}{0}
-
-\begingroup
-\pgfmathdeclarefunction{testfct}{0}{\def\pgfmathresult{42.42}}
-\parsertest[parser,compare with TeX=false,compare with fpu=false,show error message=false]{testfct}{}{0}
-\parsertest[parser,enable TeX fallback]{testfct}{42.42}{0}
-
-\def\macro{1234}
-\pgfkeys{/pgf/declare function={res(\x)=\x*\macro;}}
-\parsertest[enable TeX fallback=true]{res(1)}{1234.0}{0}
-\endgroup
-
-% Check that setseed is communicated to LUA:
-\pgfmathsetseed{123}
-\parsertest[compare with TeX=false,compare with fpu=false]{rnd}{0.788318}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{rnd}{0.203068}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{rand}{-0.302874}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{rand}{-0.276781}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random}{0.134639}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random}{0.375968}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random(4)}{2.0}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random(4)}{1.0}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random(4,10)}{10.0}{0}
-\parsertest[compare with TeX=false,compare with fpu=false]{random(4,10)}{8.0}{0}
-
-\begingroup
-% Check that 'trig format' is property communicated to LUA and
-% implemented correctly:
-\parsertest{sin(50)}{0.766044}{0}%
-\parsertest{cos(50)}{0.642788}{0}%
-\parsertest{tan(50)}{1.191754}{0}%
-\parsertest{asin(0.766044)}{49.999961}{0}%
-\parsertest{acos(0.642788)}{49.999971}{0}%
-\parsertest{atan(1.191754)}{50.00001}{0}%
-\parsertest{atan2(-4,3)}{-53.130102}{0}%
-\parsertest{cot(50)}{0.8391}{0}%
-\parsertest{sec(50)}{1.555724}{0}%
-\parsertest{cosec(50)}{1.305407}{0}%
-%
-\pgfkeys{/pgf/trig format=rad}
-\parsertest{sin(0.5)}{0.479426}{0}%
-\parsertest{cos(0.5)}{0.877583}{0}%
-\parsertest{tan(0.5)}{0.546302}{0}%
-\parsertest{asin(0.5)}{0.523599}{0}%
-\parsertest{acos(0.5)}{1.047198}{0}%
-\parsertest{atan(0.5)}{0.463648}{0}%
-\parsertest{atan2(-4,3)}{-0.927295}{0}%
-\parsertest{cot(0.5)}{1.830488}{0}%
-\parsertest{sec(0.5)}{1.139494}{0}%
-\parsertest{cosec(0.5)}{2.08583}{0}%
-\endgroup
-
-\begingroup
-\pgfkeys{/pgf/declare function={mu1(\x,\i)=\x^\i;}}
-
-\parsertest{mu1(5,2)}{25.0}{0}
-% produces something different in TeX :-( See docs in LUA
-\parsertest[compare with TeX=false]{mu1(-5,2)}{25.0}{0}
-
-\begingroup
-\pgfkeys{/pgf/declare function={mu2=42;}}
-\parsertest{mu2}{42.0}{0}
-\endgroup
-% should have been clean up:
-\parsertest[show error message=false,compare with TeX=false,compare with fpu=false]{mu2}{}{0}
-% ... but this should NOT have been cleaned up!
-\parsertest{mu1(5,2)}{25.0}{0}
-
-\endgroup
-% should have been clean up:
-\parsertest[show error message=false,compare with TeX=false,compare with fpu=false]{mu1(-5,2)}{}{0}
-
-
-\def\pgfmathifexpressionTest#1{%
- \pgfmathifexpression{1000>999}{%
- % ok
- \message{PASSED for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
- }{%
- \message{FAILURE for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
- \global\advance\numErrors by1
- }%
-}
-
-\pgfmathifexpressionTest{basicmath}
-
-
-\begingroup
-\pgfkeys{/pgf/fpu}%
-\pgfmathifexpressionTest{fpu}
-\endgroup
-
-\begingroup
-\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
-\pgfmathifexpressionTest{fpu output fixed}
-\endgroup
-
-\begingroup
-\pgfkeys{/pgf/fpu,/pgf/fpu/output format=sci}%
-\pgfmathifexpressionTest{fpu output sci}
-\endgroup
-
-\begingroup
-\pgfkeys{/pgf/luamath/parser}%
-\pgfmathifexpressionTest{luamath}
-\endgroup
-
-\begingroup
-\pgfkeys{/pgf/luamath/parser,/pgf/luamath/output format=float}%
-\pgfmathifexpressionTest{luamath output float}
-\endgroup
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
-% NO MORE TEST CASES HERE!
-
-\ifnum\numErrors>0
- \PackageError{pgf}{Has \the\numErrors\space FAILURES}{}
-\else
- \message{All cases PASSED^^J}%
-\fi
-
-
-\end{document}