Make a status test pass against old servers.
[svn.git] / build / generator / extractor.py
blob814c5d03dbd74367af29d7af2697bcb7eeec8e5d
1 #!/usr/bin/env python
3 # extractor.py: extract function names from declarations in header files
5 # ====================================================================
6 # Copyright (c) 2000-2006 CollabNet. All rights reserved.
8 # This software is licensed as described in the file COPYING, which
9 # you should have received as part of this distribution. The terms
10 # are also available at http://subversion.tigris.org/license-1.html.
11 # If newer versions of this license are posted there, you may use a
12 # newer version instead, at your option.
14 # This software consists of voluntary contributions made by many
15 # individuals. For exact contribution history, see the revision
16 # history and logs, available at http://subversion.tigris.org/.
17 # ====================================================================
20 import os
21 import re
22 import string
25 # This parses the following two types of declarations:
27 # void
28 # svn_foo_bar (args)
29 # or
30 # void svn_foo_bar (args)
32 _funcs = re.compile(r'^(?:(?:(?:\w+|\*) )+\*?)?((?:svn|apr)_[a-z_0-9]+)\s*\(', re.M)
34 def extract_funcs(fname):
35 funcs = [ ]
36 for name in _funcs.findall(open(fname).read()):
37 if name not in _filter_names:
38 funcs.append(name)
39 return funcs
41 _filter_names = [
42 'svn_boolean_t', # svn_config_enumerator_t looks like (to our regex) a
43 # function declaration for svn_boolean_t
44 'svn_auth_get_keychain_simple_provider', # Not available on Windows
47 if __name__ == '__main__':
48 # run the extractor over each file mentioned
49 import sys
50 print "EXPORTS"
51 for fname in sys.argv[1:]:
52 for func in extract_funcs(fname):
53 print func
54 if os.path.basename(fname) == 'svn_ctype.h':
55 print 'svn_ctype_table = svn_ctype_table_internal CONSTANT'