From f7e18bc8c19e84456607e842df3b4e94df0c5506 Mon Sep 17 00:00:00 2001 From: abeham Date: Wed, 3 Aug 2016 17:08:23 +0200 Subject: [PATCH 1/5] Fix linker errors and add declspec dll exports to several functions --- include/igraph_centrality.h | 67 +++++++++++------- include/igraph_cliques.h | 47 +++++++++---- include/igraph_cocitation.h | 35 +++++++--- include/igraph_components.h | 29 ++++++-- include/igraph_constructors.h | 55 +++++++++------ include/igraph_conversion.h | 31 +++++++-- include/igraph_dqueue.h | 17 +++++ include/igraph_dqueue_pmt.h | 24 +++---- include/igraph_eigen.h | 25 +++++-- include/igraph_flow.h | 59 ++++++++++------ include/igraph_foreign.h | 53 ++++++++++----- include/igraph_heap.h | 17 +++++ include/igraph_heap_pmt.h | 18 ++--- include/igraph_hrg.h | 39 ++++++++--- include/igraph_interface.h | 59 ++++++++++------ include/igraph_iterators.h | 95 +++++++++++++++----------- include/igraph_layout.h | 67 +++++++++++------- include/igraph_matching.h | 25 +++++-- include/igraph_matrix.h | 17 +++++ include/igraph_matrix_pmt.h | 122 ++++++++++++++++----------------- include/igraph_neighborhood.h | 23 ++++++- include/igraph_nongraph.h | 31 +++++++-- include/igraph_operators.h | 35 +++++++--- include/igraph_paths.h | 53 ++++++++++----- include/igraph_random.h | 55 +++++++++------ include/igraph_stack.h | 17 +++++ include/igraph_stack_pmt.h | 18 ++--- include/igraph_structural.h | 77 +++++++++++++-------- include/igraph_strvector.h | 51 +++++++++----- include/igraph_transitivity.h | 31 +++++++-- include/igraph_types.h | 27 ++++++-- include/igraph_vector.h | 17 +++++ include/igraph_vector_pmt.h | 136 ++++++++++++++++++------------------- msvc/igraph.vcproj | 8 +-- src/CHOLMOD/Include/cholmod_blas.h | 2 +- src/Makefile.am | 6 +- src/cliquer/{graph.c => graph2.c} | 0 src/{heap.c => heap2.c} | 0 38 files changed, 982 insertions(+), 506 deletions(-) rename src/cliquer/{graph.c => graph2.c} (100%) rename src/{heap.c => heap2.c} (100%) diff --git a/include/igraph_centrality.h b/include/igraph_centrality.h index bd2d88b10..3df2c8b93 100644 --- a/include/igraph_centrality.h +++ b/include/igraph_centrality.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -46,27 +63,27 @@ __BEGIN_DECLS /* Centrality */ /* -------------------------------------------------- */ -int igraph_closeness(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_closeness(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode, const igraph_vector_t *weights, igraph_bool_t normalized); -int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_real_t cutoff, const igraph_vector_t *weights, igraph_bool_t normalized); -int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_bool_t directed, const igraph_vector_t *weights, igraph_bool_t nobigint); -int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_bool_t directed, igraph_real_t cutoff, const igraph_vector_t *weights, igraph_bool_t nobigint); -int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result, +DECLDIR int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result, igraph_bool_t directed, const igraph_vector_t *weigths); -int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result, +DECLDIR int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result, igraph_bool_t directed, igraph_real_t cutoff, const igraph_vector_t *weights); int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res, @@ -109,18 +126,18 @@ typedef struct igraph_pagerank_power_options_t { igraph_real_t eps; } igraph_pagerank_power_options_t; -int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo, +DECLDIR int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo, igraph_vector_t *vector, igraph_real_t *value, const igraph_vs_t vids, igraph_bool_t directed, igraph_real_t damping, const igraph_vector_t *weights, void *options); -int igraph_personalized_pagerank(const igraph_t *graph, +DECLDIR int igraph_personalized_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo, igraph_vector_t *vector, igraph_real_t *value, const igraph_vs_t vids, igraph_bool_t directed, igraph_real_t damping, igraph_vector_t *reset, const igraph_vector_t *weights, void *options); -int igraph_personalized_pagerank_vs(const igraph_t *graph, +DECLDIR int igraph_personalized_pagerank_vs(const igraph_t *graph, igraph_pagerank_algo_t algo, igraph_vector_t *vector, igraph_real_t *value, const igraph_vs_t vids, @@ -128,32 +145,32 @@ int igraph_personalized_pagerank_vs(const igraph_t *graph, igraph_vs_t reset_vids, const igraph_vector_t *weights, void *options); -int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector, +DECLDIR int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector, igraph_real_t *value, igraph_bool_t directed, igraph_bool_t scale, const igraph_vector_t *weights, igraph_arpack_options_t *options); -int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector, +DECLDIR int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector, igraph_real_t *value, igraph_bool_t scale, const igraph_vector_t *weights, igraph_arpack_options_t *options); -int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector, +DECLDIR int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector, igraph_real_t *value, igraph_bool_t scale, const igraph_vector_t *weights, igraph_arpack_options_t *options); -int igraph_constraint(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_constraint(const igraph_t *graph, igraph_vector_t *res, igraph_vs_t vids, const igraph_vector_t *weights); -int igraph_strength(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_strength(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops, const igraph_vector_t *weights); -int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result, +DECLDIR int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result, igraph_vector_t *ins, igraph_vector_t *outs); -int igraph_sort_vertex_ids_by_degree(const igraph_t *graph, +DECLDIR int igraph_sort_vertex_ids_by_degree(const igraph_t *graph, igraph_vector_t *outvids, igraph_vs_t vids, igraph_neimode_t mode, @@ -161,45 +178,45 @@ int igraph_sort_vertex_ids_by_degree(const igraph_t *graph, igraph_order_t order, igraph_bool_t only_indices); -igraph_real_t igraph_centralization(const igraph_vector_t *scores, +DECLDIR igraph_real_t igraph_centralization(const igraph_vector_t *scores, igraph_real_t theoretical_max, igraph_bool_t normalized); -int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res, igraph_neimode_t mode, igraph_bool_t loops, igraph_real_t *centralization, igraph_real_t *theoretical_max, igraph_bool_t normalized); -int igraph_centralization_degree_tmax(const igraph_t *graph, +DECLDIR int igraph_centralization_degree_tmax(const igraph_t *graph, igraph_integer_t nodes, igraph_neimode_t mode, igraph_bool_t loops, igraph_real_t *res); -int igraph_centralization_betweenness(const igraph_t *graph, +DECLDIR int igraph_centralization_betweenness(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t directed, igraph_bool_t nobigint, igraph_real_t *centralization, igraph_real_t *theoretical_max, igraph_bool_t normalized); -int igraph_centralization_betweenness_tmax(const igraph_t *graph, +DECLDIR int igraph_centralization_betweenness_tmax(const igraph_t *graph, igraph_integer_t nodes, igraph_bool_t directed, igraph_real_t *res); -int igraph_centralization_closeness(const igraph_t *graph, +DECLDIR int igraph_centralization_closeness(const igraph_t *graph, igraph_vector_t *res, igraph_neimode_t mode, igraph_real_t *centralization, igraph_real_t *theoretical_max, igraph_bool_t normalized); -int igraph_centralization_closeness_tmax(const igraph_t *graph, +DECLDIR int igraph_centralization_closeness_tmax(const igraph_t *graph, igraph_integer_t nodes, igraph_neimode_t mode, igraph_real_t *res); -int igraph_centralization_eigenvector_centrality( +DECLDIR int igraph_centralization_eigenvector_centrality( const igraph_t *graph, igraph_vector_t *vector, igraph_real_t *value, @@ -209,7 +226,7 @@ int igraph_centralization_eigenvector_centrality( igraph_real_t *centralization, igraph_real_t *theoretical_max, igraph_bool_t normalized); -int igraph_centralization_eigenvector_centrality_tmax( +DECLDIR int igraph_centralization_eigenvector_centrality_tmax( const igraph_t *graph, igraph_integer_t nodes, igraph_bool_t directed, diff --git a/include/igraph_cliques.h b/include/igraph_cliques.h index 5f4976793..3993e86de 100644 --- a/include/igraph_cliques.h +++ b/include/igraph_cliques.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_vector_ptr.h" @@ -44,17 +61,17 @@ __BEGIN_DECLS /* Cliques, maximal independent vertex sets */ /* -------------------------------------------------- */ -int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, +DECLDIR int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_maximal_cliques_file(const igraph_t *graph, +DECLDIR int igraph_maximal_cliques_file(const igraph_t *graph, FILE *outfile, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_maximal_cliques_count(const igraph_t *graph, +DECLDIR int igraph_maximal_cliques_count(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_maximal_cliques_subset(const igraph_t *graph, +DECLDIR int igraph_maximal_cliques_subset(const igraph_t *graph, igraph_vector_int_t *subset, igraph_vector_ptr_t *res, igraph_integer_t *no, @@ -62,29 +79,29 @@ int igraph_maximal_cliques_subset(const igraph_t *graph, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, +DECLDIR int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist, +DECLDIR int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_largest_cliques(const igraph_t *graph, +DECLDIR int igraph_largest_cliques(const igraph_t *graph, igraph_vector_ptr_t *cliques); -int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no); -int igraph_weighted_cliques(const igraph_t *graph, +DECLDIR int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no); +DECLDIR int igraph_weighted_cliques(const igraph_t *graph, const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res, igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal); -int igraph_largest_weighted_cliques(const igraph_t *graph, +DECLDIR int igraph_largest_weighted_cliques(const igraph_t *graph, const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res); -int igraph_weighted_clique_number(const igraph_t *graph, +DECLDIR int igraph_weighted_clique_number(const igraph_t *graph, const igraph_vector_t *vertex_weights, igraph_real_t *res); -int igraph_independent_vertex_sets(const igraph_t *graph, +DECLDIR int igraph_independent_vertex_sets(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_integer_t min_size, igraph_integer_t max_size); -int igraph_largest_independent_vertex_sets(const igraph_t *graph, +DECLDIR int igraph_largest_independent_vertex_sets(const igraph_t *graph, igraph_vector_ptr_t *res); -int igraph_maximal_independent_vertex_sets(const igraph_t *graph, +DECLDIR int igraph_maximal_independent_vertex_sets(const igraph_t *graph, igraph_vector_ptr_t *res); -int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no); +DECLDIR int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no); /** * \typedef igraph_clique_handler_t diff --git a/include/igraph_cocitation.h b/include/igraph_cocitation.h index eff0867cc..7499a21e2 100644 --- a/include/igraph_cocitation.h +++ b/include/igraph_cocitation.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_types.h" #include "igraph_matrix.h" #include "igraph_datatype.h" @@ -45,28 +62,28 @@ __BEGIN_DECLS /* Cocitation and other similarity measures */ /* -------------------------------------------------- */ -int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t vids); -int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t vids); -int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res, const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res, const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res, const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res, const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_similarity_inverse_log_weighted(const igraph_t *graph, +DECLDIR int igraph_similarity_inverse_log_weighted(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t vids, igraph_neimode_t mode); diff --git a/include/igraph_components.h b/include/igraph_components.h index b243be9c4..93119a291 100644 --- a/include/igraph_components.h +++ b/include/igraph_components.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -46,18 +63,18 @@ __BEGIN_DECLS /* Components */ /* -------------------------------------------------- */ -int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership, +DECLDIR int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership, igraph_vector_t *csize, igraph_integer_t *no, igraph_connectedness_t mode); -int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res, +DECLDIR int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res, igraph_connectedness_t mode); -void igraph_decompose_destroy(igraph_vector_ptr_t *complist); -int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components, +DECLDIR void igraph_decompose_destroy(igraph_vector_ptr_t *complist); +DECLDIR int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components, igraph_connectedness_t mode, long int maxcompno, long int minelements); -int igraph_articulation_points(const igraph_t *graph, +DECLDIR int igraph_articulation_points(const igraph_t *graph, igraph_vector_t *res); -int igraph_biconnected_components(const igraph_t *graph, +DECLDIR int igraph_biconnected_components(const igraph_t *graph, igraph_integer_t *no, igraph_vector_ptr_t *tree_edges, igraph_vector_ptr_t *component_edges, diff --git a/include/igraph_constructors.h b/include/igraph_constructors.h index e2572c186..444cdedf3 100644 --- a/include/igraph_constructors.h +++ b/include/igraph_constructors.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_matrix.h" @@ -45,40 +62,40 @@ __BEGIN_DECLS /* Constructors, deterministic */ /* -------------------------------------------------- */ -int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n, +DECLDIR int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n, igraph_bool_t directed); -int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, +DECLDIR int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, ...); -int igraph_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, +DECLDIR int igraph_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, igraph_adjacency_t mode); -int igraph_weighted_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, +DECLDIR int igraph_weighted_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, igraph_adjacency_t mode, const char* attr, igraph_bool_t loops); -int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode, +DECLDIR int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode, igraph_integer_t center); -int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei, +DECLDIR int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei, igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular); -int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, +DECLDIR int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular); -int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children, +DECLDIR int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children, igraph_tree_mode_t type); -int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops); -int igraph_full_citation(igraph_t *graph, igraph_integer_t n, +DECLDIR int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops); +DECLDIR int igraph_full_citation(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed); -int igraph_atlas(igraph_t *graph, int number); -int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes, +DECLDIR int igraph_atlas(igraph_t *graph, int number); +DECLDIR int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes, const igraph_matrix_t *W); -int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order, +DECLDIR int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order, igraph_neimode_t mode); -int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph); +DECLDIR int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph); -int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); -int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); -int igraph_famous(igraph_t *graph, const char *name); -int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n, +DECLDIR int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); +DECLDIR int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); +DECLDIR int igraph_famous(igraph_t *graph, const char *name); +DECLDIR int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n, const igraph_vector_t *shifts, igraph_integer_t repeats); -int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...); +DECLDIR int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...); __END_DECLS diff --git a/include/igraph_conversion.h b/include/igraph_conversion.h index 9dce4c097..e7d04879d 100644 --- a/include/igraph_conversion.h +++ b/include/igraph_conversion.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -48,24 +65,24 @@ __BEGIN_DECLS /* Conversion */ /* -------------------------------------------------- */ -int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res, igraph_get_adjacency_t type, igraph_bool_t eids); -int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res, +DECLDIR int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res, igraph_get_adjacency_t type); -int igraph_get_stochastic(const igraph_t *graph, +DECLDIR int igraph_get_stochastic(const igraph_t *graph, igraph_matrix_t *matrix, igraph_bool_t column_wise); -int igraph_get_stochastic_sparsemat(const igraph_t *graph, +DECLDIR int igraph_get_stochastic_sparsemat(const igraph_t *graph, igraph_sparsemat_t *sparsemat, igraph_bool_t column_wise); -int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol); +DECLDIR int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol); -int igraph_to_directed(igraph_t *graph, +DECLDIR int igraph_to_directed(igraph_t *graph, igraph_to_directed_t flags); -int igraph_to_undirected(igraph_t *graph, +DECLDIR int igraph_to_undirected(igraph_t *graph, igraph_to_undirected_t flags, const igraph_attribute_combination_t *edge_comb); diff --git a/include/igraph_dqueue.h b/include/igraph_dqueue.h index 6cfb88dd1..eff1ce516 100644 --- a/include/igraph_dqueue.h +++ b/include/igraph_dqueue.h @@ -36,6 +36,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS /* -------------------------------------------------- */ diff --git a/include/igraph_dqueue_pmt.h b/include/igraph_dqueue_pmt.h index 564640865..b729ec796 100644 --- a/include/igraph_dqueue_pmt.h +++ b/include/igraph_dqueue_pmt.h @@ -33,17 +33,17 @@ typedef struct TYPE(igraph_dqueue) { BASE *stor_end; } TYPE(igraph_dqueue); -int FUNCTION(igraph_dqueue,init) (TYPE(igraph_dqueue)* q, long int size); -void FUNCTION(igraph_dqueue,destroy) (TYPE(igraph_dqueue)* q); -igraph_bool_t FUNCTION(igraph_dqueue,empty) (const TYPE(igraph_dqueue)* q); -void FUNCTION(igraph_dqueue,clear) (TYPE(igraph_dqueue)* q); -igraph_bool_t FUNCTION(igraph_dqueue,full) (TYPE(igraph_dqueue)* q); -long int FUNCTION(igraph_dqueue,size) (const TYPE(igraph_dqueue)* q); -BASE FUNCTION(igraph_dqueue,pop) (TYPE(igraph_dqueue)* q); -BASE FUNCTION(igraph_dqueue,pop_back)(TYPE(igraph_dqueue)* q); -BASE FUNCTION(igraph_dqueue,head) (const TYPE(igraph_dqueue)* q); -BASE FUNCTION(igraph_dqueue,back) (const TYPE(igraph_dqueue)* q); -int FUNCTION(igraph_dqueue,push) (TYPE(igraph_dqueue)* q, BASE elem); +DECLDIR int FUNCTION(igraph_dqueue,init) (TYPE(igraph_dqueue)* q, long int size); +DECLDIR void FUNCTION(igraph_dqueue,destroy) (TYPE(igraph_dqueue)* q); +DECLDIR igraph_bool_t FUNCTION(igraph_dqueue,empty) (const TYPE(igraph_dqueue)* q); +DECLDIR void FUNCTION(igraph_dqueue,clear) (TYPE(igraph_dqueue)* q); +DECLDIR igraph_bool_t FUNCTION(igraph_dqueue,full) (TYPE(igraph_dqueue)* q); +DECLDIR long int FUNCTION(igraph_dqueue,size) (const TYPE(igraph_dqueue)* q); +DECLDIR BASE FUNCTION(igraph_dqueue,pop) (TYPE(igraph_dqueue)* q); +DECLDIR BASE FUNCTION(igraph_dqueue,pop_back)(TYPE(igraph_dqueue)* q); +DECLDIR BASE FUNCTION(igraph_dqueue,head) (const TYPE(igraph_dqueue)* q); +DECLDIR BASE FUNCTION(igraph_dqueue,back) (const TYPE(igraph_dqueue)* q); +DECLDIR int FUNCTION(igraph_dqueue,push) (TYPE(igraph_dqueue)* q, BASE elem); int FUNCTION(igraph_dqueue,print)(const TYPE(igraph_dqueue)* q); int FUNCTION(igraph_dqueue,fprint)(const TYPE(igraph_dqueue)* q, FILE *file); -BASE FUNCTION(igraph_dqueue,e)(const TYPE(igraph_dqueue) *q, long int idx); +DECLDIR BASE FUNCTION(igraph_dqueue,e)(const TYPE(igraph_dqueue) *q, long int idx); diff --git a/include/igraph_eigen.h b/include/igraph_eigen.h index d37e3d9ac..bca49a9b9 100644 --- a/include/igraph_eigen.h +++ b/include/igraph_eigen.h @@ -38,6 +38,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS typedef enum { IGRAPH_EIGEN_AUTO=0, @@ -71,7 +88,7 @@ typedef struct igraph_eigen_which_t { } igraph_eigen_which_t; -int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A, +DECLDIR int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A, const igraph_sparsemat_t *sA, igraph_arpack_function_t *fun, int n, void *extra, @@ -82,7 +99,7 @@ int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A, igraph_vector_t *values, igraph_matrix_t *vectors); -int igraph_eigen_matrix(const igraph_matrix_t *A, +DECLDIR int igraph_eigen_matrix(const igraph_matrix_t *A, const igraph_sparsemat_t *sA, igraph_arpack_function_t *fun, int n, void *extra, @@ -93,7 +110,7 @@ int igraph_eigen_matrix(const igraph_matrix_t *A, igraph_vector_complex_t *values, igraph_matrix_complex_t *vectors); -int igraph_eigen_adjacency(const igraph_t *graph, +DECLDIR int igraph_eigen_adjacency(const igraph_t *graph, igraph_eigen_algorithm_t algorithm, const igraph_eigen_which_t *which, igraph_arpack_options_t *options, @@ -103,7 +120,7 @@ int igraph_eigen_adjacency(const igraph_t *graph, igraph_vector_complex_t *cmplxvalues, igraph_matrix_complex_t *cmplxvectors); -int igraph_eigen_laplacian(const igraph_t *graph, +DECLDIR int igraph_eigen_laplacian(const igraph_t *graph, igraph_eigen_algorithm_t algorithm, const igraph_eigen_which_t *which, igraph_arpack_options_t *options, diff --git a/include/igraph_flow.h b/include/igraph_flow.h index 5b94cf3e2..7be1647e4 100644 --- a/include/igraph_flow.h +++ b/include/igraph_flow.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -66,67 +83,67 @@ typedef struct { int nopush, norelabel, nogap, nogapnodes, nobfs; } igraph_maxflow_stats_t; -int igraph_maxflow(const igraph_t *graph, igraph_real_t *value, +DECLDIR int igraph_maxflow(const igraph_t *graph, igraph_real_t *value, igraph_vector_t *flow, igraph_vector_t *cut, igraph_vector_t *partition, igraph_vector_t *partition2, igraph_integer_t source, igraph_integer_t target, const igraph_vector_t *capacity, igraph_maxflow_stats_t *stats); -int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value, +DECLDIR int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value, igraph_integer_t source, igraph_integer_t target, const igraph_vector_t *capacity, igraph_maxflow_stats_t *stats); -int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value, +DECLDIR int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value, igraph_vector_t *cut, igraph_vector_t *partition, igraph_vector_t *partition2, igraph_integer_t source, igraph_integer_t target, const igraph_vector_t *capacity); -int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res, +DECLDIR int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res, igraph_integer_t source, igraph_integer_t target, const igraph_vector_t *capacity); -int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res, +DECLDIR int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res, const igraph_vector_t *capacity); -int igraph_mincut(const igraph_t *graph, +DECLDIR int igraph_mincut(const igraph_t *graph, igraph_real_t *value, igraph_vector_t *partition, igraph_vector_t *partition2, igraph_vector_t *cut, const igraph_vector_t *capacity); -int igraph_st_vertex_connectivity(const igraph_t *graph, +DECLDIR int igraph_st_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t source, igraph_integer_t target, igraph_vconn_nei_t neighbors); -int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res, igraph_bool_t checks); -int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t source, igraph_integer_t target); -int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, igraph_bool_t checks); -int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t source, igraph_integer_t target); -int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t source, igraph_integer_t target); -int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res, igraph_bool_t checks); -int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res, igraph_bool_t checks); /* s-t cut listing related stuff */ -int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar, +DECLDIR int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar, igraph_vector_t *capacity); -int igraph_residual_graph(const igraph_t *graph, +DECLDIR int igraph_residual_graph(const igraph_t *graph, const igraph_vector_t *capacity, igraph_t *residual, igraph_vector_t *residual_capacity, @@ -143,32 +160,32 @@ int igraph_i_reverse_residual_graph(const igraph_t *graph, igraph_t *residual, const igraph_vector_t *flow, igraph_vector_t *tmp); -int igraph_reverse_residual_graph(const igraph_t *graph, +DECLDIR int igraph_reverse_residual_graph(const igraph_t *graph, const igraph_vector_t *capacity, igraph_t *residual, const igraph_vector_t *flow); -int igraph_dominator_tree(const igraph_t *graph, +DECLDIR int igraph_dominator_tree(const igraph_t *graph, igraph_integer_t root, igraph_vector_t *dom, igraph_t *domtree, igraph_vector_t *leftout, igraph_neimode_t mode); -int igraph_all_st_cuts(const igraph_t *graph, +DECLDIR int igraph_all_st_cuts(const igraph_t *graph, igraph_vector_ptr_t *cuts, igraph_vector_ptr_t *partition1s, igraph_integer_t source, igraph_integer_t target); -int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value, +DECLDIR int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value, igraph_vector_ptr_t *cuts, igraph_vector_ptr_t *partition1s, igraph_integer_t source, igraph_integer_t target, const igraph_vector_t *capacity); -int igraph_gomory_hu_tree(const igraph_t *graph, +DECLDIR int igraph_gomory_hu_tree(const igraph_t *graph, igraph_t *tree, igraph_vector_t *flows, const igraph_vector_t *capacity); diff --git a/include/igraph_foreign.h b/include/igraph_foreign.h index 3ef9153ae..1631cf660 100644 --- a/include/igraph_foreign.h +++ b/include/igraph_foreign.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -47,46 +64,46 @@ __BEGIN_DECLS /* Read and write foreign formats */ /* -------------------------------------------------- */ -int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream, igraph_integer_t n, igraph_bool_t directed); -int igraph_read_graph_ncol(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_ncol(igraph_t *graph, FILE *instream, igraph_strvector_t *predefnames, igraph_bool_t names, igraph_add_weights_t weights, igraph_bool_t directed); -int igraph_read_graph_lgl(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_lgl(igraph_t *graph, FILE *instream, igraph_bool_t names, igraph_add_weights_t weights, igraph_bool_t directed); -int igraph_read_graph_pajek(igraph_t *graph, FILE *instream); -int igraph_read_graph_graphml(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_pajek(igraph_t *graph, FILE *instream); +DECLDIR int igraph_read_graph_graphml(igraph_t *graph, FILE *instream, int index); -int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream, igraph_strvector_t *problem, igraph_vector_t *label, igraph_integer_t *source, igraph_integer_t *target, igraph_vector_t *capacity, igraph_bool_t directed); -int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream, igraph_bool_t directed); -int igraph_read_graph_gml(igraph_t *graph, FILE *instream); -int igraph_read_graph_dl(igraph_t *graph, FILE *instream, +DECLDIR int igraph_read_graph_gml(igraph_t *graph, FILE *instream); +DECLDIR int igraph_read_graph_dl(igraph_t *graph, FILE *instream, igraph_bool_t directed); -int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream); -int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream); +DECLDIR int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream, const char *names, const char *weights); -int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream, const char *names, const char *weights, igraph_bool_t isolates); -int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream, igraph_bool_t prefixattr); -int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream); -int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream); +DECLDIR int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream, long int source, long int target, const igraph_vector_t *capacity); -int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream, const igraph_vector_t *id, const char *creator); -int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream); -int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream, +DECLDIR int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream); +DECLDIR int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream, const char* vertex_attr_name, const char* edge_attr_name); __END_DECLS diff --git a/include/igraph_heap.h b/include/igraph_heap.h index 5e46ed9c4..b0d3d948e 100644 --- a/include/igraph_heap.h +++ b/include/igraph_heap.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS /* -------------------------------------------------- */ diff --git a/include/igraph_heap_pmt.h b/include/igraph_heap_pmt.h index 02a704a94..6463a65d2 100644 --- a/include/igraph_heap_pmt.h +++ b/include/igraph_heap_pmt.h @@ -28,15 +28,15 @@ typedef struct TYPE(igraph_heap) { int destroy; } TYPE(igraph_heap); -int FUNCTION(igraph_heap,init)(TYPE(igraph_heap)* h, long int size); -int FUNCTION(igraph_heap,init_array)(TYPE(igraph_heap) *t, BASE* data, long int len); -void FUNCTION(igraph_heap,destroy)(TYPE(igraph_heap)* h); -igraph_bool_t FUNCTION(igraph_heap,empty)(TYPE(igraph_heap)* h); -int FUNCTION(igraph_heap,push)(TYPE(igraph_heap)* h, BASE elem); -BASE FUNCTION(igraph_heap,top)(TYPE(igraph_heap)* h); -BASE FUNCTION(igraph_heap,delete_top)(TYPE(igraph_heap)* h); -long int FUNCTION(igraph_heap,size)(TYPE(igraph_heap)* h); -int FUNCTION(igraph_heap,reserve)(TYPE(igraph_heap)* h, long int size); +DECLDIR int FUNCTION(igraph_heap,init)(TYPE(igraph_heap)* h, long int size); +DECLDIR int FUNCTION(igraph_heap,init_array)(TYPE(igraph_heap) *t, BASE* data, long int len); +DECLDIR void FUNCTION(igraph_heap,destroy)(TYPE(igraph_heap)* h); +DECLDIR igraph_bool_t FUNCTION(igraph_heap,empty)(TYPE(igraph_heap)* h); +DECLDIR int FUNCTION(igraph_heap,push)(TYPE(igraph_heap)* h, BASE elem); +DECLDIR BASE FUNCTION(igraph_heap,top)(TYPE(igraph_heap)* h); +DECLDIR BASE FUNCTION(igraph_heap,delete_top)(TYPE(igraph_heap)* h); +DECLDIR long int FUNCTION(igraph_heap,size)(TYPE(igraph_heap)* h); +DECLDIR int FUNCTION(igraph_heap,reserve)(TYPE(igraph_heap)* h, long int size); void FUNCTION(igraph_heap,i_build)(BASE* arr, long int size, long int head); void FUNCTION(igraph_heap,i_shift_up)(BASE* arr, long int size, long int elem); diff --git a/include/igraph_hrg.h b/include/igraph_hrg.h index cb50518e2..100494f58 100644 --- a/include/igraph_hrg.h +++ b/include/igraph_hrg.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_vector.h" #include "igraph_vector_ptr.h" #include "igraph_datatype.h" @@ -77,36 +94,36 @@ typedef struct igraph_hrg_t { igraph_vector_t left, right, prob, edges, vertices; } igraph_hrg_t; -int igraph_hrg_init(igraph_hrg_t *hrg, int n); -void igraph_hrg_destroy(igraph_hrg_t *hrg); -int igraph_hrg_size(const igraph_hrg_t *hrg); -int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize); +DECLDIR int igraph_hrg_init(igraph_hrg_t *hrg, int n); +DECLDIR void igraph_hrg_destroy(igraph_hrg_t *hrg); +DECLDIR int igraph_hrg_size(const igraph_hrg_t *hrg); +DECLDIR int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize); -int igraph_hrg_fit(const igraph_t *graph, +DECLDIR int igraph_hrg_fit(const igraph_t *graph, igraph_hrg_t *hrg, igraph_bool_t start, int steps); -int igraph_hrg_sample(const igraph_t *graph, +DECLDIR int igraph_hrg_sample(const igraph_t *graph, igraph_t *sample, igraph_vector_ptr_t *samples, igraph_hrg_t *hrg, igraph_bool_t start); -int igraph_hrg_game(igraph_t *graph, +DECLDIR int igraph_hrg_game(igraph_t *graph, const igraph_hrg_t *hrg); -int igraph_hrg_dendrogram(igraph_t *graph, +DECLDIR int igraph_hrg_dendrogram(igraph_t *graph, const igraph_hrg_t *hrg); -int igraph_hrg_consensus(const igraph_t *graph, +DECLDIR int igraph_hrg_consensus(const igraph_t *graph, igraph_vector_t *parents, igraph_vector_t *weights, igraph_hrg_t *hrg, igraph_bool_t start, int num_samples); -int igraph_hrg_predict(const igraph_t *graph, +DECLDIR int igraph_hrg_predict(const igraph_t *graph, igraph_vector_t *edges, igraph_vector_t *prob, igraph_hrg_t *hrg, @@ -114,7 +131,7 @@ int igraph_hrg_predict(const igraph_t *graph, int num_samples, int num_bins); -int igraph_hrg_create(igraph_hrg_t *hrg, +DECLDIR int igraph_hrg_create(igraph_hrg_t *hrg, const igraph_t *graph, const igraph_vector_t *prob); diff --git a/include/igraph_interface.h b/include/igraph_interface.h index 4031b1f72..ffb7f56b8 100644 --- a/include/igraph_interface.h +++ b/include/igraph_interface.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_iterators.h" @@ -44,45 +61,45 @@ __BEGIN_DECLS /* Interface */ /* -------------------------------------------------- */ -int igraph_empty(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed); -int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, void *attr); -int igraph_destroy(igraph_t *graph); -int igraph_copy(igraph_t *to, const igraph_t *from); -int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges, +DECLDIR int igraph_empty(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed); +DECLDIR int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, void *attr); +DECLDIR int igraph_destroy(igraph_t *graph); +DECLDIR int igraph_copy(igraph_t *to, const igraph_t *from); +DECLDIR int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges, void *attr); -int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv, +DECLDIR int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv, void *attr); -int igraph_delete_edges(igraph_t *graph, igraph_es_t edges); -int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices); -int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices, +DECLDIR int igraph_delete_edges(igraph_t *graph, igraph_es_t edges); +DECLDIR int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices); +DECLDIR int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices, igraph_vector_t *idx, igraph_vector_t *invidx); -igraph_integer_t igraph_vcount(const igraph_t *graph); -igraph_integer_t igraph_ecount(const igraph_t *graph); -int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid, +DECLDIR igraph_integer_t igraph_vcount(const igraph_t *graph); +DECLDIR igraph_integer_t igraph_ecount(const igraph_t *graph); +DECLDIR int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid, igraph_neimode_t mode); -igraph_bool_t igraph_is_directed(const igraph_t *graph); -int igraph_degree(const igraph_t *graph, igraph_vector_t *res, +DECLDIR igraph_bool_t igraph_is_directed(const igraph_t *graph); +DECLDIR int igraph_degree(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_edge(const igraph_t *graph, igraph_integer_t eid, +DECLDIR int igraph_edge(const igraph_t *graph, igraph_integer_t eid, igraph_integer_t *from, igraph_integer_t *to); -int igraph_edges(const igraph_t *graph, igraph_es_t eids, +DECLDIR int igraph_edges(const igraph_t *graph, igraph_es_t eids, igraph_vector_t *edges); -int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid, +DECLDIR int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed, igraph_bool_t error); -int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids, +DECLDIR int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids, const igraph_vector_t *pairs, const igraph_vector_t *path, igraph_bool_t directed, igraph_bool_t error); -int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids, +DECLDIR int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids, const igraph_vector_t *pairs, const igraph_vector_t *path, igraph_bool_t directed, igraph_bool_t error); -int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, +DECLDIR int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */ -int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, +DECLDIR int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, igraph_neimode_t mode); #define IGRAPH_FROM(g,e) ((igraph_integer_t)(VECTOR((g)->from)[(long int)(e)])) diff --git a/include/igraph_iterators.h b/include/igraph_iterators.h index 224e9cb87..d179ce970 100644 --- a/include/igraph_iterators.h +++ b/include/igraph_iterators.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" __BEGIN_DECLS @@ -67,45 +84,45 @@ typedef struct igraph_vs_t { } data; } igraph_vs_t; -int igraph_vs_all(igraph_vs_t *vs); +DECLDIR int igraph_vs_all(igraph_vs_t *vs); igraph_vs_t igraph_vss_all(void); -int igraph_vs_adj(igraph_vs_t *vs, +DECLDIR int igraph_vs_adj(igraph_vs_t *vs, igraph_integer_t vid, igraph_neimode_t mode); igraph_vs_t igraph_vss_adj(igraph_integer_t vid, igraph_neimode_t mode); -int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid, +DECLDIR int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid, igraph_neimode_t mode); -int igraph_vs_none(igraph_vs_t *vs); +DECLDIR int igraph_vs_none(igraph_vs_t *vs); igraph_vs_t igraph_vss_none(void); -int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid); +DECLDIR int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid); igraph_vs_t igraph_vss_1(igraph_integer_t vid); -int igraph_vs_vector(igraph_vs_t *vs, +DECLDIR int igraph_vs_vector(igraph_vs_t *vs, const igraph_vector_t *v); igraph_vs_t igraph_vss_vector(const igraph_vector_t *v); -int igraph_vs_vector_small(igraph_vs_t *vs, ...); +DECLDIR int igraph_vs_vector_small(igraph_vs_t *vs, ...); -int igraph_vs_vector_copy(igraph_vs_t *vs, +DECLDIR int igraph_vs_vector_copy(igraph_vs_t *vs, const igraph_vector_t *v); -int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to); +DECLDIR int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to); igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to); -void igraph_vs_destroy(igraph_vs_t *vs); +DECLDIR void igraph_vs_destroy(igraph_vs_t *vs); igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs); -int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src); +DECLDIR int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src); -int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs, +DECLDIR int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs, igraph_vector_t *v); -int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs, +DECLDIR int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs, igraph_integer_t *result); -int igraph_vs_type(const igraph_vs_t *vs); +DECLDIR int igraph_vs_type(const igraph_vs_t *vs); /* -------------------------------------------------- */ /* Vertex iterators */ @@ -217,11 +234,11 @@ typedef struct igraph_vit_t { ((igraph_integer_t)(((vit).type == IGRAPH_VIT_SEQ) ? (vit).pos : \ VECTOR(*(vit).vec)[(vit).pos])) -int igraph_vit_create(const igraph_t *graph, +DECLDIR int igraph_vit_create(const igraph_t *graph, igraph_vs_t vs, igraph_vit_t *vit); -void igraph_vit_destroy(const igraph_vit_t *vit); +DECLDIR void igraph_vit_destroy(const igraph_vit_t *vit); -int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v); +DECLDIR int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v); /* -------------------------------------------------- */ /* Edge Selectors */ @@ -261,55 +278,55 @@ typedef struct igraph_es_t { } data; } igraph_es_t; -int igraph_es_all(igraph_es_t *es, +DECLDIR int igraph_es_all(igraph_es_t *es, igraph_edgeorder_type_t order); igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order); -int igraph_es_adj(igraph_es_t *es, +DECLDIR int igraph_es_adj(igraph_es_t *es, igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */ -int igraph_es_incident(igraph_es_t *es, +DECLDIR int igraph_es_incident(igraph_es_t *es, igraph_integer_t vid, igraph_neimode_t mode); -int igraph_es_none(igraph_es_t *es); +DECLDIR int igraph_es_none(igraph_es_t *es); igraph_es_t igraph_ess_none(void); -int igraph_es_1(igraph_es_t *es, igraph_integer_t eid); +DECLDIR int igraph_es_1(igraph_es_t *es, igraph_integer_t eid); igraph_es_t igraph_ess_1(igraph_integer_t eid); -int igraph_es_vector(igraph_es_t *es, +DECLDIR int igraph_es_vector(igraph_es_t *es, const igraph_vector_t *v); igraph_es_t igraph_ess_vector(const igraph_vector_t *v); -int igraph_es_fromto(igraph_es_t *es, +DECLDIR int igraph_es_fromto(igraph_es_t *es, igraph_vs_t from, igraph_vs_t to); -int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to); +DECLDIR int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to); igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to); -int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v); +DECLDIR int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v); -int igraph_es_pairs(igraph_es_t *es, const igraph_vector_t *v, +DECLDIR int igraph_es_pairs(igraph_es_t *es, const igraph_vector_t *v, igraph_bool_t directed); -int igraph_es_pairs_small(igraph_es_t *es, igraph_bool_t directed, ...); +DECLDIR int igraph_es_pairs_small(igraph_es_t *es, igraph_bool_t directed, ...); -int igraph_es_multipairs(igraph_es_t *es, const igraph_vector_t *v, +DECLDIR int igraph_es_multipairs(igraph_es_t *es, const igraph_vector_t *v, igraph_bool_t directed); -int igraph_es_path(igraph_es_t *es, const igraph_vector_t *v, +DECLDIR int igraph_es_path(igraph_es_t *es, const igraph_vector_t *v, igraph_bool_t directed); -int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...); +DECLDIR int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...); -void igraph_es_destroy(igraph_es_t *es); +DECLDIR void igraph_es_destroy(igraph_es_t *es); igraph_bool_t igraph_es_is_all(const igraph_es_t *es); -int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src); +DECLDIR int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src); -int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es, +DECLDIR int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es, igraph_vector_t *v); -int igraph_es_size(const igraph_t *graph, const igraph_es_t *es, +DECLDIR int igraph_es_size(const igraph_t *graph, const igraph_es_t *es, igraph_integer_t *result); -int igraph_es_type(const igraph_es_t *es); +DECLDIR int igraph_es_type(const igraph_es_t *es); /* -------------------------------------------------- */ @@ -399,11 +416,11 @@ typedef struct igraph_eit_t { (igraph_integer_t)((((eit).type == IGRAPH_EIT_SEQ) ? (eit).pos : \ VECTOR(*(eit).vec)[(eit).pos])) -int igraph_eit_create(const igraph_t *graph, +DECLDIR int igraph_eit_create(const igraph_t *graph, igraph_es_t es, igraph_eit_t *eit); -void igraph_eit_destroy(const igraph_eit_t *eit); +DECLDIR void igraph_eit_destroy(const igraph_eit_t *eit); -int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v); +DECLDIR int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v); __END_DECLS diff --git a/include/igraph_layout.h b/include/igraph_layout.h index 17cd17b12..b367c43bb 100644 --- a/include/igraph_layout.h +++ b/include/igraph_layout.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -49,13 +66,13 @@ __BEGIN_DECLS /* Layouts */ /* -------------------------------------------------- */ -int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res); -int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res); +DECLDIR int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res, igraph_vs_t order); -int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t center, const igraph_vector_t *order); -int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width); -int igraph_layout_fruchterman_reingold(const igraph_t *graph, +DECLDIR int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width); +DECLDIR int igraph_layout_fruchterman_reingold(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t niter, @@ -67,39 +84,39 @@ int igraph_layout_fruchterman_reingold(const igraph_t *graph, const igraph_vector_t *miny, const igraph_vector_t *maxy); -int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t maxiter, igraph_real_t epsilon, igraph_real_t kkconst, const igraph_vector_t *weights, const igraph_vector_t *minx, const igraph_vector_t *maxx, const igraph_vector_t *miny, const igraph_vector_t *maxy); -int igraph_layout_springs(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_springs(const igraph_t *graph, igraph_matrix_t *res, igraph_real_t mass, igraph_real_t equil, igraph_real_t k, igraph_real_t repeqdis, igraph_real_t kfr, igraph_bool_t repulse); -int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t maxiter, igraph_real_t maxdelta, igraph_real_t area, igraph_real_t coolexp, igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root); -int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res, igraph_neimode_t mode, const igraph_vector_t *roots, const igraph_vector_t *rootlevel); -int igraph_layout_reingold_tilford_circular(const igraph_t *graph, +DECLDIR int igraph_layout_reingold_tilford_circular(const igraph_t *graph, igraph_matrix_t *res, igraph_neimode_t mode, const igraph_vector_t *roots, const igraph_vector_t *rootlevel); -int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res, igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids, const igraph_vector_t* layers, igraph_real_t hgap, igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights); -int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res); -int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res); -int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res); +DECLDIR int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res); +DECLDIR int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res, long int width, long int height); -int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, +DECLDIR int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t niter, @@ -112,7 +129,7 @@ int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, const igraph_vector_t *minz, const igraph_vector_t *maxz); -int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t maxiter, igraph_real_t epsilon, igraph_real_t kkconst, const igraph_vector_t *weights, @@ -120,7 +137,7 @@ int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, const igraph_vector_t *miny, const igraph_vector_t *maxy, const igraph_vector_t *minz, const igraph_vector_t *maxz); -int igraph_layout_graphopt(const igraph_t *graph, +DECLDIR int igraph_layout_graphopt(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t node_charge, igraph_real_t node_mass, igraph_real_t spring_length, @@ -128,11 +145,11 @@ int igraph_layout_graphopt(const igraph_t *graph, igraph_real_t max_sa_movement, igraph_bool_t use_seed); -int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res, const igraph_matrix_t *dist, long int dim, igraph_arpack_options_t *options); -int igraph_layout_bipartite(const igraph_t *graph, +DECLDIR int igraph_layout_bipartite(const igraph_t *graph, const igraph_vector_bool_t *types, igraph_matrix_t *res, igraph_real_t hgap, igraph_real_t vgap, long int maxiter); @@ -222,30 +239,30 @@ typedef enum { IGRAPH_LAYOUT_DRL_DEFAULT=0, IGRAPH_LAYOUT_DRL_REFINE, IGRAPH_LAYOUT_DRL_FINAL } igraph_layout_drl_default_t; -int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options, +DECLDIR int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options, igraph_layout_drl_default_t templ); -int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_layout_drl_options_t *options, const igraph_vector_t *weights, const igraph_vector_bool_t *fixed); -int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_layout_drl_options_t *options, const igraph_vector_t *weights, const igraph_vector_bool_t *fixed); -int igraph_layout_merge_dla(igraph_vector_ptr_t *graphs, +DECLDIR int igraph_layout_merge_dla(igraph_vector_ptr_t *graphs, igraph_vector_ptr_t *coords, igraph_matrix_t *res); -int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t maxiter, igraph_real_t temp_max, igraph_real_t temp_min, igraph_real_t temp_init); -int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_integer_t maxiter, igraph_integer_t fineiter, igraph_real_t cool_fact, igraph_real_t weight_node_dist, igraph_real_t weight_border, diff --git a/include/igraph_matching.h b/include/igraph_matching.h index 46194beb0..d075f401a 100644 --- a/include/igraph_matching.h +++ b/include/igraph_matching.h @@ -33,6 +33,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -44,19 +61,19 @@ __BEGIN_DECLS /* Matchings in graphs */ /* -------------------------------------------------- */ -int igraph_is_matching(const igraph_t* graph, +DECLDIR int igraph_is_matching(const igraph_t* graph, const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, igraph_bool_t* result); -int igraph_is_maximal_matching(const igraph_t* graph, +DECLDIR int igraph_is_maximal_matching(const igraph_t* graph, const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, igraph_bool_t* result); -int igraph_maximum_bipartite_matching(const igraph_t* graph, +DECLDIR int igraph_maximum_bipartite_matching(const igraph_t* graph, const igraph_vector_bool_t* types, igraph_integer_t* matching_size, igraph_real_t* matching_weight, igraph_vector_long_t* matching, const igraph_vector_t* weights, igraph_real_t eps); -int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size, +DECLDIR int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size, igraph_real_t* matching_weight, igraph_vector_long_t* matching, const igraph_vector_t* weights); diff --git a/include/igraph_matrix.h b/include/igraph_matrix.h index fc57d9a75..32992ed50 100644 --- a/include/igraph_matrix.h +++ b/include/igraph_matrix.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_vector.h" __BEGIN_DECLS diff --git a/include/igraph_matrix_pmt.h b/include/igraph_matrix_pmt.h index c3dd7e279..eed5e3e6a 100644 --- a/include/igraph_matrix_pmt.h +++ b/include/igraph_matrix_pmt.h @@ -30,31 +30,31 @@ typedef struct TYPE(igraph_matrix) { /* Allocation */ /*---------------*/ -int FUNCTION(igraph_matrix,init)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,init)(TYPE(igraph_matrix) *m, long int nrow, long int ncol); -int FUNCTION(igraph_matrix,copy)(TYPE(igraph_matrix) *to, +DECLDIR int FUNCTION(igraph_matrix,copy)(TYPE(igraph_matrix) *to, const TYPE(igraph_matrix) *from); -void FUNCTION(igraph_matrix,destroy)(TYPE(igraph_matrix) *m); -long int FUNCTION(igraph_matrix,capacity)(const TYPE(igraph_matrix) *m); +DECLDIR void FUNCTION(igraph_matrix,destroy)(TYPE(igraph_matrix) *m); +DECLDIR long int FUNCTION(igraph_matrix,capacity)(const TYPE(igraph_matrix) *m); /*--------------------*/ /* Accessing elements */ /*--------------------*/ /* MATRIX */ -BASE FUNCTION(igraph_matrix,e)(const TYPE(igraph_matrix) *m, +DECLDIR BASE FUNCTION(igraph_matrix,e)(const TYPE(igraph_matrix) *m, long int row, long int col); BASE* FUNCTION(igraph_matrix,e_ptr)(const TYPE(igraph_matrix) *m, long int row, long int col); -void FUNCTION(igraph_matrix,set)(TYPE(igraph_matrix)* m, long int row, long int col, +DECLDIR void FUNCTION(igraph_matrix,set)(TYPE(igraph_matrix)* m, long int row, long int col, BASE value); /*------------------------------*/ /* Initializing matrix elements */ /*------------------------------*/ -void FUNCTION(igraph_matrix,null)(TYPE(igraph_matrix) *m); -void FUNCTION(igraph_matrix,fill)(TYPE(igraph_matrix) *m, BASE e); +DECLDIR void FUNCTION(igraph_matrix,null)(TYPE(igraph_matrix) *m); +DECLDIR void FUNCTION(igraph_matrix,fill)(TYPE(igraph_matrix) *m, BASE e); /*-----------------------*/ /* Matrix views */ @@ -69,34 +69,34 @@ const TYPE(igraph_matrix) *FUNCTION(igraph_matrix,view)(const TYPE(igraph_matrix /* Copying matrices */ /*------------------*/ -void FUNCTION(igraph_matrix,copy_to)(const TYPE(igraph_matrix) *m, BASE *to); -int FUNCTION(igraph_matrix,update)(TYPE(igraph_matrix) *to, +DECLDIR void FUNCTION(igraph_matrix,copy_to)(const TYPE(igraph_matrix) *m, BASE *to); +DECLDIR int FUNCTION(igraph_matrix,update)(TYPE(igraph_matrix) *to, const TYPE(igraph_matrix) *from); -int FUNCTION(igraph_matrix,rbind)(TYPE(igraph_matrix) *to, +DECLDIR int FUNCTION(igraph_matrix,rbind)(TYPE(igraph_matrix) *to, const TYPE(igraph_matrix) *from); -int FUNCTION(igraph_matrix,cbind)(TYPE(igraph_matrix) *to, +DECLDIR int FUNCTION(igraph_matrix,cbind)(TYPE(igraph_matrix) *to, const TYPE(igraph_matrix) *from); -int FUNCTION(igraph_matrix,swap)(TYPE(igraph_matrix) *m1, TYPE(igraph_matrix) *m2); +DECLDIR int FUNCTION(igraph_matrix,swap)(TYPE(igraph_matrix) *m1, TYPE(igraph_matrix) *m2); /*--------------------------*/ /* Copying rows and columns */ /*--------------------------*/ -int FUNCTION(igraph_matrix,get_row)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,get_row)(const TYPE(igraph_matrix) *m, TYPE(igraph_vector) *res, long int index); -int FUNCTION(igraph_matrix,get_col)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,get_col)(const TYPE(igraph_matrix) *m, TYPE(igraph_vector) *res, long int index); -int FUNCTION(igraph_matrix,set_row)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,set_row)(TYPE(igraph_matrix) *m, const TYPE(igraph_vector) *v, long int index); -int FUNCTION(igraph_matrix,set_col)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,set_col)(TYPE(igraph_matrix) *m, const TYPE(igraph_vector) *v, long int index); -int FUNCTION(igraph_matrix,select_rows)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,select_rows)(const TYPE(igraph_matrix) *m, TYPE(igraph_matrix) *res, const igraph_vector_t *rows); -int FUNCTION(igraph_matrix,select_cols)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,select_cols)(const TYPE(igraph_matrix) *m, TYPE(igraph_matrix) *res, const igraph_vector_t *cols); -int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m, TYPE(igraph_matrix) *res, const igraph_vector_t *rows, const igraph_vector_t *cols); @@ -105,42 +105,42 @@ int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m, /* Exchanging rows and columns */ /*-----------------------------*/ -int FUNCTION(igraph_matrix,swap_rows)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,swap_rows)(TYPE(igraph_matrix) *m, long int i, long int j); -int FUNCTION(igraph_matrix,swap_cols)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,swap_cols)(TYPE(igraph_matrix) *m, long int i, long int j); -int FUNCTION(igraph_matrix,swap_rowcol)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,swap_rowcol)(TYPE(igraph_matrix) *m, long int i, long int j); -int FUNCTION(igraph_matrix,transpose)(TYPE(igraph_matrix) *m); +DECLDIR int FUNCTION(igraph_matrix,transpose)(TYPE(igraph_matrix) *m); /*-----------------------------*/ /* Matrix operations */ /*-----------------------------*/ -int FUNCTION(igraph_matrix,add)(TYPE(igraph_matrix) *m1, +DECLDIR int FUNCTION(igraph_matrix,add)(TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); -int FUNCTION(igraph_matrix,sub)(TYPE(igraph_matrix) *m1, +DECLDIR int FUNCTION(igraph_matrix,sub)(TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); -int FUNCTION(igraph_matrix,mul_elements)(TYPE(igraph_matrix) *m1, +DECLDIR int FUNCTION(igraph_matrix,mul_elements)(TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); -int FUNCTION(igraph_matrix,div_elements)(TYPE(igraph_matrix) *m1, +DECLDIR int FUNCTION(igraph_matrix,div_elements)(TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); -void FUNCTION(igraph_matrix,scale)(TYPE(igraph_matrix) *m, BASE by); -void FUNCTION(igraph_matrix,add_constant)(TYPE(igraph_matrix) *m, BASE plus); +DECLDIR void FUNCTION(igraph_matrix,scale)(TYPE(igraph_matrix) *m, BASE by); +DECLDIR void FUNCTION(igraph_matrix,add_constant)(TYPE(igraph_matrix) *m, BASE plus); /*-----------------------------*/ /* Finding minimum and maximum */ /*-----------------------------*/ -igraph_real_t FUNCTION(igraph_matrix,min)(const TYPE(igraph_matrix) *m); -igraph_real_t FUNCTION(igraph_matrix,max)(const TYPE(igraph_matrix) *m); -int FUNCTION(igraph_matrix,which_min)(const TYPE(igraph_matrix) *m, +DECLDIR igraph_real_t FUNCTION(igraph_matrix,min)(const TYPE(igraph_matrix) *m); +DECLDIR igraph_real_t FUNCTION(igraph_matrix,max)(const TYPE(igraph_matrix) *m); +DECLDIR int FUNCTION(igraph_matrix,which_min)(const TYPE(igraph_matrix) *m, long int *i, long int *j); -int FUNCTION(igraph_matrix,which_max)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,which_max)(const TYPE(igraph_matrix) *m, long int *i, long int *j); -int FUNCTION(igraph_matrix,minmax)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,minmax)(const TYPE(igraph_matrix) *m, BASE *min, BASE *max); -int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m, long int *imin, long int *jmin, long int *imax, long int *jmax); @@ -148,45 +148,45 @@ int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m, /* Comparison */ /*------------------------------*/ -igraph_bool_t FUNCTION(igraph_matrix,all_e)(const TYPE(igraph_matrix) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_e)(const TYPE(igraph_matrix) *lhs, const TYPE(igraph_matrix) *rhs); -igraph_bool_t FUNCTION(igraph_matrix,all_l)(const TYPE(igraph_matrix) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_l)(const TYPE(igraph_matrix) *lhs, const TYPE(igraph_matrix) *rhs); -igraph_bool_t FUNCTION(igraph_matrix,all_g)(const TYPE(igraph_matrix) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_g)(const TYPE(igraph_matrix) *lhs, const TYPE(igraph_matrix) *rhs); -igraph_bool_t FUNCTION(igraph_matrix,all_le)(const TYPE(igraph_matrix) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_le)(const TYPE(igraph_matrix) *lhs, const TYPE(igraph_matrix) *rhs); -igraph_bool_t FUNCTION(igraph_matrix,all_ge)(const TYPE(igraph_matrix) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_ge)(const TYPE(igraph_matrix) *lhs, const TYPE(igraph_matrix) *rhs); /*-------------------*/ /* Matrix properties */ /*-------------------*/ -igraph_bool_t FUNCTION(igraph_matrix,isnull)(const TYPE(igraph_matrix) *m); -igraph_bool_t FUNCTION(igraph_matrix,empty)(const TYPE(igraph_matrix) *m); -long int FUNCTION(igraph_matrix,size)(const TYPE(igraph_matrix) *m); -long int FUNCTION(igraph_matrix,nrow)(const TYPE(igraph_matrix) *m); -long int FUNCTION(igraph_matrix,ncol)(const TYPE(igraph_matrix) *m); -igraph_bool_t FUNCTION(igraph_matrix,is_symmetric)(const TYPE(igraph_matrix) *m); -BASE FUNCTION(igraph_matrix,sum)(const TYPE(igraph_matrix) *m); -BASE FUNCTION(igraph_matrix,prod)(const TYPE(igraph_matrix) *m); -int FUNCTION(igraph_matrix,rowsum)(const TYPE(igraph_matrix) *m, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,isnull)(const TYPE(igraph_matrix) *m); +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,empty)(const TYPE(igraph_matrix) *m); +DECLDIR long int FUNCTION(igraph_matrix,size)(const TYPE(igraph_matrix) *m); +DECLDIR long int FUNCTION(igraph_matrix,nrow)(const TYPE(igraph_matrix) *m); +DECLDIR long int FUNCTION(igraph_matrix,ncol)(const TYPE(igraph_matrix) *m); +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,is_symmetric)(const TYPE(igraph_matrix) *m); +DECLDIR BASE FUNCTION(igraph_matrix,sum)(const TYPE(igraph_matrix) *m); +DECLDIR BASE FUNCTION(igraph_matrix,prod)(const TYPE(igraph_matrix) *m); +DECLDIR int FUNCTION(igraph_matrix,rowsum)(const TYPE(igraph_matrix) *m, TYPE(igraph_vector) *res); -int FUNCTION(igraph_matrix,colsum)(const TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,colsum)(const TYPE(igraph_matrix) *m, TYPE(igraph_vector) *res); -igraph_bool_t FUNCTION(igraph_matrix,is_equal)(const TYPE(igraph_matrix) *m1, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,is_equal)(const TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); -BASE FUNCTION(igraph_matrix,maxdifference)(const TYPE(igraph_matrix) *m1, +DECLDIR BASE FUNCTION(igraph_matrix,maxdifference)(const TYPE(igraph_matrix) *m1, const TYPE(igraph_matrix) *m2); /*------------------------*/ /* Searching for elements */ /*------------------------*/ -igraph_bool_t FUNCTION(igraph_matrix,contains)(const TYPE(igraph_matrix) *m, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,contains)(const TYPE(igraph_matrix) *m, BASE e); -igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m, +DECLDIR igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m, long int from, BASE what, long int *pos, long int *row, long int *col); @@ -195,13 +195,13 @@ igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m, /* Resizing operations */ /*------------------------*/ -int FUNCTION(igraph_matrix,resize)(TYPE(igraph_matrix) *m, +DECLDIR int FUNCTION(igraph_matrix,resize)(TYPE(igraph_matrix) *m, long int nrow, long int ncol); -int FUNCTION(igraph_matrix,resize_min)(TYPE(igraph_matrix) *m); -int FUNCTION(igraph_matrix,add_cols)(TYPE(igraph_matrix) *m, long int n); -int FUNCTION(igraph_matrix,add_rows)(TYPE(igraph_matrix) *m, long int n); -int FUNCTION(igraph_matrix,remove_col)(TYPE(igraph_matrix) *m, long int col); -int FUNCTION(igraph_matrix,remove_row)(TYPE(igraph_matrix) *m, long int row); +DECLDIR int FUNCTION(igraph_matrix,resize_min)(TYPE(igraph_matrix) *m); +DECLDIR int FUNCTION(igraph_matrix,add_cols)(TYPE(igraph_matrix) *m, long int n); +DECLDIR int FUNCTION(igraph_matrix,add_rows)(TYPE(igraph_matrix) *m, long int n); +DECLDIR int FUNCTION(igraph_matrix,remove_col)(TYPE(igraph_matrix) *m, long int col); +DECLDIR int FUNCTION(igraph_matrix,remove_row)(TYPE(igraph_matrix) *m, long int row); /*------------------------*/ /* Print as text */ diff --git a/include/igraph_neighborhood.h b/include/igraph_neighborhood.h index c5b6f5dbf..0c3227183 100644 --- a/include/igraph_neighborhood.h +++ b/include/igraph_neighborhood.h @@ -34,15 +34,32 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS -int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res, igraph_vs_t vids, igraph_integer_t order, igraph_neimode_t mode, igraph_integer_t mindist); -int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res, +DECLDIR int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_vs_t vids, igraph_integer_t order, igraph_neimode_t mode, igraph_integer_t mindist); -int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res, +DECLDIR int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_vs_t vids, igraph_integer_t order, igraph_neimode_t mode, igraph_integer_t mindist); diff --git a/include/igraph_nongraph.h b/include/igraph_nongraph.h index 007f275a6..9dbf8b679 100644 --- a/include/igraph_nongraph.h +++ b/include/igraph_nongraph.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_matrix.h" #include "igraph_types.h" @@ -79,22 +96,22 @@ typedef struct igraph_plfit_result_t { double p; } igraph_plfit_result_t; -int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res, +DECLDIR int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res, igraph_integer_t binwidth); -int igraph_fisher_yates_shuffle(igraph_vector_t *seq); -int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h, +DECLDIR int igraph_fisher_yates_shuffle(igraph_vector_t *seq); +DECLDIR int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h, igraph_integer_t length); -int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts, +DECLDIR int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts, igraph_matrix_t *rescoords); -int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx, +DECLDIR int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx, igraph_real_t (*f)(igraph_real_t x, void *info), void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res); -int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin, +DECLDIR int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin, igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr, int maxit, int trace, igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex, igraph_integer_t *fncount, igraph_integer_t *grcount); -int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result, +DECLDIR int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result, igraph_real_t xmin, igraph_bool_t force_continuous); __END_DECLS diff --git a/include/igraph_operators.h b/include/igraph_operators.h index e2343aed2..fe4248c88 100644 --- a/include/igraph_operators.h +++ b/include/igraph_operators.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -45,26 +62,26 @@ __BEGIN_DECLS /* Graph operators */ /* -------------------------------------------------- */ -int igraph_disjoint_union(igraph_t *res, +DECLDIR int igraph_disjoint_union(igraph_t *res, const igraph_t *left, const igraph_t *right); -int igraph_disjoint_union_many(igraph_t *res, +DECLDIR int igraph_disjoint_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs); -int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right, +DECLDIR int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right, igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); -int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs, +DECLDIR int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs, igraph_vector_ptr_t *edgemaps); -int igraph_intersection(igraph_t *res, +DECLDIR int igraph_intersection(igraph_t *res, const igraph_t *left, const igraph_t *right, igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); -int igraph_intersection_many(igraph_t *res, +DECLDIR int igraph_intersection_many(igraph_t *res, const igraph_vector_ptr_t *graphs, igraph_vector_ptr_t *edgemaps); -int igraph_difference(igraph_t *res, +DECLDIR int igraph_difference(igraph_t *res, const igraph_t *orig, const igraph_t *sub); -int igraph_complementer(igraph_t *res, const igraph_t *graph, +DECLDIR int igraph_complementer(igraph_t *res, const igraph_t *graph, igraph_bool_t loops); -int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2, +DECLDIR int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2, igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); __END_DECLS diff --git a/include/igraph_paths.h b/include/igraph_paths.h index ede598d8a..3f244f7a2 100644 --- a/include/igraph_paths.h +++ b/include/igraph_paths.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -43,11 +60,11 @@ __BEGIN_DECLS -int igraph_diameter(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_diameter(const igraph_t *graph, igraph_integer_t *res, igraph_integer_t *from, igraph_integer_t *to, igraph_vector_t *path, igraph_bool_t directed, igraph_bool_t unconn); -int igraph_diameter_dijkstra(const igraph_t *graph, +DECLDIR int igraph_diameter_dijkstra(const igraph_t *graph, const igraph_vector_t *weights, igraph_real_t *pres, igraph_integer_t *pfrom, @@ -56,41 +73,41 @@ int igraph_diameter_dijkstra(const igraph_t *graph, igraph_bool_t directed, igraph_bool_t unconn); -int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t from, const igraph_vs_t to, igraph_neimode_t mode); -int igraph_get_shortest_paths(const igraph_t *graph, +DECLDIR int igraph_get_shortest_paths(const igraph_t *graph, igraph_vector_ptr_t *vertices, igraph_vector_ptr_t *edges, igraph_integer_t from, const igraph_vs_t to, igraph_neimode_t mode, igraph_vector_long_t *predecessors, igraph_vector_long_t *inbound_edges); -int igraph_get_shortest_path(const igraph_t *graph, +DECLDIR int igraph_get_shortest_path(const igraph_t *graph, igraph_vector_t *vertices, igraph_vector_t *edges, igraph_integer_t from, igraph_integer_t to, igraph_neimode_t mode); -int igraph_get_all_shortest_paths(const igraph_t *graph, +DECLDIR int igraph_get_all_shortest_paths(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_vector_t *nrgeo, igraph_integer_t from, const igraph_vs_t to, igraph_neimode_t mode); -int igraph_shortest_paths_dijkstra(const igraph_t *graph, +DECLDIR int igraph_shortest_paths_dijkstra(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t from, const igraph_vs_t to, const igraph_vector_t *weights, igraph_neimode_t mode); -int igraph_shortest_paths_bellman_ford(const igraph_t *graph, +DECLDIR int igraph_shortest_paths_bellman_ford(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t from, const igraph_vs_t to, const igraph_vector_t *weights, igraph_neimode_t mode); -int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, +DECLDIR int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, igraph_vector_ptr_t *vertices, igraph_vector_ptr_t *edges, igraph_integer_t from, @@ -99,45 +116,45 @@ int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, igraph_neimode_t mode, igraph_vector_long_t *predecessors, igraph_vector_long_t *inbound_edges); -int igraph_get_shortest_path_dijkstra(const igraph_t *graph, +DECLDIR int igraph_get_shortest_path_dijkstra(const igraph_t *graph, igraph_vector_t *vertices, igraph_vector_t *edges, igraph_integer_t from, igraph_integer_t to, const igraph_vector_t *weights, igraph_neimode_t mode); -int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph, +DECLDIR int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph, igraph_vector_ptr_t *res, igraph_vector_t *nrgeo, igraph_integer_t from, igraph_vs_t to, const igraph_vector_t *weights, igraph_neimode_t mode); -int igraph_shortest_paths_johnson(const igraph_t *graph, +DECLDIR int igraph_shortest_paths_johnson(const igraph_t *graph, igraph_matrix_t *res, const igraph_vs_t from, const igraph_vs_t to, const igraph_vector_t *weights); -int igraph_average_path_length(const igraph_t *graph, igraph_real_t *res, +DECLDIR int igraph_average_path_length(const igraph_t *graph, igraph_real_t *res, igraph_bool_t directed, igraph_bool_t unconn); -int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, igraph_real_t *unconnected, igraph_bool_t directed); -int igraph_eccentricity(const igraph_t *graph, +DECLDIR int igraph_eccentricity(const igraph_t *graph, igraph_vector_t *res, igraph_vs_t vids, igraph_neimode_t mode); -int igraph_radius(const igraph_t *graph, igraph_real_t *radius, +DECLDIR int igraph_radius(const igraph_t *graph, igraph_real_t *radius, igraph_neimode_t mode); -int igraph_get_all_simple_paths(const igraph_t *graph, +DECLDIR int igraph_get_all_simple_paths(const igraph_t *graph, igraph_vector_int_t *res, igraph_integer_t from, const igraph_vs_t to, igraph_neimode_t mode); -int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk, +DECLDIR int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk, igraph_integer_t start, igraph_neimode_t mode, igraph_integer_t steps, igraph_random_walk_stuck_t stuck); diff --git a/include/igraph_random.h b/include/igraph_random.h index 37e35d468..e6aa53bc7 100644 --- a/include/igraph_random.h +++ b/include/igraph_random.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS #include @@ -69,30 +86,30 @@ typedef struct igraph_rng_t { /* --------------------------------- */ -int igraph_rng_init(igraph_rng_t *rng, const igraph_rng_type_t *type); -void igraph_rng_destroy(igraph_rng_t *rng); +DECLDIR int igraph_rng_init(igraph_rng_t *rng, const igraph_rng_type_t *type); +DECLDIR void igraph_rng_destroy(igraph_rng_t *rng); -int igraph_rng_seed(igraph_rng_t *rng, unsigned long int seed); -unsigned long int igraph_rng_max(igraph_rng_t *rng); -unsigned long int igraph_rng_min(igraph_rng_t *rng); -const char *igraph_rng_name(igraph_rng_t *rng); +DECLDIR int igraph_rng_seed(igraph_rng_t *rng, unsigned long int seed); +DECLDIR unsigned long int igraph_rng_max(igraph_rng_t *rng); +DECLDIR unsigned long int igraph_rng_min(igraph_rng_t *rng); +DECLDIR const char *igraph_rng_name(igraph_rng_t *rng); -long int igraph_rng_get_integer(igraph_rng_t *rng, +DECLDIR long int igraph_rng_get_integer(igraph_rng_t *rng, long int l, long int h); -igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng, +DECLDIR igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng, igraph_real_t m, igraph_real_t s); -igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng, +DECLDIR igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng, igraph_real_t l, igraph_real_t h); -igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng); -igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p); -igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n, +DECLDIR igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng); +DECLDIR igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p); +DECLDIR igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n, igraph_real_t p); -igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); -unsigned long int igraph_rng_get_int31(igraph_rng_t *rng); -igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); -igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape, +DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); +DECLDIR unsigned long int igraph_rng_get_int31(igraph_rng_t *rng); +DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); +DECLDIR igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape, igraph_real_t scale); -int igraph_rng_get_dirichlet(igraph_rng_t *rng, +DECLDIR int igraph_rng_get_dirichlet(igraph_rng_t *rng, const igraph_vector_t *alpha, igraph_vector_t *result); @@ -102,8 +119,8 @@ extern const igraph_rng_type_t igraph_rngtype_glibc2; extern const igraph_rng_type_t igraph_rngtype_rand; extern const igraph_rng_type_t igraph_rngtype_mt19937; -igraph_rng_t *igraph_rng_default(void); -void igraph_rng_set_default(igraph_rng_t *rng); +DECLDIR igraph_rng_t *igraph_rng_default(void); +DECLDIR void igraph_rng_set_default(igraph_rng_t *rng); /* --------------------------------- */ diff --git a/include/igraph_stack.h b/include/igraph_stack.h index 70867e091..4be7f9ba1 100644 --- a/include/igraph_stack.h +++ b/include/igraph_stack.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_types.h" __BEGIN_DECLS diff --git a/include/igraph_stack_pmt.h b/include/igraph_stack_pmt.h index 2db6aa042..92b223449 100644 --- a/include/igraph_stack_pmt.h +++ b/include/igraph_stack_pmt.h @@ -34,14 +34,14 @@ typedef struct TYPE(igraph_stack) { BASE* end; } TYPE(igraph_stack); -int FUNCTION(igraph_stack,init)(TYPE(igraph_stack)* s, long int size); -void FUNCTION(igraph_stack,destroy)(TYPE(igraph_stack)* s); -int FUNCTION(igraph_stack,reserve)(TYPE(igraph_stack)* s, long int size); -igraph_bool_t FUNCTION(igraph_stack,empty)(TYPE(igraph_stack)* s); -long int FUNCTION(igraph_stack,size)(const TYPE(igraph_stack)* s); -void FUNCTION(igraph_stack,clear)(TYPE(igraph_stack)* s); -int FUNCTION(igraph_stack,push)(TYPE(igraph_stack)* s, BASE elem); -BASE FUNCTION(igraph_stack,pop)(TYPE(igraph_stack)* s); -BASE FUNCTION(igraph_stack,top)(const TYPE(igraph_stack)* s); +DECLDIR int FUNCTION(igraph_stack,init)(TYPE(igraph_stack)* s, long int size); +DECLDIR void FUNCTION(igraph_stack,destroy)(TYPE(igraph_stack)* s); +DECLDIR int FUNCTION(igraph_stack,reserve)(TYPE(igraph_stack)* s, long int size); +DECLDIR igraph_bool_t FUNCTION(igraph_stack,empty)(TYPE(igraph_stack)* s); +DECLDIR long int FUNCTION(igraph_stack,size)(const TYPE(igraph_stack)* s); +DECLDIR void FUNCTION(igraph_stack,clear)(TYPE(igraph_stack)* s); +DECLDIR int FUNCTION(igraph_stack,push)(TYPE(igraph_stack)* s, BASE elem); +DECLDIR BASE FUNCTION(igraph_stack,pop)(TYPE(igraph_stack)* s); +DECLDIR BASE FUNCTION(igraph_stack,top)(const TYPE(igraph_stack)* s); int FUNCTION(igraph_stack,print)(const TYPE(igraph_stack)* s); int FUNCTION(igraph_stack,fprint)(const TYPE(igraph_stack)* s, FILE *file); diff --git a/include/igraph_structural.h b/include/igraph_structural.h index 67253a7de..462af8f0b 100644 --- a/include/igraph_structural.h +++ b/include/igraph_structural.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -49,96 +66,96 @@ __BEGIN_DECLS /* Basic query functions */ /* -------------------------------------------------- */ -int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res); +DECLDIR int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res); /* -------------------------------------------------- */ /* Structural properties */ /* -------------------------------------------------- */ -int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res, const igraph_vector_t *weights); -int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph, +DECLDIR int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph, igraph_t *mst); -int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst, +DECLDIR int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst, const igraph_vector_t *weights); -int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid, +DECLDIR int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid, igraph_neimode_t mode); -int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode); -int igraph_subgraph(const igraph_t *graph, igraph_t *res, +DECLDIR int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode); +DECLDIR int igraph_subgraph(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids); -int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res, +DECLDIR int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids, igraph_subgraph_implementation_t impl, igraph_vector_t *map, igraph_vector_t *invmap); -int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res, +DECLDIR int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids, igraph_subgraph_implementation_t impl); -int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res, +DECLDIR int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res, const igraph_es_t eids, igraph_bool_t delete_vertices); -int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, +DECLDIR int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, igraph_bool_t loops, const igraph_attribute_combination_t *edge_comb); -int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res, +DECLDIR int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res, igraph_bool_t ignore_loops, igraph_reciprocity_t mode); -int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res, +DECLDIR int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res, igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops); -int igraph_density(const igraph_t *graph, igraph_real_t *res, +DECLDIR int igraph_density(const igraph_t *graph, igraph_real_t *res, igraph_bool_t loops); -int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res, +DECLDIR int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); -int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res); -int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res); -int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res, +DECLDIR int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res); +DECLDIR int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res); +DECLDIR int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); -int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es); -int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, +DECLDIR int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es); +DECLDIR int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, igraph_vector_t *circle); int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to); -int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree, +DECLDIR int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree, igraph_neimode_t mode, const igraph_vector_t *roots, igraph_vector_t *vertex_index); -int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); +DECLDIR int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); -int igraph_maximum_cardinality_search(const igraph_t *graph, +DECLDIR int igraph_maximum_cardinality_search(const igraph_t *graph, igraph_vector_t *alpha, igraph_vector_t *alpham1); -int igraph_is_chordal(const igraph_t *graph, +DECLDIR int igraph_is_chordal(const igraph_t *graph, const igraph_vector_t *alpha, const igraph_vector_t *alpham1, igraph_bool_t *chordal, igraph_vector_t *fill_in, igraph_t *newgraph); -int igraph_avg_nearest_neighbor_degree(const igraph_t *graph, +DECLDIR int igraph_avg_nearest_neighbor_degree(const igraph_t *graph, igraph_vs_t vids, igraph_vector_t *knn, igraph_vector_t *knnk, const igraph_vector_t *weights); -int igraph_contract_vertices(igraph_t *graph, +DECLDIR int igraph_contract_vertices(igraph_t *graph, const igraph_vector_t *mapping, const igraph_attribute_combination_t *vertex_comb); -int igraph_transitive_closure_dag(const igraph_t *graph, +DECLDIR int igraph_transitive_closure_dag(const igraph_t *graph, igraph_t *closure); -int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result, +DECLDIR int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result, const igraph_vector_t *weights, igraph_fas_algorithm_t algo); -int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights, +DECLDIR int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights, igraph_vector_t *res, const igraph_vs_t vs); /* -------------------------------------------------- */ /* Spectral Properties */ /* -------------------------------------------------- */ -int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res, +DECLDIR int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res, igraph_sparsemat_t *sparseres, igraph_bool_t normalized, const igraph_vector_t *weights); diff --git a/include/igraph_strvector.h b/include/igraph_strvector.h index b67d3dde0..a7ab95289 100644 --- a/include/igraph_strvector.h +++ b/include/igraph_strvector.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_vector.h" __BEGIN_DECLS @@ -68,35 +85,35 @@ typedef struct s_igraph_strvector { do { IGRAPH_CHECK(igraph_strvector_init(v, size)); \ IGRAPH_FINALLY( (igraph_finally_func_t*) igraph_strvector_destroy, v); } while (0) -int igraph_strvector_init(igraph_strvector_t *sv, long int len); -void igraph_strvector_destroy(igraph_strvector_t *sv); -long int igraph_strvector_size(const igraph_strvector_t *sv); -void igraph_strvector_get(const igraph_strvector_t *sv, +DECLDIR int igraph_strvector_init(igraph_strvector_t *sv, long int len); +DECLDIR void igraph_strvector_destroy(igraph_strvector_t *sv); +DECLDIR long int igraph_strvector_size(const igraph_strvector_t *sv); +DECLDIR void igraph_strvector_get(const igraph_strvector_t *sv, long int idx, char **value); -int igraph_strvector_set(igraph_strvector_t *sv, long int idx, +DECLDIR int igraph_strvector_set(igraph_strvector_t *sv, long int idx, const char *value); -int igraph_strvector_set2(igraph_strvector_t *sv, long int idx, +DECLDIR int igraph_strvector_set2(igraph_strvector_t *sv, long int idx, const char *value, int len); -void igraph_strvector_clear(igraph_strvector_t *sv); -void igraph_strvector_remove_section(igraph_strvector_t *v, long int from, +DECLDIR void igraph_strvector_clear(igraph_strvector_t *sv); +DECLDIR void igraph_strvector_remove_section(igraph_strvector_t *v, long int from, long int to); -void igraph_strvector_remove(igraph_strvector_t *v, long int elem); -void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin, +DECLDIR void igraph_strvector_remove(igraph_strvector_t *v, long int elem); +DECLDIR void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin, long int end, long int to); -int igraph_strvector_copy(igraph_strvector_t *to, +DECLDIR int igraph_strvector_copy(igraph_strvector_t *to, const igraph_strvector_t *from); -int igraph_strvector_append(igraph_strvector_t *to, +DECLDIR int igraph_strvector_append(igraph_strvector_t *to, const igraph_strvector_t *from); -int igraph_strvector_resize(igraph_strvector_t* v, long int newsize); -int igraph_strvector_add(igraph_strvector_t *v, const char *value); -void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index, +DECLDIR int igraph_strvector_resize(igraph_strvector_t* v, long int newsize); +DECLDIR int igraph_strvector_add(igraph_strvector_t *v, const char *value); +DECLDIR void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index, long int nremove); -void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg, +DECLDIR void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg, long int nremove); int igraph_strvector_print(const igraph_strvector_t *v, FILE *file, const char *sep); -int igraph_strvector_index(const igraph_strvector_t *v, +DECLDIR int igraph_strvector_index(const igraph_strvector_t *v, igraph_strvector_t *newv, const igraph_vector_t *idx); diff --git a/include/igraph_transitivity.h b/include/igraph_transitivity.h index b691a1b0b..017673793 100644 --- a/include/igraph_transitivity.h +++ b/include/igraph_transitivity.h @@ -34,35 +34,52 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_datatype.h" #include "igraph_constants.h" #include "igraph_iterators.h" __BEGIN_DECLS -int igraph_transitivity_undirected(const igraph_t *graph, +DECLDIR int igraph_transitivity_undirected(const igraph_t *graph, igraph_real_t *res, igraph_transitivity_mode_t mode); -int igraph_transitivity_local_undirected(const igraph_t *graph, +DECLDIR int igraph_transitivity_local_undirected(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_transitivity_mode_t mode); -int igraph_transitivity_local_undirected1(const igraph_t *graph, +DECLDIR int igraph_transitivity_local_undirected1(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_transitivity_mode_t mode); -int igraph_transitivity_local_undirected2(const igraph_t *graph, +DECLDIR int igraph_transitivity_local_undirected2(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_transitivity_mode_t mode); -int igraph_transitivity_local_undirected4(const igraph_t *graph, +DECLDIR int igraph_transitivity_local_undirected4(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_transitivity_mode_t mode); -int igraph_transitivity_avglocal_undirected(const igraph_t *graph, +DECLDIR int igraph_transitivity_avglocal_undirected(const igraph_t *graph, igraph_real_t *res, igraph_transitivity_mode_t mode); -int igraph_transitivity_barrat(const igraph_t *graph, +DECLDIR int igraph_transitivity_barrat(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, const igraph_vector_t *weights, diff --git a/include/igraph_types.h b/include/igraph_types.h index 8445f71aa..f009509a9 100644 --- a/include/igraph_types.h +++ b/include/igraph_types.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + __BEGIN_DECLS #ifndef _GNU_SOURCE @@ -78,13 +95,13 @@ double igraph_i_fdiv(const double a, const double b); # define IGRAPH_NEGINFINITY (igraph_i_fdiv(-1.0, 0.0)) #endif -int igraph_finite(double x); +DECLDIR int igraph_finite(double x); #define IGRAPH_FINITE(x) igraph_finite(x) -int igraph_is_nan(double x); -int igraph_is_inf(double x); -int igraph_is_posinf(double x); -int igraph_is_neginf(double x); +DECLDIR int igraph_is_nan(double x); +DECLDIR int igraph_is_inf(double x); +DECLDIR int igraph_is_posinf(double x); +DECLDIR int igraph_is_neginf(double x); #if defined(NAN) # define IGRAPH_NAN NAN diff --git a/include/igraph_vector.h b/include/igraph_vector.h index c70a3c9d3..ea10d1820 100644 --- a/include/igraph_vector.h +++ b/include/igraph_vector.h @@ -34,6 +34,23 @@ # define __END_DECLS /* empty */ #endif +#ifdef DECLDIR +# undef DECLDIR +#endif +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif + #include "igraph_types.h" #include "igraph_complex.h" diff --git a/include/igraph_vector_pmt.h b/include/igraph_vector_pmt.h index acd0a584d..fd5f0ebfd 100644 --- a/include/igraph_vector_pmt.h +++ b/include/igraph_vector_pmt.h @@ -25,15 +25,15 @@ /* Allocation */ /*--------------------*/ -int FUNCTION(igraph_vector,init)(TYPE(igraph_vector)* v, long int size); -int FUNCTION(igraph_vector,init_copy)(TYPE(igraph_vector)* v, +DECLDIR int FUNCTION(igraph_vector,init)(TYPE(igraph_vector)* v, long int size); +DECLDIR int FUNCTION(igraph_vector,init_copy)(TYPE(igraph_vector)* v, BASE* data, long int length); -int FUNCTION(igraph_vector,init_seq)(TYPE(igraph_vector)*v, BASE from, BASE to); -int FUNCTION(igraph_vector,copy)(TYPE(igraph_vector) *to, +DECLDIR int FUNCTION(igraph_vector,init_seq)(TYPE(igraph_vector)*v, BASE from, BASE to); +DECLDIR int FUNCTION(igraph_vector,copy)(TYPE(igraph_vector) *to, const TYPE(igraph_vector) *from); -void FUNCTION(igraph_vector,destroy)(TYPE(igraph_vector)* v); +DECLDIR void FUNCTION(igraph_vector,destroy)(TYPE(igraph_vector)* v); -long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v); +DECLDIR long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v); /*--------------------*/ /* Accessing elements */ @@ -61,23 +61,23 @@ long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v); #define VECTOR(v) ((v).stor_begin) #endif -BASE FUNCTION(igraph_vector,e)(const TYPE(igraph_vector)* v, long int pos); +DECLDIR BASE FUNCTION(igraph_vector,e)(const TYPE(igraph_vector)* v, long int pos); BASE* FUNCTION(igraph_vector,e_ptr)(const TYPE(igraph_vector)* v, long int pos); -void FUNCTION(igraph_vector,set)(TYPE(igraph_vector)* v, long int pos, BASE value); -BASE FUNCTION(igraph_vector,tail)(const TYPE(igraph_vector) *v); +DECLDIR void FUNCTION(igraph_vector,set)(TYPE(igraph_vector)* v, long int pos, BASE value); +DECLDIR BASE FUNCTION(igraph_vector,tail)(const TYPE(igraph_vector) *v); /*-----------------------*/ /* Initializing elements */ /*-----------------------*/ -void FUNCTION(igraph_vector,null)(TYPE(igraph_vector)* v); -void FUNCTION(igraph_vector,fill)(TYPE(igraph_vector)* v, BASE e); +DECLDIR void FUNCTION(igraph_vector,null)(TYPE(igraph_vector)* v); +DECLDIR void FUNCTION(igraph_vector,fill)(TYPE(igraph_vector)* v, BASE e); /*-----------------------*/ /* Vector views */ /*-----------------------*/ -const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector) *v, +DECLDIR const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector) *v, const BASE *data, long int length); @@ -85,124 +85,124 @@ const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector /* Copying vectors */ /*-----------------------*/ -void FUNCTION(igraph_vector,copy_to)(const TYPE(igraph_vector) *v, BASE* to); -int FUNCTION(igraph_vector,update)(TYPE(igraph_vector) *to, +DECLDIR void FUNCTION(igraph_vector,copy_to)(const TYPE(igraph_vector) *v, BASE* to); +DECLDIR int FUNCTION(igraph_vector,update)(TYPE(igraph_vector) *to, const TYPE(igraph_vector) *from); -int FUNCTION(igraph_vector,append)(TYPE(igraph_vector) *to, +DECLDIR int FUNCTION(igraph_vector,append)(TYPE(igraph_vector) *to, const TYPE(igraph_vector) *from); -int FUNCTION(igraph_vector,swap)(TYPE(igraph_vector) *v1, TYPE(igraph_vector) *v2); +DECLDIR int FUNCTION(igraph_vector,swap)(TYPE(igraph_vector) *v1, TYPE(igraph_vector) *v2); /*-----------------------*/ /* Exchanging elements */ /*-----------------------*/ -int FUNCTION(igraph_vector,swap_elements)(TYPE(igraph_vector) *v, +DECLDIR int FUNCTION(igraph_vector,swap_elements)(TYPE(igraph_vector) *v, long int i, long int j); -int FUNCTION(igraph_vector,reverse)(TYPE(igraph_vector) *v); -int FUNCTION(igraph_vector,shuffle)(TYPE(igraph_vector) *v); +DECLDIR int FUNCTION(igraph_vector,reverse)(TYPE(igraph_vector) *v); +DECLDIR int FUNCTION(igraph_vector,shuffle)(TYPE(igraph_vector) *v); /*-----------------------*/ /* Vector operations */ /*-----------------------*/ -void FUNCTION(igraph_vector,add_constant)(TYPE(igraph_vector) *v, BASE plus); -void FUNCTION(igraph_vector,scale)(TYPE(igraph_vector) *v, BASE by); -int FUNCTION(igraph_vector,add)(TYPE(igraph_vector) *v1, +DECLDIR void FUNCTION(igraph_vector,add_constant)(TYPE(igraph_vector) *v, BASE plus); +DECLDIR void FUNCTION(igraph_vector,scale)(TYPE(igraph_vector) *v, BASE by); +DECLDIR int FUNCTION(igraph_vector,add)(TYPE(igraph_vector) *v1, const TYPE(igraph_vector) *v2); -int FUNCTION(igraph_vector,sub)(TYPE(igraph_vector) *v1, +DECLDIR int FUNCTION(igraph_vector,sub)(TYPE(igraph_vector) *v1, const TYPE(igraph_vector) *v2); -int FUNCTION(igraph_vector,mul)(TYPE(igraph_vector) *v1, +DECLDIR int FUNCTION(igraph_vector,mul)(TYPE(igraph_vector) *v1, const TYPE(igraph_vector) *v2); -int FUNCTION(igraph_vector,div)(TYPE(igraph_vector) *v1, +DECLDIR int FUNCTION(igraph_vector,div)(TYPE(igraph_vector) *v1, const TYPE(igraph_vector) *v2); -int FUNCTION(igraph_vector,cumsum)(TYPE(igraph_vector) *to, +DECLDIR int FUNCTION(igraph_vector,cumsum)(TYPE(igraph_vector) *to, const TYPE(igraph_vector) *from); #ifndef NOABS -int FUNCTION(igraph_vector,abs)(TYPE(igraph_vector) *v); +DECLDIR int FUNCTION(igraph_vector,abs)(TYPE(igraph_vector) *v); #endif /*------------------------------*/ /* Comparison */ /*------------------------------*/ -igraph_bool_t FUNCTION(igraph_vector,all_e)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_e)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); -igraph_bool_t FUNCTION(igraph_vector,all_l)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_l)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); -igraph_bool_t FUNCTION(igraph_vector,all_g)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_g)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); -igraph_bool_t FUNCTION(igraph_vector,all_le)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_le)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); -igraph_bool_t FUNCTION(igraph_vector,all_ge)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_ge)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); /*------------------------------*/ /* Finding minimum and maximum */ /*------------------------------*/ -BASE FUNCTION(igraph_vector,min)(const TYPE(igraph_vector)* v); -BASE FUNCTION(igraph_vector,max)(const TYPE(igraph_vector)* v); -long int FUNCTION(igraph_vector,which_min)(const TYPE(igraph_vector)* v); -long int FUNCTION(igraph_vector,which_max)(const TYPE(igraph_vector)* v); -int FUNCTION(igraph_vector,minmax)(const TYPE(igraph_vector) *v, +DECLDIR BASE FUNCTION(igraph_vector,min)(const TYPE(igraph_vector)* v); +DECLDIR BASE FUNCTION(igraph_vector,max)(const TYPE(igraph_vector)* v); +DECLDIR long int FUNCTION(igraph_vector,which_min)(const TYPE(igraph_vector)* v); +DECLDIR long int FUNCTION(igraph_vector,which_max)(const TYPE(igraph_vector)* v); +DECLDIR int FUNCTION(igraph_vector,minmax)(const TYPE(igraph_vector) *v, BASE *min, BASE *max); -int FUNCTION(igraph_vector,which_minmax)(const TYPE(igraph_vector) *v, +DECLDIR int FUNCTION(igraph_vector,which_minmax)(const TYPE(igraph_vector) *v, long int *which_min, long int *which_max); /*-------------------*/ /* Vector properties */ /*-------------------*/ -igraph_bool_t FUNCTION(igraph_vector,empty) (const TYPE(igraph_vector)* v); -long int FUNCTION(igraph_vector,size) (const TYPE(igraph_vector)* v); -igraph_bool_t FUNCTION(igraph_vector,isnull)(const TYPE(igraph_vector) *v); -BASE FUNCTION(igraph_vector,sum)(const TYPE(igraph_vector) *v); -igraph_real_t FUNCTION(igraph_vector,sumsq)(const TYPE(igraph_vector) *v); -BASE FUNCTION(igraph_vector,prod)(const TYPE(igraph_vector) *v); -igraph_bool_t FUNCTION(igraph_vector,isininterval)(const TYPE(igraph_vector) *v, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,empty) (const TYPE(igraph_vector)* v); +DECLDIR long int FUNCTION(igraph_vector,size) (const TYPE(igraph_vector)* v); +DECLDIR igraph_bool_t FUNCTION(igraph_vector,isnull)(const TYPE(igraph_vector) *v); +DECLDIR BASE FUNCTION(igraph_vector,sum)(const TYPE(igraph_vector) *v); +DECLDIR igraph_real_t FUNCTION(igraph_vector,sumsq)(const TYPE(igraph_vector) *v); +DECLDIR BASE FUNCTION(igraph_vector,prod)(const TYPE(igraph_vector) *v); +DECLDIR igraph_bool_t FUNCTION(igraph_vector,isininterval)(const TYPE(igraph_vector) *v, BASE low, BASE high); -igraph_bool_t FUNCTION(igraph_vector,any_smaller)(const TYPE(igraph_vector) *v, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,any_smaller)(const TYPE(igraph_vector) *v, BASE limit); -igraph_bool_t FUNCTION(igraph_vector,is_equal)(const TYPE(igraph_vector) *lhs, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,is_equal)(const TYPE(igraph_vector) *lhs, const TYPE(igraph_vector) *rhs); -BASE FUNCTION(igraph_vector,maxdifference)(const TYPE(igraph_vector) *m1, +DECLDIR BASE FUNCTION(igraph_vector,maxdifference)(const TYPE(igraph_vector) *m1, const TYPE(igraph_vector) *m2); /*------------------------*/ /* Searching for elements */ /*------------------------*/ -igraph_bool_t FUNCTION(igraph_vector,contains)(const TYPE(igraph_vector) *v, BASE e); -igraph_bool_t FUNCTION(igraph_vector,search)(const TYPE(igraph_vector) *v, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,contains)(const TYPE(igraph_vector) *v, BASE e); +DECLDIR igraph_bool_t FUNCTION(igraph_vector,search)(const TYPE(igraph_vector) *v, long int from, BASE what, long int *pos); -igraph_bool_t FUNCTION(igraph_vector,binsearch)(const TYPE(igraph_vector) *v, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,binsearch)(const TYPE(igraph_vector) *v, BASE what, long int *pos); -igraph_bool_t FUNCTION(igraph_vector,binsearch2)(const TYPE(igraph_vector) *v, +DECLDIR igraph_bool_t FUNCTION(igraph_vector,binsearch2)(const TYPE(igraph_vector) *v, BASE what); /*------------------------*/ /* Resizing operations */ /*------------------------*/ -void FUNCTION(igraph_vector,clear)(TYPE(igraph_vector)* v); -int FUNCTION(igraph_vector,resize)(TYPE(igraph_vector)* v, long int newsize); -int FUNCTION(igraph_vector,resize_min)(TYPE(igraph_vector)*v); -int FUNCTION(igraph_vector,reserve)(TYPE(igraph_vector)* v, long int size); -int FUNCTION(igraph_vector,push_back)(TYPE(igraph_vector)* v, BASE e); -BASE FUNCTION(igraph_vector,pop_back)(TYPE(igraph_vector)* v); -int FUNCTION(igraph_vector,insert)(TYPE(igraph_vector) *v, long int pos, BASE value); -void FUNCTION(igraph_vector,remove)(TYPE(igraph_vector) *v, long int elem); -void FUNCTION(igraph_vector,remove_section)(TYPE(igraph_vector) *v, +DECLDIR void FUNCTION(igraph_vector,clear)(TYPE(igraph_vector)* v); +DECLDIR int FUNCTION(igraph_vector,resize)(TYPE(igraph_vector)* v, long int newsize); +DECLDIR int FUNCTION(igraph_vector,resize_min)(TYPE(igraph_vector)*v); +DECLDIR int FUNCTION(igraph_vector,reserve)(TYPE(igraph_vector)* v, long int size); +DECLDIR int FUNCTION(igraph_vector,push_back)(TYPE(igraph_vector)* v, BASE e); +DECLDIR BASE FUNCTION(igraph_vector,pop_back)(TYPE(igraph_vector)* v); +DECLDIR int FUNCTION(igraph_vector,insert)(TYPE(igraph_vector) *v, long int pos, BASE value); +DECLDIR void FUNCTION(igraph_vector,remove)(TYPE(igraph_vector) *v, long int elem); +DECLDIR void FUNCTION(igraph_vector,remove_section)(TYPE(igraph_vector) *v, long int from, long int to); /*-----------*/ /* Sorting */ /*-----------*/ -void FUNCTION(igraph_vector,sort)(TYPE(igraph_vector) *v); -long int FUNCTION(igraph_vector,qsort_ind)(TYPE(igraph_vector) *v, +DECLDIR void FUNCTION(igraph_vector,sort)(TYPE(igraph_vector) *v); +DECLDIR long int FUNCTION(igraph_vector,qsort_ind)(TYPE(igraph_vector) *v, igraph_vector_t *inds, igraph_bool_t descending); /*-----------*/ @@ -216,17 +216,17 @@ int FUNCTION(igraph_vector,fprint)(const TYPE(igraph_vector) *v, FILE *file); #ifdef BASE_COMPLEX -int igraph_vector_complex_real(const igraph_vector_complex_t *v, +DECLDIR int igraph_vector_complex_real(const igraph_vector_complex_t *v, igraph_vector_t *real); -int igraph_vector_complex_imag(const igraph_vector_complex_t *v, +DECLDIR int igraph_vector_complex_imag(const igraph_vector_complex_t *v, igraph_vector_t *imag); -int igraph_vector_complex_realimag(const igraph_vector_complex_t *v, +DECLDIR int igraph_vector_complex_realimag(const igraph_vector_complex_t *v, igraph_vector_t *real, igraph_vector_t *imag); -int igraph_vector_complex_create(igraph_vector_complex_t *v, +DECLDIR int igraph_vector_complex_create(igraph_vector_complex_t *v, const igraph_vector_t *real, const igraph_vector_t *imag); -int igraph_vector_complex_create_polar(igraph_vector_complex_t *v, +DECLDIR int igraph_vector_complex_create_polar(igraph_vector_complex_t *v, const igraph_vector_t *r, const igraph_vector_t *theta); diff --git a/msvc/igraph.vcproj b/msvc/igraph.vcproj index 1fd29346d..0b8ae1f96 100644 --- a/msvc/igraph.vcproj +++ b/msvc/igraph.vcproj @@ -23,7 +23,7 @@ Date: Thu, 4 Aug 2016 16:29:50 +0200 Subject: [PATCH 2/5] Added igraph_decls header and additional DECLDIR declarations --- include/igraph_adjlist.h | 127 ++++++------- include/igraph_arpack.h | 38 ++-- include/igraph_array.h | 10 +- include/igraph_attributes.h | 190 +++++++++---------- include/igraph_bipartite.h | 119 ++++++------ include/igraph_blas.h | 25 +-- include/igraph_centrality.h | 220 ++++++++++----------- include/igraph_cliques.h | 84 +++----- include/igraph_cocitation.h | 52 ++--- include/igraph_community.h | 271 +++++++++++++------------- include/igraph_complex.h | 133 ++++++------- include/igraph_components.h | 50 ++--- include/igraph_constants.h | 11 +- include/igraph_constructors.h | 56 ++---- include/igraph_conversion.h | 46 +---- include/igraph_datatype.h | 11 +- include/igraph_decls.h | 24 +++ include/igraph_dqueue.h | 28 +-- include/igraph_eigen.h | 95 ++++------ include/igraph_embedding.h | 55 +++--- include/igraph_epidemics.h | 21 +- include/igraph_error.h | 46 ++--- include/igraph_flow.h | 164 +++++++--------- include/igraph_foreign.h | 72 +++---- include/igraph_games.h | 369 ++++++++++++++++++------------------ include/igraph_graphlets.h | 61 +++--- include/igraph_heap.h | 27 +-- include/igraph_hrg.h | 72 +++---- include/igraph_interface.h | 66 ++----- include/igraph_interrupt.h | 16 +- include/igraph_iterators.h | 84 +++----- include/igraph_lapack.h | 81 ++++---- include/igraph_layout.h | 190 ++++++++----------- include/igraph_matching.h | 46 +---- include/igraph_matrix.h | 28 +-- include/igraph_memory.h | 15 +- include/igraph_microscopic_update.h | 57 +++--- include/igraph_mixing.h | 35 ++-- include/igraph_motifs.h | 65 +++---- include/igraph_neighborhood.h | 41 +--- include/igraph_nongraph.h | 48 ++--- include/igraph_operators.h | 52 ++--- include/igraph_paths.h | 174 ++++++++--------- include/igraph_progress.h | 22 +-- include/igraph_psumtree.h | 30 ++- include/igraph_qsort.h | 18 +- include/igraph_random.h | 43 +---- include/igraph_scan.h | 61 +++--- include/igraph_separators.h | 31 ++- include/igraph_spmatrix.h | 91 ++++----- include/igraph_stack.h | 28 +-- include/igraph_stack_pmt.h | 4 +- include/igraph_statusbar.h | 17 +- include/igraph_structural.h | 116 +++++------- include/igraph_strvector.h | 54 ++---- include/igraph_threading.h.in | 10 +- include/igraph_topology.h | 61 +++--- include/igraph_transitivity.h | 28 +-- include/igraph_types.h | 39 +--- include/igraph_vector.h | 36 +--- include/igraph_vector_ptr.h | 61 +++--- include/igraph_version.h.in | 10 +- include/igraph_visitor.h | 11 +- 63 files changed, 1626 insertions(+), 2620 deletions(-) create mode 100644 include/igraph_decls.h diff --git a/include/igraph_adjlist.h b/include/igraph_adjlist.h index c105dce42..1d4676f33 100644 --- a/include/igraph_adjlist.h +++ b/include/igraph_adjlist.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_ADJLIST_H #define IGRAPH_ADJLIST_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -45,24 +36,24 @@ typedef struct igraph_adjlist_t { igraph_vector_int_t *adjs; } igraph_adjlist_t; -int igraph_adjlist_init(const igraph_t *graph, igraph_adjlist_t *al, - igraph_neimode_t mode); -int igraph_adjlist_init_empty(igraph_adjlist_t *al, igraph_integer_t no_of_nodes); -igraph_integer_t igraph_adjlist_size(const igraph_adjlist_t *al); -int igraph_adjlist_init_complementer(const igraph_t *graph, - igraph_adjlist_t *al, - igraph_neimode_t mode, - igraph_bool_t loops); -void igraph_adjlist_destroy(igraph_adjlist_t *al); -void igraph_adjlist_clear(igraph_adjlist_t *al); -void igraph_adjlist_sort(igraph_adjlist_t *al); -int igraph_adjlist_simplify(igraph_adjlist_t *al); -int igraph_adjlist_remove_duplicate(const igraph_t *graph, - igraph_adjlist_t *al); -int igraph_adjlist_print(const igraph_adjlist_t *al); -int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile); -igraph_bool_t igraph_adjlist_has_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed); -int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t oldto, igraph_integer_t newto, igraph_bool_t directed); +DECLDIR int igraph_adjlist_init(const igraph_t *graph, igraph_adjlist_t *al, + igraph_neimode_t mode); +DECLDIR int igraph_adjlist_init_empty(igraph_adjlist_t *al, igraph_integer_t no_of_nodes); +DECLDIR igraph_integer_t igraph_adjlist_size(const igraph_adjlist_t *al); +DECLDIR int igraph_adjlist_init_complementer(const igraph_t *graph, + igraph_adjlist_t *al, + igraph_neimode_t mode, + igraph_bool_t loops); +DECLDIR void igraph_adjlist_destroy(igraph_adjlist_t *al); +DECLDIR void igraph_adjlist_clear(igraph_adjlist_t *al); +DECLDIR void igraph_adjlist_sort(igraph_adjlist_t *al); +DECLDIR int igraph_adjlist_simplify(igraph_adjlist_t *al); +DECLDIR int igraph_adjlist_remove_duplicate(const igraph_t *graph, + igraph_adjlist_t *al); +DECLDIR int igraph_adjlist_print(const igraph_adjlist_t *al); +DECLDIR int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile); +DECLDIR igraph_bool_t igraph_adjlist_has_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed); +DECLDIR int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t oldto, igraph_integer_t newto, igraph_bool_t directed); /* igraph_vector_int_t *igraph_adjlist_get(const igraph_adjlist_t *al, */ /* igraph_integer_t no); */ @@ -81,24 +72,24 @@ int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igr */ #define igraph_adjlist_get(al,no) (&(al)->adjs[(long int)(no)]) -int igraph_adjlist(igraph_t *graph, const igraph_adjlist_t *adjlist, - igraph_neimode_t mode, igraph_bool_t duplicate); +DECLDIR int igraph_adjlist(igraph_t *graph, const igraph_adjlist_t *adjlist, + igraph_neimode_t mode, igraph_bool_t duplicate); typedef struct igraph_inclist_t { igraph_integer_t length; igraph_vector_int_t *incs; } igraph_inclist_t; -int igraph_inclist_init(const igraph_t *graph, - igraph_inclist_t *il, - igraph_neimode_t mode); -int igraph_inclist_init_empty(igraph_inclist_t *il, igraph_integer_t n); -void igraph_inclist_destroy(igraph_inclist_t *il); -void igraph_inclist_clear(igraph_inclist_t *il); -int igraph_inclist_remove_duplicate(const igraph_t *graph, - igraph_inclist_t *il); -int igraph_inclist_print(const igraph_inclist_t *il); -int igraph_inclist_fprint(const igraph_inclist_t *il, FILE *outfile); +DECLDIR int igraph_inclist_init(const igraph_t *graph, + igraph_inclist_t *il, + igraph_neimode_t mode); +DECLDIR int igraph_inclist_init_empty(igraph_inclist_t *il, igraph_integer_t n); +DECLDIR void igraph_inclist_destroy(igraph_inclist_t *il); +DECLDIR void igraph_inclist_clear(igraph_inclist_t *il); +DECLDIR int igraph_inclist_remove_duplicate(const igraph_t *graph, + igraph_inclist_t *il); +DECLDIR int igraph_inclist_print(const igraph_inclist_t *il); +DECLDIR int igraph_inclist_fprint(const igraph_inclist_t *il, FILE *outfile); /** * \define igraph_inclist_get @@ -123,12 +114,12 @@ typedef struct igraph_lazy_adjlist_t { igraph_lazy_adlist_simplify_t simplify; } igraph_lazy_adjlist_t; -int igraph_lazy_adjlist_init(const igraph_t *graph, - igraph_lazy_adjlist_t *al, - igraph_neimode_t mode, - igraph_lazy_adlist_simplify_t simplify); -void igraph_lazy_adjlist_destroy(igraph_lazy_adjlist_t *al); -void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al); +DECLDIR int igraph_lazy_adjlist_init(const igraph_t *graph, + igraph_lazy_adjlist_t *al, + igraph_neimode_t mode, + igraph_lazy_adlist_simplify_t simplify); +DECLDIR void igraph_lazy_adjlist_destroy(igraph_lazy_adjlist_t *al); +DECLDIR void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al); /* igraph_vector_t *igraph_lazy_adjlist_get(igraph_lazy_adjlist_t *al, */ /* igraph_integer_t no); */ /** @@ -150,8 +141,8 @@ void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al); #define igraph_lazy_adjlist_get(al,no) \ ((al)->adjs[(long int)(no)] != 0 ? ((al)->adjs[(long int)(no)]) : \ (igraph_lazy_adjlist_get_real(al, no))) -igraph_vector_t *igraph_lazy_adjlist_get_real(igraph_lazy_adjlist_t *al, - igraph_integer_t no); +DECLDIR igraph_vector_t *igraph_lazy_adjlist_get_real(igraph_lazy_adjlist_t *al, + igraph_integer_t no); typedef struct igraph_lazy_inclist_t { const igraph_t *graph; @@ -160,11 +151,11 @@ typedef struct igraph_lazy_inclist_t { igraph_neimode_t mode; } igraph_lazy_inclist_t; -int igraph_lazy_inclist_init(const igraph_t *graph, - igraph_lazy_inclist_t *il, - igraph_neimode_t mode); -void igraph_lazy_inclist_destroy(igraph_lazy_inclist_t *il); -void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il); +DECLDIR int igraph_lazy_inclist_init(const igraph_t *graph, + igraph_lazy_inclist_t *il, + igraph_neimode_t mode); +DECLDIR void igraph_lazy_inclist_destroy(igraph_lazy_inclist_t *il); +DECLDIR void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il); /** * \define igraph_lazy_inclist_get @@ -185,8 +176,8 @@ void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il); #define igraph_lazy_inclist_get(al,no) \ ((al)->incs[(long int)(no)] != 0 ? ((al)->incs[(long int)(no)]) : \ (igraph_lazy_inclist_get_real(al, no))) -igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al, - igraph_integer_t no); +DECLDIR igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al, + igraph_integer_t no); /************************************************************************* * DEPRECATED TYPES AND FUNCTIONS @@ -194,13 +185,13 @@ igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al, typedef igraph_inclist_t igraph_adjedgelist_t; -int igraph_adjedgelist_init(const igraph_t *graph, - igraph_inclist_t *il, - igraph_neimode_t mode); -void igraph_adjedgelist_destroy(igraph_inclist_t *il); -int igraph_adjedgelist_remove_duplicate(const igraph_t *graph, - igraph_inclist_t *il); -int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile); +DECLDIR int igraph_adjedgelist_init(const igraph_t *graph, + igraph_inclist_t *il, + igraph_neimode_t mode); +DECLDIR void igraph_adjedgelist_destroy(igraph_inclist_t *il); +DECLDIR int igraph_adjedgelist_remove_duplicate(const igraph_t *graph, + igraph_inclist_t *il); +DECLDIR int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile); /** * \define igraph_adjedgelist_get @@ -216,10 +207,10 @@ int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile); typedef igraph_lazy_inclist_t igraph_lazy_adjedgelist_t; -int igraph_lazy_adjedgelist_init(const igraph_t *graph, - igraph_lazy_inclist_t *il, - igraph_neimode_t mode); -void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il); +DECLDIR int igraph_lazy_adjedgelist_init(const igraph_t *graph, + igraph_lazy_inclist_t *il, + igraph_neimode_t mode); +DECLDIR void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il); /** * \define igraph_lazy_adjedgelist_get @@ -234,8 +225,8 @@ void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il); #define igraph_lazy_adjedgelist_get(al,no) \ ((al)->incs[(long int)(no)] != 0 ? ((al)->incs[(long int)(no)]) : \ (igraph_lazy_adjedgelist_get_real(al, no))) -igraph_vector_t *igraph_lazy_adjedgelist_get_real(igraph_lazy_inclist_t *al, - igraph_integer_t no); +DECLDIR igraph_vector_t *igraph_lazy_adjedgelist_get_real(igraph_lazy_inclist_t *al, + igraph_integer_t no); __END_DECLS #endif diff --git a/include/igraph_arpack.h b/include/igraph_arpack.h index b165665c2..b31707df2 100644 --- a/include/igraph_arpack.h +++ b/include/igraph_arpack.h @@ -28,15 +28,7 @@ #ifndef ARPACK_H #define ARPACK_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -297,11 +289,11 @@ typedef struct igraph_arpack_storage_t { igraph_real_t *workev; } igraph_arpack_storage_t; -void igraph_arpack_options_init(igraph_arpack_options_t *o); +DECLDIR void igraph_arpack_options_init(igraph_arpack_options_t *o); -int igraph_arpack_storage_init(igraph_arpack_storage_t *s, long int maxn, - long int maxncv, long int maxldv, igraph_bool_t symm); -void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s); +DECLDIR int igraph_arpack_storage_init(igraph_arpack_storage_t *s, long int maxn, + long int maxncv, long int maxldv, igraph_bool_t symm); +DECLDIR void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s); /** * \typedef igraph_arpack_function_t @@ -323,18 +315,18 @@ void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s); typedef int igraph_arpack_function_t(igraph_real_t *to, const igraph_real_t *from, int n, void *extra); -int igraph_arpack_rssolve(igraph_arpack_function_t *fun, void *extra, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, igraph_matrix_t *vectors); +DECLDIR int igraph_arpack_rssolve(igraph_arpack_function_t *fun, void *extra, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_vector_t *values, igraph_matrix_t *vectors); -int igraph_arpack_rnsolve(igraph_arpack_function_t *fun, void *extra, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_matrix_t *values, igraph_matrix_t *vectors); +DECLDIR int igraph_arpack_rnsolve(igraph_arpack_function_t *fun, void *extra, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_matrix_t *values, igraph_matrix_t *vectors); -int igraph_arpack_unpack_complex(igraph_matrix_t *vectors, igraph_matrix_t *values, - long int nev); +DECLDIR int igraph_arpack_unpack_complex(igraph_matrix_t *vectors, igraph_matrix_t *values, + long int nev); __END_DECLS diff --git a/include/igraph_array.h b/include/igraph_array.h index 4b8a47e7e..de9b4700e 100644 --- a/include/igraph_array.h +++ b/include/igraph_array.h @@ -24,15 +24,7 @@ #ifndef IGRAPH_ARRAY_H #define IGRAPH_ARRAY_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS diff --git a/include/igraph_attributes.h b/include/igraph_attributes.h index 003bc56af..9d0f85e4b 100644 --- a/include/igraph_attributes.h +++ b/include/igraph_attributes.h @@ -24,16 +24,7 @@ #ifndef REST_ATTRIBUTES_H #define REST_ATTRIBUTES_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -151,19 +142,19 @@ typedef struct igraph_attribute_combination_t { #define IGRAPH_NO_MORE_ATTRIBUTES ((const char*)0) -int igraph_attribute_combination_init(igraph_attribute_combination_t *comb); -int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...); -void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb); -int igraph_attribute_combination_add(igraph_attribute_combination_t *comb, - const char *name, - igraph_attribute_combination_type_t type, - void *func); -int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb, - const char *name); -int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb, - const char *name, - igraph_attribute_combination_type_t *type, - void **func); +DECLDIR int igraph_attribute_combination_init(igraph_attribute_combination_t *comb); +DECLDIR int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...); +DECLDIR void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb); +DECLDIR int igraph_attribute_combination_add(igraph_attribute_combination_t *comb, + const char *name, + igraph_attribute_combination_type_t type, + void *func); +DECLDIR int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb, + const char *name); +DECLDIR int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb, + const char *name, + igraph_attribute_combination_type_t *type, + void **func); /** * \struct igraph_attribute_table_t @@ -298,10 +289,9 @@ typedef struct igraph_attribute_table_t { igraph_vector_bool_t *value); } igraph_attribute_table_t; -igraph_attribute_table_t * -igraph_i_set_attribute_table(const igraph_attribute_table_t * table); +DECLDIR igraph_attribute_table_t * igraph_i_set_attribute_table(const igraph_attribute_table_t * table); -igraph_bool_t igraph_has_attribute_table(void); +DECLDIR igraph_bool_t igraph_has_attribute_table(void); #define IGRAPH_I_ATTRIBUTE_DESTROY(graph) \ do {if ((graph)->attr) igraph_i_attribute_destroy(graph);} while(0) @@ -392,80 +382,80 @@ int igraph_i_attribute_get_bool_edge_attr(const igraph_t *graph, extern const igraph_attribute_table_t igraph_cattribute_table; -igraph_real_t igraph_cattribute_GAN(const igraph_t *graph, const char *name); -igraph_bool_t igraph_cattribute_GAB(const igraph_t *graph, const char *name); -const char* igraph_cattribute_GAS(const igraph_t *graph, const char *name); -igraph_real_t igraph_cattribute_VAN(const igraph_t *graph, const char *name, - igraph_integer_t vid); -igraph_bool_t igraph_cattribute_VAB(const igraph_t *graph, const char *name, - igraph_integer_t vid); -const char* igraph_cattribute_VAS(const igraph_t *graph, const char *name, - igraph_integer_t vid); -igraph_real_t igraph_cattribute_EAN(const igraph_t *graph, const char *name, - igraph_integer_t eid); -igraph_bool_t igraph_cattribute_EAB(const igraph_t *graph, const char *name, - igraph_integer_t eid); -const char* igraph_cattribute_EAS(const igraph_t *graph, const char *name, - igraph_integer_t eid); - -int igraph_cattribute_VANV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_vector_t *result); -int igraph_cattribute_EANV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_vector_t *result); -int igraph_cattribute_VASV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_strvector_t *result); -int igraph_cattribute_EASV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_strvector_t *result); -int igraph_cattribute_VABV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_vector_bool_t *result); -int igraph_cattribute_EABV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_vector_bool_t *result); - -int igraph_cattribute_list(const igraph_t *graph, - igraph_strvector_t *gnames, igraph_vector_t *gtypes, - igraph_strvector_t *vnames, igraph_vector_t *vtypes, - igraph_strvector_t *enames, igraph_vector_t *etypes); -igraph_bool_t igraph_cattribute_has_attr(const igraph_t *graph, - igraph_attribute_elemtype_t type, - const char *name); - -int igraph_cattribute_GAN_set(igraph_t *graph, const char *name, - igraph_real_t value); -int igraph_cattribute_GAB_set(igraph_t *graph, const char *name, - igraph_bool_t value); -int igraph_cattribute_GAS_set(igraph_t *graph, const char *name, - const char *value); -int igraph_cattribute_VAN_set(igraph_t *graph, const char *name, - igraph_integer_t vid, igraph_real_t value); -int igraph_cattribute_VAB_set(igraph_t *graph, const char *name, - igraph_integer_t vid, igraph_bool_t value); -int igraph_cattribute_VAS_set(igraph_t *graph, const char *name, - igraph_integer_t vid, const char *value); -int igraph_cattribute_EAN_set(igraph_t *graph, const char *name, - igraph_integer_t eid, igraph_real_t value); -int igraph_cattribute_EAB_set(igraph_t *graph, const char *name, - igraph_integer_t eid, igraph_bool_t value); -int igraph_cattribute_EAS_set(igraph_t *graph, const char *name, - igraph_integer_t eid, const char *value); - -int igraph_cattribute_VAN_setv(igraph_t *graph, const char *name, - const igraph_vector_t *v); -int igraph_cattribute_VAB_setv(igraph_t *graph, const char *name, - const igraph_vector_bool_t *v); -int igraph_cattribute_VAS_setv(igraph_t *graph, const char *name, - const igraph_strvector_t *sv); -int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name, - const igraph_vector_t *v); -int igraph_cattribute_EAB_setv(igraph_t *graph, const char *name, - const igraph_vector_bool_t *v); -int igraph_cattribute_EAS_setv(igraph_t *graph, const char *name, - const igraph_strvector_t *sv); - -void igraph_cattribute_remove_g(igraph_t *graph, const char *name); -void igraph_cattribute_remove_v(igraph_t *graph, const char *name); -void igraph_cattribute_remove_e(igraph_t *graph, const char *name); -void igraph_cattribute_remove_all(igraph_t *graph, igraph_bool_t g, - igraph_bool_t v, igraph_bool_t e); +DECLDIR igraph_real_t igraph_cattribute_GAN(const igraph_t *graph, const char *name); +DECLDIR igraph_bool_t igraph_cattribute_GAB(const igraph_t *graph, const char *name); +DECLDIR const char* igraph_cattribute_GAS(const igraph_t *graph, const char *name); +DECLDIR igraph_real_t igraph_cattribute_VAN(const igraph_t *graph, const char *name, + igraph_integer_t vid); +DECLDIR igraph_bool_t igraph_cattribute_VAB(const igraph_t *graph, const char *name, + igraph_integer_t vid); +DECLDIR const char* igraph_cattribute_VAS(const igraph_t *graph, const char *name, + igraph_integer_t vid); +DECLDIR igraph_real_t igraph_cattribute_EAN(const igraph_t *graph, const char *name, + igraph_integer_t eid); +DECLDIR igraph_bool_t igraph_cattribute_EAB(const igraph_t *graph, const char *name, + igraph_integer_t eid); +DECLDIR const char* igraph_cattribute_EAS(const igraph_t *graph, const char *name, + igraph_integer_t eid); + +DECLDIR int igraph_cattribute_VANV(const igraph_t *graph, const char *name, + igraph_vs_t vids, igraph_vector_t *result); +DECLDIR int igraph_cattribute_EANV(const igraph_t *graph, const char *name, + igraph_es_t eids, igraph_vector_t *result); +DECLDIR int igraph_cattribute_VASV(const igraph_t *graph, const char *name, + igraph_vs_t vids, igraph_strvector_t *result); +DECLDIR int igraph_cattribute_EASV(const igraph_t *graph, const char *name, + igraph_es_t eids, igraph_strvector_t *result); +DECLDIR int igraph_cattribute_VABV(const igraph_t *graph, const char *name, + igraph_vs_t vids, igraph_vector_bool_t *result); +DECLDIR int igraph_cattribute_EABV(const igraph_t *graph, const char *name, + igraph_es_t eids, igraph_vector_bool_t *result); + +DECLDIR int igraph_cattribute_list(const igraph_t *graph, + igraph_strvector_t *gnames, igraph_vector_t *gtypes, + igraph_strvector_t *vnames, igraph_vector_t *vtypes, + igraph_strvector_t *enames, igraph_vector_t *etypes); +DECLDIR igraph_bool_t igraph_cattribute_has_attr(const igraph_t *graph, + igraph_attribute_elemtype_t type, + const char *name); + +DECLDIR int igraph_cattribute_GAN_set(igraph_t *graph, const char *name, + igraph_real_t value); +DECLDIR int igraph_cattribute_GAB_set(igraph_t *graph, const char *name, + igraph_bool_t value); +DECLDIR int igraph_cattribute_GAS_set(igraph_t *graph, const char *name, + const char *value); +DECLDIR int igraph_cattribute_VAN_set(igraph_t *graph, const char *name, + igraph_integer_t vid, igraph_real_t value); +DECLDIR int igraph_cattribute_VAB_set(igraph_t *graph, const char *name, + igraph_integer_t vid, igraph_bool_t value); +DECLDIR int igraph_cattribute_VAS_set(igraph_t *graph, const char *name, + igraph_integer_t vid, const char *value); +DECLDIR int igraph_cattribute_EAN_set(igraph_t *graph, const char *name, + igraph_integer_t eid, igraph_real_t value); +DECLDIR int igraph_cattribute_EAB_set(igraph_t *graph, const char *name, + igraph_integer_t eid, igraph_bool_t value); +DECLDIR int igraph_cattribute_EAS_set(igraph_t *graph, const char *name, + igraph_integer_t eid, const char *value); + +DECLDIR int igraph_cattribute_VAN_setv(igraph_t *graph, const char *name, + const igraph_vector_t *v); +DECLDIR int igraph_cattribute_VAB_setv(igraph_t *graph, const char *name, + const igraph_vector_bool_t *v); +DECLDIR int igraph_cattribute_VAS_setv(igraph_t *graph, const char *name, + const igraph_strvector_t *sv); +DECLDIR int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name, + const igraph_vector_t *v); +DECLDIR int igraph_cattribute_EAB_setv(igraph_t *graph, const char *name, + const igraph_vector_bool_t *v); +DECLDIR int igraph_cattribute_EAS_setv(igraph_t *graph, const char *name, + const igraph_strvector_t *sv); + +DECLDIR void igraph_cattribute_remove_g(igraph_t *graph, const char *name); +DECLDIR void igraph_cattribute_remove_v(igraph_t *graph, const char *name); +DECLDIR void igraph_cattribute_remove_e(igraph_t *graph, const char *name); +DECLDIR void igraph_cattribute_remove_all(igraph_t *graph, igraph_bool_t g, + igraph_bool_t v, igraph_bool_t e); /** * \define GAN diff --git a/include/igraph_bipartite.h b/include/igraph_bipartite.h index 69c2d482f..19e50c555 100644 --- a/include/igraph_bipartite.h +++ b/include/igraph_bipartite.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_BIPARTITE_H #define IGRAPH_BIPARTITE_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -46,60 +37,60 @@ __BEGIN_DECLS /* Bipartite networks */ /* -------------------------------------------------- */ -int igraph_full_bipartite(igraph_t *graph, - igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_bool_t directed, - igraph_neimode_t mode); - -int igraph_create_bipartite(igraph_t *g, const igraph_vector_bool_t *types, - const igraph_vector_t *edges, - igraph_bool_t directed); - -int igraph_bipartite_projection_size(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_integer_t *vcount1, - igraph_integer_t *ecount1, - igraph_integer_t *vcount2, - igraph_integer_t *ecount2); - -int igraph_bipartite_projection(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_t *proj1, - igraph_t *proj2, - igraph_vector_t *multiplicity1, - igraph_vector_t *multiplicity2, - igraph_integer_t probe1); - -int igraph_incidence(igraph_t *graph, igraph_vector_bool_t *types, - const igraph_matrix_t *incidence, igraph_bool_t directed, - igraph_neimode_t mode, igraph_bool_t multiple); - -int igraph_get_incidence(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_matrix_t *res, - igraph_vector_t *row_ids, - igraph_vector_t *col_ids); - -int igraph_is_bipartite(const igraph_t *graph, - igraph_bool_t *res, - igraph_vector_bool_t *type); - -int igraph_bipartite_game(igraph_t *graph, igraph_vector_bool_t *types, - igraph_erdos_renyi_t type, - igraph_integer_t n1, igraph_integer_t n2, - igraph_real_t p, igraph_integer_t m, - igraph_bool_t directed, igraph_neimode_t mode); - -int igraph_bipartite_game_gnp(igraph_t *graph, igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_real_t p, igraph_bool_t directed, - igraph_neimode_t mode); - -int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_integer_t m, igraph_bool_t directed, - igraph_neimode_t mode); +DECLDIR int igraph_full_bipartite(igraph_t *graph, + igraph_vector_bool_t *types, + igraph_integer_t n1, igraph_integer_t n2, + igraph_bool_t directed, + igraph_neimode_t mode); + +DECLDIR int igraph_create_bipartite(igraph_t *g, const igraph_vector_bool_t *types, + const igraph_vector_t *edges, + igraph_bool_t directed); + +DECLDIR int igraph_bipartite_projection_size(const igraph_t *graph, + const igraph_vector_bool_t *types, + igraph_integer_t *vcount1, + igraph_integer_t *ecount1, + igraph_integer_t *vcount2, + igraph_integer_t *ecount2); + +DECLDIR int igraph_bipartite_projection(const igraph_t *graph, + const igraph_vector_bool_t *types, + igraph_t *proj1, + igraph_t *proj2, + igraph_vector_t *multiplicity1, + igraph_vector_t *multiplicity2, + igraph_integer_t probe1); + +DECLDIR int igraph_incidence(igraph_t *graph, igraph_vector_bool_t *types, + const igraph_matrix_t *incidence, igraph_bool_t directed, + igraph_neimode_t mode, igraph_bool_t multiple); + +DECLDIR int igraph_get_incidence(const igraph_t *graph, + const igraph_vector_bool_t *types, + igraph_matrix_t *res, + igraph_vector_t *row_ids, + igraph_vector_t *col_ids); + +DECLDIR int igraph_is_bipartite(const igraph_t *graph, + igraph_bool_t *res, + igraph_vector_bool_t *type); + +DECLDIR int igraph_bipartite_game(igraph_t *graph, igraph_vector_bool_t *types, + igraph_erdos_renyi_t type, + igraph_integer_t n1, igraph_integer_t n2, + igraph_real_t p, igraph_integer_t m, + igraph_bool_t directed, igraph_neimode_t mode); + +DECLDIR int igraph_bipartite_game_gnp(igraph_t *graph, igraph_vector_bool_t *types, + igraph_integer_t n1, igraph_integer_t n2, + igraph_real_t p, igraph_bool_t directed, + igraph_neimode_t mode); + +DECLDIR int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types, + igraph_integer_t n1, igraph_integer_t n2, + igraph_integer_t m, igraph_bool_t directed, + igraph_neimode_t mode); __END_DECLS diff --git a/include/igraph_blas.h b/include/igraph_blas.h index 102a6d190..b6c41ca55 100644 --- a/include/igraph_blas.h +++ b/include/igraph_blas.h @@ -27,16 +27,7 @@ #include "igraph_types.h" #include "igraph_vector.h" #include "igraph_matrix.h" - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -60,14 +51,14 @@ __BEGIN_DECLS * */ -void igraph_blas_dgemv(igraph_bool_t transpose, igraph_real_t alpha, - const igraph_matrix_t* a, const igraph_vector_t* x, - igraph_real_t beta, igraph_vector_t* y); -void igraph_blas_dgemv_array(igraph_bool_t transpose, igraph_real_t alpha, - const igraph_matrix_t* a, const igraph_real_t* x, - igraph_real_t beta, igraph_real_t* y); +DECLDIR void igraph_blas_dgemv(igraph_bool_t transpose, igraph_real_t alpha, + const igraph_matrix_t* a, const igraph_vector_t* x, + igraph_real_t beta, igraph_vector_t* y); +DECLDIR void igraph_blas_dgemv_array(igraph_bool_t transpose, igraph_real_t alpha, + const igraph_matrix_t* a, const igraph_real_t* x, + igraph_real_t beta, igraph_real_t* y); -igraph_real_t igraph_blas_dnrm2(const igraph_vector_t *v); +DECLDIR igraph_real_t igraph_blas_dnrm2(const igraph_vector_t *v); __END_DECLS diff --git a/include/igraph_centrality.h b/include/igraph_centrality.h index 3df2c8b93..108682215 100644 --- a/include/igraph_centrality.h +++ b/include/igraph_centrality.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_CENTRALITY_H #define IGRAPH_CENTRALITY_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -64,32 +38,32 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_closeness(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - const igraph_vector_t *weights, igraph_bool_t normalized); + const igraph_vs_t vids, igraph_neimode_t mode, + const igraph_vector_t *weights, igraph_bool_t normalized); DECLDIR int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_real_t cutoff, - const igraph_vector_t *weights, - igraph_bool_t normalized); + const igraph_vs_t vids, igraph_neimode_t mode, + igraph_real_t cutoff, + const igraph_vector_t *weights, + igraph_bool_t normalized); DECLDIR int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - const igraph_vector_t *weights, igraph_bool_t nobigint); + const igraph_vs_t vids, igraph_bool_t directed, + const igraph_vector_t *weights, igraph_bool_t nobigint); DECLDIR int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - igraph_real_t cutoff, - const igraph_vector_t *weights, - igraph_bool_t nobigint); + const igraph_vs_t vids, igraph_bool_t directed, + igraph_real_t cutoff, + const igraph_vector_t *weights, + igraph_bool_t nobigint); DECLDIR int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result, - igraph_bool_t directed, - const igraph_vector_t *weigths); + igraph_bool_t directed, + const igraph_vector_t *weigths); DECLDIR int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result, - igraph_bool_t directed, igraph_real_t cutoff, - const igraph_vector_t *weights); -int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - igraph_integer_t niter, igraph_real_t eps, - igraph_real_t damping, igraph_bool_t old); + igraph_bool_t directed, igraph_real_t cutoff, + const igraph_vector_t *weights); +DECLDIR int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res, + const igraph_vs_t vids, igraph_bool_t directed, + igraph_integer_t niter, igraph_real_t eps, + igraph_real_t damping, igraph_bool_t old); /** * \typedef igraph_pagerank_algo_t @@ -127,111 +101,111 @@ typedef struct igraph_pagerank_power_options_t { } igraph_pagerank_power_options_t; DECLDIR int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo, - igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - const igraph_vector_t *weights, void *options); + igraph_vector_t *vector, + igraph_real_t *value, const igraph_vs_t vids, + igraph_bool_t directed, igraph_real_t damping, + const igraph_vector_t *weights, void *options); DECLDIR int igraph_personalized_pagerank(const igraph_t *graph, - igraph_pagerank_algo_t algo, igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - igraph_vector_t *reset, - const igraph_vector_t *weights, void *options); + igraph_pagerank_algo_t algo, igraph_vector_t *vector, + igraph_real_t *value, const igraph_vs_t vids, + igraph_bool_t directed, igraph_real_t damping, + igraph_vector_t *reset, + const igraph_vector_t *weights, void *options); DECLDIR int igraph_personalized_pagerank_vs(const igraph_t *graph, - igraph_pagerank_algo_t algo, - igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - igraph_vs_t reset_vids, - const igraph_vector_t *weights, void *options); + igraph_pagerank_algo_t algo, + igraph_vector_t *vector, + igraph_real_t *value, const igraph_vs_t vids, + igraph_bool_t directed, igraph_real_t damping, + igraph_vs_t reset_vids, + const igraph_vector_t *weights, void *options); DECLDIR int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, - igraph_bool_t directed, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); + igraph_real_t *value, + igraph_bool_t directed, igraph_bool_t scale, + const igraph_vector_t *weights, + igraph_arpack_options_t *options); DECLDIR int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); + igraph_real_t *value, igraph_bool_t scale, + const igraph_vector_t *weights, + igraph_arpack_options_t *options); DECLDIR int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); + igraph_real_t *value, igraph_bool_t scale, + const igraph_vector_t *weights, + igraph_arpack_options_t *options); DECLDIR int igraph_constraint(const igraph_t *graph, igraph_vector_t *res, - igraph_vs_t vids, const igraph_vector_t *weights); + igraph_vs_t vids, const igraph_vector_t *weights); DECLDIR int igraph_strength(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops, const igraph_vector_t *weights); + const igraph_vs_t vids, igraph_neimode_t mode, + igraph_bool_t loops, const igraph_vector_t *weights); DECLDIR int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result, - igraph_vector_t *ins, igraph_vector_t *outs); + igraph_vector_t *ins, igraph_vector_t *outs); DECLDIR int igraph_sort_vertex_ids_by_degree(const igraph_t *graph, - igraph_vector_t *outvids, - igraph_vs_t vids, - igraph_neimode_t mode, - igraph_bool_t loops, - igraph_order_t order, - igraph_bool_t only_indices); + igraph_vector_t *outvids, + igraph_vs_t vids, + igraph_neimode_t mode, + igraph_bool_t loops, + igraph_order_t order, + igraph_bool_t only_indices); DECLDIR igraph_real_t igraph_centralization(const igraph_vector_t *scores, - igraph_real_t theoretical_max, - igraph_bool_t normalized); + igraph_real_t theoretical_max, + igraph_bool_t normalized); DECLDIR int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res, - igraph_neimode_t mode, igraph_bool_t loops, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); + igraph_neimode_t mode, igraph_bool_t loops, + igraph_real_t *centralization, + igraph_real_t *theoretical_max, + igraph_bool_t normalized); DECLDIR int igraph_centralization_degree_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_neimode_t mode, - igraph_bool_t loops, - igraph_real_t *res); + igraph_integer_t nodes, + igraph_neimode_t mode, + igraph_bool_t loops, + igraph_real_t *res); DECLDIR int igraph_centralization_betweenness(const igraph_t *graph, - igraph_vector_t *res, - igraph_bool_t directed, - igraph_bool_t nobigint, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); + igraph_vector_t *res, + igraph_bool_t directed, + igraph_bool_t nobigint, + igraph_real_t *centralization, + igraph_real_t *theoretical_max, + igraph_bool_t normalized); DECLDIR int igraph_centralization_betweenness_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_bool_t directed, - igraph_real_t *res); + igraph_integer_t nodes, + igraph_bool_t directed, + igraph_real_t *res); DECLDIR int igraph_centralization_closeness(const igraph_t *graph, - igraph_vector_t *res, - igraph_neimode_t mode, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); + igraph_vector_t *res, + igraph_neimode_t mode, + igraph_real_t *centralization, + igraph_real_t *theoretical_max, + igraph_bool_t normalized); DECLDIR int igraph_centralization_closeness_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_neimode_t mode, - igraph_real_t *res); + igraph_integer_t nodes, + igraph_neimode_t mode, + igraph_real_t *res); DECLDIR int igraph_centralization_eigenvector_centrality( - const igraph_t *graph, - igraph_vector_t *vector, - igraph_real_t *value, - igraph_bool_t directed, - igraph_bool_t scale, - igraph_arpack_options_t *options, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); + const igraph_t *graph, + igraph_vector_t *vector, + igraph_real_t *value, + igraph_bool_t directed, + igraph_bool_t scale, + igraph_arpack_options_t *options, + igraph_real_t *centralization, + igraph_real_t *theoretical_max, + igraph_bool_t normalized); DECLDIR int igraph_centralization_eigenvector_centrality_tmax( - const igraph_t *graph, - igraph_integer_t nodes, - igraph_bool_t directed, - igraph_bool_t scale, - igraph_real_t *res); + const igraph_t *graph, + igraph_integer_t nodes, + igraph_bool_t directed, + igraph_bool_t scale, + igraph_real_t *res); __END_DECLS diff --git a/include/igraph_cliques.h b/include/igraph_cliques.h index 3993e86de..9d2a0d6a4 100644 --- a/include/igraph_cliques.h +++ b/include/igraph_cliques.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_CLIQUES_H #define IGRAPH_CLIQUES_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_vector_ptr.h" @@ -62,45 +36,45 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_integer_t min_size, igraph_integer_t max_size); + igraph_integer_t min_size, igraph_integer_t max_size); DECLDIR int igraph_maximal_cliques_file(const igraph_t *graph, - FILE *outfile, - igraph_integer_t min_size, - igraph_integer_t max_size); + FILE *outfile, + igraph_integer_t min_size, + igraph_integer_t max_size); DECLDIR int igraph_maximal_cliques_count(const igraph_t *graph, - igraph_integer_t *res, - igraph_integer_t min_size, - igraph_integer_t max_size); + igraph_integer_t *res, + igraph_integer_t min_size, + igraph_integer_t max_size); DECLDIR int igraph_maximal_cliques_subset(const igraph_t *graph, - igraph_vector_int_t *subset, - igraph_vector_ptr_t *res, - igraph_integer_t *no, - FILE *outfile, - igraph_integer_t min_size, - igraph_integer_t max_size); + igraph_vector_int_t *subset, + igraph_vector_ptr_t *res, + igraph_integer_t *no, + FILE *outfile, + igraph_integer_t min_size, + igraph_integer_t max_size); DECLDIR int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_integer_t min_size, igraph_integer_t max_size); + igraph_integer_t min_size, igraph_integer_t max_size); DECLDIR int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist, - igraph_integer_t min_size, igraph_integer_t max_size); + igraph_integer_t min_size, igraph_integer_t max_size); DECLDIR int igraph_largest_cliques(const igraph_t *graph, - igraph_vector_ptr_t *cliques); + igraph_vector_ptr_t *cliques); DECLDIR int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no); DECLDIR int igraph_weighted_cliques(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res, - igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal); + const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res, + igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal); DECLDIR int igraph_largest_weighted_cliques(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res); + const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res); DECLDIR int igraph_weighted_clique_number(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_real_t *res); + const igraph_vector_t *vertex_weights, igraph_real_t *res); DECLDIR int igraph_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_integer_t min_size, - igraph_integer_t max_size); + igraph_vector_ptr_t *res, + igraph_integer_t min_size, + igraph_integer_t max_size); DECLDIR int igraph_largest_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res); + igraph_vector_ptr_t *res); DECLDIR int igraph_maximal_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res); + igraph_vector_ptr_t *res); DECLDIR int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no); /** @@ -120,9 +94,9 @@ DECLDIR int igraph_independence_number(const igraph_t *graph, igraph_integer_t * */ typedef igraph_bool_t igraph_clique_handler_t(igraph_vector_t *clique, void *arg); -int igraph_cliques_callback(const igraph_t *graph, - igraph_integer_t min_size, igraph_integer_t max_size, - igraph_clique_handler_t *cliquehandler_fn, void *arg); +DECLDIR int igraph_cliques_callback(const igraph_t *graph, + igraph_integer_t min_size, igraph_integer_t max_size, + igraph_clique_handler_t *cliquehandler_fn, void *arg); __END_DECLS diff --git a/include/igraph_cocitation.h b/include/igraph_cocitation.h index 7499a21e2..eb1c7cb6f 100644 --- a/include/igraph_cocitation.h +++ b/include/igraph_cocitation.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_COCITATION_H #define IGRAPH_COCITATION_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_matrix.h" #include "igraph_datatype.h" @@ -63,29 +37,29 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids); + const igraph_vs_t vids); DECLDIR int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids); + const igraph_vs_t vids); DECLDIR int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); + const igraph_vs_t vids, igraph_neimode_t mode, + igraph_bool_t loops); DECLDIR int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); + const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); DECLDIR int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res, - const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); + const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); DECLDIR int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); + const igraph_vs_t vids, igraph_neimode_t mode, + igraph_bool_t loops); DECLDIR int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); + const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); DECLDIR int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res, - const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); + const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); DECLDIR int igraph_similarity_inverse_log_weighted(const igraph_t *graph, - igraph_matrix_t *res, const igraph_vs_t vids, - igraph_neimode_t mode); + igraph_matrix_t *res, const igraph_vs_t vids, + igraph_neimode_t mode); __END_DECLS diff --git a/include/igraph_community.h b/include/igraph_community.h index 5aa9b162e..bf971f29c 100644 --- a/include/igraph_community.h +++ b/include/igraph_community.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_COMMUNITY_H #define IGRAPH_COMMUNITY_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -46,8 +37,8 @@ __BEGIN_DECLS /* K-Cores */ /* -------------------------------------------------- */ -int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores, - igraph_neimode_t mode); +DECLDIR int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores, + igraph_neimode_t mode); /* -------------------------------------------------- */ /* Community Structure */ @@ -57,102 +48,102 @@ int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores, /* TODO: edge.type.matrix */ /* TODO: */ -int igraph_community_optimal_modularity(const igraph_t *graph, - igraph_real_t *modularity, - igraph_vector_t *membership, - const igraph_vector_t *weights); - -int igraph_community_spinglass(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_real_t *modularity, - igraph_real_t *temperature, - igraph_vector_t *membership, - igraph_vector_t *csize, - igraph_integer_t spins, - igraph_bool_t parupdate, - igraph_real_t starttemp, - igraph_real_t stoptemp, - igraph_real_t coolfact, - igraph_spincomm_update_t update_rule, - igraph_real_t gamma, - /* the rest is for the NegSpin implementation */ - igraph_spinglass_implementation_t implementation, -/* igraph_matrix_t *adhesion, */ -/* igraph_matrix_t *normalised_adhesion, */ -/* igraph_real_t *polarization, */ - igraph_real_t lambda); - -int igraph_community_spinglass_single(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_integer_t vertex, - igraph_vector_t *community, - igraph_real_t *cohesion, - igraph_real_t *adhesion, - igraph_integer_t *inner_links, - igraph_integer_t *outer_links, - igraph_integer_t spins, - igraph_spincomm_update_t update_rule, - igraph_real_t gamma); +DECLDIR int igraph_community_optimal_modularity(const igraph_t *graph, + igraph_real_t *modularity, + igraph_vector_t *membership, + const igraph_vector_t *weights); + +DECLDIR int igraph_community_spinglass(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_real_t *modularity, + igraph_real_t *temperature, + igraph_vector_t *membership, + igraph_vector_t *csize, + igraph_integer_t spins, + igraph_bool_t parupdate, + igraph_real_t starttemp, + igraph_real_t stoptemp, + igraph_real_t coolfact, + igraph_spincomm_update_t update_rule, + igraph_real_t gamma, + /* the rest is for the NegSpin implementation */ + igraph_spinglass_implementation_t implementation, +/* igraph_matrix_t *adhesion, */ +/* igraph_matrix_t *normalised_adhesion, */ +/* igraph_real_t *polarization, */ + igraph_real_t lambda); + +DECLDIR int igraph_community_spinglass_single(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_integer_t vertex, + igraph_vector_t *community, + igraph_real_t *cohesion, + igraph_real_t *adhesion, + igraph_integer_t *inner_links, + igraph_integer_t *outer_links, + igraph_integer_t spins, + igraph_spincomm_update_t update_rule, + igraph_real_t gamma); -int igraph_community_walktrap(const igraph_t *graph, - const igraph_vector_t *weights, - int steps, - igraph_matrix_t *merges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -int igraph_community_infomap(const igraph_t * graph, - const igraph_vector_t *e_weights, - const igraph_vector_t *v_weights, - int nb_trials, - igraph_vector_t *membership, - igraph_real_t *codelength); - -int igraph_community_edge_betweenness(const igraph_t *graph, - igraph_vector_t *result, - igraph_vector_t *edge_betweenness, - igraph_matrix_t *merges, - igraph_vector_t *bridges, - igraph_vector_t *modularity, - igraph_vector_t *membership, - igraph_bool_t directed, - const igraph_vector_t *weights); -int igraph_community_eb_get_merges(const igraph_t *graph, - const igraph_vector_t *edges, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *bridges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -int igraph_community_fastgreedy(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -int igraph_community_to_membership(const igraph_matrix_t *merges, - igraph_integer_t nodes, - igraph_integer_t steps, - igraph_vector_t *membership, - igraph_vector_t *csize); -int igraph_le_community_to_membership(const igraph_matrix_t *merges, - igraph_integer_t steps, - igraph_vector_t *membership, - igraph_vector_t *csize); - -int igraph_modularity(const igraph_t *graph, - const igraph_vector_t *membership, - igraph_real_t *modularity, - const igraph_vector_t *weights); - -int igraph_modularity_matrix(const igraph_t *graph, - const igraph_vector_t *membership, - igraph_matrix_t *modmat, - const igraph_vector_t *weights); - -int igraph_reindex_membership(igraph_vector_t *membership, - igraph_vector_t *new_to_old); +DECLDIR int igraph_community_walktrap(const igraph_t *graph, + const igraph_vector_t *weights, + int steps, + igraph_matrix_t *merges, + igraph_vector_t *modularity, + igraph_vector_t *membership); + +DECLDIR int igraph_community_infomap(const igraph_t * graph, + const igraph_vector_t *e_weights, + const igraph_vector_t *v_weights, + int nb_trials, + igraph_vector_t *membership, + igraph_real_t *codelength); + +DECLDIR int igraph_community_edge_betweenness(const igraph_t *graph, + igraph_vector_t *result, + igraph_vector_t *edge_betweenness, + igraph_matrix_t *merges, + igraph_vector_t *bridges, + igraph_vector_t *modularity, + igraph_vector_t *membership, + igraph_bool_t directed, + const igraph_vector_t *weights); +DECLDIR int igraph_community_eb_get_merges(const igraph_t *graph, + const igraph_vector_t *edges, + const igraph_vector_t *weights, + igraph_matrix_t *merges, + igraph_vector_t *bridges, + igraph_vector_t *modularity, + igraph_vector_t *membership); + +DECLDIR int igraph_community_fastgreedy(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_matrix_t *merges, + igraph_vector_t *modularity, + igraph_vector_t *membership); + +DECLDIR int igraph_community_to_membership(const igraph_matrix_t *merges, + igraph_integer_t nodes, + igraph_integer_t steps, + igraph_vector_t *membership, + igraph_vector_t *csize); +DECLDIR int igraph_le_community_to_membership(const igraph_matrix_t *merges, + igraph_integer_t steps, + igraph_vector_t *membership, + igraph_vector_t *csize); + +DECLDIR int igraph_modularity(const igraph_t *graph, + const igraph_vector_t *membership, + igraph_real_t *modularity, + const igraph_vector_t *weights); + +DECLDIR int igraph_modularity_matrix(const igraph_t *graph, + const igraph_vector_t *membership, + igraph_matrix_t *modmat, + const igraph_vector_t *weights); + +DECLDIR int igraph_reindex_membership(igraph_vector_t *membership, + igraph_vector_t *new_to_old); typedef enum { IGRAPH_LEVC_HIST_SPLIT=1, IGRAPH_LEVC_HIST_FAILED, @@ -197,44 +188,44 @@ typedef int igraph_community_leading_eigenvector_callback_t( void *arpack_extra, void *extra); -int igraph_community_leading_eigenvector(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *membership, - igraph_integer_t steps, - igraph_arpack_options_t *options, - igraph_real_t *modularity, - igraph_bool_t start, - igraph_vector_t *eigenvalues, - igraph_vector_ptr_t *eigenvectors, - igraph_vector_t *history, - igraph_community_leading_eigenvector_callback_t *callback, - void *callback_extra); - -int igraph_community_label_propagation(const igraph_t *graph, - igraph_vector_t *membership, - const igraph_vector_t *weights, - const igraph_vector_t *initial, - igraph_vector_bool_t *fixed, - igraph_real_t *modularity); -int igraph_community_multilevel(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_t *membership, - igraph_matrix_t *memberships, - igraph_vector_t *modularity); +DECLDIR int igraph_community_leading_eigenvector(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_matrix_t *merges, + igraph_vector_t *membership, + igraph_integer_t steps, + igraph_arpack_options_t *options, + igraph_real_t *modularity, + igraph_bool_t start, + igraph_vector_t *eigenvalues, + igraph_vector_ptr_t *eigenvectors, + igraph_vector_t *history, + igraph_community_leading_eigenvector_callback_t *callback, + void *callback_extra); + +DECLDIR int igraph_community_label_propagation(const igraph_t *graph, + igraph_vector_t *membership, + const igraph_vector_t *weights, + const igraph_vector_t *initial, + igraph_vector_bool_t *fixed, + igraph_real_t *modularity); +DECLDIR int igraph_community_multilevel(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_vector_t *membership, + igraph_matrix_t *memberships, + igraph_vector_t *modularity); /* -------------------------------------------------- */ /* Community Structure Comparison */ /* -------------------------------------------------- */ -int igraph_compare_communities(const igraph_vector_t *comm1, - const igraph_vector_t *comm2, - igraph_real_t* result, - igraph_community_comparison_t method); -int igraph_split_join_distance(const igraph_vector_t *comm1, - const igraph_vector_t *comm2, - igraph_integer_t* distance12, - igraph_integer_t* distance21); +DECLDIR int igraph_compare_communities(const igraph_vector_t *comm1, + const igraph_vector_t *comm2, + igraph_real_t* result, + igraph_community_comparison_t method); +DECLDIR int igraph_split_join_distance(const igraph_vector_t *comm1, + const igraph_vector_t *comm2, + igraph_integer_t* distance12, + igraph_integer_t* distance21); __END_DECLS diff --git a/include/igraph_complex.h b/include/igraph_complex.h index 9821038c7..413763099 100644 --- a/include/igraph_complex.h +++ b/include/igraph_complex.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_COMPLEX_H #define IGRAPH_COMPLEX_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" __BEGIN_DECLS @@ -44,67 +35,67 @@ typedef struct igraph_complex_t { igraph_real_t dat[2]; } igraph_complex_t; #define IGRAPH_IMAG(x) ((x).dat[1]) #define IGRAPH_COMPLEX_EQ(x,y) ((x).dat[0]==(y).dat[0] && (x).dat[1]==(y).dat[1]) -igraph_complex_t igraph_complex(igraph_real_t x, igraph_real_t y); -igraph_complex_t igraph_complex_polar(igraph_real_t r, igraph_real_t theta); - -igraph_bool_t igraph_complex_eq_tol(igraph_complex_t z1, - igraph_complex_t z2, - igraph_real_t tol); - -igraph_real_t igraph_complex_mod(igraph_complex_t z); -igraph_real_t igraph_complex_arg(igraph_complex_t z); - -igraph_real_t igraph_complex_abs(igraph_complex_t z); -igraph_real_t igraph_complex_logabs(igraph_complex_t z); - -igraph_complex_t igraph_complex_add(igraph_complex_t z1, - igraph_complex_t z2); -igraph_complex_t igraph_complex_sub(igraph_complex_t z1, - igraph_complex_t z2); -igraph_complex_t igraph_complex_mul(igraph_complex_t z1, - igraph_complex_t z2); -igraph_complex_t igraph_complex_div(igraph_complex_t z1, - igraph_complex_t z2); - -igraph_complex_t igraph_complex_add_real(igraph_complex_t z, - igraph_real_t x); -igraph_complex_t igraph_complex_add_imag(igraph_complex_t z, - igraph_real_t y); -igraph_complex_t igraph_complex_sub_real(igraph_complex_t z, - igraph_real_t x); -igraph_complex_t igraph_complex_sub_imag(igraph_complex_t z, - igraph_real_t y); -igraph_complex_t igraph_complex_mul_real(igraph_complex_t z, - igraph_real_t x); -igraph_complex_t igraph_complex_mul_imag(igraph_complex_t z, - igraph_real_t y); -igraph_complex_t igraph_complex_div_real(igraph_complex_t z, - igraph_real_t x); -igraph_complex_t igraph_complex_div_imag(igraph_complex_t z, - igraph_real_t y); - -igraph_complex_t igraph_complex_conj(igraph_complex_t z); -igraph_complex_t igraph_complex_neg(igraph_complex_t z); -igraph_complex_t igraph_complex_inv(igraph_complex_t z); - -igraph_complex_t igraph_complex_sqrt(igraph_complex_t z); -igraph_complex_t igraph_complex_sqrt_real(igraph_real_t x); -igraph_complex_t igraph_complex_exp(igraph_complex_t z); -igraph_complex_t igraph_complex_pow(igraph_complex_t z1, - igraph_complex_t z2); -igraph_complex_t igraph_complex_pow_real(igraph_complex_t z, - igraph_real_t x); -igraph_complex_t igraph_complex_log(igraph_complex_t z); -igraph_complex_t igraph_complex_log10(igraph_complex_t z); -igraph_complex_t igraph_complex_log_b(igraph_complex_t z, - igraph_complex_t b); - -igraph_complex_t igraph_complex_sin(igraph_complex_t z); -igraph_complex_t igraph_complex_cos(igraph_complex_t z); -igraph_complex_t igraph_complex_tan(igraph_complex_t z); -igraph_complex_t igraph_complex_sec(igraph_complex_t z); -igraph_complex_t igraph_complex_csc(igraph_complex_t z); -igraph_complex_t igraph_complex_cot(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex(igraph_real_t x, igraph_real_t y); +DECLDIR igraph_complex_t igraph_complex_polar(igraph_real_t r, igraph_real_t theta); + +DECLDIR igraph_bool_t igraph_complex_eq_tol(igraph_complex_t z1, + igraph_complex_t z2, + igraph_real_t tol); + +DECLDIR igraph_real_t igraph_complex_mod(igraph_complex_t z); +DECLDIR igraph_real_t igraph_complex_arg(igraph_complex_t z); + +DECLDIR igraph_real_t igraph_complex_abs(igraph_complex_t z); +DECLDIR igraph_real_t igraph_complex_logabs(igraph_complex_t z); + +DECLDIR igraph_complex_t igraph_complex_add(igraph_complex_t z1, + igraph_complex_t z2); +DECLDIR igraph_complex_t igraph_complex_sub(igraph_complex_t z1, + igraph_complex_t z2); +DECLDIR igraph_complex_t igraph_complex_mul(igraph_complex_t z1, + igraph_complex_t z2); +DECLDIR igraph_complex_t igraph_complex_div(igraph_complex_t z1, + igraph_complex_t z2); + +DECLDIR igraph_complex_t igraph_complex_add_real(igraph_complex_t z, + igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_add_imag(igraph_complex_t z, + igraph_real_t y); +DECLDIR igraph_complex_t igraph_complex_sub_real(igraph_complex_t z, + igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_sub_imag(igraph_complex_t z, + igraph_real_t y); +DECLDIR igraph_complex_t igraph_complex_mul_real(igraph_complex_t z, + igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_mul_imag(igraph_complex_t z, + igraph_real_t y); +DECLDIR igraph_complex_t igraph_complex_div_real(igraph_complex_t z, + igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_div_imag(igraph_complex_t z, + igraph_real_t y); + +DECLDIR igraph_complex_t igraph_complex_conj(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_neg(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_inv(igraph_complex_t z); + +DECLDIR igraph_complex_t igraph_complex_sqrt(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_sqrt_real(igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_exp(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_pow(igraph_complex_t z1, + igraph_complex_t z2); +DECLDIR igraph_complex_t igraph_complex_pow_real(igraph_complex_t z, + igraph_real_t x); +DECLDIR igraph_complex_t igraph_complex_log(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_log10(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_log_b(igraph_complex_t z, + igraph_complex_t b); + +DECLDIR igraph_complex_t igraph_complex_sin(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_cos(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_tan(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_sec(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_csc(igraph_complex_t z); +DECLDIR igraph_complex_t igraph_complex_cot(igraph_complex_t z); __END_DECLS diff --git a/include/igraph_components.h b/include/igraph_components.h index 93119a291..1c61381f2 100644 --- a/include/igraph_components.h +++ b/include/igraph_components.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_COMPONENTS_H #define IGRAPH_COMPONENTS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -64,22 +38,22 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership, - igraph_vector_t *csize, igraph_integer_t *no, - igraph_connectedness_t mode); + igraph_vector_t *csize, igraph_integer_t *no, + igraph_connectedness_t mode); DECLDIR int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res, - igraph_connectedness_t mode); + igraph_connectedness_t mode); DECLDIR void igraph_decompose_destroy(igraph_vector_ptr_t *complist); DECLDIR int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components, - igraph_connectedness_t mode, - long int maxcompno, long int minelements); + igraph_connectedness_t mode, + long int maxcompno, long int minelements); DECLDIR int igraph_articulation_points(const igraph_t *graph, - igraph_vector_t *res); + igraph_vector_t *res); DECLDIR int igraph_biconnected_components(const igraph_t *graph, - igraph_integer_t *no, - igraph_vector_ptr_t *tree_edges, - igraph_vector_ptr_t *component_edges, - igraph_vector_ptr_t *components, - igraph_vector_t *articulation_points); + igraph_integer_t *no, + igraph_vector_ptr_t *tree_edges, + igraph_vector_ptr_t *component_edges, + igraph_vector_ptr_t *components, + igraph_vector_t *articulation_points); __END_DECLS diff --git a/include/igraph_constants.h b/include/igraph_constants.h index 715f750cb..ea5b71061 100644 --- a/include/igraph_constants.h +++ b/include/igraph_constants.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_CONSTANTS_H #define IGRAPH_CONSTANTS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_datatype.h" diff --git a/include/igraph_constructors.h b/include/igraph_constructors.h index 444cdedf3..a92f0f4c0 100644 --- a/include/igraph_constructors.h +++ b/include/igraph_constructors.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_CONSTRUCTORS_H #define IGRAPH_CONSTRUCTORS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_matrix.h" @@ -63,38 +37,38 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n, - igraph_bool_t directed); + igraph_bool_t directed); DECLDIR int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, - ...); + ...); DECLDIR int igraph_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, - igraph_adjacency_t mode); + igraph_adjacency_t mode); DECLDIR int igraph_weighted_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix, - igraph_adjacency_t mode, const char* attr, - igraph_bool_t loops); + igraph_adjacency_t mode, const char* attr, + igraph_bool_t loops); DECLDIR int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode, - igraph_integer_t center); + igraph_integer_t center); DECLDIR int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei, - igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular); + igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular); DECLDIR int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, - igraph_bool_t mutual, igraph_bool_t circular); + igraph_bool_t mutual, igraph_bool_t circular); DECLDIR int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children, - igraph_tree_mode_t type); + igraph_tree_mode_t type); DECLDIR int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops); DECLDIR int igraph_full_citation(igraph_t *graph, igraph_integer_t n, - igraph_bool_t directed); + igraph_bool_t directed); DECLDIR int igraph_atlas(igraph_t *graph, int number); DECLDIR int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes, - const igraph_matrix_t *W); + const igraph_matrix_t *W); DECLDIR int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order, - igraph_neimode_t mode); + igraph_neimode_t mode); DECLDIR int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph); DECLDIR int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); DECLDIR int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); DECLDIR int igraph_famous(igraph_t *graph, const char *name); DECLDIR int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n, - const igraph_vector_t *shifts, - igraph_integer_t repeats); + const igraph_vector_t *shifts, + igraph_integer_t repeats); DECLDIR int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...); __END_DECLS diff --git a/include/igraph_conversion.h b/include/igraph_conversion.h index e7d04879d..1c3d01650 100644 --- a/include/igraph_conversion.h +++ b/include/igraph_conversion.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_CONVERSION_H #define IGRAPH_CONVERSION_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -66,25 +40,25 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res, - igraph_get_adjacency_t type, igraph_bool_t eids); + igraph_get_adjacency_t type, igraph_bool_t eids); DECLDIR int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res, - igraph_get_adjacency_t type); + igraph_get_adjacency_t type); DECLDIR int igraph_get_stochastic(const igraph_t *graph, - igraph_matrix_t *matrix, - igraph_bool_t column_wise); + igraph_matrix_t *matrix, + igraph_bool_t column_wise); DECLDIR int igraph_get_stochastic_sparsemat(const igraph_t *graph, - igraph_sparsemat_t *sparsemat, - igraph_bool_t column_wise); + igraph_sparsemat_t *sparsemat, + igraph_bool_t column_wise); DECLDIR int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol); DECLDIR int igraph_to_directed(igraph_t *graph, - igraph_to_directed_t flags); + igraph_to_directed_t flags); DECLDIR int igraph_to_undirected(igraph_t *graph, - igraph_to_undirected_t flags, - const igraph_attribute_combination_t *edge_comb); + igraph_to_undirected_t flags, + const igraph_attribute_combination_t *edge_comb); __END_DECLS diff --git a/include/igraph_datatype.h b/include/igraph_datatype.h index 563b8d076..703b7e868 100644 --- a/include/igraph_datatype.h +++ b/include/igraph_datatype.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_DATATYPE_H #define IGRAPH_DATATYPE_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_vector.h" diff --git a/include/igraph_decls.h b/include/igraph_decls.h new file mode 100644 index 000000000..01a0b44b9 --- /dev/null +++ b/include/igraph_decls.h @@ -0,0 +1,24 @@ +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +#undef DECLDIR +#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) +# if defined (__MINGW32__) || defined (__CYGWIN32__) +# define DECLDIR /**/ +# else +# ifdef IGRAPH_EXPORTS +# define DECLDIR __declspec(dllexport) +# else +# define DECLDIR __declspec(dllimport) +# endif +# endif +#else +# define DECLDIR /**/ +#endif \ No newline at end of file diff --git a/include/igraph_dqueue.h b/include/igraph_dqueue.h index eff1ce516..5777287bb 100644 --- a/include/igraph_dqueue.h +++ b/include/igraph_dqueue.h @@ -25,33 +25,7 @@ #define IGRAPH_DQUEUE_H #include "igraph_types.h" - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS diff --git a/include/igraph_eigen.h b/include/igraph_eigen.h index bca49a9b9..905469bf8 100644 --- a/include/igraph_eigen.h +++ b/include/igraph_eigen.h @@ -28,32 +28,7 @@ #ifndef IGRAPH_EIGEN_H #define IGRAPH_EIGEN_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -89,46 +64,46 @@ typedef struct igraph_eigen_which_t { DECLDIR int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A, - const igraph_sparsemat_t *sA, - igraph_arpack_function_t *fun, int n, - void *extra, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors); + const igraph_sparsemat_t *sA, + igraph_arpack_function_t *fun, int n, + void *extra, + igraph_eigen_algorithm_t algorithm, + const igraph_eigen_which_t *which, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_vector_t *values, + igraph_matrix_t *vectors); DECLDIR int igraph_eigen_matrix(const igraph_matrix_t *A, - const igraph_sparsemat_t *sA, - igraph_arpack_function_t *fun, int n, - void *extra, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_complex_t *values, - igraph_matrix_complex_t *vectors); + const igraph_sparsemat_t *sA, + igraph_arpack_function_t *fun, int n, + void *extra, + igraph_eigen_algorithm_t algorithm, + const igraph_eigen_which_t *which, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_vector_complex_t *values, + igraph_matrix_complex_t *vectors); DECLDIR int igraph_eigen_adjacency(const igraph_t *graph, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_vector_complex_t *cmplxvalues, - igraph_matrix_complex_t *cmplxvectors); + igraph_eigen_algorithm_t algorithm, + const igraph_eigen_which_t *which, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_vector_t *values, + igraph_matrix_t *vectors, + igraph_vector_complex_t *cmplxvalues, + igraph_matrix_complex_t *cmplxvectors); DECLDIR int igraph_eigen_laplacian(const igraph_t *graph, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_vector_complex_t *cmplxvalues, - igraph_matrix_complex_t *cmplxvectors); + igraph_eigen_algorithm_t algorithm, + const igraph_eigen_which_t *which, + igraph_arpack_options_t *options, + igraph_arpack_storage_t *storage, + igraph_vector_t *values, + igraph_matrix_t *vectors, + igraph_vector_complex_t *cmplxvalues, + igraph_matrix_complex_t *cmplxvectors); __END_DECLS diff --git a/include/igraph_embedding.h b/include/igraph_embedding.h index b0e29dc6a..430623095 100644 --- a/include/igraph_embedding.h +++ b/include/igraph_embedding.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_EMBEDDING_H #define IGRAPH_EMBEDDING_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_arpack.h" #include "igraph_eigen.h" @@ -41,16 +32,16 @@ __BEGIN_DECLS -int igraph_adjacency_spectral_embedding(const igraph_t *graph, - igraph_integer_t no, - const igraph_vector_t *weights, - igraph_eigen_which_position_t which, - igraph_bool_t scaled, - igraph_matrix_t *X, - igraph_matrix_t *Y, - igraph_vector_t *D, - const igraph_vector_t *cvec, - igraph_arpack_options_t *options); +DECLDIR int igraph_adjacency_spectral_embedding(const igraph_t *graph, + igraph_integer_t no, + const igraph_vector_t *weights, + igraph_eigen_which_position_t which, + igraph_bool_t scaled, + igraph_matrix_t *X, + igraph_matrix_t *Y, + igraph_vector_t *D, + const igraph_vector_t *cvec, + igraph_arpack_options_t *options); typedef enum { IGRAPH_EMBEDDING_D_A=0, @@ -58,19 +49,19 @@ typedef enum { IGRAPH_EMBEDDING_DAD, IGRAPH_EMBEDDING_OAP } igraph_laplacian_spectral_embedding_type_t; -int igraph_laplacian_spectral_embedding(const igraph_t *graph, - igraph_integer_t no, - const igraph_vector_t *weights, - igraph_eigen_which_position_t which, - igraph_neimode_t degmode, - igraph_laplacian_spectral_embedding_type_t type, - igraph_bool_t scaled, - igraph_matrix_t *X, - igraph_matrix_t *Y, - igraph_vector_t *D, - igraph_arpack_options_t *options); +DECLDIR int igraph_laplacian_spectral_embedding(const igraph_t *graph, + igraph_integer_t no, + const igraph_vector_t *weights, + igraph_eigen_which_position_t which, + igraph_neimode_t degmode, + igraph_laplacian_spectral_embedding_type_t type, + igraph_bool_t scaled, + igraph_matrix_t *X, + igraph_matrix_t *Y, + igraph_vector_t *D, + igraph_arpack_options_t *options); -int igraph_dim_select(const igraph_vector_t *sv, igraph_integer_t *dim); +DECLDIR int igraph_dim_select(const igraph_vector_t *sv, igraph_integer_t *dim); __END_DECLS diff --git a/include/igraph_epidemics.h b/include/igraph_epidemics.h index 9b925a588..bc05db150 100644 --- a/include/igraph_epidemics.h +++ b/include/igraph_epidemics.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_EPIDEMICS_H #define IGRAPH_EPIDEMICS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_vector.h" #include "igraph_vector_ptr.h" @@ -63,12 +54,12 @@ typedef struct igraph_sir_t { igraph_vector_int_t no_s, no_i, no_r; } igraph_sir_t; -int igraph_sir_init(igraph_sir_t *sir); -void igraph_sir_destroy(igraph_sir_t *sir); +DECLDIR int igraph_sir_init(igraph_sir_t *sir); +DECLDIR void igraph_sir_destroy(igraph_sir_t *sir); -int igraph_sir(const igraph_t *graph, igraph_real_t beta, - igraph_real_t gamma, igraph_integer_t no_sim, - igraph_vector_ptr_t *result); +DECLDIR int igraph_sir(const igraph_t *graph, igraph_real_t beta, + igraph_real_t gamma, igraph_integer_t no_sim, + igraph_vector_ptr_t *result); __END_DECLS diff --git a/include/igraph_error.h b/include/igraph_error.h index 880b1bf3c..1065b3bad 100644 --- a/include/igraph_error.h +++ b/include/igraph_error.h @@ -26,15 +26,7 @@ #include -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -260,8 +252,7 @@ extern igraph_error_handler_t igraph_error_handler_printignore; * more. */ -igraph_error_handler_t* -igraph_set_error_handler(igraph_error_handler_t* new_handler); +DECLDIR igraph_error_handler_t* igraph_set_error_handler(igraph_error_handler_t* new_handler); /** * \typedef igraph_error_type_t @@ -446,8 +437,8 @@ typedef enum { * \sa igraph_errorf(). */ -int igraph_error(const char *reason, const char *file, int line, - int igraph_errno); +DECLDIR int igraph_error(const char *reason, const char *file, int line, + int igraph_errno); /** * \function igraph_errorf @@ -464,11 +455,11 @@ int igraph_error(const char *reason, const char *file, int line, * \sa igraph_error(). */ -int igraph_errorf(const char *reason, const char *file, int line, - int igraph_errno, ...); +DECLDIR int igraph_errorf(const char *reason, const char *file, int line, + int igraph_errno, ...); -int igraph_errorvf(const char *reason, const char *file, int line, - int igraph_errno, va_list ap); +DECLDIR int igraph_errorvf(const char *reason, const char *file, int line, + int igraph_errno, va_list ap); /** * \function igraph_strerror @@ -481,7 +472,7 @@ int igraph_errorvf(const char *reason, const char *file, int line, * \return pointer to the textual description of the error code. */ -const char* igraph_strerror(const int igraph_errno); +DECLDIR const char* igraph_strerror(const int igraph_errno); #define IGRAPH_ERROR_SELECT_2(a,b) ((a) != IGRAPH_SUCCESS ? (a) : ((b) != IGRAPH_SUCCESS ? (b) : IGRAPH_SUCCESS)) #define IGRAPH_ERROR_SELECT_3(a,b,c) ((a) != IGRAPH_SUCCESS ? (a) : IGRAPH_ERROR_SELECT_2(b,c)) @@ -501,7 +492,7 @@ struct igraph_i_protectedPtr { typedef void igraph_finally_func_t (void*); -void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr); +DECLDIR void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr); /** * \function IGRAPH_FINALLY_CLEAN @@ -514,7 +505,7 @@ void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr); * stack. */ -void IGRAPH_FINALLY_CLEAN(int num); +DECLDIR void IGRAPH_FINALLY_CLEAN(int num); /** * \function IGRAPH_FINALLY_FREE @@ -528,7 +519,7 @@ void IGRAPH_FINALLY_CLEAN(int num); * as well. */ -void IGRAPH_FINALLY_FREE(void); +DECLDIR void IGRAPH_FINALLY_FREE(void); /** * \function IGRAPH_FINALLY_STACK_SIZE @@ -545,7 +536,7 @@ void IGRAPH_FINALLY_FREE(void); * write your own test cases and examine \ref IGRAPH_FINALLY_STACK_SIZE * before and after your test cases - the numbers should be equal. */ -int IGRAPH_FINALLY_STACK_SIZE(void); +DECLDIR int IGRAPH_FINALLY_STACK_SIZE(void); /** * \define IGRAPH_FINALLY_STACK_EMPTY @@ -658,8 +649,7 @@ typedef igraph_error_handler_t igraph_warning_handler_t; * \return The current warning handler function. */ -igraph_warning_handler_t* -igraph_set_warning_handler(igraph_warning_handler_t* new_handler); +DECLDIR igraph_warning_handler_t* igraph_set_warning_handler(igraph_warning_handler_t* new_handler); extern igraph_warning_handler_t igraph_warning_handler_ignore; extern igraph_warning_handler_t igraph_warning_handler_print; @@ -679,8 +669,8 @@ extern igraph_warning_handler_t igraph_warning_handler_print; * \return The supplied error code. */ -int igraph_warning(const char *reason, const char *file, int line, - int igraph_errno); +DECLDIR int igraph_warning(const char *reason, const char *file, int line, + int igraph_errno); /** * \function igraph_warningf @@ -701,8 +691,8 @@ int igraph_warning(const char *reason, const char *file, int line, * \return The supplied error code. */ -int igraph_warningf(const char *reason, const char *file, int line, - int igraph_errno, ...); +DECLDIR int igraph_warningf(const char *reason, const char *file, int line, + int igraph_errno, ...); /** * \define IGRAPH_WARNING diff --git a/include/igraph_flow.h b/include/igraph_flow.h index 7be1647e4..d13e5a53a 100644 --- a/include/igraph_flow.h +++ b/include/igraph_flow.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_FLOW_H #define IGRAPH_FLOW_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -84,111 +58,111 @@ typedef struct { } igraph_maxflow_stats_t; DECLDIR int igraph_maxflow(const igraph_t *graph, igraph_real_t *value, - igraph_vector_t *flow, igraph_vector_t *cut, - igraph_vector_t *partition, igraph_vector_t *partition2, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity, - igraph_maxflow_stats_t *stats); + igraph_vector_t *flow, igraph_vector_t *cut, + igraph_vector_t *partition, igraph_vector_t *partition2, + igraph_integer_t source, igraph_integer_t target, + const igraph_vector_t *capacity, + igraph_maxflow_stats_t *stats); DECLDIR int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity, - igraph_maxflow_stats_t *stats); + igraph_integer_t source, igraph_integer_t target, + const igraph_vector_t *capacity, + igraph_maxflow_stats_t *stats); DECLDIR int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value, - igraph_vector_t *cut, igraph_vector_t *partition, - igraph_vector_t *partition2, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity); + igraph_vector_t *cut, igraph_vector_t *partition, + igraph_vector_t *partition2, + igraph_integer_t source, igraph_integer_t target, + const igraph_vector_t *capacity); DECLDIR int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity); + igraph_integer_t source, igraph_integer_t target, + const igraph_vector_t *capacity); DECLDIR int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res, - const igraph_vector_t *capacity); + const igraph_vector_t *capacity); DECLDIR int igraph_mincut(const igraph_t *graph, - igraph_real_t *value, - igraph_vector_t *partition, - igraph_vector_t *partition2, - igraph_vector_t *cut, - const igraph_vector_t *capacity); + igraph_real_t *value, + igraph_vector_t *partition, + igraph_vector_t *partition2, + igraph_vector_t *cut, + const igraph_vector_t *capacity); DECLDIR int igraph_st_vertex_connectivity(const igraph_t *graph, - igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target, - igraph_vconn_nei_t neighbors); + igraph_integer_t *res, + igraph_integer_t source, + igraph_integer_t target, + igraph_vconn_nei_t neighbors); DECLDIR int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); + igraph_bool_t checks); DECLDIR int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); + igraph_integer_t source, + igraph_integer_t target); DECLDIR int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); + igraph_bool_t checks); DECLDIR int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); + igraph_integer_t source, + igraph_integer_t target); DECLDIR int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); + igraph_integer_t source, + igraph_integer_t target); DECLDIR int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); + igraph_bool_t checks); DECLDIR int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); + igraph_bool_t checks); /* s-t cut listing related stuff */ DECLDIR int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar, - igraph_vector_t *capacity); + igraph_vector_t *capacity); DECLDIR int igraph_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - igraph_vector_t *residual_capacity, - const igraph_vector_t *flow); + const igraph_vector_t *capacity, + igraph_t *residual, + igraph_vector_t *residual_capacity, + const igraph_vector_t *flow); int igraph_i_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - igraph_vector_t *residual_capacity, - const igraph_vector_t *flow, - igraph_vector_t *tmp); + const igraph_vector_t *capacity, + igraph_t *residual, + igraph_vector_t *residual_capacity, + const igraph_vector_t *flow, + igraph_vector_t *tmp); int igraph_i_reverse_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - const igraph_vector_t *flow, - igraph_vector_t *tmp); + const igraph_vector_t *capacity, + igraph_t *residual, + const igraph_vector_t *flow, + igraph_vector_t *tmp); DECLDIR int igraph_reverse_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - const igraph_vector_t *flow); + const igraph_vector_t *capacity, + igraph_t *residual, + const igraph_vector_t *flow); DECLDIR int igraph_dominator_tree(const igraph_t *graph, - igraph_integer_t root, - igraph_vector_t *dom, - igraph_t *domtree, - igraph_vector_t *leftout, - igraph_neimode_t mode); + igraph_integer_t root, + igraph_vector_t *dom, + igraph_t *domtree, + igraph_vector_t *leftout, + igraph_neimode_t mode); DECLDIR int igraph_all_st_cuts(const igraph_t *graph, - igraph_vector_ptr_t *cuts, - igraph_vector_ptr_t *partition1s, - igraph_integer_t source, - igraph_integer_t target); + igraph_vector_ptr_t *cuts, + igraph_vector_ptr_t *partition1s, + igraph_integer_t source, + igraph_integer_t target); DECLDIR int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value, - igraph_vector_ptr_t *cuts, - igraph_vector_ptr_t *partition1s, - igraph_integer_t source, - igraph_integer_t target, - const igraph_vector_t *capacity); + igraph_vector_ptr_t *cuts, + igraph_vector_ptr_t *partition1s, + igraph_integer_t source, + igraph_integer_t target, + const igraph_vector_t *capacity); DECLDIR int igraph_gomory_hu_tree(const igraph_t *graph, - igraph_t *tree, - igraph_vector_t *flows, - const igraph_vector_t *capacity); + igraph_t *tree, + igraph_vector_t *flows, + const igraph_vector_t *capacity); __END_DECLS diff --git a/include/igraph_foreign.h b/include/igraph_foreign.h index 1631cf660..9dd38fdf6 100644 --- a/include/igraph_foreign.h +++ b/include/igraph_foreign.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_FOREIGN_H #define IGRAPH_FOREIGN_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -65,46 +39,46 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream, - igraph_integer_t n, igraph_bool_t directed); + igraph_integer_t n, igraph_bool_t directed); DECLDIR int igraph_read_graph_ncol(igraph_t *graph, FILE *instream, - igraph_strvector_t *predefnames, igraph_bool_t names, - igraph_add_weights_t weights, igraph_bool_t directed); + igraph_strvector_t *predefnames, igraph_bool_t names, + igraph_add_weights_t weights, igraph_bool_t directed); DECLDIR int igraph_read_graph_lgl(igraph_t *graph, FILE *instream, - igraph_bool_t names, igraph_add_weights_t weights, - igraph_bool_t directed); + igraph_bool_t names, igraph_add_weights_t weights, + igraph_bool_t directed); DECLDIR int igraph_read_graph_pajek(igraph_t *graph, FILE *instream); DECLDIR int igraph_read_graph_graphml(igraph_t *graph, FILE *instream, - int index); + int index); DECLDIR int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream, - igraph_strvector_t *problem, - igraph_vector_t *label, - igraph_integer_t *source, - igraph_integer_t *target, - igraph_vector_t *capacity, - igraph_bool_t directed); + igraph_strvector_t *problem, + igraph_vector_t *label, + igraph_integer_t *source, + igraph_integer_t *target, + igraph_vector_t *capacity, + igraph_bool_t directed); DECLDIR int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream, - igraph_bool_t directed); + igraph_bool_t directed); DECLDIR int igraph_read_graph_gml(igraph_t *graph, FILE *instream); DECLDIR int igraph_read_graph_dl(igraph_t *graph, FILE *instream, - igraph_bool_t directed); + igraph_bool_t directed); DECLDIR int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream); DECLDIR int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream, - const char *names, const char *weights); + const char *names, const char *weights); DECLDIR int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream, - const char *names, const char *weights, - igraph_bool_t isolates); + const char *names, const char *weights, + igraph_bool_t isolates); DECLDIR int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream, - igraph_bool_t prefixattr); + igraph_bool_t prefixattr); DECLDIR int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream); DECLDIR int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream, - long int source, long int target, - const igraph_vector_t *capacity); + long int source, long int target, + const igraph_vector_t *capacity); DECLDIR int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream, - const igraph_vector_t *id, const char *creator); + const igraph_vector_t *id, const char *creator); DECLDIR int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream); DECLDIR int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream, - const char* vertex_attr_name, const char* edge_attr_name); + const char* vertex_attr_name, const char* edge_attr_name); __END_DECLS diff --git a/include/igraph_games.h b/include/igraph_games.h index 311573cf4..9d6e71f86 100644 --- a/include/igraph_games.h +++ b/include/igraph_games.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_GAMES_H #define IGRAPH_GAMES_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_matrix.h" @@ -47,188 +38,188 @@ __BEGIN_DECLS /* Constructors, games (=stochastic) */ /* -------------------------------------------------- */ -int igraph_barabasi_game(igraph_t *graph, igraph_integer_t n, - igraph_real_t power, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t A, - igraph_bool_t directed, - igraph_barabasi_algorithm_t algo, - const igraph_t *start_from); -int igraph_nonlinear_barabasi_game(igraph_t *graph, igraph_integer_t n, - igraph_real_t power, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t zeroappeal, - igraph_bool_t directed); -int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type, - igraph_integer_t n, igraph_real_t p, - igraph_bool_t directed, igraph_bool_t loops); -int igraph_erdos_renyi_game_gnp(igraph_t *graph, igraph_integer_t n, igraph_real_t p, - igraph_bool_t directed, igraph_bool_t loops); -int igraph_erdos_renyi_game_gnm(igraph_t *graph, igraph_integer_t n, igraph_real_t m, - igraph_bool_t directed, igraph_bool_t loops); -int igraph_degree_sequence_game(igraph_t *graph, const igraph_vector_t *out_deg, - const igraph_vector_t *in_deg, - igraph_degseq_t method); -int igraph_growing_random_game(igraph_t *graph, igraph_integer_t n, - igraph_integer_t m, igraph_bool_t directed, igraph_bool_t citation); -int igraph_barabasi_aging_game(igraph_t *graph, - igraph_integer_t nodes, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t pa_exp, - igraph_real_t aging_exp, - igraph_integer_t aging_bin, - igraph_real_t zero_deg_appeal, - igraph_real_t zero_age_appeal, - igraph_real_t deg_coef, - igraph_real_t age_coef, - igraph_bool_t directed); -int igraph_recent_degree_game(igraph_t *graph, igraph_integer_t n, - igraph_real_t power, - igraph_integer_t window, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t zero_appeal, - igraph_bool_t directed); -int igraph_recent_degree_aging_game(igraph_t *graph, - igraph_integer_t nodes, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t pa_exp, - igraph_real_t aging_exp, - igraph_integer_t aging_bin, - igraph_integer_t window, - igraph_real_t zero_appeal, - igraph_bool_t directed); -int igraph_callaway_traits_game (igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, igraph_integer_t edges_per_step, - igraph_vector_t *type_dist, - igraph_matrix_t *pref_matrix, - igraph_bool_t directed); -int igraph_establishment_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, igraph_integer_t k, - igraph_vector_t *type_dist, - igraph_matrix_t *pref_matrix, - igraph_bool_t directed); -int igraph_grg_game(igraph_t *graph, igraph_integer_t nodes, - igraph_real_t radius, igraph_bool_t torus, - igraph_vector_t *x, igraph_vector_t *y); -int igraph_preference_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, - const igraph_vector_t *type_dist, - igraph_bool_t fixed_sizes, - const igraph_matrix_t *pref_matrix, - igraph_vector_t *node_type_vec, - igraph_bool_t directed, igraph_bool_t loops); -int igraph_asymmetric_preference_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, - igraph_matrix_t *type_dist_matrix, - igraph_matrix_t *pref_matrix, - igraph_vector_t *node_type_in_vec, - igraph_vector_t *node_type_out_vec, - igraph_bool_t loops); - -int igraph_rewire_edges(igraph_t *graph, igraph_real_t prob, - igraph_bool_t loops, igraph_bool_t multiple); -int igraph_watts_strogatz_game(igraph_t *graph, igraph_integer_t dim, - igraph_integer_t size, igraph_integer_t nei, - igraph_real_t p, igraph_bool_t loops, - igraph_bool_t multiple); - -int igraph_lastcit_game(igraph_t *graph, - igraph_integer_t nodes, igraph_integer_t edges_per_node, - igraph_integer_t agebins, - const igraph_vector_t *preference, igraph_bool_t directed); - -int igraph_cited_type_game(igraph_t *graph, igraph_integer_t nodes, - const igraph_vector_t *types, - const igraph_vector_t *pref, - igraph_integer_t edges_per_step, - igraph_bool_t directed); - -int igraph_citing_cited_type_game(igraph_t *graph, igraph_integer_t nodes, - const igraph_vector_t *types, - const igraph_matrix_t *pref, - igraph_integer_t edges_per_step, - igraph_bool_t directed); - -int igraph_forest_fire_game(igraph_t *graph, igraph_integer_t nodes, - igraph_real_t fw_prob, igraph_real_t bw_factor, - igraph_integer_t ambs, igraph_bool_t directed); - - -int igraph_simple_interconnected_islands_game( - igraph_t *graph, - igraph_integer_t islands_n, - igraph_integer_t islands_size, - igraph_real_t islands_pin, - igraph_integer_t n_inter); - -int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges, +DECLDIR int igraph_barabasi_game(igraph_t *graph, igraph_integer_t n, + igraph_real_t power, + igraph_integer_t m, + const igraph_vector_t *outseq, + igraph_bool_t outpref, + igraph_real_t A, + igraph_bool_t directed, + igraph_barabasi_algorithm_t algo, + const igraph_t *start_from); +DECLDIR int igraph_nonlinear_barabasi_game(igraph_t *graph, igraph_integer_t n, + igraph_real_t power, + igraph_integer_t m, + const igraph_vector_t *outseq, + igraph_bool_t outpref, + igraph_real_t zeroappeal, + igraph_bool_t directed); +DECLDIR int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type, + igraph_integer_t n, igraph_real_t p, + igraph_bool_t directed, igraph_bool_t loops); +DECLDIR int igraph_erdos_renyi_game_gnp(igraph_t *graph, igraph_integer_t n, igraph_real_t p, + igraph_bool_t directed, igraph_bool_t loops); +DECLDIR int igraph_erdos_renyi_game_gnm(igraph_t *graph, igraph_integer_t n, igraph_real_t m, + igraph_bool_t directed, igraph_bool_t loops); +DECLDIR int igraph_degree_sequence_game(igraph_t *graph, const igraph_vector_t *out_deg, + const igraph_vector_t *in_deg, + igraph_degseq_t method); +DECLDIR int igraph_growing_random_game(igraph_t *graph, igraph_integer_t n, + igraph_integer_t m, igraph_bool_t directed, igraph_bool_t citation); +DECLDIR int igraph_barabasi_aging_game(igraph_t *graph, + igraph_integer_t nodes, + igraph_integer_t m, + const igraph_vector_t *outseq, + igraph_bool_t outpref, + igraph_real_t pa_exp, + igraph_real_t aging_exp, + igraph_integer_t aging_bin, + igraph_real_t zero_deg_appeal, + igraph_real_t zero_age_appeal, + igraph_real_t deg_coef, + igraph_real_t age_coef, + igraph_bool_t directed); +DECLDIR int igraph_recent_degree_game(igraph_t *graph, igraph_integer_t n, + igraph_real_t power, + igraph_integer_t window, + igraph_integer_t m, + const igraph_vector_t *outseq, + igraph_bool_t outpref, + igraph_real_t zero_appeal, + igraph_bool_t directed); +DECLDIR int igraph_recent_degree_aging_game(igraph_t *graph, + igraph_integer_t nodes, + igraph_integer_t m, + const igraph_vector_t *outseq, + igraph_bool_t outpref, + igraph_real_t pa_exp, + igraph_real_t aging_exp, + igraph_integer_t aging_bin, + igraph_integer_t window, + igraph_real_t zero_appeal, + igraph_bool_t directed); +DECLDIR int igraph_callaway_traits_game (igraph_t *graph, igraph_integer_t nodes, + igraph_integer_t types, igraph_integer_t edges_per_step, + igraph_vector_t *type_dist, + igraph_matrix_t *pref_matrix, + igraph_bool_t directed); +DECLDIR int igraph_establishment_game(igraph_t *graph, igraph_integer_t nodes, + igraph_integer_t types, igraph_integer_t k, + igraph_vector_t *type_dist, + igraph_matrix_t *pref_matrix, + igraph_bool_t directed); +DECLDIR int igraph_grg_game(igraph_t *graph, igraph_integer_t nodes, + igraph_real_t radius, igraph_bool_t torus, + igraph_vector_t *x, igraph_vector_t *y); +DECLDIR int igraph_preference_game(igraph_t *graph, igraph_integer_t nodes, + igraph_integer_t types, + const igraph_vector_t *type_dist, + igraph_bool_t fixed_sizes, + const igraph_matrix_t *pref_matrix, + igraph_vector_t *node_type_vec, + igraph_bool_t directed, igraph_bool_t loops); +DECLDIR int igraph_asymmetric_preference_game(igraph_t *graph, igraph_integer_t nodes, + igraph_integer_t types, + igraph_matrix_t *type_dist_matrix, + igraph_matrix_t *pref_matrix, + igraph_vector_t *node_type_in_vec, + igraph_vector_t *node_type_out_vec, + igraph_bool_t loops); + +DECLDIR int igraph_rewire_edges(igraph_t *graph, igraph_real_t prob, + igraph_bool_t loops, igraph_bool_t multiple); +DECLDIR int igraph_watts_strogatz_game(igraph_t *graph, igraph_integer_t dim, + igraph_integer_t size, igraph_integer_t nei, + igraph_real_t p, igraph_bool_t loops, + igraph_bool_t multiple); + +DECLDIR int igraph_lastcit_game(igraph_t *graph, + igraph_integer_t nodes, igraph_integer_t edges_per_node, + igraph_integer_t agebins, + const igraph_vector_t *preference, igraph_bool_t directed); + +DECLDIR int igraph_cited_type_game(igraph_t *graph, igraph_integer_t nodes, + const igraph_vector_t *types, + const igraph_vector_t *pref, + igraph_integer_t edges_per_step, + igraph_bool_t directed); + +DECLDIR int igraph_citing_cited_type_game(igraph_t *graph, igraph_integer_t nodes, + const igraph_vector_t *types, + const igraph_matrix_t *pref, + igraph_integer_t edges_per_step, + igraph_bool_t directed); + +DECLDIR int igraph_forest_fire_game(igraph_t *graph, igraph_integer_t nodes, + igraph_real_t fw_prob, igraph_real_t bw_factor, + igraph_integer_t ambs, igraph_bool_t directed); + + +DECLDIR int igraph_simple_interconnected_islands_game( + igraph_t *graph, + igraph_integer_t islands_n, + igraph_integer_t islands_size, + igraph_real_t islands_pin, + igraph_integer_t n_inter); + +DECLDIR int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges, igraph_vector_t* fitness_out, igraph_vector_t* fitness_in, igraph_bool_t loops, igraph_bool_t multiple); -int igraph_static_power_law_game(igraph_t *graph, - igraph_integer_t no_of_nodes, igraph_integer_t no_of_edges, - igraph_real_t exponent_out, igraph_real_t exponent_in, - igraph_bool_t loops, igraph_bool_t multiple, - igraph_bool_t finite_size_correction); - -int igraph_k_regular_game(igraph_t *graph, - igraph_integer_t no_of_nodes, igraph_integer_t k, - igraph_bool_t directed, igraph_bool_t multiple); - -int igraph_sbm_game(igraph_t *graph, igraph_integer_t n, - const igraph_matrix_t *pref_matrix, - const igraph_vector_int_t *block_sizes, - igraph_bool_t directed, igraph_bool_t loops); - -int igraph_hsbm_game(igraph_t *graph, igraph_integer_t n, - igraph_integer_t m, const igraph_vector_t *rho, - const igraph_matrix_t *C, igraph_real_t p); - -int igraph_hsbm_list_game(igraph_t *graph, igraph_integer_t n, - const igraph_vector_int_t *mlist, - const igraph_vector_ptr_t *rholist, - const igraph_vector_ptr_t *Clist, - igraph_real_t p); - -int igraph_correlated_game(const igraph_t *old_graph, igraph_t *new_graph, - igraph_real_t corr, igraph_real_t p, - const igraph_vector_t *permutation); - -int igraph_correlated_pair_game(igraph_t *graph1, igraph_t *graph2, - int n, igraph_real_t corr, igraph_real_t p, - igraph_bool_t directed, - const igraph_vector_t *permutation); - -int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs, - igraph_bool_t directed); - -int igraph_sample_sphere_surface(igraph_integer_t dim, igraph_integer_t n, - igraph_real_t radius, - igraph_bool_t positive, - igraph_matrix_t *res); - -int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n, - igraph_real_t radius, - igraph_bool_t positive, - igraph_matrix_t *res); - -int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n, - igraph_real_t radius, - igraph_bool_t positive, - igraph_matrix_t *res); - -int igraph_sample_dirichlet(igraph_integer_t n, const igraph_vector_t *alpha, - igraph_matrix_t *res); +DECLDIR int igraph_static_power_law_game(igraph_t *graph, + igraph_integer_t no_of_nodes, igraph_integer_t no_of_edges, + igraph_real_t exponent_out, igraph_real_t exponent_in, + igraph_bool_t loops, igraph_bool_t multiple, + igraph_bool_t finite_size_correction); + +DECLDIR int igraph_k_regular_game(igraph_t *graph, + igraph_integer_t no_of_nodes, igraph_integer_t k, + igraph_bool_t directed, igraph_bool_t multiple); + +DECLDIR int igraph_sbm_game(igraph_t *graph, igraph_integer_t n, + const igraph_matrix_t *pref_matrix, + const igraph_vector_int_t *block_sizes, + igraph_bool_t directed, igraph_bool_t loops); + +DECLDIR int igraph_hsbm_game(igraph_t *graph, igraph_integer_t n, + igraph_integer_t m, const igraph_vector_t *rho, + const igraph_matrix_t *C, igraph_real_t p); + +DECLDIR int igraph_hsbm_list_game(igraph_t *graph, igraph_integer_t n, + const igraph_vector_int_t *mlist, + const igraph_vector_ptr_t *rholist, + const igraph_vector_ptr_t *Clist, + igraph_real_t p); + +DECLDIR int igraph_correlated_game(const igraph_t *old_graph, igraph_t *new_graph, + igraph_real_t corr, igraph_real_t p, + const igraph_vector_t *permutation); + +DECLDIR int igraph_correlated_pair_game(igraph_t *graph1, igraph_t *graph2, + int n, igraph_real_t corr, igraph_real_t p, + igraph_bool_t directed, + const igraph_vector_t *permutation); + +DECLDIR int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs, + igraph_bool_t directed); + +DECLDIR int igraph_sample_sphere_surface(igraph_integer_t dim, igraph_integer_t n, + igraph_real_t radius, + igraph_bool_t positive, + igraph_matrix_t *res); + +DECLDIR int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n, + igraph_real_t radius, + igraph_bool_t positive, + igraph_matrix_t *res); + +DECLDIR int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n, + igraph_real_t radius, + igraph_bool_t positive, + igraph_matrix_t *res); + +DECLDIR int igraph_sample_dirichlet(igraph_integer_t n, const igraph_vector_t *alpha, + igraph_matrix_t *res); __END_DECLS diff --git a/include/igraph_graphlets.h b/include/igraph_graphlets.h index e3479fcb4..0393d73a5 100644 --- a/include/igraph_graphlets.h +++ b/include/igraph_graphlets.h @@ -24,47 +24,38 @@ #ifndef IGRAPH_GRAPHLETS_H #define IGRAPH_GRAPHLETS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_vector_ptr.h" #include "igraph_interface.h" __BEGIN_DECLS -int igraph_subclique_next(const igraph_t *graph, - const igraph_vector_t *weights, - const igraph_vector_int_t *ids, - const igraph_vector_ptr_t *cliques, - igraph_vector_ptr_t *result, - igraph_vector_ptr_t *resultweights, - igraph_vector_ptr_t *resultids, - igraph_vector_t *clique_thr, - igraph_vector_t *next_thr); - -int igraph_graphlets_candidate_basis(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_ptr_t *cliques, - igraph_vector_t *thresholds); - -int igraph_graphlets_project(const igraph_t *graph, - const igraph_vector_t *weights, - const igraph_vector_ptr_t *cliques, - igraph_vector_t *Mu, igraph_bool_t startMu, - int niter); - -int igraph_graphlets(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_ptr_t *cliques, - igraph_vector_t *Mu, int niter); +DECLDIR int igraph_subclique_next(const igraph_t *graph, + const igraph_vector_t *weights, + const igraph_vector_int_t *ids, + const igraph_vector_ptr_t *cliques, + igraph_vector_ptr_t *result, + igraph_vector_ptr_t *resultweights, + igraph_vector_ptr_t *resultids, + igraph_vector_t *clique_thr, + igraph_vector_t *next_thr); + +DECLDIR int igraph_graphlets_candidate_basis(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_vector_ptr_t *cliques, + igraph_vector_t *thresholds); + +DECLDIR int igraph_graphlets_project(const igraph_t *graph, + const igraph_vector_t *weights, + const igraph_vector_ptr_t *cliques, + igraph_vector_t *Mu, igraph_bool_t startMu, + int niter); + +DECLDIR int igraph_graphlets(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_vector_ptr_t *cliques, + igraph_vector_t *Mu, int niter); __END_DECLS diff --git a/include/igraph_heap.h b/include/igraph_heap.h index b0d3d948e..0f3e921e0 100644 --- a/include/igraph_heap.h +++ b/include/igraph_heap.h @@ -24,32 +24,7 @@ #ifndef IGRAPH_HEAP_H #define IGRAPH_HEAP_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS diff --git a/include/igraph_hrg.h b/include/igraph_hrg.h index 100494f58..3b3bbc9b0 100644 --- a/include/igraph_hrg.h +++ b/include/igraph_hrg.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_HRG_H #define IGRAPH_HRG_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" #include "igraph_vector_ptr.h" #include "igraph_datatype.h" @@ -100,40 +74,40 @@ DECLDIR int igraph_hrg_size(const igraph_hrg_t *hrg); DECLDIR int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize); DECLDIR int igraph_hrg_fit(const igraph_t *graph, - igraph_hrg_t *hrg, - igraph_bool_t start, - int steps); + igraph_hrg_t *hrg, + igraph_bool_t start, + int steps); DECLDIR int igraph_hrg_sample(const igraph_t *graph, - igraph_t *sample, - igraph_vector_ptr_t *samples, - igraph_hrg_t *hrg, - igraph_bool_t start); + igraph_t *sample, + igraph_vector_ptr_t *samples, + igraph_hrg_t *hrg, + igraph_bool_t start); DECLDIR int igraph_hrg_game(igraph_t *graph, - const igraph_hrg_t *hrg); + const igraph_hrg_t *hrg); DECLDIR int igraph_hrg_dendrogram(igraph_t *graph, - const igraph_hrg_t *hrg); + const igraph_hrg_t *hrg); DECLDIR int igraph_hrg_consensus(const igraph_t *graph, - igraph_vector_t *parents, - igraph_vector_t *weights, - igraph_hrg_t *hrg, - igraph_bool_t start, - int num_samples); + igraph_vector_t *parents, + igraph_vector_t *weights, + igraph_hrg_t *hrg, + igraph_bool_t start, + int num_samples); DECLDIR int igraph_hrg_predict(const igraph_t *graph, - igraph_vector_t *edges, - igraph_vector_t *prob, - igraph_hrg_t *hrg, - igraph_bool_t start, - int num_samples, - int num_bins); + igraph_vector_t *edges, + igraph_vector_t *prob, + igraph_hrg_t *hrg, + igraph_bool_t start, + int num_samples, + int num_bins); DECLDIR int igraph_hrg_create(igraph_hrg_t *hrg, - const igraph_t *graph, - const igraph_vector_t *prob); + const igraph_t *graph, + const igraph_vector_t *prob); __END_DECLS diff --git a/include/igraph_interface.h b/include/igraph_interface.h index ffb7f56b8..1e97f2fb5 100644 --- a/include/igraph_interface.h +++ b/include/igraph_interface.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_INTERFACE_H #define IGRAPH_INTERFACE_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_iterators.h" @@ -66,41 +40,41 @@ DECLDIR int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_ DECLDIR int igraph_destroy(igraph_t *graph); DECLDIR int igraph_copy(igraph_t *to, const igraph_t *from); DECLDIR int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges, - void *attr); + void *attr); DECLDIR int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv, - void *attr); + void *attr); DECLDIR int igraph_delete_edges(igraph_t *graph, igraph_es_t edges); DECLDIR int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices); DECLDIR int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices, - igraph_vector_t *idx, - igraph_vector_t *invidx); + igraph_vector_t *idx, + igraph_vector_t *invidx); DECLDIR igraph_integer_t igraph_vcount(const igraph_t *graph); DECLDIR igraph_integer_t igraph_ecount(const igraph_t *graph); DECLDIR int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid, - igraph_neimode_t mode); + igraph_neimode_t mode); DECLDIR igraph_bool_t igraph_is_directed(const igraph_t *graph); DECLDIR int igraph_degree(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); + const igraph_vs_t vids, igraph_neimode_t mode, + igraph_bool_t loops); DECLDIR int igraph_edge(const igraph_t *graph, igraph_integer_t eid, - igraph_integer_t *from, igraph_integer_t *to); + igraph_integer_t *from, igraph_integer_t *to); DECLDIR int igraph_edges(const igraph_t *graph, igraph_es_t eids, - igraph_vector_t *edges); + igraph_vector_t *edges); DECLDIR int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid, - igraph_integer_t from, igraph_integer_t to, - igraph_bool_t directed, igraph_bool_t error); + igraph_integer_t from, igraph_integer_t to, + igraph_bool_t directed, igraph_bool_t error); DECLDIR int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids, - const igraph_vector_t *pairs, - const igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t error); + const igraph_vector_t *pairs, + const igraph_vector_t *path, + igraph_bool_t directed, igraph_bool_t error); DECLDIR int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids, - const igraph_vector_t *pairs, - const igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t error); + const igraph_vector_t *pairs, + const igraph_vector_t *path, + igraph_bool_t directed, igraph_bool_t error); DECLDIR int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, - igraph_neimode_t mode); /* deprecated */ + igraph_neimode_t mode); /* deprecated */ DECLDIR int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, - igraph_neimode_t mode); + igraph_neimode_t mode); #define IGRAPH_FROM(g,e) ((igraph_integer_t)(VECTOR((g)->from)[(long int)(e)])) #define IGRAPH_TO(g,e) ((igraph_integer_t)(VECTOR((g)->to) [(long int)(e)])) diff --git a/include/igraph_interrupt.h b/include/igraph_interrupt.h index 890740179..b8b7b228f 100644 --- a/include/igraph_interrupt.h +++ b/include/igraph_interrupt.h @@ -25,16 +25,7 @@ #define IGRAPH_INTERRUPT_H #include "igraph_error.h" - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -128,10 +119,9 @@ typedef int igraph_interruption_handler_t (void* data); * \return \c IGRAPH_SUCCESS if the calculation should go on, anything else otherwise. */ -int igraph_allow_interruption(void* data); +DECLDIR int igraph_allow_interruption(void* data); -igraph_interruption_handler_t * -igraph_set_interruption_handler (igraph_interruption_handler_t * new_handler); +DECLDIR igraph_interruption_handler_t * igraph_set_interruption_handler (igraph_interruption_handler_t * new_handler); __END_DECLS diff --git a/include/igraph_iterators.h b/include/igraph_iterators.h index d179ce970..154a2ad51 100644 --- a/include/igraph_iterators.h +++ b/include/igraph_iterators.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_ITERATORS_H #define IGRAPH_ITERATORS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" __BEGIN_DECLS @@ -85,43 +59,43 @@ typedef struct igraph_vs_t { } igraph_vs_t; DECLDIR int igraph_vs_all(igraph_vs_t *vs); -igraph_vs_t igraph_vss_all(void); +DECLDIR igraph_vs_t igraph_vss_all(void); DECLDIR int igraph_vs_adj(igraph_vs_t *vs, - igraph_integer_t vid, igraph_neimode_t mode); -igraph_vs_t igraph_vss_adj(igraph_integer_t vid, igraph_neimode_t mode); + igraph_integer_t vid, igraph_neimode_t mode); +DECLDIR igraph_vs_t igraph_vss_adj(igraph_integer_t vid, igraph_neimode_t mode); DECLDIR int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid, - igraph_neimode_t mode); + igraph_neimode_t mode); DECLDIR int igraph_vs_none(igraph_vs_t *vs); -igraph_vs_t igraph_vss_none(void); +DECLDIR igraph_vs_t igraph_vss_none(void); DECLDIR int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid); -igraph_vs_t igraph_vss_1(igraph_integer_t vid); +DECLDIR igraph_vs_t igraph_vss_1(igraph_integer_t vid); DECLDIR int igraph_vs_vector(igraph_vs_t *vs, - const igraph_vector_t *v); -igraph_vs_t igraph_vss_vector(const igraph_vector_t *v); + const igraph_vector_t *v); +DECLDIR igraph_vs_t igraph_vss_vector(const igraph_vector_t *v); DECLDIR int igraph_vs_vector_small(igraph_vs_t *vs, ...); DECLDIR int igraph_vs_vector_copy(igraph_vs_t *vs, - const igraph_vector_t *v); + const igraph_vector_t *v); DECLDIR int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to); -igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to); +DECLDIR igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to); DECLDIR void igraph_vs_destroy(igraph_vs_t *vs); -igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs); +DECLDIR igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs); DECLDIR int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src); DECLDIR int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs, - igraph_vector_t *v); + igraph_vector_t *v); DECLDIR int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs, - igraph_integer_t *result); + igraph_integer_t *result); DECLDIR int igraph_vs_type(const igraph_vs_t *vs); /* -------------------------------------------------- */ @@ -235,7 +209,7 @@ typedef struct igraph_vit_t { VECTOR(*(vit).vec)[(vit).pos])) DECLDIR int igraph_vit_create(const igraph_t *graph, - igraph_vs_t vs, igraph_vit_t *vit); + igraph_vs_t vs, igraph_vit_t *vit); DECLDIR void igraph_vit_destroy(const igraph_vit_t *vit); DECLDIR int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v); @@ -279,29 +253,29 @@ typedef struct igraph_es_t { } igraph_es_t; DECLDIR int igraph_es_all(igraph_es_t *es, - igraph_edgeorder_type_t order); -igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order); + igraph_edgeorder_type_t order); +DECLDIR igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order); DECLDIR int igraph_es_adj(igraph_es_t *es, - igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */ + igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */ DECLDIR int igraph_es_incident(igraph_es_t *es, - igraph_integer_t vid, igraph_neimode_t mode); + igraph_integer_t vid, igraph_neimode_t mode); DECLDIR int igraph_es_none(igraph_es_t *es); -igraph_es_t igraph_ess_none(void); +DECLDIR igraph_es_t igraph_ess_none(void); DECLDIR int igraph_es_1(igraph_es_t *es, igraph_integer_t eid); -igraph_es_t igraph_ess_1(igraph_integer_t eid); +DECLDIR igraph_es_t igraph_ess_1(igraph_integer_t eid); DECLDIR int igraph_es_vector(igraph_es_t *es, - const igraph_vector_t *v); -igraph_es_t igraph_ess_vector(const igraph_vector_t *v); + const igraph_vector_t *v); +DECLDIR igraph_es_t igraph_ess_vector(const igraph_vector_t *v); DECLDIR int igraph_es_fromto(igraph_es_t *es, - igraph_vs_t from, igraph_vs_t to); + igraph_vs_t from, igraph_vs_t to); DECLDIR int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to); -igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to); +DECLDIR igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to); DECLDIR int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v); @@ -318,14 +292,14 @@ DECLDIR int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...); DECLDIR void igraph_es_destroy(igraph_es_t *es); -igraph_bool_t igraph_es_is_all(const igraph_es_t *es); +DECLDIR igraph_bool_t igraph_es_is_all(const igraph_es_t *es); DECLDIR int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src); DECLDIR int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es, - igraph_vector_t *v); + igraph_vector_t *v); DECLDIR int igraph_es_size(const igraph_t *graph, const igraph_es_t *es, - igraph_integer_t *result); + igraph_integer_t *result); DECLDIR int igraph_es_type(const igraph_es_t *es); @@ -417,7 +391,7 @@ typedef struct igraph_eit_t { VECTOR(*(eit).vec)[(eit).pos])) DECLDIR int igraph_eit_create(const igraph_t *graph, - igraph_es_t es, igraph_eit_t *eit); + igraph_es_t es, igraph_eit_t *eit); DECLDIR void igraph_eit_destroy(const igraph_eit_t *eit); DECLDIR int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v); diff --git a/include/igraph_lapack.h b/include/igraph_lapack.h index 4c862f41a..d9858fc57 100644 --- a/include/igraph_lapack.h +++ b/include/igraph_lapack.h @@ -26,16 +26,7 @@ #include "igraph_vector.h" #include "igraph_matrix.h" - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -65,31 +56,31 @@ __BEGIN_DECLS * */ -int igraph_lapack_dgetrf(igraph_matrix_t *a, igraph_vector_int_t *ipiv, - int *info); -int igraph_lapack_dgetrs(igraph_bool_t transpose, const igraph_matrix_t *a, - igraph_vector_int_t *ipiv, igraph_matrix_t *b); -int igraph_lapack_dgesv(igraph_matrix_t *a, igraph_vector_int_t *ipiv, - igraph_matrix_t *b, int *info); +DECLDIR int igraph_lapack_dgetrf(igraph_matrix_t *a, igraph_vector_int_t *ipiv, + int *info); +DECLDIR int igraph_lapack_dgetrs(igraph_bool_t transpose, const igraph_matrix_t *a, + igraph_vector_int_t *ipiv, igraph_matrix_t *b); +DECLDIR int igraph_lapack_dgesv(igraph_matrix_t *a, igraph_vector_int_t *ipiv, + igraph_matrix_t *b, int *info); typedef enum { IGRAPH_LAPACK_DSYEV_ALL, IGRAPH_LAPACK_DSYEV_INTERVAL, IGRAPH_LAPACK_DSYEV_SELECT } igraph_lapack_dsyev_which_t; -int igraph_lapack_dsyevr(const igraph_matrix_t *A, - igraph_lapack_dsyev_which_t which, - igraph_real_t vl, igraph_real_t vu, int vestimate, - int il, int iu, igraph_real_t abstol, - igraph_vector_t *values, igraph_matrix_t *vectors, - igraph_vector_int_t *support); +DECLDIR int igraph_lapack_dsyevr(const igraph_matrix_t *A, + igraph_lapack_dsyev_which_t which, + igraph_real_t vl, igraph_real_t vu, int vestimate, + int il, int iu, igraph_real_t abstol, + igraph_vector_t *values, igraph_matrix_t *vectors, + igraph_vector_int_t *support); /* TODO: should we use complex vectors/matrices? */ -int igraph_lapack_dgeev(const igraph_matrix_t *A, - igraph_vector_t *valuesreal, - igraph_vector_t *valuesimag, - igraph_matrix_t *vectorsleft, - igraph_matrix_t *vectorsright, int *info); +DECLDIR int igraph_lapack_dgeev(const igraph_matrix_t *A, + igraph_vector_t *valuesreal, + igraph_vector_t *valuesimag, + igraph_matrix_t *vectorsleft, + igraph_matrix_t *vectorsright, int *info); typedef enum { IGRAPH_LAPACK_DGEEVX_BALANCE_NONE=0, IGRAPH_LAPACK_DGEEVX_BALANCE_PERM, @@ -97,24 +88,24 @@ typedef enum { IGRAPH_LAPACK_DGEEVX_BALANCE_NONE=0, IGRAPH_LAPACK_DGEEVX_BALANCE_BOTH } igraph_lapack_dgeevx_balance_t; -int igraph_lapack_dgeevx(igraph_lapack_dgeevx_balance_t balance, - const igraph_matrix_t *A, - igraph_vector_t *valuesreal, - igraph_vector_t *valuesimag, - igraph_matrix_t *vectorsleft, - igraph_matrix_t *vectorsright, - int *ilo, int *ihi, igraph_vector_t *scale, - igraph_real_t *abnrm, - igraph_vector_t *rconde, - igraph_vector_t *rcondv, - int *info); - -int igraph_lapack_dgehrd(const igraph_matrix_t *A, - int ilo, int ihi, - igraph_matrix_t *result); - -int igraph_lapack_ddot(const igraph_vector_t *v1, const igraph_vector_t *v2, - igraph_real_t *res); +DECLDIR int igraph_lapack_dgeevx(igraph_lapack_dgeevx_balance_t balance, + const igraph_matrix_t *A, + igraph_vector_t *valuesreal, + igraph_vector_t *valuesimag, + igraph_matrix_t *vectorsleft, + igraph_matrix_t *vectorsright, + int *ilo, int *ihi, igraph_vector_t *scale, + igraph_real_t *abnrm, + igraph_vector_t *rconde, + igraph_vector_t *rcondv, + int *info); + +DECLDIR int igraph_lapack_dgehrd(const igraph_matrix_t *A, + int ilo, int ihi, + igraph_matrix_t *result); + +DECLDIR int igraph_lapack_ddot(const igraph_vector_t *v1, const igraph_vector_t *v2, + igraph_real_t *res); __END_DECLS diff --git a/include/igraph_layout.h b/include/igraph_layout.h index b367c43bb..c0fdbf6d0 100644 --- a/include/igraph_layout.h +++ b/include/igraph_layout.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_LAYOUT_H #define IGRAPH_LAYOUT_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -68,91 +42,91 @@ __BEGIN_DECLS DECLDIR int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res); DECLDIR int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res, - igraph_vs_t order); + igraph_vs_t order); DECLDIR int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res, - igraph_integer_t center, const igraph_vector_t *order); + igraph_integer_t center, const igraph_vector_t *order); DECLDIR int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width); DECLDIR int igraph_layout_fruchterman_reingold(const igraph_t *graph, - igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_integer_t niter, - igraph_real_t start_temp, - igraph_layout_grid_t grid, - const igraph_vector_t *weight, - const igraph_vector_t *minx, - const igraph_vector_t *maxx, - const igraph_vector_t *miny, - const igraph_vector_t *maxy); + igraph_matrix_t *res, + igraph_bool_t use_seed, + igraph_integer_t niter, + igraph_real_t start_temp, + igraph_layout_grid_t grid, + const igraph_vector_t *weight, + const igraph_vector_t *minx, + const igraph_vector_t *maxx, + const igraph_vector_t *miny, + const igraph_vector_t *maxy); DECLDIR int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t epsilon, igraph_real_t kkconst, - const igraph_vector_t *weights, - const igraph_vector_t *minx, const igraph_vector_t *maxx, - const igraph_vector_t *miny, const igraph_vector_t *maxy); + igraph_bool_t use_seed, igraph_integer_t maxiter, + igraph_real_t epsilon, igraph_real_t kkconst, + const igraph_vector_t *weights, + const igraph_vector_t *minx, const igraph_vector_t *maxx, + const igraph_vector_t *miny, const igraph_vector_t *maxy); DECLDIR int igraph_layout_springs(const igraph_t *graph, igraph_matrix_t *res, - igraph_real_t mass, igraph_real_t equil, igraph_real_t k, - igraph_real_t repeqdis, igraph_real_t kfr, igraph_bool_t repulse); + igraph_real_t mass, igraph_real_t equil, igraph_real_t k, + igraph_real_t repeqdis, igraph_real_t kfr, igraph_bool_t repulse); DECLDIR int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res, - igraph_integer_t maxiter, igraph_real_t maxdelta, - igraph_real_t area, igraph_real_t coolexp, - igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root); + igraph_integer_t maxiter, igraph_real_t maxdelta, + igraph_real_t area, igraph_real_t coolexp, + igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root); DECLDIR int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res, - igraph_neimode_t mode, - const igraph_vector_t *roots, - const igraph_vector_t *rootlevel); + igraph_neimode_t mode, + const igraph_vector_t *roots, + const igraph_vector_t *rootlevel); DECLDIR int igraph_layout_reingold_tilford_circular(const igraph_t *graph, - igraph_matrix_t *res, - igraph_neimode_t mode, - const igraph_vector_t *roots, - const igraph_vector_t *rootlevel); + igraph_matrix_t *res, + igraph_neimode_t mode, + const igraph_vector_t *roots, + const igraph_vector_t *rootlevel); DECLDIR int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res, - igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids, - const igraph_vector_t* layers, igraph_real_t hgap, - igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights); + igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids, + const igraph_vector_t* layers, igraph_real_t hgap, + igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights); DECLDIR int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res); DECLDIR int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res); DECLDIR int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res, - long int width, long int height); + long int width, long int height); DECLDIR int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, - igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_integer_t niter, - igraph_real_t start_temp, - const igraph_vector_t *weight, - const igraph_vector_t *minx, - const igraph_vector_t *maxx, - const igraph_vector_t *miny, - const igraph_vector_t *maxy, - const igraph_vector_t *minz, - const igraph_vector_t *maxz); + igraph_matrix_t *res, + igraph_bool_t use_seed, + igraph_integer_t niter, + igraph_real_t start_temp, + const igraph_vector_t *weight, + const igraph_vector_t *minx, + const igraph_vector_t *maxx, + const igraph_vector_t *miny, + const igraph_vector_t *maxy, + const igraph_vector_t *minz, + const igraph_vector_t *maxz); DECLDIR int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t epsilon, igraph_real_t kkconst, - const igraph_vector_t *weights, - const igraph_vector_t *minx, const igraph_vector_t *maxx, - const igraph_vector_t *miny, const igraph_vector_t *maxy, - const igraph_vector_t *minz, const igraph_vector_t *maxz); + igraph_bool_t use_seed, igraph_integer_t maxiter, + igraph_real_t epsilon, igraph_real_t kkconst, + const igraph_vector_t *weights, + const igraph_vector_t *minx, const igraph_vector_t *maxx, + const igraph_vector_t *miny, const igraph_vector_t *maxy, + const igraph_vector_t *minz, const igraph_vector_t *maxz); DECLDIR int igraph_layout_graphopt(const igraph_t *graph, - igraph_matrix_t *res, igraph_integer_t niter, - igraph_real_t node_charge, igraph_real_t node_mass, - igraph_real_t spring_length, - igraph_real_t spring_constant, - igraph_real_t max_sa_movement, - igraph_bool_t use_seed); + igraph_matrix_t *res, igraph_integer_t niter, + igraph_real_t node_charge, igraph_real_t node_mass, + igraph_real_t spring_length, + igraph_real_t spring_constant, + igraph_real_t max_sa_movement, + igraph_bool_t use_seed); DECLDIR int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res, - const igraph_matrix_t *dist, long int dim, - igraph_arpack_options_t *options); + const igraph_matrix_t *dist, long int dim, + igraph_arpack_options_t *options); DECLDIR int igraph_layout_bipartite(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_matrix_t *res, igraph_real_t hgap, - igraph_real_t vgap, long int maxiter); + const igraph_vector_bool_t *types, + igraph_matrix_t *res, igraph_real_t hgap, + igraph_real_t vgap, long int maxiter); /** * \struct igraph_layout_drl_options_t @@ -240,35 +214,35 @@ typedef enum { IGRAPH_LAYOUT_DRL_DEFAULT=0, IGRAPH_LAYOUT_DRL_FINAL } igraph_layout_drl_default_t; DECLDIR int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options, - igraph_layout_drl_default_t templ); + igraph_layout_drl_default_t templ); DECLDIR int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_layout_drl_options_t *options, - const igraph_vector_t *weights, - const igraph_vector_bool_t *fixed); + igraph_bool_t use_seed, + igraph_layout_drl_options_t *options, + const igraph_vector_t *weights, + const igraph_vector_bool_t *fixed); DECLDIR int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_layout_drl_options_t *options, - const igraph_vector_t *weights, - const igraph_vector_bool_t *fixed); + igraph_bool_t use_seed, + igraph_layout_drl_options_t *options, + const igraph_vector_t *weights, + const igraph_vector_bool_t *fixed); DECLDIR int igraph_layout_merge_dla(igraph_vector_ptr_t *graphs, - igraph_vector_ptr_t *coords, - igraph_matrix_t *res); + igraph_vector_ptr_t *coords, + igraph_matrix_t *res); DECLDIR int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t temp_max, igraph_real_t temp_min, - igraph_real_t temp_init); + igraph_bool_t use_seed, igraph_integer_t maxiter, + igraph_real_t temp_max, igraph_real_t temp_min, + igraph_real_t temp_init); DECLDIR int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_integer_t fineiter, igraph_real_t cool_fact, - igraph_real_t weight_node_dist, igraph_real_t weight_border, - igraph_real_t weight_edge_lengths, - igraph_real_t weight_edge_crossings, - igraph_real_t weight_node_edge_dist); + igraph_bool_t use_seed, igraph_integer_t maxiter, + igraph_integer_t fineiter, igraph_real_t cool_fact, + igraph_real_t weight_node_dist, igraph_real_t weight_border, + igraph_real_t weight_edge_lengths, + igraph_real_t weight_edge_crossings, + igraph_real_t weight_node_edge_dist); __END_DECLS diff --git a/include/igraph_matching.h b/include/igraph_matching.h index d075f401a..dbd1a143e 100644 --- a/include/igraph_matching.h +++ b/include/igraph_matching.h @@ -23,33 +23,7 @@ #ifndef IGRAPH_MATCHING_H #define IGRAPH_MATCHING_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -62,20 +36,20 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_is_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, - igraph_bool_t* result); + const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, + igraph_bool_t* result); DECLDIR int igraph_is_maximal_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, - igraph_bool_t* result); + const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, + igraph_bool_t* result); DECLDIR int igraph_maximum_bipartite_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, igraph_integer_t* matching_size, - igraph_real_t* matching_weight, igraph_vector_long_t* matching, - const igraph_vector_t* weights, igraph_real_t eps); + const igraph_vector_bool_t* types, igraph_integer_t* matching_size, + igraph_real_t* matching_weight, igraph_vector_long_t* matching, + const igraph_vector_t* weights, igraph_real_t eps); DECLDIR int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size, - igraph_real_t* matching_weight, igraph_vector_long_t* matching, - const igraph_vector_t* weights); + igraph_real_t* matching_weight, igraph_vector_long_t* matching, + const igraph_vector_t* weights); __END_DECLS diff --git a/include/igraph_matrix.h b/include/igraph_matrix.h index 32992ed50..c9229e788 100644 --- a/include/igraph_matrix.h +++ b/include/igraph_matrix.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_MATRIX_H #define IGRAPH_MATRIX_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" __BEGIN_DECLS diff --git a/include/igraph_memory.h b/include/igraph_memory.h index 29504feb3..f39c678a7 100644 --- a/include/igraph_memory.h +++ b/include/igraph_memory.h @@ -25,16 +25,7 @@ #define REST_MEMORY_H #include - -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -48,8 +39,8 @@ __BEGIN_DECLS /* # define Free igraph_Free */ /* #endif */ -int igraph_free(void *p); -void *igraph_malloc(size_t n); +DECLDIR int igraph_free(void *p); +DECLDIR void *igraph_malloc(size_t n); __END_DECLS diff --git a/include/igraph_microscopic_update.h b/include/igraph_microscopic_update.h index 5789eb9cf..6f7430c06 100644 --- a/include/igraph_microscopic_update.h +++ b/include/igraph_microscopic_update.h @@ -22,16 +22,7 @@ #ifndef IGRAPH_MICROSCOPIC_UPDATE_H #define IGRAPH_MICROSCOPIC_UPDATE_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_iterators.h" @@ -40,29 +31,29 @@ __BEGIN_DECLS -int igraph_deterministic_optimal_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_optimal_t optimality, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -int igraph_moran_process(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -int igraph_roulette_wheel_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_bool_t islocal, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -int igraph_stochastic_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_imitate_algorithm_t algo, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); +DECLDIR int igraph_deterministic_optimal_imitation(const igraph_t *graph, + igraph_integer_t vid, + igraph_optimal_t optimality, + const igraph_vector_t *quantities, + igraph_vector_t *strategies, + igraph_neimode_t mode); +DECLDIR int igraph_moran_process(const igraph_t *graph, + const igraph_vector_t *weights, + igraph_vector_t *quantities, + igraph_vector_t *strategies, + igraph_neimode_t mode); +DECLDIR int igraph_roulette_wheel_imitation(const igraph_t *graph, + igraph_integer_t vid, + igraph_bool_t islocal, + const igraph_vector_t *quantities, + igraph_vector_t *strategies, + igraph_neimode_t mode); +DECLDIR int igraph_stochastic_imitation(const igraph_t *graph, + igraph_integer_t vid, + igraph_imitate_algorithm_t algo, + const igraph_vector_t *quantities, + igraph_vector_t *strategies, + igraph_neimode_t mode); __END_DECLS diff --git a/include/igraph_mixing.h b/include/igraph_mixing.h index c9d2dc61c..d1045d3c9 100644 --- a/include/igraph_mixing.h +++ b/include/igraph_mixing.h @@ -24,36 +24,27 @@ #ifndef IGRAPH_MIXING_H #define IGRAPH_MIXING_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_vector.h" __BEGIN_DECLS -int igraph_assortativity_nominal(const igraph_t *graph, - const igraph_vector_t *types, - igraph_real_t *res, - igraph_bool_t directed); +DECLDIR int igraph_assortativity_nominal(const igraph_t *graph, + const igraph_vector_t *types, + igraph_real_t *res, + igraph_bool_t directed); -int igraph_assortativity(const igraph_t *graph, - const igraph_vector_t *types1, - const igraph_vector_t *types2, - igraph_real_t *res, - igraph_bool_t directed); +DECLDIR int igraph_assortativity(const igraph_t *graph, + const igraph_vector_t *types1, + const igraph_vector_t *types2, + igraph_real_t *res, + igraph_bool_t directed); -int igraph_assortativity_degree(const igraph_t *graph, - igraph_real_t *res, - igraph_bool_t directed); +DECLDIR int igraph_assortativity_degree(const igraph_t *graph, + igraph_real_t *res, + igraph_bool_t directed); __END_DECLS diff --git a/include/igraph_motifs.h b/include/igraph_motifs.h index 61f01b8e2..85f98688c 100644 --- a/include/igraph_motifs.h +++ b/include/igraph_motifs.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_MOTIFS_H #define IGRAPH_MOTIFS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_datatype.h" #include "igraph_iterators.h" @@ -73,33 +64,33 @@ typedef igraph_bool_t igraph_motifs_handler_t(const igraph_t *graph, int isoclass, void* extra); -int igraph_motifs_randesu(const igraph_t *graph, igraph_vector_t *hist, - int size, const igraph_vector_t *cut_prob); - -int igraph_motifs_randesu_callback(const igraph_t *graph, int size, - const igraph_vector_t *cut_prob, - igraph_motifs_handler_t *callback, - void* extra); - -int igraph_motifs_randesu_estimate(const igraph_t *graph, igraph_integer_t *est, - int size, const igraph_vector_t *cut_prob, - igraph_integer_t sample_size, - const igraph_vector_t *sample); -int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no, - int size, const igraph_vector_t *cut_prob); - -int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut, - igraph_integer_t *asym, igraph_integer_t *null); -int igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res); -int igraph_triad_census_24(const igraph_t *graph, igraph_integer_t *res2, - igraph_integer_t *res4); - -int igraph_adjacent_triangles(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids); - -int igraph_list_triangles(const igraph_t *graph, - igraph_vector_int_t *res); +DECLDIR int igraph_motifs_randesu(const igraph_t *graph, igraph_vector_t *hist, + int size, const igraph_vector_t *cut_prob); + +DECLDIR int igraph_motifs_randesu_callback(const igraph_t *graph, int size, + const igraph_vector_t *cut_prob, + igraph_motifs_handler_t *callback, + void* extra); + +DECLDIR int igraph_motifs_randesu_estimate(const igraph_t *graph, igraph_integer_t *est, + int size, const igraph_vector_t *cut_prob, + igraph_integer_t sample_size, + const igraph_vector_t *sample); +DECLDIR int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no, + int size, const igraph_vector_t *cut_prob); + +DECLDIR int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut, + igraph_integer_t *asym, igraph_integer_t *null); +DECLDIR int igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res); +DECLDIR int igraph_triad_census_24(const igraph_t *graph, igraph_integer_t *res2, + igraph_integer_t *res4); + +DECLDIR int igraph_adjacent_triangles(const igraph_t *graph, + igraph_vector_t *res, + const igraph_vs_t vids); + +DECLDIR int igraph_list_triangles(const igraph_t *graph, + igraph_vector_int_t *res); __END_DECLS diff --git a/include/igraph_neighborhood.h b/include/igraph_neighborhood.h index 0c3227183..a18beeae1 100644 --- a/include/igraph_neighborhood.h +++ b/include/igraph_neighborhood.h @@ -24,45 +24,20 @@ #ifndef IGRAPH_NEIGHBORHOOD_H #define IGRAPH_NEIGHBORHOOD_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS DECLDIR int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, igraph_integer_t mindist); + igraph_vs_t vids, igraph_integer_t order, + igraph_neimode_t mode, igraph_integer_t mindist); DECLDIR int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, igraph_integer_t mindist); + igraph_vs_t vids, igraph_integer_t order, + igraph_neimode_t mode, igraph_integer_t mindist); DECLDIR int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, - igraph_integer_t mindist); + igraph_vs_t vids, igraph_integer_t order, + igraph_neimode_t mode, + igraph_integer_t mindist); __END_DECLS diff --git a/include/igraph_nongraph.h b/include/igraph_nongraph.h index 9dbf8b679..b4b6efbab 100644 --- a/include/igraph_nongraph.h +++ b/include/igraph_nongraph.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_NONGRAPH_H #define IGRAPH_NONGRAPH_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_matrix.h" #include "igraph_types.h" @@ -97,22 +71,22 @@ typedef struct igraph_plfit_result_t { } igraph_plfit_result_t; DECLDIR int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res, - igraph_integer_t binwidth); + igraph_integer_t binwidth); DECLDIR int igraph_fisher_yates_shuffle(igraph_vector_t *seq); DECLDIR int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h, - igraph_integer_t length); + igraph_integer_t length); DECLDIR int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts, - igraph_matrix_t *rescoords); + igraph_matrix_t *rescoords); DECLDIR int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx, - igraph_real_t (*f)(igraph_real_t x, void *info), - void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res); + igraph_real_t (*f)(igraph_real_t x, void *info), + void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res); DECLDIR int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin, - igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr, - int maxit, int trace, - igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex, - igraph_integer_t *fncount, igraph_integer_t *grcount); + igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr, + int maxit, int trace, + igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex, + igraph_integer_t *fncount, igraph_integer_t *grcount); DECLDIR int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result, - igraph_real_t xmin, igraph_bool_t force_continuous); + igraph_real_t xmin, igraph_bool_t force_continuous); __END_DECLS diff --git a/include/igraph_operators.h b/include/igraph_operators.h index fe4248c88..df7f9fe8d 100644 --- a/include/igraph_operators.h +++ b/include/igraph_operators.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_OPERATORS_H #define IGRAPH_OPERATORS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" @@ -63,26 +37,26 @@ __BEGIN_DECLS /* -------------------------------------------------- */ DECLDIR int igraph_disjoint_union(igraph_t *res, - const igraph_t *left, const igraph_t *right); + const igraph_t *left, const igraph_t *right); DECLDIR int igraph_disjoint_union_many(igraph_t *res, - const igraph_vector_ptr_t *graphs); + const igraph_vector_ptr_t *graphs); DECLDIR int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right, - igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); + igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); DECLDIR int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs, - igraph_vector_ptr_t *edgemaps); + igraph_vector_ptr_t *edgemaps); DECLDIR int igraph_intersection(igraph_t *res, - const igraph_t *left, const igraph_t *right, - igraph_vector_t *edge_map1, - igraph_vector_t *edge_map2); + const igraph_t *left, const igraph_t *right, + igraph_vector_t *edge_map1, + igraph_vector_t *edge_map2); DECLDIR int igraph_intersection_many(igraph_t *res, - const igraph_vector_ptr_t *graphs, - igraph_vector_ptr_t *edgemaps); + const igraph_vector_ptr_t *graphs, + igraph_vector_ptr_t *edgemaps); DECLDIR int igraph_difference(igraph_t *res, - const igraph_t *orig, const igraph_t *sub); + const igraph_t *orig, const igraph_t *sub); DECLDIR int igraph_complementer(igraph_t *res, const igraph_t *graph, - igraph_bool_t loops); + igraph_bool_t loops); DECLDIR int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2, - igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); + igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); __END_DECLS diff --git a/include/igraph_paths.h b/include/igraph_paths.h index 3f244f7a2..402fcd2d3 100644 --- a/include/igraph_paths.h +++ b/include/igraph_paths.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_PATHS_H #define IGRAPH_PATHS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -61,103 +35,103 @@ __BEGIN_DECLS DECLDIR int igraph_diameter(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t *from, igraph_integer_t *to, - igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t unconn); + igraph_integer_t *from, igraph_integer_t *to, + igraph_vector_t *path, + igraph_bool_t directed, igraph_bool_t unconn); DECLDIR int igraph_diameter_dijkstra(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_real_t *pres, - igraph_integer_t *pfrom, - igraph_integer_t *pto, - igraph_vector_t *path, - igraph_bool_t directed, - igraph_bool_t unconn); + const igraph_vector_t *weights, + igraph_real_t *pres, + igraph_integer_t *pfrom, + igraph_integer_t *pto, + igraph_vector_t *path, + igraph_bool_t directed, + igraph_bool_t unconn); DECLDIR int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t from, const igraph_vs_t to, - igraph_neimode_t mode); + const igraph_vs_t from, const igraph_vs_t to, + igraph_neimode_t mode); DECLDIR int igraph_get_shortest_paths(const igraph_t *graph, - igraph_vector_ptr_t *vertices, - igraph_vector_ptr_t *edges, - igraph_integer_t from, const igraph_vs_t to, - igraph_neimode_t mode, - igraph_vector_long_t *predecessors, - igraph_vector_long_t *inbound_edges); + igraph_vector_ptr_t *vertices, + igraph_vector_ptr_t *edges, + igraph_integer_t from, const igraph_vs_t to, + igraph_neimode_t mode, + igraph_vector_long_t *predecessors, + igraph_vector_long_t *inbound_edges); DECLDIR int igraph_get_shortest_path(const igraph_t *graph, - igraph_vector_t *vertices, - igraph_vector_t *edges, - igraph_integer_t from, - igraph_integer_t to, - igraph_neimode_t mode); + igraph_vector_t *vertices, + igraph_vector_t *edges, + igraph_integer_t from, + igraph_integer_t to, + igraph_neimode_t mode); DECLDIR int igraph_get_all_shortest_paths(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_vector_t *nrgeo, - igraph_integer_t from, const igraph_vs_t to, - igraph_neimode_t mode); + igraph_vector_ptr_t *res, + igraph_vector_t *nrgeo, + igraph_integer_t from, const igraph_vs_t to, + igraph_neimode_t mode); DECLDIR int igraph_shortest_paths_dijkstra(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); + igraph_matrix_t *res, + const igraph_vs_t from, + const igraph_vs_t to, + const igraph_vector_t *weights, + igraph_neimode_t mode); DECLDIR int igraph_shortest_paths_bellman_ford(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); + igraph_matrix_t *res, + const igraph_vs_t from, + const igraph_vs_t to, + const igraph_vector_t *weights, + igraph_neimode_t mode); DECLDIR int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, - igraph_vector_ptr_t *vertices, - igraph_vector_ptr_t *edges, - igraph_integer_t from, - igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode, - igraph_vector_long_t *predecessors, - igraph_vector_long_t *inbound_edges); + igraph_vector_ptr_t *vertices, + igraph_vector_ptr_t *edges, + igraph_integer_t from, + igraph_vs_t to, + const igraph_vector_t *weights, + igraph_neimode_t mode, + igraph_vector_long_t *predecessors, + igraph_vector_long_t *inbound_edges); DECLDIR int igraph_get_shortest_path_dijkstra(const igraph_t *graph, - igraph_vector_t *vertices, - igraph_vector_t *edges, - igraph_integer_t from, - igraph_integer_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); + igraph_vector_t *vertices, + igraph_vector_t *edges, + igraph_integer_t from, + igraph_integer_t to, + const igraph_vector_t *weights, + igraph_neimode_t mode); DECLDIR int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_vector_t *nrgeo, - igraph_integer_t from, igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); + igraph_vector_ptr_t *res, + igraph_vector_t *nrgeo, + igraph_integer_t from, igraph_vs_t to, + const igraph_vector_t *weights, + igraph_neimode_t mode); DECLDIR int igraph_shortest_paths_johnson(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights); + igraph_matrix_t *res, + const igraph_vs_t from, + const igraph_vs_t to, + const igraph_vector_t *weights); DECLDIR int igraph_average_path_length(const igraph_t *graph, igraph_real_t *res, - igraph_bool_t directed, igraph_bool_t unconn); + igraph_bool_t directed, igraph_bool_t unconn); DECLDIR int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, - igraph_real_t *unconnected, igraph_bool_t directed); + igraph_real_t *unconnected, igraph_bool_t directed); DECLDIR int igraph_eccentricity(const igraph_t *graph, - igraph_vector_t *res, - igraph_vs_t vids, - igraph_neimode_t mode); + igraph_vector_t *res, + igraph_vs_t vids, + igraph_neimode_t mode); DECLDIR int igraph_radius(const igraph_t *graph, igraph_real_t *radius, - igraph_neimode_t mode); + igraph_neimode_t mode); DECLDIR int igraph_get_all_simple_paths(const igraph_t *graph, - igraph_vector_int_t *res, - igraph_integer_t from, - const igraph_vs_t to, - igraph_neimode_t mode); + igraph_vector_int_t *res, + igraph_integer_t from, + const igraph_vs_t to, + igraph_neimode_t mode); DECLDIR int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk, - igraph_integer_t start, igraph_neimode_t mode, - igraph_integer_t steps, - igraph_random_walk_stuck_t stuck); + igraph_integer_t start, igraph_neimode_t mode, + igraph_integer_t steps, + igraph_random_walk_stuck_t stuck); __END_DECLS diff --git a/include/igraph_progress.h b/include/igraph_progress.h index be1c42495..91b75782f 100644 --- a/include/igraph_progress.h +++ b/include/igraph_progress.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_PROGRESS_H #define IGRAPH_PROGRESS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" __BEGIN_DECLS @@ -152,17 +143,16 @@ __BEGIN_DECLS */ typedef int igraph_progress_handler_t(const char *message, igraph_real_t percent, - void *data); + void *data); extern igraph_progress_handler_t igraph_progress_handler_stderr; -igraph_progress_handler_t * -igraph_set_progress_handler(igraph_progress_handler_t new_handler); +DECLDIR igraph_progress_handler_t * igraph_set_progress_handler(igraph_progress_handler_t new_handler); -int igraph_progress(const char *message, igraph_real_t percent, void *data); +DECLDIR int igraph_progress(const char *message, igraph_real_t percent, void *data); -int igraph_progressf(const char *message, igraph_real_t percent, void *data, - ...); +DECLDIR int igraph_progressf(const char *message, igraph_real_t percent, void *data, + ...); /** * \define IGRAPH_PROGRESS diff --git a/include/igraph_psumtree.h b/include/igraph_psumtree.h index 9dd85544f..eb5469298 100644 --- a/include/igraph_psumtree.h +++ b/include/igraph_psumtree.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_PSUMTREE_H #define IGRAPH_PSUMTREE_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" __BEGIN_DECLS @@ -43,15 +34,16 @@ typedef struct { long int size; long int offset; } igraph_psumtree_t; -int igraph_psumtree_init(igraph_psumtree_t *t, long int size); -void igraph_psumtree_destroy(igraph_psumtree_t *t); -igraph_real_t igraph_psumtree_get(const igraph_psumtree_t *t, long int idx); -long int igraph_psumtree_size(const igraph_psumtree_t *t); -int igraph_psumtree_search(const igraph_psumtree_t *t, long int *idx, - igraph_real_t elem); -int igraph_psumtree_update(igraph_psumtree_t *t, long int idx, - igraph_real_t new_value); -igraph_real_t igraph_psumtree_sum(const igraph_psumtree_t *t); + +DECLDIR int igraph_psumtree_init(igraph_psumtree_t *t, long int size); +DECLDIR void igraph_psumtree_destroy(igraph_psumtree_t *t); +DECLDIR igraph_real_t igraph_psumtree_get(const igraph_psumtree_t *t, long int idx); +DECLDIR long int igraph_psumtree_size(const igraph_psumtree_t *t); +DECLDIR int igraph_psumtree_search(const igraph_psumtree_t *t, long int *idx, + igraph_real_t elem); +DECLDIR int igraph_psumtree_update(igraph_psumtree_t *t, long int idx, + igraph_real_t new_value); +DECLDIR igraph_real_t igraph_psumtree_sum(const igraph_psumtree_t *t); __END_DECLS diff --git a/include/igraph_qsort.h b/include/igraph_qsort.h index bb347da2a..65fe0bf3c 100644 --- a/include/igraph_qsort.h +++ b/include/igraph_qsort.h @@ -24,22 +24,14 @@ #ifndef IGRAPH_QSORT_H #define IGRAPH_QSORT_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS -void igraph_qsort(void *base, size_t nel, size_t width, - int (*compar)(const void *, const void *)); -void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk, - int (*compar)(void *, const void *, const void *)); +DECLDIR void igraph_qsort(void *base, size_t nel, size_t width, + int (*compar)(const void *, const void *)); +DECLDIR void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk, + int (*compar)(void *, const void *, const void *)); __END_DECLS diff --git a/include/igraph_random.h b/include/igraph_random.h index e6aa53bc7..327281ea7 100644 --- a/include/igraph_random.h +++ b/include/igraph_random.h @@ -24,32 +24,7 @@ #ifndef REST_RANDOM_H #define REST_RANDOM_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -95,23 +70,23 @@ DECLDIR unsigned long int igraph_rng_min(igraph_rng_t *rng); DECLDIR const char *igraph_rng_name(igraph_rng_t *rng); DECLDIR long int igraph_rng_get_integer(igraph_rng_t *rng, - long int l, long int h); + long int l, long int h); DECLDIR igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng, - igraph_real_t m, igraph_real_t s); + igraph_real_t m, igraph_real_t s); DECLDIR igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng, - igraph_real_t l, igraph_real_t h); + igraph_real_t l, igraph_real_t h); DECLDIR igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng); DECLDIR igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p); DECLDIR igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n, - igraph_real_t p); + igraph_real_t p); DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); DECLDIR unsigned long int igraph_rng_get_int31(igraph_rng_t *rng); DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); DECLDIR igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape, - igraph_real_t scale); + igraph_real_t scale); DECLDIR int igraph_rng_get_dirichlet(igraph_rng_t *rng, - const igraph_vector_t *alpha, - igraph_vector_t *result); + const igraph_vector_t *alpha, + igraph_vector_t *result); /* --------------------------------- */ @@ -142,7 +117,7 @@ double Rf_dnorm4(double x, double mu, double sigma, int give_log); } #define RNG_END() /* do nothing */ -double igraph_dnorm(double x, double mu, double sigma, int give_log); +DECLDIR double igraph_dnorm(double x, double mu, double sigma, int give_log); #endif diff --git a/include/igraph_scan.h b/include/igraph_scan.h index 86d920d86..c387bb89c 100644 --- a/include/igraph_scan.h +++ b/include/igraph_scan.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_SCAN_H #define IGRAPH_SCAN_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_arpack.h" #include "igraph_constants.h" @@ -41,37 +32,37 @@ __BEGIN_DECLS -int igraph_local_scan_0(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights, igraph_neimode_t mode); +DECLDIR int igraph_local_scan_0(const igraph_t *graph, igraph_vector_t *res, + const igraph_vector_t *weights, igraph_neimode_t mode); -int igraph_local_scan_0_them(const igraph_t *us, const igraph_t *them, - igraph_vector_t *res, - const igraph_vector_t *weigths_them, - igraph_neimode_t mode); +DECLDIR int igraph_local_scan_0_them(const igraph_t *us, const igraph_t *them, + igraph_vector_t *res, + const igraph_vector_t *weigths_them, + igraph_neimode_t mode); -int igraph_local_scan_1_ecount(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); +DECLDIR int igraph_local_scan_1_ecount(const igraph_t *graph, igraph_vector_t *res, + const igraph_vector_t *weights, + igraph_neimode_t mode); -int igraph_local_scan_1_ecount_them(const igraph_t *us, const igraph_t *them, - igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); +DECLDIR int igraph_local_scan_1_ecount_them(const igraph_t *us, const igraph_t *them, + igraph_vector_t *res, + const igraph_vector_t *weights, + igraph_neimode_t mode); -int igraph_local_scan_k_ecount(const igraph_t *graph,int k, - igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); +DECLDIR int igraph_local_scan_k_ecount(const igraph_t *graph,int k, + igraph_vector_t *res, + const igraph_vector_t *weights, + igraph_neimode_t mode); -int igraph_local_scan_k_ecount_them(const igraph_t *us, const igraph_t *them, - int k, igraph_vector_t *res, - const igraph_vector_t *weights_them, - igraph_neimode_t mode); +DECLDIR int igraph_local_scan_k_ecount_them(const igraph_t *us, const igraph_t *them, + int k, igraph_vector_t *res, + const igraph_vector_t *weights_them, + igraph_neimode_t mode); -int igraph_local_scan_neighborhood_ecount(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vector_t *weights, - const igraph_vector_ptr_t *neighborhoods); +DECLDIR int igraph_local_scan_neighborhood_ecount(const igraph_t *graph, + igraph_vector_t *res, + const igraph_vector_t *weights, + const igraph_vector_ptr_t *neighborhoods); __END_DECLS diff --git a/include/igraph_separators.h b/include/igraph_separators.h index 19ad5316b..5b9862336 100644 --- a/include/igraph_separators.h +++ b/include/igraph_separators.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_SEPARATORS_H #define IGRAPH_SEPARATORS_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -43,19 +34,19 @@ __BEGIN_DECLS -int igraph_is_separator(const igraph_t *graph, - const igraph_vs_t candidate, - igraph_bool_t *res); +DECLDIR int igraph_is_separator(const igraph_t *graph, + const igraph_vs_t candidate, + igraph_bool_t *res); -int igraph_all_minimal_st_separators(const igraph_t *graph, - igraph_vector_ptr_t *separators); +DECLDIR int igraph_all_minimal_st_separators(const igraph_t *graph, + igraph_vector_ptr_t *separators); -int igraph_is_minimal_separator(const igraph_t *graph, - const igraph_vs_t candidate, - igraph_bool_t *res); +DECLDIR int igraph_is_minimal_separator(const igraph_t *graph, + const igraph_vs_t candidate, + igraph_bool_t *res); -int igraph_minimum_size_separators(const igraph_t *graph, - igraph_vector_ptr_t *separators); +DECLDIR int igraph_minimum_size_separators(const igraph_t *graph, + igraph_vector_ptr_t *separators); __END_DECLS diff --git a/include/igraph_spmatrix.h b/include/igraph_spmatrix.h index 54c1c8689..42a6ebd7e 100644 --- a/include/igraph_spmatrix.h +++ b/include/igraph_spmatrix.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_SPMATRIX_H #define IGRAPH_SPMATRIX_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" __BEGIN_DECLS @@ -67,41 +58,41 @@ typedef struct s_spmatrix { do { IGRAPH_CHECK(igraph_spmatrix_init(m, nr, nc)); \ IGRAPH_FINALLY(igraph_spmatrix_destroy, m); } while (0) -int igraph_spmatrix_init(igraph_spmatrix_t *m, long int nrow, long int ncol); -void igraph_spmatrix_destroy(igraph_spmatrix_t *m); -int igraph_spmatrix_resize(igraph_spmatrix_t *m, long int nrow, long int ncol); -igraph_real_t igraph_spmatrix_e(const igraph_spmatrix_t *m, long int row, long int col); -int igraph_spmatrix_set(igraph_spmatrix_t *m, long int row, long int col, - igraph_real_t value); -int igraph_spmatrix_add_e(igraph_spmatrix_t *m, long int row, long int col, - igraph_real_t value); -int igraph_spmatrix_add_col_values(igraph_spmatrix_t *m, long int to, long int from); -long int igraph_spmatrix_count_nonzero(const igraph_spmatrix_t *m); -long int igraph_spmatrix_size(const igraph_spmatrix_t *m); -long int igraph_spmatrix_nrow(const igraph_spmatrix_t *m); -long int igraph_spmatrix_ncol(const igraph_spmatrix_t *m); -int igraph_spmatrix_copy_to(const igraph_spmatrix_t *m, igraph_real_t *to); -int igraph_spmatrix_null(igraph_spmatrix_t *m); -int igraph_spmatrix_add_cols(igraph_spmatrix_t *m, long int n); -int igraph_spmatrix_add_rows(igraph_spmatrix_t *m, long int n); -int igraph_spmatrix_clear_col(igraph_spmatrix_t *m, long int col); -int igraph_spmatrix_clear_row(igraph_spmatrix_t *m, long int row); -int igraph_spmatrix_copy(igraph_spmatrix_t *to, const igraph_spmatrix_t *from); -igraph_real_t igraph_spmatrix_max_nonzero(const igraph_spmatrix_t *m, - igraph_real_t *ridx, igraph_real_t *cidx); -igraph_real_t igraph_spmatrix_max(const igraph_spmatrix_t *m, - igraph_real_t *ridx, igraph_real_t *cidx); -void igraph_spmatrix_scale(igraph_spmatrix_t *m, igraph_real_t by); -int igraph_spmatrix_colsums(const igraph_spmatrix_t *m, igraph_vector_t *res); -int igraph_spmatrix_rowsums(const igraph_spmatrix_t *m, igraph_vector_t *res); - -int igraph_spmatrix_print(const igraph_spmatrix_t *matrix); -int igraph_spmatrix_fprint(const igraph_spmatrix_t *matrix, FILE* file); - -int igraph_i_spmatrix_get_col_nonzero_indices(const igraph_spmatrix_t *m, - igraph_vector_t *res, long int col); -int igraph_i_spmatrix_clear_row_fast(igraph_spmatrix_t *m, long int row); -int igraph_i_spmatrix_cleanup(igraph_spmatrix_t *m); +DECLDIR int igraph_spmatrix_init(igraph_spmatrix_t *m, long int nrow, long int ncol); +DECLDIR void igraph_spmatrix_destroy(igraph_spmatrix_t *m); +DECLDIR int igraph_spmatrix_resize(igraph_spmatrix_t *m, long int nrow, long int ncol); +DECLDIR igraph_real_t igraph_spmatrix_e(const igraph_spmatrix_t *m, long int row, long int col); +DECLDIR int igraph_spmatrix_set(igraph_spmatrix_t *m, long int row, long int col, + igraph_real_t value); +DECLDIR int igraph_spmatrix_add_e(igraph_spmatrix_t *m, long int row, long int col, + igraph_real_t value); +DECLDIR int igraph_spmatrix_add_col_values(igraph_spmatrix_t *m, long int to, long int from); +DECLDIR long int igraph_spmatrix_count_nonzero(const igraph_spmatrix_t *m); +DECLDIR long int igraph_spmatrix_size(const igraph_spmatrix_t *m); +DECLDIR long int igraph_spmatrix_nrow(const igraph_spmatrix_t *m); +DECLDIR long int igraph_spmatrix_ncol(const igraph_spmatrix_t *m); +DECLDIR int igraph_spmatrix_copy_to(const igraph_spmatrix_t *m, igraph_real_t *to); +DECLDIR int igraph_spmatrix_null(igraph_spmatrix_t *m); +DECLDIR int igraph_spmatrix_add_cols(igraph_spmatrix_t *m, long int n); +DECLDIR int igraph_spmatrix_add_rows(igraph_spmatrix_t *m, long int n); +DECLDIR int igraph_spmatrix_clear_col(igraph_spmatrix_t *m, long int col); +DECLDIR int igraph_spmatrix_clear_row(igraph_spmatrix_t *m, long int row); +DECLDIR int igraph_spmatrix_copy(igraph_spmatrix_t *to, const igraph_spmatrix_t *from); +DECLDIR igraph_real_t igraph_spmatrix_max_nonzero(const igraph_spmatrix_t *m, + igraph_real_t *ridx, igraph_real_t *cidx); +DECLDIR igraph_real_t igraph_spmatrix_max(const igraph_spmatrix_t *m, + igraph_real_t *ridx, igraph_real_t *cidx); +DECLDIR void igraph_spmatrix_scale(igraph_spmatrix_t *m, igraph_real_t by); +DECLDIR int igraph_spmatrix_colsums(const igraph_spmatrix_t *m, igraph_vector_t *res); +DECLDIR int igraph_spmatrix_rowsums(const igraph_spmatrix_t *m, igraph_vector_t *res); + +DECLDIR int igraph_spmatrix_print(const igraph_spmatrix_t *matrix); +DECLDIR int igraph_spmatrix_fprint(const igraph_spmatrix_t *matrix, FILE* file); + +DECLDIR int igraph_i_spmatrix_get_col_nonzero_indices(const igraph_spmatrix_t *m, + igraph_vector_t *res, long int col); +DECLDIR int igraph_i_spmatrix_clear_row_fast(igraph_spmatrix_t *m, long int row); +DECLDIR int igraph_i_spmatrix_cleanup(igraph_spmatrix_t *m); typedef struct s_spmatrix_iter { @@ -112,11 +103,11 @@ typedef struct s_spmatrix_iter { igraph_real_t value; /* value at the given cell */ } igraph_spmatrix_iter_t; -int igraph_spmatrix_iter_create(igraph_spmatrix_iter_t *mit, const igraph_spmatrix_t *m); -int igraph_spmatrix_iter_reset(igraph_spmatrix_iter_t *mit); -int igraph_spmatrix_iter_next(igraph_spmatrix_iter_t *mit); -igraph_bool_t igraph_spmatrix_iter_end(igraph_spmatrix_iter_t *mit); -void igraph_spmatrix_iter_destroy(igraph_spmatrix_iter_t *mit); +DECLDIR int igraph_spmatrix_iter_create(igraph_spmatrix_iter_t *mit, const igraph_spmatrix_t *m); +DECLDIR int igraph_spmatrix_iter_reset(igraph_spmatrix_iter_t *mit); +DECLDIR int igraph_spmatrix_iter_next(igraph_spmatrix_iter_t *mit); +DECLDIR igraph_bool_t igraph_spmatrix_iter_end(igraph_spmatrix_iter_t *mit); +DECLDIR void igraph_spmatrix_iter_destroy(igraph_spmatrix_iter_t *mit); __END_DECLS diff --git a/include/igraph_stack.h b/include/igraph_stack.h index 4be7f9ba1..a6d633ad2 100644 --- a/include/igraph_stack.h +++ b/include/igraph_stack.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_STACK_H #define IGRAPH_STACK_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" __BEGIN_DECLS diff --git a/include/igraph_stack_pmt.h b/include/igraph_stack_pmt.h index 92b223449..139be4bd8 100644 --- a/include/igraph_stack_pmt.h +++ b/include/igraph_stack_pmt.h @@ -43,5 +43,5 @@ DECLDIR void FUNCTION(igraph_stack,clear)(TYPE(igraph_stack)* s); DECLDIR int FUNCTION(igraph_stack,push)(TYPE(igraph_stack)* s, BASE elem); DECLDIR BASE FUNCTION(igraph_stack,pop)(TYPE(igraph_stack)* s); DECLDIR BASE FUNCTION(igraph_stack,top)(const TYPE(igraph_stack)* s); -int FUNCTION(igraph_stack,print)(const TYPE(igraph_stack)* s); -int FUNCTION(igraph_stack,fprint)(const TYPE(igraph_stack)* s, FILE *file); +DECLDIR int FUNCTION(igraph_stack,print)(const TYPE(igraph_stack)* s); +DECLDIR int FUNCTION(igraph_stack,fprint)(const TYPE(igraph_stack)* s, FILE *file); diff --git a/include/igraph_statusbar.h b/include/igraph_statusbar.h index 1fc845ecf..bf2f5fdf5 100644 --- a/include/igraph_statusbar.h +++ b/include/igraph_statusbar.h @@ -24,15 +24,7 @@ #ifndef IGRAPH_STATUSBAR #define IGRAPH_STATUSBAR -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -74,10 +66,9 @@ typedef int igraph_status_handler_t(const char *message, void *data); extern igraph_status_handler_t igraph_status_handler_stderr; -igraph_status_handler_t * -igraph_set_status_handler(igraph_status_handler_t new_handler); +DECLDIR igraph_status_handler_t * igraph_set_status_handler(igraph_status_handler_t new_handler); -int igraph_status(const char *message, void *data); +DECLDIR int igraph_status(const char *message, void *data); /** * \define IGRAPH_STATUS @@ -104,7 +95,7 @@ int igraph_status(const char *message, void *data); } \ } while (0) -int igraph_statusf(const char *message, void *data, ...); +DECLDIR int igraph_statusf(const char *message, void *data, ...); /** * \define IGRAPH_STATUSF diff --git a/include/igraph_structural.h b/include/igraph_structural.h index 462af8f0b..ed1c664bb 100644 --- a/include/igraph_structural.h +++ b/include/igraph_structural.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_STRUCTURAL_H #define IGRAPH_STRUCTURAL_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" @@ -73,92 +47,92 @@ DECLDIR int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igr /* -------------------------------------------------- */ DECLDIR int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights); + const igraph_vector_t *weights); DECLDIR int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph, - igraph_t *mst); + igraph_t *mst); DECLDIR int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst, - const igraph_vector_t *weights); + const igraph_vector_t *weights); DECLDIR int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid, - igraph_neimode_t mode); + igraph_neimode_t mode); DECLDIR int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode); DECLDIR int igraph_subgraph(const igraph_t *graph, igraph_t *res, - const igraph_vs_t vids); + const igraph_vs_t vids); DECLDIR int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res, - const igraph_vs_t vids, - igraph_subgraph_implementation_t impl, - igraph_vector_t *map, - igraph_vector_t *invmap); + const igraph_vs_t vids, + igraph_subgraph_implementation_t impl, + igraph_vector_t *map, + igraph_vector_t *invmap); DECLDIR int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res, - const igraph_vs_t vids, igraph_subgraph_implementation_t impl); + const igraph_vs_t vids, igraph_subgraph_implementation_t impl); DECLDIR int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res, - const igraph_es_t eids, igraph_bool_t delete_vertices); + const igraph_es_t eids, igraph_bool_t delete_vertices); DECLDIR int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, - igraph_bool_t loops, - const igraph_attribute_combination_t *edge_comb); + igraph_bool_t loops, + const igraph_attribute_combination_t *edge_comb); DECLDIR int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res, - igraph_bool_t ignore_loops, - igraph_reciprocity_t mode); + igraph_bool_t ignore_loops, + igraph_reciprocity_t mode); DECLDIR int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res, - igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); + igraph_vs_t vids, igraph_neimode_t mode, + igraph_bool_t loops); DECLDIR int igraph_density(const igraph_t *graph, igraph_real_t *res, - igraph_bool_t loops); + igraph_bool_t loops); DECLDIR int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res, - igraph_es_t es); + igraph_es_t es); DECLDIR int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res); DECLDIR int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res); DECLDIR int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res, - igraph_es_t es); + igraph_es_t es); DECLDIR int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es); DECLDIR int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, - igraph_vector_t *circle); -int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to); + igraph_vector_t *circle); +DECLDIR int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to); DECLDIR int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree, - igraph_neimode_t mode, const igraph_vector_t *roots, - igraph_vector_t *vertex_index); + igraph_neimode_t mode, const igraph_vector_t *roots, + igraph_vector_t *vertex_index); DECLDIR int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); DECLDIR int igraph_maximum_cardinality_search(const igraph_t *graph, - igraph_vector_t *alpha, - igraph_vector_t *alpham1); + igraph_vector_t *alpha, + igraph_vector_t *alpham1); DECLDIR int igraph_is_chordal(const igraph_t *graph, - const igraph_vector_t *alpha, - const igraph_vector_t *alpham1, - igraph_bool_t *chordal, - igraph_vector_t *fill_in, - igraph_t *newgraph); + const igraph_vector_t *alpha, + const igraph_vector_t *alpham1, + igraph_bool_t *chordal, + igraph_vector_t *fill_in, + igraph_t *newgraph); DECLDIR int igraph_avg_nearest_neighbor_degree(const igraph_t *graph, - igraph_vs_t vids, - igraph_vector_t *knn, - igraph_vector_t *knnk, - const igraph_vector_t *weights); + igraph_vs_t vids, + igraph_vector_t *knn, + igraph_vector_t *knnk, + const igraph_vector_t *weights); DECLDIR int igraph_contract_vertices(igraph_t *graph, - const igraph_vector_t *mapping, - const igraph_attribute_combination_t - *vertex_comb); + const igraph_vector_t *mapping, + const igraph_attribute_combination_t + *vertex_comb); DECLDIR int igraph_transitive_closure_dag(const igraph_t *graph, - igraph_t *closure); + igraph_t *closure); DECLDIR int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result, - const igraph_vector_t *weights, igraph_fas_algorithm_t algo); + const igraph_vector_t *weights, igraph_fas_algorithm_t algo); DECLDIR int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights, - igraph_vector_t *res, const igraph_vs_t vs); + igraph_vector_t *res, const igraph_vs_t vs); /* -------------------------------------------------- */ /* Spectral Properties */ /* -------------------------------------------------- */ DECLDIR int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res, - igraph_sparsemat_t *sparseres, - igraph_bool_t normalized, - const igraph_vector_t *weights); + igraph_sparsemat_t *sparseres, + igraph_bool_t normalized, + const igraph_vector_t *weights); /* -------------------------------------------------- */ /* Internal functions, may change any time */ diff --git a/include/igraph_strvector.h b/include/igraph_strvector.h index a7ab95289..279bc8cff 100644 --- a/include/igraph_strvector.h +++ b/include/igraph_strvector.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_STRVECTOR_H #define IGRAPH_STRVECTOR_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" __BEGIN_DECLS @@ -89,33 +63,33 @@ DECLDIR int igraph_strvector_init(igraph_strvector_t *sv, long int len); DECLDIR void igraph_strvector_destroy(igraph_strvector_t *sv); DECLDIR long int igraph_strvector_size(const igraph_strvector_t *sv); DECLDIR void igraph_strvector_get(const igraph_strvector_t *sv, - long int idx, char **value); + long int idx, char **value); DECLDIR int igraph_strvector_set(igraph_strvector_t *sv, long int idx, - const char *value); + const char *value); DECLDIR int igraph_strvector_set2(igraph_strvector_t *sv, long int idx, - const char *value, int len); + const char *value, int len); DECLDIR void igraph_strvector_clear(igraph_strvector_t *sv); DECLDIR void igraph_strvector_remove_section(igraph_strvector_t *v, long int from, - long int to); + long int to); DECLDIR void igraph_strvector_remove(igraph_strvector_t *v, long int elem); DECLDIR void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin, - long int end, long int to); + long int end, long int to); DECLDIR int igraph_strvector_copy(igraph_strvector_t *to, - const igraph_strvector_t *from); + const igraph_strvector_t *from); DECLDIR int igraph_strvector_append(igraph_strvector_t *to, - const igraph_strvector_t *from); + const igraph_strvector_t *from); DECLDIR int igraph_strvector_resize(igraph_strvector_t* v, long int newsize); DECLDIR int igraph_strvector_add(igraph_strvector_t *v, const char *value); DECLDIR void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index, - long int nremove); + long int nremove); DECLDIR void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg, - long int nremove); -int igraph_strvector_print(const igraph_strvector_t *v, FILE *file, - const char *sep); + long int nremove); +DECLDIR int igraph_strvector_print(const igraph_strvector_t *v, FILE *file, + const char *sep); DECLDIR int igraph_strvector_index(const igraph_strvector_t *v, - igraph_strvector_t *newv, - const igraph_vector_t *idx); + igraph_strvector_t *newv, + const igraph_vector_t *idx); __END_DECLS diff --git a/include/igraph_threading.h.in b/include/igraph_threading.h.in index 928269c8d..cb43af5a8 100644 --- a/include/igraph_threading.h.in +++ b/include/igraph_threading.h.in @@ -24,15 +24,7 @@ #ifndef IGRAPH_THREADING_H #define IGRAPH_THREADING_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS diff --git a/include/igraph_topology.h b/include/igraph_topology.h index 5db7ad8e7..5cf8f263d 100644 --- a/include/igraph_topology.h +++ b/include/igraph_topology.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_TOPOLOGY_H #define IGRAPH_TOPOLOGY_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_datatype.h" #include "igraph_types.h" @@ -45,19 +36,19 @@ __BEGIN_DECLS /* Degree sequences */ /* -------------------------------------------------- */ -int igraph_is_degree_sequence(const igraph_vector_t *out_degrees, +DECLDIR int igraph_is_degree_sequence(const igraph_vector_t *out_degrees, const igraph_vector_t *in_degrees, igraph_bool_t *res); -int igraph_is_graphical_degree_sequence(const igraph_vector_t *out_degrees, +DECLDIR int igraph_is_graphical_degree_sequence(const igraph_vector_t *out_degrees, const igraph_vector_t *in_degrees, igraph_bool_t *res); /* -------------------------------------------------- */ /* Directed acyclic graphs */ /* -------------------------------------------------- */ -int igraph_topological_sorting(const igraph_t *graph, igraph_vector_t *res, +DECLDIR int igraph_topological_sorting(const igraph_t *graph, igraph_vector_t *res, igraph_neimode_t mode); -int igraph_is_dag(const igraph_t *graph, igraph_bool_t *res); -int igraph_transitive_closure_dag(const igraph_t *graph, +DECLDIR int igraph_is_dag(const igraph_t *graph, igraph_bool_t *res); +DECLDIR int igraph_transitive_closure_dag(const igraph_t *graph, igraph_t *closure); /* -------------------------------------------------- */ @@ -65,17 +56,17 @@ int igraph_transitive_closure_dag(const igraph_t *graph, /* -------------------------------------------------- */ /* Common functions */ -int igraph_permute_vertices(const igraph_t *graph, igraph_t *res, +DECLDIR int igraph_permute_vertices(const igraph_t *graph, igraph_t *res, const igraph_vector_t *permutation); /* Generic interface */ -int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2, igraph_bool_t *iso); -int igraph_subisomorphic(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_subisomorphic(const igraph_t *graph1, const igraph_t *graph2, igraph_bool_t *iso); /* LAD */ -int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target, +DECLDIR int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target, igraph_vector_ptr_t *domains, igraph_bool_t *iso, igraph_vector_t *map, igraph_vector_ptr_t *maps, @@ -130,7 +121,7 @@ typedef igraph_bool_t igraph_isocompat_t(const igraph_t *graph1, const igraph_integer_t g2_num, void *arg); -int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, const igraph_vector_int_t *edge_color1, @@ -141,7 +132,7 @@ int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, const igraph_vector_int_t *edge_color1, @@ -151,7 +142,7 @@ int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, const igraph_vector_int_t *edge_color1, @@ -160,7 +151,7 @@ int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2 igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_get_isomorphisms_vf2(const igraph_t *graph1, +DECLDIR int igraph_get_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, @@ -171,7 +162,7 @@ int igraph_get_isomorphisms_vf2(const igraph_t *graph1, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, const igraph_vector_int_t *edge_color1, @@ -182,7 +173,7 @@ int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_subisomorphic_function_vf2(const igraph_t *graph1, +DECLDIR int igraph_subisomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, @@ -194,7 +185,7 @@ int igraph_subisomorphic_function_vf2(const igraph_t *graph1, igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, const igraph_vector_int_t *edge_color1, @@ -203,7 +194,7 @@ int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *gra igraph_isocompat_t *node_compat_fn, igraph_isocompat_t *edge_compat_fn, void *arg); -int igraph_get_subisomorphisms_vf2(const igraph_t *graph1, +DECLDIR int igraph_get_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *vertex_color1, const igraph_vector_int_t *vertex_color2, @@ -264,28 +255,28 @@ typedef enum { IGRAPH_BLISS_F=0, IGRAPH_BLISS_FL, IGRAPH_BLISS_FS, IGRAPH_BLISS_FM, IGRAPH_BLISS_FLM, IGRAPH_BLISS_FSM } igraph_bliss_sh_t; -int igraph_canonical_permutation(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_t *labeling, +DECLDIR int igraph_canonical_permutation(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_t *labeling, igraph_bliss_sh_t sh, igraph_bliss_info_t *info); -int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2, const igraph_vector_int_t *colors1, const igraph_vector_int_t *colors2, igraph_bool_t *iso, igraph_vector_t *map12, igraph_vector_t *map21, igraph_bliss_sh_t sh, igraph_bliss_info_t *info1, igraph_bliss_info_t *info2); -int igraph_automorphisms(const igraph_t *graph, const igraph_vector_int_t *colors, +DECLDIR int igraph_automorphisms(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_bliss_sh_t sh, igraph_bliss_info_t *info); -int igraph_automorphism_group(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_ptr_t *generators, +DECLDIR int igraph_automorphism_group(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_ptr_t *generators, igraph_bliss_sh_t sh, igraph_bliss_info_t *info); /* Functions for 3-4 graphs */ -int igraph_isomorphic_34(const igraph_t *graph1, const igraph_t *graph2, +DECLDIR int igraph_isomorphic_34(const igraph_t *graph1, const igraph_t *graph2, igraph_bool_t *iso); -int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass); -int igraph_isoclass_subgraph(const igraph_t *graph, igraph_vector_t *vids, +DECLDIR int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass); +DECLDIR int igraph_isoclass_subgraph(const igraph_t *graph, igraph_vector_t *vids, igraph_integer_t *isoclass); -int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size, +DECLDIR int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size, igraph_integer_t number, igraph_bool_t directed); diff --git a/include/igraph_transitivity.h b/include/igraph_transitivity.h index 017673793..12b9628ec 100644 --- a/include/igraph_transitivity.h +++ b/include/igraph_transitivity.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_TRANSITIVITY_H #define IGRAPH_TRANSITIVITY_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_datatype.h" #include "igraph_constants.h" #include "igraph_iterators.h" diff --git a/include/igraph_types.h b/include/igraph_types.h index f009509a9..6c9e19e81 100644 --- a/include/igraph_types.h +++ b/include/igraph_types.h @@ -24,32 +24,7 @@ #ifndef REST_TYPES_H #define REST_TYPES_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif +#include "igraph_decls.h" __BEGIN_DECLS @@ -71,15 +46,15 @@ typedef int igraph_bool_t; /* Replacements for printf that print doubles in the same way on all platforms * (even for NaN and infinities) */ -int igraph_real_printf(igraph_real_t val); -int igraph_real_fprintf(FILE *file, igraph_real_t val); -int igraph_real_snprintf(char* str, size_t size, igraph_real_t val); +DECLDIR int igraph_real_printf(igraph_real_t val); +DECLDIR int igraph_real_fprintf(FILE *file, igraph_real_t val); +DECLDIR int igraph_real_snprintf(char* str, size_t size, igraph_real_t val); /* Replacements for printf that print doubles in the same way on all platforms * (even for NaN and infinities) with the largest possible precision */ -int igraph_real_printf_precise(igraph_real_t val); -int igraph_real_fprintf_precise(FILE *file, igraph_real_t val); -int igraph_real_snprintf_precise(char* str, size_t size, igraph_real_t val); +DECLDIR int igraph_real_printf_precise(igraph_real_t val); +DECLDIR int igraph_real_fprintf_precise(FILE *file, igraph_real_t val); +DECLDIR int igraph_real_snprintf_precise(char* str, size_t size, igraph_real_t val); /* igraph_i_fdiv is needed here instead of in igraph_math.h because * some constants use it */ diff --git a/include/igraph_vector.h b/include/igraph_vector.h index ea10d1820..cf8656230 100644 --- a/include/igraph_vector.h +++ b/include/igraph_vector.h @@ -24,33 +24,7 @@ #ifndef IGRAPH_VECTOR_H #define IGRAPH_VECTOR_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -#ifdef DECLDIR -# undef DECLDIR -#endif -#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64) -# if defined (__MINGW32__) || defined (__CYGWIN32__) -# define DECLDIR /**/ -# else -# ifdef IGRAPH_EXPORTS -# define DECLDIR __declspec(dllexport) -# else -# define DECLDIR __declspec(dllimport) -# endif -# endif -#else -# define DECLDIR /**/ -#endif - +#include "igraph_decls.h" #include "igraph_types.h" #include "igraph_complex.h" @@ -180,14 +154,14 @@ __BEGIN_DECLS /* Type-specific vector functions */ /* -------------------------------------------------- */ -int igraph_vector_floor(const igraph_vector_t *from, igraph_vector_long_t *to); -int igraph_vector_round(const igraph_vector_t *from, igraph_vector_long_t *to); +DECLDIR int igraph_vector_floor(const igraph_vector_t *from, igraph_vector_long_t *to); +DECLDIR int igraph_vector_round(const igraph_vector_t *from, igraph_vector_long_t *to); -igraph_bool_t igraph_vector_e_tol(const igraph_vector_t *lhs, +DECLDIR igraph_bool_t igraph_vector_e_tol(const igraph_vector_t *lhs, const igraph_vector_t *rhs, igraph_real_t tol); -int igraph_vector_zapsmall(igraph_vector_t *v, igraph_real_t tol); +DECLDIR int igraph_vector_zapsmall(igraph_vector_t *v, igraph_real_t tol); /* These are for internal use only */ int igraph_vector_order(const igraph_vector_t* v, const igraph_vector_t *v2, diff --git a/include/igraph_vector_ptr.h b/include/igraph_vector_ptr.h index f606be407..5e2ce92f2 100644 --- a/include/igraph_vector_ptr.h +++ b/include/igraph_vector_ptr.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_VECTOR_PTR_H #define IGRAPH_VECTOR_PTR_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_vector.h" __BEGIN_DECLS @@ -59,35 +50,35 @@ typedef struct s_vector_ptr { do { IGRAPH_CHECK(igraph_vector_ptr_init(v, size)); \ IGRAPH_FINALLY(igraph_vector_ptr_destroy, v); } while (0) -int igraph_vector_ptr_init (igraph_vector_ptr_t* v, long int size); -int igraph_vector_ptr_init_copy (igraph_vector_ptr_t* v, void** data, long int length); -const igraph_vector_ptr_t *igraph_vector_ptr_view (const igraph_vector_ptr_t *v, +DECLDIR int igraph_vector_ptr_init (igraph_vector_ptr_t* v, long int size); +DECLDIR int igraph_vector_ptr_init_copy (igraph_vector_ptr_t* v, void** data, long int length); +DECLDIR const igraph_vector_ptr_t *igraph_vector_ptr_view (const igraph_vector_ptr_t *v, void *const *data, long int length); -void igraph_vector_ptr_destroy (igraph_vector_ptr_t* v); -void igraph_vector_ptr_free_all (igraph_vector_ptr_t* v); -void igraph_vector_ptr_destroy_all (igraph_vector_ptr_t* v); -int igraph_vector_ptr_reserve (igraph_vector_ptr_t* v, long int size); -igraph_bool_t igraph_vector_ptr_empty (const igraph_vector_ptr_t* v); -long int igraph_vector_ptr_size (const igraph_vector_ptr_t* v); -void igraph_vector_ptr_clear (igraph_vector_ptr_t* v); -void igraph_vector_ptr_null (igraph_vector_ptr_t* v); -int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e); -int igraph_vector_ptr_append (igraph_vector_ptr_t *to, +DECLDIR void igraph_vector_ptr_destroy (igraph_vector_ptr_t* v); +DECLDIR void igraph_vector_ptr_free_all (igraph_vector_ptr_t* v); +DECLDIR void igraph_vector_ptr_destroy_all (igraph_vector_ptr_t* v); +DECLDIR int igraph_vector_ptr_reserve (igraph_vector_ptr_t* v, long int size); +DECLDIR igraph_bool_t igraph_vector_ptr_empty (const igraph_vector_ptr_t* v); +DECLDIR long int igraph_vector_ptr_size (const igraph_vector_ptr_t* v); +DECLDIR void igraph_vector_ptr_clear (igraph_vector_ptr_t* v); +DECLDIR void igraph_vector_ptr_null (igraph_vector_ptr_t* v); +DECLDIR int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e); +DECLDIR int igraph_vector_ptr_append (igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from); -void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v); -int igraph_vector_ptr_insert(igraph_vector_ptr_t *v, long int pos, void* e); -void* igraph_vector_ptr_e (const igraph_vector_ptr_t* v, long int pos); -void igraph_vector_ptr_set (igraph_vector_ptr_t* v, long int pos, void* value); -int igraph_vector_ptr_resize(igraph_vector_ptr_t* v, long int newsize); -void igraph_vector_ptr_copy_to(const igraph_vector_ptr_t *v, void** to); -int igraph_vector_ptr_copy(igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from); -void igraph_vector_ptr_remove(igraph_vector_ptr_t *v, long int pos); -void igraph_vector_ptr_sort(igraph_vector_ptr_t *v, int(*compar)(const void*, const void*)); -int igraph_vector_ptr_index_int(igraph_vector_ptr_t *v, +DECLDIR void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v); +DECLDIR int igraph_vector_ptr_insert(igraph_vector_ptr_t *v, long int pos, void* e); +DECLDIR void* igraph_vector_ptr_e (const igraph_vector_ptr_t* v, long int pos); +DECLDIR void igraph_vector_ptr_set (igraph_vector_ptr_t* v, long int pos, void* value); +DECLDIR int igraph_vector_ptr_resize(igraph_vector_ptr_t* v, long int newsize); +DECLDIR void igraph_vector_ptr_copy_to(const igraph_vector_ptr_t *v, void** to); +DECLDIR int igraph_vector_ptr_copy(igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from); +DECLDIR void igraph_vector_ptr_remove(igraph_vector_ptr_t *v, long int pos); +DECLDIR void igraph_vector_ptr_sort(igraph_vector_ptr_t *v, int(*compar)(const void*, const void*)); +DECLDIR int igraph_vector_ptr_index_int(igraph_vector_ptr_t *v, const igraph_vector_int_t *idx); -igraph_finally_func_t* igraph_vector_ptr_get_item_destructor(const igraph_vector_ptr_t *v); -igraph_finally_func_t* igraph_vector_ptr_set_item_destructor(igraph_vector_ptr_t *v, +DECLDIR igraph_finally_func_t* igraph_vector_ptr_get_item_destructor(const igraph_vector_ptr_t *v); +DECLDIR igraph_finally_func_t* igraph_vector_ptr_set_item_destructor(igraph_vector_ptr_t *v, igraph_finally_func_t *func); /** diff --git a/include/igraph_version.h.in b/include/igraph_version.h.in index 8cd7e05b7..966ebe3fd 100644 --- a/include/igraph_version.h.in +++ b/include/igraph_version.h.in @@ -24,15 +24,7 @@ #ifndef IGRAPH_VERSION_H #define IGRAPH_VERSION_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif +#include "igraph_decls.h" __BEGIN_DECLS diff --git a/include/igraph_visitor.h b/include/igraph_visitor.h index 8abdcf784..f047032b1 100644 --- a/include/igraph_visitor.h +++ b/include/igraph_visitor.h @@ -24,16 +24,7 @@ #ifndef IGRAPH_VISITOR_H #define IGRAPH_VISITOR_H -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - +#include "igraph_decls.h" #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_datatype.h" From 20b7cd73aa8f0c89fae2c05600d34063bd9c33f8 Mon Sep 17 00:00:00 2001 From: abeham Date: Sat, 13 Aug 2016 21:43:10 +0200 Subject: [PATCH 3/5] renamed files and removed stdint.h include in prpack_solver --- src/Makefile.am | 6 +++--- src/bliss/{heap.cc => bliss_heap.cc} | 0 src/cliquer/{graph2.c => cliquer_graph.c} | 0 src/{heap2.c => heap.c} | 0 src/prpack/prpack_solver.cpp | 1 - 5 files changed, 3 insertions(+), 4 deletions(-) rename src/bliss/{heap.cc => bliss_heap.cc} (100%) rename src/cliquer/{graph2.c => cliquer_graph.c} (100%) rename src/{heap2.c => heap.c} (100%) diff --git a/src/Makefile.am b/src/Makefile.am index 004803116..a3be17f58 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -334,7 +334,7 @@ SOURCES = basic_query.c games.c cocitation.c iterators.c \ foreign-lgl-parser.y foreign-lgl-lexer.l \ foreign-pajek-parser.y foreign-pajek-lexer.l \ foreign-gml-parser.y foreign-gml-lexer.l \ - dqueue.c heap2.c igraph_heap.c igraph_stack.c \ + dqueue.c heap.c igraph_heap.c igraph_stack.c \ igraph_strvector.c igraph_trie.c matrix.c \ vector.c vector_ptr.c memory.c adjlist.c \ visitors.c igraph_grid.c atlas.c topology.c \ @@ -351,7 +351,7 @@ SOURCES = basic_query.c games.c cocitation.c iterators.c \ gml_tree.c \ bliss/orbit.cc bliss/defs.cc bliss/uintseqhash.cc \ bliss/partition.cc bliss/graph.cc \ - bliss/heap.cc bliss/utils.cc bliss.cc \ + bliss/bliss_heap.cc bliss/utils.cc bliss.cc \ cattributes.c zeroin.c bfgs.c math.c \ forestfire.c microscopic_update.c \ blas.c arpack.c centrality.c drl_layout.cpp drl_parse.cpp \ @@ -382,7 +382,7 @@ SOURCES = basic_query.c games.c cocitation.c iterators.c \ $(SPCONFIG) layout_gem.c layout_dh.c lsap.c \ layout_fr.c layout_kk.c paths.c \ random_walk.c \ - igraph_cliquer.c cliquer/cliquer.c cliquer/graph2.c cliquer/reorder.c + igraph_cliquer.c cliquer/cliquer.c cliquer/cliquer_graph.c cliquer/reorder.c if INTERNAL_F2C else diff --git a/src/bliss/heap.cc b/src/bliss/bliss_heap.cc similarity index 100% rename from src/bliss/heap.cc rename to src/bliss/bliss_heap.cc diff --git a/src/cliquer/graph2.c b/src/cliquer/cliquer_graph.c similarity index 100% rename from src/cliquer/graph2.c rename to src/cliquer/cliquer_graph.c diff --git a/src/heap2.c b/src/heap.c similarity index 100% rename from src/heap2.c rename to src/heap.c diff --git a/src/prpack/prpack_solver.cpp b/src/prpack/prpack_solver.cpp index d67e132ce..de82769cd 100644 --- a/src/prpack/prpack_solver.cpp +++ b/src/prpack/prpack_solver.cpp @@ -4,7 +4,6 @@ #include #include #include -#include using namespace prpack; using namespace std; From cb02d3855caa3aaa42fded4cdd5bae1f7871e9e7 Mon Sep 17 00:00:00 2001 From: abeham Date: Sat, 13 Aug 2016 22:01:04 +0200 Subject: [PATCH 4/5] reusing stdint include from bignum.h in prpack_csc.h --- src/prpack/prpack_csc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/prpack/prpack_csc.h b/src/prpack/prpack_csc.h index 4878e924f..234655b37 100644 --- a/src/prpack/prpack_csc.h +++ b/src/prpack/prpack_csc.h @@ -2,7 +2,15 @@ #define PRPACK_CSC #ifndef _MSC_VER -#include +# ifdef HAVE_STDINT_H +# include +# else +# ifdef HAVE_SYS_INT_TYPES_H +# include +# else +# include "pstdint.h" +# endif +# endif #else typedef __int64 int64_t; #endif From 0467290186164e0602f7228d12ff48234dbff787 Mon Sep 17 00:00:00 2001 From: abeham Date: Sat, 13 Aug 2016 22:39:19 +0200 Subject: [PATCH 5/5] Added igraph_decls.h to public headers in Makefile.am and tweaked include of stdint in prpack_csc.h --- src/Makefile.am | 2 +- src/prpack/prpack_csc.h | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a3be17f58..b1c0ccb06 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -322,7 +322,7 @@ HEADERS_PUBLIC =../include/igraph.h ../include/igraph_memory.h \ ../include/igraph_matching.h ../include/igraph_embedding.h \ ../include/igraph_scan.h ../include/igraph_graphlets.h \ ../include/igraph_vector_type.h ../include/igraph_epidemics.h \ - ../include/igraph_lsap.h + ../include/igraph_lsap.h ../include/igraph_decls.h SOURCES = basic_query.c games.c cocitation.c iterators.c \ structural_properties.c components.c layout.c \ diff --git a/src/prpack/prpack_csc.h b/src/prpack/prpack_csc.h index 234655b37..42ec8932c 100644 --- a/src/prpack/prpack_csc.h +++ b/src/prpack/prpack_csc.h @@ -1,16 +1,8 @@ #ifndef PRPACK_CSC #define PRPACK_CSC -#ifndef _MSC_VER -# ifdef HAVE_STDINT_H -# include -# else -# ifdef HAVE_SYS_INT_TYPES_H -# include -# else -# include "pstdint.h" -# endif -# endif +#if !defined(_MSC_VER) && !defined (__MINGW32__) && !defined (__MINGW64__) +# include #else typedef __int64 int64_t; #endif