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