Пример #1
0
/*--------------------------------------------------------------------------*/
int get_colminmax_arg(char *fname,int pos,rhs_opts opts[], int ** colminmax )
{
  int 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,2);
	  *colminmax=istk(l);
	}
      else
	{
	  /** global value can be modified  **/
    int zeros[2] = { 0, 0 } ;
    setDefColMinMax( zeros ) ;
	  *colminmax = getDefColMinMax() ;
	}
    }
  else if ((kopt=FindOpt("colminmax",opts)))
    {
      GetRhsVar(kopt,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
      CheckLength(kopt,m*n,2);
      *colminmax=istk(l);
    }
  else
    {
      /** global value can be modified  **/
      int zeros[2] = { 0, 0 } ;
      setDefColMinMax( zeros ) ;
      *colminmax = getDefColMinMax() ;
    }
  return 1;
}
Пример #2
0
/*--------------------------------------------------------------------------*/
int get_colminmax_arg(void* _pvCtx, char *fname, int pos, rhs_opts opts[], int ** colminmax)
{
    int m, n, first_opt = FirstOpt(), 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 (m * n != 2)
            {
                return 1;
            }
            *colminmax = piData;
        }
        else
        {
            /** global value can be modified  **/
            int zeros[2] = { 0, 0 };
            setDefColMinMax(zeros);
            *colminmax = getDefColMinMax();
        }
    }
    else if ((kopt = FindOpt("colminmax", opts)))
    {
        int* piAddr = 0;
        int* piData = NULL;

        getVarAddressFromPosition(_pvCtx, kopt, &piAddr);
        getMatrixOfDoubleAsInteger(_pvCtx, piAddr, &m, &n, &piData);
        if (m * n != 2)
        {
            return 1;
        }
        *colminmax = piData;
    }
    else
    {
        /** global value can be modified  **/
        int zeros[2] = { 0, 0 };
        setDefColMinMax(zeros);
        *colminmax = getDefColMinMax();
    }
    return 1;
}