The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
################################################################################
#
# $Project: /Convert-Binary-C $
# $Author: mhx $
# $Date: 2011/04/10 12:32:29 +0200 $
# $Revision: 18 $
# $Source: /typemap $
#
################################################################################
# 
# Copyright (c) 2002-2011 Marcus Holland-Moritz. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
# 
################################################################################

TYPEMAP
const char *	T_PV
CBC *		T_CBC_OBJECT

INPUT
T_CBC_OBJECT
	if (sv_isobject($arg) && SvTYPE(SvRV($arg)) == SVt_PVHV) {
	  HV *hv = (HV *) SvRV($arg);
	  SV **sv = hv_fetch(hv, \"\", 0, 0);
	  if (sv) {
	    IV tmp = SvIV(*sv);
	    $var = INT2PTR($type, tmp);
	    if ($var == NULL)
	      Perl_croak(aTHX_ \"${Package}::$func_name(): $var is NULL\");
	    if ($var->hv != hv)
	      Perl_croak(aTHX_ \"${Package}::$func_name(): $var->hv is corrupt\");
	  }
	  else
	    Perl_croak(aTHX_ \"${Package}::$func_name(): $var is corrupt\");
	}
	else
	  Perl_croak(aTHX_ \"${Package}::$func_name(): $var is not a blessed hash reference\");