/*
 * This file was generated automatically by ExtUtils::ParseXS version 2.18 from the
 * contents of BSED.xs. Do not edit this file, edit BSED.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST! 
 *
 */

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

#include "ppport.h"

#include <stdio.h>
#include "bsedlib.h"

extern int isb_errno;

#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#line 26 "BSED.c"

XS(XS_File__BSED__binary_file_matches); /* prototype to pass -Wmissing-prototypes */
XS(XS_File__BSED__binary_file_matches)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "File::BSED::_binary_file_matches", "search, infile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	unsigned char *	search = (unsigned char *)SvPV_nolen(ST(0));
	unsigned char *	infile = (unsigned char *)SvPV_nolen(ST(1));
	int	RETVAL;
	dXSTARG;
#line 21 "BSED.xs"
        unsigned char *replace;
        unsigned char *outfile;
        int min  =  1;
        int max  = -1;
        int no_r =  1;
        replace  = NULL;
        outfile  = NULL;


    RETVAL = bsr(search, replace, infile, outfile, min, max, no_r);


#line 57 "BSED.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_File__BSED__bsed); /* prototype to pass -Wmissing-prototypes */
XS(XS_File__BSED__bsed)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 6)
       Perl_croak(aTHX_ "Usage: %s(%s)", "File::BSED::_bsed", "search, replace, infile, outfile, min, max");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	unsigned char *	search = (unsigned char *)SvPV_nolen(ST(0));
	unsigned char *	replace = (unsigned char *)SvPV_nolen(ST(1));
	unsigned char *	infile = (unsigned char *)SvPV_nolen(ST(2));
	unsigned char *	outfile = (unsigned char *)SvPV_nolen(ST(3));
	int	min = (int)SvIV(ST(4));
	int	max = (int)SvIV(ST(5));
	int	RETVAL;
	dXSTARG;
#line 46 "BSED.xs"
        int no_r =  0; 

    RETVAL = bsr(search, replace, infile, outfile, min, max, no_r);

#line 89 "BSED.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_File__BSED__isb_errno); /* prototype to pass -Wmissing-prototypes */
XS(XS_File__BSED__isb_errno)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 0)
       Perl_croak(aTHX_ "Usage: %s(%s)", "File::BSED::_isb_errno", "");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	int	RETVAL;
	dXSTARG;
#line 56 "BSED.xs"
        RETVAL = isb_errno;
#line 112 "BSED.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_File__BSED__set_isb_errno); /* prototype to pass -Wmissing-prototypes */
XS(XS_File__BSED__set_isb_errno)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "File::BSED::_set_isb_errno", "new_errno");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	int	new_errno = (int)SvIV(ST(0));
#line 65 "BSED.xs"
        isb_errno = new_errno;
#line 134 "BSED.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_File__BSED__errtostr); /* prototype to pass -Wmissing-prototypes */
XS(XS_File__BSED__errtostr)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "File::BSED::_errtostr", "isb_errno_val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	int	isb_errno_val = (int)SvIV(ST(0));
	SV *	RETVAL;
#line 73 "BSED.xs"
    const char *isb_errstr;

    isb_errstr = isb_errtostr(isb_errno_val);
    if (isb_errstr == NULL) {
        RETVAL = &PL_sv_undef;
    }
    else {
        RETVAL = newSVpvn((char *)isb_errstr, (STRLEN)strlen((char *)isb_errstr));
    }

#line 165 "BSED.c"
	ST(0) = RETVAL;
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

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

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
    XS_VERSION_BOOTCHECK ;

        newXS("File::BSED::_binary_file_matches", XS_File__BSED__binary_file_matches, file);
        newXS("File::BSED::_bsed", XS_File__BSED__bsed, file);
        newXS("File::BSED::_isb_errno", XS_File__BSED__isb_errno, file);
        newXS("File::BSED::_set_isb_errno", XS_File__BSED__set_isb_errno, file);
        newXS("File::BSED::_errtostr", XS_File__BSED__errtostr, file);
    if (PL_unitcheckav)
         call_list(PL_scopestack_ix, PL_unitcheckav);
    XSRETURN_YES;
}

