Re: [gamin] Compatibility with SGI::FAM Perl module



Quoting Daniel Veillard (veillard redhat com):
> On Fri, Feb 18, 2005 at 03:18:26PM -0500, Mike Heins wrote:
> > Quoting Daniel Veillard (veillard redhat com):
> > > On Fri, Feb 18, 2005 at 01:05:25PM -0500, Mike Heins wrote:
> > > > Since gamin has replaced sgi_fam as the file alteration module
> > > > shipped with Fedora Core, I have a bit of a problem. I have software
> > > > based on SGI::FAM, the Perl module that works with sgi_fam. I tried
> > > > compiling against libgamin, but no go.
> > > 
> > >   Not informative... what went wrong ?
> > 
[snip]
> > gcc -c   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -m32 -march=i386 -mtune=pentium4   -DVERSION=\"1.002\" -DXS_VERSION=\"1.002\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE"   FAM.c

> > FAM.xs: In function `famerror':
> > FAM.xs:123: warning: return discards qualifiers from pointer target type
> > FAM.c: In function `XS_FAMEventPtr_code':
> > FAM.c:813: error: storage size of 'RETVAL' isn't known
> > make: *** [FAM.o] Error 1
> 
>   what is that type ? I do NOT have SGI::FAM ! You need to make a minimal
> amount of analysis to give me back informations about this.

I am not competent to make that analysis, as my knowledge of C is minimal.

> What version of fam is required ?

It has worked with the sgi_fam shipped with Fedora Core 1 & 2, which
are 2.6.8 and 2.6.10.

> The error part of fam were not defined completely at
> the point we decided to drop their code and recode the tool.

It is part of the XS code that melds the library to Perl. I have
attached the XS code, as well as the FAM.c that is generated as a result
of that. Since I am not a C hacker, the things I tried (casting a few
types) only changed the error.

> 
> > > 
> > > > It looks like the problems are mostly struct declarations, but I am
> > > > not enough of a C hacker to sort them out.
> > > 
> > >   I'm not gonna work on SGI::FAM or other application level code.
> > > 
> > > Differences between gamin and FAM are listed there
> > >    http://www.gnome.org/~veillard/gamin/differences.html
> > > I reused the same structure declarations as in fam.h from SGI, the public
> > > header is basically the same.
> > > 
> > 
> > If I can't get this fixed, then I will look at compiling and using
> > sgi_fam instead. I *was* looking forward to the improvments in gaming
> > (i.e. with luck not dying a horrible death at 1024 events) but I can
> > live with sgi_fam.
> 
>   with dnotify since you need to open a descriptor for any monitored dir
> you're stuck. When kernels will support inotify replacement, then gamin
> will support it and the limitation should go away...

I guess that means if I increase the amount of available descriptors,
the limit will rise -- and I think that is settable in /proc.

-- 

Nature, to be commanded, must be obeyed. -- Francis Bacon
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif

#include <fam.h>
#include <string.h>
#include <errno.h>

static int
constant(name)
char *name;
{
    errno = 0;
    switch (*name) {
    case 'A':
	break;
    case 'B':
	break;
    case 'C':
	break;
    case 'D':
	break;
    case 'E':
	break;
    case 'F':
	if (strEQ(name, "FAM_DEBUG_OFF"))
#ifdef FAM_DEBUG_OFF
	    return FAM_DEBUG_OFF;
#else
	    goto not_there;
#endif
	if (strEQ(name, "FAM_DEBUG_ON"))
#ifdef FAM_DEBUG_ON
	    return FAM_DEBUG_ON;
#else
	    goto not_there;
#endif
	if (strEQ(name, "FAM_DEBUG_VERBOSE"))
#ifdef FAM_DEBUG_VERBOSE
	    return FAM_DEBUG_VERBOSE;
#else
	    goto not_there;
#endif
	    /* enum FAMCodes--added by hand */
        if (strEQ(name, "FAMChanged")) {
          return FAMChanged;
        } else if (strEQ(name, "FAMDeleted")) {
          return FAMDeleted;
        } else if (strEQ(name, "FAMStartExecuting")) {
          return FAMStartExecuting;
        } else if (strEQ(name, "FAMStopExecuting")) {
          return FAMStopExecuting;
        } else if (strEQ(name, "FAMCreated")) {
          return FAMCreated;
        } else if (strEQ(name, "FAMMoved")) {
          return FAMMoved;
        } else if (strEQ(name, "FAMAcknowledge")) {
          return FAMAcknowledge;
        } else if (strEQ(name, "FAMExists")) {
          return FAMExists;
        } else if (strEQ(name, "FAMEndExist")) {
	  return FAMEndExist;
        }
	break;
    case 'G':
	break;
    case 'H':
	break;
    case 'I':
	break;
    case 'J':
	break;
    case 'K':
	break;
    case 'L':
	break;
    case 'M':
	break;
    case 'N':
	break;
    case 'O':
	break;
    case 'P':
	break;
    case 'Q':
	break;
    case 'R':
	break;
    case 'S':
	break;
    case 'T':
	break;
    case 'U':
	break;
    case 'V':
	break;
    case 'W':
	break;
    case 'X':
	break;
    case 'Y':
	break;
    case 'Z':
	break;
    case '_':
	break;
    }
    errno = EINVAL;
    return 0;

not_there:
    errno = ENOENT;
    return 0;
}

static char *famerror() {
  return FAMErrno ? FamErrlist[FAMErrno] : "";
}

static void famwarn(code, what)
int code;
char *what;
{
  if (code==-1)
    warn("SGI::FAM: %s: %s", what,
	 FAMErrno ? FamErrlist[FAMErrno] :
	 errno ? strerror(errno) :
	 "(unidentified)");
}


MODULE = SGI::FAM		PACKAGE = SGI::FAM

PROTOTYPES: ENABLE

int
constant(name)
	char *		name

char *
famerror()


MODULE = SGI::FAM		PACKAGE = FAMConnectionPtr		PREFIX = FAM

PROTOTYPES: ENABLE

# int
# FAMOpen(fc)
# 	FAMConnection *	fc

int
FAMOpen2(fc, appName)
	FAMConnection *	fc
	char *	appName

int
FAMClose(fc)
	FAMConnection *	fc

# int
# FAMMonitorDirectory(fc, filename, fr, userData)
# 	FAMConnection *	fc
# 	char *	filename
# 	FAMRequest *	fr
# 	void *	userData
# 
# int
# FAMMonitorFile(fc, filename, fr, userData)
# 	FAMConnection *	fc
# 	char *	filename
# 	FAMRequest *	fr
# 	void *	userData

int
FAMMonitorCollection(fc, filename, fr, userData, depth, mask)
	FAMConnection *	fc
	char *	filename
	FAMRequest *	fr
	void *	userData
	int	depth
	char *	mask

int
FAMMonitorDirectory2(fc, filename, fr)
	FAMConnection *	fc
	char *	filename
	FAMRequest *	fr

int
FAMMonitorFile2(fc, filename, fr)
	FAMConnection *	fc
	char *	filename
	FAMRequest *	fr

int
FAMSuspendMonitor(fc, fr)
	FAMConnection *	fc
	FAMRequest *	fr

int
FAMResumeMonitor(fc, fr)
	FAMConnection *	fc
	FAMRequest *	fr

int
FAMCancelMonitor(fc, fr)
	FAMConnection *	fc
	FAMRequest *	fr

int
FAMNextEvent(fc, fe)
	FAMConnection *	fc
	FAMEvent *	fe

int
FAMPending(fc)
	FAMConnection *	fc

int
FAMDebugLevel(fc, debugLevel)
	FAMConnection *	fc
	int	debugLevel


MODULE = SGI::FAM		PACKAGE = FAMConnectionPtr		PREFIX = fc_

PROTOTYPES: ENABLE

void
fc_DESTROY(fc)
 FAMConnection * fc
 CODE:
# warn("Freeing FAMConnection %p\n", (void *)fc);
 famwarn(FAMClose(fc), "Closing connection");
 Safefree(fc);

FAMConnection *
fc_new(class)
 char * class
 CODE:
 New(0, RETVAL, 1, FAMConnection);
# warn("Created FAMConnection %p\n", (void *)RETVAL);
 OUTPUT:
 RETVAL

int
fc_fd(fc)
 FAMConnection * fc
 CODE:
 RETVAL=FAMCONNECTION_GETFD(fc);
 OUTPUT:
 RETVAL


MODULE = SGI::FAM		PACKAGE = FAMRequestPtr			PREFIX = fr_

PROTOTYPES: ENABLE

void
fr_DESTROY(fr)
 FAMRequest * fr
 CODE:
# warn("Freeing FAMRequest %p\n", (void *)fr);
 Safefree(fr);

FAMRequest *
fr_new(class)
 char * class
 CODE:
 New(0, RETVAL, 1, FAMRequest);
# warn("Created FAMRequest %p\n", (void *)RETVAL);
 OUTPUT:
 RETVAL

int
fr_reqnum(fr)
 FAMRequest * fr
 CODE:
 RETVAL=FAMREQUEST_GETREQNUM(fr);
 OUTPUT:
 RETVAL

void
fr_setreqnum(fr, new)
 FAMRequest * fr
 int new
 CODE:
 FAMREQUEST_GETREQNUM(fr)=new;


MODULE = SGI::FAM		PACKAGE = FAMEventPtr			PREFIX = fe_

PROTOTYPES: ENABLE

void
fe_DESTROY(fe)
 FAMEvent * fe
 CODE:
# warn("Freeing FAMEvent %p\n", (void *)fe);
 Safefree(fe);

FAMEvent *
fe_new(class)
 char * class
 CODE:
 New(0, RETVAL, 1, FAMEvent);
# warn("Created FAMEvent %p\n", (void *)RETVAL);
 OUTPUT:
 RETVAL

# /*
# Properly, these next two should inc. the REFCNT of ST(0), once I
# figure out how to do something like that, and return the original
# object. Until then, we do not want gratuitous freeing.
# */

FAMConnection *
fe_fc(fe)
 FAMEvent * fe
 CODE:
 New(0, RETVAL, 1, FAMConnection);
 *RETVAL=*(fe->fc);
 OUTPUT:
 RETVAL

FAMRequest *
fe_fr(fe)
 FAMEvent * fe
 CODE:
 New(0, RETVAL, 1, FAMRequest);
 *RETVAL=fe->fr;
 OUTPUT:
 RETVAL

char *
fe_hostname(fe)
 FAMEvent * fe
 CODE:
 RETVAL=fe->hostname;
 OUTPUT:
 RETVAL

char *
fe_filename(fe)
 FAMEvent * fe
 CODE:
 RETVAL=fe->filename;
 OUTPUT:
 RETVAL

enum FAMCodes
fe_code(fe)
 FAMEvent * fe
 CODE:
 RETVAL=fe->code;
 OUTPUT:
 RETVAL
/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of FAM.xs. Do not edit this file, edit FAM.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "FAM.xs"
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif

#include <fam.h>
#include <string.h>
#include <errno.h>

static int
constant(name)
char *name;
{
    errno = 0;
    switch (*name) {
    case 'A':
	break;
    case 'B':
	break;
    case 'C':
	break;
    case 'D':
	break;
    case 'E':
	break;
    case 'F':
	if (strEQ(name, "FAM_DEBUG_OFF"))
#ifdef FAM_DEBUG_OFF
	    return FAM_DEBUG_OFF;
#else
	    goto not_there;
#endif
	if (strEQ(name, "FAM_DEBUG_ON"))
#ifdef FAM_DEBUG_ON
	    return FAM_DEBUG_ON;
#else
	    goto not_there;
#endif
	if (strEQ(name, "FAM_DEBUG_VERBOSE"))
#ifdef FAM_DEBUG_VERBOSE
	    return FAM_DEBUG_VERBOSE;
#else
	    goto not_there;
#endif
	    /* enum FAMCodes--added by hand */
        if (strEQ(name, "FAMChanged")) {
          return FAMChanged;
        } else if (strEQ(name, "FAMDeleted")) {
          return FAMDeleted;
        } else if (strEQ(name, "FAMStartExecuting")) {
          return FAMStartExecuting;
        } else if (strEQ(name, "FAMStopExecuting")) {
          return FAMStopExecuting;
        } else if (strEQ(name, "FAMCreated")) {
          return FAMCreated;
        } else if (strEQ(name, "FAMMoved")) {
          return FAMMoved;
        } else if (strEQ(name, "FAMAcknowledge")) {
          return FAMAcknowledge;
        } else if (strEQ(name, "FAMExists")) {
          return FAMExists;
        } else if (strEQ(name, "FAMEndExist")) {
	  return FAMEndExist;
        }
	break;
    case 'G':
	break;
    case 'H':
	break;
    case 'I':
	break;
    case 'J':
	break;
    case 'K':
	break;
    case 'L':
	break;
    case 'M':
	break;
    case 'N':
	break;
    case 'O':
	break;
    case 'P':
	break;
    case 'Q':
	break;
    case 'R':
	break;
    case 'S':
	break;
    case 'T':
	break;
    case 'U':
	break;
    case 'V':
	break;
    case 'W':
	break;
    case 'X':
	break;
    case 'Y':
	break;
    case 'Z':
	break;
    case '_':
	break;
    }
    errno = EINVAL;
    return 0;

not_there:
    errno = ENOENT;
    return 0;
}

static char *famerror() {
  return FAMErrno ? FamErrlist[FAMErrno] : "";
}

static void famwarn(code, what)
int code;
char *what;
{
  if (code==-1)
    warn("SGI::FAM: %s: %s", what,
	 FAMErrno ? FamErrlist[FAMErrno] :
	 errno ? strerror(errno) :
	 "(unidentified)");
}


#line 148 "FAM.c"
XS(XS_SGI__FAM_constant); /* prototype to pass -Wmissing-prototypes */
XS(XS_SGI__FAM_constant)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: SGI::FAM::constant(name)");
    {
	char *	name = (char *)SvPV_nolen(ST(0));
	int	RETVAL;
	dXSTARG;

	RETVAL = constant(name);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_SGI__FAM_famerror); /* prototype to pass -Wmissing-prototypes */
XS(XS_SGI__FAM_famerror)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: SGI::FAM::famerror()");
    {
	char *	RETVAL;
	dXSTARG;

	RETVAL = famerror();
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_Open2); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_Open2)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::Open2(fc, appName)");
    {
	FAMConnection *	fc;
	char *	appName = (char *)SvPV_nolen(ST(1));
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	RETVAL = FAMOpen2(fc, appName);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_Close); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_Close)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::Close(fc)");
    {
	FAMConnection *	fc;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	RETVAL = FAMClose(fc);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_MonitorCollection); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_MonitorCollection)
{
    dXSARGS;
    if (items != 6)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::MonitorCollection(fc, filename, fr, userData, depth, mask)");
    {
	FAMConnection *	fc;
	char *	filename = (char *)SvPV_nolen(ST(1));
	FAMRequest *	fr;
	void *	userData = INT2PTR(void *,SvIV(ST(3)));
	int	depth = (int)SvIV(ST(4));
	char *	mask = (char *)SvPV_nolen(ST(5));
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(2), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(2)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMMonitorCollection(fc, filename, fr, userData, depth, mask);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_MonitorDirectory2); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_MonitorDirectory2)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::MonitorDirectory2(fc, filename, fr)");
    {
	FAMConnection *	fc;
	char *	filename = (char *)SvPV_nolen(ST(1));
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(2), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(2)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMMonitorDirectory2(fc, filename, fr);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_MonitorFile2); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_MonitorFile2)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::MonitorFile2(fc, filename, fr)");
    {
	FAMConnection *	fc;
	char *	filename = (char *)SvPV_nolen(ST(1));
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(2), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(2)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMMonitorFile2(fc, filename, fr);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_SuspendMonitor); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_SuspendMonitor)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::SuspendMonitor(fc, fr)");
    {
	FAMConnection *	fc;
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(1), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMSuspendMonitor(fc, fr);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_ResumeMonitor); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_ResumeMonitor)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::ResumeMonitor(fc, fr)");
    {
	FAMConnection *	fc;
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(1), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMResumeMonitor(fc, fr);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_CancelMonitor); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_CancelMonitor)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::CancelMonitor(fc, fr)");
    {
	FAMConnection *	fc;
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(1), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");

	RETVAL = FAMCancelMonitor(fc, fr);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_NextEvent); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_NextEvent)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::NextEvent(fc, fe)");
    {
	FAMConnection *	fc;
	FAMEvent *	fe;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	if (sv_derived_from(ST(1), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(1)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");

	RETVAL = FAMNextEvent(fc, fe);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_Pending); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_Pending)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::Pending(fc)");
    {
	FAMConnection *	fc;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	RETVAL = FAMPending(fc);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_DebugLevel); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_DebugLevel)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::DebugLevel(fc, debugLevel)");
    {
	FAMConnection *	fc;
	int	debugLevel = (int)SvIV(ST(1));
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");

	RETVAL = FAMDebugLevel(fc, debugLevel);
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_DESTROY)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::DESTROY(fc)");
    {
	FAMConnection *	fc;

	if (SvROK(ST(0))) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not a reference");
#line 241 "FAM.xs"
 famwarn(FAMClose(fc), "Closing connection");
 Safefree(fc);
#line 528 "FAM.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_FAMConnectionPtr_new); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_new)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::new(class)");
    {
	char *	class = (char *)SvPV_nolen(ST(0));
	FAMConnection *	RETVAL;
#line 248 "FAM.xs"
 New(0, RETVAL, 1, FAMConnection);
#line 544 "FAM.c"
	ST(0) = sv_newmortal();
	sv_setref_pv(ST(0), "FAMConnectionPtr", (void*)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMConnectionPtr_fd); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMConnectionPtr_fd)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMConnectionPtr::fd(fc)");
    {
	FAMConnection *	fc;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMConnectionPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fc = INT2PTR(FAMConnection *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fc is not of type FAMConnectionPtr");
#line 257 "FAM.xs"
 RETVAL=FAMCONNECTION_GETFD(fc);
#line 570 "FAM.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMRequestPtr_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMRequestPtr_DESTROY)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMRequestPtr::DESTROY(fr)");
    {
	FAMRequest *	fr;

	if (SvROK(ST(0))) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not a reference");
#line 271 "FAM.xs"
 Safefree(fr);
#line 593 "FAM.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_FAMRequestPtr_new); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMRequestPtr_new)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMRequestPtr::new(class)");
    {
	char *	class = (char *)SvPV_nolen(ST(0));
	FAMRequest *	RETVAL;
#line 277 "FAM.xs"
 New(0, RETVAL, 1, FAMRequest);
#line 609 "FAM.c"
	ST(0) = sv_newmortal();
	sv_setref_pv(ST(0), "FAMRequestPtr", (void*)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMRequestPtr_reqnum); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMRequestPtr_reqnum)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMRequestPtr::reqnum(fr)");
    {
	FAMRequest *	fr;
	int	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");
#line 286 "FAM.xs"
 RETVAL=FAMREQUEST_GETREQNUM(fr);
#line 635 "FAM.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMRequestPtr_setreqnum); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMRequestPtr_setreqnum)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: FAMRequestPtr::setreqnum(fr, new)");
    {
	FAMRequest *	fr;
	int	new = (int)SvIV(ST(1));

	if (sv_derived_from(ST(0), "FAMRequestPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fr = INT2PTR(FAMRequest *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fr is not of type FAMRequestPtr");
#line 295 "FAM.xs"
 FAMREQUEST_GETREQNUM(fr)=new;
#line 659 "FAM.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_FAMEventPtr_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_DESTROY)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::DESTROY(fe)");
    {
	FAMEvent *	fe;

	if (SvROK(ST(0))) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not a reference");
#line 307 "FAM.xs"
 Safefree(fe);
#line 681 "FAM.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_FAMEventPtr_new); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_new)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::new(class)");
    {
	char *	class = (char *)SvPV_nolen(ST(0));
	FAMEvent *	RETVAL;
#line 313 "FAM.xs"
 New(0, RETVAL, 1, FAMEvent);
#line 697 "FAM.c"
	ST(0) = sv_newmortal();
	sv_setref_pv(ST(0), "FAMEventPtr", (void*)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMEventPtr_fc); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_fc)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::fc(fe)");
    {
	FAMEvent *	fe;
	FAMConnection *	RETVAL;

	if (sv_derived_from(ST(0), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");
#line 328 "FAM.xs"
 New(0, RETVAL, 1, FAMConnection);
 *RETVAL=*(fe->fc);
#line 723 "FAM.c"
	ST(0) = sv_newmortal();
	sv_setref_pv(ST(0), "FAMConnectionPtr", (void*)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMEventPtr_fr); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_fr)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::fr(fe)");
    {
	FAMEvent *	fe;
	FAMRequest *	RETVAL;

	if (sv_derived_from(ST(0), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");
#line 337 "FAM.xs"
 New(0, RETVAL, 1, FAMRequest);
 *RETVAL=fe->fr;
#line 749 "FAM.c"
	ST(0) = sv_newmortal();
	sv_setref_pv(ST(0), "FAMRequestPtr", (void*)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_FAMEventPtr_hostname); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_hostname)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::hostname(fe)");
    {
	FAMEvent *	fe;
	char *	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");
#line 346 "FAM.xs"
 RETVAL=fe->hostname;
#line 775 "FAM.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_FAMEventPtr_filename); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_filename)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::filename(fe)");
    {
	FAMEvent *	fe;
	char *	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");
#line 354 "FAM.xs"
 RETVAL=fe->filename;
#line 800 "FAM.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_FAMEventPtr_code); /* prototype to pass -Wmissing-prototypes */
XS(XS_FAMEventPtr_code)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: FAMEventPtr::code(fe)");
    {
	FAMEvent *	fe;
	enum FAMCodes	RETVAL;
	dXSTARG;

	if (sv_derived_from(ST(0), "FAMEventPtr")) {
	    IV tmp = SvIV((SV*)SvRV(ST(0)));
	    fe = INT2PTR(FAMEvent *,tmp);
	}
	else
	    Perl_croak(aTHX_ "fe is not of type FAMEventPtr");
#line 362 "FAM.xs"
 RETVAL=fe->code;
#line 825 "FAM.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}

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

    XS_VERSION_BOOTCHECK ;

        newXSproto("SGI::FAM::constant", XS_SGI__FAM_constant, file, "$");
        newXSproto("SGI::FAM::famerror", XS_SGI__FAM_famerror, file, "");
        newXSproto("FAMConnectionPtr::Open2", XS_FAMConnectionPtr_Open2, file, "$$");
        newXSproto("FAMConnectionPtr::Close", XS_FAMConnectionPtr_Close, file, "$");
        newXSproto("FAMConnectionPtr::MonitorCollection", XS_FAMConnectionPtr_MonitorCollection, file, "$$$$$$");
        newXSproto("FAMConnectionPtr::MonitorDirectory2", XS_FAMConnectionPtr_MonitorDirectory2, file, "$$$");
        newXSproto("FAMConnectionPtr::MonitorFile2", XS_FAMConnectionPtr_MonitorFile2, file, "$$$");
        newXSproto("FAMConnectionPtr::SuspendMonitor", XS_FAMConnectionPtr_SuspendMonitor, file, "$$");
        newXSproto("FAMConnectionPtr::ResumeMonitor", XS_FAMConnectionPtr_ResumeMonitor, file, "$$");
        newXSproto("FAMConnectionPtr::CancelMonitor", XS_FAMConnectionPtr_CancelMonitor, file, "$$");
        newXSproto("FAMConnectionPtr::NextEvent", XS_FAMConnectionPtr_NextEvent, file, "$$");
        newXSproto("FAMConnectionPtr::Pending", XS_FAMConnectionPtr_Pending, file, "$");
        newXSproto("FAMConnectionPtr::DebugLevel", XS_FAMConnectionPtr_DebugLevel, file, "$$");
        newXSproto("FAMConnectionPtr::DESTROY", XS_FAMConnectionPtr_DESTROY, file, "$");
        newXSproto("FAMConnectionPtr::new", XS_FAMConnectionPtr_new, file, "$");
        newXSproto("FAMConnectionPtr::fd", XS_FAMConnectionPtr_fd, file, "$");
        newXSproto("FAMRequestPtr::DESTROY", XS_FAMRequestPtr_DESTROY, file, "$");
        newXSproto("FAMRequestPtr::new", XS_FAMRequestPtr_new, file, "$");
        newXSproto("FAMRequestPtr::reqnum", XS_FAMRequestPtr_reqnum, file, "$");
        newXSproto("FAMRequestPtr::setreqnum", XS_FAMRequestPtr_setreqnum, file, "$$");
        newXSproto("FAMEventPtr::DESTROY", XS_FAMEventPtr_DESTROY, file, "$");
        newXSproto("FAMEventPtr::new", XS_FAMEventPtr_new, file, "$");
        newXSproto("FAMEventPtr::fc", XS_FAMEventPtr_fc, file, "$");
        newXSproto("FAMEventPtr::fr", XS_FAMEventPtr_fr, file, "$");
        newXSproto("FAMEventPtr::hostname", XS_FAMEventPtr_hostname, file, "$");
        newXSproto("FAMEventPtr::filename", XS_FAMEventPtr_filename, file, "$");
        newXSproto("FAMEventPtr::code", XS_FAMEventPtr_code, file, "$");
    XSRETURN_YES;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]