/************************************************************************* * *N query_table * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function returns the set of selected rows of a VPF table * based upon the evaluation of the given selection expression string. * * The expression is strictly evaluated left to right. No nesting * is supported, so parentheses are not allowed. The expression * must match the form: * <field><log op><value> [ <join> <field><log op><value>] * where, * <field> is a valid field name of the table. * <log op> is one of the following: =, <, >, <=, >=, <> (not equal). * <value> is a valid value for the field. * <join> is either " AND " or " OR ". * Any number of clauses (<field><log op><value>) may be joined * together with AND or OR to form the expression. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * expression <input>==(char *) selection expression string. * table <input>==(vpf_table_type) VPF table structure. * return <output>==(set_type) set of selected rows. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels May 1991 DOS Turbo C *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * External Variables: *X * None *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Functions Called: *F * set_type set_init( rspf_int32 n ) SET.C * void set_insert( rspf_int32 element, set_type set ) SET.C * linked_list_type parse_expression( char *expression, * vpf_table_type table ) VPFQUERY.C * row_type read_next_row( vpf_table_type table ) VPFREAD.C * position_type ll_first( linked_list_type list ) LINKLIST.C * int ll_end( position_type position ) LINKLIST.C * void ll_element( position_type position, void *element ) LINKLIST.C * void *get_table_element( rspf_int32 field_number, * row_type row, * vpf_table_type table, * void *value, * rspf_int32 *count ) VPFREAD.C * void display_message( char *info ) USER DEFINED * static int strcompare( char *val1, char *val2, char op ) VPFQUERY.C * static int icompare( rspf_int32 val1, rspf_int32 val2, char op ) VPFQUERY.C * static int fcompare( float val1, float val2, char op ) VPFQUERY.C * void ll_reset( linked_list_type list ) LINKLIST.C void free_row( row_type row, vpf_table_type table) VPFREAD.C *E *************************************************************************/ set_type query_table( char *expression, vpf_table_type table ) { row_type row; position_type pos; expr_type expr; register rspf_int32 i; int boolval=FALSE, booltemp=0, join = OR; rspf_int32 lval, lval2, count; float fval, fval2; char tval, tval2, *tptr; linked_list_type exprlist; set_type select_set; select_set = set_init(table.nrows+1); if (strcmp(expression,"*")==0) { set_on(select_set); return select_set; } exprlist = parse_expression( expression, table ); if (!exprlist) return select_set; if (table.storage == DISK) fseek( table.fp, index_pos(1,table), SEEK_SET ); for (i=1;i<=table.nrows;i++) { if (table.storage == DISK) row = read_next_row(table); else row = get_row( i, table ); pos = ll_first(exprlist); while (!ll_end(pos)) { ll_element( pos, &expr ); switch (table.header[expr.field].type) { case 'I': if (table.header[expr.field].count == 1) { get_table_element( expr.field, row, table, &lval, &count ); lval2 = atol(expr.value); booltemp = icompare( lval, lval2, expr.op ); } else { display_message( "Selection may not be performed upon arrays"); i=table.nrows+1; } break; case 'T': if (table.header[expr.field].count == 1) { get_table_element( expr.field, row, table, &tval, &count ); tval2 = expr.value[0]; booltemp = comp( &tval, &tval2, sizeof(tval), expr.op ); } else { tptr = (char *)get_table_element( expr.field, row, table, NULL, &count ); booltemp = strcompare( tptr, expr.value, expr.op ); free(tptr); } break; case 'F': if (table.header[expr.field].count == 1) { get_table_element( expr.field, row, table, &fval, &count ); if (!is_vpf_null_float(fval)) { fval2 = (float)atof(expr.value); booltemp = fcompare( fval, fval2, expr.op ); } else booltemp = FALSE; } else { display_message( "Selection may not be performed upon arrays"); i=table.nrows+3; } break; default: display_message("Field type not supported for query"); i=table.nrows+3; break; } if (i>table.nrows) break; if (join==OR) boolval = boolval || booltemp; else boolval = boolval && booltemp; join = expr.join; pos = pos->next; } free_row( row, table ); if (boolval) set_insert(i,select_set); boolval = FALSE; join = OR; if (i==table.nrows+3) break; } ll_reset(exprlist); return select_set; }
bool ossimVpfBoundingRecordTable::openTable(const ossimFilename& tableName) { bool result = false; theExtent = ossimVpfExtent(0,0,0,0); bool firstOneSetFlag = false; if(ossimVpfTable::openTable(tableName)) { ossim_int32 xminIdx = getColumnPosition("XMIN"); ossim_int32 yminIdx = getColumnPosition("YMIN"); ossim_int32 xmaxIdx = getColumnPosition("XMAX"); ossim_int32 ymaxIdx = getColumnPosition("YMAX"); if((xminIdx < 0)|| (yminIdx < 0)|| (xmaxIdx < 0)|| (ymaxIdx < 0)) { closeTable(); } else { if(getNumberOfRows() > 0) { result = true; reset(); ossim_int32 n = 1; ossim_float32 xmin; ossim_float32 ymin; ossim_float32 xmax; ossim_float32 ymax; row_type row; for(int rowIdx = 1; rowIdx < getNumberOfRows(); ++rowIdx) { if(rowIdx == 1) { row = read_row(rowIdx, *theTableInformation); } else { row = read_next_row(*theTableInformation); } get_table_element(xminIdx, row, *theTableInformation, &xmin, &n); get_table_element(yminIdx, row, *theTableInformation, &ymin, &n); get_table_element(xmaxIdx, row, *theTableInformation, &xmax, &n); get_table_element(ymaxIdx, row, *theTableInformation, &ymax, &n); if(!is_vpf_null_float(xmin)&& !is_vpf_null_float(ymin)&& !is_vpf_null_float(xmax)&& !is_vpf_null_float(ymax)) { if(!firstOneSetFlag) { theExtent = ossimVpfExtent(xmin, ymin, xmax, ymax); firstOneSetFlag = true; } else { theExtent = theExtent + ossimVpfExtent(xmin, ymin, xmax, ymax); } } free_row(row, *theTableInformation); } } } } return result; }
ossimString ossimVpfTable::getColumnValueAsString(row_type& row, long columnNumber)const { ossimString result; ossim_int32 n=1; switch(theTableInformation->header[columnNumber].type) { case 'T': // it's of type text so { char c; char *buf = (char *)get_table_element(columnNumber, row, *theTableInformation, &c, &n); if(buf) { result = buf; free(buf); } else { result = c; } break; } case 'I': { ossim_int32 value; ossim_int32* v = (ossim_int32*)get_table_element(columnNumber, row, *theTableInformation, &value, &n); if(v) { result = ossimString::toString(v[0]); free(v); } else { result = ossimString::toString(value); } break; } case 'S': { short int value; short int* v = (short int*)get_table_element(columnNumber, row, *theTableInformation, &value, &n); if(v) { result = ossimString::toString(v[0]); free(v); } else { result = ossimString::toString(value); } break; } case 'F': { float value; float* v = (float*)get_table_element(columnNumber, row, *theTableInformation, &value, &n); if(v) { value = v[0]; free(v); } if (!is_vpf_null_float(value)) { result = ossimString::toString(value); } else { result = "nan"; } break; } case 'B': { double value; double* tempBuf = (double*)get_table_element(columnNumber, row, *theTableInformation, &value, &n); if(tempBuf) { value = tempBuf[0]; free(tempBuf); } if (!is_vpf_null_double(value)) { result = ossimString::toString(value); } else { result = "nan"; } break; } case 'C': { coordinate_type coordType; coordinate_type* temp = (coordinate_type*)get_table_element(columnNumber, row, *theTableInformation, &coordType, &n); if(temp) { coordType = temp[0]; free(temp); } result = ossimString::toString(coordType.x)+ ossimString(" ") + ossimString::toString(coordType.y); break; } case 'K': { id_triplet_type idTripletType; id_triplet_type* tempType = (id_triplet_type*)get_table_element(columnNumber, row, *theTableInformation, &idTripletType, &n); if(tempType) { idTripletType = tempType[0]; free (tempType); } result = ossimString(idTripletType.type) + ossimString(" ") + ossimString::toString(static_cast<ossim_int32>(idTripletType.id)) + ossimString(" ") + ossimString::toString(static_cast<ossim_int32>(idTripletType.tile))+ ossimString(" ") + ossimString::toString(static_cast<ossim_int32>(idTripletType.exid)); break; } case 'D': { date_type date, formatDate; date_type* temp = (date_type*)get_table_element(columnNumber, row, *theTableInformation, &date, &n); if(temp) { free(temp); } format_date(date, formatDate); result = formatDate; break; } case 'Z': // tri coordinate types x, y, z { tri_coordinate_type *tcptr=NULL; tcptr = (tri_coordinate_type *) get_table_element(columnNumber,row, *theTableInformation, NULL,&n); result = ""; for (int k=0;k<n;k++) { result = result + " (" + ossimString::toString(tcptr[k].x) + ossimString(" ") + ossimString::toString(tcptr[k].y) + ossimString(" ") + ossimString::toString(tcptr[k].z) + ossimString(") ") ; } if (tcptr) { free(tcptr); } break; } } result.trim(); return result; }
void ossimVpfTable::print(std::ostream& out)const { if(theTableInformation && (theTableInformation->status!=CLOSED)) { // make sure we are at the beginning of the table. this->reset(); // the rest of this code is from the vpfutil. The vpfutil // was grabbed from the vhcl map server software. vpf_table_type& table = *theTableInformation; ossim_int32 i,j,k,n; ossim_int16 ival=0,*iptr=NULL; ossim_int32 lval=0,*lptr=NULL; ossim_float32 fval=0,*fptr=NULL; date_type dval,*dptr=NULL; id_triplet_type kval={0,0,0}, *kptr=NULL; coordinate_type cval={0,0}, *cptr=NULL; char *buf, ch, date[40]; row_type row; out << "table name: " << theTableName << std::endl << "desciption: " << table.description << std::endl << std::endl; out << "Definition:" << std::endl; for (i=0;i<table.nfields;i++) { if (table.header[i].count < 0) { out << table.header[i].name << " (" << table.header[i].type << ",*) " << table.header[i].description << std::endl; } else { out << table.header[i].name << " (" << table.header[i].type << "," << table.header[i].count << ") " << table.header[i].description << std::endl; } } out << "\nContents:" << std::endl; for (i=1;i<=table.nrows;i++) { row = read_next_row(table); for (j=0;j<table.nfields;j++) { out << table.header[j].name << ": "; switch (table.header[j].type) { case 'T': if (table.header[j].count==1) { get_table_element(j,row,table,&ch,&n); out << ch << std::endl; } else { buf = (char *)get_table_element(j,row,table,NULL,&n); n = (long)strlen(table.header[j].name) + 2; for (k=0;k<(long)strlen(buf);k++) { out << buf[k]; n++; if (n>80) { out << std::endl; n = 0; } } out << std::endl; free(buf); } break; case 'I': // long if (table.header[j].count==1) { get_table_element(j,row,table,&lval,&n); if (!is_vpf_null_float(lval)) { out << lval << std::endl; } else { out << "null" << std::endl; } } else { lptr = (ossim_int32*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { if (!is_vpf_null_float(lptr[k])) { out << lptr[k]; } else { out << "null"; } } out << std::endl; free(lptr); } break; case 'R': // for double { double *dptr=NULL; double value = 0; if (table.header[j].count==1) { get_table_element(j,row,table,&value,&n); if(!is_vpf_null_double(value)) { out << "null" << std::endl; } else { out << value << std::endl; } } else { dptr = (double*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { if (!is_vpf_null_double(dptr[k])) { out << dptr[k]; } else { out << "null "; } } out << std::endl; free(dptr); } } case 'S': // integer if (table.header[j].count==1) { get_table_element(j,row,table,&ival,&n); if (ival != (short int)INT_MAX) { out << ival << std::endl; } else { out << "null" << std::endl; } } else { iptr = (short int*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { if (iptr[k] != (short int)INT_MAX) { out << iptr[k]; } else { out << "null "; } } out << std::endl; free(iptr); } break; case 'F': // float type if (table.header[j].count==1) { get_table_element(j,row,table,&fval,&n); if (!is_vpf_null_float(fval)) { out << fval << std::endl; } else { out << "null" << std::endl; } } else { fptr = (float*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { if (!is_vpf_null_float(fptr[k])) { out << fptr[k] << " "; } else { out << "null "; } } out << std::endl; free(fptr); } break; case 'Y': { double_tri_coordinate_type dtctValue, *dtctPtr; if (table.header[j].count==1) { get_table_element(j,row,table,&dtctValue,&n); out << "("; if(is_vpf_null_double(dtctValue.x)) { out << "null, "; } else { out << dtctValue.x << ", "; } if(is_vpf_null_double(dtctValue.y)) { out << "null, "; } else { out << dtctValue.y << ", "; } if(is_vpf_null_double(dtctValue.z)) { out << "null, "; } else { out << dtctValue.z << ", "; } } else { dtctPtr = (double_tri_coordinate_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { out << "("; if(is_vpf_null_double(dtctPtr[k].x)) { out << "null, "; } else { out << dtctPtr[k].x << ", "; } if(is_vpf_null_double(dtctPtr[k].y)) { out << "null, "; } else { out << dtctPtr[k].y << ", "; } if(is_vpf_null_double(dtctPtr[k].z)) { out << "null, "; } else { out << dtctPtr[k].z << ", "; } } free(dtctPtr); } break; } case 'Z': // tri coordinate types x, y, z { tri_coordinate_type tcval={0,0,0}, *tcptr=NULL; if (table.header[j].count==1) { get_table_element(j,row,table,&tcval,&n); out << "("; if(is_vpf_null_float(tcval.x)) { out << "null" << ","; } else { out << tcval.x << ", "; } if(is_vpf_null_float(tcval.y)) { out << "null" << ", "; } else { out << tcval.y << ", "; } if(is_vpf_null_float(tcval.z)) { out << "null)" << std::endl; } else { out << tcval.z << ")" << std::endl; } } else { tcptr = (tri_coordinate_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { out << "("; if(is_vpf_null_float(tcptr[k].x)) { out << "null, "; } else { out << tcptr[k].x << ", "; } if(is_vpf_null_float(tcptr[k].y)) { out << "null, "; } else { out << tcptr[k].y << ", "; } if(is_vpf_null_float(tcptr[k].z)) { out << "null)"; } else { out << tcptr[k].z << ")"; } } out << std::endl; free(tcptr); } break; } case 'C': // coordinate type x, y if (table.header[j].count==1) { get_table_element(j,row,table,&cval,&n); out << "("; if(is_vpf_null_float(cval.x)) { out << "null, "; } else { out << cval.x << ", "; } if(is_vpf_null_float(cval.y)) { out << "null, "; } else { out << cval.y << ")"; } } else { cptr = (coordinate_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { out << "(" << cptr[k].x << "," << cptr[k].y << ") "; } out << std::endl; free(cptr); } break; case 'B': // double coordinate type { double_coordinate_type dct, *dctPtr; if (table.header[j].count==1) { get_table_element(j,row,table,&dct,&n); out << "("; if(is_vpf_null_double(dct.x)) { out << "null, "; } else { out << dct.x << ", "; } if(is_vpf_null_double(dct.y)) { out << "null, "; } else { out << dct.y << ")"; } } else { dctPtr = (double_coordinate_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { out << "("; if(is_vpf_null_double(dctPtr[k].x)) { out << "null,"; } else { out << dctPtr[k].x << ", "; } if(is_vpf_null_double(dctPtr[k].y)) { out << "null,"; } else { out << dctPtr[k].y << ", "; } } out << std::endl; free(dctPtr); } } case 'K': //id triplet if (table.header[j].count==1) { get_table_element(j,row,table,&kval,&n); out << "(" << kval.id << ", " << kval.tile << ", " << kval.exid << ")" << std::endl; } else { kptr = (id_triplet_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { out << "(" << kptr[k].id << ", " << kptr[k].tile << ", " << kptr[k].exid << ") " << std::endl; } out << std::endl; free(kptr); } break; case 'D': /* Date */ if (table.header[j].count==1) { get_table_element(j,row,table,&dval,&n); format_date(dval,date); out << date << std::endl; } else { dptr = (date_type*)get_table_element(j,row,table,NULL,&n); for (k=0;k<n;k++) { format_date((char*)(&dptr[k]),date); out << dptr[k] << " "; } out << std::endl; free(dptr); } break; } } out << std::endl; free_row( row, table ); } } }
/************************************************************************* * *N vpf_display_record * *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Purpose: *P * This function displays all of the fields of a particular VPF * record, including the descriptions of the fields and their * values. It accesses the online data dictionary metadata * contained in the specified Value Description Tables. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * Parameters: *A * row <input> == (row_type) vpf table row structure. * table <input> == (vpf_table_type) vpf table. * fp <input> == (FILE *) pointer to the output file. *E *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * History: *H * Barry Michaels Sept 1991 DOS Turbo C *E *************************************************************************/ void vpf_display_record( row_type row, vpf_table_type table, FILE *fp ) { register int i,j; char *buf,*num, path[128], *tablename; char *attr,*val,*descr, vdtpath[128], fmtdate[40]; vpf_table_type vdt; row_type vdtrow; int found; ossim_int32 l, lval, count, *lptr; short int s,sval,*sptr; float f,*fptr; date_type date; int TABLE_ = 1, ATTR_ = 2, VAL_ = 3, DESCR_ = 4; num = (char *)vpfmalloc(20*sizeof(char)); strcpy( vdtpath, "" ); /* Display all secondary attributes */ for (i=0;i<table.nfields;i++) { switch (table.header[i].type) { case 'T': buf = (char *)get_table_element(i,row,table, NULL,&count); rightjust(buf); if (strcmp( buf, "" ) != 0) { fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": ",fp); fputs(buf,fp); strcpy( path, table.path ); strcat( path, table.header[i].vdt ); if ( (access(path,4)==0) && (strcmp(table.header[i].vdt,"") != 0) ) { if (strcmp(vdtpath,path) != 0) { if (strcmp(vdtpath,"") != 0) { vpf_close_table(&vdt); } vdt = vpf_open_table( path, disk, "rb", NULL ); } strcpy( vdtpath, path ); for (j=1;j<=vdt.nrows;j++) { vdtrow = read_row( j, vdt ); tablename = (char *)get_table_element( TABLE_, vdtrow, vdt, NULL, &count ); rightjust(tablename); strupr2(tablename); attr = (char *)get_table_element( ATTR_, vdtrow, vdt, NULL, &count ); rightjust(attr); val = (char *)get_table_element( VAL_, vdtrow, vdt, NULL, &count ); rightjust(val); found = FALSE; if ( (strstr(table.name,tablename)) && (ossim_strcasecmp(attr,table.header[i].name)==0) && (ossim_strcasecmp(val,buf)==0) ) { descr = (char *)get_table_element(DESCR_,vdtrow,vdt, NULL, &count); rightjust(descr); fputs(" (",fp); fputs(descr,fp); fputs(")",fp); free(descr); found = TRUE; } free(tablename); free(attr); free(val); free_row( vdtrow, vdt ); if (found) break; } } fputc('\n',fp); } free(buf); break; case 'I': if (table.header[i].count==1) { get_table_element(i,row,table,&l,&count); if (l != NULLINT) { fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": ",fp); ltoa((int)l,num,10); fputs(num,fp); strcpy( path, table.path ); strcat( path, table.header[i].vdt ); if ( (access(path,4)==0) && (strcmp(table.header[i].vdt,"") != 0) ) { if (strcmp(vdtpath,path) != 0) { if (strcmp(vdtpath,"") != 0) { vpf_close_table(&vdt); } vdt = vpf_open_table( path, disk, "rb", NULL ); } strcpy( vdtpath, path ); for (j=1;j<=vdt.nrows;j++) { vdtrow = read_row( j, vdt ); tablename = (char *)get_table_element( TABLE_, vdtrow, vdt, NULL, &count ); rightjust(tablename); strupr2(tablename); attr = (char *)get_table_element( ATTR_, vdtrow, vdt, NULL, &count ); rightjust(attr); get_table_element( VAL_, vdtrow, vdt, &lval, &count ); found = FALSE; if ( (strstr(table.name,tablename)) && (ossim_strcasecmp(attr,table.header[i].name)==0) && (lval==l) ) { descr = (char *)get_table_element(DESCR_,vdtrow, vdt, NULL, &count); rightjust(descr); fputs(" (",fp); fputs(descr,fp); fputs(")",fp); free(descr); found = TRUE; } free(tablename); free(attr); free_row( vdtrow, vdt ); if (found) break; } } fputc('\n',fp); } } else { get_table_element(i,row,table,&lptr,&count); fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": (",fp); for (j=0;j<count;j++) { ltoa((int)lptr[j],num,10); fputs(num,fp); if (j<count-1) fputs(", ",fp); } fputs(")\n",fp); } break; case 'S': if (table.header[i].count==1) { get_table_element(i,row,table,&s,&count); if (s != NULLSHORT) { fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": ",fp); itoa(s,num,10); fputs(num,fp); strcpy( path, table.path ); strcat( path, table.header[i].vdt ); if ( (access(path,4)==0) && (strcmp(table.header[i].vdt,"") != 0) ) { if (strcmp(vdtpath,path) != 0) { if (strcmp(vdtpath,"") != 0) { vpf_close_table(&vdt); } vdt = vpf_open_table( path, disk, "rb", NULL ); } strcpy( vdtpath, path ); for (j=1;j<=vdt.nrows;j++) { vdtrow = read_row( j, vdt ); tablename = (char *)get_table_element( TABLE_, vdtrow, vdt, NULL, &count ); rightjust(tablename); strupr2(tablename); attr = (char *)get_table_element( ATTR_, vdtrow, vdt, NULL, &count ); rightjust(attr); get_table_element( VAL_, vdtrow, vdt, &sval, &count ); found = FALSE; if ( (strstr(table.name,tablename)) && (ossim_strcasecmp(attr,table.header[i].name)==0) && (sval==s) ) { descr = (char *)get_table_element(DESCR_,vdtrow, vdt, NULL, &count); rightjust(descr); fputs(" (",fp); fputs(descr,fp); fputs(")",fp); free(descr); found = TRUE; } free(tablename); free(attr); free_row( vdtrow, vdt ); if (found) break; } } fputc('\n',fp); } } else { get_table_element(i,row,table,&sptr,&count); fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": (",fp); for (j=0;j<count;j++) { itoa(sptr[j],num,10); fputs(num,fp); if (j<count-1) fputs(", ",fp); } fputs(")\n",fp); } break; case 'F': if (table.header[i].count==1) { get_table_element(i,row,table,&f,&count); if (!is_vpf_null_float(f)) { fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": ",fp); #if !defined(__APPLE__) && !defined(__FreeBSD__) gcvt(f,6,num); #endif fputs(num,fp); fputc('\n',fp); } } else { get_table_element(i,row,table,&fptr,&count); fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": (",fp); for (j=0;j<count;j++) { if (is_vpf_null_float(fptr[j])) { fputs("(null)",fp); } else { #if !defined(__APPLE__) && !defined(__FreeBSD__) gcvt(fptr[j],6,num); #endif fputs(num,fp); } if (j<count-1) fputs(", ",fp); } fputs(")\n",fp); } break; case 'D': if (table.header[i].count==1) { get_table_element(i,row,table,date,&count); fputs(table.header[i].name,fp); fputs(" - ",fp); fputs(table.header[i].description,fp); fputs(": ",fp); format_date(date,fmtdate); fputs(fmtdate,fp); fputc('\n',fp); } break; } } if (strcmp(vdtpath,"") != 0) vpf_close_table( &vdt ); free(num); }