/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of Reference.xs. Do not edit this file, edit Reference.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Reference.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"


#line 18 "Reference.c"
XS(XS_Devel__Reference_conceal); /* prototype to pass -Wmissing-prototypes */
XS(XS_Devel__Reference_conceal)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Devel::Reference::conceal(var)");
    {
	int	RETVAL;
	dXSTARG;
	int	var = (int)SvIV(ST(0));
#line 13 "Reference.xs"
    SvREFCNT_inc((SV *) var);
    RETVAL = var;
#line 32 "Reference.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_Devel__Reference_reveal); /* prototype to pass -Wmissing-prototypes */
XS(XS_Devel__Reference_reveal)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Devel::Reference::reveal(str_or_addr)");
    {
	SV *	RETVAL;
	char *	str_or_addr = (char *)SvPV_nolen(ST(0));
#line 21 "Reference.xs"
    char *hex;
    int addr = (hex = rindex(str_or_addr, 'x')) ?
      strtol(++hex, NULL, 16) :
      atoi(str_or_addr);
    RETVAL = newRV((SV *) addr);
    SvREFCNT_dec((SV *) addr);
#line 54 "Reference.c"
	ST(0) = RETVAL;
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_Devel__Reference_refcount); /* prototype to pass -Wmissing-prototypes */
XS(XS_Devel__Reference_refcount)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Devel::Reference::refcount(addr)");
    {
	U32	RETVAL;
	dXSTARG;
	int	addr = (int)SvIV(ST(0));
#line 33 "Reference.xs"
    SV *sv = (SV *) addr;
    RETVAL = SvREFCNT(sv);
#line 74 "Reference.c"
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_Devel__Reference); /* prototype to pass -Wmissing-prototypes */
XS(boot_Devel__Reference)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("Devel::Reference::conceal", XS_Devel__Reference_conceal, file);
        newXS("Devel::Reference::reveal", XS_Devel__Reference_reveal, file);
        newXS("Devel::Reference::refcount", XS_Devel__Reference_refcount, file);
    XSRETURN_YES;
}

