2 * ====================================================================
3 * Copyright (c) 2000-2008 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,
100 %apply apr_hash_t **HASH_SVN_STRING_MAYBENULL {
101 /* svn_config_read_auth_data() */
106 /* -----------------------------------------------------------------------
107 Output of apr_hash_t * <const char *, const char *>
111 %typemap(argout) apr_hash_t **HASH_CSTRING {
112 %append_output(svn_swig_rb_apr_hash_to_hash_string(*$1));
116 %typemap(argout) apr_hash_t **HASH_CSTRING {
117 %append_output(svn_swig_py_stringhash_to_dict(*$1));
121 %apply apr_hash_t **HASH_CSTRING {
122 apr_hash_t **type_map,
123 apr_hash_t **externals_old,
124 apr_hash_t **externals_new,
128 /* -----------------------------------------------------------------------
129 apr_hash_t **locations
130 svn_repos_trace_node_locations()
131 svn_ra_get_locations()
135 %typemap(argout) apr_hash_t **locations {
136 %append_output(svn_swig_py_locationhash_to_dict(*$1));
140 %typemap(argout) apr_hash_t **locations
142 %append_output(svn_swig_rb_apr_revnum_key_hash_to_hash_string(*$1));
146 /* -----------------------------------------------------------------------
147 apr_hash_t **externals_old
148 apr_hash_t **externals_new
149 svn_wc_edited_externals()
153 %typemap(argout) apr_hash_t **externals_old, apr_hash_t **externals_new {
154 %append_output(svn_swig_rb_apr_hash_to_hash_string(*$1));
159 /* =======================================================================
160 %typemap(in) apr_hash_t *
163 /* -----------------------------------------------------------------------
164 Input of apr_hash_t * <const char *, svn_string_t *>
165 (commonly used for property name and value pairs)
169 %typemap(in) apr_hash_t *PROPHASH
170 (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
172 if (_global_pool == NULL)
174 if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
175 &_global_py_pool, &_global_pool))
179 $1 = svn_swig_py_prophash_from_dict($input, _global_pool);
180 if (PyErr_Occurred()) {
185 %typemap(out) apr_hash_t *PROPHASH
187 %append_output(svn_swig_py_prophash_to_dict($1));
192 %typemap(in) apr_hash_t *changed_paths
193 (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
195 if (_global_pool == NULL)
197 if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
198 &_global_py_pool, &_global_pool))
202 $1 = svn_swig_py_changed_path_hash_from_dict($input, _global_pool);
203 if (PyErr_Occurred()) {
207 %typemap(out) apr_hash_t *changed_paths
209 %append_output(svn_swig_py_changed_path_hash_to_dict($1));
214 %typemap(in) apr_hash_t *PROPHASH
216 VALUE rb_pool = Qnil;
218 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &_global_pool);
219 svn_swig_rb_push_pool(rb_pool);
221 $1 = svn_swig_rb_hash_to_apr_hash_svn_string($input, _global_pool);
223 if (!NIL_P(rb_pool)) {
225 svn_swig_rb_destroy_pool(rb_pool);
227 svn_swig_rb_set_pool_for_no_swig_type($input, rb_pool);
229 svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
233 %typemap(out) apr_hash_t *PROPHASH
235 %append_output(svn_swig_rb_apr_hash_to_hash_svn_string($1));
239 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
240 %apply apr_hash_t *PROPHASH {
241 apr_hash_t *target_props,
242 apr_hash_t *source_props,
245 apr_hash_t *revprop_table,
251 %typemap(out) apr_hash_t *CHANGED_PATH_HASH
253 VALUE rb_changed_path_hash;
254 rb_changed_path_hash =
255 svn_swig_rb_apr_hash_to_hash_swig_type($1, "svn_log_changed_path_t *");
256 %append_output(rb_changed_path_hash);
259 %apply apr_hash_t *CHANGED_PATH_HASH {
260 apr_hash_t *changed_paths
264 /* -----------------------------------------------------------------------
265 Input of scripting hash/dictionary (string => string)
266 converted to apr_hash_t (const char * => const char *)
269 %typemap(in) apr_hash_t *HASH_CSTRING {
270 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
272 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
273 /* PYTHON-FIXME: Handle None -> NULL. */
274 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
278 %typemap(in) apr_hash_t *HASH_CSTRING {
279 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
281 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
282 /* PERL-FIXME: Handle undef -> NULL. */
283 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
287 %typemap(in) apr_hash_t *HASH_CSTRING {
288 $1 = svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
290 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
291 VALUE rb_pool = Qnil;
293 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &_global_pool);
294 svn_swig_rb_push_pool(rb_pool);
296 $1 = (NIL_P($input)) ? NULL :
297 svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
299 if (!NIL_P(rb_pool)) {
301 svn_swig_rb_destroy_pool(rb_pool);
303 svn_swig_rb_set_pool_for_no_swig_type($input, rb_pool);
305 svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
309 %typemap(out) apr_hash_t *HASH_CSTRING_MAYBENULL {
310 $result = $1 ? svn_swig_rb_apr_hash_to_hash_string($1) : Qnil;
314 %apply apr_hash_t *HASH_CSTRING {
315 apr_hash_t *path_tokens
317 %apply apr_hash_t *HASH_CSTRING_MAYBENULL {
318 apr_hash_t *fs_config,
319 apr_hash_t *lock_tokens
322 /* -----------------------------------------------------------------------
323 handle config and fs_config in svn_{fs,repos}_create
327 %typemap(in) apr_hash_t *config {
328 $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *",
333 %typemap(in) apr_hash_t *config
338 $1 = svn_swig_rb_hash_to_apr_hash_swig_type($input, "svn_config_t *", _global_pool);
344 %typemap(in) apr_hash_t *path_revs
346 $1 = svn_swig_rb_hash_to_apr_hash_revnum($input, _global_pool);
351 %typemap(in) apr_hash_t *path_revs
353 $1 = svn_swig_py_path_revs_hash_from_dict($input, _global_pool);
357 /* =======================================================================
358 %typemap(argout) apr_array_header_t **
361 /* -----------------------------------------------------------------------
362 Output of apr_array_header_t * <svn_prop_t *>
365 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
366 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop(*$1));
369 %apply apr_array_header_t **OUTPUT_OF_PROP {
370 apr_array_header_t **entry_props,
371 apr_array_header_t **wc_props,
372 apr_array_header_t **regular_props,
373 apr_array_header_t **propdiffs
378 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
379 %append_output(svn_swig_py_proparray_to_dict(*$1));
382 %apply apr_array_header_t **OUTPUT_OF_PROP {
383 apr_array_header_t **entry_props,
384 apr_array_header_t **wc_props,
385 apr_array_header_t **regular_props,
386 apr_array_header_t **propdiffs
390 /* -----------------------------------------------------------------------
391 Output of apr_array_header_t * <const char *>
395 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
396 %append_output(svn_swig_py_array_to_list(*$1));
400 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
401 %append_output(svn_swig_pl_array_to_list(*$1));
405 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
406 %append_output(svn_swig_rb_apr_array_to_array_string(*$1));
410 %apply apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
411 apr_array_header_t **patterns,
412 apr_array_header_t **logfiles,
413 apr_array_header_t **names_p,
414 apr_array_header_t **targets_p,
415 apr_array_header_t **args_p
418 /* -----------------------------------------------------------------------
419 apr_array_header_t **externals_p
420 svn_wc_parse_externals_description3()
424 %typemap(argout) apr_array_header_t **externals_p {
425 %append_output(svn_swig_rb_apr_array_to_array_external_item2(*$1));
429 /* svn_client_update3/svn_client_update2 */
431 %typemap(argout) apr_array_header_t **result_revs {
432 %append_output(svn_swig_py_revarray_to_list(*$1));
433 if (PyErr_Occurred()) {
440 %typemap(argout) apr_array_header_t **result_revs {
441 %append_output(svn_swig_rb_apr_array_to_array_svn_rev(*$1));
445 /* =======================================================================
446 %typemap(in) apr_array_header_t *
449 /* -----------------------------------------------------------------------
450 apr_array_header_t *location_revisions
451 svn_repos_trace_node_locations()
452 svn_ra_get_locations()
456 %typemap(in) apr_array_header_t *location_revisions {
457 $1 = (apr_array_header_t *) svn_swig_py_revnums_to_array($input,
464 %typemap(in) apr_array_header_t *location_revisions {
465 $1 = svn_swig_rb_array_to_apr_array_revnum($input, _global_pool);
469 /* -----------------------------------------------------------------------
470 define a general INPUT param of an array of const char * items.
474 %typemap(in) const apr_array_header_t *STRINGLIST {
475 $1 = (apr_array_header_t *) svn_swig_py_strings_to_array($input,
477 if (PyErr_Occurred())
480 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
481 $1 = ($input == Py_None)
483 : (apr_array_header_t *)svn_swig_py_strings_to_array($input,
485 if (PyErr_Occurred())
490 %typemap(in) const apr_array_header_t *STRINGLIST {
491 $1 = (apr_array_header_t *) svn_swig_pl_strings_to_array($input,
496 %typemap(in) const apr_array_header_t *STRINGLIST {
497 $1 = svn_swig_rb_strings_to_apr_array($input, _global_pool);
499 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
500 $1 = (NIL_P($input)) ? NULL :
501 svn_swig_rb_strings_to_apr_array($input, _global_pool);
505 /* svn_delta_path_driver() mutates its 'paths' argument (by sorting it),
506 despite the fact that it is notionally an input parameter - hence, the
507 lack of 'const' in that one case.
509 svn_wc_get_update_editor3() and svn_wc_get_switch_editor3() aren't changing
510 their 'preserved_exts' argument, but it is forwarded to
511 svn_cstring_match_glob_list which also doesn't modify it, but does not have
512 const in its prototype. */
513 %apply const apr_array_header_t *STRINGLIST {
514 const apr_array_header_t *args,
515 const apr_array_header_t *diff_options,
516 apr_array_header_t *paths,
517 apr_array_header_t *revprops,
518 const apr_array_header_t *targets,
519 apr_array_header_t *preserved_exts
523 %apply const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
524 apr_array_header_t *revprops
528 /* -----------------------------------------------------------------------
529 auth provider convertors
532 %typemap(in) apr_array_header_t *providers {
533 $1 = (apr_array_header_t *) svn_swig_pl_objs_to_array($input,
534 $descriptor(svn_auth_provider_object_t *), _global_pool);
539 %typemap(in) apr_array_header_t *providers {
540 svn_auth_provider_object_t *provider;
542 if (!PySequence_Check($input)) {
543 PyErr_SetString(PyExc_TypeError, "not a sequence");
546 targlen = PySequence_Length($input);
547 $1 = apr_array_make(_global_pool, targlen, sizeof(provider));
548 ($1)->nelts = targlen;
550 provider = svn_swig_MustGetPtr(PySequence_GetItem($input, targlen),
551 $descriptor(svn_auth_provider_object_t *), $svn_argnum);
552 if (PyErr_Occurred()) {
555 APR_ARRAY_IDX($1, targlen, svn_auth_provider_object_t *) = provider;
561 %typemap(in) apr_array_header_t *providers
563 $1 = svn_swig_rb_array_to_auth_provider_object_apr_array($input, _global_pool);
567 /* -----------------------------------------------------------------------
568 An array of svn_prop_t.
572 %typemap(in) apr_array_header_t *ROW_PROP_LIST
574 $1 = svn_swig_rb_to_apr_array_row_prop($input, _global_pool);
577 %apply apr_array_header_t *ROW_PROP_LIST {
578 apr_array_header_t *proplist
582 /* -----------------------------------------------------------------------
583 An array of svn_prop_t *.
587 %typemap(in) apr_array_header_t *PROP_LIST
592 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
594 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
597 %typemap(out) apr_array_header_t *PROP_LIST
599 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop($1));
602 %typemap(in) apr_array_header_t *PROP_LIST_MAY_BE_NULL
610 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
611 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
615 %typemap(out) apr_array_header_t *PROP_LIST_MAY_BE_NULL
617 %append_output($1 ? svn_swig_rb_prop_apr_array_to_hash_prop($1) : Qnil);
620 %apply apr_array_header_t *PROP_LIST {
621 apr_array_header_t *wcprop_changes,
622 apr_array_header_t *propchanges
625 %apply apr_array_header_t *PROP_LIST_MAY_BE_NULL {
626 apr_array_header_t *incoming_prop_changes,
627 apr_array_header_t *outgoing_prop_changes,
628 apr_array_header_t *merge_options
633 /* -----------------------------------------------------------------------
634 Input of apr_array_header_t * <svn_merge_range_t *>
637 %typemap(in) apr_array_header_t *RANGELIST {
638 $1 = svn_swig_py_rangelist_to_array($input, _global_pool);
639 if (PyErr_Occurred()) {
646 %typemap(in) apr_array_header_t *RANGELIST {
647 $1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
651 /* -----------------------------------------------------------------------
652 Input of apr_array_header_t * <svn_client_copy_source_t *>
655 %typemap(in) apr_array_header_t *SOURCES {
656 $1 = svn_swig_rb_array_to_apr_array_copy_source($input, _global_pool);
660 /* -----------------------------------------------------------------------
661 Input of apr_array_header_t * <svn_opt_revision_range_t *>
664 %typemap(in) apr_array_header_t *REVISION_RANGE_LIST {
665 $1 = svn_swig_rb_array_to_apr_array_revision_range($input, _global_pool);
669 /* -----------------------------------------------------------------------
671 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
674 %typemap(in) apr_hash_t *MERGEINFO {
675 $1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
676 if (PyErr_Occurred()) {
683 %typemap(in) apr_hash_t *MERGEINFO {
684 $1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
688 /* -----------------------------------------------------------------------
690 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
693 %typemap(argout) apr_hash_t **MERGEINFO
696 (svn_swig_py_mergeinfo_to_dict(*$1, $descriptor(svn_merge_range_t *),
699 if (PyErr_Occurred()) {
704 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
707 *$1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
708 if (PyErr_Occurred()) {
715 %typemap(argout) apr_hash_t **MERGEINFO
717 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range(*$1));
720 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
723 *$1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
727 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
728 %typemap(argout) apr_hash_t **MERGEINFO_INOUT = apr_hash_t **MERGEINFO;
731 /* -----------------------------------------------------------------------
733 apr_hash_t * <const char *,
734 apr_hash_t * <const char *,
735 array_header_t * <svn_merge_range_t *>>>
738 %typemap(argout) apr_hash_t **MERGEINFO_CATALOG
740 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range_hash(*$1));
744 %typemap(argout) apr_hash_t **MERGEINFO_CATALOG
746 %append_output(svn_swig_py_mergeinfo_catalog_to_dict(*$1,
747 $descriptor(svn_merge_range_t *),
749 if (PyErr_Occurred()) {
755 /* -----------------------------------------------------------------------
756 Output of apr_array_header_t * <svn_merge_range_t *>
759 %typemap(argout) apr_array_header_t **RANGELIST {
761 (svn_swig_py_rangelist_to_list(*$1, $descriptor(svn_merge_range_t *),
763 if (PyErr_Occurred()) {
768 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
771 *$1 = svn_swig_py_rangelist_to_array($input, _global_pool);
772 if (PyErr_Occurred()) {
779 %typemap(argout) apr_array_header_t **RANGELIST {
780 %append_output(svn_swig_rb_apr_array_to_array_merge_range(*$1));
783 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
786 *$1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
790 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
791 %typemap(argout) apr_array_header_t **RANGELIST_INOUT =
792 apr_array_header_t **RANGELIST;