00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __DEFS_H
00021 #define __DEFS_H
00022
00023 #include <stddef.h>
00024 #include <math.h>
00025
00026
00027 #define OMNETPP_VERSION 0x0202
00028
00029
00030 #ifndef __WIN32__
00031 # if defined(_WIN32) || defined(WIN32)
00032 # define __WIN32__
00033 # endif
00034 #endif
00035
00036
00037 #if defined(__WIN32__) && defined(WIN32_DLL)
00038 # define OPP_DLLIMPORT __declspec(dllimport)
00039 # define OPP_DLLEXPORT __declspec(dllexport)
00040 #else
00041 # define OPP_DLLIMPORT
00042 # define OPP_DLLEXPORT
00043 #endif
00044
00045
00046 #ifdef BUILDING_SIM
00047 # define SIM_API OPP_DLLEXPORT
00048 #else
00049 # define SIM_API OPP_DLLIMPORT
00050 #endif
00051
00052
00053 #ifdef BUILDING_ENVIR
00054 # define ENVIR_API OPP_DLLEXPORT
00055 #else
00056 # define ENVIR_API OPP_DLLIMPORT
00057 #endif
00058
00059
00060
00061 #ifndef NULL
00062 #define NULL ((void*)0)
00063 #endif
00064
00065 #define NO(cXX) ((cXX *)NULL)
00066
00067
00068
00069
00070 #ifndef TRUE
00071 #define TRUE true
00072 #define FALSE false
00073 #endif
00074
00076
00077
00078
00079
00080
00081
00082 #ifndef PI
00083 #define PI 3.141592653589793
00084 #endif
00085
00086 #ifndef Min
00087 #define Min(a,b) ( (a)<(b) ? (a) : (b) )
00088 #define Max(a,b) ( (a)>(b) ? (a) : (b) )
00089 #endif
00090
00091 #define sgn(x) ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
00092
00093 #ifndef NDEBUG
00094 #define ASSERT(expr) \
00095 ((void) ((expr) ? 0 : \
00096 (opp_error("ASSERT: condition %s false, %s line %d", \
00097 #expr, __FILE__, __LINE__), 0)))
00098 #else
00099 #define ASSERT(expr) ((void)0)
00100 #endif
00101
00102
00103
00104 typedef double simtime_t;
00105 #define MAXTIME HUGE_VAL
00106
00107
00108 #define isA() className()
00109
00110 #define insertHead(a) insert(a)
00111 #define peekTail() tail()
00112 #define peekHead() head()
00113 #define getTail() pop()
00114
00115
00116
00117
00118
00124 typedef void (*VoidDelFunc)(void *);
00125
00131 typedef void *(*VoidDupFunc)(void *);
00132
00133
00134
00140 typedef double (*MathFunc)(...);
00141
00147 typedef double (*MathFuncNoArg)();
00148
00154 typedef double (*MathFunc1Arg)(double);
00155
00161 typedef double (*MathFunc2Args)(double,double);
00162
00168 typedef double (*MathFunc3Args)(double,double,double);
00169
00170 #endif
00171