本文整理汇总了C++中requestdoc函数的典型用法代码示例。如果您正苦于以下问题:C++ requestdoc函数的具体用法?C++ requestdoc怎么用?C++ requestdoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了requestdoc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
int i;
char *srcfile;
char *datfile;
float b,e,k,a;
int nv; float *v;
/* Initialize */
initargs(argc, argv);
requestdoc(1);
/* Get parameters */
if (!getparstring("src", &srcfile)) err("must specify src= source file");
if (!getparstring("dat", &datfile)) err("must specify dat= data file");
if (!getparfloat("b", &b)) b=-INFINITY;
if (!getparfloat("e", &e)) e=INFINITY;
if (!getparfloat("k", &k)) k=0.01;
if (!getparfloat("a", &a)) a=0;
if ((nv=countparval("v"))) {
v=malloc(nv*sizeof(float));
getparfloat("v",v);
}
/* Print out parameters */
printf("src=%s dat=%s b=%f e=%f k=%f a=%f v=",srcfile,datfile,b,e,k,a);
for (i=0;i<nv;i++) printf("%f,",v[i]);
printf("\n");
return 0;
}
开发者ID:taotaokai,项目名称:libgetpar,代码行数:32,代码来源:test.c
示例2: main
int
main(int argc, char **argv)
{
int ns; /* samples on output traces */
/* Initialize */
initargs(argc, argv);
requestdoc(1);
/* Get info from first trace */
if (!fvgettr(stdin, &tr)) err("can't get first trace");
if (!getparint("ns", &ns)) ns = tr.ns;
checkpars();
/* Loop over the traces */
do {
int nt = tr.ns;
if (nt < ns) /* pad with zeros */
memset((void *)(tr.data + nt), 0, (ns-nt)*FSIZE);
tr.ns = ns;
puttr(&tr);
} while (fvgettr(stdin, &tr));
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:29,代码来源:suvlength.c
示例3: main
int
main(int argc, char **argv)
{
FILE *fp;
int fd,j=0,verbose;
initargs(argc,argv);
requestdoc(1);
if(!getparint("fd",&fd)) fd=-1;
if(!getparint("verbose",&verbose)) verbose=0;
warn("File descriptor passed to suget = %d",fd);
if( (fp = (FILE *) fdopen(fd,"r"))==NULL) err("Bad file descriptor");
warn("About to read first trace");
if(!fgettr(fp,&tr)) err("Can't get first trace");
do{
if(verbose>0){
warn("read trace %d",j);
j++;
}
puttr(&tr);
} while(fgettr(fp,&tr));
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:28,代码来源:suget.c
示例4: main
int
main(int argc, char **argv)
{
/* Initialize */
initargs(argc, argv);
requestdoc(1);
while (gettr(&tr)) {
tr.f1 = 0.0;
tr.d1 = 0.0;
tr.f2 = 0.0;
tr.d2 = 0.0;
tr.ungpow = 0.0;
tr.unscale = 0.0;
tr.ntr = 0;
tr.mark = 0;
puttr(&tr);
}
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:25,代码来源:segyclean.c
示例5: main
int
main(int argc, char **argv)
{
float *f;
int n1;
void *wpc1;
int i;
initargs(argc,argv);
requestdoc(1);
wpc1 = wpc1Read(stdin);
n1 = wpc1Numsmp(wpc1);
if(n1< 0) fprintf(stderr, "Inconsistent data, n=%d\n", n1);
f = alloc1float(n1);
i = 0;
while(i >= 0 /*TRUE*/){
if(!wpc1Uncompress(wpc1, f)){
fprintf(stderr, "Inconsistent data, trace # %d\n", i);
break;
}
i++;
fwrite(f, sizeof(float), n1, stdout);
if((wpc1 = wpc1Read(stdin)) == NULL) break;
}
return EXIT_SUCCESS;
}
开发者ID:JOravetz,项目名称:SeisUnix,代码行数:32,代码来源:wpc1uncomp2.c
示例6: main
int
main(int argc, char **argv)
{
/* Segy data constans */
int ntr=0; /* number of traces */
char *outpar=NULL; /* name of file holding output */
FILE *outparfp=stdout; /* ... its file pointer */
initargs(argc, argv);
requestdoc(1);
/* Get information from the first header */
if (!gettr(&tr)) err("can't get first trace");
if (!getparstring("outpar", &outpar)) outpar = "/dev/stdout" ;
outparfp = efopen(outpar, "w");
checkpars();
/* Loop over traces getting a count */
do {
++ntr;
} while(gettr(&tr));
fprintf(outparfp, "%d", ntr);
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:28,代码来源:sutrcount.c
示例7: main
int
main(int argc, char **argv)
{
cwp_String key1, key2; /* x and y key header words */
Value val1, val2; /* ... their values */
cwp_String type1, type2;/* ... their types */
int index1, index2; /* ... their indices in hdr.h */
float x, y; /* temps to hold current x & y */
cwp_String outpar; /* name of par file */
register int npairs; /* number of pairs found */
/* Hook up getpars */
initargs(argc, argv);
requestdoc(1);
/* Prevent byte codes from spilling to screen */
if (isatty(STDOUT)) err("must redirect or pipe binary output");
/* Get parameters */
if (!getparstring("key1", &key1)) key1 = "sx";
if (!getparstring("key2", &key2)) key2 = "gx";
type1 = hdtype(key1);
type2 = hdtype(key2);
index1 = getindex(key1);
index2 = getindex(key2);
/* Loop over traces */
npairs = 0;
while(gettr(&tr)) {
gethval(&tr, index1, &val1);
gethval(&tr, index2, &val2);
x = vtof(type1, val1);
y = vtof(type2, val2);
efwrite(&x, FSIZE, 1, stdout);
efwrite(&y, FSIZE, 1, stdout);
++npairs;
}
/* Make parfile if needed */
if (getparstring("outpar", &outpar))
fprintf(efopen(outpar, "w"),
"n=%d label1=%s label2=%s\n",
npairs, key1, key2);
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:57,代码来源:suchart.c
示例8: main
int
main(int argc, char **argv)
{
int i, j, n;
float *f, max, step, rstep;
float fhist[1024], dev, rdev, ent, error;
int hist[1024];
initargs(argc, argv);
requestdoc(1);
MUSTGETPARINT("n",&n);
f = alloc1float(n);
fread(f,sizeof(float),n,stdin);
for(i=0;i<1024;i++) hist[i] = 0;
for(i=0,rdev=0.;i<n;i++)
rdev += f[i]*f[i];
rdev = rdev/n;
rdev = sqrt(rdev);
if(!getparfloat("dev",&dev)) dev = rdev;
fprintf(stderr,"dev=%f\n", dev);
step = dev*3.464*.01;
rstep = 1./step;
error = 0.;
for(i=0;i<n;i++){
max = f[i]*rstep;
error += (NINT(max)*step - f[i])*(NINT(max)*step - f[i]);
hist[NINT(max)+512] ++;
}
error = error/n;
error = sqrt(error);
error = error/rdev;
ent = 0.;
for(j=0;j<1024;j++){
fhist[j] = ((float) hist[j])/((float) n);
if(hist[j])
ent += fhist[j]*log(fhist[j])/log(2.);
}
ent = -ent;
fprintf(stderr,"entropy of the signal is=%f, average error=%f\n",ent, error);
fwrite(fhist,sizeof(float),1024,stdout);
return EXIT_SUCCESS;
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:57,代码来源:entropy.c
示例9: main
int
main(int argc, char **argv)
{
int i; /* counter */
int itr=0; /* trace counter */
int verbose; /* =0 silent, =1 chatty */
int interp; /* =1 interpolate to get NaN */
/* and Inf replacement values */
float value; /* value to set NaN and Infs to */
/* Initialize */
initargs(argc,argv);
requestdoc(1);
/* Get info from first trace */
if(!gettr(&tr) ) err("Can't get first trace \n");
/* Get parameters */
if(!getparint("verbose",&verbose)) verbose = 1;
if(!getparint("interp",&interp)) interp = 0;
if(!getparfloat("value",&value)) value = 0.0;
checkpars();
/* Loop over traces */
do{
++itr;
for(i=0; i<tr.ns; ++i){
if(!isfinite(tr.data[i])) {
if (verbose)
warn("found NaN trace = %d sample = %d", itr, i);
if (interp) { /* interpolate nearest neighbors */
/* for NaN replacement value */
if (i==0 && isfinite(tr.data[i+1])) {
tr.data[i]=tr.data[i+1];
} else if(i==tr.ns-1 && isfinite(tr.data[i-2])) {
tr.data[i]= tr.data[i-2];
} else if( isfinite(tr.data[i-1]) &&
isfinite(tr.data[i+1]) ) {
tr.data[i]=(tr.data[i-1]+tr.data[i+1])/2.0;
}
}
/* use user defined NaNs replacement value */
tr.data[i] = value;
}
}
puttr(&tr);
} while(gettr(&tr));
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:55,代码来源:sunan.c
示例10: main
int
main(int argc, char **argv)
{
float fz[BUFSIZ];
int iz=0,jz,nz=0;
unsigned int z[BUFSIZ];
char line[BUFSIZ],*lp, *outpar;
FILE *infp=stdin,*outfp=stdout, *outparfp;
unsigned int *uz = &(z[0]);
/* Hook up getpar */
initargs(argc, argv);
requestdoc(1);
/* Prevent floats from dumping on screen */
switch(filestat(STDOUT)) {
case BADFILETYPE:
warn("stdout is illegal filetype");
pagedoc();
break;
case TTY:
warn("stdout can't be tty");
pagedoc();
break;
default: /* rest are OK */
break;
}
/* Get parameters and do set up */
if (!getparstring("outpar", &outpar)) outpar = "/dev/tty" ;
outparfp = efopen(outpar, "w");
while (fgets(line,BUFSIZ,infp)!=NULL) {
/* set pointer to beginning of line */
lp = line;
/* read hex digits from input line */
for(iz=0;sscanf(lp,"%2x",&uz[iz])==1;iz++,nz++,lp+=2);
/* convert to floats */
for(jz=0;jz<iz;jz++)
fz[jz] = 255-z[jz];
/* write floats */
fwrite(fz,sizeof(float),iz,outfp);
}
/* Make par file */
fprintf(outparfp, "total number of values=%d\n",nz);
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:55,代码来源:h2b.c
示例11: main
int
main(int argc, char **argv)
{
int nt; /* number of samples on input */
int ntout; /* number of samples on output */
int it; /* counter */
int istart; /* beginning sample */
int izero; /* - istart */
int norm; /* user defined normalization value */
int sym; /* symmetric plot? */
float scale; /* scale factor computed from norm */
float *temp=NULL; /* temporary array */
float dt; /* time sampling interval (sec) */
/* hook up getpar */
initargs(argc, argv);
requestdoc(1);
/* get information from the first header */
if (!gettr(&tr)) err("can't get first trace");
nt = tr.ns;
dt = tr.dt/1000000.0;
/* get parameters */
if (!getparint("ntout",&ntout)) ntout=101;
if (!getparint("norm",&norm)) norm = 1;
if (!getparint("sym",&sym)) sym = 1;
checkpars();
/* allocate workspace */
temp = ealloc1float(ntout);
/* index of first sample */
if (sym == 0) istart = 0;
else istart = -(ntout-1)/2;
/* index of sample at time zero */
izero = -istart;
/* loop over traces */
do {
xcor(nt,0,tr.data,nt,0,tr.data,ntout,istart,temp);
if (norm) {
scale = 1.0/(temp[izero]==0.0?1.0:temp[izero]);
for (it=0; it<ntout; ++it) temp[it] *= scale;
}
memcpy((void *) tr.data, (const void *) temp, ntout*FSIZE);
tr.ns = ntout;
tr.f1 = -dt*ntout/2.0;
tr.delrt = 0;
puttr(&tr);
} while(gettr(&tr));
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:55,代码来源:suacor.c
示例12: main
main(int argc, char **argv)
{
initargs(argc, argv);
requestdoc(1);
while (gettr(&tr)) {
tr.offset = abs(tr.offset);
puttr(&tr);
}
return EXIT_SUCCESS;
}
开发者ID:gganssle,项目名称:stripper,代码行数:12,代码来源:fgettr.c
示例13: main
int
main(int argc, char **argv)
{
double sx, sy, gx, gy, factor;
float mx, my;
short unit;
int degree;
cwp_String outpar;
register int npairs;
/* Initialize */
initargs(argc, argv);
requestdoc(1);
if (!getparint("degree", °ree)) degree=0;
npairs = 0;
while (gettr(&tr)) {
sx = tr.sx;
sy = tr.sy;
gx = tr.gx;
gy = tr.gy;
unit = tr.counit;
/* If tr.scalco not set, use 1 as the value */
factor = (!tr.scalco) ? 1 : tr.scalco;
/* factor < 0 means divide; factor > 0 means to multiply */
if (factor < 0) factor = -1/factor;
/* if necessary, convert from seconds to degrees */
if (unit == 2 && degree == 1) factor /= 3600;
mx = (float) (0.5*(sx + gx) * factor);
my = (float) (0.5*(sy + gy) * factor);
efwrite(&mx, FSIZE, 1, stdout);
efwrite(&my, FSIZE, 1, stdout);
++npairs;
}
/* Make parfile if needed */
if (getparstring("outpar", &outpar))
fprintf(efopen(outpar, "w"), "n=%d\n", npairs);
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:52,代码来源:su3dchart.c
示例14: main
int main( int argc, char *argv[] )
{
/* binning */
float xc;
float yc;
double cdpcx;
double cdpcy;
float dbx;
float dby;
float deg;
float degr;
int dirx;
int diry;
int nx;
int ny;
float xe;
float ye;
int ix;
int iy;
initargs(argc, argv);
requestdoc(1);
/* binning stuff */
if(!getparfloat("xc",&xc)) xc=1;
if(!getparfloat("yc",&yc)) yc=1;
if(!getparfloat("dbx",&dbx)) dbx=20;
if(!getparfloat("dby",&dby)) dby=20;
if(!getparfloat("deg",°)) deg=0;
degr = 3.141592653/180 * deg;
if(!getparint("dirx",&dirx)) dirx=1;
if(!getparint("diry",&diry)) diry=1;
MUSTGETPARINT("nx", &nx);
MUSTGETPARINT("ny", &ny);
/* edge of bin# 1,1 */
xe = xc - dirx*dbx/2.0*cos(degr) - diry*dby/2.0*sin(degr);
ye = yc - diry*dby/2.0*cos(degr) + dirx*dbx/2.0*sin(degr);
/* compute bin centre coordinates */
for(ix=1;ix<=nx; ix++) {
for(iy=1;iy<=ny;iy++) {
cdpcx= xc + dirx*(ix-1)*dbx*cos(degr) +
diry*(iy-1)*dby*sin(degr);
cdpcy= yc + diry*(iy-1)*dby*cos(degr) -
dirx*(ix-1)*dbx*sin(degr);
fprintf(stdout," %d %f %f\n",
ix*1000+iy,cdpcx,cdpcy);
}
}
return EXIT_SUCCESS;
}
开发者ID:JOravetz,项目名称:SeisUnix,代码行数:52,代码来源:subins.c
示例15: main
int
main(int argc, char **argv)
{
int itmin; /* smallest sample (zero-based) to plot */
int itmax; /* largest sample (zero-based) to plot */
int nt; /* number of samples */
int count; /* number of traces to plot */
register int itr; /* trace counter */
cwp_Bool plotall; /* plot all the traces */
/* Initialize */
initargs(argc, argv);
requestdoc(1);
/* Set number of traces to plot */
plotall = cwp_false;
if (!getparint("count", &count)) plotall = cwp_true;
/* Loop over traces */
for (itr = 0; (plotall || itr < count) && gettr(&tr); itr++) {
nt = (int) tr.ns; /* Cast from unsigned */
if (itr == 0) { /* Awkward to do a gettr outside loop */
if (!getparint("itmin", &itmin)) itmin = 0;
if (!getparint("itmax", &itmax)) itmax = nt - 1;
if (itmin >= nt - 1 || itmin < 0) {
err("itmin=%d, require 0 < itmin < %d",
itmin, nt - 1);
}
if (itmax >= nt) {
itmax = nt - 1;
}
if (itmax < 0) {
err("itmax=%d, require itmax > 0", itmax);
}
if (itmin > itmax) {
itmin = itmax;
}
}
printheader(&tr);
tabplot(&tr, itmin, itmax);
}
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:52,代码来源:sutab.c
示例16: main
int
main(int argc, char **argv)
{
int nt; /* number of time samples */
int ntr; /* number of traces */
int itr; /* trace counter */
int nspk; /* number of spikes */
int it1; /* time of 1st spike */
int ix1; /* position of 1st spike */
int it2; /* time of 2nd spike */
int ix2; /* position of 2nd spike */
int ix3; /* position of 3rd spike */
int it3; /* time of 3rd spike */
int ix4; /* position of 4th spike */
int it4; /* time of 4th spike */
float dt; /* time sampling interval */
float offset; /* offset */
/* Initialize */
initargs(argc, argv);
requestdoc(0); /* stdin not used */
nt = 64; getparint("nt", &nt);
CHECK_NT("nt",nt); tr.ns = nt;
ntr = 32; getparint("ntr", &ntr);
dt = 0.004; getparfloat("dt", &dt); tr.dt = dt*1000000;
offset = 400; getparfloat("offset", &offset); tr.offset = offset;
nspk = 4; getparint("nspk", &nspk);
ix1 = ntr/4; getparint("ix1", &ix1);
it1 = nt/4; getparint("it1", &it1);
ix2 = ntr/4; getparint("ix2", &ix2);
it2 = 3*nt/4; getparint("it2", &it2);
ix3 = 3*ntr/4; getparint("ix3", &ix3);
it3 = nt/4; getparint("it3", &it3);
ix4 = 3*ntr/4; getparint("ix4", &ix4);
it4 = 3*nt/4; getparint("it4", &it4);
for (itr = 0; itr < ntr; itr++) {
memset( (void *) tr.data, 0, nt * FSIZE);
if (itr == ix1-1) tr.data[it1-1] = 1.0;
if (nspk > 1 && itr == ix2-1) tr.data[it2-1] = 1.0;
if (nspk > 2 && itr == ix3-1) tr.data[it3-1] = 1.0;
if (nspk > 3 && itr == ix4-1) tr.data[it4-1] = 1.0;
tr.tracl = itr + 1;
puttr(&tr);
}
return(CWP_Exit());
}
开发者ID:JohnWStockwellJr,项目名称:SeisUnix,代码行数:52,代码来源:suspike.c
示例17: main
int main( int argc, char *argv[] )
{
/* Segy data constans */
int nt; /* number of time samples */
int ntr=0; /* number of traces */
float *filter;
int fnl,fnr;
int fnp;
int fld;
int fm;
float dt; /* sample interval in secs */
float prw; /* pre-withening */
initargs(argc, argv);
requestdoc(1);
/* get information from the first header */
if (!gettr(&tr)) err("can't get first trace");
nt = tr.ns;
if (!getparfloat("dt", &dt)) dt = ((double) tr.dt)/1000000.0;
if (!dt) {
dt = .002;
warn("dt not set, assumed to be .002");
}
if(!getparint ("fnl", &fnl)) fnl=15;
fnr=fnl;
if(!getparint ("fnp", &fnp)) fnp=fnr+fnl+fnr/2;
if(!getparfloat ("prw", &prw)) prw=1.0;
if(fnl!=0) {
fld=0; fm=0; fnr=fnl;
filter = ealloc1float(fnp);
SG_smoothing_filter(fnp,fnl,fnr,fld,fm,filter);
/* rwa_smoothing_filter(1,fnl,fnr,filter); */
} else {
filter= NULL;
}
do {
do_minphdec(tr.data,nt,filter,fnl,fnr,prw);
tr.ns=nt;
ntr++;
puttr(&tr);
} while(gettr(&tr));
return EXIT_SUCCESS;
}
开发者ID:JOravetz,项目名称:SeisUnix,代码行数:51,代码来源:suminphdec_sub2.c
示例18: main
int
main(int argc, char **argv)
{
char *outpar; /* name of file holding output parfile */
FILE *outparfp; /* ... its file pointer */
int n1; /* number of floats per line */
size_t n1read; /* number of items read */
size_t n2 = 0; /* number of lines in input file */
float *z; /* binary floats */
/* Hook up getpar */
initargs(argc, argv);
requestdoc(1);
/* Get parameters and do set up */
if (!getparstring("outpar", &outpar)) outpar = "/dev/tty" ;
outparfp = efopen(outpar, "w");
MUSTGETPARINT("n1",&n1);
z = ealloc1float(n1);
/* Loop over data converting to ascii */
while ((n1read = efread(z, FSIZE, n1, stdin))) {
register int i1;
if (n1read != n1)
err("out of data in forming line #%d", n2+1);
for (i1 = 0; i1 < n1; ++i1)
/* z2xyz.c:70: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘size_t’ */
/* printf("%d %d %11.4e \n",n2,i1,z[i1]); */
#if __WORDSIZE == 64
printf("%lu %d %11.4e \n",n2,i1,z[i1]);
#else
printf("%u %d %11.4e \n",n2,i1,z[i1]);
#endif
++n2;
}
/* Make par file */
/* z2xyz.c:76: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’ */
/* fprintf(outparfp, "n2=%d\n", n2); */
#if __WORDSIZE == 64
fprintf(outparfp, "n2=%lu\n", n2);
#else
fprintf(outparfp, "n2=%u\n", n2);
#endif
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:50,代码来源:z2xyz.c
示例19: main
int
main(int argc, char **argv)
{
int nt,nshot,noff;
int ishot,ioff,it;
float dt,dshot,doff,sx,gx,offset,cmp;
/* Initialize */
initargs(argc, argv);
requestdoc(0); /* stdin not used */
nt = 100; getparint("nt", &nt);
CHECK_NT("nt",nt); tr.ns = nt;
nshot = 10; getparint("nshot", &nshot);
noff = 24; getparint("noff", &noff);
dt = 0.004; getparfloat("dt", &dt); tr.dt = dt*1000000;
dshot = 10; getparfloat("dshot", &dshot);
doff = 20; getparfloat("doff", &doff);
for (ishot = 0; ishot < nshot; ishot++) {
sx = ishot*dshot;
for (ioff = 0; ioff < noff; ioff++) {
offset = (ioff+1)*doff;
gx = sx + offset;
cmp = (sx + gx)/2.;
memset( (void *) tr.data, 0, nt * FSIZE);
for (it = 0; it < nt/4; it++) {
tr.data[it] = sx;
}
for (it = nt/4; it < nt/2; it++) {
tr.data[it] = gx;
}
for (it = nt/2; it < 3*nt/4; it++) {
tr.data[it] = offset;
}
for (it = 3*nt/4; it < nt; it++) {
tr.data[it] = cmp;
}
tr.sx = sx;
tr.gx = gx;
tr.offset = offset;
tr.cdp = cmp;
tr.tracl = ishot*nshot + ioff + 1;
puttr(&tr);
}
}
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:50,代码来源:susorty.c
示例20: main
int
main (int argc, char **argv)
{
int n1,n2,i2;
float f1,f2,d1,d2,*x;
char *label2="Trace",label[256];
FILE *infp=stdin,*outfp=stdout;
/* hook up getpar to handle the parameters */
initargs(argc,argv);
requestdoc(0);
/* get optional parameters */
if (!getparint("n1",&n1)) {
if (efseeko(infp,(off_t) 0,SEEK_END)==-1)
err("input file size is unknown; specify n1!\n");
if ((n1=((int) (eftello(infp)/((off_t) sizeof(float)))))<=0)
err("input file size is unknown; specify n1!\n");
efseeko(infp,(off_t) 0,SEEK_SET);
}
if (!getparfloat("d1",&d1)) d1 = 1.0;
if (!getparfloat("f1",&f1)) f1 = d1;
if (!getparint("n2",&n2)) n2 = -1;
if (!getparfloat("d2",&d2)) d2 = 1.0;
if (!getparfloat("f2",&f2)) f2 = d2;
getparstring("label2",&label2);
/* allocate space */
x = ealloc1float(n1);
/* loop over 2nd dimension */
for (i2=0; i2<n2 || n2<0; i2++) {
/* read input array, watching for end of file */
if (efread(x,sizeof(float),n1,infp)!=n1) break;
/* make plot label */
sprintf(label,"%s %0.4g",label2,f2+i2*d2);
/* plot the array */
prp1d(outfp,label,n1,d1,f1,x);
}
return(CWP_Exit());
}
开发者ID:gwowen,项目名称:seismicunix,代码行数:46,代码来源:prplot.c
注:本文中的requestdoc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论