From 0aab207ab081f9b4a897de4b456973983ac957bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 30 Mar 2022 09:47:06 +0300 Subject: [PATCH] extern "C" in headers --- qpms/beyn.h | 10 ++++++++-- qpms/ewald.h | 8 ++++++++ qpms/gaunt.h | 7 +++++++ qpms/groups.h | 6 ++++++ qpms/indexing.h | 6 ++++++ qpms/kahansum.h | 6 ++++++ qpms/lattices.h | 6 ++++++ qpms/materials.h | 7 +++++++ qpms/normalisation.h | 6 ++++++ qpms/parsing.h | 6 ++++++ qpms/pointgroups.h | 6 ++++++ qpms/qpms_error.h | 6 ++++++ qpms/qpms_specfunc.h | 7 +++++++ qpms/qpms_types.h | 8 ++++++++ qpms/qpmsblas.h | 7 +++++++ qpms/quaternions.h | 6 ++++++ qpms/scatsystem.h | 7 +++++++ qpms/symmetries.h | 8 ++++++++ qpms/tmatrices.h | 7 +++++++ qpms/tolerances.h | 6 ++++++ qpms/translations.h | 7 +++++++ qpms/vswf.h | 7 +++++++ 22 files changed, 148 insertions(+), 2 deletions(-) diff --git a/qpms/beyn.h b/qpms/beyn.h index 9395265..9b05a3a 100644 --- a/qpms/beyn.h +++ b/qpms/beyn.h @@ -3,6 +3,9 @@ */ #ifndef BEYN_H #define BEYN_H +#ifdef __cplusplus +extern "C" { +#endif #include @@ -47,12 +50,12 @@ typedef enum { /// Complex plane "half-elliptic" integration contour with axes parallel to the real, imaginary axes. /** Free using free(). */ beyn_contour_t *beyn_contour_halfellipse(_Complex double centre, double halfax_re, double halfax_im, size_t npoints, - beyn_contour_halfellipse_orientation or); + beyn_contour_halfellipse_orientation o); /// Similar to halfellipse but with rounded corners. beyn_contour_t *beyn_contour_kidney(_Complex double centre, double halfax_re, double halfax_im, double rounding, ///< Must be in interval [0, 0.5) - size_t n, beyn_contour_halfellipse_orientation or); + size_t n, beyn_contour_halfellipse_orientation o); /// Beyn algorithm result structure (pure C array version). @@ -82,4 +85,7 @@ beyn_result_t *beyn_solve( double res_tol ///< (default: `0.0`) TODO DOC. ); +#ifdef __cplusplus +} +#endif #endif // BEYN_H diff --git a/qpms/ewald.h b/qpms/ewald.h index cb0acbe..4d0ac98 100644 --- a/qpms/ewald.h +++ b/qpms/ewald.h @@ -26,6 +26,10 @@ #ifndef EWALD_H #define EWALD_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -335,4 +339,8 @@ int ewald3_sigma_long( // calls ewald3_21_sigma_long or ewald3_3_sigma_long, dep extern int ewald_factor_ipow_l; // If nonzero, adds an additional factor \f$ i^{nm} \f$ to the Ewald sum result (for debubbing). extern int ewald_factor_ipow_m; + +#ifdef __cplusplus +} +#endif #endif //EWALD_H diff --git a/qpms/gaunt.h b/qpms/gaunt.h index 425c660..d6e2e81 100644 --- a/qpms/gaunt.h +++ b/qpms/gaunt.h @@ -3,6 +3,10 @@ */ #ifndef GAUNT_H #define GAUNT_H +#ifdef __cplusplus +extern "C" { +#endif + #include #define _GAUNT_H_MIN(x,y) (((x) > (y)) ? (y) : (x)) @@ -30,4 +34,7 @@ double const * gaunt_table_retrieve_allq(int m, int n, int mu, int nu); int gaunt_table_or_xu_fill(double *target, int m, int n, int mu, int nu); #endif //GAUNT_PRECOMPILED +#ifdef __cplusplus +} +#endif #endif //GAUNT_H diff --git a/qpms/groups.h b/qpms/groups.h index 771a7e9..36142d9 100644 --- a/qpms/groups.h +++ b/qpms/groups.h @@ -23,6 +23,9 @@ */ #ifndef QPMS_GROUPS_H #define QPMS_GROUPS_H +#ifdef __cplusplus +extern "C" { +#endif #include "qpms_types.h" #include @@ -93,4 +96,7 @@ qpms_iri_t qpms_finite_group_find_irrep_by_name(qpms_finite_group_t *G, char *na extern const qpms_finite_group_t QPMS_FINITE_GROUP_TRIVIAL; extern const qpms_finite_group_t QPMS_FINITE_GROUP_TRIVIAL_G; +#ifdef __cplusplus +} +#endif #endif // QPMS_GROUPS_H diff --git a/qpms/indexing.h b/qpms/indexing.h index aab7478..86ea952 100644 --- a/qpms/indexing.h +++ b/qpms/indexing.h @@ -26,6 +26,9 @@ */ #ifndef QPMS_INDEXING_H #define QPMS_INDEXING_H +#ifdef __cplusplus +extern "C" { +#endif #include "qpms_types.h" #include @@ -147,4 +150,7 @@ static inline qpms_m_t qpms_uvswfi2m(qpms_uvswfi_t u) { } +#ifdef __cplusplus +} +#endif #endif //QPMS_INDEXING_H diff --git a/qpms/kahansum.h b/qpms/kahansum.h index 350bfa9..c2ef963 100644 --- a/qpms/kahansum.h +++ b/qpms/kahansum.h @@ -3,6 +3,9 @@ */ #ifndef KAHANSUM_H #define KAHANSUM_H +#ifdef __cplusplus +extern "C" { +#endif static inline void kahaninit(double * const sum, double * const compensation) { *sum = 0; @@ -29,4 +32,7 @@ static inline void ckahanadd(_Complex double *sum, _Complex double *compensation *sum = nsum; } +#ifdef __cplusplus +} +#endif #endif //KAHANSUM_H diff --git a/qpms/lattices.h b/qpms/lattices.h index d7daa3c..c41e479 100644 --- a/qpms/lattices.h +++ b/qpms/lattices.h @@ -4,6 +4,9 @@ */ #ifndef LATTICES_H #define LATTICES_H +#ifdef __cplusplus +extern "C" { +#endif #include #include @@ -945,4 +948,7 @@ int honeycomb_lattice_gen_extend_to_steps(honeycomb_lattice_gen_t *g, int maxste int honeycomb_lattice_gen_extend_to_r(honeycomb_lattice_gen_t *g, double r); void honeycomb_lattice_gen_free(honeycomb_lattice_gen_t *g); +#ifdef __cplusplus +} +#endif #endif // LATTICES_H diff --git a/qpms/materials.h b/qpms/materials.h index d01885f..c14e041 100644 --- a/qpms/materials.h +++ b/qpms/materials.h @@ -3,6 +3,10 @@ */ #ifndef QPMS_MATERIALS_H #define QPMS_MATERIALS_H +#ifdef __cplusplus +extern "C" { +#endif + #include "qpms_types.h" #include #include @@ -159,4 +163,7 @@ static inline _Complex double qpms_drude_epsilon( } +#ifdef __cplusplus +} +#endif #endif //QPMS_MATERIALS_H diff --git a/qpms/normalisation.h b/qpms/normalisation.h index 6afa7ac..2b72f82 100644 --- a/qpms/normalisation.h +++ b/qpms/normalisation.h @@ -5,6 +5,9 @@ */ #ifndef NORMALISATION_H #define NORMALISATION_H +#ifdef __cplusplus +extern "C" { +#endif #include "qpms_types.h" #include "qpms_error.h" @@ -282,4 +285,7 @@ static inline double qpms_normalisation_t_factor_abssquare(qpms_normalisation_t } #endif +#ifdef __cplusplus +} +#endif #endif //NORMALISATION_H diff --git a/qpms/parsing.h b/qpms/parsing.h index 3f60daa..aba1f30 100644 --- a/qpms/parsing.h +++ b/qpms/parsing.h @@ -3,6 +3,9 @@ */ #ifndef QPMS_PARSING_H #define QPMS_PARSING_H +#ifdef __cplusplus +extern "C" { +#endif #include @@ -57,4 +60,7 @@ size_t qpms_parse_doubles_fromfile( const char *filepath //< File to read from, or NULL, "", "-" to read from stdin. ); +#ifdef __cplusplus +} +#endif #endif // QPMS_PARSING_H diff --git a/qpms/pointgroups.h b/qpms/pointgroups.h index 2823d47..2ddcac2 100644 --- a/qpms/pointgroups.h +++ b/qpms/pointgroups.h @@ -3,6 +3,9 @@ */ #ifndef POINTGROUPS_H #define POINTGROUPS_H +#ifdef __cplusplus +extern "C" { +#endif #include "qpms_error.h" #include "quaternions.h" @@ -81,4 +84,7 @@ _Bool qpms_pg_is_subgroup(qpms_pointgroup_t a, qpms_pointgroup_t b); +#ifdef __cplusplus +} +#endif #endif //POINTGROUPS_H diff --git a/qpms/qpms_error.h b/qpms/qpms_error.h index f554035..bb30c5c 100644 --- a/qpms/qpms_error.h +++ b/qpms/qpms_error.h @@ -5,6 +5,9 @@ */ #ifndef QPMS_ERROR_H #define QPMS_ERROR_H +#ifdef __cplusplus +extern "C" { +#endif #include "optim.h" @@ -266,4 +269,7 @@ qpms_dbgmsg_flags qpms_dbgmsg_enable(qpms_dbgmsg_flags types); }\ } +#ifdef __cplusplus +} +#endif #endif diff --git a/qpms/qpms_specfunc.h b/qpms/qpms_specfunc.h index 6a9b32f..213a38d 100644 --- a/qpms/qpms_specfunc.h +++ b/qpms/qpms_specfunc.h @@ -3,6 +3,10 @@ */ #ifndef QPMS_SPECFUNC_H #define QPMS_SPECFUNC_H +#ifdef __cplusplus +extern "C" { +#endif + #include "qpms_types.h" #include @@ -107,4 +111,7 @@ double qpms_legendre0(int m, int n); // Associated Legendre polynomial derivative at zero argument (DLMF 14.5.2) double qpms_legendred0(int m, int n); +#ifdef __cplusplus +} +#endif #endif // QPMS_SPECFUNC_H diff --git a/qpms/qpms_types.h b/qpms/qpms_types.h index 75aeaca..209d07e 100644 --- a/qpms/qpms_types.h +++ b/qpms/qpms_types.h @@ -3,6 +3,10 @@ */ #ifndef QPMS_TYPES_H #define QPMS_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -435,4 +439,8 @@ typedef enum { } qpms_ewald_part; #define lmcheck(l,m) assert((l) >= 1 && abs(m) <= (l)) + +#ifdef __cplusplus +} +#endif #endif // QPMS_TYPES diff --git a/qpms/qpmsblas.h b/qpms/qpmsblas.h index c32282b..3981b82 100644 --- a/qpms/qpmsblas.h +++ b/qpms/qpmsblas.h @@ -14,6 +14,10 @@ */ #ifndef QPMSBLAS_H #define QPMSBLAS_H +#ifdef __cplusplus +extern "C" { +#endif + #define QPMS_BLAS_INDEX_T long long int #ifndef CBLAS_H @@ -31,4 +35,7 @@ void qpms_zgemm(CBLAS_LAYOUT Order, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE Tran const _Complex double *B, const QPMS_BLAS_INDEX_T ldb, const _Complex double *beta, _Complex double *C, const QPMS_BLAS_INDEX_T ldc); +#ifdef __cplusplus +} +#endif #endif //QPMSBLAS_H diff --git a/qpms/quaternions.h b/qpms/quaternions.h index 520d821..474b06b 100644 --- a/qpms/quaternions.h +++ b/qpms/quaternions.h @@ -3,6 +3,9 @@ */ #ifndef QPMS_WIGNER_H #define QPMS_WIGNER_H +#ifdef __cplusplus +extern "C" { +#endif #include "qpms_types.h" #include "vectors.h" @@ -303,4 +306,7 @@ static inline qpms_irot3_t qpms_irot3_zrot_Nk(double N, double k) { return qpms_irot3_zrot_angle(2 * M_PI * k / N); } +#ifdef __cplusplus +} +#endif #endif //QPMS_WIGNER_H diff --git a/qpms/scatsystem.h b/qpms/scatsystem.h index 7449ede..eb3337d 100644 --- a/qpms/scatsystem.h +++ b/qpms/scatsystem.h @@ -10,6 +10,10 @@ */ #ifndef QPMS_SCATSYSTEM_H #define QPMS_SCATSYSTEM_H +#ifdef __cplusplus +extern "C" { +#endif + #include "qpms_types.h" #include "vswf.h" #include "tmatrices.h" @@ -919,4 +923,7 @@ ccart3_t qpms_scatsys_scattered_E_irrep(const qpms_scatsys_t *ss, ); #endif +#ifdef __cplusplus +} +#endif #endif //QPMS_SCATSYSTEM_H diff --git a/qpms/symmetries.h b/qpms/symmetries.h index 3e590a3..4ef1f4d 100644 --- a/qpms/symmetries.h +++ b/qpms/symmetries.h @@ -21,6 +21,10 @@ */ #ifndef SYMMETRIES_H #define SYMMETRIES_H +#ifdef __cplusplus +extern "C" { +#endif + #include "qpms_types.h" #include @@ -75,4 +79,8 @@ size_t qpms_zero_roundoff_clean(double *arr, size_t nmemb, double atol); * TODO doc. */ size_t qpms_czero_roundoff_clean(_Complex double *arr, size_t nmemb, double atol); + +#ifdef __cplusplus +} +#endif #endif // SYMMETRIES_H diff --git a/qpms/tmatrices.h b/qpms/tmatrices.h index b46571e..30361c9 100644 --- a/qpms/tmatrices.h +++ b/qpms/tmatrices.h @@ -3,6 +3,10 @@ */ #ifndef TMATRICES_H #define TMATRICES_H +#ifdef __cplusplus +extern "C" { +#endif + // #include "qpms_types.h" // included via materials.h // #include // included via materials.h #include "materials.h" @@ -689,4 +693,7 @@ typedef struct qpms_abstract_particle_t { typedef qpms_particle_tid_t qpms_abstract_particle_tid_t; #endif // 0 +#ifdef __cplusplus +} +#endif #endif //TMATRICES_H diff --git a/qpms/tolerances.h b/qpms/tolerances.h index 14939a6..eac65df 100644 --- a/qpms/tolerances.h +++ b/qpms/tolerances.h @@ -1,6 +1,9 @@ /*! \file tolerances.h */ #ifndef QPMS_TOLERANCES_H #define QPMS_TOLERANCES_H +#ifdef __cplusplus +extern "C" { +#endif // TODO DOC @@ -12,4 +15,7 @@ typedef struct qpms_tolerance_spec_t { /// A rather arbitrary default tolerance. static const qpms_tolerance_spec_t QPMS_TOLERANCE_DEFAULT = {.atol = 1e-9, .rtol = 1e-8}; +#ifdef __cplusplus +} +#endif #endif // QPMS_TOLERANCES_H diff --git a/qpms/translations.h b/qpms/translations.h index c5a3155..492a9c9 100644 --- a/qpms/translations.h +++ b/qpms/translations.h @@ -26,6 +26,10 @@ */ #ifndef QPMS_TRANSLATIONS_H #define QPMS_TRANSLATIONS_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vectors.h" #include "qpms_types.h" #include @@ -243,4 +247,7 @@ int qpms_cython_trans_calculator_get_AB_arrays_loop( #endif //QPMS_COMPILE_PYTHON_EXTENSIONS +#ifdef __cplusplus +} +#endif #endif // QPMS_TRANSLATIONS_H diff --git a/qpms/vswf.h b/qpms/vswf.h index 736e803..86e68aa 100644 --- a/qpms/vswf.h +++ b/qpms/vswf.h @@ -7,6 +7,10 @@ */ #ifndef QPMS_VSWF_H #define QPMS_VSWF_H +#ifdef __cplusplus +extern "C" { +#endif + #include // ssize_t #include "qpms_types.h" #include @@ -246,4 +250,7 @@ qpms_vswfset_sph_t *qpms_vswfset_make(qpms_l_t lMax, sph_t kdlj, qpms_bessel_t btyp, qpms_normalisation_t norm);//NI void qpms_vswfset_sph_pfree(qpms_vswfset_sph_t *);//NI +#ifdef __cplusplus +} +#endif #endif // QPMS_VSWF_H