+ rewrote C interface for SWIG/Python
[qpalma.git] / QPalmaDP / QPalmaDP.i
1 %module QPalmaDP
2 %{
3 #include "common.h"
4 #include "Mathmatics.h"
5 #include "penalty_info.h"
6 #include "qpalma_dp.h"
7 %}
8
9 %include "std_vector.i"
10 %include "std_string.i"
11
12 %include "carrays.i"
13
14 %include "common.h"
15 %include "Mathmatics.h"
16 %include "penalty_info.h"
17 %include "qpalma_dp.h"
18
19 %array_functions(int, intArray) ;
20 %array_functions(double, doubleArray) ;
21 %array_class(Pre_score, Pre_scoreArray) ;
22
23 %pythoncode
24 %{
25
26 def createDoubleArrayFromList(list):
27 array = new_doubleArray(len(list))
28 for i in range(len(list)):
29 doubleArray_setitem(array, i, list[i])
30 return array
31
32 def createIntArrayFromList(list):
33 array = new_intArray(len(list))
34 for i in range(len(list)):
35 intArray_setitem(array, i, list[i])
36 return array
37
38 def createListFromIntArray(array, array_len):
39 list = [0]*array_len
40 for i in range(array_len):
41 list[i] = intArray_getitem(array,i)
42 return list
43
44 def createListFromDoubleArray(array, array_len):
45 list = [0]*array_len
46 for i in range(array_len):
47 list[i] = doubleArray_getitem(array,i)
48 return list
49
50 %}
51