00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __DEFS_H
00019 #define __DEFS_H
00020
00021 #include <stddef.h>
00022 #include <math.h>
00023
00024
00025 #define OMNETPP_VERSION 0x0303
00026
00027
00028 #ifndef __WIN32__
00029 # if defined(_WIN32) || defined(WIN32)
00030 # define __WIN32__
00031 # endif
00032 #endif
00033
00034
00035 #if defined(__WIN32__)
00036 # define OPP_DLLEXPORT __declspec(dllexport)
00037 # if defined(WIN32_DLL)
00038 # define OPP_DLLIMPORT __declspec(dllimport)
00039 # else
00040 # define OPP_DLLIMPORT
00041 # endif
00042 #else
00043 # define OPP_DLLIMPORT
00044 # define OPP_DLLEXPORT
00045 #endif
00046
00047
00048 #ifdef BUILDING_SIM
00049 # define SIM_API OPP_DLLEXPORT
00050 #else
00051 # define SIM_API OPP_DLLIMPORT
00052 #endif
00053
00054
00055 #ifdef BUILDING_ENVIR
00056 # define ENVIR_API OPP_DLLEXPORT
00057 #else
00058 # define ENVIR_API OPP_DLLIMPORT
00059 #endif
00060
00061
00062
00063 #ifndef NULL
00064 #define NULL ((void*)0)
00065 #endif
00066
00067
00068
00069 #define MAX_CLASSNAME 100
00070 #define MAX_OBJECTFULLPATH 1024
00071 #define MAX_OBJECTINFO 500
00072
00073
00074 #define FULLPATHBUF_SIZE MAX_OBJECTFULLPATH
00075
00076
00077 #ifdef _MSC_VER
00078 #pragma warning(disable:4996)
00079 #endif
00080
00081
00082
00083 #ifndef PI
00084 #define PI 3.141592653589793
00085 #endif
00086
00087 #ifndef Min
00088 #define Min(a,b) ( (a)<(b) ? (a) : (b) )
00089 #define Max(a,b) ( (a)>(b) ? (a) : (b) )
00090 #endif
00091
00092 #define sgn(x) ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
00093
00094
00095 #ifdef __GNUC__
00096 # if __GNUC__<3
00097 # error gcc 3.x required -- please upgrade
00098 # endif
00099 #endif
00100
00101 #ifndef NDEBUG
00102 #define ASSERT(expr) \
00103 ((void) ((expr) ? 0 : \
00104 (opp_error("ASSERT: condition %s false, %s line %d", \
00105 #expr, __FILE__, __LINE__), 0)))
00106 #else
00107 #define ASSERT(expr) ((void)0)
00108 #endif
00109
00110
00114 typedef double simtime_t;
00115
00116 #define MAXTIME HUGE_VAL
00117
00118
00119
00120
00121
00122
00128 typedef void (*VoidDelFunc)(void *);
00129
00135 typedef void *(*VoidDupFunc)(void *);
00136
00137
00138
00139
00140
00146 typedef double (*MathFunc)(...);
00147
00153 typedef double (*MathFuncNoArg)();
00154
00160 typedef double (*MathFunc1Arg)(double);
00161
00167 typedef double (*MathFunc2Args)(double,double);
00168
00174 typedef double (*MathFunc3Args)(double,double,double);
00175
00181 typedef double (*MathFunc4Args)(double,double,double,double);
00182
00183 #endif
00184