]> granicus.if.org Git - graphviz/commitdiff
lib/mingle: add guards, making headers safe to include from C++
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 25 Dec 2021 19:11:27 +0000 (11:11 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 4 Jan 2022 15:56:35 +0000 (07:56 -0800)
An upcoming change will convert cmd/mingle/minglemain.c to C++, which
includes some of these headers.

Related to #2154.

lib/mingle/agglomerative_bundling.h
lib/mingle/edge_bundling.h
lib/mingle/ink.h
lib/mingle/nearest_neighbor_graph.h

index d3c6222a84b56bb1b1852b5b787b3ff5212abc3a..c1c90fa1c967ee87df4cc69f46f264f45e1d4534 100644 (file)
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct Agglomerative_Ink_Bundling_struct *Agglomerative_Ink_Bundling;
 
 struct Agglomerative_Ink_Bundling_struct {
@@ -29,3 +33,7 @@ struct Agglomerative_Ink_Bundling_struct {
 };
 
 pedge* agglomerative_ink_bundling(int dim, SparseMatrix A, pedge* edges, int nneighbor, int max_recursion, double angle_param, double angle, int open_gl, int *flag);
+
+#ifdef __cplusplus
+}
+#endif
index 002312a156aeade541837dac14085fe4e6f9bf1f..013a034dd25998e218e905b3a28f9a6a738dacae 100644 (file)
 
 #include <sparse/SparseMatrix.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct pedge_struct {
   double wgt; /* weight, telling how many original edges this edge represent. If this edge consists of multiple sections of different weights then this is a lower bound. This only applied for agglomerative bundling */
   int npoints;/* number of poly points */
@@ -38,3 +42,7 @@ pedge pedge_double(pedge e);
 
 /* flip the polyline so that last point becomes the first, second last the second, etc*/
 pedge pedge_flip(pedge e);
+
+#ifdef __cplusplus
+}
+#endif
index 2f8c2ba8540258057b61da52da450920c532abfe..1cbba48437f9d891ca37f3e2fce1cd476b5229b5 100644 (file)
 
 #include <mingle/edge_bundling.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
   double x, y;
 } point_t;
@@ -32,3 +36,7 @@ double ink(pedge* edges, int numEdges, int *pick, double *ink0, point_t *meet1,
 double ink1(pedge e);
 
 extern double ink_count;
+
+#ifdef __cplusplus
+}
+#endif
index 6d26cb76dd9aba5fe6d2df68764947b1ab5f42b8..e4fad4a5b8f05c38de264e0380829df5bf72e66d 100644 (file)
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 SparseMatrix nearest_neighbor_graph(int nPts, int num_neigbors, double *x, double eps);
+
+#ifdef __cplusplus
+}
+#endif