[libglib-perl] 03/07: Add char_byte and char_byte_ornull typemaps

Intrigeri intrigeri at moszumanska.debian.org
Thu Mar 19 13:29:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag rel-1-31-0
in repository libglib-perl.

commit c4015e04e326409a0f01ea5676be33cd297090ca
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date:   Sun Nov 30 18:46:43 2014 +0100

    Add char_byte and char_byte_ornull typemaps
    
    These use SvPVbyte to ensure that the bytes that the user stored in the string
    are passed on, regardless of which internal representation perl happens to use.
---
 gperl.h            |  2 ++
 lib/Glib/GenPod.pm |  2 ++
 typemap            | 15 +++++++++++++++
 3 files changed, 19 insertions(+)

diff --git a/gperl.h b/gperl.h
index 8506ffc..2f060a9 100644
--- a/gperl.h
+++ b/gperl.h
@@ -372,6 +372,8 @@ SV * newSVGUserDirectory (GUserDirectory dir);
 typedef char char_ornull;
 typedef char char_own;
 typedef char char_own_ornull;
+typedef char char_byte;
+typedef char char_byte_ornull;
 
 /* never use this function directly.  use GPERL_CALL_BOOT. */
 void _gperl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark);
diff --git a/lib/Glib/GenPod.pm b/lib/Glib/GenPod.pm
index 22f884c..91c1e68 100644
--- a/lib/Glib/GenPod.pm
+++ b/lib/Glib/GenPod.pm
@@ -448,6 +448,8 @@ our %basic_types = (
 	gchar_length => 'string',
 	gchar_utf8_length => 'string',
 
+	char_byte => 'byte string',
+
 	FILE => 'file handle',
 	time_t => 'unix timestamp',
 
diff --git a/typemap b/typemap
index ab05a57..7307291 100644
--- a/typemap
+++ b/typemap
@@ -60,6 +60,11 @@ char_own *			T_CHAR_OWN
 char_own_ornull *		T_CHAR_OWN_ORNULL
 const char_ornull *		T_CHAR_ORNULL
 
+char_byte *			T_CHAR_BYTE
+const char_byte *		T_CHAR_BYTE
+char_byte_ornull *		T_CHAR_BYTE_ORNULL
+const char_byte_ornull *	T_CHAR_BYTE_ORNULL
+
 guchar *			T_GUCHAR
 const guchar *			T_GUCHAR
 
@@ -149,6 +154,16 @@ T_CHAR_ORNULL
 		$var = NULL;
 	}
 
+T_CHAR_BYTE
+	$var = ($type)SvPVbyte_nolen ($arg);
+
+T_CHAR_BYTE_ORNULL
+	if (gperl_sv_is_defined ($arg)) {
+		$var = ($type)SvPVbyte_nolen ($arg);
+	} else {
+		$var = NULL;
+	}
+
 T_G_TYPE_IO_CONDITION
 	$var = gperl_convert_flags (G_TYPE_IO_CONDITION, $arg);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-perl.git



More information about the Pkg-perl-cvs-commits mailing list