00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DIME_BASIC_H
00031 #define DIME_BASIC_H
00032
00033 #include <stdlib.h>
00034 #include <stdio.h>
00035 #include <stdarg.h>
00036 #include <string.h>
00037 #include <assert.h>
00038 #include <math.h>
00039
00040
00041
00042 typedef float dxfdouble;
00043
00044 #ifdef _WIN32
00045 #include "float.h"
00046 #define M_PI 3.14159265357989
00047 #endif
00048
00049 #define DXFABS(x) ((x)<0?-(x):(x))
00050 #define DXFMAX(x,y) ((x)>(y)?(x):(y))
00051 #define DXFMIN(x,y) ((x)<(y)?(x):(y))
00052 #define DXFDEG2RAD(x) (M_PI*(x)/180.0)
00053 #define DXFRAD2DEG(x) (180.0*(x)/M_PI)
00054
00055
00056 #ifdef __sgi
00057 #define bool int
00058 #define true 1
00059 #define false 0
00060 #endif // __sgi
00061
00062
00063 template <class T> inline
00064 T DXFSQR(const T x)
00065 {
00066 return x*x;
00067 }
00068
00069 #if defined(__BEOS__)
00070 #include <support/SupportDefs.h>
00071 #else // ! defined(__BEOS__)
00072 typedef signed char int8;
00073 typedef unsigned char uint8;
00074 typedef signed short int16;
00075 typedef unsigned short uint16;
00076 #ifdef _WIN32
00077 typedef long int32;
00078 #else // ! defined(_WIN32)
00079 typedef signed int int32;
00080 #endif // ! defined(_WIN32)
00081 typedef unsigned int uint32;
00082 #endif // ! defined(__BEOS__)
00083
00084 #ifdef macintosh
00085 char* strdup( const char* );
00086 #endif
00087
00088 #define ARRAY_NEW(memh, type, num) \
00089 memh ? (type*) memh->allocMem((num)*sizeof(type)) : new type[num]
00090
00091 #define DXF_STRCPY(mh, d, s) \
00092 mh ? d = mh->stringAlloc(s) : d = new char[strlen(s)+1]; if (d) strcpy(d,s)
00093
00094 typedef bool dimeCallbackFunc(const class dimeState * const, class dimeEntity *, void *);
00095 typedef dimeCallbackFunc * dimeCallback;
00096
00097 typedef union {
00098 int8 int8_data;
00099 int16 int16_data;
00100 int32 int32_data;
00101 float float_data;
00102 dxfdouble double_data;
00103 const char *string_data;
00104 const char *hex_data;
00105 } dimeParam;
00106
00107
00108
00109
00110
00111 #ifdef DIME_DLL_API
00112 # error Leave the internal DIME_DLL_API define alone.
00113 #endif
00114 #ifdef DIME_INTERNAL
00115 # ifdef DIME_NOT_DLL
00116 # error The DIME_NOT_DLL define is not supposed to be used when building the library, only when building Win32 applications.
00117 # endif
00118 # ifdef DIME_DLL
00119 # error The DIME_DLL define is not supposed to be used when building the library, only when building Win32 applications.
00120 # endif
00121 #endif
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
00155 # ifdef DIME_INTERNAL
00156 # ifdef DIME_MAKE_DLL
00157 # define DIME_DLL_API __declspec(dllexport)
00158 # endif
00159 # else
00160 # ifdef DIME_DLL
00161 # ifdef DIME_NOT_DLL
00162 # error Do not define both DIME_DLL and DIME_NOT_DLL at the same time
00163 # endif
00164 # define DIME_DLL_API __declspec(dllimport)
00165 # else
00166 # ifndef DIME_NOT_DLL
00167 # error Define either DIME_DLL or DIME_NOT_DLL as appropriate for your linkage! See dime/Basic.h for further instructions.
00168 # endif
00169 # endif
00170 # endif
00171 #endif
00172
00173
00174 #ifndef DIME_DLL_API
00175 # define DIME_DLL_API
00176 #endif
00177
00178
00179
00180 #endif // !DIME_BASIC_H