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

#line 1 "xs/GnomeVFSOps.xs"
/*
 * Copyright (C) 2003-2005 by the gtk2-perl team
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library 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
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id$
 */

#include "vfs2perl.h"
#include <gperl_marshal.h>

/* ------------------------------------------------------------------------- */

static GPerlCallback *
vfs2perl_monitor_callback_create (SV *func, SV *data)
{
	return gperl_callback_new (func, data, 0, NULL, 0);
}

static void
vfs2perl_monitor_callback (GnomeVFSMonitorHandle *handle,
                           const gchar *monitor_uri,
                           const gchar *info_uri,
                           GnomeVFSMonitorEventType event_type,
                           GPerlCallback *callback)
{
	dGPERL_CALLBACK_MARSHAL_SP;
	GPERL_CALLBACK_MARSHAL_INIT (callback);

	ENTER;
	SAVETMPS;

	PUSHMARK (SP);

	EXTEND (SP, 4);
	PUSHs (sv_2mortal (newSVGnomeVFSMonitorHandle (handle)));
	PUSHs (sv_2mortal (newSVGChar (monitor_uri)));
	PUSHs (sv_2mortal (newSVGChar (info_uri)));
	PUSHs (sv_2mortal (newSVGnomeVFSMonitorEventType (event_type)));
	if (callback->data)
		XPUSHs (sv_2mortal (newSVsv (callback->data)));

	PUTBACK;

	call_sv (callback->func, G_DISCARD);

	SPAGAIN;

	FREETMPS;
	LEAVE;
}

/* ------------------------------------------------------------------------- */

#line 77 "xs/GnomeVFSOps.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(pTHX_ const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(pTHX_ 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(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
        else
            Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
        Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#ifdef PERL_IMPLICIT_CONTEXT
#define croak_xs_usage(a,b)    S_croak_xs_usage(aTHX_ a,b)
#else
#define croak_xs_usage        S_croak_xs_usage
#endif

#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) */

#line 219 "xs/GnomeVFSOps.c"

XS_EUPXS(XS_Gnome2__VFS_open); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_open)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, text_uri, open_mode");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	const gchar *	text_uri;
	GnomeVFSOpenMode	open_mode = SvGnomeVFSOpenMode (ST(2))
;
#line 84 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSHandle *handle;
#line 236 "xs/GnomeVFSOps.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;
#line 87 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_open (&handle, text_uri, open_mode);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSHandle (handle)));
#line 247 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_create)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "class, text_uri, open_mode, exclusive, perm");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	const gchar *	text_uri;
	GnomeVFSOpenMode	open_mode = SvGnomeVFSOpenMode (ST(2))
;
	gboolean	exclusive = (bool)SvTRUE(ST(3))
;
	guint	perm = (guint)SvUV(ST(4))
;
#line 106 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSHandle *handle;
#line 273 "xs/GnomeVFSOps.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;
#line 109 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_create (&handle, text_uri, open_mode, exclusive, perm);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSHandle (handle)));
#line 284 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS_unlink); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_unlink)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "class, text_uri");
    {
	const gchar *	text_uri;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	RETVAL = gnome_vfs_unlink(text_uri);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_move); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_move)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "class, old_text_uri, new_text_uri, force_replace");
    {
	const gchar *	old_text_uri;
	const gchar *	new_text_uri;
	gboolean	force_replace = (bool)SvTRUE(ST(3))
;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	old_text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(2));
	new_text_uri = (const gchar *)SvPV_nolen (ST(2))
;

	RETVAL = gnome_vfs_move(old_text_uri, new_text_uri, force_replace);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_check_same_fs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_check_same_fs)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, source, target");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	const gchar *	source;
	const gchar *	target;
#line 142 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	gboolean same_fs_return;
#line 359 "xs/GnomeVFSOps.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	source = (const gchar *)SvPV_nolen (ST(1))
;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(2));
	target = (const gchar *)SvPV_nolen (ST(2))
;
#line 145 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_check_same_fs (source, target, &same_fs_return);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVuv (same_fs_return)));
#line 375 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS_create_symbolic_link); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_create_symbolic_link)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, uri, target_reference");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(1))
;
	const gchar *	target_reference;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(2));
	target_reference = (const gchar *)SvPV_nolen (ST(2))
;

	RETVAL = gnome_vfs_create_symbolic_link(uri, target_reference);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_get_file_info); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_get_file_info)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, text_uri, options");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	const gchar *	text_uri;
	GnomeVFSFileInfoOptions	options = SvGnomeVFSFileInfoOptions (ST(2))
;
#line 170 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSFileInfo *info;
#line 422 "xs/GnomeVFSOps.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;
#line 173 "xs/GnomeVFSOps.xs"
	info = gnome_vfs_file_info_new ();
	result = gnome_vfs_get_file_info (text_uri, info, options);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSFileInfo (info)));
	gnome_vfs_file_info_unref (info);
#line 435 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS_truncate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_truncate)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, text_uri, length");
    {
	const gchar *	text_uri;
	GnomeVFSFileSize	length = SvGnomeVFSFileSize (ST(2))
;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	RETVAL = gnome_vfs_truncate(text_uri, length);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_make_directory); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_make_directory)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "class, text_uri, perm");
    {
	const gchar *	text_uri;
	guint	perm = (guint)SvUV(ST(2))
;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	RETVAL = gnome_vfs_make_directory(text_uri, perm);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_remove_directory); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_remove_directory)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "class, text_uri");
    {
	const gchar *	text_uri;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	RETVAL = gnome_vfs_remove_directory(text_uri);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS_set_file_info); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS_set_file_info)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "class, text_uri, info, mask");
    {
	const gchar *	text_uri;
	GnomeVFSFileInfo *	info = SvGnomeVFSFileInfo (ST(2))
;
	GnomeVFSSetFileInfoMask	mask = SvGnomeVFSSetFileInfoMask (ST(3))
;
	GnomeVFSResult	RETVAL;

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	RETVAL = gnome_vfs_set_file_info(text_uri, info, mask);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__Handle_close); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_close)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSResult	RETVAL;

	RETVAL = gnome_vfs_close(handle);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__Handle_read); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_read)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, bytes");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSFileSize	bytes = SvGnomeVFSFileSize (ST(1))
;
#line 233 "xs/GnomeVFSOps.xs"
	char *buffer;
	GnomeVFSResult result;
	GnomeVFSFileSize bytes_read = bytes;
#line 578 "xs/GnomeVFSOps.c"
#line 237 "xs/GnomeVFSOps.xs"
	if (! bytes > 0)
		croak ("The number of bytes to read must be greater than 0");

	buffer = g_new0 (char, bytes);
	result = gnome_vfs_read (handle, buffer, bytes, &bytes_read);

	EXTEND (sp, 3);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVuv (bytes_read)));
	PUSHs (sv_2mortal (newSVpv (buffer, bytes_read)));

	g_free (buffer);
#line 592 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__Handle_write); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_write)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, buffer, bytes");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	char *	buffer = (char *)SvPV_nolen(ST(1))
;
	GnomeVFSFileSize	bytes = SvGnomeVFSFileSize (ST(2))
;
#line 262 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSFileSize bytes_written = bytes;
#line 617 "xs/GnomeVFSOps.c"
#line 265 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_write (handle, buffer, bytes, &bytes_written);
	EXTEND (sp, 3);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVuv (bytes_written)));
#line 623 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__Handle_seek); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_seek)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, whence, offset");
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSSeekPosition	whence = SvGnomeVFSSeekPosition (ST(1))
;
	GnomeVFSFileOffset	offset = SvGnomeVFSFileOffset (ST(2))
;
	GnomeVFSResult	RETVAL;

	RETVAL = gnome_vfs_seek(handle, whence, offset);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__Handle_tell); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_tell)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
#line 287 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSFileSize offset_return;
#line 667 "xs/GnomeVFSOps.c"
#line 290 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_tell (handle, &offset_return);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSViv (offset_return)));
#line 673 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__Handle_get_file_info); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_get_file_info)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, options");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSFileInfoOptions	options = SvGnomeVFSFileInfoOptions (ST(1))
;
#line 306 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSFileInfo *info;
#line 696 "xs/GnomeVFSOps.c"
#line 309 "xs/GnomeVFSOps.xs"
	info = gnome_vfs_file_info_new ();
	result = gnome_vfs_get_file_info_from_handle (handle, info, options);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSFileInfo (info)));
	g_free (info);
#line 704 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__Handle_truncate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_truncate)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "handle, length");
    {
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSFileSize	length = SvGnomeVFSFileSize (ST(1))
;
	GnomeVFSResult	RETVAL;
#line 322 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_truncate_handle (handle, length);
#line 725 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

#if VFS_CHECK_VERSION (2, 12, 0)
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Gnome2__VFS__Handle_forget_cache); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Handle_forget_cache)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "handle, offset, size");
    {
	GnomeVFSResult	RETVAL;
	GnomeVFSHandle *	handle = SvGnomeVFSHandle (ST(0))
;
	GnomeVFSFileOffset	offset = SvGnomeVFSFileOffset (ST(1))
;
	GnomeVFSFileSize	size = SvGnomeVFSFileSize (ST(2))
;

	RETVAL = gnome_vfs_forget_cache(handle, offset, size);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Gnome2__VFS__URI_open); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_open)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "uri, open_mode");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSOpenMode	open_mode = SvGnomeVFSOpenMode (ST(1))
;
#line 347 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSHandle *handle;
#line 776 "xs/GnomeVFSOps.c"
#line 350 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_open_uri (&handle, uri, open_mode);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSHandle (handle)));
#line 782 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__URI_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_create)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "uri, open_mode, exclusive, perm");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSOpenMode	open_mode = SvGnomeVFSOpenMode (ST(1))
;
	gboolean	exclusive = (bool)SvTRUE(ST(2))
;
	guint	perm = (guint)SvUV(ST(3))
;
#line 368 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSHandle *handle;
#line 809 "xs/GnomeVFSOps.c"
#line 371 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_create_uri (&handle, uri, open_mode, exclusive, perm);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSHandle (handle)));
#line 815 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__URI_move); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_move)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "old_uri, new_uri, force_replace");
    {
	GnomeVFSURI *	old_uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSURI *	new_uri = SvGnomeVFSURI (ST(1))
;
	gboolean	force_replace = (bool)SvTRUE(ST(2))
;
	GnomeVFSResult	RETVAL;
#line 383 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_move_uri (old_uri, new_uri, force_replace);
#line 838 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_check_same_fs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_check_same_fs)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "source_uri, target_uri");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSURI *	source_uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSURI *	target_uri = SvGnomeVFSURI (ST(1))
;
#line 398 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	gboolean same_fs_return;
#line 862 "xs/GnomeVFSOps.c"
#line 401 "xs/GnomeVFSOps.xs"
	result = gnome_vfs_check_same_fs_uris (source_uri, target_uri, &same_fs_return);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVuv (same_fs_return)));
#line 868 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__URI_exists); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_exists)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "uri");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	gboolean	RETVAL;

	RETVAL = gnome_vfs_uri_exists(uri);
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_unlink); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_unlink)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "uri");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSResult	RETVAL;
#line 416 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_unlink_from_uri (uri);
#line 905 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_get_file_info); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_get_file_info)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "uri, options");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSFileInfoOptions	options = SvGnomeVFSFileInfoOptions (ST(1))
;
#line 431 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSFileInfo *info;
#line 929 "xs/GnomeVFSOps.c"
#line 434 "xs/GnomeVFSOps.xs"
	info = gnome_vfs_file_info_new ();
	result = gnome_vfs_get_file_info_uri (uri, info, options);
	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSFileInfo (info)));
	g_free (info);
#line 937 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__URI_truncate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_truncate)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "uri, length");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSFileSize	length = SvGnomeVFSFileSize (ST(1))
;
	GnomeVFSResult	RETVAL;
#line 447 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_truncate_uri (uri, length);
#line 958 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_make_directory); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_make_directory)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "uri, perm");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	guint	perm = (guint)SvUV(ST(1))
;
	GnomeVFSResult	RETVAL;
#line 457 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_make_directory_for_uri (uri, perm);
#line 980 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_remove_directory); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_remove_directory)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "uri");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSResult	RETVAL;
#line 466 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_remove_directory_from_uri (uri);
#line 1000 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__URI_set_file_info); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__URI_set_file_info)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "uri, info, mask");
    {
	GnomeVFSURI *	uri = SvGnomeVFSURI (ST(0))
;
	GnomeVFSFileInfo *	info = SvGnomeVFSFileInfo (ST(1))
;
	GnomeVFSSetFileInfoMask	mask = SvGnomeVFSSetFileInfoMask (ST(2))
;
	GnomeVFSResult	RETVAL;
#line 477 "xs/GnomeVFSOps.xs"
	RETVAL = gnome_vfs_set_file_info_uri (uri, info, mask);
#line 1024 "xs/GnomeVFSOps.c"
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Gnome2__VFS__Monitor_add); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Monitor_add)
{
    dVAR; dXSARGS;
    if (items < 4 || items > 5)
       croak_xs_usage(cv,  "class, text_uri, monitor_type, func, data=NULL");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	const gchar *	text_uri;
	GnomeVFSMonitorType	monitor_type = SvGnomeVFSMonitorType (ST(2))
;
	SV *	func = ST(3)
;
	SV *	data;
#line 498 "xs/GnomeVFSOps.xs"
	GnomeVFSResult result;
	GnomeVFSMonitorHandle *handle;
	GPerlCallback *callback;
#line 1051 "xs/GnomeVFSOps.c"

	/* same as SvGChar(), but not in a function */
	sv_utf8_upgrade (ST(1));
	text_uri = (const gchar *)SvPV_nolen (ST(1))
;

	if (items < 5)
	    data = NULL;
	else {
	    data = ST(4)
;
	}
#line 502 "xs/GnomeVFSOps.xs"
	callback = vfs2perl_monitor_callback_create (func, data);

	/* FIXME: destroy that callback somehow. */

	result = gnome_vfs_monitor_add (&handle,
	                                text_uri,
	                                monitor_type,
	                                (GnomeVFSMonitorCallback)
	                                  vfs2perl_monitor_callback,
	                                callback);

	EXTEND (sp, 2);
	PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
	PUSHs (sv_2mortal (newSVGnomeVFSMonitorHandle (handle)));
#line 1079 "xs/GnomeVFSOps.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Gnome2__VFS__Monitor__Handle_cancel); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Gnome2__VFS__Monitor__Handle_cancel)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "handle");
    {
	GnomeVFSMonitorHandle *	handle = SvGnomeVFSMonitorHandle (ST(0))
;
	GnomeVFSResult	RETVAL;

	RETVAL = gnome_vfs_monitor_cancel(handle);
	ST(0) = newSVGnomeVFSResult (RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Gnome2__VFS__Ops); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Gnome2__VFS__Ops)
{
    dVAR; dXSARGS;
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#endif
    XS_VERSION_BOOTCHECK;

        newXS("Gnome2::VFS::open", XS_Gnome2__VFS_open, file);
        newXS("Gnome2::VFS::create", XS_Gnome2__VFS_create, file);
        newXS("Gnome2::VFS::unlink", XS_Gnome2__VFS_unlink, file);
        newXS("Gnome2::VFS::move", XS_Gnome2__VFS_move, file);
        newXS("Gnome2::VFS::check_same_fs", XS_Gnome2__VFS_check_same_fs, file);
        newXS("Gnome2::VFS::create_symbolic_link", XS_Gnome2__VFS_create_symbolic_link, file);
        newXS("Gnome2::VFS::get_file_info", XS_Gnome2__VFS_get_file_info, file);
        newXS("Gnome2::VFS::truncate", XS_Gnome2__VFS_truncate, file);
        newXS("Gnome2::VFS::make_directory", XS_Gnome2__VFS_make_directory, file);
        newXS("Gnome2::VFS::remove_directory", XS_Gnome2__VFS_remove_directory, file);
        newXS("Gnome2::VFS::set_file_info", XS_Gnome2__VFS_set_file_info, file);
        newXS("Gnome2::VFS::Handle::close", XS_Gnome2__VFS__Handle_close, file);
        newXS("Gnome2::VFS::Handle::read", XS_Gnome2__VFS__Handle_read, file);
        newXS("Gnome2::VFS::Handle::write", XS_Gnome2__VFS__Handle_write, file);
        newXS("Gnome2::VFS::Handle::seek", XS_Gnome2__VFS__Handle_seek, file);
        newXS("Gnome2::VFS::Handle::tell", XS_Gnome2__VFS__Handle_tell, file);
        newXS("Gnome2::VFS::Handle::get_file_info", XS_Gnome2__VFS__Handle_get_file_info, file);
        newXS("Gnome2::VFS::Handle::truncate", XS_Gnome2__VFS__Handle_truncate, file);
#if XSubPPtmpAAAA
        newXS("Gnome2::VFS::Handle::forget_cache", XS_Gnome2__VFS__Handle_forget_cache, file);
#endif
        newXS("Gnome2::VFS::URI::open", XS_Gnome2__VFS__URI_open, file);
        newXS("Gnome2::VFS::URI::create", XS_Gnome2__VFS__URI_create, file);
        newXS("Gnome2::VFS::URI::move", XS_Gnome2__VFS__URI_move, file);
        newXS("Gnome2::VFS::URI::check_same_fs", XS_Gnome2__VFS__URI_check_same_fs, file);
        newXS("Gnome2::VFS::URI::exists", XS_Gnome2__VFS__URI_exists, file);
        newXS("Gnome2::VFS::URI::unlink", XS_Gnome2__VFS__URI_unlink, file);
        newXS("Gnome2::VFS::URI::get_file_info", XS_Gnome2__VFS__URI_get_file_info, file);
        newXS("Gnome2::VFS::URI::truncate", XS_Gnome2__VFS__URI_truncate, file);
        newXS("Gnome2::VFS::URI::make_directory", XS_Gnome2__VFS__URI_make_directory, file);
        newXS("Gnome2::VFS::URI::remove_directory", XS_Gnome2__VFS__URI_remove_directory, file);
        newXS("Gnome2::VFS::URI::set_file_info", XS_Gnome2__VFS__URI_set_file_info, file);
        newXS("Gnome2::VFS::Monitor::add", XS_Gnome2__VFS__Monitor_add, file);
        newXS("Gnome2::VFS::Monitor::Handle::cancel", XS_Gnome2__VFS__Monitor__Handle_cancel, file);

    /* Initialisation Section */

#if XSubPPtmpAAAA
#endif
#line 1163 "xs/GnomeVFSOps.c"

    /* End of Initialisation Section */

#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
  if (PL_unitcheckav)
       call_list(PL_scopestack_ix, PL_unitcheckav);
#endif
    XSRETURN_YES;
}

