コード例 #1
0
ファイル: hpa.c プロジェクト: DanIverson/OpenVnmrJ
int hpa(int argc, char *argv[], int retc, char *retv[])
/*************/
{
  double plotchar = 0.6;

  (void) argc;
  (void) argv;
  (void) retc;
  (void) retv;
  if (setplotter()) return(ERROR);
  if (raster)
  {
    Werrprintf("hpa is not supported on raster plotters");
    return(COMPLETE);
  }
  charsize(plotchar);
  color(GREEN);
  if (debug1)
    Wscrprintf("ppmm= %g ymultiplier= %d plot= %d raster= %d, mnumxpnts= %d\n",
                ppmm,ymultiplier,plot,raster,mnumxpnts);

/*  Copy the display parameters from the current group to the
    processed group so the current values will be plotted.	*/

  P_copygroup( CURRENT, PROCESSED, G_DISPLAY );

  plotparam("tn",      COL1,   ROW1, 6,0);
  plotparam("sw",      COL1,   ROW2, 8,1);
  plotparam("at",      COL1,   ROW3, 8,3);
  plotparam("pw",      COL1,   ROW4, 8,1);
  plotparam("sfrq",    COL2,   ROW1, 8,4);
  plotparam("tof",     COL2,   ROW2, 8,1);
  plotparam("d1",      COL2,   ROW3, 8,3);
  plotparam("ct",      COL2+2, ROW4, 8,0);
  plotparam("dn",      COL3,   ROW1, 6,0);
  plotparam("dm",      COL3,   ROW2, 6,0);
  plotparam("dmm",     COL3+7, ROW3, 6,0);
  plotparam("pp",      COL3,   ROW4, 8,1);
  plotparam("dof",     COL4,   ROW1, 8,1);
  plotparam("dlp",     COL4,   ROW2, 8,0);
  plotparam("dmf",     COL4,   ROW3, 8,0);
  plotparam("dpwr",    COL4,   ROW4, 8,0);
  plotparam("fn",      COL5,   ROW1, 8,0);
  plotparam("lb",      COL5,   ROW2, 8,3);
  plotparam("wp",      COL5+2, ROW3, 8,1);
  plotparam("gf",      COL6,   ROW2, 8,3);
  plotparam("sp",      COL7-6, ROW3, 8,1);
  plotparam("seqfil",  COL8,   ROW1, 6,0);
  plotparam("temp",    COL8-2, ROW3, 8,1);
  plotparam("solvent", COL8,   ROW4, 8,0);
  plotparam("file",    COL9,   ROW2, 8,0);
  plotparam("date",    COL9,   ROW3, 8,0);
  plotparam("h1freq",  COL9,   ROW4, 6,0);
  plottext(295,ROW2);
  endgraphics();
  return(COMPLETE);
}
コード例 #2
0
ファイル: dfww.c プロジェクト: timburrow/ovj3
int dfww(int argc, char *argv[], int retc, char *retv[])
/*************/
{   int firstindex;
    int lastindex;
    int step;
    int ctrace;
    int do_ww;
    int local_color;
    int imag_on;
    int redoDscale;
    int color_traces;
    int index=1;
    int maxindex=nblocks * specperblock;
    double save_sc, save_wc, save_sc2, save_wc2;

    (void) retc;
    (void) retv;
    redoDscale = dscale_onscreen();
    Wturnoff_buttons();
    plot = (argv[0][0] == 'p');
    do_ww = (argv[0][2] == 'w');
    if (Bnmr && !plot)
        return(COMPLETE);
    revflag = 0;
    if(initfid(plot+1)) return(ERROR);
    dispcalib = (float) (mnumypnts-ymin) / (float) wc2max;
    if (init_vars2()) return(ERROR);
    clearMspec();

    checkinput(argc,argv,&firstindex,&lastindex,&step,&imag_on,&color_traces);
    if (!plot)
        setwindows(argv);
    if ((firstindex < 1) || (firstindex > maxindex))
    {
        Werrprintf("spectrum %d does not exist",firstindex);
        return(ERROR);
    }

    save_sc=sc;
    save_wc=wc;
    save_sc2=sc2;
    save_wc2=wc2;

    if (lastindex < firstindex)
        lastindex = firstindex;
    if (lastindex > maxindex)
        lastindex = maxindex;
    //setscwc(firstindex,lastindex,step);
    if(plot) setscwc(firstindex,lastindex,step);
    else setscwc_new(firstindex,lastindex,step);
    setspecmaxmin();
    disp_specIndex(firstindex);

    /*  Need to change this for multiple traces...  */

    get_fid_color(argc,argv,&local_color,imag_on);
    ctrace = index = firstindex;
    if (!plot && inRepaintMode && redoDscale)
        new_dscale(FALSE,TRUE);
    if (do_ww)
        if (init_whitewash(mnumxpnts))
            do_ww = FALSE;
    while ((ctrace <= lastindex) && !interuption)
    {
        if(plot) exp_factors(FALSE);
        else calcDisplayPars();
        if(color_traces)
            local_color=((index % (NUM_AV_COLORS-2)) + FIRST_AV_COLOR + 1);

        if (calc_fid(ctrace-1))
            return(ERROR);
        if (imag_on)
            imagdisp(local_color, do_ww);
        else
            fiddisp(local_color, do_ww);
        if(plot) {
            sc += ho;
            if (!horizontal)
                sc2 += vo;
        } else {
            dss_sc += ho;
            if (!horizontal)
                dss_sc2 += vo;
        }
        ctrace += step;
        index++;
    }
    if (!plot)
    {
        ResetLabels();
        DispField(FIELD1,PARAM_COLOR,"vf",vs,1);
        InitVal(FIELD2,HORIZ,SP_NAME, PARAM_COLOR,UNIT4,
                SP_NAME, PARAM_COLOR,SCALED,2);
        InitVal(FIELD3,HORIZ,WP_NAME, PARAM_COLOR,UNIT4,
                WP_NAME, PARAM_COLOR,SCALED,2);
        if (firstindex != lastindex)
        {
            DispField(FIELD4,PARAM_COLOR,"first",(double) firstindex,0);
            DispField(FIELD5,PARAM_COLOR,"last",(double) lastindex,0);
            DispField(FIELD6,PARAM_COLOR,"step",(double) step,0);
        }
    }
    if (plot)
        amove(0,0);
    else {
        exit_display();
        Wsetgraphicsdisplay("dfs");
    }
    endgraphics();

    sc=save_sc;
    wc=save_wc;
    sc2=save_sc2;
    wc2=save_wc2;
    P_setreal(CURRENT,"sc",sc,0);
    P_setreal(CURRENT,"wc",wc,0);
    P_setreal(CURRENT,"sc2",sc2,0);
    P_setreal(CURRENT,"wc2",wc2,0);

    if (do_ww)
        close_whitewash();
    if (freebuffers()) return(ERROR);
    appendvarlist("dss_sc,dss_wc,sc,wc,vo,ho");
    return(COMPLETE);
}
コード例 #3
0
ファイル: dpf.c プロジェクト: DanIverson/OpenVnmrJ
int dpir(int argc, char *argv[], int retc, char *retv[])
/*************/
{ int groups;
  int resets;
  int i, min, ysize;
  char name[64];
  char tmpstr[MAXSTR];

  (void) retc;
  (void) retv;

  if (argc > 1 && strcmp(argv[1],"off") == 0) {
	set_dpir_flag(0,"");
        redo_dpf_dpir();
	RETURN;
  } else if (argc > 1 && strcmp(argv[1],"turnoff") == 0) {
        set_dpir_flag(0,"");
        RETURN;
  }

  vertflag=0;
  if ( ! P_getstring(GLOBAL, "integralOrient", tmpstr, 1, MAXSTR) )
  {
     vertflag = (strcmp(tmpstr,"vert") == 0);
  }
  if (argc > 1 && strcmp(argv[1],"vert") == 0) {
      vertflag=1;
  }

  if(argc == 1 || strcmp(argv[1],"noli") != 0) {
     execString("nli\n");
  }
  if (check_int(&resets))
  {
    Werrprintf("intmod must not be set to 'full'");
    ABORT;
  }
  if (resets <= 1)
  {
    Werrprintf("no integral resets are defined");
    ABORT;
  }
  plot = (argv[0][0] == 'p');
  if (select_init(
	0,
	plot+1,
	NO_FREQ_DIM,
	NO_HEADERS,
	DO_CHECK2D,
	DO_SPECPARS,
	NO_BLOCKPARS,
	NO_PHASEFILE
     )) {
      ABORT;
  }

  if(strlen(argv[0]) > 4 && argv[0][4] == 'N') {
     normInt = 1;
  } else if(strlen(argv[0]) > 3 && argv[0][3] == 'N') {
     normInt = 1;
  }

  if ((groups = getregions(resets)) == 0) {
	ABORT;
  }

  min=mnumxpnts; 
  for (i = 1; i <= groups; i++) {
    if(gb[i].lowlimit <= 0 || gb[i].highlimit <= 0
	|| gb[i].lowlimit >= (mnumxpnts-xcharpixels)
	|| gb[i].highlimit >= (mnumxpnts-xcharpixels)) continue;
    if((gb[i].highlimit-gb[i].lowlimit) < min) 
	min = gb[i].highlimit-gb[i].lowlimit;
  }
  if(min != 0 && min < 3*xcharpixels) ysize = 3; else ysize=2;
    
  if (!plot)
  {
    setwindows();
    dispcalib = (float) (mnumypnts-ymin) / (float) wc2max;
    CharSize = ycharpixels + ycharpixels / 5;

    getOptName(INTEG_MARK,name);
    set_line_thickness(name);
    getOptName(INTEG_NUM,name);
    set_graphics_font(name);
  }
  else
  { 
    double size = G_getCharSize("IntegralNum");
    charsize(size);
    //charsize((double)0.7);
    dispcalib = ppmm / ymultiplier;
    CharSize = ycharpixels;
  }

  if (showPlotBox()) dpir_off=0.0;
  else dpir_off=9.0;

  if(dispcalib>0) {
    int size= 12;
    G_getSize("IntegralNum", &size);
    i = (int)(vp*dispcalib); 
    if (vertflag && i < 4*size)
    {
      char cmd[64];
      i = (int)(4*size/dispcalib)+1;
      if(vertflag) sprintf(cmd,"vp=%d ds %s('vert')\n",i,argv[0]);
      else sprintf(cmd,"vp=%d ds %s\n",i,argv[0]);
      if(!plot) execString(cmd); 
      //Werrprintf("pir requires minimum vp of %d",i);
      RETURN;
    } else if (i < 3*size)
    {
      char cmd[64];
      i = (int)(3*size/dispcalib)+1;
      if(vertflag) sprintf(cmd,"vp=%d ds %s('vert')\n",i,argv[0]);
      else sprintf(cmd,"vp=%d ds %s\n",i,argv[0]);
      if(!plot) execString(cmd); 
      //Werrprintf("pir requires minimum vp of %d",i);
      RETURN;
    }
  } else {
    if (vp < 30)
    {
      char cmd[64];
      i=30;
      if(vertflag) sprintf(cmd,"vp=%d ds %s('vert')\n",i,argv[0]);
      else sprintf(cmd,"vp=%d ds %s\n",i,argv[0]);
      if(!plot) execString(cmd); 
      //Werrprintf("pir requires minimum vp of 30");
      RETURN;
    }
  }

  //color(PARAM_COLOR);
  color(INTEG_MARK_COLOR);
  if (debug1)
  {
    Wscrprintf("dispcalib= %g, dfpnt2= %d, CharSize= %d, bottom= %d\n",
        dispcalib,dfpnt2,CharSize,
        dfpnt2 - CharSize + (int) (dispcalib * (vp - dpir_off - 5.0)));
    Wscrprintf("index highlimit lowlimit below\n");
    for (i = 1; i <= groups; i++)
      Wscrprintf("%d %d %d %s\n",i,gb[i].highlimit,gb[i].lowlimit,
                  (gb[i].below) ? "true" : "false");
  }
  if(vertflag) {
    for (i = 1; i <= groups; i++) label_pirv(i);
  } else {
    for (i = 1; i <= groups; i++) label_pir(i, ysize);
  }
  if (!plot) {
      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_dpir_flag(1,cmd);
  }
  releaseAllWithId("dpir");
  endgraphics();
  disp_status("        ");
  set_graphics_font("Default");
  RETURN;
}
コード例 #4
0
ファイル: initcommon.c プロジェクト: wjlei1990/WORKFLOW
void /*FUNCTION*/ initcommon()
{
	int nerr;

	/*=====================================================================
	 * PURPOSE: Variable initialization of ALL common blocks.
	 *=====================================================================
	 * MODULE/LEVEL:  EXM/4
	 *=====================================================================
	 * GLOBAL INPUT:
	 *    MACH:    KWSNGL, KWMULT, KWCONC
	 *    MEM:     MMEM, MEPSL
	 *    CSF:     KTOKDL, NTOKDL, KMSGDL, NMSGDL
	 *=====================================================================
	 * GLOBAL OUTPUT:
	 *    MEM:     SACMEM
	 *=====================================================================
	 * MODIFICATION HISTORY:
	 *    920414:  Moved block data initialization to initsac as a new
	 *             procedure, initblkdata, while portint to IBM RISC 6000.
	 *    920410:  Added nlevelsgt data initialization after taking it out
	 *             of getvlist and getvlist2, moving common to inc/vars.
	 *
	 *    920309:  Added include dload and initialization of global nfiles.
	 *    920330:  Added block data initialization of common variables.
	 *             Added include gem, dfm, cnv, vars. Added initialization 
	 *             of ndsflcnt - files in data-set storage.
	 *    911107:  Added nerr check and exti on initcomlists.
	 *    900405:  Added call to INITCONTATTR.
	 *    900305:  Added call to INIXYZ.
	 *    880520:  Fixed bug in call to endgraphics.
	 *    870527:  Deleted call to INIWVT.
	 *    870513:  Deleted call to INIOFM.
	 *    870317:  Added call to INIICM.
	 *    870301:  Added call to create global variable store.
	 *    860407:  Added call to INIAM.
	 *    860327:  Added call to INIWVT.
	 *             Moved call to DELIMS from INISAC to here.
	 *    860218:  Added call to WILDCH.
	 *    830309:  Added call to end graphics library.
	 *    810514:  Added call to INISNF
	 *    810414:  Original version.
	 *=====================================================================
	 * DOCUMENTED/REVIEWED:  900305
	 *===================================================================== */
	/* PROCEDURE: */
	/* - Terminate graphics library. */
	endgraphics( &nerr );

	/* - SAC's common blocks. */

	inibom();
	inicom();
	inicpf();
	inidfm();
	inieam();
	iniexm();
	inifks();
	inigem();
	inigam();
	inihdr();
	inilhf();
	inisam();
	iniscm();
	inispe();
	initok();
	inisss();
	iniuom();
	initcomlists( &nerr );
	if( nerr == 901 )
		exit(1);
	initsite();
	inismm();
	inibbs();
	iniicm();
	inivars();
	inixyz();
	initcontattr();

	/* - SACMEM array manager. */

	iniam( &cmmem );

	/* - Blackboard store. */

	createbbs( &nerr );
	reperr(nerr);
	sac_report_files_in_memory(&nerr);

	/* - Initialize wildcard patterns with system values. */

	wildch( KWSNGL, KWMULT, KWCONC );

       
	return;

} /* end of function */
コード例 #5
0
ファイル: dpf.c プロジェクト: DanIverson/OpenVnmrJ
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;
}