[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Stub bindings for perl5

From: Sander Roobol <phy_at_wanadoo.nl>
Date: 2003-03-11 15:02:20 CET

Filed as issue #1185.

Sander

On Wed, Jan 29, 2003 at 07:29:51AM -0500, pwd@mdtsoft.com wrote:
>
> This patch adds the stub typemaps for the Perl5 bindings using swig.
>
> I am submitting this patch because I found that in svn_types.i there was
> a typemap that was not limited to python but used python calls. I have
> tested this as best as I can, I generated the python wrapper c-code with
> and without the change and made sure the generated code had no differences
> but I am not a python user. If this patch can be applied and broadly tested
> it will insure that I am doing no harm to the python bindings in developing
> the perl5 ones. I believe that this is the only change to the *.i files that
> will be necessary in the python code. While these interface files will
> generate a perl5 binding it in NOT usable (and you need a Makefile.PL that
> I have not submitted as it is not ready for publication yet).
>
> NOTE:
>
> I will be unable to read e-mail till next week, I have to go to Kokomo IN
> on business and won't have e-mail access.
>
> =============================log message====================================
> This change added just the stub perl5 typemap entries, it will not generate
> a useable perl5 binding for svn but is submitted because of a change in the
> python bindings in svn_types that was needed to allow development of the
> perl5 bindings.
> * svn_types.i
> added python method to the typemap for the generic pools typemap.
> This typemap has python spcific calls in it and must be limited
> to python it swig is to be used for any other language bindings.
> * apr.i, svn_client.i, svn_fs.i, svn_repos.i,
> svn_string.i, svn_types.i, util.i
> (typemaps) Added stub typemap statments for perl5 bindings.
>
> =============================patch==========================================
> Index: svn_types.i
> ===================================================================
> --- svn_types.i (revision 4640)
> +++ svn_types.i (working copy)
> @@ -35,12 +35,17 @@
> $result = t_output_helper($result,
> SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
> }
> +%typemap(perl5, argout) SWIGTYPE **OUTPARAM {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> Create a typemap for specifying string args that may be NULL.
> */
> %typemap(python, in, parse="z") const char *MAY_BE_NULL "";
>
> +/* ### FIXME-perl I need to figure out what is going on with the above typemap */
> +
> /* -----------------------------------------------------------------------
> Define a more refined 'varin' typemap for 'const char *' members. This
> is used in place of the 'char *' handler defined automatically.
> @@ -70,6 +75,9 @@
> Py_INCREF(Py_None);
> $result = Py_None;
> }
> +%typemap(perl5,out) svn_error_t * {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> 'svn_renum_t *' will always be an OUTPUT parameter
> @@ -92,16 +100,22 @@
> /* FIXME: This is just a stub -- implement JNI code! */
> }
>
> +%typemap(perl5, in) (const char *PTR, apr_size_t LEN) {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> Define a generic arginit mapping for pools.
> */
>
> -%typemap(arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
> +%typemap(python, arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
> /* Assume that the pool here is the last argument in the list */
> SWIG_ConvertPtr(PyTuple_GET_ITEM(args, PyTuple_GET_SIZE(args) - 1),
> (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION | 0);
> _global_pool = $1;
> }
> +%typemap(perl5, arginit) apr_pool_t *pool(apr_pool_t *_global_pool) {
> + /* ### FIXME-perl */
> +}
> %typemap(in) apr_pool_t *pool "";
>
> /* -----------------------------------------------------------------------
> Index: svn_string.i
> ===================================================================
> --- svn_string.i (revision 4640)
> +++ svn_string.i (working copy)
> @@ -47,6 +47,9 @@
> return NULL;
> }
>
> +%typemap(perl5,argout) RET_STRING {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> TYPE: svn_stringbuf_t
> */
> @@ -62,9 +65,15 @@
> _global_pool);
> }
>
> +%typemap(perl5,in) svn_stringbuf_t * {
> + /* ### FIXME-perl */
> +}
> %typemap(python,out) svn_stringbuf_t * {
> $result = PyString_FromStringAndSize($1->data, $1->len);
> }
> +%typemap(perl5,out) svn_stringbuf_t * {
> + /* ### FIXME-perl */
> +}
>
> /* svn_stringbuf_t ** is always an output parameter */
> %typemap(in,numinputs=0) svn_stringbuf_t ** (svn_stringbuf_t *temp) {
> @@ -91,16 +100,25 @@
> $1 = &value;
> }
> }
> +%typemap(perl5,in) const svn_string_t * (svn_string_t value) {
> + /* ### FIXME-perl */
> +}
>
> /* when storing an svn_string_t* into a structure, we must allocate the
> svn_string_t structure on the heap. */
> %typemap(python,memberin) const svn_string_t * {
> $1 = svn_string_dup($input, _global_pool);
> }
> +%typemap(perl5,memberin) const svn_string_t * {
> + /* ### FIXME-perl */
> +}
>
> %typemap(python,out) svn_string_t * {
> $result = PyString_FromStringAndSize($1->data, $1->len);
> }
> +%typemap(perl5,out) svn_string_t * {
> + /* ### FIXME-perl */
> +}
>
> /* svn_string_t ** is always an output parameter */
> %typemap(in,numinputs=0) svn_string_t ** (svn_string_t *temp) {
> @@ -118,6 +136,7 @@
> %typemap(python) const char **OUTPUT (const char *temp) {
> $1 = (char **)&temp;
> }
> +/* ### FIXME-perl I need to figure out what a typemap with a member of just python does*/
> %typemap(python,argout,fragment="t_output_helper") const char **OUTPUT {
> PyObject *s;
> if (*$1 == NULL) {
> @@ -132,6 +151,9 @@
> $result = t_output_helper($result, s);
> }
>
> +%typemap(perl5,argout) const char **OUTPUT {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> define a general INPUT param of an array of svn_stringbuf_t* items.
> */
> @@ -145,5 +167,8 @@
> %typemap(java,in) const apr_array_header_t *STRINGLIST {
> /* FIXME: This is just a stub -- implement JNI code! */
> }
> +%typemap(perl5,in) const apr_array_header_t *STRINGLIST {
> + /* ### FIXME-perl */
> +}
>
> /* ----------------------------------------------------------------------- */
> Index: svn_fs.i
> ===================================================================
> --- svn_fs.i (revision 4640)
> +++ svn_fs.i (working copy)
> @@ -80,6 +80,9 @@
> $result = t_output_helper($result, svn_swig_py_array_to_list(*$1));
> }
>
> +%typemap(perl5, argout) apr_array_header_t **names_p {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> revisions_changed's "apr_array_header_t **" is returning a list of
> revs. also, its input array is a list of strings.
> @@ -89,6 +92,9 @@
> apr_array_header_t **revs {
> $result = t_output_helper($result, svn_swig_py_revarray_to_list(*$1));
> }
> +%typemap(perl5, argout) apr_array_header_t **revs {
> + /* ### FIXME-perl */
> +}
> %apply const apr_array_header_t *STRINGLIST {
> const apr_array_header_t *paths
> };
> @@ -109,6 +115,9 @@
> $result,
> svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_dirent_t));
> }
> +%typemap(perl5,argout) apr_hash_t **entries_p {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> and except for svn_fs_paths_changed, which returns svn_fs_path_change_t
> @@ -122,6 +131,9 @@
> svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_path_change_t));
> }
>
> +%typemap(perl5, argout) apr_hash_t **changed_paths_p {
> + /* ### FIXME-perl */
> +}
> /* ----------------------------------------------------------------------- */
>
>
> Index: svn_client.i
> ===================================================================
> --- svn_client.i (revision 4640)
> +++ svn_client.i (working copy)
> @@ -91,6 +91,9 @@
> $result,
> svn_swig_java_convert_hash(*$1, SWIGTYPE_p_svn_wc_status_t));
> }
> +%typemap(perl5,argout) apr_hash_t **statushash {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> handle svn_wc_notify_func_t/baton pairs
> @@ -102,6 +105,9 @@
> $2 = $input; /* our function is the baton. */
> }
>
> +%typemap(perl5,in) (svn_wc_notify_func_t notify_func, void *notify_baton) {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> handle svn_client_get_commit_log_t/baton pairs
> */
> @@ -113,6 +119,11 @@
> $2 = $input; /* our function is the baton. */
> }
>
> +%typemap(perl5,in) (svn_client_get_commit_log_t log_msg_func,
> + void *log_msg_baton) {
> + /* ### FIXME-perl */
> +}
> +
> /* -----------------------------------------------------------------------
> handle the "statushash" OUTPUT param for svn_client_status()
> */
> @@ -123,6 +134,9 @@
> svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_wc_status_t));
> }
>
> +%typemap(perl5,argout) apr_hash_t **statushash {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> fix up the return hash for svn_client_ls()
> */
> @@ -133,6 +147,9 @@
> $result,
> svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_dirent_t));
> }
> +%typemap(perl5,argout) apr_hash_t **dirents {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> We use 'svn_wc_status_t *' in some custom code, but it isn't in the
> Index: util.i
> ===================================================================
> --- util.i (revision 4640)
> +++ util.i (working copy)
> @@ -109,6 +109,9 @@
> $1 = malloc(temp);
> $2 = ($2_ltype)&temp;
> }
> +%typemap(perl5, in) (char *buffer, apr_size_t *len) ($*2_type temp) {
> + /* ### FIXME-perl */
> +}
>
> /* ### need to use freearg or somesuch to ensure the string is freed.
> ### watch out for 'return' anywhere in the binding code. */
> @@ -117,6 +120,9 @@
> $result = t_output_helper($result, PyString_FromStringAndSize($1, *$2));
> free($1);
> }
> +%typemap(perl5, argout) (char *buffer, apr_size_t *len) {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> fix up the svn_stream_write() ptr/len arguments
> @@ -131,11 +137,17 @@
> temp = PyString_GET_SIZE($input);
> $2 = ($2_ltype)&temp;
> }
> +%typemap(perl5, in) (const char *data, apr_size_t *len) ($*2_type temp) {
> + /* ### FIXME-perl */
> +}
>
> %typemap(python, argout, fragment="t_output_helper") (const char *data, apr_size_t *len) {
> $result = t_output_helper($result, PyInt_FromLong(*$2));
> }
>
> +%typemap(perl5, argout, fragment="t_output_helper") (const char *data, apr_size_t *len) {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> describe how to pass a FILE* as a parameter (svn_stream_from_stdio)
> */
> @@ -146,6 +158,9 @@
> return NULL;
> }
> }
> +%typemap(perl5, in) FILE * {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> the second argument to svn_parse_date is unused: always pass NULL
> Index: svn_repos.i
> ===================================================================
> --- svn_repos.i (revision 4640)
> +++ svn_repos.i (working copy)
> @@ -48,6 +48,10 @@
> $1 = svn_swig_py_thunk_log_receiver;
> $2 = (void *)$input;
> }
> +%typemap(perl5, in) (svn_log_message_receiver_t receiver,
> + void *receiver_baton) {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> handle the 'paths' parameter appropriately
> Index: apr.i
> ===================================================================
> --- apr.i (revision 4640)
> +++ apr.i (working copy)
> @@ -40,6 +40,10 @@
> /* ### FIXME */
> }
>
> +%typemap(perl5,argout) apr_off_t * {
> + /* ### FIXME-perl */
> +}
> +
> /* ----------------------------------------------------------------------- */
>
> %include apr.h
> @@ -81,6 +85,9 @@
> $result = t_output_helper($result, JCALL1(NewGlobalRef, jenv, l));
> }
>
> +%typemap(perl5,argout) apr_time_t * {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> create some INOUT typemaps for apr_size_t
> */
> @@ -98,6 +105,9 @@
> $1 = &temp;
> }
>
> +%typemap(perl5,in) apr_size_t *INOUT (apr_size_t temp) {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> create an OUTPUT argument typemap for an apr_hash_t **
> */
> @@ -123,6 +133,9 @@
> svn_swig_java_prophash_to_dict(jenv, *$1));
> }
>
> +%typemap(perl5,argout) apr_hash_t **PROPHASH {
> + /* ### FIXME-perl */
> +}
> /* -----------------------------------------------------------------------
> handle apr_file_t *
> */
> @@ -130,6 +143,9 @@
> %typemap(python, in) apr_file_t * {
> $1 = svn_swig_py_make_file($input, _global_pool);
> }
> +%typemap(perl5, in) apr_file_t * {
> + /* ### FIXME-perl */
> +}
>
> /* -----------------------------------------------------------------------
> apr_file_t ** is always an OUT param
> @@ -151,4 +167,7 @@
> SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
> }
>
> +%typemap(perl5,argout) apr_file_t ** {
> + /* ### FIXME-perl */
> +}
> /* ----------------------------------------------------------------------- */
> =============================end============================================
> --
> It is MDT, Inc's policy to delete mail containing unsolicited file attachments.
> Please be sure to contact the MDT staff member BEFORE sending an e-mail with
> any file attachments; they will be able to arrange for the files to be received.
>
> This email, and any files transmitted with it, is confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error, please advise postmaster@mdtsoft.com
> <mailto:postmaster@mdtsoft.com>.
>
> Philip W. Dalrymple III <pwd@mdtsoft.com>
> MDT Software - The Change Management Company
> +1 678 297 1001
> Fax +1 678 297 1003
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 11 15:02:12 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.