aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-01-12 09:35:26 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-01-12 09:35:26 +0000
commitc50c50bf9317c415532041c8fb50166f7590dd05 (patch)
treebb7c153baba7e60e61e7d6fcfa903a4829ea6f23
parent83034e2a37c52db73e4f911434c3a833205be9ad (diff)
downloadpaludis-c50c50bf9317c415532041c8fb50166f7590dd05.tar.gz
paludis-c50c50bf9317c415532041c8fb50166f7590dd05.tar.xz
Document const comments in ruby.
-rw-r--r--doc/create_ruby_doc.rb17
-rw-r--r--ruby/dep_list.cc2
2 files changed, 13 insertions, 6 deletions
diff --git a/doc/create_ruby_doc.rb b/doc/create_ruby_doc.rb
index 0ae6f85..980c22c 100644
--- a/doc/create_ruby_doc.rb
+++ b/doc/create_ruby_doc.rb
@@ -55,14 +55,21 @@ module RDoc
def generate_consts(header, type, in_class)
consts = []
- file = IO.readlines("../#{header}").join("").gsub(%r{//.*$},'').gsub(/\s+/,'')
- if file =~ /enum#{type}\{([^}]+)\}/
+ file = File.read("../#{header}")
+ match = Regexp.new(/enum\s+#{type}\s+\{([^}]+)\}/, Regexp::MULTILINE)
+ if file =~ match
i = 0
- $1.split(',').each do |line|
+ $1.each_line do |line|
next if line =~/last/
- const = line.sub(%r{^[^_]+_},'').capitalize #strip start
+ next if line.strip == ''
+ next unless line =~ /,/
+ (const, comment) = line.split (',',2)
+ const.strip!
+ comment.strip!
+ comment.gsub!(%r{^[^a-zA-Z0-9]*},'')
+ const.sub!(%r{^[^_]+_},'').capitalize! #strip start
const.gsub!(%r{[_\s](\w)}) { |x| $1.capitalize}
- consts << "rb_define_const(#{in_class}, \"#{const}\", #{i});"
+ consts << "/*\n*#{comment}\n*/\nrb_define_const(#{in_class}, \"#{const}\", #{i});"
i+=1
end
end
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index 3ecafa0..65a98e0 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -663,7 +663,7 @@ namespace
l = static_cast<DepListReinstallScmOption>(static_cast<int>(l) + 1))
rb_define_const(c_dep_list_reinstall_scm_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
- // cc_enum_special<paludis/dep_list/options.hh, DepListReinstalScmlOption, c_dep_list_reinstall_scm_option>
+ // cc_enum_special<paludis/dep_list/options.hh, DepListReinstallScmOption, c_dep_list_reinstall_scm_option>
/*
* Document-module: Paludis::DepListUpgradeOption