1 /* THIS FILE IS AUTOMATICALLY GENERATED BY Module::Install::XSUtil 0.43. */ 2 /* 3 =head1 NAME 4 5 xshelper.h - Helper C header file for XS modules 6 7 =head1 DESCRIPTION 8 9 // This includes all the perl header files and ppport.h 10 #include "xshelper.h" 11 12 =head1 SEE ALSO 13 14 L<Module::Install::XSUtil>, where this file is distributed as a part of 15 16 =head1 AUTHOR 17 18 Fuji, Goro (gfx) E<lt>gfuji at cpan.orgE<gt> 19 20 =head1 LISENCE 21 22 Copyright (c) 2010, Fuji, Goro (gfx). All rights reserved. 23 24 This library is free software; you can redistribute it and/or modify 25 it under the same terms as Perl itself. 26 27 =cut 28 */ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define PERL_NO_GET_CONTEXT /* we want efficiency */ 35 #include <EXTERN.h> 36 #include <perl.h> 37 #define NO_XSLOCKS /* for exceptions */ 38 #include <XSUB.h> 39 40 #ifdef __cplusplus 41 } /* extern "C" */ 42 #endif 43 44 #include "ppport.h" 45 46 /* portability stuff not supported by ppport.h yet */ 47 48 #ifndef STATIC_INLINE /* from 5.13.4 */ 49 # if defined(__GNUC__) || defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) 50 # define STATIC_INLINE static inline 51 # else 52 # define STATIC_INLINE static 53 # endif 54 #endif /* STATIC_INLINE */ 55 56 #ifndef __attribute__format__ 57 #define __attribute__format__(a,b,c) /* nothing */ 58 #endif 59 60 #ifndef LIKELY /* they are just a compiler's hint */ 61 #define LIKELY(x) (!!(x)) 62 #define UNLIKELY(x) (!!(x)) 63 #endif 64 65 #ifndef newSVpvs_share 66 #define newSVpvs_share(s) Perl_newSVpvn_share(aTHX_ STR_WITH_LEN(s), 0U) 67 #endif 68 69 #ifndef get_cvs 70 #define get_cvs(name, flags) get_cv(name, flags) 71 #endif 72 73 #ifndef GvNAME_get 74 #define GvNAME_get GvNAME 75 #endif 76 #ifndef GvNAMELEN_get 77 #define GvNAMELEN_get GvNAMELEN 78 #endif 79 80 #ifndef CvGV_set 81 #define CvGV_set(cv, gv) (CvGV(cv) = (gv)) 82 #endif 83 84 /* general utility */ 85 86 #if PERL_BCDVERSION >= 0x5008005 87 #define LooksLikeNumber(x) looks_like_number(x) 88 #else 89 #define LooksLikeNumber(x) (SvPOKp(x) ? looks_like_number(x) : (I32)SvNIOKp(x)) 90 #endif 91 92 #define newAV_mortal() (AV*)sv_2mortal((SV*)newAV()) 93 #define newHV_mortal() (HV*)sv_2mortal((SV*)newHV()) 94 #define newRV_inc_mortal(sv) sv_2mortal(newRV_inc(sv)) 95 #define newRV_noinc_mortal(sv) sv_2mortal(newRV_noinc(sv)) 96 97 #define DECL_BOOT(name) EXTERN_C XS(CAT2(boot_, name)) 98 #define CALL_BOOT(name) STMT_START { \ 99 PUSHMARK(SP); \ 100 CALL_FPTR(CAT2(boot_, name))(aTHX_ cv); \ 101 } STMT_END 102