Esempio n. 1
0
/*--------------------------------------------------------------------------*/
int get_nax_arg(void* _pvCtx, int pos, rhs_opts opts[], int ** nax, BOOL * flagNax)
{
    int i, m, n, first_opt = FirstOpt(_pvCtx), kopt;

    if (pos < first_opt)
    {
        int* piAddr = 0;
        int iType = 0;
        int* piData = NULL;
        getVarAddressFromPosition(_pvCtx, pos, &piAddr);
        getVarType(_pvCtx, piAddr, &iType);

        if (iType)
        {
            getMatrixOfDoubleAsInteger(_pvCtx, piAddr, &m, &n, &piData);
            if (n * m != 4)
            {
                return 1;
            }

            for (i = 0 ; i < 4; ++i)
            {
                // When i = 1 or 3 we talk about the number of ticks, this value can be -1 to say 'AutoTicks'
                piData[i] = Max(piData[i], -(i % 2));
            }
            *nax = piData;
            *flagNax = TRUE;
        }
        else
        {
            *nax = getDefNax();
            *flagNax = FALSE;
        }
    }
    else if ((kopt = FindOpt(_pvCtx, "nax", opts)) >= 0)
    {
        int* piData = NULL;

        getMatrixOfDoubleAsInteger(_pvCtx, opts[kopt].piAddr, &m, &n, &piData);
        if (m * n != 4)
        {
            return 1;
        }

        for (i = 0 ; i < 4; ++i)
        {
            // When i = 1 or 3 we talk about the number of ticks, this value can be -1 to say 'AutoTicks'
            piData[i] = Max(piData[i], -(i % 2));
        }
        *nax = piData;
        *flagNax = TRUE;
    }
    else
    {
        *nax = getDefNax();
        *flagNax = FALSE;
    }
    return 1;
}
Esempio n. 2
0
/*--------------------------------------------------------------------------*/
int get_nax_arg(int pos,rhs_opts opts[], int ** nax, BOOL * flagNax )
{
  int i,m,n,l,first_opt=FirstOpt(),kopt;

  if (pos < first_opt)
  {
    if (VarType(pos))
    {
      GetRhsVar(pos,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
      CheckLength(pos,m*n,4);
      for (i = 0 ; i < 4; ++i)
      {
        // When i = 1 or 3 we talk about the number of ticks, this value can be -1 to say 'AutoTicks'
        *istk(l+i) = Max((int)  *istk(l+i),-(i%2));
      }
      *nax=istk(l);
      *flagNax = TRUE;
    }
    else
    {
	    *nax = getDefNax() ;
	    *flagNax = FALSE;
    }
  }
  else if ((kopt=FindOpt("nax",opts)))
  {
    GetRhsVar(kopt,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
    CheckLength(kopt,m*n,4);
    for (i = 0 ; i < 4; ++i)
    {
      // When i = 1 or 3 we talk about the number of ticks, this value can be -1 to say 'AutoTicks'
      *istk(l+i) = Max((int)  *istk(l+i),-(i%2));
    }
    *nax=istk(l);
    *flagNax = TRUE;
  }
  else
  {
    *nax = getDefNax() ;
    *flagNax = FALSE;
  }
  return 1;
}