/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of perlglue.xs. Do not edit this file, edit perlglue.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "perlglue.xs"
static const char fileIdent[] = "$Id: perlglue.xs,v 1.8 2009/03/28 21:00:42 kretch Exp $";

#ifdef HAVE_LIBZEPHYR
#include <zephyr/zephyr.h>
#endif
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

/* Yeah, we should just include owl.h, but curses and perl don't play nice. */
extern char *owl_function_command(char *cmd);
extern void owl_free(void *x);
extern SV *owl_perlconfig_curmessage2hashref();
extern int owl_zwrite_create_and_send_from_line(char *, char *);
extern char *owl_function_ztext_stylestrip(char *);
extern void g;
extern int owl_global_get_cols(void*);
extern char *owl_zephyr_get_realm();
extern char *owl_zephyr_get_sender();
 
#line 31 "perlglue.c"
XS(XS_owl_command); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_command)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: owl::command(cmd)");
    {
	char *	cmd = (char *)SvPV_nolen(ST(0));
#line 27 "perlglue.xs"
		char *rv = NULL;
#line 42 "perlglue.c"
	char *	RETVAL;
	dXSTARG;
#line 29 "perlglue.xs"
		rv = owl_function_command(cmd);
		RETVAL = rv;	
#line 48 "perlglue.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
#line 34 "perlglue.xs"
		if (rv) owl_free(rv);
#line 52 "perlglue.c"
    }
    XSRETURN(1);
}

XS(XS_owl_getcurmsg); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_getcurmsg)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: owl::getcurmsg()");
    {
	SV *	RETVAL;
#line 39 "perlglue.xs"
		ST(0) = owl_perlconfig_curmessage2hashref();
#line 67 "perlglue.c"
    }
    XSRETURN(1);
}

XS(XS_owl_getnumcols); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_getnumcols)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: owl::getnumcols()");
    {
	int	RETVAL;
	dXSTARG;
#line 44 "perlglue.xs"
		RETVAL = owl_global_get_cols(&g);
#line 83 "perlglue.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_owl_zephyr_getrealm); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_zephyr_getrealm)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: owl::zephyr_getrealm()");
    {
	char *	RETVAL;
	dXSTARG;
#line 51 "perlglue.xs"
		RETVAL = owl_zephyr_get_realm();
#line 100 "perlglue.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_owl_zephyr_getsender); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_zephyr_getsender)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: owl::zephyr_getsender()");
    {
	char *	RETVAL;
	dXSTARG;
#line 58 "perlglue.xs"
		RETVAL = owl_zephyr_get_sender();
#line 117 "perlglue.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_owl_zephyr_zwrite); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_zephyr_zwrite)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: owl::zephyr_zwrite(cmd, msg)");
    {
	char *	cmd = (char *)SvPV_nolen(ST(0));
	char *	msg = (char *)SvPV_nolen(ST(1));
#line 67 "perlglue.xs"
		int i;
#line 134 "perlglue.c"
#line 69 "perlglue.xs"
		i = owl_zwrite_create_and_send_from_line(cmd, msg);
#line 137 "perlglue.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_owl_ztext_stylestrip); /* prototype to pass -Wmissing-prototypes */
XS(XS_owl_ztext_stylestrip)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: owl::ztext_stylestrip(ztext)");
    {
	char *	ztext = (char *)SvPV_nolen(ST(0));
#line 75 "perlglue.xs"
		char *rv = NULL;
#line 152 "perlglue.c"
	char *	RETVAL;
	dXSTARG;
#line 77 "perlglue.xs"
		rv = owl_function_ztext_stylestrip(ztext);
		RETVAL = rv;
#line 158 "perlglue.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
#line 82 "perlglue.xs"
		if (rv) owl_free(rv);
#line 162 "perlglue.c"
    }
    XSRETURN(1);
}

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

    XS_VERSION_BOOTCHECK ;

        newXSproto("owl::command", XS_owl_command, file, "$");
        newXSproto("owl::getcurmsg", XS_owl_getcurmsg, file, "");
        newXSproto("owl::getnumcols", XS_owl_getnumcols, file, "");
        newXSproto("owl::zephyr_getrealm", XS_owl_zephyr_getrealm, file, "");
        newXSproto("owl::zephyr_getsender", XS_owl_zephyr_getsender, file, "");
        newXSproto("owl::zephyr_zwrite", XS_owl_zephyr_zwrite, file, "$$");
        newXSproto("owl::ztext_stylestrip", XS_owl_ztext_stylestrip, file, "$");
    XSRETURN_YES;
}

