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);
234 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
235 %apply apr_hash_t *PROPHASH {
236 apr_hash_t *target_props,
237 apr_hash_t *source_props,
240 apr_hash_t *revprop_table,
245 /* -----------------------------------------------------------------------
246 Input of scripting hash/dictionary (string => string)
247 converted to apr_hash_t (const char * => const char *)
250 %typemap(in) apr_hash_t *HASH_CSTRING {
251 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
253 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
254 /* PYTHON-FIXME: Handle None -> NULL. */
255 $1 = svn_swig_py_stringhash_from_dict($input, _global_pool);
259 %typemap(in) apr_hash_t *HASH_CSTRING {
260 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
262 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
263 /* PERL-FIXME: Handle undef -> NULL. */
264 $1 = svn_swig_pl_strings_to_hash($input, _global_pool);
268 %typemap(in) apr_hash_t *HASH_CSTRING {
269 $1 = svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
271 %typemap(in) apr_hash_t *HASH_CSTRING_MAYBENULL {
272 VALUE rb_pool = Qnil;
274 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &_global_pool);
275 svn_swig_rb_push_pool(rb_pool);
277 $1 = (NIL_P($input)) ? NULL :
278 svn_swig_rb_hash_to_apr_hash_string($input, _global_pool);
280 if (!NIL_P(rb_pool)) {
282 svn_swig_rb_destroy_pool(rb_pool);
284 svn_swig_rb_set_pool_for_no_swig_type($input, rb_pool);
286 svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
290 %typemap(out) apr_hash_t *HASH_CSTRING_MAYBENULL {
291 $result = $1 ? svn_swig_rb_apr_hash_to_hash_string($1) : Qnil;
295 %apply apr_hash_t *HASH_CSTRING {
296 apr_hash_t *path_tokens
298 %apply apr_hash_t *HASH_CSTRING_MAYBENULL {
299 apr_hash_t *fs_config,
300 apr_hash_t *lock_tokens
303 /* -----------------------------------------------------------------------
304 handle config and fs_config in svn_{fs,repos}_create
308 %typemap(in) apr_hash_t *config {
309 $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *",
314 %typemap(in) apr_hash_t *config
319 $1 = svn_swig_rb_hash_to_apr_hash_swig_type($input, "svn_config_t *", _global_pool);
325 %typemap(in) apr_hash_t *path_revs
327 $1 = svn_swig_rb_hash_to_apr_hash_revnum($input, _global_pool);
332 %typemap(in) apr_hash_t *path_revs
334 $1 = svn_swig_py_path_revs_hash_from_dict($input, _global_pool);
338 /* =======================================================================
339 %typemap(argout) apr_array_header_t **
342 /* -----------------------------------------------------------------------
343 Output of apr_array_header_t * <svn_prop_t *>
346 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
347 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop(*$1));
350 %apply apr_array_header_t **OUTPUT_OF_PROP {
351 apr_array_header_t **entry_props,
352 apr_array_header_t **wc_props,
353 apr_array_header_t **regular_props,
354 apr_array_header_t **propdiffs
359 %typemap(argout) apr_array_header_t **OUTPUT_OF_PROP {
360 %append_output(svn_swig_py_proparray_to_dict(*$1));
363 %apply apr_array_header_t **OUTPUT_OF_PROP {
364 apr_array_header_t **entry_props,
365 apr_array_header_t **wc_props,
366 apr_array_header_t **regular_props,
367 apr_array_header_t **propdiffs
371 /* -----------------------------------------------------------------------
372 Output of apr_array_header_t * <const char *>
376 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
377 %append_output(svn_swig_py_array_to_list(*$1));
381 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
382 %append_output(svn_swig_pl_array_to_list(*$1));
386 %typemap(argout) apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
387 %append_output(svn_swig_rb_apr_array_to_array_string(*$1));
391 %apply apr_array_header_t **OUTPUT_OF_CONST_CHAR_P {
392 apr_array_header_t **patterns,
393 apr_array_header_t **logfiles,
394 apr_array_header_t **names_p,
395 apr_array_header_t **targets_p,
396 apr_array_header_t **args_p
399 /* -----------------------------------------------------------------------
400 apr_array_header_t **externals_p
401 svn_wc_parse_externals_description3()
405 %typemap(argout) apr_array_header_t **externals_p {
406 %append_output(svn_swig_rb_apr_array_to_array_external_item2(*$1));
410 /* svn_client_update3/svn_client_update2 */
412 %typemap(argout) apr_array_header_t **result_revs {
413 %append_output(svn_swig_py_revarray_to_list(*$1));
414 if (PyErr_Occurred()) {
421 %typemap(argout) apr_array_header_t **result_revs {
422 %append_output(svn_swig_rb_apr_array_to_array_svn_rev(*$1));
426 /* =======================================================================
427 %typemap(in) apr_array_header_t *
430 /* -----------------------------------------------------------------------
431 apr_array_header_t *location_revisions
432 svn_repos_trace_node_locations()
433 svn_ra_get_locations()
437 %typemap(in) apr_array_header_t *location_revisions {
438 $1 = (apr_array_header_t *) svn_swig_py_revnums_to_array($input,
445 %typemap(in) apr_array_header_t *location_revisions {
446 $1 = svn_swig_rb_array_to_apr_array_revnum($input, _global_pool);
450 /* -----------------------------------------------------------------------
451 define a general INPUT param of an array of const char * items.
455 %typemap(in) const apr_array_header_t *STRINGLIST {
456 $1 = (apr_array_header_t *) svn_swig_py_strings_to_array($input,
458 if (PyErr_Occurred())
461 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
462 $1 = ($input == Py_None)
464 : (apr_array_header_t *)svn_swig_py_strings_to_array($input,
466 if (PyErr_Occurred())
471 %typemap(in) const apr_array_header_t *STRINGLIST {
472 $1 = (apr_array_header_t *) svn_swig_pl_strings_to_array($input,
477 %typemap(in) const apr_array_header_t *STRINGLIST {
478 $1 = svn_swig_rb_strings_to_apr_array($input, _global_pool);
480 %typemap(in) const apr_array_header_t *STRINGLIST_MAY_BE_NULL {
481 $1 = (NIL_P($input)) ? NULL :
482 svn_swig_rb_strings_to_apr_array($input, _global_pool);
486 /* svn_delta_path_driver() mutates its 'paths' argument (by sorting it),
487 despite the fact that it is notionally an input parameter - hence, the
488 lack of 'const' in that one case.
490 svn_wc_get_update_editor3() and svn_wc_get_switch_editor3() aren't changing
491 their 'preserved_exts' argument, but it is forwarded to
492 svn_cstring_match_glob_list which also doesn't modify it, but does not have
493 const in its prototype. */
494 %apply const apr_array_header_t *STRINGLIST {
495 const apr_array_header_t *args,
496 const apr_array_header_t *diff_options,
497 apr_array_header_t *paths,
498 apr_array_header_t *revprops,
499 const apr_array_header_t *targets,
500 apr_array_header_t *preserved_exts
503 /* -----------------------------------------------------------------------
504 auth provider convertors
507 %typemap(in) apr_array_header_t *providers {
508 $1 = (apr_array_header_t *) svn_swig_pl_objs_to_array($input,
509 $descriptor(svn_auth_provider_object_t *), _global_pool);
514 %typemap(in) apr_array_header_t *providers {
515 svn_auth_provider_object_t *provider;
517 if (!PySequence_Check($input)) {
518 PyErr_SetString(PyExc_TypeError, "not a sequence");
521 targlen = PySequence_Length($input);
522 $1 = apr_array_make(_global_pool, targlen, sizeof(provider));
523 ($1)->nelts = targlen;
525 provider = svn_swig_MustGetPtr(PySequence_GetItem($input, targlen),
526 $descriptor(svn_auth_provider_object_t *), $svn_argnum);
527 if (PyErr_Occurred()) {
530 APR_ARRAY_IDX($1, targlen, svn_auth_provider_object_t *) = provider;
536 %typemap(in) apr_array_header_t *providers
538 $1 = svn_swig_rb_array_to_auth_provider_object_apr_array($input, _global_pool);
542 /* -----------------------------------------------------------------------
543 An array of svn_prop_t.
547 %typemap(in) apr_array_header_t *ROW_PROP_LIST
549 $1 = svn_swig_rb_to_apr_array_row_prop($input, _global_pool);
552 %apply apr_array_header_t *ROW_PROP_LIST {
553 apr_array_header_t *proplist
557 /* -----------------------------------------------------------------------
558 An array of svn_prop_t *.
562 %typemap(in) apr_array_header_t *PROP_LIST
567 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
569 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
572 %typemap(out) apr_array_header_t *PROP_LIST
574 %append_output(svn_swig_rb_prop_apr_array_to_hash_prop($1));
577 %typemap(in) apr_array_header_t *PROP_LIST_MAY_BE_NULL
585 svn_swig_rb_get_pool(argc, argv, self, &rb_pool, &pool);
586 $1 = svn_swig_rb_to_apr_array_prop($input, pool);
590 %typemap(out) apr_array_header_t *PROP_LIST_MAY_BE_NULL
592 %append_output($1 ? svn_swig_rb_prop_apr_array_to_hash_prop($1) : Qnil);
595 %apply apr_array_header_t *PROP_LIST {
596 apr_array_header_t *wcprop_changes,
597 apr_array_header_t *propchanges
600 %apply apr_array_header_t *PROP_LIST_MAY_BE_NULL {
601 apr_array_header_t *incoming_prop_changes,
602 apr_array_header_t *outgoing_prop_changes,
603 apr_array_header_t *merge_options
608 /* -----------------------------------------------------------------------
609 Input of apr_array_header_t * <svn_merge_range_t *>
612 %typemap(in) apr_array_header_t *RANGELIST {
613 $1 = svn_swig_py_rangelist_to_array($input, _global_pool);
614 if (PyErr_Occurred()) {
621 %typemap(in) apr_array_header_t *RANGELIST {
622 $1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
626 /* -----------------------------------------------------------------------
627 Input of apr_array_header_t * <svn_client_copy_source_t *>
630 %typemap(in) apr_array_header_t *SOURCES {
631 $1 = svn_swig_rb_array_to_apr_array_copy_source($input, _global_pool);
635 /* -----------------------------------------------------------------------
636 Input of apr_array_header_t * <svn_opt_revision_range_t *>
639 %typemap(in) apr_array_header_t *REVISION_RANGE_LIST {
640 $1 = svn_swig_rb_array_to_apr_array_revision_range($input, _global_pool);
644 /* -----------------------------------------------------------------------
646 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
649 %typemap(in) apr_hash_t *MERGEINFO {
650 $1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
651 if (PyErr_Occurred()) {
658 %typemap(in) apr_hash_t *MERGEINFO {
659 $1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
663 /* -----------------------------------------------------------------------
665 apr_hash_t * <const char *, apr_array_header_t * <svn_merge_range_t *>>
668 %typemap(argout) apr_hash_t **MERGEINFO
671 (svn_swig_py_mergeinfo_to_dict(*$1, $descriptor(svn_merge_range_t *),
674 if (PyErr_Occurred()) {
679 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
682 *$1 = svn_swig_py_mergeinfo_from_dict($input, _global_pool);
683 if (PyErr_Occurred()) {
690 %typemap(argout) apr_hash_t **MERGEINFO
692 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range(*$1));
695 %typemap(in) apr_hash_t **MERGEINFO_INOUT ($*1_ltype temp)
698 *$1 = svn_swig_rb_hash_to_apr_hash_merge_range($input, _global_pool);
702 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
703 %typemap(argout) apr_hash_t **MERGEINFO_INOUT = apr_hash_t **MERGEINFO;
706 /* -----------------------------------------------------------------------
708 apr_hash_t * <const char *,
709 apr_hash_t * <const char *,
710 array_header_t * <svn_merge_range_t *>>>
713 %typemap(argout) apr_hash_t **MERGEINFO_CATALOG
715 %append_output(svn_swig_rb_apr_hash_to_hash_merge_range_hash(*$1));
719 %typemap(argout) apr_hash_t **MERGEINFO_CATALOG
721 %append_output(svn_swig_py_mergeinfo_catalog_to_dict(*$1,
722 $descriptor(svn_merge_range_t *),
724 if (PyErr_Occurred()) {
730 /* -----------------------------------------------------------------------
731 Output of apr_array_header_t * <svn_merge_range_t *>
734 %typemap(argout) apr_array_header_t **RANGELIST {
736 (svn_swig_py_rangelist_to_list(*$1, $descriptor(svn_merge_range_t *),
738 if (PyErr_Occurred()) {
743 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
746 *$1 = svn_swig_py_rangelist_to_array($input, _global_pool);
747 if (PyErr_Occurred()) {
754 %typemap(argout) apr_array_header_t **RANGELIST {
755 %append_output(svn_swig_rb_apr_array_to_array_merge_range(*$1));
758 %typemap(in) apr_array_header_t **RANGELIST_INOUT ($*1_ltype temp)
761 *$1 = svn_swig_rb_array_to_apr_array_merge_range($input, _global_pool);
765 #if defined(SWIGPYTHON) || defined(SWIGRUBY)
766 %typemap(argout) apr_array_header_t **RANGELIST_INOUT =
767 apr_array_header_t **RANGELIST;