#include #include #include #include /* #define DEBUG 1 */ #if HP || IBM #define jdbopen_ jdbopen #define jdbreada_ jdbreada #define jdbread_ jdbread #define jdbclose_ jdbclose #define jdbcomments_ jdbcomments #define jdblevel_ jdblevel #define jdbattributes_ jdbattributes #endif #define NVALS 250 static int nnames=0; static int nrow=0; static char names[NVALS][40]; static int namelen=40; struct rowpntr { float *vals; struct rowpntr *next; } *rows; static int lpntr[11],maxlevel; double *yp; static double nan; static int unit; static int nanflag; int getnames(s) char *s; { nnames= -NVALS; maxlevel=jdbopen_(&unit,s,names,&namelen,&nnames); return maxlevel; } int getdata() { static int i,lev,nr; struct rowpntr *rp,*rpo; float *v,*vo; rows=(struct rowpntr *)malloc(sizeof(rows)); rows->vals=(float *)malloc(nnames*sizeof(float)); rp=rows; v=rp->vals; nr=0; while((lev=jdbread_(&unit,v))>=0){ nr++; rp->next=(struct rowpntr *)malloc(sizeof(rows)); rp=rp->next; rp->vals=(float *)malloc(nnames*sizeof(float)); vo=v; v=rp->vals; for(i=0;inext=(struct rowpntr *)malloc(sizeof(rows)); rp=rp->next; rp->vals=(float *)malloc(nnames*sizeof(float)); for(i=0;ivals; for(i=0;ivals[k]; /* if(y == -9999.99) printf("NaN\n"); else printf("%g\n",y); */ if(y <= -9999) y=nan; fwrite(&y,1,sizeof(double),stdout); rp=rp->next; } } }