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 * core.i
: SWIG module interface file for libsvn_subr
, a few pieces of
17 * APR functionality
, and anything else that does not fit into any
18 * of the more specific module files.
21 #if defined
(SWIGPYTHON
)
22 %module
(package
="libsvn") core
23 #elif defined
(SWIGPERL
)
25 #elif defined
(SWIGRUBY
)
26 %module
"svn::ext::core"
29 %include svn_global.swg
33 #include
<apr_general.h
>
42 #include
<apr_xlate.h
>
46 /* ### for now
, let's ignore this thing.
*/
49 /* -----------------------------------------------------------------------
50 The following struct members have to be read-only because otherwise
51 strings assigned to then would never be freed
, resulting in memory
52 leaks. This prevents the swig warning
"Warning(451): Setting const
53 char * member may leak memory."
55 %immutable svn_log_changed_path_t
::copyfrom_path
;
56 %immutable svn_dirent_t
::last_author
;
57 %immutable svn_error_t
::message
;
58 %immutable svn_error_t
::file
;
60 /* -----------------------------------------------------------------------
61 completely ignore a number of functions. the presumption is that the
62 scripting language already has facilities for these things
(or they
63 are relatively trivial
).
66 /* svn_io.h
: We cherry-pick certain functions from this file. To aid in this
,
67 * EVERY function in the file is listed in the order it appears
, and is either
68 * %ignore-d
, or present as a comment
, explicitly documenting that we wrap it.
71 %ignore svn_io_check_path
;
72 %ignore svn_io_check_special_path
;
73 %ignore svn_io_check_resolved_path
;
74 /* This is useful for implementing svn_ra_callbacks_t-
>open_tmp_file
*/
75 // svn_io_open_unique_file2
76 // svn_io_open_unique_file
77 %ignore svn_io_create_unique_link
;
78 %ignore svn_io_read_link
;
79 %ignore svn_io_temp_dir
;
80 %ignore svn_io_copy_file
;
81 %ignore svn_io_copy_link
;
82 %ignore svn_io_copy_dir_recursively
;
83 %ignore svn_io_make_dir_recursively
;
84 %ignore svn_io_dir_empty
;
85 %ignore svn_io_append_file
;
86 %ignore svn_io_set_file_read_only
;
87 %ignore svn_io_set_file_read_write
;
88 %ignore svn_io_set_file_read_write_carefully
;
89 %ignore svn_io_set_file_executable
;
90 %ignore svn_io_is_file_executable
;
91 %ignore svn_io_read_length_line
;
92 %ignore svn_io_file_affected_time
;
93 %ignore svn_io_set_file_affected_time
;
94 %ignore svn_io_filesizes_different_p
;
95 // svn_io_file_checksum
96 // svn_io_files_contents_same_p
97 %ignore svn_io_file_create
;
98 %ignore svn_io_file_lock
;
99 %ignore svn_io_file_lock2
;
100 %ignore svn_io_file_flush_to_disk
;
101 %ignore svn_io_dir_file_copy
;
103 /* Not useful from scripting languages. Custom streams should be achieved
104 * by passing a scripting language native stream into a svn_stream_t
*
105 * parameter
, and letting a typemap using svn_swig_xx_make_stream
() take
106 * care of the details.
*/
107 %ignore svn_stream_create
;
108 %ignore svn_stream_set_baton
;
109 %ignore svn_stream_set_read
;
110 %ignore svn_stream_set_write
;
111 %ignore svn_stream_set_close
;
113 /* The permitted svn_stream and svn_stringbuf functions could possibly
114 * be used by a script
, in conjunction with other APIs which return or
115 * accept streams. This requires that the relevant language's custom
116 * svn_stream_t wrapping code does not obstruct this usage.
*/
119 // svn_stream_from_aprfile2
120 // svn_stream_from_aprfile
121 // svn_stream_for_stdout
122 // svn_stream_from_stringbuf
123 // svn_stream_compressed
124 /* svn_stream_checksummed would require special attention to wrap
, because
125 * of the read_digest and write_digest parameters.
*/
126 %ignore svn_stream_checksummed
;
131 /* Scripts can do the printf
, then write to a stream.
132 * We can't really handle the variadic
, so ignore it.
*/
133 %ignore svn_stream_printf
;
134 %ignore svn_stream_printf_from_utf8
;
136 // svn_stream_readline
138 // svn_stream_contents_same
139 // svn_stringbuf_from_file
140 // svn_stringbuf_from_aprfile
143 /* These functions are useful in Python
, because they allow you to
144 * easily delete files which are marked as read-only on Windows.
*/
145 %ignore svn_io_remove_file
;
146 %ignore svn_io_remove_dir
;
148 %ignore svn_io_get_dir_filenames
;
149 %ignore svn_io_get_dirents2
;
150 %ignore svn_io_get_dirents
;
151 %ignore svn_io_dir_walk
;
152 %ignore svn_io_start_cmd
;
153 %ignore svn_io_wait_for_cmd
;
154 %ignore svn_io_run_cmd
;
155 %ignore svn_io_run_diff
;
156 %ignore svn_io_run_diff3_2
;
157 %ignore svn_io_run_diff3
;
158 // svn_io_detect_mimetype
159 %ignore svn_io_file_open
;
160 %ignore svn_io_file_close
;
161 %ignore svn_io_file_getc
;
162 %ignore svn_io_file_info_get
;
163 %ignore svn_io_file_read
;
164 %ignore svn_io_file_read_full
;
165 %ignore svn_io_file_seek
;
166 %ignore svn_io_file_write
;
167 %ignore svn_io_file_write_full
;
169 %ignore svn_io_file_rename
;
170 %ignore svn_io_file_move
;
171 %ignore svn_io_dir_make
;
172 %ignore svn_io_dir_make_hidden
;
173 %ignore svn_io_dir_make_sgid
;
174 %ignore svn_io_dir_open
;
175 %ignore svn_io_dir_remove_nonrecursive
;
176 %ignore svn_io_dir_read
;
177 %ignore svn_io_read_version_file
;
178 %ignore svn_io_write_version_file
;
180 /* svn_path.h
: We cherry-pick certain functions from this file. To aid in this
,
181 * EVERY function in the file is listed in the order it appears
, and is either
182 * %ignore-d
, or present as a comment
, explicitly documenting that we wrap it.
184 // svn_path_internal_style
;
185 // svn_path_local_style
;
186 %ignore svn_path_join
;
187 %ignore svn_path_join_many
;
188 %ignore svn_path_basename
;
189 %ignore svn_path_dirname
;
190 %ignore svn_path_component_count
;
191 %ignore svn_path_add_component
;
192 %ignore svn_path_remove_component
;
193 %ignore svn_path_remove_components
;
194 %ignore svn_path_split
;
195 // svn_path_is_empty
;
196 // svn_path_canonicalize
;
197 // svn_path_compare_paths
;
198 // svn_path_get_longest_ancestor
;
199 %ignore svn_path_get_absolute
;
200 %ignore svn_path_split_if_file
;
201 %ignore svn_path_condense_targets
;
202 %ignore svn_path_remove_redundancies
;
203 %ignore svn_path_decompose
;
204 %ignore svn_path_compose
;
205 %ignore svn_path_is_single_path_component
;
206 %ignore svn_path_is_backpath_present
;
207 %ignore svn_path_is_child
;
208 %ignore svn_path_is_ancestor
;
209 %ignore svn_path_check_valid
;
210 %ignore svn_path_is_url
;
211 // svn_path_is_uri_safe
;
212 %ignore svn_path_uri_encode
;
213 %ignore svn_path_uri_decode
;
214 %ignore svn_path_url_add_component
;
215 %ignore svn_path_uri_from_iri
;
216 %ignore svn_path_uri_autoescape
;
217 %ignore svn_path_cstring_from_utf8
;
218 %ignore svn_path_cstring_to_utf8
;
221 /* bad pool convention
*/
222 %ignore svn_opt_print_generic_help
;
224 %ignore svn_opt_args_to_target_array
;
226 /* Ugliness because the constants are typedefed and SWIG ignores them
228 %constant svn_revnum_t SWIG_SVN_INVALID_REVNUM
= -1;
229 %constant svn_revnum_t SWIG_SVN_IGNORED_REVNUM
= -1;
231 /* -----------------------------------------------------------------------
234 %apply apr_array_header_t
*RANGELIST
{
235 apr_array_header_t
*rangeinput
,
236 const apr_array_header_t
*rangelist
,
237 apr_array_header_t
*from
,
238 apr_array_header_t
*to
,
239 apr_array_header_t
*changes
,
240 apr_array_header_t
*eraser
,
241 apr_array_header_t
*whiteboard
,
242 apr_array_header_t
*rangelist1
,
243 apr_array_header_t
*rangelist2
246 /* -----------------------------------------------------------------------
249 %apply apr_array_header_t
**RANGELIST
{
250 apr_array_header_t
**rangelist
,
251 apr_array_header_t
**inheritable_rangelist
,
252 apr_array_header_t
**deleted
,
253 apr_array_header_t
**added
,
254 apr_array_header_t
**output
257 /* -----------------------------------------------------------------------
258 input and output rangelist
260 %apply apr_array_header_t
**RANGELIST_INOUT
{
261 apr_array_header_t
**rangelist_inout
264 /* -----------------------------------------------------------------------
267 %apply apr_hash_t
*MERGEINFO
{
268 apr_hash_t
*mergefrom
,
270 apr_hash_t
*mergein1
,
271 apr_hash_t
*mergein2
,
272 apr_hash_t
*mergeinfo
,
273 apr_hash_t
*mergeinput
,
275 apr_hash_t
*whiteboard
,
279 /* -----------------------------------------------------------------------
283 #if defined
(SWIGPYTHON
) || defined
(SWIGRUBY
)
284 %apply apr_hash_t
**MERGEINFO_INOUT
{
285 apr_hash_t
**mergeinfo_inout
288 %apply apr_hash_t
**MERGEINFO
{
289 apr_hash_t
**mergeinfo
,
290 apr_hash_t
**inheritable_mergeinfo
,
291 apr_hash_t
**deleted
,
296 /* -----------------------------------------------------------------------
297 output mergeinfo hash
300 #if defined
(SWIGRUBY
) || defined
(SWIGPYTHON
)
301 %apply apr_hash_t
**MERGEINFO_CATALOG
{
307 /* -----------------------------------------------------------------------
308 handle the default value of svn_config_get
().and the
309 config directory of svn_config_read_auth_data
() and
310 svn_config_write_auth_data
().
312 %apply const char
*MAY_BE_NULL
{
313 const char
*default_value
,
314 const char
*config_dir
,
315 const char
*conflict_original
,
316 const char
*conflict_modified
,
317 const char
*conflict_latest
,
318 const char
*conflict_separator
321 /* -----------------------------------------------------------------------
322 fix up the svn_stream_read
() ptr
/len arguments
325 %typemap
(in
) (char
*buffer
, apr_size_t
*len
) ($
*2_type temp
) {
326 if
(!PyInt_Check
($input
)) {
327 PyErr_SetString
(PyExc_TypeError
,
328 "expecting an integer for the buffer size");
331 temp
= PyInt_AsLong
($input
);
333 PyErr_SetString
(PyExc_ValueError
,
334 "buffer size must be a positive integer");
338 $
2 = ($
2_ltype
)&temp;
342 %typemap
(in
) (char
*buffer
, apr_size_t
*len
) ($
*2_type temp
) {
345 $
2 = ($
2_ltype
)&temp;
349 %typemap
(in
) (char
*buffer
, apr_size_t
*len
) ($
*2_type temp
) {
350 temp
= NUM2LONG
($input
);
352 $
2 = ($
2_ltype
)&temp;
356 /* ### need to use freearg or somesuch to ensure the string is freed.
357 ### watch out for 'return' anywhere in the binding code.
*/
360 %typemap
(argout
) (char
*buffer
, apr_size_t
*len
) {
361 %append_output
(PyString_FromStringAndSize
($
1, *$
2));
366 %typemap
(argout
) (char
*buffer
, apr_size_t
*len
) {
367 %append_output
(sv_2mortal
(newSVpvn
($
1, *$
2)));
372 %typemap
(argout
) (char
*buffer
, apr_size_t
*len
) {
373 %append_output
(*$
2 == 0 ? Qnil
: rb_str_new
($
1, *$
2));
378 /* -----------------------------------------------------------------------
379 fix up the svn_stream_write
() ptr
/len arguments
382 %typemap
(in
) (const char
*data
, apr_size_t
*len
) ($
*2_type temp
) {
383 if
(!PyString_Check
($input
)) {
384 PyErr_SetString
(PyExc_TypeError
,
385 "expecting a string for the buffer");
388 $
1 = PyString_AS_STRING
($input
);
389 temp
= PyString_GET_SIZE
($input
);
390 $
2 = ($
2_ltype
)&temp;
394 %typemap
(in
) (const char
*data
, apr_size_t
*len
) ($
*2_type temp
) {
395 $
1 = SvPV
($input
, temp
);
396 $
2 = ($
2_ltype
)&temp;
400 %typemap
(in
) (const char
*data
, apr_size_t
*len
) ($
*2_type temp
)
402 $
1 = StringValuePtr
($input
);
403 temp
= RSTRING
($input
)->len
;
404 $
2 = ($
2_ltype
)&temp;
409 %typemap
(argout
) (const char
*data
, apr_size_t
*len
) {
410 %append_output
(PyInt_FromLong
(*$
2));
415 %typemap
(argout
) (const char
*data
, apr_size_t
*len
) {
416 %append_output
(sv_2mortal
(newSViv
(*$
2)));
421 %typemap
(argout
) (const char
*data
, apr_size_t
*len
) {
422 %append_output
(LONG2NUM
(*$
2));
426 /* -----------------------------------------------------------------------
427 auth parameter set
/get
432 %typemap
(in
) const void
*value
433 (apr_pool_t
*_global_pool
= NULL, PyObject
*_global_py_pool
= NULL)
435 if
(_global_pool
== NULL)
437 if
(svn_swig_py_get_parent_pool
(args
, $descriptor
(apr_pool_t
*),
438 &_global_py_pool, &_global_pool))
442 if
(PyString_Check
($input
)) {
443 char
*value
= PyString_AS_STRING
($input
);
444 $
1 = apr_pstrdup
(_global_pool
, value
);
446 else if
(PyLong_Check
($input
)) {
447 $
1 = apr_palloc
(_global_pool
, sizeof
(apr_uint32_t
));
448 *((apr_uint32_t
*)$
1) = PyLong_AsLong
($input
);
450 else if
(PyInt_Check
($input
)) {
451 $
1 = apr_palloc
(_global_pool
, sizeof
(apr_uint32_t
));
452 *((apr_uint32_t
*)$
1) = PyInt_AsLong
($input
);
454 else if
($input
== Py_None
) {
457 else if
(svn_swig_ConvertPtr
($input
, (void
**)&$1, $descriptor(svn_auth_ssl_server_cert_info_t *)) == 0) {
460 PyErr_SetString
(PyExc_TypeError
, "not a known type");
467 - all values are converted to char
*
468 - assume the first argument is Ruby object for svn_auth_baton_t
*
471 %typemap
(in
) const void
*value
477 apr_pool_t
*_global_pool
;
478 char
*value
= StringValuePtr
($input
);
480 svn_swig_rb_get_pool
(1, argv
, Qnil
, &_rb_pool, &_global_pool);
481 $
1 = (void
*)apr_pstrdup
(_global_pool
, value
);
487 /* assume the value is char
* */
489 %typemap
(out
) const void
*
493 $result
= rb_str_new2
(value
);
501 %ignore svn_auth_get_parameter
;
504 /* -----------------------------------------------------------------------
505 svn_io_parse_mimetypes_file
()
509 %apply apr_hash_t
**HASH_CSTRING
{
510 apr_hash_t
**type_map
514 /* -----------------------------------------------------------------------
515 svn_io_detect_mimetype2
()
518 %apply apr_hash_t
*HASH_CSTRING
{
519 apr_hash_t
*mimetype_map
522 /* -----------------------------------------------------------------------
523 describe how to pass a
FILE* as a parameter
(svn_stream_from_stdio
)
526 %typemap
(in
) FILE * {
527 $
1 = PyFile_AsFile
($input
);
529 PyErr_SetString
(PyExc_ValueError
, "Must pass in a valid file object");
535 %typemap
(in
) FILE * {
536 $
1 = PerlIO_exportFILE
(IoIFP
(sv_2io
($input
)), NULL);
540 /* -----------------------------------------------------------------------
541 wrap some specific APR functionality
544 apr_status_t apr_initialize
(void
);
545 void apr_terminate
(void
);
547 apr_status_t apr_time_ansi_put
(apr_time_t
*result
, time_t input
);
549 void apr_pool_destroy
(apr_pool_t
*p
);
550 void apr_pool_clear
(apr_pool_t
*p
);
552 apr_status_t apr_file_open_stdout
(apr_file_t
**out
, apr_pool_t
*pool
);
553 apr_status_t apr_file_open_stderr
(apr_file_t
**out
, apr_pool_t
*pool
);
555 /* Allow parsing of apr_errno.h without parsing apr.h.
*/
556 #define APR_DECLARE
(x
) x
557 /* Not wrapped
, use svn_strerror instead.
*/
558 %ignore apr_strerror
;
559 /* Wrap the APR status and error codes.
*/
560 /* Sigh
, or not. This would mean actually having access to apr_errno.h at
561 wrapper generation time
, which
, when rolling tarballs
, the include paths
562 are not currently set up to give us. FIXME. So
, instead
, we replicate
563 one important typedef here instead.
566 typedef int apr_status_t
;
568 /* -----------------------------------------------------------------------
569 pool functions renaming since swig doesn't take care of the #define's
571 %rename
(svn_pool_create
) svn_pool_create_ex
;
572 %ignore svn_pool_create_ex_debug
;
573 %typemap
(default
) apr_allocator_t
*allocator
{
577 /* -----------------------------------------------------------------------
578 Default pool handling for perl.
581 apr_pool_t
*current_pool
;
583 #if SWIG_VERSION
<= 0x010324
585 #define SVN_SWIGEXPORT
(t
) SWIGEXPORT
(t
)
589 #define SVN_SWIGEXPORT
(t
) SWIGEXPORT t
595 static apr_pool_t
*current_pool
= 0;
597 SVN_SWIGEXPORT
(apr_pool_t
*)
598 svn_swig_pl_get_current_pool
(void
)
604 svn_swig_pl_set_current_pool
(apr_pool_t
*pool
)
613 /* -----------------------------------------------------------------------
614 wrap config functions
618 %callback_typemap
(svn_config_enumerator_t callback
, void
*baton
,
620 svn_swig_pl_thunk_config_enumerator
,
625 %callback_typemap
(svn_config_enumerator2_t callback
, void
*baton
,
628 svn_swig_rb_config_enumerator
)
630 %callback_typemap
(svn_config_section_enumerator2_t callback
, void
*baton
,
633 svn_swig_rb_config_section_enumerator
)
636 /* Allow None to be passed as config_dir argument
*/
638 %typemap
(in
,parse
="z") const char
*config_dir
"";
641 /* -----------------------------------------------------------------------
642 thunk the various authentication prompt functions.
643 PERL NOTE
: store the inputed SV in _global_callback for use in the
647 %define
%authprompt_callback_typemap
(AuthType
)
648 %typemap
(in
) (svn_auth_ ## AuthType ## _prompt_func_t prompt_func
,
649 void
*prompt_baton
) {
650 $
1 = svn_swig_pl_thunk_ ## AuthType ## _prompt
;
652 _global_callback
= $input
;
656 %define
%authprompt_callback_typemap
(AuthType
)
657 %callback_typemap
(svn_auth_ ## AuthType ## _prompt_func_t prompt_func
,
659 svn_swig_py_auth_ ## AuthType ## _prompt_func
,,
660 svn_swig_rb_auth_ ## AuthType ## _prompt_func
)
664 %authprompt_callback_typemap
(simple
)
665 %authprompt_callback_typemap
(username
)
666 %authprompt_callback_typemap
(ssl_server_trust
)
667 %authprompt_callback_typemap
(ssl_client_cert
)
668 %authprompt_callback_typemap
(ssl_client_cert_pw
)
670 /* -----------------------------------------------------------------------
671 * For all the various functions that set a callback baton create a reference
672 * for the baton
(which in this case is an SV pointing to the callback
)
673 * and make that a return from the function. The perl side should
674 * then store the return in the object the baton is attached to.
675 * If the function already returns a value then this value is follows that
676 * function. In the case of the prompt functions auth_open_helper in Core.pm
677 * is used to split up these values.
680 %typemap
(argout
) void
*CALLBACK_BATON
(SV
* _global_callback
) {
682 %append_output
(sv_2mortal
(newRV_inc
(_global_callback
)));
685 %typemap
(in
) void
*CALLBACK_BATON
(SV
* _global_callback
) {
686 _global_callback
= $input
;
687 $
1 = (void
*) _global_callback
;
690 %apply void
*CALLBACK_BATON
{
696 /* -----------------------------------------------------------------------
697 These APIs take an
"inout" parameter that necessitates more careful
700 %ignore svn_mergeinfo_merge
;
701 %ignore svn_mergeinfo_sort
;
702 %ignore svn_rangelist_merge
;
703 %ignore svn_rangelist_reverse
;
706 %ignore svn_auth_open
;
707 %ignore svn_diff_file_options_create
;
708 %ignore svn_create_commit_info
;
709 %ignore svn_commit_info_dup
;
711 %ignore svn_opt_args_to_target_array2
;
712 %ignore svn_opt_args_to_target_array3
;
713 %ignore svn_opt_parse_num_args
;
714 %ignore svn_opt_parse_all_args
;
717 /* ----------------------------------------------------------------------- */
719 %include svn_error_codes_h.swg
720 %include svn_time_h.swg
721 %include svn_types_h.swg
722 %include svn_pools_h.swg
723 %include svn_version_h.swg
725 /* The constant SVN_PROP_REVISION_ALL_PROPS is a C fragment
, not a single
726 data value
, so the SWIG parser will raise a
305 warning if we don't
728 #pragma SWIG nowarn
=305
729 %include svn_props_h.swg
730 #pragma SWIG nowarn
=+305
732 %include svn_opt_h.swg
733 %include svn_auth_h.swg
734 %include svn_config_h.swg
735 %include svn_utf_h.swg
736 %include svn_nls_h.swg
737 %include svn_path_h.swg
738 %include svn_mergeinfo_h.swg
739 %include svn_io_h.swg
742 %include svn_md5_h.swg
743 %include svn_diff_h.swg
744 %include svn_error_h.swg
747 #include
"svn_private_config.h"
750 #if defined
(SVN_AVOID_CIRCULAR_LINKAGE_AT_ALL_COSTS_HACK
)
751 svn_swig_pl_bind_current_pool_fns
(&svn_swig_pl_get_current_pool,
752 &svn_swig_pl_set_current_pool);
759 void svn_swig_py_set_application_pool
(PyObject
*py_pool
, apr_pool_t
*pool
);
760 void svn_swig_py_clear_application_pool
();
763 /* Theoretically
, we should be checking for errors here
,
764 but I do not know of any useful way to signal an error to Python
765 from within a module initialization function.
*/
766 svn_swig_py_initialize
();
769 /* Proxy classes for APR classes
*/
770 %include proxy_apr.swg
776 svn_swig_rb_initialize
();
778 rb_define_const
(mCore
, "SVN_VER_NUM", rb_str_new2
(SVN_VER_NUM
));
779 rb_define_const
(mCore
, "SVN_VER_NUMBER", rb_str_new2
(SVN_VER_NUMBER
));
780 rb_define_const
(mCore
, "SVN_VERSION", rb_str_new2
(SVN_VERSION
));
784 static void apr_pool_wrapper_destroy
(apr_pool_wrapper_t
*self
);
785 static void apr_pool_wrapper_destroy_children
(apr_pool_wrapper_t
*self
);
786 static void apr_pool_wrapper_remove_from_parent
(apr_pool_wrapper_t
*self
);
789 /* Dummy declaration
*/
790 struct apr_pool_wrapper_t
794 /* Leave memory administration to ruby's GC
*/
795 %extend apr_pool_wrapper_t
797 static void destroy
(VALUE object
) {
798 svn_swig_rb_destroy_internal_pool
(object
);
801 apr_pool_wrapper_t
(apr_pool_wrapper_t
*parent
) {
802 apr_pool_wrapper_t
*self
;
803 apr_pool_t
*parent_pool
;
805 self
= ALLOC
(apr_pool_wrapper_t
);
807 parent_pool
= parent-
>pool
;
808 APR_ARRAY_PUSH
(parent-
>children
, apr_pool_wrapper_t
*) = self
;
812 self-
>pool
= svn_pool_create_ex
(parent_pool
, NULL);
813 self-
>destroyed
= FALSE;
814 self-
>parent
= parent
;
815 self-
>children
= apr_array_make
(self-
>pool
, 0,
816 sizeof
(apr_pool_wrapper_t
*));
820 ~apr_pool_wrapper_t
() {
821 apr_pool_wrapper_destroy
(self
);
825 void _destroy
(void
) {
826 apr_pool_wrapper_destroy
(self
);
830 %ignore apr_pool_wrapper_destroy
;
831 %ignore apr_pool_wrapper_destroy_children
;
832 %ignore apr_pool_wrapper_remove_from_parent
;
835 apr_pool_wrapper_destroy
(apr_pool_wrapper_t
*self
)
837 if
(!self-
>destroyed
) {
838 self-
>destroyed
= TRUE;
839 apr_pool_wrapper_destroy_children
(self
);
840 apr_pool_wrapper_remove_from_parent
(self
);
841 apr_pool_destroy
(self-
>pool
);
846 apr_pool_wrapper_destroy_children
(apr_pool_wrapper_t
*self
)
848 apr_pool_wrapper_t
**child
;
850 while
((child
= apr_array_pop
(self-
>children
))) {
852 apr_pool_wrapper_destroy
(*child
);
858 apr_pool_wrapper_remove_from_parent
(apr_pool_wrapper_t
*self
)
861 apr_pool_wrapper_t
*child
;
864 len
= self-
>parent-
>children-
>nelts
;
865 for
(i
= 0; i
< len
; i
++) {
866 child
= APR_ARRAY_IDX
(self-
>parent-
>children
, i
, apr_pool_wrapper_t
*);
868 APR_ARRAY_IDX
(self-
>parent-
>children
, i
, apr_pool_wrapper_t
*) = NULL;
877 /* Dummy declaration
*/
884 svn_stream_t
(VALUE io
) {
885 return svn_swig_rb_make_stream
(io
);
892 /* Dummy declaration
*/
893 struct svn_auth_baton_t
897 %extend svn_auth_baton_t
899 svn_auth_baton_t
(apr_array_header_t
*providers
, apr_pool_t
*pool
) {
900 svn_auth_baton_t
*self
;
901 svn_auth_open
(&self, providers, pool);
905 ~svn_auth_baton_t
() {
909 %extend svn_diff_file_options_t
911 svn_diff_file_options_t
(apr_pool_t
*pool
) {
912 return svn_diff_file_options_create
(pool
);
915 ~svn_diff_file_options_t
() {
919 %extend svn_commit_info_t
921 svn_commit_info_t
(apr_pool_t
*pool
) {
922 return svn_create_commit_info
(pool
);
925 ~svn_commit_info_t
() {
928 svn_commit_info_t
*dup
(apr_pool_t
*pool
) {
929 return svn_commit_info_dup
(self
, pool
);
933 %extend svn_merge_range_t
935 svn_merge_range_t
(svn_revnum_t start
, svn_revnum_t end
,
936 svn_boolean_t inheritable
, apr_pool_t
*pool
) {
937 svn_merge_range_t
*self
;
938 self
= apr_palloc
(pool
, sizeof
(svn_merge_range_t
));
941 self-
>inheritable
= inheritable
;
945 ~svn_merge_range_t
() {
948 svn_merge_range_t
*dup
(apr_pool_t
*pool
) {
949 return svn_merge_range_dup
(self
, pool
);
953 %include svn_diff_h.swg
957 svn_default_charset
(void
)
959 return PTR2NUM
(APR_DEFAULT_CHARSET
);
963 svn_locale_charset
(void
)
965 return PTR2NUM
(APR_LOCALE_CHARSET
);
968 /* prompt providers return baton for protecting GC
*/
970 svn_swig_rb_auth_get_simple_prompt_provider
(
971 svn_auth_provider_object_t
**provider
,
972 svn_auth_simple_prompt_func_t prompt_func
,
977 svn_auth_get_simple_prompt_provider
(provider
, prompt_func
, prompt_baton
,
979 return rb_ary_new3
(1, (VALUE)prompt_baton
);
983 svn_swig_rb_auth_get_ssl_client_cert_prompt_provider
(
984 svn_auth_provider_object_t
**provider
,
985 svn_auth_ssl_client_cert_prompt_func_t prompt_func
,
990 svn_auth_get_ssl_client_cert_prompt_provider
(provider
, prompt_func
,
991 prompt_baton
, retry_limit
,
993 return rb_ary_new3
(1, (VALUE)prompt_baton
);
997 svn_swig_rb_auth_get_ssl_client_cert_pw_prompt_provider
(
998 svn_auth_provider_object_t
**provider
,
999 svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func
,
1004 svn_auth_get_ssl_client_cert_pw_prompt_provider
(provider
, prompt_func
,
1005 prompt_baton
, retry_limit
,
1007 return rb_ary_new3
(1, (VALUE)prompt_baton
);
1011 svn_swig_rb_auth_get_ssl_server_trust_prompt_provider
(
1012 svn_auth_provider_object_t
**provider
,
1013 svn_auth_ssl_server_trust_prompt_func_t prompt_func
,
1017 svn_auth_get_ssl_server_trust_prompt_provider
(provider
, prompt_func
,
1018 prompt_baton
, pool
);
1019 return rb_ary_new3
(1, (VALUE)prompt_baton
);
1023 svn_swig_rb_auth_get_username_prompt_provider
(
1024 svn_auth_provider_object_t
**provider
,
1025 svn_auth_username_prompt_func_t prompt_func
,
1030 svn_auth_get_username_prompt_provider
(provider
, prompt_func
, prompt_baton
,
1032 return rb_ary_new3
(1, (VALUE)prompt_baton
);
1037 #if defined
(SWIGPYTHON
) || defined
(SWIGRUBY
)
1039 static svn_error_t
*
1040 svn_swig_mergeinfo_merge
(apr_hash_t
**mergeinfo_inout
,
1041 apr_hash_t
*changes
,
1044 return svn_mergeinfo_merge
(*mergeinfo_inout
, changes
, pool
);
1047 static svn_error_t
*
1048 svn_swig_mergeinfo_sort
(apr_hash_t
**mergeinfo_inout
, apr_pool_t
*pool
)
1050 return svn_mergeinfo_sort
(*mergeinfo_inout
, pool
);
1053 static svn_error_t
*
1054 svn_swig_rangelist_merge
(apr_array_header_t
**rangelist_inout
,
1055 apr_array_header_t
*changes
,
1058 return svn_rangelist_merge
(rangelist_inout
, changes
, pool
);
1061 static svn_error_t
*
1062 svn_swig_rangelist_reverse
(apr_array_header_t
**rangelist_inout
,
1065 return svn_rangelist_reverse
(*rangelist_inout
, pool
);