/*
* This file was generated automatically by ExtUtils::ParseXS version 2.18 from the
* contents of deHTMLxs.xs. Do not edit this file, edit deHTMLxs.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
#line 1 "deHTMLxs.xs"
/* $Id: deHTMLxs.xs,v 1.6 2006/02/16 19:16:00 rsoderberg Exp $ */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
/* try to be compatible with older perls */
/* SvPV_nolen() macro first defined in 5.005_55 */
/* this is slow, not threadsafe, but works */
#include "patchlevel.h"
#if (PATCHLEVEL == 4) || ((PATCHLEVEL == 5) && (SUBVERSION < 55))
static STRLEN nolen_na;
# define SvPV_nolen(sv) SvPV ((sv), nolen_na)
#endif
#include "deHTMLxs.h"
typedef struct mystate {
int is_xs;
} *Razor2__Preproc__deHTMLxs;
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif
#line 36 "deHTMLxs.c"
XS(XS_Razor2__Preproc__deHTMLxs_new); /* prototype to pass -Wmissing-prototypes */
XS(XS_Razor2__Preproc__deHTMLxs_new)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 1)
Perl_croak(aTHX_ "Usage: %s(%s)", "Razor2::Preproc::deHTMLxs::new", "class");
PERL_UNUSED_VAR(cv); /* -W */
{
SV * class = ST(0);
Razor2__Preproc__deHTMLxs RETVAL;
#line 31 "deHTMLxs.xs"
{
Newz(0, RETVAL, 1, struct mystate);
RETVAL->is_xs = 1; /* placeholder, not used now */
}
#line 59 "deHTMLxs.c"
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Razor2::Preproc::deHTMLxs", (void*)RETVAL);
}
XSRETURN(1);
}
XS(XS_Razor2__Preproc__deHTMLxs_is_xs); /* prototype to pass -Wmissing-prototypes */
XS(XS_Razor2__Preproc__deHTMLxs_is_xs)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 1)
Perl_croak(aTHX_ "Usage: %s(%s)", "Razor2::Preproc::deHTMLxs::is_xs", "self");
PERL_UNUSED_VAR(cv); /* -W */
{
Razor2__Preproc__deHTMLxs self;
int RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Razor2::Preproc::deHTMLxs")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
self = INT2PTR(Razor2__Preproc__deHTMLxs,tmp);
}
else
Perl_croak(aTHX_ "self is not of type Razor2::Preproc::deHTMLxs");
#line 44 "deHTMLxs.xs"
RETVAL = 1;
#line 91 "deHTMLxs.c"
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Razor2__Preproc__deHTMLxs_testxs); /* prototype to pass -Wmissing-prototypes */
XS(XS_Razor2__Preproc__deHTMLxs_testxs)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 2)
Perl_croak(aTHX_ "Usage: %s(%s)", "Razor2::Preproc::deHTMLxs::testxs", "self, str");
PERL_UNUSED_VAR(cv); /* -W */
{
Razor2__Preproc__deHTMLxs self;
char * str = (char *)SvPV_nolen(ST(1));
char * RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Razor2::Preproc::deHTMLxs")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
self = INT2PTR(Razor2__Preproc__deHTMLxs,tmp);
}
else
Perl_croak(aTHX_ "self is not of type Razor2::Preproc::deHTMLxs");
#line 53 "deHTMLxs.xs"
RETVAL = str + 1;
#line 123 "deHTMLxs.c"
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
}
XSRETURN(1);
}
XS(XS_Razor2__Preproc__deHTMLxs_isit); /* prototype to pass -Wmissing-prototypes */
XS(XS_Razor2__Preproc__deHTMLxs_isit)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 2)
Perl_croak(aTHX_ "Usage: %s(%s)", "Razor2::Preproc::deHTMLxs::isit", "self, scalarref");
PERL_UNUSED_VAR(cv); /* -W */
{
Razor2__Preproc__deHTMLxs self;
SV * scalarref = ST(1);
SV * RETVAL;
if (sv_derived_from(ST(0), "Razor2::Preproc::deHTMLxs")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
self = INT2PTR(Razor2__Preproc__deHTMLxs,tmp);
}
else
Perl_croak(aTHX_ "self is not of type Razor2::Preproc::deHTMLxs");
#line 62 "deHTMLxs.xs"
{
/* 2002/11/21 Anne Bennett: use the right type def: */
STRLEN size;
char * raw;
SV * text;
const char mynull = 0;
if (SvROK(scalarref)) {
text = SvRV(scalarref);
/* normally perl has '\0' on end, but not guaranteed */
sv_catpv(text,&mynull);
raw = SvPV(text,size);
/* bool CM_PREPROC_is_html(const char *); */
if (CM_PREPROC_is_html(raw)) {
RETVAL = newSVpv ("1", 0);
} else {
RETVAL = newSVpv ("", 0);
}
} else {
RETVAL = newSVpv ("", 0);
}
}
#line 177 "deHTMLxs.c"
ST(0) = RETVAL;
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Razor2__Preproc__deHTMLxs_doit); /* prototype to pass -Wmissing-prototypes */
XS(XS_Razor2__Preproc__deHTMLxs_doit)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 2)
Perl_croak(aTHX_ "Usage: %s(%s)", "Razor2::Preproc::deHTMLxs::doit", "self, scalarref");
PERL_UNUSED_VAR(cv); /* -W */
{
Razor2__Preproc__deHTMLxs self;
SV * scalarref = ST(1);
SV * RETVAL;
if (sv_derived_from(ST(0), "Razor2::Preproc::deHTMLxs")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
self = INT2PTR(Razor2__Preproc__deHTMLxs,tmp);
}
else
Perl_croak(aTHX_ "self is not of type Razor2::Preproc::deHTMLxs");
#line 94 "deHTMLxs.xs"
{
char * cleaned, * raw, * res;
/* 2002/11/21 Anne Bennett: use the right type def: */
STRLEN size;
SV * text;
SV * newtext;
SV * newref;
if (SvROK(scalarref)) {
text = SvRV(scalarref);
raw = SvPV(text,size);
*(raw + size - 1) = '\0';
if ( (cleaned = malloc(size+1)) &&
(res = CM_PREPROC_html_strip(raw, cleaned)) /* html_strip will memset cleaned to 0 */
) {
/*
* hook it up so scalarref will dereference to new scalar
*/
newtext = newSVpv (res, 0);
/* newtext is new scalar containing cleaned html.
* we want scalarref to point to that instead of its old dude, text. */
/* sv_setsv (SV* dest, SV* src) */
sv_setsv(text, newtext);
SvREFCNT_inc(scalarref);
RETVAL = scalarref;
free(cleaned);
} else {
if (cleaned) {
free(cleaned);
}
RETVAL = newSVpv ("", 0);
}
} else {
RETVAL = newSVpv ("", 0);
}
}
#line 254 "deHTMLxs.c"
ST(0) = RETVAL;
sv_2mortal(ST(0));
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_Razor2__Preproc__deHTMLxs); /* prototype to pass -Wmissing-prototypes */
XS(boot_Razor2__Preproc__deHTMLxs)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
char* file = __FILE__;
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(items); /* -W */
XS_VERSION_BOOTCHECK ;
newXSproto("Razor2::Preproc::deHTMLxs::new", XS_Razor2__Preproc__deHTMLxs_new, file, "$");
newXSproto("Razor2::Preproc::deHTMLxs::is_xs", XS_Razor2__Preproc__deHTMLxs_is_xs, file, "$");
newXSproto("Razor2::Preproc::deHTMLxs::testxs", XS_Razor2__Preproc__deHTMLxs_testxs, file, "$$");
newXSproto("Razor2::Preproc::deHTMLxs::isit", XS_Razor2__Preproc__deHTMLxs_isit, file, "$$");
newXSproto("Razor2::Preproc::deHTMLxs::doit", XS_Razor2__Preproc__deHTMLxs_doit, file, "$$");
XSRETURN_YES;
}
syntax highlighted by Code2HTML, v. 0.9.1