/
usr
/
share
/
swig
/
3.0.12
/
python
/
/usr/share/swig/3.0.12/python
mkdir
upload
Name
Size
Mode
Actions
argcargv.i
2642
0644
edit
dl
rm
attribute.i
34
0644
edit
dl
rm
boost_shared_ptr.i
16295
0644
edit
dl
rm
builtin.swg
25016
0644
edit
dl
rm
carrays.i
338
0644
edit
dl
rm
ccomplex.i
763
0644
edit
dl
rm
cdata.i
30
0644
edit
dl
rm
cmalloc.i
32
0644
edit
dl
rm
cni.i
42
0644
edit
dl
rm
complex.i
80
0644
edit
dl
rm
cpointer.i
33
0644
edit
dl
rm
cstring.i
32
0644
edit
dl
rm
cwstring.i
60
0644
edit
dl
rm
defarg.swg
1154
0644
edit
dl
rm
director.swg
10638
0644
edit
dl
rm
embed.i
2530
0644
edit
dl
rm
exception.i
139
0644
edit
dl
rm
factory.i
32
0644
edit
dl
rm
file.i
1035
0644
edit
dl
rm
implicit.i
287
0644
edit
dl
rm
jstring.i
1759
0644
edit
dl
rm
pyabc.i
418
0644
edit
dl
rm
pyapi.swg
1339
0644
edit
dl
rm
pybackward.swg
1162
0644
edit
dl
rm
pybuffer.i
2782
0644
edit
dl
rm
pyclasses.swg
3474
0644
edit
dl
rm
pycomplex.swg
2243
0644
edit
dl
rm
pycontainer.swg
29789
0644
edit
dl
rm
pydocs.swg
1104
0644
edit
dl
rm
pyerrors.swg
1689
0644
edit
dl
rm
pyfragments.swg
551
0644
edit
dl
rm
pyhead.swg
5741
0644
edit
dl
rm
pyinit.swg
13525
0644
edit
dl
rm
pyiterators.swg
10650
0644
edit
dl
rm
pymacros.swg
38
0644
edit
dl
rm
pyname_compat.i
4124
0644
edit
dl
rm
pyopers.swg
10223
0644
edit
dl
rm
pyprimtypes.swg
8070
0644
edit
dl
rm
pyrun.swg
53129
0644
edit
dl
rm
pyruntime.swg
795
0644
edit
dl
rm
pystdcommon.swg
7102
0644
edit
dl
rm
pystrings.swg
4422
0644
edit
dl
rm
python.swg
2035
0644
edit
dl
rm
pythonkw.swg
2355
0644
edit
dl
rm
pythreads.swg
2864
0644
edit
dl
rm
pytuplehlp.swg
308
0644
edit
dl
rm
pytypemaps.swg
3208
0644
edit
dl
rm
pyuserdir.swg
6326
0644
edit
dl
rm
pywstrings.swg
2097
0644
edit
dl
rm
std_alloc.i
27
0644
edit
dl
rm
std_array.i
3693
0644
edit
dl
rm
std_auto_ptr.i
585
0644
edit
dl
rm
std_basic_string.i
2817
0644
edit
dl
rm
std_carray.i
1583
0644
edit
dl
rm
std_char_traits.i
33
0644
edit
dl
rm
std_common.i
2319
0644
edit
dl
rm
std_complex.i
469
0644
edit
dl
rm
std_container.i
58
0644
edit
dl
rm
std_deque.i
678
0644
edit
dl
rm
std_except.i
35
0644
edit
dl
rm
std_ios.i
66
0644
edit
dl
rm
std_iostream.i
107
0644
edit
dl
rm
std_list.i
668
0644
edit
dl
rm
std_map.i
9975
0644
edit
dl
rm
std_multimap.i
2578
0644
edit
dl
rm
std_multiset.i
1085
0644
edit
dl
rm
std_pair.i
6167
0644
edit
dl
rm
std_set.i
1490
0644
edit
dl
rm
std_shared_ptr.i
68
0644
edit
dl
rm
std_sstream.i
29
0644
edit
dl
rm
std_streambuf.i
31
0644
edit
dl
rm
std_string.i
35
0644
edit
dl
rm
std_unordered_map.i
8653
0644
edit
dl
rm
std_unordered_multimap.i
3115
0644
edit
dl
rm
std_unordered_multiset.i
1436
0644
edit
dl
rm
std_unordered_set.i
1719
0644
edit
dl
rm
std_vector.i
886
0644
edit
dl
rm
std_vectora.i
829
0644
edit
dl
rm
std_wios.i
26
0644
edit
dl
rm
std_wiostream.i
166
0644
edit
dl
rm
std_wsstream.i
30
0644
edit
dl
rm
std_wstreambuf.i
32
0644
edit
dl
rm
std_wstring.i
63
0644
edit
dl
rm
stl.i
182
0644
edit
dl
rm
typemaps.i
4453
0644
edit
dl
rm
wchar.i
186
0644
edit
dl
rm
Edit:
/usr/share/swig/3.0.12/python/typemaps.i
(4453B)
/* ----------------------------------------------------------------------------- * typemaps.i * * Pointer handling * These mappings provide support for input/output arguments and common * uses for C/C++ pointers. * ----------------------------------------------------------------------------- */ // INPUT typemaps. // These remap a C pointer to be an "INPUT" value which is passed by value // instead of reference. /* The following methods can be applied to turn a pointer into a simple "input" value. That is, instead of passing a pointer to an object, you would use a real value instead. int *INPUT short *INPUT long *INPUT long long *INPUT unsigned int *INPUT unsigned short *INPUT unsigned long *INPUT unsigned long long *INPUT unsigned char *INPUT bool *INPUT float *INPUT double *INPUT To use these, suppose you had a C function like this : double fadd(double *a, double *b) { return *a+*b; } You could wrap it with SWIG as follows : %include <typemaps.i> double fadd(double *INPUT, double *INPUT); or you can use the %apply directive : %include <typemaps.i> %apply double *INPUT { double *a, double *b }; double fadd(double *a, double *b); */ // OUTPUT typemaps. These typemaps are used for parameters that // are output only. The output value is appended to the result as // a list element. /* The following methods can be applied to turn a pointer into an "output" value. When calling a function, no input value would be given for a parameter, but an output value would be returned. In the case of multiple output values, they are returned in the form of a Python tuple. int *OUTPUT short *OUTPUT long *OUTPUT long long *OUTPUT unsigned int *OUTPUT unsigned short *OUTPUT unsigned long *OUTPUT unsigned long long *OUTPUT unsigned char *OUTPUT bool *OUTPUT float *OUTPUT double *OUTPUT For example, suppose you were trying to wrap the modf() function in the C math library which splits x into integral and fractional parts (and returns the integer part in one of its parameters).K: double modf(double x, double *ip); You could wrap it with SWIG as follows : %include <typemaps.i> double modf(double x, double *OUTPUT); or you can use the %apply directive : %include <typemaps.i> %apply double *OUTPUT { double *ip }; double modf(double x, double *ip); The Python output of the function would be a tuple containing both output values. */ // INOUT // Mappings for an argument that is both an input and output // parameter /* The following methods can be applied to make a function parameter both an input and output value. This combines the behavior of both the "INPUT" and "OUTPUT" methods described earlier. Output values are returned in the form of a Python tuple. int *INOUT short *INOUT long *INOUT long long *INOUT unsigned int *INOUT unsigned short *INOUT unsigned long *INOUT unsigned long long *INOUT unsigned char *INOUT bool *INOUT float *INOUT double *INOUT For example, suppose you were trying to wrap the following function : void neg(double *x) { *x = -(*x); } You could wrap it with SWIG as follows : %include <typemaps.i> void neg(double *INOUT); or you can use the %apply directive : %include <typemaps.i> %apply double *INOUT { double *x }; void neg(double *x); Unlike C, this mapping does not directly modify the input value (since this makes no sense in Python). Rather, the modified input value shows up as the return value of the function. Thus, to apply this function to a Python variable you might do this : x = neg(x) Note : previous versions of SWIG used the symbol 'BOTH' to mark input/output arguments. This is still supported, but will be slowly phased out in future releases. */ %include <typemaps/typemaps.swg>
Save
cmd:
run