blob: d7403d40da1372e890187e8faa628f6ec1a3c7ca (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
TYPEMAP
Botan__ASN1_String * O_OBJECT
Botan__AlgorithmIdentifier * O_OBJECT
Botan__AlternativeName * O_OBJECT
Botan__Attribute * O_OBJECT
Botan__Base64_Decoder * O_EXTOBJECT
Botan__Base64_Encoder * O_EXTOBJECT
Botan__Chain * O_EXTOBJECT
Botan__Extension * O_OBJECT
Botan__Filter * O_EXTOBJECT
Botan__Fork * O_EXTOBJECT
Botan__Hex_Decoder * O_EXTOBJECT
Botan__Hex_Encoder * O_EXTOBJECT
Botan__OID * O_OBJECT
Botan__Pipe * O_OBJECT
Botan__X509_Certificate * O_OBJECT
Botan__X509_DN * O_OBJECT
Botan__X509_Time * O_OBJECT
Botan__u32bit T_UV
######################################################################
OUTPUT
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
O_OBJECT
sv_setref_pv($arg, CLASS, (void*)$var);
O_EXTOBJECT
sv_setref_pv($arg, CLASS, (void*)$var);
sv_magic(SvRV($arg), 0, '~', (char *)&oi_init, sizeof(oi_init));
######################################################################
INPUT
O_OBJECT
if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else
croak(\"${Package}::$func_name() -- \"
\"$var is not a blessed SV reference\");
# The pointer variable "ObjectInfo *${var}_oi;" must be declared
# in PREINIT section. I don't know how to emit this declaration safely here.
O_EXTOBJECT
if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV($arg));
else
croak(\"${Package}::$func_name() -- \"
\"$var is not a blessed SV reference\");
{
MAGIC *mg = mg_find(SvRV($arg), '~');
if ( mg == 0
|| mg->mg_len != sizeof(ObjectInfo)
|| *(I32 *)(mg->mg_ptr) != ObjectInfo::SIGNVAL )
croak(\"${Package}::$func_name() -- \"
\"private magic data for $var invalid\");
${var}_oi = (ObjectInfo *)(mg->mg_ptr);
}
|