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

#line 1 "Strip.xs"

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "strip_html.h"

#line 18 "Strip.c"

XS(XS_HTML__Strip_create); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_create)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: HTML::Strip::create()");
    {
#line 15 "Strip.xs"
  Stripper * stripper;
#line 29 "Strip.c"
	Stripper *	RETVAL;
#line 17 "Strip.xs"
  New( 0, stripper, 1, Stripper );
  reset( stripper );
  RETVAL = stripper;
#line 35 "Strip.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "HTML::Strip", (void*)RETVAL );
    }
    XSRETURN(1);
}


XS(XS_HTML__Strip_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_DESTROY)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: HTML::Strip::DESTROY(stripper)");
    {
	Stripper *	stripper;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::DESTROY() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 27 "Strip.xs"
  Safefree( stripper );
#line 60 "Strip.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_strip_html); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_strip_html)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: HTML::Strip::strip_html(stripper, raw)");
    {
	Stripper *	stripper;
	char *	raw = (char *)SvPV_nolen(ST(1));
#line 34 "Strip.xs"
  char * clean;
  int size = strlen(raw) + 1;
#line 78 "Strip.c"
	char *	RETVAL;
	dXSTARG;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::strip_html() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 37 "Strip.xs"
  New( 0, clean, size, char );
#line 90 "Strip.c"
#line 39 "Strip.xs"
  strip_html( stripper, raw, clean );
  RETVAL = clean;
#line 94 "Strip.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
#line 44 "Strip.xs"
  Safefree( clean );
#line 98 "Strip.c"
    }
    XSRETURN(1);
}


XS(XS_HTML__Strip_reset); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_reset)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: HTML::Strip::reset(stripper)");
    {
	Stripper *	stripper;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::reset() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};

	reset(stripper);
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_clear_striptags); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_clear_striptags)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: HTML::Strip::clear_striptags(stripper)");
    {
	Stripper *	stripper;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::clear_striptags() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};

	clear_striptags(stripper);
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_add_striptag); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_add_striptag)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: HTML::Strip::add_striptag(stripper, tag)");
    {
	Stripper *	stripper;
	char *	tag = (char *)SvPV_nolen(ST(1));

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::add_striptag() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};

	add_striptag(stripper, tag);
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_set_emit_spaces); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_set_emit_spaces)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: HTML::Strip::set_emit_spaces(stripper, emit)");
    {
	Stripper *	stripper;
	int	emit = (int)SvIV(ST(1));

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::set_emit_spaces() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 64 "Strip.xs"
  stripper->o_emit_spaces = emit;
#line 189 "Strip.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_set_decode_entities); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_set_decode_entities)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: HTML::Strip::set_decode_entities(stripper, decode)");
    {
	Stripper *	stripper;
	int	decode = (int)SvIV(ST(1));

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::set_decode_entities() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 71 "Strip.xs"
  stripper->o_decode_entities = decode;
#line 213 "Strip.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_HTML__Strip_decode_entities); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_decode_entities)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: HTML::Strip::decode_entities(stripper)");
    {
	Stripper *	stripper;
	int	RETVAL;
	dXSTARG;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::decode_entities() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 77 "Strip.xs"
  RETVAL = stripper->o_decode_entities;
#line 238 "Strip.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_HTML__Strip_set_striptags_ref); /* prototype to pass -Wmissing-prototypes */
XS(XS_HTML__Strip_set_striptags_ref)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: HTML::Strip::set_striptags_ref(stripper, tagref)");
    {
	Stripper *	stripper;
	SV *	tagref = ST(1);
#line 86 "Strip.xs"
  AV * tags;
  I32 numtags = 0;
  int n;
  if( (SvROK(tagref)) &&
      (SvTYPE(SvRV(tagref)) == SVt_PVAV) ) {
    tags = (AV *) SvRV(tagref);  
  } else {
    XSRETURN_UNDEF;
  }
  numtags = av_len(tags);
  if( numtags < 0 ) {
    XSRETURN_UNDEF;
  }
#line 268 "Strip.c"

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		stripper = (Stripper *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "HTML::Strip::set_striptags_ref() -- stripper is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};
#line 100 "Strip.xs"
  clear_striptags( stripper );
  for (n = 0; n <= numtags; n++) {
     STRLEN l;
     char * tag = SvPV(*av_fetch(tags, n, 0), l);
     add_striptag( stripper, tag );
  }
#line 283 "Strip.c"
    }
    XSRETURN_EMPTY;
}

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

    XS_VERSION_BOOTCHECK ;

        newXSproto("HTML::Strip::create", XS_HTML__Strip_create, file, "");
        newXSproto("HTML::Strip::DESTROY", XS_HTML__Strip_DESTROY, file, "$");
        newXSproto("HTML::Strip::strip_html", XS_HTML__Strip_strip_html, file, "$$");
        newXSproto("HTML::Strip::reset", XS_HTML__Strip_reset, file, "$");
        newXSproto("HTML::Strip::clear_striptags", XS_HTML__Strip_clear_striptags, file, "$");
        newXSproto("HTML::Strip::add_striptag", XS_HTML__Strip_add_striptag, file, "$$");
        newXSproto("HTML::Strip::set_emit_spaces", XS_HTML__Strip_set_emit_spaces, file, "$$");
        newXSproto("HTML::Strip::set_decode_entities", XS_HTML__Strip_set_decode_entities, file, "$$");
        newXSproto("HTML::Strip::decode_entities", XS_HTML__Strip_decode_entities, file, "$");
        newXSproto("HTML::Strip::set_striptags_ref", XS_HTML__Strip_set_striptags_ref, file, "$$");
    XSRETURN_YES;
}

