Director: added disown. It now mutates the reference held by the object.

mlheading and mliheading: Added C_director_core, which holds the state needed
by the director to disown.
std_string and std_vector: Added specific support for the common case of
a zero-terminated char **.
typemaps.i: Withdraw default argout for SWIGTYPE &


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4481 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Art Yerkes 2003-03-08 20:14:31 +00:00
commit b6895badf2
7 changed files with 131 additions and 4 deletions

View file

@ -58,5 +58,35 @@ namespace std {
(*self)[i] = x;
}
};
%extend {
T *to_array() {
T *array = new T[self->size() + 1];
array[self->size()] = T();
for( int i = 0; i < self->size(); i++ )
array[i] = (*self)[i];
return array;
}
};
};
};
%insert(ml) %{
let array_to_vector v argcons array =
for i = 0 to (Array.length array) - 1 do
(invoke v) "set" (C_list [ C_int i ; (argcons array.(i)) ])
done ;
v
let vector_to_array v argcons array =
for i = 0; to (get_int ((invoke v) "size" C_void)) - 1 do
array.(i) <- argcons ((invoke v) "[]" (C_int i))
done ;
v
%}
%insert(mli) %{
val array_to_vector : c_obj -> ('a -> c_obj) -> 'a array -> c_obj
val vector_to_array : c_obj -> (c_obj -> 'a) -> 'a array -> c_obj
%}