ATYPE * XFUNCV ( UINT4 ndim, UINT4 *dims )
{
  ATYPE *arr;
  UINT4Vector dimLength;

  if ( ! ndim )
    XLAL_ERROR_NULL( XLAL_EBADLEN );
  if ( ! dims )
    XLAL_ERROR_NULL( XLAL_EFAULT );

  dimLength.length = ndim;
  dimLength.data   = dims;

  arr = XFUNC ( &dimLength );
  if ( ! arr )
    XLAL_ERROR_NULL( XLAL_EFUNC );
  return arr;
}
void FUNC ( LALStatus *status, ATYPE **array, UINT4Vector *dimLength )
{
  INITSTATUS(status);

  /* make sure arguments are sane */

  ASSERT (array,             status, AVFACTORIESH_EVPTR, AVFACTORIESH_MSGEVPTR);
  ASSERT (!*array,           status, AVFACTORIESH_EUPTR, AVFACTORIESH_MSGEUPTR);
  ASSERT (dimLength,         status, AVFACTORIESH_EVPTR, AVFACTORIESH_MSGEVPTR);
  ASSERT (dimLength->data,   status, AVFACTORIESH_EVPTR, AVFACTORIESH_MSGEVPTR);
  ASSERT (dimLength->length, status,
          AVFACTORIESH_ELENGTH, AVFACTORIESH_MSGELENGTH);

  *array = XFUNC ( dimLength );
  if ( ! *array )
  {
    int code = xlalErrno & ~XLAL_EFUNC; /* turn off subfunction error bit */
    XLALClearErrno();
    if ( code & XLAL_EFAULT )
    {
      ABORT (status, AVFACTORIESH_EVPTR, AVFACTORIESH_MSGEVPTR);
    }
    if ( code == XLAL_EBADLEN )
    {
      ABORT (status, AVFACTORIESH_ELENGTH, AVFACTORIESH_MSGELENGTH);
    }
    if ( code == XLAL_EINVAL )
    {
      ABORT (status, AVFACTORIESH_EVPTR, AVFACTORIESH_MSGEVPTR);
    }
    if ( code == XLAL_ENOMEM )
    {
      ABORT (status, AVFACTORIESH_EMALLOC, AVFACTORIESH_MSGEMALLOC);
    }
  }

  RETURN (status);
}
Esempio n. 3
0
File: xfunc.c Progetto: dharc/dsb
int dsb_xfunc_init()
{
	XFUNC(XFUNC_LOG,xfunc_log);
	return 0;
}
void FUNC ( LALStatus *status, STYPE **vseq, CreateVectorSequenceIn *in )
{
  /*
   * Initialize status
   */
  INITSTATUS(status);

  /* Check input structure: report if NULL */

  ASSERT (in != NULL, status, SEQFACTORIESH_EINPTR, SEQFACTORIESH_MSGEINPTR);

  /* Check sequence length: report error if 0
   * Use of unsigned for length means we can't check if negative
   * length was passed
   */

  ASSERT (in->length > 0, status,
          SEQFACTORIESH_ESLENGTH, SEQFACTORIESH_MSGESLENGTH);

  /* Check vector length: report error if 0
   * Use of unsigned for length means we can't check if negative
   * length was passed
   */

  ASSERT (in->vectorLength > 0, status,
          SEQFACTORIESH_EVLENGTH, SEQFACTORIESH_MSGEVLENGTH);

  /*
   * Check return structure: If return pointer does not point to a
   *    valid pointer then report an error
   */

  ASSERT (vseq != NULL, status, SEQFACTORIESH_EVPTR, SEQFACTORIESH_MSGEVPTR);
  ASSERT (*vseq == NULL, status, SEQFACTORIESH_EUPTR, SEQFACTORIESH_MSGEUPTR);


  *vseq = XFUNC ( in->length, in->vectorLength );
  if ( ! vseq )
  {
    int code = xlalErrno;
    XLALClearErrno();
    if ( code == XLAL_EBADLEN )
    {
      if ( ! in->length )
      {
        ABORT (status, SEQFACTORIESH_ESLENGTH, SEQFACTORIESH_MSGESLENGTH);
      }
      else
      {
        ABORT (status, SEQFACTORIESH_EVLENGTH, SEQFACTORIESH_MSGEVLENGTH);
      }
    }
    if ( code == XLAL_ENOMEM )
    {
      ABORT( status, SEQFACTORIESH_EMALLOC, SEQFACTORIESH_MSGEMALLOC );
    }
  }

  /* We be done: Normal exit */

  RETURN (status);
}