From 48ca569fea7e1a22f2994b3f5a7396ba7cf30959 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 21 Feb 2010 13:29:46 +0000 Subject: [PATCH] Minor fixes. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4683 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ plugins/genapi.py | 39 ++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index eee8008c5..be23c2518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * scripts/create_py_tags.py: Minor fixes. Replace tabs by spaces. + * plugins/genapi.py: + Minor fixes. 2010-02-20 Dominic Hopf diff --git a/plugins/genapi.py b/plugins/genapi.py index 8fb5b2781..1a1a8644f 100755 --- a/plugins/genapi.py +++ b/plugins/genapi.py @@ -34,25 +34,22 @@ import re, sys def get_function_names(): names = [] - try: - f = open('../src/plugins.c') - while 1: - l = f.readline() - if l == "": - break; - m = re.match("^\t&([a-z][a-z0-9_]+)", l) - if m: - s = m.group(1) - if not s.endswith('_funcs'): - names.append(s) - f.close - except: - pass + filep = open('../src/plugins.c') + while 1: + line = filep.readline() + if line == "": + break + match = re.match("^\t&([a-z][a-z0-9_]+)", line) + if match: + symbol = match.group(1) + if not symbol.endswith('_funcs'): + names.append(symbol) + filep.close() return names -def get_api_tuple(str): - m = re.match("^([a-z]+)_([a-z][a-z0-9_]+)$", str) - return 'p_' + m.group(1), m.group(2) +def get_api_tuple(source): + match = re.match("^([a-z]+)_([a-z][a-z0-9_]+)$", source) + return 'p_' + match.group(1), match.group(2) header = \ @@ -83,15 +80,15 @@ if __name__ == "__main__": sys.exit("No function names read!") f = open(outfile, 'w') - print >>f, header % (outfile) + print >> f, header % (outfile) for fname in fnames: ptr, name = get_api_tuple(fname) # note: name no longer needed - print >>f, '#define %s \\\n\tgeany_functions->%s->%s' % (fname, ptr, fname) + print >> f, '#define %s \\\n\tgeany_functions->%s->%s' % (fname, ptr, fname) - print >>f, '\n#endif' - f.close + print >> f, '\n#endif' + f.close() if not '-q' in sys.argv: print 'Generated ' + outfile -- 2.11.4.GIT