annotate win32/basetsd.d @ 1:4a9dcbd9e54f

-files of 0.13 beta -fixes so that it now compiles with the current dmd version
author marton@basel.hu
date Tue, 05 Apr 2011 20:44:01 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
1 /***********************************************************************\
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
2 * basetsd.d *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
3 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
4 * Windows API header module *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
5 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
6 * Translated from MinGW API for MS-Windows 3.12 *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
7 * by Stewart Gordon *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
8 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
9 * Placed into public domain *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
10 \***********************************************************************/
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
11 module win32.basetsd;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
12
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
13 /* This template is used in these modules to declare constant pointer types,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
14 * in order to support both D 1.x and 2.x.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
15 */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
16 template CPtr(T) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
17 version (D_Version2) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
18 // must use mixin so that it doesn't cause a syntax error under D1
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
19 mixin("alias const(T)* CPtr;");
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
20 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
21 alias T* CPtr;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
22 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
23 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
24
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
25 // [SnakE 2009-02-23] Moved HANDLE definition here from winnt.d to avoid
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
26 // 'forwatd template reference' to CPtr from winnt.d caused by a circular
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
27 // import.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
28
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
29 typedef void* HANDLE;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
30
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
31 alias HANDLE* PHANDLE, LPHANDLE;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
32
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
33 version (Win64) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
34 alias long __int3264;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
35 const ulong ADDRESS_TAG_BIT = 0x40000000000;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
36
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
37 alias long INT_PTR, LONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
38 alias long* PINT_PTR, PLONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
39 alias ulong UINT_PTR, ULONG_PTR, HANDLE_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
40 alias ulong* PUINT_PTR, PULONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
41 alias int HALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
42 alias int* PHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
43 alias uint UHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
44 alias uint* PUHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
45
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
46 /* *To* functions are conditioned out in MinGW.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
47 * Presumably they're not working/tested yet. Comment:
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
48 TODO when WIN64 is here
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
49 */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
50 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
51 alias int __int3264;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
52 const uint ADDRESS_TAG_BIT = 0x80000000;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
53
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
54 alias int INT_PTR, LONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
55 alias int* PINT_PTR, PLONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
56 alias uint UINT_PTR, ULONG_PTR, HANDLE_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
57 alias uint* PUINT_PTR, PULONG_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
58 alias short HALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
59 alias short* PHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
60 alias ushort UHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
61 alias ushort* PUHALF_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
62
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
63 uint HandleToUlong(HANDLE h) { return cast(uint) h; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
64 int HandleToLong(HANDLE h) { return cast(int) h; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
65 HANDLE LongToHandle(LONG_PTR h) { return cast(HANDLE) h; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
66 uint PtrToUlong(CPtr!(void) p) { return cast(uint) p; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
67 uint PtrToUint(CPtr!(void) p) { return cast(uint) p; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
68 int PtrToInt(CPtr!(void) p) { return cast(int) p; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
69 ushort PtrToUshort(CPtr!(void) p) { return cast(ushort) p; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
70 short PtrToShort(CPtr!(void) p) { return cast(short) p; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
71 void* IntToPtr(int i) { return cast(void*) i; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
72 void* UIntToPtr(uint ui) { return cast(void*) ui; }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
73 alias IntToPtr LongToPtr;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
74 alias UIntToPtr ULongToPtr;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
75 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
76
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
77 alias UIntToPtr UintToPtr, UlongToPtr;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
78
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
79 enum : UINT_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
80 MAXUINT_PTR = UINT_PTR.max
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
81 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
82
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
83 enum : INT_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
84 MAXINT_PTR = INT_PTR.max,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
85 MININT_PTR = INT_PTR.min
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
86 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
87
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
88 enum : ULONG_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
89 MAXULONG_PTR = ULONG_PTR.max
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
90 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
91
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
92 enum : LONG_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
93 MAXLONG_PTR = LONG_PTR.max,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
94 MINLONG_PTR = LONG_PTR.min
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
95 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
96
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
97 enum : UHALF_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
98 MAXUHALF_PTR = UHALF_PTR.max
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
99 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
100
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
101 enum : HALF_PTR {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
102 MAXHALF_PTR = HALF_PTR.max,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
103 MINHALF_PTR = HALF_PTR.min
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
104 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
105
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
106 alias byte INT8;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
107 alias byte* PINT8;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
108 alias ubyte UINT8;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
109 alias ubyte* PUINT8;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
110
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
111 alias short INT16;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
112 alias short* PINT16;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
113 alias ushort UINT16;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
114 alias ushort* PUINT16;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
115
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
116 alias int LONG32, INT32;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
117 alias int* PLONG32, PINT32;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
118 alias uint ULONG32, DWORD32, UINT32;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
119 alias uint* PULONG32, PDWORD32, PUINT32;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
120
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
121 alias ULONG_PTR SIZE_T, DWORD_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
122 alias ULONG_PTR* PSIZE_T, PDWORD_PTR;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
123 alias LONG_PTR SSIZE_T;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
124 alias LONG_PTR* PSSIZE_T;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
125
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
126 alias long LONG64, INT64;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
127 alias long* PLONG64, PINT64;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
128 alias ulong ULONG64, DWORD64, UINT64;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
129 alias ulong* PULONG64, PDWORD64, PUINT64;