diff options
author | Eli Bendersky <eliben@gmail.com> | 2015-04-21 14:42:56 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2015-04-21 14:42:56 -0700 |
commit | 331f81f994b3447be17fa93040f6713c02949ec8 (patch) | |
tree | 3e55669ac9ef9e0b3e843067717c9b589d451d38 /examples/func_calls.py | |
parent | b17da15ad70e0062019f6f9a78406410313184e8 (diff) | |
download | pycparser-331f81f994b3447be17fa93040f6713c02949ec8.tar.gz |
Fix up examples to run properly from the main source dir
Diffstat (limited to 'examples/func_calls.py')
-rw-r--r-- | examples/func_calls.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/func_calls.py b/examples/func_calls.py index f56f153..72c64d3 100644 --- a/examples/func_calls.py +++ b/examples/func_calls.py @@ -4,7 +4,7 @@ # Using pycparser for printing out all the calls of some function # in a C file. # -# Copyright (C) 2008-2011, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- from __future__ import print_function @@ -12,7 +12,6 @@ import sys # This is not required if you've installed pycparser into # your site-packages/ with setup.py -# sys.path.extend(['.', '..']) from pycparser import c_parser, c_ast, parse_file @@ -27,8 +26,7 @@ class FuncCallVisitor(c_ast.NodeVisitor): def visit_FuncCall(self, node): if node.name.name == self.funcname: - print('%s called at %s' % ( - self.funcname, node.name.coord)) + print('%s called at %s' % (self.funcname, node.name.coord)) def show_func_calls(filename, funcname): @@ -42,7 +40,7 @@ if __name__ == "__main__": filename = sys.argv[1] func = sys.argv[2] else: - filename = 'c_files/hash.c' + filename = 'examples/c_files/hash.c' func = 'malloc' show_func_calls(filename, func) |