OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
passthebuck.h
Go to the documentation of this file.
1 #ifndef _PASSTHEBUCK_H_
2 #define _PASSTHEBUCK_H_
3 
4 #define LIFE_IS_GOOD 0 /* Successful return status */
5 #define FILE_ALREADY_EXISTS 1 /* HDF output file already existed */
6 #define MEMORY_ALLOCATION_ERROR 2 /* malloc() or calloc() failed */
7 #define HDF_FUNCTION_ERROR 3 /* One of NCSA's functions complained */
8 #define PROGRAMMER_BOOBOO 4 /* Error in code logic or consistency */
9 #define CALDATA_NOT_APPENDED 5 /* Calibration data was not appended */
10 #define MISSING_ENVVAR 6 /* Environment variable not set */
11 #define STAT_FAILURE 7 /* Call to stat() function failed */
12 #define FILE_IS_EMPTY 8 /* File size is zero bytes */
13 #define FOPEN_FAILURE 9 /* Call to fopen() function failed */
14 #define FREAD_FAILURE 10 /* Call to fread() function failed */
15 
16 #define PTB(function){ \
17  int status = function; \
18  switch(status){ \
19  case LIFE_IS_GOOD: break; \
20  default: return(status); \
21  } \
22 }
23 
24 #define DPTB(function){ \
25  int status = function; \
26  switch(status){ \
27  case LIFE_IS_GOOD: break; \
28  default: printf("Programming error: file %s, line %d\n",__FILE__,__LINE__); exit(1); \
29  } \
30 }
31 
32 #endif