示例#1
0
/*--------------------------------------------------------------------------*/
int get_colout_arg(char *fname,int pos,rhs_opts opts[], int ** colout )
{
  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);
	  *colout = istk(l);
	}
      else
	{
	  /** global value can be modified  **/
    int newDefCO[2] = { -1, -1 } ;
    setDefColOut( newDefCO ) ;
	  *colout = getDefColOut() ;
	}
    }
  else if ((kopt=FindOpt("colout",opts)))
    {
      GetRhsVar(kopt,MATRIX_OF_INTEGER_DATATYPE, &m, &n, &l);
      CheckLength(kopt,m*n,2);
      *colout=istk(l);
    }
  else
    {
      /** global value can be modified  **/
      int newDefCO[2] = { -1, -1 } ;
      setDefColOut( newDefCO ) ;
      *colout = getDefColOut() ;
    }
  return 1;
}
示例#2
0
/*--------------------------------------------------------------------------*/
int get_colout_arg(void* _pvCtx, char *fname, int pos, rhs_opts opts[], int ** colout)
{
    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;
            }
            *colout = piData;
        }
        else
        {
            /** global value can be modified  **/
            int newDefCO[2] = { -1, -1 };
            setDefColOut(newDefCO);
            *colout = getDefColOut();
        }
    }
    else if ((kopt = FindOpt("colout", opts)))
    {
        int* piAddr = 0;
        int* piData = NULL;

        getVarAddressFromPosition(_pvCtx, kopt, &piAddr);
        getMatrixOfDoubleAsInteger(_pvCtx, piAddr, &m, &n, &piData);
        if (m * n != 2)
        {
            return 1;
        }
        *colout = piData;
    }
    else
    {
        /** global value can be modified  **/
        int newDefCO[2] = { -1, -1 };
        setDefColOut(newDefCO);
        *colout = getDefColOut();
    }
    return 1;
}