common.h

Go to the documentation of this file.
00001 /*
00002  * common.h: this file is part of the FM project.
00003  * 
00004  * FM, a fast and optimized C implementation of Fourier-Motzkin 
00005  * projection algorithm.
00006  * 
00007  * Copyright (C) 2006-2008 Louis-Noel Pouchet
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * as published by the Free Software Foundation; either version 3
00012  * of the License, or (at your option) any later version.
00013  * 
00014  * The complete GNU Lesser General Public Licence Notice can be found
00015  *  as the `COPYING.LESSER' file in the root directory.
00016  * 
00017  * Author:
00018  * Louis-Noel Pouchet <Louis-Noel.Pouchet@inria.fr>
00019  * 
00020  */
00021 #ifndef FM_COMMON_H
00022 # define FM_COMMON_H
00023 
00024 # if HAVE_CONFIG_H
00025 #  include <config.h>
00026 # endif
00027 
00028 # include <stdio.h>
00029 # include <sys/types.h>
00030 
00031 # if STDC_HEADERS
00032 #  include <stdlib.h>
00033 #  include <string.h>
00034 # elif HAVE_STRINGS_H
00035 #  include <strings.h>
00036 # endif /*STDC_HEADERS*/
00037 
00038 # if HAVE_UNISTD_H
00039 #  include <unistd.h>
00040 # endif
00041 
00042 
00043 # ifdef __cplusplus
00044 #  define BEGIN_C_DECLS         extern "C" {
00045 #  define END_C_DECLS           }
00046 # else
00047 #  define BEGIN_C_DECLS
00048 #  define END_C_DECLS
00049 # endif
00050 
00051 
00052 # ifdef __GNUC__
00053 #  ifndef const
00054 #    define const       __const
00055 #  endif
00056 #  ifndef signed
00057 #    define signed      __signed
00058 #  endif
00059 #  ifndef volatile
00060 #    define volatile    __volatile
00061 #  endif
00062 # else
00063 #  ifdef __STDC__
00064 #    undef  signed
00065 #    define signed
00066 #    undef  volatile
00067 #    define volatile
00068 #  endif
00069 # endif
00070 
00071 # ifdef __STDC__
00072 #  define STR(x)          #x
00073 #  define CONC(x, y)      x##y
00074 # else
00075 #  define STR(x)          "x"
00076 #  define CONC(x, y)      x/**/y
00077 # endif
00078 
00079 
00080 # ifndef EXIT_SUCCESS
00081 #  define EXIT_SUCCESS  0
00082 #  define EXIT_FAILURE  1
00083 # endif
00084 
00085 
00086 # define XCALLOC(type, num)                                  \
00087         ((type *) xcalloc ((num), sizeof(type)))
00088 # define XMALLOC(type, num)                                  \
00089         ((type *) xmalloc ((num) * sizeof(type)))
00090 # define XREALLOC(type, p, num)                              \
00091         ((type *) xrealloc ((p), (num) * sizeof(type)))
00092 # define XFREE(stale)                            do {        \
00093         if (stale) { free (stale);  stale = 0; }            \
00094                                                 } while (0)
00095 
00096 # define FM_STATUS_ERROR 1
00097 # define FM_STATUS_OK    0
00098 
00099 #define FM_SIZE_BUF 5000
00100 
00101 
00102 BEGIN_C_DECLS
00103 
00104 extern void *xcalloc    (size_t num, size_t size);
00105 extern void *xmalloc    (size_t num);
00106 extern void *xrealloc   (void *p, size_t num);
00107 extern char *xstrdup    (const char *string);
00108 extern char *xstrerror  (int errnum);
00109 
00110 typedef long int z_type_t;
00111 # define Z_STRING_MODIFIER "%ld"
00112 
00113 
00114 END_C_DECLS
00115 
00116 #endif // FM_COMMON_H

Generated on Thu Oct 30 13:38:21 2008 for FM by  doxygen 1.5.3