gobject-introspection 2.0.2-x86-mingw32 → 2.0.3-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 +7 -0
- data/Rakefile +5 -2
- data/ext/gobject-introspection/rb-gi-argument.c +215 -4
- data/ext/gobject-introspection/rb-gi-loader.c +7 -2
- data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.0/gobject_introspection.so +0 -0
- data/test/test-function-info.rb +3 -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/lib/girepository-1.0/DBus-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -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/GModule-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/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 +1 -0
- 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 +52 -47
- 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 +48 -42
- 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 +11 -10
- 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/codegen.py +7 -5
- 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 +22 -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/ordereddict.py +120 -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.py +14 -2
- 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/docwriter.py +19 -10
- 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 +18 -11
- 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 +10 -13
- 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 +24 -30
- 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 +11 -12
- 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.py +25 -21
- 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.py +1 -1
- 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 +98 -100
- 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 +10 -8
- 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 +28 -16
- 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.py +83 -9
- 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 +5 -1
- 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 +20 -21
- 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 +3 -0
- 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 +32 -41
- 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 +9 -0
- 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 +9 -11
- 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 +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +691 -691
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +6972 -6467
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +103 -4
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +2085 -1955
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +10955 -9269
- data/vendor/local/share/gir-1.0/win32-1.0.gir +19 -0
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +2 -2
- data/vendor/local/share/gobject-introspection-1.0/gdump.c +7 -2
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +15 -15
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +14 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +2 -2
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +8 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +9 -0
- metadata +20 -21
- data/vendor/local/lib/gobject-introspection/giscanner/odict.py +0 -50
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyo +0 -0
@@ -18,24 +18,29 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
import re
|
21
|
-
import
|
21
|
+
from . import ast
|
22
|
+
from .utils import to_underscores
|
22
23
|
|
23
|
-
|
24
|
+
|
25
|
+
class SectionsFile(object):
|
24
26
|
def __init__(self, sections):
|
25
27
|
self.sections = sections
|
26
28
|
|
29
|
+
|
27
30
|
class Section(object):
|
28
31
|
def __init__(self):
|
29
32
|
self.file = None
|
30
33
|
self.title = None
|
31
|
-
self.
|
34
|
+
self.includes = None
|
32
35
|
self.subsections = []
|
33
36
|
|
37
|
+
|
34
38
|
class Subsection(object):
|
35
39
|
def __init__(self, name):
|
36
40
|
self.name = name
|
37
41
|
self.symbols = []
|
38
42
|
|
43
|
+
|
39
44
|
def parse_sections_file(lines):
|
40
45
|
sections = []
|
41
46
|
current_section = None
|
@@ -50,29 +55,98 @@ def parse_sections_file(lines):
|
|
50
55
|
if line == "<SECTION>":
|
51
56
|
current_section = Section()
|
52
57
|
sections.append(current_section)
|
53
|
-
current_subsection =
|
58
|
+
current_subsection = Subsection(None)
|
59
|
+
current_section.subsections.append(current_subsection)
|
54
60
|
continue
|
55
61
|
|
56
62
|
if line == "</SECTION>":
|
57
63
|
current_section = None
|
58
64
|
continue
|
59
65
|
|
60
|
-
match = re.match(
|
66
|
+
match = re.match(r"<FILE>(?P<contents>.*)</FILE>", line)
|
61
67
|
if match:
|
62
68
|
current_section.file = match.groupdict['contents']
|
63
69
|
continue
|
64
70
|
|
65
|
-
match = re.match(
|
71
|
+
match = re.match(r"<TITLE>(?P<contents>.*)</TITLE>", line)
|
66
72
|
if match:
|
67
73
|
current_section.title = match.groupdict['contents']
|
68
74
|
continue
|
69
75
|
|
70
|
-
match = re.match(
|
76
|
+
match = re.match(r"<INCLUDE>(?P<contents>.*)</INCLUDE>", line)
|
71
77
|
if match:
|
72
|
-
|
78
|
+
current_section.includes = match.groupdict['contents']
|
79
|
+
continue
|
80
|
+
|
81
|
+
match = re.match(r"<SUBSECTION(?: (?P<name>.*))?>", line)
|
82
|
+
if match:
|
83
|
+
current_subsection = Subsection(match.groupdict.get('name', None))
|
73
84
|
current_section.subsections.append(current_subsection)
|
74
85
|
continue
|
75
86
|
|
87
|
+
if line.startswith("<") and line.endswith(">"):
|
88
|
+
# Other directive to gtk-doc, not a symbol.
|
89
|
+
continue
|
90
|
+
|
76
91
|
current_subsection.symbols.append(line)
|
77
92
|
|
78
|
-
return
|
93
|
+
return SectionsFile(sections)
|
94
|
+
|
95
|
+
|
96
|
+
def write_sections_file(f, sections_file):
|
97
|
+
for section in sections_file.sections:
|
98
|
+
f.write("\n<SECTION>\n")
|
99
|
+
if section.file is not None:
|
100
|
+
f.write("<FILE>%s</FILE>\n" % (section.file, ))
|
101
|
+
if section.title is not None:
|
102
|
+
f.write("<TITLE>%s</TITLE>\n" % (section.title, ))
|
103
|
+
if section.includes is not None:
|
104
|
+
f.write("<INCLUDE>%s</INCLUDE>\n" % (section.includes, ))
|
105
|
+
|
106
|
+
is_first_subsection = True
|
107
|
+
for subsection in section.subsections:
|
108
|
+
if subsection.name is not None:
|
109
|
+
f.write("<SUBSECTION %s>\n" % (subsection.name, ))
|
110
|
+
elif not is_first_subsection:
|
111
|
+
f.write("\n<SUBSECTION>\n")
|
112
|
+
|
113
|
+
is_first_subsection = False
|
114
|
+
|
115
|
+
for symbol in subsection.symbols:
|
116
|
+
f.write(symbol + "\n")
|
117
|
+
|
118
|
+
|
119
|
+
def generate_sections_file(transformer):
|
120
|
+
ns = transformer.namespace
|
121
|
+
|
122
|
+
sections = []
|
123
|
+
|
124
|
+
def new_section(file_, title):
|
125
|
+
section = Section()
|
126
|
+
section.file = file_
|
127
|
+
section.title = title
|
128
|
+
section.subsections.append(Subsection(None))
|
129
|
+
sections.append(section)
|
130
|
+
return section
|
131
|
+
|
132
|
+
def append_symbol(section, sym):
|
133
|
+
section.subsections[0].symbols.append(sym)
|
134
|
+
|
135
|
+
general_section = new_section("main", "Main")
|
136
|
+
|
137
|
+
for node in ns.itervalues():
|
138
|
+
if isinstance(node, ast.Function):
|
139
|
+
append_symbol(general_section, node.symbol)
|
140
|
+
elif isinstance(node, (ast.Class, ast.Interface)):
|
141
|
+
gtype_name = node.gtype_name
|
142
|
+
file_name = to_underscores(gtype_name).replace('_', '-').lower()
|
143
|
+
section = new_section(file_name, gtype_name)
|
144
|
+
append_symbol(section, gtype_name)
|
145
|
+
append_symbol(section, node.glib_type_struct.target_giname.replace('.', ''))
|
146
|
+
|
147
|
+
for meth in node.methods:
|
148
|
+
append_symbol(section, meth.symbol)
|
149
|
+
for meth in node.static_methods:
|
150
|
+
append_symbol(section, meth.symbol)
|
151
|
+
|
152
|
+
return SectionsFile(sections)
|
Binary file
|
Binary file
|
@@ -26,6 +26,7 @@ import subprocess
|
|
26
26
|
|
27
27
|
from .utils import get_libtool_command, extract_libtool_shlib
|
28
28
|
|
29
|
+
|
29
30
|
# For .la files, the situation is easy.
|
30
31
|
def _resolve_libtool(options, binary, libraries):
|
31
32
|
shlibs = []
|
@@ -36,6 +37,7 @@ def _resolve_libtool(options, binary, libraries):
|
|
36
37
|
|
37
38
|
return shlibs
|
38
39
|
|
40
|
+
|
39
41
|
# Assume ldd output is something vaguely like
|
40
42
|
#
|
41
43
|
# libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x006c1000)
|
@@ -51,6 +53,7 @@ def _ldd_library_pattern(library_name):
|
|
51
53
|
return re.compile("(?<![A-Za-z0-9_-])(lib*%s[^A-Za-z0-9_-][^\s\(\)]*)"
|
52
54
|
% re.escape(library_name))
|
53
55
|
|
56
|
+
|
54
57
|
# This is a what we do for non-la files. We assume that we are on an
|
55
58
|
# ELF-like system where ldd exists and the soname extracted with ldd is
|
56
59
|
# a filename that can be opened with dlopen().
|
@@ -68,7 +71,7 @@ def _resolve_non_libtool(options, binary, libraries):
|
|
68
71
|
if not libraries:
|
69
72
|
return []
|
70
73
|
|
71
|
-
if
|
74
|
+
if platform.platform().startswith('OpenBSD'):
|
72
75
|
# Hack for OpenBSD when using the ports' libtool which uses slightly
|
73
76
|
# different directories to store the libraries in. So rewite binary.args[0]
|
74
77
|
# by inserting '.libs/'.
|
@@ -118,6 +121,7 @@ def _resolve_non_libtool(options, binary, libraries):
|
|
118
121
|
|
119
122
|
return shlibs
|
120
123
|
|
124
|
+
|
121
125
|
# We want to resolve a set of library names (the <foo> of -l<foo>)
|
122
126
|
# against a library to find the shared library name. The shared
|
123
127
|
# library name is suppose to be what you pass to dlopen() (or
|
Binary file
|
Binary file
|
@@ -32,6 +32,10 @@ with LibtoolImporter(None, None):
|
|
32
32
|
else:
|
33
33
|
from giscanner._giscanner import SourceScanner as CSourceScanner
|
34
34
|
|
35
|
+
HEADER_EXTS = ['.h', '.hpp', '.hxx']
|
36
|
+
SOURCE_EXTS = ['.c', '.cpp', '.cc', '.cxx']
|
37
|
+
ALL_EXTS = SOURCE_EXTS + HEADER_EXTS
|
38
|
+
|
35
39
|
(CSYMBOL_TYPE_INVALID,
|
36
40
|
CSYMBOL_TYPE_ELLIPSIS,
|
37
41
|
CSYMBOL_TYPE_CONST,
|
@@ -89,8 +93,7 @@ def symbol_type_name(symbol_type):
|
|
89
93
|
CSYMBOL_TYPE_UNION: 'union',
|
90
94
|
CSYMBOL_TYPE_ENUM: 'enum',
|
91
95
|
CSYMBOL_TYPE_TYPEDEF: 'typedef',
|
92
|
-
CSYMBOL_TYPE_MEMBER: 'member'
|
93
|
-
}.get(symbol_type)
|
96
|
+
CSYMBOL_TYPE_MEMBER: 'member'}.get(symbol_type)
|
94
97
|
|
95
98
|
|
96
99
|
def ctype_name(ctype):
|
@@ -104,8 +107,7 @@ def ctype_name(ctype):
|
|
104
107
|
CTYPE_ENUM: 'enum',
|
105
108
|
CTYPE_POINTER: 'pointer',
|
106
109
|
CTYPE_ARRAY: 'array',
|
107
|
-
CTYPE_FUNCTION: 'function'
|
108
|
-
}.get(ctype)
|
110
|
+
CTYPE_FUNCTION: 'function'}.get(ctype)
|
109
111
|
|
110
112
|
|
111
113
|
class SourceType(object):
|
@@ -241,8 +243,7 @@ class SourceScanner(object):
|
|
241
243
|
|
242
244
|
headers = []
|
243
245
|
for filename in filenames:
|
244
|
-
if (filename
|
245
|
-
filename.endswith('.cc') or filename.endswith('.cxx')):
|
246
|
+
if os.path.splitext(filename)[1] in SOURCE_EXTS:
|
246
247
|
filename = os.path.abspath(filename)
|
247
248
|
self._scanner.lex_filename(filename)
|
248
249
|
else:
|
@@ -263,7 +264,7 @@ class SourceScanner(object):
|
|
263
264
|
return self._scanner.get_comments()
|
264
265
|
|
265
266
|
def dump(self):
|
266
|
-
print '-'*30
|
267
|
+
print '-' * 30
|
267
268
|
for symbol in self._scanner.get_symbols():
|
268
269
|
print symbol.ident, symbol.base_type.name, symbol.type
|
269
270
|
|
@@ -275,19 +276,17 @@ class SourceScanner(object):
|
|
275
276
|
|
276
277
|
defines = ['__GI_SCANNER__']
|
277
278
|
undefs = []
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
cpp_args = 'gcc'
|
286
|
-
else:
|
287
|
-
cpp_args = cpp_exec
|
279
|
+
cpp_args = os.environ.get('CC', 'cc').split() # support CC="ccache gcc"
|
280
|
+
if 'cl' in cpp_args:
|
281
|
+
# The Microsoft compiler/preprocessor (cl) does not accept
|
282
|
+
# source input from stdin (the '-' flag), so we need
|
283
|
+
# some help from gcc from MinGW/Cygwin or so.
|
284
|
+
# Note that the generated dumper program is
|
285
|
+
# still built and linked by Visual C++.
|
286
|
+
cpp_args = ['gcc']
|
288
287
|
cpp_args += ['-E', '-C', '-I.', '-']
|
289
|
-
|
290
288
|
cpp_args += self._cpp_options
|
289
|
+
|
291
290
|
proc = subprocess.Popen(cpp_args,
|
292
291
|
stdin=subprocess.PIPE,
|
293
292
|
stdout=subprocess.PIPE)
|
@@ -303,8 +302,8 @@ class SourceScanner(object):
|
|
303
302
|
proc.stdin.write('#include <%s>\n' % (filename, ))
|
304
303
|
proc.stdin.close()
|
305
304
|
|
306
|
-
|
307
|
-
fp =
|
305
|
+
tmp_fd, tmp_name = tempfile.mkstemp()
|
306
|
+
fp = os.fdopen(tmp_fd, 'w+b')
|
308
307
|
while True:
|
309
308
|
data = proc.stdout.read(4096)
|
310
309
|
if data is None:
|
@@ -321,4 +320,4 @@ class SourceScanner(object):
|
|
321
320
|
|
322
321
|
self._scanner.parse_file(fp.fileno())
|
323
322
|
fp.close()
|
324
|
-
os.unlink(
|
323
|
+
os.unlink(tmp_name)
|
Binary file
|
Binary file
|
@@ -27,12 +27,14 @@ DEFAULT_C_VALUES = {ast.TYPE_ANY: 'NULL',
|
|
27
27
|
ast.TYPE_FILENAME: '""',
|
28
28
|
ast.TYPE_GTYPE: 'g_object_get_type ()'}
|
29
29
|
|
30
|
+
|
30
31
|
def get_default_for_typeval(typeval):
|
31
32
|
default = DEFAULT_C_VALUES.get(typeval)
|
32
33
|
if default:
|
33
34
|
return default
|
34
35
|
return "0"
|
35
36
|
|
37
|
+
|
36
38
|
def uscore_from_type(typeval):
|
37
39
|
if typeval.target_fundamental:
|
38
40
|
return typeval.target_fundamental.replace(' ', '_')
|
@@ -41,6 +43,7 @@ def uscore_from_type(typeval):
|
|
41
43
|
else:
|
42
44
|
assert False, typeval
|
43
45
|
|
46
|
+
|
44
47
|
class EverythingCodeGenerator(object):
|
45
48
|
|
46
49
|
def __init__(self, out_h_filename, out_c_filename):
|
Binary file
|
Binary file
|
@@ -34,6 +34,7 @@ from .sourcescanner import (
|
|
34
34
|
CSYMBOL_TYPE_MEMBER, CSYMBOL_TYPE_ELLIPSIS, CSYMBOL_TYPE_CONST,
|
35
35
|
TYPE_QUALIFIER_CONST, TYPE_QUALIFIER_VOLATILE)
|
36
36
|
|
37
|
+
|
37
38
|
class TransformerException(Exception):
|
38
39
|
pass
|
39
40
|
|
@@ -54,10 +55,9 @@ class Transformer(object):
|
|
54
55
|
self._namespace = namespace
|
55
56
|
self._pkg_config_packages = set()
|
56
57
|
self._typedefs_ns = {}
|
57
|
-
self._parsed_includes = {}
|
58
|
+
self._parsed_includes = {} # <string namespace -> Namespace>
|
58
59
|
self._includepaths = []
|
59
60
|
self._passthrough_mode = False
|
60
|
-
self._annotations = {}
|
61
61
|
|
62
62
|
def get_pkgconfig_packages(self):
|
63
63
|
return self._pkg_config_packages
|
@@ -68,9 +68,6 @@ class Transformer(object):
|
|
68
68
|
def set_passthrough_mode(self):
|
69
69
|
self._passthrough_mode = True
|
70
70
|
|
71
|
-
def set_annotations(self, annotations):
|
72
|
-
self._annotations = annotations
|
73
|
-
|
74
71
|
def _append_new_node(self, node):
|
75
72
|
original = self._namespace.get(node.name)
|
76
73
|
# Special case constants here; we allow duplication to sort-of
|
@@ -108,7 +105,7 @@ class Transformer(object):
|
|
108
105
|
if not ns_compound:
|
109
106
|
ns_compound = self._namespace.get('_' + compound.name)
|
110
107
|
if (not ns_compound and isinstance(compound, (ast.Record, ast.Union))
|
111
|
-
|
108
|
+
and len(compound.fields) == 0):
|
112
109
|
disguised = ast.Record(compound.name, typedef, disguised=True)
|
113
110
|
self._namespace.append(disguised)
|
114
111
|
elif not ns_compound:
|
@@ -130,8 +127,8 @@ class Transformer(object):
|
|
130
127
|
def register_include_uninstalled(self, include_path):
|
131
128
|
basename = os.path.basename(include_path)
|
132
129
|
if not basename.endswith('.gir'):
|
133
|
-
raise SystemExit(
|
134
|
-
"
|
130
|
+
raise SystemExit("Include path %r must be a filename path "
|
131
|
+
"ending in .gir" % (include_path, ))
|
135
132
|
girname = basename[:-4]
|
136
133
|
include = ast.Include.from_string(girname)
|
137
134
|
if include in self._namespace.includes:
|
@@ -179,8 +176,7 @@ None."""
|
|
179
176
|
path = os.path.join(d, girname)
|
180
177
|
if os.path.exists(path):
|
181
178
|
return path
|
182
|
-
sys.stderr.write("Couldn't find include %r (search path: %r)\n"
|
183
|
-
% (girname, searchdirs))
|
179
|
+
sys.stderr.write("Couldn't find include %r (search path: %r)\n" % (girname, searchdirs))
|
184
180
|
sys.exit(1)
|
185
181
|
|
186
182
|
@classmethod
|
@@ -232,7 +228,7 @@ currently-scanned namespace is first."""
|
|
232
228
|
|
233
229
|
def _split_c_string_for_namespace_matches(self, name, is_identifier=False):
|
234
230
|
matches = [] # Namespaces which might contain this name
|
235
|
-
unprefixed_namespaces = []
|
231
|
+
unprefixed_namespaces = [] # Namespaces with no prefix, last resort
|
236
232
|
for ns in self._iter_namespaces():
|
237
233
|
if is_identifier:
|
238
234
|
prefixes = ns.identifier_prefixes
|
@@ -289,7 +285,7 @@ raise ValueError."""
|
|
289
285
|
ident = ident[1:]
|
290
286
|
try:
|
291
287
|
matches = self.split_ctype_namespaces(ident)
|
292
|
-
except ValueError
|
288
|
+
except ValueError as e:
|
293
289
|
raise TransformerException(str(e))
|
294
290
|
for ns, name in matches:
|
295
291
|
if ns is self._namespace:
|
@@ -309,7 +305,7 @@ raise ValueError."""
|
|
309
305
|
ident = ident[1:]
|
310
306
|
try:
|
311
307
|
(ns, name) = self.split_csymbol(ident)
|
312
|
-
except ValueError
|
308
|
+
except ValueError as e:
|
313
309
|
raise TransformerException(str(e))
|
314
310
|
if ns != self._namespace:
|
315
311
|
raise TransformerException(
|
@@ -383,7 +379,7 @@ raise ValueError."""
|
|
383
379
|
# prefix.
|
384
380
|
try:
|
385
381
|
name = self._strip_symbol(child)
|
386
|
-
except TransformerException
|
382
|
+
except TransformerException as e:
|
387
383
|
message.warn_symbol(symbol, e)
|
388
384
|
return None
|
389
385
|
members.append(ast.Member(name.lower(),
|
@@ -393,7 +389,7 @@ raise ValueError."""
|
|
393
389
|
|
394
390
|
try:
|
395
391
|
enum_name = self.strip_identifier(symbol.ident)
|
396
|
-
except TransformerException
|
392
|
+
except TransformerException as e:
|
397
393
|
message.warn_symbol(symbol, e)
|
398
394
|
return None
|
399
395
|
if symbol.base_type.is_bitfield:
|
@@ -412,7 +408,7 @@ raise ValueError."""
|
|
412
408
|
return_ = self._create_return(symbol.base_type.base_type)
|
413
409
|
try:
|
414
410
|
name = self._strip_symbol(symbol)
|
415
|
-
except TransformerException
|
411
|
+
except TransformerException as e:
|
416
412
|
message.warn_symbol(symbol, e)
|
417
413
|
return None
|
418
414
|
func = ast.Function(name, return_, parameters, False, symbol.ident)
|
@@ -506,8 +502,8 @@ raise ValueError."""
|
|
506
502
|
|
507
503
|
def _create_member(self, symbol, parent_symbol=None):
|
508
504
|
source_type = symbol.base_type
|
509
|
-
if (source_type.type == CTYPE_POINTER
|
510
|
-
|
505
|
+
if (source_type.type == CTYPE_POINTER
|
506
|
+
and symbol.base_type.base_type.type == CTYPE_FUNCTION):
|
511
507
|
node = self._create_callback(symbol, member=True)
|
512
508
|
elif source_type.type == CTYPE_STRUCT and source_type.name is None:
|
513
509
|
node = self._create_struct(symbol, anonymous=True)
|
@@ -523,8 +519,8 @@ raise ValueError."""
|
|
523
519
|
# to be able to properly calculate the size of the compound
|
524
520
|
# type (e.g. GValue) that contains this array, see
|
525
521
|
# <https://bugzilla.gnome.org/show_bug.cgi?id=657040>.
|
526
|
-
if (source_type.base_type.type == CTYPE_UNION
|
527
|
-
|
522
|
+
if (source_type.base_type.type == CTYPE_UNION
|
523
|
+
and source_type.base_type.name is None):
|
528
524
|
synthesized_type = self._synthesize_union_type(symbol, parent_symbol)
|
529
525
|
ftype = ast.Array(None, synthesized_type, complete_ctype=complete_ctype)
|
530
526
|
else:
|
@@ -562,11 +558,9 @@ raise ValueError."""
|
|
562
558
|
|
563
559
|
def _create_typedef(self, symbol):
|
564
560
|
ctype = symbol.base_type.type
|
565
|
-
if (ctype == CTYPE_POINTER and
|
566
|
-
symbol.base_type.base_type.type == CTYPE_FUNCTION):
|
561
|
+
if (ctype == CTYPE_POINTER and symbol.base_type.base_type.type == CTYPE_FUNCTION):
|
567
562
|
node = self._create_typedef_callback(symbol)
|
568
|
-
elif (ctype == CTYPE_POINTER and
|
569
|
-
symbol.base_type.base_type.type == CTYPE_STRUCT):
|
563
|
+
elif (ctype == CTYPE_POINTER and symbol.base_type.base_type.type == CTYPE_STRUCT):
|
570
564
|
node = self._create_typedef_struct(symbol, disguised=True)
|
571
565
|
elif ctype == CTYPE_STRUCT:
|
572
566
|
node = self._create_typedef_struct(symbol)
|
@@ -580,7 +574,7 @@ raise ValueError."""
|
|
580
574
|
CTYPE_VOID):
|
581
575
|
try:
|
582
576
|
name = self.strip_identifier(symbol.ident)
|
583
|
-
except TransformerException
|
577
|
+
except TransformerException as e:
|
584
578
|
message.warn(e)
|
585
579
|
return None
|
586
580
|
if symbol.base_type.name:
|
@@ -631,8 +625,7 @@ raise ValueError."""
|
|
631
625
|
derefed_typename = canonical.replace('*', '')
|
632
626
|
|
633
627
|
# Preserve "pointerness" of struct/union members
|
634
|
-
if (is_member and canonical.endswith('*') and
|
635
|
-
derefed_typename in ast.basic_type_names):
|
628
|
+
if (is_member and canonical.endswith('*') and derefed_typename in ast.basic_type_names):
|
636
629
|
return 'gpointer'
|
637
630
|
else:
|
638
631
|
return derefed_typename
|
@@ -718,12 +711,11 @@ raise ValueError."""
|
|
718
711
|
|
719
712
|
# Don't create constants for non-public things
|
720
713
|
# http://bugzilla.gnome.org/show_bug.cgi?id=572790
|
721
|
-
if (symbol.source_filename is None or
|
722
|
-
not symbol.source_filename.endswith('.h')):
|
714
|
+
if (symbol.source_filename is None or not symbol.source_filename.endswith('.h')):
|
723
715
|
return None
|
724
716
|
try:
|
725
717
|
name = self._strip_symbol(symbol)
|
726
|
-
except TransformerException
|
718
|
+
except TransformerException as e:
|
727
719
|
message.warn_symbol(symbol, e)
|
728
720
|
return None
|
729
721
|
if symbol.const_string is not None:
|
@@ -742,13 +734,13 @@ raise ValueError."""
|
|
742
734
|
if isinstance(target, ast.Type):
|
743
735
|
unaliased = target
|
744
736
|
if unaliased == ast.TYPE_UINT64:
|
745
|
-
value = str(symbol.const_int % 2**64)
|
737
|
+
value = str(symbol.const_int % 2 ** 64)
|
746
738
|
elif unaliased == ast.TYPE_UINT32:
|
747
|
-
value = str(symbol.const_int % 2**32)
|
739
|
+
value = str(symbol.const_int % 2 ** 32)
|
748
740
|
elif unaliased == ast.TYPE_UINT16:
|
749
|
-
value = str(symbol.const_int % 2**16)
|
741
|
+
value = str(symbol.const_int % 2 ** 16)
|
750
742
|
elif unaliased == ast.TYPE_UINT8:
|
751
|
-
value = str(symbol.const_int % 2**16)
|
743
|
+
value = str(symbol.const_int % 2 ** 16)
|
752
744
|
else:
|
753
745
|
value = str(symbol.const_int)
|
754
746
|
elif symbol.const_double is not None:
|
@@ -765,7 +757,7 @@ raise ValueError."""
|
|
765
757
|
def _create_typedef_struct(self, symbol, disguised=False):
|
766
758
|
try:
|
767
759
|
name = self.strip_identifier(symbol.ident)
|
768
|
-
except TransformerException
|
760
|
+
except TransformerException as e:
|
769
761
|
message.warn_symbol(symbol, e)
|
770
762
|
return None
|
771
763
|
struct = ast.Record(name, symbol.ident, disguised=disguised)
|
@@ -777,7 +769,7 @@ raise ValueError."""
|
|
777
769
|
def _create_typedef_union(self, symbol):
|
778
770
|
try:
|
779
771
|
name = self.strip_identifier(symbol.ident)
|
780
|
-
except TransformerException
|
772
|
+
except TransformerException as e:
|
781
773
|
message.warn(e)
|
782
774
|
return None
|
783
775
|
union = ast.Union(name, symbol.ident)
|
@@ -825,7 +817,7 @@ raise ValueError."""
|
|
825
817
|
else:
|
826
818
|
try:
|
827
819
|
name = self.strip_identifier(symbol.ident)
|
828
|
-
except TransformerException
|
820
|
+
except TransformerException as e:
|
829
821
|
message.warn(e)
|
830
822
|
return None
|
831
823
|
compound = klass(name, symbol.ident)
|
@@ -846,8 +838,7 @@ raise ValueError."""
|
|
846
838
|
|
847
839
|
# Mark the 'user_data' arguments
|
848
840
|
for i, param in enumerate(parameters):
|
849
|
-
if (param.type.target_fundamental == 'gpointer' and
|
850
|
-
param.argname == 'user_data'):
|
841
|
+
if (param.type.target_fundamental == 'gpointer' and param.argname == 'user_data'):
|
851
842
|
param.closure_name = param.argname
|
852
843
|
|
853
844
|
if member:
|
@@ -855,13 +846,13 @@ raise ValueError."""
|
|
855
846
|
elif symbol.ident.find('_') > 0:
|
856
847
|
try:
|
857
848
|
name = self._strip_symbol(symbol)
|
858
|
-
except TransformerException
|
849
|
+
except TransformerException as e:
|
859
850
|
message.warn_symbol(symbol, e)
|
860
851
|
return None
|
861
852
|
else:
|
862
853
|
try:
|
863
854
|
name = self.strip_identifier(symbol.ident)
|
864
|
-
except TransformerException
|
855
|
+
except TransformerException as e:
|
865
856
|
message.warn(e)
|
866
857
|
return None
|
867
858
|
callback = ast.Callback(name, retval, parameters, False,
|
Binary file
|
Binary file
|
@@ -22,7 +22,10 @@ import re
|
|
22
22
|
import os
|
23
23
|
import subprocess
|
24
24
|
|
25
|
+
|
25
26
|
_debugflags = None
|
27
|
+
|
28
|
+
|
26
29
|
def have_debug_flag(flag):
|
27
30
|
"""Check for whether a specific debugging feature is enabled.
|
28
31
|
Well-known flags:
|
@@ -38,6 +41,7 @@ Well-known flags:
|
|
38
41
|
_debugflags.remove('')
|
39
42
|
return flag in _debugflags
|
40
43
|
|
44
|
+
|
41
45
|
def break_on_debug_flag(flag):
|
42
46
|
if have_debug_flag(flag):
|
43
47
|
import pdb
|
@@ -69,8 +73,10 @@ def to_underscores_noprefix(name):
|
|
69
73
|
name = _upperstr_pat2.sub(r'\1_\2', name)
|
70
74
|
return name
|
71
75
|
|
76
|
+
|
72
77
|
_libtool_pat = re.compile("dlname='([A-z0-9\.\-\+]+)'\n")
|
73
78
|
|
79
|
+
|
74
80
|
def _extract_dlname_field(la_file):
|
75
81
|
f = open(la_file)
|
76
82
|
data = f.read()
|
@@ -81,6 +87,7 @@ def _extract_dlname_field(la_file):
|
|
81
87
|
else:
|
82
88
|
return None
|
83
89
|
|
90
|
+
|
84
91
|
# Returns the name that we would pass to dlopen() the library
|
85
92
|
# corresponding to this .la file
|
86
93
|
def extract_libtool_shlib(la_file):
|
@@ -92,6 +99,7 @@ def extract_libtool_shlib(la_file):
|
|
92
99
|
# a path rather than the raw dlname
|
93
100
|
return os.path.basename(dlname)
|
94
101
|
|
102
|
+
|
95
103
|
def extract_libtool(la_file):
|
96
104
|
dlname = _extract_dlname_field(la_file)
|
97
105
|
if dlname is None:
|
@@ -104,6 +112,7 @@ def extract_libtool(la_file):
|
|
104
112
|
libname = libname.replace('.libs/.libs', '.libs')
|
105
113
|
return libname
|
106
114
|
|
115
|
+
|
107
116
|
# Returns arguments for invoking libtool, if applicable, otherwise None
|
108
117
|
def get_libtool_command(options):
|
109
118
|
libtool_infection = not options.nolibtool
|
Binary file
|
Binary file
|