src/genmacros.h File Reference

Defines useful macros for all programs in the package. More...

Go to the source code of this file.

Defines

#define retype_arraycp(to_t, to, from, size)
 use type conversion to another (possibly) type, copy one array to another
#define NC_STATUS_CHECK(f)
 handles the status of netcdf functions. It prints an appropriate message if a function would fail and quit with the status
#define message(...)
 message from the program (with the program name in it)
#define fatal(errcode,...)
 Fatal error message macro used for error messaging and program emergency exit.
#define warning(...)
 Warning message with debug info. No emergency exit.


Detailed Description

Defines useful macros for all programs in the package.


Define Documentation

#define fatal ( errcode,
...   ) 

Value:

{                                                                     \
    fprintf( stderr, __FILE__ ":%d\n", __LINE__ );                      \
    fprintf( stderr, "    Error %d (" PROGRAM_NAME_BRIEF                \
             ") at function %s:\n", errcode, __func__ );                \
    fprintf( stderr, "    " __VA_ARGS__ );                              \
    fprintf( stderr, "\n" );                                            \
    exit( errcode );                                                    \
  }
Fatal error message macro used for error messaging and program emergency exit.

Parameters:
[in] errcode integer with the code number
[in] ... Any input to the printf function.
Example of usage:

    if ( x == 0 )
      fatal ( 1, "Division by zero" );
    else if ( x == 1 )
      fatal ( 2, "Wrong value of x (%d)", x );

Referenced by mfft_ibm_double(), mfft_ibm_float(), and readdata_alloc().

#define message ( ...   ) 

Value:

{                                                        \
    printf( "(" PROGRAM_NAME_BRIEF ") " __VA_ARGS__ );     \
    printf( "\n" );                                        \
  }
message from the program (with the program name in it)

Referenced by main(), mfft_fftw(), and mfft_ibm_float().

#define NC_STATUS_CHECK (  ) 

Value:

{                                                                     \
    int status = (f);                                                   \
    if ( status != NC_NOERR )                                           \
      {                                                                 \
        fprintf( stderr, __FILE__ ":%d, netCDF API: ", __LINE__);       \
        fprintf( stderr, "%s\n", nc_strerror( status ) );               \
        exit( status );                                                 \
      }                                                                 \
  }
handles the status of netcdf functions. It prints an appropriate message if a function would fail and quit with the status

#define retype_arraycp ( to_t,
to,
from,
size   ) 

Value:

{                                                                     \
    for( size_t _k = 0; _k < (size); ++_k ) (to)[_k] = (to_t) (from)[_k]; \
  }
use type conversion to another (possibly) type, copy one array to another

Parameters:
[in] to_t new type of elements
[out] to destination array
[in] from source array
[in] size the size of arrays

#define warning ( ...   ) 

Value:

{                                                                     \
    fprintf( stderr, __FILE__ ":%d\n", __LINE__ );                      \
    fprintf( stderr, "    Warning (" PROGRAM_NAME_BRIEF                 \
             ") at function %s:\n", __func__ );                         \
    fprintf( stderr, "    " __VA_ARGS__ );                              \
    fprintf( stderr, "\n" );                                            \
  }
Warning message with debug info. No emergency exit.

Parameters:
[in] ... Any input to the printf function.


Generated on Fri Jun 12 16:41:37 2009 for slowsum by  doxygen 1.5.7.1