/
usr
/
share
/
swig
/
3.0.12
/
/usr/share/swig/3.0.12
mkdir
upload
Name
Size
Mode
Actions
allegrocl/
-
0755
rm
cffi/
-
0755
rm
chicken/
-
0755
rm
clisp/
-
0755
rm
csharp/
-
0755
rm
d/
-
0755
rm
gcj/
-
0755
rm
go/
-
0755
rm
guile/
-
0755
rm
java/
-
0755
rm
javascript/
-
0755
rm
lua/
-
0755
rm
modula3/
-
0755
rm
mzscheme/
-
0755
rm
ocaml/
-
0755
rm
octave/
-
0755
rm
perl5/
-
0755
rm
php/
-
0755
rm
php5/
-
0755
rm
pike/
-
0755
rm
python/
-
0755
rm
r/
-
0755
rm
ruby/
-
0755
rm
scilab/
-
0755
rm
std/
-
0755
rm
tcl/
-
0755
rm
typemaps/
-
0755
rm
uffi/
-
0755
rm
allkw.swg
803
0644
edit
dl
rm
attribute.i
496
0644
edit
dl
rm
carrays.i
2646
0644
edit
dl
rm
cdata.i
3181
0644
edit
dl
rm
cmalloc.i
2354
0644
edit
dl
rm
constraints.i
7047
0644
edit
dl
rm
cpointer.i
3551
0644
edit
dl
rm
cstring.i
324
0644
edit
dl
rm
cwstring.i
265
0644
edit
dl
rm
director_common.swg
512
0644
edit
dl
rm
exception.i
8254
0644
edit
dl
rm
intrusive_ptr.i
2814
0644
edit
dl
rm
inttypes.i
2380
0644
edit
dl
rm
math.i
2086
0644
edit
dl
rm
pointer.i
294
0644
edit
dl
rm
runtime.swg
1236
0644
edit
dl
rm
shared_ptr.i
2686
0644
edit
dl
rm
stdint.i
2368
0644
edit
dl
rm
std_except.i
2077
0644
edit
dl
rm
stl.i
249
0644
edit
dl
rm
swig.swg
24840
0644
edit
dl
rm
swigarch.i
1580
0644
edit
dl
rm
swigerrors.swg
499
0644
edit
dl
rm
swiginit.swg
7973
0644
edit
dl
rm
swiglabels.swg
3800
0644
edit
dl
rm
swigrun.i
256
0644
edit
dl
rm
swigrun.swg
16662
0644
edit
dl
rm
swigwarn.swg
14291
0644
edit
dl
rm
swigwarnings.swg
7094
0644
edit
dl
rm
wchar.i
309
0644
edit
dl
rm
windows.i
4143
0644
edit
dl
rm
Edit:
/usr/share/swig/3.0.12/cpointer.i
(3551B)
/* ----------------------------------------------------------------------------- * cpointer.i * * SWIG library file containing macros that can be used to manipulate simple * pointer objects. * ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- * %pointer_class(type,name) * * Places a simple proxy around a simple type like 'int', 'float', or whatever. * The proxy provides this interface: * * class type { * public: * type(); * ~type(); * type value(); * void assign(type value); * }; * * Example: * * %pointer_class(int, intp); * * int add(int *x, int *y) { return *x + *y; } * * In python (with proxies) * * >>> a = intp() * >>> a.assign(10) * >>> a.value() * 10 * >>> b = intp() * >>> b.assign(20) * >>> print add(a,b) * 30 * * As a general rule, this macro should not be used on class/structures that * are already defined in the interface. * ----------------------------------------------------------------------------- */ %define %pointer_class(TYPE, NAME) %{ typedef TYPE NAME; %} typedef struct { } NAME; %extend NAME { #ifdef __cplusplus NAME() { return new TYPE(); } ~NAME() { if ($self) delete $self; } #else NAME() { return (TYPE *) calloc(1,sizeof(TYPE)); } ~NAME() { if ($self) free($self); } #endif } %extend NAME { void assign(TYPE value) { *$self = value; } TYPE value() { return *$self; } TYPE * cast() { return $self; } static NAME * frompointer(TYPE *t) { return (NAME *) t; } } %types(NAME = TYPE); %enddef /* ----------------------------------------------------------------------------- * %pointer_functions(type,name) * * Create functions for allocating/deallocating pointers. This can be used * if you don't want to create a proxy class or if the pointer is complex. * * %pointer_functions(int, intp) * * int add(int *x, int *y) { return *x + *y; } * * In python (with proxies) * * >>> a = copy_intp(10) * >>> intp_value(a) * 10 * >>> b = new_intp() * >>> intp_assign(b,20) * >>> print add(a,b) * 30 * >>> delete_intp(a) * >>> delete_intp(b) * * ----------------------------------------------------------------------------- */ %define %pointer_functions(TYPE,NAME) %{ static TYPE *new_##NAME() { %} #ifdef __cplusplus %{ return new TYPE(); %} #else %{ return (TYPE *) calloc(1,sizeof(TYPE)); %} #endif %{} static TYPE *copy_##NAME(TYPE value) { %} #ifdef __cplusplus %{ return new TYPE(value); %} #else %{ TYPE *obj = (TYPE *) calloc(1,sizeof(TYPE)); *obj = value; return obj; %} #endif %{} static void delete_##NAME(TYPE *obj) { %} #ifdef __cplusplus %{ if (obj) delete obj; %} #else %{ if (obj) free(obj); %} #endif %{} static void NAME ##_assign(TYPE *obj, TYPE value) { *obj = value; } static TYPE NAME ##_value(TYPE *obj) { return *obj; } %} TYPE *new_##NAME(); TYPE *copy_##NAME(TYPE value); void delete_##NAME(TYPE *obj); void NAME##_assign(TYPE *obj, TYPE value); TYPE NAME##_value(TYPE *obj); %enddef /* ----------------------------------------------------------------------------- * %pointer_cast(type1,type2,name) * * Generates a pointer casting function. * ----------------------------------------------------------------------------- */ %define %pointer_cast(TYPE1,TYPE2,NAME) %inline %{ TYPE2 NAME(TYPE1 x) { return (TYPE2) x; } %} %enddef
Save
cmd:
run