From 82219e1e2fa8954702bf82ea6236f728daed3fe2 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 22 Mar 2021 19:22:14 -0700 Subject: [PATCH] replace neatogen header guards with more modern #pragma once --- lib/neatogen/adjust.h | 6 +----- lib/neatogen/bfs.h | 7 ++----- lib/neatogen/call_tri.h | 6 +----- lib/neatogen/closest.h | 9 ++------- lib/neatogen/conjgrad.h | 9 ++------- lib/neatogen/defs.h | 7 ++----- lib/neatogen/delaunay.h | 5 +---- lib/neatogen/digcola.h | 6 ++---- lib/neatogen/dijkstra.h | 9 ++------- lib/neatogen/edges.h | 9 ++------- lib/neatogen/embed_graph.h | 9 ++------- lib/neatogen/geometry.h | 10 ++-------- lib/neatogen/heap.h | 9 ++------- lib/neatogen/hedges.h | 9 ++------- lib/neatogen/info.h | 7 ++----- lib/neatogen/kkutils.h | 9 ++------- lib/neatogen/matrix_ops.h | 8 ++------ lib/neatogen/mem.h | 10 ++-------- lib/neatogen/mosek_quad_solve.h | 6 ++---- lib/neatogen/multispline.h | 5 +---- lib/neatogen/neato.h | 6 +----- lib/neatogen/neatoprocs.h | 4 +--- lib/neatogen/overlap.h | 4 +--- lib/neatogen/pca.h | 9 ++------- lib/neatogen/poly.h | 7 ++----- lib/neatogen/quad_prog_solver.h | 7 ++----- lib/neatogen/quad_prog_vpsc.h | 7 ++----- lib/neatogen/randomkit.h | 7 ++----- lib/neatogen/sgd.h | 7 ++----- lib/neatogen/site.h | 8 ++------ lib/neatogen/sparsegraph.h | 7 ++----- lib/neatogen/stress.h | 8 ++------ lib/neatogen/voronoi.h | 10 ++-------- 33 files changed, 59 insertions(+), 187 deletions(-) diff --git a/lib/neatogen/adjust.h b/lib/neatogen/adjust.h index 562414de1..33daf3849 100644 --- a/lib/neatogen/adjust.h +++ b/lib/neatogen/adjust.h @@ -8,10 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ - - -#ifndef ADJUST_H -#define ADJUST_H +#pragma once #ifdef __cplusplus extern "C" { @@ -57,4 +54,3 @@ typedef struct { #ifdef __cplusplus } #endif -#endif diff --git a/lib/neatogen/bfs.h b/lib/neatogen/bfs.h index dc5590ea6..60169e179 100644 --- a/lib/neatogen/bfs.h +++ b/lib/neatogen/bfs.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef _BFS_H_ -#define _BFS_H_ - #include typedef struct { @@ -34,8 +33,6 @@ extern "C" { extern int bfs_bounded(int, vtx_data *, int, DistType *, Queue *, int, int *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/call_tri.h b/lib/neatogen/call_tri.h index 43d19f1ed..a87af2f14 100644 --- a/lib/neatogen/call_tri.h +++ b/lib/neatogen/call_tri.h @@ -8,11 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ -#ifndef CALL_TRI_H -#define CALL_TRI_H +#pragma once SparseMatrix call_tri(int n, int dim, real * x); SparseMatrix call_tri2(int n, int dim, real * x); - -#endif - diff --git a/lib/neatogen/closest.h b/lib/neatogen/closest.h index 886abdb62..83dc4c85e 100644 --- a/lib/neatogen/closest.h +++ b/lib/neatogen/closest.h @@ -8,21 +8,16 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef CLOSEST_H -#define CLOSEST_H - #include extern void closest_pairs2graph(double *, int, int, vtx_data **); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/conjgrad.h b/lib/neatogen/conjgrad.h index c2327132b..6c1e679aa 100644 --- a/lib/neatogen/conjgrad.h +++ b/lib/neatogen/conjgrad.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef _CG_H_ -#define _CG_H_ - #include /************************* @@ -36,8 +33,6 @@ extern "C" { extern int conjugate_gradient_mkernel(float *, float *, float *, int, double, int); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/defs.h b/lib/neatogen/defs.h index f49d96cc9..758cabde4 100644 --- a/lib/neatogen/defs.h +++ b/lib/neatogen/defs.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef _DEFS_H_ -#define _DEFS_H_ - #include #include @@ -37,5 +36,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif diff --git a/lib/neatogen/delaunay.h b/lib/neatogen/delaunay.h index cf3e34b9d..54b4e4d1e 100644 --- a/lib/neatogen/delaunay.h +++ b/lib/neatogen/delaunay.h @@ -8,8 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ -#ifndef DELAUNAY_H -#define DELAUNAY_H +#pragma once #include @@ -32,5 +31,3 @@ v_data *UG_graph(double *x, double *y, int n, int accurate_computation); surface_t* mkSurface (double *x, double *y, int n, int* segs, int nsegs); void freeSurface (surface_t* s); - -#endif diff --git a/lib/neatogen/digcola.h b/lib/neatogen/digcola.h index cae379596..0ed2f228e 100644 --- a/lib/neatogen/digcola.h +++ b/lib/neatogen/digcola.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef DIGCOLA_H -#define DIGCOLA_H - #include #ifdef DIGCOLA extern int compute_y_coords(vtx_data*, int, double*, int); @@ -44,7 +43,6 @@ typedef struct ipsep_options { extern int stress_majorization_cola(vtx_data*, int, int, double**, node_t**, int, int, int, ipsep_options*); #endif #endif -#endif #ifdef __cplusplus } diff --git a/lib/neatogen/dijkstra.h b/lib/neatogen/dijkstra.h index d4dd79778..76fd1bb23 100644 --- a/lib/neatogen/dijkstra.h +++ b/lib/neatogen/dijkstra.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef _DIJKSTRA_H_ -#define _DIJKSTRA_H_ - #include #include @@ -28,8 +25,6 @@ extern "C" { int *); extern int dijkstra_sgd(graph_sgd *, int, term_sgd *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/edges.h b/lib/neatogen/edges.h index ddda3f77f..ceb162407 100644 --- a/lib/neatogen/edges.h +++ b/lib/neatogen/edges.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef EDGES_H -#define EDGES_H - #include typedef struct Edge { @@ -35,8 +32,6 @@ extern "C" { extern void clip_line(Edge * e); extern Edge *gvbisect(Site *, Site *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/embed_graph.h b/lib/neatogen/embed_graph.h index e8a73d1e5..85e6276b4 100644 --- a/lib/neatogen/embed_graph.h +++ b/lib/neatogen/embed_graph.h @@ -8,23 +8,18 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef EMBED_GRAPH_H_ -#define EMBED_GRAPH_H_ - #include extern void embed_graph(vtx_data * graph, int n, int dim, DistType ***, int); extern void center_coordinate(DistType **, int, int); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/geometry.h b/lib/neatogen/geometry.h index 217fb1c7e..010e23dd6 100644 --- a/lib/neatogen/geometry.h +++ b/lib/neatogen/geometry.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef GEOMETRY_H -#define GEOMETRY_H - #ifdef HAVE_POINTF_S typedef pointf Point; #else @@ -41,9 +38,6 @@ extern "C" { extern int leftOf(Point a, Point b, Point c); extern int intersection(Point a, Point b, Point c, Point d, Point * p); -#endif - - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/heap.h b/lib/neatogen/heap.h index c3d4055c8..adac235d1 100644 --- a/lib/neatogen/heap.h +++ b/lib/neatogen/heap.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef HEAP_H -#define HEAP_H - #include extern void PQinitialize(void); @@ -27,8 +24,6 @@ extern "C" { extern void PQdelete(Halfedge *); extern void PQinsert(Halfedge *, Site *, double); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/hedges.h b/lib/neatogen/hedges.h index 5c28d84e7..273db6892 100644 --- a/lib/neatogen/hedges.h +++ b/lib/neatogen/hedges.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef HEDGES_H -#define HEDGES_H - #include #include @@ -44,8 +41,6 @@ extern "C" { extern Halfedge *ELleftbnd(Point *); extern Site *leftreg(Halfedge *), *rightreg(Halfedge *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/info.h b/lib/neatogen/info.h index d926fc6ea..0f7d9e2d9 100644 --- a/lib/neatogen/info.h +++ b/lib/neatogen/info.h @@ -8,14 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - -#ifndef INFO_H -#define INFO_H - #include #include @@ -38,7 +36,6 @@ extern "C" { extern void infoinit(void); /* Insert vertex into sorted list */ extern void addVertex(Site *, double, double); -#endif #ifdef __cplusplus } diff --git a/lib/neatogen/kkutils.h b/lib/neatogen/kkutils.h index 9f64257d2..1dbda4807 100644 --- a/lib/neatogen/kkutils.h +++ b/lib/neatogen/kkutils.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef KKUTILS_H_ -#define KKUTILS_H_ - #include extern void fill_neighbors_vec_unweighted(vtx_data *, int vtx, @@ -33,8 +30,6 @@ extern "C" { extern void restore_old_weights(vtx_data * graph, int n, float *old_weights); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/matrix_ops.h b/lib/neatogen/matrix_ops.h index b566d14c9..cb9832186 100644 --- a/lib/neatogen/matrix_ops.h +++ b/lib/neatogen/matrix_ops.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef _MATRIX_OPS_H_ -#define _MATRIX_OPS_H_ - #include extern void cpvec(double *, int, int, double *); @@ -79,7 +76,6 @@ extern "C" { extern void sqrt_vec(int n, float *vec); extern void sqrt_vecf(int n, float *source, float *target); extern void invert_sqrt_vec(int n, float *vec); -#endif #ifdef __cplusplus } diff --git a/lib/neatogen/mem.h b/lib/neatogen/mem.h index 3a2fb4b30..c4ad8d55d 100644 --- a/lib/neatogen/mem.h +++ b/lib/neatogen/mem.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef MEMORY_H -#define MEMORY_H - #include /* Support for freelists */ @@ -31,9 +28,6 @@ extern "C" { extern void freeinit(Freelist *, int); extern void makefree(void *, Freelist *); -#endif - - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/mosek_quad_solve.h b/lib/neatogen/mosek_quad_solve.h index 8c04da814..86e3441ad 100644 --- a/lib/neatogen/mosek_quad_solve.h +++ b/lib/neatogen/mosek_quad_solve.h @@ -14,9 +14,9 @@ * Adaptagrams repository. */ +#pragma once + #ifdef MOSEK -#ifndef _QSOLVE_H_ -#define _QSOLVE_H_ #include /* Include the MOSEK definition file. */ #include "types.h" @@ -38,6 +38,4 @@ MosekEnv* mosek_init_sep(float* lap, int nv, int ndv, Constraint** cs, int m); void mosek_quad_solve_sep(MosekEnv*,int n,float *b,float* coords); void mosek_delete(MosekEnv*); - -#endif /* _QSOLVE_H_ */ #endif /* MOSEK */ diff --git a/lib/neatogen/multispline.h b/lib/neatogen/multispline.h index 50255391a..ec32fdbca 100644 --- a/lib/neatogen/multispline.h +++ b/lib/neatogen/multispline.h @@ -8,8 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ -#ifndef MULTISPLINE_H -#define MULTISPLINE_H +#pragma once #include #include @@ -19,5 +18,3 @@ typedef struct router_s router_t; extern void freeRouter (router_t* rtr); extern router_t* mkRouter (Ppoly_t** obs, int npoly); extern int makeMultiSpline(graph_t* g, edge_t* e, router_t * rtr, int); - -#endif diff --git a/lib/neatogen/neato.h b/lib/neatogen/neato.h index e46b12ba1..909ca0165 100644 --- a/lib/neatogen/neato.h +++ b/lib/neatogen/neato.h @@ -8,9 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ - -#ifndef NEATO_H -#define NEATO_H +#pragma once #include "config.h" @@ -34,5 +32,3 @@ #include "pathplan.h" #include #include - -#endif /* NEATO_H */ diff --git a/lib/neatogen/neatoprocs.h b/lib/neatogen/neatoprocs.h index 7541c7f39..51ea9532b 100644 --- a/lib/neatogen/neatoprocs.h +++ b/lib/neatogen/neatoprocs.h @@ -8,8 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ -#ifndef NEATOPROCS_H -#define NEATOPROCS_H +#pragma once #ifdef __cplusplus extern "C" { @@ -72,4 +71,3 @@ extern "C" { #ifdef __cplusplus } #endif -#endif diff --git a/lib/neatogen/overlap.h b/lib/neatogen/overlap.h index fec6c6ded..13e03c37a 100644 --- a/lib/neatogen/overlap.h +++ b/lib/neatogen/overlap.h @@ -8,8 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ -#ifndef OVERLAP_H -#define OVERLAP_H +#pragma once #include @@ -52,4 +51,3 @@ real OverlapSmoother_smooth(OverlapSmoother sm, int dim, real *x); void remove_overlap(int dim, SparseMatrix A, real *x, real *label_sizes, int ntry, real initial_scaling, int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int doShrink, int *flag); real overlap_scaling(int dim, int m, real *x, real *width, real scale_sta, real scale_sto, real epsilon, int maxiter); -#endif diff --git a/lib/neatogen/pca.h b/lib/neatogen/pca.h index bc3c5b2b7..c13f3b3ed 100644 --- a/lib/neatogen/pca.h +++ b/lib/neatogen/pca.h @@ -8,22 +8,17 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef PCA_H -#define PCA_H - #include extern void PCA_alloc(DistType **, int, int, double **, int); extern boolean iterativePCA_1D(double **, int, int, double *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/poly.h b/lib/neatogen/poly.h index 73c3e4edd..b401b7f45 100644 --- a/lib/neatogen/poly.h +++ b/lib/neatogen/poly.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef POLY_H -#define POLY_H - #include typedef struct { @@ -31,8 +30,6 @@ extern "C" { extern int makeAddPoly(Poly *, Agnode_t *, float, float); extern void breakPoly(Poly *); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/quad_prog_solver.h b/lib/neatogen/quad_prog_solver.h index 0ab89e092..efe42f10b 100644 --- a/lib/neatogen/quad_prog_solver.h +++ b/lib/neatogen/quad_prog_solver.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef _CMAJ_H_ -#define _CMAJ_H_ - #ifdef DIGCOLA typedef struct { @@ -53,8 +52,6 @@ extern float** unpackMatrix(float * packedMat, int n); #endif -#endif /* _CMAJ_H_ */ - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/quad_prog_vpsc.h b/lib/neatogen/quad_prog_vpsc.h index 9c5c32102..f9a57372d 100644 --- a/lib/neatogen/quad_prog_vpsc.h +++ b/lib/neatogen/quad_prog_vpsc.h @@ -19,13 +19,12 @@ * * **********************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef _QUAD_PROG_VPSC_H_ -#define _QUAD_PROG_VPSC_H_ - #ifdef DIGCOLA #include @@ -85,8 +84,6 @@ extern void print_digcola_levels(FILE* logfile, DigColaLevel *levels, int num_le int get_num_digcola_constraints(DigColaLevel *levels, int num_levels); #endif -#endif /* _QUAD_PROG_VPSC_H_ */ - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/randomkit.h b/lib/neatogen/randomkit.h index 899ab8233..8d4373036 100644 --- a/lib/neatogen/randomkit.h +++ b/lib/neatogen/randomkit.h @@ -54,10 +54,9 @@ * defaults to "/dev/urandom" */ -#include +#pragma once -#ifndef _RANDOMKIT_ -#define _RANDOMKIT_ +#include #define RK_STATE_LEN 624 @@ -144,5 +143,3 @@ extern double rk_double(rk_state *state); #ifdef __cplusplus } #endif - -#endif /* _RANDOMKIT_ */ diff --git a/lib/neatogen/sgd.h b/lib/neatogen/sgd.h index fcad8d091..feed10a3a 100644 --- a/lib/neatogen/sgd.h +++ b/lib/neatogen/sgd.h @@ -1,10 +1,9 @@ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef SGD_H -#define SGD_H - typedef struct term_sgd { int i, j; float d, w; @@ -21,8 +20,6 @@ typedef struct graph_sgd { extern void sgd(graph_t *, int); -#endif /* SGD_H */ - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/site.h b/lib/neatogen/site.h index 75591723f..7cad63e21 100644 --- a/lib/neatogen/site.h +++ b/lib/neatogen/site.h @@ -8,15 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef SITE_H -#define SITE_H - #include /* Sites are also used as vertices on line segments */ @@ -35,7 +32,6 @@ extern "C" { extern void deref(Site *); /* Increment refcnt of site */ extern void ref(Site *); /* Decrement refcnt of site */ extern void makevertex(Site *); /* Transform a site into a vertex */ -#endif #ifdef __cplusplus } diff --git a/lib/neatogen/sparsegraph.h b/lib/neatogen/sparsegraph.h index d7fc4ada6..c463337e1 100644 --- a/lib/neatogen/sparsegraph.h +++ b/lib/neatogen/sparsegraph.h @@ -8,13 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif -#ifndef SPARSEGRAPH_H -#define SPARSEGRAPH_H - #include "config.h" #ifdef USE_STYLES @@ -44,8 +43,6 @@ extern "C" { extern void freeGraphData(vtx_data * graph); extern void freeGraph(v_data * graph); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/stress.h b/lib/neatogen/stress.h index 41602b7b6..3e1d85a35 100644 --- a/lib/neatogen/stress.h +++ b/lib/neatogen/stress.h @@ -8,14 +8,12 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - -#ifndef STRESS_H -#define STRESS_H - #include #define tolerance_cg 1e-3 @@ -59,8 +57,6 @@ extern float* circuitModel(vtx_data * graph, int nG); extern float* mdsModel (vtx_data * graph, int nG); extern int initLayout(vtx_data * graph, int n, int dim, double **coords, node_t** nodes); -#endif - #ifdef __cplusplus } #endif diff --git a/lib/neatogen/voronoi.h b/lib/neatogen/voronoi.h index f50c8a1ca..7ee78456d 100644 --- a/lib/neatogen/voronoi.h +++ b/lib/neatogen/voronoi.h @@ -8,22 +8,16 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#pragma once + #ifdef __cplusplus extern "C" { #endif - - -#ifndef VORONOI_H -#define VORONOI_H - #include extern void voronoi(int, Site * (*)(void)); -#endif - - #ifdef __cplusplus } #endif -- 2.40.0