*** empty log message ***
[m17n/m17n-docs.git] / utils / mkman.rb
index 5cf667d..f695ff1 100644 (file)
@@ -1,25 +1,23 @@
 #! /usr/local/bin/ruby
 #! /usr/local/bin/ruby
+# Usage: mkman.rb SRCDIR DSTDIR
+
 #¼Â¹Ô¤¹¤ë¤È/tmp/doxyman¤ò¤Ä¤«¤Ã¤Æ¥Õ¥¡¥¤¥ë¤òʬ¤±¡¢
 #¤â¤È¤Îdirectory¤Ë¤«¤­¤Ê¤ª¤¹¡£
 # see also ¤ÎÃæ¿È¤ò woman ¸þ¤±¤Ë½ñ¤­´¹¤¨¤ë¡£
 
 #¼Â¹Ô¤¹¤ë¤È/tmp/doxyman¤ò¤Ä¤«¤Ã¤Æ¥Õ¥¡¥¤¥ë¤òʬ¤±¡¢
 #¤â¤È¤Îdirectory¤Ë¤«¤­¤Ê¤ª¤¹¡£
 # see also ¤ÎÃæ¿È¤ò woman ¸þ¤±¤Ë½ñ¤­´¹¤¨¤ë¡£
 
-usr_or_ja=$*[0]
+$manext="."+$*[0]
 
 #
 # Setting up directory names.
 #
 
 $currentdir = Dir.pwd+"/"
 
 #
 # Setting up directory names.
 #
 
 $currentdir = Dir.pwd+"/"
+$srcdir=$currentdir+$*[1]+"/"
+$dstdir=$currentdir+$*[2]+"/"
 $doxywork = $currentdir+"doxywork/"
 $doxywork = $currentdir+"doxywork/"
-$srcman3 = $currentdir+usr_or_ja+"/man/man3/"
-if usr_or_ja == "usr"
-  $dstman3m = $currentdir+"/usr/man3m/"
-else
-  $dstman3m = $currentdir+"/ja/man3m/"
-end
 $sampledir="sample/man3/"
 $sampledir="sample/man3/"
-
 $headfile = $currentdir+"manhead"
 $headfile = $currentdir+"manhead"
+
 headbuf = open($headfile, "r").readlines
 
 #
 headbuf = open($headfile, "r").readlines
 
 #
@@ -87,7 +85,7 @@ def  writedocumentation(buf, text, index)
 
 def datastructure(struct)
 
 
 def datastructure(struct)
 
-   text = open(struct.concat(".3m"),"r").readlines
+   text = open(struct.concat($manext),"r").readlines
 
    buf = []
 
 
    buf = []
 
@@ -172,7 +170,7 @@ def documentfunc2 (dstart, title, func_text, short_text)
  #short_text¤Î´Ø¿ô̾¤Î£²¹Ô¸å¤¬brief¡£
    brief =  short_text[short_text.index(short_text.find{|i| i.index(ffname)}) + 2]
  #´Ø¿ô¤´¤È¤Î¥Õ¥¡¥¤¥ë¤òºî¤ë¡£
  #short_text¤Î´Ø¿ô̾¤Î£²¹Ô¸å¤¬brief¡£
    brief =  short_text[short_text.index(short_text.find{|i| i.index(ffname)}) + 2]
  #´Ø¿ô¤´¤È¤Î¥Õ¥¡¥¤¥ë¤òºî¤ë¡£
-   file = open($doxywork+fname+".3m", "w")
+   file = open($doxywork+fname+$manext, "w")
    file.puts("@function")
  #¥Ø¥Ã¥À
    /^\.TH \"([^"]*)\"\s/ =~ title
    file.puts("@function")
  #¥Ø¥Ã¥À
    /^\.TH \"([^"]*)\"\s/ =~ title
@@ -402,7 +400,7 @@ end
 
 Dir.mkdir $doxywork unless FileTest.directory? $doxywork
 
 
 Dir.mkdir $doxywork unless FileTest.directory? $doxywork
 
-Dir.chdir($srcman3)
+Dir.chdir($srcdir)
 
 Dir.open(".").each{|filename|
 
 
 Dir.open(".").each{|filename|
 
@@ -454,7 +452,7 @@ Dir.open(".").each{|filename|
 
 #############################rewriting files
 
 
 #############################rewriting files
 
-Dir.chdir($dstman3m)
+Dir.chdir($dstdir)
 
 Dir.open(".").each{|f|  File.delete(f) if FileTest.file?(f)}
 
 
 Dir.open(".").each{|f|  File.delete(f) if FileTest.file?(f)}
 
@@ -477,7 +475,7 @@ unless FileTest.directory? filename
         else buf = orewrite(text)
       end
 
         else buf = orewrite(text)
       end
 
-     filetowrite = open($dstman3m+filename,"w")
+     filetowrite = open($dstdir+filename,"w")
      filetowrite.puts(headbuf)
      filetowrite.puts(buf)
      filetowrite.flush
      filetowrite.puts(headbuf)
      filetowrite.puts(buf)
      filetowrite.flush