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

#line 1 "Poly.xs"
/* Copyright (c) 1997-2006			 -*- C -*-
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.de

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
*/

#ident "$Project: polymake $$Id: Poly.xs 7163 2006-03-07 17:53:29Z gawrilow $"

#include "Ext.h"

static
void unimport_function(pTHX_ SV *gv)
{
   CV *cv=GvCV(gv);
   if (cv) {
      SvREFCNT_dec(cv);
      GvCV(gv)=0;
   }
   GvIMPORTED_CV_off(gv);
   GvASSUMECV_off(gv);
}

static
GV* do_can(pTHX_ SV *obj, SV *method)
{
   HV *pkg=0;
   GV *glob=0;
   I32 in_super=FALSE;
   char *method_name=SvPVX(method);
   I32 method_name_len=SvCUR(method);

   /* 7==strlen("SUPER::") */
   if (method_name_len>7 && !memcmp(method_name,"SUPER::",7)) {
      in_super=TRUE;
      method_name+=7;
      method_name_len-=7;
   }

   if (SvGMAGICAL(obj)) mg_get(obj);
   if (SvROK(obj)) {
      obj = (SV*)SvRV(obj);
      if (SvOBJECT(obj)) {
	 pkg = SvSTASH(obj);
	 if (in_super) {
	    SV *super_pkg=sv_2mortal( newSVpvf("%s::SUPER", HvNAME(pkg)) );
	    pkg=gv_stashsv(super_pkg,TRUE);
	 }
      }
   } else if (SvPOKp(obj) && SvCUR(obj)) {
      if (in_super) {
	 obj=sv_mortalcopy(obj);
	 sv_catpvn(obj, "::SUPER", 7);
      }
      pkg=gv_stashsv(obj,in_super);
   }

   if (pkg)
      glob=gv_fetchmeth(pkg, method_name, method_name_len, 0);
   return glob;
}

OP* select_method_helper_op(pTHX)
{
   PL_op->op_ppaddr=PL_ppaddr[OP_ENTERSUB];
   ++PL_stack_sp;
   return (PL_ppaddr[OP_ENTERSUB])(aTHX);
}

static
OP* pp_first(pTHX)
{
   dSP; dMARK;
   if (MARK<SP)
      SP=MARK+1;
   else
      XPUSHs(&PL_sv_undef);
   RETURN;
}

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

#line 103 "Poly.c"

XS(XS_Poly_refcnt); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_refcnt)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::refcnt", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	x = ST(0);
	I32	RETVAL;
	dXSTARG;
#line 96 "Poly.xs"
{
   if (SvROK(x)) x=SvRV(x);
   RETVAL=SvREFCNT(x);
}
#line 125 "Poly.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Poly_refcmp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_refcmp)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::refcmp", "x, y, ...");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
	SV *	y = ST(1);
#line 108 "Poly.xs"
{
   if (SvRV(x)==SvRV(y)) XSRETURN_YES;
   XSRETURN_NO;
}
#line 153 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_weak); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_weak)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::weak", "ref");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	ref = ST(0);
#line 118 "Poly.xs"
{
#ifdef SvWEAKREF
   PUSHs(sv_rvweaken(sv_mortalcopy(ref)));
#else
   croak("weak references are not implemented in this release of perl");
#endif
}
#line 183 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_isweak); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_isweak)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::isweak", "ref");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	ref = ST(0);
#line 131 "Poly.xs"
{
#ifdef SvWEAKREF
   if (SvROK(ref) && SvWEAKREF(ref)) XSRETURN_YES;
   XSRETURN_NO;
#else
   croak("weak references are not implemented in this release of perl");
#endif
}
#line 212 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_readonly); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_readonly)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::readonly", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 145 "Poly.xs"
{
   if (SvROK(x)) {
      x=SvRV(x);
      write_protect_on(x);
      if (SvTYPE(x) == SVt_PVAV && !SvRMAGICAL(x)) {
	 I32 l=av_len((AV*)x);
	 if (l>=0) {
	    SV **elem=AvARRAY(x), **last=elem+l;
	    for (; elem<=last; ++elem)
	       if (*elem) write_protect_on(*elem);
	 }
      }
   } else {
      write_protect_on(x);
   }
   ++SP;
}
#line 251 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_readwrite); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_readwrite)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::readwrite", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 168 "Poly.xs"
{
   if (!SvROK(x))
      write_protect_off(x);
   ++SP;
}
#line 279 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_write_protect); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_write_protect)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::write_protect", "x, flag");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	x = ST(0);
	SV *	flag = ST(1);
#line 180 "Poly.xs"
{
   if (SvTRUE(flag))
      SvREADONLY_on(x);
   else
      SvREADONLY_off(x);
}
#line 307 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_dump_me); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_dump_me)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::dump_me", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	x = ST(0);
#line 192 "Poly.xs"
{
   dump_me(x);
   fflush(stderr);
}
#line 331 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_retrieve); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_retrieve)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::retrieve", "x, index");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
	I32	index = (I32)SvIV(ST(1));
#line 203 "Poly.xs"
{
   while (SvROK(x)) x=SvRV(x);
   if (SvTYPE(x) != SVt_PVAV)
      croak("retrieve: not an array");
   PUSHs(*av_fetch((AV*)x, index, 1));
}
#line 360 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_lvalue); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_lvalue)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_lvalue", "subref");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	subref = ST(0);
#line 215 "Poly.xs"
{
   if (!SvROK(subref) || (subref=SvRV(subref), SvTYPE(subref) != SVt_PVCV))
      croak("is_lvalue: bad reference");
   if (CvFLAGS(subref) & CVf_LVALUE) XSRETURN_YES;
   XSRETURN_NO;
}
#line 389 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_declare_lvalue); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_declare_lvalue)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::declare_lvalue", "subref");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	subref = ST(0);
#line 228 "Poly.xs"
{
   if (!SvROK(subref) || (subref=SvRV(subref), SvTYPE(subref) != SVt_PVCV))
      croak("declare_lvalue: bad reference");
   CvFLAGS(subref) |= CVf_LVALUE | CVf_NODEBUG;
}
#line 415 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_is_method); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_method)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_method", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 239 "Poly.xs"
{
   if (!SvROK(sub)) {
      if (SvPOKp(sub)) XSRETURN_YES;	/* probably the method name */
   } else {
      sub=SvRV(sub);
      if (SvTYPE(sub) != SVt_PVCV)
	 croak("is_method: bad code reference");
      if (CvMETHOD(sub)) XSRETURN_YES;
   }
}
XSRETURN_NO;
#line 448 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_select_method); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_select_method)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::select_method", "sub, ...");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 255 "Poly.xs"
{
   int push=0, i;
   SV **stack, **bottom;
   if (SvROK(sub)) {
      sub=SvRV(sub);
      if (SvTYPE(sub) != SVt_PVCV)
	 croak("select_method: bad code reference");
      if (CvMETHOD(sub)) {
	 HV *method_stash=GvSTASH(CvGV(sub));
	 for (i=1; i<items; ++i) {
	    SV *obj_ref=ST(i);
	    if (SvSTASH(SvRV(obj_ref))==method_stash || sv_derived_from(obj_ref,HvNAME(method_stash))) {
	       push=i; goto push_obj;
	    }
	 }
	 croak("no suitable object found");
      } else {
	 goto ready;
      }
   } else if (SvPOKp(sub)) {
      for (i=1; i<items; ++i) {
	 GV *method_gv=do_can(aTHX_ ST(i), sub);
	 if (method_gv) {
	    SV *cache_here=sub;
	    sub=(SV*)GvCV(method_gv);
	    if (sub) {
	       if (!(SvFLAGS(cache_here) & (SVs_TEMP | SVf_FAKE | SVf_READONLY))) {
		  sv_setsv(cache_here, sv_2mortal(newRV(sub)));
	       }
	       if (CvMETHOD(sub)) {
		  push=i; goto push_obj;
	       } else {
		  goto ready;
	       }
	    }
	 }
      }
      croak("method not found");
   } else {
      croak("usage: select_method(\"method_name\" || \\&sub, Object, ...)");
   }
 push_obj:
   for (stack=++SP, bottom=PL_stack_base+TOPMARK+1; stack>bottom; --stack)
      *stack=stack[-1];
   *stack=ST(push);
 ready:
   if (PL_op->op_next->op_type==OP_ENTERSUB) {
      PUSHs(sub);
      if (GIMME==G_SCALAR) {
	 PL_op->op_flags ^= OPf_WANT_SCALAR^OPf_WANT_LIST;
	 if (push) {
	    --SP;
	    PL_op->op_next->op_ppaddr=&select_method_helper_op;
	 }
      }
   } else {
      PUSHs(sv_2mortal(newRV(sub)));
   }
}
#line 530 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_set_prototype); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_set_prototype)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::set_prototype", "sub, proto");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	sub = ST(0);
	SV *	proto = ST(1);
#line 321 "Poly.xs"
{
   STRLEN l;
   char *p=SvPV(proto, l);
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: set_prototype(\\&sub, \"proto\"");
   sv_setpvn(sub, p, l);
}
#line 559 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_is_unary); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_unary)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_unary", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 334 "Poly.xs"
{
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("is_unary: not a sub reference");
   if (SvPOK(sub)) {
      if (SvCUR(sub)==1 && *SvPVX(sub)=='$')
	 XSRETURN_YES;
      else
	 XSRETURN_NO;
   }
   XSRETURN_UNDEF;
}
#line 592 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_integer); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_integer)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_integer", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 351 "Poly.xs"
{
   if (SvIOK(x)) XSRETURN_YES;
   XSRETURN_NO;
}
#line 619 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_float); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_float)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_float", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 361 "Poly.xs"
{
   if (SvNOK(x)) XSRETURN_YES;
   XSRETURN_NO;
}
#line 646 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_numeric); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_numeric)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_numeric", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 371 "Poly.xs"
{
   if ((!SvPOK(x) || SvCUR(x)>0) && (SvIOK(x) | SvNOK(x))) XSRETURN_YES;
   XSRETURN_NO;
}
#line 673 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_extract_integer); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_extract_integer)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 0)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::extract_integer", "");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 380 "Poly.xs"
{
   SV *str=GvSV(PL_defgv);
   MAGIC *pos_mg=mg_find(str, PERL_MAGIC_regex_global);
   if (pos_mg && pos_mg->mg_len>=0) {
      char *start=SvPVX(str)+pos_mg->mg_len, *end=0;
      long val=strtol(start,&end,10);
      pos_mg->mg_len+=end-start;
      PUSHs(sv_2mortal(newSViv(val)));
   } else {
      croak("extract_integer: no prior pos() or m//g");
   }
}
#line 707 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_extract_float); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_extract_float)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 0)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::extract_float", "");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 397 "Poly.xs"
{
   SV *str=GvSV(PL_defgv);
   MAGIC *pos_mg=mg_find(str, PERL_MAGIC_regex_global);
   if (pos_mg && pos_mg->mg_len>=0) {
      char *start=SvPVX(str)+pos_mg->mg_len;
#ifdef my_atof2
      NV val=0;
      char* end=my_atof2(start, &val);
#else
      char* end=0;
      NV val=strtod(start, &end);
#endif
      pos_mg->mg_len+=end-start;
      PUSHs(sv_2mortal(newSVnv(val)));
   } else {
      croak("extract_float: no prior pos() or m//g");
   }
}
#line 747 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_object); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_object)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_object", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 421 "Poly.xs"
{
   if (SvROK(x) && SvOBJECT(SvRV(x)))
      XSRETURN_YES;
   XSRETURN_NO;
}
#line 775 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_inherit_class); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_inherit_class)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::inherit_class", "obj, src");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	obj = ST(0);
	SV *	src = ST(1);
#line 432 "Poly.xs"
{
   HV *stash;
   if (SvROK(src)) {
      src=SvRV(src);
      if (SvOBJECT(src))
	 stash=SvSTASH(src);
      else
	 goto DONE;
   } else {
      STRLEN l;
      const char *p=SvPV(src,l);
      if (!(stash=gv_stashpvn(p,l,FALSE)))
	 croak("unknown package %.*s",l,p);
   }
   sv_bless(obj,stash);
 DONE:
   ++SP;	/* let obj appear at the stack top again */
}
#line 817 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_compiling_in); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_compiling_in)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 455 "Poly.xs"
if (items==0) {
   XPUSHs(sv_2mortal(newSVpv(HvNAME(PL_curstash), 0)));
} else {
   SV *pkg=ST(0);
   HV *stash=SvROK(pkg) ? (HV*)SvRV(pkg) : gv_stashsv(pkg, FALSE);
   PUSHs(PL_curstash == stash ? &PL_sv_yes : &PL_sv_no);
}
#line 844 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_symtable_of); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_symtable_of)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::symtable_of", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 468 "Poly.xs"
{
   if (SvROK(x) && (x=SvRV(x), SvOBJECT(x)))
      PUSHs(sv_2mortal(newRV((SV*)SvSTASH(x))));
   else
      PUSHs(&PL_sv_undef);
}
#line 873 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_pkg_name); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_pkg_name)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::pkg_name", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 480 "Poly.xs"
{
   if (SvROK(x) && (x=SvRV(x), SvTYPE(x)==SVt_PVHV))
      PUSHs(sv_2mortal(newSVpv(HvNAME((HV*)x), 0)));
   else
      PUSHs(&PL_sv_undef);
}
#line 902 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_get_pkg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_get_pkg)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::get_pkg", "pkg_name, ...");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	pkg_name = ST(0);
#line 492 "Poly.xs"
{
   HV *stash=gv_stashsv(pkg_name, items==2 && SvTRUE(ST(1)));
   if (stash)
      PUSHs(sv_2mortal(newRV((SV*)stash)));
   else
      PUSHs(&PL_sv_undef);
}
#line 932 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_ARRAY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_ARRAY)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_ARRAY", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 505 "Poly.xs"
{
   if (SvROK(x) && SvTYPE(SvRV(x)) == SVt_PVAV) XSRETURN_YES;
   XSRETURN_NO;
}
#line 959 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_hash); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_hash)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_hash", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 515 "Poly.xs"
{
   if (SvROK(x) && SvTYPE(SvRV(x)) == SVt_PVHV) XSRETURN_YES;
   XSRETURN_NO;
}
#line 986 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_code); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_code)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_code", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 525 "Poly.xs"
{
   if (SvROK(x) && SvTYPE(SvRV(x))== SVt_PVCV) XSRETURN_YES;
   XSRETURN_NO;
}
#line 1013 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_real_code); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_real_code)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_real_code", "x");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	x = ST(0);
#line 535 "Poly.xs"
{
   if (SvROK(x) && (x=SvRV(x), SvTYPE(x) == SVt_PVCV)
       && (CvROOT((CV*)x) || CvXSUB((CV*)x)))
      return;	/* keep the CV reference on the stack */
   XSRETURN_NO;
}
#line 1042 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_unimport_function); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_unimport_function)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    PERL_UNUSED_VAR(cv); /* -W */
    {
#line 546 "Poly.xs"
{
   SV *gv=ST(0);
   if (items==1) {
      unimport_function(aTHX_ gv);
   } else {
      int i=0;
      HV *stash= SvROK(gv) ? (HV*)(++i, SvRV(gv)) : CopSTASH(PL_curcop);
      for (; i<items; ++i) {
	 STRLEN l;
	 const char *n=SvPV(ST(i),l);
	 SV **gvp=hv_fetch(stash, n, l, FALSE);
	 if (gvp)
	    unimport_function(aTHX_ *gvp);
	 else
	    croak("unknown function %s::%.*s\n", HvNAME(stash), l, n);
      }
   }
}
#line 1078 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_forget_function); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_forget_function)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::forget_function", "ref");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	ref = ST(0);
#line 570 "Poly.xs"
{
   CV *sub=0;
   GV *glob=0;
   if (SvROK(ref)) {
      sub=(CV*)SvRV(ref);
      if (SvTYPE(sub) == SVt_PVCV)
	 glob=CvGV(sub);
      else
	 croak("usage: forget_function(\\&sub || *glob)");
   } else if (SvTYPE(ref) == SVt_PVGV) {
      if ((sub=GvCV((GV*)ref)))
	 glob=(GV*)ref;
      else
	 XSRETURN_EMPTY;
   }
   SvREFCNT_dec(sub);
   GvCV(glob)=0;
   GvIMPORTED_CV_off(glob);
   GvASSUMECV_off(glob);
}
#line 1118 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_method_name); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_method_name)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::method_name", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 596 "Poly.xs"
{
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: method_name(\\&sub)");
   PUSHs(sv_2mortal(newSVpvn(GvNAME(CvGV(sub)), GvNAMELEN(CvGV(sub)))));
}
#line 1145 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_sub_pkg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_sub_pkg)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::sub_pkg", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 607 "Poly.xs"
{
   if (SvROK(sub)) {
      sub=SvRV(sub);
      if (SvTYPE(sub) != SVt_PVCV)
	 croak("usage: sub_pkg(\\&sub)");
      PUSHs(sv_2mortal(newSVpv(HvNAME(CvSTASH(sub)), 0)));
   } else {
      PUSHs(&PL_sv_undef);
   }
}
#line 1178 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_sub_file); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_sub_file)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::sub_file", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 623 "Poly.xs"
{
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: sub_file(\\&sub)");
   PUSHs(sv_2mortal(newSVpv(CopFILE((COP*)CvSTART(sub)), 0)));
}
#line 1206 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_sub_firstline); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_sub_firstline)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::sub_firstline", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 634 "Poly.xs"
{
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: sub_firstline(\\&sub)");
   PUSHs(sv_2mortal(newSViv(CopLINE((COP*)CvSTART(sub)))));
}
#line 1234 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_method_owner); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_method_owner)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::method_owner", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
#line 645 "Poly.xs"
{
   if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: method_owner(\\&sub)");
   PUSHs(sv_2mortal( newSVpv( HvNAME(GvSTASH(CvGV(sub))), 0) ));
}
#line 1262 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_define_function); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_define_function)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 3)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::define_function", "pkg, name, sub, ...");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	pkg = ST(0);
	SV *	name = ST(1);
	SV *	sub = ST(2);
	I32	create_pkg = items>3 && SvTRUE(ST(3));
#line 658 "Poly.xs"
if (!SvROK(sub) ||
    (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV) ||
    (SvROK(pkg) && SvTYPE(SvRV(pkg))!=SVt_PVHV))
   croak("usage: define_function(\"pkg\" || \\%stash, \"name\", \\&sub, [ TRUE ])");
{
   HV *pkg_stash=SvROK(pkg) ? (HV*)SvRV(pkg) : gv_stashsv(pkg, create_pkg);
   GV *glob;
   if (!pkg_stash)
      croak("define_function: unknown package %.*s", SvCUR(pkg), SvPVX(pkg));
   glob=(GV*)*hv_fetch(pkg_stash, SvPVX(name), SvCUR(name), TRUE);
   if (SvTYPE(glob) != SVt_PVGV)
      gv_init(glob, pkg_stash, SvPVX(name), SvCUR(name), GV_ADDMULTI);
   sv_setsv((SV*)glob, ST(2));
   if (CvANON(sub)) {
      CvANON_off(sub);
      CvGV(sub)=glob;
      if (!CvXSUB(sub)) {
	 SV *file=CopFILESV((COP*)CvSTART(sub));
	 if (file && (!SvOK(file) || !SvPVX(file) || !strncmp(SvPVX(file), "(eval ", 6)))
	    sv_setpvf(file, "(%s::%s)", HvNAME(pkg_stash), SvPVX(name));
      }
   }
   PUSHs(ST(2));
}
#line 1312 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_define_unique_function); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_define_unique_function)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 3)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::define_unique_function", "pkg, name, sub");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	pkg = ST(0);
	SV *	name = ST(1);
	SV *	sub = ST(2);
#line 690 "Poly.xs"
if (!SvROK(sub) ||
    (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV) ||
    (SvROK(pkg) && SvTYPE(SvRV(pkg))!=SVt_PVHV))
   croak("usage: define_unique_function(\"pkg\" || \\%stash, \"name\", \\&sub)");
{
   HV *pkg_stash=SvROK(pkg) ? (HV*)SvRV(pkg) : gv_stashsv(pkg, FALSE);
   GV *glob;
   CV *was_here;
   if (!pkg_stash)
      croak("define_function: unknown package %.*s", SvCUR(pkg), SvPVX(pkg));
   glob=(GV*)*hv_fetch(pkg_stash, SvPVX(name), SvCUR(name), TRUE);
   if (SvTYPE(glob) != SVt_PVGV)
      gv_init(glob, pkg_stash, SvPVX(name), SvCUR(name), GV_ADDMULTI);
   if ((was_here=GvCV(glob)) &&
       (CvROOT(was_here) || (CvXSUB(was_here))))
      XSRETURN_UNDEF;

   sv_setsv((SV*)glob, ST(2));
   if (CvANON(sub)) {
      CvANON_off(sub);
      CvGV(sub)=glob;
      if (!CvXSUB(sub)) {
	 SV *file=CopFILESV((COP*)CvSTART(sub));
	 if (file && (!SvOK(file) || !SvPVX(file) || !strncmp(SvPVX(file), "(eval ", 6)))
	    sv_setpvf(file, "(%s::%s)", HvNAME(pkg_stash), SvPVX(name));
      }
   }
   PUSHs(ST(2));
}
#line 1366 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_set_sub_name); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_set_sub_name)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::set_sub_name", "sub, name");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sub = ST(0);
	SV *	name = ST(1);
#line 726 "Poly.xs"
if (!SvROK(sub) || (sub=SvRV(sub), SvTYPE(sub) != SVt_PVCV))
      croak("usage: set_sub_name(\\&sub, \"name\")");
{
   GV *glob=(GV*)*hv_fetch(GvSTASH(CvGV(sub)), SvPVX(name), SvCUR(name), TRUE);
   if (SvTYPE(glob) != SVt_PVGV)
      gv_init(glob, GvSTASH(CvGV(sub)), SvPVX(name), SvCUR(name), GV_ADDMULTI);
   CvANON_off(sub);
   CvGV(sub)=glob;
}
#line 1399 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_can); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_can)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::can", "obj, method, ...");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	obj = ST(0);
	SV *	method = ST(1);
#line 741 "Poly.xs"
{
   GV *glob=do_can(aTHX_ obj, method);
   if (glob)
      PUSHs( sv_2mortal(newRV((SV*)GvCV(glob))) );
   else
      PUSHs( &PL_sv_undef );
}
#line 1430 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_set_method); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_set_method)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::set_method", "sub");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	sub = ST(0);
#line 755 "Poly.xs"
{
   CvMETHOD_on(SvRV(sub));
}
#line 1454 "Poly.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Poly_ones); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_ones)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::ones", "bitset");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	bitset = ST(0);
#line 764 "Poly.xs"
{
   I32 gimme=GIMME;
   if (SvOK(bitset)) {
      I32 l=SvCUR(bitset)<<3, i;
      const unsigned char *s=(unsigned char*)SvPVX(bitset);
      unsigned int bit=1;
      EXTEND(SP,l);
      for (i=0; i<l; ++i) {
	 if ((*s) & bit) {
	    PUSHs(sv_2mortal(newSViv(i)));
	    if (gimme==G_SCALAR) break;
	 }
	 if ((bit<<=1)==(1<<8)) {
	    ++s;  bit=1;
	 }
      }
   }
}
#line 1494 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_first); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_first)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 786 "Poly.xs"
{
   OP *o=cUNOP->op_first, *kid;
   if (!o->op_sibling)
      o=cUNOPo->op_first;
   while ((kid=o->op_sibling)) o=kid;
   if (o->op_type==OP_NULL)
      o=cUNOPo->op_first;
   o->op_next=PL_op->op_next;
   o->op_ppaddr=&pp_first;
   if (items)
      ++SP;
   else
      XPUSHs(&PL_sv_undef);
}
#line 1528 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_is_magical); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_is_magical)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::is_magical", "sv");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sv = ST(0);
#line 806 "Poly.xs"
{
   if (SvRV(sv) && SvAMAGIC(sv))
      XSRETURN_YES;
   XSRETURN_NO;
}
#line 1556 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_defuse_magic); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_defuse_magic)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::defuse_magic", "sv");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sv = ST(0);
#line 816 "Poly.xs"
{
   if (!SvRV(sv)) croak("usage: defuse_magic(ref)");
   SvAMAGIC_off(sv);
   ++SP;
}
#line 1584 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_restore_magic); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_restore_magic)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::restore_magic", "sv");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sv = ST(0);
#line 826 "Poly.xs"
{
   if (!SvRV(sv)) croak("usage: restore_magic(ref)");
   SvAMAGIC_on(sv);
   ++SP;
}
#line 1612 "Poly.c"
	PUTBACK;
	return;
    }
}


XS(XS_Poly_unbless); /* prototype to pass -Wmissing-prototypes */
XS(XS_Poly_unbless)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::unbless", "sv");
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	SV *	sv = ST(0);
#line 836 "Poly.xs"
{
   SV *obj;
   if (!SvRV(sv)) croak("usage: unbless(ref)");
   SvAMAGIC_off(sv);
   obj=SvRV(sv);
   SvOBJECT_off(obj);
   SvREFCNT_dec(SvSTASH(obj));
   SvSTASH(obj)=0;
   ++SP;
}
#line 1645 "Poly.c"
	PUTBACK;
	return;
    }
}

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

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

        newXSproto("Poly::refcnt", XS_Poly_refcnt, file, "$");
        newXS("Poly::refcmp", XS_Poly_refcmp, file);
        newXSproto("Poly::weak", XS_Poly_weak, file, "$");
        newXSproto("Poly::isweak", XS_Poly_isweak, file, "$");
        newXSproto("Poly::readonly", XS_Poly_readonly, file, "$");
        newXSproto("Poly::readwrite", XS_Poly_readwrite, file, "$");
        newXSproto("Poly::write_protect", XS_Poly_write_protect, file, "$$");
        newXSproto("Poly::dump_me", XS_Poly_dump_me, file, "$");
        newXSproto("Poly::retrieve", XS_Poly_retrieve, file, "$$");
        newXSproto("Poly::is_lvalue", XS_Poly_is_lvalue, file, "$");
        newXSproto("Poly::declare_lvalue", XS_Poly_declare_lvalue, file, "$");
        newXSproto("Poly::is_method", XS_Poly_is_method, file, "$");
        newXS("Poly::select_method", XS_Poly_select_method, file);
        newXSproto("Poly::set_prototype", XS_Poly_set_prototype, file, "$$");
        newXSproto("Poly::is_unary", XS_Poly_is_unary, file, "$");
        newXSproto("Poly::is_integer", XS_Poly_is_integer, file, "$");
        newXSproto("Poly::is_float", XS_Poly_is_float, file, "$");
        newXSproto("Poly::is_numeric", XS_Poly_is_numeric, file, "$");
        newXSproto("Poly::extract_integer", XS_Poly_extract_integer, file, "");
        newXSproto("Poly::extract_float", XS_Poly_extract_float, file, "");
        newXSproto("Poly::is_object", XS_Poly_is_object, file, "$");
        newXS("Poly::inherit_class", XS_Poly_inherit_class, file);
        newXSproto("Poly::compiling_in", XS_Poly_compiling_in, file, ";$");
        newXSproto("Poly::symtable_of", XS_Poly_symtable_of, file, "$");
        newXSproto("Poly::pkg_name", XS_Poly_pkg_name, file, "$");
        newXSproto("Poly::get_pkg", XS_Poly_get_pkg, file, "$;$");
        newXSproto("Poly::is_ARRAY", XS_Poly_is_ARRAY, file, "$");
        newXSproto("Poly::is_hash", XS_Poly_is_hash, file, "$");
        newXSproto("Poly::is_code", XS_Poly_is_code, file, "$");
        newXSproto("Poly::is_real_code", XS_Poly_is_real_code, file, "$");
        newXS("Poly::unimport_function", XS_Poly_unimport_function, file);
        newXSproto("Poly::forget_function", XS_Poly_forget_function, file, "$");
        newXSproto("Poly::method_name", XS_Poly_method_name, file, "$");
        newXSproto("Poly::sub_pkg", XS_Poly_sub_pkg, file, "$");
        newXSproto("Poly::sub_file", XS_Poly_sub_file, file, "$");
        newXSproto("Poly::sub_firstline", XS_Poly_sub_firstline, file, "$");
        newXSproto("Poly::method_owner", XS_Poly_method_owner, file, "$");
        newXS("Poly::define_function", XS_Poly_define_function, file);
        newXS("Poly::define_unique_function", XS_Poly_define_unique_function, file);
        newXS("Poly::set_sub_name", XS_Poly_set_sub_name, file);
        newXS("Poly::can", XS_Poly_can, file);
        newXSproto("Poly::set_method", XS_Poly_set_method, file, "$");
        newXSproto("Poly::ones", XS_Poly_ones, file, "$");
        newXS("Poly::first", XS_Poly_first, file);
        newXS("Poly::is_magical", XS_Poly_is_magical, file);
        newXS("Poly::defuse_magic", XS_Poly_defuse_magic, file);
        newXS("Poly::restore_magic", XS_Poly_restore_magic, file);
        newXS("Poly::unbless", XS_Poly_unbless, file);
    XSRETURN_YES;
}



syntax highlighted by Code2HTML, v. 0.9.1