/trunk/Examples/test-suite/pointer_in_out.i
Swig | 35 lines | 23 code | 9 blank | 3 comment | 0 complexity | d48c80e53fe7e431d4419c24b37ab0c1 MD5 | raw file
1/* This file tests the pointer-in-out typemap library, 2 currently only available for Guile. */ 3 4%module pointer_in_out 5 6%include "pointer-in-out.i" 7 8TYPEMAP_POINTER_INPUT_OUTPUT(int *, int-pointer); 9 10int consume_int_pointer(int **INPUT); 11void produce_int_pointer(int **OUTPUT, int value1, int value2); 12void frobnicate_int_pointer(int **INOUT); 13 14%{ 15 16int consume_int_pointer(int **INPUT) 17{ 18 return **INPUT; 19} 20 21void produce_int_pointer(int **OUTPUT, int value1, int value2) 22{ 23 int *foo = malloc(2 * sizeof(int)); 24 foo[0] = value1; 25 foo[1] = value2; 26 *OUTPUT = foo; 27} 28 29void frobnicate_int_pointer(int **INOUT) 30{ 31 /* advance the pointer */ 32 (*INOUT)++; 33} 34 35%}