From: Eric S. Raymond Date: Wed, 4 Oct 2006 16:40:09 +0000 (+0000) Subject: Add some file object methods. X-Git-Tag: 1.0~21 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=6a7a4e1dead5a57695a3be800a3ab432ddc8ede2;p=ctopy.git Add some file object methods. --- diff --git a/ctopy b/ctopy index 293eb69..dee4d8a 100755 --- a/ctopy +++ b/ctopy @@ -339,6 +339,14 @@ funmappings = ( # These are C functions that need to turn into method calls on their first arg methodmappings = ( + # File objects + ("fclose", "close", None), + ("fflush", "flush", None), + ("fileno", "fileno", None), + ("fprintf", "write", None), + ("fseek", "seek", None), + ("ftell", "tell", None), + ("ftruncate", "truncate", None), # Curses library. This is all the methods on the Windows Objects page ("waddch", "addch", "curses"), ("waddnstr", "addnstr", "curses"), @@ -511,7 +519,7 @@ post_transformations = ( (r"\bfor \((%(id)s) *= *(\w+); *\1 *< *([^;]+); *\1\+\+\)(\s*{)?", r"for \1 in range(\2, \3):"), (r"else if", r"elif"), - (r"else *{", r"else"), + (r"(?:} )?else\s*{", r"else"), (r"(?