MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/2/cwd/installd/perl588installer/perl-5.8.8/ext/attrs/attrs.c
/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of attrs.xs. Do not edit this file, edit attrs.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "attrs.xs"
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

static cv_flags_t
get_flag(const char *attr)
{
    if (strnEQ(attr, "method", 6))
	return CVf_METHOD;
    else if (strnEQ(attr, "locked", 6))
	return CVf_LOCKED;
    else
	return 0;
}

#line 27 "attrs.c"

XS(XS_attrs_import); /* prototype to pass -Wmissing-prototypes */
XS(XS_attrs_import)
{
    dXSARGS;
    dXSI32;
   PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 24 "attrs.xs"
	int i;
#line 39 "attrs.c"
#line 26 "attrs.xs"
       if (items < 1)
           Perl_croak(aTHX_ "Usage: %s(Class, ...)", GvNAME(CvGV(cv)));
	if (!PL_compcv || !(cv = CvOUTSIDE(PL_compcv)))
	    croak("can't set attributes outside a subroutine scope");
	if (ckWARN(WARN_DEPRECATED))
	    Perl_warner(aTHX_ packWARN(WARN_DEPRECATED),
			"pragma \"attrs\" is deprecated, "
			"use \"sub NAME : ATTRS\" instead");
	for (i = 1; i < items; i++) {
	    const char * const attr = SvPV_nolen(ST(i));
	    const cv_flags_t flag = get_flag(attr);
	    if (!flag)
		croak("invalid attribute name %s", attr);
	    if (ix)
    		CvFLAGS(cv) &= ~flag;
	    else
		CvFLAGS(cv) |= flag;
	}
#line 59 "attrs.c"
	PUTBACK;
	return;
    }
}


XS(XS_attrs_get); /* prototype to pass -Wmissing-prototypes */
XS(XS_attrs_get)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: attrs::get(sub)");
    SP -= items;
    {
	SV *	sub = ST(0);
#line 49 "attrs.xs"
	if (SvROK(sub)) {
	    sub = SvRV(sub);
	    if (SvTYPE(sub) != SVt_PVCV)
		sub = Nullsv;
	}
	else {
	    const char * const name = SvPV_nolen(sub);
	    sub = (SV*)perl_get_cv(name, FALSE);
	}
	if (!sub)
	    croak("invalid subroutine reference or name");
	if (CvFLAGS(sub) & CVf_METHOD)
	    XPUSHs(sv_2mortal(newSVpvn("method", 6)));
	if (CvFLAGS(sub) & CVf_LOCKED)
	    XPUSHs(sv_2mortal(newSVpvn("locked", 6)));
#line 91 "attrs.c"
	PUTBACK;
	return;
    }
}

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

    XS_VERSION_BOOTCHECK ;

    {
        CV * cv ;

        cv = newXS("attrs::unimport", XS_attrs_import, file);
        XSANY.any_i32 = 1 ;
        cv = newXS("attrs::import", XS_attrs_import, file);
        XSANY.any_i32 = 0 ;
        newXS("attrs::get", XS_attrs_get, file);
    }
    XSRETURN_YES;
}