X7ROOT File Manager
Current Path:
/usr/share/swig/2.0.10
usr
/
share
/
swig
/
2.0.10
/
📁
..
📁
allegrocl
📄
allkw.swg
(705 B)
📄
attribute.i
(496 B)
📄
carrays.i
(2.58 KB)
📄
cdata.i
(2.17 KB)
📁
cffi
📁
chicken
📁
clisp
📄
cmalloc.i
(2.3 KB)
📄
constraints.i
(6.88 KB)
📄
cpointer.i
(3.47 KB)
📁
csharp
📄
cstring.i
(324 B)
📄
cwstring.i
(265 B)
📁
d
📄
exception.i
(7.77 KB)
📁
gcj
📁
go
📁
guile
📄
intrusive_ptr.i
(2.75 KB)
📄
inttypes.i
(2.57 KB)
📁
java
📁
lua
📄
math.i
(2.04 KB)
📁
modula3
📁
mzscheme
📁
ocaml
📁
octave
📁
perl5
📁
php
📁
pike
📄
pointer.i
(294 B)
📁
python
📁
r
📁
ruby
📄
runtime.swg
(1.21 KB)
📄
shared_ptr.i
(2.1 KB)
📁
std
📄
std_except.i
(1.95 KB)
📄
stdint.i
(2.31 KB)
📄
stl.i
(249 B)
📄
swig.swg
(23.57 KB)
📄
swigarch.i
(1.54 KB)
📄
swigerrors.swg
(509 B)
📄
swiginit.swg
(7.88 KB)
📄
swiglabels.swg
(3.11 KB)
📄
swigrun.i
(256 B)
📄
swigrun.swg
(16.49 KB)
📄
swigwarn.swg
(13.2 KB)
📄
swigwarnings.swg
(6.83 KB)
📁
tcl
📁
typemaps
📁
uffi
📄
wchar.i
(309 B)
📄
windows.i
(4.05 KB)
Editing: carrays.i
/* ----------------------------------------------------------------------------- * carrays.i * * SWIG library file containing macros that can be used to manipulate simple * pointers as arrays. * ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- * %array_functions(TYPE,NAME) * * Generates functions for creating and accessing elements of a C array * (as pointers). Creates the following functions: * * TYPE *new_NAME(int nelements) * void delete_NAME(TYPE *); * TYPE NAME_getitem(TYPE *, int index); * void NAME_setitem(TYPE *, int index, TYPE value); * * ----------------------------------------------------------------------------- */ %define %array_functions(TYPE,NAME) %{ static TYPE *new_##NAME(int nelements) { %} #ifdef __cplusplus %{ return new TYPE[nelements]; %} #else %{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %} #endif %{} static void delete_##NAME(TYPE *ary) { %} #ifdef __cplusplus %{ delete [] ary; %} #else %{ free(ary); %} #endif %{} static TYPE NAME##_getitem(TYPE *ary, int index) { return ary[index]; } static void NAME##_setitem(TYPE *ary, int index, TYPE value) { ary[index] = value; } %} TYPE *new_##NAME(int nelements); void delete_##NAME(TYPE *ary); TYPE NAME##_getitem(TYPE *ary, int index); void NAME##_setitem(TYPE *ary, int index, TYPE value); %enddef /* ----------------------------------------------------------------------------- * %array_class(TYPE,NAME) * * Generates a class wrapper around a C array. The class has the following * interface: * * struct NAME { * NAME(int nelements); * ~NAME(); * TYPE getitem(int index); * void setitem(int index, TYPE value); * TYPE * cast(); * static NAME *frompointer(TYPE *t); * } * * ----------------------------------------------------------------------------- */ %define %array_class(TYPE,NAME) %{ typedef TYPE NAME; %} typedef struct { /* Put language specific enhancements here */ } NAME; %extend NAME { #ifdef __cplusplus NAME(int nelements) { return new TYPE[nelements]; } ~NAME() { delete [] self; } #else NAME(int nelements) { return (TYPE *) calloc(nelements,sizeof(TYPE)); } ~NAME() { free(self); } #endif TYPE getitem(int index) { return self[index]; } void setitem(int index, TYPE value) { self[index] = value; } TYPE * cast() { return self; } static NAME *frompointer(TYPE *t) { return (NAME *) t; } }; %types(NAME = TYPE); %enddef
Upload File
Create Folder