diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/crush/CrushWrapper.i | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/crush/CrushWrapper.i')
-rw-r--r-- | src/crush/CrushWrapper.i | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/crush/CrushWrapper.i b/src/crush/CrushWrapper.i new file mode 100644 index 00000000..76340611 --- /dev/null +++ b/src/crush/CrushWrapper.i @@ -0,0 +1,47 @@ +/* File : CrushWrapper.i */ +%module CrushWrapper +%{ +#include "CrushWrapper.h" +%} + +%include typemaps.i + +// This tells SWIG to treat 'int *data' as a special case +%typemap(in) int *items { + AV *tempav; + I32 len; + int i; + SV **tv; +// int view; + + + //printf("typemap\n"); + + if (!SvROK($input)) + croak("$input is not a reference."); + if (SvTYPE(SvRV($input)) != SVt_PVAV) + croak("$input is not an array."); + + tempav = (AV*)SvRV($input); + len = av_len(tempav); + //printf("typemap len: %i\n",len); + $1 = (int *) malloc((len+1)*sizeof(int)); + for (i = 0; i <= len; i++) { + tv = av_fetch(tempav, i, 0); + $1[i] = (int) SvIV(*tv); + + /* + view = SvIV(*tv); + printf("view: %d",view); + printf("\n"); + */ + } +} + +%apply int *items { int *weights }; +%apply double *OUTPUT { double *min, double *max, double *avg }; + +/* Let's just grab the original header file here */ +%include "CrushWrapper.h" + +%clear double *min, double *max, double *avg; |