const to enums

This commit is contained in:
Walter Bright 2008-03-04 08:24:16 +00:00
parent 0644b63ac8
commit 46c83cf355
2 changed files with 40 additions and 22 deletions

View file

@ -147,10 +147,13 @@ else
alias FARPROC DRAWSTATEPROC; alias FARPROC DRAWSTATEPROC;
} }
extern (D)
{
WORD HIWORD(int l) { return cast(WORD)((l >> 16) & 0xFFFF); } WORD HIWORD(int l) { return cast(WORD)((l >> 16) & 0xFFFF); }
WORD LOWORD(int l) { return cast(WORD)l; } WORD LOWORD(int l) { return cast(WORD)l; }
bool FAILED(int status) { return status < 0; } bool FAILED(int status) { return status < 0; }
bool SUCCEEDED(int Status) { return Status >= 0; } bool SUCCEEDED(int Status) { return Status >= 0; }
}
enum : int enum : int
{ {
@ -444,9 +447,11 @@ enum
// Key creation/open disposition // Key creation/open disposition
// //
const int REG_CREATED_NEW_KEY = 0x00000001; // New Registry Key created enum : int
const int REG_OPENED_EXISTING_KEY = 0x00000002; // Existing Key opened {
REG_CREATED_NEW_KEY = 0x00000001, // New Registry Key created
REG_OPENED_EXISTING_KEY = 0x00000002, // Existing Key opened
}
// //
// //
@ -533,15 +538,18 @@ enum
int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType); int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
int MessageBoxExA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId); int MessageBoxExA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId);
const HKEY HKEY_CLASSES_ROOT = cast(HKEY)(0x80000000); enum : HKEY
const HKEY HKEY_CURRENT_USER = cast(HKEY)(0x80000001); {
const HKEY HKEY_LOCAL_MACHINE = cast(HKEY)(0x80000002); HKEY_CLASSES_ROOT = cast(HKEY)(0x80000000),
const HKEY HKEY_USERS = cast(HKEY)(0x80000003); HKEY_CURRENT_USER = cast(HKEY)(0x80000001),
const HKEY HKEY_PERFORMANCE_DATA = cast(HKEY)(0x80000004); HKEY_LOCAL_MACHINE = cast(HKEY)(0x80000002),
const HKEY HKEY_PERFORMANCE_TEXT = cast(HKEY)(0x80000050); HKEY_USERS = cast(HKEY)(0x80000003),
const HKEY HKEY_PERFORMANCE_NLSTEXT = cast(HKEY)(0x80000060); HKEY_PERFORMANCE_DATA = cast(HKEY)(0x80000004),
const HKEY HKEY_CURRENT_CONFIG = cast(HKEY)(0x80000005); HKEY_PERFORMANCE_TEXT = cast(HKEY)(0x80000050),
const HKEY HKEY_DYN_DATA = cast(HKEY)(0x80000006); HKEY_PERFORMANCE_NLSTEXT = cast(HKEY)(0x80000060),
HKEY_CURRENT_CONFIG = cast(HKEY)(0x80000005),
HKEY_DYN_DATA = cast(HKEY)(0x80000006),
}
enum enum
{ {
@ -2045,10 +2053,13 @@ export
HCURSOR LoadCursorW(HINSTANCE hInstance, LPCWSTR lpCursorName); HCURSOR LoadCursorW(HINSTANCE hInstance, LPCWSTR lpCursorName);
} }
const LPSTR IDI_APPLICATION = cast(LPSTR)(32512); enum : LPSTR
{
IDI_APPLICATION = cast(LPSTR)(32512),
const LPSTR IDC_ARROW = cast(LPSTR)(32512); IDC_ARROW = cast(LPSTR)(32512),
const LPSTR IDC_CROSS = cast(LPSTR)(32515); IDC_CROSS = cast(LPSTR)(32515),
}
/* /*
* Color Types * Color Types
@ -2100,12 +2111,18 @@ enum
COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT, COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT,
} }
const int CW_USEDEFAULT = cast(int)0x80000000; enum : int
{
CW_USEDEFAULT = cast(int)0x80000000
}
/* /*
* Special value for CreateWindow, et al. * Special value for CreateWindow, et al.
*/ */
const HWND HWND_DESKTOP = (cast(HWND)0); enum : HWND
{
HWND_DESKTOP = cast(HWND)0,
}
export ATOM RegisterClassA(WNDCLASSA *lpWndClass); export ATOM RegisterClassA(WNDCLASSA *lpWndClass);
@ -2730,8 +2747,11 @@ export HWND SetFocus(HWND hWnd);
export int wsprintfA(LPSTR, LPCSTR, ...); export int wsprintfA(LPSTR, LPCSTR, ...);
export int wsprintfW(LPWSTR, LPCWSTR, ...); export int wsprintfW(LPWSTR, LPCWSTR, ...);
const uint INFINITE = uint.max; enum : uint
const uint WAIT_OBJECT_0 = 0; {
INFINITE = uint.max,
WAIT_OBJECT_0 = 0,
}
export HANDLE CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCTSTR lpName); export HANDLE CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCTSTR lpName);
export HANDLE OpenSemaphoreA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCTSTR lpName); export HANDLE OpenSemaphoreA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCTSTR lpName);

View file

@ -49,7 +49,6 @@ public import std.hiddenfunc;
public import std.intrinsic; public import std.intrinsic;
public import std.loader; public import std.loader;
public import std.math; public import std.math;
public import std.math2;
public import std.md5; public import std.md5;
public import std.metastrings; public import std.metastrings;
public import std.mmfile; public import std.mmfile;
@ -91,7 +90,6 @@ int main(char[][] args)
cmp("foo", "bar"); // string cmp("foo", "bar"); // string
fncharmatch('a', 'b'); // path fncharmatch('a', 'b'); // path
isnan(1.0); // math isnan(1.0); // math
std.math2.feq(1.0, 2.0); // math2
std.conv.toDouble("1.0"); // std.conv std.conv.toDouble("1.0"); // std.conv
OutBuffer b = new OutBuffer(); // outbuffer OutBuffer b = new OutBuffer(); // outbuffer
std.ctype.tolower('A'); // ctype std.ctype.tolower('A'); // ctype