Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c  view on Meta::CPAN

{
  if (NIL_P(cSvnFs)) {
    cSvnFs = rb_const_get(rb_svn(), rb_intern("Fs"));
  }
  return cSvnFs;
}

static VALUE
rb_svn_fs_file_system(void)
{
  if (NIL_P(cSvnFsFileSystem)) {
    cSvnFsFileSystem = rb_const_get(rb_svn_fs(), rb_intern("FileSystem"));
    rb_ivar_set(cSvnFsFileSystem, id___batons__, rb_hash_new());
  }
  return cSvnFsFileSystem;
}

static VALUE
rb_svn_ra(void)
{
  if (NIL_P(cSvnRa)) {
    cSvnRa = rb_const_get(rb_svn(), rb_intern("Ra"));
  }
  return cSvnRa;
}

static VALUE
rb_svn_ra_reporter3(void)
{
  if (NIL_P(cSvnRaReporter3)) {
    cSvnRaReporter3 = rb_const_get(rb_svn_ra(), rb_intern("Reporter3"));
  }
  return cSvnRaReporter3;
}


/* constant resolver */
static VALUE
resolve_constant(VALUE parent, const char *prefix, VALUE name)
{
    VALUE const_name;

    const_name = rb_str_new2(prefix);
    rb_str_concat(const_name,
                  rb_funcall(rb_funcall(name, id_to_s, 0),
                             id_upcase, 0));
    return rb_const_get(parent, rb_intern(StringValuePtr(const_name)));
}


/* initialize */
static VALUE
svn_swig_rb_converter_to_locale_encoding(VALUE self, VALUE str)
{
  apr_pool_t *pool;
  svn_error_t *err;
  const char *dest;
  VALUE result;

  pool = svn_pool_create(NULL);
  err = svn_utf_cstring_from_utf8(&dest, StringValueCStr(str), pool);
  if (err) {
    svn_pool_destroy(pool);
    svn_swig_rb_handle_svn_error(err);
  }

  result = rb_str_new2(dest);
  svn_pool_destroy(pool);
  return result;
}

static VALUE
svn_swig_rb_locale_set(int argc, VALUE *argv, VALUE self)
{
  char *result;
  int category;
  const char *locale;
  VALUE rb_category, rb_locale;

  rb_scan_args(argc, argv, "02", &rb_category, &rb_locale);

  if (NIL_P(rb_category))
    category = LC_ALL;
  else
    category = NUM2INT(rb_category);

  if (NIL_P(rb_locale))
    locale = "";
  else
    locale = StringValueCStr(rb_locale);

  result = setlocale(category, locale);

  return result ? rb_str_new2(result) : Qnil;
}

static VALUE
svn_swig_rb_gettext_bindtextdomain(VALUE self, VALUE path)
{
#ifdef ENABLE_NLS
  bindtextdomain(PACKAGE_NAME, StringValueCStr(path));
#endif
  return Qnil;
}

static VALUE
svn_swig_rb_gettext__(VALUE self, VALUE message)
{
#ifdef ENABLE_NLS
  return rb_str_new2(_(StringValueCStr(message)));
#else
  return message;
#endif
}

static void
svn_swig_rb_initialize_ids(void)
{
  DEFINE_ID(code);
  DEFINE_ID(message);
  DEFINE_ID(call);



( run in 1.483 second using v1.01-cache-2.11-cpan-5623c5533a1 )