_generic.h

Go to the documentation of this file.
00001 /*  _________________________________________________________________________
00002  *
00003  *  UTILIB: A utility library for developing portable C++ codes.
00004  *  Copyright (c) 2001, Sandia National Laboratories.
00005  *  This software is distributed under the GNU Lesser General Public License.
00006  *  For more information, see the README file in the top UTILIB directory.
00007  *  _________________________________________________________________________
00008  */
00009 
00016 #ifdef CPLANT
00017 #if defined(__cplusplus) && defined(ANSI_HDRS)
00018 #include <cstdio>
00019 #else
00020 #include <stdio.h>
00021 #endif
00022 #endif
00023 
00024 #ifndef _GENERIC_H
00025 #ifdef _GNUG_
00026 #pragma once
00027 #endif
00028 #define _GENERIC_H
00029 
00030 #include <sys/types.h>
00031 
00037 #define PAUSE() fflush(stdout); while(fgetc(stdin) == EOF);
00038 
00039 
00040 /*
00041  *
00042  * generic defines
00043  *
00044  */
00050 #ifndef BUF_SIZE
00051 #define BUF_SIZE        256
00052 #endif
00053 
00058 #ifndef ERR
00059 #define ERR             -999
00060 #endif
00061 
00066 #ifndef OK
00067 #define OK              0
00068 #endif
00069 
00074 #ifndef TRUE
00075 #define TRUE            1
00076 #endif
00077 
00082 #ifndef FALSE
00083 #define FALSE           0
00084 #endif
00085 
00090 #ifndef ON
00091 #define ON              1
00092 #endif
00093 
00098 #ifndef OFF
00099 #define OFF             0
00100 #endif
00101 
00106 #ifndef YES
00107 #define YES             1
00108 #endif
00109 
00114 #ifndef NO
00115 #define NO              0
00116 #endif
00117 
00122 #ifdef NULL
00123 #undef NULL             /* Always override the definition of NULL */
00124 #endif
00125 #define NULL            0
00126 
00131 #ifndef EOF
00132 #define EOF             (-1)
00133 #endif
00134 
00135 #ifdef DEBUG                    /* Debug defines to see if conflicts exist */
00136 #define TRUE    1
00137 #define FALSE   0
00138 #define OK      0
00139 #define ON      1
00140 #define OFF     0
00141 #define YES     1
00142 #define NO      0
00143 #define NULL    0
00144 #define EOF     (-1)
00145 #define ERR     -999
00146 #endif
00147 
00148 
00149 #if !defined(__STDC__) && !defined(__cplusplus)
00150 
00155 #ifndef _SIZE_T
00156 #define _SIZE_T
00157 typedef unsigned size_t;
00158 #endif
00159 #else 
00160 #if defined(__cplusplus) && defined(ANSI_HDRS)
00161 #include <cstddef>
00162 #else
00163 #include <stddef.h>
00164 #endif
00165 #endif
00166 
00171 #ifndef VOID
00172 typedef char VOID;
00173 #endif
00174 
00180 #if defined(__STDC__) || defined(__cplusplus)
00181 #define _(args) args
00182 #else
00183 #define _(args) ()
00184 #endif
00185 
00191 #ifndef _ENUMDATAOWNED_
00192 #define _ENUMDATAOWNED_
00193 enum EnumDataOwned
00194 {
00195   DataNotOwned=0,       
00196   AcquireOwnership=1,   
00197   AssumeOwnership=2     
00198 };
00199 #endif
00200 
00206 #ifndef ORDERSENSE
00207 #define ORDERSENSE
00208 enum OrderSense
00209 {
00210   increasing=1, 
00211   decreasing=-1, 
00212   minimal=1,
00213   maximal=-1
00214 };
00215 #endif
00216 
00222 typedef size_t size_type;
00223 
00224 #endif