[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

Re: [ ruby-Patches-7499 ] RDoc patch that fixes rb_const_define output

From: Eric Hodel <drbrain@...7.net>
Date: 2006-12-31 09:04:26 UTC
List: ruby-core #9818
On Dec 31, 2006, at 24:31, Eric Hodel wrote:
> On Dec 30, 2006, at 19:16, Daniel Berger wrote:
>> On a side note, I've noticed that multiline comments for constants
>> don't format properly (with or without my patch) - they seem to  
>> indent
>> on the newline.  But, I'll worry about that in another patch. :)
>
> Like this?
>
> It could possibly be made cleaner, I am tired.

No, how about this one.  It probably could be made cleaner, I'm still  
tired.

Index: lib/rdoc/parsers/parse_c.rb
===================================================================
--- lib/rdoc/parsers/parse_c.rb (revision 11436)
+++ lib/rdoc/parsers/parse_c.rb (working copy)
@@ -444,14 +446,37 @@

        comment = find_const_comment(type, const_name)
-      con = Constant.new(const_name, definition, mangle_comment 
(comment))
+      # In the case of rb_define_const, the definition and comment  
are in
+      # "/* definition: comment */" form.  The literal ':' and '\'  
characters
+      # can be escaped with a backslash.
+      if type.downcase == 'const' then
+         elements = mangle_comment(comment).split(':')
+         if elements.nil? or elements.empty? then
+            con = Constant.new(const_name, definition, mangle_comment 
(comment))
+         else
+            new_definition = elements[0..-2].join(':')
+            if new_definition.empty? then # Default to literal C  
definition
+               new_definition = definition
+            else
+               new_definition.gsub!("\:", ":")
+               new_definition.gsub!("\\", '\\')
+            end
+            new_definition.sub!(/\A(\s+)/, '')
+            new_comment = $1.nil? ? elements.last : "#{$1}# 
{elements.last.lstrip}"
+            con = Constant.new(const_name, new_definition,
+                               mangle_comment(new_comment))
+         end
+      else
+         con = Constant.new(const_name, definition, mangle_comment 
(comment))
+      end
+
        class_obj.add_constant(con)
      end
      ###########################################################
      def find_const_comment(type, const_name)
-      if @body =~ %r{((?>/\*.*?\*/\s+))
+      if @body =~ %r{((?>^\s*/\*.*?\*/\s+))
                       rb_define_#{type}\((?:\s*(\w+),)?\s*"# 
{const_name}"\s*,.*?\)\s*;}xmi
          $1
        elsif @body =~ %r{Document-(?:const|global|variable):\s# 
{const_name}\s*?\n((?>.*?\*/))}m

-- 
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!


In This Thread