     1			/*
     2			 * This file was generated automatically by ExtUtils::ParseXS version 2.10 from the
     3			 * contents of attrs.xs. Do not edit this file, edit attrs.xs instead.
     4			 *
     5			 *	ANY CHANGES MADE HERE WILL BE LOST! 
     6			 *
     7			 */
     8			
     9			#line 1 "attrs.xs"
    10			#define PERL_NO_GET_CONTEXT
    11			#include "EXTERN.h"
    12			#include "perl.h"
    13			#include "XSUB.h"
    14			
    15			static cv_flags_t
    16			get_flag(const char *attr)
    17			{
    18			    if (strnEQ(attr, "method", 6))
    19				return CVf_METHOD;
    20			    else if (strnEQ(attr, "locked", 6))
    21				return CVf_LOCKED;
    22			    else
    23				return 0;
    24			}
    25			
    26			#ifndef PERL_UNUSED_VAR
    27			#  define PERL_UNUSED_VAR(var) if (0) var = var
    28			#endif
    29			
    30			#line 31 "attrs.c"
    31			
    32			XS(XS_attrs_import); /* prototype to pass -Wmissing-prototypes */
    33			XS(XS_attrs_import)
    34	           6    {
    35	           6        dXSARGS;
    36	           6        dXSI32;
    37	           6        PERL_UNUSED_VAR(cv); /* -W */
    38	           6        PERL_UNUSED_VAR(ax); /* -Wall */
    39	           6        SP -= items;
    40			    {
    41			#line 24 "attrs.xs"
    42				int i;
    43			#line 44 "attrs.c"
    44			#line 26 "attrs.xs"
    45			       if (items < 1)
    46			           Perl_croak(aTHX_ "Usage: %s(Class, ...)", GvNAME(CvGV(cv)));
    47				if (!PL_compcv || !(cv = CvOUTSIDE(PL_compcv)))
    48				    croak("can't set attributes outside a subroutine scope");
    49				if (ckWARN(WARN_DEPRECATED))
    50				    Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
    51						"pragma \"attrs\" is deprecated, "
    52						"use \"sub NAME : ATTRS\" instead");
    53				for (i = 1; i < items; i++) {
    54				    const char * const attr = SvPV_nolen(ST(i));
    55				    const cv_flags_t flag = get_flag(attr);
    56				    if (!flag)
    57					croak("invalid attribute name %s", attr);
    58				    if (ix)
    59			    		CvFLAGS(cv) &= ~flag;
    60				    else
    61					CvFLAGS(cv) |= flag;
    62				}
    63			#line 64 "attrs.c"
    64	           6    	PUTBACK;
    65				return;
    66			    }
    67			}
    68			
    69			
    70			XS(XS_attrs_get); /* prototype to pass -Wmissing-prototypes */
    71			XS(XS_attrs_get)
    72	           3    {
    73	           3        dXSARGS;
    74	           3        if (items != 1)
    75	      ######    	Perl_croak(aTHX_ "Usage: attrs::get(sub)");
    76	           3        PERL_UNUSED_VAR(cv); /* -W */
    77	           3        PERL_UNUSED_VAR(ax); /* -Wall */
    78	           3        SP -= items;
    79			    {
    80	           3    	SV *	sub = ST(0);
    81			#line 49 "attrs.xs"
    82				if (SvROK(sub)) {
    83				    sub = SvRV(sub);
    84				    if (SvTYPE(sub) != SVt_PVCV)
    85					sub = Nullsv;
    86				}
    87				else {
    88				    const char * const name = SvPV_nolen(sub);
    89				    sub = (SV*)perl_get_cv(name, FALSE);
    90				}
    91				if (!sub)
    92				    croak("invalid subroutine reference or name");
    93				if (CvFLAGS(sub) & CVf_METHOD)
    94				    XPUSHs(sv_2mortal(newSVpvn("method", 6)));
    95				if (CvFLAGS(sub) & CVf_LOCKED)
    96				    XPUSHs(sv_2mortal(newSVpvn("locked", 6)));
    97			#line 98 "attrs.c"
    98	           3    	PUTBACK;
    99				return;
   100			    }
   101			}
   102			
   103			#ifdef __cplusplus
   104			extern "C"
   105			#endif
   106			XS(boot_attrs); /* prototype to pass -Wmissing-prototypes */
   107			XS(boot_attrs)
   108	           1    {
   109	           1        dXSARGS;
   110	           1        char* file = __FILE__;
   111			
   112	           1        PERL_UNUSED_VAR(cv); /* -W */
   113	           1        PERL_UNUSED_VAR(items); /* -W */
   114	           1        XS_VERSION_BOOTCHECK ;
   115			
   116			    {
   117	           1            CV * cv ;
   118			
   119	           1            cv = newXS("attrs::unimport", XS_attrs_import, file);
   120	           1            XSANY.any_i32 = 1 ;
   121	           1            cv = newXS("attrs::import", XS_attrs_import, file);
   122	           1            XSANY.any_i32 = 0 ;
   123	           1            newXS("attrs::get", XS_attrs_get, file);
   124			    }
   125	           1        XSRETURN_YES;
   126			}
   127			
