blob: bdcd7d5e5368caf9114836e6b3cd516e463b4ae0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// Simple tests of overloaded functions
%module overload_simple
#ifndef SWIG_NO_OVERLOAD
%immutable Spam::type;
%inline %{
struct Foo {
};
class Bar {
public:
Bar(int i = 0) {}
static int foo(int a=0, int b=0) {return 0;}
};
char *foo(int) {
return (char*) "foo:int";
}
char *foo(double) {
return (char*) "foo:double";
}
char *foo(char *) {
return (char*) "foo:char *";
}
char *foo(Foo *) {
return (char*) "foo:Foo *";
}
char *foo(Bar *) {
return (char *) "foo:Bar *";
}
char *foo(void *) {
return (char *) "foo:void *";
}
char *blah(double) {
return (char *) "blah:double";
}
char *blah(char *) {
return (char *) "blah:char *";
}
class Spam {
public:
Spam() { type = "none"; }
Spam(int) { type = "int"; }
Spam(double) { type = "double"; }
Spam(char *) { type = "char *"; }
Spam(Foo *) { type = "Foo *"; }
Spam(Bar *) { type = "Bar *"; }
Spam(void *) { type = "void *"; }
const char *type;
char *foo(int) {
return (char*) "foo:int";
}
char *foo(double) {
return (char*) "foo:double";
}
char *foo(char *) {
return (char*) "foo:char *";
}
char *foo(Foo *) {
return (char*) "foo:Foo *";
}
char *foo(Bar *) {
return (char *) "foo:Bar *";
}
char *foo(void *) {
return (char *) "foo:void *";
}
static char *bar(int) {
return (char*) "bar:int";
}
static char *bar(double) {
return (char*) "bar:double";
}
static char *bar(char *) {
return (char*) "bar:char *";
}
static char *bar(Foo *) {
return (char*) "bar:Foo *";
}
static char *bar(Bar *) {
return (char *) "bar:Bar *";
}
static char *bar(void *) {
return (char *) "bar:void *";
}
};
%}
%include cmalloc.i
%malloc(void);
#endif
|