From: Matthew Fernandez Date: Sat, 25 Dec 2021 19:11:27 +0000 (-0800) Subject: lib/mingle: add guards, making headers safe to include from C++ X-Git-Tag: 3.0.0~95^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22da493900f0a95f77ce8a2e55f4f1133006a517;p=graphviz lib/mingle: add guards, making headers safe to include from C++ An upcoming change will convert cmd/mingle/minglemain.c to C++, which includes some of these headers. Related to #2154. --- diff --git a/lib/mingle/agglomerative_bundling.h b/lib/mingle/agglomerative_bundling.h index d3c6222a8..c1c90fa1c 100644 --- a/lib/mingle/agglomerative_bundling.h +++ b/lib/mingle/agglomerative_bundling.h @@ -10,6 +10,10 @@ #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 diff --git a/lib/mingle/edge_bundling.h b/lib/mingle/edge_bundling.h index 002312a15..013a034dd 100644 --- a/lib/mingle/edge_bundling.h +++ b/lib/mingle/edge_bundling.h @@ -12,6 +12,10 @@ #include +#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 diff --git a/lib/mingle/ink.h b/lib/mingle/ink.h index 2f8c2ba85..1cbba4843 100644 --- a/lib/mingle/ink.h +++ b/lib/mingle/ink.h @@ -12,6 +12,10 @@ #include +#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 diff --git a/lib/mingle/nearest_neighbor_graph.h b/lib/mingle/nearest_neighbor_graph.h index 6d26cb76d..e4fad4a5b 100644 --- a/lib/mingle/nearest_neighbor_graph.h +++ b/lib/mingle/nearest_neighbor_graph.h @@ -10,4 +10,12 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + SparseMatrix nearest_neighbor_graph(int nPts, int num_neigbors, double *x, double eps); + +#ifdef __cplusplus +} +#endif