#include #include #define FORM1a "%8d\n" #define FORM1b "%8d %s\n" #define FORM2 "%s\n" #define FORM3 " %11.4e %11.4e 0 0 0.00\n" #define FORM4a "%8d %8.5f %11.4e\n" #define TRUE 1 #define FALSE 0 char form[32] = "(7e14.5)"; char comment1[80]; main(ac,av) int ac; char **av; { int nt, nx, comm1, perline, nread, i, j, cnt, left, f_width; float offset=0.0, t0=0.0; float dt, mul, *pv, *vec; char c_form[512]; setpar(ac,av); mstpar("nt","d",&nt); mstpar("dt","f",&dt); if (getpar("ntr","d",&nx) == 0) getpar("nx","d",&nx); getpar("mul","f",&mul); if (getpar("format","s",form)) { fprintf(stderr,"mkHelm: input format: %s\n",form); perline = chkform(form,c_form,&f_width); fprintf(stderr," format used: %s\n",form); } else perline = chkform(form,c_form,&f_width); comm1 = getpar("comment1","s",comment1); getpar("offset","f",&offset); getpar("starttime","f",&t0); endpar(); vec = (float *) malloc(4*nt); /* write initial header */ if (comm1) fprintf(stdout,FORM1b,nx,comment1); else fprintf(stdout,FORM1a,nx); fprintf(stdout,FORM2,form); fprintf(stdout,FORM3,offset,t0); fprintf(stdout,FORM4a,nt,dt,mul); /* write data */ if ((nread = read(0,vec,4*nt)) != 4*nt) { fprintf(stderr,"mkHelm: Read error, only %d bytes\n",nread); exit(-1); } cnt = nt / perline; left = nt % perline; pv = vec; for (i=0;i