import source from 1.3.40
[external/swig.git] / Examples / test-suite / multivalue.i
1 /* -*- c -*- */
2
3 %module multivalue
4
5 #ifdef SWIGGUILE
6
7 /* Multiple values as lists. By default, if more than one value is to
8 be returned, a list of the values is created and returned; to switch
9 back to this behavior, use: */
10 %values_as_list; 
11
12 void divide_l(int a, int b, int *OUTPUT, int *OUTPUT);
13
14 /* Multiple values as vectors. By issueing: */
15 %values_as_vector;
16 /* vectors instead of lists will be used. */
17
18 void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
19
20 /* Multiple values for multiple-value continuations.
21    (This is the most elegant way.)  By issueing: */
22 %multiple_values;
23 /* multiple values are passed to the multiple-value
24    continuation, as created by `call-with-values' or the
25    convenience macro `receive'. (See the Scheme file.) */
26
27 void divide_mv(int a, int b, int *OUTPUT, int *OUTPUT);
28
29 #endif
30
31 %{
32
33 void divide_l(int a, int b, int *quotient_p, int *remainder_p)
34 {
35   *quotient_p = a/b;
36   *remainder_p = a%b;
37 }
38
39 void divide_v(int a, int b, int *quotient_p, int *remainder_p)
40 {
41   *quotient_p = a/b;
42   *remainder_p = a%b;
43 }
44
45 void divide_mv(int a, int b, int *quotient_p, int *remainder_p)
46 {
47   *quotient_p = a/b;
48   *remainder_p = a%b;
49 }
50
51 %}
52