Starlink-AST

 view release on metacpan or  search on metacpan

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

 CODE:
   RETVAL = astStatus;
 OUTPUT:
  RETVAL

void
astStripEscapes( text )
  char * text
 PREINIT:
  const char * RETVAL;
 PPCODE:
  ASTCALL(
    RETVAL = astStripEscapes( text );
  )
  if (RETVAL) {
    XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));
  } else {
    XSRETURN_EMPTY;
  }

int

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

  RETVAL

void
astTuneC( name, ... )
  char * name
 PREINIT:
  int argoff = 1; /* number of fixed arguments */
  int nargs;
  char buff[200];
  char * value = 0;
 PPCODE:
  nargs = items - argoff;
  switch (nargs) {
    case 0:
      break;
    case 1:
      value = SvPV_nolen(ST(argoff));
      break;
    default:
      Perl_croak(aTHX_ "Usage: Starlink::AST::TuneC(name, [value])");
  }

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

  RETVAL

void
MatchAxes( frm1, frm2 )
  AstFrame * frm1
  AstFrame * frm2
 PREINIT:
  int naxes;
  int * caxes;
  AV * axes;
 PPCODE:
  naxes = astGetI( frm2, "Naxes" );
  caxes = get_mortalspace( naxes, 'i' );

  ASTCALL(
    astMatchAxes( frm1, frm2, caxes );
  )

  axes = newAV();
  unpack1D( newRV_noinc((SV*) axes), caxes, 'i', naxes );
  XPUSHs( newRV_noinc( (SV*)axes ));

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

   RETVAL = astFrameSet( frame, "%s", options );
  )
  if ( RETVAL == AST__NULL ) XSRETURN_UNDEF;
 OUTPUT:
  RETVAL

void
MirrorVariants( this, iframe )
  AstFrameSet * this
  int iframe
 PPCODE:
  ASTCALL(
    astMirrorVariants( this, iframe );
  )


MODULE = Starlink::AST  PACKAGE = Starlink::AST::CmpFrame

AstCmpFrame *
new( class, frame1, frame2, options )
  char * class

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


void
PolyCoeffs( this, forward )
  AstPolyMap * this
  int forward
 PREINIT:
  int nel;
  double * ccoeffs;
  int ncoeff;
  AV * coeffs;
 PPCODE:
  ASTCALL(
    astPolyCoeffs( this, forward, 0, 0, &ncoeff );
  )
  nel = ncoeff * (astGetI(this, forward ? "Nin" : "Nout") + 2);
  ccoeffs = get_mortalspace( nel, 'd' );
  ASTCALL(
    astPolyCoeffs( this, forward, nel, ccoeffs, &ncoeff );
  )
  coeffs = newAV();
  unpack1D(newRV_noinc((SV*) coeffs), ccoeffs, 'd', nel );

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

void
ChebyDomain( this, forward )
  AstChebyMap * this
  int forward
 PREINIT:
  int len;
  double * clbnd;
  double * cubnd;
  AV * lbnd;
  AV * ubnd;
 PPCODE:
  len = astGetI(this, forward ? "Nin" : "Nout");
  clbnd = get_mortalspace( len, 'd' );
  cubnd = get_mortalspace( len, 'd' );
  ASTCALL(
    astChebyDomain( this, forward, clbnd, cubnd );
  )
  lbnd = newAV();
  unpack1D(newRV_noinc((SV*) lbnd), clbnd, 'd', len );
  XPUSHs(newRV_noinc((SV*) lbnd));
  ubnd = newAV();

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

  RETVAL

void
TimeAdd( this, cvt, args )
  AstTimeMap * this
  char * cvt
  AV * args
 PREINIT:
  int narg;
  double * cargs;
 PPCODE:
  narg = av_len(args) + 1;
  cargs = pack1D( newRV_noinc((SV*)args), 'd');
  ASTCALL(
    astTimeAdd( this, cvt, narg, cargs );
  )

MODULE = Starlink::AST   PACKAGE = Starlink::AST::TranMap

AstTranMap *
new( class, map1, map2, options )

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

 OUTPUT:
  RETVAL

void
astCreatedAt( this )
  AstObject * this
 PREINIT:
   const char * routine;
   const char * file;
   int line;
 PPCODE:
  ASTCALL(
    astCreatedAt( this, &routine, &file, &line );
  )
  XPUSHs(sv_2mortal(newSVpvn(routine,strlen(routine))));
  XPUSHs(sv_2mortal(newSVpvn(file,strlen(file))));
  XPUSHs(sv_2mortal(newSViv(line)));

# Note that we do not return a NULL object

void

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

    RETVAL = astThread( this, ptr );
  )
 OUTPUT:
  RETVAL

void
astToString( this )
  AstObject * this
 PREINIT:
  char * string;
 PPCODE:
  ASTCALL(
    string = astToString( this );
  )
  XPUSHs(sv_2mortal(newSVpvn(string,strlen(string))));
  astFree( string );

AstObject *
ast_FromString( string )
  char * string
 CODE:

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

   RETVAL = astKeyMap( "%s", options );
  )
  if ( RETVAL == AST__NULL ) XSRETURN_UNDEF;
 OUTPUT:
  RETVAL

void
astMapCopy( this, that )
  AstKeyMap * this
  AstKeyMap * that
 PPCODE:
  ASTCALL(
    astMapCopy( this, that );
  )

void
astMapCopyEntry( this, key, that, merge )
  AstKeyMap * this
  char * key
  AstKeyMap * that
  int merge

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

   astMapPut1A( this, key, size, val, comment);
  )

void
astMapGet0D( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  double RETVAL;
  int status;
 PPCODE:
  ASTCALL(
    status = astMapGet0D( this, key, &RETVAL );
  )
  if (status != 0) {
    XPUSHs(sv_2mortal(newSVnv(RETVAL)));
  } else {
    XSRETURN_EMPTY;
  }

# Short ints are handled by "I" interface because Perl will always

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


void
astMapGet0I( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  int RETVAL;
  int status;
 ALIAS:
   MapGet0S = 1
 PPCODE:
  ASTCALL(
    status = astMapGet0I( this, key, &RETVAL );
  )
  if (status != 0) {
    XPUSHs(sv_2mortal(newSViv(RETVAL)));
  } else {
    XSRETURN_EMPTY;
  }

void
astMapGet0C( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  char * RETVAL;
  int status;
 PPCODE:
  ASTCALL(
    status = astMapGet0C( this, key, (const char **)&RETVAL );
  )
  if (status != 0) {
    XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));
  } else {
    XSRETURN_EMPTY;
  }

# Note the underscore in the name because currently we return

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

# layer

void
ast_MapGet0A( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  AstObject * RETVAL;
  int status;
  SV * sv;
 PPCODE:
  ASTCALL(
    status = astMapGet0A( this, key, &RETVAL );
  )
  if (status != 0) {
    /* Have an AstObject pointer. Convert to object. */
    sv = createPerlObject( "AstObjectPtr", RETVAL );
    XPUSHs(sv_2mortal( sv ));
  } else {
    XSRETURN_EMPTY;
  }

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


void
astMapGet1D( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  int i;
  int status;
  double * outarr;
  int nelems;
 PPCODE:
  /* First we need to find out how many elements are in the KeyMap */
  nelems = astMapLength( this, key );
  if (nelems == 0) {
    XSRETURN_EMPTY;
  }

  /* get some memory */
  outarr = get_mortalspace( nelems, 'd' );

  ASTCALL(

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

astMapGet1I( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  int i;
  int status;
  int * outarr;
  int nelems;
 ALIAS:
  MapGet1S = 1
 PPCODE:
  /* First we need to find out how many elements are in the KeyMap */
  nelems = astMapLength( this, key );
  if (nelems == 0) {
    XSRETURN_EMPTY;
  }

  /* get some memory */
  outarr = get_mortalspace( nelems, 'i' );

  ASTCALL(

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

void
ast_MapGet1A( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  SV * sv;
  int i;
  int status;
  AstObject ** outarr;
  int nelems;
 PPCODE:
  /* First we need to find out how many elements are in the KeyMap */
  nelems = astMapLength( this, key );
  if (nelems == 0) {
    XSRETURN_EMPTY;
  }

  /* get some memory */
  outarr = get_mortalspace( nelems, 'v' );

  ASTCALL(

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

  AstKeyMap * this
  char * key
 PREINIT:
  SV * sv;
  int i;
  int status;
  char * buffer;
  char * tmpp;
  int nelems;
  int maxlen = 80; /* max length of each string in map. Includes NUL */
 PPCODE:
  /* First we need to find out how many elements are in the KeyMap */
  nelems = astMapLength( this, key );
  if (nelems == 0) {
    XSRETURN_EMPTY;
  }

  /* get some memory */
  buffer = get_mortalspace( nelems * maxlen, 'u' );

  ASTCALL(

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

  } else {
    XSRETURN_EMPTY;
  }

void
astMapGetC( this, key )
  AstKeyMap * this
  char * key
 PREINIT:
  const char * RETVAL = 0;
 PPCODE:
  ASTCALL(
    astMapGetC( this, key, &RETVAL );
  )
  if (RETVAL) {
    XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));
  }
  else {
    XSRETURN_EMPTY;
  }

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

 CODE:
  ASTCALL(
    astMapRemove( this, key );
  )

void
astMapRename( this, oldkey, newkey )
  AstKeyMap * this
  char * oldkey
  char * newkey
 PPCODE:
  ASTCALL(
    astMapRename( this, oldkey, newkey );
  )

int
astMapSize( this )
  AstKeyMap * this
 CODE:
  ASTCALL(
   RETVAL = astMapSize( this );

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

  ASTCALL(
    astAddParameter( this, name );
  )

void
ColumnName( this, index )
  AstTable * this
  int index
 PREINIT:
  const char * RETVAL;
 PPCODE:
  ASTCALL(
    RETVAL = astColumnName( this, index );
  )
  XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));

void
ColumnShape( this, column )
  AstTable * this
  char * column
 PREINIT:
  int ndim;
  int cdims[10];
  AV * dims;
 PPCODE:
  /* Unsure how to determine required size because astGetColumnNdim is protected.
     Therefore use fixed size 10 for now. */
  ASTCALL(
    astColumnShape( this, column, 10, &ndim, cdims );
  )
  if (ndim) {
    dims = newAV();
    unpack1D(newRV_noinc((SV*)dims), cdims, 'i', ndim);
    XPUSHs(newRV_noinc((SV*)dims));
  }

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

  )
 OUTPUT:
  RETVAL

void
ParameterName( this, index )
  AstTable * this
  int index
 PREINIT:
  const char * cname;
 PPCODE:
  ASTCALL(
    cname = astParameterName( this, index );
  )
  if (cname) {
    XPUSHs(sv_2mortal(newSVpvn(cname,strlen(cname))));
  }
  else {
    XSRETURN_EMPTY;
  }

void
PurgeRows( this )
  AstTable * this
 PPCODE:
  ASTCALL(
    astPurgeRows( this );
  )

void
RemoveColumn( this, name )
  AstTable * this
  char * name
 PPCODE:
  ASTCALL(
    astRemoveColumn( this, name );
  )

void
RemoveParameter( this, name )
  AstTable * this
  char * name
 PPCODE:
  ASTCALL(
    astRemoveParameter( this, name );
  )

void
RemoveRow( this, index )
  AstTable * this
  int index
 PPCODE:
  ASTCALL(
    astRemoveRow( this, index );
  )


MODULE = Starlink::AST   PACKAGE = Starlink::AST::FitsTable

AstFitsTable *
new( class, header, options )
  char * class

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

  AstFitsTable * this
  char * column
 PREINIT:
   int argoff = 2; /* number of fixed arguments */
   int nargs;
   int RETVAL;
   int set = 0;
   int newval = 0;
   int wasset;
   int hasnull;
 PPCODE:
  nargs = items - argoff;
  switch (nargs) {
    case 0:
      break;
    case 1:
      set = 1;
      newval = SvIV(ST(argoff));
      break;
    default:
      Perl_croak(aTHX_ "Usage: $fitstable->ColumnNull(column, [newval])");

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

  ASTCALL(
    RETVAL = astColumnSize( this, column );
  )
 OUTPUT:
  RETVAL

void
PutTableHeader( this, header )
  AstFitsTable * this
  AstFitsChan * header
 PPCODE:
  ASTCALL(
    astPutTableHeader( this, header );
  )


MODULE = Starlink::AST   PACKAGE = Starlink::AST::Frame PREFIX = ast


double
astAngle( this, a, b, c )

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

void
astAxNorm( this, axis, oper, values )
  AstFrame * this
  int axis
  int oper
  AV * values
 PREINIT:
  int nval;
  double * cvalues;
  AV * nvalues;
 PPCODE:
  nval = av_len( values ) + 1;
  cvalues = pack1D( newRV_noinc((SV*)values), 'd' );
  ASTCALL(
    astAxNorm( this, axis, oper, nval, cvalues );
  )
  nvalues = newAV();
  unpack1D( newRV_noinc((SV*) nvalues), cvalues, 'd', nval );
  XPUSHs( newRV_noinc( (SV*) nvalues ));

double

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

  AV * b2
 PREINIT:
  int naxes;
  int len;
  double * ca1;
  double * ca2;
  double * cb1;
  double * cb2;
  double * ccross;
  AV * cross;
 PPCODE:
  naxes = astGetI( this, "Naxes" );

  len = av_len( a1 ) + 1;
  if ( len != naxes ) Perl_croak( aTHX_ "a1 must contain %d elements", naxes );
  ca1 = pack1D(newRV_noinc((SV*)a1), 'd');

  len = av_len( a2 ) + 1;
  if ( len != naxes ) Perl_croak( aTHX_ "a2 must contain %d elements", naxes );
  ca2 = pack1D(newRV_noinc((SV*)a2), 'd');

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

void
astNorm( this, ... )
  AstFrame * this
 PREINIT:
  int argoff = 1; /* number of fixed arguments */
  int naxes;
  double * aa;
  int i;
  int ncoord_in;
  double * inputs;
 PPCODE:
  /* Create C arrays of the correct dimensions */
  naxes = astGetI( this, "Naxes" );
  ncoord_in = items - argoff;

  /* Copy from the perl array to the C array */
  if (naxes != ncoord_in )
     Perl_croak(aTHX_ "Number of elements in first coord array must be %d",
                naxes);
  aa = get_mortalspace( ncoord_in, 'd' );
  for (i=0; i<ncoord_in; i++) {

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

  AV* point1
  AV* point2
  double offset
 PREINIT:
  int naxes;
  double * aa;
  double * bb;
  double * point3;
  int i;
  AV * myoffset;
 PPCODE:
  naxes = astGetI( this, "Naxes" );

  /* Copy from the perl array to the C array */
  if (av_len(point1) != naxes-1)
     Perl_croak(aTHX_ "Number of elements in first coord array must be %d",
                naxes);
  aa = pack1D( newRV_noinc((SV*)point1), 'd');
  if (av_len(point2) != naxes-1)
     Perl_croak(aTHX_ "Number of elements in second coord array must be %d",
                naxes);

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

  AV* point1
  double angle
  double offset
 PREINIT:
  int naxes;
  double * aa;
  double * point2;
  int i;
  double RETVAL;
  AV * myoffset;
 PPCODE:
  naxes = astGetI( this, "Naxes" );

  /* Copy from the perl array to the C array */
  if (av_len(point1) != naxes-1)
     Perl_croak(aTHX_ "Number of elements in first coord array must be %d",
                naxes);
  aa = pack1D( newRV_noinc((SV*)point1), 'd');

  /* Somewhere to put the return values */
  point2 = get_mortalspace( naxes, 'd' );

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

void
ast_PickAxes( this, axes )
  AstFrame * this;
  AV* axes
 PREINIT:
  int maxaxes;
  int naxes;
  int * aa;
  AstMapping * map;
  AstFrame * newframe;
 PPCODE:
  maxaxes = astGetI(this, "Naxes");
  naxes = av_len(axes) + 1;
  if ( naxes > maxaxes )
    Perl_croak(aTHX_ "Number of axes selected must be less than number of axes in frame");
  aa = pack1D( newRV_noinc((SV*)axes), 'i');
  ASTCALL(
   newframe = astPickAxes( this, naxes, aa, &map);
  )
  if ( newframe == AST__NULL ) XSRETURN_UNDEF;
  /* Create perl objects from the two return arguments */

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

 PREINIT:
  double * cpoint1;
  double * cpoint2;
  double * cpoint3;
  double * cpoint4;
  AV * point4;
  double d1;
  double d2;
  int len;
  int naxes;
 PPCODE:
  naxes = astGetI(this, "Naxes");
  len = av_len(point1) + 1;
  if ( naxes != len )
    Perl_croak(aTHX_ "Number of coords in point1 must be equal to the number of axes in frame [%d != %d]", naxes, len);
  len = av_len(point2) + 1;
  if ( naxes != len )
    Perl_croak(aTHX_ "Number of coords in point2 must be equal to the number of axes in frame [%d != %d]", naxes, len);
  len = av_len(point3) + 1;
  if ( naxes != len )
    Perl_croak(aTHX_ "Number of coords in point3 must be equal to the number of axes in frame [%d != %d]", naxes, len);

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


void
astDecompose( this )
  AstMapping * this
 PREINIT:
  AstMapping * map1;
  AstMapping * map2;
  int series;
  int invert1;
  int invert2;
 PPCODE:
  Perl_croak(aTHX_ "astDecompose not yet implemented\n");
  /* May want to restrict this to CmpMap and CmpFrame classes
     explicitly */
  ASTCALL(
   astDecompose(this, &map1, &map2, &series, &invert1, &invert2);
  )


void
astInvert( this )

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

 PREINIT:
  int len;
  double * clbnd;
  double * cubnd;
  int nin;
  int nout;
  int ncoeff;
  double * fit;
  int i;
  int status;
 PPCODE:
  /* get the input values and verify them */
  nin = astGetI( this, "Nin" );
  len = av_len( lbnd ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "lbnd must contain %d elements", nin );
  len = av_len( ubnd ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "ubnd must contain %d elements", nin );
  clbnd = pack1D(newRV_noinc((SV*)lbnd), 'd');
  cubnd = pack1D(newRV_noinc((SV*)ubnd), 'd');

  /* Get memory for the return values */

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

  int nin;
  int len;
  double * clbnd = NULL;
  double * cubnd = NULL;
  double * cxl = NULL;
  double * cxu = NULL;
  double lbnd_out;
  double ubnd_out;
  AV * xl = NULL;
  AV * xu = NULL;
 PPCODE:
  nin = astGetI( this, "Nin" );
  len = av_len( lbnd_in ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "lbnd must contain %d elements", nin );
  len = av_len( ubnd_in ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "ubnd must contain %d elements", nin );
  clbnd = pack1D(newRV_noinc((SV*)lbnd_in), 'd' );
  cubnd = pack1D(newRV_noinc((SV*)ubnd_in), 'd' );

  /* Return arrays */
  cxl = get_mortalspace( nin, 'd' );

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

astMapSplit( this, in )
  AstMapping * this
  AV * in
 PREINIT:
  int i;
  int nin;
  int nout;
  int * cin;
  int * cout;
  AstMapping * outmap = NULL;
 PPCODE:
  nin = av_len( in ) + 1;
  cin = pack1D(newRV_noinc((SV*)in), 'i');

  /* output array */
  nout = astGetI( this, "Nout" );
  cout = get_mortalspace( nout, 'i' );

  ASTCALL(
    astMapSplit( this, nin, cin, cout, &outmap );
  )

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

  AstMapping * this
  AV* at
  int ax1
  int ax2
 PREINIT:
  double RETVAL;
  int nin;
  int len;
  double * cat;
  double d2;
 PPCODE:
  nin = astGetI( this, "Nin");
  len = av_len( at ) + 1;
  if (nin != len)
      Perl_croak(aTHX_ "Must supply Nin coordinates to astRate [%d != %d]",
                        nin, len);
  cat = pack1D( newRV_noinc((SV*)at), 'd');

  ASTCALL(
    RETVAL = astRate( this, cat, ax1, ax2 );
  )

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

 PREINIT:
  int nin;
  int nout;
  int len;
  double * clbnd;
  double * cubnd;
  double * cfit;
  double rms;
  int status;
  AV * fit;
 PPCODE:
  nin = astGetI( this, "Nin" );
  nout = astGetI( this, "Nout" );
  len = av_len( lbnd ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "lbnd must contain %d elements", nin );
  len = av_len( ubnd ) + 1;
  if ( len != nin ) Perl_croak( aTHX_ "ubnd must contain %d elements", nin );
  clbnd = pack1D(newRV_noinc((SV*)lbnd), 'd');
  cubnd = pack1D(newRV_noinc((SV*)ubnd), 'd');

  cfit = get_mortalspace( 6 * nout, 'd' );

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

 CODE:
  ASTCALL(
   RETVAL = astSimplify( this );
  )
  if ( RETVAL == AST__NULL ) XSRETURN_UNDEF;
 OUTPUT:
  RETVAL

# astTran1
#   Returns one array
# Even though we return one array, we use PPCODE so that it is closer to
# the code used for astTran2

void
astTran1( this, xin, forward )
  AstMapping * this
  AV* xin
  bool forward
 PREINIT:
  int len1;
  double * cxin;
  AV* xout;
  double * cxout;
  SV** elem;
 PPCODE:
  len1 = av_len( xin ) + 1;
  cxin = pack1D( newRV_noinc((SV*)xin), 'd');
  cxout = get_mortalspace( len1, 'd' );

  ASTCALL(
    astTran1( this, len1, cxin, forward, cxout );
  )

  xout = newAV();
  unpack1D( newRV_noinc((SV*) xout), cxout, 'd', len1);

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

 PREINIT:
  int len1;
  int len2;
  double * cxin;
  double * cyin;
  AV* xout;
  AV* yout;
  double * cxout;
  double * cyout;
  SV** elem;
 PPCODE:
  len1 = av_len( xin ) + 1;
  len2 = av_len( yin ) + 1;
  if ( len1 != len2 )
     Perl_croak(aTHX_ "Number of elements in input arrays must be identical (%d != %d )",
             len1, len2);
  cxin = pack1D( newRV_noinc((SV*)xin), 'd');
  cyin = pack1D( newRV_noinc((SV*)yin), 'd');
  cxout = get_mortalspace( len1, 'd' );
  cyout = get_mortalspace( len2, 'd' );

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

  int n;
  int argoff = 2; /* number of fixed arguments */
  int ndims;
  int npoint;
  int naxin;
  int naxout;
  int ncoord_in;
  int ncoord_out;
  double **ptr_in;
  double **ptr_out;
 PPCODE:
  /* Make sure we have some coordinates to transform */
  ndims = items - argoff;
  if (ndims > 0) {
    /* Number of in and output coordinates required for this mapping */
    naxin = astGetI( this, "Nin" );
    naxout = astGetI( this, "Nout" );

    /* The required dimensionality depends on direction */
    if (forward) {
      ncoord_in = naxin;

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


MODULE = Starlink::AST   PACKAGE = Starlink::AST::Region PREFIX = ast

void
astGetRegionDisc( this )
  AstRegion * this
 PREINIT:
  double ccentre[2];
  double radius;
  AV * centre;
 PPCODE:
  ASTCALL(
    astGetRegionDisc( this, ccentre, &radius );
  )

  centre = newAV();
  unpack1D(newRV_noinc((SV*) centre), ccentre, 'd', 2);
  XPUSHs(newRV_noinc((SV*) centre));

  XPUSHs(sv_2mortal(newSVnv(radius)));

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

  RETVAL

void
astGetRegionPoints( this )
  AstRegion * this
 PREINIT:
  int naxes;
  int npoint;
  double * cpoints;
  AV * points;
 PPCODE:
  naxes = astGetI( this, "Naxes" );
  ASTCALL(
    astGetRegionPoints( this, 0, naxes, &npoint, 0 );
  )
  cpoints = get_mortalspace( naxes * npoint,'d');
  ASTCALL(
    astGetRegionPoints( this, npoint, naxes, &npoint, cpoints );
  )
  points = newAV();
  unpack1D(newRV_noinc((SV*) points), cpoints, 'd', naxes * npoint);

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

 PREINIT:
  int len;
  int ndims;
  int * clbnd;
  int * cubnd;
  double * cin;
  int nelem;
  int i;
  AV * output;
  int nmasked;
 PPCODE:
  ndims = astGetI( map, "Nout" );
  len = av_len( lbnd ) + 1;
  if ( len != ndims ) Perl_croak( aTHX_ "lbnd must contain %d elements", ndims );
  len = av_len( ubnd ) + 1;
  if ( len != ndims ) Perl_croak( aTHX_ "ubnd must contain %d elements", ndims );
  clbnd = pack1D(newRV_noinc((SV*)lbnd), 'd');
  cubnd = pack1D(newRV_noinc((SV*)ubnd), 'd');
  cin = pack1D( newRV_noinc((SV*)in), 'd' );
  ASTCALL(
     nmasked = astMaskD( this, map, inside, ndims, clbnd, cubnd, cin, val);

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

void
astGetRegionBounds( this )
  AstRegion * this
 PREINIT:
  int naxes;
  int i;
  double * clbnd;
  double * cubnd;
  AV * lbnd;
  AV * ubnd;
 PPCODE:
  naxes = astGetI( this, "Naxes" );
  clbnd = get_mortalspace( naxes, 'd' );
  cubnd = get_mortalspace( naxes, 'd' );

  ASTCALL(
    astGetRegionBounds( this, clbnd, cubnd );
  )

  lbnd = newAV();
  ubnd = newAV();

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

  int surface
 PREINIT:
  int maxpoint;
  int naxes;
  int npoint;
  double * cpoints;
  AV * points;
  AV * coord;
  int i;
  int axis;
 PPCODE:
  naxes = astGetI( this, "Naxes" );

  ASTCALL(
    astGetRegionMesh( this, surface, 0, 0, &maxpoint, 0 );
  )

  cpoints = get_mortalspace( naxes * maxpoint, 'd' );

  ASTCALL(
    astGetRegionMesh( this, surface, maxpoint, naxes * maxpoint, &npoint, cpoints );

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


  unpack1D( newRV_noinc((SV*) points), cpoints, 'd', naxes * npoint );

  XPUSHs(newRV_noinc((SV*) points));

void
astShowMesh( this, format, ttl )
  AstRegion * this
  int format
  char * ttl
 PPCODE:
  ASTCALL(
    astShowMesh( this, format, ttl);
  )

int
astPointInRegion( this, point )
  AstRegion * this
  AV * point
 PREINIT:
  double * cpoint;

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

  int naxes;
  double * ccentre;
  double a;
  double b;
  double angle;
  double * cp1;
  double * cp2;
  AV * centre;
  AV * p1;
  AV * p2;
 PPCODE:
  naxes = astGetI( this, "Naxes" );
  ccentre = get_mortalspace( naxes, 'd' );
  cp1 = get_mortalspace( naxes, 'd' );
  cp2 = get_mortalspace( naxes, 'd' );

  ASTCALL(
    astEllipsePars( this, ccentre, &a, &b, &angle, cp1, cp2 );
  )

  centre = newAV();

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

void
CirclePars( this )
  AstCircle * this
 PREINIT:
  int naxes;
  double * ccentre;
  double radius;
  double * cp1;
  AV * centre;
  AV * p1;
 PPCODE:
  naxes = astGetI( this, "Naxes" );
  ccentre = get_mortalspace( naxes, 'd' );
  cp1 = get_mortalspace( naxes, 'd' );

  ASTCALL(
    astCirclePars( this, ccentre, &radius, cp1 );
  )

  centre = newAV();
  unpack1D(newRV_noinc((SV*) centre), ccentre, 'd', naxes);

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

   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

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


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);

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

 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)));


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

astEmptyFits( this )
  AstFitsChan * this
 CODE:
  ASTCALL(
    astEmptyFits( this );
  )

void
astPurgeWCS( this )
  AstFitsChan * this
 PPCODE:
  ASTCALL(
    astPurgeWCS( this );
  )

void
astPutCards( this, cards )
  AstFitsChan * this
  char * cards
 CODE:
  ASTCALL(

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

 CODE:
  ASTCALL(
   astPutFits(this, card, overwrite);
  )

void
astPutTable( this, table, extnam )
  AstFitsChan * this
  AstFitsTable *table
  char * extnam
 PPCODE:
  ASTCALL(
    astPutTable( this, table, extnam );
  )

void
astRemoveTables( this, key )
  AstFitsChan * this
  char * key
 PPCODE:
  ASTCALL(
    astRemoveTables( this, key );
  )

void
astRetainFits( this )
  AstFitsChan * this
 PPCODE:
  ASTCALL(
    astRetainFits( this );
  )

void
astShowFits( this )
  AstFitsChan * this
 PPCODE:
  ASTCALL(
    astShowFits( this );
  )

void
astTestFits( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  int RETVAL;
  int there;
 PPCODE:
  ASTCALL(
    RETVAL = astTestFits( this, name, &there );
  )
  XPUSHs(sv_2mortal(newSViv(RETVAL)));
  XPUSHs(sv_2mortal(newSViv(there)));

void
astDelFits( this )
  AstFitsChan * this
 CODE:

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

  ASTCALL(
    astSetFitsU( this, name, comment, overwrite );
  )

double
astGetFitsF( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  int status;
 PPCODE:
  ASTCALL(
    status = astGetFitsF( this, name, &RETVAL );
  )
  if (status) {
    XPUSHs(sv_2mortal(newSVnv(RETVAL)));
  }
  else {
    XSRETURN_EMPTY;
  }

int
astGetFitsI( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  int status;
 PPCODE:
  ASTCALL(
    status = astGetFitsI( this, name, &RETVAL );
  )
  if (status) {
    XPUSHs(sv_2mortal(newSViv(RETVAL)));
  }
  else {
    XSRETURN_EMPTY;
  }

int
astGetFitsL( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  int status;
 PPCODE:
  ASTCALL(
    status = astGetFitsL( this, name, &RETVAL );
  )
  if (status) {
    XPUSHs(sv_2mortal(newSViv(RETVAL)));
  }
  else {
    XSRETURN_EMPTY;
  }

void
astGetFitsS( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  char * RETVAL;
  int status;
 PPCODE:
  ASTCALL(
    status = astGetFitsS( this, name, &RETVAL );
  )
  if (status) {
    XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));
  }
  else {
    XSRETURN_EMPTY;
  }

void
astGetFitsCN( this, name )
  AstFitsChan * this
  char * name
 PREINIT:
  char * RETVAL;
  int status;
 PPCODE:
  ASTCALL(
    status = astGetFitsCN( this, name, &RETVAL );
  )
  if (status) {
    XPUSHs(sv_2mortal(newSVpvn(RETVAL,strlen(RETVAL))));
  }
  else {
    XSRETURN_EMPTY;
  }

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

    RETVAL = astGetTables( this );
  )
  if ( RETVAL == AST__NULL ) XSRETURN_UNDEF;
 OUTPUT:
  RETVAL

void
astPutTables( this, tables )
  AstFitsChan * this
  AstKeyMap * tables
 PPCODE:
  ASTCALL(
    astPutTables( this, tables );
  )

void
astReadFits( this )
  AstFitsChan * this
 PPCODE:
  ASTCALL(
    astReadFits( this );
  )

void
astWriteFits( this )
  AstFitsChan * this
 PPCODE:
  ASTCALL(
    astWriteFits( this );
  )


MODULE = Starlink::AST   PACKAGE = Starlink::AST::SpecFrame PREFIX = ast

void
astSetRefPos( this, frm, lon, lat)
  AstSpecFrame * this

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


# XXX frm is allowed to be null here

void
astGetRefPos( this, frm )
  AstSpecFrame * this
  AstSkyFrame * frm
 PREINIT:
  double lon;
  double lat;
 PPCODE:
  ASTCALL(
   astGetRefPos( this, frm, &lon, &lat );
  )
  XPUSHs(sv_2mortal(newSVnv(lon)));
  XPUSHs(sv_2mortal(newSVnv(lat)));

MODULE = Starlink::AST   PACKAGE = Starlink::AST::SlaMap PREFIX = astSla

void
astSlaAdd( this, cvt, args )

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


void
astBoundingBox( this )
  AstPlot * this
 PREINIT:
  float clbnd[2];
  float cubnd[2];
  AV* lbnd;
  AV* ubnd;
  SV * arg = ST(0);
 PPCODE:
  PLOTCALL (arg,
   astBoundingBox( this, clbnd, cubnd );
  )
  lbnd = newAV();
  unpack1D( newRV_noinc((SV*) lbnd), clbnd, 'f', 2 );
  ubnd = newAV();
  unpack1D( newRV_noinc((SV*) ubnd), cubnd, 'f', 2 );
  XPUSHs(newRV_noinc((SV*)lbnd ));
  XPUSHs(newRV_noinc((SV*)ubnd ));

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

  } else {
    XSRETURN_EMPTY;
  }

void
astRegionOutline( this, region )
  AstPlot * this
  AstRegion * region
 PREINIT:
  SV * arg = ST(0);
 PPCODE:
  PLOTCALL(
    arg,
    astRegionOutline( this, region );
  )

void
astText( this, text, pos, up, just )
  AstPlot * this
  char * text
  AV* pos

src/astTypemap.c  view on Meta::CPAN

/*
*     astTypemap.c

*  Purpose:
*     Helper code for AST object typemap processing and object handling

*  Description:
*     This file implements functions useful for converting AST C structs
*     to Perl objects and Perl objects back to the corresponding C struct.
*     Mainly used in the typemap file but can be used to simplify processing
*     of PPCODE return arguments.
*
*     In order to use these functions in a typemap file, declare each
*     AST struct as a T_ASTOBJ and define the following INPUT and OUTPUT
*     entries:
*
*     TYPEMAP
*     AstObject *   T_ASTOBJ
*
*     INPUT
*     T_ASTOBJ



( run in 0.572 second using v1.01-cache-2.11-cpan-5511b514fd6 )