⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swigutil_rb.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
                    callback_rescue,                    (VALUE)(handle_error_baton->rescue_baton),                    rb_svn_error(),                    (VALUE)0);}static VALUEinvoke_callback_handle_error(VALUE args, VALUE pool, svn_error_t **err){  callback_handle_error_baton_t handle_error_baton;  callback_rescue_baton_t rescue_baton;  VALUE new_args;  rescue_baton.err = err;  rescue_baton.pool = pool;  new_args = rb_ary_dup(args);  rb_ary_unshift(new_args, pool);  handle_error_baton.args = new_args;  handle_error_baton.rescue_baton = &rescue_baton;    return rb_ensure(callback_handle_error, (VALUE)&handle_error_baton,                   callback_ensure, pool);}/* svn_delta_editor_t */typedef struct {  VALUE editor;  VALUE baton;} item_baton;static voidadd_baton(VALUE editor, VALUE baton){  if (NIL_P((rb_ivar_get(editor, rb_id_baton())))) {    rb_ivar_set(editor, rb_id_baton(), rb_ary_new());  }    rb_ary_push(rb_ivar_get(editor, rb_id_baton()), baton);}static item_baton *make_baton(apr_pool_t *pool, VALUE editor, VALUE baton){  item_baton *newb = apr_palloc(pool, sizeof(*newb));  newb->editor = editor;  newb->baton = baton;  add_baton(editor, baton);  return newb;}static VALUEadd_baton_if_delta_editor(VALUE target, VALUE baton){  if (RTEST(rb_obj_is_kind_of(target, svn_swig_rb_svn_delta_editor()))) {    add_baton(target, baton);  }  return Qnil;}voidsvn_swig_rb_set_baton(VALUE target, VALUE baton){  if (NIL_P(baton)) {    return;  }  if (!RTEST(rb_obj_is_kind_of(target, rb_cArray))) {    target = rb_ary_new3(1, target);  }  rb_iterate(rb_each, target, add_baton_if_delta_editor, baton);}static svn_error_t *delta_editor_set_target_revision(void *edit_baton,                                 svn_revnum_t target_revision,                                 apr_pool_t *pool){  item_baton *ib = edit_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(3,                     ib->editor,                     rb_id_set_target_revision(),                     INT2NUM(target_revision));  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_open_root(void *edit_baton,                       svn_revnum_t base_revision,                       apr_pool_t *dir_pool,                       void **root_baton){  item_baton *ib = edit_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(3,                     ib->editor,                     rb_id_open_root(),                     INT2NUM(base_revision));  result = invoke_callback_handle_error(args, Qnil, &err);  *root_baton = make_baton(dir_pool, ib->editor, result);  return err;}static svn_error_t *delta_editor_delete_entry(const char *path,                          svn_revnum_t revision,                          void *parent_baton,                          apr_pool_t *pool){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(5,                     ib->editor,                     rb_id_delete_entry(),                     c2r_string2(path),                     INT2NUM(revision),                     ib->baton);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_add_directory(const char *path,                           void *parent_baton,                           const char *copyfrom_path,                           svn_revnum_t copyfrom_revision,                           apr_pool_t *dir_pool,                           void **child_baton){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(6,                     ib->editor,                     rb_id_add_directory(),                     c2r_string2(path),                     ib->baton,                     c2r_string2(copyfrom_path),                     INT2NUM(copyfrom_revision));  result = invoke_callback_handle_error(args, Qnil, &err);  *child_baton = make_baton(dir_pool, ib->editor, result);  return err;}static svn_error_t *delta_editor_open_directory(const char *path,                            void *parent_baton,                            svn_revnum_t base_revision,                            apr_pool_t *dir_pool,                            void **child_baton){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(5,                     ib->editor,                     rb_id_open_directory(),                     c2r_string2(path),                     ib->baton,                     INT2NUM(base_revision));  result = invoke_callback_handle_error(args, Qnil, &err);  *child_baton = make_baton(dir_pool, ib->editor, result);  return err;}static svn_error_t *delta_editor_change_dir_prop(void *dir_baton,                             const char *name,                             const svn_string_t *value,                             apr_pool_t *pool){  item_baton *ib = dir_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(5,                     ib->editor,                     rb_id_change_dir_prop(),                     ib->baton,                     c2r_string2(name),                     value ? rb_str_new(value->data, value->len) : Qnil);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_close_baton(void *baton, ID method_id){  item_baton *ib = baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(3,                     ib->editor,                     method_id,                     ib->baton);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_close_directory(void *dir_baton, apr_pool_t *pool){  return delta_editor_close_baton(dir_baton, rb_id_close_directory());}static svn_error_t *delta_editor_absent_directory(const char *path,                              void *parent_baton,                              apr_pool_t *pool){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(4,                     ib->editor,                     rb_id_absent_directory(),                     c2r_string2(path),                     ib->baton);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_add_file(const char *path,                      void *parent_baton,                      const char *copyfrom_path,                      svn_revnum_t copyfrom_revision,                      apr_pool_t *file_pool,                      void **file_baton){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(6,                     ib->editor,                     rb_id_add_file(),                     c2r_string2(path),                     ib->baton,                     c2r_string2(copyfrom_path),                     INT2NUM(copyfrom_revision));  result = invoke_callback_handle_error(args, Qnil, &err);  *file_baton = make_baton(file_pool, ib->editor, result);  return err;}static svn_error_t *delta_editor_open_file(const char *path,                       void *parent_baton,                       svn_revnum_t base_revision,                       apr_pool_t *file_pool,                       void **file_baton){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(5,                     ib->editor,                     rb_id_open_file(),                     c2r_string2(path),                     ib->baton,                     INT2NUM(base_revision));  result = invoke_callback_handle_error(args, Qnil, &err);  *file_baton = make_baton(file_pool, ib->editor, result);  return err;}static svn_error_t *delta_editor_window_handler(svn_txdelta_window_t *window, void *baton){  VALUE handler = (VALUE)baton;  VALUE args;  VALUE result;  svn_error_t *err = SVN_NO_ERROR;  args = rb_ary_new3(3,                     handler,                     rb_id_call(),                     c2r_txdelta_window__dup(window));  result = invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_apply_textdelta(void *file_baton,                              const char *base_checksum,                             apr_pool_t *pool,                             svn_txdelta_window_handler_t *handler,                             void **h_baton){  item_baton *ib = file_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  VALUE result;  args = rb_ary_new3(4,                     ib->editor,                     rb_id_apply_textdelta(),                     ib->baton,                     c2r_string2(base_checksum));  result = invoke_callback_handle_error(args, Qnil, &err);  if (NIL_P(result)) {    *handler = svn_delta_noop_window_handler;    *h_baton = NULL;  } else {    *handler = delta_editor_window_handler;    *h_baton = (void *)result;  }  return err;}static svn_error_t *delta_editor_change_file_prop(void *file_baton,                              const char *name,                              const svn_string_t *value,                              apr_pool_t *pool){  item_baton *ib = file_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(5,                     ib->editor,                     rb_id_change_file_prop(),                     ib->baton,                     c2r_string2(name),                     value ? rb_str_new(value->data, value->len) : Qnil);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_close_file(void *file_baton,                        const char *text_checksum,                        apr_pool_t *pool){  item_baton *ib = file_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(4,                     ib->editor,                     rb_id_close_file(),                     ib->baton,                     c2r_string2(text_checksum));  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_absent_file(const char *path,                         void *parent_baton,                         apr_pool_t *pool){  item_baton *ib = parent_baton;  svn_error_t *err = SVN_NO_ERROR;  VALUE args;  args = rb_ary_new3(4,                     ib->editor,                     rb_id_absent_file(),                     c2r_string2(path),                     ib->baton);  invoke_callback_handle_error(args, Qnil, &err);  return err;}static svn_error_t *delta_editor_close_edit(void *edit_baton, apr_pool_t *pool){  item_baton *ib = edit_baton;  svn_error_t *err = delta_editor_close_baton(edit_baton, rb_id_close_edit());  rb_ary_clear(rb_ivar_get(ib->editor, rb_id_baton()));  return err;}static svn_error_t *delta_editor_abort_edit(void *edit_baton, apr_pool_t *pool){  item_baton *ib = edit_baton;  svn_error_t *err = delta_editor_close_baton(edit_baton, rb_id_abort_edit());  rb_ary_clear(rb_ivar_get(ib->editor, rb_id_baton()));  return err;}voidsvn_swig_rb_make_delta_editor(svn_delta_editor_t **editor,                              void **edit_baton,                              VALUE rb_editor,                              apr_pool_t *pool){  svn_delta_editor_t *thunk_editor = svn_delta_default_editor(pool);    thunk_editor->set_target_revision = delta_editor_set_target_revision;  thunk_editor->open_root = delta_editor_open_root;  thunk_editor->delete_entry = delta_editor_delete_entry;  thunk_editor->add_directory = delta_editor_add_directory;  thunk_editor->open_directory = delta_editor_open_directory;  thunk_editor->change_dir_prop = delta_editor_change_dir_prop;  thunk_editor->close_directory = delta_editor_close_directory;  thunk_editor->absent_directory = delta_editor_absent_directory;  thunk_editor->add_file = delta_editor_add_file;  thunk_editor->open_file = delta_editor_open_file;  thunk_editor->apply_textdelta = delta_editor_apply_textdelta;  thunk_editor->change_file_prop = delta_editor_change_file_prop;  thunk_editor->close_file = delta_editor_close_file;  thunk_editor->absent_file = delta_editor_absent_file;  thunk_editor->close_edit = delta_editor_close_edit;  thunk_editor->abort_edit = delta_editor_abort_edit;  *editor = thunk_editor;  rb_ivar_set(rb_editor, rb_id_baton(), rb_ary_new());  *edit_baton = make_baton(pool, rb_editor, Qnil);}VALUEsvn_swig_rb_make_baton(VALUE proc, VALUE pool){  if (NIL_P(proc)) {    return Qnil;  } else {    return rb_ary_new3(2, proc, pool);  }}voidsvn_swig_rb_from_baton(VALUE baton, VALUE *proc, VALUE *pool){  if (NIL_P(baton)) {    *proc = Qnil;    *pool = Qnil;  } else {    *proc = rb_ary_entry(baton, 0);    *pool = rb_ary_entry(baton, 1);  }}svn_error_t *svn_swig_rb_log_receiver(void *baton,                         apr_hash_t *changed_paths,                         svn_revnum_t revision,                         const char *author,                         const char *date,                         const char *message,                         apr_pool_t *pool){  svn_error_t *err = SVN_NO_ERROR;  VALUE proc, rb_pool;  svn_swig_rb_from_baton((VALUE)baton, &proc, &rb_pool);    if (!NIL_P(proc)) {    VALUE args;    VALUE rb_changed_paths = Qnil;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -