]> thyrsus.com Git - ctopy.git/commitdiff
We handle boxed comments now.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 29 Sep 2006 03:34:33 +0000 (03:34 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 29 Sep 2006 03:34:33 +0000 (03:34 +0000)
ctopy

diff --git a/ctopy b/ctopy
index 90735f39b6c9f2b7acf6e9904dbdda091c712634..65b9997bc4f6554c1214e27bc169fb47891fb334 100755 (executable)
--- a/ctopy
+++ b/ctopy
@@ -202,7 +202,7 @@ def ctopy(input, debug=0):
                 elif re.search("/\*+\n", regions[i]):  # boxed comment
                     regions[i] = re.sub(r"\n([ \t]*) \* ?", r"\n\1",regions[i])
                     regions[i] = re.sub(r"\n([ \t]*)\*", r"\n\1", regions[i])
-                    regions[i] = re.sub(r"^([ \t]*)/\*+\n", r"\1\n", regions[i])
+                    regions[i] = re.sub(r"^([ \t]*)/\*+\n", r"\1#\n", regions[i])
                     regions[i] = re.sub(r"\n([ \t]*)\**/", r"\n\1", regions[i])
                     regions[i] = re.sub(r"\n([ \t]*)(?!#)", r"\n\1# ", regions[i])
                 else:
@@ -235,9 +235,9 @@ def ctopy(input, debug=0):
     importlist = filter(lambda x: ("import %s" % x).find(text) > -1, importlist)
     if importlist:
         importlist = "import " + ",".join(importlist) + "\n"
-        regions.insert(0, importlist)
+        text = importlist + text
     # Emit what we got.  Preverve imports in case this is a .h file 
-    return (text, importlist)
+    return text
 
 if __name__ == "__main__":
     import getopt
@@ -248,5 +248,5 @@ if __name__ == "__main__":
            debug = 1
 
     code = sys.stdin.read()
-    (text, imports) = ctopy(code, debug)
+    text = ctopy(code, debug)
     sys.stdout.write(text)