1 /* File : CrushWrapper.i */
4 #include "CrushWrapper.h"
9 // This tells SWIG to treat 'int *data' as a special case
10 %typemap(in) int *items {
18 //printf("typemap\n");
21 croak("$input is not a reference.");
22 if (SvTYPE(SvRV($input)) != SVt_PVAV)
23 croak("$input is not an array.");
25 tempav = (AV*)SvRV($input);
27 //printf("typemap len: %i\n",len);
28 $1 = (int *) malloc((len+1)*sizeof(int));
29 for (i = 0; i <= len; i++) {
30 tv = av_fetch(tempav, i, 0);
31 $1[i] = (int) SvIV(*tv);
35 printf("view: %d",view);
41 %apply int *items { int *weights };
42 %apply double *OUTPUT { double *min, double *max, double *avg };
44 /* Let's just grab the original header file here */
45 %include "CrushWrapper.h"
47 %clear double *min, double *max, double *avg;