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

#line 1 "Libgenders.xs"
/*****************************************************************************\
 *  $Id: Libgenders.xs,v 1.43 2009-06-02 18:05:21 chu11 Exp $
 *****************************************************************************
 *  Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC.
 *  Copyright (C) 2001-2007 The Regents of the University of California.
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 *  Written by Jim Garlick <garlick@llnl.gov> and Albert Chu <chu11@llnl.gov>.
 *  UCRL-CODE-2003-004.
 *
 *  This file is part of Genders, a cluster configuration database.
 *  For details, see <http://www.llnl.gov/linux/genders/>.
 *
 *  Genders 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 of the License, or (at your option)
 *  any later version.
 *
 *  Genders 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.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with Genders.  If not, see <http://www.gnu.org/licenses/>.
\*****************************************************************************/

#if HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

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

#if STDC_HEADERS
#include <string.h>
#endif /* STDC_HEADERS */

#include <genders.h>

#line 51 "Libgenders.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 195 "Libgenders.c"

XS_EUPXS(XS_Libgenders_GENDERS_ERR_SUCCESS); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_SUCCESS)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 49 "Libgenders.xs"
        RETVAL = GENDERS_ERR_SUCCESS;
#line 216 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_NULLHANDLE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_NULLHANDLE)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 57 "Libgenders.xs"
        RETVAL = GENDERS_ERR_NULLHANDLE;
#line 243 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_OPEN); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_OPEN)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 65 "Libgenders.xs"
        RETVAL = GENDERS_ERR_OPEN;
#line 270 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_READ); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_READ)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 73 "Libgenders.xs"
        RETVAL = GENDERS_ERR_READ;
#line 297 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_PARSE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_PARSE)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 81 "Libgenders.xs"
        RETVAL = GENDERS_ERR_PARSE;
#line 324 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_NOTLOADED); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_NOTLOADED)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 89 "Libgenders.xs"
        RETVAL = GENDERS_ERR_NOTLOADED;
#line 351 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_ISLOADED); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_ISLOADED)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 97 "Libgenders.xs"
        RETVAL = GENDERS_ERR_ISLOADED;
#line 378 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_OVERFLOW); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_OVERFLOW)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 105 "Libgenders.xs"
        RETVAL = GENDERS_ERR_OVERFLOW;
#line 405 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_PARAMETERS); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_PARAMETERS)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 113 "Libgenders.xs"
        RETVAL = GENDERS_ERR_PARAMETERS;
#line 432 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_NULLPTR); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_NULLPTR)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 121 "Libgenders.xs"
        RETVAL = GENDERS_ERR_NULLPTR;
#line 459 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_NOTFOUND); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_NOTFOUND)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 129 "Libgenders.xs"
        RETVAL = GENDERS_ERR_NOTFOUND;
#line 486 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_OUTMEM); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_OUTMEM)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 137 "Libgenders.xs"
        RETVAL = GENDERS_ERR_OUTMEM;
#line 513 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_SYNTAX); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_SYNTAX)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 145 "Libgenders.xs"
        RETVAL = GENDERS_ERR_SYNTAX;
#line 540 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_MAGIC); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_MAGIC)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 153 "Libgenders.xs"
        RETVAL = GENDERS_ERR_MAGIC;
#line 567 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_INTERNAL); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_INTERNAL)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 161 "Libgenders.xs"
        RETVAL = GENDERS_ERR_INTERNAL;
#line 594 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_ERR_ERRNUMRANGE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_ERR_ERRNUMRANGE)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	int	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 169 "Libgenders.xs"
        RETVAL = GENDERS_ERR_ERRNUMRANGE;
#line 621 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_GENDERS_DEFAULT_FILE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_GENDERS_DEFAULT_FILE)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "sv=&PL_sv_undef");
    {
	SV *	sv;
	char *	RETVAL;
	dXSTARG;

	if (items < 1)
	    sv = &PL_sv_undef;
	else {
	    sv = ST(0)
;
	}
#line 177 "Libgenders.xs"
        RETVAL = GENDERS_DEFAULT_FILE;
#line 648 "Libgenders.c"
	sv_setpv(TARG, RETVAL);
	XSprePUSH;
	PUSHTARG;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::DESTROY() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 185 "Libgenders.xs"
       (void)genders_handle_destroy(handle);
#line 675 "Libgenders.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Libgenders_genders_handle_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_handle_create)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "CLASS");
    {
	char *        CLASS = (SvOK(ST(0))) ? (char *)SvPV(ST(0), PL_na) : NULL
;
	genders_t	RETVAL;
#line 191 "Libgenders.xs"
                RETVAL = genders_handle_create();
#line 693 "Libgenders.c"
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    sv_setref_pv( RETVALSV, CLASS, (void*)RETVAL );
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_load_data); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_load_data)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, filename=NULL");
    {
	genders_t	handle;
	char *	filename;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_load_data() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    filename = NULL;
	else {
	filename = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 200 "Libgenders.xs"
                RETVAL = genders_load_data(handle, filename);
#line 733 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_errnum); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_errnum)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_errnum() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 208 "Libgenders.xs"
        RETVAL = genders_errnum(handle);
#line 761 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_strerror); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_strerror)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, errnum");
    {
	genders_t	handle;
	int	errnum = (int)SvIV(ST(1))
;
	char *	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_strerror() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 217 "Libgenders.xs"
        RETVAL = genders_strerror(errnum);
#line 791 "Libgenders.c"
	sv_setpv(TARG, RETVAL);
	XSprePUSH;
	PUSHTARG;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_errormsg); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_errormsg)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
	char *	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_errormsg() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 225 "Libgenders.xs"
        RETVAL = genders_errormsg(handle);
#line 820 "Libgenders.c"
	sv_setpv(TARG, RETVAL);
	XSprePUSH;
	PUSHTARG;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_perror); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_perror)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, msg=NULL");
    {
	genders_t	handle;
	char *	msg;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_perror() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    msg = NULL;
	else {
	msg = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 234 "Libgenders.xs"
        genders_perror(handle, msg);
#line 855 "Libgenders.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Libgenders_genders_getnumnodes); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getnumnodes)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getnumnodes() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 240 "Libgenders.xs"
        RETVAL = genders_getnumnodes(handle);
#line 881 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getnumattrs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getnumattrs)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getnumattrs() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 248 "Libgenders.xs"
        RETVAL = genders_getnumattrs(handle);
#line 909 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getnodename); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getnodename)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
#line 256 "Libgenders.xs"
        int len;
        char *buf = NULL;
#line 928 "Libgenders.c"
	SV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getnodename() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 259 "Libgenders.xs"
        if ((len = genders_getmaxnodelen(handle)) < 0) 
            goto handle_error;

        if (!(buf = (char *)malloc(len+1))) 
            goto handle_error;

        memset(buf, '\0', len+1);

        if (genders_getnodename(handle, buf, len+1) < 0) 
            goto handle_error;

        RETVAL = newSVpv(buf, 0);
        free(buf);
        goto the_end;

        handle_error:

            free(buf);
            XSRETURN_UNDEF;

        the_end:
#line 960 "Libgenders.c"
	RETVAL = sv_2mortal(RETVAL);
	ST(0) = RETVAL;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getnodes); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getnodes)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 3)
       croak_xs_usage(cv,  "handle, attr=NULL, val=NULL");
    {
	genders_t	handle;
	char *	attr;
	char *	val;
#line 289 "Libgenders.xs"
        int len, num, errnum, i;
        char **nlist = NULL; 
#line 981 "Libgenders.c"
	AV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getnodes() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    attr = NULL;
	else {
	attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}

	if (items < 3)
	    val = NULL;
	else {
	val = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	}
#line 292 "Libgenders.xs"
        if ((len = genders_nodelist_create(handle, &nlist)) < 0) 
            goto handle_error;

        if ((num = genders_getnodes(handle, nlist, len, attr, val)) < 0)
            goto handle_error;

        RETVAL = newAV();
        for (i = 0; i < num; i++)
            av_push(RETVAL, newSVpv(nlist[i], 0));

        if (genders_nodelist_destroy(handle, nlist) < 0)
            goto handle_error;

        goto the_end;

        handle_error:

            errnum = genders_errnum(handle);

            (void)genders_nodelist_destroy(handle, nlist);

            genders_set_errnum(handle, errnum);

            XSRETURN_UNDEF;

        the_end:
#line 1032 "Libgenders.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newRV((SV*)RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getattr); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getattr)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, node=NULL");
    {
	genders_t	handle;
	char *	node;
#line 326 "Libgenders.xs"
        int len, num, errnum, i;
        char **alist = NULL; 
        char **vlist = NULL; 
        AV *attrs;
        AV *vals;
#line 1059 "Libgenders.c"
	AV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getattr() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    node = NULL;
	else {
	node = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 332 "Libgenders.xs"
        if ((len = genders_attrlist_create(handle, &alist)) < 0) 
            goto handle_error;

        if ((len = genders_vallist_create(handle, &vlist)) < 0) 
            goto handle_error;

        if ((num = genders_getattr(handle, alist, vlist, len, node)) < 0)
            goto handle_error;

        attrs = newAV();
        for (i = 0; i < num; i++)
            av_push(attrs, newSVpv(alist[i], 0));

        vals = newAV();
        for (i = 0; i < num; i++)
            av_push(vals, newSVpv(vlist[i], 0));

        RETVAL = newAV();
        av_push(RETVAL, newRV_noinc((SV *)attrs));
        av_push(RETVAL, newRV_noinc((SV *)vals));

        if (genders_attrlist_destroy(handle, alist) < 0)
            goto handle_error;
	alist = NULL;

        if (genders_vallist_destroy(handle, vlist) < 0)
            goto handle_error;
	vlist = NULL;

        goto the_end;

        handle_error:

            errnum = genders_errnum(handle);

            (void)genders_attrlist_destroy(handle, alist);
            (void)genders_vallist_destroy(handle, vlist);

            genders_set_errnum(handle, errnum);

            XSRETURN_UNDEF;

        the_end:
#line 1120 "Libgenders.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newRV((SV*)RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getattr_all); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getattr_all)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	genders_t	handle;
#line 382 "Libgenders.xs"
        int len, num, errnum, i;
        char **alist = NULL; 
#line 1143 "Libgenders.c"
	AV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getattr_all() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 385 "Libgenders.xs"
        if ((len = genders_attrlist_create(handle, &alist)) < 0) 
            goto handle_error;

        if ((num = genders_getattr_all(handle, alist, len)) < 0)
            goto handle_error;

        RETVAL = newAV();
        for (i = 0; i < num; i++)
            av_push(RETVAL, newSVpv(alist[i], 0));

        if (genders_attrlist_destroy(handle, alist) < 0)
            goto handle_error;

        goto the_end;

        handle_error:

            errnum = genders_errnum(handle);

            (void)genders_attrlist_destroy(handle, alist);

            genders_set_errnum(handle, errnum);

            XSRETURN_UNDEF;

        the_end:
#line 1180 "Libgenders.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newRV((SV*)RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_getattrval); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_getattrval)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, attr, node=NULL");
    {
	genders_t	handle;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	char *	node;
#line 420 "Libgenders.xs"
        int rv, len;
        char *buf = NULL;
#line 1206 "Libgenders.c"
	SV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_getattrval() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 3)
	    node = NULL;
	else {
	node = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	}
#line 424 "Libgenders.xs"
        if ((len = genders_getmaxvallen(handle)) < 0) 
            goto handle_error;

        if (!(buf = (char *)malloc(len+1))) 
            goto handle_error;

        memset(buf, '\0', len+1);

        if ((rv = genders_testattr(handle, node, attr, buf, len+1)) < 0)
            goto handle_error;

        if (rv == 1 && strlen(buf) > 0) 
            RETVAL = newSVpv(buf, 0);
        else 
            RETVAL = newSVpv("", 0);

        free(buf);
        goto the_end;

        handle_error:

            free(buf);
            XSRETURN_UNDEF;

        the_end:
#line 1249 "Libgenders.c"
	RETVAL = sv_2mortal(RETVAL);
	ST(0) = RETVAL;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_testattr); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_testattr)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, attr, node=NULL");
    {
	genders_t	handle;
	char *	node;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_testattr() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 3)
	    node = NULL;
	else {
	node = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	}
#line 458 "Libgenders.xs"
        RETVAL = genders_testattrval(handle, node, attr, NULL);
#line 1287 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_testattrval); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_testattrval)
{
    dVAR; dXSARGS;
    if (items < 3 || items > 4)
       croak_xs_usage(cv,  "handle, attr, val, node=NULL");
    {
	genders_t	handle;
	char *	node;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	char *        val = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_testattrval() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 4)
	    node = NULL;
	else {
	node = (SvOK(ST(3))) ? (char *)SvPV(ST(3), PL_na) : NULL
;
	}
#line 469 "Libgenders.xs"
        RETVAL = genders_testattrval(handle, node, attr, val);
#line 1327 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_isnode); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_isnode)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, node=NULL");
    {
	genders_t	handle;
	char *	node;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_isnode() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    node = NULL;
	else {
	node = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 478 "Libgenders.xs"
        RETVAL = genders_isnode(handle, node);
#line 1363 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_isattr); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_isattr)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, attr");
    {
	genders_t	handle;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_isattr() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 487 "Libgenders.xs"
        RETVAL = genders_isattr(handle, attr);
#line 1393 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_isattrval); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_isattrval)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, attr, val");
    {
	genders_t	handle;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	char *        val = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_isattrval() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 497 "Libgenders.xs"
        RETVAL = genders_isattrval(handle, attr, val);
#line 1425 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_index_attrvals); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_index_attrvals)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, attr");
    {
	genders_t	handle;
	char *        attr = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_index_attrvals() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 506 "Libgenders.xs"
        RETVAL = genders_index_attrvals(handle, attr);
#line 1455 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_query); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_query)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, query=NULL");
    {
	genders_t	handle;
	char *	query;
#line 515 "Libgenders.xs"
        int len, num, errnum, i;
        char **nlist = NULL; 
#line 1475 "Libgenders.c"
	AV *	RETVAL;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_query() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    query = NULL;
	else {
	query = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 518 "Libgenders.xs"
        if ((len = genders_nodelist_create(handle, &nlist)) < 0) 
            goto handle_error;

        if ((num = genders_query(handle, nlist, len, query)) < 0)
            goto handle_error;

        RETVAL = newAV();
        for (i = 0; i < num; i++)
            av_push(RETVAL, newSVpv(nlist[i], 0));

        if (genders_nodelist_destroy(handle, nlist) < 0)
            goto handle_error;

        goto the_end;

        handle_error:

            errnum = genders_errnum(handle);

            (void)genders_nodelist_destroy(handle, nlist);

            genders_set_errnum(handle, errnum);

            XSRETURN_UNDEF;

        the_end:
#line 1519 "Libgenders.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newRV((SV*)RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_testquery); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_testquery)
{
    dVAR; dXSARGS;
    if (items < 2 || items > 3)
       croak_xs_usage(cv,  "handle, query, node=NULL");
    {
	genders_t	handle;
	char *	node;
	char *        query = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_testquery() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 3)
	    node = NULL;
	else {
	node = (SvOK(ST(2))) ? (char *)SvPV(ST(2), PL_na) : NULL
;
	}
#line 553 "Libgenders.xs"
        RETVAL = genders_testquery(handle, node, query);
#line 1561 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_parse); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_parse)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "handle, filename=NULL");
    {
	genders_t	handle;
	char *	filename;
	int	RETVAL;
	dXSTARG;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_parse() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;

	if (items < 2)
	    filename = NULL;
	else {
	filename = (SvOK(ST(1))) ? (char *)SvPV(ST(1), PL_na) : NULL
;
	}
#line 562 "Libgenders.xs"
        RETVAL = genders_parse(handle, filename, NULL);
#line 1597 "Libgenders.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Libgenders_genders_set_errnum); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Libgenders_genders_set_errnum)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, errnum");
    {
	genders_t	handle;
	int	errnum = (int)SvIV(ST(1))
;

        if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
                handle = (genders_t)SvIV((SV*)SvRV( ST(0) ));
        else{
                warn( "Libgenders::genders_set_errnum() -- handle is not a blessed SV reference" );
                XSRETURN_UNDEF;
        }
;
#line 571 "Libgenders.xs"
        genders_set_errnum(handle, errnum);
#line 1625 "Libgenders.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Libgenders); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Libgenders)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        (void)newXSproto_portable("Libgenders::GENDERS_ERR_SUCCESS", XS_Libgenders_GENDERS_ERR_SUCCESS, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_NULLHANDLE", XS_Libgenders_GENDERS_ERR_NULLHANDLE, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_OPEN", XS_Libgenders_GENDERS_ERR_OPEN, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_READ", XS_Libgenders_GENDERS_ERR_READ, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_PARSE", XS_Libgenders_GENDERS_ERR_PARSE, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_NOTLOADED", XS_Libgenders_GENDERS_ERR_NOTLOADED, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_ISLOADED", XS_Libgenders_GENDERS_ERR_ISLOADED, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_OVERFLOW", XS_Libgenders_GENDERS_ERR_OVERFLOW, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_PARAMETERS", XS_Libgenders_GENDERS_ERR_PARAMETERS, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_NULLPTR", XS_Libgenders_GENDERS_ERR_NULLPTR, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_NOTFOUND", XS_Libgenders_GENDERS_ERR_NOTFOUND, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_OUTMEM", XS_Libgenders_GENDERS_ERR_OUTMEM, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_SYNTAX", XS_Libgenders_GENDERS_ERR_SYNTAX, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_MAGIC", XS_Libgenders_GENDERS_ERR_MAGIC, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_INTERNAL", XS_Libgenders_GENDERS_ERR_INTERNAL, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_ERR_ERRNUMRANGE", XS_Libgenders_GENDERS_ERR_ERRNUMRANGE, file, ";$");
        (void)newXSproto_portable("Libgenders::GENDERS_DEFAULT_FILE", XS_Libgenders_GENDERS_DEFAULT_FILE, file, ";$");
        (void)newXSproto_portable("Libgenders::DESTROY", XS_Libgenders_DESTROY, file, "$");
        (void)newXSproto_portable("Libgenders::genders_handle_create", XS_Libgenders_genders_handle_create, file, "$");
        (void)newXSproto_portable("Libgenders::genders_load_data", XS_Libgenders_genders_load_data, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_errnum", XS_Libgenders_genders_errnum, file, "$");
        (void)newXSproto_portable("Libgenders::genders_strerror", XS_Libgenders_genders_strerror, file, "$$");
        (void)newXSproto_portable("Libgenders::genders_errormsg", XS_Libgenders_genders_errormsg, file, "$");
        (void)newXSproto_portable("Libgenders::genders_perror", XS_Libgenders_genders_perror, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_getnumnodes", XS_Libgenders_genders_getnumnodes, file, "$");
        (void)newXSproto_portable("Libgenders::genders_getnumattrs", XS_Libgenders_genders_getnumattrs, file, "$");
        (void)newXSproto_portable("Libgenders::genders_getnodename", XS_Libgenders_genders_getnodename, file, "$");
        (void)newXSproto_portable("Libgenders::genders_getnodes", XS_Libgenders_genders_getnodes, file, "$;$$");
        (void)newXSproto_portable("Libgenders::genders_getattr", XS_Libgenders_genders_getattr, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_getattr_all", XS_Libgenders_genders_getattr_all, file, "$");
        (void)newXSproto_portable("Libgenders::genders_getattrval", XS_Libgenders_genders_getattrval, file, "$$;$");
        (void)newXSproto_portable("Libgenders::genders_testattr", XS_Libgenders_genders_testattr, file, "$$;$");
        (void)newXSproto_portable("Libgenders::genders_testattrval", XS_Libgenders_genders_testattrval, file, "$$$;$");
        (void)newXSproto_portable("Libgenders::genders_isnode", XS_Libgenders_genders_isnode, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_isattr", XS_Libgenders_genders_isattr, file, "$$");
        (void)newXSproto_portable("Libgenders::genders_isattrval", XS_Libgenders_genders_isattrval, file, "$$$");
        (void)newXSproto_portable("Libgenders::genders_index_attrvals", XS_Libgenders_genders_index_attrvals, file, "$$");
        (void)newXSproto_portable("Libgenders::genders_query", XS_Libgenders_genders_query, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_testquery", XS_Libgenders_genders_testquery, file, "$$;$");
        (void)newXSproto_portable("Libgenders::genders_parse", XS_Libgenders_genders_parse, file, "$;$");
        (void)newXSproto_portable("Libgenders::genders_set_errnum", XS_Libgenders_genders_set_errnum, file, "$$");
#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

