1 #ifndef DEFINITIONS_GROUP
2 #define DEFINITIONS_GROUP
4 /*****************************************************************************\
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 1991-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 //! @file "definitions.h" Constants and objects used throughout HOOPLE.
20 Defines a set of useful universal constants (for our chosen universe) and
21 a set of aliases for convenient abstract and concrete data types.
22 This is the lowest-level header in hoople and should not include any others.
31 //! The value representing a pointer to nothing.
32 #define NULL_POINTER 0
34 ////! A null pointer with a type of (void *).
35 //#define NULL_VOID_POINTER (void *)NULL_POINTER
37 //! A fundamental constant measuring the number of bits in a byte.
38 #define BITS_PER_BYTE 8
40 //! An approximation of the fundamental circular constant.
41 #define PI_APPROX 3.14159265358
45 // Data Structures & Functions
47 //! This macro just eats what it's passed; it marks unused formal parameters.
48 #define formal(parameter)
50 //! A fairly important unit which is seldom defined...
51 typedef unsigned char abyte;
53 #if defined(UNICODE) && defined(__WIN32__)
54 //! the flexichar type is always appropriate to hold data for win32 calls.
55 typedef wchar_t flexichar;
57 // this version simply defangs any conversions.
58 typedef char flexichar;
61 //! Abbreviated name for unsigned integers.
62 typedef unsigned int un_int;
63 //! Abbreviated name for unsigned short integers.
64 typedef unsigned short un_short;
65 //! Abbreviated name for unsigned long integers.
66 typedef unsigned long un_long;
68 // some maximum and minimum values that are helpful.
70 //! Maximum 32-bit integer value.
71 #define MAXINT32 0x7fffffff
74 //! Minimum 32-bit integer value.
75 #define MININT32 0x80000000
78 //! Maximum 32-bit integer value.
79 #define MAXINT16 0x7fff
82 //! Minimum 32-bit integer value.
83 #define MININT16 0x8000
86 //! Maximum byte-based character value.
90 //! Minimum byte-based character value.
94 //! Maximum unsigned byte value.
98 //! Minimum unsigned byte value.
102 // Provide definitions for integers with platform independent specific sizes.
103 // Note that these may have to be adjusted for 64 bit platforms.
105 typedef unsigned char uint8;
106 typedef signed short int16;
107 typedef unsigned short uint16;
108 typedef signed int int32;
109 typedef unsigned int uint32;
113 // useful time constants.
115 // the _ms suffix indicates that these are measured in milliseconds.
116 const int SECOND_ms = 1000; //!< Number of milliseconds in a second.
117 const int MINUTE_ms = 60 * SECOND_ms; //!< Number of milliseconds in a minute.
118 const int HOUR_ms = 60 * MINUTE_ms; //!< Number of milliseconds in an hour.
119 const int DAY_ms = 24 * HOUR_ms; //!< Number of milliseconds in a day.
121 // the _s suffix indicates that these are measured in seconds.
122 const int MINUTE_s = 60; //!< Number of seconds in a minute.
123 const int HOUR_s = 60 * MINUTE_s; //!< Number of seconds in an hour.
124 const int DAY_s = 24 * HOUR_s; //!< Number of seconds in a day.
128 // useful general constants.
130 const int KILOBYTE = 1024; //!< Number of bytes in a kilobyte.
131 const int MEGABYTE = KILOBYTE * KILOBYTE; //!< Number of bytes in a megabyte.
132 const int GIGABYTE = MEGABYTE * KILOBYTE; //!< Number of bytes in a gigabyte.
133 const double TERABYTE = double(GIGABYTE) * double(KILOBYTE);
134 //double TERABYTE() { return double(GIGABYTE) * double(KILOBYTE); }
135 //!< Number of bytes in a terabyte.
136 // /*!< Implemented as a function to avoid annoying link errors for double
137 // floating point constants in some compilers. */
141 // Super basic objects...
143 //! lowest level object for all hoople objects. supports run-time type id.
148 virtual ~root_object() {}
153 // compiler specific dumping ground for global settings...
156 // turns off annoying complaints from visual c++.
157 #pragma warning(disable : 4251 4275 4003 4800 4355 4786 4290 4996 4407)
158 #pragma warning(error : 4172)
159 // 4251 and 4275 turn off warnings regarding statically linked code
160 // not being marked with dll import/export flags.
161 // 4003 turns off warnings about insufficient number of parameters passed
163 // 4800 turns off the warning about conversion from int to bool not being
165 // 4355 turns off the warning re 'this' used in base member init list.
166 // 4786 turns off the warning about 'identifier' truncated to 'number'
167 // characters in the debug information which frequenly happens when
168 // STL pair and set templates are expanded.
169 // 4172 is made an error because this warning is emitted for a dangerous
170 // condition; the address of a local variable is being returned, making
171 // the returned object junk in almost all cases.
172 // 4996 turns off warnings about deprecated functions, which are mostly
173 // nonsense, since these are mainly the core posix functions.
175 //hmmm: trying to fix complaints about size_t being '?'.
176 // typedef long long __int64;
177 //#define __SIZE_TYPE__ long unsigned int
178 #endif // ms visual c++.
184 #endif // outer guard.