tfmacros.h 1.9 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
6
/* this is <tfmacros.h>
 * 
 * this file contains some frequently used preprocessor macros
 *
 * 23/4/1997   Thomas Forbriger
 *
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * ----
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ----
 *
thomas.forbriger's avatar
thomas.forbriger committed
23
24
25
26
27
 */

#ifndef _TF_TFMACROS_H
#define _TF_TFMACROS_H

28
29
#warning "tfmacros.h is deprecated and will disappear in the future"

thomas.forbriger's avatar
thomas.forbriger committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* #include <stdlib.h> */

/*
 * macros
 */

#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif

#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif

#ifndef CHECKERROR
#define CHECKERROR( EXPR , SUB, STR )\
  if ( EXPR ) { fprintf(stderr, "ERROR (%s):\n   %s\n", SUB, STR );\
  exit(EXIT_FAILURE); }
#endif

#ifndef RETURNERROR
#define RETURNERROR( EXPR , SUB, STR, CODE )\
  if ( EXPR ) { fprintf(stderr, "ERROR (%s):\n   %s\n", SUB, STR );\
  return(CODE); }
#endif

#ifndef FRETURNERROR
#define FRETURNERROR( EXPR , SUB, STR, FILENAME, CODE )\
  if ( EXPR ) { fprintf(stderr, "ERROR (%s %s):\n   %s\n", \
    SUB, FILENAME, STR );\
  return(CODE); }
#endif

#ifndef CHECKWARNING
#define CHECKWARNING( EXPR , SUB, STR )\
  if ( EXPR ) { fprintf(stderr, "WARNING (%s):\n   %s\n", SUB, STR ); }
#endif

#ifndef SETFREE
#define SETFREE( PTR ) \
  if (PTR!=NULL) { free(PTR); PTR=NULL; }
#endif

#endif /* _TF_TFMACROS_H */

/***** END OF tfmacros.h *****/