blob: d5e66763d5af22073df89fa2995f9a5fbb7cfe29 [file] [log] [blame]
/*
* svn_types.i : SWIG interface file for svn_types.h
*
* ====================================================================
* Copyright (c) 2000-2002 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* ====================================================================
*/
/* This interface file only defines types and their related information.
There is no module associated with this interface file. */
%import apr.i
/* -----------------------------------------------------------------------
Create a typemap to define "type **" as OUT parameters.
Note: SWIGTYPE is just a placeholder for "some arbitrary type". This
typemap will be applied onto a "real" type.
*/
%typemap(ignore) SWIGTYPE **OUTPARAM ($*1_type temp) {
$1 = ($1_ltype)&temp;
}
%typemap(python, argout) SWIGTYPE **OUTPARAM {
$result = t_output_helper($result,
SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
}
/* -----------------------------------------------------------------------
Define a more refined 'varin' typemap for 'const char *' members. This
is used in place of the 'char *' handler defined automatically.
We need to do the free/malloc/strcpy special because of the const
*/
%typemap(memberin) const char * {
apr_size_t len = strlen($input) + 1;
char *copied;
if ($1) free((char *)$1);
copied = malloc(len);
memcpy(copied, $input, len);
$1 = copied;
}
/* ----------------------------------------------------------------------- */
%typemap(python,out) svn_error_t * {
if ($1 != NULL) {
PyErr_SetString(PyExc_RuntimeError,
$1->message ? $1->message : "unknown error");
return NULL;
}
Py_INCREF(Py_None);
$result = Py_None;
}
/* -----------------------------------------------------------------------
'svn_renum_t *' will always be an OUTPUT parameter
*/
// ### for now, disable this. it interferes with 'svn_fs_id_t *' params
// ### awaiting some swig fixes.
//%apply long *OUTPUT { svn_revnum_t * };
/* -----------------------------------------------------------------------
Define a general ptr/len typemap. This takes a single script argument
and expands it into a ptr/len pair for the native call.
*/
%typemap(python, in) (const char *PTR, apr_size_t LEN) {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "expecting a string");
return NULL;
}
$1 = PyString_AS_STRING($input);
$2 = PyString_GET_SIZE($input);
}
/* ----------------------------------------------------------------------- */
%include svn_types.h