/*************************************************************** CHECKDBF.C Functions that simplify common CODAS access calls from C. Header: use_db.h Library: use_db_x.lib ****************************************************************/ #include "geninc.h" /* DB*() */ /*************************************************************** Note: DBGET and DBGET_F will return ierr as INVALID_TYPE_REQUEST (not multiplied by 1000) if a request is made for profile data (ID from 0-99) of a type that is not in the data list. To the user, this is functionally the same as the situation in which the data type is in the data list, but zero bytes are stored. Therefore the two functions check_dbget_f and check_db_get trap this error and convert it to a return of zero bytes. */ unsigned int check_dbget_f(int type, float *x, unsigned int n, char *err_msg) { int ierr; DBGET_F(&type, x, &n, &ierr); if (ierr == INVALID_TYPE_REQUEST) return(0); if (DBERROR(&ierr, err_msg)) exit(-1); return(n); }