📄 core.i
字号:
*/%typemap(ruby, in, numinputs=0) apr_hash_t **hash = apr_hash_t **OUTPUT;%typemap(ruby, argout) apr_hash_t **hash{ if (*$1) { $result = svn_swig_rb_apr_hash_to_hash_svn_string(*$1); } else { $result = Qnil; }}/* ----------------------------------------------------------------------- svn_config_write_auth_data()*/%typemap(ruby, in) apr_hash_t *hash{ $1 = svn_swig_rb_hash_to_apr_hash_svn_string($input, _global_pool);}/* ----------------------------------------------------------------------- describe how to pass a FILE* as a parameter (svn_stream_from_stdio)*/%typemap(python, in) FILE * { $1 = PyFile_AsFile($input); if ($1 == NULL) { PyErr_SetString(PyExc_ValueError, "Must pass in a valid file object"); SWIG_fail; }}%typemap(perl5, in) FILE * { $1 = PerlIO_exportFILE (IoIFP (sv_2io ($input)), NULL);}/* ----------------------------------------------------------------------- wrap some specific APR functionality*/apr_status_t apr_initialize(void);void apr_terminate(void);apr_status_t apr_time_ansi_put(apr_time_t *result, time_t input);void apr_pool_destroy(apr_pool_t *p);void apr_pool_clear(apr_pool_t *p);apr_status_t apr_file_open_stdout (apr_file_t **out, apr_pool_t *pool);apr_status_t apr_file_open_stderr (apr_file_t **out, apr_pool_t *pool);/* ----------------------------------------------------------------------- pool functions renaming since swig doesn't take care of the #define's*/%rename (svn_pool_create) svn_pool_create_ex;%ignore svn_pool_create_ex_debug;%typemap(default) apr_allocator_t *allocator { $1 = NULL;}/* ----------------------------------------------------------------------- Default pool handling for perl.*/#ifdef SWIGPERL/* Fix for SWIG 1.3.24 */#if SWIG_VERSION == 0x010324%typemap(varin) apr_pool_t * { void *temp; if (SWIG_ConvertPtr($input, (void **) &temp, $1_descriptor,0) < 0) { croak("Type error in argument $argnum of $symname. Expected $1_mangle"); } $1 = ($1_ltype) temp;}#endifapr_pool_t *current_pool;#if SWIG_VERSION <= 0x010324%{#define SVN_SWIGEXPORT(t) SWIGEXPORT(t)%}#else%{#define SVN_SWIGEXPORT(t) SWIGEXPORT t%}#endif%{static apr_pool_t *current_pool = 0;SVN_SWIGEXPORT(apr_pool_t *)svn_swig_pl_get_current_pool (void){ return current_pool;}SVN_SWIGEXPORT(void)svn_swig_pl_set_current_pool (apr_pool_t *pool){ current_pool = pool;}%}#endif/* ----------------------------------------------------------------------- wrap config functions*/%typemap(perl5,in,numinputs=0) apr_hash_t **cfg_hash = apr_hash_t **OUTPUT;%typemap(perl5,argout) apr_hash_t **cfg_hash { ST(argvi++) = svn_swig_pl_convert_hash(*$1, $descriptor(svn_config_t *));}%typemap(perl5, in) (svn_config_enumerator_t callback, void *baton) { $1 = svn_swig_pl_thunk_config_enumerator, $2 = (void *)$input;};%typemap(ruby, in, numinputs=0) apr_hash_t **cfg_hash = apr_hash_t **OUTPUT;%typemap(ruby, argout) apr_hash_t **cfg_hash { $result = svn_swig_rb_apr_hash_to_hash_swig_type(*$1, "svn_config_t *");}%typemap(ruby, in) (svn_config_enumerator2_t callback, void *baton){ $1 = svn_swig_rb_config_enumerator; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);};%typemap(ruby, in) (svn_config_section_enumerator2_t callback, void *baton){ $1 = svn_swig_rb_config_section_enumerator; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);};%typemap(python,in,numinputs=0) apr_hash_t **cfg_hash = apr_hash_t **OUTPUT;%typemap(python,argout,fragment="t_output_helper") apr_hash_t **cfg_hash { $result = t_output_helper( $result, svn_swig_NewPointerObj(*$1, $descriptor(apr_hash_t *), _global_svn_swig_py_pool));}/* Allow None to be passed as config_dir argument */%typemap(python,in,parse="z") const char *config_dir "";%typemap(ruby, in) const char *config_dir { if (NIL_P($input)) { $1 = ""; } else { $1 = StringValuePtr($input); }}#ifdef SWIGPYTHONPyObject *svn_swig_py_exception_type(void);#endif/* svn_prop_diffs */%typemap(ruby, in, numinputs=0) apr_array_header_t **propdiffs (apr_array_header_t *temp){ $1 = &temp;}%typemap(ruby, argout, fragment="output_helper") apr_array_header_t **propdiffs{ $result = output_helper($result, svn_swig_rb_apr_array_to_array_prop(*$1));}%apply apr_hash_t *PROPHASH { apr_hash_t *target_props, apr_hash_t *source_props};%typemap(ruby, in) apr_array_header_t *proplist{ $1 = svn_swig_rb_array_to_apr_array_prop($input, _global_pool);}%apply apr_array_header_t **OUTPUT_OF_PROP { apr_array_header_t **entry_props, apr_array_header_t **wc_props, apr_array_header_t **regular_props};/* ----------------------------------------------------------------------- thunk the various authentication prompt functions.*/%typemap(ruby, in) (svn_auth_simple_prompt_func_t prompt_func, void *prompt_baton){ $1 = svn_swig_rb_auth_simple_prompt_func; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);}%typemap(ruby, in) (svn_auth_username_prompt_func_t prompt_func, void *prompt_baton){ $1 = svn_swig_rb_auth_username_prompt_func; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);}%typemap(ruby, in) (svn_auth_ssl_server_trust_prompt_func_t prompt_func, void *prompt_baton){ $1 = svn_swig_rb_auth_ssl_server_trust_prompt_func; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);}%typemap(ruby, in) (svn_auth_ssl_client_cert_prompt_func_t prompt_func, void *prompt_baton){ $1 = svn_swig_rb_auth_ssl_client_cert_prompt_func; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);}%typemap(ruby, in) (svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func, void *prompt_baton){ $1 = svn_swig_rb_auth_ssl_client_cert_pw_prompt_func; $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);}/* ----------------------------------------------------------------------- */%include svn_types_h.swg%include svn_pools_h.swg%include svn_version_h.swg%include svn_time_h.swg#ifdef SWIGRUBY%immutable name;%immutable value;#endif%include svn_props_h.swg#ifdef SWIGRUBY%mutable name;%mutable value;#endif%include svn_opt_h.swg%include svn_auth_h.swg%include svn_config_h.swg%include svn_version_h.swg%include svn_utf_h.swg%include svn_nls_h.swg%include svn_path_h.swg/* SWIG won't follow through to APR's defining this to be empty, so we need to do it manually, before SWIG sees this in svn_io.h. */#define __attribute__(x)%include svn_io_h.swg#ifdef SWIGPERL%include svn_md5_h.swg%include svn_diff_h.swg%include svn_error_h.swg%{#include "svn_private_config.h"%}%init %{#if defined(SVN_AVOID_CIRCULAR_LINKAGE_AT_ALL_COSTS_HACK) svn_swig_pl_bind_current_pool_fns (&svn_swig_pl_get_current_pool, &svn_swig_pl_set_current_pool);#endif%}#endif#ifdef SWIGPYTHONvoid svn_swig_py_set_application_pool(PyObject *py_pool, apr_pool_t *pool);void svn_swig_py_clear_application_pool();%init %{/* Theoretically, we should be checking for errors here, but I do not know of any useful way to signal an error to Python from within a module initialization function. */svn_swig_py_initialize();/* This is a hack. I dunno if we can count on SWIG calling the module "m" */PyModule_AddObject(m, "SubversionException", svn_swig_py_register_exception());%}%pythoncode %{SubversionException = _core.SubversionException%}/* Proxy classes for APR classes */%include proxy_apr.swg#endif#ifdef SWIGRUBY%init %{ svn_swig_rb_initialize();%}%header %{static void apr_pool_wrapper_destroy(apr_pool_wrapper_t *self);static void apr_pool_wrapper_destroy_children(apr_pool_wrapper_t *self);static void apr_pool_wrapper_remove_from_parent(apr_pool_wrapper_t *self);%}/* Dummy declaration */struct apr_pool_wrapper_t{};/* Leave memory administration to ruby's GC */%extend apr_pool_wrapper_t{ apr_pool_wrapper_t(apr_pool_wrapper_t *parent) { apr_pool_wrapper_t *self; apr_pool_t *parent_pool; self = ALLOC(apr_pool_wrapper_t); if (parent) { parent_pool = parent->pool; APR_ARRAY_PUSH(parent->children, apr_pool_wrapper_t *) = self; } else { parent_pool = NULL; } self->pool = svn_pool_create_ex(parent_pool, NULL); self->destroyed = FALSE; self->parent = parent; self->children = apr_array_make(self->pool, 0, sizeof(apr_pool_wrapper_t *)); return self; } ~apr_pool_wrapper_t() { apr_pool_wrapper_destroy(self); free(self); }};%ignore apr_pool_wrapper_destroy;%ignore apr_pool_wrapper_destroy_children;%ignore apr_pool_wrapper_remove_from_parent;%inline %{static voidapr_pool_wrapper_destroy(apr_pool_wrapper_t *self){ if (!self->destroyed) { self->destroyed = TRUE; apr_pool_wrapper_destroy_children(self); apr_pool_wrapper_remove_from_parent(self); apr_pool_destroy(self->pool); }}static voidapr_pool_wrapper_destroy_children(apr_pool_wrapper_t *self){ apr_pool_wrapper_t **child; while ((child = apr_array_pop(self->children))) { if (*child) { apr_pool_wrapper_destroy(*child); } }}static voidapr_pool_wrapper_remove_from_parent(apr_pool_wrapper_t *self){ if (self->parent) { apr_pool_wrapper_t *child; int i, len; len = self->parent->children->nelts; for (i = 0; i < len; i++) { child = APR_ARRAY_IDX(self->parent->children, i, apr_pool_wrapper_t *); if (child == self) { APR_ARRAY_IDX(self->parent->children, i, apr_pool_wrapper_t *) = NULL; self->parent = NULL; break; } } }}%}%include svn_diff_h.swg%inline %{static VALUEsvn_default_charset(void){ return INT2NUM((int)APR_DEFAULT_CHARSET);} static VALUEsvn_locale_charset(void){ return INT2NUM((int)APR_LOCALE_CHARSET);}/* prompt providers return baton for protecting GC */static VALUEsvn_swig_rb_auth_get_simple_prompt_provider( svn_auth_provider_object_t **provider, svn_auth_simple_prompt_func_t prompt_func, void *prompt_baton, int retry_limit, apr_pool_t *pool){ svn_auth_get_simple_prompt_provider(provider, prompt_func, prompt_baton, retry_limit, pool); return rb_ary_new3(1, (VALUE)prompt_baton);}static VALUEsvn_swig_rb_auth_get_ssl_client_cert_prompt_provider( svn_auth_provider_object_t **provider, svn_auth_ssl_client_cert_prompt_func_t prompt_func, void *prompt_baton, int retry_limit, apr_pool_t *pool){ svn_auth_get_ssl_client_cert_prompt_provider(provider, prompt_func, prompt_baton, retry_limit, pool); return rb_ary_new3(1, (VALUE)prompt_baton);}static VALUEsvn_swig_rb_auth_get_ssl_client_cert_pw_prompt_provider( svn_auth_provider_object_t **provider, svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func, void *prompt_baton, int retry_limit, apr_pool_t *pool){ svn_auth_get_ssl_client_cert_pw_prompt_provider(provider, prompt_func, prompt_baton, retry_limit, pool); return rb_ary_new3(1, (VALUE)prompt_baton);}static VALUEsvn_swig_rb_auth_get_ssl_server_trust_prompt_provider( svn_auth_provider_object_t **provider, svn_auth_ssl_server_trust_prompt_func_t prompt_func, void *prompt_baton, apr_pool_t *pool){ svn_auth_get_ssl_server_trust_prompt_provider(provider, prompt_func, prompt_baton, pool); return rb_ary_new3(1, (VALUE)prompt_baton);}static VALUEsvn_swig_rb_auth_get_username_prompt_provider( svn_auth_provider_object_t **provider, svn_auth_username_prompt_func_t prompt_func, void *prompt_baton, int retry_limit, apr_pool_t *pool){ svn_auth_get_username_prompt_provider(provider, prompt_func, prompt_baton, retry_limit, pool); return rb_ary_new3(1, (VALUE)prompt_baton);}%}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -