[gobject-introspection] [scanner] Also parse C++ files



commit 5e45b27c31df528672134961e4655d5fca08cbc7
Author: Gustavo Noronha Silva <gustavo noronha collabora co uk>
Date:   Tue Aug 17 11:31:17 2010 -0300

    [scanner] Also parse C++ files
    
    This is to support cases such as WebKitGTK+, that have C API
    implemented in C++ files. Do note this does not mean we support proper
    C++ parsing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627152

 giscanner/scannermain.py   |    8 ++++++--
 giscanner/sourcescanner.py |    3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 363f6f6..3694282 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -266,8 +266,12 @@ def scanner_main(args):
 
     filenames = []
     for arg in args:
-        if (arg.endswith('.c') or
-            arg.endswith('.h')):
+        # We don't support real C++ parsing yet, but we should be able
+        # to understand C API implemented in C++ files.
+        if (arg.endswith('.c') or arg.endswith('.cpp') or
+            arg.endswith('.cc') or arg.endswith('.cxx') or
+            arg.endswith('.h') or arg.endswith('.hpp') or
+            arg.endswith('.hxx')):
             if not os.path.exists(arg):
                 _error('%s: no such a file or directory' % (arg, ))
             # Make absolute, because we do comparisons inside scannerparser.c
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index ae3d29d..cd7a432 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -220,7 +220,8 @@ class SourceScanner(object):
 
         headers = []
         for filename in filenames:
-            if filename.endswith('.c'):
+            if (filename.endswith('.c') or filename.endswith('.cpp') or
+                filename.endswith('.cc') or filename.endswith('.cxx')):
                 filename = os.path.abspath(filename)
                 self._scanner.lex_filename(filename)
             else:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]