| 1 |
unit BTypes; |
| 2 |
|
| 3 |
{Common basic type definitions} |
| 4 |
|
| 5 |
|
| 6 |
interface |
| 7 |
|
| 8 |
|
| 9 |
{$i STD.INC} |
| 10 |
|
| 11 |
(************************************************************************* |
| 12 |
|
| 13 |
DESCRIPTION : Common basic type definitions |
| 14 |
|
| 15 |
REQUIREMENTS : TP5-7, D1-D7/D9-D12/D17-D22, FPC, VP, WDOSX |
| 16 |
|
| 17 |
EXTERNAL DATA : --- |
| 18 |
|
| 19 |
MEMORY USAGE : --- |
| 20 |
|
| 21 |
DISPLAY MODE : --- |
| 22 |
|
| 23 |
REFERENCES : --- |
| 24 |
|
| 25 |
|
| 26 |
Version Date Author Modification |
| 27 |
------- -------- ------- ------------------------------------------ |
| 28 |
0.10 15.04.06 W.Ehrhardt Initial version |
| 29 |
0.11 15.04.06 we With $ifdef HAS_XTYPES |
| 30 |
0.12 15.04.06 we FPC1_0 and pShortInt |
| 31 |
0.13 09.09.08 we UInt32 = cardinal $ifdef HAS_CARD32 |
| 32 |
0.14 12.11.08 we Str127, Ptr2Inc |
| 33 |
0.15 14.11.08 we BString, char8 |
| 34 |
0.16 21.11.08 we __P2I: type cast pointer to integer for masking etc |
| 35 |
0.17 02.12.08 we Use pchar and pAnsiChar for pchar8 if possible |
| 36 |
0.18 27.02.09 we pBoolean |
| 37 |
0.19 14.02.12 we extended = double $ifdef SIMULATE_EXT64 |
| 38 |
0.20 06.05.14 we extended = double $ifdef SIMULATE_EXT64 OR EXT64 |
| 39 |
0.21 25.04.15 we With $ifdef HAS_INTXX, HAS_PINTXX |
| 40 |
*************************************************************************) |
| 41 |
|
| 42 |
|
| 43 |
(*------------------------------------------------------------------------- |
| 44 |
(C) Copyright 2006-2015 Wolfgang Ehrhardt |
| 45 |
|
| 46 |
This software is provided 'as-is', without any express or implied warranty. |
| 47 |
In no event will the authors be held liable for any damages arising from |
| 48 |
the use of this software. |
| 49 |
|
| 50 |
Permission is granted to anyone to use this software for any purpose, |
| 51 |
including commercial applications, and to alter it and redistribute it |
| 52 |
freely, subject to the following restrictions: |
| 53 |
|
| 54 |
1. The origin of this software must not be misrepresented; you must not |
| 55 |
claim that you wrote the original software. If you use this software in |
| 56 |
a product, an acknowledgment in the product documentation would be |
| 57 |
appreciated but is not required. |
| 58 |
|
| 59 |
2. Altered source versions must be plainly marked as such, and must not be |
| 60 |
misrepresented as being the original software. |
| 61 |
|
| 62 |
3. This notice may not be removed or altered from any source distribution. |
| 63 |
----------------------------------------------------------------------------*) |
| 64 |
|
| 65 |
{$ifdef BIT16} |
| 66 |
type |
| 67 |
Int8 = ShortInt; { 8 bit signed integer} |
| 68 |
Int16 = Integer; {16 bit signed integer} |
| 69 |
Int32 = Longint; {32 bit signed integer} |
| 70 |
UInt8 = Byte; { 8 bit unsigned integer} |
| 71 |
UInt16 = Word; {16 bit unsigned integer} |
| 72 |
UInt32 = Longint; {32 bit unsigned integer} |
| 73 |
|
| 74 |
Smallint = Integer; |
| 75 |
Shortstring = string; |
| 76 |
|
| 77 |
pByte = ^Byte; |
| 78 |
pBoolean = ^Boolean; |
| 79 |
pShortInt = ^ShortInt; |
| 80 |
pWord = ^Word; |
| 81 |
pSmallInt = ^SmallInt; |
| 82 |
pLongint = ^Longint; |
| 83 |
|
| 84 |
{$else} |
| 85 |
|
| 86 |
{$ifndef HAS_INTXX} |
| 87 |
type |
| 88 |
Int8 = ShortInt; { 8 bit signed integer} |
| 89 |
Int16 = SmallInt; {16 bit signed integer} |
| 90 |
Int32 = Longint; {32 bit signed integer} |
| 91 |
UInt8 = Byte; { 8 bit unsigned integer} |
| 92 |
UInt16 = Word; {16 bit unsigned integer} |
| 93 |
{$ifdef HAS_CARD32} |
| 94 |
UInt32 = Cardinal; {32 bit unsigned integer} |
| 95 |
{$else} |
| 96 |
UInt32 = Longint; {32 bit unsigned integer} |
| 97 |
{$endif} |
| 98 |
{$endif} |
| 99 |
|
| 100 |
{$ifndef HAS_XTYPES} |
| 101 |
type |
| 102 |
pByte = ^Byte; |
| 103 |
pBoolean = ^Boolean; |
| 104 |
pShortInt = ^ShortInt; |
| 105 |
pWord = ^Word; |
| 106 |
pSmallInt = ^SmallInt; |
| 107 |
pLongint = ^Longint; |
| 108 |
{$endif} |
| 109 |
{$ifdef FPC} {$ifdef VER1_0} |
| 110 |
type |
| 111 |
pBoolean = ^Boolean; |
| 112 |
pShortInt = ^ShortInt; |
| 113 |
{$endif} {$endif} |
| 114 |
|
| 115 |
{$endif} {BIT16} |
| 116 |
|
| 117 |
type |
| 118 |
Str255 = string[255]; {Handy type to avoid problems with 32 bit and/or unicode} |
| 119 |
Str127 = string[127]; |
| 120 |
|
| 121 |
type |
| 122 |
{$ifndef HAS_PINTXX} |
| 123 |
pInt8 = ^Int8; |
| 124 |
pInt16 = ^Int16; |
| 125 |
pInt32 = ^Int32; |
| 126 |
pUInt8 = ^UInt8; |
| 127 |
pUInt16 = ^UInt16; |
| 128 |
pUInt32 = ^UInt32; |
| 129 |
{$endif} |
| 130 |
pStr255 = ^Str255; |
| 131 |
pStr127 = ^Str127; |
| 132 |
|
| 133 |
{$ifdef BIT16} |
| 134 |
{$ifdef V7Plus} |
| 135 |
type |
| 136 |
BString = string[255]; {String of 8 bit characters} |
| 137 |
pBString = ^BString; |
| 138 |
char8 = char; {8 bit characters} |
| 139 |
pchar8 = pchar; |
| 140 |
{$else} |
| 141 |
type |
| 142 |
BString = string[255]; {String of 8 bit characters} |
| 143 |
pBString = ^BString; |
| 144 |
char8 = char; {8 bit characters} |
| 145 |
pchar8 = ^char; |
| 146 |
{$endif} |
| 147 |
{$else} |
| 148 |
{$ifdef UNICODE} |
| 149 |
type |
| 150 |
BString = AnsiString; {String of 8 bit characters} |
| 151 |
pBString = pAnsiString; |
| 152 |
char8 = AnsiChar; {8 bit characters} |
| 153 |
pchar8 = pAnsiChar; |
| 154 |
{$else} |
| 155 |
type |
| 156 |
BString = AnsiString; {String of 8 bit characters} |
| 157 |
pBString = pAnsiString; |
| 158 |
char8 = AnsiChar; {8 bit characters} |
| 159 |
pchar8 = pAnsiChar; |
| 160 |
{$endif} |
| 161 |
{$endif} |
| 162 |
|
| 163 |
|
| 164 |
{$ifdef V7Plus} |
| 165 |
type |
| 166 |
Ptr2Inc = pByte; {Type cast to increment untyped pointer} |
| 167 |
{$else} |
| 168 |
type |
| 169 |
Ptr2Inc = Longint; {Type cast to increment untyped pointer} |
| 170 |
{$endif} |
| 171 |
|
| 172 |
|
| 173 |
{$ifdef FPC} |
| 174 |
{$ifdef VER1} |
| 175 |
type __P2I = longint; {Type cast pointer to integer for masking etc} |
| 176 |
{$else} |
| 177 |
type __P2I = PtrUInt; {Type cast pointer to integer for masking etc} |
| 178 |
{$endif} |
| 179 |
{$else} |
| 180 |
{$ifdef BIT64} |
| 181 |
type __P2I = NativeInt; {Type cast pointer to integer for masking etc} |
| 182 |
{$else} |
| 183 |
type __P2I = longint; {Type cast pointer to integer for masking etc} |
| 184 |
{$endif} |
| 185 |
{$endif} |
| 186 |
|
| 187 |
|
| 188 |
{$ifdef EXT64} |
| 189 |
type extended = double; {Force 64-bit 'extended'} |
| 190 |
{$else} |
| 191 |
{$ifdef SIMULATE_EXT64} |
| 192 |
type extended = double; {Debug simulation EXT64} |
| 193 |
{$endif} |
| 194 |
{$endif} |
| 195 |
|
| 196 |
|
| 197 |
implementation |
| 198 |
|
| 199 |
end. |