2 * ====================================================================
3 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
5 * This software is licensed as described in the file COPYING, which
6 * you should have received as part of this distribution. The terms
7 * are also available at http://subversion.tigris.org/license-1.html.
8 * If newer versions of this license are posted there, you may use a
9 * newer version instead, at your option.
11 * This software consists of voluntary contributions made by many
12 * individuals. For exact contribution history, see the revision
13 * history and logs, available at http://subversion.tigris.org/.
14 * ====================================================================
16 * svn_containers.swg: This is a child file of svn_types.swg, and
17 * should not be included directly. This file contains typemaps
18 * that deal with "container" data types (e.g. apr_hash_t,
19 * apr_array_header_t, etc.).
22 /* =======================================================================
23 %typemap(argout) apr_hash_t **
27 %define %hash_argout_typemap(ParamName, ValueType)
28 %typemap(argout) apr_hash_t **ParamName {
29 %append_output(svn_swig_py_convert_hash(*$1,
30 $descriptor(ValueType),
36 %define %hash_argout_typemap(ParamName, ValueType)
37 %typemap(argout) apr_hash_t **ParamName {
38 %append_output(svn_swig_pl_convert_hash(*$1, $descriptor(ValueType)));
43 %define %hash_argout_typemap(ParamName, ValueType)
44 %typemap(argout) apr_hash_t **ParamName {
45 %append_output(svn_swig_rb_apr_hash_to_hash_swig_type(*$1,
51 %hash_argout_typemap(dirents, svn_dirent_t *)
52 %hash_argout_typemap(locks, svn_lock_t *)
54 /* FIXME: We are effectively treating this hash as an opaque blob...
55 this is because we currently do not have suitable typemaps to convert
56 it back to an apr_hash_t * for use. */
57 %typemap(argout) apr_hash_t **cfg_hash {
58 %append_output(svn_swig_NewPointerObj(*$1, $descriptor(apr_hash_t *),
59 _global_py_pool, args));
62 %hash_argout_typemap(cfg_hash, svn_config_t *)
65 /* -----------------------------------------------------------------------
66 Output of apr_hash_t * <const char *, svn_string_t *>
67 (commonly used for property name and value pairs)
71 %typemap(argout) apr_hash_t **HASH_SVN_STRING {
72 %append_output(svn_swig_py_prophash_to_dict(*$1));
74 %typemap(argout) apr_hash_t **HASH_SVN_STRING_MAYBENULL {
75 %append_output(!*$1 ? Py_None : svn_swig_py_prophash_to_dict(*$1));
79 %typemap(argout) apr_hash_t **HASH_SVN_STRING {
80 %append_output(svn_swig_pl_prophash_to_hash(*$1));
82 %typemap(argout) apr_hash_t **HASH_SVN_STRING_MAYBENULL {
83 %append_output(!*$1 ? &PL_sv_undef : svn_swig_pl_prophash_to_hash(*$1));
87 %typemap(argout) apr_hash_t **HASH_SVN_STRING {
88 %append_output(svn_swig_rb_apr_hash_to_hash_svn_string(*$1));
90 %typemap(argout) apr_hash_t **HASH_SVN_STRING_MAYBENULL {
91 %append_output(!*$1 ? Qnil : svn_swig_rb_apr_hash_to_hash_svn_string(*$1));
94 %apply apr_hash_t **HASH_SVN_STRING {
96 apr_hash_t **original_props,
99 %apply apr_hash_t **HASH_SVN_STRING_MAYBENULL {
100 /* svn_config_read_auth_data() */
105 /* -----------------------------------------------------------------------
106 Output of apr_hash_t * <const char *, const char *>
110 %typemap(argout) apr_hash_t **HASH_CSTRING {
111 %append_output(svn_swig_rb_apr_hash_to_hash_string(*$1));
116 /* -----------------------------------------------------------------------
117 apr_hash_t **locations
118 svn_repos_trace_node_locations()
119 svn_ra_get_locations()
123 %typemap(argout) apr_hash_t **locations {
124 %append_output(svn_swig_py_locationhash_to_dict(*$1));
128 %typemap(argout) apr_hash_t **locations
130 %append_output(svn_swig_rb_apr_revnum_key_hash_to_hash_string(*$1));
134 /* -----------------------------------------------------------------------
135 apr_hash_t **externals_old
136 apr_hash_t **externals_new
137 svn_wc_edited_externals()
141 %typemap(argout) apr_hash_t **externals_old, apr_hash_t **externals_new {
142 %append_output(svn_swig_rb_apr_hash_to_hash_string(*$1));
147 /* =======================================================================
148 %typemap(in) apr_hash_t *
151 /* -----------------------------------------------------------------------
152 Input of apr_hash_t * <const char *, svn_string_t *>
153 (commonly used for property name and value pairs)
157 %typemap(in) apr_hash_t *PROPHASH
158 (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
160 if (_global_pool == NULL)
162 if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
163 &_global_py_pool, &_global_pool))
167 $1 = svn_swig_py_prophash_from_dict($input, _global_pool);
168 if (PyErr_Occurred()) {
173 %typemap(out) apr_hash_t *PROPHASH
175 %append_output(svn_swig_py_prophash_to_dict($1));
180 %typemap(in) apr_hash_t *changed_paths
181 (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
183 if (_global_pool == NULL)
185 if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
186 &_global_py_pool, &_global_pool))
190 $1 = svn_swig_py_changed_path_hash_from_dict($input, _global_pool);
191 if (PyErr_Occurred()) {
195 %typemap(out) apr_hash_t *changed_paths
197 %append_output(svn_swig_py_changed_path_hash_to_dict($1));
202 %typemap(in) apr_hash_t *PROPHASH
204 VALUE rb_pool = Qnil;
206 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &_global_pool);
207 svn_swig_rb_push_pool(rb_pool);
209 $1 = svn_swig_rb_hash_to_apr_hash_svn_string($input, _global_pool);
211 if (!NIL_P(rb_pool)) {
213 svn_swig_rb_destroy_pool(rb_pool);
215 svn_swig_rb_set_pool_for_no_swig_type($input, rb_pool);
217 svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
222 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
223 %apply apr_hash_t *PROPHASH {
224 apr_hash_t *target_props,
225 apr_hash_t *source_props,
228 apr_hash_t *revprop_table,
233 /* -----------------------------------------------------------------------
234 Input of scripting hash/dictionary (string => string)
235 converted to apr_hash_t (const char * => const char *)
238 %typemap(in) apr_hash_t *HASH_CSTRING {
239 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
241 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
242 /* PYTHON-FIXME: Handle None -> NULL. */
243 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
247 %typemap(in) apr_hash_t *HASH_CSTRING {
248 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
250 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
251 /* PERL-FIXME: Handle undef -> NULL. */
252 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
256 %typemap(in) apr_hash_t *HASH_CSTRING {
257 $1 = svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
259 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
260 VALUE rb_pool = Qnil;
262 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &_global_pool);
263 svn_swig_rb_push_pool(rb_pool);
265 $1 = (NIL_P($input)) ? NULL :
266 svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
268 if (!NIL_P(rb_pool)) {
270 svn_swig_rb_destroy_pool(rb_pool);
272 svn_swig_rb_set_pool_for_no_swig_type($input, rb_pool);
274 svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
278 %typemap(out) apr_hash_t *HASH_CSTRING_MAYBENULL {
279 $result = $1 ? svn_swig_rb_apr_hash_to_hash_string($1) : Qnil;
283 %apply apr_hash_t *HASH_CSTRING {
284 apr_hash_t *path_tokens
286 %apply apr_hash_t *HASH_CSTRING_MAYBENULL {
287 apr_hash_t *fs_config,
288 apr_hash_t *lock_tokens
291 /* -----------------------------------------------------------------------
292 handle config and fs_config in svn_{fs,repos}_create
296 %typemap(in) apr_hash_t *config {
297 $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *",
302 %typemap(in) apr_hash_t *config
307 $1 = svn_swig_rb_hash_to_apr_hash_swig_type($input, "svn_config_t *", _global_pool);
313 %typemap(in) apr_hash_t *path_revs
315 $1 = svn_swig_rb_hash_to_apr_hash_revnum($input, _global_pool);
320 %typemap(in) apr_hash_t *path_revs
322 $1 = svn_swig_py_path_revs_hash_from_dict($input, _global_pool);
326 /* =======================================================================
327 %typemap(argout) apr_array_header_t **
330 /* -----------------------------------------------------------------------
331 Output of apr_array_header_t * <svn_prop_t *>
334 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
335 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop(*$1));
338 %apply apr_array_header_t **OUTPUT_OF_PROP {
339 apr_array_header_t **entry_props,
340 apr_array_header_t **wc_props,
341 apr_array_header_t **regular_props,
342 apr_array_header_t **propdiffs
347 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
348 %append_output(svn_swig_py_proparray_to_dict(*$1));
352 /* -----------------------------------------------------------------------
353 Output of apr_array_header_t * <const char *>
357 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
358 %append_output(svn_swig_py_array_to_list(*$1));
362 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
363 %append_output(svn_swig_pl_array_to_list(*$1));
367 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
368 %append_output(svn_swig_rb_apr_array_to_array_string(*$1));
372 %apply apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
373 apr_array_header_t **patterns,
374 apr_array_header_t **logfiles,
375 apr_array_header_t **names_p
378 /* -----------------------------------------------------------------------
379 apr_array_header_t **externals_p
380 svn_wc_parse_externals_description3()
384 %typemap(argout) apr_array_header_t **externals_p {
385 %append_output(svn_swig_rb_apr_array_to_array_external_item2(*$1));
389 /* svn_client_update3/svn_client_update2 */
391 %typemap(argout) apr_array_header_t **result_revs {
392 %append_output(svn_swig_py_revarray_to_list(*$1));
393 if (PyErr_Occurred()) {
400 %typemap(argout) apr_array_header_t **result_revs {
401 %append_output(svn_swig_rb_apr_array_to_array_svn_rev(*$1));
405 /* =======================================================================
406 %typemap(in) apr_array_header_t *
409 /* -----------------------------------------------------------------------
410 apr_array_header_t *location_revisions
411 svn_repos_trace_node_locations()
412 svn_ra_get_locations()
416 %typemap(in) apr_array_header_t *location_revisions {
417 $1 = (apr_array_header_t *) svn_swig_py_revnums_to_array($input,
424 %typemap(in) apr_array_header_t *location_revisions {
425 $1 = svn_swig_rb_array_to_apr_array_revnum($input, _global_pool);
429 /* -----------------------------------------------------------------------
430 define a general INPUT param of an array of const char * items.
434 %typemap(in) const apr_array_header_t *STRINGLIST {
435 $1 = (apr_array_header_t *) svn_swig_py_strings_to_array($input,
437 if (PyErr_Occurred())
440 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
441 $1 = ($input == Py_None)
443 : (apr_array_header_t *)svn_swig_py_strings_to_array($input,
445 if (PyErr_Occurred())
450 %typemap(in) const apr_array_header_t *STRINGLIST {
451 $1 = (apr_array_header_t *) svn_swig_pl_strings_to_array($input,
456 %typemap(in) const apr_array_header_t *STRINGLIST {
457 $1 = svn_swig_rb_strings_to_apr_array($input, _global_pool);
459 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
460 $1 = (NIL_P($input)) ? NULL :
461 svn_swig_rb_strings_to_apr_array($input, _global_pool);
465 /* svn_delta_path_driver() mutates its 'paths' argument (by sorting it),
466 despite the fact that it is notionally an input parameter - hence, the
467 lack of 'const' in that one case.
469 svn_wc_get_update_editor3() and svn_wc_get_switch_editor3() aren't changing
470 their 'preserved_exts' argument, but it is forwarded to
471 svn_cstring_match_glob_list which also doesn't modify it, but does not have
472 const in its prototype. */
473 %apply const apr_array_header_t *STRINGLIST {
474 const apr_array_header_t *args,
475 const apr_array_header_t *diff_options,
476 apr_array_header_t *paths,
477 apr_array_header_t *revprops,
478 const apr_array_header_t *targets,
479 apr_array_header_t *preserved_exts
482 /* -----------------------------------------------------------------------
483 auth provider convertors
486 %typemap(in) apr_array_header_t *providers {
487 $1 = (apr_array_header_t *) svn_swig_pl_objs_to_array($input,
488 $descriptor(svn_auth_provider_object_t *), _global_pool);
493 %typemap(in) apr_array_header_t *providers {
494 svn_auth_provider_object_t *provider;
496 if (!PySequence_Check($input)) {
497 PyErr_SetString(PyExc_TypeError, "not a sequence");
500 targlen = PySequence_Length($input);
501 $1 = apr_array_make(_global_pool, targlen, sizeof(provider));
502 ($1)->nelts = targlen;
504 provider = svn_swig_MustGetPtr(PySequence_GetItem($input, targlen),
505 $descriptor(svn_auth_provider_object_t *), $svn_argnum);
506 if (PyErr_Occurred()) {
509 APR_ARRAY_IDX($1, targlen, svn_auth_provider_object_t *) = provider;
515 %typemap(in) apr_array_header_t *providers
517 $1 = svn_swig_rb_array_to_auth_provider_object_apr_array($input, _global_pool);
521 /* -----------------------------------------------------------------------
522 An array of svn_prop_t.
526 %typemap(in) apr_array_header_t *ROW_PROP_LIST
528 $1 = svn_swig_rb_to_apr_array_row_prop($input, _global_pool);
531 %apply apr_array_header_t *ROW_PROP_LIST {
532 apr_array_header_t *proplist
536 /* -----------------------------------------------------------------------
537 An array of svn_prop_t *.
541 %typemap(in) apr_array_header_t *PROP_LIST
546 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
548 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
551 %typemap(out) apr_array_header_t *PROP_LIST
553 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop($1));
556 %typemap(in) apr_array_header_t *PROP_LIST_MAY_BE_NULL
564 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
565 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
569 %typemap(out) apr_array_header_t *PROP_LIST_MAY_BE_NULL
571 %append_output($1 ? svn_swig_rb_prop_apr_array_to_hash_prop($1) : Qnil);
574 %apply apr_array_header_t *PROP_LIST {
575 apr_array_header_t *wcprop_changes,
576 apr_array_header_t *propchanges
579 %apply apr_array_header_t *PROP_LIST_MAY_BE_NULL {
580 apr_array_header_t *incoming_prop_changes,
581 apr_array_header_t *outgoing_prop_changes,
582 apr_array_header_t *merge_options
587 /* -----------------------------------------------------------------------
588 Input of apr_array_header_t * <svn_merge_range_t *>
591 %typemap(in) apr_array_header_t *RANGELIST {
592 $1 = svn_swig_py_rangelist_to_array($input, _global_pool);
593 if (PyErr_Occurred()) {
600 %typemap(in) apr_array_header_t *RANGELIST {
601 $1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
605 /* -----------------------------------------------------------------------
606 Input of apr_array_header_t * <svn_client_copy_source_t *>
609 %typemap(in) apr_array_header_t *SOURCES {
610 $1 = svn_swig_rb_array_to_apr_array_copy_source($input, _global_pool);
614 /* -----------------------------------------------------------------------
615 Input of apr_array_header_t * <svn_opt_revision_range_t *>
618 %typemap(in) apr_array_header_t *REVISION_RANGE_LIST {
619 $1 = svn_swig_rb_array_to_apr_array_revision_range($input, _global_pool);
623 /* -----------------------------------------------------------------------
625 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
628 %typemap(in) apr_hash_t *MERGEINFO {
629 $1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
630 if (PyErr_Occurred()) {
637 %typemap(in) apr_hash_t *MERGEINFO {
638 $1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
642 /* -----------------------------------------------------------------------
644 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
647 %typemap(argout) apr_hash_t **MERGEINFO
650 (svn_swig_py_mergeinfo_to_dict(*$1, $descriptor(svn_merge_range_t *),
653 if (PyErr_Occurred()) {
658 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
661 *$1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
662 if (PyErr_Occurred()) {
669 %typemap(argout) apr_hash_t **MERGEINFO
671 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range(*$1));
674 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
677 *$1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
681 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
682 %typemap(argout) apr_hash_t **MERGEINFO_INOUT = apr_hash_t **MERGEINFO;
685 /* -----------------------------------------------------------------------
687 apr_hash_t * <const char *,
688 apr_hash_t * <const char *,
689 array_header_t * <svn_merge_range_t *>>>
692 %typemap(argout) apr_hash_t **MERGEINFO_HASH
694 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range_hash(*$1));
698 /* -----------------------------------------------------------------------
699 Output of apr_array_header_t * <svn_merge_range_t *>
702 %typemap(argout) apr_array_header_t **RANGELIST {
704 (svn_swig_py_rangelist_to_list(*$1, $descriptor(svn_merge_range_t *),
706 if (PyErr_Occurred()) {
711 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
714 *$1 = svn_swig_py_rangelist_to_array($input, _global_pool);
715 if (PyErr_Occurred()) {
722 %typemap(argout) apr_array_header_t **RANGELIST {
723 %append_output(svn_swig_rb_apr_array_to_array_merge_range(*$1));
726 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
729 *$1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
733 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
734 %typemap(argout) apr_array_header_t **RANGELIST_INOUT =
735 apr_array_header_t **RANGELIST;