root/trunk/win32/basetsd.d

Revision 223, 3.2 kB (checked in by WeirdCat, 10 months ago)

byte and short types added (needed for Direct3D10)

Line 
1 /***********************************************************************\
2 *                               basetsd.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *             Translated from MinGW API for MS-Windows 3.10             *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.basetsd;
12
13 private import win32.winnt;
14
15 version (Win64) {
16     alias long __int3264;
17     const ulong ADDRESS_TAG_BIT = 0x40000000000;
18
19     alias long INT_PTR, LONG_PTR;
20     alias long* PINT_PTR, PLONG_PTR;
21     alias ulong UINT_PTR, ULONG_PTR, HANDLE_PTR;
22     alias ulong* PUINT_PTR, PULONG_PTR;
23     alias int HALF_PTR;
24     alias int* PHALF_PTR;
25     alias uint UHALF_PTR;
26     alias uint* PUHALF_PTR;
27
28     /*  *To* functions are conditioned out in MinGW.
29      *  Presumably they're not working/tested yet.  Comment:
30             TODO when WIN64 is here
31      */
32 } else {
33     alias int __int3264;
34     const uint ADDRESS_TAG_BIT = 0x80000000;
35
36     alias int INT_PTR, LONG_PTR;
37     alias int* PINT_PTR, PLONG_PTR;
38     alias uint UINT_PTR, ULONG_PTR, HANDLE_PTR;
39     alias uint* PUINT_PTR, PULONG_PTR;
40     alias short HALF_PTR;
41     alias short* PHALF_PTR;
42     alias ushort UHALF_PTR;
43     alias ushort* PUHALF_PTR;
44
45     uint HandleToUlong(HANDLE h)    { return cast(uint) h; }
46     int HandleToLong(HANDLE h)      { return cast(int) h; }
47     HANDLE LongToHandle(LONG_PTR h) { return cast(HANDLE) h; }
48     uint PtrToUlong(void* p)        { return cast(uint) p; }
49     uint PtrToUint(void* p)         { return cast(uint) p; }
50     int PtrToInt(void* p)           { return cast(int) p; }
51     ushort PtrToUshort(void* p)     { return cast(ushort) p; }
52     short PtrToShort(void* p)       { return cast(short) p; }
53     void* IntToPtr(int i)           { return cast(void*) i; }
54     void* UIntToPtr(uint ui)        { return cast(void*) ui; }
55     alias IntToPtr LongToPtr;
56     alias UIntToPtr ULongToPtr;
57 }
58
59 alias UIntToPtr UintToPtr, UlongToPtr;
60
61 enum : UINT_PTR {
62     MAXUINT_PTR = UINT_PTR.max
63 }
64
65 enum : INT_PTR {
66     MAXINT_PTR = INT_PTR.max,
67     MININT_PTR = INT_PTR.min
68 }
69
70 enum : ULONG_PTR {
71     MAXULONG_PTR = ULONG_PTR.max
72 }
73
74 enum : LONG_PTR {
75     MAXLONG_PTR = LONG_PTR.max,
76     MINLONG_PTR = LONG_PTR.min
77 }
78
79 enum : UHALF_PTR {
80     MAXUHALF_PTR = UHALF_PTR.max
81 }
82
83 enum : HALF_PTR {
84     MAXHALF_PTR = HALF_PTR.max,
85     MINHALF_PTR = HALF_PTR.min
86 }
87
88 alias byte INT8;
89 alias byte* PINT8;
90 alias ubyte UINT8;
91 alias ubyte* PUINT8;
92
93 alias short INT16;
94 alias short* PINT16;
95 alias ushort UINT16;
96 alias ushort* PUINT16;
97
98 alias int LONG32, INT32;
99 alias int* PLONG32, PINT32;
100 alias uint ULONG32, DWORD32, UINT32;
101 alias uint* PULONG32, PDWORD32, PUINT32;
102
103 alias ULONG_PTR SIZE_T, DWORD_PTR;
104 alias ULONG_PTR* PSIZE_T, PDWORD_PTR;
105 alias LONG_PTR SSIZE_T;
106 alias LONG_PTR* PSSIZE_T;
107
108 alias long LONG64, INT64;
109 alias long* PLONG64, PINT64;
110 alias ulong ULONG64, DWORD64, UINT64;
111 alias ulong* PULONG64, PDWORD64, PUINT64;
Note: See TracBrowser for help on using the browser.