More and better fixes for older versions of perl
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8783 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
18d7ad613b
commit
e85c27328e
1 changed files with 85 additions and 76 deletions
|
|
@ -70,9 +70,6 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
} /* cc-mode */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SWIG_OWNER SWIG_POINTER_OWN
|
||||
|
|
@ -90,7 +87,86 @@ extern "C" {
|
|||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "patchlevel.h"
|
||||
|
||||
/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
|
||||
|
||||
/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
|
||||
#ifndef PERL_REVISION
|
||||
# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
|
||||
# define PERL_PATCHLEVEL_H_IMPLICIT
|
||||
# include <patchlevel.h>
|
||||
# endif
|
||||
# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
|
||||
# include <could_not_find_Perl_patchlevel.h>
|
||||
# endif
|
||||
# ifndef PERL_REVISION
|
||||
# define PERL_REVISION (5)
|
||||
# define PERL_VERSION PATCHLEVEL
|
||||
# define PERL_SUBVERSION SUBVERSION
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
|
||||
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
|
||||
#endif
|
||||
|
||||
#ifndef SvIOK_UV
|
||||
# define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
|
||||
#endif
|
||||
|
||||
#ifndef SvUOK
|
||||
# define SvUOK(sv) SvIOK_UV(sv)
|
||||
#endif
|
||||
|
||||
#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
|
||||
# define PL_sv_undef sv_undef
|
||||
# define PL_na na
|
||||
# define PL_errgv errgv
|
||||
# define PL_sv_no sv_no
|
||||
# define PL_sv_yes sv_yes
|
||||
# define PL_markstack_ptr markstack_ptr
|
||||
#endif
|
||||
|
||||
#ifndef IVSIZE
|
||||
# ifdef LONGSIZE
|
||||
# define IVSIZE LONGSIZE
|
||||
# else
|
||||
# define IVSIZE 4 /* A bold guess, but the best we can make. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT2PTR
|
||||
# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
|
||||
# define PTRV UV
|
||||
# define INT2PTR(any,d) (any)(d)
|
||||
# else
|
||||
# if PTRSIZE == LONGSIZE
|
||||
# define PTRV unsigned long
|
||||
# else
|
||||
# define PTRV unsigned
|
||||
# endif
|
||||
# define INT2PTR(any,d) (any)(PTRV)(d)
|
||||
# endif
|
||||
|
||||
# define NUM2PTR(any,d) (any)(PTRV)(d)
|
||||
# define PTR2IV(p) INT2PTR(IV,p)
|
||||
# define PTR2UV(p) INT2PTR(UV,p)
|
||||
# define PTR2NV(p) NUM2PTR(NV,p)
|
||||
|
||||
# if PTRSIZE == LONGSIZE
|
||||
# define PTR2ul(p) (unsigned long)(p)
|
||||
# else
|
||||
# define PTR2ul(p) INT2PTR(unsigned long,p)
|
||||
# endif
|
||||
#endif /* !INT2PTR */
|
||||
|
||||
#ifndef get_sv
|
||||
# define get_sv perl_get_sv
|
||||
#endif
|
||||
|
||||
#ifndef ERRSV
|
||||
# define ERRSV get_sv("@",FALSE)
|
||||
#endif
|
||||
|
||||
#ifndef pTHX_
|
||||
#define pTHX_
|
||||
|
|
@ -101,8 +177,9 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Macro to call an XS function */
|
||||
/* SWIG Perl macros */
|
||||
|
||||
/* Macro to call an XS function */
|
||||
#ifdef PERL_OBJECT
|
||||
# define SWIG_CALLXS(_name) _name(cv,pPerl)
|
||||
#else
|
||||
|
|
@ -160,7 +237,7 @@ typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
|
|||
#endif
|
||||
|
||||
/* Workaround for bug in perl 5.6.x croak and earlier */
|
||||
#if !defined(PERL_VERSION) || (PERL_VERSION < 8)
|
||||
#if (PERL_VERSION < 8)
|
||||
# ifdef PERL_OBJECT
|
||||
# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
|
||||
static void SWIG_Perl_croak_null(CPerlObj *pPerl)
|
||||
|
|
@ -169,7 +246,7 @@ static void SWIG_croak_null()
|
|||
# endif
|
||||
{
|
||||
SV *err=ERRSV;
|
||||
# if !defined(PERL_VERSION) || (PERL_VERSION < 6)
|
||||
# if (PERL_VERSION < 6)
|
||||
croak("%_", err);
|
||||
# else
|
||||
if (SvOK(err) && !SvROK(err)) croak("%_", err);
|
||||
|
|
@ -177,75 +254,10 @@ static void SWIG_croak_null()
|
|||
# endif
|
||||
}
|
||||
#else
|
||||
#define SWIG_croak_null() croak(Nullch)
|
||||
# define SWIG_croak_null() croak(Nullch)
|
||||
#endif
|
||||
|
||||
|
||||
/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
|
||||
|
||||
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
|
||||
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
|
||||
#endif
|
||||
|
||||
#ifndef SvIOK_UV
|
||||
# define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
|
||||
#endif
|
||||
|
||||
#ifndef SvUOK
|
||||
# define SvUOK(sv) SvIOK_UV(sv)
|
||||
#endif
|
||||
|
||||
#if !((PATCHLEVEL == 5) && (SUBVERSION == 4))
|
||||
# ifndef PL_markstack_ptr
|
||||
# define PL_markstack_ptr Perl_markstack_ptr
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(PERL_REVISION) || ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
|
||||
# define PL_sv_undef sv_undef
|
||||
# define PL_na na
|
||||
# define PL_errgv errgv
|
||||
# define PL_sv_no sv_no
|
||||
# define PL_sv_yes sv_yes
|
||||
#endif
|
||||
|
||||
#ifndef IVSIZE
|
||||
# ifdef LONGSIZE
|
||||
# define IVSIZE LONGSIZE
|
||||
# else
|
||||
# define IVSIZE 4 /* A bold guess, but the best we can make. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT2PTR
|
||||
# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
|
||||
# define PTRV UV
|
||||
# define INT2PTR(any,d) (any)(d)
|
||||
# else
|
||||
# if PTRSIZE == LONGSIZE
|
||||
# define PTRV unsigned long
|
||||
# else
|
||||
# define PTRV unsigned
|
||||
# endif
|
||||
# define INT2PTR(any,d) (any)(PTRV)(d)
|
||||
# endif
|
||||
|
||||
# define NUM2PTR(any,d) (any)(PTRV)(d)
|
||||
# define PTR2IV(p) INT2PTR(IV,p)
|
||||
# define PTR2UV(p) INT2PTR(UV,p)
|
||||
# define PTR2NV(p) NUM2PTR(NV,p)
|
||||
|
||||
# if PTRSIZE == LONGSIZE
|
||||
# define PTR2ul(p) (unsigned long)(p)
|
||||
# else
|
||||
# define PTR2ul(p) INT2PTR(unsigned long,p)
|
||||
# endif
|
||||
#endif /* !INT2PTR */
|
||||
|
||||
#ifndef get_sv
|
||||
# define get_sv perl_get_sv
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
@ -514,8 +526,5 @@ SWIG_Perl_SetModule(swig_module_info *module) {
|
|||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{ /* cc-mode */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue