Esempio n. 1
0
static int num_vals_args(int firstarg, int lastarg, char *argv[],
                         double valptr[], int max_n_vals )
{
	int	argno, valndx;
	double	cur_val;

	for (argno = firstarg; argno < lastarg; argno++)
	  if (isReal( argv[ argno ] )) {
		cur_val = stringReal( argv[ argno ] );
		valndx = argno-firstarg;
		if (valndx < max_n_vals)
		  valptr[ valndx ] = cur_val;
	  }
	  else {
		Werrprintf( "%s:  invalid argument '%s'", argv[ 0 ], argv[ argno ] );
		return( -1 );
	  }

	return( lastarg-firstarg );
}
Esempio n. 2
0
static int checkinput(int argc, char *argv[],
                      int *firstindex,int *lastindex,int *step,int *imag_on,int *color_traces)
/*************/
{   int arg_no;
    int maxindex;

    *step = 1;
    arg_no = 1;
    *imag_on = *color_traces = FALSE;
    horizontal = 0;
    automatic =  0;
    if(strlen(argv[0])>3) {
        horizontal = (argv[0][3] == 'h');
        automatic =  (argv[0][3] == 'a');
    }
    maxindex = nblocks * specperblock;

    if (plot && (argv[0][2] != 'w'))
    {
        *firstindex = specIndex;
        *lastindex = specIndex;
    }
    else if(d2flag)
    {
        *firstindex = fpnt1;
        *lastindex = fpnt1 + npnt1;
    }
    else
    {
        *firstindex = 1;
        *lastindex = maxindex;
    }

    while (argc>arg_no)
    {
        if (isReal(argv[arg_no]))
        {
            *lastindex = *firstindex = (int) stringReal(argv[arg_no]);
            arg_no++;
            if (argc>arg_no)
                if (isReal(argv[arg_no]))
                {
                    *lastindex = (int) stringReal(argv[arg_no]);
                    arg_no++;
                }
            if (argc>arg_no)
            {
                if (isReal(argv[arg_no]))
                {
                    *step = (int) stringReal(argv[arg_no]);
                    arg_no++;
                }
            }
        }
        else if (strcmp(argv[arg_no],"all")==0)
        {
            *firstindex = 1;
            *lastindex  = maxindex;
            arg_no++;
        }
        else if (strcmp(argv[arg_no],"imag")==0)
        {
            *imag_on = TRUE;
            arg_no++;
        }
        else if (strcmp(argv[arg_no],"color")==0)
        {
            *color_traces = TRUE;
            arg_no++;
        }
        else
            arg_no++;
    }
    if (*firstindex < 1)
        *firstindex = 1;
    if (*step < 1)
        *step = 1;
    if (*lastindex < *firstindex)
        *lastindex = *firstindex;
    return(COMPLETE);
}
Esempio n. 3
0
int dpf(int argc, char *argv[], int retc, char *retv[])
/*************/
{ int groups;
  int noisemult_p = 0;
  int numlines,maxlines;
  int i;
  int donll = TRUE;
  int noneg = FALSE;
  int top = FALSE;
  char command[128];
  char name[64];

  (void) retc;
  (void) retv;
  Wturnoff_buttons();
  leader_len = 20.0;
  axish = FALSE;
  axisp = FALSE;
  axisp_freq = 1.0;
  if (argc > 1)
  {
    for (i=1; i<argc; i++)
    {
      if (strcmp(argv[i],"off") == 0) {
	set_dpf_flag(0,"");
        redo_dpf_dpir();
	RETURN;
      } else if (strcmp(argv[i],"turnoff") == 0) {
        set_dpf_flag(0,"");
        RETURN;
      } else if (strcmp(argv[i],"noll") == 0) donll = FALSE;
      else if (strcmp(argv[i],"pos") == 0) noneg = TRUE;
      else if (strcmp(argv[i],"top") == 0) top = TRUE;
      else if (strcmp(argv[i],"axish") == 0) axish = TRUE;
      else if (strcmp(argv[i],"axisp") == 0)
      {
         axisp = TRUE;
         P_getreal(PROCESSED,"sfrq",&axisp_freq,1);
      }
      else if (strcmp(argv[i],"leader") == 0)
      {
         if (((i+1) < argc) && isReal(argv[i+1]) )
         {
            i++;
            leader_len = stringReal(argv[i]);
         }
      }
      else if (isReal(argv[i])) noisemult_p = i;
    }
  }
  if (donll) /* if not donll, dpf uses last previous line listing */
  {
    if (noisemult_p != 0)
    {
      if (noneg)
	strcpy(command,"nll('dpf','pos',");
      else
	strcpy(command,"nll('dpf',");
      strcat(command,argv[noisemult_p]);
      strcat(command,")\n");
    }
    else
    {
      if (noneg)
	strcpy(command,"nll('dpf','pos')\n");
      else
	strcpy(command,"nll('dpf')\n");
    }
    execString(command);
  }

  if(P_getreal(CURRENT, "dpf_sc2",&dpf_sc2,1)) dpf_sc2=sc2;
  if(P_getreal(CURRENT, "dpf_wc2",&dpf_wc2,1)) dpf_wc2=wc2;
  if(dpf_wc2>wc2) dpf_wc2=wc2;
  if(dpf_sc2<sc2) dpf_sc2=sc2;

  /* if (init2d(1,1)) return(ERROR); */
  scale = vs;
  if (normflag)
    scale *= normalize;
  /*   Wscrprintf("normflag=%d normalize=%g\n",normflag,normalize); */
  plot = (argv[0][0] == 'p');

/*select_init(get_rev, dis_setup, fdimname, doheaders, docheck2d, dospecpars,
            	doblockpars, dophasefile)*/
/*if (init2d(0,plot + 1)) return(ERROR); */
  if (select_init(
	0,
	plot+1,
	NO_FREQ_DIM,
	NO_HEADERS,
	DO_CHECK2D,
	DO_SPECPARS,
	NO_BLOCKPARS,
	NO_PHASEFILE
     ))
      return(ERROR);
  if ((numlines = getlines(noneg)) == 0) RETURN;
  if (!plot)
  {
    setwindows();
    dispcalib = (float) (mnumypnts-ymin) / (float) wc2max;

    getOptName(PEAK_MARK,name);
    set_line_thickness(name);
    getOptName(PEAK_NUM,name);
    set_graphics_font(name);
    
  }
  else
  { 
    double size = G_getCharSize("PeakNum");
    charsize(size);
    //charsize((double)0.7);
    dispcalib = ppmm / ymultiplier;
  }
  CharSize = ycharpixels + ycharpixels / 5;
  maxlines = dnpnt / CharSize;

  if (maxlines < numlines)
    remove_lines(maxlines,&numlines);
  if (numlines > 0)
  {
    //color(PARAM_COLOR);
    color(PEAK_MARK_COLOR);
    groups = groupcheck(numlines);
    if (debug1)
    {
      Wscrprintf("index high low newhigh newlow highlimit lowlimit\n");
      for (i = 1; i <= groups; i++)
        Wscrprintf("%d %d %d %d %d %d %d\n",i,ga[i].high,ga[i].low,
                   ga[i].newhigh,ga[i].newlow,ga[i].highlimit,ga[i].lowlimit);
    }
    label_proc = (top) ? (PFV) label_top : (PFV) label_bot;
    for (i = 1; i <= groups; i++)
      label_group(i);

    if (!plot) { // construct the command, and set the flag and command
      char cmd[64];
      if(argc > 1) {
        if (isReal(argv[1]) ) sprintf(cmd,"%s(%s",argv[0],argv[1]);
	else sprintf(cmd,"%s('%s'",argv[0],argv[1]);
	for(i=2;i<argc;i++)
        {
           if (isReal(argv[i]) )
           {
	      strcat(cmd,",");
              strcat(cmd,argv[i]);
           }
	   else
           {
	      strcat(cmd,",'");
              strcat(cmd,argv[i]);
	      strcat(cmd,"'");
           }
	}
	strcat(cmd,")\n");
      } else sprintf(cmd,"%s\n",argv[0]);
      Wsetgraphicsdisplay("ds");
      set_dpf_flag(1, cmd);
    }
  }
  releaseAllWithId("dpf");
  endgraphics();
  disp_status("        ");
  set_graphics_font("Default");
  RETURN;
}