aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-11-11 22:34:15 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-11-11 22:34:15 +0000
commita3e527497a23f92b6454c058ccf899b59186b09b (patch)
tree8ad77f063e446fcc9062c95d0ebef6e07960dbb1
parent23ac22983def7c89f81f89e8ed72765d2efaaf12 (diff)
downloadpaludis-a3e527497a23f92b6454c058ccf899b59186b09b.tar.gz
paludis-a3e527497a23f92b6454c058ccf899b59186b09b.tar.xz
(ruby) Remove redundant code and fix global rdoc descriptions.
-rw-r--r--doc/api/ruby/create_ruby_doc.rb33
-rw-r--r--ruby/environment.cc5
-rw-r--r--ruby/paludis_ruby.cc23
-rw-r--r--ruby/paludis_ruby.hh2
4 files changed, 18 insertions, 45 deletions
diff --git a/doc/api/ruby/create_ruby_doc.rb b/doc/api/ruby/create_ruby_doc.rb
index 9901d54..f510af1 100644
--- a/doc/api/ruby/create_ruby_doc.rb
+++ b/doc/api/ruby/create_ruby_doc.rb
@@ -4,34 +4,33 @@
require 'rdoc/rdoc'
module RDoc
- #define these ourself, as they are in all files.
-# KNOWN_CLASSES['rb_mPaludis'] = 'Paludis'
-# KNOWN_CLASSES['rb_mQA'] = 'Paludis::QA'
-# KNOWN_CLASSES['c_environment'] = 'Paludis::Environment'
class C_Parser_Paludis < C_Parser
#override C_Parse
parse_files_matching(/\.(c|cc|cpp|CC)$/)
def initialize(top_level, file_name, body, options, stats)
- #Paludis and Paludis::QA are already added
+ paludis_desc = <<-DESC
+
+ /*
+ * Document-module: Paludis
+ *
+ * <b>Paludis</b> is the other package mangler, this is the doc to the ruby binding. The C++ library
+ * documentation may also help.
+ *
+ */
+ c_paludis_module = rb_define_module("Paludis");
+
+ DESC
+ #Paludis and are already added
body.gsub!('paludis_module()','c_paludis_module')
- body.gsub!('paludis_qa_module()','c_paludis_qa_module')
- body.gsub!('no_config_environment_class()','c_no_config_environment')
- body.gsub!('environment_class()','c_environment')
#parse_c hates rb_defines over multiple lines
body.gsub!(/(rb_define[^;]+)\n/) {|match| $1}
new_body=''
- new_body += "\n" + 'c_paludis_module = rb_define_module("Paludis");' + "\n"
- new_body += 'c_paludis_qa_module = rb_define_module_under(c_paludis_module, "QA");' + "\n"
- new_body += 'c_environment = rb_define_class_under(c_paludis_module, "Environment", rb_cObject);' + "\n"
- new_body += 'c_no_config_environment = rb_define_class_under(c_paludis_module, "NoConfigEnvironment", c_environment);' + "\n"
+ new_body += paludis_desc
body.each_line do |line|
- next if line =~ /rb_mPaludis\s*=/
- next if line =~ /rb_mQA\s*=/
- next if line =~ /c_environment\s*=/
- next if line =~ /c_no_config_environment\s*=/
+ next if line =~ /c_paludis_module\s*=/
if line =~ /cc_enum_special/
line.scan(/cc_enum_special<([^,]+),\s*([^,]+),\s*([^>]+)>/) do
|header_file, type, in_class|
@@ -48,8 +47,6 @@ module RDoc
end
new_body+= line
end
- #puts new_body
- #exit
super(top_level, file_name, new_body, options, stats)
end
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 55caed0..f602a3c 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -484,7 +484,7 @@ namespace
* Represents a working environment, which contains an available packages database and provides
* various methods for querying package visibility and options.
*/
- c_environment = environment_class();
+ c_environment = rb_define_class_under(paludis_module(), "Environment", rb_cObject);
rb_funcall(c_environment, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_environment, "query_use", RUBY_FUNC_CAST(&environment_query_use), 2);
rb_define_method(c_environment, "package_database", RUBY_FUNC_CAST(&environment_package_database), 0);
@@ -511,7 +511,7 @@ namespace
*
* An environment that uses a single repository, with no user configuration.
*/
- c_no_config_environment = no_config_environment_class();
+ c_no_config_environment = rb_define_class_under(paludis_module(), "NoConfigEnvironment", c_environment);
rb_define_singleton_method(c_no_config_environment, "new", RUBY_FUNC_CAST(&no_config_environment_new), -1);
rb_define_method(c_no_config_environment, "initialize", RUBY_FUNC_CAST(&no_config_environment_init), -1);
rb_define_method(c_no_config_environment, "main_repository", RUBY_FUNC_CAST(&no_config_environment_main_repository), 0);
@@ -525,7 +525,6 @@ namespace
* existing Environment, e.g. the state of a USE flag for a
* package.
*/
-
c_adapted_environment = rb_define_class_under(paludis_module(), "AdaptedEnvironment", c_environment);
rb_define_singleton_method(c_adapted_environment, "new", RUBY_FUNC_CAST(&adapted_environment_new), -1);
rb_define_method(c_adapted_environment, "initialize", RUBY_FUNC_CAST(&adapted_environment_init), -1);
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index c610ea1..06d231f 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -75,9 +75,6 @@ namespace
static VALUE c_action_error;
static VALUE c_bad_version_operator_error;
- static VALUE c_environment;
- static VALUE c_no_config_environment;
-
/*
* Document-method: match_package
*
@@ -263,18 +260,6 @@ paludis::ruby::paludis_module()
return c_paludis_module;
}
-VALUE
-paludis::ruby::environment_class()
-{
- return c_environment;
-}
-
-VALUE
-paludis::ruby::no_config_environment_class()
-{
- return c_no_config_environment;
-}
-
static VALUE
has_query_property_error_init(int argc, VALUE* argv, VALUE self)
{
@@ -324,15 +309,9 @@ fetch_action_error_failures(VALUE self)
void PALUDIS_VISIBLE paludis::ruby::init()
{
/*
- * Document-module: Paludis
- *
- * <b>Paludis</b> is the other package mangler, this is the doc to the ruby binding. The C++ library
- * documentation may also help.
- *
+ * Defined in create_ruby_doc.rb
*/
c_paludis_module = rb_define_module("Paludis");
- c_environment = rb_define_class_under(paludis_module(), "Environment", rb_cObject);
- c_no_config_environment = rb_define_class_under(paludis_module(), "NoConfigEnvironment", c_environment);
c_name_error = rb_define_class_under(c_paludis_module, "NameError", rb_eRuntimeError);
c_set_name_error = rb_define_class_under(c_paludis_module, "SetNameError", c_name_error);
c_category_name_part_error = rb_define_class_under(c_paludis_module, "CategoryNamePartError", c_name_error);
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index c8220c5..b1e8227 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -69,8 +69,6 @@ namespace paludis
std::string value_case_to_RubyCase(const std::string & s);
VALUE paludis_module();
- VALUE environment_class();
- VALUE no_config_environment_class();
bool is_kind_of_query(VALUE query);