gobject-introspection 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +7 -7
- data/ext/gobject-introspection/rb-gi-argument.c +28 -3
- data/ext/gobject-introspection/rb-gi-constructor-info.c +6 -1
- data/ext/gobject-introspection/rb-gi-function-info.c +29 -4
- data/ext/gobject-introspection/rb-gi-loader.c +19 -3
- data/ext/gobject-introspection/rb-gi-struct-info.c +28 -16
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/gobject-introspection/callable-info.rb +16 -7
- data/lib/gobject-introspection/loader.rb +47 -19
- data/test/test-object-info.rb +1 -1
- data/test/test-signal-info.rb +2 -2
- data/test/test-struct-info.rb +1 -1
- data/vendor/local/bin/g-ir-compiler.exe +0 -0
- data/vendor/local/bin/g-ir-generate.exe +0 -0
- data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
- data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +30 -0
- data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +31 -0
- data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +36 -0
- data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +12 -0
- data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +26 -0
- data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +19 -0
- data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +23 -0
- data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +38 -0
- data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +72 -2
- data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +12 -0
- data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +11 -0
- data/vendor/local/include/gobject-introspection-1.0/girepository.h +68 -8
- data/vendor/local/include/gobject-introspection-1.0/girffi.h +25 -1
- data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +12 -0
- data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +24 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +31 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +25 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypes.h +84 -13
- data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +27 -0
- data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +128 -0
- data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +17 -0
- data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +5 -4
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +1865 -913
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.py +49 -16
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +10 -4
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +202 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +32 -1
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.py +305 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/callback.tmpl +4 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/field.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +8 -9
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/interface.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/callback.tmpl +27 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +17 -5
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +8 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/field.tmpl +9 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +12 -13
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/interface.tmpl +17 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +3 -4
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +10 -9
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +7 -7
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/callback.tmpl +27 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +5 -4
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/field.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +8 -14
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/interface.tmpl +16 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +2 -3
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +6 -7
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +7 -13
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +10 -19
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +24 -3
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +4 -7
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +375 -61
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +43 -75
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +1 -20
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +33 -15
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +51 -22
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +285 -254
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.py +41 -25
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +67 -15
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +10 -6
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +14 -8
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +16 -2
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +150 -169
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.py +64 -3
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +5 -44
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
- data/vendor/local/lib/libgirepository-1.0.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.la +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +4 -4
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +5 -5
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +352 -143
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +6402 -3872
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +42 -24
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +1543 -887
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +10859 -3705
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +10 -14
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +112 -9
- data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +2 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +11 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +106 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +107 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +3 -3
- data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +145 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +166 -10
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +790 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gitestmacros.h +10 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +79 -28
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +462 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +2 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +7 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +14 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +10 -0
- data/vendor/local/share/man/man1/g-ir-compiler.1 +1 -10
- metadata +38 -23
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.1/gobject_introspection.so +0 -0
Binary file
|
Binary file
|
@@ -31,9 +31,13 @@ from . import utils
|
|
31
31
|
|
32
32
|
|
33
33
|
class Position(object):
|
34
|
-
"""
|
34
|
+
"""
|
35
|
+
Represents a position in the source file which we
|
35
36
|
want to inform about.
|
36
37
|
"""
|
38
|
+
|
39
|
+
__slots__ = ('filename', 'line', 'column')
|
40
|
+
|
37
41
|
def __init__(self, filename=None, line=None, column=None):
|
38
42
|
self.filename = filename
|
39
43
|
self.line = line
|
@@ -44,15 +48,16 @@ class Position(object):
|
|
44
48
|
(other.filename, other.line, other.column))
|
45
49
|
|
46
50
|
def __repr__(self):
|
47
|
-
return '<Position %s:%d:%d>' % (
|
48
|
-
|
49
|
-
self.line or -1,
|
50
|
-
self.column or -1)
|
51
|
+
return '<Position %s:%d:%d>' % (os.path.basename(self.filename), self.line or -1,
|
52
|
+
self.column or -1)
|
51
53
|
|
52
54
|
def format(self, cwd):
|
53
|
-
filename = self.filename
|
54
|
-
|
55
|
-
|
55
|
+
filename = os.path.realpath(self.filename)
|
56
|
+
cwd = os.path.realpath(cwd)
|
57
|
+
common_prefix = os.path.commonprefix((filename, cwd))
|
58
|
+
if common_prefix:
|
59
|
+
filename = os.path.relpath(filename, common_prefix)
|
60
|
+
|
56
61
|
if self.column is not None:
|
57
62
|
return '%s:%d:%d' % (filename, self.line, self.column)
|
58
63
|
elif self.line is not None:
|
@@ -60,9 +65,6 @@ class Position(object):
|
|
60
65
|
else:
|
61
66
|
return '%s:' % (filename, )
|
62
67
|
|
63
|
-
def offset(self, offset):
|
64
|
-
return Position(self.filename, self.line + offset, self.column)
|
65
|
-
|
66
68
|
|
67
69
|
class MessageLogger(object):
|
68
70
|
_instance = None
|
@@ -70,11 +72,12 @@ class MessageLogger(object):
|
|
70
72
|
def __init__(self, namespace, output=None):
|
71
73
|
if output is None:
|
72
74
|
output = sys.stderr
|
73
|
-
self._cwd = os.getcwd()
|
75
|
+
self._cwd = os.getcwd()
|
74
76
|
self._output = output
|
75
77
|
self._namespace = namespace
|
76
|
-
self._enable_warnings =
|
78
|
+
self._enable_warnings = []
|
77
79
|
self._warning_count = 0
|
80
|
+
self._error_count = 0
|
78
81
|
|
79
82
|
@classmethod
|
80
83
|
def get(cls, *args, **kwargs):
|
@@ -82,24 +85,27 @@ class MessageLogger(object):
|
|
82
85
|
cls._instance = cls(*args, **kwargs)
|
83
86
|
return cls._instance
|
84
87
|
|
85
|
-
def enable_warnings(self,
|
86
|
-
self._enable_warnings =
|
88
|
+
def enable_warnings(self, log_types):
|
89
|
+
self._enable_warnings = log_types
|
87
90
|
|
88
91
|
def get_warning_count(self):
|
89
92
|
return self._warning_count
|
90
93
|
|
94
|
+
def get_error_count(self):
|
95
|
+
return self._error_count
|
96
|
+
|
91
97
|
def log(self, log_type, text, positions=None, prefix=None):
|
92
|
-
"""
|
93
|
-
|
98
|
+
"""
|
99
|
+
Log a warning, using optional file positioning information.
|
100
|
+
If the warning is related to a ast.Node type, see log_node().
|
101
|
+
"""
|
94
102
|
utils.break_on_debug_flag('warning')
|
95
103
|
|
96
104
|
self._warning_count += 1
|
97
105
|
|
98
|
-
if not self._enable_warnings
|
106
|
+
if not log_type in self._enable_warnings:
|
99
107
|
return
|
100
108
|
|
101
|
-
# Always drop through on fatal
|
102
|
-
|
103
109
|
if type(positions) == set:
|
104
110
|
positions = list(positions)
|
105
111
|
if isinstance(positions, Position):
|
@@ -116,8 +122,10 @@ If the warning is related to a ast.Node type, see log_node()."""
|
|
116
122
|
error_type = "Warning"
|
117
123
|
elif log_type == ERROR:
|
118
124
|
error_type = "Error"
|
125
|
+
self._error_count += 1
|
119
126
|
elif log_type == FATAL:
|
120
127
|
error_type = "Fatal"
|
128
|
+
|
121
129
|
if prefix:
|
122
130
|
text = ('%s: %s: %s: %s: %s\n' % (last_position, error_type,
|
123
131
|
self._namespace.name, prefix, text))
|
@@ -129,16 +137,19 @@ If the warning is related to a ast.Node type, see log_node()."""
|
|
129
137
|
text = ('%s: %s: %s\n' % (last_position, error_type, text))
|
130
138
|
|
131
139
|
self._output.write(text)
|
140
|
+
|
132
141
|
if log_type == FATAL:
|
133
142
|
utils.break_on_debug_flag('fatal')
|
134
143
|
raise SystemExit(text)
|
135
144
|
|
136
145
|
def log_node(self, log_type, node, text, context=None, positions=None):
|
137
|
-
"""
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
146
|
+
"""
|
147
|
+
Log a warning, using information about file positions from
|
148
|
+
the given node. The optional context argument, if given, should be
|
149
|
+
another ast.Node type which will also be displayed. If no file position
|
150
|
+
information is available from the node, the position data from the
|
151
|
+
context will be used.
|
152
|
+
"""
|
142
153
|
if positions:
|
143
154
|
pass
|
144
155
|
elif getattr(node, 'file_positions', None):
|
@@ -182,6 +193,11 @@ def warn_symbol(symbol, text):
|
|
182
193
|
ml.log_symbol(WARNING, symbol, text)
|
183
194
|
|
184
195
|
|
196
|
+
def error(text, positions=None, prefix=None):
|
197
|
+
ml = MessageLogger.get()
|
198
|
+
ml.log(ERROR, text, positions, prefix)
|
199
|
+
|
200
|
+
|
185
201
|
def fatal(text, positions=None, prefix=None):
|
186
202
|
ml = MessageLogger.get()
|
187
203
|
ml.log(FATAL, text, positions, prefix)
|
Binary file
|
Binary file
|
@@ -27,9 +27,10 @@ import shutil
|
|
27
27
|
import subprocess
|
28
28
|
import sys
|
29
29
|
import tempfile
|
30
|
+
import platform
|
30
31
|
|
31
32
|
from giscanner import message
|
32
|
-
from giscanner.annotationparser import
|
33
|
+
from giscanner.annotationparser import GtkDocCommentBlockParser
|
33
34
|
from giscanner.ast import Include, Namespace
|
34
35
|
from giscanner.dumper import compile_introspection_binary
|
35
36
|
from giscanner.gdumpparser import GDumpParser, IntrospectionBinary
|
@@ -46,13 +47,22 @@ from . import utils
|
|
46
47
|
def process_cflags_begin(option, opt, value, parser):
|
47
48
|
cflags = getattr(parser.values, option.dest)
|
48
49
|
while len(parser.rargs) > 0 and parser.rargs[0] != '--cflags-end':
|
49
|
-
|
50
|
+
arg = parser.rargs.pop(0)
|
51
|
+
if arg == "-I" and parser.rargs and parser.rargs[0] != '--cflags-end':
|
52
|
+
# This is a special case where there's a space between -I and the path.
|
53
|
+
arg += parser.rargs.pop(0)
|
54
|
+
cflags.append(utils.cflag_real_include_path(arg))
|
50
55
|
|
51
56
|
|
52
57
|
def process_cflags_end(option, opt, value, parser):
|
53
58
|
pass
|
54
59
|
|
55
60
|
|
61
|
+
def process_cpp_includes(option, opt, value, parser):
|
62
|
+
cpp_includes = getattr(parser.values, option.dest)
|
63
|
+
cpp_includes.append(os.path.realpath(value))
|
64
|
+
|
65
|
+
|
56
66
|
def get_preprocessor_option_group(parser):
|
57
67
|
group = optparse.OptionGroup(parser, "Preprocessor options")
|
58
68
|
group.add_option("", "--cflags-begin",
|
@@ -63,8 +73,8 @@ def get_preprocessor_option_group(parser):
|
|
63
73
|
help="End preprocessor/compiler flags",
|
64
74
|
action="callback", callback=process_cflags_end)
|
65
75
|
group.add_option("-I", help="Pre-processor include file",
|
66
|
-
|
67
|
-
|
76
|
+
dest="cpp_includes", default=[], type="string",
|
77
|
+
action="callback", callback=process_cpp_includes)
|
68
78
|
group.add_option("-D", help="Pre-processor define",
|
69
79
|
action="append", dest="cpp_defines",
|
70
80
|
default=[])
|
@@ -146,6 +156,11 @@ and --symbol-prefix.""")
|
|
146
156
|
help="""Remove this prefix from C identifiers (structure typedefs, etc.).
|
147
157
|
May be specified multiple times. This is also used as the default for --symbol-prefix if
|
148
158
|
the latter is not specified.""")
|
159
|
+
parser.add_option("", "--identifier-filter-cmd",
|
160
|
+
action="store", dest="identifier_filter_cmd", default='',
|
161
|
+
help='Filter identifiers (struct and union typedefs) through the given '
|
162
|
+
'shell command which will receive the identifier name as input '
|
163
|
+
'to stdin and is expected to output the filtered results to stdout.')
|
149
164
|
parser.add_option("", "--symbol-prefix",
|
150
165
|
action="append", dest="symbol_prefixes", default=[],
|
151
166
|
help="Remove this prefix from C symbols (function names)")
|
@@ -184,7 +199,8 @@ match the namespace prefix.""")
|
|
184
199
|
group = get_preprocessor_option_group(parser)
|
185
200
|
parser.add_option_group(group)
|
186
201
|
|
187
|
-
|
202
|
+
msystemenv = os.environ.get('MSYSTEM')
|
203
|
+
if msystemenv and msystemenv.startswith('MINGW'):
|
188
204
|
group = get_windows_option_group(parser)
|
189
205
|
parser.add_option_group(group)
|
190
206
|
|
@@ -201,6 +217,21 @@ match the namespace prefix.""")
|
|
201
217
|
parser.add_option("", "--typelib-xml",
|
202
218
|
action="store_true", dest="typelib_xml",
|
203
219
|
help=optparse.SUPPRESS_HELP)
|
220
|
+
parser.add_option("", "--function-decoration",
|
221
|
+
action="append", dest="function_decoration", default=[],
|
222
|
+
help="Macro to decorate functions in generated code")
|
223
|
+
parser.add_option("", "--include-first-in-header",
|
224
|
+
action="append", dest="include_first_header", default=[],
|
225
|
+
help="Header to include first in generated header")
|
226
|
+
parser.add_option("", "--include-last-in-header",
|
227
|
+
action="append", dest="include_last_header", default=[],
|
228
|
+
help="Header to include after the other headers in generated header")
|
229
|
+
parser.add_option("", "--include-first-in-src",
|
230
|
+
action="append", dest="include_first_src", default=[],
|
231
|
+
help="Header to include first in generated sources")
|
232
|
+
parser.add_option("", "--include-last-in-src",
|
233
|
+
action="append", dest="include_last_src", default=[],
|
234
|
+
help="Header to include after the other headers in generated sources")
|
204
235
|
|
205
236
|
return parser
|
206
237
|
|
@@ -217,11 +248,22 @@ def passthrough_gir(path, f):
|
|
217
248
|
f.write(writer.get_xml())
|
218
249
|
|
219
250
|
|
220
|
-
def test_codegen(optstring
|
251
|
+
def test_codegen(optstring,
|
252
|
+
function_decoration,
|
253
|
+
include_first_header,
|
254
|
+
include_last_header,
|
255
|
+
include_first_src,
|
256
|
+
include_last_src):
|
221
257
|
(namespace, out_h_filename, out_c_filename) = optstring.split(',')
|
222
258
|
if namespace == 'Everything':
|
223
259
|
from .testcodegen import EverythingCodeGenerator
|
224
|
-
gen = EverythingCodeGenerator(out_h_filename,
|
260
|
+
gen = EverythingCodeGenerator(out_h_filename,
|
261
|
+
out_c_filename,
|
262
|
+
function_decoration,
|
263
|
+
include_first_header,
|
264
|
+
include_last_header,
|
265
|
+
include_first_src,
|
266
|
+
include_last_src)
|
225
267
|
gen.write()
|
226
268
|
else:
|
227
269
|
_error("Invaild namespace %r" % (namespace, ))
|
@@ -252,7 +294,7 @@ def process_packages(options, packages):
|
|
252
294
|
filtered_output = list(process_options(output, options_whitelist))
|
253
295
|
parser = _get_option_parser()
|
254
296
|
pkg_options, unused = parser.parse_args(filtered_output)
|
255
|
-
options.cpp_includes.extend(pkg_options.cpp_includes)
|
297
|
+
options.cpp_includes.extend([os.path.realpath(f) for f in pkg_options.cpp_includes])
|
256
298
|
options.cpp_defines.extend(pkg_options.cpp_defines)
|
257
299
|
options.cpp_undefines.extend(pkg_options.cpp_undefines)
|
258
300
|
|
@@ -267,7 +309,7 @@ def extract_filenames(args):
|
|
267
309
|
_error('%s: no such a file or directory' % (arg, ))
|
268
310
|
# Make absolute, because we do comparisons inside scannerparser.c
|
269
311
|
# against the absolute path that cpp will give us
|
270
|
-
filenames.append(
|
312
|
+
filenames.append(arg)
|
271
313
|
return filenames
|
272
314
|
|
273
315
|
|
@@ -289,7 +331,7 @@ def extract_filelist(options):
|
|
289
331
|
_error('%s: Invalid filelist entry-no such file or directory' % (line, ))
|
290
332
|
# Make absolute, because we do comparisons inside scannerparser.c
|
291
333
|
# against the absolute path that cpp will give us
|
292
|
-
filenames.append(
|
334
|
+
filenames.append(filename)
|
293
335
|
return filenames
|
294
336
|
|
295
337
|
|
@@ -324,7 +366,8 @@ see --identifier-prefix and --symbol-prefix."""
|
|
324
366
|
|
325
367
|
def create_transformer(namespace, options):
|
326
368
|
transformer = Transformer(namespace,
|
327
|
-
accept_unprefixed=options.accept_unprefixed
|
369
|
+
accept_unprefixed=options.accept_unprefixed,
|
370
|
+
identifier_filter_cmd=options.identifier_filter_cmd)
|
328
371
|
transformer.set_include_paths(options.include_paths)
|
329
372
|
if options.passthrough_gir:
|
330
373
|
transformer.disable_cache()
|
@@ -374,6 +417,9 @@ def create_source_scanner(options, args):
|
|
374
417
|
else:
|
375
418
|
filenames = extract_filenames(args)
|
376
419
|
|
420
|
+
if platform.system() == 'Darwin':
|
421
|
+
options.cpp_undefines.append('__BLOCKS__')
|
422
|
+
|
377
423
|
# Run the preprocessor, tokenize and construct simple
|
378
424
|
# objects representing the raw C symbols
|
379
425
|
ss = SourceScanner()
|
@@ -430,7 +476,12 @@ def scanner_main(args):
|
|
430
476
|
if options.passthrough_gir:
|
431
477
|
passthrough_gir(options.passthrough_gir, sys.stdout)
|
432
478
|
if options.test_codegen:
|
433
|
-
return test_codegen(options.test_codegen
|
479
|
+
return test_codegen(options.test_codegen,
|
480
|
+
options.function_decoration,
|
481
|
+
options.include_first_header,
|
482
|
+
options.include_last_header,
|
483
|
+
options.include_first_src,
|
484
|
+
options.include_last_src)
|
434
485
|
|
435
486
|
if hasattr(options, 'filelist') and not options.filelist:
|
436
487
|
if len(args) <= 1:
|
@@ -452,7 +503,8 @@ def scanner_main(args):
|
|
452
503
|
namespace = create_namespace(options)
|
453
504
|
logger = message.MessageLogger.get(namespace=namespace)
|
454
505
|
if options.warn_all:
|
455
|
-
logger.enable_warnings(
|
506
|
+
logger.enable_warnings((message.WARNING, message.ERROR, message.FATAL))
|
507
|
+
|
456
508
|
transformer = create_transformer(namespace, options)
|
457
509
|
|
458
510
|
packages = set(options.packages)
|
@@ -464,8 +516,8 @@ def scanner_main(args):
|
|
464
516
|
|
465
517
|
ss = create_source_scanner(options, args)
|
466
518
|
|
467
|
-
|
468
|
-
blocks =
|
519
|
+
cbp = GtkDocCommentBlockParser()
|
520
|
+
blocks = cbp.parse_comment_blocks(ss.get_comments())
|
469
521
|
|
470
522
|
# Transform the C symbols into AST nodes
|
471
523
|
transformer.parse(ss.get_symbols())
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -24,7 +24,8 @@ import platform
|
|
24
24
|
import re
|
25
25
|
import subprocess
|
26
26
|
|
27
|
-
from .utils import get_libtool_command, extract_libtool_shlib
|
27
|
+
from .utils import get_libtool_command, extract_libtool_shlib, which
|
28
|
+
from .ccompiler import CCompiler
|
28
29
|
|
29
30
|
|
30
31
|
# For .la files, the situation is easy.
|
@@ -49,9 +50,13 @@ def _resolve_libtool(options, binary, libraries):
|
|
49
50
|
# The negative lookbehind at the start is to avoid problems if someone
|
50
51
|
# is crazy enough to name a library liblib<foo> when lib<foo> exists.
|
51
52
|
#
|
53
|
+
# Match absolute paths on OS X to conform to how libraries are usually
|
54
|
+
# referenced on OS X systems.
|
52
55
|
def _ldd_library_pattern(library_name):
|
53
|
-
|
54
|
-
|
56
|
+
pattern = "(?<![A-Za-z0-9_-])(lib*%s[^A-Za-z0-9_-][^\s\(\)]*)"
|
57
|
+
if platform.system() == 'Darwin':
|
58
|
+
pattern = "([^\s]*lib*%s[^A-Za-z0-9_-][^\s\(\)]*)"
|
59
|
+
return re.compile(pattern % re.escape(library_name))
|
55
60
|
|
56
61
|
|
57
62
|
# This is a what we do for non-la files. We assume that we are on an
|
@@ -85,10 +90,9 @@ def _resolve_non_libtool(options, binary, libraries):
|
|
85
90
|
binary.args[0] = old_argdir
|
86
91
|
|
87
92
|
if os.name == 'nt':
|
88
|
-
|
93
|
+
cc = CCompiler()
|
94
|
+
shlibs = cc.resolve_windows_libs(libraries, options)
|
89
95
|
|
90
|
-
for library in libraries:
|
91
|
-
shlibs.append(library + '.dll')
|
92
96
|
else:
|
93
97
|
args = []
|
94
98
|
libtool = get_libtool_command(options)
|
Binary file
|
Binary file
|
@@ -154,8 +154,8 @@ class SourceType(object):
|
|
154
154
|
|
155
155
|
|
156
156
|
class SourceSymbol(object):
|
157
|
-
__members__ = ['const_int', 'const_double', 'const_string', '
|
158
|
-
'type', 'base_type']
|
157
|
+
__members__ = ['const_int', 'const_double', 'const_string', 'const_boolean',
|
158
|
+
'ident', 'type', 'base_type']
|
159
159
|
|
160
160
|
def __init__(self, scanner, symbol):
|
161
161
|
self._scanner = scanner
|
@@ -185,6 +185,10 @@ class SourceSymbol(object):
|
|
185
185
|
def const_string(self):
|
186
186
|
return self._symbol.const_string
|
187
187
|
|
188
|
+
@property
|
189
|
+
def const_boolean(self):
|
190
|
+
return self._symbol.const_boolean
|
191
|
+
|
188
192
|
@property
|
189
193
|
def ident(self):
|
190
194
|
return self._symbol.ident
|
@@ -227,7 +231,7 @@ class SourceScanner(object):
|
|
227
231
|
|
228
232
|
def set_cpp_options(self, includes, defines, undefines, cflags=[]):
|
229
233
|
self._cpp_options.extend(cflags)
|
230
|
-
for prefix, args in [('-I', includes),
|
234
|
+
for prefix, args in [('-I', [os.path.realpath(f) for f in includes]),
|
231
235
|
('-D', defines),
|
232
236
|
('-U', undefines)]:
|
233
237
|
for arg in (args or []):
|
@@ -237,14 +241,14 @@ class SourceScanner(object):
|
|
237
241
|
|
238
242
|
def parse_files(self, filenames):
|
239
243
|
for filename in filenames:
|
240
|
-
|
244
|
+
# self._scanner expects file names to be canonicalized and symlinks to be resolved
|
245
|
+
filename = os.path.realpath(filename)
|
241
246
|
self._scanner.append_filename(filename)
|
242
247
|
self._filenames.append(filename)
|
243
248
|
|
244
249
|
headers = []
|
245
|
-
for filename in
|
250
|
+
for filename in self._filenames:
|
246
251
|
if os.path.splitext(filename)[1] in SOURCE_EXTS:
|
247
|
-
filename = os.path.abspath(filename)
|
248
252
|
self._scanner.lex_filename(filename)
|
249
253
|
else:
|
250
254
|
headers.append(filename)
|
@@ -253,7 +257,8 @@ class SourceScanner(object):
|
|
253
257
|
|
254
258
|
def parse_macros(self, filenames):
|
255
259
|
self._scanner.set_macro_scan(True)
|
256
|
-
self._scanner
|
260
|
+
# self._scanner expects file names to be canonicalized and symlinks to be resolved
|
261
|
+
self._scanner.parse_macros([os.path.realpath(f) for f in filenames])
|
257
262
|
self._scanner.set_macro_scan(False)
|
258
263
|
|
259
264
|
def get_symbols(self):
|
@@ -284,6 +289,8 @@ class SourceScanner(object):
|
|
284
289
|
# Note that the generated dumper program is
|
285
290
|
# still built and linked by Visual C++.
|
286
291
|
cpp_args = ['gcc']
|
292
|
+
cpp_args += os.environ.get('CPPFLAGS', '').split()
|
293
|
+
cpp_args += os.environ.get('CFLAGS', '').split()
|
287
294
|
cpp_args += ['-E', '-C', '-I.', '-']
|
288
295
|
cpp_args += self._cpp_options
|
289
296
|
|
@@ -298,7 +305,6 @@ class SourceScanner(object):
|
|
298
305
|
for undef in undefs:
|
299
306
|
proc.stdin.write('#undef %s\n' % (undef, ))
|
300
307
|
for filename in filenames:
|
301
|
-
filename = os.path.abspath(filename)
|
302
308
|
proc.stdin.write('#include <%s>\n' % (filename, ))
|
303
309
|
proc.stdin.close()
|
304
310
|
|
Binary file
|
Binary file
|
@@ -46,9 +46,23 @@ def uscore_from_type(typeval):
|
|
46
46
|
|
47
47
|
class EverythingCodeGenerator(object):
|
48
48
|
|
49
|
-
def __init__(self,
|
49
|
+
def __init__(self,
|
50
|
+
out_h_filename,
|
51
|
+
out_c_filename,
|
52
|
+
function_decoration,
|
53
|
+
include_first_header,
|
54
|
+
include_last_header,
|
55
|
+
include_first_src,
|
56
|
+
include_last_src):
|
50
57
|
self.namespace = ast.Namespace('Everything', '1.0')
|
51
|
-
self.gen = CCodeGenerator(self.namespace,
|
58
|
+
self.gen = CCodeGenerator(self.namespace,
|
59
|
+
out_h_filename,
|
60
|
+
out_c_filename,
|
61
|
+
function_decoration,
|
62
|
+
include_first_header,
|
63
|
+
include_last_header,
|
64
|
+
include_first_src,
|
65
|
+
include_last_src)
|
52
66
|
|
53
67
|
def write(self):
|
54
68
|
func = ast.Function('nullfunc',
|
Binary file
|
Binary file
|