[前][次][番号順一覧][スレッド一覧]

ruby-changes:23657

From: nobu <ko1@a...>
Date: Sat, 19 May 2012 11:38:11 +0900 (JST)
Subject: [ruby-changes:23657] nobu:r35708 (trunk): ext/extmk.rb: fold long macro

nobu	2012-05-19 11:36:25 +0900 (Sat, 19 May 2012)

  New Revision: 35708

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35708

  Log:
    ext/extmk.rb: fold long macro
    
    * ext/extmk.rb (command_output): fold long macro lines.

  Modified files:
    trunk/ChangeLog
    trunk/ext/extmk.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35707)
+++ ChangeLog	(revision 35708)
@@ -1,5 +1,7 @@
-Sat May 19 11:35:33 2012  Nobuyoshi Nakada  <nobu@r...>
+Sat May 19 11:36:22 2012  Nobuyoshi Nakada  <nobu@r...>
 
+	* ext/extmk.rb (command_output): fold long macro lines.
+
 	* Makefile.in (LIBEXT): add macro.
 
 	* configure.in (ENCOBJS, EXTOBJS): use LIBEXT, not hardcoded suffix.
Index: ext/extmk.rb
===================================================================
--- ext/extmk.rb	(revision 35707)
+++ ext/extmk.rb	(revision 35708)
@@ -628,26 +628,26 @@
     mf.puts "MFLAGS = -$(MAKEFLAGS)" if $nmake
     mf.puts
 
-    mf.print "extensions ="
-    w = 12
-    exts.each do |d|
-      if d.size + w > 70
-        mf.print " \\\n\t    "
-        w = 12
+    def mf.macro(name, values, max = 70)
+      print name, " ="
+      w = w0 = name.size + 2
+      h = " \\\n" + "\t" * (w / 8) + " " * (w % 8)
+      values.each do |s|
+        if s.size + w > max
+          print h
+          w = w0
+        end
+        print " ", s
+        w += s.size + 1
       end
-      mf.print " #{d}"
-      w += d.size + 1
+      puts
     end
+
+    mf.macro "extensions", exts
+    mf.macro "EXTOBJS", $extlist.empty? ? [] : ["ext/extinit.#{$OBJEXT}", *$extobjs]
+    mf.macro "EXTLIBS", $extlibs
+    mf.macro "EXTLDFLAGS", $extflags.split
     mf.puts
-    if !$extlist.empty?
-      mf.puts "EXTOBJS = ext/extinit.#{$OBJEXT} #{$extobjs.join(' ')}"
-      mf.puts "EXTLIBS = #{$extlibs.join(' ')}"
-    else
-      mf.puts "EXTOBJS = "
-      mf.puts "EXTLIBS = "
-    end
-    mf.puts "EXTLDFLAGS = #{$extflags}"
-    mf.puts
     targets = %w[all install static install-so install-rb clean distclean realclean]
     targets.each do |tgt|
       mf.puts "#{tgt}: $(extensions:/.=/#{tgt})"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]