feisty meow concerns codebase  2.140
definitions.h
Go to the documentation of this file.
1 #ifndef DEFINITIONS_GROUP
2 #define DEFINITIONS_GROUP
3 
4 /*****************************************************************************\
5 * *
6 * Name : definitions *
7 * Author : Chris Koeritz *
8 * *
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 \*****************************************************************************/
17 
19 
25 namespace basis {
26 
28 
29 // Constants...
30 
32 #define NULL_POINTER 0
33 
35 //#define NULL_VOID_POINTER (void *)NULL_POINTER
36 
38 #define BITS_PER_BYTE 8
39 
41 #define PI_APPROX 3.14159265358
42 
44 
45 // Data Structures & Functions
46 
48 #define formal(parameter)
49 
51 typedef unsigned char abyte;
52 
53 #if defined(UNICODE) && defined(__WIN32__)
55  typedef wchar_t flexichar;
56 #else
57  // this version simply defangs any conversions.
58  typedef char flexichar;
59 #endif
60 
62 typedef unsigned int un_int;
64 typedef unsigned short un_short;
66 typedef unsigned long un_long;
68 typedef long int signed_long;
70 typedef long long signed_long_long;
71 
72 // some maximum and minimum values that are helpful.
73 #ifndef MAXINT32
75  #define MAXINT32 0x7fffffff
76 #endif
77 #ifndef MININT32
79  #define MININT32 0x80000000
80 #endif
81 #ifndef MAXINT16
83  #define MAXINT16 0x7fff
84 #endif
85 #ifndef MININT16
87  #define MININT16 0x8000
88 #endif
89 #ifndef MAXCHAR
91  #define MAXCHAR 0x7f
92 #endif
93 #ifndef MINCHAR
95  #define MINCHAR 0x80
96 #endif
97 #ifndef MAXBYTE
99  #define MAXBYTE 0xff
100 #endif
101 #ifndef MINBYTE
103  #define MINBYTE 0x00
104 #endif
105 
106 // Provide definitions for integers with platform independent specific sizes.
107 // Note that these may have to be adjusted for 64 bit platforms.
108 typedef char int8;
109 typedef unsigned char uint8;
110 typedef signed short int16;
111 typedef unsigned short uint16;
112 typedef signed int int32;
113 typedef unsigned int uint32;
114 
116 
117 // useful time constants.
118 
119 // the _ms suffix indicates that these are measured in milliseconds.
120 const int SECOND_ms = 1000;
121 const int MINUTE_ms = 60 * SECOND_ms;
122 const int HOUR_ms = 60 * MINUTE_ms;
123 const int DAY_ms = 24 * HOUR_ms;
124 
125 // the _s suffix indicates that these are measured in seconds.
126 const int MINUTE_s = 60;
127 const int HOUR_s = 60 * MINUTE_s;
128 const int DAY_s = 24 * HOUR_s;
129 
131 
132 // useful general constants.
133 
134 const int KILOBYTE = 1024;
135 const int MEGABYTE = KILOBYTE * KILOBYTE;
136 const int GIGABYTE = MEGABYTE * KILOBYTE;
137 const double TERABYTE = double(GIGABYTE) * double(KILOBYTE);
138 //double TERABYTE() { return double(GIGABYTE) * double(KILOBYTE); }
140 // /*!< Implemented as a function to avoid annoying link errors for double
141 // floating point constants in some compilers. */
142 
144 
145 // Super basic objects...
146 
148 
149 class root_object
150 {
151 public:
152  virtual ~root_object() {}
153 };
154 
156 
157 // compiler specific dumping ground for global settings...
158 
159 /*
160 #ifdef _MSC_VER
161  // turns off annoying complaints from visual c++.
162  #pragma warning(disable : 4251 4275 4003 4800 4355 4786 4290 4996 4407)
163  #pragma warning(error : 4172)
164  // 4251 and 4275 turn off warnings regarding statically linked code
165  // not being marked with dll import/export flags.
166  // 4003 turns off warnings about insufficient number of parameters passed
167  // to a macro.
168  // 4800 turns off the warning about conversion from int to bool not being
169  // efficient.
170  // 4355 turns off the warning re 'this' used in base member init list.
171  // 4786 turns off the warning about 'identifier' truncated to 'number'
172  // characters in the debug information which frequenly happens when
173  // STL pair and set templates are expanded.
174  // 4172 is made an error because this warning is emitted for a dangerous
175  // condition; the address of a local variable is being returned, making
176  // the returned object junk in almost all cases.
177  // 4996 turns off warnings about deprecated functions, which are mostly
178  // nonsense, since these are mainly the core posix functions.
179 #else
180 //hmmm: trying to fix complaints about size_t being '?'.
181 // typedef long long __int64;
182  //#define __SIZE_TYPE__ long unsigned int
183 #endif // ms visual c++.
184 */
185 
187 
188 } //namespace.
189 
190 #endif // outer guard.
191 
The guards collection helps in testing preconditions and reporting errors.
Definition: array.h:30
unsigned short uint16
Definition: definitions.h:111
unsigned char uint8
Definition: definitions.h:109
const int GIGABYTE
Number of bytes in a gigabyte.
Definition: definitions.h:136
const int MINUTE_s
Number of seconds in a minute.
Definition: definitions.h:126
const int MEGABYTE
Number of bytes in a megabyte.
Definition: definitions.h:135
unsigned char abyte
A fairly important unit which is seldom defined...
Definition: definitions.h:51
unsigned long un_long
Abbreviated name for unsigned long integers.
Definition: definitions.h:66
signed int int32
Definition: definitions.h:112
const int DAY_s
Number of seconds in a day.
Definition: definitions.h:128
const double TERABYTE
Definition: definitions.h:137
char int8
Definition: definitions.h:108
const int DAY_ms
Number of milliseconds in a day.
Definition: definitions.h:123
long int signed_long
Abbreviated name for signed long integers.
Definition: definitions.h:68
const int SECOND_ms
Number of milliseconds in a second.
Definition: definitions.h:120
unsigned int un_int
Abbreviated name for unsigned integers.
Definition: definitions.h:62
const int HOUR_s
Number of seconds in an hour.
Definition: definitions.h:127
const int HOUR_ms
Number of milliseconds in an hour.
Definition: definitions.h:122
unsigned short un_short
Abbreviated name for unsigned short integers.
Definition: definitions.h:64
long long signed_long_long
Abbreviated name for signed long long integers.
Definition: definitions.h:70
char flexichar
Definition: definitions.h:58
const int MINUTE_ms
Number of milliseconds in a minute.
Definition: definitions.h:121
const int KILOBYTE
Number of bytes in a kilobyte.
Definition: definitions.h:134
unsigned int uint32
Definition: definitions.h:113
signed short int16
Definition: definitions.h:110