Scippy

SCIP

Solving Constraint Integer Programs

xmldef.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2016 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file xmldef.h
17  * @brief definitions for XML parsing
18  * @author Thorsten Koch
19  * @author Marc Pfetsch
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_XMLDEF_H__
25 #define __SCIP_XMLDEF_H__
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 #ifndef XML_Bool
33 #define XML_Bool unsigned int /**< type used for boolean values */
34 #endif
35 
36 #ifndef TRUE
37 #define TRUE 1 /**< boolean value TRUE */
38 #define FALSE 0 /**< boolean value FALSE */
39 #endif
40 
41 
42 #ifdef WITH_ZLIB
43 #include <zlib.h>
44 
45 #define FOPEN(file, mode) gzopen(file, mode)
46 #define FCLOSE(fp) gzclose(fp)
47 #define FGETS(buf, len, fp) gzgets(fp, buf, len)
48 #define FREAD(buf, len, fp) gzread(fp, buf, len)
49 #define FPTYPE gzFile
50 #else
51 #define FOPEN(file, mode) fopen(file, mode)
52 #define FCLOSE(fp) fclose(fp)
53 #define FGETS(buf, len, fp) fgets(buf, len, fp)
54 #define FREAD(buf, len, fp) fread(buf, 1, len, fp)
55 #define FPTYPE FILE*
56 #endif /* WITH_ZLIB */
57 
58 
59 #ifndef ALLOC_ABORT
60 #define ALLOC_ABORT(x) do \
61  { \
62  if( NULL == (x) ) \
63  { \
64  printf("[%s:%d] No memory in function call\n", __FILE__, __LINE__); \
65  abort(); \
66  } \
67  } \
68  while( FALSE )
69 #endif
70 
71 #ifndef ALLOC_FALSE
72 #define ALLOC_FALSE(x) do \
73  { \
74  if( NULL == (x) ) \
75  { \
76  printf("[%s:%d] No memory in function call\n", __FILE__, __LINE__); \
77  return FALSE; \
78  } \
79  } \
80  while( FALSE )
81 #endif
82 
83 #ifdef XML_DEBUG
84 #define debug(x) x
85 #define debugMessage printf("[%s:%d] debug: ", __FILE__, __LINE__); printf
86 #define debugPrintf printf
87 #else
88 #define debug(x) /**/
89 #define debugMessage while( FALSE ) printf
90 #define debugPrintf while( FALSE ) printf
91 #endif
92 
93 #ifndef infoMessage
94 #define infoMessage printf
95 #endif
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif