Example #1
0
/*--------------------------------------------------------------------------*/
int get_legend_arg(void* _pvCtx, char *fname, int pos, rhs_opts opts[], char ** legend)
{
    int first_opt = FirstOpt(_pvCtx), kopt;

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

        if (iType)
        {
            getAllocatedSingleString(_pvCtx, piAddr, &pstData);
            *legend = pstData;
        }
        else
        {
            *legend = getDefLegend();
        }
    }
    else if ((kopt = FindOpt(_pvCtx, "leg", opts)) >= 0)
    {
        char* pstData = NULL;
        getAllocatedSingleString(_pvCtx, opts[kopt].piAddr, &pstData);
        *legend = pstData;
    }
    else
    {
        *legend = getDefLegend();
    }
    return 1;
}
Example #2
0
/*--------------------------------------------------------------------------*/
int get_legend_arg(char *fname,int pos,rhs_opts opts[], char ** legend )
{
  int m,n,l,first_opt=FirstOpt(),kopt;

  if (pos < first_opt)
    {
      if (VarType(pos)) {
	GetRhsVar(pos,STRING_DATATYPE, &m, &n, &l);
	*legend = cstk(l);
      }
      else
	{
	  *legend = getDefLegend() ;
	}
    }
  else if ((kopt=FindOpt("leg",opts))) {
    GetRhsVar(kopt,STRING_DATATYPE, &m, &n, &l);
    *legend = cstk(l);
  }
  else
    {
      *legend = getDefLegend() ;
    }
  return 1;
}
Example #3
0
/**
 * retrieve the labels from the command line and store them into labels
 */
int get_labels_arg(void* _pvCtx, char *fname, int pos, rhs_opts opts[], char ** labels)
{
    int first_opt = FirstOpt(), kopt;

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

        if (iType)
        {
            getAllocatedSingleString(_pvCtx, piAddr, &pstData);
            *labels = pstData;
        }
        else
        {
            /* jb silvy 03/2006 */
            /* do not change the legend if one already exists */
            char * pSubWinUID = (char*)getOrCreateDefaultSubwin();
            if (sciGetLegendDefined(pSubWinUID))
            {
                *labels = NULL;
            }
            else
            {
                *labels = getDefLegend();
            }
        }
    }
    else if ((kopt = FindOpt("leg", opts)))
    {
        int* piAddr = 0;
        char* pstData = NULL;
        getVarAddressFromPosition(_pvCtx, kopt, &piAddr);
        getAllocatedSingleString(_pvCtx, piAddr, &pstData);
        *labels = pstData;
    }
    else
    {
        /* jb silvy 03/2006 */
        /* do not change the legend if one already exists */
        char* pSubWinUID = (char*)getOrCreateDefaultSubwin();

        if (sciGetLegendDefined(pSubWinUID))
        {
            *labels = NULL;
        }
        else
        {
            *labels = getDefLegend();
        }
    }
    return 1;
}
Example #4
0
/**
 * retrieve the labels from the command line and store them into labels
 */
int get_labels_arg(char *fname, int pos, rhs_opts opts[], char ** labels)
{
    int m,n,l,first_opt=FirstOpt(),kopt;

    if (pos < first_opt)
    {
        if (VarType(pos))
        {
            GetRhsVar(pos,STRING_DATATYPE, &m, &n, &l);
            *labels = cstk(l);
        }
        else
        {
            /* jb silvy 03/2006 */
            /* do not change the legend if one already exists */
            char * pSubWinUID = getOrCreateDefaultSubwin();
            if (sciGetLegendDefined(pSubWinUID))
            {
                *labels = NULL;
            }
            else
            {
                *labels = getDefLegend();
            }
        }
    }
    else if ((kopt=FindOpt("leg",opts)))
    {
        GetRhsVar(kopt,STRING_DATATYPE, &m, &n, &l);
        *labels = cstk(l);
    }
    else
    {
        /* jb silvy 03/2006 */
        /* do not change the legend if one already exists */
        char* pSubWinUID = getOrCreateDefaultSubwin();

        if (sciGetLegendDefined(pSubWinUID))
        {
            *labels = NULL;
        }
        else
        {
            *labels = getDefLegend();
        }
    }
    return 1;
}