00001
00002
00003
00004
00005
00006 #ifndef CONFIG_H
00007 #define CONFIG_H
00008
00009
00010
00011 #define SIDE_EFFECT_FUNCTIONS
00012
00013 #define PLAYER_NAME_LIMIT 22
00014 #define NUM_ENV_VARS 10
00015 #define MAX_ARG 100
00016 #define MAX_GLOBAL_REGS 36
00017
00018 #define OUTPUT_BLOCK_SIZE 16384
00019
00020
00021
00022
00023
00024 #define MANDFLAGS (V_LINK|V_PARENT|V_XFLAGS|V_ZONE|V_POWERS|V_3FLAGS|V_QUOTED)
00025 #define OFLAGS (V_DATABASE|V_ATRKEY|V_ATRNAME|V_ATRMONEY)
00026
00027 #define OUTPUT_VERSION 1
00028 #ifdef MEMORY_BASED
00029 #define OUTPUT_FLAGS (MANDFLAGS)
00030 #else // MEMORY_BASED
00031 #define OUTPUT_FLAGS (MANDFLAGS|OFLAGS)
00032 #endif // MEMORY_BASED
00033
00034 #define UNLOAD_VERSION 1
00035 #define UNLOAD_FLAGS (MANDFLAGS)
00036
00037 #define MIN_SUPPORTED_VERSION 1
00038 #define MAX_SUPPORTED_VERSION 2
00039
00040
00041 #define NOT_TOKEN '!'
00042 #define AND_TOKEN '&'
00043 #define OR_TOKEN '|'
00044 #define LOOKUP_TOKEN '*'
00045 #define NUMBER_TOKEN '#'
00046 #define INDIR_TOKEN '@'
00047 #define CARRY_TOKEN '+'
00048 #define IS_TOKEN '='
00049 #define OWNER_TOKEN '$'
00050
00051
00052 #define AMATCH_CMD '$'
00053 #define AMATCH_LISTEN '^'
00054
00055
00056 #define EXIT_DELIMITER ';'
00057 #define ARG_DELIMITER '='
00058 #define ARG_LIST_DELIM ','
00059
00060
00061
00062 #define NULL_DELIM_VAR "@@"
/* This is used to indent output from pretty-printing. */
#define INDENT_STR " "
00063
00064
00065 #define OBJECT_ENDOWMENT(cost) (((cost)/mudconf.sacfactor) + mudconf.sacadjust)
00066
00067
00068 #define OBJECT_DEPOSIT(pennies) \
00069 (((pennies) - mudconf.sacadjust)* mudconf.sacfactor)
00070
00071 #ifdef WIN32
00072 #define DCL_CDECL __cdecl
00073 #define DCL_INLINE __inline
00074
00075 typedef __int64 INT64;
00076 typedef unsigned __int64 UINT64;
00077 #define INT64_MAX_VALUE 9223372036854775807i64
00078 #define INT64_MIN_VALUE (-9223372036854775807i64 - 1)
00079 #define UINT64_MAX_VALUE 0xffffffffffffffffui64
00080
00081 #define LOCALTIME_TIME_T_MIN_VALUE 0
00082 #if (_MSC_VER >= 1400)
00083
00084 #define LOCALTIME_TIME_T_MAX_VALUE 32535215999ui64
00085 #endif
00086
00087 #define SIZEOF_PATHNAME (_MAX_PATH + 1)
00088 #define SOCKET_WRITE(s,b,n,f) send(s,b,n,f)
00089 #define SOCKET_READ(s,b,n,f) recv(s,b,n,f)
00090 #define SOCKET_CLOSE(s) closesocket(s)
00091 #define IS_SOCKET_ERROR(cc) ((cc) == SOCKET_ERROR)
00092 #define IS_INVALID_SOCKET(s) ((s) == INVALID_SOCKET)
00093 #define SOCKET_LAST_ERROR (WSAGetLastError())
00094 #define SOCKET_EINTR (WSAEINTR)
00095 #define SOCKET_EWOULDBLOCK (WSAEWOULDBLOCK)
00096 #define SOCKET_EBADF (WSAEBADF)
00097 #define popen _popen
00098 #define pclose _pclose
00099
00100 #else // WIN32
00101
00102 #define DCL_CDECL
00103 #define DCL_INLINE inline
00104 #define INVALID_HANDLE_VALUE (-1)
00105 #ifndef O_BINARY
00106 #define O_BINARY 0
00107 #endif // O_BINARY
00108 typedef int HANDLE;
00109
00110 typedef long long INT64;
00111 typedef unsigned long long UINT64;
00112 #define INT64_MAX_VALUE 9223372036854775807LL
00113 #define INT64_MIN_VALUE (-9223372036854775807LL - 1)
00114 #define UINT64_MAX_VALUE 0xffffffffffffffffULL
00115
00116 typedef int SOCKET;
00117 #ifdef PATH_MAX
00118 #define SIZEOF_PATHNAME (PATH_MAX + 1)
00119 #else // PATH_MAX
00120 #define SIZEOF_PATHNAME (4095 + 1)
00121 #endif // PATH_MAX
00122 #define SOCKET_WRITE(s,b,n,f) write(s,b,n)
00123 #define SOCKET_READ(s,b,n,f) read(s,b,n)
00124 #define SOCKET_CLOSE(s) close(s)
00125 #define IS_SOCKET_ERROR(cc) ((cc) < 0)
00126 #define IS_INVALID_SOCKET(s) ((s) < 0)
00127 #define SOCKET_LAST_ERROR (errno)
00128 #define SOCKET_EINTR (EINTR)
00129 #define SOCKET_EWOULDBLOCK (EWOULDBLOCK)
00130 #ifdef EAGAIN
00131 #define SOCKET_EAGAIN (EAGAIN)
00132 #endif // EAGAIN
00133 #define SOCKET_EBADF (EBADF)
00134 #define INVALID_SOCKET (-1)
00135 #define SD_BOTH (2)
00136
00137 #endif // WIN32
00138
00139 #define isTRUE(x) ((x) != 0)
00140
00141
00142
00143
00144 #if SIZEOF_INT == 4
00145 typedef int INT32;
00146 typedef unsigned int UINT32;
00147 #ifdef CAN_UNALIGN_INT
00148 #define UNALIGNED32
00149 #endif
00150 #elif SIZEOF_LONG == 4
00151 typedef long INT32;
00152 typedef unsigned long UINT32;
00153 #ifdef CAN_UNALIGN_LONG
00154 #define UNALIGNED32
00155 #endif
00156 #elif SIZEOF_SHORT == 4
00157 typedef short INT32;
00158 typedef unsigned short UINT32;
00159 #ifdef CAN_UNALIGN_SHORT
00160 #define UNALIGNED32
00161 #endif
00162 #else
00163 typedef INT64 INT32;
00164 typedef UINT64 UINT32;
00165 #ifdef CAN_UNALIGN_LONGLONG
00166 #define UNALIGNED32
00167 #endif
00168 #endif // SIZEOF INT32
00169 #define INT32_MIN_VALUE (-2147483647 - 1)
00170 #define INT32_MAX_VALUE 2147483647
00171 #define UINT32_MAX_VALUE 0xFFFFFFFFU
00172
00173
00174
00175
00176 #if SIZEOF_INT == 2
00177 typedef int INT16;
00178 typedef unsigned int UINT16;
00179 #ifdef CAN_UNALIGN_INT
00180 #define UNALIGNED16
00181 #endif
00182 #elif SIZEOF_LONG == 2
00183 typedef long INT16;
00184 typedef unsigned long UINT16;
00185 #ifdef CAN_UNALIGN_LONG
00186 #define UNALIGNED16
00187 #endif
00188 #elif SIZEOF_SHORT == 2
00189 typedef short INT16;
00190 typedef unsigned short UINT16;
00191 #ifdef CAN_UNALIGN_SHORT
00192 #define UNALIGNED16
00193 #endif
00194 #else
00195 typedef INT32 INT16;
00196 typedef UINT32 UINT16;
00197 #ifdef UNALIGNED32
00198 #define UNALIGNED16
00199 #endif
00200 #endif // SIZEOF INT16
00201 #define INT16_MIN_VALUE (-32768)
00202 #define INT16_MAX_VALUE 32767
00203 #define UINT16_MAX_VALUE 0xFFFFU
00204
00205 typedef signed char INT8;
00206 typedef unsigned char UINT8;
00207
00208 #ifndef HAVE_IN_ADDR_T
00209 typedef UINT32 in_addr_t;
00210 #endif
00211
00212 #ifndef SMALLEST_INT_GTE_NEG_QUOTIENT
00213 #define LARGEST_INT_LTE_NEG_QUOTIENT
00214 #endif // !SMALLEST_INT_GTE_NEG_QUOTIENT
00215
00216 extern bool AssertionFailed(const char *SourceFile, unsigned int LineNo);
00217 #define mux_assert(exp) (void)( (exp) || (AssertionFailed(__FILE__, __LINE__), 0) )
00218
00219 extern void OutOfMemory(const char *SourceFile, unsigned int LineNo);
00220 #define ISOUTOFMEMORY(exp) {if (!(exp)) { OutOfMemory(__FILE__, __LINE__); }}
00221
00222
00223
00224
00225
00226 #ifdef MEMORY_ACCOUNTING
00227 extern void *MemAllocate(size_t n, const char *f, int l);
00228 extern void MemFree(void *p, const char *f, int l);
00229 extern void *MemRealloc(void *p, size_t n, const char *f, int l);
00230 #define MEMALLOC(n) MemAllocate((n), __FILE__, __LINE__)
00231 #define MEMFREE(p) MemFree((p), __FILE__, __LINE__)
00232 #define MEMREALLOC(p, n) MemRealloc((p), (n), __FILE__, __LINE__)
00233 #else // MEMORY_ACCOUNTING
00234 #define MEMALLOC(n) malloc((n))
00235 #define MEMFREE(p) free((p))
00236 #define MEMREALLOC(p, n) realloc((p),(n))
00237 #endif // MEMORY_ACCOUNTING
00238
00239
00240
00241
00242 #ifdef hpux
00243 #define HAVE_GETRUSAGE 1
00244 #include <sys/syscall.h>
00245 #define getrusage(x,p) syscall(SYS_GETRUSAGE,x,p)
00246 #endif // hpux
00247
00248 #if defined(__INTEL_COMPILER)
00249 extern "C" unsigned int __intel_cpu_indicator;
00250 #endif
00251
00252 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
00253 void init_rlimit(void);
00254 #endif // HAVE_SETRLIMIT RLIMIT_NOFILE
00255
00256 #endif // !CONFIG_H
00257