Starlink-AST

 view release on metacpan or  search on metacpan

lib/Starlink/AST.xs  view on Meta::CPAN

  int64_t npix
 CODE:
  ASTCALL(
   astAddCell( this, cmode, order, npix );
  )

void
GetCell( this, icell )
  AstMoc * this
  int icell
 PREINIT:
  int order;
  int64_t npix;
 PPCODE:
  ASTCALL(
    astGetCell( this, icell, &order, &npix );
  )
  XPUSHs(sv_2mortal(newSViv(order)));
  XPUSHs(sv_2mortal(newSViv(npix)));

int
TestCell( this, order, npix, parent )
  AstMoc * this
  int order
  int64_t npix
  int parent
 CODE:
  ASTCALL(
    RETVAL = astTestCell( this, order, npix, parent );
  )
 OUTPUT:
  RETVAL

void
AddRegion( this, cmode, region)
  AstMoc * this
  int cmode
  AstRegion * region
 CODE:
  ASTCALL(
    astAddRegion( this, cmode, region );
  )

AstFitsChan *
GetMocHeader( this )
  AstMoc * this
 CODE:
  ASTCALL(
    RETVAL = astGetMocHeader( this );
  )
 OUTPUT:
  RETVAL

void
GetMocData( this )
  AstMoc * this
 PREINIT:
  int nb;
  size_t ln;
  size_t mxsize;
  void * cdata;
  AV * data;
 PPCODE:
  nb = astGetI( this, "moctype" );
  ln = astGetI( this, "moclength" );
  mxsize = nb * ln;
  cdata = get_mortalspace( mxsize, 'u' );
  ASTCALL(
    astGetMocData( this, mxsize, cdata );
  )
  if (nb == 4) {
    data = newAV();
    unpack1D(newRV_noinc((SV*) data), cdata, 'i', ln);
    XPUSHs(newRV_noinc((SV*) data));
  }
  else if (nb == 8) {
    data = newAV();
    unpack1D(newRV_noinc((SV*) data), cdata, 'q', ln);
    XPUSHs(newRV_noinc((SV*) data));
  }
  else {
    Perl_croak(aTHX_ "Unexpected byte-length MOC data\n");
  }

void
AddMocData( this, cmode, negate, maxorder, data )
  AstMoc * this
  int cmode
  int negate
  int maxorder
  AV * data
 PREINIT:
  int len;
  int64_t * cdata;
 CODE:
  len = av_len( data ) + 1;
  cdata = pack1D( newRV_noinc((SV*)data), 'q' );
  ASTCALL(
    astAddMocData( this, cmode, negate, maxorder, len, 8, cdata );
  )

void
AddPixelMaskD( this, cmode, wcs, value, oper, flags, badval, array, dims )
  AstMoc * this
  int cmode
  AstFrameSet * wcs
  double value
  int oper
  int flags
  double badval
  AV * array
  AV * dims
 PREINIT:
  double * carray;
  int * cdims;
 CODE:
  carray = pack1D( newRV_noinc((SV*)array), 'd' );
  cdims = pack1D( newRV_noinc((SV*)dims), 'i' );
  ASTCALL(
    astAddPixelMaskD( this, cmode, wcs, value, oper, flags, badval, carray, cdims );
  )

int
AddMocString( this, cmode, negate, maxorder, string )
  AstMoc * this
  int cmode
  int negate
  int maxorder
  char * string
 CODE:
  ASTCALL(
    astAddMocString( this, cmode, negate, maxorder, strlen(string), string, &RETVAL );
  )
 OUTPUT:
  RETVAL

void
GetMocString( this, json )
  AstMoc * this
  int json
 PREINIT:
   size_t size;
   char * RETVAL;
 PPCODE:
  ASTCALL(
    astGetMocString( this, json, 0, 0, &size );
  )
  RETVAL = get_mortalspace( size, 'u' );
  ASTCALL(
    astGetMocString( this, json, size, RETVAL, &size );
  )
  XPUSHs(sv_2mortal(newSVpvn(RETVAL,size)));


MODULE = Starlink::AST   PACKAGE = Starlink::AST::Prism

AstPrism *
new( class, region1, region2, options )
  char * class



( run in 1.200 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )