Skip to content

Commit

Permalink
fix: fix binding tests for Gck-1 and Gck-2
Browse files Browse the repository at this point in the history
See #87
  • Loading branch information
ianprime0509 committed Dec 24, 2024
1 parent abbe214 commit 576a64b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 4 deletions.
41 changes: 41 additions & 0 deletions gir-fixes/Gck-1.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:core="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_SESSION_HANDLE']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_SESSION_HANDLE in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gulong</xsl:attribute>
<xsl:attribute name="c:type">gulong</xsl:attribute>
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_FUNCTION_LIST_PTR']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_FUNCTION_LIST_PTR in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gpointer</xsl:attribute>
<xsl:attribute name="c:type">gpointer</xsl:attribute>
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_NOTIFY']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_NOTIFY in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gpointer</xsl:attribute>
<xsl:attribute name="c:type">gpointer</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
41 changes: 41 additions & 0 deletions gir-fixes/Gck-2.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:core="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_SESSION_HANDLE']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_SESSION_HANDLE in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gulong</xsl:attribute>
<xsl:attribute name="c:type">gulong</xsl:attribute>
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_FUNCTION_LIST_PTR']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_FUNCTION_LIST_PTR in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gpointer</xsl:attribute>
<xsl:attribute name="c:type">gpointer</xsl:attribute>
</xsl:copy>
</xsl:template>

<xsl:template match="core:type[@c:type='CK_NOTIFY']">
<!-- https://github.com/ianprime0509/zig-gobject/issues/87 -->
<!-- See CK_NOTIFY in http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html -->
<xsl:copy>
<xsl:attribute name="name">gpointer</xsl:attribute>
<xsl:attribute name="c:type">gpointer</xsl:attribute>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
20 changes: 16 additions & 4 deletions test/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ const module_options = std.StaticStringMap(ModuleOptions).initComptime(.{
.test_abi = false,
},
},
.{
"Gck-1", ModuleOptions{
// C includes yield error "This API has not yet reached stability."
.test_abi = false,
},
},
.{
"Gck-2", ModuleOptions{
// C includes yield error "This API has not yet reached stability."
.test_abi = false,
},
},
.{
"Gcr-3", ModuleOptions{
// C includes yield error "This API has not yet reached stability."
Expand Down Expand Up @@ -253,8 +265,8 @@ pub fn build(b: *std.Build) void {
"fontconfig-2.0",
"freetype2-2.0",
"GCab-1.0",
// "Gck-1", // Not enough type information available to translate
// "Gck-2", // Not enough type information available to translate
"Gck-1",
"Gck-2",
"Gcr-3",
"Gcr-4",
"GcrUi-3",
Expand Down Expand Up @@ -359,8 +371,8 @@ pub fn build(b: *std.Build) void {
"fontconfig-2.0",
"freetype2-2.0",
"GCab-1.0",
// "Gck-1", // Not enough type information available to translate
// "Gck-2", // Not enough type information available to translate
"Gck-1",
"Gck-2",
"Gcr-3",
"Gcr-4",
"GcrUi-3",
Expand Down

0 comments on commit 576a64b

Please sign in to comment.