X7ROOT File Manager
Current Path:
/usr/share/swig/2.0.10/d
usr
/
share
/
swig
/
2.0.10
/
d
/
📁
..
📄
boost_shared_ptr.i
(8.03 KB)
📄
carrays.i
(2.51 KB)
📄
cpointer.i
(3.4 KB)
📄
d.swg
(1.32 KB)
📄
dclassgen.swg
(3.53 KB)
📄
ddirectives.swg
(466 B)
📄
denums.swg
(1.87 KB)
📄
dexception.swg
(1.15 KB)
📄
dhead.swg
(9.59 KB)
📄
director.swg
(1.2 KB)
📄
dkw.swg
(2.36 KB)
📄
dmemberfunctionpointers.swg
(2.67 KB)
📄
doperators.swg
(7.93 KB)
📄
dprimitives.swg
(4.5 KB)
📄
dstrings.swg
(2.51 KB)
📄
dswigtype.swg
(5.09 KB)
📄
dvoid.swg
(559 B)
📄
std_common.i
(102 B)
📄
std_deque.i
(28 B)
📄
std_except.i
(1.86 KB)
📄
std_map.i
(1.7 KB)
📄
std_pair.i
(703 B)
📄
std_shared_ptr.i
(68 B)
📄
std_string.i
(3.04 KB)
📄
std_vector.i
(16.07 KB)
📄
stl.i
(357 B)
📄
typemaps.i
(10.81 KB)
📄
wrapperloader.swg
(7.71 KB)
Editing: carrays.i
/* ----------------------------------------------------------------------------- * carrays.i * * D-specific version of ../carrays.i. * ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- * %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 * ptr(); * static NAME *frompointer(TYPE *t); * } * * ----------------------------------------------------------------------------- */ %define %array_class(TYPE,NAME) %{ typedef TYPE NAME; %} typedef struct {} 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 * ptr() { return self; } static NAME *frompointer(TYPE *t) { return (NAME *) t; } }; %types(NAME = TYPE); %enddef
Upload File
Create Folder