| Filename | Latest commit message | Latest commit date |
|---|---|---|
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.
std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...
Lib/python/pystdcommon.swg:
template <> struct traits_info<void *> {
static swig_type_info *type_info() {
static swig_type_info *info = 0;
}
};
Lib/std/std_common.i:
template <>
struct traits_asptr<void *> {
static int asptr(PyObject *obj, void ***val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
// this is needed, but am not sure this is expected
template <>
struct traits_asptr<void> {
static int asptr(PyObject *obj, void **val) {
void **p;
swig_type_info *descriptor = 0;
int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
|
||
| .. | ||
| attribute.swg | ||
| carrays.swg | ||
| cdata.swg | ||
| cmalloc.swg | ||
| cpointer.swg | ||
| cstring.swg | ||
| cstrings.swg | ||
| cwstring.swg | ||
| enumint.swg | ||
| exception.swg | ||
| factory.swg | ||
| fragments.swg | ||
| implicit.swg | ||
| inoutlist.swg | ||
| misctypes.swg | ||
| primtypes.swg | ||
| ptrtypes.swg | ||
| README | ||
| std_except.swg | ||
| std_string.swg | ||
| std_strings.swg | ||
| std_wstring.swg | ||
| string.swg | ||
| strings.swg | ||
| swigmacros.swg | ||
| swigobject.swg | ||
| swigtype.swg | ||
| swigtypemaps.swg | ||
| typemaps.swg | ||
| valtypes.swg | ||
| void.swg | ||
| wstring.swg | ||
Still in development, but if you are interested into looking around,
start with
swigtypemaps.swg
which is the head file. Also read the docs for %fragments in
fragments.swg
and follow the definitions in one of the supported languages:
python, perl, ruby, tcl
/* -----------------------------------------------------------------------------
* Internal typemap specializations
* ----------------------------------------------------------------------------- */
carrays.swg Implement the carrays.i library
cdata.swg Implement the cdata.i library
cmalloc.swg Implement the cmalloc.i library
cpointer.swg Implement the cpointer.i library
cstring.swg Implement the cstring.i library typemaps for char *
cwstring.swg Implement the cstring.i library typemaps for wchar_t *
exception.swg Implement the exception.i library
implicit.swg Allow the use of implicit C++ constructors
string.swg Typemaps for char * string
wstring.swg Typemaps for wchar_t * string
std_string.swg Typemaps for std::string
std_wstring.swg Typemaps for std::wstring
swigtype.swg Typemaps for the SWIGTYPE type
void.swg Typemaps for the 'void' type
enumint.swg Typemaps for enums treated as 'int'
swigobject.swg Typemaps for the SWIG_Object as in PyObject, Tcl_Obj, etc.
misctypes.swg Typemaps for miscellaneos types (size_t, ptrdiff_t, etc)
ptrtypes.swg Typemaps for types with a 'ptr' behavior
valtypes.swg Typemaps for 'by value' types
inoutlist.swg IN/OUTPUT/INOUT typemaps, where the OUTPUT values are returned in a list
primtypes.swg Common macros to manage primitive types (short,int,double,etc)
cstrings.swg Common macros to implemented the cstring/cwstring libraries
std_strings.swg Common macros to implemented the std::string/std::wstring typemaps
strings.swg Common macros and typemaps for string and wstring (char *, wchar_t *)
swigmacros.swg Basic macros
fragments.swg Macros for fragment manipulations
typemaps.swg The old typemaps.i library, not needed anymore