[gobject-introspection: 2/3] Define grefcount and gatomicrefcount as aliases to gint



commit 1672daae17b5b58a9595848b76150c5dac7e5614
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Fri Nov 23 00:00:00 2018 +0000

    Define grefcount and gatomicrefcount as aliases to gint

 giscanner/ast.py                                   |  2 +
 ...gress.TestReferenceCounters-atomicrefcount.page | 14 +++++++
 .../Regress.TestReferenceCounters-refcount.page    | 14 +++++++
 .../Regress.TestReferenceCounters.page             | 35 ++++++++++++++++++
 ...gress.TestReferenceCounters-atomicrefcount.page | 18 +++++++++
 .../Regress.TestReferenceCounters-refcount.page    | 18 +++++++++
 .../Regress.TestReferenceCounters.page             | 43 ++++++++++++++++++++++
 ...gress.TestReferenceCounters-atomicrefcount.page | 14 +++++++
 .../Regress.TestReferenceCounters-refcount.page    | 14 +++++++
 .../Regress.TestReferenceCounters.page             | 40 ++++++++++++++++++++
 tests/scanner/Regress-1.0-expected.gir             |  8 ++++
 tests/scanner/regress.h                            |  8 ++++
 12 files changed, 228 insertions(+)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index a9a6e13b..75daa459 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -322,6 +322,8 @@ type_names['gssize'] = TYPE_SSIZE
 type_names['gintptr'] = TYPE_INTPTR
 type_names['guintptr'] = TYPE_UINTPTR
 type_names['gconstpointer'] = TYPE_ANY
+type_names['grefcount'] = TYPE_INT
+type_names['gatomicrefcount'] = TYPE_INT
 
 # We used to support these; continue to do so
 type_names['any'] = TYPE_ANY
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page 
b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..6c07402d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters->atomicrefcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page 
b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..ed4aab56
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters->refcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page 
b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..8176ff9a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+      type="guide"
+      style="class"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="class" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters</title>
+
+
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-csrc"
+         groups="constructor" style="linklist">
+    <title>Constructors</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-csrc"
+         groups="method" style="linklist">
+    <title>Methods</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-csrc"
+         groups="function" style="linklist">
+    <title>Static Functions</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="field" style="linklist">
+    <title>Fields</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+    <title>Other</title>
+  </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page 
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..afd078e2
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+    <title type="link" role="topic">atomicrefcount</title>
+  </info>
+  <title>Regress.TestReferenceCounters.atomicrefcount</title>
+  <synopsis><code mime="text/x-gjs">
+TestReferenceCounters.atomicrefcount: Number(gint) (Read / Write)
+  </code></synopsis>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page 
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..8784e28a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+    <title type="link" role="topic">refcount</title>
+  </info>
+  <title>Regress.TestReferenceCounters.refcount</title>
+  <synopsis><code mime="text/x-gjs">
+TestReferenceCounters.refcount: Number(gint) (Read / Write)
+  </code></synopsis>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page 
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..8f5b2d2d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+      type="guide"
+      style="class"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="class" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters</title>
+  <synopsis><code>
+const Regress = imports.gi.Regress;
+
+let testReferenceCounters = new Regress.TestReferenceCounters({
+    <link xref='Regress.TestReferenceCounters-refcount'>refcount</link>: value
+    <link xref='Regress.TestReferenceCounters-atomicrefcount'>atomicrefcount</link>: value
+});
+  </code></synopsis>
+
+
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-gjs"
+         groups="constructor" style="linklist">
+    <title>Constructors</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-gjs"
+         groups="method" style="linklist">
+    <title>Methods</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/x-gjs"
+         groups="function" style="linklist">
+    <title>Static Functions</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="field" style="linklist">
+    <title>Fields</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+    <title>Other</title>
+  </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page 
b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..6c07402d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters->atomicrefcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page 
b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..ed4aab56
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+      type="topic"
+      style="field"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters->refcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page 
b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..bc8651ab
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+      type="guide"
+      style="class"
+      xmlns="http://projectmallard.org/1.0/";
+      xmlns:api="http://projectmallard.org/experimental/api/";
+      xmlns:ui="http://projectmallard.org/1.0/ui/";>
+  <info>
+    <link xref="index" group="class" type="guide"/>
+  </info>
+  <title>Regress.TestReferenceCounters</title>
+  <synopsis><code>
+from gi.repository import Regress
+
+test_reference_counters = Regress.TestReferenceCounters()
+  </code></synopsis>
+
+
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/python"
+         groups="constructor" style="linklist">
+    <title>Constructors</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/python"
+         groups="method" style="linklist">
+    <title>Methods</title>
+  </links>
+  <links type="topic" ui:expanded="true"
+         api:type="function" api:mime="text/python"
+         groups="function" style="linklist">
+    <title>Static Functions</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="field" style="linklist">
+    <title>Fields</title>
+  </links>
+  <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+    <title>Other</title>
+  </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 2b4962ff..64ed1177 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4034,6 +4034,14 @@ the introspection client langage.</doc>
         <type name="gint" c:type="gint"/>
       </field>
     </record>
+    <record name="TestReferenceCounters" c:type="RegressTestReferenceCounters">
+      <field name="refcount" writable="1">
+        <type name="gint" c:type="grefcount"/>
+      </field>
+      <field name="atomicrefcount" writable="1">
+        <type name="gint" c:type="gatomicrefcount"/>
+      </field>
+    </record>
     <enumeration name="TestReferenceEnum" c:type="RegressTestReferenceEnum">
       <member name="0" value="4" c:identifier="REGRESS_TEST_REFERENCE_0">
       </member>
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 167a71d9..66467d0a 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -4,6 +4,7 @@
 #ifndef _GI_DISABLE_CAIRO
 #include <cairo-gobject.h>
 #endif
+#include <glib.h>
 #include <glib-object.h>
 #include <gio/gio.h>
 #include <time.h>
@@ -1494,4 +1495,11 @@ typedef struct {
 GVariant *
 regress_get_variant (void);
 
+typedef struct _RegressTestReferenceCounters RegressTestReferenceCounters;
+
+struct _RegressTestReferenceCounters {
+  grefcount       refcount;
+  gatomicrefcount atomicrefcount;
+};
+
 #endif /* __GITESTTYPES_H__ */


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