Debian Codegraph @

contrib/perl/lib/Text/typemap

raw
1 # SPDX-License-Identifier: Artistic-1.0-Perl
2 ###############################################################################
3 ##
4 ## Typemap for Graphite2 objects
5 ##
6 ## Copyright (c) 2011 Simon Cozens
7 ## All rights reserved.
8 ##
9 ## This typemap is designed specifically to make it easier to handle
10 ## Perl-style blessed objects in XS. In particular, it takes care of
11 ## blessing the object into the correct class (even for derived classes).
12 ##
13 ##
14 ###############################################################################
15 ## vi:et:sw=4 ts=4
16
17 TYPEMAP
18
19 gr_uint32 T_U_LONG
20 gr_uint16 T_U_SHORT
21 gr_int16 T_IV
22 gr_uint8 T_UV
23 enum gr_encform T_IV
24 enum gr_attrCode T_IV
25
26 Text_Gr2_Face* T_PTROBJ_SPECIAL
27 Text_Gr2_Font* T_PTROBJ_SPECIAL
28 Text_Gr2_FeatureVal* T_PTROBJ_SPECIAL
29 Text_Gr2_FeatureRef* T_PTROBJ_SPECIAL
30 Text_Gr2_CharInfo* T_PTROBJ_SPECIAL
31 Text_Gr2_Segment* T_PTROBJ_SPECIAL
32 Text_Gr2_Slot* T_PTROBJ_SPECIAL
33
34 INPUT
35 T_PTROBJ_SPECIAL
36 if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;$ntt=~s/Ptr//;\$ntt}\")) {
37 IV tmp = SvIV((SV*)SvRV($arg));
38 $var = INT2PTR($type,tmp);
39 }
40 else
41 croak(\"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;$ntt=~s/Ptr//;\$ntt}\")
42
43 OUTPUT
44 T_PTROBJ_SPECIAL
45 /* inherited new() */
46 sv_setref_pv($arg, "${(my $ntt=$ntype)=~s/_/::/g;$ntt=~s/Ptr//;\$ntt}\", (void*)$var);