1
From 751a9fa80a31c01cd26ff35f0e66f428372ea88b Mon Sep 17 00:00:00 2001
2
From: Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
3
Date: Thu, 20 Jan 2011 16:34:45 +0100
4
Subject: [PATCH 1/3] Preserve the c:type of array elements
6
So the element type has the correct is_pointer flag
8
https://bugzilla.gnome.org/show_bug.cgi?id=638929
10
giscanner/maintransformer.py | 5 ++-
11
tests/scanner/Annotation-1.0-expected.gir | 14 ++++++------
12
tests/scanner/Foo-1.0-expected.gir | 4 +-
13
tests/scanner/Regress-1.0-expected.gir | 34 ++++++++++++++--------------
14
4 files changed, 29 insertions(+), 28 deletions(-)
16
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
17
index 8ada929..ee94554 100644
18
--- a/giscanner/maintransformer.py
19
+++ b/giscanner/maintransformer.py
20
@@ -325,8 +325,9 @@ usage is void (*_gtk_reserved1)(void);"""
1
=== modified file 'giscanner/maintransformer.py'
2
--- old/giscanner/maintransformer.py 2011-01-21 21:08:31 +0000
3
+++ new/giscanner/maintransformer.py 2011-01-21 21:09:34 +0000
21
5
# We're assuming here that Foo* with an (array) annotation
22
6
# and no (element-type) means array of Foo
23
7
element_type_node = node.type.clone()
24
8
- # Explicitly erase ctype since it's no longer valid
25
9
- element_type_node.ctype = None
26
+ # The element's ctype is the array's dereferenced
27
+ if element_type_node.ctype.endswith('*'):
28
+ element_type_node.ctype = element_type_node.ctype[:-1]
10
+ if hasattr(element_type_node.ctype, "endswith"):
11
+ # The element's ctype is the array's dereferenced
12
+ if element_type_node.ctype.endswith('*'):
13
+ element_type_node.ctype = element_type_node.ctype[:-1]
15
+ element_type_node.ctype = None
30
17
if isinstance(node.type, ast.Array):
31
18
array_type = node.type.array_type
32
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
33
index e47a4b9..e05e61b 100644
34
--- a/tests/scanner/Annotation-1.0-expected.gir
35
+++ b/tests/scanner/Annotation-1.0-expected.gir
36
@@ -147,7 +147,7 @@ and/or use gtk-doc annotations. -->
20
=== modified file 'tests/scanner/Annotation-1.0-expected.gir'
21
--- old/tests/scanner/Annotation-1.0-expected.gir 2011-01-21 21:08:31 +0000
22
+++ new/tests/scanner/Annotation-1.0-expected.gir 2011-01-21 21:09:08 +0000
37
24
<parameter name="nums" transfer-ownership="none">
38
25
<doc xml:whitespace="preserve">Sequence of numbers</doc>
39
26
<array c:type="int*">
99
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
100
index e527cad..fa5ee93 100644
101
--- a/tests/scanner/Foo-1.0-expected.gir
102
+++ b/tests/scanner/Foo-1.0-expected.gir
103
@@ -1085,7 +1085,7 @@ exposed to language bindings.</doc>
87
=== modified file 'tests/scanner/Foo-1.0-expected.gir'
88
--- old/tests/scanner/Foo-1.0-expected.gir 2011-01-21 21:08:31 +0000
89
+++ new/tests/scanner/Foo-1.0-expected.gir 2011-01-21 21:09:08 +0000
105
92
<parameter name="array" transfer-ownership="none">
106
93
<array c:type="char**">
121
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
122
index 3d4e56f..abf46f1 100644
123
--- a/tests/scanner/Regress-1.0-expected.gir
124
+++ b/tests/scanner/Regress-1.0-expected.gir
125
@@ -1069,7 +1069,7 @@ TpAccount::status-changed</doc>
109
=== modified file 'tests/scanner/Regress-1.0-expected.gir'
110
--- old/tests/scanner/Regress-1.0-expected.gir 2011-01-21 21:08:31 +0000
111
+++ new/tests/scanner/Regress-1.0-expected.gir 2011-01-21 21:09:08 +0000
112
@@ -1051,7 +1051,7 @@
126
113
<parameter name="ints" transfer-ownership="none">
127
114
<doc xml:whitespace="preserve">a list of 5 integers</doc>
128
115
<array c:type="int*" fixed-size="5">