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
25namespace 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
51typedef 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
62typedef unsigned int un_int;
64typedef unsigned short un_short;
66typedef unsigned long un_long;
68typedef long int signed_long;
70typedef 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.
108typedef char int8;
109typedef unsigned char uint8;
110typedef signed short int16;
111typedef unsigned short uint16;
112typedef signed int int32;
113typedef unsigned int uint32;
114
116
117// useful time constants.
118
119// the _ms suffix indicates that these are measured in milliseconds.
120const int SECOND_ms = 1000;
121const int MINUTE_ms = 60 * SECOND_ms;
122const int HOUR_ms = 60 * MINUTE_ms;
123const int DAY_ms = 24 * HOUR_ms;
124
125// the _s suffix indicates that these are measured in seconds.
126const int MINUTE_s = 60;
127const int HOUR_s = 60 * MINUTE_s;
128const int DAY_s = 24 * HOUR_s;
129
131
132// useful general constants.
133
134const int KILOBYTE = 1024;
137const 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
149class root_object
150{
151public:
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
unsigned char uint8
const int GIGABYTE
Number of bytes in a gigabyte.
const int MINUTE_s
Number of seconds in a minute.
const int MEGABYTE
Number of bytes in a megabyte.
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
const int DAY_s
Number of seconds in a day.
const double TERABYTE
char int8
const int DAY_ms
Number of milliseconds in a day.
long int signed_long
Abbreviated name for signed long integers.
Definition definitions.h:68
const int SECOND_ms
Number of milliseconds in a second.
unsigned int un_int
Abbreviated name for unsigned integers.
Definition definitions.h:62
const int HOUR_s
Number of seconds in an hour.
const int HOUR_ms
Number of milliseconds in an hour.
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.
const int KILOBYTE
Number of bytes in a kilobyte.
unsigned int uint32
signed short int16