/*
* This file was generated automatically by xsubpp version 1.937 from the
* contents of IIS.xs. Do not edit this file, edit IIS.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/*
IIS.xs - provide interface to KGB's libiis.c for
IIS graphics (SAOimage/Ximtool etc...)
*/
#include "EXTERN.h" /* std perl include */
#include "perl.h" /* std perl include */
#include "XSUB.h" /* XSUB include */
#include "pdl.h" /* Data structure declarations */
#include "pdlcore.h" /* Core declarations */
#include "libiis.h" /* Local decs */
static Core* PDL; /* Structure hold core C functions */
SV* CoreSV; /* Get's pointer to perl var holding core structure */
XS(XS_PDL__Graphics__IIS_iis_c)
{
dXSARGS;
if (items != 3)
croak("Usage: PDL::Graphics::IIS::iis_c(image,lo,hi)");
{
pdl* image = PDL->SvPDLV(ST(0));
float lo = (float)SvNV(ST(1));
float hi = (float)SvNV(ST(2));
int* dims = image->dims;
int frame = (int)SvIV( perl_get_sv("iisframe", FALSE) );
if (image->ndims != 2)
croak("Array is not 2D");
if (frame<1 || frame>4)
croak("$iisframe must be in range 1--4");
iis_open(SvPV(perl_get_sv("fifi",FALSE),na),SvPV(perl_get_sv("fifo",FALSE),na),
(int)SvIV( perl_get_sv("fbconfig", FALSE) ),
(int)SvIV( perl_get_sv("fb_x", FALSE) ),
(int)SvIV( perl_get_sv("fb_y", FALSE) ) );
iis_display( image->data, image->datatype, dims[0],dims[1],lo,hi,frame );
iis_close();
}
XSRETURN(1);
}
XS(XS_PDL__Graphics__IIS_iiscur_c)
{
dXSARGS;
if (items != 0)
croak("Usage: PDL::Graphics::IIS::iiscur_c()");
SP -= items;
{
float x,y;
char ch;
int frame = (int)SvIV( perl_get_sv("iisframe", FALSE) );
iis_open(SvPV(perl_get_sv("fifi",FALSE),na),SvPV(perl_get_sv("fifo",FALSE),na),
(int)SvIV( perl_get_sv("fbconfig", FALSE) ),
(int)SvIV( perl_get_sv("fb_x", FALSE) ),
(int)SvIV( perl_get_sv("fb_y", FALSE) ) );
iis_cur(&x,&y,&ch);
iis_close();
EXTEND(sp,3);
PUSHs(sv_2mortal(newSVnv((float)x)));
PUSHs(sv_2mortal(newSVnv((float)y)));
PUSHs(sv_2mortal(newSVpv(&ch,1)));
PUTBACK;
return;
}
}
XS(XS_PDL__Graphics__IIS_iiscirc_c)
{
dXSARGS;
if (items != 4)
croak("Usage: PDL::Graphics::IIS::iiscirc_c(x,y,r,colour)");
{
pdl* x = PDL->SvPDLV(ST(0));
pdl* y = PDL->SvPDLV(ST(1));
pdl* r = PDL->SvPDLV(ST(2));
pdl* colour = PDL->SvPDLV(ST(3));
int frame = (int)SvIV( perl_get_sv("iisframe", FALSE) );
int n = x->nvals;
int i, j=0, k=0;
float *xx,*yy,*rr;
long *cc;
if (x->ndims!=1 || y->ndims !=1 || r->ndims !=1 || colour->ndims!=1)
croak("Arguments must be 1D");
if (y->nvals !=n || (r->nvals!=n && r->nvals!=1) || (colour->nvals!=n && colour->nvals!=1))
croak("Dimensions must match");
PDL->converttype( &x, PDL_F, TMP); xx = (float*) x->data;
PDL->converttype( &y, PDL_F, TMP); yy = (float*) y->data;
PDL->converttype( &r, PDL_F, TMP); rr = (float*) r->data;
PDL->converttype( &colour, PDL_L, TMP); cc = (long*) colour->data;
iis_open(SvPV(perl_get_sv("fifi",FALSE),na),SvPV(perl_get_sv("fifo",FALSE),na),
(int)SvIV( perl_get_sv("fbconfig", FALSE) ),
(int)SvIV( perl_get_sv("fb_x", FALSE) ),
(int)SvIV( perl_get_sv("fb_y", FALSE) ) );
for (i=0; i<n; i++) {
iis_drawcirc( xx[i], yy[i], rr[j], (int)cc[k], frame);
if (r->nvals!=1)
j++;
if (colour->nvals!=1)
k++;
}
iis_close();
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_PDL__Graphics__IIS)
{
dXSARGS;
char* file = __FILE__;
XS_VERSION_BOOTCHECK ;
newXS("PDL::Graphics::IIS::iis_c", XS_PDL__Graphics__IIS_iis_c, file);
newXS("PDL::Graphics::IIS::iiscur_c", XS_PDL__Graphics__IIS_iiscur_c, file);
newXS("PDL::Graphics::IIS::iiscirc_c", XS_PDL__Graphics__IIS_iiscirc_c, file);
/* Initialisation Section */
/* Get pointer to structure of core shared C routines */
CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* SV* value */
if (CoreSV==NULL)
croak("This module requires use of PDL::Core first");
PDL = (Core*) (void*) SvIV( CoreSV ); /* Core* value */
/* End of Initialisation Section */
ST(0) = &sv_yes;
XSRETURN(1);
}