Skip to content

Commit 73b736e

Browse files
committed
Fix other generic comparators
1 parent 823dd59 commit 73b736e

File tree

4 files changed

+39
-50
lines changed

4 files changed

+39
-50
lines changed

include/flc.i

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ using std::size_t;
7878
(double *DATA, size_t DATASIZE),
7979
(void **DATA, size_t DATASIZE)};
8080

81-
%apply (const SWIGTYPE *DATA, size_t SIZE) {
82-
(const int32_t *DATA, size_t DATASIZE),
83-
(const int64_t *DATA, size_t DATASIZE),
84-
(const double *DATA, size_t DATASIZE),
85-
(void * const *DATA, size_t DATASIZE)};
81+
%apply (SWIGTYPE const *DATA, size_t SIZE) {
82+
(int32_t const *DATA, size_t DATASIZE),
83+
(int64_t const *DATA, size_t DATASIZE),
84+
(double const *DATA, size_t DATASIZE),
85+
(void* const *DATA, size_t DATASIZE)};
8686

8787
/* -------------------------------------------------------------------------
8888
* Version information

include/flc_algorithm.i

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ typedef int index_int;
8686
%apply (SWIGTYPE *DATA, size_t SIZE) { (index_int *IDX, size_t IDXSIZE) };
8787

8888
%apply (const SWIGTYPE *DATA, size_t SIZE) {
89-
(const int32_t *DATA1, size_t DATASIZE1),
90-
(const int64_t *DATA1, size_t DATASIZE1),
91-
(const double *DATA1, size_t DATASIZE1),
92-
(const void **DATA1, size_t DATASIZE1),
93-
(const int32_t *DATA2, size_t DATASIZE2),
94-
(const int64_t *DATA2, size_t DATASIZE2),
95-
(const double *DATA2, size_t DATASIZE2),
96-
(const void **DATA2, size_t DATASIZE2)};
89+
(int32_t const *DATA1, size_t DATASIZE1),
90+
(int64_t const *DATA1, size_t DATASIZE1),
91+
(double const *DATA1, size_t DATASIZE1),
92+
(void* const *DATA1, size_t DATASIZE1),
93+
(int32_t const *DATA2, size_t DATASIZE2),
94+
(int64_t const *DATA2, size_t DATASIZE2),
95+
(double const *DATA2, size_t DATASIZE2),
96+
(void* const *DATA2, size_t DATASIZE2)};
9797

9898

9999
// Make function pointers available as generic types

src/flc_algorithm.f90

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ function flc_cmp_funptr_void_Sm_(left, right) bind(C) &
6161
type(C_PTR), public :: cptr = C_NULL_PTR
6262
integer(C_INT), public :: cmemflags = 0
6363
end type
64-
type, public :: SWIGTYPE_p_p_void
65-
type(SwigClassWrapper), public :: swigdata
66-
end type
6764
interface binary_search
6865
module procedure swigf_binary_search__SWIG_1, swigf_binary_search__SWIG_2, swigf_binary_search__SWIG_3, &
6966
swigf_binary_search__SWIG_4, swigf_binary_search__SWIG_5, swigf_binary_search__SWIG_6, swigf_binary_search__SWIG_7
@@ -564,15 +561,13 @@ function swigc_includes__SWIG_6(farg1, farg3, farg5) &
564561
integer(C_INT) :: fresult
565562
end function
566563

567-
function swigc_includes__SWIG_7(farg1, farg2, farg3, farg4, farg5) &
564+
function swigc_includes__SWIG_7(farg1, farg3, farg5) &
568565
bind(C, name="_wrap_includes__SWIG_7") &
569566
result(fresult)
570567
use, intrinsic :: ISO_C_BINDING
571-
import :: swigclasswrapper
572-
type(SwigClassWrapper) :: farg1
573-
integer(C_SIZE_T), intent(in) :: farg2
574-
type(SwigClassWrapper) :: farg3
575-
integer(C_SIZE_T), intent(in) :: farg4
568+
import :: swigarraywrapper
569+
type(SwigArrayWrapper) :: farg1
570+
type(SwigArrayWrapper) :: farg3
576571
type(C_FUNPTR), value :: farg5
577572
integer(C_INT) :: fresult
578573
end function
@@ -1464,28 +1459,22 @@ function swigf_includes__SWIG_6(data1, data2, cmp) &
14641459
call SWIGTM_fout_bool(fresult, swig_result)
14651460
end function
14661461

1467-
function swigf_includes__SWIG_7(data1, datasize1, data2, datasize2, cmp) &
1462+
function swigf_includes__SWIG_7(data1, data2, cmp) &
14681463
result(swig_result)
14691464
use, intrinsic :: ISO_C_BINDING
14701465
logical :: swig_result
1471-
class(SWIGTYPE_p_p_void), intent(in) :: data1
1472-
integer(C_SIZE_T), intent(in) :: datasize1
1473-
class(SWIGTYPE_p_p_void), intent(in) :: data2
1474-
integer(C_SIZE_T), intent(in) :: datasize2
1466+
type(C_PTR), dimension(:), intent(in), target :: data1
1467+
type(C_PTR), dimension(:), intent(in), target :: data2
14751468
procedure(flc_cmp_funptr_void_Sm_) :: cmp
14761469
integer(C_INT) :: fresult
1477-
type(SwigClassWrapper) :: farg1
1478-
integer(C_SIZE_T) :: farg2
1479-
type(SwigClassWrapper) :: farg3
1480-
integer(C_SIZE_T) :: farg4
1470+
type(SwigArrayWrapper) :: farg1
1471+
type(SwigArrayWrapper) :: farg3
14811472
type(C_FUNPTR) :: farg5
14821473

1483-
farg1 = data1%swigdata
1484-
farg2 = datasize1
1485-
farg3 = data2%swigdata
1486-
farg4 = datasize2
1474+
call SWIGTM_fin_void_Sm__Sb__SB_(data1, farg1)
1475+
call SWIGTM_fin_void_Sm__Sb__SB_(data2, farg3)
14871476
farg5 = c_funloc(cmp)
1488-
fresult = swigc_includes__SWIG_7(farg1, farg2, farg3, farg4, farg5)
1477+
fresult = swigc_includes__SWIG_7(farg1, farg3, farg5)
14891478
call SWIGTM_fout_bool(fresult, swig_result)
14901479
end function
14911480

src/flc_algorithmFORTRAN_wrap.cxx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,15 @@ static bool includes_cmp(const T *DATA1,size_t DATASIZE1,const T *DATA2,size_t D
449449
}
450450

451451

452+
#include <random>
453+
454+
455+
template<class T>
456+
static void shuffle(std::mt19937_64& g, T *DATA, size_t DATASIZE) {
457+
std::shuffle(DATA, DATA + DATASIZE, g);
458+
}
459+
460+
452461
struct SwigClassWrapper {
453462
void* cptr;
454463
int cmemflags;
@@ -463,15 +472,6 @@ SWIGINTERN SwigClassWrapper SwigClassWrapper_uninitialized() {
463472
}
464473

465474

466-
#include <random>
467-
468-
469-
template<class T>
470-
static void shuffle(std::mt19937_64& g, T *DATA, size_t DATASIZE) {
471-
std::shuffle(DATA, DATA + DATASIZE, g);
472-
}
473-
474-
475475
namespace swig {
476476

477477
template<class T, AssignmentType A>
@@ -1339,7 +1339,7 @@ SWIGEXPORT int _wrap_includes__SWIG_6(SwigArrayWrapper *farg1, SwigArrayWrapper
13391339
}
13401340

13411341

1342-
SWIGEXPORT int _wrap_includes__SWIG_7(SwigClassWrapper *farg1, size_t const *farg2, SwigClassWrapper *farg3, size_t const *farg4, bool (*farg5)(void *,void *)) {
1342+
SWIGEXPORT int _wrap_includes__SWIG_7(SwigArrayWrapper *farg1, SwigArrayWrapper *farg3, bool (*farg5)(void *,void *)) {
13431343
int fresult ;
13441344
void **arg1 = (void **) 0 ;
13451345
size_t arg2 ;
@@ -1348,10 +1348,10 @@ SWIGEXPORT int _wrap_includes__SWIG_7(SwigClassWrapper *farg1, size_t const *far
13481348
bool (*arg5)(void *,void *) = (bool (*)(void *,void *)) 0 ;
13491349
bool result;
13501350

1351-
arg1 = (void **)farg1->cptr;
1352-
arg2 = (size_t)(*farg2);
1353-
arg3 = (void **)farg3->cptr;
1354-
arg4 = (size_t)(*farg4);
1351+
arg1 = (void **)farg1->data;
1352+
arg2 = farg1->size;
1353+
arg3 = (void **)farg3->data;
1354+
arg4 = farg3->size;
13551355
arg5 = (bool (*)(void *,void *))(*farg5);
13561356
result = (bool)includes_cmp< void * >((void *const *)arg1,arg2,(void *const *)arg3,arg4,arg5);
13571357
fresult = (result ? 1 : 0);

0 commit comments

Comments
 (0)