File: typemap

package info (click to toggle)
libconvert-binary-c-perl 0.79-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 9,100 kB
  • sloc: ansic: 63,694; perl: 18,580; yacc: 2,143; makefile: 31
file content (31 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
################################################################################
#
# Copyright (c) 2002-2020 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\");