PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/Lib/perl5/perlhead.swg

#
Unknown | 102 lines | 87 code | 15 blank | 0 comment | 0 complexity | cee58e8532363af56758d1a327d57902 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. #ifdef __cplusplus
  2. /* Needed on some windows machines---since MS plays funny games with the header files under C++ */
  3. #include <math.h>
  4. #include <stdlib.h>
  5. extern "C" {
  6. #endif
  7. #include "EXTERN.h"
  8. #include "perl.h"
  9. #include "XSUB.h"
  10. /* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
  11. /* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
  12. #ifndef PERL_REVISION
  13. # if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
  14. # define PERL_PATCHLEVEL_H_IMPLICIT
  15. # include <patchlevel.h>
  16. # endif
  17. # if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
  18. # include <could_not_find_Perl_patchlevel.h>
  19. # endif
  20. # ifndef PERL_REVISION
  21. # define PERL_REVISION (5)
  22. # define PERL_VERSION PATCHLEVEL
  23. # define PERL_SUBVERSION SUBVERSION
  24. # endif
  25. #endif
  26. #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
  27. #define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
  28. #endif
  29. #ifndef SvIOK_UV
  30. # define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
  31. #endif
  32. #ifndef SvUOK
  33. # define SvUOK(sv) SvIOK_UV(sv)
  34. #endif
  35. #if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
  36. # define PL_sv_undef sv_undef
  37. # define PL_na na
  38. # define PL_errgv errgv
  39. # define PL_sv_no sv_no
  40. # define PL_sv_yes sv_yes
  41. # define PL_markstack_ptr markstack_ptr
  42. #endif
  43. #ifndef IVSIZE
  44. # ifdef LONGSIZE
  45. # define IVSIZE LONGSIZE
  46. # else
  47. # define IVSIZE 4 /* A bold guess, but the best we can make. */
  48. # endif
  49. #endif
  50. #ifndef INT2PTR
  51. # if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
  52. # define PTRV UV
  53. # define INT2PTR(any,d) (any)(d)
  54. # else
  55. # if PTRSIZE == LONGSIZE
  56. # define PTRV unsigned long
  57. # else
  58. # define PTRV unsigned
  59. # endif
  60. # define INT2PTR(any,d) (any)(PTRV)(d)
  61. # endif
  62. # define NUM2PTR(any,d) (any)(PTRV)(d)
  63. # define PTR2IV(p) INT2PTR(IV,p)
  64. # define PTR2UV(p) INT2PTR(UV,p)
  65. # define PTR2NV(p) NUM2PTR(NV,p)
  66. # if PTRSIZE == LONGSIZE
  67. # define PTR2ul(p) (unsigned long)(p)
  68. # else
  69. # define PTR2ul(p) INT2PTR(unsigned long,p)
  70. # endif
  71. #endif /* !INT2PTR */
  72. #ifndef SvPV_nolen
  73. # define SvPV_nolen(x) SvPV(x,PL_na)
  74. #endif
  75. #ifndef get_sv
  76. # define get_sv perl_get_sv
  77. #endif
  78. #ifndef ERRSV
  79. # define ERRSV get_sv("@",FALSE)
  80. #endif
  81. #ifndef pTHX_
  82. #define pTHX_
  83. #endif
  84. #include <string.h>
  85. #ifdef __cplusplus
  86. }
  87. #endif