sqlite3_prepare sqlite-check-result
r> sqlite3-stmt-indirect-pointer ;
: sqlite-bind-text ( statement col text -- )
diff --git a/contrib/sqlite/test.factor b/contrib/sqlite/test.factor
index 864281c8a8..b01b9993f6 100644
--- a/contrib/sqlite/test.factor
+++ b/contrib/sqlite/test.factor
@@ -25,11 +25,7 @@
!
! Create a test database like follows:
!
-! sqlite3 test.db
-! > create table test (name varchar(30), address varchar(30));
-! > insert into test values('John', 'America');
-! > insert into test values('Jane', 'New Zealand');
-! > [eof]
+! sqlite3 test.db < test.txt
!
! Then run this file.
USE: sqlite
@@ -38,18 +34,20 @@ USE: io
USE: prettyprint
USE: lists
+: test.db "contrib/sqlite/test.db" ;
+
: show-people ( statement -- )
dup 0 column-text write " from " write 1 column-text . ;
: run-test ( -- )
- "test.db" sqlite-open
+ test.db sqlite-open
dup "select * from test" sqlite-prepare
dup [ show-people ] sqlite-each
sqlite-finalize
sqlite-close ;
: find-person ( name -- )
- "test.db" sqlite-open ( name db )
+ test.db sqlite-open ( name db )
dup "select * from test where name=?" sqlite-prepare ( name db stmt )
[ rot 1 swap sqlite-bind-text ] keep ( db stmt )
[ [ 1 column-text . ] sqlite-each ] keep
@@ -57,15 +55,15 @@ USE: lists
sqlite-close ;
: find-all ( -- )
- "test.db" sqlite-open ( db )
+ test.db sqlite-open ( db )
dup "select * from test" sqlite-prepare ( db stmt )
[ [ [ 0 column-text ] keep 1 column-text cons ] sqlite-map ] keep
sqlite-finalize
swap sqlite-close ;
: run-test2 ( -- )
- "test.db" sqlite-open
+ test.db sqlite-open
dup "select * from test" sqlite-prepare
dup [ show-people ] ;
-run-test
\ No newline at end of file
+run-test
diff --git a/contrib/sqlite/test.txt b/contrib/sqlite/test.txt
new file mode 100644
index 0000000000..5c7ae2b52a
--- /dev/null
+++ b/contrib/sqlite/test.txt
@@ -0,0 +1,3 @@
+create table test (name varchar(30), address varchar(30));
+insert into test values('John', 'America');
+insert into test values('Jane', 'New Zealand');
diff --git a/contrib/sqlite/tuple-db.factor b/contrib/sqlite/tuple-db.factor
index ed7bfa3b64..db6b509d22 100644
--- a/contrib/sqlite/tuple-db.factor
+++ b/contrib/sqlite/tuple-db.factor
@@ -37,15 +37,15 @@ TUPLE: db-field name bind-name slot type ;
TUPLE: mapping tuple table fields one-to-one one-to-many ;
: sanitize-conversions ( -- alist )
- [
- [[ CHAR: - "_" ]]
- [[ CHAR: ? "p" ]]
- ] ;
+ H{
+ { CHAR: - "_" }
+ { CHAR: ? "p" }
+ } ;
: sanitize ( string -- string )
#! Convert a string so it can be used as a table or field name.
[
- [ dup sanitize-conversions assoc [ % ] [ , ] ?if ] each
+ [ dup sanitize-conversions hash [ % ] [ , ] ?if ] each
] "" make ;
: tuple-fields ( class -- seq )
diff --git a/contrib/sqlite/tuple-db.html b/contrib/sqlite/tuple-db.html
index a3f9d22f83..1d7b463296 100644
--- a/contrib/sqlite/tuple-db.html
+++ b/contrib/sqlite/tuple-db.html
@@ -51,19 +51,16 @@ following command:
./f boot.image.le32 -libraries:sqlite:name=libsqlite3.so
-The quickest way to get up and running with this library is to
-change to the 'sqlite' directory and run Factor. Then execute the
-following commands:
+The quickest way to get up and running with this library is to type the following into the listener:
-"sqlite.factor" run-file
-"tuple-db.factor" run-file
+"/contrib/sqlite/load.factor" run-resource
USE: sqlite
USE: tuple-db
Some simple tests can be run to check that everything is working
ok:
-"tuple-db-tests.factor" run-file
+"/contrib/sqlite/tuple-db-tests.factor" run-resource
Basic Usage
This library can be used for storing simple Factor tuples in a
diff --git a/contrib/units/constants.factor b/contrib/units/constants.factor
index d3768ea24c..d3e8ff0888 100644
--- a/contrib/units/constants.factor
+++ b/contrib/units/constants.factor
@@ -1,4 +1,4 @@
-USING: kernel math dimensioned si-units ;
+USING: kernel math si-units ;
! From: http://physics.nist.gov/constants
IN: si-units
diff --git a/contrib/units/dimensioned.factor b/contrib/units/dimensioned.factor
index 31687f02c7..a4c34a06d4 100644
--- a/contrib/units/dimensioned.factor
+++ b/contrib/units/dimensioned.factor
@@ -1,14 +1,11 @@
-USING: physical-constants conversions ;
USING: kernel prettyprint io sequences words lists vectors inspector math errors namespaces ;
-
IN: units-internal
-: seq-diff ( seq1 seq2 -- seq2-seq1 )
- [ swap member? not ] subset-with ; flushable
-
: seq-intersect ( seq1 seq2 -- seq1/\seq2 )
[ swap member? ] subset-with ; flushable
+: 2list ( x y -- [ x y ] ) f cons cons ;
+
IN: units
TUPLE: dimensioned val top bot ;
diff --git a/contrib/units/load.factor b/contrib/units/load.factor
index 0b230dd8b7..c1b7f04c1a 100644
--- a/contrib/units/load.factor
+++ b/contrib/units/load.factor
@@ -1,10 +1,8 @@
-USING: parser sequences words compiler ;
-
-[
- "contrib/units/dimensioned.factor"
- "contrib/units/si-units.factor"
- "contrib/units/constants.factor"
-] [ run-file ] each
-
-! "" words [ try-compile ] each
+IN: scratchpad
+USING: kernel parser sequences words compiler ;
+{
+ "dimensioned"
+ "si-units"
+ "constants"
+} [ "/contrib/units/" swap ".factor" append3 run-resource ] each
diff --git a/contrib/win32/clip.factor b/contrib/win32/clip.factor
new file mode 100644
index 0000000000..1104daf330
--- /dev/null
+++ b/contrib/win32/clip.factor
@@ -0,0 +1,59 @@
+USING: kernel win32 math namespaces io prettyprint errors sequences alien ;
+IN: clipboard
+
+: (enum-clipboard) ( n -- )
+ EnumClipboardFormats win32-error dup 0 > [ dup , (enum-clipboard) ] when ;
+
+: enum-clipboard ( -- seq )
+ [ 0 (enum-clipboard) ] { } make nip ;
+
+: paste ( -- str )
+ f OpenClipboard drop
+ CF_TEXT IsClipboardFormatAvailable 0 = [
+ "no text in clipboard" print
+ ] [
+ ! "text found" print
+ CF_TEXT GetClipboardData
+ dup GlobalLock swap
+ GlobalUnlock drop
+ ] if
+ CloseClipboard drop alien>string ;
+
+LIBRARY: libc
+FUNCTION: void memcpy ( char* dst, char* src, ulong size ) ;
+
+: copy ( str -- )
+ f OpenClipboard drop
+ EmptyClipboard drop
+ GMEM_MOVEABLE over length 1+ GlobalAlloc dup 0 = [
+ "unable to allocate memory" throw
+ ] when
+
+ dup GlobalLock
+ rot dup length memcpy
+ dup GlobalUnlock drop
+ CF_TEXT swap SetClipboardData 0 = [
+ win32-error
+ "SetClipboardData failed" throw
+ ] when
+
+ CloseClipboard drop ;
+
+
+ ! hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
+ ! (cch + 1) * sizeof(TCHAR));
+
+
+ ! // Lock the handle and copy the text to the buffer.
+
+ ! lptstrCopy = GlobalLock(hglbCopy);
+ ! memcpy(lptstrCopy, &pbox->atchLabel[ich1],
+ ! cch * sizeof(TCHAR));
+ ! lptstrCopy[cch] = (TCHAR) 0; // null character
+ ! GlobalUnlock(hglbCopy);
+
+ ! // Place the handle on the clipboard.
+ ! SetClipboardData(CF_TEXT, hglbCopy);
+
+
+
diff --git a/contrib/win32/examples.factor b/contrib/win32/examples.factor
new file mode 100644
index 0000000000..1f748b6db2
--- /dev/null
+++ b/contrib/win32/examples.factor
@@ -0,0 +1,39 @@
+IN: win32
+USING: alien namespaces math io prettyprint kernel ;
+
+SYMBOL: hInst
+SYMBOL: wc
+SYMBOL: className "SimpleWindowClass" className set
+
+: hello-world
+ f "Hello, world!" "First Application" MB_OK MessageBox win32-error drop ;
+
+
+! : message-loop ( -- )
+ ! message-loop ;
+
+: app2
+ f GetModuleHandle hInst set
+
+ "WNDCLASSEX" c-size over set-WNDCLASSEX-cbSize
+ CS_HREDRAW CS_VREDRAW bitor over set-WNDCLASSEX-style
+ ! [ event-loop ] over set-WNDCLASSEX-lpfnWndProc
+ 0 over set-WNDCLASSEX-cbClsExtra
+ 0 over set-WNDCLASSEX-cbWndExtra
+ hInst get over set-WNDCLASSEX-hInstance
+ COLOR_WINDOW 1 + over set-WNDCLASSEX-hbrBackground
+ f over set-WNDCLASSEX-lpszMenuName
+ className get over set-WNDCLASSEX-lpszClassName
+ ! ! f IDI_APPLICATION LoadIcon over [ set-WNDCLASSEX-hIcon ] keep set-WNDCLASSEX-hIconSm
+ ! f IDC_ARROW LoadCursor over set-WNDCLASSEX-hCursor
+ ! RegisterClassEx
+
+ ! 0 className get "Second Application" WS_OVERLAPPEDWINDOW CW_USEDEFAULT CW_USEDEFAULT CW_USEDEFAULT CW_USEDEFAULT f f hInst get f ! CreateWindowEx
+
+ ! dup SW_SHOWDEFAULT ShowWindow
+ ! dup UpdateWindow
+ ! message-loop
+
+
+ ! f GetModuleHandle
+ ;
diff --git a/contrib/win32/kernel-notes.txt b/contrib/win32/kernel-notes.txt
new file mode 100644
index 0000000000..ae82d79389
--- /dev/null
+++ b/contrib/win32/kernel-notes.txt
@@ -0,0 +1,2943 @@
+// Generated by PE Explorer 1.97 (www.heaventools.com)
+// File name: C:\WINDOWS\system32\kernel32.dll
+// Created : 29.11.2005 02:34
+// Type : Exports
+
+
+// ActivateActCtx; Index 1; Information not available
+
+function AddAtom(lpString: PAnsiChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'AddAtomA' index 1;
+
+function AddAtomW(lpString: PWideChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'AddAtomW' index 2;
+
+// AddConsoleAliasA; Index 4; Information not available
+
+// AddConsoleAliasW; Index 5; Information not available
+
+// AddLocalAlternateComputerNameA; Index 6; Information not available
+
+// AddLocalAlternateComputerNameW; Index 7; Information not available
+
+// AddRefActCtx; Index 8; Information not available
+
+// AddVectoredExceptionHandler; Index 9; Information not available
+
+function AllocConsole: BOOL; stdcall;
+ external 'kernel32.dll' name 'AllocConsole' index 5;
+
+// AllocateUserPhysicalPages; Index 11; Information not available
+
+function AreFileApisANSI: BOOL; stdcall;
+ external 'kernel32.dll' name 'AreFileApisANSI' index 7;
+
+// AssignProcessToJobObject; Index 13; Information not available
+
+// AttachConsole; Index 14; Information not available
+
+function BackupRead(hFile: THandle; lpBuffer: PByte;
+ nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD;
+ bAbort: BOOL; bProcessSecurity: BOOL; var lpContext: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'BackupRead' index 9;
+
+function BackupSeek(hFile: THandle; dwLowBytesToSeek,
+ dwHighBytesToSeek: DWORD; var lpdwLowByteSeeked,
+ lpdwHighByteSeeked: DWORD; lpContext: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'BackupSeek' index 10;
+
+function BackupWrite(hFile: THandle; lpBuffer: PByte;
+ nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; bAbort,
+ bProcessSecurity: BOOL; var lpContext: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'BackupWrite' index 11;
+
+// BaseCheckAppcompatCache; Index 18; Information not available
+
+// BaseCleanupAppcompatCache; Index 19; Information not available
+
+// BaseCleanupAppcompatCacheSupport; Index 20; Information not available
+
+// BaseDumpAppcompatCache; Index 21; Information not available
+
+// BaseFlushAppcompatCache; Index 22; Information not available
+
+// BaseInitAppcompatCache; Index 23; Information not available
+
+// BaseInitAppcompatCacheSupport; Index 24; Information not available
+
+// BaseProcessInitPostImport; Index 25; Information not available
+
+// BaseQueryModuleData; Index 26; Information not available
+
+// BaseUpdateAppcompatCache; Index 27; Information not available
+
+// BasepCheckWinSaferRestrictions; Index 28; Information not available
+
+function Beep(dwFreq, dwDuration: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'Beep' index 13;
+
+function BeginUpdateResource(pFileName: PAnsiChar;
+ bDeleteExistingResources: BOOL): THandle; stdcall;
+ external 'kernel32.dll' name 'BeginUpdateResourceA' index 14;
+
+function BeginUpdateResourceW(pFileName: PWideChar;
+ bDeleteExistingResources: BOOL): THandle; stdcall;
+ external 'kernel32.dll' name 'BeginUpdateResourceW' index 15;
+
+// BindIoCompletionCallback; Index 32; Information not available
+
+function BuildCommDCB(lpDef: PAnsiChar; var lpDCB: TDCB): BOOL; stdcall;
+ external 'kernel32.dll' name 'BuildCommDCBA' index 17;
+
+function BuildCommDCBAndTimeouts(lpDef: PAnsiChar; var lpDCB: TDCB;
+ var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
+ external 'kernel32.dll' name 'BuildCommDCBAndTimeoutsA' index 18;
+
+function BuildCommDCBAndTimeoutsW(lpDef: PWideChar; var lpDCB: TDCB;
+ var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
+ external 'kernel32.dll' name 'BuildCommDCBAndTimeoutsW' index 19;
+
+function BuildCommDCBW(lpDef: PWideChar; var lpDCB: TDCB): BOOL; stdcall;
+ external 'kernel32.dll' name 'BuildCommDCBW' index 20;
+
+function CallNamedPipe(lpNamedPipeName: PAnsiChar; lpInBuffer: Pointer;
+ nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
+ var lpBytesRead: DWORD; nTimeOut: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'CallNamedPipeA' index 21;
+
+function CallNamedPipeW(lpNamedPipeName: PWideChar; lpInBuffer: Pointer;
+ nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
+ var lpBytesRead: DWORD; nTimeOut: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'CallNamedPipeW' index 22;
+
+// CancelDeviceWakeupRequest; Index 39; Information not available
+
+function CancelIo(hFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'CancelIo' index 24;
+
+// CancelTimerQueueTimer; Index 41; Information not available
+
+function CancelWaitableTimer(hTimer: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'CancelWaitableTimer' index 26;
+
+// ChangeTimerQueueTimer; Index 43; Information not available
+
+// CheckNameLegalDOS8Dot3A; Index 44; Information not available
+
+// CheckNameLegalDOS8Dot3W; Index 45; Information not available
+
+// CheckRemoteDebuggerPresent; Index 46; Information not available
+
+function ClearCommBreak(hFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'ClearCommBreak' index 28;
+
+function ClearCommError(hFile: THandle; var lpErrors: DWORD;
+ lpStat: PComStat): BOOL; stdcall;
+ external 'kernel32.dll' name 'ClearCommError' index 29;
+
+// CloseConsoleHandle; Index 49; Information not available
+
+function CloseHandle(hObject: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'CloseHandle' index 31;
+
+// CloseProfileUserMapping; Index 51; Information not available
+
+// CmdBatNotification; Index 52; Information not available
+
+function CommConfigDialog(lpszName: PAnsiChar; hWnd: HWND;
+ var lpCC: TCommConfig): BOOL; stdcall;
+ external 'kernel32.dll' name 'CommConfigDialogA' index 34;
+
+function CommConfigDialogW(lpszName: PWideChar; hWnd: HWND;
+ var lpCC: TCommConfig): BOOL; stdcall;
+ external 'kernel32.dll' name 'CommConfigDialogW' index 35;
+
+function CompareFileTime(const lpFileTime1, lpFileTime2: TFileTime): Longint;
+ stdcall; external 'kernel32.dll' name 'CompareFileTime' index 36;
+
+function CompareString(Locale: LCID; dwCmpFlags: DWORD; lpString1: PAnsiChar;
+ cchCount1: Integer; lpString2: PAnsiChar; cchCount2: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'CompareStringA' index 37;
+
+function CompareStringW(Locale: LCID; dwCmpFlags: DWORD; lpString1: PWideChar;
+ cchCount1: Integer; lpString2: PWideChar; cchCount2: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'CompareStringW' index 38;
+
+function ConnectNamedPipe(hNamedPipe: THandle;
+ lpOverlapped: POverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'ConnectNamedPipe' index 39;
+
+// ConsoleMenuControl; Index 59; Information not available
+
+function ContinueDebugEvent(dwProcessId, dwThreadId,
+ dwContinueStatus: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ContinueDebugEvent' index 41;
+
+function ConvertDefaultLocale(Locale: LCID): LCID; stdcall;
+ external 'kernel32.dll' name 'ConvertDefaultLocale' index 42;
+
+// ConvertFiberToThread; Index 62; Information not available
+
+function ConvertThreadToFiber(lpParameter: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'ConvertThreadToFiber' index 43;
+
+function CopyFile(lpExistingFileName, lpNewFileName: PAnsiChar;
+ bFailIfExists: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'CopyFileA' index 44;
+
+function CopyFileEx(lpExistingFileName, lpNewFileName: PAnsiChar;
+ lpProgressRoutine: TFNProgressRoutine; lpData: Pointer; pbCancel: PBool;
+ dwCopyFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'CopyFileExA' index 45;
+
+function CopyFileExW(lpExistingFileName, lpNewFileName: PWideChar;
+ lpProgressRoutine: TFNProgressRoutine; lpData: Pointer; pbCancel: PBool;
+ dwCopyFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'CopyFileExW' index 46;
+
+function CopyFileW(lpExistingFileName, lpNewFileName: PWideChar;
+ bFailIfExists: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'CopyFileW' index 47;
+
+// CopyLZFile; Index 68; Information not available
+
+// CreateActCtxA; Index 69; Information not available
+
+// CreateActCtxW; Index 70; Information not available
+
+function CreateConsoleScreenBuffer(dwDesiredAccess, dwShareMode: DWORD;
+ lpSecurityAttributes: PSecurityAttributes; dwFlags: DWORD;
+ lpScreenBufferData: Pointer): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateConsoleScreenBuffer' index 48;
+
+function CreateDirectory(lpPathName: PAnsiChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateDirectoryA' index 49;
+
+function CreateDirectoryEx(lpTemplateDirectory, lpNewDirectory: PAnsiChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateDirectoryExA' index 50;
+
+function CreateDirectoryExW(lpTemplateDirectory, lpNewDirectory: PWideChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateDirectoryExW' index 51;
+
+function CreateDirectoryW(lpPathName: PWideChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateDirectoryW' index 52;
+
+function CreateEvent(lpEventAttributes: PSecurityAttributes; bManualReset,
+ bInitialState: BOOL; lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateEventA' index 53;
+
+function CreateEventW(lpEventAttributes: PSecurityAttributes; bManualReset,
+ bInitialState: BOOL; lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateEventW' index 54;
+
+function CreateFiber(dwStackSize: DWORD; lpStartAddress: TFNFiberStartRoutine;
+ lpParameter: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateFiber' index 55;
+
+// CreateFiberEx; Index 79; Information not available
+
+function CreateFile(lpFileName: PAnsiChar; dwDesiredAccess,
+ dwShareMode: DWORD; lpSecurityAttributes: PSecurityAttributes;
+ dwCreationDisposition, dwFlagsAndAttributes: DWORD;
+ hTemplateFile: THandle): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateFileA' index 56;
+
+function CreateFileMapping(hFile: THandle;
+ lpFileMappingAttributes: PSecurityAttributes; flProtect,
+ dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: PAnsiChar): THandle;
+ stdcall; external 'kernel32.dll' name 'CreateFileMappingA' index 57;
+
+function CreateFileMappingW(hFile: THandle;
+ lpFileMappingAttributes: PSecurityAttributes; flProtect,
+ dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: PWideChar): THandle;
+ stdcall; external 'kernel32.dll' name 'CreateFileMappingW' index 58;
+
+function CreateFileW(lpFileName: PWideChar; dwDesiredAccess,
+ dwShareMode: DWORD; lpSecurityAttributes: PSecurityAttributes;
+ dwCreationDisposition, dwFlagsAndAttributes: DWORD;
+ hTemplateFile: THandle): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateFileW' index 59;
+
+function CreateHardLink(lpFileName, lpExistingFileName: PAnsiChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateHardLinkA' index 60;
+
+function CreateHardLinkW(lpFileName, lpExistingFileName: PWideChar;
+ lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateHardLinkW' index 61;
+
+function CreateIoCompletionPort(FileHandle, ExistingCompletionPort: THandle;
+ CompletionKey, NumberOfConcurrentThreads: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateIoCompletionPort' index 62;
+
+// CreateJobObjectA; Index 87; Information not available
+
+// CreateJobObjectW; Index 88; Information not available
+
+// CreateJobSet; Index 89; Information not available
+
+function CreateMailslot(lpName: PAnsiChar; nMaxMessageSize: DWORD;
+ lReadTimeout: DWORD;
+ lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateMailslotA' index 65;
+
+function CreateMailslotW(lpName: PWideChar; nMaxMessageSize: DWORD;
+ lReadTimeout: DWORD;
+ lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateMailslotW' index 66;
+
+// CreateMemoryResourceNotification; Index 92; Information not available
+
+function CreateMutex(lpMutexAttributes: PSecurityAttributes;
+ bInitialOwner: BOOL; lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateMutexA' index 67;
+
+function CreateMutexW(lpMutexAttributes: PSecurityAttributes;
+ bInitialOwner: BOOL; lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateMutexW' index 68;
+
+function CreateNamedPipe(lpName: PAnsiChar; dwOpenMode, dwPipeMode,
+ nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut: DWORD;
+ lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateNamedPipeA' index 69;
+
+function CreateNamedPipeW(lpName: PWideChar; dwOpenMode, dwPipeMode,
+ nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut: DWORD;
+ lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateNamedPipeW' index 70;
+
+// CreateNlsSecurityDescriptor; Index 97; Information not available
+
+function CreatePipe(var hReadPipe, hWritePipe: THandle;
+ lpPipeAttributes: PSecurityAttributes; nSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreatePipe' index 71;
+
+function CreateProcess(lpApplicationName: PAnsiChar; lpCommandLine: PAnsiChar;
+ lpProcessAttributes, lpThreadAttributes: PSecurityAttributes;
+ bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer;
+ lpCurrentDirectory: PAnsiChar; const lpStartupInfo: TStartupInfo;
+ var lpProcessInformation: TProcessInformation): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateProcessA' index 72;
+
+// CreateProcessInternalA; Index 100; Information not available
+
+// CreateProcessInternalW; Index 101; Information not available
+
+// CreateProcessInternalWSecure; Index 102; Information not available
+
+function CreateProcessW(lpApplicationName: PWideChar;
+ lpCommandLine: PWideChar; lpProcessAttributes,
+ lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;
+ dwCreationFlags: DWORD; lpEnvironment: Pointer;
+ lpCurrentDirectory: PWideChar; const lpStartupInfo: TStartupInfo;
+ var lpProcessInformation: TProcessInformation): BOOL; stdcall;
+ external 'kernel32.dll' name 'CreateProcessW' index 73;
+
+function CreateRemoteThread(hProcess: THandle; lpThreadAttributes: Pointer;
+ dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine;
+ lpParameter: Pointer; dwCreationFlags: DWORD;
+ var lpThreadId: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateRemoteThread' index 74;
+
+function CreateSemaphore(lpSemaphoreAttributes: PSecurityAttributes;
+ lInitialCount, lMaximumCount: Longint; lpName: PAnsiChar): THandle;
+ stdcall; external 'kernel32.dll' name 'CreateSemaphoreA' index 75;
+
+function CreateSemaphoreW(lpSemaphoreAttributes: PSecurityAttributes;
+ lInitialCount, lMaximumCount: Longint; lpName: PWideChar): THandle;
+ stdcall; external 'kernel32.dll' name 'CreateSemaphoreW' index 76;
+
+// CreateSocketHandle; Index 107; Information not available
+
+function CreateTapePartition(hDevice: THandle; dwPartitionMethod, dwCount,
+ dwSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'CreateTapePartition' index 77;
+
+function CreateThread(lpThreadAttributes: Pointer; dwStackSize: DWORD;
+ lpStartAddress: TFNThreadStartRoutine; lpParameter: Pointer;
+ dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateThread' index 78;
+
+// CreateTimerQueue; Index 110; Information not available
+
+// CreateTimerQueueTimer; Index 111; Information not available
+
+function CreateToolhelp32Snapshot(dwFlags, th32ProcessID: DWORD): THandle;
+ stdcall;
+ external 'kernel32.dll' name 'CreateToolhelp32Snapshot' index 81;
+
+// CreateVirtualBuffer; Index 113; Information not available
+
+function CreateWaitableTimer(lpTimerAttributes: PSecurityAttributes;
+ bManualReset: BOOL; lpTimerName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateWaitableTimerA' index 83;
+
+function CreateWaitableTimerW(lpTimerAttributes: PSecurityAttributes;
+ bManualReset: BOOL; lpTimerName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'CreateWaitableTimerW' index 84;
+
+// DeactivateActCtx; Index 116; Information not available
+
+function DebugActiveProcess(dwProcessId: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'DebugActiveProcess' index 85;
+
+// DebugActiveProcessStop; Index 118; Information not available
+
+procedure DebugBreak; stdcall;
+ external 'kernel32.dll' name 'DebugBreak' index 86;
+
+// DebugBreakProcess; Index 120; Information not available
+
+// DebugSetProcessKillOnExit; Index 121; Information not available
+
+// DecodePointer; Index 122; Information not available
+
+// DecodeSystemPointer; Index 123; Information not available
+
+function DefineDosDevice(dwFlags: DWORD; lpDeviceName,
+ lpTargetPath: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'DefineDosDeviceA' index 87;
+
+function DefineDosDeviceW(dwFlags: DWORD; lpDeviceName,
+ lpTargetPath: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'DefineDosDeviceW' index 88;
+
+// DelayLoadFailureHook; Index 126; Information not available
+
+function DeleteAtom(nAtom: ATOM): ATOM; stdcall;
+ external 'kernel32.dll' name 'DeleteAtom' index 90;
+
+procedure DeleteCriticalSection(var lpCriticalSection: TRTLCriticalSection);
+ stdcall; external 'kernel32.dll' name 'DeleteCriticalSection' index 91;
+
+function DeleteFiber(lpFiber: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'DeleteFiber' index 92;
+
+function DeleteFile(lpFileName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'DeleteFileA' index 93;
+
+function DeleteFileW(lpFileName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'DeleteFileW' index 94;
+
+// DeleteTimerQueue; Index 132; Information not available
+
+// DeleteTimerQueueEx; Index 133; Information not available
+
+// DeleteTimerQueueTimer; Index 134; Information not available
+
+// DeleteVolumeMountPointA; Index 135; Information not available
+
+// DeleteVolumeMountPointW; Index 136; Information not available
+
+function DeviceIoControl(hDevice: THandle; dwIoControlCode: DWORD;
+ lpInBuffer: Pointer; nInBufferSize: DWORD; lpOutBuffer: Pointer;
+ nOutBufferSize: DWORD; var lpBytesReturned: DWORD;
+ lpOverlapped: POverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'DeviceIoControl' index 100;
+
+function DisableThreadLibraryCalls(hLibModule: HMODULE): BOOL; stdcall;
+ external 'kernel32.dll' name 'DisableThreadLibraryCalls' index 101;
+
+function DisconnectNamedPipe(hNamedPipe: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'DisconnectNamedPipe' index 102;
+
+// DnsHostnameToComputerNameA; Index 140; Information not available
+
+// DnsHostnameToComputerNameW; Index 141; Information not available
+
+function DosDateTimeToFileTime(wFatDate, wFatTime: Word;
+ var lpFileTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'DosDateTimeToFileTime' index 105;
+
+// DosPathToSessionPathA; Index 143; Information not available
+
+// DosPathToSessionPathW; Index 144; Information not available
+
+// DuplicateConsoleHandle; Index 145; Information not available
+
+function DuplicateHandle(hSourceProcessHandle, hSourceHandle,
+ hTargetProcessHandle: THandle; lpTargetHandle: PHandle;
+ dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwOptions: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'DuplicateHandle' index 109;
+
+// EncodePointer; Index 147; Information not available
+
+// EncodeSystemPointer; Index 148; Information not available
+
+function EndUpdateResource(hUpdate: THandle; fDiscard: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'EndUpdateResourceA' index 110;
+
+function EndUpdateResourceW(hUpdate: THandle; fDiscard: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'EndUpdateResourceW' index 111;
+
+procedure EnterCriticalSection(var lpCriticalSection: TRTLCriticalSection);
+ stdcall; external 'kernel32.dll' name 'EnterCriticalSection' index 112;
+
+function EnumCalendarInfo(lpCalInfoEnumProc: TFNCalInfoEnumProc; Locale: LCID;
+ Calendar: CALID; CalType: CALTYPE): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumCalendarInfoA' index 113;
+
+// EnumCalendarInfoExA; Index 153; Information not available
+
+// EnumCalendarInfoExW; Index 154; Information not available
+
+function EnumCalendarInfoW(lpCalInfoEnumProc: TFNCalInfoEnumProc;
+ Locale: LCID; Calendar: CALID; CalType: CALTYPE): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumCalendarInfoW' index 116;
+
+function EnumDateFormats(lpDateFmtEnumProc: TFNDateFmtEnumProc; Locale: LCID;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumDateFormatsA' index 117;
+
+// EnumDateFormatsExA; Index 157; Information not available
+
+// EnumDateFormatsExW; Index 158; Information not available
+
+function EnumDateFormatsW(lpDateFmtEnumProc: TFNDateFmtEnumProc; Locale: LCID;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumDateFormatsW' index 120;
+
+// EnumLanguageGroupLocalesA; Index 160; Information not available
+
+// EnumLanguageGroupLocalesW; Index 161; Information not available
+
+function EnumResourceLanguages(hModule: HMODULE; lpType, lpName: PAnsiChar;
+ lpEnumFunc: ENUMRESLANGPROC; lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceLanguagesA' index 123;
+
+function EnumResourceLanguagesW(hModule: HMODULE; lpType, lpName: PWideChar;
+ lpEnumFunc: ENUMRESLANGPROC; lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceLanguagesW' index 124;
+
+function EnumResourceNames(hModule: HMODULE; lpType: PAnsiChar;
+ lpEnumFunc: ENUMRESNAMEPROC; lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceNamesA' index 125;
+
+function EnumResourceNamesW(hModule: HMODULE; lpType: PWideChar;
+ lpEnumFunc: ENUMRESNAMEPROC; lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceNamesW' index 126;
+
+function EnumResourceTypes(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROC;
+ lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceTypesA' index 127;
+
+function EnumResourceTypesW(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROC;
+ lParam: Longint): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumResourceTypesW' index 128;
+
+function EnumSystemCodePages(lpCodePageEnumProc: TFNCodepageEnumProc;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumSystemCodePagesA' index 129;
+
+function EnumSystemCodePagesW(lpCodePageEnumProc: TFNCodepageEnumProc;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumSystemCodePagesW' index 130;
+
+// EnumSystemGeoID; Index 170; Information not available
+
+// EnumSystemLanguageGroupsA; Index 171; Information not available
+
+// EnumSystemLanguageGroupsW; Index 172; Information not available
+
+function EnumSystemLocales(lpLocaleEnumProc: TFNLocaleEnumProc;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumSystemLocalesA' index 133;
+
+function EnumSystemLocalesW(lpLocaleEnumProc: TFNLocaleEnumProc;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumSystemLocalesW' index 134;
+
+function EnumTimeFormats(lpTimeFmtEnumProc: TFNTimeFmtEnumProc; Locale: LCID;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumTimeFormatsA' index 135;
+
+function EnumTimeFormatsW(lpTimeFmtEnumProc: TFNTimeFmtEnumProc; Locale: LCID;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EnumTimeFormatsW' index 136;
+
+// EnumUILanguagesA; Index 177; Information not available
+
+// EnumUILanguagesW; Index 178; Information not available
+
+// EnumerateLocalComputerNamesA; Index 179; Information not available
+
+// EnumerateLocalComputerNamesW; Index 180; Information not available
+
+function EraseTape(hDevice: THandle; dwEraseType: DWORD;
+ bImmediate: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'EraseTape' index 139;
+
+function EscapeCommFunction(hFile: THandle; dwFunc: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'EscapeCommFunction' index 140;
+
+procedure ExitProcess(uExitCode: UINT); stdcall;
+ external 'kernel32.dll' name 'ExitProcess' index 141;
+
+procedure ExitThread(dwExitCode: DWORD); stdcall;
+ external 'kernel32.dll' name 'ExitThread' index 142;
+
+// ExitVDM; Index 185; Information not available
+
+function ExpandEnvironmentStrings(lpSrc: PAnsiChar; lpDst: PAnsiChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'ExpandEnvironmentStringsA' index 144;
+
+function ExpandEnvironmentStringsW(lpSrc: PWideChar; lpDst: PWideChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'ExpandEnvironmentStringsW' index 145;
+
+// ExpungeConsoleCommandHistoryA; Index 188; Information not available
+
+// ExpungeConsoleCommandHistoryW; Index 189; Information not available
+
+// ExtendVirtualBuffer; Index 190; Information not available
+
+procedure FatalAppExit(uAction: UINT; lpMessageText: PAnsiChar); stdcall;
+ external 'kernel32.dll' name 'FatalAppExitA' index 149;
+
+procedure FatalAppExitW(uAction: UINT; lpMessageText: PWideChar); stdcall;
+ external 'kernel32.dll' name 'FatalAppExitW' index 150;
+
+procedure FatalExit(ExitCode: Integer); stdcall;
+ external 'kernel32.dll' name 'FatalExit' index 151;
+
+function FileTimeToDosDateTime(const lpFileTime: TFileTime; var lpFatDate,
+ lpFatTime: Word): BOOL; stdcall;
+ external 'kernel32.dll' name 'FileTimeToDosDateTime' index 152;
+
+function FileTimeToLocalFileTime(const lpFileTime: TFileTime;
+ var lpLocalFileTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'FileTimeToLocalFileTime' index 153;
+
+function FileTimeToSystemTime(const lpFileTime: TFileTime;
+ var lpSystemTime: TSystemTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'FileTimeToSystemTime' index 154;
+
+function FillConsoleOutputAttribute(hConsoleOutput: THandle; wAttribute: Word;
+ nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FillConsoleOutputAttribute' index 155;
+
+function FillConsoleOutputCharacter(hConsoleOutput: THandle;
+ cCharacter: AnsiChar; nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FillConsoleOutputCharacterA' index 156;
+
+function FillConsoleOutputCharacterW(hConsoleOutput: THandle;
+ cCharacter: WideChar; nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FillConsoleOutputCharacterW' index 157;
+
+// FindActCtxSectionGuid; Index 200; Information not available
+
+// FindActCtxSectionStringA; Index 201; Information not available
+
+// FindActCtxSectionStringW; Index 202; Information not available
+
+function FindAtom(lpString: PAnsiChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'FindAtomA' index 158;
+
+function FindAtomW(lpString: PWideChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'FindAtomW' index 159;
+
+function FindClose(hFindFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindClose' index 160;
+
+function FindCloseChangeNotification(hChangeHandle: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindCloseChangeNotification' index 161;
+
+function FindFirstChangeNotification(lpPathName: PAnsiChar;
+ bWatchSubtree: BOOL; dwNotifyFilter: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'FindFirstChangeNotificationA' index 162;
+
+function FindFirstChangeNotificationW(lpPathName: PWideChar;
+ bWatchSubtree: BOOL; dwNotifyFilter: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'FindFirstChangeNotificationW' index 163;
+
+function FindFirstFile(lpFileName: PAnsiChar;
+ var lpFindFileData: TWIN32FindDataA): THandle; stdcall;
+ external 'kernel32.dll' name 'FindFirstFileA' index 164;
+
+function FindFirstFileEx(lpFileName: PAnsiChar;
+ fInfoLevelId: TFindexInfoLevels; lpFindFileData: Pointer;
+ fSearchOp: TFindexSearchOps; lpSearchFilter: Pointer;
+ dwAdditionalFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindFirstFileExA' index 165;
+
+function FindFirstFileExW(lpFileName: PWideChar;
+ fInfoLevelId: TFindexInfoLevels; lpFindFileData: Pointer;
+ fSearchOp: TFindexSearchOps; lpSearchFilter: Pointer;
+ dwAdditionalFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindFirstFileExW' index 166;
+
+function FindFirstFileW(lpFileName: PWideChar;
+ var lpFindFileData: TWIN32FindDataW): THandle; stdcall;
+ external 'kernel32.dll' name 'FindFirstFileW' index 167;
+
+// FindFirstVolumeA; Index 213; Information not available
+
+// FindFirstVolumeMountPointA; Index 214; Information not available
+
+// FindFirstVolumeMountPointW; Index 215; Information not available
+
+// FindFirstVolumeW; Index 216; Information not available
+
+function FindNextChangeNotification(hChangeHandle: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindNextChangeNotification' index 172;
+
+function FindNextFile(hFindFile: THandle;
+ var lpFindFileData: TWIN32FindDataA): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindNextFileA' index 173;
+
+function FindNextFileW(hFindFile: THandle;
+ var lpFindFileData: TWIN32FindDataW): BOOL; stdcall;
+ external 'kernel32.dll' name 'FindNextFileW' index 174;
+
+// FindNextVolumeA; Index 220; Information not available
+
+// FindNextVolumeMountPointA; Index 221; Information not available
+
+// FindNextVolumeMountPointW; Index 222; Information not available
+
+// FindNextVolumeW; Index 223; Information not available
+
+function FindResource(hModule: HMODULE; lpName, lpType: PAnsiChar): HRSRC;
+ stdcall; external 'kernel32.dll' name 'FindResourceA' index 179;
+
+function FindResourceEx(hModule: HMODULE; lpType, lpName: PAnsiChar;
+ wLanguage: Word): HRSRC; stdcall;
+ external 'kernel32.dll' name 'FindResourceExA' index 180;
+
+function FindResourceExW(hModule: HMODULE; lpType, lpName: PWideChar;
+ wLanguage: Word): HRSRC; stdcall;
+ external 'kernel32.dll' name 'FindResourceExW' index 181;
+
+function FindResourceW(hModule: HMODULE; lpName, lpType: PWideChar): HRSRC;
+ stdcall; external 'kernel32.dll' name 'FindResourceW' index 182;
+
+// FindVolumeClose; Index 228; Information not available
+
+// FindVolumeMountPointClose; Index 229; Information not available
+
+function FlushConsoleInputBuffer(hConsoleInput: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'FlushConsoleInputBuffer' index 185;
+
+function FlushFileBuffers(hFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'FlushFileBuffers' index 186;
+
+function FlushInstructionCache(hProcess: THandle;
+ const lpBaseAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FlushInstructionCache' index 187;
+
+function FlushViewOfFile(const lpBaseAddress: Pointer;
+ dwNumberOfBytesToFlush: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'FlushViewOfFile' index 188;
+
+function FoldString(dwMapFlags: DWORD; lpSrcStr: PAnsiChar; cchSrc: Integer;
+ lpDestStr: PAnsiChar; cchDest: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'FoldStringA' index 189;
+
+function FoldStringW(dwMapFlags: DWORD; lpSrcStr: PWideChar; cchSrc: Integer;
+ lpDestStr: PWideChar; cchDest: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'FoldStringW' index 190;
+
+function FormatMessage(dwFlags: DWORD; lpSource: Pointer; dwMessageId: DWORD;
+ dwLanguageId: DWORD; lpBuffer: PAnsiChar; nSize: DWORD;
+ Arguments: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'FormatMessageA' index 191;
+
+function FormatMessageW(dwFlags: DWORD; lpSource: Pointer; dwMessageId: DWORD;
+ dwLanguageId: DWORD; lpBuffer: PWideChar; nSize: DWORD;
+ Arguments: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'FormatMessageW' index 192;
+
+function FreeConsole: BOOL; stdcall;
+ external 'kernel32.dll' name 'FreeConsole' index 193;
+
+function FreeEnvironmentStrings(p1: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'FreeEnvironmentStringsA' index 194;
+
+function FreeEnvironmentStringsW(p1: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'FreeEnvironmentStringsW' index 195;
+
+function FreeLibrary(hLibModule: HMODULE): BOOL; stdcall;
+ external 'kernel32.dll' name 'FreeLibrary' index 196;
+
+procedure FreeLibraryAndExitThread(hLibModule: HMODULE; dwExitCode: DWORD);
+ stdcall;
+ external 'kernel32.dll' name 'FreeLibraryAndExitThread' index 197;
+
+function FreeResource(hResData: HGLOBAL): BOOL; stdcall;
+ external 'kernel32.dll' name 'FreeResource' index 198;
+
+// FreeUserPhysicalPages; Index 244; Information not available
+
+// FreeVirtualBuffer; Index 245; Information not available
+
+function GenerateConsoleCtrlEvent(dwCtrlEvent: DWORD;
+ dwProcessGroupId: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GenerateConsoleCtrlEvent' index 201;
+
+function GetACP: UINT; stdcall;
+ external 'kernel32.dll' name 'GetACP' index 202;
+
+function GetAtomName(nAtom: ATOM; lpBuffer: PAnsiChar; nSize: Integer): UINT;
+ stdcall; external 'kernel32.dll' name 'GetAtomNameA' index 203;
+
+function GetAtomNameW(nAtom: ATOM; lpBuffer: PWideChar; nSize: Integer): UINT;
+ stdcall; external 'kernel32.dll' name 'GetAtomNameW' index 204;
+
+// GetBinaryType; Index 250; Information not available
+
+function GetBinaryType(lpApplicationName: PAnsiChar;
+ var lpBinaryType: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetBinaryTypeA' index 206;
+
+function GetBinaryTypeW(lpApplicationName: PWideChar;
+ var lpBinaryType: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetBinaryTypeW' index 207;
+
+// GetCPFileNameFromRegistry; Index 253; Information not available
+
+function GetCPInfo(CodePage: UINT; var lpCPInfo: TCPInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetCPInfo' index 208;
+
+// GetCPInfoExA; Index 255; Information not available
+
+// GetCPInfoExW; Index 256; Information not available
+
+// GetCalendarInfoA; Index 257; Information not available
+
+// GetCalendarInfoW; Index 258; Information not available
+
+// GetComPlusPackageInstallStatus; Index 259; Information not available
+
+function GetCommConfig(hCommDev: THandle; var lpCC: TCommConfig;
+ var lpdwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetCommConfig' index 213;
+
+function GetCommMask(hFile: THandle; var lpEvtMask: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetCommMask' index 214;
+
+function GetCommModemStatus(hFile: THandle; var lpModemStat: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetCommModemStatus' index 215;
+
+function GetCommProperties(hFile: THandle; var lpCommProp: TCommProp): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetCommProperties' index 216;
+
+function GetCommState(hFile: THandle; var lpDCB: TDCB): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetCommState' index 217;
+
+function GetCommTimeouts(hFile: THandle;
+ var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetCommTimeouts' index 218;
+
+function GetCommandLine: PAnsiChar; stdcall;
+ external 'kernel32.dll' name 'GetCommandLineA' index 219;
+
+function GetCommandLineW: PWideChar; stdcall;
+ external 'kernel32.dll' name 'GetCommandLineW' index 220;
+
+function GetCompressedFileSize(lpFileName: PAnsiChar;
+ lpFileSizeHigh: PDWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCompressedFileSizeA' index 221;
+
+function GetCompressedFileSizeW(lpFileName: PWideChar;
+ lpFileSizeHigh: PDWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCompressedFileSizeW' index 222;
+
+function GetComputerName(lpBuffer: PAnsiChar; var nSize: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetComputerNameA' index 223;
+
+// GetComputerNameExA; Index 271; Information not available
+
+// GetComputerNameExW; Index 272; Information not available
+
+function GetComputerNameW(lpBuffer: PWideChar; var nSize: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetComputerNameW' index 226;
+
+// GetConsoleAliasA; Index 274; Information not available
+
+// GetConsoleAliasExesA; Index 275; Information not available
+
+// GetConsoleAliasExesLengthA; Index 276; Information not available
+
+// GetConsoleAliasExesLengthW; Index 277; Information not available
+
+// GetConsoleAliasExesW; Index 278; Information not available
+
+// GetConsoleAliasW; Index 279; Information not available
+
+// GetConsoleAliasesA; Index 280; Information not available
+
+// GetConsoleAliasesLengthA; Index 281; Information not available
+
+// GetConsoleAliasesLengthW; Index 282; Information not available
+
+// GetConsoleAliasesW; Index 283; Information not available
+
+function GetConsoleCP: UINT; stdcall;
+ external 'kernel32.dll' name 'GetConsoleCP' index 237;
+
+// GetConsoleCharType; Index 285; Information not available
+
+// GetConsoleCommandHistoryA; Index 286; Information not available
+
+// GetConsoleCommandHistoryLengthA; Index 287; Information not available
+
+// GetConsoleCommandHistoryLengthW; Index 288; Information not available
+
+// GetConsoleCommandHistoryW; Index 289; Information not available
+
+function GetConsoleCursorInfo(hConsoleOutput: THandle;
+ var lpConsoleCursorInfo: TConsoleCursorInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetConsoleCursorInfo' index 243;
+
+// GetConsoleCursorMode; Index 291; Information not available
+
+// GetConsoleDisplayMode; Index 292; Information not available
+
+// GetConsoleFontInfo; Index 293; Information not available
+
+// GetConsoleFontSize; Index 294; Information not available
+
+// GetConsoleHardwareState; Index 295; Information not available
+
+// GetConsoleInputExeNameA; Index 296; Information not available
+
+// GetConsoleInputExeNameW; Index 297; Information not available
+
+// GetConsoleInputWaitHandle; Index 298; Information not available
+
+// GetConsoleKeyboardLayoutNameA; Index 299; Information not available
+
+// GetConsoleKeyboardLayoutNameW; Index 300; Information not available
+
+function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetConsoleMode' index 254;
+
+// GetConsoleNlsMode; Index 302; Information not available
+
+function GetConsoleOutputCP: UINT; stdcall;
+ external 'kernel32.dll' name 'GetConsoleOutputCP' index 256;
+
+// GetConsoleProcessList; Index 304; Information not available
+
+function GetConsoleScreenBufferInfo(hConsoleOutput: THandle;
+ var lpConsoleScreenBufferInfo: TConsoleScreenBufferInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetConsoleScreenBufferInfo' index 257;
+
+// GetConsoleSelectionInfo; Index 306; Information not available
+
+function GetConsoleTitle(lpConsoleTitle: PAnsiChar; nSize: DWORD): DWORD;
+ stdcall; external 'kernel32.dll' name 'GetConsoleTitleA' index 258;
+
+function GetConsoleTitleW(lpConsoleTitle: PWideChar; nSize: DWORD): DWORD;
+ stdcall; external 'kernel32.dll' name 'GetConsoleTitleW' index 259;
+
+// GetConsoleWindow; Index 309; Information not available
+
+function GetCurrencyFormat(Locale: LCID; dwFlags: DWORD; lpValue: PAnsiChar;
+ lpFormat: PCurrencyFmtA; lpCurrencyStr: PAnsiChar;
+ cchCurrency: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetCurrencyFormatA' index 261;
+
+function GetCurrencyFormatW(Locale: LCID; dwFlags: DWORD; lpValue: PWideChar;
+ lpFormat: PCurrencyFmtW; lpCurrencyStr: PWideChar;
+ cchCurrency: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetCurrencyFormatW' index 262;
+
+// GetCurrentActCtx; Index 312; Information not available
+
+// GetCurrentConsoleFont; Index 313; Information not available
+
+function GetCurrentDirectory(nBufferLength: DWORD;
+ lpBuffer: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCurrentDirectoryA' index 264;
+
+function GetCurrentDirectoryW(nBufferLength: DWORD;
+ lpBuffer: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCurrentDirectoryW' index 265;
+
+function GetCurrentProcess: THandle; stdcall;
+ external 'kernel32.dll' name 'GetCurrentProcess' index 266;
+
+function GetCurrentProcessId: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCurrentProcessId' index 267;
+
+function GetCurrentThread: THandle; stdcall;
+ external 'kernel32.dll' name 'GetCurrentThread' index 268;
+
+function GetCurrentThreadId: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetCurrentThreadId' index 269;
+
+function GetDateFormat(Locale: LCID; dwFlags: DWORD; lpDate: PSystemTime;
+ lpFormat: PAnsiChar; lpDateStr: PAnsiChar; cchDate: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'GetDateFormatA' index 270;
+
+function GetDateFormatW(Locale: LCID; dwFlags: DWORD; lpDate: PSystemTime;
+ lpFormat: PWideChar; lpDateStr: PWideChar; cchDate: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'GetDateFormatW' index 271;
+
+function GetDefaultCommConfig(lpszName: PAnsiChar; var lpCC: TCommConfig;
+ var lpdwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDefaultCommConfigA' index 272;
+
+function GetDefaultCommConfigW(lpszName: PWideChar; var lpCC: TCommConfig;
+ var lpdwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDefaultCommConfigW' index 273;
+
+// GetDefaultSortkeySize; Index 324; Information not available
+
+// GetDevicePowerState; Index 325; Information not available
+
+function GetDiskFreeSpace(lpRootPathName: PAnsiChar; var lpSectorsPerCluster,
+ lpBytesPerSector, lpNumberOfFreeClusters,
+ lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDiskFreeSpaceA' index 276;
+
+function GetDiskFreeSpaceEx(lpDirectoryName: PAnsiChar;
+ var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes;
+ lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDiskFreeSpaceExA' index 277;
+
+function GetDiskFreeSpaceExW(lpDirectoryName: PWideChar;
+ var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes;
+ lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDiskFreeSpaceExW' index 278;
+
+function GetDiskFreeSpaceW(lpRootPathName: PWideChar; var lpSectorsPerCluster,
+ lpBytesPerSector, lpNumberOfFreeClusters,
+ lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetDiskFreeSpaceW' index 279;
+
+// GetDllDirectoryA; Index 330; Information not available
+
+// GetDllDirectoryW; Index 331; Information not available
+
+function GetDriveType(lpRootPathName: PAnsiChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetDriveTypeA' index 280;
+
+function GetDriveTypeW(lpRootPathName: PWideChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetDriveTypeW' index 281;
+
+// GetEnvironmentStrings; Index 334; Information not available
+
+function GetEnvironmentStrings: PAnsiChar; stdcall;
+ external 'kernel32.dll' name 'GetEnvironmentStringsA' index 283;
+
+function GetEnvironmentStringsW: PWideChar; stdcall;
+ external 'kernel32.dll' name 'GetEnvironmentStringsW' index 284;
+
+function GetEnvironmentVariable(lpName: PAnsiChar; lpBuffer: PAnsiChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetEnvironmentVariableA' index 285;
+
+function GetEnvironmentVariableW(lpName: PWideChar; lpBuffer: PWideChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetEnvironmentVariableW' index 286;
+
+function GetExitCodeProcess(hProcess: THandle; var lpExitCode: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetExitCodeProcess' index 287;
+
+function GetExitCodeThread(hThread: THandle; var lpExitCode: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetExitCodeThread' index 288;
+
+// GetExpandedNameA; Index 341; Information not available
+
+// GetExpandedNameW; Index 342; Information not available
+
+function GetFileAttributes(lpFileName: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFileAttributesA' index 289;
+
+function GetFileAttributesEx(lpFileName: PAnsiChar;
+ fInfoLevelId: TGetFileExInfoLevels; lpFileInformation: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetFileAttributesExA' index 290;
+
+function GetFileAttributesExW(lpFileName: PWideChar;
+ fInfoLevelId: TGetFileExInfoLevels; lpFileInformation: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetFileAttributesExW' index 291;
+
+function GetFileAttributesW(lpFileName: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFileAttributesW' index 292;
+
+function GetFileInformationByHandle(hFile: THandle;
+ var lpFileInformation: TByHandleFileInformation): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetFileInformationByHandle' index 293;
+
+function GetFileSize(hFile: THandle; lpFileSizeHigh: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFileSize' index 294;
+
+// GetFileSizeEx; Index 349; Information not available
+
+function GetFileTime(hFile: THandle; lpCreationTime, lpLastAccessTime,
+ lpLastWriteTime: PFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetFileTime' index 296;
+
+function GetFileType(hFile: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFileType' index 297;
+
+// GetFirmwareEnvironmentVariableA; Index 352; Information not available
+
+// GetFirmwareEnvironmentVariableW; Index 353; Information not available
+
+function GetFullPathName(lpFileName: PAnsiChar; nBufferLength: DWORD;
+ lpBuffer: PAnsiChar; var lpFilePart: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFullPathNameA' index 298;
+
+function GetFullPathNameW(lpFileName: PWideChar; nBufferLength: DWORD;
+ lpBuffer: PWideChar; var lpFilePart: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetFullPathNameW' index 299;
+
+// GetGeoInfoA; Index 356; Information not available
+
+// GetGeoInfoW; Index 357; Information not available
+
+// GetHandleContext; Index 358; Information not available
+
+function GetHandleInformation(hObject: THandle; var lpdwFlags: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetHandleInformation' index 300;
+
+function GetLargestConsoleWindowSize(hConsoleOutput: THandle): TCoord;
+ stdcall;
+ external 'kernel32.dll' name 'GetLargestConsoleWindowSize' index 301;
+
+function GetLastError: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetLastError' index 302;
+
+// GetLinguistLangSize; Index 362; Information not available
+
+procedure GetLocalTime(var lpSystemTime: TSystemTime); stdcall;
+ external 'kernel32.dll' name 'GetLocalTime' index 304;
+
+function GetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: PAnsiChar;
+ cchData: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetLocaleInfoA' index 305;
+
+function GetLocaleInfoW(Locale: LCID; LCType: LCTYPE; lpLCData: PWideChar;
+ cchData: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetLocaleInfoW' index 306;
+
+function GetLogicalDriveStrings(nBufferLength: DWORD;
+ lpBuffer: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetLogicalDriveStringsA' index 307;
+
+function GetLogicalDriveStringsW(nBufferLength: DWORD;
+ lpBuffer: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetLogicalDriveStringsW' index 308;
+
+function GetLogicalDrives: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetLogicalDrives' index 309;
+
+// GetLongPathNameA; Index 369; Information not available
+
+// GetLongPathNameW; Index 370; Information not available
+
+function GetMailslotInfo(hMailslot: THandle; lpMaxMessageSize: Pointer;
+ var lpNextSize: DWORD; lpMessageCount, lpReadTimeout: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetMailslotInfo' index 312;
+
+function GetModuleFileName(hModule: HINST; lpFilename: PAnsiChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetModuleFileNameA' index 313;
+
+function GetModuleFileNameW(hModule: HINST; lpFilename: PWideChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetModuleFileNameW' index 314;
+
+function GetModuleHandle(lpModuleName: PAnsiChar): HMODULE; stdcall;
+ external 'kernel32.dll' name 'GetModuleHandleA' index 315;
+
+// GetModuleHandleExA; Index 375; Information not available
+
+// GetModuleHandleExW; Index 376; Information not available
+
+function GetModuleHandleW(lpModuleName: PWideChar): HMODULE; stdcall;
+ external 'kernel32.dll' name 'GetModuleHandleW' index 316;
+
+function GetNamedPipeHandleState(hNamedPipe: THandle; lpState, lpCurInstances,
+ lpMaxCollectionCount, lpCollectDataTimeout: PDWORD;
+ lpUserName: PAnsiChar; nMaxUserNameSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetNamedPipeHandleStateA' index 317;
+
+function GetNamedPipeHandleStateW(hNamedPipe: THandle; lpState,
+ lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout: PDWORD;
+ lpUserName: PWideChar; nMaxUserNameSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetNamedPipeHandleStateW' index 318;
+
+function GetNamedPipeInfo(hNamedPipe: THandle; var lpFlags: DWORD;
+ lpOutBufferSize, lpInBufferSize, lpMaxInstances: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetNamedPipeInfo' index 319;
+
+// GetNativeSystemInfo; Index 381; Information not available
+
+// GetNextVDMCommand; Index 382; Information not available
+
+// GetNlsSectionName; Index 383; Information not available
+
+// GetNumaAvailableMemory; Index 384; Information not available
+
+// GetNumaAvailableMemoryNode; Index 385; Information not available
+
+// GetNumaHighestNodeNumber; Index 386; Information not available
+
+// GetNumaNodeProcessorMask; Index 387; Information not available
+
+// GetNumaProcessorMap; Index 388; Information not available
+
+// GetNumaProcessorNode; Index 389; Information not available
+
+function GetNumberFormat(Locale: LCID; dwFlags: DWORD; lpValue: PAnsiChar;
+ lpFormat: PNumberFmtA; lpNumberStr: PAnsiChar;
+ cchNumber: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetNumberFormatA' index 322;
+
+function GetNumberFormatW(Locale: LCID; dwFlags: DWORD; lpValue: PWideChar;
+ lpFormat: PNumberFmtW; lpNumberStr: PWideChar;
+ cchNumber: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'GetNumberFormatW' index 323;
+
+// GetNumberOfConsoleFonts; Index 392; Information not available
+
+function GetNumberOfConsoleInputEvents(hConsoleInput: THandle;
+ var lpNumberOfEvents: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetNumberOfConsoleInputEvents' index 325;
+
+function GetNumberOfConsoleMouseButtons(var lpNumberOfMouseButtons: DWORD):
+ BOOL; stdcall;
+ external 'kernel32.dll' name 'GetNumberOfConsoleMouseButtons' index 326;
+
+function GetOEMCP: UINT; stdcall;
+ external 'kernel32.dll' name 'GetOEMCP' index 327;
+
+function GetOverlappedResult(hFile: THandle; const lpOverlapped: TOverlapped;
+ var lpNumberOfBytesTransferred: DWORD; bWait: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetOverlappedResult' index 328;
+
+function GetPriorityClass(hProcess: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPriorityClass' index 329;
+
+function GetPrivateProfileInt(lpAppName, lpKeyName: PAnsiChar;
+ nDefault: Integer; lpFileName: PAnsiChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileIntA' index 330;
+
+function GetPrivateProfileIntW(lpAppName, lpKeyName: PWideChar;
+ nDefault: Integer; lpFileName: PWideChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileIntW' index 331;
+
+function GetPrivateProfileSection(lpAppName: PAnsiChar;
+ lpReturnedString: PAnsiChar; nSize: DWORD;
+ lpFileName: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileSectionA' index 332;
+
+function GetPrivateProfileSectionNames(lpszReturnBuffer: PAnsiChar;
+ nSize: DWORD; lpFileName: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileSectionNamesA' index 333;
+
+function GetPrivateProfileSectionNamesW(lpszReturnBuffer: PWideChar;
+ nSize: DWORD; lpFileName: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileSectionNamesW' index 334;
+
+function GetPrivateProfileSectionW(lpAppName: PWideChar;
+ lpReturnedString: PWideChar; nSize: DWORD;
+ lpFileName: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileSectionW' index 335;
+
+function GetPrivateProfileString(lpAppName, lpKeyName, lpDefault: PAnsiChar;
+ lpReturnedString: PAnsiChar; nSize: DWORD;
+ lpFileName: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileStringA' index 336;
+
+function GetPrivateProfileStringW(lpAppName, lpKeyName, lpDefault: PWideChar;
+ lpReturnedString: PWideChar; nSize: DWORD;
+ lpFileName: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileStringW' index 337;
+
+function GetPrivateProfileStruct(lpszSection, lpszKey: PAnsiChar;
+ lpStruct: Pointer; uSizeStruct: UINT; szFile: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileStructA' index 338;
+
+function GetPrivateProfileStructW(lpszSection, lpszKey: PWideChar;
+ lpStruct: Pointer; uSizeStruct: UINT; szFile: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetPrivateProfileStructW' index 339;
+
+function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC;
+ stdcall; external 'kernel32.dll' name 'GetProcAddress' index 340;
+
+function GetProcessAffinityMask(hProcess: THandle; var lpProcessAffinityMask,
+ lpSystemAffinityMask: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetProcessAffinityMask' index 341;
+
+// GetProcessHandleCount; Index 410; Information not available
+
+function GetProcessHeap: THandle; stdcall;
+ external 'kernel32.dll' name 'GetProcessHeap' index 342;
+
+function GetProcessHeaps(NumberOfHeaps: DWORD;
+ var ProcessHeaps: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProcessHeaps' index 343;
+
+// GetProcessId; Index 413; Information not available
+
+// GetProcessIoCounters; Index 414; Information not available
+
+function GetProcessPriorityBoost(hThread: THandle;
+ var DisablePriorityBoost: Bool): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetProcessPriorityBoost' index 345;
+
+function GetProcessShutdownParameters(var lpdwLevel, lpdwFlags: DWORD): BOOL;
+ stdcall;
+ external 'kernel32.dll' name 'GetProcessShutdownParameters' index 346;
+
+function GetProcessTimes(hProcess: THandle; var lpCreationTime, lpExitTime,
+ lpKernelTime, lpUserTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetProcessTimes' index 347;
+
+function GetProcessVersion(ProcessId: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProcessVersion' index 348;
+
+function GetProcessWorkingSetSize(hProcess: THandle;
+ var lpMinimumWorkingSetSize, lpMaximumWorkingSetSize: DWORD): BOOL;
+ stdcall;
+ external 'kernel32.dll' name 'GetProcessWorkingSetSize' index 349;
+
+function GetProfileInt(lpAppName, lpKeyName: PAnsiChar;
+ nDefault: Integer): UINT; stdcall;
+ external 'kernel32.dll' name 'GetProfileIntA' index 350;
+
+function GetProfileIntW(lpAppName, lpKeyName: PWideChar;
+ nDefault: Integer): UINT; stdcall;
+ external 'kernel32.dll' name 'GetProfileIntW' index 351;
+
+function GetProfileSection(lpAppName: PAnsiChar; lpReturnedString: PAnsiChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProfileSectionA' index 352;
+
+function GetProfileSectionW(lpAppName: PWideChar; lpReturnedString: PWideChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProfileSectionW' index 353;
+
+function GetProfileString(lpAppName, lpKeyName, lpDefault: PAnsiChar;
+ lpReturnedString: PAnsiChar; nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProfileStringA' index 354;
+
+function GetProfileStringW(lpAppName, lpKeyName, lpDefault: PWideChar;
+ lpReturnedString: PWideChar; nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetProfileStringW' index 355;
+
+function GetQueuedCompletionStatus(CompletionPort: THandle;
+ var lpNumberOfBytesTransferred, lpCompletionKey: DWORD;
+ var lpOverlapped: POverlapped; dwMilliseconds: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetQueuedCompletionStatus' index 356;
+
+function GetShortPathName(lpszLongPath: PAnsiChar; lpszShortPath: PAnsiChar;
+ cchBuffer: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetShortPathNameA' index 357;
+
+function GetShortPathNameW(lpszLongPath: PWideChar; lpszShortPath: PWideChar;
+ cchBuffer: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetShortPathNameW' index 358;
+
+procedure GetStartupInfo(var lpStartupInfo: TStartupInfo); stdcall;
+ external 'kernel32.dll' name 'GetStartupInfoA' index 359;
+
+procedure GetStartupInfoW(var lpStartupInfo: TStartupInfo); stdcall;
+ external 'kernel32.dll' name 'GetStartupInfoW' index 360;
+
+function GetStdHandle(nStdHandle: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'GetStdHandle' index 361;
+
+function GetStringTypeA(Locale: LCID; dwInfoType: DWORD;
+ const lpSrcStr: LPCSTR; cchSrc: BOOL; var lpCharType: Word): BOOL;
+ external 'kernel32.dll' name 'GetStringTypeA' index 362;
+
+function GetStringTypeEx(Locale: LCID; dwInfoType: DWORD; lpSrcStr: PAnsiChar;
+ cchSrc: Integer; var lpCharType): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetStringTypeExA' index 363;
+
+function GetStringTypeExW(Locale: LCID; dwInfoType: DWORD;
+ lpSrcStr: PWideChar; cchSrc: Integer; var lpCharType): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetStringTypeExW' index 364;
+
+function GetStringTypeW(dwInfoType: DWORD; const lpSrcStr: WCHAR;
+ cchSrc: BOOL; var lpCharType: Word): BOOL;
+ external 'kernel32.dll' name 'GetStringTypeW' index 365;
+
+function GetSystemDefaultLCID: LCID; stdcall;
+ external 'kernel32.dll' name 'GetSystemDefaultLCID' index 366;
+
+function GetSystemDefaultLangID: LANGID; stdcall;
+ external 'kernel32.dll' name 'GetSystemDefaultLangID' index 367;
+
+// GetSystemDefaultUILanguage; Index 438; Information not available
+
+function GetSystemDirectory(lpBuffer: PAnsiChar; uSize: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'GetSystemDirectoryA' index 369;
+
+function GetSystemDirectoryW(lpBuffer: PWideChar; uSize: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'GetSystemDirectoryW' index 370;
+
+procedure GetSystemInfo(var lpSystemInfo: TSystemInfo); stdcall;
+ external 'kernel32.dll' name 'GetSystemInfo' index 371;
+
+function GetSystemPowerStatus(var lpSystemPowerStatus: TSystemPowerStatus):
+ BOOL; stdcall;
+ external 'kernel32.dll' name 'GetSystemPowerStatus' index 372;
+
+// GetSystemRegistryQuota; Index 443; Information not available
+
+procedure GetSystemTime(var lpSystemTime: TSystemTime); stdcall;
+ external 'kernel32.dll' name 'GetSystemTime' index 373;
+
+function GetSystemTimeAdjustment(var lpTimeAdjustment, lpTimeIncrement: DWORD;
+ var lpTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetSystemTimeAdjustment' index 374;
+
+procedure GetSystemTimeAsFileTime(var lpSystemTimeAsFileTime: TFileTime);
+ stdcall;
+ external 'kernel32.dll' name 'GetSystemTimeAsFileTime' index 375;
+
+// GetSystemTimes; Index 447; Information not available
+
+// GetSystemWindowsDirectoryA; Index 448; Information not available
+
+// GetSystemWindowsDirectoryW; Index 449; Information not available
+
+// GetSystemWow64DirectoryA; Index 450; Information not available
+
+// GetSystemWow64DirectoryW; Index 451; Information not available
+
+function GetTapeParameters(hDevice: THandle; dwOperation: DWORD;
+ var lpdwSize: DWORD; lpTapeInformation: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetTapeParameters' index 378;
+
+function GetTapePosition(hDevice: THandle; dwPositionType: DWORD;
+ var lpdwPartition, lpdwOffsetLow: DWORD;
+ lpdwOffsetHigh: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetTapePosition' index 379;
+
+function GetTapeStatus(hDevice: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetTapeStatus' index 380;
+
+function GetTempFileName(lpPathName, lpPrefixString: PAnsiChar; uUnique: UINT;
+ lpTempFileName: PAnsiChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetTempFileNameA' index 381;
+
+function GetTempFileNameW(lpPathName, lpPrefixString: PWideChar;
+ uUnique: UINT; lpTempFileName: PWideChar): UINT; stdcall;
+ external 'kernel32.dll' name 'GetTempFileNameW' index 382;
+
+function GetTempPath(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD;
+ stdcall; external 'kernel32.dll' name 'GetTempPathA' index 383;
+
+function GetTempPathW(nBufferLength: DWORD; lpBuffer: PWideChar): DWORD;
+ stdcall; external 'kernel32.dll' name 'GetTempPathW' index 384;
+
+function GetThreadContext(hThread: THandle; var lpContext: TContext): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetThreadContext' index 385;
+
+// GetThreadIOPendingFlag; Index 460; Information not available
+
+function GetThreadLocale: LCID; stdcall;
+ external 'kernel32.dll' name 'GetThreadLocale' index 386;
+
+function GetThreadPriority(hThread: THandle): Integer; stdcall;
+ external 'kernel32.dll' name 'GetThreadPriority' index 387;
+
+function GetThreadPriorityBoost(hThread: THandle;
+ var DisablePriorityBoost: Bool): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetThreadPriorityBoost' index 388;
+
+function GetThreadSelectorEntry(hThread: THandle; dwSelector: DWORD;
+ var lpSelectorEntry: TLDTEntry): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetThreadSelectorEntry' index 389;
+
+function GetThreadTimes(hThread: THandle; var lpCreationTime, lpExitTime,
+ lpKernelTime, lpUserTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetThreadTimes' index 390;
+
+function GetTickCount: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetTickCount' index 391;
+
+function GetTimeFormat(Locale: LCID; dwFlags: DWORD; lpTime: PSystemTime;
+ lpFormat: PAnsiChar; lpTimeStr: PAnsiChar; cchTime: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'GetTimeFormatA' index 392;
+
+function GetTimeFormatW(Locale: LCID; dwFlags: DWORD; lpTime: PSystemTime;
+ lpFormat: PWideChar; lpTimeStr: PWideChar; cchTime: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'GetTimeFormatW' index 393;
+
+function GetTimeZoneInformation(var lpTimeZoneInformation:
+ TTimeZoneInformation): DWORD; stdcall;
+ external 'kernel32.dll' name 'GetTimeZoneInformation' index 394;
+
+function GetUserDefaultLCID: LCID; stdcall;
+ external 'kernel32.dll' name 'GetUserDefaultLCID' index 395;
+
+function GetUserDefaultLangID: LANGID; stdcall;
+ external 'kernel32.dll' name 'GetUserDefaultLangID' index 396;
+
+// GetUserDefaultUILanguage; Index 472; Information not available
+
+// GetUserGeoID; Index 473; Information not available
+
+// GetVDMCurrentDirectories; Index 474; Information not available
+
+function GetVersion: DWORD; stdcall;
+ external 'kernel32.dll' name 'GetVersion' index 399;
+
+function GetVersionEx(var lpVersionInformation: TOSVersionInfo): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetVersionExA' index 400;
+
+function GetVersionExW(var lpVersionInformation: TOSVersionInfo): BOOL;
+ stdcall; external 'kernel32.dll' name 'GetVersionExW' index 401;
+
+function GetVolumeInformation(lpRootPathName: PAnsiChar;
+ lpVolumeNameBuffer: PAnsiChar; nVolumeNameSize: DWORD;
+ lpVolumeSerialNumber: PDWORD; var lpMaximumComponentLength,
+ lpFileSystemFlags: DWORD; lpFileSystemNameBuffer: PAnsiChar;
+ nFileSystemNameSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetVolumeInformationA' index 402;
+
+function GetVolumeInformationW(lpRootPathName: PWideChar;
+ lpVolumeNameBuffer: PWideChar; nVolumeNameSize: DWORD;
+ lpVolumeSerialNumber: PDWORD; var lpMaximumComponentLength,
+ lpFileSystemFlags: DWORD; lpFileSystemNameBuffer: PWideChar;
+ nFileSystemNameSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'GetVolumeInformationW' index 403;
+
+// GetVolumeNameForVolumeMountPointA; Index 480; Information not available
+
+// GetVolumeNameForVolumeMountPointW; Index 481; Information not available
+
+// GetVolumePathNameA; Index 482; Information not available
+
+// GetVolumePathNameW; Index 483; Information not available
+
+// GetVolumePathNamesForVolumeNameA; Index 484; Information not available
+
+// GetVolumePathNamesForVolumeNameW; Index 485; Information not available
+
+function GetWindowsDirectory(lpBuffer: PAnsiChar; uSize: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'GetWindowsDirectoryA' index 408;
+
+function GetWindowsDirectoryW(lpBuffer: PWideChar; uSize: UINT): UINT;
+ stdcall; external 'kernel32.dll' name 'GetWindowsDirectoryW' index 409;
+
+// GetWriteWatch; Index 488; Information not available
+
+function GlobalAddAtom(lpString: PAnsiChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'GlobalAddAtomA' index 411;
+
+function GlobalAddAtomW(lpString: PWideChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'GlobalAddAtomW' index 412;
+
+function GlobalAlloc(uFlags: UINT; dwBytes: DWORD): HGLOBAL; stdcall;
+ external 'kernel32.dll' name 'GlobalAlloc' index 413;
+
+function GlobalCompact(dwMinFree: DWORD): UINT; stdcall;
+ external 'kernel32.dll' name 'GlobalCompact' index 414;
+
+function GlobalDeleteAtom(nAtom: ATOM): ATOM; stdcall;
+ external 'kernel32.dll' name 'GlobalDeleteAtom' index 415;
+
+function GlobalFindAtom(lpString: PAnsiChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'GlobalFindAtomA' index 416;
+
+function GlobalFindAtomW(lpString: PWideChar): ATOM; stdcall;
+ external 'kernel32.dll' name 'GlobalFindAtomW' index 417;
+
+procedure GlobalFix(hMem: HGLOBAL); stdcall;
+ external 'kernel32.dll' name 'GlobalFix' index 418;
+
+function GlobalFlags(hMem: HGLOBAL): UINT; stdcall;
+ external 'kernel32.dll' name 'GlobalFlags' index 419;
+
+function GlobalFree(hMem: HGLOBAL): HGLOBAL; stdcall;
+ external 'kernel32.dll' name 'GlobalFree' index 420;
+
+function GlobalGetAtomName(nAtom: ATOM; lpBuffer: PAnsiChar;
+ nSize: Integer): UINT; stdcall;
+ external 'kernel32.dll' name 'GlobalGetAtomNameA' index 421;
+
+function GlobalGetAtomNameW(nAtom: ATOM; lpBuffer: PWideChar;
+ nSize: Integer): UINT; stdcall;
+ external 'kernel32.dll' name 'GlobalGetAtomNameW' index 422;
+
+function GlobalHandle(Mem: Pointer): HGLOBAL; stdcall;
+ external 'kernel32.dll' name 'GlobalHandle' index 423;
+
+function GlobalLock(hMem: HGLOBAL): Pointer; stdcall;
+ external 'kernel32.dll' name 'GlobalLock' index 424;
+
+procedure GlobalMemoryStatus(var lpBuffer: TMemoryStatus); stdcall;
+ external 'kernel32.dll' name 'GlobalMemoryStatus' index 425;
+
+// GlobalMemoryStatusEx; Index 504; Information not available
+
+function GlobalReAlloc(hMem: HGLOBAL; dwBytes: DWORD; uFlags: UINT): HGLOBAL;
+ stdcall; external 'kernel32.dll' name 'GlobalReAlloc' index 427;
+
+function GlobalSize(hMem: HGLOBAL): DWORD; stdcall;
+ external 'kernel32.dll' name 'GlobalSize' index 428;
+
+function GlobalUnWire(hMem: HGLOBAL): BOOL; stdcall;
+ external 'kernel32.dll' name 'GlobalUnWire' index 429;
+
+procedure GlobalUnfix(hMem: HGLOBAL); stdcall;
+ external 'kernel32.dll' name 'GlobalUnfix' index 430;
+
+function GlobalUnlock(hMem: HGLOBAL): BOOL; stdcall;
+ external 'kernel32.dll' name 'GlobalUnlock' index 431;
+
+function GlobalWire(hMem: HGLOBAL): Pointer; stdcall;
+ external 'kernel32.dll' name 'GlobalWire' index 432;
+
+function Heap32First(var lphe: THeapEntry32; th32ProcessID,
+ th32HeapID: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'Heap32First' index 433;
+
+function Heap32ListFirst(hSnapshot: THandle; var lphl: THeapList32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Heap32ListFirst' index 434;
+
+function Heap32ListNext(hSnapshot: THandle; var lphl: THeapList32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Heap32ListNext' index 435;
+
+function Heap32Next(var lphe: THeapEntry32): BOOL; stdcall;
+ external 'kernel32.dll' name 'Heap32Next' index 436;
+
+function HeapAlloc(hHeap: THandle; dwFlags, dwBytes: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'HeapAlloc' index 437;
+
+function HeapCompact(hHeap: THandle; dwFlags: DWORD): UINT; stdcall;
+ external 'kernel32.dll' name 'HeapCompact' index 438;
+
+function HeapCreate(flOptions, dwInitialSize, dwMaximumSize: DWORD): THandle;
+ stdcall; external 'kernel32.dll' name 'HeapCreate' index 439;
+
+// HeapCreateTagsW; Index 518; Information not available
+
+function HeapDestroy(hHeap: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'HeapDestroy' index 441;
+
+// HeapExtend; Index 520; Information not available
+
+function HeapFree(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'HeapFree' index 443;
+
+function HeapLock(hHeap: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'HeapLock' index 444;
+
+// HeapQueryInformation; Index 523; Information not available
+
+// HeapQueryTagW; Index 524; Information not available
+
+function HeapReAlloc(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer;
+ dwBytes: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'HeapReAlloc' index 446;
+
+// HeapSetInformation; Index 526; Information not available
+
+function HeapSize(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): DWORD;
+ stdcall; external 'kernel32.dll' name 'HeapSize' index 447;
+
+// HeapSummary; Index 528; Information not available
+
+function HeapUnlock(hHeap: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'HeapUnlock' index 449;
+
+// HeapUsage; Index 530; Information not available
+
+function HeapValidate(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): BOOL;
+ stdcall; external 'kernel32.dll' name 'HeapValidate' index 451;
+
+function HeapWalk(hHeap: THandle; var lpEntry: TProcessHeapEntry): BOOL;
+ stdcall; external 'kernel32.dll' name 'HeapWalk' index 452;
+
+function InitAtomTable(nSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'InitAtomTable' index 453;
+
+procedure InitializeCriticalSection(var lpCriticalSection:
+ TRTLCriticalSection); stdcall;
+ external 'kernel32.dll' name 'InitializeCriticalSection' index 454;
+
+function InitializeCriticalSectionAndSpinCount(var lpCriticalSection:
+ TRTLCriticalSection; dwSpinCount: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'InitializeCriticalSectionAndSpinCount'
+ index 455;
+
+// InitializeSListHead; Index 536; Information not available
+
+function InterlockedCompareExchange(var Destination: Pointer;
+ Exchange: Pointer; Comperand: Pointer): Pointer; stdcall;
+ external 'kernel32.dll' name 'InterlockedCompareExchange' index 456;
+
+function InterlockedDecrement(var Addend: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'InterlockedDecrement' index 457;
+
+function InterlockedExchange(var Target: Integer; Value: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'InterlockedExchange' index 458;
+
+function InterlockedExchangeAdd(Addend: PLongint; Value: Longint): Longint;
+ stdcall;
+ external 'kernel32.dll' name 'InterlockedExchangeAdd' index 459;
+
+// InterlockedFlushSList; Index 541; Information not available
+
+function InterlockedIncrement(var Addend: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'InterlockedIncrement' index 460;
+
+// InterlockedPopEntrySList; Index 543; Information not available
+
+// InterlockedPushEntrySList; Index 544; Information not available
+
+// InvalidateConsoleDIBits; Index 545; Information not available
+
+function IsBadCodePtr(lpfn: FARPROC): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadCodePtr' index 462;
+
+function IsBadHugeReadPtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadHugeReadPtr' index 463;
+
+function IsBadHugeWritePtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadHugeWritePtr' index 464;
+
+function IsBadReadPtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadReadPtr' index 465;
+
+function IsBadStringPtr(lpsz: PAnsiChar; ucchMax: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadStringPtrA' index 466;
+
+function IsBadStringPtrW(lpsz: PWideChar; ucchMax: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadStringPtrW' index 467;
+
+function IsBadWritePtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsBadWritePtr' index 468;
+
+function IsDBCSLeadByte(TestChar: Byte): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsDBCSLeadByte' index 469;
+
+function IsDBCSLeadByteEx(CodePage: UINT; TestChar: Byte): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsDBCSLeadByteEx' index 470;
+
+// IsDebuggerPresent; Index 555; Information not available
+
+// IsProcessInJob; Index 556; Information not available
+
+function IsProcessorFeaturePresent(ProcessorFeature: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsProcessorFeaturePresent' index 472;
+
+// IsSystemResumeAutomatic; Index 558; Information not available
+
+function IsValidCodePage(CodePage: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsValidCodePage' index 474;
+
+// IsValidLanguageGroup; Index 560; Information not available
+
+function IsValidLocale(Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'IsValidLocale' index 476;
+
+// IsValidUILanguage; Index 562; Information not available
+
+// IsWow64Process; Index 563; Information not available
+
+function LCMapString(Locale: LCID; dwMapFlags: DWORD; lpSrcStr: PAnsiChar;
+ cchSrc: Integer; lpDestStr: PAnsiChar; cchDest: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'LCMapStringA' index 477;
+
+function LCMapStringW(Locale: LCID; dwMapFlags: DWORD; lpSrcStr: PWideChar;
+ cchSrc: Integer; lpDestStr: PWideChar; cchDest: Integer): Integer;
+ stdcall; external 'kernel32.dll' name 'LCMapStringW' index 478;
+
+// LZClose; Index 566; Information not available
+
+// LZCloseFile; Index 567; Information not available
+
+// LZCopy; Index 568; Information not available
+
+// LZCreateFileW; Index 569; Information not available
+
+// LZDone; Index 570; Information not available
+
+// LZInit; Index 571; Information not available
+
+// LZOpenFileA; Index 572; Information not available
+
+// LZOpenFileW; Index 573; Information not available
+
+// LZRead; Index 574; Information not available
+
+// LZSeek; Index 575; Information not available
+
+// LZStart; Index 576; Information not available
+
+procedure LeaveCriticalSection(var lpCriticalSection: TRTLCriticalSection);
+ stdcall; external 'kernel32.dll' name 'LeaveCriticalSection' index 479;
+
+function LoadLibrary(lpLibFileName: PAnsiChar): HMODULE; stdcall;
+ external 'kernel32.dll' name 'LoadLibraryA' index 480;
+
+function LoadLibraryEx(lpLibFileName: PAnsiChar; hFile: THandle;
+ dwFlags: DWORD): HMODULE; stdcall;
+ external 'kernel32.dll' name 'LoadLibraryExA' index 481;
+
+function LoadLibraryExW(lpLibFileName: PWideChar; hFile: THandle;
+ dwFlags: DWORD): HMODULE; stdcall;
+ external 'kernel32.dll' name 'LoadLibraryExW' index 482;
+
+function LoadLibraryW(lpLibFileName: PWideChar): HMODULE; stdcall;
+ external 'kernel32.dll' name 'LoadLibraryW' index 483;
+
+function LoadModule(lpModuleName: LPCSTR; lpParameterBlock: Pointer): DWORD;
+ stdcall; external 'kernel32.dll' name 'LoadModule' index 484;
+
+function LoadResource(hModule: HINST; hResInfo: HRSRC): HGLOBAL; stdcall;
+ external 'kernel32.dll' name 'LoadResource' index 485;
+
+function LocalAlloc(uFlags, uBytes: UINT): HLOCAL; stdcall;
+ external 'kernel32.dll' name 'LocalAlloc' index 486;
+
+function LocalCompact(uMinFree: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'LocalCompact' index 487;
+
+function LocalFileTimeToFileTime(const lpLocalFileTime: TFileTime;
+ var lpFileTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'LocalFileTimeToFileTime' index 488;
+
+function LocalFlags(hMem: HLOCAL): UINT; stdcall;
+ external 'kernel32.dll' name 'LocalFlags' index 489;
+
+function LocalFree(hMem: HLOCAL): HLOCAL; stdcall;
+ external 'kernel32.dll' name 'LocalFree' index 490;
+
+// LocalHandle; Index 589; Information not available
+
+function LocalLock(hMem: HLOCAL): Pointer; stdcall;
+ external 'kernel32.dll' name 'LocalLock' index 492;
+
+function LocalReAlloc(hMem: HLOCAL; uBytes, uFlags: UINT): HLOCAL; stdcall;
+ external 'kernel32.dll' name 'LocalReAlloc' index 493;
+
+function LocalShrink(hMem: HLOCAL; cbNewSize: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'LocalShrink' index 494;
+
+function LocalSize(hMem: HLOCAL): UINT; stdcall;
+ external 'kernel32.dll' name 'LocalSize' index 495;
+
+function LocalUnlock(hMem: HLOCAL): BOOL; stdcall;
+ external 'kernel32.dll' name 'LocalUnlock' index 496;
+
+function LockFile(hFile: THandle; dwFileOffsetLow, dwFileOffsetHigh: DWORD;
+ nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'LockFile' index 497;
+
+function LockFileEx(hFile: THandle; dwFlags, dwReserved: DWORD;
+ nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh: DWORD;
+ const lpOverlapped: TOverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'LockFileEx' index 498;
+
+function LockResource(hResData: HGLOBAL): Pointer; stdcall;
+ external 'kernel32.dll' name 'LockResource' index 499;
+
+// MapUserPhysicalPages; Index 598; Information not available
+
+// MapUserPhysicalPagesScatter; Index 599; Information not available
+
+function MapViewOfFile(hFileMappingObject: THandle; dwDesiredAccess: DWORD;
+ dwFileOffsetHigh, dwFileOffsetLow,
+ dwNumberOfBytesToMap: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'MapViewOfFile' index 502;
+
+function MapViewOfFileEx(hFileMappingObject: THandle; dwDesiredAccess,
+ dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap: DWORD;
+ lpBaseAddress: Pointer): Pointer; stdcall;
+ external 'kernel32.dll' name 'MapViewOfFileEx' index 503;
+
+function Module32First(hSnapshot: THandle; var lpme: TModuleEntry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Module32First' index 504;
+
+// Module32FirstW; Index 603; Information not available
+
+function Module32Next(hSnapshot: THandle; var lpme: TModuleEntry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Module32Next' index 506;
+
+// Module32NextW; Index 605; Information not available
+
+function MoveFile(lpExistingFileName, lpNewFileName: PAnsiChar): BOOL;
+ stdcall; external 'kernel32.dll' name 'MoveFileA' index 508;
+
+function MoveFileEx(lpExistingFileName, lpNewFileName: PAnsiChar;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'MoveFileExA' index 509;
+
+function MoveFileExW(lpExistingFileName, lpNewFileName: PWideChar;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'MoveFileExW' index 510;
+
+function MoveFileW(lpExistingFileName, lpNewFileName: PWideChar): BOOL;
+ stdcall; external 'kernel32.dll' name 'MoveFileW' index 511;
+
+function MoveFileWithProgress(lpExistingFileName, lpNewFileName: PAnsiChar;
+ lpProgressRoutine: TFNProgressRoutine; lpData: Pointer;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'MoveFileWithProgressA' index 512;
+
+function MoveFileWithProgressW(lpExistingFileName, lpNewFileName: PWideChar;
+ lpProgressRoutine: TFNProgressRoutine; lpData: Pointer;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'MoveFileWithProgressW' index 513;
+
+function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'MulDiv' index 514;
+
+function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD;
+ const lpMultiByteStr: LPCSTR; cchMultiByte: Integer;
+ lpWideCharStr: LPWSTR; cchWideChar: Integer): Integer; stdcall;
+ external 'kernel32.dll' name 'MultiByteToWideChar' index 515;
+
+// NlsConvertIntegerToString; Index 614; Information not available
+
+// NlsGetCacheUpdateCount; Index 615; Information not available
+
+// NlsResetProcessLocale; Index 616; Information not available
+
+// NumaVirtualQueryNode; Index 617; Information not available
+
+// OpenConsoleW; Index 618; Information not available
+
+// OpenDataFile; Index 619; Information not available
+
+function OpenEvent(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenEventA' index 521;
+
+function OpenEventW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenEventW' index 522;
+
+function OpenFile(const lpFileName: LPCSTR; var lpReOpenBuff: TOFStruct;
+ uStyle: UINT): HFILE; stdcall;
+ external 'kernel32.dll' name 'OpenFile' index 523;
+
+function OpenFileMapping(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenFileMappingA' index 524;
+
+function OpenFileMappingW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenFileMappingW' index 525;
+
+// OpenJobObjectA; Index 625; Information not available
+
+// OpenJobObjectW; Index 626; Information not available
+
+function OpenMutex(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenMutexA' index 528;
+
+function OpenMutexW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenMutexW' index 529;
+
+function OpenProcess(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ dwProcessId: DWORD): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenProcess' index 530;
+
+// OpenProfileUserMapping; Index 630; Information not available
+
+function OpenSemaphore(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenSemaphoreA' index 532;
+
+function OpenSemaphoreW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenSemaphoreW' index 533;
+
+// OpenThread; Index 633; Information not available
+
+function OpenWaitableTimer(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpTimerName: PAnsiChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenWaitableTimerA' index 535;
+
+function OpenWaitableTimerW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
+ lpTimerName: PWideChar): THandle; stdcall;
+ external 'kernel32.dll' name 'OpenWaitableTimerW' index 536;
+
+procedure OutputDebugString(lpOutputString: PAnsiChar); stdcall;
+ external 'kernel32.dll' name 'OutputDebugStringA' index 537;
+
+procedure OutputDebugStringW(lpOutputString: PWideChar); stdcall;
+ external 'kernel32.dll' name 'OutputDebugStringW' index 538;
+
+function PeekConsoleInput(hConsoleInput: THandle; var lpBuffer: TInputRecord;
+ nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'PeekConsoleInputA' index 539;
+
+function PeekConsoleInputW(hConsoleInput: THandle; var lpBuffer: TInputRecord;
+ nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'PeekConsoleInputW' index 540;
+
+function PeekNamedPipe(hNamedPipe: THandle; lpBuffer: Pointer;
+ nBufferSize: DWORD; lpBytesRead, lpTotalBytesAvail,
+ lpBytesLeftThisMessage: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'PeekNamedPipe' index 541;
+
+function PostQueuedCompletionStatus(CompletionPort: THandle;
+ dwNumberOfBytesTransferred: DWORD; dwCompletionKey: DWORD;
+ lpOverlapped: POverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'PostQueuedCompletionStatus' index 542;
+
+function PrepareTape(hDevice: THandle; dwOperation: DWORD;
+ bImmediate: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'PrepareTape' index 543;
+
+// PrivCopyFileExW; Index 643; Information not available
+
+// PrivMoveFileIdentityW; Index 644; Information not available
+
+function Process32First(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Process32First' index 546;
+
+// Process32FirstW; Index 646; Information not available
+
+function Process32Next(hSnapshot: THandle; var lppe: TProcessEntry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Process32Next' index 548;
+
+// Process32NextW; Index 648; Information not available
+
+// ProcessIdToSessionId; Index 649; Information not available
+
+function PulseEvent(hEvent: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'PulseEvent' index 551;
+
+function PurgeComm(hFile: THandle; dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'PurgeComm' index 552;
+
+// QueryActCtxW; Index 652; Information not available
+
+// QueryDepthSList; Index 653; Information not available
+
+function QueryDosDevice(lpDeviceName: PAnsiChar; lpTargetPath: PAnsiChar;
+ ucchMax: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'QueryDosDeviceA' index 553;
+
+function QueryDosDeviceW(lpDeviceName: PWideChar; lpTargetPath: PWideChar;
+ ucchMax: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'QueryDosDeviceW' index 554;
+
+// QueryInformationJobObject; Index 656; Information not available
+
+// QueryMemoryResourceNotification; Index 657; Information not available
+
+function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL;
+ stdcall;
+ external 'kernel32.dll' name 'QueryPerformanceCounter' index 556;
+
+function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL;
+ stdcall;
+ external 'kernel32.dll' name 'QueryPerformanceFrequency' index 557;
+
+// QueryWin31IniFilesMappedToRegistry; Index 660; Information not available
+
+function QueueUserAPC(pfnAPC: TFNAPCProc; hThread: THandle;
+ dwData: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'QueueUserAPC' index 559;
+
+// QueueUserWorkItem; Index 662; Information not available
+
+procedure RaiseException(dwExceptionCode, dwExceptionFlags,
+ nNumberOfArguments: DWORD; lpArguments: PDWORD); stdcall;
+ external 'kernel32.dll' name 'RaiseException' index 561;
+
+function ReadConsole(hConsoleInput: THandle; lpBuffer: Pointer;
+ nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
+ lpReserved: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleA' index 562;
+
+function ReadConsoleInput(hConsoleInput: THandle; var lpBuffer: TInputRecord;
+ nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleInputA' index 563;
+
+// ReadConsoleInputExA; Index 666; Information not available
+
+// ReadConsoleInputExW; Index 667; Information not available
+
+function ReadConsoleInputW(hConsoleInput: THandle; var lpBuffer: TInputRecord;
+ nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleInputW' index 566;
+
+function ReadConsoleOutput(hConsoleOutput: THandle; lpBuffer: Pointer;
+ dwBufferSize, dwBufferCoord: TCoord;
+ var lpReadRegion: TSmallRect): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleOutputA' index 567;
+
+function ReadConsoleOutputAttribute(hConsoleOutput: THandle;
+ lpAttribute: Pointer; nLength: DWORD; dwReadCoord: TCoord;
+ var lpNumberOfAttrsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleOutputAttribute' index 568;
+
+function ReadConsoleOutputCharacter(hConsoleOutput: THandle;
+ lpCharacter: PAnsiChar; nLength: DWORD; dwReadCoord: TCoord;
+ var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleOutputCharacterA' index 569;
+
+function ReadConsoleOutputCharacterW(hConsoleOutput: THandle;
+ lpCharacter: PAnsiChar; nLength: DWORD; dwReadCoord: TCoord;
+ var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleOutputCharacterW' index 570;
+
+function ReadConsoleOutputW(hConsoleOutput: THandle; lpBuffer: Pointer;
+ dwBufferSize, dwBufferCoord: TCoord;
+ var lpReadRegion: TSmallRect): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleOutputW' index 571;
+
+function ReadConsoleW(hConsoleInput: THandle; lpBuffer: Pointer;
+ nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD;
+ lpReserved: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadConsoleW' index 572;
+
+function ReadDirectoryChangesW(hDirectory: THandle; lpBuffer: Pointer;
+ nBufferLength: DWORD; bWatchSubtree: Bool; dwNotifyFilter: DWORD;
+ lpBytesReturned: LPDWORD; lpOverlapped: POverlapped;
+ lpCompletionRoutine: FARPROC): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadDirectoryChangesW' index 573;
+
+function ReadFile(hFile: THandle; var Buffer; nNumberOfBytesToRead: DWORD;
+ var lpNumberOfBytesRead: DWORD; lpOverlapped: POverlapped): BOOL;
+ stdcall; external 'kernel32.dll' name 'ReadFile' index 574;
+
+function ReadFileEx(hFile: THandle; lpBuffer: Pointer;
+ nNumberOfBytesToRead: DWORD; lpOverlapped: POverlapped;
+ lpCompletionRoutine: TPROverlappedCompletionRoutine): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReadFileEx' index 575;
+
+// ReadFileScatter; Index 678; Information not available
+
+function ReadProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer;
+ lpBuffer: Pointer; nSize: DWORD; var lpNumberOfBytesRead: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'ReadProcessMemory' index 577;
+
+// RegisterConsoleIME; Index 680; Information not available
+
+// RegisterConsoleOS2; Index 681; Information not available
+
+// RegisterConsoleVDM; Index 682; Information not available
+
+// RegisterWaitForInputIdle; Index 683; Information not available
+
+// RegisterWaitForSingleObject; Index 684; Information not available
+
+// RegisterWaitForSingleObjectEx; Index 685; Information not available
+
+// RegisterWowBaseHandlers; Index 686; Information not available
+
+// RegisterWowExec; Index 687; Information not available
+
+// ReleaseActCtx; Index 688; Information not available
+
+function ReleaseMutex(hMutex: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReleaseMutex' index 586;
+
+function ReleaseSemaphore(hSemaphore: THandle; lReleaseCount: Longint;
+ lpPreviousCount: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'ReleaseSemaphore' index 587;
+
+function RemoveDirectory(lpPathName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'RemoveDirectoryA' index 588;
+
+function RemoveDirectoryW(lpPathName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'RemoveDirectoryW' index 589;
+
+// RemoveLocalAlternateComputerNameA; Index 693; Information not available
+
+// RemoveLocalAlternateComputerNameW; Index 694; Information not available
+
+// RemoveVectoredExceptionHandler; Index 695; Information not available
+
+// ReplaceFile; Index 696; Information not available
+
+// ReplaceFileA; Index 697; Information not available
+
+// ReplaceFileW; Index 698; Information not available
+
+// RequestDeviceWakeup; Index 699; Information not available
+
+// RequestWakeupLatency; Index 700; Information not available
+
+function ResetEvent(hEvent: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'ResetEvent' index 595;
+
+// ResetWriteWatch; Index 702; Information not available
+
+// RestoreLastError; Index 703; Information not available
+
+function ResumeThread(hThread: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'ResumeThread' index 597;
+
+// RtlCaptureContext; Index 705; Information not available
+
+// RtlCaptureStackBackTrace; Index 706; Information not available
+
+// RtlFillMemory; Index 707; Information not available
+
+// RtlMoveMemory; Index 708; Information not available
+
+// RtlUnwind; Index 709; Information not available
+
+// RtlZeroMemory; Index 710; Information not available
+
+function ScrollConsoleScreenBuffer(hConsoleOutput: THandle;
+ const lpScrollRectangle: TSmallRect; lpClipRectangle: PSmallRect;
+ dwDestinationOrigin: TCoord; var lpFill: TCharInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'ScrollConsoleScreenBufferA' index 602;
+
+function ScrollConsoleScreenBufferW(hConsoleOutput: THandle;
+ const lpScrollRectangle: TSmallRect; lpClipRectangle: PSmallRect;
+ dwDestinationOrigin: TCoord; var lpFill: TCharInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'ScrollConsoleScreenBufferW' index 603;
+
+function SearchPath(lpPath, lpFileName, lpExtension: PAnsiChar;
+ nBufferLength: DWORD; lpBuffer: PAnsiChar;
+ var lpFilePart: PAnsiChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'SearchPathA' index 604;
+
+function SearchPathW(lpPath, lpFileName, lpExtension: PWideChar;
+ nBufferLength: DWORD; lpBuffer: PWideChar;
+ var lpFilePart: PWideChar): DWORD; stdcall;
+ external 'kernel32.dll' name 'SearchPathW' index 605;
+
+// SetCPGlobal; Index 715; Information not available
+
+// SetCalendarInfoA; Index 716; Information not available
+
+// SetCalendarInfoW; Index 717; Information not available
+
+// SetClientTimeZoneInformation; Index 718; Information not available
+
+// SetComPlusPackageInstallStatus; Index 719; Information not available
+
+function SetCommBreak(hFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCommBreak' index 609;
+
+function SetCommConfig(hCommDev: THandle; const lpCC: TCommConfig;
+ dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCommConfig' index 610;
+
+function SetCommMask(hFile: THandle; dwEvtMask: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCommMask' index 611;
+
+function SetCommState(hFile: THandle; const lpDCB: TDCB): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCommState' index 612;
+
+function SetCommTimeouts(hFile: THandle;
+ const lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCommTimeouts' index 613;
+
+function SetComputerName(lpComputerName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetComputerNameA' index 614;
+
+// SetComputerNameExA; Index 726; Information not available
+
+// SetComputerNameExW; Index 727; Information not available
+
+function SetComputerNameW(lpComputerName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetComputerNameW' index 617;
+
+function SetConsoleActiveScreenBuffer(hConsoleOutput: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleActiveScreenBuffer' index 618;
+
+function SetConsoleCP(wCodePageID: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleCP' index 619;
+
+// SetConsoleCommandHistoryMode; Index 731; Information not available
+
+function SetConsoleCtrlHandler(HandlerRoutine: TFNHandlerRoutine;
+ Add: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleCtrlHandler' index 621;
+
+// SetConsoleCursor; Index 733; Information not available
+
+function SetConsoleCursorInfo(hConsoleOutput: THandle;
+ const lpConsoleCursorInfo: TConsoleCursorInfo): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleCursorInfo' index 623;
+
+// SetConsoleCursorMode; Index 735; Information not available
+
+function SetConsoleCursorPosition(hConsoleOutput: THandle;
+ dwCursorPosition: TCoord): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleCursorPosition' index 625;
+
+// SetConsoleDisplayMode; Index 737; Information not available
+
+// SetConsoleFont; Index 738; Information not available
+
+// SetConsoleHardwareState; Index 739; Information not available
+
+// SetConsoleIcon; Index 740; Information not available
+
+// SetConsoleInputExeNameA; Index 741; Information not available
+
+// SetConsoleInputExeNameW; Index 742; Information not available
+
+// SetConsoleKeyShortcuts; Index 743; Information not available
+
+// SetConsoleLocalEUDC; Index 744; Information not available
+
+// SetConsoleMaximumWindowSize; Index 745; Information not available
+
+// SetConsoleMenuClose; Index 746; Information not available
+
+function SetConsoleMode(hConsoleHandle: THandle; dwMode: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetConsoleMode' index 636;
+
+// SetConsoleNlsMode; Index 748; Information not available
+
+// SetConsoleNumberOfCommandsA; Index 749; Information not available
+
+// SetConsoleNumberOfCommandsW; Index 750; Information not available
+
+// SetConsoleOS2OemFormat; Index 751; Information not available
+
+function SetConsoleOutputCP(wCodePageID: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleOutputCP' index 641;
+
+// SetConsolePalette; Index 753; Information not available
+
+function SetConsoleScreenBufferSize(hConsoleOutput: THandle;
+ dwSize: TCoord): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleScreenBufferSize' index 643;
+
+function SetConsoleTextAttribute(hConsoleOutput: THandle;
+ wAttributes: Word): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleTextAttribute' index 644;
+
+function SetConsoleTitle(lpConsoleTitle: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleTitleA' index 645;
+
+function SetConsoleTitleW(lpConsoleTitle: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleTitleW' index 646;
+
+function SetConsoleWindowInfo(hConsoleOutput: THandle; bAbsolute: BOOL;
+ const lpConsoleWindow: TSmallRect): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetConsoleWindowInfo' index 647;
+
+function SetCriticalSectionSpinCount(var lpCriticalSection:
+ TRTLCriticalSection; dwSpinCount: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'SetCriticalSectionSpinCount' index 648;
+
+function SetCurrentDirectory(lpPathName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCurrentDirectoryA' index 649;
+
+function SetCurrentDirectoryW(lpPathName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetCurrentDirectoryW' index 650;
+
+function SetDefaultCommConfig(lpszName: PAnsiChar; lpCC: PCommConfig;
+ dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetDefaultCommConfigA' index 651;
+
+function SetDefaultCommConfigW(lpszName: PWideChar; lpCC: PCommConfig;
+ dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetDefaultCommConfigW' index 652;
+
+// SetDllDirectoryA; Index 764; Information not available
+
+// SetDllDirectoryW; Index 765; Information not available
+
+function SetEndOfFile(hFile: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetEndOfFile' index 653;
+
+function SetEnvironmentVariable(lpName, lpValue: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetEnvironmentVariableA' index 654;
+
+function SetEnvironmentVariableW(lpName, lpValue: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetEnvironmentVariableW' index 655;
+
+function SetErrorMode(uMode: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'SetErrorMode' index 656;
+
+function SetEvent(hEvent: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetEvent' index 657;
+
+procedure SetFileApisToANSI; stdcall;
+ external 'kernel32.dll' name 'SetFileApisToANSI' index 658;
+
+procedure SetFileApisToOEM; stdcall;
+ external 'kernel32.dll' name 'SetFileApisToOEM' index 659;
+
+function SetFileAttributes(lpFileName: PAnsiChar;
+ dwFileAttributes: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetFileAttributesA' index 660;
+
+function SetFileAttributesW(lpFileName: PWideChar;
+ dwFileAttributes: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetFileAttributesW' index 661;
+
+function SetFilePointer(hFile: THandle; lDistanceToMove: Longint;
+ lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'SetFilePointer' index 662;
+
+// SetFilePointerEx; Index 776; Information not available
+
+// SetFileShortNameA; Index 777; Information not available
+
+// SetFileShortNameW; Index 778; Information not available
+
+function SetFileTime(hFile: THandle; lpCreationTime, lpLastAccessTime,
+ lpLastWriteTime: PFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetFileTime' index 664;
+
+// SetFileValidData; Index 780; Information not available
+
+// SetFirmwareEnvironmentVariableA; Index 781; Information not available
+
+// SetFirmwareEnvironmentVariableW; Index 782; Information not available
+
+// SetHandleContext; Index 783; Information not available
+
+function SetHandleCount(uNumber: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'SetHandleCount' index 665;
+
+function SetHandleInformation(hObject: THandle; dwMask: DWORD;
+ dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetHandleInformation' index 666;
+
+// SetInformationJobObject; Index 786; Information not available
+
+// SetLastConsoleEventActive; Index 787; Information not available
+
+procedure SetLastError(dwErrCode: DWORD); stdcall;
+ external 'kernel32.dll' name 'SetLastError' index 669;
+
+// SetLocalPrimaryComputerNameA; Index 789; Information not available
+
+// SetLocalPrimaryComputerNameW; Index 790; Information not available
+
+function SetLocalTime(const lpSystemTime: TSystemTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetLocalTime' index 670;
+
+function SetLocaleInfo(Locale: LCID; LCType: LCTYPE;
+ lpLCData: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetLocaleInfoA' index 671;
+
+function SetLocaleInfoW(Locale: LCID; LCType: LCTYPE;
+ lpLCData: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetLocaleInfoW' index 672;
+
+function SetMailslotInfo(hMailslot: THandle; lReadTimeout: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetMailslotInfo' index 673;
+
+// SetMessageWaitingIndicator; Index 795; Information not available
+
+function SetNamedPipeHandleState(hNamedPipe: THandle; var lpMode: DWORD;
+ lpMaxCollectionCount, lpCollectDataTimeout: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetNamedPipeHandleState' index 675;
+
+function SetPriorityClass(hProcess: THandle; dwPriorityClass: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetPriorityClass' index 676;
+
+function SetProcessAffinityMask(hProcess: THandle;
+ dwProcessAffinityMask: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetProcessAffinityMask' index 677;
+
+function SetProcessPriorityBoost(hThread: THandle;
+ DisablePriorityBoost: Bool): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetProcessPriorityBoost' index 678;
+
+function SetProcessShutdownParameters(dwLevel, dwFlags: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetProcessShutdownParameters' index 679;
+
+function SetProcessWorkingSetSize(hProcess: THandle; dwMinimumWorkingSetSize,
+ dwMaximumWorkingSetSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetProcessWorkingSetSize' index 680;
+
+function SetStdHandle(nStdHandle: DWORD; hHandle: THandle): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetStdHandle' index 681;
+
+function SetSystemPowerState(fSuspend, fForce: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetSystemPowerState' index 682;
+
+function SetSystemTime(const lpSystemTime: TSystemTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetSystemTime' index 683;
+
+function SetSystemTimeAdjustment(dwTimeAdjustment: DWORD;
+ bTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetSystemTimeAdjustment' index 684;
+
+function SetTapeParameters(hDevice: THandle; dwOperation: DWORD;
+ lpTapeInformation: Pointer): DWORD; stdcall;
+ external 'kernel32.dll' name 'SetTapeParameters' index 685;
+
+function SetTapePosition(hDevice: THandle; dwPositionMethod,
+ dwPartition: DWORD; dwOffsetLow, dwOffsetHigh: DWORD;
+ bImmediate: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'SetTapePosition' index 686;
+
+// SetTermsrvAppInstallMode; Index 808; Information not available
+
+function SetThreadAffinityMask(hThread: THandle;
+ dwThreadAffinityMask: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'SetThreadAffinityMask' index 688;
+
+function SetThreadContext(hThread: THandle; const lpContext: TContext): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetThreadContext' index 689;
+
+// SetThreadExecutionState; Index 811; Information not available
+
+function SetThreadIdealProcessor(hThread: THandle;
+ dwIdealProcessor: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetThreadIdealProcessor' index 691;
+
+function SetThreadLocale(Locale: LCID): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetThreadLocale' index 692;
+
+function SetThreadPriority(hThread: THandle; nPriority: Integer): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetThreadPriority' index 693;
+
+function SetThreadPriorityBoost(hThread: THandle;
+ DisablePriorityBoost: Bool): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetThreadPriorityBoost' index 694;
+
+// SetThreadUILanguage; Index 816; Information not available
+
+function SetTimeZoneInformation(const lpTimeZoneInformation:
+ TTimeZoneInformation): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetTimeZoneInformation' index 695;
+
+// SetTimerQueueTimer; Index 818; Information not available
+
+function SetUnhandledExceptionFilter(lpTopLevelExceptionFilter:
+ TFNTopLevelExceptionFilter): TFNTopLevelExceptionFilter; stdcall;
+ external 'kernel32.dll' name 'SetUnhandledExceptionFilter' index 697;
+
+// SetUserGeoID; Index 820; Information not available
+
+// SetVDMCurrentDirectories; Index 821; Information not available
+
+function SetVolumeLabel(lpRootPathName: PAnsiChar;
+ lpVolumeName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetVolumeLabelA' index 699;
+
+function SetVolumeLabelW(lpRootPathName: PWideChar;
+ lpVolumeName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetVolumeLabelW' index 700;
+
+// SetVolumeMountPointA; Index 824; Information not available
+
+// SetVolumeMountPointW; Index 825; Information not available
+
+function SetWaitableTimer(hTimer: THandle; var lpDueTime: TLargeInteger;
+ lPeriod: Longint; pfnCompletionRoutine: TFNTimerAPCRoutine;
+ lpArgToCompletionRoutine: Pointer; fResume: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'SetWaitableTimer' index 703;
+
+function SetupComm(hFile: THandle; dwInQueue, dwOutQueue: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'SetupComm' index 704;
+
+// ShowConsoleCursor; Index 828; Information not available
+
+function SignalObjectAndWait(hObjectToSignal: THandle;
+ hObjectToWaitOn: THandle; dwMilliseconds: DWORD;
+ bAlertable: BOOL): BOOL; stdcall;
+ external 'kernel32.dll' name 'SignalObjectAndWait' index 706;
+
+function SizeofResource(hModule: HINST; hResInfo: HRSRC): DWORD; stdcall;
+ external 'kernel32.dll' name 'SizeofResource' index 707;
+
+procedure Sleep(dwMilliseconds: DWORD); stdcall;
+ external 'kernel32.dll' name 'Sleep' index 708;
+
+function SleepEx(dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'SleepEx' index 709;
+
+function SuspendThread(hThread: THandle): DWORD; stdcall;
+ external 'kernel32.dll' name 'SuspendThread' index 710;
+
+function SwitchToFiber(lpFiber: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'SwitchToFiber' index 711;
+
+function SwitchToThread: BOOL; stdcall;
+ external 'kernel32.dll' name 'SwitchToThread' index 712;
+
+function SystemTimeToFileTime(const lpSystemTime: TSystemTime;
+ var lpFileTime: TFileTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'SystemTimeToFileTime' index 713;
+
+function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation:
+ PTimeZoneInformation; var lpUniversalTime,
+ lpLocalTime: TSystemTime): BOOL; stdcall;
+ external 'kernel32.dll' name 'SystemTimeToTzSpecificLocalTime' index
+ 714;
+
+// TerminateJobObject; Index 838; Information not available
+
+function TerminateProcess(hProcess: THandle; uExitCode: UINT): BOOL; stdcall;
+ external 'kernel32.dll' name 'TerminateProcess' index 716;
+
+function TerminateThread(hThread: THandle; dwExitCode: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'TerminateThread' index 717;
+
+// TermsrvAppInstallMode; Index 841; Information not available
+
+function Thread32First(hSnapshot: THandle; var lpte: TThreadEntry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Thread32First' index 719;
+
+function Thread32Next(hSnapshot: THandle; var lpte: TThreadENtry32): BOOL;
+ stdcall; external 'kernel32.dll' name 'Thread32Next' index 720;
+
+function TlsAlloc: DWORD; stdcall;
+ external 'kernel32.dll' name 'TlsAlloc' index 721;
+
+function TlsFree(dwTlsIndex: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'TlsFree' index 722;
+
+function TlsGetValue(dwTlsIndex: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'TlsGetValue' index 723;
+
+function TlsSetValue(dwTlsIndex: DWORD; lpTlsValue: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'TlsSetValue' index 724;
+
+function Toolhelp32ReadProcessMemory(th32ProcessID: DWORD;
+ lpBaseAddress: Pointer; var lpBuffer; cbRead: DWORD;
+ var lpNumberOfBytesRead: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'Toolhelp32ReadProcessMemory' index 725;
+
+function TransactNamedPipe(hNamedPipe: THandle; lpInBuffer: Pointer;
+ nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
+ var lpBytesRead: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'TransactNamedPipe' index 726;
+
+function TransmitCommChar(hFile: THandle; cChar: CHAR): BOOL; stdcall;
+ external 'kernel32.dll' name 'TransmitCommChar' index 727;
+
+// TrimVirtualBuffer; Index 851; Information not available
+
+function TryEnterCriticalSection(var lpCriticalSection: TRTLCriticalSection):
+ BOOL; stdcall;
+ external 'kernel32.dll' name 'TryEnterCriticalSection' index 729;
+
+// TzSpecificLocalTimeToSystemTime; Index 853; Information not available
+
+// UTRegister; Index 854; Information not available
+
+// UTUnRegister; Index 855; Information not available
+
+function UnhandledExceptionFilter(const ExceptionInfo: TExceptionPointers):
+ Longint; stdcall;
+ external 'kernel32.dll' name 'UnhandledExceptionFilter' index 732;
+
+function UnlockFile(hFile: THandle; dwFileOffsetLow, dwFileOffsetHigh: DWORD;
+ nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'UnlockFile' index 733;
+
+function UnlockFileEx(hFile: THandle; dwReserved,
+ nNumberOfBytesToUnlockLow: DWORD; nNumberOfBytesToUnlockHigh: DWORD;
+ const lpOverlapped: TOverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'UnlockFileEx' index 734;
+
+function UnmapViewOfFile(lpBaseAddress: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'UnmapViewOfFile' index 735;
+
+// UnregisterConsoleIME; Index 860; Information not available
+
+// UnregisterWait; Index 861; Information not available
+
+// UnregisterWaitEx; Index 862; Information not available
+
+function UpdateResource(hUpdate: THandle; lpType, lpName: PAnsiChar;
+ wLanguage: Word; lpData: Pointer; cbData: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'UpdateResourceA' index 739;
+
+function UpdateResourceW(hUpdate: THandle; lpType, lpName: PWideChar;
+ wLanguage: Word; lpData: Pointer; cbData: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'UpdateResourceW' index 740;
+
+// VDMConsoleOperation; Index 865; Information not available
+
+// VDMOperationStarted; Index 866; Information not available
+
+// ValidateLCType; Index 867; Information not available
+
+// ValidateLocale; Index 868; Information not available
+
+function VerLanguageName(wLang: DWORD; szLang: PAnsiChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'VerLanguageNameA' index 745;
+
+function VerLanguageNameW(wLang: DWORD; szLang: PWideChar;
+ nSize: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'VerLanguageNameW' index 746;
+
+// VerSetConditionMask; Index 871; Information not available
+
+// VerifyConsoleIoHandle; Index 872; Information not available
+
+// VerifyVersionInfoA; Index 873; Information not available
+
+// VerifyVersionInfoW; Index 874; Information not available
+
+function VirtualAlloc(lpvAddress: Pointer; dwSize, flAllocationType,
+ flProtect: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'VirtualAlloc' index 751;
+
+function VirtualAllocEx(hProcess: THandle; lpAddress: Pointer; dwSize,
+ flAllocationType: DWORD; flProtect: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'VirtualAllocEx' index 752;
+
+// VirtualBufferExceptionHandler; Index 877; Information not available
+
+function VirtualFree(lpAddress: Pointer; dwSize, dwFreeType: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'VirtualFree' index 754;
+
+function VirtualFreeEx(hProcess: THandle; lpAddress: Pointer; dwSize,
+ dwFreeType: DWORD): Pointer; stdcall;
+ external 'kernel32.dll' name 'VirtualFreeEx' index 755;
+
+function VirtualLock(lpAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'VirtualLock' index 756;
+
+function VirtualProtect(lpAddress: Pointer; dwSize, flNewProtect: DWORD;
+ lpflOldProtect: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'VirtualProtect' index 757;
+
+function VirtualProtectEx(hProcess: THandle; lpAddress: Pointer; dwSize,
+ flNewProtect: DWORD; lpflOldProtect: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'VirtualProtectEx' index 758;
+
+function VirtualQuery(lpAddress: Pointer;
+ var lpBuffer: TMemoryBasicInformation; dwLength: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'VirtualQuery' index 759;
+
+function VirtualQueryEx(hProcess: THandle; lpAddress: Pointer;
+ var lpBuffer: TMemoryBasicInformation; dwLength: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'VirtualQueryEx' index 760;
+
+function VirtualUnlock(lpAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'VirtualUnlock' index 761;
+
+// WTSGetActiveConsoleSessionId; Index 886; Information not available
+
+function WaitCommEvent(hFile: THandle; var lpEvtMask: DWORD;
+ lpOverlapped: POverlapped): BOOL; stdcall;
+ external 'kernel32.dll' name 'WaitCommEvent' index 762;
+
+function WaitForDebugEvent(var lpDebugEvent: TDebugEvent;
+ dwMilliseconds: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WaitForDebugEvent' index 763;
+
+function WaitForMultipleObjects(nCount: DWORD; lpHandles: PWOHandleArray;
+ bWaitAll: BOOL; dwMilliseconds: DWORD): DWORD; stdcall;
+ external 'kernel32.dll' name 'WaitForMultipleObjects' index 764;
+
+function WaitForMultipleObjectsEx(nCount: DWORD; lpHandles: PWOHandleArray;
+ bWaitAll: BOOL; dwMilliseconds: DWORD; bAlertable: BOOL): DWORD;
+ stdcall;
+ external 'kernel32.dll' name 'WaitForMultipleObjectsEx' index 765;
+
+function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD;
+ stdcall; external 'kernel32.dll' name 'WaitForSingleObject' index 766;
+
+function WaitForSingleObjectEx(hHandle: THandle; dwMilliseconds: DWORD;
+ bAlertable: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'WaitForSingleObjectEx' index 767;
+
+function WaitNamedPipe(lpNamedPipeName: PAnsiChar; nTimeOut: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'WaitNamedPipeA' index 768;
+
+function WaitNamedPipeW(lpNamedPipeName: PWideChar; nTimeOut: DWORD): BOOL;
+ stdcall; external 'kernel32.dll' name 'WaitNamedPipeW' index 769;
+
+function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD;
+ lpWideCharStr: LPWSTR; cchWideChar: Integer; lpMultiByteStr: LPSTR;
+ cchMultiByte: Integer; lpDefaultChar: LPCSTR;
+ lpUsedDefaultChar: PBOOL): Integer; stdcall;
+ external 'kernel32.dll' name 'WideCharToMultiByte' index 770;
+
+function WinExec(lpCmdLine: LPCSTR; uCmdShow: UINT): UINT; stdcall;
+ external 'kernel32.dll' name 'WinExec' index 771;
+
+function WriteConsole(hConsoleOutput: THandle; const lpBuffer: Pointer;
+ nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
+ lpReserved: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleA' index 772;
+
+function WriteConsoleInput(hConsoleInput: THandle;
+ const lpBuffer: TInputRecord; nLength: DWORD;
+ var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleInputA' index 773;
+
+// WriteConsoleInputVDMA; Index 899; Information not available
+
+// WriteConsoleInputVDMW; Index 900; Information not available
+
+function WriteConsoleInputW(hConsoleInput: THandle;
+ const lpBuffer: TInputRecord; nLength: DWORD;
+ var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleInputW' index 776;
+
+function WriteConsoleOutput(hConsoleOutput: THandle; lpBuffer: Pointer;
+ dwBufferSize, dwBufferCoord: TCoord;
+ var lpWriteRegion: TSmallRect): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleOutputA' index 777;
+
+function WriteConsoleOutputAttribute(hConsoleOutput: THandle;
+ lpAttribute: Pointer; nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleOutputAttribute' index 778;
+
+function WriteConsoleOutputCharacter(hConsoleOutput: THandle;
+ lpCharacter: PAnsiChar; nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleOutputCharacterA' index 779;
+
+function WriteConsoleOutputCharacterW(hConsoleOutput: THandle;
+ lpCharacter: PWideChar; nLength: DWORD; dwWriteCoord: TCoord;
+ var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleOutputCharacterW' index 780;
+
+function WriteConsoleOutputW(hConsoleOutput: THandle; lpBuffer: Pointer;
+ dwBufferSize, dwBufferCoord: TCoord;
+ var lpWriteRegion: TSmallRect): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleOutputW' index 781;
+
+function WriteConsoleW(hConsoleOutput: THandle; const lpBuffer: Pointer;
+ nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD;
+ lpReserved: Pointer): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteConsoleW' index 782;
+
+function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD;
+ var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL;
+ stdcall; external 'kernel32.dll' name 'WriteFile' index 783;
+
+function WriteFileEx(hFile: THandle; lpBuffer: Pointer;
+ nNumberOfBytesToWrite: DWORD; const lpOverlapped: TOverlapped;
+ lpCompletionRoutine: FARPROC): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteFileEx' index 784;
+
+// WriteFileGather; Index 910; Information not available
+
+function WritePrivateProfileSection(lpAppName, lpString,
+ lpFileName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileSectionA' index 786;
+
+function WritePrivateProfileSectionW(lpAppName, lpString,
+ lpFileName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileSectionW' index 787;
+
+function WritePrivateProfileString(lpAppName, lpKeyName, lpString,
+ lpFileName: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileStringA' index 788;
+
+function WritePrivateProfileStringW(lpAppName, lpKeyName, lpString,
+ lpFileName: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileStringW' index 789;
+
+function WritePrivateProfileStruct(lpszSection, lpszKey: PAnsiChar;
+ lpStruct: Pointer; uSizeStruct: UINT; szFile: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileStructA' index 790;
+
+function WritePrivateProfileStructW(lpszSection, lpszKey: PWideChar;
+ lpStruct: Pointer; uSizeStruct: UINT; szFile: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WritePrivateProfileStructW' index 791;
+
+function WriteProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer;
+ lpBuffer: Pointer; nSize: DWORD;
+ var lpNumberOfBytesWritten: DWORD): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteProcessMemory' index 792;
+
+function WriteProfileSection(lpAppName, lpString: PAnsiChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteProfileSectionA' index 793;
+
+function WriteProfileSectionW(lpAppName, lpString: PWideChar): BOOL; stdcall;
+ external 'kernel32.dll' name 'WriteProfileSectionW' index 794;
+
+function WriteProfileString(lpAppName, lpKeyName, lpString: PAnsiChar): BOOL;
+ stdcall; external 'kernel32.dll' name 'WriteProfileStringA' index 795;
+
+function WriteProfileStringW(lpAppName, lpKeyName, lpString: PWideChar): BOOL;
+ stdcall; external 'kernel32.dll' name 'WriteProfileStringW' index 796;
+
+function WriteTapemark(hDevice: THandle; dwTapemarkType,
+ dwTapemarkCount: DWORD; bImmediate: BOOL): DWORD; stdcall;
+ external 'kernel32.dll' name 'WriteTapemark' index 797;
+
+// ZombifyActCtx; Index 923; Information not available
+
+function _hread(hFile: HFILE; lpBuffer: Pointer; lBytes: Longint): Longint;
+ stdcall; external 'kernel32.dll' name '_hread' index 798;
+
+function _hwrite(hFile: HFILE; lpBuffer: LPCSTR; lBytes: Longint): Longint;
+ stdcall; external 'kernel32.dll' name '_hwrite' index 799;
+
+function _lclose(hFile: HFILE): HFILE; stdcall;
+ external 'kernel32.dll' name '_lclose' index 800;
+
+function _lcreat(const lpPathName: LPCSTR; iAttribute: Integer): HFILE;
+ stdcall; external 'kernel32.dll' name '_lcreat' index 801;
+
+function _llseek(hFile: HFILE; lOffset: Longint; iOrigin: Integer): Longint;
+ stdcall; external 'kernel32.dll' name '_llseek' index 802;
+
+function _lopen(const lpPathName: LPCSTR; iReadWrite: Integer): HFILE;
+ stdcall; external 'kernel32.dll' name '_lopen' index 803;
+
+function _lread(hFile: HFILE; lpBuffer: Pointer; uBytes: UINT): UINT; stdcall;
+ external 'kernel32.dll' name '_lread' index 804;
+
+function _lwrite(hFile: HFILE; const lpBuffer: LPCSTR; uBytes: UINT): UINT;
+ stdcall; external 'kernel32.dll' name '_lwrite' index 805;
+
+// lstrcat; Index 932; Information not available
+
+function lstrcat(lpString1, lpString2: PAnsiChar): PAnsiChar; stdcall;
+ external 'kernel32.dll' name 'lstrcatA' index 807;
+
+function lstrcatW(lpString1, lpString2: PWideChar): PWideChar; stdcall;
+ external 'kernel32.dll' name 'lstrcatW' index 808;
+
+// lstrcmp; Index 935; Information not available
+
+function lstrcmp(lpString1, lpString2: PAnsiChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrcmpA' index 810;
+
+function lstrcmpW(lpString1, lpString2: PWideChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrcmpW' index 811;
+
+// lstrcmpi; Index 938; Information not available
+
+function lstrcmpi(lpString1, lpString2: PAnsiChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrcmpiA' index 813;
+
+function lstrcmpiW(lpString1, lpString2: PWideChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrcmpiW' index 814;
+
+// lstrcpy; Index 941; Information not available
+
+function lstrcpy(lpString1, lpString2: PAnsiChar): PAnsiChar; stdcall;
+ external 'kernel32.dll' name 'lstrcpyA' index 816;
+
+function lstrcpyW(lpString1, lpString2: PWideChar): PWideChar; stdcall;
+ external 'kernel32.dll' name 'lstrcpyW' index 817;
+
+// lstrcpyn; Index 944; Information not available
+
+function lstrcpyn(lpString1, lpString2: PAnsiChar;
+ iMaxLength: Integer): PAnsiChar; stdcall;
+ external 'kernel32.dll' name 'lstrcpynA' index 819;
+
+function lstrcpynW(lpString1, lpString2: PWideChar;
+ iMaxLength: Integer): PWideChar; stdcall;
+ external 'kernel32.dll' name 'lstrcpynW' index 820;
+
+// lstrlen; Index 947; Information not available
+
+function lstrlen(lpString: PAnsiChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrlenA' index 822;
+
+function lstrlenW(lpString: PWideChar): Integer; stdcall;
+ external 'kernel32.dll' name 'lstrlenW' index 823;
+
+
diff --git a/contrib/win32/kernel32.factor b/contrib/win32/kernel32.factor
new file mode 100644
index 0000000000..c3bd59e46f
--- /dev/null
+++ b/contrib/win32/kernel32.factor
@@ -0,0 +1,59 @@
+IN: win32
+USING: alien kernel errors ;
+
+LIBRARY: kernel
+
+! FUNCTION: MAKEINTRESOURCEA
+! FUNCTION: MAKEINTRESOURCEW
+
+! : MAKEINTRESOURCE \ MAKEINTRESOURCEW \ MAKEINTRESOURCEA unicode-exec ;
+! #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0)
+! #define MAKEINTRESOURCEA(i) (LPSTR)((ULONG_PTR)((WORD)(i)))
+! #define MAKEINTRESOURCEW(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
+
+
+! FUNCTION: DWORD FormatMessage(
+ ! DWORD dwFlags,
+ ! LPCVOID lpSource,
+ ! DWORD dwMessageId,
+ ! DWORD dwLanguageId,
+ ! LPTSTR lpBuffer,
+ ! DWORD nSize,
+ ! va_list* Arguments
+! ) ;
+
+
+
+FUNCTION: HMODULE GetModuleHandleA ( char* lpModulename ) ;
+FUNCTION: HMODULE GetModuleHandleW ( char* lpModulename ) ;
+
+: GetModuleHandle \ GetModuleHandleW \ GetModuleHandleA unicode-exec ;
+
+
+! FUNCTION: HMODULE GetModuleHandleEx (
+! DWORD dwFlags,
+! LPCTSTR lpModulename,
+! HMODULE* phModule ) ;
+
+
+
+FUNCTION: DWORD GetLastError ( ) ;
+
+: (win32-error) ( id -- string )
+ "char*" f "error_message" [ "int" ] alien-invoke ;
+
+: win32-error ( -- )
+ GetLastError dup 0 = [ (win32-error) throw ] unless drop ;
+
+: GHND HEX: 40 ; inline
+: GMEM_FIXED 0 ; inline
+: GMEM_MOVEABLE 2 ; inline
+: GMEM_ZEROINIT HEX: 40 ; inline
+: GPTR HEX: 40 ; inline
+
+FUNCTION: HGLOBAL GlobalAlloc ( UINT uFlags, SIZE_T dwBytes ) ;
+FUNCTION: LPVOID GlobalLock ( HGLOBAL hMem ) ;
+! FUNCTION: char* GlobalLock ( HGLOBAL hMem ) ;
+FUNCTION: BOOL GlobalUnlock ( HGLOBAL hMem ) ;
+
+
diff --git a/contrib/win32/load.factor b/contrib/win32/load.factor
new file mode 100644
index 0000000000..3a039062a3
--- /dev/null
+++ b/contrib/win32/load.factor
@@ -0,0 +1,14 @@
+IN: scratchpad
+USING: alien compiler kernel parser sequences words ;
+
+{
+ { "user" "user32" }
+ { "kernel" "kernel32" }
+} [ first2 add-simple-library ] each
+
+{
+ "utils"
+ "types"
+ "kernel32"
+ "user32"
+} [ "/contrib/win32/" swap ".factor" append3 run-resource ] each
diff --git a/contrib/win32/types.factor b/contrib/win32/types.factor
new file mode 100644
index 0000000000..502dfe4cc9
--- /dev/null
+++ b/contrib/win32/types.factor
@@ -0,0 +1,299 @@
+IN: win32
+USING: alien namespaces kernel words ;
+
+! http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp
+
+SYMBOL: unicode f unicode set
+: unicode-exec ( unicode-func ascii-func -- func )
+ unicode get [
+ drop execute
+ ] [
+ nip execute
+ ] if ; inline
+
+: unicode? unicode get ; inline
+
+: win64? f ;
+
+! win64
+! char uchar short ushort int uint long ulong longlong ulonglong
+! 1 1 2 2 * * ?
+! win32
+! char uchar short ushort int uint long ulong longlong ulonglong
+! 1 1 2 2 * * 4 4 8 8
+
+TYPEDEF: char CHAR
+TYPEDEF: uchar UCHAR
+TYPEDEF: uchar BYTE
+
+TYPEDEF: short wchar_t
+TYPEDEF: wchar_t WCHAR
+
+TYPEDEF: short SHORT
+TYPEDEF: ushort USHORT
+
+TYPEDEF: ushort WORD
+TYPEDEF: ulong DWORD
+
+TYPEDEF: int INT
+TYPEDEF: uint UINT
+
+TYPEDEF: int BOOL
+
+TYPEDEF: int* PINT
+TYPEDEF: int* LPINT
+TYPEDEF: int HFILE
+
+TYPEDEF: long LONG
+TYPEDEF: long* LPLONG
+TYPEDEF: long LONG_PTR
+TYPEDEF: long* PLONG_PTR
+
+TYPEDEF: uint ULONG
+TYPEDEF: ulong ULONG_PTR
+TYPEDEF: ulong* PULONG_PTR
+
+TYPEDEF: void VOID
+TYPEDEF: void* PVOID
+TYPEDEF: void* LPVOID
+TYPEDEF: void* LPCVOID
+
+TYPEDEF: float FLOAT
+win64? [
+ ! TODO: check these!
+ TYPEDEF: INT32 HALF_PTR
+ TYPEDEF: UINT32 UHALF_PTR
+ TYPEDEF: long INT_PTR
+ TYPEDEF: ulong UINT_PTR
+
+ TYPEDEF: longlong LONG_PTR ! 64bit
+ TYPEDEF: ulonglong ULONG_PTR ! 64bit
+
+ TYPEDEF: int INT32
+ TYPEDEF: uint UINT32
+ TYPEDEF: uint DWORD32
+ TYPEDEF: uint ULONG32
+ TYPEDEF: ulong ULONG64
+ TYPEDEF: int* POINTER_32
+ TYPEDEF: long* POINTER_64
+ TYPEDEF: longlong INT64
+ TYPEDEF: ulonglong UINT64
+ TYPEDEF: longlong LONGLONG ! 64bit
+ TYPEDEF: ulonglong ULONGLONG
+ TYPEDEF: longlong LONG64
+ TYPEDEF: ulonglong DWORD64
+ ] [
+ TYPEDEF: short HALF_PTR
+ TYPEDEF: ushort UHALF_PTR
+ TYPEDEF: int INT_PTR
+ TYPEDEF: uint UINT_PTR
+
+ TYPEDEF: int LONG_PTR
+ TYPEDEF: ulong ULONG_PTR
+
+ TYPEDEF: int INT32
+ TYPEDEF: uint UINT32
+ TYPEDEF: uint DWORD32
+ TYPEDEF: ulong ULONG32
+ TYPEDEF: ulonglong ULONG64
+ TYPEDEF: long* POINTER_32
+ TYPEDEF: longlong* POINTER_64
+ TYPEDEF: longlong INT64
+ TYPEDEF: ulonglong UINT64
+ TYPEDEF: longlong LONGLONG
+ TYPEDEF: ulonglong ULONGLONG
+ TYPEDEF: longlong LONG64
+ TYPEDEF: ulonglong DWORD64
+] if
+
+unicode? [
+ TYPEDEF: WCHAR TBYTE
+ TYPEDEF: WCHAR TCHAR
+ ] [
+ TYPEDEF: uchar TBYTE
+ TYPEDEF: char TCHAR
+] if
+
+! Below down is based on the above definitions
+! There should be no 32/64bit issues
+
+TYPEDEF: WORD ATOM
+TYPEDEF: BYTE BOOLEAN
+! TYPEDEF: __stdcall CALLBACK
+TYPEDEF: DWORD COLORREF
+TYPEDEF: ULONGLONG DWORDLONG
+TYPEDEF: ULONG_PTR DWORD_PTR
+! TYPEDEF: uint HANDLE
+TYPEDEF: PVOID HANDLE
+TYPEDEF: HANDLE HACCEL
+TYPEDEF: HANDLE HBITMAP
+TYPEDEF: HANDLE HBRUSH
+TYPEDEF: HANDLE HCOLORSPACE
+TYPEDEF: HANDLE HCONV
+TYPEDEF: HANDLE HCONVLIST
+TYPEDEF: HANDLE HICON
+TYPEDEF: HICON HCURSOR
+TYPEDEF: HANDLE HDC
+TYPEDEF: HANDLE HDDEDATA
+TYPEDEF: HANDLE HDESK
+TYPEDEF: HANDLE HDROP
+TYPEDEF: HANDLE HDWP
+TYPEDEF: HANDLE HENMETAFILE
+TYPEDEF: HANDLE HFONT
+TYPEDEF: HANDLE HGDIOBJ
+TYPEDEF: HANDLE HGLOBAL
+TYPEDEF: HANDLE HHOOK
+TYPEDEF: HANDLE HINSTANCE
+TYPEDEF: HANDLE HKEY
+TYPEDEF: HANDLE HKL
+TYPEDEF: HANDLE HLOCAL
+TYPEDEF: HANDLE HMENU
+TYPEDEF: HANDLE HMETAFILE
+TYPEDEF: HINSTANCE HMODULE
+TYPEDEF: HANDLE HMONITOR
+TYPEDEF: HANDLE HPALETTE
+TYPEDEF: HANDLE HPEN
+TYPEDEF: LONG HRESULT
+TYPEDEF: HANDLE HRGN
+TYPEDEF: HANDLE HRSRC
+TYPEDEF: HANDLE HSZ
+TYPEDEF: HANDLE WINSTA ! MS docs say typedef HANDLE WINSTA ;
+TYPEDEF: HANDLE HWINSTA ! typo??
+TYPEDEF: HANDLE HWND
+TYPEDEF: WORD LANGID
+TYPEDEF: DWORD LCID
+TYPEDEF: DWORD LCTYPE
+TYPEDEF: DWORD LGRPID
+TYPEDEF: LONG_PTR LPARAM
+TYPEDEF: BOOL* LPBOOL
+TYPEDEF: BYTE* LPBYTE
+TYPEDEF: DWORD* LPCOLORREF
+TYPEDEF: CHAR* LPCSTR
+TYPEDEF: WCHAR* LPCWSTR
+TYPEDEF: WCHAR* LPWSTR
+unicode? [
+ TYPEDEF: LPCWSTR LPCTSTR
+ TYPEDEF: LPWSTR LPTSTR
+ TYPEDEF: LPCWSTR PCTSTR
+ TYPEDEF: LPWSTR PTSTR
+ ] [
+ TYPEDEF: LPCSTR LPCTSTR
+ TYPEDEF: LPSTR LPTSTR
+ TYPEDEF: LPCSTR PCTSTR
+ TYPEDEF: LPSTR PTSTR
+] if
+TYPEDEF: DWORD* LPDWORD
+TYPEDEF: HANDLE* LPHANDLE
+TYPEDEF: CHAR* LPSTR
+TYPEDEF: WORD* LPWORD
+TYPEDEF: WCHAR* LPWSTR
+TYPEDEF: LONG_PTR LRESULT
+TYPEDEF: BOOL* PBOOL
+TYPEDEF: BOOLEAN* PBOOLEAN
+TYPEDEF: BYTE* PBYTE
+TYPEDEF: CHAR* PCHAR
+TYPEDEF: CHAR* PCSTR
+TYPEDEF: WCHAR* PCWSTR
+TYPEDEF: DWORD* PDWORD
+TYPEDEF: DWORDLONG* PDWORDLONG
+TYPEDEF: DWORD_PTR* PDWORD_PTR
+TYPEDEF: DWORD32* PDWORD32
+TYPEDEF: DWORD64* PDWORD64
+TYPEDEF: FLOAT* PFLOAT
+TYPEDEF: HALF_PTR* PHALF_PTR
+TYPEDEF: HANDLE* PHANDLE
+TYPEDEF: HKEY* PHKEY
+TYPEDEF: INT_PTR* PINT_PTR
+TYPEDEF: INT32* PINT32
+TYPEDEF: INT64* PINT64
+TYPEDEF: PDWORD PLCID
+TYPEDEF: LONG* PLONG
+TYPEDEF: LONGLONG* PLONGLONG
+TYPEDEF: LONG_PTR* PLONG_PTR
+TYPEDEF: LONG32* PLONG32
+TYPEDEF: LONG64* PLONG64
+TYPEDEF: SHORT* PSHORT
+TYPEDEF: SIZE_T* PSIZE_T
+TYPEDEF: SSIZE_T* PSSIZE_T
+TYPEDEF: CHAR* PSTR
+TYPEDEF: TBYTE* PTBYTE
+TYPEDEF: TCHAR* PTCHAR
+TYPEDEF: UCHAR* PUCHAR
+TYPEDEF: UHALF_PTR* PUHALF_PTR
+TYPEDEF: UINT* PUINT
+TYPEDEF: UINT_PTR* PUINT_PTR
+TYPEDEF: UINT32* PUINT32
+TYPEDEF: UINT64* PUINT64
+TYPEDEF: ULONG* PULONG
+TYPEDEF: ULONGLONG* PULONGLONG
+TYPEDEF: ULONG_PTR* PULONG_PTR
+TYPEDEF: ULONG32* PULONG32
+TYPEDEF: ULONG64* PULONG64
+TYPEDEF: USHORT* PUSHORT
+TYPEDEF: WCHAR* PWCHAR
+TYPEDEF: WORD* PWORD
+TYPEDEF: WCHAR* PWSTR
+TYPEDEF: HANDLE SC_HANDLE
+TYPEDEF: LPVOID SC_LOCK
+TYPEDEF: HANDLE SERVICE_STATUS_HANDLE
+TYPEDEF: ULONG_PTR SIZE_T
+TYPEDEF: LONG_PTR SSIZE_T
+TYPEDEF: LONGLONG USN
+! TYPEDEF: __stdcall WINAPI
+TYPEDEF: UINT_PTR WPARAM
+
+
+
+
+TYPEDEF: RECT* LPRECT
+TYPEDEF: void* PWNDCLASS
+TYPEDEF: void* PWNDCLASSEX
+
+TYPEDEF: void* WNDPROC
+
+! typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+
+BEGIN-STRUCT: WNDCLASS
+ FIELD: UINT style
+ FIELD: WNDPROC lpfnWndProc
+ FIELD: int cbClsExtra
+ FIELD: int cbWndExtra
+ FIELD: HINSTANCE hInstance
+ FIELD: HICON hIcon
+ FIELD: HCURSOR hCursor
+ FIELD: HBRUSH hbrBackground
+ FIELD: LPCTSTR lpszMenuName
+ FIELD: LPCTSTR lpszClassName
+END-STRUCT
+
+BEGIN-STRUCT: WNDCLASSEX
+ FIELD: UINT cbSize
+ FIELD: UINT style
+ FIELD: WNDPROC lpfnWndProc
+ FIELD: int cbClsExtra
+ FIELD: int cbWndExtra
+ FIELD: HINSTANCE hInstance
+ FIELD: HICON hIcon
+ FIELD: HCURSOR hCursor
+ FIELD: HBRUSH hbrBackground
+ FIELD: LPCTSTR lpszMenuName
+ FIELD: LPCTSTR lpszClassName
+ FIELD: HICON hIconSm
+END-STRUCT
+
+BEGIN-STRUCT: RECT
+ FIELD: LONG left
+ FIELD: LONG top
+ FIELD: LONG right
+ FIELD: LONG bottom
+END-STRUCT
+
+BEGIN-STRUCT: PAINTSTRUCT
+ FIELD: HDC hdc
+ FIELD: BOOL fErase
+ FIELD: RECT rcPaint
+ FIELD: BOOL fRestore
+ FIELD: BOOL fIncUpdate
+ FIELD: BYTE rgbReserved[32]
+END-STRUCT
+
diff --git a/contrib/win32/user32.factor b/contrib/win32/user32.factor
new file mode 100644
index 0000000000..8a6dd8b1d9
--- /dev/null
+++ b/contrib/win32/user32.factor
@@ -0,0 +1,1051 @@
+IN: win32
+USING: alien parser namespaces kernel syntax words math io prettyprint ;
+
+
+TYPEDEF: void* MSGBOXPARAMSA
+TYPEDEF: void* MSGBOXPARAMSW
+
+
+! HKL for ActivateKeyboardLayout
+: HKL_PREV 0 ;
+: HKL_NEXT 1 ;
+
+: CW_USEDEFAULT HEX: 80000000 ;
+
+: WS_OVERLAPPED HEX: 00000000 ;
+: WS_POPUP HEX: 80000000 ;
+: WS_CHILD HEX: 40000000 ;
+: WS_MINIMIZE HEX: 20000000 ;
+: WS_VISIBLE HEX: 10000000 ;
+: WS_DISABLED HEX: 08000000 ;
+: WS_CLIPSIBLINGS HEX: 04000000 ;
+: WS_CLIPCHILDREN HEX: 02000000 ;
+: WS_MAXIMIZE HEX: 01000000 ;
+: WS_CAPTION HEX: 00C00000 ; ! /* WS_BORDER | WS_DLGFRAME */
+: WS_BORDER HEX: 00800000 ;
+: WS_DLGFRAME HEX: 00400000 ;
+: WS_VSCROLL HEX: 00200000 ;
+: WS_HSCROLL HEX: 00100000 ;
+: WS_SYSMENU HEX: 00080000 ;
+: WS_THICKFRAME HEX: 00040000 ;
+: WS_GROUP HEX: 00020000 ;
+: WS_TABSTOP HEX: 00010000 ;
+: WS_MINIMIZEBOX HEX: 00020000 ;
+: WS_MAXIMIZEBOX HEX: 00010000 ;
+
+! Common window styles
+: WS_OVERLAPPEDWINDOW WS_OVERLAPPED WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX bitor bitor bitor bitor bitor ;
+
+: WS_POPUPWINDOW WS_POPUP WS_BORDER WS_SYSMENU bitor bitor ;
+
+: WS_CHILDWINDOW WS_CHILD ;
+
+: WS_TILED WS_OVERLAPPED ;
+: WS_ICONIC WS_MINIMIZE ;
+: WS_SIZEBOX WS_THICKFRAME ;
+: WS_TILEDWINDOW WS_OVERLAPPEDWINDOW ;
+
+
+
+! Extended window styles
+
+: WS_EX_DLGMODALFRAME HEX: 00000001 ;
+: WS_EX_NOPARENTNOTIFY HEX: 00000004 ;
+: WS_EX_TOPMOST HEX: 00000008 ;
+: WS_EX_ACCEPTFILES HEX: 00000010 ;
+: WS_EX_TRANSPARENT HEX: 00000020 ;
+: WS_EX_MDICHILD HEX: 00000040 ;
+: WS_EX_TOOLWINDOW HEX: 00000080 ;
+: WS_EX_WINDOWEDGE HEX: 00000100 ;
+: WS_EX_CLIENTEDGE HEX: 00000200 ;
+: WS_EX_CONTEXTHELP HEX: 00000400 ;
+
+: CS_VREDRAW HEX: 0001 ;
+: CS_HREDRAW HEX: 0002 ;
+: CS_DBLCLKS HEX: 0008 ;
+: CS_OWNDC HEX: 0020 ;
+: CS_CLASSDC HEX: 0040 ;
+: CS_PARENTDC HEX: 0080 ;
+: CS_NOCLOSE HEX: 0200 ;
+: CS_SAVEBITS HEX: 0800 ;
+: CS_BYTEALIGNCLIENT HEX: 1000 ;
+: CS_BYTEALIGNWINDOW HEX: 2000 ;
+: CS_GLOBALCLASS HEX: 4000 ;
+
+: COLOR_SCROLLBAR 0 ;
+: COLOR_BACKGROUND 1 ;
+: COLOR_ACTIVECAPTION 2 ;
+: COLOR_INACTIVECAPTION 3 ;
+: COLOR_MENU 4 ;
+: COLOR_WINDOW 5 ;
+: COLOR_WINDOWFRAME 6 ;
+: COLOR_MENUTEXT 7 ;
+: COLOR_WINDOWTEXT 8 ;
+: COLOR_CAPTIONTEXT 9 ;
+: COLOR_ACTIVEBORDER 10 ;
+: COLOR_INACTIVEBORDER 11 ;
+: COLOR_APPWORKSPACE 12 ;
+: COLOR_HIGHLIGHT 13 ;
+: COLOR_HIGHLIGHTTEXT 14 ;
+: COLOR_BTNFACE 15 ;
+: COLOR_BTNSHADOW 16 ;
+: COLOR_GRAYTEXT 17 ;
+: COLOR_BTNTEXT 18 ;
+: COLOR_INACTIVECAPTIONTEXT 19 ;
+: COLOR_BTNHIGHLIGHT 20 ;
+
+: IDI_APPLICATION 32512 ;
+: IDI_HAND 32513 ;
+: IDI_QUESTION 32514 ;
+: IDI_EXCLAMATION 32515 ;
+: IDI_ASTERISK 32516 ;
+: IDI_WINLOGO 32517 ;
+
+! ShowWindow() Commands
+: SW_HIDE 0 ;
+: SW_SHOWNORMAL 1 ;
+: SW_NORMAL 1 ;
+: SW_SHOWMINIMIZED 2 ;
+: SW_SHOWMAXIMIZED 3 ;
+: SW_MAXIMIZE 3 ;
+: SW_SHOWNOACTIVATE 4 ;
+: SW_SHOW 5 ;
+: SW_MINIMIZE 6 ;
+: SW_SHOWMINNOACTIVE 7 ;
+: SW_SHOWNA 8 ;
+: SW_RESTORE 9 ;
+: SW_SHOWDEFAULT 10 ;
+: SW_FORCEMINIMIZE 11 ;
+: SW_MAX 11 ;
+
+
+
+: MAKEINTRESOURCE ( int -- something )
+ ;
+!
+! Standard Cursor IDs
+!
+: IDC_ARROW 32512 MAKEINTRESOURCE ;
+: IDC_IBEAM 32513 MAKEINTRESOURCE ;
+: IDC_WAIT 32514 MAKEINTRESOURCE ;
+: IDC_CROSS 32515 MAKEINTRESOURCE ;
+: IDC_UPARROW 32516 MAKEINTRESOURCE ;
+: IDC_SIZE 32640 MAKEINTRESOURCE ; ! OBSOLETE: use IDC_SIZEALL
+: IDC_ICON 32641 MAKEINTRESOURCE ; ! OBSOLETE: use IDC_ARROW
+: IDC_SIZENWSE 32642 MAKEINTRESOURCE ;
+: IDC_SIZENESW 32643 MAKEINTRESOURCE ;
+: IDC_SIZEWE 32644 MAKEINTRESOURCE ;
+: IDC_SIZENS 32645 MAKEINTRESOURCE ;
+: IDC_SIZEALL 32646 MAKEINTRESOURCE ;
+: IDC_NO 32648 MAKEINTRESOURCE ; ! not in win3.1
+: IDC_HAND 32649 MAKEINTRESOURCE ;
+: IDC_APPSTARTING 32650 MAKEINTRESOURCE ; ! not in win3.1
+: IDC_HELP 32651 MAKEINTRESOURCE ;
+
+
+
+
+
+! Predefined Clipboard Formats
+: CF_TEXT 1 ; inline
+: CF_BITMAP 2 ; inline
+: CF_METAFILEPICT 3 ; inline
+: CF_SYLK 4 ; inline
+: CF_DIF 5 ; inline
+: CF_TIFF 6 ; inline
+: CF_OEMTEXT 7 ; inline
+: CF_DIB 8 ; inline
+: CF_PALETTE 9 ; inline
+: CF_PENDATA 10 ; inline
+: CF_RIFF 11 ; inline
+: CF_WAVE 12 ; inline
+: CF_UNICODETEXT 13 ; inline
+: CF_ENHMETAFILE 14 ; inline
+: CF_HDROP 15 ; inline
+: CF_LOCALE 16 ; inline
+: CF_DIBV5 17 ; inline
+: CF_MAX 18 ; inline
+
+: CF_OWNERDISPLAY HEX: 0080 ; inline
+: CF_DSPTEXT HEX: 0081 ; inline
+: CF_DSPBITMAP HEX: 0082 ; inline
+: CF_DSPMETAFILEPICT HEX: 0083 ; inline
+: CF_DSPENHMETAFILE HEX: 008E ; inline
+
+! "Private" formats don't get GlobalFree()'d
+: CF_PRIVATEFIRST HEX: 200 ; inline
+: CF_PRIVATELAST HEX: 2FF ; inline
+
+
+
+
+
+! "GDIOBJ" formats do get DeleteObject()'d
+: CF_GDIOBJFIRST HEX: 300 ; inline
+: CF_GDIOBJLAST HEX: 3FF ; inline
+
+
+
+
+
+
+LIBRARY: user
+FUNCTION: HKL ActivateKeyboardLayout ( HKL hkl, UINT Flags ) ;
+
+! FUNCTION: AdjustWindowRect
+! FUNCTION: AdjustWindowRectEx
+! FUNCTION: AlignRects
+! FUNCTION: AllowForegroundActivation
+! FUNCTION: AllowSetForegroundWindow
+! FUNCTION: AnimateWindow
+
+
+
+FUNCTION: BOOL AnyPopup ( ) ;
+
+! FUNCTION: AppendMenuA
+! FUNCTION: AppendMenuW
+! FUNCTION: ArrangeIconicWindows
+! FUNCTION: AttachThreadInput
+! FUNCTION: BeginDeferWindowPos
+
+
+! FUNCTION: HDC BeginPaint ( HWND hwnd, LPPAINTSTRUCT lpPaint ) ;
+
+! FUNCTION: BlockInput
+! FUNCTION: BringWindowToTop
+! FUNCTION: BroadcastSystemMessage
+! FUNCTION: BroadcastSystemMessageA
+! FUNCTION: BroadcastSystemMessageExA
+! FUNCTION: BroadcastSystemMessageExW
+! FUNCTION: BroadcastSystemMessageW
+! FUNCTION: BuildReasonArray
+! FUNCTION: CalcMenuBar
+! FUNCTION: CallMsgFilter
+! FUNCTION: CallMsgFilterA
+! FUNCTION: CallMsgFilterW
+! FUNCTION: CallNextHookEx
+! FUNCTION: CallWindowProcA
+! FUNCTION: CallWindowProcW
+! FUNCTION: CascadeChildWindows
+! FUNCTION: CascadeWindows
+! FUNCTION: ChangeClipboardChain
+! FUNCTION: ChangeDisplaySettingsA
+! FUNCTION: ChangeDisplaySettingsExA
+! FUNCTION: ChangeDisplaySettingsExW
+! FUNCTION: ChangeDisplaySettingsW
+! FUNCTION: ChangeMenuA
+! FUNCTION: ChangeMenuW
+! FUNCTION: CharLowerA
+! FUNCTION: CharLowerBuffA
+! FUNCTION: CharLowerBuffW
+! FUNCTION: CharLowerW
+! FUNCTION: CharNextA
+! FUNCTION: CharNextExA
+! FUNCTION: CharNextW
+! FUNCTION: CharPrevA
+! FUNCTION: CharPrevExA
+! FUNCTION: CharPrevW
+! FUNCTION: CharToOemA
+! FUNCTION: CharToOemBuffA
+! FUNCTION: CharToOemBuffW
+! FUNCTION: CharToOemW
+! FUNCTION: CharUpperA
+! FUNCTION: CharUpperBuffA
+! FUNCTION: CharUpperBuffW
+! FUNCTION: CharUpperW
+! FUNCTION: CheckDlgButton
+! FUNCTION: CheckMenuItem
+! FUNCTION: CheckMenuRadioItem
+! FUNCTION: CheckRadioButton
+! FUNCTION: ChildWindowFromPoint
+! FUNCTION: ChildWindowFromPointEx
+! FUNCTION: ClientThreadSetup
+! FUNCTION: ClientToScreen
+! FUNCTION: CliImmSetHotKey
+! FUNCTION: ClipCursor
+FUNCTION: BOOL CloseClipboard ( ) ;
+! FUNCTION: CloseDesktop
+! FUNCTION: CloseWindow
+! FUNCTION: CloseWindowStation
+! FUNCTION: CopyAcceleratorTableA
+! FUNCTION: CopyAcceleratorTableW
+! FUNCTION: CopyIcon
+! FUNCTION: CopyImage
+! FUNCTION: CopyRect
+! FUNCTION: CountClipboardFormats
+! FUNCTION: CreateAcceleratorTableA
+! FUNCTION: CreateAcceleratorTableW
+! FUNCTION: CreateCaret
+! FUNCTION: CreateCursor
+! FUNCTION: CreateDesktopA
+! FUNCTION: CreateDesktopW
+! FUNCTION: CreateDialogIndirectParamA
+! FUNCTION: CreateDialogIndirectParamAorW
+! FUNCTION: CreateDialogIndirectParamW
+! FUNCTION: CreateDialogParamA
+! FUNCTION: CreateDialogParamW
+! FUNCTION: CreateIcon
+! FUNCTION: CreateIconFromResource
+! FUNCTION: CreateIconFromResourceEx
+! FUNCTION: CreateIconIndirect
+! FUNCTION: CreateMDIWindowA
+! FUNCTION: CreateMDIWindowW
+! FUNCTION: CreateMenu
+! FUNCTION: CreatePopupMenu
+! FUNCTION: CreateSystemThreads
+
+FUNCTION: HWND CreateWindowExA (
+ DWORD dwExStyle,
+ LPCSTR lpClassName,
+ LPCSTR lpWindowName,
+ DWORD dwStyle,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ HWND hWndParent,
+ HMENU hMenu,
+ HINSTANCE hInstance,
+ LPVOID lpParam ) ;
+
+FUNCTION: HWND CreateWindowExW (
+ DWORD dwExStyle,
+ LPCWSTR lpClassName,
+ LPCWSTR lpWindowName,
+ DWORD dwStyle,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ HWND hWndParent,
+ HMENU hMenu,
+ HINSTANCE hInstance,
+ LPVOID lpParam ) ;
+
+: CreateWindowEx \ CreateWindowExW \ CreateWindowExA unicode-exec ;
+
+! 11 >r r >r >r >r >r >r >r >r >r >r >r 0 r> r> r> r> r> r> r> r> r> r> r> CreateWindowEx ;
+
+
+! FUNCTION: CreateWindowStationA
+! FUNCTION: CreateWindowStationW
+! FUNCTION: CsrBroadcastSystemMessageExW
+! FUNCTION: CtxInitUser32
+! FUNCTION: DdeAbandonTransaction
+! FUNCTION: DdeAccessData
+! FUNCTION: DdeAddData
+! FUNCTION: DdeClientTransaction
+! FUNCTION: DdeCmpStringHandles
+! FUNCTION: DdeConnect
+! FUNCTION: DdeConnectList
+! FUNCTION: DdeCreateDataHandle
+! FUNCTION: DdeCreateStringHandleA
+! FUNCTION: DdeCreateStringHandleW
+! FUNCTION: DdeDisconnect
+! FUNCTION: DdeDisconnectList
+! FUNCTION: DdeEnableCallback
+! FUNCTION: DdeFreeDataHandle
+! FUNCTION: DdeFreeStringHandle
+! FUNCTION: DdeGetData
+! FUNCTION: DdeGetLastError
+! FUNCTION: DdeGetQualityOfService
+! FUNCTION: DdeImpersonateClient
+! FUNCTION: DdeInitializeA
+! FUNCTION: DdeInitializeW
+! FUNCTION: DdeKeepStringHandle
+! FUNCTION: DdeNameService
+! FUNCTION: DdePostAdvise
+! FUNCTION: DdeQueryConvInfo
+! FUNCTION: DdeQueryNextServer
+! FUNCTION: DdeQueryStringA
+! FUNCTION: DdeQueryStringW
+! FUNCTION: DdeReconnect
+! FUNCTION: DdeSetQualityOfService
+! FUNCTION: DdeSetUserHandle
+! FUNCTION: DdeUnaccessData
+! FUNCTION: DdeUninitialize
+! FUNCTION: DefDlgProcA
+! FUNCTION: DefDlgProcW
+! FUNCTION: DeferWindowPos
+! FUNCTION: DefFrameProcA
+! FUNCTION: DefFrameProcW
+! FUNCTION: DefMDIChildProcA
+! FUNCTION: DefMDIChildProcW
+! FUNCTION: DefRawInputProc
+! FUNCTION: DefWindowProcA
+! FUNCTION: DefWindowProcW
+! FUNCTION: DeleteMenu
+! FUNCTION: DeregisterShellHookWindow
+! FUNCTION: DestroyAcceleratorTable
+! FUNCTION: DestroyCaret
+! FUNCTION: DestroyCursor
+! FUNCTION: DestroyIcon
+! FUNCTION: DestroyMenu
+! FUNCTION: DestroyReasons
+! FUNCTION: DestroyWindow
+! FUNCTION: DeviceEventWorker
+! FUNCTION: DialogBoxIndirectParamA
+! FUNCTION: DialogBoxIndirectParamAorW
+! FUNCTION: DialogBoxIndirectParamW
+! FUNCTION: DialogBoxParamA
+! FUNCTION: DialogBoxParamW
+! FUNCTION: DisableProcessWindowsGhosting
+! FUNCTION: DispatchMessageA
+! FUNCTION: DispatchMessageW
+! FUNCTION: DisplayExitWindowsWarnings
+! FUNCTION: DlgDirListA
+! FUNCTION: DlgDirListComboBoxA
+! FUNCTION: DlgDirListComboBoxW
+! FUNCTION: DlgDirListW
+! FUNCTION: DlgDirSelectComboBoxExA
+! FUNCTION: DlgDirSelectComboBoxExW
+! FUNCTION: DlgDirSelectExA
+! FUNCTION: DlgDirSelectExW
+! FUNCTION: DragDetect
+! FUNCTION: DragObject
+
+
+FUNCTION: BOOL DrawAnimatedRects ( HWND hWnd, int idAni, RECT* lprcFrom, RECT* lprcTo ) ;
+! FUNCTION: BOOL DrawCaption ( HWND hWnd, HDC hdc, LPRECT lprc, UINT uFlags ) ;
+
+! FUNCTION: DrawEdge
+! FUNCTION: DrawFocusRect
+! FUNCTION: DrawFrame
+! FUNCTION: DrawFrameControl
+! FUNCTION: DrawIcon
+! FUNCTION: DrawIconEx
+! FUNCTION: DrawMenuBar
+! FUNCTION: DrawMenuBarTemp
+! FUNCTION: DrawStateA
+! FUNCTION: DrawStateW
+! FUNCTION: DrawTextA
+! FUNCTION: DrawTextExA
+! FUNCTION: DrawTextExW
+! FUNCTION: DrawTextW
+! FUNCTION: EditWndProc
+FUNCTION: BOOL EmptyClipboard ( ) ;
+! FUNCTION: EnableMenuItem
+! FUNCTION: EnableScrollBar
+! FUNCTION: EnableWindow
+! FUNCTION: EndDeferWindowPos
+! FUNCTION: EndDialog
+! FUNCTION: EndMenu
+
+FUNCTION: BOOL EndPaint (
+ HWND hWnd,
+ PAINTSTRUCT* lpPaint
+ ) ;
+
+! FUNCTION: EndTask
+! FUNCTION: EnterReaderModeHelper
+! FUNCTION: EnumChildWindows
+FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
+! FUNCTION: EnumDesktopsA
+! FUNCTION: EnumDesktopsW
+! FUNCTION: EnumDesktopWindows
+! FUNCTION: EnumDisplayDevicesA
+! FUNCTION: EnumDisplayDevicesW
+! FUNCTION: EnumDisplayMonitors
+! FUNCTION: EnumDisplaySettingsA
+! FUNCTION: EnumDisplaySettingsExA
+! FUNCTION: EnumDisplaySettingsExW
+! FUNCTION: EnumDisplaySettingsW
+! FUNCTION: EnumPropsA
+! FUNCTION: EnumPropsExA
+! FUNCTION: EnumPropsExW
+! FUNCTION: EnumPropsW
+! FUNCTION: EnumThreadWindows
+! FUNCTION: EnumWindows
+! FUNCTION: EnumWindowStationsA
+! FUNCTION: EnumWindowStationsW
+! FUNCTION: EqualRect
+! FUNCTION: ExcludeUpdateRgn
+! FUNCTION: ExitWindowsEx
+! FUNCTION: FillRect
+! FUNCTION: FindWindowA
+! FUNCTION: FindWindowExA
+! FUNCTION: FindWindowExW
+! FUNCTION: FindWindowW
+! FUNCTION: FlashWindow
+! FUNCTION: FlashWindowEx
+! FUNCTION: FrameRect
+! FUNCTION: FreeDDElParam
+! FUNCTION: GetActiveWindow
+! FUNCTION: GetAltTabInfo
+! FUNCTION: GetAltTabInfoA
+! FUNCTION: GetAltTabInfoW
+! FUNCTION: GetAncestor
+! FUNCTION: GetAppCompatFlags
+! FUNCTION: GetAppCompatFlags2
+! FUNCTION: GetAsyncKeyState
+! FUNCTION: GetCapture
+! FUNCTION: GetCaretBlinkTime
+! FUNCTION: GetCaretPos
+! FUNCTION: GetClassInfoA
+! FUNCTION: GetClassInfoExA
+! FUNCTION: GetClassInfoExW
+! FUNCTION: GetClassInfoW
+! FUNCTION: GetClassLongA
+! FUNCTION: GetClassLongW
+! FUNCTION: GetClassNameA
+! FUNCTION: GetClassNameW
+! FUNCTION: GetClassWord
+! FUNCTION: BOOL GetClientRect ( HWND hWnd, LPRECT lpRect ) ;
+
+FUNCTION: HANDLE GetClipboardData ( UINT uFormat ) ;
+
+! FUNCTION: GetClipboardFormatNameA
+! FUNCTION: GetClipboardFormatNameW
+FUNCTION: HWND GetClipboardOwner ( ) ;
+FUNCTION: DWORD GetClipboardSequenceNumber ( ) ;
+! FUNCTION: GetClipboardViewer
+! FUNCTION: GetClipCursor
+! FUNCTION: GetComboBoxInfo
+! FUNCTION: GetCursor
+! FUNCTION: GetCursorFrameInfo
+! FUNCTION: GetCursorInfo
+! FUNCTION: GetCursorPos
+! FUNCTION: GetDC
+! FUNCTION: GetDCEx
+! FUNCTION: GetDesktopWindow
+! FUNCTION: GetDialogBaseUnits
+! FUNCTION: GetDlgCtrlID
+! FUNCTION: GetDlgItem
+! FUNCTION: GetDlgItemInt
+! FUNCTION: GetDlgItemTextA
+! FUNCTION: GetDlgItemTextW
+! FUNCTION: GetDoubleClickTime
+FUNCTION: HWND GetFocus ( ) ;
+! FUNCTION: GetForegroundWindow
+! FUNCTION: GetGuiResources
+! FUNCTION: GetGUIThreadInfo
+! FUNCTION: GetIconInfo
+! FUNCTION: GetInputDesktop
+! FUNCTION: GetInputState
+! FUNCTION: GetInternalWindowPos
+! FUNCTION: GetKBCodePage
+! FUNCTION: GetKeyboardLayout
+! FUNCTION: GetKeyboardLayoutList
+! FUNCTION: GetKeyboardLayoutNameA
+! FUNCTION: GetKeyboardLayoutNameW
+! FUNCTION: GetKeyboardState
+! FUNCTION: GetKeyboardType
+! FUNCTION: GetKeyNameTextA
+! FUNCTION: GetKeyNameTextW
+! FUNCTION: GetKeyState
+! FUNCTION: GetLastActivePopup
+! FUNCTION: GetLastInputInfo
+! FUNCTION: GetLayeredWindowAttributes
+! FUNCTION: GetListBoxInfo
+! FUNCTION: GetMenu
+! FUNCTION: GetMenuBarInfo
+! FUNCTION: GetMenuCheckMarkDimensions
+! FUNCTION: GetMenuContextHelpId
+! FUNCTION: GetMenuDefaultItem
+! FUNCTION: GetMenuInfo
+! FUNCTION: GetMenuItemCount
+! FUNCTION: GetMenuItemID
+! FUNCTION: GetMenuItemInfoA
+! FUNCTION: GetMenuItemInfoW
+! FUNCTION: GetMenuItemRect
+! FUNCTION: GetMenuState
+! FUNCTION: GetMenuStringA
+! FUNCTION: GetMenuStringW
+! FUNCTION: GetMessageA
+! FUNCTION: GetMessageExtraInfo
+! FUNCTION: GetMessagePos
+! FUNCTION: GetMessageTime
+! FUNCTION: GetMessageW
+! FUNCTION: GetMonitorInfoA
+! FUNCTION: GetMonitorInfoW
+! FUNCTION: GetMouseMovePointsEx
+! FUNCTION: GetNextDlgGroupItem
+! FUNCTION: GetNextDlgTabItem
+! FUNCTION: GetOpenClipboardWindow
+FUNCTION: HWND GetParent ( HWND hWnd ) ;
+FUNCTION: int GetPriorityClipboardFormat ( UINT* paFormatPriorityList, int cFormats ) ;
+! FUNCTION: GetProcessDefaultLayout
+! FUNCTION: GetProcessWindowStation
+! FUNCTION: GetProgmanWindow
+! FUNCTION: GetPropA
+! FUNCTION: GetPropW
+! FUNCTION: GetQueueStatus
+! FUNCTION: GetRawInputBuffer
+! FUNCTION: GetRawInputData
+! FUNCTION: GetRawInputDeviceInfoA
+! FUNCTION: GetRawInputDeviceInfoW
+! FUNCTION: GetRawInputDeviceList
+! FUNCTION: GetReasonTitleFromReasonCode
+! FUNCTION: GetRegisteredRawInputDevices
+! FUNCTION: GetScrollBarInfo
+! FUNCTION: GetScrollInfo
+! FUNCTION: GetScrollPos
+! FUNCTION: GetScrollRange
+! FUNCTION: GetShellWindow
+! FUNCTION: GetSubMenu
+! FUNCTION: GetSysColor
+! FUNCTION: GetSysColorBrush
+! FUNCTION: GetSystemMenu
+! FUNCTION: GetSystemMetrics
+! FUNCTION: GetTabbedTextExtentA
+! FUNCTION: GetTabbedTextExtentW
+! FUNCTION: GetTaskmanWindow
+! FUNCTION: GetThreadDesktop
+! FUNCTION: GetTitleBarInfo
+
+
+FUNCTION: HWND GetTopWindow ( HWND hWnd ) ;
+! FUNCTION: BOOL GetUpdateRect ( HWND hWnd, LPRECT lpRect, BOOL bErase ) ;
+FUNCTION: int GetUpdateRgn ( HWND hWnd, HRGN hRgn, BOOL bErase ) ;
+
+
+! FUNCTION: GetUserObjectInformationA
+! FUNCTION: GetUserObjectInformationW
+! FUNCTION: GetUserObjectSecurity
+FUNCTION: HWND GetWindow ( HWND hWnd, UINT uCmd ) ;
+! FUNCTION: GetWindowContextHelpId
+! FUNCTION: GetWindowDC
+! FUNCTION: GetWindowInfo
+! FUNCTION: GetWindowLongA
+! FUNCTION: GetWindowLongW
+! FUNCTION: GetWindowModuleFileName
+! FUNCTION: GetWindowModuleFileNameA
+! FUNCTION: GetWindowModuleFileNameW
+! FUNCTION: GetWindowPlacement
+! FUNCTION: GetWindowRect
+! FUNCTION: GetWindowRgn
+! FUNCTION: GetWindowRgnBox
+! FUNCTION: GetWindowTextA
+! FUNCTION: GetWindowTextLengthA
+! FUNCTION: GetWindowTextLengthW
+! FUNCTION: GetWindowTextW
+! FUNCTION: GetWindowThreadProcessId
+! FUNCTION: GetWindowWord
+! FUNCTION: GetWinStationInfo
+! FUNCTION: GrayStringA
+! FUNCTION: GrayStringW
+! FUNCTION: HideCaret
+! FUNCTION: HiliteMenuItem
+! FUNCTION: ImpersonateDdeClientWindow
+! FUNCTION: IMPGetIMEA
+! FUNCTION: IMPGetIMEW
+! FUNCTION: IMPQueryIMEA
+! FUNCTION: IMPQueryIMEW
+! FUNCTION: IMPSetIMEA
+! FUNCTION: IMPSetIMEW
+! FUNCTION: InflateRect
+! FUNCTION: InitializeLpkHooks
+! FUNCTION: InitializeWin32EntryTable
+! FUNCTION: InSendMessage
+! FUNCTION: InSendMessageEx
+! FUNCTION: InsertMenuA
+! FUNCTION: InsertMenuItemA
+! FUNCTION: InsertMenuItemW
+! FUNCTION: InsertMenuW
+! FUNCTION: InternalGetWindowText
+! FUNCTION: IntersectRect
+! FUNCTION: InvalidateRect
+! FUNCTION: InvalidateRgn
+! FUNCTION: InvertRect
+! FUNCTION: IsCharAlphaA
+! FUNCTION: IsCharAlphaNumericA
+! FUNCTION: IsCharAlphaNumericW
+! FUNCTION: IsCharAlphaW
+! FUNCTION: IsCharLowerA
+! FUNCTION: IsCharLowerW
+! FUNCTION: IsCharUpperA
+! FUNCTION: IsCharUpperW
+FUNCTION: BOOL IsChild ( HWND hWndParent, HWND hWnd ) ;
+FUNCTION: BOOL IsClipboardFormatAvailable ( UINT format ) ;
+! FUNCTION: IsDialogMessage
+! FUNCTION: IsDialogMessageA
+! FUNCTION: IsDialogMessageW
+! FUNCTION: IsDlgButtonChecked
+FUNCTION: BOOL IsGUIThread ( BOOL bConvert ) ;
+FUNCTION: BOOL IsHungAppWindow ( HWND hWnd ) ;
+FUNCTION: BOOL IsIconic ( HWND hWnd ) ;
+FUNCTION: BOOL IsMenu ( HMENU hMenu ) ;
+! FUNCTION: BOOL IsRectEmpty
+! FUNCTION: BOOL IsServerSideWindow
+FUNCTION: BOOL IsWindow ( HWND hWnd ) ;
+! FUNCTION: BOOL IsWindowEnabled
+! FUNCTION: BOOL IsWindowInDestroy
+FUNCTION: BOOL IsWindowUnicode ( HWND hWnd ) ;
+FUNCTION: BOOL IsWindowVisible ( HWND hWnd ) ;
+! FUNCTION: BOOL IsWinEventHookInstalled
+FUNCTION: BOOL IsZoomed ( HWND hWnd ) ;
+! FUNCTION: keybd_event
+! FUNCTION: KillSystemTimer
+! FUNCTION: KillTimer
+! FUNCTION: LoadAcceleratorsA
+! FUNCTION: LoadAcceleratorsW
+! FUNCTION: LoadBitmapA
+! FUNCTION: LoadBitmapW
+! FUNCTION: LoadCursorFromFileA
+! FUNCTION: LoadCursorFromFileW
+
+
+FUNCTION: HCURSOR LoadCursorA ( HINSTANCE hInstance, LPCTSTR lpCursorName ) ;
+FUNCTION: HCURSOR LoadCursorW ( HINSTANCE hInstance, LPCWSTR lpCursorName ) ;
+: LoadCursor \ LoadCursorW \ LoadCursorA unicode-exec ;
+
+FUNCTION: HICON LoadIconA ( HINSTANCE hInstance, LPCTSTR lpIconName ) ;
+FUNCTION: HICON LoadIconW ( HINSTANCE hInstance, LPCTSTR lpIconName ) ;
+: LoadIcon \ LoadIconW \ LoadIconA unicode-exec ;
+
+! FUNCTION: LoadImageA
+! FUNCTION: LoadImageW
+! FUNCTION: LoadKeyboardLayoutA
+! FUNCTION: LoadKeyboardLayoutEx
+! FUNCTION: LoadKeyboardLayoutW
+! FUNCTION: LoadLocalFonts
+! FUNCTION: LoadMenuA
+! FUNCTION: LoadMenuIndirectA
+! FUNCTION: LoadMenuIndirectW
+! FUNCTION: LoadMenuW
+! FUNCTION: LoadRemoteFonts
+! FUNCTION: LoadStringA
+! FUNCTION: LoadStringW
+! FUNCTION: LockSetForegroundWindow
+! FUNCTION: LockWindowStation
+! FUNCTION: LockWindowUpdate
+! FUNCTION: LockWorkStation
+! FUNCTION: LookupIconIdFromDirectory
+! FUNCTION: LookupIconIdFromDirectoryEx
+! FUNCTION: MapDialogRect
+! FUNCTION: MapVirtualKeyA
+! FUNCTION: MapVirtualKeyExA
+! FUNCTION: MapVirtualKeyExW
+! FUNCTION: MapVirtualKeyW
+! FUNCTION: MapWindowPoints
+! FUNCTION: MB_GetString
+! FUNCTION: MBToWCSEx
+! FUNCTION: MenuItemFromPoint
+! FUNCTION: MenuWindowProcA
+! FUNCTION: MenuWindowProcW
+
+
+: MB_ICONASTERISK HEX: 00000040 ;
+: MB_ICONEXCLAMATION HEX: 00000030 ;
+: MB_ICONHAND HEX: 00000010 ;
+: MB_ICONQUESTION HEX: 00000020 ;
+: MB_OK HEX: 00000000 ;
+! -1 is Simple beep
+FUNCTION: BOOL MessageBeep ( UINT uType ) ;
+
+FUNCTION: int MessageBoxA (
+ HWND hWnd,
+ LPCSTR lpText,
+ LPCSTR lpCaption,
+ UINT uType ) ;
+
+FUNCTION: int MessageBoxW (
+ HWND hWnd,
+ LPCWSTR lpText,
+ LPCWSTR lpCaption,
+ UINT uType) ;
+
+FUNCTION: int MessageBoxExA ( HWND hWnd,
+ LPCSTR lpText,
+ LPCSTR lpCaption,
+ UINT uType,
+ WORD wLanguageId
+ ) ;
+
+FUNCTION: int MessageBoxExW (
+ HWND hWnd,
+ LPCWSTR lpText,
+ LPCWSTR lpCaption,
+ UINT uType,
+ WORD wLanguageId ) ;
+
+FUNCTION: int MessageBoxIndirectA (
+ MSGBOXPARAMSA* params ) ;
+
+FUNCTION: int MessageBoxIndirectW (
+ MSGBOXPARAMSW* params ) ;
+
+
+: MessageBox ( -- )
+ \ MessageBoxW \ MessageBoxA unicode-exec ;
+
+: MessageBoxEx ( -- )
+ \ MessageBoxExW \ MessageBoxExA unicode-exec ;
+
+: MessageBoxIndirect ( -- )
+ \ MessageBoxIndirectW \ MessageBoxIndirectA unicode-exec ;
+
+! FUNCTION: MessageBoxTimeoutA ! dllexported, not in header
+! FUNCTION: MessageBoxTimeoutW ! dllexported, not in header
+
+! FUNCTION: ModifyMenuA
+! FUNCTION: ModifyMenuW
+! FUNCTION: MonitorFromPoint
+! FUNCTION: MonitorFromRect
+! FUNCTION: MonitorFromWindow
+! FUNCTION: mouse_event
+
+
+
+FUNCTION: BOOL MoveWindow (
+ HWND hWnd,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ BOOL bRepaint ) ;
+
+
+! FUNCTION: MsgWaitForMultipleObjects
+! FUNCTION: MsgWaitForMultipleObjectsEx
+! FUNCTION: NotifyWinEvent
+! FUNCTION: OemKeyScan
+! FUNCTION: OemToCharA
+! FUNCTION: OemToCharBuffA
+! FUNCTION: OemToCharBuffW
+! FUNCTION: OemToCharW
+! FUNCTION: OffsetRect
+FUNCTION: BOOL OpenClipboard ( HWND hWndNewOwner ) ;
+! FUNCTION: OpenDesktopA
+! FUNCTION: OpenDesktopW
+! FUNCTION: OpenIcon
+! FUNCTION: OpenInputDesktop
+! FUNCTION: OpenWindowStationA
+! FUNCTION: OpenWindowStationW
+! FUNCTION: PackDDElParam
+! FUNCTION: PaintDesktop
+! FUNCTION: PaintMenuBar
+! FUNCTION: PeekMessageA
+! FUNCTION: PeekMessageW
+! FUNCTION: PostMessageA
+! FUNCTION: PostMessageW
+! FUNCTION: PostQuitMessage
+! FUNCTION: PostThreadMessageA
+! FUNCTION: PostThreadMessageW
+! FUNCTION: PrintWindow
+! FUNCTION: PrivateExtractIconExA
+! FUNCTION: PrivateExtractIconExW
+! FUNCTION: PrivateExtractIconsA
+! FUNCTION: PrivateExtractIconsW
+! FUNCTION: PrivateSetDbgTag
+! FUNCTION: PrivateSetRipFlags
+! FUNCTION: PtInRect
+! FUNCTION: QuerySendMessage
+! FUNCTION: QueryUserCounters
+! FUNCTION: RealChildWindowFromPoint
+! FUNCTION: RealGetWindowClass
+! FUNCTION: RealGetWindowClassA
+! FUNCTION: RealGetWindowClassW
+! FUNCTION: ReasonCodeNeedsBugID
+! FUNCTION: ReasonCodeNeedsComment
+! FUNCTION: RecordShutdownReason
+! FUNCTION: RedrawWindow
+
+FUNCTION: ATOM RegisterClassA ( WNDCLASS* lpWndClass) ;
+FUNCTION: ATOM RegisterClassW ( WNDCLASS* lpWndClass ) ;
+FUNCTION: ATOM RegisterClassExA ( WNDCLASSEX* lpwcx ) ;
+FUNCTION: ATOM RegisterClassExW ( WNDCLASSEX* lpwcx ) ;
+
+: RegisterClass \ RegisterClassW \ RegisterClassA unicode-exec ;
+: RegisterClassEx \ RegisterClassExW \ RegisterClassExA unicode-exec ;
+
+! FUNCTION: RegisterClipboardFormatA
+! FUNCTION: RegisterClipboardFormatW
+! FUNCTION: RegisterDeviceNotificationA
+! FUNCTION: RegisterDeviceNotificationW
+! FUNCTION: RegisterHotKey
+! FUNCTION: RegisterLogonProcess
+! FUNCTION: RegisterMessagePumpHook
+! FUNCTION: RegisterRawInputDevices
+! FUNCTION: RegisterServicesProcess
+! FUNCTION: RegisterShellHookWindow
+! FUNCTION: RegisterSystemThread
+! FUNCTION: RegisterTasklist
+! FUNCTION: RegisterUserApiHook
+! FUNCTION: RegisterWindowMessageA
+! FUNCTION: RegisterWindowMessageW
+! FUNCTION: ReleaseCapture
+! FUNCTION: ReleaseDC
+! FUNCTION: RemoveMenu
+! FUNCTION: RemovePropA
+! FUNCTION: RemovePropW
+! FUNCTION: ReplyMessage
+! FUNCTION: ResolveDesktopForWOW
+! FUNCTION: ReuseDDElParam
+! FUNCTION: ScreenToClient
+! FUNCTION: ScrollChildren
+! FUNCTION: ScrollDC
+! FUNCTION: ScrollWindow
+! FUNCTION: ScrollWindowEx
+! FUNCTION: SendDlgItemMessageA
+! FUNCTION: SendDlgItemMessageW
+! FUNCTION: SendIMEMessageExA
+! FUNCTION: SendIMEMessageExW
+! FUNCTION: UINT SendInput ( UINT nInputs, LPINPUT pInputs, int cbSize ) ;
+! FUNCTION: SendMessageA
+! FUNCTION: SendMessageCallbackA
+! FUNCTION: SendMessageCallbackW
+! FUNCTION: SendMessageTimeoutA
+! FUNCTION: SendMessageTimeoutW
+! FUNCTION: SendMessageW
+! FUNCTION: SendNotifyMessageA
+! FUNCTION: SendNotifyMessageW
+! FUNCTION: SetActiveWindow
+! FUNCTION: SetCapture
+! FUNCTION: SetCaretBlinkTime
+! FUNCTION: SetCaretPos
+! FUNCTION: SetClassLongA
+! FUNCTION: SetClassLongW
+! FUNCTION: SetClassWord
+FUNCTION: HANDLE SetClipboardData ( UINT uFormat, HANDLE hMem ) ;
+! FUNCTION: SetClipboardViewer
+! FUNCTION: SetConsoleReserveKeys
+! FUNCTION: SetCursor
+! FUNCTION: SetCursorContents
+! FUNCTION: SetCursorPos
+! FUNCTION: SetDebugErrorLevel
+! FUNCTION: SetDeskWallpaper
+! FUNCTION: SetDlgItemInt
+! FUNCTION: SetDlgItemTextA
+! FUNCTION: SetDlgItemTextW
+! FUNCTION: SetDoubleClickTime
+! FUNCTION: SetFocus
+! FUNCTION: SetForegroundWindow
+! FUNCTION: SetInternalWindowPos
+! FUNCTION: SetKeyboardState
+! FUNCTION: SetLastErrorEx
+! FUNCTION: SetLayeredWindowAttributes
+! FUNCTION: SetLogonNotifyWindow
+! FUNCTION: SetMenu
+! FUNCTION: SetMenuContextHelpId
+! FUNCTION: SetMenuDefaultItem
+! FUNCTION: SetMenuInfo
+! FUNCTION: SetMenuItemBitmaps
+! FUNCTION: SetMenuItemInfoA
+! FUNCTION: SetMenuItemInfoW
+! FUNCTION: SetMessageExtraInfo
+! FUNCTION: SetMessageQueue
+! FUNCTION: SetParent
+! FUNCTION: SetProcessDefaultLayout
+! FUNCTION: SetProcessWindowStation
+! FUNCTION: SetProgmanWindow
+! FUNCTION: SetPropA
+! FUNCTION: SetPropW
+! FUNCTION: SetRect
+! FUNCTION: SetRectEmpty
+! FUNCTION: SetScrollInfo
+! FUNCTION: SetScrollPos
+! FUNCTION: SetScrollRange
+! FUNCTION: SetShellWindow
+! FUNCTION: SetShellWindowEx
+! FUNCTION: SetSysColors
+! FUNCTION: SetSysColorsTemp
+! FUNCTION: SetSystemCursor
+! FUNCTION: SetSystemMenu
+! FUNCTION: SetSystemTimer
+! FUNCTION: SetTaskmanWindow
+! FUNCTION: SetThreadDesktop
+! FUNCTION: SetTimer
+! FUNCTION: SetUserObjectInformationA
+! FUNCTION: SetUserObjectInformationW
+! FUNCTION: SetUserObjectSecurity
+! FUNCTION: SetWindowContextHelpId
+! FUNCTION: SetWindowLongA
+! FUNCTION: SetWindowLongW
+! FUNCTION: SetWindowPlacement
+! FUNCTION: SetWindowPos
+! FUNCTION: SetWindowRgn
+! FUNCTION: SetWindowsHookA
+! FUNCTION: SetWindowsHookExA
+! FUNCTION: SetWindowsHookExW
+! FUNCTION: SetWindowsHookW
+! FUNCTION: SetWindowStationUser
+! FUNCTION: SetWindowTextA
+! FUNCTION: SetWindowTextW
+! FUNCTION: SetWindowWord
+! FUNCTION: SetWinEventHook
+! FUNCTION: ShowCaret
+! FUNCTION: ShowCursor
+! FUNCTION: ShowOwnedPopups
+! FUNCTION: ShowScrollBar
+! FUNCTION: ShowStartGlass
+
+FUNCTION: BOOL ShowWindow ( HWND hWnd, int nCmdShow ) ;
+
+! FUNCTION: ShowWindowAsync
+! FUNCTION: SoftModalMessageBox
+! FUNCTION: SubtractRect
+! FUNCTION: SwapMouseButton
+! FUNCTION: SwitchDesktop
+! FUNCTION: SwitchToThisWindow
+! FUNCTION: SystemParametersInfoA
+! FUNCTION: SystemParametersInfoW
+! FUNCTION: TabbedTextOutA
+! FUNCTION: TabbedTextOutW
+! FUNCTION: TileChildWindows
+! FUNCTION: TileWindows
+! FUNCTION: ToAscii
+! FUNCTION: ToAsciiEx
+! FUNCTION: ToUnicode
+! FUNCTION: ToUnicodeEx
+! FUNCTION: TrackMouseEvent
+! FUNCTION: TrackPopupMenu
+! FUNCTION: TrackPopupMenuEx
+! FUNCTION: TranslateAccelerator
+! FUNCTION: TranslateAcceleratorA
+! FUNCTION: TranslateAcceleratorW
+! FUNCTION: TranslateMDISysAccel
+! FUNCTION: TranslateMessage
+! FUNCTION: TranslateMessageEx
+! FUNCTION: UnhookWindowsHook
+! FUNCTION: UnhookWindowsHookEx
+! FUNCTION: UnhookWinEvent
+! FUNCTION: UnionRect
+! FUNCTION: UnloadKeyboardLayout
+! FUNCTION: UnlockWindowStation
+! FUNCTION: UnpackDDElParam
+! FUNCTION: UnregisterClassA
+! FUNCTION: UnregisterClassW
+! FUNCTION: UnregisterDeviceNotification
+! FUNCTION: UnregisterHotKey
+! FUNCTION: UnregisterMessagePumpHook
+! FUNCTION: UnregisterUserApiHook
+! FUNCTION: UpdateLayeredWindow
+! FUNCTION: UpdatePerUserSystemParameters
+
+
+FUNCTION: BOOL UpdateWindow ( HWND hWnd ) ;
+
+! FUNCTION: User32InitializeImmEntryTable
+! FUNCTION: UserClientDllInitialize
+! FUNCTION: UserHandleGrantAccess
+! FUNCTION: UserLpkPSMTextOut
+! FUNCTION: UserLpkTabbedTextOut
+! FUNCTION: UserRealizePalette
+! FUNCTION: UserRegisterWowHandlers
+! FUNCTION: ValidateRect
+! FUNCTION: ValidateRgn
+! FUNCTION: VkKeyScanA
+! FUNCTION: VkKeyScanExA
+! FUNCTION: VkKeyScanExW
+! FUNCTION: VkKeyScanW
+! FUNCTION: VRipOutput
+! FUNCTION: VTagOutput
+! FUNCTION: WaitForInputIdle
+! FUNCTION: WaitMessage
+! FUNCTION: WCSToMBEx
+! FUNCTION: Win32PoolAllocationStats
+! FUNCTION: WindowFromDC
+! FUNCTION: WindowFromPoint
+! FUNCTION: WinHelpA
+! FUNCTION: WinHelpW
+! FUNCTION: WINNLSEnableIME
+! FUNCTION: WINNLSGetEnableStatus
+! FUNCTION: WINNLSGetIMEHotkey
+! FUNCTION: wsprintfA
+! FUNCTION: wsprintfW
+! FUNCTION: wvsprintfA
+! FUNCTION: wvsprintfW
+
diff --git a/contrib/win32/utils.factor b/contrib/win32/utils.factor
new file mode 100644
index 0000000000..993f0b9e4b
--- /dev/null
+++ b/contrib/win32/utils.factor
@@ -0,0 +1,4 @@
+IN: win32
+USING: alien parser namespaces kernel syntax words math io prettyprint ;
+
+
diff --git a/contrib/win32/winuser.h b/contrib/win32/winuser.h
new file mode 100644
index 0000000000..516c472241
--- /dev/null
+++ b/contrib/win32/winuser.h
@@ -0,0 +1,11835 @@
+/****************************************************************************
+* *
+* winuser.h -- USER procedure declarations, constant definitions and macros *
+* *
+* Copyright (c) Microsoft Corporation. All rights reserved. *
+* *
+****************************************************************************/
+
+
+
+#ifndef _WINUSER_
+#define _WINUSER_
+
+
+
+//
+// Define API decoration for direct importing of DLL references.
+//
+
+#if !defined(_USER32_)
+#define WINUSERAPI DECLSPEC_IMPORT
+#else
+#define WINUSERAPI
+#endif
+
+#ifdef _MAC
+#include
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef WINVER
+#define WINVER 0x0500 /* version 5.0 */
+#endif /* !WINVER */
+
+#include
+
+#ifndef NOUSER
+
+typedef HANDLE HDWP;
+typedef VOID MENUTEMPLATEA;
+typedef VOID MENUTEMPLATEW;
+#ifdef UNICODE
+typedef MENUTEMPLATEW MENUTEMPLATE;
+#else
+typedef MENUTEMPLATEA MENUTEMPLATE;
+#endif // UNICODE
+typedef PVOID LPMENUTEMPLATEA;
+typedef PVOID LPMENUTEMPLATEW;
+#ifdef UNICODE
+typedef LPMENUTEMPLATEW LPMENUTEMPLATE;
+#else
+typedef LPMENUTEMPLATEA LPMENUTEMPLATE;
+#endif // UNICODE
+
+typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+
+#ifdef STRICT
+
+typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
+typedef VOID (CALLBACK* TIMERPROC)(HWND, UINT, UINT_PTR, DWORD);
+typedef BOOL (CALLBACK* GRAYSTRINGPROC)(HDC, LPARAM, int);
+typedef BOOL (CALLBACK* WNDENUMPROC)(HWND, LPARAM);
+typedef LRESULT (CALLBACK* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);
+typedef VOID (CALLBACK* SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT);
+
+typedef BOOL (CALLBACK* PROPENUMPROCA)(HWND, LPCSTR, HANDLE);
+typedef BOOL (CALLBACK* PROPENUMPROCW)(HWND, LPCWSTR, HANDLE);
+
+typedef BOOL (CALLBACK* PROPENUMPROCEXA)(HWND, LPSTR, HANDLE, ULONG_PTR);
+typedef BOOL (CALLBACK* PROPENUMPROCEXW)(HWND, LPWSTR, HANDLE, ULONG_PTR);
+
+typedef int (CALLBACK* EDITWORDBREAKPROCA)(LPSTR lpch, int ichCurrent, int cch, int code);
+typedef int (CALLBACK* EDITWORDBREAKPROCW)(LPWSTR lpch, int ichCurrent, int cch, int code);
+
+#if(WINVER >= 0x0400)
+typedef BOOL (CALLBACK* DRAWSTATEPROC)(HDC hdc, LPARAM lData, WPARAM wData, int cx, int cy);
+#endif /* WINVER >= 0x0400 */
+#else /* !STRICT */
+
+typedef FARPROC DLGPROC;
+typedef FARPROC TIMERPROC;
+typedef FARPROC GRAYSTRINGPROC;
+typedef FARPROC WNDENUMPROC;
+typedef FARPROC HOOKPROC;
+typedef FARPROC SENDASYNCPROC;
+
+typedef FARPROC EDITWORDBREAKPROCA;
+typedef FARPROC EDITWORDBREAKPROCW;
+
+typedef FARPROC PROPENUMPROCA;
+typedef FARPROC PROPENUMPROCW;
+
+typedef FARPROC PROPENUMPROCEXA;
+typedef FARPROC PROPENUMPROCEXW;
+
+#if(WINVER >= 0x0400)
+typedef FARPROC DRAWSTATEPROC;
+#endif /* WINVER >= 0x0400 */
+#endif /* !STRICT */
+
+#ifdef UNICODE
+typedef PROPENUMPROCW PROPENUMPROC;
+typedef PROPENUMPROCEXW PROPENUMPROCEX;
+typedef EDITWORDBREAKPROCW EDITWORDBREAKPROC;
+#else /* !UNICODE */
+typedef PROPENUMPROCA PROPENUMPROC;
+typedef PROPENUMPROCEXA PROPENUMPROCEX;
+typedef EDITWORDBREAKPROCA EDITWORDBREAKPROC;
+#endif /* UNICODE */
+
+#ifdef STRICT
+
+typedef BOOL (CALLBACK* NAMEENUMPROCA)(LPSTR, LPARAM);
+typedef BOOL (CALLBACK* NAMEENUMPROCW)(LPWSTR, LPARAM);
+
+typedef NAMEENUMPROCA WINSTAENUMPROCA;
+typedef NAMEENUMPROCA DESKTOPENUMPROCA;
+typedef NAMEENUMPROCW WINSTAENUMPROCW;
+typedef NAMEENUMPROCW DESKTOPENUMPROCW;
+
+
+#else /* !STRICT */
+
+typedef FARPROC NAMEENUMPROCA;
+typedef FARPROC NAMEENUMPROCW;
+typedef FARPROC WINSTAENUMPROCA;
+typedef FARPROC DESKTOPENUMPROCA;
+typedef FARPROC WINSTAENUMPROCW;
+typedef FARPROC DESKTOPENUMPROCW;
+
+
+#endif /* !STRICT */
+
+#ifdef UNICODE
+typedef WINSTAENUMPROCW WINSTAENUMPROC;
+typedef DESKTOPENUMPROCW DESKTOPENUMPROC;
+
+
+#else /* !UNICODE */
+typedef WINSTAENUMPROCA WINSTAENUMPROC;
+typedef DESKTOPENUMPROCA DESKTOPENUMPROC;
+
+#endif /* UNICODE */
+
+#define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0)
+#define MAKEINTRESOURCEA(i) (LPSTR)((ULONG_PTR)((WORD)(i)))
+#define MAKEINTRESOURCEW(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
+#ifdef UNICODE
+#define MAKEINTRESOURCE MAKEINTRESOURCEW
+#else
+#define MAKEINTRESOURCE MAKEINTRESOURCEA
+#endif // !UNICODE
+
+#ifndef NORESOURCE
+
+/*
+ * Predefined Resource Types
+ */
+#define RT_CURSOR MAKEINTRESOURCE(1)
+#define RT_BITMAP MAKEINTRESOURCE(2)
+#define RT_ICON MAKEINTRESOURCE(3)
+#define RT_MENU MAKEINTRESOURCE(4)
+#define RT_DIALOG MAKEINTRESOURCE(5)
+#define RT_STRING MAKEINTRESOURCE(6)
+#define RT_FONTDIR MAKEINTRESOURCE(7)
+#define RT_FONT MAKEINTRESOURCE(8)
+#define RT_ACCELERATOR MAKEINTRESOURCE(9)
+#define RT_RCDATA MAKEINTRESOURCE(10)
+#define RT_MESSAGETABLE MAKEINTRESOURCE(11)
+
+#define DIFFERENCE 11
+#define RT_GROUP_CURSOR MAKEINTRESOURCE((ULONG_PTR)RT_CURSOR + DIFFERENCE)
+#define RT_GROUP_ICON MAKEINTRESOURCE((ULONG_PTR)RT_ICON + DIFFERENCE)
+#define RT_VERSION MAKEINTRESOURCE(16)
+#define RT_DLGINCLUDE MAKEINTRESOURCE(17)
+#if(WINVER >= 0x0400)
+#define RT_PLUGPLAY MAKEINTRESOURCE(19)
+#define RT_VXD MAKEINTRESOURCE(20)
+#define RT_ANICURSOR MAKEINTRESOURCE(21)
+#define RT_ANIICON MAKEINTRESOURCE(22)
+#endif /* WINVER >= 0x0400 */
+#define RT_HTML MAKEINTRESOURCE(23)
+#ifdef RC_INVOKED
+#define RT_MANIFEST 24
+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
+#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
+#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
+#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 /* inclusive */
+#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 /* inclusive */
+#else /* RC_INVOKED */
+#define RT_MANIFEST MAKEINTRESOURCE(24)
+#define CREATEPROCESS_MANIFEST_RESOURCE_ID MAKEINTRESOURCE( 1)
+#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(2)
+#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(3)
+#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE( 1 /*inclusive*/)
+#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(16 /*inclusive*/)
+#endif /* RC_INVOKED */
+
+
+#endif /* !NORESOURCE */
+
+WINUSERAPI
+int
+WINAPI
+wvsprintfA(
+ OUT LPSTR,
+ IN LPCSTR,
+ IN va_list arglist);
+WINUSERAPI
+int
+WINAPI
+wvsprintfW(
+ OUT LPWSTR,
+ IN LPCWSTR,
+ IN va_list arglist);
+#ifdef UNICODE
+#define wvsprintf wvsprintfW
+#else
+#define wvsprintf wvsprintfA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPIV
+wsprintfA(
+ OUT LPSTR,
+ IN LPCSTR,
+ ...);
+WINUSERAPI
+int
+WINAPIV
+wsprintfW(
+ OUT LPWSTR,
+ IN LPCWSTR,
+ ...);
+#ifdef UNICODE
+#define wsprintf wsprintfW
+#else
+#define wsprintf wsprintfA
+#endif // !UNICODE
+
+
+/*
+ * SPI_SETDESKWALLPAPER defined constants
+ */
+#define SETWALLPAPER_DEFAULT ((LPWSTR)-1)
+
+#ifndef NOSCROLL
+
+/*
+ * Scroll Bar Constants
+ */
+#define SB_HORZ 0
+#define SB_VERT 1
+#define SB_CTL 2
+#define SB_BOTH 3
+
+/*
+ * Scroll Bar Commands
+ */
+#define SB_LINEUP 0
+#define SB_LINELEFT 0
+#define SB_LINEDOWN 1
+#define SB_LINERIGHT 1
+#define SB_PAGEUP 2
+#define SB_PAGELEFT 2
+#define SB_PAGEDOWN 3
+#define SB_PAGERIGHT 3
+#define SB_THUMBPOSITION 4
+#define SB_THUMBTRACK 5
+#define SB_TOP 6
+#define SB_LEFT 6
+#define SB_BOTTOM 7
+#define SB_RIGHT 7
+#define SB_ENDSCROLL 8
+
+#endif /* !NOSCROLL */
+
+#ifndef NOSHOWWINDOW
+
+
+/*
+ * ShowWindow() Commands
+ */
+#define SW_HIDE 0
+#define SW_SHOWNORMAL 1
+#define SW_NORMAL 1
+#define SW_SHOWMINIMIZED 2
+#define SW_SHOWMAXIMIZED 3
+#define SW_MAXIMIZE 3
+#define SW_SHOWNOACTIVATE 4
+#define SW_SHOW 5
+#define SW_MINIMIZE 6
+#define SW_SHOWMINNOACTIVE 7
+#define SW_SHOWNA 8
+#define SW_RESTORE 9
+#define SW_SHOWDEFAULT 10
+#define SW_FORCEMINIMIZE 11
+#define SW_MAX 11
+
+/*
+ * Old ShowWindow() Commands
+ */
+#define HIDE_WINDOW 0
+#define SHOW_OPENWINDOW 1
+#define SHOW_ICONWINDOW 2
+#define SHOW_FULLSCREEN 3
+#define SHOW_OPENNOACTIVATE 4
+
+/*
+ * Identifiers for the WM_SHOWWINDOW message
+ */
+#define SW_PARENTCLOSING 1
+#define SW_OTHERZOOM 2
+#define SW_PARENTOPENING 3
+#define SW_OTHERUNZOOM 4
+
+
+#endif /* !NOSHOWWINDOW */
+
+#if(WINVER >= 0x0500)
+/*
+ * AnimateWindow() Commands
+ */
+#define AW_HOR_POSITIVE 0x00000001
+#define AW_HOR_NEGATIVE 0x00000002
+#define AW_VER_POSITIVE 0x00000004
+#define AW_VER_NEGATIVE 0x00000008
+#define AW_CENTER 0x00000010
+#define AW_HIDE 0x00010000
+#define AW_ACTIVATE 0x00020000
+#define AW_SLIDE 0x00040000
+#define AW_BLEND 0x00080000
+
+#endif /* WINVER >= 0x0500 */
+
+
+/*
+ * WM_KEYUP/DOWN/CHAR HIWORD(lParam) flags
+ */
+#define KF_EXTENDED 0x0100
+#define KF_DLGMODE 0x0800
+#define KF_MENUMODE 0x1000
+#define KF_ALTDOWN 0x2000
+#define KF_REPEAT 0x4000
+#define KF_UP 0x8000
+
+#ifndef NOVIRTUALKEYCODES
+
+
+/*
+ * Virtual Keys, Standard Set
+ */
+#define VK_LBUTTON 0x01
+#define VK_RBUTTON 0x02
+#define VK_CANCEL 0x03
+#define VK_MBUTTON 0x04 /* NOT contiguous with L & RBUTTON */
+
+#if(_WIN32_WINNT >= 0x0500)
+#define VK_XBUTTON1 0x05 /* NOT contiguous with L & RBUTTON */
+#define VK_XBUTTON2 0x06 /* NOT contiguous with L & RBUTTON */
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+/*
+ * 0x07 : unassigned
+ */
+
+#define VK_BACK 0x08
+#define VK_TAB 0x09
+
+/*
+ * 0x0A - 0x0B : reserved
+ */
+
+#define VK_CLEAR 0x0C
+#define VK_RETURN 0x0D
+
+#define VK_SHIFT 0x10
+#define VK_CONTROL 0x11
+#define VK_MENU 0x12
+#define VK_PAUSE 0x13
+#define VK_CAPITAL 0x14
+
+#define VK_KANA 0x15
+#define VK_HANGEUL 0x15 /* old name - should be here for compatibility */
+#define VK_HANGUL 0x15
+#define VK_JUNJA 0x17
+#define VK_FINAL 0x18
+#define VK_HANJA 0x19
+#define VK_KANJI 0x19
+
+#define VK_ESCAPE 0x1B
+
+#define VK_CONVERT 0x1C
+#define VK_NONCONVERT 0x1D
+#define VK_ACCEPT 0x1E
+#define VK_MODECHANGE 0x1F
+
+#define VK_SPACE 0x20
+#define VK_PRIOR 0x21
+#define VK_NEXT 0x22
+#define VK_END 0x23
+#define VK_HOME 0x24
+#define VK_LEFT 0x25
+#define VK_UP 0x26
+#define VK_RIGHT 0x27
+#define VK_DOWN 0x28
+#define VK_SELECT 0x29
+#define VK_PRINT 0x2A
+#define VK_EXECUTE 0x2B
+#define VK_SNAPSHOT 0x2C
+#define VK_INSERT 0x2D
+#define VK_DELETE 0x2E
+#define VK_HELP 0x2F
+
+/*
+ * VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
+ * 0x40 : unassigned
+ * VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
+ */
+
+#define VK_LWIN 0x5B
+#define VK_RWIN 0x5C
+#define VK_APPS 0x5D
+
+/*
+ * 0x5E : reserved
+ */
+
+#define VK_SLEEP 0x5F
+
+#define VK_NUMPAD0 0x60
+#define VK_NUMPAD1 0x61
+#define VK_NUMPAD2 0x62
+#define VK_NUMPAD3 0x63
+#define VK_NUMPAD4 0x64
+#define VK_NUMPAD5 0x65
+#define VK_NUMPAD6 0x66
+#define VK_NUMPAD7 0x67
+#define VK_NUMPAD8 0x68
+#define VK_NUMPAD9 0x69
+#define VK_MULTIPLY 0x6A
+#define VK_ADD 0x6B
+#define VK_SEPARATOR 0x6C
+#define VK_SUBTRACT 0x6D
+#define VK_DECIMAL 0x6E
+#define VK_DIVIDE 0x6F
+#define VK_F1 0x70
+#define VK_F2 0x71
+#define VK_F3 0x72
+#define VK_F4 0x73
+#define VK_F5 0x74
+#define VK_F6 0x75
+#define VK_F7 0x76
+#define VK_F8 0x77
+#define VK_F9 0x78
+#define VK_F10 0x79
+#define VK_F11 0x7A
+#define VK_F12 0x7B
+#define VK_F13 0x7C
+#define VK_F14 0x7D
+#define VK_F15 0x7E
+#define VK_F16 0x7F
+#define VK_F17 0x80
+#define VK_F18 0x81
+#define VK_F19 0x82
+#define VK_F20 0x83
+#define VK_F21 0x84
+#define VK_F22 0x85
+#define VK_F23 0x86
+#define VK_F24 0x87
+
+/*
+ * 0x88 - 0x8F : unassigned
+ */
+
+#define VK_NUMLOCK 0x90
+#define VK_SCROLL 0x91
+
+/*
+ * NEC PC-9800 kbd definitions
+ */
+#define VK_OEM_NEC_EQUAL 0x92 // '=' key on numpad
+
+/*
+ * Fujitsu/OASYS kbd definitions
+ */
+#define VK_OEM_FJ_JISHO 0x92 // 'Dictionary' key
+#define VK_OEM_FJ_MASSHOU 0x93 // 'Unregister word' key
+#define VK_OEM_FJ_TOUROKU 0x94 // 'Register word' key
+#define VK_OEM_FJ_LOYA 0x95 // 'Left OYAYUBI' key
+#define VK_OEM_FJ_ROYA 0x96 // 'Right OYAYUBI' key
+
+/*
+ * 0x97 - 0x9F : unassigned
+ */
+
+/*
+ * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
+ * Used only as parameters to GetAsyncKeyState() and GetKeyState().
+ * No other API or message will distinguish left and right keys in this way.
+ */
+#define VK_LSHIFT 0xA0
+#define VK_RSHIFT 0xA1
+#define VK_LCONTROL 0xA2
+#define VK_RCONTROL 0xA3
+#define VK_LMENU 0xA4
+#define VK_RMENU 0xA5
+
+#if(_WIN32_WINNT >= 0x0500)
+#define VK_BROWSER_BACK 0xA6
+#define VK_BROWSER_FORWARD 0xA7
+#define VK_BROWSER_REFRESH 0xA8
+#define VK_BROWSER_STOP 0xA9
+#define VK_BROWSER_SEARCH 0xAA
+#define VK_BROWSER_FAVORITES 0xAB
+#define VK_BROWSER_HOME 0xAC
+
+#define VK_VOLUME_MUTE 0xAD
+#define VK_VOLUME_DOWN 0xAE
+#define VK_VOLUME_UP 0xAF
+#define VK_MEDIA_NEXT_TRACK 0xB0
+#define VK_MEDIA_PREV_TRACK 0xB1
+#define VK_MEDIA_STOP 0xB2
+#define VK_MEDIA_PLAY_PAUSE 0xB3
+#define VK_LAUNCH_MAIL 0xB4
+#define VK_LAUNCH_MEDIA_SELECT 0xB5
+#define VK_LAUNCH_APP1 0xB6
+#define VK_LAUNCH_APP2 0xB7
+
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+/*
+ * 0xB8 - 0xB9 : reserved
+ */
+
+#define VK_OEM_1 0xBA // ';:' for US
+#define VK_OEM_PLUS 0xBB // '+' any country
+#define VK_OEM_COMMA 0xBC // ',' any country
+#define VK_OEM_MINUS 0xBD // '-' any country
+#define VK_OEM_PERIOD 0xBE // '.' any country
+#define VK_OEM_2 0xBF // '/?' for US
+#define VK_OEM_3 0xC0 // '`~' for US
+
+/*
+ * 0xC1 - 0xD7 : reserved
+ */
+
+/*
+ * 0xD8 - 0xDA : unassigned
+ */
+
+#define VK_OEM_4 0xDB // '[{' for US
+#define VK_OEM_5 0xDC // '\|' for US
+#define VK_OEM_6 0xDD // ']}' for US
+#define VK_OEM_7 0xDE // ''"' for US
+#define VK_OEM_8 0xDF
+
+/*
+ * 0xE0 : reserved
+ */
+
+/*
+ * Various extended or enhanced keyboards
+ */
+#define VK_OEM_AX 0xE1 // 'AX' key on Japanese AX kbd
+#define VK_OEM_102 0xE2 // "<>" or "\|" on RT 102-key kbd.
+#define VK_ICO_HELP 0xE3 // Help key on ICO
+#define VK_ICO_00 0xE4 // 00 key on ICO
+
+#if(WINVER >= 0x0400)
+#define VK_PROCESSKEY 0xE5
+#endif /* WINVER >= 0x0400 */
+
+#define VK_ICO_CLEAR 0xE6
+
+
+#if(_WIN32_WINNT >= 0x0500)
+#define VK_PACKET 0xE7
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+/*
+ * 0xE8 : unassigned
+ */
+
+/*
+ * Nokia/Ericsson definitions
+ */
+#define VK_OEM_RESET 0xE9
+#define VK_OEM_JUMP 0xEA
+#define VK_OEM_PA1 0xEB
+#define VK_OEM_PA2 0xEC
+#define VK_OEM_PA3 0xED
+#define VK_OEM_WSCTRL 0xEE
+#define VK_OEM_CUSEL 0xEF
+#define VK_OEM_ATTN 0xF0
+#define VK_OEM_FINISH 0xF1
+#define VK_OEM_COPY 0xF2
+#define VK_OEM_AUTO 0xF3
+#define VK_OEM_ENLW 0xF4
+#define VK_OEM_BACKTAB 0xF5
+
+#define VK_ATTN 0xF6
+#define VK_CRSEL 0xF7
+#define VK_EXSEL 0xF8
+#define VK_EREOF 0xF9
+#define VK_PLAY 0xFA
+#define VK_ZOOM 0xFB
+#define VK_NONAME 0xFC
+#define VK_PA1 0xFD
+#define VK_OEM_CLEAR 0xFE
+
+/*
+ * 0xFF : reserved
+ */
+
+
+#endif /* !NOVIRTUALKEYCODES */
+
+#ifndef NOWH
+
+/*
+ * SetWindowsHook() codes
+ */
+#define WH_MIN (-1)
+#define WH_MSGFILTER (-1)
+#define WH_JOURNALRECORD 0
+#define WH_JOURNALPLAYBACK 1
+#define WH_KEYBOARD 2
+#define WH_GETMESSAGE 3
+#define WH_CALLWNDPROC 4
+#define WH_CBT 5
+#define WH_SYSMSGFILTER 6
+#define WH_MOUSE 7
+#if defined(_WIN32_WINDOWS)
+#define WH_HARDWARE 8
+#endif
+#define WH_DEBUG 9
+#define WH_SHELL 10
+#define WH_FOREGROUNDIDLE 11
+#if(WINVER >= 0x0400)
+#define WH_CALLWNDPROCRET 12
+#endif /* WINVER >= 0x0400 */
+
+#if (_WIN32_WINNT >= 0x0400)
+#define WH_KEYBOARD_LL 13
+#define WH_MOUSE_LL 14
+#endif // (_WIN32_WINNT >= 0x0400)
+
+#if(WINVER >= 0x0400)
+#if (_WIN32_WINNT >= 0x0400)
+#define WH_MAX 14
+#else
+#define WH_MAX 12
+#endif // (_WIN32_WINNT >= 0x0400)
+#else
+#define WH_MAX 11
+#endif
+
+#define WH_MINHOOK WH_MIN
+#define WH_MAXHOOK WH_MAX
+
+/*
+ * Hook Codes
+ */
+#define HC_ACTION 0
+#define HC_GETNEXT 1
+#define HC_SKIP 2
+#define HC_NOREMOVE 3
+#define HC_NOREM HC_NOREMOVE
+#define HC_SYSMODALON 4
+#define HC_SYSMODALOFF 5
+
+/*
+ * CBT Hook Codes
+ */
+#define HCBT_MOVESIZE 0
+#define HCBT_MINMAX 1
+#define HCBT_QS 2
+#define HCBT_CREATEWND 3
+#define HCBT_DESTROYWND 4
+#define HCBT_ACTIVATE 5
+#define HCBT_CLICKSKIPPED 6
+#define HCBT_KEYSKIPPED 7
+#define HCBT_SYSCOMMAND 8
+#define HCBT_SETFOCUS 9
+
+/*
+ * HCBT_CREATEWND parameters pointed to by lParam
+ */
+typedef struct tagCBT_CREATEWNDA
+{
+ struct tagCREATESTRUCTA *lpcs;
+ HWND hwndInsertAfter;
+} CBT_CREATEWNDA, *LPCBT_CREATEWNDA;
+/*
+ * HCBT_CREATEWND parameters pointed to by lParam
+ */
+typedef struct tagCBT_CREATEWNDW
+{
+ struct tagCREATESTRUCTW *lpcs;
+ HWND hwndInsertAfter;
+} CBT_CREATEWNDW, *LPCBT_CREATEWNDW;
+#ifdef UNICODE
+typedef CBT_CREATEWNDW CBT_CREATEWND;
+typedef LPCBT_CREATEWNDW LPCBT_CREATEWND;
+#else
+typedef CBT_CREATEWNDA CBT_CREATEWND;
+typedef LPCBT_CREATEWNDA LPCBT_CREATEWND;
+#endif // UNICODE
+
+/*
+ * HCBT_ACTIVATE structure pointed to by lParam
+ */
+typedef struct tagCBTACTIVATESTRUCT
+{
+ BOOL fMouse;
+ HWND hWndActive;
+} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;
+
+#if(_WIN32_WINNT >= 0x0501)
+/*
+ * WTSSESSION_NOTIFICATION struct pointed by lParam, for WM_WTSSESSION_CHANGE
+ */
+typedef struct tagWTSSESSION_NOTIFICATION
+{
+ DWORD cbSize;
+ DWORD dwSessionId;
+
+} WTSSESSION_NOTIFICATION, *PWTSSESSION_NOTIFICATION;
+
+/*
+ * codes passed in WPARAM for WM_WTSSESSION_CHANGE
+ */
+
+#define WTS_CONSOLE_CONNECT 0x1
+#define WTS_CONSOLE_DISCONNECT 0x2
+#define WTS_REMOTE_CONNECT 0x3
+#define WTS_REMOTE_DISCONNECT 0x4
+#define WTS_SESSION_LOGON 0x5
+#define WTS_SESSION_LOGOFF 0x6
+#define WTS_SESSION_LOCK 0x7
+#define WTS_SESSION_UNLOCK 0x8
+#define WTS_SESSION_REMOTE_CONTROL 0x9
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+/*
+ * WH_MSGFILTER Filter Proc Codes
+ */
+#define MSGF_DIALOGBOX 0
+#define MSGF_MESSAGEBOX 1
+#define MSGF_MENU 2
+#define MSGF_SCROLLBAR 5
+#define MSGF_NEXTWINDOW 6
+#define MSGF_MAX 8 // unused
+#define MSGF_USER 4096
+
+/*
+ * Shell support
+ */
+#define HSHELL_WINDOWCREATED 1
+#define HSHELL_WINDOWDESTROYED 2
+#define HSHELL_ACTIVATESHELLWINDOW 3
+
+#if(WINVER >= 0x0400)
+#define HSHELL_WINDOWACTIVATED 4
+#define HSHELL_GETMINRECT 5
+#define HSHELL_REDRAW 6
+#define HSHELL_TASKMAN 7
+#define HSHELL_LANGUAGE 8
+#define HSHELL_SYSMENU 9
+#define HSHELL_ENDTASK 10
+#endif /* WINVER >= 0x0400 */
+#if(_WIN32_WINNT >= 0x0500)
+#define HSHELL_ACCESSIBILITYSTATE 11
+#define HSHELL_APPCOMMAND 12
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define HSHELL_WINDOWREPLACED 13
+#define HSHELL_WINDOWREPLACING 14
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define HSHELL_HIGHBIT 0x8000
+#define HSHELL_FLASH (HSHELL_REDRAW|HSHELL_HIGHBIT)
+#define HSHELL_RUDEAPPACTIVATED (HSHELL_WINDOWACTIVATED|HSHELL_HIGHBIT)
+
+#if(_WIN32_WINNT >= 0x0500)
+/* wparam for HSHELL_ACCESSIBILITYSTATE */
+#define ACCESS_STICKYKEYS 0x0001
+#define ACCESS_FILTERKEYS 0x0002
+#define ACCESS_MOUSEKEYS 0x0003
+
+/* cmd for HSHELL_APPCOMMAND and WM_APPCOMMAND */
+#define APPCOMMAND_BROWSER_BACKWARD 1
+#define APPCOMMAND_BROWSER_FORWARD 2
+#define APPCOMMAND_BROWSER_REFRESH 3
+#define APPCOMMAND_BROWSER_STOP 4
+#define APPCOMMAND_BROWSER_SEARCH 5
+#define APPCOMMAND_BROWSER_FAVORITES 6
+#define APPCOMMAND_BROWSER_HOME 7
+#define APPCOMMAND_VOLUME_MUTE 8
+#define APPCOMMAND_VOLUME_DOWN 9
+#define APPCOMMAND_VOLUME_UP 10
+#define APPCOMMAND_MEDIA_NEXTTRACK 11
+#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
+#define APPCOMMAND_MEDIA_STOP 13
+#define APPCOMMAND_MEDIA_PLAY_PAUSE 14
+#define APPCOMMAND_LAUNCH_MAIL 15
+#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16
+#define APPCOMMAND_LAUNCH_APP1 17
+#define APPCOMMAND_LAUNCH_APP2 18
+#define APPCOMMAND_BASS_DOWN 19
+#define APPCOMMAND_BASS_BOOST 20
+#define APPCOMMAND_BASS_UP 21
+#define APPCOMMAND_TREBLE_DOWN 22
+#define APPCOMMAND_TREBLE_UP 23
+#if(_WIN32_WINNT >= 0x0501)
+#define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24
+#define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25
+#define APPCOMMAND_MICROPHONE_VOLUME_UP 26
+#define APPCOMMAND_HELP 27
+#define APPCOMMAND_FIND 28
+#define APPCOMMAND_NEW 29
+#define APPCOMMAND_OPEN 30
+#define APPCOMMAND_CLOSE 31
+#define APPCOMMAND_SAVE 32
+#define APPCOMMAND_PRINT 33
+#define APPCOMMAND_UNDO 34
+#define APPCOMMAND_REDO 35
+#define APPCOMMAND_COPY 36
+#define APPCOMMAND_CUT 37
+#define APPCOMMAND_PASTE 38
+#define APPCOMMAND_REPLY_TO_MAIL 39
+#define APPCOMMAND_FORWARD_MAIL 40
+#define APPCOMMAND_SEND_MAIL 41
+#define APPCOMMAND_SPELL_CHECK 42
+#define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43
+#define APPCOMMAND_MIC_ON_OFF_TOGGLE 44
+#define APPCOMMAND_CORRECTION_LIST 45
+#define APPCOMMAND_MEDIA_PLAY 46
+#define APPCOMMAND_MEDIA_PAUSE 47
+#define APPCOMMAND_MEDIA_RECORD 48
+#define APPCOMMAND_MEDIA_FAST_FORWARD 49
+#define APPCOMMAND_MEDIA_REWIND 50
+#define APPCOMMAND_MEDIA_CHANNEL_UP 51
+#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define FAPPCOMMAND_MOUSE 0x8000
+#define FAPPCOMMAND_KEY 0
+#define FAPPCOMMAND_OEM 0x1000
+#define FAPPCOMMAND_MASK 0xF000
+
+#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
+#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
+#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM
+#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
+#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+typedef struct
+{
+ HWND hwnd;
+ RECT rc;
+} SHELLHOOKINFO, *LPSHELLHOOKINFO;
+
+/*
+ * Message Structure used in Journaling
+ */
+typedef struct tagEVENTMSG {
+ UINT message;
+ UINT paramL;
+ UINT paramH;
+ DWORD time;
+ HWND hwnd;
+} EVENTMSG, *PEVENTMSGMSG, NEAR *NPEVENTMSGMSG, FAR *LPEVENTMSGMSG;
+
+typedef struct tagEVENTMSG *PEVENTMSG, NEAR *NPEVENTMSG, FAR *LPEVENTMSG;
+
+/*
+ * Message structure used by WH_CALLWNDPROC
+ */
+typedef struct tagCWPSTRUCT {
+ LPARAM lParam;
+ WPARAM wParam;
+ UINT message;
+ HWND hwnd;
+} CWPSTRUCT, *PCWPSTRUCT, NEAR *NPCWPSTRUCT, FAR *LPCWPSTRUCT;
+
+#if(WINVER >= 0x0400)
+/*
+ * Message structure used by WH_CALLWNDPROCRET
+ */
+typedef struct tagCWPRETSTRUCT {
+ LRESULT lResult;
+ LPARAM lParam;
+ WPARAM wParam;
+ UINT message;
+ HWND hwnd;
+} CWPRETSTRUCT, *PCWPRETSTRUCT, NEAR *NPCWPRETSTRUCT, FAR *LPCWPRETSTRUCT;
+
+#endif /* WINVER >= 0x0400 */
+
+#if (_WIN32_WINNT >= 0x0400)
+
+/*
+ * Low level hook flags
+ */
+
+#define LLKHF_EXTENDED (KF_EXTENDED >> 8)
+#define LLKHF_INJECTED 0x00000010
+#define LLKHF_ALTDOWN (KF_ALTDOWN >> 8)
+#define LLKHF_UP (KF_UP >> 8)
+
+#define LLMHF_INJECTED 0x00000001
+
+/*
+ * Structure used by WH_KEYBOARD_LL
+ */
+typedef struct tagKBDLLHOOKSTRUCT {
+ DWORD vkCode;
+ DWORD scanCode;
+ DWORD flags;
+ DWORD time;
+ ULONG_PTR dwExtraInfo;
+} KBDLLHOOKSTRUCT, FAR *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
+
+/*
+ * Structure used by WH_MOUSE_LL
+ */
+typedef struct tagMSLLHOOKSTRUCT {
+ POINT pt;
+ DWORD mouseData;
+ DWORD flags;
+ DWORD time;
+ ULONG_PTR dwExtraInfo;
+} MSLLHOOKSTRUCT, FAR *LPMSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT;
+
+#endif // (_WIN32_WINNT >= 0x0400)
+
+/*
+ * Structure used by WH_DEBUG
+ */
+typedef struct tagDEBUGHOOKINFO
+{
+ DWORD idThread;
+ DWORD idThreadInstaller;
+ LPARAM lParam;
+ WPARAM wParam;
+ int code;
+} DEBUGHOOKINFO, *PDEBUGHOOKINFO, NEAR *NPDEBUGHOOKINFO, FAR* LPDEBUGHOOKINFO;
+
+/*
+ * Structure used by WH_MOUSE
+ */
+typedef struct tagMOUSEHOOKSTRUCT {
+ POINT pt;
+ HWND hwnd;
+ UINT wHitTestCode;
+ ULONG_PTR dwExtraInfo;
+} MOUSEHOOKSTRUCT, FAR *LPMOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT;
+
+#if(_WIN32_WINNT >= 0x0500)
+#ifdef __cplusplus
+typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT
+{
+ DWORD mouseData;
+} MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;
+#else // ndef __cplusplus
+typedef struct tagMOUSEHOOKSTRUCTEX
+{
+ MOUSEHOOKSTRUCT;
+ DWORD mouseData;
+} MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;
+#endif
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+/*
+ * Structure used by WH_HARDWARE
+ */
+typedef struct tagHARDWAREHOOKSTRUCT {
+ HWND hwnd;
+ UINT message;
+ WPARAM wParam;
+ LPARAM lParam;
+} HARDWAREHOOKSTRUCT, FAR *LPHARDWAREHOOKSTRUCT, *PHARDWAREHOOKSTRUCT;
+#endif /* WINVER >= 0x0400 */
+#endif /* !NOWH */
+
+/*
+ * Keyboard Layout API
+ */
+#define HKL_PREV 0
+#define HKL_NEXT 1
+
+
+#define KLF_ACTIVATE 0x00000001
+#define KLF_SUBSTITUTE_OK 0x00000002
+#define KLF_REORDER 0x00000008
+#if(WINVER >= 0x0400)
+#define KLF_REPLACELANG 0x00000010
+#define KLF_NOTELLSHELL 0x00000080
+#endif /* WINVER >= 0x0400 */
+#define KLF_SETFORPROCESS 0x00000100
+#if(_WIN32_WINNT >= 0x0500)
+#define KLF_SHIFTLOCK 0x00010000
+#define KLF_RESET 0x40000000
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+
+#if(WINVER >= 0x0500)
+/*
+ * Bits in wParam of WM_INPUTLANGCHANGEREQUEST message
+ */
+#define INPUTLANGCHANGE_SYSCHARSET 0x0001
+#define INPUTLANGCHANGE_FORWARD 0x0002
+#define INPUTLANGCHANGE_BACKWARD 0x0004
+#endif /* WINVER >= 0x0500 */
+
+/*
+ * Size of KeyboardLayoutName (number of characters), including nul terminator
+ */
+#define KL_NAMELENGTH 9
+
+WINUSERAPI
+HKL
+WINAPI
+LoadKeyboardLayoutA(
+ IN LPCSTR pwszKLID,
+ IN UINT Flags);
+WINUSERAPI
+HKL
+WINAPI
+LoadKeyboardLayoutW(
+ IN LPCWSTR pwszKLID,
+ IN UINT Flags);
+#ifdef UNICODE
+#define LoadKeyboardLayout LoadKeyboardLayoutW
+#else
+#define LoadKeyboardLayout LoadKeyboardLayoutA
+#endif // !UNICODE
+
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+HKL
+WINAPI
+ActivateKeyboardLayout(
+ IN HKL hkl,
+ IN UINT Flags);
+#else
+WINUSERAPI
+BOOL
+WINAPI
+ActivateKeyboardLayout(
+ IN HKL hkl,
+ IN UINT Flags);
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+int
+WINAPI
+ToUnicodeEx(
+ IN UINT wVirtKey,
+ IN UINT wScanCode,
+ IN CONST BYTE *lpKeyState,
+ OUT LPWSTR pwszBuff,
+ IN int cchBuff,
+ IN UINT wFlags,
+ IN HKL dwhkl);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+UnloadKeyboardLayout(
+ IN HKL hkl);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetKeyboardLayoutNameA(
+ OUT LPSTR pwszKLID);
+WINUSERAPI
+BOOL
+WINAPI
+GetKeyboardLayoutNameW(
+ OUT LPWSTR pwszKLID);
+#ifdef UNICODE
+#define GetKeyboardLayoutName GetKeyboardLayoutNameW
+#else
+#define GetKeyboardLayoutName GetKeyboardLayoutNameA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+int
+WINAPI
+GetKeyboardLayoutList(
+ IN int nBuff,
+ OUT HKL FAR *lpList);
+
+WINUSERAPI
+HKL
+WINAPI
+GetKeyboardLayout(
+ IN DWORD idThread
+);
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+
+typedef struct tagMOUSEMOVEPOINT {
+ int x;
+ int y;
+ DWORD time;
+ ULONG_PTR dwExtraInfo;
+} MOUSEMOVEPOINT, *PMOUSEMOVEPOINT, FAR* LPMOUSEMOVEPOINT;
+
+/*
+ * Values for resolution parameter of GetMouseMovePointsEx
+ */
+#define GMMP_USE_DISPLAY_POINTS 1
+#define GMMP_USE_HIGH_RESOLUTION_POINTS 2
+
+WINUSERAPI
+int
+WINAPI
+GetMouseMovePointsEx(
+ IN UINT cbSize,
+ IN LPMOUSEMOVEPOINT lppt,
+ IN LPMOUSEMOVEPOINT lpptBuf,
+ IN int nBufPoints,
+ IN DWORD resolution
+);
+
+#endif /* WINVER >= 0x0500 */
+
+#ifndef NODESKTOP
+/*
+ * Desktop-specific access flags
+ */
+#define DESKTOP_READOBJECTS 0x0001L
+#define DESKTOP_CREATEWINDOW 0x0002L
+#define DESKTOP_CREATEMENU 0x0004L
+#define DESKTOP_HOOKCONTROL 0x0008L
+#define DESKTOP_JOURNALRECORD 0x0010L
+#define DESKTOP_JOURNALPLAYBACK 0x0020L
+#define DESKTOP_ENUMERATE 0x0040L
+#define DESKTOP_WRITEOBJECTS 0x0080L
+#define DESKTOP_SWITCHDESKTOP 0x0100L
+
+/*
+ * Desktop-specific control flags
+ */
+#define DF_ALLOWOTHERACCOUNTHOOK 0x0001L
+
+#ifdef _WINGDI_
+#ifndef NOGDI
+
+WINUSERAPI
+HDESK
+WINAPI
+CreateDesktopA(
+ IN LPCSTR lpszDesktop,
+ IN LPCSTR lpszDevice,
+ IN LPDEVMODEA pDevmode,
+ IN DWORD dwFlags,
+ IN ACCESS_MASK dwDesiredAccess,
+ IN LPSECURITY_ATTRIBUTES lpsa);
+WINUSERAPI
+HDESK
+WINAPI
+CreateDesktopW(
+ IN LPCWSTR lpszDesktop,
+ IN LPCWSTR lpszDevice,
+ IN LPDEVMODEW pDevmode,
+ IN DWORD dwFlags,
+ IN ACCESS_MASK dwDesiredAccess,
+ IN LPSECURITY_ATTRIBUTES lpsa);
+#ifdef UNICODE
+#define CreateDesktop CreateDesktopW
+#else
+#define CreateDesktop CreateDesktopA
+#endif // !UNICODE
+
+#endif /* NOGDI */
+#endif /* _WINGDI_ */
+
+WINUSERAPI
+HDESK
+WINAPI
+OpenDesktopA(
+ IN LPCSTR lpszDesktop,
+ IN DWORD dwFlags,
+ IN BOOL fInherit,
+ IN ACCESS_MASK dwDesiredAccess);
+WINUSERAPI
+HDESK
+WINAPI
+OpenDesktopW(
+ IN LPCWSTR lpszDesktop,
+ IN DWORD dwFlags,
+ IN BOOL fInherit,
+ IN ACCESS_MASK dwDesiredAccess);
+#ifdef UNICODE
+#define OpenDesktop OpenDesktopW
+#else
+#define OpenDesktop OpenDesktopA
+#endif // !UNICODE
+
+WINUSERAPI
+HDESK
+WINAPI
+OpenInputDesktop(
+ IN DWORD dwFlags,
+ IN BOOL fInherit,
+ IN ACCESS_MASK dwDesiredAccess);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDesktopsA(
+ IN HWINSTA hwinsta,
+ IN DESKTOPENUMPROCA lpEnumFunc,
+ IN LPARAM lParam);
+WINUSERAPI
+BOOL
+WINAPI
+EnumDesktopsW(
+ IN HWINSTA hwinsta,
+ IN DESKTOPENUMPROCW lpEnumFunc,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define EnumDesktops EnumDesktopsW
+#else
+#define EnumDesktops EnumDesktopsA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDesktopWindows(
+ IN HDESK hDesktop,
+ IN WNDENUMPROC lpfn,
+ IN LPARAM lParam);
+
+WINUSERAPI
+BOOL
+WINAPI
+SwitchDesktop(
+ IN HDESK hDesktop);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetThreadDesktop(
+ IN HDESK hDesktop);
+
+WINUSERAPI
+BOOL
+WINAPI
+CloseDesktop(
+ IN HDESK hDesktop);
+
+WINUSERAPI
+HDESK
+WINAPI
+GetThreadDesktop(
+ IN DWORD dwThreadId);
+#endif /* !NODESKTOP */
+
+#ifndef NOWINDOWSTATION
+/*
+ * Windowstation-specific access flags
+ */
+#define WINSTA_ENUMDESKTOPS 0x0001L
+#define WINSTA_READATTRIBUTES 0x0002L
+#define WINSTA_ACCESSCLIPBOARD 0x0004L
+#define WINSTA_CREATEDESKTOP 0x0008L
+#define WINSTA_WRITEATTRIBUTES 0x0010L
+#define WINSTA_ACCESSGLOBALATOMS 0x0020L
+#define WINSTA_EXITWINDOWS 0x0040L
+#define WINSTA_ENUMERATE 0x0100L
+#define WINSTA_READSCREEN 0x0200L
+
+#define WINSTA_ALL_ACCESS (WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | WINSTA_ACCESSCLIPBOARD | \
+ WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES | WINSTA_ACCESSGLOBALATOMS | \
+ WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN)
+
+/*
+ * Windowstation-specific attribute flags
+ */
+#define WSF_VISIBLE 0x0001L
+
+WINUSERAPI
+HWINSTA
+WINAPI
+CreateWindowStationA(
+ IN LPCSTR lpwinsta,
+ IN DWORD dwReserved,
+ IN ACCESS_MASK dwDesiredAccess,
+ IN LPSECURITY_ATTRIBUTES lpsa);
+WINUSERAPI
+HWINSTA
+WINAPI
+CreateWindowStationW(
+ IN LPCWSTR lpwinsta,
+ IN DWORD dwReserved,
+ IN ACCESS_MASK dwDesiredAccess,
+ IN LPSECURITY_ATTRIBUTES lpsa);
+#ifdef UNICODE
+#define CreateWindowStation CreateWindowStationW
+#else
+#define CreateWindowStation CreateWindowStationA
+#endif // !UNICODE
+
+WINUSERAPI
+HWINSTA
+WINAPI
+OpenWindowStationA(
+ IN LPCSTR lpszWinSta,
+ IN BOOL fInherit,
+ IN ACCESS_MASK dwDesiredAccess);
+WINUSERAPI
+HWINSTA
+WINAPI
+OpenWindowStationW(
+ IN LPCWSTR lpszWinSta,
+ IN BOOL fInherit,
+ IN ACCESS_MASK dwDesiredAccess);
+#ifdef UNICODE
+#define OpenWindowStation OpenWindowStationW
+#else
+#define OpenWindowStation OpenWindowStationA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumWindowStationsA(
+ IN WINSTAENUMPROCA lpEnumFunc,
+ IN LPARAM lParam);
+WINUSERAPI
+BOOL
+WINAPI
+EnumWindowStationsW(
+ IN WINSTAENUMPROCW lpEnumFunc,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define EnumWindowStations EnumWindowStationsW
+#else
+#define EnumWindowStations EnumWindowStationsA
+#endif // !UNICODE
+
+
+WINUSERAPI
+BOOL
+WINAPI
+CloseWindowStation(
+ IN HWINSTA hWinSta);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetProcessWindowStation(
+ IN HWINSTA hWinSta);
+
+WINUSERAPI
+HWINSTA
+WINAPI
+GetProcessWindowStation(
+ VOID);
+#endif /* !NOWINDOWSTATION */
+
+#ifndef NOSECURITY
+
+WINUSERAPI
+BOOL
+WINAPI
+SetUserObjectSecurity(
+ IN HANDLE hObj,
+ IN PSECURITY_INFORMATION pSIRequested,
+ IN PSECURITY_DESCRIPTOR pSID);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetUserObjectSecurity(
+ IN HANDLE hObj,
+ IN PSECURITY_INFORMATION pSIRequested,
+ IN OUT PSECURITY_DESCRIPTOR pSID,
+ IN DWORD nLength,
+ OUT LPDWORD lpnLengthNeeded);
+
+#define UOI_FLAGS 1
+#define UOI_NAME 2
+#define UOI_TYPE 3
+#define UOI_USER_SID 4
+
+typedef struct tagUSEROBJECTFLAGS {
+ BOOL fInherit;
+ BOOL fReserved;
+ DWORD dwFlags;
+} USEROBJECTFLAGS, *PUSEROBJECTFLAGS;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetUserObjectInformationA(
+ IN HANDLE hObj,
+ IN int nIndex,
+ OUT PVOID pvInfo,
+ IN DWORD nLength,
+ OUT LPDWORD lpnLengthNeeded);
+WINUSERAPI
+BOOL
+WINAPI
+GetUserObjectInformationW(
+ IN HANDLE hObj,
+ IN int nIndex,
+ OUT PVOID pvInfo,
+ IN DWORD nLength,
+ OUT LPDWORD lpnLengthNeeded);
+#ifdef UNICODE
+#define GetUserObjectInformation GetUserObjectInformationW
+#else
+#define GetUserObjectInformation GetUserObjectInformationA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SetUserObjectInformationA(
+ IN HANDLE hObj,
+ IN int nIndex,
+ IN PVOID pvInfo,
+ IN DWORD nLength);
+WINUSERAPI
+BOOL
+WINAPI
+SetUserObjectInformationW(
+ IN HANDLE hObj,
+ IN int nIndex,
+ IN PVOID pvInfo,
+ IN DWORD nLength);
+#ifdef UNICODE
+#define SetUserObjectInformation SetUserObjectInformationW
+#else
+#define SetUserObjectInformation SetUserObjectInformationA
+#endif // !UNICODE
+
+#endif /* !NOSECURITY */
+
+#if(WINVER >= 0x0400)
+typedef struct tagWNDCLASSEXA {
+ UINT cbSize;
+ /* Win 3.x */
+ UINT style;
+ WNDPROC lpfnWndProc;
+ int cbClsExtra;
+ int cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+ /* Win 4.0 */
+ HICON hIconSm;
+} WNDCLASSEXA, *PWNDCLASSEXA, NEAR *NPWNDCLASSEXA, FAR *LPWNDCLASSEXA;
+typedef struct tagWNDCLASSEXW {
+ UINT cbSize;
+ /* Win 3.x */
+ UINT style;
+ WNDPROC lpfnWndProc;
+ int cbClsExtra;
+ int cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCWSTR lpszMenuName;
+ LPCWSTR lpszClassName;
+ /* Win 4.0 */
+ HICON hIconSm;
+} WNDCLASSEXW, *PWNDCLASSEXW, NEAR *NPWNDCLASSEXW, FAR *LPWNDCLASSEXW;
+#ifdef UNICODE
+typedef WNDCLASSEXW WNDCLASSEX;
+typedef PWNDCLASSEXW PWNDCLASSEX;
+typedef NPWNDCLASSEXW NPWNDCLASSEX;
+typedef LPWNDCLASSEXW LPWNDCLASSEX;
+#else
+typedef WNDCLASSEXA WNDCLASSEX;
+typedef PWNDCLASSEXA PWNDCLASSEX;
+typedef NPWNDCLASSEXA NPWNDCLASSEX;
+typedef LPWNDCLASSEXA LPWNDCLASSEX;
+#endif // UNICODE
+#endif /* WINVER >= 0x0400 */
+
+typedef struct tagWNDCLASSA {
+ UINT style;
+ WNDPROC lpfnWndProc;
+ int cbClsExtra;
+ int cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+} WNDCLASSA, *PWNDCLASSA, NEAR *NPWNDCLASSA, FAR *LPWNDCLASSA;
+typedef struct tagWNDCLASSW {
+ UINT style;
+ WNDPROC lpfnWndProc;
+ int cbClsExtra;
+ int cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCWSTR lpszMenuName;
+ LPCWSTR lpszClassName;
+} WNDCLASSW, *PWNDCLASSW, NEAR *NPWNDCLASSW, FAR *LPWNDCLASSW;
+#ifdef UNICODE
+typedef WNDCLASSW WNDCLASS;
+typedef PWNDCLASSW PWNDCLASS;
+typedef NPWNDCLASSW NPWNDCLASS;
+typedef LPWNDCLASSW LPWNDCLASS;
+#else
+typedef WNDCLASSA WNDCLASS;
+typedef PWNDCLASSA PWNDCLASS;
+typedef NPWNDCLASSA NPWNDCLASS;
+typedef LPWNDCLASSA LPWNDCLASS;
+#endif // UNICODE
+
+WINUSERAPI
+BOOL
+IsHungAppWindow(
+ IN HWND hwnd);
+
+
+#if(WINVER >= 0x0501)
+WINUSERAPI
+VOID
+DisableProcessWindowsGhosting(
+ VOID);
+#endif /* WINVER >= 0x0501 */
+
+#ifndef NOMSG
+
+/*
+ * Message structure
+ */
+typedef struct tagMSG {
+ HWND hwnd;
+ UINT message;
+ WPARAM wParam;
+ LPARAM lParam;
+ DWORD time;
+ POINT pt;
+#ifdef _MAC
+ DWORD lPrivate;
+#endif
+} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;
+
+#define POINTSTOPOINT(pt, pts) \
+ { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); \
+ (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); }
+
+#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x), (short)((pt).y)))
+#define MAKEWPARAM(l, h) ((WPARAM)(DWORD)MAKELONG(l, h))
+#define MAKELPARAM(l, h) ((LPARAM)(DWORD)MAKELONG(l, h))
+#define MAKELRESULT(l, h) ((LRESULT)(DWORD)MAKELONG(l, h))
+
+
+#endif /* !NOMSG */
+
+#ifndef NOWINOFFSETS
+
+/*
+ * Window field offsets for GetWindowLong()
+ */
+#define GWL_WNDPROC (-4)
+#define GWL_HINSTANCE (-6)
+#define GWL_HWNDPARENT (-8)
+#define GWL_STYLE (-16)
+#define GWL_EXSTYLE (-20)
+#define GWL_USERDATA (-21)
+#define GWL_ID (-12)
+
+#ifdef _WIN64
+
+#undef GWL_WNDPROC
+#undef GWL_HINSTANCE
+#undef GWL_HWNDPARENT
+#undef GWL_USERDATA
+
+#endif /* _WIN64 */
+
+#define GWLP_WNDPROC (-4)
+#define GWLP_HINSTANCE (-6)
+#define GWLP_HWNDPARENT (-8)
+#define GWLP_USERDATA (-21)
+#define GWLP_ID (-12)
+
+/*
+ * Class field offsets for GetClassLong()
+ */
+#define GCL_MENUNAME (-8)
+#define GCL_HBRBACKGROUND (-10)
+#define GCL_HCURSOR (-12)
+#define GCL_HICON (-14)
+#define GCL_HMODULE (-16)
+#define GCL_CBWNDEXTRA (-18)
+#define GCL_CBCLSEXTRA (-20)
+#define GCL_WNDPROC (-24)
+#define GCL_STYLE (-26)
+#define GCW_ATOM (-32)
+
+#if(WINVER >= 0x0400)
+#define GCL_HICONSM (-34)
+#endif /* WINVER >= 0x0400 */
+
+#ifdef _WIN64
+
+#undef GCL_MENUNAME
+#undef GCL_HBRBACKGROUND
+#undef GCL_HCURSOR
+#undef GCL_HICON
+#undef GCL_HMODULE
+#undef GCL_WNDPROC
+#undef GCL_HICONSM
+
+#endif /* _WIN64 */
+
+#define GCLP_MENUNAME (-8)
+#define GCLP_HBRBACKGROUND (-10)
+#define GCLP_HCURSOR (-12)
+#define GCLP_HICON (-14)
+#define GCLP_HMODULE (-16)
+#define GCLP_WNDPROC (-24)
+#define GCLP_HICONSM (-34)
+
+#endif /* !NOWINOFFSETS */
+
+#ifndef NOWINMESSAGES
+
+
+/*
+ * Window Messages
+ */
+
+#define WM_NULL 0x0000
+#define WM_CREATE 0x0001
+#define WM_DESTROY 0x0002
+#define WM_MOVE 0x0003
+#define WM_SIZE 0x0005
+
+#define WM_ACTIVATE 0x0006
+/*
+ * WM_ACTIVATE state values
+ */
+#define WA_INACTIVE 0
+#define WA_ACTIVE 1
+#define WA_CLICKACTIVE 2
+
+#define WM_SETFOCUS 0x0007
+#define WM_KILLFOCUS 0x0008
+#define WM_ENABLE 0x000A
+#define WM_SETREDRAW 0x000B
+#define WM_SETTEXT 0x000C
+#define WM_GETTEXT 0x000D
+#define WM_GETTEXTLENGTH 0x000E
+#define WM_PAINT 0x000F
+#define WM_CLOSE 0x0010
+#ifndef _WIN32_WCE
+#define WM_QUERYENDSESSION 0x0011
+#define WM_QUERYOPEN 0x0013
+#define WM_ENDSESSION 0x0016
+#endif
+#define WM_QUIT 0x0012
+#define WM_ERASEBKGND 0x0014
+#define WM_SYSCOLORCHANGE 0x0015
+#define WM_SHOWWINDOW 0x0018
+#define WM_WININICHANGE 0x001A
+#if(WINVER >= 0x0400)
+#define WM_SETTINGCHANGE WM_WININICHANGE
+#endif /* WINVER >= 0x0400 */
+
+
+#define WM_DEVMODECHANGE 0x001B
+#define WM_ACTIVATEAPP 0x001C
+#define WM_FONTCHANGE 0x001D
+#define WM_TIMECHANGE 0x001E
+#define WM_CANCELMODE 0x001F
+#define WM_SETCURSOR 0x0020
+#define WM_MOUSEACTIVATE 0x0021
+#define WM_CHILDACTIVATE 0x0022
+#define WM_QUEUESYNC 0x0023
+
+#define WM_GETMINMAXINFO 0x0024
+/*
+ * Struct pointed to by WM_GETMINMAXINFO lParam
+ */
+typedef struct tagMINMAXINFO {
+ POINT ptReserved;
+ POINT ptMaxSize;
+ POINT ptMaxPosition;
+ POINT ptMinTrackSize;
+ POINT ptMaxTrackSize;
+} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO;
+
+#define WM_PAINTICON 0x0026
+#define WM_ICONERASEBKGND 0x0027
+#define WM_NEXTDLGCTL 0x0028
+#define WM_SPOOLERSTATUS 0x002A
+#define WM_DRAWITEM 0x002B
+#define WM_MEASUREITEM 0x002C
+#define WM_DELETEITEM 0x002D
+#define WM_VKEYTOITEM 0x002E
+#define WM_CHARTOITEM 0x002F
+#define WM_SETFONT 0x0030
+#define WM_GETFONT 0x0031
+#define WM_SETHOTKEY 0x0032
+#define WM_GETHOTKEY 0x0033
+#define WM_QUERYDRAGICON 0x0037
+#define WM_COMPAREITEM 0x0039
+#if(WINVER >= 0x0500)
+#ifndef _WIN32_WCE
+#define WM_GETOBJECT 0x003D
+#endif
+#endif /* WINVER >= 0x0500 */
+#define WM_COMPACTING 0x0041
+#define WM_COMMNOTIFY 0x0044 /* no longer suported */
+#define WM_WINDOWPOSCHANGING 0x0046
+#define WM_WINDOWPOSCHANGED 0x0047
+
+#define WM_POWER 0x0048
+/*
+ * wParam for WM_POWER window message and DRV_POWER driver notification
+ */
+#define PWR_OK 1
+#define PWR_FAIL (-1)
+#define PWR_SUSPENDREQUEST 1
+#define PWR_SUSPENDRESUME 2
+#define PWR_CRITICALRESUME 3
+
+#define WM_COPYDATA 0x004A
+#define WM_CANCELJOURNAL 0x004B
+
+
+/*
+ * lParam of WM_COPYDATA message points to...
+ */
+typedef struct tagCOPYDATASTRUCT {
+ ULONG_PTR dwData;
+ DWORD cbData;
+ PVOID lpData;
+} COPYDATASTRUCT, *PCOPYDATASTRUCT;
+
+#if(WINVER >= 0x0400)
+typedef struct tagMDINEXTMENU
+{
+ HMENU hmenuIn;
+ HMENU hmenuNext;
+ HWND hwndNext;
+} MDINEXTMENU, * PMDINEXTMENU, FAR * LPMDINEXTMENU;
+#endif /* WINVER >= 0x0400 */
+
+
+#if(WINVER >= 0x0400)
+#define WM_NOTIFY 0x004E
+#define WM_INPUTLANGCHANGEREQUEST 0x0050
+#define WM_INPUTLANGCHANGE 0x0051
+#define WM_TCARD 0x0052
+#define WM_HELP 0x0053
+#define WM_USERCHANGED 0x0054
+#define WM_NOTIFYFORMAT 0x0055
+
+#define NFR_ANSI 1
+#define NFR_UNICODE 2
+#define NF_QUERY 3
+#define NF_REQUERY 4
+
+#define WM_CONTEXTMENU 0x007B
+#define WM_STYLECHANGING 0x007C
+#define WM_STYLECHANGED 0x007D
+#define WM_DISPLAYCHANGE 0x007E
+#define WM_GETICON 0x007F
+#define WM_SETICON 0x0080
+#endif /* WINVER >= 0x0400 */
+
+#define WM_NCCREATE 0x0081
+#define WM_NCDESTROY 0x0082
+#define WM_NCCALCSIZE 0x0083
+#define WM_NCHITTEST 0x0084
+#define WM_NCPAINT 0x0085
+#define WM_NCACTIVATE 0x0086
+#define WM_GETDLGCODE 0x0087
+#ifndef _WIN32_WCE
+#define WM_SYNCPAINT 0x0088
+#endif
+#define WM_NCMOUSEMOVE 0x00A0
+#define WM_NCLBUTTONDOWN 0x00A1
+#define WM_NCLBUTTONUP 0x00A2
+#define WM_NCLBUTTONDBLCLK 0x00A3
+#define WM_NCRBUTTONDOWN 0x00A4
+#define WM_NCRBUTTONUP 0x00A5
+#define WM_NCRBUTTONDBLCLK 0x00A6
+#define WM_NCMBUTTONDOWN 0x00A7
+#define WM_NCMBUTTONUP 0x00A8
+#define WM_NCMBUTTONDBLCLK 0x00A9
+
+
+
+#if(_WIN32_WINNT >= 0x0500)
+#define WM_NCXBUTTONDOWN 0x00AB
+#define WM_NCXBUTTONUP 0x00AC
+#define WM_NCXBUTTONDBLCLK 0x00AD
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+
+#if(_WIN32_WINNT >= 0x0501)
+#define WM_INPUT 0x00FF
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define WM_KEYFIRST 0x0100
+#define WM_KEYDOWN 0x0100
+#define WM_KEYUP 0x0101
+#define WM_CHAR 0x0102
+#define WM_DEADCHAR 0x0103
+#define WM_SYSKEYDOWN 0x0104
+#define WM_SYSKEYUP 0x0105
+#define WM_SYSCHAR 0x0106
+#define WM_SYSDEADCHAR 0x0107
+#if(_WIN32_WINNT >= 0x0501)
+#define WM_UNICHAR 0x0109
+#define WM_KEYLAST 0x0109
+#define UNICODE_NOCHAR 0xFFFF
+#else
+#define WM_KEYLAST 0x0108
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(WINVER >= 0x0400)
+#define WM_IME_STARTCOMPOSITION 0x010D
+#define WM_IME_ENDCOMPOSITION 0x010E
+#define WM_IME_COMPOSITION 0x010F
+#define WM_IME_KEYLAST 0x010F
+#endif /* WINVER >= 0x0400 */
+
+#define WM_INITDIALOG 0x0110
+#define WM_COMMAND 0x0111
+#define WM_SYSCOMMAND 0x0112
+#define WM_TIMER 0x0113
+#define WM_HSCROLL 0x0114
+#define WM_VSCROLL 0x0115
+#define WM_INITMENU 0x0116
+#define WM_INITMENUPOPUP 0x0117
+#define WM_MENUSELECT 0x011F
+#define WM_MENUCHAR 0x0120
+#define WM_ENTERIDLE 0x0121
+#if(WINVER >= 0x0500)
+#ifndef _WIN32_WCE
+#define WM_MENURBUTTONUP 0x0122
+#define WM_MENUDRAG 0x0123
+#define WM_MENUGETOBJECT 0x0124
+#define WM_UNINITMENUPOPUP 0x0125
+#define WM_MENUCOMMAND 0x0126
+
+#ifndef _WIN32_WCE
+#if(_WIN32_WINNT >= 0x0500)
+#define WM_CHANGEUISTATE 0x0127
+#define WM_UPDATEUISTATE 0x0128
+#define WM_QUERYUISTATE 0x0129
+
+/*
+ * LOWORD(wParam) values in WM_*UISTATE*
+ */
+#define UIS_SET 1
+#define UIS_CLEAR 2
+#define UIS_INITIALIZE 3
+
+/*
+ * HIWORD(wParam) values in WM_*UISTATE*
+ */
+#define UISF_HIDEFOCUS 0x1
+#define UISF_HIDEACCEL 0x2
+#if(_WIN32_WINNT >= 0x0501)
+#define UISF_ACTIVE 0x4
+#endif /* _WIN32_WINNT >= 0x0501 */
+#endif /* _WIN32_WINNT >= 0x0500 */
+#endif
+
+#endif
+#endif /* WINVER >= 0x0500 */
+
+#define WM_CTLCOLORMSGBOX 0x0132
+#define WM_CTLCOLOREDIT 0x0133
+#define WM_CTLCOLORLISTBOX 0x0134
+#define WM_CTLCOLORBTN 0x0135
+#define WM_CTLCOLORDLG 0x0136
+#define WM_CTLCOLORSCROLLBAR 0x0137
+#define WM_CTLCOLORSTATIC 0x0138
+#define MN_GETHMENU 0x01E1
+
+#define WM_MOUSEFIRST 0x0200
+#define WM_MOUSEMOVE 0x0200
+#define WM_LBUTTONDOWN 0x0201
+#define WM_LBUTTONUP 0x0202
+#define WM_LBUTTONDBLCLK 0x0203
+#define WM_RBUTTONDOWN 0x0204
+#define WM_RBUTTONUP 0x0205
+#define WM_RBUTTONDBLCLK 0x0206
+#define WM_MBUTTONDOWN 0x0207
+#define WM_MBUTTONUP 0x0208
+#define WM_MBUTTONDBLCLK 0x0209
+#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
+#define WM_MOUSEWHEEL 0x020A
+#endif
+#if (_WIN32_WINNT >= 0x0500)
+#define WM_XBUTTONDOWN 0x020B
+#define WM_XBUTTONUP 0x020C
+#define WM_XBUTTONDBLCLK 0x020D
+#endif
+#if (_WIN32_WINNT >= 0x0500)
+#define WM_MOUSELAST 0x020D
+#elif (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
+#define WM_MOUSELAST 0x020A
+#else
+#define WM_MOUSELAST 0x0209
+#endif /* (_WIN32_WINNT >= 0x0500) */
+
+
+#if(_WIN32_WINNT >= 0x0400)
+/* Value for rolling one detent */
+#define WHEEL_DELTA 120
+#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
+
+/* Setting to scroll one page for SPI_GET/SETWHEELSCROLLLINES */
+#define WHEEL_PAGESCROLL (UINT_MAX)
+#endif /* _WIN32_WINNT >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0500)
+#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam))
+#define GET_NCHITTEST_WPARAM(wParam) ((short)LOWORD(wParam))
+#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
+
+/* XButton values are WORD flags */
+#define XBUTTON1 0x0001
+#define XBUTTON2 0x0002
+/* Were there to be an XBUTTON3, its value would be 0x0004 */
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#define WM_PARENTNOTIFY 0x0210
+#define WM_ENTERMENULOOP 0x0211
+#define WM_EXITMENULOOP 0x0212
+
+#if(WINVER >= 0x0400)
+#define WM_NEXTMENU 0x0213
+#define WM_SIZING 0x0214
+#define WM_CAPTURECHANGED 0x0215
+#define WM_MOVING 0x0216
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0400)
+
+
+#define WM_POWERBROADCAST 0x0218
+
+#ifndef _WIN32_WCE
+#define PBT_APMQUERYSUSPEND 0x0000
+#define PBT_APMQUERYSTANDBY 0x0001
+
+#define PBT_APMQUERYSUSPENDFAILED 0x0002
+#define PBT_APMQUERYSTANDBYFAILED 0x0003
+
+#define PBT_APMSUSPEND 0x0004
+#define PBT_APMSTANDBY 0x0005
+
+#define PBT_APMRESUMECRITICAL 0x0006
+#define PBT_APMRESUMESUSPEND 0x0007
+#define PBT_APMRESUMESTANDBY 0x0008
+
+#define PBTF_APMRESUMEFROMFAILURE 0x00000001
+
+#define PBT_APMBATTERYLOW 0x0009
+#define PBT_APMPOWERSTATUSCHANGE 0x000A
+
+#define PBT_APMOEMEVENT 0x000B
+#define PBT_APMRESUMEAUTOMATIC 0x0012
+#endif
+
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0400)
+#define WM_DEVICECHANGE 0x0219
+#endif /* WINVER >= 0x0400 */
+
+#define WM_MDICREATE 0x0220
+#define WM_MDIDESTROY 0x0221
+#define WM_MDIACTIVATE 0x0222
+#define WM_MDIRESTORE 0x0223
+#define WM_MDINEXT 0x0224
+#define WM_MDIMAXIMIZE 0x0225
+#define WM_MDITILE 0x0226
+#define WM_MDICASCADE 0x0227
+#define WM_MDIICONARRANGE 0x0228
+#define WM_MDIGETACTIVE 0x0229
+
+
+#define WM_MDISETMENU 0x0230
+#define WM_ENTERSIZEMOVE 0x0231
+#define WM_EXITSIZEMOVE 0x0232
+#define WM_DROPFILES 0x0233
+#define WM_MDIREFRESHMENU 0x0234
+
+
+#if(WINVER >= 0x0400)
+#define WM_IME_SETCONTEXT 0x0281
+#define WM_IME_NOTIFY 0x0282
+#define WM_IME_CONTROL 0x0283
+#define WM_IME_COMPOSITIONFULL 0x0284
+#define WM_IME_SELECT 0x0285
+#define WM_IME_CHAR 0x0286
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0500)
+#define WM_IME_REQUEST 0x0288
+#endif /* WINVER >= 0x0500 */
+#if(WINVER >= 0x0400)
+#define WM_IME_KEYDOWN 0x0290
+#define WM_IME_KEYUP 0x0291
+#endif /* WINVER >= 0x0400 */
+
+#if((_WIN32_WINNT >= 0x0400) || (WINVER >= 0x0500))
+#define WM_MOUSEHOVER 0x02A1
+#define WM_MOUSELEAVE 0x02A3
+#endif
+#if(WINVER >= 0x0500)
+#define WM_NCMOUSEHOVER 0x02A0
+#define WM_NCMOUSELEAVE 0x02A2
+#endif /* WINVER >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define WM_WTSSESSION_CHANGE 0x02B1
+
+#define WM_TABLET_FIRST 0x02c0
+#define WM_TABLET_LAST 0x02df
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define WM_CUT 0x0300
+#define WM_COPY 0x0301
+#define WM_PASTE 0x0302
+#define WM_CLEAR 0x0303
+#define WM_UNDO 0x0304
+#define WM_RENDERFORMAT 0x0305
+#define WM_RENDERALLFORMATS 0x0306
+#define WM_DESTROYCLIPBOARD 0x0307
+#define WM_DRAWCLIPBOARD 0x0308
+#define WM_PAINTCLIPBOARD 0x0309
+#define WM_VSCROLLCLIPBOARD 0x030A
+#define WM_SIZECLIPBOARD 0x030B
+#define WM_ASKCBFORMATNAME 0x030C
+#define WM_CHANGECBCHAIN 0x030D
+#define WM_HSCROLLCLIPBOARD 0x030E
+#define WM_QUERYNEWPALETTE 0x030F
+#define WM_PALETTEISCHANGING 0x0310
+#define WM_PALETTECHANGED 0x0311
+#define WM_HOTKEY 0x0312
+
+#if(WINVER >= 0x0400)
+#define WM_PRINT 0x0317
+#define WM_PRINTCLIENT 0x0318
+#endif /* WINVER >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0500)
+#define WM_APPCOMMAND 0x0319
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define WM_THEMECHANGED 0x031A
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+
+#if(WINVER >= 0x0400)
+
+#define WM_HANDHELDFIRST 0x0358
+#define WM_HANDHELDLAST 0x035F
+
+#define WM_AFXFIRST 0x0360
+#define WM_AFXLAST 0x037F
+#endif /* WINVER >= 0x0400 */
+
+#define WM_PENWINFIRST 0x0380
+#define WM_PENWINLAST 0x038F
+
+
+#if(WINVER >= 0x0400)
+#define WM_APP 0x8000
+#endif /* WINVER >= 0x0400 */
+
+
+/*
+ * NOTE: All Message Numbers below 0x0400 are RESERVED.
+ *
+ * Private Window Messages Start Here:
+ */
+#define WM_USER 0x0400
+
+#if(WINVER >= 0x0400)
+
+/* wParam for WM_SIZING message */
+#define WMSZ_LEFT 1
+#define WMSZ_RIGHT 2
+#define WMSZ_TOP 3
+#define WMSZ_TOPLEFT 4
+#define WMSZ_TOPRIGHT 5
+#define WMSZ_BOTTOM 6
+#define WMSZ_BOTTOMLEFT 7
+#define WMSZ_BOTTOMRIGHT 8
+#endif /* WINVER >= 0x0400 */
+
+#ifndef NONCMESSAGES
+
+/*
+ * WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes
+ */
+#define HTERROR (-2)
+#define HTTRANSPARENT (-1)
+#define HTNOWHERE 0
+#define HTCLIENT 1
+#define HTCAPTION 2
+#define HTSYSMENU 3
+#define HTGROWBOX 4
+#define HTSIZE HTGROWBOX
+#define HTMENU 5
+#define HTHSCROLL 6
+#define HTVSCROLL 7
+#define HTMINBUTTON 8
+#define HTMAXBUTTON 9
+#define HTLEFT 10
+#define HTRIGHT 11
+#define HTTOP 12
+#define HTTOPLEFT 13
+#define HTTOPRIGHT 14
+#define HTBOTTOM 15
+#define HTBOTTOMLEFT 16
+#define HTBOTTOMRIGHT 17
+#define HTBORDER 18
+#define HTREDUCE HTMINBUTTON
+#define HTZOOM HTMAXBUTTON
+#define HTSIZEFIRST HTLEFT
+#define HTSIZELAST HTBOTTOMRIGHT
+#if(WINVER >= 0x0400)
+#define HTOBJECT 19
+#define HTCLOSE 20
+#define HTHELP 21
+#endif /* WINVER >= 0x0400 */
+
+
+/*
+ * SendMessageTimeout values
+ */
+#define SMTO_NORMAL 0x0000
+#define SMTO_BLOCK 0x0001
+#define SMTO_ABORTIFHUNG 0x0002
+#if(WINVER >= 0x0500)
+#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008
+#endif /* WINVER >= 0x0500 */
+#endif /* !NONCMESSAGES */
+
+/*
+ * WM_MOUSEACTIVATE Return Codes
+ */
+#define MA_ACTIVATE 1
+#define MA_ACTIVATEANDEAT 2
+#define MA_NOACTIVATE 3
+#define MA_NOACTIVATEANDEAT 4
+
+/*
+ * WM_SETICON / WM_GETICON Type Codes
+ */
+#define ICON_SMALL 0
+#define ICON_BIG 1
+#if(_WIN32_WINNT >= 0x0501)
+#define ICON_SMALL2 2
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+
+WINUSERAPI
+UINT
+WINAPI
+RegisterWindowMessageA(
+ IN LPCSTR lpString);
+WINUSERAPI
+UINT
+WINAPI
+RegisterWindowMessageW(
+ IN LPCWSTR lpString);
+#ifdef UNICODE
+#define RegisterWindowMessage RegisterWindowMessageW
+#else
+#define RegisterWindowMessage RegisterWindowMessageA
+#endif // !UNICODE
+
+
+/*
+ * WM_SIZE message wParam values
+ */
+#define SIZE_RESTORED 0
+#define SIZE_MINIMIZED 1
+#define SIZE_MAXIMIZED 2
+#define SIZE_MAXSHOW 3
+#define SIZE_MAXHIDE 4
+
+/*
+ * Obsolete constant names
+ */
+#define SIZENORMAL SIZE_RESTORED
+#define SIZEICONIC SIZE_MINIMIZED
+#define SIZEFULLSCREEN SIZE_MAXIMIZED
+#define SIZEZOOMSHOW SIZE_MAXSHOW
+#define SIZEZOOMHIDE SIZE_MAXHIDE
+
+/*
+ * WM_WINDOWPOSCHANGING/CHANGED struct pointed to by lParam
+ */
+typedef struct tagWINDOWPOS {
+ HWND hwnd;
+ HWND hwndInsertAfter;
+ int x;
+ int y;
+ int cx;
+ int cy;
+ UINT flags;
+} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS;
+
+/*
+ * WM_NCCALCSIZE parameter structure
+ */
+typedef struct tagNCCALCSIZE_PARAMS {
+ RECT rgrc[3];
+ PWINDOWPOS lppos;
+} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
+
+/*
+ * WM_NCCALCSIZE "window valid rect" return values
+ */
+#define WVR_ALIGNTOP 0x0010
+#define WVR_ALIGNLEFT 0x0020
+#define WVR_ALIGNBOTTOM 0x0040
+#define WVR_ALIGNRIGHT 0x0080
+#define WVR_HREDRAW 0x0100
+#define WVR_VREDRAW 0x0200
+#define WVR_REDRAW (WVR_HREDRAW | \
+ WVR_VREDRAW)
+#define WVR_VALIDRECTS 0x0400
+
+
+#ifndef NOKEYSTATES
+
+/*
+ * Key State Masks for Mouse Messages
+ */
+#define MK_LBUTTON 0x0001
+#define MK_RBUTTON 0x0002
+#define MK_SHIFT 0x0004
+#define MK_CONTROL 0x0008
+#define MK_MBUTTON 0x0010
+#if(_WIN32_WINNT >= 0x0500)
+#define MK_XBUTTON1 0x0020
+#define MK_XBUTTON2 0x0040
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#endif /* !NOKEYSTATES */
+
+
+#if(_WIN32_WINNT >= 0x0400)
+#ifndef NOTRACKMOUSEEVENT
+
+#define TME_HOVER 0x00000001
+#define TME_LEAVE 0x00000002
+#if(WINVER >= 0x0500)
+#define TME_NONCLIENT 0x00000010
+#endif /* WINVER >= 0x0500 */
+#define TME_QUERY 0x40000000
+#define TME_CANCEL 0x80000000
+
+
+#define HOVER_DEFAULT 0xFFFFFFFF
+#endif /* _WIN32_WINNT >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0400)
+typedef struct tagTRACKMOUSEEVENT {
+ DWORD cbSize;
+ DWORD dwFlags;
+ HWND hwndTrack;
+ DWORD dwHoverTime;
+} TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT;
+
+WINUSERAPI
+BOOL
+WINAPI
+TrackMouseEvent(
+ IN OUT LPTRACKMOUSEEVENT lpEventTrack);
+#endif /* _WIN32_WINNT >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0400)
+
+#endif /* !NOTRACKMOUSEEVENT */
+#endif /* _WIN32_WINNT >= 0x0400 */
+
+
+#endif /* !NOWINMESSAGES */
+
+#ifndef NOWINSTYLES
+
+
+/*
+ * Window Styles
+ */
+#define WS_OVERLAPPED 0x00000000L
+#define WS_POPUP 0x80000000L
+#define WS_CHILD 0x40000000L
+#define WS_MINIMIZE 0x20000000L
+#define WS_VISIBLE 0x10000000L
+#define WS_DISABLED 0x08000000L
+#define WS_CLIPSIBLINGS 0x04000000L
+#define WS_CLIPCHILDREN 0x02000000L
+#define WS_MAXIMIZE 0x01000000L
+#define WS_CAPTION 0x00C00000L /* WS_BORDER | WS_DLGFRAME */
+#define WS_BORDER 0x00800000L
+#define WS_DLGFRAME 0x00400000L
+#define WS_VSCROLL 0x00200000L
+#define WS_HSCROLL 0x00100000L
+#define WS_SYSMENU 0x00080000L
+#define WS_THICKFRAME 0x00040000L
+#define WS_GROUP 0x00020000L
+#define WS_TABSTOP 0x00010000L
+
+#define WS_MINIMIZEBOX 0x00020000L
+#define WS_MAXIMIZEBOX 0x00010000L
+
+
+#define WS_TILED WS_OVERLAPPED
+#define WS_ICONIC WS_MINIMIZE
+#define WS_SIZEBOX WS_THICKFRAME
+#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW
+
+/*
+ * Common Window Styles
+ */
+#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | \
+ WS_CAPTION | \
+ WS_SYSMENU | \
+ WS_THICKFRAME | \
+ WS_MINIMIZEBOX | \
+ WS_MAXIMIZEBOX)
+
+#define WS_POPUPWINDOW (WS_POPUP | \
+ WS_BORDER | \
+ WS_SYSMENU)
+
+#define WS_CHILDWINDOW (WS_CHILD)
+
+/*
+ * Extended Window Styles
+ */
+#define WS_EX_DLGMODALFRAME 0x00000001L
+#define WS_EX_NOPARENTNOTIFY 0x00000004L
+#define WS_EX_TOPMOST 0x00000008L
+#define WS_EX_ACCEPTFILES 0x00000010L
+#define WS_EX_TRANSPARENT 0x00000020L
+#if(WINVER >= 0x0400)
+#define WS_EX_MDICHILD 0x00000040L
+#define WS_EX_TOOLWINDOW 0x00000080L
+#define WS_EX_WINDOWEDGE 0x00000100L
+#define WS_EX_CLIENTEDGE 0x00000200L
+#define WS_EX_CONTEXTHELP 0x00000400L
+
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0400)
+
+#define WS_EX_RIGHT 0x00001000L
+#define WS_EX_LEFT 0x00000000L
+#define WS_EX_RTLREADING 0x00002000L
+#define WS_EX_LTRREADING 0x00000000L
+#define WS_EX_LEFTSCROLLBAR 0x00004000L
+#define WS_EX_RIGHTSCROLLBAR 0x00000000L
+
+#define WS_EX_CONTROLPARENT 0x00010000L
+#define WS_EX_STATICEDGE 0x00020000L
+#define WS_EX_APPWINDOW 0x00040000L
+
+
+#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
+#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
+
+#endif /* WINVER >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0500)
+#define WS_EX_LAYERED 0x00080000
+
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+
+#if(WINVER >= 0x0500)
+#define WS_EX_NOINHERITLAYOUT 0x00100000L // Disable inheritence of mirroring by children
+#define WS_EX_LAYOUTRTL 0x00400000L // Right to left mirroring
+#endif /* WINVER >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0500)
+#define WS_EX_COMPOSITED 0x02000000L
+#define WS_EX_NOACTIVATE 0x08000000L
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+
+/*
+ * Class styles
+ */
+#define CS_VREDRAW 0x0001
+#define CS_HREDRAW 0x0002
+#define CS_DBLCLKS 0x0008
+#define CS_OWNDC 0x0020
+#define CS_CLASSDC 0x0040
+#define CS_PARENTDC 0x0080
+#define CS_NOCLOSE 0x0200
+#define CS_SAVEBITS 0x0800
+#define CS_BYTEALIGNCLIENT 0x1000
+#define CS_BYTEALIGNWINDOW 0x2000
+#define CS_GLOBALCLASS 0x4000
+
+#define CS_IME 0x00010000
+#if(_WIN32_WINNT >= 0x0501)
+#define CS_DROPSHADOW 0x00020000
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+
+
+#endif /* !NOWINSTYLES */
+#if(WINVER >= 0x0400)
+/* WM_PRINT flags */
+#define PRF_CHECKVISIBLE 0x00000001L
+#define PRF_NONCLIENT 0x00000002L
+#define PRF_CLIENT 0x00000004L
+#define PRF_ERASEBKGND 0x00000008L
+#define PRF_CHILDREN 0x00000010L
+#define PRF_OWNED 0x00000020L
+
+/* 3D border styles */
+#define BDR_RAISEDOUTER 0x0001
+#define BDR_SUNKENOUTER 0x0002
+#define BDR_RAISEDINNER 0x0004
+#define BDR_SUNKENINNER 0x0008
+
+#define BDR_OUTER (BDR_RAISEDOUTER | BDR_SUNKENOUTER)
+#define BDR_INNER (BDR_RAISEDINNER | BDR_SUNKENINNER)
+#define BDR_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+#define BDR_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+
+
+#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER)
+#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER)
+
+/* Border flags */
+#define BF_LEFT 0x0001
+#define BF_TOP 0x0002
+#define BF_RIGHT 0x0004
+#define BF_BOTTOM 0x0008
+
+#define BF_TOPLEFT (BF_TOP | BF_LEFT)
+#define BF_TOPRIGHT (BF_TOP | BF_RIGHT)
+#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT)
+#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT)
+#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
+
+#define BF_DIAGONAL 0x0010
+
+// For diagonal lines, the BF_RECT flags specify the end point of the
+// vector bounded by the rectangle parameter.
+#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT)
+#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
+
+
+#define BF_MIDDLE 0x0800 /* Fill in the middle */
+#define BF_SOFT 0x1000 /* For softer buttons */
+#define BF_ADJUST 0x2000 /* Calculate the space left over */
+#define BF_FLAT 0x4000 /* For flat rather than 3D borders */
+#define BF_MONO 0x8000 /* For monochrome borders */
+
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawEdge(
+ IN HDC hdc,
+ IN OUT LPRECT qrc,
+ IN UINT edge,
+ IN UINT grfFlags);
+
+/* flags for DrawFrameControl */
+
+#define DFC_CAPTION 1
+#define DFC_MENU 2
+#define DFC_SCROLL 3
+#define DFC_BUTTON 4
+#if(WINVER >= 0x0500)
+#define DFC_POPUPMENU 5
+#endif /* WINVER >= 0x0500 */
+
+#define DFCS_CAPTIONCLOSE 0x0000
+#define DFCS_CAPTIONMIN 0x0001
+#define DFCS_CAPTIONMAX 0x0002
+#define DFCS_CAPTIONRESTORE 0x0003
+#define DFCS_CAPTIONHELP 0x0004
+
+#define DFCS_MENUARROW 0x0000
+#define DFCS_MENUCHECK 0x0001
+#define DFCS_MENUBULLET 0x0002
+#define DFCS_MENUARROWRIGHT 0x0004
+#define DFCS_SCROLLUP 0x0000
+#define DFCS_SCROLLDOWN 0x0001
+#define DFCS_SCROLLLEFT 0x0002
+#define DFCS_SCROLLRIGHT 0x0003
+#define DFCS_SCROLLCOMBOBOX 0x0005
+#define DFCS_SCROLLSIZEGRIP 0x0008
+#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010
+
+#define DFCS_BUTTONCHECK 0x0000
+#define DFCS_BUTTONRADIOIMAGE 0x0001
+#define DFCS_BUTTONRADIOMASK 0x0002
+#define DFCS_BUTTONRADIO 0x0004
+#define DFCS_BUTTON3STATE 0x0008
+#define DFCS_BUTTONPUSH 0x0010
+
+#define DFCS_INACTIVE 0x0100
+#define DFCS_PUSHED 0x0200
+#define DFCS_CHECKED 0x0400
+
+#if(WINVER >= 0x0500)
+#define DFCS_TRANSPARENT 0x0800
+#define DFCS_HOT 0x1000
+#endif /* WINVER >= 0x0500 */
+
+#define DFCS_ADJUSTRECT 0x2000
+#define DFCS_FLAT 0x4000
+#define DFCS_MONO 0x8000
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawFrameControl(
+ IN HDC,
+ IN OUT LPRECT,
+ IN UINT,
+ IN UINT);
+
+
+/* flags for DrawCaption */
+#define DC_ACTIVE 0x0001
+#define DC_SMALLCAP 0x0002
+#define DC_ICON 0x0004
+#define DC_TEXT 0x0008
+#define DC_INBUTTON 0x0010
+#if(WINVER >= 0x0500)
+#define DC_GRADIENT 0x0020
+#endif /* WINVER >= 0x0500 */
+#if(_WIN32_WINNT >= 0x0501)
+#define DC_BUTTONS 0x1000
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawCaption(IN HWND, IN HDC, IN CONST RECT *, IN UINT);
+
+
+#define IDANI_OPEN 1
+#define IDANI_CAPTION 3
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawAnimatedRects(
+ IN HWND hwnd,
+ IN int idAni,
+ IN CONST RECT * lprcFrom,
+ IN CONST RECT * lprcTo);
+
+#endif /* WINVER >= 0x0400 */
+
+#ifndef NOCLIPBOARD
+
+
+/*
+ * Predefined Clipboard Formats
+ */
+#define CF_TEXT 1
+#define CF_BITMAP 2
+#define CF_METAFILEPICT 3
+#define CF_SYLK 4
+#define CF_DIF 5
+#define CF_TIFF 6
+#define CF_OEMTEXT 7
+#define CF_DIB 8
+#define CF_PALETTE 9
+#define CF_PENDATA 10
+#define CF_RIFF 11
+#define CF_WAVE 12
+#define CF_UNICODETEXT 13
+#define CF_ENHMETAFILE 14
+#if(WINVER >= 0x0400)
+#define CF_HDROP 15
+#define CF_LOCALE 16
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0500)
+#define CF_DIBV5 17
+#endif /* WINVER >= 0x0500 */
+
+#if(WINVER >= 0x0500)
+#define CF_MAX 18
+#elif(WINVER >= 0x0400)
+#define CF_MAX 17
+#else
+#define CF_MAX 15
+#endif
+
+#define CF_OWNERDISPLAY 0x0080
+#define CF_DSPTEXT 0x0081
+#define CF_DSPBITMAP 0x0082
+#define CF_DSPMETAFILEPICT 0x0083
+#define CF_DSPENHMETAFILE 0x008E
+
+/*
+ * "Private" formats don't get GlobalFree()'d
+ */
+#define CF_PRIVATEFIRST 0x0200
+#define CF_PRIVATELAST 0x02FF
+
+/*
+ * "GDIOBJ" formats do get DeleteObject()'d
+ */
+#define CF_GDIOBJFIRST 0x0300
+#define CF_GDIOBJLAST 0x03FF
+
+
+#endif /* !NOCLIPBOARD */
+
+/*
+ * Defines for the fVirt field of the Accelerator table structure.
+ */
+#define FVIRTKEY TRUE /* Assumed to be == TRUE */
+#define FNOINVERT 0x02
+#define FSHIFT 0x04
+#define FCONTROL 0x08
+#define FALT 0x10
+
+typedef struct tagACCEL {
+#ifndef _MAC
+ BYTE fVirt; /* Also called the flags field */
+ WORD key;
+ WORD cmd;
+#else
+ WORD fVirt; /* Also called the flags field */
+ WORD key;
+ DWORD cmd;
+#endif
+} ACCEL, *LPACCEL;
+
+typedef struct tagPAINTSTRUCT {
+ HDC hdc;
+ BOOL fErase;
+ RECT rcPaint;
+ BOOL fRestore;
+ BOOL fIncUpdate;
+ BYTE rgbReserved[32];
+} PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, *LPPAINTSTRUCT;
+
+typedef struct tagCREATESTRUCTA {
+ LPVOID lpCreateParams;
+ HINSTANCE hInstance;
+ HMENU hMenu;
+ HWND hwndParent;
+ int cy;
+ int cx;
+ int y;
+ int x;
+ LONG style;
+ LPCSTR lpszName;
+ LPCSTR lpszClass;
+ DWORD dwExStyle;
+} CREATESTRUCTA, *LPCREATESTRUCTA;
+typedef struct tagCREATESTRUCTW {
+ LPVOID lpCreateParams;
+ HINSTANCE hInstance;
+ HMENU hMenu;
+ HWND hwndParent;
+ int cy;
+ int cx;
+ int y;
+ int x;
+ LONG style;
+ LPCWSTR lpszName;
+ LPCWSTR lpszClass;
+ DWORD dwExStyle;
+} CREATESTRUCTW, *LPCREATESTRUCTW;
+#ifdef UNICODE
+typedef CREATESTRUCTW CREATESTRUCT;
+typedef LPCREATESTRUCTW LPCREATESTRUCT;
+#else
+typedef CREATESTRUCTA CREATESTRUCT;
+typedef LPCREATESTRUCTA LPCREATESTRUCT;
+#endif // UNICODE
+
+typedef struct tagWINDOWPLACEMENT {
+ UINT length;
+ UINT flags;
+ UINT showCmd;
+ POINT ptMinPosition;
+ POINT ptMaxPosition;
+ RECT rcNormalPosition;
+#ifdef _MAC
+ RECT rcDevice;
+#endif
+} WINDOWPLACEMENT;
+typedef WINDOWPLACEMENT *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT;
+
+#define WPF_SETMINPOSITION 0x0001
+#define WPF_RESTORETOMAXIMIZED 0x0002
+#if(_WIN32_WINNT >= 0x0500)
+#define WPF_ASYNCWINDOWPLACEMENT 0x0004
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+typedef struct tagNMHDR
+{
+ HWND hwndFrom;
+ UINT_PTR idFrom;
+ UINT code; // NM_ code
+} NMHDR;
+typedef NMHDR FAR * LPNMHDR;
+
+typedef struct tagSTYLESTRUCT
+{
+ DWORD styleOld;
+ DWORD styleNew;
+} STYLESTRUCT, * LPSTYLESTRUCT;
+#endif /* WINVER >= 0x0400 */
+
+
+/*
+ * Owner draw control types
+ */
+#define ODT_MENU 1
+#define ODT_LISTBOX 2
+#define ODT_COMBOBOX 3
+#define ODT_BUTTON 4
+#if(WINVER >= 0x0400)
+#define ODT_STATIC 5
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Owner draw actions
+ */
+#define ODA_DRAWENTIRE 0x0001
+#define ODA_SELECT 0x0002
+#define ODA_FOCUS 0x0004
+
+/*
+ * Owner draw state
+ */
+#define ODS_SELECTED 0x0001
+#define ODS_GRAYED 0x0002
+#define ODS_DISABLED 0x0004
+#define ODS_CHECKED 0x0008
+#define ODS_FOCUS 0x0010
+#if(WINVER >= 0x0400)
+#define ODS_DEFAULT 0x0020
+#define ODS_COMBOBOXEDIT 0x1000
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0500)
+#define ODS_HOTLIGHT 0x0040
+#define ODS_INACTIVE 0x0080
+#if(_WIN32_WINNT >= 0x0500)
+#define ODS_NOACCEL 0x0100
+#define ODS_NOFOCUSRECT 0x0200
+#endif /* _WIN32_WINNT >= 0x0500 */
+#endif /* WINVER >= 0x0500 */
+
+/*
+ * MEASUREITEMSTRUCT for ownerdraw
+ */
+typedef struct tagMEASUREITEMSTRUCT {
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemWidth;
+ UINT itemHeight;
+ ULONG_PTR itemData;
+} MEASUREITEMSTRUCT, NEAR *PMEASUREITEMSTRUCT, FAR *LPMEASUREITEMSTRUCT;
+
+
+/*
+ * DRAWITEMSTRUCT for ownerdraw
+ */
+typedef struct tagDRAWITEMSTRUCT {
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemAction;
+ UINT itemState;
+ HWND hwndItem;
+ HDC hDC;
+ RECT rcItem;
+ ULONG_PTR itemData;
+} DRAWITEMSTRUCT, NEAR *PDRAWITEMSTRUCT, FAR *LPDRAWITEMSTRUCT;
+
+/*
+ * DELETEITEMSTRUCT for ownerdraw
+ */
+typedef struct tagDELETEITEMSTRUCT {
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ HWND hwndItem;
+ ULONG_PTR itemData;
+} DELETEITEMSTRUCT, NEAR *PDELETEITEMSTRUCT, FAR *LPDELETEITEMSTRUCT;
+
+/*
+ * COMPAREITEMSTUCT for ownerdraw sorting
+ */
+typedef struct tagCOMPAREITEMSTRUCT {
+ UINT CtlType;
+ UINT CtlID;
+ HWND hwndItem;
+ UINT itemID1;
+ ULONG_PTR itemData1;
+ UINT itemID2;
+ ULONG_PTR itemData2;
+ DWORD dwLocaleId;
+} COMPAREITEMSTRUCT, NEAR *PCOMPAREITEMSTRUCT, FAR *LPCOMPAREITEMSTRUCT;
+
+#ifndef NOMSG
+
+/*
+ * Message Function Templates
+ */
+
+WINUSERAPI
+BOOL
+WINAPI
+GetMessageA(
+ OUT LPMSG lpMsg,
+ IN HWND hWnd,
+ IN UINT wMsgFilterMin,
+ IN UINT wMsgFilterMax);
+WINUSERAPI
+BOOL
+WINAPI
+GetMessageW(
+ OUT LPMSG lpMsg,
+ IN HWND hWnd,
+ IN UINT wMsgFilterMin,
+ IN UINT wMsgFilterMax);
+#ifdef UNICODE
+#define GetMessage GetMessageW
+#else
+#define GetMessage GetMessageA
+#endif // !UNICODE
+
+
+WINUSERAPI
+BOOL
+WINAPI
+TranslateMessage(
+ IN CONST MSG *lpMsg);
+
+WINUSERAPI
+LRESULT
+WINAPI
+DispatchMessageA(
+ IN CONST MSG *lpMsg);
+WINUSERAPI
+LRESULT
+WINAPI
+DispatchMessageW(
+ IN CONST MSG *lpMsg);
+#ifdef UNICODE
+#define DispatchMessage DispatchMessageW
+#else
+#define DispatchMessage DispatchMessageA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMessageQueue(
+ IN int cMessagesMax);
+
+WINUSERAPI
+BOOL
+WINAPI
+PeekMessageA(
+ OUT LPMSG lpMsg,
+ IN HWND hWnd,
+ IN UINT wMsgFilterMin,
+ IN UINT wMsgFilterMax,
+ IN UINT wRemoveMsg);
+WINUSERAPI
+BOOL
+WINAPI
+PeekMessageW(
+ OUT LPMSG lpMsg,
+ IN HWND hWnd,
+ IN UINT wMsgFilterMin,
+ IN UINT wMsgFilterMax,
+ IN UINT wRemoveMsg);
+#ifdef UNICODE
+#define PeekMessage PeekMessageW
+#else
+#define PeekMessage PeekMessageA
+#endif // !UNICODE
+
+
+/*
+ * PeekMessage() Options
+ */
+#define PM_NOREMOVE 0x0000
+#define PM_REMOVE 0x0001
+#define PM_NOYIELD 0x0002
+#if(WINVER >= 0x0500)
+#define PM_QS_INPUT (QS_INPUT << 16)
+#define PM_QS_POSTMESSAGE ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16)
+#define PM_QS_PAINT (QS_PAINT << 16)
+#define PM_QS_SENDMESSAGE (QS_SENDMESSAGE << 16)
+#endif /* WINVER >= 0x0500 */
+
+
+#endif /* !NOMSG */
+
+WINUSERAPI
+BOOL
+WINAPI
+RegisterHotKey(
+ IN HWND hWnd,
+ IN int id,
+ IN UINT fsModifiers,
+ IN UINT vk);
+
+WINUSERAPI
+BOOL
+WINAPI
+UnregisterHotKey(
+ IN HWND hWnd,
+ IN int id);
+
+#define MOD_ALT 0x0001
+#define MOD_CONTROL 0x0002
+#define MOD_SHIFT 0x0004
+#define MOD_WIN 0x0008
+
+
+#define IDHOT_SNAPWINDOW (-1) /* SHIFT-PRINTSCRN */
+#define IDHOT_SNAPDESKTOP (-2) /* PRINTSCRN */
+
+#ifdef WIN_INTERNAL
+ #ifndef LSTRING
+ #define NOLSTRING
+ #endif /* LSTRING */
+ #ifndef LFILEIO
+ #define NOLFILEIO
+ #endif /* LFILEIO */
+#endif /* WIN_INTERNAL */
+
+#if(WINVER >= 0x0400)
+
+#define ENDSESSION_LOGOFF 0x80000000
+#endif /* WINVER >= 0x0400 */
+
+#define EWX_LOGOFF 0
+#define EWX_SHUTDOWN 0x00000001
+#define EWX_REBOOT 0x00000002
+#define EWX_FORCE 0x00000004
+#define EWX_POWEROFF 0x00000008
+#if(_WIN32_WINNT >= 0x0500)
+#define EWX_FORCEIFHUNG 0x00000010
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+
+#define ExitWindows(dwReserved, Code) ExitWindowsEx(EWX_LOGOFF, 0xFFFFFFFF)
+
+WINUSERAPI
+BOOL
+WINAPI
+ExitWindowsEx(
+ IN UINT uFlags,
+ IN DWORD dwReserved);
+
+WINUSERAPI
+BOOL
+WINAPI
+SwapMouseButton(
+ IN BOOL fSwap);
+
+WINUSERAPI
+DWORD
+WINAPI
+GetMessagePos(
+ VOID);
+
+WINUSERAPI
+LONG
+WINAPI
+GetMessageTime(
+ VOID);
+
+WINUSERAPI
+LPARAM
+WINAPI
+GetMessageExtraInfo(
+ VOID);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+LPARAM
+WINAPI
+SetMessageExtraInfo(
+ IN LPARAM lParam);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+LRESULT
+WINAPI
+SendMessageA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+LRESULT
+WINAPI
+SendMessageW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define SendMessage SendMessageW
+#else
+#define SendMessage SendMessageA
+#endif // !UNICODE
+
+WINUSERAPI
+LRESULT
+WINAPI
+SendMessageTimeoutA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam,
+ IN UINT fuFlags,
+ IN UINT uTimeout,
+ OUT PDWORD_PTR lpdwResult);
+WINUSERAPI
+LRESULT
+WINAPI
+SendMessageTimeoutW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam,
+ IN UINT fuFlags,
+ IN UINT uTimeout,
+ OUT PDWORD_PTR lpdwResult);
+#ifdef UNICODE
+#define SendMessageTimeout SendMessageTimeoutW
+#else
+#define SendMessageTimeout SendMessageTimeoutA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SendNotifyMessageA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+BOOL
+WINAPI
+SendNotifyMessageW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define SendNotifyMessage SendNotifyMessageW
+#else
+#define SendNotifyMessage SendNotifyMessageA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SendMessageCallbackA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam,
+ IN SENDASYNCPROC lpResultCallBack,
+ IN ULONG_PTR dwData);
+WINUSERAPI
+BOOL
+WINAPI
+SendMessageCallbackW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam,
+ IN SENDASYNCPROC lpResultCallBack,
+ IN ULONG_PTR dwData);
+#ifdef UNICODE
+#define SendMessageCallback SendMessageCallbackW
+#else
+#define SendMessageCallback SendMessageCallbackA
+#endif // !UNICODE
+
+#if(_WIN32_WINNT >= 0x0501)
+typedef struct {
+ UINT cbSize;
+ HDESK hdesk;
+ HWND hwnd;
+ LUID luid;
+} BSMINFO, *PBSMINFO;
+
+WINUSERAPI
+long
+WINAPI
+BroadcastSystemMessageExA(
+ IN DWORD,
+ IN LPDWORD,
+ IN UINT,
+ IN WPARAM,
+ IN LPARAM,
+ OUT PBSMINFO);
+WINUSERAPI
+long
+WINAPI
+BroadcastSystemMessageExW(
+ IN DWORD,
+ IN LPDWORD,
+ IN UINT,
+ IN WPARAM,
+ IN LPARAM,
+ OUT PBSMINFO);
+#ifdef UNICODE
+#define BroadcastSystemMessageEx BroadcastSystemMessageExW
+#else
+#define BroadcastSystemMessageEx BroadcastSystemMessageExA
+#endif // !UNICODE
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(WINVER >= 0x0400)
+
+#if defined(_WIN32_WINNT)
+WINUSERAPI
+long
+WINAPI
+BroadcastSystemMessageA(
+ IN DWORD,
+ IN LPDWORD,
+ IN UINT,
+ IN WPARAM,
+ IN LPARAM);
+WINUSERAPI
+long
+WINAPI
+BroadcastSystemMessageW(
+ IN DWORD,
+ IN LPDWORD,
+ IN UINT,
+ IN WPARAM,
+ IN LPARAM);
+#ifdef UNICODE
+#define BroadcastSystemMessage BroadcastSystemMessageW
+#else
+#define BroadcastSystemMessage BroadcastSystemMessageA
+#endif // !UNICODE
+#elif defined(_WIN32_WINDOWS)
+// The Win95 version isn't A/W decorated
+WINUSERAPI
+long
+WINAPI
+BroadcastSystemMessage(
+ IN DWORD,
+ IN LPDWORD,
+ IN UINT,
+ IN WPARAM,
+ IN LPARAM);
+
+#endif
+
+//Broadcast Special Message Recipient list
+#define BSM_ALLCOMPONENTS 0x00000000
+#define BSM_VXDS 0x00000001
+#define BSM_NETDRIVER 0x00000002
+#define BSM_INSTALLABLEDRIVERS 0x00000004
+#define BSM_APPLICATIONS 0x00000008
+#define BSM_ALLDESKTOPS 0x00000010
+
+//Broadcast Special Message Flags
+#define BSF_QUERY 0x00000001
+#define BSF_IGNORECURRENTTASK 0x00000002
+#define BSF_FLUSHDISK 0x00000004
+#define BSF_NOHANG 0x00000008
+#define BSF_POSTMESSAGE 0x00000010
+#define BSF_FORCEIFHUNG 0x00000020
+#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040
+#if(_WIN32_WINNT >= 0x0500)
+#define BSF_ALLOWSFW 0x00000080
+#define BSF_SENDNOTIFYMESSAGE 0x00000100
+#endif /* _WIN32_WINNT >= 0x0500 */
+#if(_WIN32_WINNT >= 0x0501)
+#define BSF_RETURNHDESK 0x00000200
+#define BSF_LUID 0x00000400
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define BROADCAST_QUERY_DENY 0x424D5144 // Return this value to deny a query.
+#endif /* WINVER >= 0x0400 */
+
+// RegisterDeviceNotification
+
+#if(WINVER >= 0x0500)
+typedef PVOID HDEVNOTIFY;
+typedef HDEVNOTIFY *PHDEVNOTIFY;
+
+#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
+#define DEVICE_NOTIFY_SERVICE_HANDLE 0x00000001
+#if(_WIN32_WINNT >= 0x0501)
+#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+HDEVNOTIFY
+WINAPI
+RegisterDeviceNotificationA(
+ IN HANDLE hRecipient,
+ IN LPVOID NotificationFilter,
+ IN DWORD Flags
+ );
+WINUSERAPI
+HDEVNOTIFY
+WINAPI
+RegisterDeviceNotificationW(
+ IN HANDLE hRecipient,
+ IN LPVOID NotificationFilter,
+ IN DWORD Flags
+ );
+#ifdef UNICODE
+#define RegisterDeviceNotification RegisterDeviceNotificationW
+#else
+#define RegisterDeviceNotification RegisterDeviceNotificationA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+UnregisterDeviceNotification(
+ IN HDEVNOTIFY Handle
+ );
+#endif /* WINVER >= 0x0500 */
+
+
+WINUSERAPI
+BOOL
+WINAPI
+PostMessageA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+BOOL
+WINAPI
+PostMessageW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define PostMessage PostMessageW
+#else
+#define PostMessage PostMessageA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+PostThreadMessageA(
+ IN DWORD idThread,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+BOOL
+WINAPI
+PostThreadMessageW(
+ IN DWORD idThread,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define PostThreadMessage PostThreadMessageW
+#else
+#define PostThreadMessage PostThreadMessageA
+#endif // !UNICODE
+
+#define PostAppMessageA(idThread, wMsg, wParam, lParam)\
+ PostThreadMessageA((DWORD)idThread, wMsg, wParam, lParam)
+#define PostAppMessageW(idThread, wMsg, wParam, lParam)\
+ PostThreadMessageW((DWORD)idThread, wMsg, wParam, lParam)
+#ifdef UNICODE
+#define PostAppMessage PostAppMessageW
+#else
+#define PostAppMessage PostAppMessageA
+#endif // !UNICODE
+
+/*
+ * Special HWND value for use with PostMessage() and SendMessage()
+ */
+#define HWND_BROADCAST ((HWND)0xffff)
+
+#if(WINVER >= 0x0500)
+#define HWND_MESSAGE ((HWND)-3)
+#endif /* WINVER >= 0x0500 */
+
+WINUSERAPI
+BOOL
+WINAPI
+AttachThreadInput(
+ IN DWORD idAttach,
+ IN DWORD idAttachTo,
+ IN BOOL fAttach);
+
+
+WINUSERAPI
+BOOL
+WINAPI
+ReplyMessage(
+ IN LRESULT lResult);
+
+WINUSERAPI
+BOOL
+WINAPI
+WaitMessage(
+ VOID);
+
+
+WINUSERAPI
+DWORD
+WINAPI
+WaitForInputIdle(
+ IN HANDLE hProcess,
+ IN DWORD dwMilliseconds);
+
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefWindowProcA(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefWindowProcW(
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define DefWindowProc DefWindowProcW
+#else
+#define DefWindowProc DefWindowProcA
+#endif // !UNICODE
+
+WINUSERAPI
+VOID
+WINAPI
+PostQuitMessage(
+ IN int nExitCode);
+
+#ifdef STRICT
+
+WINUSERAPI
+LRESULT
+WINAPI
+CallWindowProcA(
+ IN WNDPROC lpPrevWndFunc,
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+LRESULT
+WINAPI
+CallWindowProcW(
+ IN WNDPROC lpPrevWndFunc,
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define CallWindowProc CallWindowProcW
+#else
+#define CallWindowProc CallWindowProcA
+#endif // !UNICODE
+
+#else /* !STRICT */
+
+WINUSERAPI
+LRESULT
+WINAPI
+CallWindowProcA(
+ IN FARPROC lpPrevWndFunc,
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+LRESULT
+WINAPI
+CallWindowProcW(
+ IN FARPROC lpPrevWndFunc,
+ IN HWND hWnd,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define CallWindowProc CallWindowProcW
+#else
+#define CallWindowProc CallWindowProcA
+#endif // !UNICODE
+
+#endif /* !STRICT */
+
+WINUSERAPI
+BOOL
+WINAPI
+InSendMessage(
+ VOID);
+
+#if(WINVER >= 0x0500)
+WINUSERAPI
+DWORD
+WINAPI
+InSendMessageEx(
+ IN LPVOID lpReserved);
+
+/*
+ * InSendMessageEx return value
+ */
+#define ISMEX_NOSEND 0x00000000
+#define ISMEX_SEND 0x00000001
+#define ISMEX_NOTIFY 0x00000002
+#define ISMEX_CALLBACK 0x00000004
+#define ISMEX_REPLIED 0x00000008
+#endif /* WINVER >= 0x0500 */
+
+WINUSERAPI
+UINT
+WINAPI
+GetDoubleClickTime(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetDoubleClickTime(
+ IN UINT);
+
+WINUSERAPI
+ATOM
+WINAPI
+RegisterClassA(
+ IN CONST WNDCLASSA *lpWndClass);
+WINUSERAPI
+ATOM
+WINAPI
+RegisterClassW(
+ IN CONST WNDCLASSW *lpWndClass);
+#ifdef UNICODE
+#define RegisterClass RegisterClassW
+#else
+#define RegisterClass RegisterClassA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+UnregisterClassA(
+ IN LPCSTR lpClassName,
+ IN HINSTANCE hInstance);
+WINUSERAPI
+BOOL
+WINAPI
+UnregisterClassW(
+ IN LPCWSTR lpClassName,
+ IN HINSTANCE hInstance);
+#ifdef UNICODE
+#define UnregisterClass UnregisterClassW
+#else
+#define UnregisterClass UnregisterClassA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+GetClassInfoA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpClassName,
+ OUT LPWNDCLASSA lpWndClass);
+WINUSERAPI
+BOOL
+WINAPI
+GetClassInfoW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpClassName,
+ OUT LPWNDCLASSW lpWndClass);
+#ifdef UNICODE
+#define GetClassInfo GetClassInfoW
+#else
+#define GetClassInfo GetClassInfoA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+ATOM
+WINAPI
+RegisterClassExA(
+ IN CONST WNDCLASSEXA *);
+WINUSERAPI
+ATOM
+WINAPI
+RegisterClassExW(
+ IN CONST WNDCLASSEXW *);
+#ifdef UNICODE
+#define RegisterClassEx RegisterClassExW
+#else
+#define RegisterClassEx RegisterClassExA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+GetClassInfoExA(
+ IN HINSTANCE,
+ IN LPCSTR,
+ OUT LPWNDCLASSEXA);
+WINUSERAPI
+BOOL
+WINAPI
+GetClassInfoExW(
+ IN HINSTANCE,
+ IN LPCWSTR,
+ OUT LPWNDCLASSEXW);
+#ifdef UNICODE
+#define GetClassInfoEx GetClassInfoExW
+#else
+#define GetClassInfoEx GetClassInfoExA
+#endif // !UNICODE
+
+#endif /* WINVER >= 0x0400 */
+
+#define CW_USEDEFAULT ((int)0x80000000)
+
+/*
+ * Special value for CreateWindow, et al.
+ */
+#define HWND_DESKTOP ((HWND)0)
+
+#if(_WIN32_WINNT >= 0x0501)
+typedef BOOLEAN (WINAPI * PREGISTERCLASSNAMEW)(LPCWSTR);
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+HWND
+WINAPI
+CreateWindowExA(
+ IN DWORD dwExStyle,
+ IN LPCSTR lpClassName,
+ IN LPCSTR lpWindowName,
+ IN DWORD dwStyle,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight,
+ IN HWND hWndParent,
+ IN HMENU hMenu,
+ IN HINSTANCE hInstance,
+ IN LPVOID lpParam);
+WINUSERAPI
+HWND
+WINAPI
+CreateWindowExW(
+ IN DWORD dwExStyle,
+ IN LPCWSTR lpClassName,
+ IN LPCWSTR lpWindowName,
+ IN DWORD dwStyle,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight,
+ IN HWND hWndParent,
+ IN HMENU hMenu,
+ IN HINSTANCE hInstance,
+ IN LPVOID lpParam);
+#ifdef UNICODE
+#define CreateWindowEx CreateWindowExW
+#else
+#define CreateWindowEx CreateWindowExA
+#endif // !UNICODE
+
+#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\
+CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+#define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\
+CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+#ifdef UNICODE
+#define CreateWindow CreateWindowW
+#else
+#define CreateWindow CreateWindowA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+IsWindow(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsMenu(
+ IN HMENU hMenu);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsChild(
+ IN HWND hWndParent,
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyWindow(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+ShowWindow(
+ IN HWND hWnd,
+ IN int nCmdShow);
+
+#if(WINVER >= 0x0500)
+WINUSERAPI
+BOOL
+WINAPI
+AnimateWindow(
+ IN HWND hWnd,
+ IN DWORD dwTime,
+ IN DWORD dwFlags);
+#endif /* WINVER >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0500)
+#if defined(_WINGDI_) && !defined (NOGDI)
+
+WINUSERAPI
+BOOL
+WINAPI
+UpdateLayeredWindow(
+ HWND hWnd,
+ HDC hdcDst,
+ POINT *pptDst,
+ SIZE *psize,
+ HDC hdcSrc,
+ POINT *pptSrc,
+ COLORREF crKey,
+ BLENDFUNCTION *pblend,
+ DWORD dwFlags);
+#endif
+
+#if(_WIN32_WINNT >= 0x0501)
+WINUSERAPI
+BOOL
+WINAPI
+GetLayeredWindowAttributes(
+ HWND hwnd,
+ COLORREF *pcrKey,
+ BYTE *pbAlpha,
+ DWORD *pdwFlags);
+
+#define PW_CLIENTONLY 0x00000001
+
+
+WINUSERAPI
+BOOL
+WINAPI
+PrintWindow(
+ IN HWND hwnd,
+ IN HDC hdcBlt,
+ IN UINT nFlags);
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+BOOL
+WINAPI
+SetLayeredWindowAttributes(
+ HWND hwnd,
+ COLORREF crKey,
+ BYTE bAlpha,
+ DWORD dwFlags);
+
+#define LWA_COLORKEY 0x00000001
+#define LWA_ALPHA 0x00000002
+
+
+#define ULW_COLORKEY 0x00000001
+#define ULW_ALPHA 0x00000002
+#define ULW_OPAQUE 0x00000004
+
+
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+BOOL
+WINAPI
+ShowWindowAsync(
+ IN HWND hWnd,
+ IN int nCmdShow);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+FlashWindow(
+ IN HWND hWnd,
+ IN BOOL bInvert);
+
+#if(WINVER >= 0x0500)
+typedef struct {
+ UINT cbSize;
+ HWND hwnd;
+ DWORD dwFlags;
+ UINT uCount;
+ DWORD dwTimeout;
+} FLASHWINFO, *PFLASHWINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+FlashWindowEx(
+ PFLASHWINFO pfwi);
+
+#define FLASHW_STOP 0
+#define FLASHW_CAPTION 0x00000001
+#define FLASHW_TRAY 0x00000002
+#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
+#define FLASHW_TIMER 0x00000004
+#define FLASHW_TIMERNOFG 0x0000000C
+
+#endif /* WINVER >= 0x0500 */
+
+WINUSERAPI
+BOOL
+WINAPI
+ShowOwnedPopups(
+ IN HWND hWnd,
+ IN BOOL fShow);
+
+WINUSERAPI
+BOOL
+WINAPI
+OpenIcon(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+CloseWindow(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+MoveWindow(
+ IN HWND hWnd,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight,
+ IN BOOL bRepaint);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetWindowPos(
+ IN HWND hWnd,
+ IN HWND hWndInsertAfter,
+ IN int X,
+ IN int Y,
+ IN int cx,
+ IN int cy,
+ IN UINT uFlags);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetWindowPlacement(
+ IN HWND hWnd,
+ OUT WINDOWPLACEMENT *lpwndpl);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetWindowPlacement(
+ IN HWND hWnd,
+ IN CONST WINDOWPLACEMENT *lpwndpl);
+
+
+#ifndef NODEFERWINDOWPOS
+
+WINUSERAPI
+HDWP
+WINAPI
+BeginDeferWindowPos(
+ IN int nNumWindows);
+
+WINUSERAPI
+HDWP
+WINAPI
+DeferWindowPos(
+ IN HDWP hWinPosInfo,
+ IN HWND hWnd,
+ IN HWND hWndInsertAfter,
+ IN int x,
+ IN int y,
+ IN int cx,
+ IN int cy,
+ IN UINT uFlags);
+
+WINUSERAPI
+BOOL
+WINAPI
+EndDeferWindowPos(
+ IN HDWP hWinPosInfo);
+
+#endif /* !NODEFERWINDOWPOS */
+
+WINUSERAPI
+BOOL
+WINAPI
+IsWindowVisible(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsIconic(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+AnyPopup(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+BringWindowToTop(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsZoomed(
+ IN HWND hWnd);
+
+/*
+ * SetWindowPos Flags
+ */
+#define SWP_NOSIZE 0x0001
+#define SWP_NOMOVE 0x0002
+#define SWP_NOZORDER 0x0004
+#define SWP_NOREDRAW 0x0008
+#define SWP_NOACTIVATE 0x0010
+#define SWP_FRAMECHANGED 0x0020 /* The frame changed: send WM_NCCALCSIZE */
+#define SWP_SHOWWINDOW 0x0040
+#define SWP_HIDEWINDOW 0x0080
+#define SWP_NOCOPYBITS 0x0100
+#define SWP_NOOWNERZORDER 0x0200 /* Don't do owner Z ordering */
+#define SWP_NOSENDCHANGING 0x0400 /* Don't send WM_WINDOWPOSCHANGING */
+
+#define SWP_DRAWFRAME SWP_FRAMECHANGED
+#define SWP_NOREPOSITION SWP_NOOWNERZORDER
+
+#if(WINVER >= 0x0400)
+#define SWP_DEFERERASE 0x2000
+#define SWP_ASYNCWINDOWPOS 0x4000
+#endif /* WINVER >= 0x0400 */
+
+
+#define HWND_TOP ((HWND)0)
+#define HWND_BOTTOM ((HWND)1)
+#define HWND_TOPMOST ((HWND)-1)
+#define HWND_NOTOPMOST ((HWND)-2)
+
+#ifndef NOCTLMGR
+
+/*
+ * WARNING:
+ * The following structures must NOT be DWORD padded because they are
+ * followed by strings, etc that do not have to be DWORD aligned.
+ */
+#include
+
+/*
+ * original NT 32 bit dialog template:
+ */
+typedef struct {
+ DWORD style;
+ DWORD dwExtendedStyle;
+ WORD cdit;
+ short x;
+ short y;
+ short cx;
+ short cy;
+} DLGTEMPLATE;
+typedef DLGTEMPLATE *LPDLGTEMPLATEA;
+typedef DLGTEMPLATE *LPDLGTEMPLATEW;
+#ifdef UNICODE
+typedef LPDLGTEMPLATEW LPDLGTEMPLATE;
+#else
+typedef LPDLGTEMPLATEA LPDLGTEMPLATE;
+#endif // UNICODE
+typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEA;
+typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEW;
+#ifdef UNICODE
+typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE;
+#else
+typedef LPCDLGTEMPLATEA LPCDLGTEMPLATE;
+#endif // UNICODE
+
+/*
+ * 32 bit Dialog item template.
+ */
+typedef struct {
+ DWORD style;
+ DWORD dwExtendedStyle;
+ short x;
+ short y;
+ short cx;
+ short cy;
+ WORD id;
+} DLGITEMTEMPLATE;
+typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA;
+typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW;
+#ifdef UNICODE
+typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE;
+#else
+typedef PDLGITEMTEMPLATEA PDLGITEMTEMPLATE;
+#endif // UNICODE
+typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA;
+typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW;
+#ifdef UNICODE
+typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE;
+#else
+typedef LPDLGITEMTEMPLATEA LPDLGITEMTEMPLATE;
+#endif // UNICODE
+
+
+#include /* Resume normal packing */
+
+WINUSERAPI
+HWND
+WINAPI
+CreateDialogParamA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpTemplateName,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+WINUSERAPI
+HWND
+WINAPI
+CreateDialogParamW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpTemplateName,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+#ifdef UNICODE
+#define CreateDialogParam CreateDialogParamW
+#else
+#define CreateDialogParam CreateDialogParamA
+#endif // !UNICODE
+
+WINUSERAPI
+HWND
+WINAPI
+CreateDialogIndirectParamA(
+ IN HINSTANCE hInstance,
+ IN LPCDLGTEMPLATEA lpTemplate,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+WINUSERAPI
+HWND
+WINAPI
+CreateDialogIndirectParamW(
+ IN HINSTANCE hInstance,
+ IN LPCDLGTEMPLATEW lpTemplate,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+#ifdef UNICODE
+#define CreateDialogIndirectParam CreateDialogIndirectParamW
+#else
+#define CreateDialogIndirectParam CreateDialogIndirectParamA
+#endif // !UNICODE
+
+#define CreateDialogA(hInstance, lpName, hWndParent, lpDialogFunc) \
+CreateDialogParamA(hInstance, lpName, hWndParent, lpDialogFunc, 0L)
+#define CreateDialogW(hInstance, lpName, hWndParent, lpDialogFunc) \
+CreateDialogParamW(hInstance, lpName, hWndParent, lpDialogFunc, 0L)
+#ifdef UNICODE
+#define CreateDialog CreateDialogW
+#else
+#define CreateDialog CreateDialogA
+#endif // !UNICODE
+
+#define CreateDialogIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#define CreateDialogIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+CreateDialogIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#ifdef UNICODE
+#define CreateDialogIndirect CreateDialogIndirectW
+#else
+#define CreateDialogIndirect CreateDialogIndirectA
+#endif // !UNICODE
+
+WINUSERAPI
+INT_PTR
+WINAPI
+DialogBoxParamA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpTemplateName,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+WINUSERAPI
+INT_PTR
+WINAPI
+DialogBoxParamW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpTemplateName,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+#ifdef UNICODE
+#define DialogBoxParam DialogBoxParamW
+#else
+#define DialogBoxParam DialogBoxParamA
+#endif // !UNICODE
+
+WINUSERAPI
+INT_PTR
+WINAPI
+DialogBoxIndirectParamA(
+ IN HINSTANCE hInstance,
+ IN LPCDLGTEMPLATEA hDialogTemplate,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+WINUSERAPI
+INT_PTR
+WINAPI
+DialogBoxIndirectParamW(
+ IN HINSTANCE hInstance,
+ IN LPCDLGTEMPLATEW hDialogTemplate,
+ IN HWND hWndParent,
+ IN DLGPROC lpDialogFunc,
+ IN LPARAM dwInitParam);
+#ifdef UNICODE
+#define DialogBoxIndirectParam DialogBoxIndirectParamW
+#else
+#define DialogBoxIndirectParam DialogBoxIndirectParamA
+#endif // !UNICODE
+
+#define DialogBoxA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#define DialogBoxW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#ifdef UNICODE
+#define DialogBox DialogBoxW
+#else
+#define DialogBox DialogBoxA
+#endif // !UNICODE
+
+#define DialogBoxIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#define DialogBoxIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+#ifdef UNICODE
+#define DialogBoxIndirect DialogBoxIndirectW
+#else
+#define DialogBoxIndirect DialogBoxIndirectA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+EndDialog(
+ IN HWND hDlg,
+ IN INT_PTR nResult);
+
+WINUSERAPI
+HWND
+WINAPI
+GetDlgItem(
+ IN HWND hDlg,
+ IN int nIDDlgItem);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetDlgItemInt(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ IN UINT uValue,
+ IN BOOL bSigned);
+
+WINUSERAPI
+UINT
+WINAPI
+GetDlgItemInt(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ OUT BOOL *lpTranslated,
+ IN BOOL bSigned);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetDlgItemTextA(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ IN LPCSTR lpString);
+WINUSERAPI
+BOOL
+WINAPI
+SetDlgItemTextW(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ IN LPCWSTR lpString);
+#ifdef UNICODE
+#define SetDlgItemText SetDlgItemTextW
+#else
+#define SetDlgItemText SetDlgItemTextA
+#endif // !UNICODE
+
+WINUSERAPI
+UINT
+WINAPI
+GetDlgItemTextA(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ OUT LPSTR lpString,
+ IN int nMaxCount);
+WINUSERAPI
+UINT
+WINAPI
+GetDlgItemTextW(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ OUT LPWSTR lpString,
+ IN int nMaxCount);
+#ifdef UNICODE
+#define GetDlgItemText GetDlgItemTextW
+#else
+#define GetDlgItemText GetDlgItemTextA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+CheckDlgButton(
+ IN HWND hDlg,
+ IN int nIDButton,
+ IN UINT uCheck);
+
+WINUSERAPI
+BOOL
+WINAPI
+CheckRadioButton(
+ IN HWND hDlg,
+ IN int nIDFirstButton,
+ IN int nIDLastButton,
+ IN int nIDCheckButton);
+
+WINUSERAPI
+UINT
+WINAPI
+IsDlgButtonChecked(
+ IN HWND hDlg,
+ IN int nIDButton);
+
+WINUSERAPI
+LRESULT
+WINAPI
+SendDlgItemMessageA(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+LRESULT
+WINAPI
+SendDlgItemMessageW(
+ IN HWND hDlg,
+ IN int nIDDlgItem,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define SendDlgItemMessage SendDlgItemMessageW
+#else
+#define SendDlgItemMessage SendDlgItemMessageA
+#endif // !UNICODE
+
+WINUSERAPI
+HWND
+WINAPI
+GetNextDlgGroupItem(
+ IN HWND hDlg,
+ IN HWND hCtl,
+ IN BOOL bPrevious);
+
+WINUSERAPI
+HWND
+WINAPI
+GetNextDlgTabItem(
+ IN HWND hDlg,
+ IN HWND hCtl,
+ IN BOOL bPrevious);
+
+WINUSERAPI
+int
+WINAPI
+GetDlgCtrlID(
+ IN HWND hWnd);
+
+WINUSERAPI
+long
+WINAPI
+GetDialogBaseUnits(VOID);
+
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefDlgProcA(
+ IN HWND hDlg,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefDlgProcW(
+ IN HWND hDlg,
+ IN UINT Msg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define DefDlgProc DefDlgProcW
+#else
+#define DefDlgProc DefDlgProcA
+#endif // !UNICODE
+
+/*
+ * Window extra byted needed for private dialog classes.
+ */
+#ifndef _MAC
+#define DLGWINDOWEXTRA 30
+#else
+#define DLGWINDOWEXTRA 48
+#endif
+
+#endif /* !NOCTLMGR */
+
+#ifndef NOMSG
+
+WINUSERAPI
+BOOL
+WINAPI
+CallMsgFilterA(
+ IN LPMSG lpMsg,
+ IN int nCode);
+WINUSERAPI
+BOOL
+WINAPI
+CallMsgFilterW(
+ IN LPMSG lpMsg,
+ IN int nCode);
+#ifdef UNICODE
+#define CallMsgFilter CallMsgFilterW
+#else
+#define CallMsgFilter CallMsgFilterA
+#endif // !UNICODE
+
+#endif /* !NOMSG */
+
+#ifndef NOCLIPBOARD
+
+/*
+ * Clipboard Manager Functions
+ */
+
+WINUSERAPI
+BOOL
+WINAPI
+OpenClipboard(
+ IN HWND hWndNewOwner);
+
+WINUSERAPI
+BOOL
+WINAPI
+CloseClipboard(
+ VOID);
+
+
+#if(WINVER >= 0x0500)
+
+WINUSERAPI
+DWORD
+WINAPI
+GetClipboardSequenceNumber(
+ VOID);
+
+#endif /* WINVER >= 0x0500 */
+
+WINUSERAPI
+HWND
+WINAPI
+GetClipboardOwner(
+ VOID);
+
+WINUSERAPI
+HWND
+WINAPI
+SetClipboardViewer(
+ IN HWND hWndNewViewer);
+
+WINUSERAPI
+HWND
+WINAPI
+GetClipboardViewer(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+ChangeClipboardChain(
+ IN HWND hWndRemove,
+ IN HWND hWndNewNext);
+
+WINUSERAPI
+HANDLE
+WINAPI
+SetClipboardData(
+ IN UINT uFormat,
+ IN HANDLE hMem);
+
+WINUSERAPI
+HANDLE
+WINAPI
+GetClipboardData(
+ IN UINT uFormat);
+
+WINUSERAPI
+UINT
+WINAPI
+RegisterClipboardFormatA(
+ IN LPCSTR lpszFormat);
+WINUSERAPI
+UINT
+WINAPI
+RegisterClipboardFormatW(
+ IN LPCWSTR lpszFormat);
+#ifdef UNICODE
+#define RegisterClipboardFormat RegisterClipboardFormatW
+#else
+#define RegisterClipboardFormat RegisterClipboardFormatA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+CountClipboardFormats(
+ VOID);
+
+WINUSERAPI
+UINT
+WINAPI
+EnumClipboardFormats(
+ IN UINT format);
+
+WINUSERAPI
+int
+WINAPI
+GetClipboardFormatNameA(
+ IN UINT format,
+ OUT LPSTR lpszFormatName,
+ IN int cchMaxCount);
+WINUSERAPI
+int
+WINAPI
+GetClipboardFormatNameW(
+ IN UINT format,
+ OUT LPWSTR lpszFormatName,
+ IN int cchMaxCount);
+#ifdef UNICODE
+#define GetClipboardFormatName GetClipboardFormatNameW
+#else
+#define GetClipboardFormatName GetClipboardFormatNameA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+EmptyClipboard(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsClipboardFormatAvailable(
+ IN UINT format);
+
+WINUSERAPI
+int
+WINAPI
+GetPriorityClipboardFormat(
+ OUT UINT *paFormatPriorityList,
+ IN int cFormats);
+
+WINUSERAPI
+HWND
+WINAPI
+GetOpenClipboardWindow(
+ VOID);
+
+#endif /* !NOCLIPBOARD */
+
+/*
+ * Character Translation Routines
+ */
+
+WINUSERAPI
+BOOL
+WINAPI
+CharToOemA(
+ IN LPCSTR lpszSrc,
+ OUT LPSTR lpszDst);
+WINUSERAPI
+BOOL
+WINAPI
+CharToOemW(
+ IN LPCWSTR lpszSrc,
+ OUT LPSTR lpszDst);
+#ifdef UNICODE
+#define CharToOem CharToOemW
+#else
+#define CharToOem CharToOemA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+OemToCharA(
+ IN LPCSTR lpszSrc,
+ OUT LPSTR lpszDst);
+WINUSERAPI
+BOOL
+WINAPI
+OemToCharW(
+ IN LPCSTR lpszSrc,
+ OUT LPWSTR lpszDst);
+#ifdef UNICODE
+#define OemToChar OemToCharW
+#else
+#define OemToChar OemToCharA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+CharToOemBuffA(
+ IN LPCSTR lpszSrc,
+ OUT LPSTR lpszDst,
+ IN DWORD cchDstLength);
+WINUSERAPI
+BOOL
+WINAPI
+CharToOemBuffW(
+ IN LPCWSTR lpszSrc,
+ OUT LPSTR lpszDst,
+ IN DWORD cchDstLength);
+#ifdef UNICODE
+#define CharToOemBuff CharToOemBuffW
+#else
+#define CharToOemBuff CharToOemBuffA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+OemToCharBuffA(
+ IN LPCSTR lpszSrc,
+ OUT LPSTR lpszDst,
+ IN DWORD cchDstLength);
+WINUSERAPI
+BOOL
+WINAPI
+OemToCharBuffW(
+ IN LPCSTR lpszSrc,
+ OUT LPWSTR lpszDst,
+ IN DWORD cchDstLength);
+#ifdef UNICODE
+#define OemToCharBuff OemToCharBuffW
+#else
+#define OemToCharBuff OemToCharBuffA
+#endif // !UNICODE
+
+WINUSERAPI
+LPSTR
+WINAPI
+CharUpperA(
+ IN OUT LPSTR lpsz);
+WINUSERAPI
+LPWSTR
+WINAPI
+CharUpperW(
+ IN OUT LPWSTR lpsz);
+#ifdef UNICODE
+#define CharUpper CharUpperW
+#else
+#define CharUpper CharUpperA
+#endif // !UNICODE
+
+WINUSERAPI
+DWORD
+WINAPI
+CharUpperBuffA(
+ IN OUT LPSTR lpsz,
+ IN DWORD cchLength);
+WINUSERAPI
+DWORD
+WINAPI
+CharUpperBuffW(
+ IN OUT LPWSTR lpsz,
+ IN DWORD cchLength);
+#ifdef UNICODE
+#define CharUpperBuff CharUpperBuffW
+#else
+#define CharUpperBuff CharUpperBuffA
+#endif // !UNICODE
+
+WINUSERAPI
+LPSTR
+WINAPI
+CharLowerA(
+ IN OUT LPSTR lpsz);
+WINUSERAPI
+LPWSTR
+WINAPI
+CharLowerW(
+ IN OUT LPWSTR lpsz);
+#ifdef UNICODE
+#define CharLower CharLowerW
+#else
+#define CharLower CharLowerA
+#endif // !UNICODE
+
+WINUSERAPI
+DWORD
+WINAPI
+CharLowerBuffA(
+ IN OUT LPSTR lpsz,
+ IN DWORD cchLength);
+WINUSERAPI
+DWORD
+WINAPI
+CharLowerBuffW(
+ IN OUT LPWSTR lpsz,
+ IN DWORD cchLength);
+#ifdef UNICODE
+#define CharLowerBuff CharLowerBuffW
+#else
+#define CharLowerBuff CharLowerBuffA
+#endif // !UNICODE
+
+WINUSERAPI
+LPSTR
+WINAPI
+CharNextA(
+ IN LPCSTR lpsz);
+WINUSERAPI
+LPWSTR
+WINAPI
+CharNextW(
+ IN LPCWSTR lpsz);
+#ifdef UNICODE
+#define CharNext CharNextW
+#else
+#define CharNext CharNextA
+#endif // !UNICODE
+
+WINUSERAPI
+LPSTR
+WINAPI
+CharPrevA(
+ IN LPCSTR lpszStart,
+ IN LPCSTR lpszCurrent);
+WINUSERAPI
+LPWSTR
+WINAPI
+CharPrevW(
+ IN LPCWSTR lpszStart,
+ IN LPCWSTR lpszCurrent);
+#ifdef UNICODE
+#define CharPrev CharPrevW
+#else
+#define CharPrev CharPrevA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+LPSTR
+WINAPI
+CharNextExA(
+ IN WORD CodePage,
+ IN LPCSTR lpCurrentChar,
+ IN DWORD dwFlags);
+
+WINUSERAPI
+LPSTR
+WINAPI
+CharPrevExA(
+ IN WORD CodePage,
+ IN LPCSTR lpStart,
+ IN LPCSTR lpCurrentChar,
+ IN DWORD dwFlags);
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Compatibility defines for character translation routines
+ */
+#define AnsiToOem CharToOemA
+#define OemToAnsi OemToCharA
+#define AnsiToOemBuff CharToOemBuffA
+#define OemToAnsiBuff OemToCharBuffA
+#define AnsiUpper CharUpperA
+#define AnsiUpperBuff CharUpperBuffA
+#define AnsiLower CharLowerA
+#define AnsiLowerBuff CharLowerBuffA
+#define AnsiNext CharNextA
+#define AnsiPrev CharPrevA
+
+#ifndef NOLANGUAGE
+/*
+ * Language dependent Routines
+ */
+
+WINUSERAPI
+BOOL
+WINAPI
+IsCharAlphaA(
+ IN CHAR ch);
+WINUSERAPI
+BOOL
+WINAPI
+IsCharAlphaW(
+ IN WCHAR ch);
+#ifdef UNICODE
+#define IsCharAlpha IsCharAlphaW
+#else
+#define IsCharAlpha IsCharAlphaA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+IsCharAlphaNumericA(
+ IN CHAR ch);
+WINUSERAPI
+BOOL
+WINAPI
+IsCharAlphaNumericW(
+ IN WCHAR ch);
+#ifdef UNICODE
+#define IsCharAlphaNumeric IsCharAlphaNumericW
+#else
+#define IsCharAlphaNumeric IsCharAlphaNumericA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+IsCharUpperA(
+ IN CHAR ch);
+WINUSERAPI
+BOOL
+WINAPI
+IsCharUpperW(
+ IN WCHAR ch);
+#ifdef UNICODE
+#define IsCharUpper IsCharUpperW
+#else
+#define IsCharUpper IsCharUpperA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+IsCharLowerA(
+ IN CHAR ch);
+WINUSERAPI
+BOOL
+WINAPI
+IsCharLowerW(
+ IN WCHAR ch);
+#ifdef UNICODE
+#define IsCharLower IsCharLowerW
+#else
+#define IsCharLower IsCharLowerA
+#endif // !UNICODE
+
+#endif /* !NOLANGUAGE */
+
+WINUSERAPI
+HWND
+WINAPI
+SetFocus(
+ IN HWND hWnd);
+
+WINUSERAPI
+HWND
+WINAPI
+GetActiveWindow(
+ VOID);
+
+WINUSERAPI
+HWND
+WINAPI
+GetFocus(
+ VOID);
+
+WINUSERAPI
+UINT
+WINAPI
+GetKBCodePage(
+ VOID);
+
+WINUSERAPI
+SHORT
+WINAPI
+GetKeyState(
+ IN int nVirtKey);
+
+WINUSERAPI
+SHORT
+WINAPI
+GetAsyncKeyState(
+ IN int vKey);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetKeyboardState(
+ OUT PBYTE lpKeyState);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetKeyboardState(
+ IN LPBYTE lpKeyState);
+
+WINUSERAPI
+int
+WINAPI
+GetKeyNameTextA(
+ IN LONG lParam,
+ OUT LPSTR lpString,
+ IN int nSize
+ );
+WINUSERAPI
+int
+WINAPI
+GetKeyNameTextW(
+ IN LONG lParam,
+ OUT LPWSTR lpString,
+ IN int nSize
+ );
+#ifdef UNICODE
+#define GetKeyNameText GetKeyNameTextW
+#else
+#define GetKeyNameText GetKeyNameTextA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+GetKeyboardType(
+ IN int nTypeFlag);
+
+WINUSERAPI
+int
+WINAPI
+ToAscii(
+ IN UINT uVirtKey,
+ IN UINT uScanCode,
+ IN CONST BYTE *lpKeyState,
+ OUT LPWORD lpChar,
+ IN UINT uFlags);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+int
+WINAPI
+ToAsciiEx(
+ IN UINT uVirtKey,
+ IN UINT uScanCode,
+ IN CONST BYTE *lpKeyState,
+ OUT LPWORD lpChar,
+ IN UINT uFlags,
+ IN HKL dwhkl);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+int
+WINAPI
+ToUnicode(
+ IN UINT wVirtKey,
+ IN UINT wScanCode,
+ IN CONST BYTE *lpKeyState,
+ OUT LPWSTR pwszBuff,
+ IN int cchBuff,
+ IN UINT wFlags);
+
+WINUSERAPI
+DWORD
+WINAPI
+OemKeyScan(
+ IN WORD wOemChar);
+
+WINUSERAPI
+SHORT
+WINAPI
+VkKeyScanA(
+ IN CHAR ch);
+WINUSERAPI
+SHORT
+WINAPI
+VkKeyScanW(
+ IN WCHAR ch);
+#ifdef UNICODE
+#define VkKeyScan VkKeyScanW
+#else
+#define VkKeyScan VkKeyScanA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+SHORT
+WINAPI
+VkKeyScanExA(
+ IN CHAR ch,
+ IN HKL dwhkl);
+WINUSERAPI
+SHORT
+WINAPI
+VkKeyScanExW(
+ IN WCHAR ch,
+ IN HKL dwhkl);
+#ifdef UNICODE
+#define VkKeyScanEx VkKeyScanExW
+#else
+#define VkKeyScanEx VkKeyScanExA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0400 */
+#define KEYEVENTF_EXTENDEDKEY 0x0001
+#define KEYEVENTF_KEYUP 0x0002
+#if(_WIN32_WINNT >= 0x0500)
+#define KEYEVENTF_UNICODE 0x0004
+#define KEYEVENTF_SCANCODE 0x0008
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+WINUSERAPI
+VOID
+WINAPI
+keybd_event(
+ IN BYTE bVk,
+ IN BYTE bScan,
+ IN DWORD dwFlags,
+ IN ULONG_PTR dwExtraInfo);
+
+#define MOUSEEVENTF_MOVE 0x0001 /* mouse move */
+#define MOUSEEVENTF_LEFTDOWN 0x0002 /* left button down */
+#define MOUSEEVENTF_LEFTUP 0x0004 /* left button up */
+#define MOUSEEVENTF_RIGHTDOWN 0x0008 /* right button down */
+#define MOUSEEVENTF_RIGHTUP 0x0010 /* right button up */
+#define MOUSEEVENTF_MIDDLEDOWN 0x0020 /* middle button down */
+#define MOUSEEVENTF_MIDDLEUP 0x0040 /* middle button up */
+#define MOUSEEVENTF_XDOWN 0x0080 /* x button down */
+#define MOUSEEVENTF_XUP 0x0100 /* x button down */
+#define MOUSEEVENTF_WHEEL 0x0800 /* wheel button rolled */
+#define MOUSEEVENTF_VIRTUALDESK 0x4000 /* map to entire virtual desktop */
+#define MOUSEEVENTF_ABSOLUTE 0x8000 /* absolute move */
+
+
+
+WINUSERAPI
+VOID
+WINAPI
+mouse_event(
+ IN DWORD dwFlags,
+ IN DWORD dx,
+ IN DWORD dy,
+ IN DWORD dwData,
+ IN ULONG_PTR dwExtraInfo);
+
+#if (_WIN32_WINNT > 0x0400)
+
+typedef struct tagMOUSEINPUT {
+ LONG dx;
+ LONG dy;
+ DWORD mouseData;
+ DWORD dwFlags;
+ DWORD time;
+ ULONG_PTR dwExtraInfo;
+} MOUSEINPUT, *PMOUSEINPUT, FAR* LPMOUSEINPUT;
+
+typedef struct tagKEYBDINPUT {
+ WORD wVk;
+ WORD wScan;
+ DWORD dwFlags;
+ DWORD time;
+ ULONG_PTR dwExtraInfo;
+} KEYBDINPUT, *PKEYBDINPUT, FAR* LPKEYBDINPUT;
+
+typedef struct tagHARDWAREINPUT {
+ DWORD uMsg;
+ WORD wParamL;
+ WORD wParamH;
+} HARDWAREINPUT, *PHARDWAREINPUT, FAR* LPHARDWAREINPUT;
+
+#define INPUT_MOUSE 0
+#define INPUT_KEYBOARD 1
+#define INPUT_HARDWARE 2
+
+typedef struct tagINPUT {
+ DWORD type;
+
+ union
+ {
+ MOUSEINPUT mi;
+ KEYBDINPUT ki;
+ HARDWAREINPUT hi;
+ };
+} INPUT, *PINPUT, FAR* LPINPUT;
+
+WINUSERAPI
+UINT
+WINAPI
+SendInput(
+ IN UINT cInputs, // number of input in the array
+ IN LPINPUT pInputs, // array of inputs
+ IN int cbSize); // sizeof(INPUT)
+
+#endif // (_WIN32_WINNT > 0x0400)
+
+#if(_WIN32_WINNT >= 0x0500)
+typedef struct tagLASTINPUTINFO {
+ UINT cbSize;
+ DWORD dwTime;
+} LASTINPUTINFO, * PLASTINPUTINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetLastInputInfo(
+ OUT PLASTINPUTINFO plii);
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+WINUSERAPI
+UINT
+WINAPI
+MapVirtualKeyA(
+ IN UINT uCode,
+ IN UINT uMapType);
+WINUSERAPI
+UINT
+WINAPI
+MapVirtualKeyW(
+ IN UINT uCode,
+ IN UINT uMapType);
+#ifdef UNICODE
+#define MapVirtualKey MapVirtualKeyW
+#else
+#define MapVirtualKey MapVirtualKeyA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+UINT
+WINAPI
+MapVirtualKeyExA(
+ IN UINT uCode,
+ IN UINT uMapType,
+ IN HKL dwhkl);
+WINUSERAPI
+UINT
+WINAPI
+MapVirtualKeyExW(
+ IN UINT uCode,
+ IN UINT uMapType,
+ IN HKL dwhkl);
+#ifdef UNICODE
+#define MapVirtualKeyEx MapVirtualKeyExW
+#else
+#define MapVirtualKeyEx MapVirtualKeyExA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+GetInputState(
+ VOID);
+
+WINUSERAPI
+DWORD
+WINAPI
+GetQueueStatus(
+ IN UINT flags);
+
+
+WINUSERAPI
+HWND
+WINAPI
+GetCapture(
+ VOID);
+
+WINUSERAPI
+HWND
+WINAPI
+SetCapture(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+ReleaseCapture(
+ VOID);
+
+WINUSERAPI
+DWORD
+WINAPI
+MsgWaitForMultipleObjects(
+ IN DWORD nCount,
+ IN CONST HANDLE *pHandles,
+ IN BOOL fWaitAll,
+ IN DWORD dwMilliseconds,
+ IN DWORD dwWakeMask);
+
+WINUSERAPI
+DWORD
+WINAPI
+MsgWaitForMultipleObjectsEx(
+ IN DWORD nCount,
+ IN CONST HANDLE *pHandles,
+ IN DWORD dwMilliseconds,
+ IN DWORD dwWakeMask,
+ IN DWORD dwFlags);
+
+
+#define MWMO_WAITALL 0x0001
+#define MWMO_ALERTABLE 0x0002
+#define MWMO_INPUTAVAILABLE 0x0004
+
+/*
+ * Queue status flags for GetQueueStatus() and MsgWaitForMultipleObjects()
+ */
+#define QS_KEY 0x0001
+#define QS_MOUSEMOVE 0x0002
+#define QS_MOUSEBUTTON 0x0004
+#define QS_POSTMESSAGE 0x0008
+#define QS_TIMER 0x0010
+#define QS_PAINT 0x0020
+#define QS_SENDMESSAGE 0x0040
+#define QS_HOTKEY 0x0080
+#define QS_ALLPOSTMESSAGE 0x0100
+#if(_WIN32_WINNT >= 0x0501)
+#define QS_RAWINPUT 0x0400
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define QS_MOUSE (QS_MOUSEMOVE | \
+ QS_MOUSEBUTTON)
+
+#if (_WIN32_WINNT >= 0x0501)
+#define QS_INPUT (QS_MOUSE | \
+ QS_KEY | \
+ QS_RAWINPUT)
+#else
+#define QS_INPUT (QS_MOUSE | \
+ QS_KEY)
+#endif // (_WIN32_WINNT >= 0x0501)
+
+#define QS_ALLEVENTS (QS_INPUT | \
+ QS_POSTMESSAGE | \
+ QS_TIMER | \
+ QS_PAINT | \
+ QS_HOTKEY)
+
+#define QS_ALLINPUT (QS_INPUT | \
+ QS_POSTMESSAGE | \
+ QS_TIMER | \
+ QS_PAINT | \
+ QS_HOTKEY | \
+ QS_SENDMESSAGE)
+
+
+/*
+ * Windows Functions
+ */
+
+WINUSERAPI
+UINT_PTR
+WINAPI
+SetTimer(
+ IN HWND hWnd,
+ IN UINT_PTR nIDEvent,
+ IN UINT uElapse,
+ IN TIMERPROC lpTimerFunc);
+
+WINUSERAPI
+BOOL
+WINAPI
+KillTimer(
+ IN HWND hWnd,
+ IN UINT_PTR uIDEvent);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsWindowUnicode(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnableWindow(
+ IN HWND hWnd,
+ IN BOOL bEnable);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsWindowEnabled(
+ IN HWND hWnd);
+
+WINUSERAPI
+HACCEL
+WINAPI
+LoadAcceleratorsA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpTableName);
+WINUSERAPI
+HACCEL
+WINAPI
+LoadAcceleratorsW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpTableName);
+#ifdef UNICODE
+#define LoadAccelerators LoadAcceleratorsW
+#else
+#define LoadAccelerators LoadAcceleratorsA
+#endif // !UNICODE
+
+WINUSERAPI
+HACCEL
+WINAPI
+CreateAcceleratorTableA(
+ IN LPACCEL, IN int);
+WINUSERAPI
+HACCEL
+WINAPI
+CreateAcceleratorTableW(
+ IN LPACCEL, IN int);
+#ifdef UNICODE
+#define CreateAcceleratorTable CreateAcceleratorTableW
+#else
+#define CreateAcceleratorTable CreateAcceleratorTableA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyAcceleratorTable(
+ IN HACCEL hAccel);
+
+WINUSERAPI
+int
+WINAPI
+CopyAcceleratorTableA(
+ IN HACCEL hAccelSrc,
+ OUT LPACCEL lpAccelDst,
+ IN int cAccelEntries);
+WINUSERAPI
+int
+WINAPI
+CopyAcceleratorTableW(
+ IN HACCEL hAccelSrc,
+ OUT LPACCEL lpAccelDst,
+ IN int cAccelEntries);
+#ifdef UNICODE
+#define CopyAcceleratorTable CopyAcceleratorTableW
+#else
+#define CopyAcceleratorTable CopyAcceleratorTableA
+#endif // !UNICODE
+
+#ifndef NOMSG
+
+WINUSERAPI
+int
+WINAPI
+TranslateAcceleratorA(
+ IN HWND hWnd,
+ IN HACCEL hAccTable,
+ IN LPMSG lpMsg);
+WINUSERAPI
+int
+WINAPI
+TranslateAcceleratorW(
+ IN HWND hWnd,
+ IN HACCEL hAccTable,
+ IN LPMSG lpMsg);
+#ifdef UNICODE
+#define TranslateAccelerator TranslateAcceleratorW
+#else
+#define TranslateAccelerator TranslateAcceleratorA
+#endif // !UNICODE
+
+#endif /* !NOMSG */
+
+#ifndef NOSYSMETRICS
+
+/*
+ * GetSystemMetrics() codes
+ */
+
+#define SM_CXSCREEN 0
+#define SM_CYSCREEN 1
+#define SM_CXVSCROLL 2
+#define SM_CYHSCROLL 3
+#define SM_CYCAPTION 4
+#define SM_CXBORDER 5
+#define SM_CYBORDER 6
+#define SM_CXDLGFRAME 7
+#define SM_CYDLGFRAME 8
+#define SM_CYVTHUMB 9
+#define SM_CXHTHUMB 10
+#define SM_CXICON 11
+#define SM_CYICON 12
+#define SM_CXCURSOR 13
+#define SM_CYCURSOR 14
+#define SM_CYMENU 15
+#define SM_CXFULLSCREEN 16
+#define SM_CYFULLSCREEN 17
+#define SM_CYKANJIWINDOW 18
+#define SM_MOUSEPRESENT 19
+#define SM_CYVSCROLL 20
+#define SM_CXHSCROLL 21
+#define SM_DEBUG 22
+#define SM_SWAPBUTTON 23
+#define SM_RESERVED1 24
+#define SM_RESERVED2 25
+#define SM_RESERVED3 26
+#define SM_RESERVED4 27
+#define SM_CXMIN 28
+#define SM_CYMIN 29
+#define SM_CXSIZE 30
+#define SM_CYSIZE 31
+#define SM_CXFRAME 32
+#define SM_CYFRAME 33
+#define SM_CXMINTRACK 34
+#define SM_CYMINTRACK 35
+#define SM_CXDOUBLECLK 36
+#define SM_CYDOUBLECLK 37
+#define SM_CXICONSPACING 38
+#define SM_CYICONSPACING 39
+#define SM_MENUDROPALIGNMENT 40
+#define SM_PENWINDOWS 41
+#define SM_DBCSENABLED 42
+#define SM_CMOUSEBUTTONS 43
+
+#if(WINVER >= 0x0400)
+#define SM_CXFIXEDFRAME SM_CXDLGFRAME /* ;win40 name change */
+#define SM_CYFIXEDFRAME SM_CYDLGFRAME /* ;win40 name change */
+#define SM_CXSIZEFRAME SM_CXFRAME /* ;win40 name change */
+#define SM_CYSIZEFRAME SM_CYFRAME /* ;win40 name change */
+
+#define SM_SECURE 44
+#define SM_CXEDGE 45
+#define SM_CYEDGE 46
+#define SM_CXMINSPACING 47
+#define SM_CYMINSPACING 48
+#define SM_CXSMICON 49
+#define SM_CYSMICON 50
+#define SM_CYSMCAPTION 51
+#define SM_CXSMSIZE 52
+#define SM_CYSMSIZE 53
+#define SM_CXMENUSIZE 54
+#define SM_CYMENUSIZE 55
+#define SM_ARRANGE 56
+#define SM_CXMINIMIZED 57
+#define SM_CYMINIMIZED 58
+#define SM_CXMAXTRACK 59
+#define SM_CYMAXTRACK 60
+#define SM_CXMAXIMIZED 61
+#define SM_CYMAXIMIZED 62
+#define SM_NETWORK 63
+#define SM_CLEANBOOT 67
+#define SM_CXDRAG 68
+#define SM_CYDRAG 69
+#endif /* WINVER >= 0x0400 */
+#define SM_SHOWSOUNDS 70
+#if(WINVER >= 0x0400)
+#define SM_CXMENUCHECK 71 /* Use instead of GetMenuCheckMarkDimensions()! */
+#define SM_CYMENUCHECK 72
+#define SM_SLOWMACHINE 73
+#define SM_MIDEASTENABLED 74
+#endif /* WINVER >= 0x0400 */
+
+#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
+#define SM_MOUSEWHEELPRESENT 75
+#endif
+#if(WINVER >= 0x0500)
+#define SM_XVIRTUALSCREEN 76
+#define SM_YVIRTUALSCREEN 77
+#define SM_CXVIRTUALSCREEN 78
+#define SM_CYVIRTUALSCREEN 79
+#define SM_CMONITORS 80
+#define SM_SAMEDISPLAYFORMAT 81
+#endif /* WINVER >= 0x0500 */
+#if(_WIN32_WINNT >= 0x0500)
+#define SM_IMMENABLED 82
+#endif /* _WIN32_WINNT >= 0x0500 */
+#if(_WIN32_WINNT >= 0x0501)
+#define SM_CXFOCUSBORDER 83
+#define SM_CYFOCUSBORDER 84
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define SM_TABLETPC 86
+#define SM_MEDIACENTER 87
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if (WINVER < 0x0500) && (!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400))
+#define SM_CMETRICS 76
+#elif WINVER == 0x500
+#define SM_CMETRICS 83
+#else
+#define SM_CMETRICS 88
+#endif
+
+#if(WINVER >= 0x0500)
+#define SM_REMOTESESSION 0x1000
+
+
+#if(_WIN32_WINNT >= 0x0501)
+#define SM_SHUTTINGDOWN 0x2000
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(WINVER >= 0x0501)
+#define SM_REMOTECONTROL 0x2001
+#endif /* WINVER >= 0x0501 */
+
+#endif /* WINVER >= 0x0500 */
+
+
+WINUSERAPI
+int
+WINAPI
+GetSystemMetrics(
+ IN int nIndex);
+
+
+#endif /* !NOSYSMETRICS */
+
+#ifndef NOMENUS
+
+WINUSERAPI
+HMENU
+WINAPI
+LoadMenuA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpMenuName);
+WINUSERAPI
+HMENU
+WINAPI
+LoadMenuW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpMenuName);
+#ifdef UNICODE
+#define LoadMenu LoadMenuW
+#else
+#define LoadMenu LoadMenuA
+#endif // !UNICODE
+
+WINUSERAPI
+HMENU
+WINAPI
+LoadMenuIndirectA(
+ IN CONST MENUTEMPLATEA *lpMenuTemplate);
+WINUSERAPI
+HMENU
+WINAPI
+LoadMenuIndirectW(
+ IN CONST MENUTEMPLATEW *lpMenuTemplate);
+#ifdef UNICODE
+#define LoadMenuIndirect LoadMenuIndirectW
+#else
+#define LoadMenuIndirect LoadMenuIndirectA
+#endif // !UNICODE
+
+WINUSERAPI
+HMENU
+WINAPI
+GetMenu(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMenu(
+ IN HWND hWnd,
+ IN HMENU hMenu);
+
+WINUSERAPI
+BOOL
+WINAPI
+ChangeMenuA(
+ IN HMENU hMenu,
+ IN UINT cmd,
+ IN LPCSTR lpszNewItem,
+ IN UINT cmdInsert,
+ IN UINT flags);
+WINUSERAPI
+BOOL
+WINAPI
+ChangeMenuW(
+ IN HMENU hMenu,
+ IN UINT cmd,
+ IN LPCWSTR lpszNewItem,
+ IN UINT cmdInsert,
+ IN UINT flags);
+#ifdef UNICODE
+#define ChangeMenu ChangeMenuW
+#else
+#define ChangeMenu ChangeMenuA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+HiliteMenuItem(
+ IN HWND hWnd,
+ IN HMENU hMenu,
+ IN UINT uIDHiliteItem,
+ IN UINT uHilite);
+
+WINUSERAPI
+int
+WINAPI
+GetMenuStringA(
+ IN HMENU hMenu,
+ IN UINT uIDItem,
+ OUT LPSTR lpString,
+ IN int nMaxCount,
+ IN UINT uFlag);
+WINUSERAPI
+int
+WINAPI
+GetMenuStringW(
+ IN HMENU hMenu,
+ IN UINT uIDItem,
+ OUT LPWSTR lpString,
+ IN int nMaxCount,
+ IN UINT uFlag);
+#ifdef UNICODE
+#define GetMenuString GetMenuStringW
+#else
+#define GetMenuString GetMenuStringA
+#endif // !UNICODE
+
+WINUSERAPI
+UINT
+WINAPI
+GetMenuState(
+ IN HMENU hMenu,
+ IN UINT uId,
+ IN UINT uFlags);
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawMenuBar(
+ IN HWND hWnd);
+
+#if(_WIN32_WINNT >= 0x0501)
+#define PMB_ACTIVE 0x00000001
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+
+WINUSERAPI
+HMENU
+WINAPI
+GetSystemMenu(
+ IN HWND hWnd,
+ IN BOOL bRevert);
+
+
+WINUSERAPI
+HMENU
+WINAPI
+CreateMenu(
+ VOID);
+
+WINUSERAPI
+HMENU
+WINAPI
+CreatePopupMenu(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyMenu(
+ IN HMENU hMenu);
+
+WINUSERAPI
+DWORD
+WINAPI
+CheckMenuItem(
+ IN HMENU hMenu,
+ IN UINT uIDCheckItem,
+ IN UINT uCheck);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnableMenuItem(
+ IN HMENU hMenu,
+ IN UINT uIDEnableItem,
+ IN UINT uEnable);
+
+WINUSERAPI
+HMENU
+WINAPI
+GetSubMenu(
+ IN HMENU hMenu,
+ IN int nPos);
+
+WINUSERAPI
+UINT
+WINAPI
+GetMenuItemID(
+ IN HMENU hMenu,
+ IN int nPos);
+
+WINUSERAPI
+int
+WINAPI
+GetMenuItemCount(
+ IN HMENU hMenu);
+
+WINUSERAPI
+BOOL
+WINAPI
+InsertMenuA(
+ IN HMENU hMenu,
+ IN UINT uPosition,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCSTR lpNewItem
+ );
+WINUSERAPI
+BOOL
+WINAPI
+InsertMenuW(
+ IN HMENU hMenu,
+ IN UINT uPosition,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCWSTR lpNewItem
+ );
+#ifdef UNICODE
+#define InsertMenu InsertMenuW
+#else
+#define InsertMenu InsertMenuA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+AppendMenuA(
+ IN HMENU hMenu,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCSTR lpNewItem
+ );
+WINUSERAPI
+BOOL
+WINAPI
+AppendMenuW(
+ IN HMENU hMenu,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCWSTR lpNewItem
+ );
+#ifdef UNICODE
+#define AppendMenu AppendMenuW
+#else
+#define AppendMenu AppendMenuA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+ModifyMenuA(
+ IN HMENU hMnu,
+ IN UINT uPosition,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCSTR lpNewItem
+ );
+WINUSERAPI
+BOOL
+WINAPI
+ModifyMenuW(
+ IN HMENU hMnu,
+ IN UINT uPosition,
+ IN UINT uFlags,
+ IN UINT_PTR uIDNewItem,
+ IN LPCWSTR lpNewItem
+ );
+#ifdef UNICODE
+#define ModifyMenu ModifyMenuW
+#else
+#define ModifyMenu ModifyMenuA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI RemoveMenu(
+ IN HMENU hMenu,
+ IN UINT uPosition,
+ IN UINT uFlags);
+
+WINUSERAPI
+BOOL
+WINAPI
+DeleteMenu(
+ IN HMENU hMenu,
+ IN UINT uPosition,
+ IN UINT uFlags);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMenuItemBitmaps(
+ IN HMENU hMenu,
+ IN UINT uPosition,
+ IN UINT uFlags,
+ IN HBITMAP hBitmapUnchecked,
+ IN HBITMAP hBitmapChecked);
+
+WINUSERAPI
+LONG
+WINAPI
+GetMenuCheckMarkDimensions(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+TrackPopupMenu(
+ IN HMENU hMenu,
+ IN UINT uFlags,
+ IN int x,
+ IN int y,
+ IN int nReserved,
+ IN HWND hWnd,
+ IN CONST RECT *prcRect);
+
+#if(WINVER >= 0x0400)
+/* return codes for WM_MENUCHAR */
+#define MNC_IGNORE 0
+#define MNC_CLOSE 1
+#define MNC_EXECUTE 2
+#define MNC_SELECT 3
+
+typedef struct tagTPMPARAMS
+{
+ UINT cbSize; /* Size of structure */
+ RECT rcExclude; /* Screen coordinates of rectangle to exclude when positioning */
+} TPMPARAMS;
+typedef TPMPARAMS FAR *LPTPMPARAMS;
+
+WINUSERAPI
+BOOL
+WINAPI
+TrackPopupMenuEx(
+ IN HMENU,
+ IN UINT,
+ IN int,
+ IN int,
+ IN HWND,
+ IN LPTPMPARAMS);
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+
+#define MNS_NOCHECK 0x80000000
+#define MNS_MODELESS 0x40000000
+#define MNS_DRAGDROP 0x20000000
+#define MNS_AUTODISMISS 0x10000000
+#define MNS_NOTIFYBYPOS 0x08000000
+#define MNS_CHECKORBMP 0x04000000
+
+#define MIM_MAXHEIGHT 0x00000001
+#define MIM_BACKGROUND 0x00000002
+#define MIM_HELPID 0x00000004
+#define MIM_MENUDATA 0x00000008
+#define MIM_STYLE 0x00000010
+#define MIM_APPLYTOSUBMENUS 0x80000000
+
+typedef struct tagMENUINFO
+{
+ DWORD cbSize;
+ DWORD fMask;
+ DWORD dwStyle;
+ UINT cyMax;
+ HBRUSH hbrBack;
+ DWORD dwContextHelpID;
+ ULONG_PTR dwMenuData;
+} MENUINFO, FAR *LPMENUINFO;
+typedef MENUINFO CONST FAR *LPCMENUINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetMenuInfo(
+ IN HMENU,
+ OUT LPMENUINFO);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMenuInfo(
+ IN HMENU,
+ IN LPCMENUINFO);
+
+WINUSERAPI
+BOOL
+WINAPI
+EndMenu(
+ VOID);
+
+/*
+ * WM_MENUDRAG return values.
+ */
+#define MND_CONTINUE 0
+#define MND_ENDMENU 1
+
+typedef struct tagMENUGETOBJECTINFO
+{
+ DWORD dwFlags;
+ UINT uPos;
+ HMENU hmenu;
+ PVOID riid;
+ PVOID pvObj;
+} MENUGETOBJECTINFO, * PMENUGETOBJECTINFO;
+
+/*
+ * MENUGETOBJECTINFO dwFlags values
+ */
+#define MNGOF_TOPGAP 0x00000001
+#define MNGOF_BOTTOMGAP 0x00000002
+
+/*
+ * WM_MENUGETOBJECT return values
+ */
+#define MNGO_NOINTERFACE 0x00000000
+#define MNGO_NOERROR 0x00000001
+#endif /* WINVER >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+#define MIIM_STATE 0x00000001
+#define MIIM_ID 0x00000002
+#define MIIM_SUBMENU 0x00000004
+#define MIIM_CHECKMARKS 0x00000008
+#define MIIM_TYPE 0x00000010
+#define MIIM_DATA 0x00000020
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+#define MIIM_STRING 0x00000040
+#define MIIM_BITMAP 0x00000080
+#define MIIM_FTYPE 0x00000100
+
+#define HBMMENU_CALLBACK ((HBITMAP) -1)
+#define HBMMENU_SYSTEM ((HBITMAP) 1)
+#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2)
+#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3)
+#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5)
+#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6)
+#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7)
+#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8)
+#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9)
+#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10)
+#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11)
+#endif /* WINVER >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+typedef struct tagMENUITEMINFOA
+{
+ UINT cbSize;
+ UINT fMask;
+ UINT fType; // used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0)
+ UINT fState; // used if MIIM_STATE
+ UINT wID; // used if MIIM_ID
+ HMENU hSubMenu; // used if MIIM_SUBMENU
+ HBITMAP hbmpChecked; // used if MIIM_CHECKMARKS
+ HBITMAP hbmpUnchecked; // used if MIIM_CHECKMARKS
+ ULONG_PTR dwItemData; // used if MIIM_DATA
+ LPSTR dwTypeData; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
+ UINT cch; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
+#if(WINVER >= 0x0500)
+ HBITMAP hbmpItem; // used if MIIM_BITMAP
+#endif /* WINVER >= 0x0500 */
+} MENUITEMINFOA, FAR *LPMENUITEMINFOA;
+typedef struct tagMENUITEMINFOW
+{
+ UINT cbSize;
+ UINT fMask;
+ UINT fType; // used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0)
+ UINT fState; // used if MIIM_STATE
+ UINT wID; // used if MIIM_ID
+ HMENU hSubMenu; // used if MIIM_SUBMENU
+ HBITMAP hbmpChecked; // used if MIIM_CHECKMARKS
+ HBITMAP hbmpUnchecked; // used if MIIM_CHECKMARKS
+ ULONG_PTR dwItemData; // used if MIIM_DATA
+ LPWSTR dwTypeData; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
+ UINT cch; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
+#if(WINVER >= 0x0500)
+ HBITMAP hbmpItem; // used if MIIM_BITMAP
+#endif /* WINVER >= 0x0500 */
+} MENUITEMINFOW, FAR *LPMENUITEMINFOW;
+#ifdef UNICODE
+typedef MENUITEMINFOW MENUITEMINFO;
+typedef LPMENUITEMINFOW LPMENUITEMINFO;
+#else
+typedef MENUITEMINFOA MENUITEMINFO;
+typedef LPMENUITEMINFOA LPMENUITEMINFO;
+#endif // UNICODE
+typedef MENUITEMINFOA CONST FAR *LPCMENUITEMINFOA;
+typedef MENUITEMINFOW CONST FAR *LPCMENUITEMINFOW;
+#ifdef UNICODE
+typedef LPCMENUITEMINFOW LPCMENUITEMINFO;
+#else
+typedef LPCMENUITEMINFOA LPCMENUITEMINFO;
+#endif // UNICODE
+
+
+WINUSERAPI
+BOOL
+WINAPI
+InsertMenuItemA(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN LPCMENUITEMINFOA
+ );
+WINUSERAPI
+BOOL
+WINAPI
+InsertMenuItemW(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN LPCMENUITEMINFOW
+ );
+#ifdef UNICODE
+#define InsertMenuItem InsertMenuItemW
+#else
+#define InsertMenuItem InsertMenuItemA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+GetMenuItemInfoA(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN OUT LPMENUITEMINFOA
+ );
+WINUSERAPI
+BOOL
+WINAPI
+GetMenuItemInfoW(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN OUT LPMENUITEMINFOW
+ );
+#ifdef UNICODE
+#define GetMenuItemInfo GetMenuItemInfoW
+#else
+#define GetMenuItemInfo GetMenuItemInfoA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMenuItemInfoA(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN LPCMENUITEMINFOA
+ );
+WINUSERAPI
+BOOL
+WINAPI
+SetMenuItemInfoW(
+ IN HMENU,
+ IN UINT,
+ IN BOOL,
+ IN LPCMENUITEMINFOW
+ );
+#ifdef UNICODE
+#define SetMenuItemInfo SetMenuItemInfoW
+#else
+#define SetMenuItemInfo SetMenuItemInfoA
+#endif // !UNICODE
+
+
+#define GMDI_USEDISABLED 0x0001L
+#define GMDI_GOINTOPOPUPS 0x0002L
+
+WINUSERAPI UINT WINAPI GetMenuDefaultItem( IN HMENU hMenu, IN UINT fByPos, IN UINT gmdiFlags);
+WINUSERAPI BOOL WINAPI SetMenuDefaultItem( IN HMENU hMenu, IN UINT uItem, IN UINT fByPos);
+
+WINUSERAPI BOOL WINAPI GetMenuItemRect( IN HWND hWnd, IN HMENU hMenu, IN UINT uItem, OUT LPRECT lprcItem);
+WINUSERAPI int WINAPI MenuItemFromPoint( IN HWND hWnd, IN HMENU hMenu, IN POINT ptScreen);
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Flags for TrackPopupMenu
+ */
+#define TPM_LEFTBUTTON 0x0000L
+#define TPM_RIGHTBUTTON 0x0002L
+#define TPM_LEFTALIGN 0x0000L
+#define TPM_CENTERALIGN 0x0004L
+#define TPM_RIGHTALIGN 0x0008L
+#if(WINVER >= 0x0400)
+#define TPM_TOPALIGN 0x0000L
+#define TPM_VCENTERALIGN 0x0010L
+#define TPM_BOTTOMALIGN 0x0020L
+
+#define TPM_HORIZONTAL 0x0000L /* Horz alignment matters more */
+#define TPM_VERTICAL 0x0040L /* Vert alignment matters more */
+#define TPM_NONOTIFY 0x0080L /* Don't send any notification msgs */
+#define TPM_RETURNCMD 0x0100L
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0500)
+#define TPM_RECURSE 0x0001L
+#define TPM_HORPOSANIMATION 0x0400L
+#define TPM_HORNEGANIMATION 0x0800L
+#define TPM_VERPOSANIMATION 0x1000L
+#define TPM_VERNEGANIMATION 0x2000L
+#if(_WIN32_WINNT >= 0x0500)
+#define TPM_NOANIMATION 0x4000L
+#endif /* _WIN32_WINNT >= 0x0500 */
+#if(_WIN32_WINNT >= 0x0501)
+#define TPM_LAYOUTRTL 0x8000L
+#endif /* _WIN32_WINNT >= 0x0501 */
+#endif /* WINVER >= 0x0500 */
+
+
+#endif /* !NOMENUS */
+
+
+#if(WINVER >= 0x0400)
+//
+// Drag-and-drop support
+// Obsolete - use OLE instead
+//
+typedef struct tagDROPSTRUCT
+{
+ HWND hwndSource;
+ HWND hwndSink;
+ DWORD wFmt;
+ ULONG_PTR dwData;
+ POINT ptDrop;
+ DWORD dwControlData;
+} DROPSTRUCT, *PDROPSTRUCT, *LPDROPSTRUCT;
+
+#define DOF_EXECUTABLE 0x8001 // wFmt flags
+#define DOF_DOCUMENT 0x8002
+#define DOF_DIRECTORY 0x8003
+#define DOF_MULTIPLE 0x8004
+#define DOF_PROGMAN 0x0001
+#define DOF_SHELLDATA 0x0002
+
+#define DO_DROPFILE 0x454C4946L
+#define DO_PRINTFILE 0x544E5250L
+
+WINUSERAPI
+DWORD
+WINAPI
+DragObject(
+ IN HWND,
+ IN HWND,
+ IN UINT,
+ IN ULONG_PTR,
+ IN HCURSOR);
+
+WINUSERAPI
+BOOL
+WINAPI
+DragDetect(
+ IN HWND,
+ IN POINT);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawIcon(
+ IN HDC hDC,
+ IN int X,
+ IN int Y,
+ IN HICON hIcon);
+
+#ifndef NODRAWTEXT
+
+/*
+ * DrawText() Format Flags
+ */
+#define DT_TOP 0x00000000
+#define DT_LEFT 0x00000000
+#define DT_CENTER 0x00000001
+#define DT_RIGHT 0x00000002
+#define DT_VCENTER 0x00000004
+#define DT_BOTTOM 0x00000008
+#define DT_WORDBREAK 0x00000010
+#define DT_SINGLELINE 0x00000020
+#define DT_EXPANDTABS 0x00000040
+#define DT_TABSTOP 0x00000080
+#define DT_NOCLIP 0x00000100
+#define DT_EXTERNALLEADING 0x00000200
+#define DT_CALCRECT 0x00000400
+#define DT_NOPREFIX 0x00000800
+#define DT_INTERNAL 0x00001000
+
+#if(WINVER >= 0x0400)
+#define DT_EDITCONTROL 0x00002000
+#define DT_PATH_ELLIPSIS 0x00004000
+#define DT_END_ELLIPSIS 0x00008000
+#define DT_MODIFYSTRING 0x00010000
+#define DT_RTLREADING 0x00020000
+#define DT_WORD_ELLIPSIS 0x00040000
+#if(WINVER >= 0x0500)
+#define DT_NOFULLWIDTHCHARBREAK 0x00080000
+#if(_WIN32_WINNT >= 0x0500)
+#define DT_HIDEPREFIX 0x00100000
+#define DT_PREFIXONLY 0x00200000
+#endif /* _WIN32_WINNT >= 0x0500 */
+#endif /* WINVER >= 0x0500 */
+
+typedef struct tagDRAWTEXTPARAMS
+{
+ UINT cbSize;
+ int iTabLength;
+ int iLeftMargin;
+ int iRightMargin;
+ UINT uiLengthDrawn;
+} DRAWTEXTPARAMS, FAR *LPDRAWTEXTPARAMS;
+#endif /* WINVER >= 0x0400 */
+
+
+WINUSERAPI
+int
+WINAPI
+DrawTextA(
+ IN HDC hDC,
+ IN LPCSTR lpString,
+ IN int nCount,
+ IN OUT LPRECT lpRect,
+ IN UINT uFormat);
+WINUSERAPI
+int
+WINAPI
+DrawTextW(
+ IN HDC hDC,
+ IN LPCWSTR lpString,
+ IN int nCount,
+ IN OUT LPRECT lpRect,
+ IN UINT uFormat);
+#ifdef UNICODE
+#define DrawText DrawTextW
+#else
+#define DrawText DrawTextA
+#endif // !UNICODE
+
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+int
+WINAPI
+DrawTextExA(
+ IN HDC,
+ IN OUT LPSTR,
+ IN int,
+ IN OUT LPRECT,
+ IN UINT,
+ IN LPDRAWTEXTPARAMS);
+WINUSERAPI
+int
+WINAPI
+DrawTextExW(
+ IN HDC,
+ IN OUT LPWSTR,
+ IN int,
+ IN OUT LPRECT,
+ IN UINT,
+ IN LPDRAWTEXTPARAMS);
+#ifdef UNICODE
+#define DrawTextEx DrawTextExW
+#else
+#define DrawTextEx DrawTextExA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0400 */
+
+#endif /* !NODRAWTEXT */
+
+WINUSERAPI
+BOOL
+WINAPI
+GrayStringA(
+ IN HDC hDC,
+ IN HBRUSH hBrush,
+ IN GRAYSTRINGPROC lpOutputFunc,
+ IN LPARAM lpData,
+ IN int nCount,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight);
+WINUSERAPI
+BOOL
+WINAPI
+GrayStringW(
+ IN HDC hDC,
+ IN HBRUSH hBrush,
+ IN GRAYSTRINGPROC lpOutputFunc,
+ IN LPARAM lpData,
+ IN int nCount,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight);
+#ifdef UNICODE
+#define GrayString GrayStringW
+#else
+#define GrayString GrayStringA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+/* Monolithic state-drawing routine */
+/* Image type */
+#define DST_COMPLEX 0x0000
+#define DST_TEXT 0x0001
+#define DST_PREFIXTEXT 0x0002
+#define DST_ICON 0x0003
+#define DST_BITMAP 0x0004
+
+/* State type */
+#define DSS_NORMAL 0x0000
+#define DSS_UNION 0x0010 /* Gray string appearance */
+#define DSS_DISABLED 0x0020
+#define DSS_MONO 0x0080
+#if(_WIN32_WINNT >= 0x0500)
+#define DSS_HIDEPREFIX 0x0200
+#define DSS_PREFIXONLY 0x0400
+#endif /* _WIN32_WINNT >= 0x0500 */
+#define DSS_RIGHT 0x8000
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawStateA(
+ IN HDC,
+ IN HBRUSH,
+ IN DRAWSTATEPROC,
+ IN LPARAM,
+ IN WPARAM,
+ IN int,
+ IN int,
+ IN int,
+ IN int,
+ IN UINT);
+WINUSERAPI
+BOOL
+WINAPI
+DrawStateW(
+ IN HDC,
+ IN HBRUSH,
+ IN DRAWSTATEPROC,
+ IN LPARAM,
+ IN WPARAM,
+ IN int,
+ IN int,
+ IN int,
+ IN int,
+ IN UINT);
+#ifdef UNICODE
+#define DrawState DrawStateW
+#else
+#define DrawState DrawStateA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+LONG
+WINAPI
+TabbedTextOutA(
+ IN HDC hDC,
+ IN int X,
+ IN int Y,
+ IN LPCSTR lpString,
+ IN int nCount,
+ IN int nTabPositions,
+ IN CONST INT *lpnTabStopPositions,
+ IN int nTabOrigin);
+WINUSERAPI
+LONG
+WINAPI
+TabbedTextOutW(
+ IN HDC hDC,
+ IN int X,
+ IN int Y,
+ IN LPCWSTR lpString,
+ IN int nCount,
+ IN int nTabPositions,
+ IN CONST INT *lpnTabStopPositions,
+ IN int nTabOrigin);
+#ifdef UNICODE
+#define TabbedTextOut TabbedTextOutW
+#else
+#define TabbedTextOut TabbedTextOutA
+#endif // !UNICODE
+
+WINUSERAPI
+DWORD
+WINAPI
+GetTabbedTextExtentA(
+ IN HDC hDC,
+ IN LPCSTR lpString,
+ IN int nCount,
+ IN int nTabPositions,
+ IN CONST INT *lpnTabStopPositions);
+WINUSERAPI
+DWORD
+WINAPI
+GetTabbedTextExtentW(
+ IN HDC hDC,
+ IN LPCWSTR lpString,
+ IN int nCount,
+ IN int nTabPositions,
+ IN CONST INT *lpnTabStopPositions);
+#ifdef UNICODE
+#define GetTabbedTextExtent GetTabbedTextExtentW
+#else
+#define GetTabbedTextExtent GetTabbedTextExtentA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+UpdateWindow(
+ IN HWND hWnd);
+
+WINUSERAPI
+HWND
+WINAPI
+SetActiveWindow(
+ IN HWND hWnd);
+
+WINUSERAPI
+HWND
+WINAPI
+GetForegroundWindow(
+ VOID);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+BOOL
+WINAPI
+PaintDesktop(
+ IN HDC hdc);
+
+WINUSERAPI
+VOID
+WINAPI
+SwitchToThisWindow(
+ IN HWND hwnd,
+ IN BOOL fUnknown);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+SetForegroundWindow(
+ IN HWND hWnd);
+
+#if(_WIN32_WINNT >= 0x0500)
+WINUSERAPI
+BOOL
+WINAPI
+AllowSetForegroundWindow(
+ DWORD dwProcessId);
+
+#define ASFW_ANY ((DWORD)-1)
+
+WINUSERAPI
+BOOL
+WINAPI
+LockSetForegroundWindow(
+ UINT uLockCode);
+
+#define LSFW_LOCK 1
+#define LSFW_UNLOCK 2
+
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+WINUSERAPI
+HWND
+WINAPI
+WindowFromDC(
+ IN HDC hDC);
+
+WINUSERAPI
+HDC
+WINAPI
+GetDC(
+ IN HWND hWnd);
+
+WINUSERAPI
+HDC
+WINAPI
+GetDCEx(
+ IN HWND hWnd,
+ IN HRGN hrgnClip,
+ IN DWORD flags);
+
+/*
+ * GetDCEx() flags
+ */
+#define DCX_WINDOW 0x00000001L
+#define DCX_CACHE 0x00000002L
+#define DCX_NORESETATTRS 0x00000004L
+#define DCX_CLIPCHILDREN 0x00000008L
+#define DCX_CLIPSIBLINGS 0x00000010L
+#define DCX_PARENTCLIP 0x00000020L
+#define DCX_EXCLUDERGN 0x00000040L
+#define DCX_INTERSECTRGN 0x00000080L
+#define DCX_EXCLUDEUPDATE 0x00000100L
+#define DCX_INTERSECTUPDATE 0x00000200L
+#define DCX_LOCKWINDOWUPDATE 0x00000400L
+
+#define DCX_VALIDATE 0x00200000L
+
+WINUSERAPI
+HDC
+WINAPI
+GetWindowDC(
+ IN HWND hWnd);
+
+WINUSERAPI
+int
+WINAPI
+ReleaseDC(
+ IN HWND hWnd,
+ IN HDC hDC);
+
+WINUSERAPI
+HDC
+WINAPI
+BeginPaint(
+ IN HWND hWnd,
+ OUT LPPAINTSTRUCT lpPaint);
+
+WINUSERAPI
+BOOL
+WINAPI
+EndPaint(
+ IN HWND hWnd,
+ IN CONST PAINTSTRUCT *lpPaint);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetUpdateRect(
+ IN HWND hWnd,
+ OUT LPRECT lpRect,
+ IN BOOL bErase);
+
+WINUSERAPI
+int
+WINAPI
+GetUpdateRgn(
+ IN HWND hWnd,
+ IN HRGN hRgn,
+ IN BOOL bErase);
+
+WINUSERAPI
+int
+WINAPI
+SetWindowRgn(
+ IN HWND hWnd,
+ IN HRGN hRgn,
+ IN BOOL bRedraw);
+
+
+WINUSERAPI
+int
+WINAPI
+GetWindowRgn(
+ IN HWND hWnd,
+ IN HRGN hRgn);
+
+#if(_WIN32_WINNT >= 0x0501)
+
+WINUSERAPI
+int
+WINAPI
+GetWindowRgnBox(
+ IN HWND hWnd,
+ OUT LPRECT lprc);
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+int
+WINAPI
+ExcludeUpdateRgn(
+ IN HDC hDC,
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+InvalidateRect(
+ IN HWND hWnd,
+ IN CONST RECT *lpRect,
+ IN BOOL bErase);
+
+WINUSERAPI
+BOOL
+WINAPI
+ValidateRect(
+ IN HWND hWnd,
+ IN CONST RECT *lpRect);
+
+WINUSERAPI
+BOOL
+WINAPI
+InvalidateRgn(
+ IN HWND hWnd,
+ IN HRGN hRgn,
+ IN BOOL bErase);
+
+WINUSERAPI
+BOOL
+WINAPI
+ValidateRgn(
+ IN HWND hWnd,
+ IN HRGN hRgn);
+
+
+WINUSERAPI
+BOOL
+WINAPI
+RedrawWindow(
+ IN HWND hWnd,
+ IN CONST RECT *lprcUpdate,
+ IN HRGN hrgnUpdate,
+ IN UINT flags);
+
+/*
+ * RedrawWindow() flags
+ */
+#define RDW_INVALIDATE 0x0001
+#define RDW_INTERNALPAINT 0x0002
+#define RDW_ERASE 0x0004
+
+#define RDW_VALIDATE 0x0008
+#define RDW_NOINTERNALPAINT 0x0010
+#define RDW_NOERASE 0x0020
+
+#define RDW_NOCHILDREN 0x0040
+#define RDW_ALLCHILDREN 0x0080
+
+#define RDW_UPDATENOW 0x0100
+#define RDW_ERASENOW 0x0200
+
+#define RDW_FRAME 0x0400
+#define RDW_NOFRAME 0x0800
+
+
+/*
+ * LockWindowUpdate API
+ */
+
+WINUSERAPI
+BOOL
+WINAPI
+LockWindowUpdate(
+ IN HWND hWndLock);
+
+WINUSERAPI
+BOOL
+WINAPI
+ScrollWindow(
+ IN HWND hWnd,
+ IN int XAmount,
+ IN int YAmount,
+ IN CONST RECT *lpRect,
+ IN CONST RECT *lpClipRect);
+
+WINUSERAPI
+BOOL
+WINAPI
+ScrollDC(
+ IN HDC hDC,
+ IN int dx,
+ IN int dy,
+ IN CONST RECT *lprcScroll,
+ IN CONST RECT *lprcClip,
+ IN HRGN hrgnUpdate,
+ OUT LPRECT lprcUpdate);
+
+WINUSERAPI
+int
+WINAPI
+ScrollWindowEx(
+ IN HWND hWnd,
+ IN int dx,
+ IN int dy,
+ IN CONST RECT *prcScroll,
+ IN CONST RECT *prcClip,
+ IN HRGN hrgnUpdate,
+ OUT LPRECT prcUpdate,
+ IN UINT flags);
+
+#define SW_SCROLLCHILDREN 0x0001 /* Scroll children within *lprcScroll. */
+#define SW_INVALIDATE 0x0002 /* Invalidate after scrolling */
+#define SW_ERASE 0x0004 /* If SW_INVALIDATE, don't send WM_ERASEBACKGROUND */
+#if(WINVER >= 0x0500)
+#define SW_SMOOTHSCROLL 0x0010 /* Use smooth scrolling */
+#endif /* WINVER >= 0x0500 */
+
+#ifndef NOSCROLL
+
+WINUSERAPI
+int
+WINAPI
+SetScrollPos(
+ IN HWND hWnd,
+ IN int nBar,
+ IN int nPos,
+ IN BOOL bRedraw);
+
+WINUSERAPI
+int
+WINAPI
+GetScrollPos(
+ IN HWND hWnd,
+ IN int nBar);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetScrollRange(
+ IN HWND hWnd,
+ IN int nBar,
+ IN int nMinPos,
+ IN int nMaxPos,
+ IN BOOL bRedraw);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetScrollRange(
+ IN HWND hWnd,
+ IN int nBar,
+ OUT LPINT lpMinPos,
+ OUT LPINT lpMaxPos);
+
+WINUSERAPI
+BOOL
+WINAPI
+ShowScrollBar(
+ IN HWND hWnd,
+ IN int wBar,
+ IN BOOL bShow);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnableScrollBar(
+ IN HWND hWnd,
+ IN UINT wSBflags,
+ IN UINT wArrows);
+
+
+/*
+ * EnableScrollBar() flags
+ */
+#define ESB_ENABLE_BOTH 0x0000
+#define ESB_DISABLE_BOTH 0x0003
+
+#define ESB_DISABLE_LEFT 0x0001
+#define ESB_DISABLE_RIGHT 0x0002
+
+#define ESB_DISABLE_UP 0x0001
+#define ESB_DISABLE_DOWN 0x0002
+
+#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT
+#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT
+
+
+#endif /* !NOSCROLL */
+
+WINUSERAPI
+BOOL
+WINAPI
+SetPropA(
+ IN HWND hWnd,
+ IN LPCSTR lpString,
+ IN HANDLE hData);
+WINUSERAPI
+BOOL
+WINAPI
+SetPropW(
+ IN HWND hWnd,
+ IN LPCWSTR lpString,
+ IN HANDLE hData);
+#ifdef UNICODE
+#define SetProp SetPropW
+#else
+#define SetProp SetPropA
+#endif // !UNICODE
+
+WINUSERAPI
+HANDLE
+WINAPI
+GetPropA(
+ IN HWND hWnd,
+ IN LPCSTR lpString);
+WINUSERAPI
+HANDLE
+WINAPI
+GetPropW(
+ IN HWND hWnd,
+ IN LPCWSTR lpString);
+#ifdef UNICODE
+#define GetProp GetPropW
+#else
+#define GetProp GetPropA
+#endif // !UNICODE
+
+WINUSERAPI
+HANDLE
+WINAPI
+RemovePropA(
+ IN HWND hWnd,
+ IN LPCSTR lpString);
+WINUSERAPI
+HANDLE
+WINAPI
+RemovePropW(
+ IN HWND hWnd,
+ IN LPCWSTR lpString);
+#ifdef UNICODE
+#define RemoveProp RemovePropW
+#else
+#define RemoveProp RemovePropA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+EnumPropsExA(
+ IN HWND hWnd,
+ IN PROPENUMPROCEXA lpEnumFunc,
+ IN LPARAM lParam);
+WINUSERAPI
+int
+WINAPI
+EnumPropsExW(
+ IN HWND hWnd,
+ IN PROPENUMPROCEXW lpEnumFunc,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define EnumPropsEx EnumPropsExW
+#else
+#define EnumPropsEx EnumPropsExA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+EnumPropsA(
+ IN HWND hWnd,
+ IN PROPENUMPROCA lpEnumFunc);
+WINUSERAPI
+int
+WINAPI
+EnumPropsW(
+ IN HWND hWnd,
+ IN PROPENUMPROCW lpEnumFunc);
+#ifdef UNICODE
+#define EnumProps EnumPropsW
+#else
+#define EnumProps EnumPropsA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+SetWindowTextA(
+ IN HWND hWnd,
+ IN LPCSTR lpString);
+WINUSERAPI
+BOOL
+WINAPI
+SetWindowTextW(
+ IN HWND hWnd,
+ IN LPCWSTR lpString);
+#ifdef UNICODE
+#define SetWindowText SetWindowTextW
+#else
+#define SetWindowText SetWindowTextA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+GetWindowTextA(
+ IN HWND hWnd,
+ OUT LPSTR lpString,
+ IN int nMaxCount);
+WINUSERAPI
+int
+WINAPI
+GetWindowTextW(
+ IN HWND hWnd,
+ OUT LPWSTR lpString,
+ IN int nMaxCount);
+#ifdef UNICODE
+#define GetWindowText GetWindowTextW
+#else
+#define GetWindowText GetWindowTextA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+GetWindowTextLengthA(
+ IN HWND hWnd);
+WINUSERAPI
+int
+WINAPI
+GetWindowTextLengthW(
+ IN HWND hWnd);
+#ifdef UNICODE
+#define GetWindowTextLength GetWindowTextLengthW
+#else
+#define GetWindowTextLength GetWindowTextLengthA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+GetClientRect(
+ IN HWND hWnd,
+ OUT LPRECT lpRect);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetWindowRect(
+ IN HWND hWnd,
+ OUT LPRECT lpRect);
+
+WINUSERAPI
+BOOL
+WINAPI
+AdjustWindowRect(
+ IN OUT LPRECT lpRect,
+ IN DWORD dwStyle,
+ IN BOOL bMenu);
+
+WINUSERAPI
+BOOL
+WINAPI
+AdjustWindowRectEx(
+ IN OUT LPRECT lpRect,
+ IN DWORD dwStyle,
+ IN BOOL bMenu,
+ IN DWORD dwExStyle);
+
+
+#if(WINVER >= 0x0400)
+#define HELPINFO_WINDOW 0x0001
+#define HELPINFO_MENUITEM 0x0002
+typedef struct tagHELPINFO /* Structure pointed to by lParam of WM_HELP */
+{
+ UINT cbSize; /* Size in bytes of this struct */
+ int iContextType; /* Either HELPINFO_WINDOW or HELPINFO_MENUITEM */
+ int iCtrlId; /* Control Id or a Menu item Id. */
+ HANDLE hItemHandle; /* hWnd of control or hMenu. */
+ DWORD_PTR dwContextId; /* Context Id associated with this item */
+ POINT MousePos; /* Mouse Position in screen co-ordinates */
+} HELPINFO, FAR *LPHELPINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+SetWindowContextHelpId(
+ IN HWND,
+ IN DWORD);
+
+WINUSERAPI
+DWORD
+WINAPI
+GetWindowContextHelpId(
+ IN HWND);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetMenuContextHelpId(
+ IN HMENU,
+ IN DWORD);
+
+WINUSERAPI
+DWORD
+WINAPI
+GetMenuContextHelpId(
+ IN HMENU);
+
+#endif /* WINVER >= 0x0400 */
+
+
+#ifndef NOMB
+
+/*
+ * MessageBox() Flags
+ */
+#define MB_OK 0x00000000L
+#define MB_OKCANCEL 0x00000001L
+#define MB_ABORTRETRYIGNORE 0x00000002L
+#define MB_YESNOCANCEL 0x00000003L
+#define MB_YESNO 0x00000004L
+#define MB_RETRYCANCEL 0x00000005L
+#if(WINVER >= 0x0500)
+#define MB_CANCELTRYCONTINUE 0x00000006L
+#endif /* WINVER >= 0x0500 */
+
+
+#define MB_ICONHAND 0x00000010L
+#define MB_ICONQUESTION 0x00000020L
+#define MB_ICONEXCLAMATION 0x00000030L
+#define MB_ICONASTERISK 0x00000040L
+
+#if(WINVER >= 0x0400)
+#define MB_USERICON 0x00000080L
+#define MB_ICONWARNING MB_ICONEXCLAMATION
+#define MB_ICONERROR MB_ICONHAND
+#endif /* WINVER >= 0x0400 */
+
+#define MB_ICONINFORMATION MB_ICONASTERISK
+#define MB_ICONSTOP MB_ICONHAND
+
+#define MB_DEFBUTTON1 0x00000000L
+#define MB_DEFBUTTON2 0x00000100L
+#define MB_DEFBUTTON3 0x00000200L
+#if(WINVER >= 0x0400)
+#define MB_DEFBUTTON4 0x00000300L
+#endif /* WINVER >= 0x0400 */
+
+#define MB_APPLMODAL 0x00000000L
+#define MB_SYSTEMMODAL 0x00001000L
+#define MB_TASKMODAL 0x00002000L
+#if(WINVER >= 0x0400)
+#define MB_HELP 0x00004000L // Help Button
+#endif /* WINVER >= 0x0400 */
+
+#define MB_NOFOCUS 0x00008000L
+#define MB_SETFOREGROUND 0x00010000L
+#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L
+
+#if(WINVER >= 0x0400)
+#define MB_TOPMOST 0x00040000L
+#define MB_RIGHT 0x00080000L
+#define MB_RTLREADING 0x00100000L
+
+
+#endif /* WINVER >= 0x0400 */
+
+#ifdef _WIN32_WINNT
+#if (_WIN32_WINNT >= 0x0400)
+#define MB_SERVICE_NOTIFICATION 0x00200000L
+#else
+#define MB_SERVICE_NOTIFICATION 0x00040000L
+#endif
+#define MB_SERVICE_NOTIFICATION_NT3X 0x00040000L
+#endif
+
+#define MB_TYPEMASK 0x0000000FL
+#define MB_ICONMASK 0x000000F0L
+#define MB_DEFMASK 0x00000F00L
+#define MB_MODEMASK 0x00003000L
+#define MB_MISCMASK 0x0000C000L
+
+WINUSERAPI
+int
+WINAPI
+MessageBoxA(
+ IN HWND hWnd,
+ IN LPCSTR lpText,
+ IN LPCSTR lpCaption,
+ IN UINT uType);
+WINUSERAPI
+int
+WINAPI
+MessageBoxW(
+ IN HWND hWnd,
+ IN LPCWSTR lpText,
+ IN LPCWSTR lpCaption,
+ IN UINT uType);
+#ifdef UNICODE
+#define MessageBox MessageBoxW
+#else
+#define MessageBox MessageBoxA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+MessageBoxExA(
+ IN HWND hWnd,
+ IN LPCSTR lpText,
+ IN LPCSTR lpCaption,
+ IN UINT uType,
+ IN WORD wLanguageId);
+WINUSERAPI
+int
+WINAPI
+MessageBoxExW(
+ IN HWND hWnd,
+ IN LPCWSTR lpText,
+ IN LPCWSTR lpCaption,
+ IN UINT uType,
+ IN WORD wLanguageId);
+#ifdef UNICODE
+#define MessageBoxEx MessageBoxExW
+#else
+#define MessageBoxEx MessageBoxExA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+
+typedef void (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo);
+
+typedef struct tagMSGBOXPARAMSA
+{
+ UINT cbSize;
+ HWND hwndOwner;
+ HINSTANCE hInstance;
+ LPCSTR lpszText;
+ LPCSTR lpszCaption;
+ DWORD dwStyle;
+ LPCSTR lpszIcon;
+ DWORD_PTR dwContextHelpId;
+ MSGBOXCALLBACK lpfnMsgBoxCallback;
+ DWORD dwLanguageId;
+} MSGBOXPARAMSA, *PMSGBOXPARAMSA, *LPMSGBOXPARAMSA;
+typedef struct tagMSGBOXPARAMSW
+{
+ UINT cbSize;
+ HWND hwndOwner;
+ HINSTANCE hInstance;
+ LPCWSTR lpszText;
+ LPCWSTR lpszCaption;
+ DWORD dwStyle;
+ LPCWSTR lpszIcon;
+ DWORD_PTR dwContextHelpId;
+ MSGBOXCALLBACK lpfnMsgBoxCallback;
+ DWORD dwLanguageId;
+} MSGBOXPARAMSW, *PMSGBOXPARAMSW, *LPMSGBOXPARAMSW;
+#ifdef UNICODE
+typedef MSGBOXPARAMSW MSGBOXPARAMS;
+typedef PMSGBOXPARAMSW PMSGBOXPARAMS;
+typedef LPMSGBOXPARAMSW LPMSGBOXPARAMS;
+#else
+typedef MSGBOXPARAMSA MSGBOXPARAMS;
+typedef PMSGBOXPARAMSA PMSGBOXPARAMS;
+typedef LPMSGBOXPARAMSA LPMSGBOXPARAMS;
+#endif // UNICODE
+
+WINUSERAPI
+int
+WINAPI
+MessageBoxIndirectA(
+ IN CONST MSGBOXPARAMSA *);
+WINUSERAPI
+int
+WINAPI
+MessageBoxIndirectW(
+ IN CONST MSGBOXPARAMSW *);
+#ifdef UNICODE
+#define MessageBoxIndirect MessageBoxIndirectW
+#else
+#define MessageBoxIndirect MessageBoxIndirectA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0400 */
+
+
+WINUSERAPI
+BOOL
+WINAPI
+MessageBeep(
+ IN UINT uType);
+
+#endif /* !NOMB */
+
+WINUSERAPI
+int
+WINAPI
+ShowCursor(
+ IN BOOL bShow);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetCursorPos(
+ IN int X,
+ IN int Y);
+
+WINUSERAPI
+HCURSOR
+WINAPI
+SetCursor(
+ IN HCURSOR hCursor);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetCursorPos(
+ OUT LPPOINT lpPoint);
+
+WINUSERAPI
+BOOL
+WINAPI
+ClipCursor(
+ IN CONST RECT *lpRect);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetClipCursor(
+ OUT LPRECT lpRect);
+
+WINUSERAPI
+HCURSOR
+WINAPI
+GetCursor(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+CreateCaret(
+ IN HWND hWnd,
+ IN HBITMAP hBitmap,
+ IN int nWidth,
+ IN int nHeight);
+
+WINUSERAPI
+UINT
+WINAPI
+GetCaretBlinkTime(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetCaretBlinkTime(
+ IN UINT uMSeconds);
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyCaret(
+ VOID);
+
+WINUSERAPI
+BOOL
+WINAPI
+HideCaret(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+ShowCaret(
+ IN HWND hWnd);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetCaretPos(
+ IN int X,
+ IN int Y);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetCaretPos(
+ OUT LPPOINT lpPoint);
+
+WINUSERAPI
+BOOL
+WINAPI
+ClientToScreen(
+ IN HWND hWnd,
+ IN OUT LPPOINT lpPoint);
+
+WINUSERAPI
+BOOL
+WINAPI
+ScreenToClient(
+ IN HWND hWnd,
+ IN OUT LPPOINT lpPoint);
+
+WINUSERAPI
+int
+WINAPI
+MapWindowPoints(
+ IN HWND hWndFrom,
+ IN HWND hWndTo,
+ IN OUT LPPOINT lpPoints,
+ IN UINT cPoints);
+
+WINUSERAPI
+HWND
+WINAPI
+WindowFromPoint(
+ IN POINT Point);
+
+WINUSERAPI
+HWND
+WINAPI
+ChildWindowFromPoint(
+ IN HWND hWndParent,
+ IN POINT Point);
+
+#if(WINVER >= 0x0400)
+#define CWP_ALL 0x0000
+#define CWP_SKIPINVISIBLE 0x0001
+#define CWP_SKIPDISABLED 0x0002
+#define CWP_SKIPTRANSPARENT 0x0004
+
+WINUSERAPI HWND WINAPI ChildWindowFromPointEx( IN HWND, IN POINT, IN UINT);
+#endif /* WINVER >= 0x0400 */
+
+#ifndef NOCOLOR
+
+/*
+ * Color Types
+ */
+#define CTLCOLOR_MSGBOX 0
+#define CTLCOLOR_EDIT 1
+#define CTLCOLOR_LISTBOX 2
+#define CTLCOLOR_BTN 3
+#define CTLCOLOR_DLG 4
+#define CTLCOLOR_SCROLLBAR 5
+#define CTLCOLOR_STATIC 6
+#define CTLCOLOR_MAX 7
+
+#define COLOR_SCROLLBAR 0
+#define COLOR_BACKGROUND 1
+#define COLOR_ACTIVECAPTION 2
+#define COLOR_INACTIVECAPTION 3
+#define COLOR_MENU 4
+#define COLOR_WINDOW 5
+#define COLOR_WINDOWFRAME 6
+#define COLOR_MENUTEXT 7
+#define COLOR_WINDOWTEXT 8
+#define COLOR_CAPTIONTEXT 9
+#define COLOR_ACTIVEBORDER 10
+#define COLOR_INACTIVEBORDER 11
+#define COLOR_APPWORKSPACE 12
+#define COLOR_HIGHLIGHT 13
+#define COLOR_HIGHLIGHTTEXT 14
+#define COLOR_BTNFACE 15
+#define COLOR_BTNSHADOW 16
+#define COLOR_GRAYTEXT 17
+#define COLOR_BTNTEXT 18
+#define COLOR_INACTIVECAPTIONTEXT 19
+#define COLOR_BTNHIGHLIGHT 20
+
+#if(WINVER >= 0x0400)
+#define COLOR_3DDKSHADOW 21
+#define COLOR_3DLIGHT 22
+#define COLOR_INFOTEXT 23
+#define COLOR_INFOBK 24
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+#define COLOR_HOTLIGHT 26
+#define COLOR_GRADIENTACTIVECAPTION 27
+#define COLOR_GRADIENTINACTIVECAPTION 28
+#if(WINVER >= 0x0501)
+#define COLOR_MENUHILIGHT 29
+#define COLOR_MENUBAR 30
+#endif /* WINVER >= 0x0501 */
+#endif /* WINVER >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+#define COLOR_DESKTOP COLOR_BACKGROUND
+#define COLOR_3DFACE COLOR_BTNFACE
+#define COLOR_3DSHADOW COLOR_BTNSHADOW
+#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT
+#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT
+#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT
+#endif /* WINVER >= 0x0400 */
+
+
+WINUSERAPI
+DWORD
+WINAPI
+GetSysColor(
+ IN int nIndex);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+HBRUSH
+WINAPI
+GetSysColorBrush(
+ IN int nIndex);
+
+
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+SetSysColors(
+ IN int cElements,
+ IN CONST INT * lpaElements,
+ IN CONST COLORREF * lpaRgbValues);
+
+#endif /* !NOCOLOR */
+
+WINUSERAPI
+BOOL
+WINAPI
+DrawFocusRect(
+ IN HDC hDC,
+ IN CONST RECT * lprc);
+
+WINUSERAPI
+int
+WINAPI
+FillRect(
+ IN HDC hDC,
+ IN CONST RECT *lprc,
+ IN HBRUSH hbr);
+
+WINUSERAPI
+int
+WINAPI
+FrameRect(
+ IN HDC hDC,
+ IN CONST RECT *lprc,
+ IN HBRUSH hbr);
+
+WINUSERAPI
+BOOL
+WINAPI
+InvertRect(
+ IN HDC hDC,
+ IN CONST RECT *lprc);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetRect(
+ OUT LPRECT lprc,
+ IN int xLeft,
+ IN int yTop,
+ IN int xRight,
+ IN int yBottom);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetRectEmpty(
+ OUT LPRECT lprc);
+
+WINUSERAPI
+BOOL
+WINAPI
+CopyRect(
+ OUT LPRECT lprcDst,
+ IN CONST RECT *lprcSrc);
+
+WINUSERAPI
+BOOL
+WINAPI
+InflateRect(
+ IN OUT LPRECT lprc,
+ IN int dx,
+ IN int dy);
+
+WINUSERAPI
+BOOL
+WINAPI
+IntersectRect(
+ OUT LPRECT lprcDst,
+ IN CONST RECT *lprcSrc1,
+ IN CONST RECT *lprcSrc2);
+
+WINUSERAPI
+BOOL
+WINAPI
+UnionRect(
+ OUT LPRECT lprcDst,
+ IN CONST RECT *lprcSrc1,
+ IN CONST RECT *lprcSrc2);
+
+WINUSERAPI
+BOOL
+WINAPI
+SubtractRect(
+ OUT LPRECT lprcDst,
+ IN CONST RECT *lprcSrc1,
+ IN CONST RECT *lprcSrc2);
+
+WINUSERAPI
+BOOL
+WINAPI
+OffsetRect(
+ IN OUT LPRECT lprc,
+ IN int dx,
+ IN int dy);
+
+WINUSERAPI
+BOOL
+WINAPI
+IsRectEmpty(
+ IN CONST RECT *lprc);
+
+WINUSERAPI
+BOOL
+WINAPI
+EqualRect(
+ IN CONST RECT *lprc1,
+ IN CONST RECT *lprc2);
+
+WINUSERAPI
+BOOL
+WINAPI
+PtInRect(
+ IN CONST RECT *lprc,
+ IN POINT pt);
+
+#ifndef NOWINOFFSETS
+
+WINUSERAPI
+WORD
+WINAPI
+GetWindowWord(
+ IN HWND hWnd,
+ IN int nIndex);
+
+WINUSERAPI
+WORD
+WINAPI
+SetWindowWord(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN WORD wNewWord);
+
+WINUSERAPI
+LONG
+WINAPI
+GetWindowLongA(
+ IN HWND hWnd,
+ IN int nIndex);
+WINUSERAPI
+LONG
+WINAPI
+GetWindowLongW(
+ IN HWND hWnd,
+ IN int nIndex);
+#ifdef UNICODE
+#define GetWindowLong GetWindowLongW
+#else
+#define GetWindowLong GetWindowLongA
+#endif // !UNICODE
+
+WINUSERAPI
+LONG
+WINAPI
+SetWindowLongA(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG dwNewLong);
+WINUSERAPI
+LONG
+WINAPI
+SetWindowLongW(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG dwNewLong);
+#ifdef UNICODE
+#define SetWindowLong SetWindowLongW
+#else
+#define SetWindowLong SetWindowLongA
+#endif // !UNICODE
+
+#ifdef _WIN64
+
+WINUSERAPI
+LONG_PTR
+WINAPI
+GetWindowLongPtrA(
+ HWND hWnd,
+ int nIndex);
+WINUSERAPI
+LONG_PTR
+WINAPI
+GetWindowLongPtrW(
+ HWND hWnd,
+ int nIndex);
+#ifdef UNICODE
+#define GetWindowLongPtr GetWindowLongPtrW
+#else
+#define GetWindowLongPtr GetWindowLongPtrA
+#endif // !UNICODE
+
+WINUSERAPI
+LONG_PTR
+WINAPI
+SetWindowLongPtrA(
+ HWND hWnd,
+ int nIndex,
+ LONG_PTR dwNewLong);
+WINUSERAPI
+LONG_PTR
+WINAPI
+SetWindowLongPtrW(
+ HWND hWnd,
+ int nIndex,
+ LONG_PTR dwNewLong);
+#ifdef UNICODE
+#define SetWindowLongPtr SetWindowLongPtrW
+#else
+#define SetWindowLongPtr SetWindowLongPtrA
+#endif // !UNICODE
+
+#else /* _WIN64 */
+
+#define GetWindowLongPtrA GetWindowLongA
+#define GetWindowLongPtrW GetWindowLongW
+#ifdef UNICODE
+#define GetWindowLongPtr GetWindowLongPtrW
+#else
+#define GetWindowLongPtr GetWindowLongPtrA
+#endif // !UNICODE
+
+#define SetWindowLongPtrA SetWindowLongA
+#define SetWindowLongPtrW SetWindowLongW
+#ifdef UNICODE
+#define SetWindowLongPtr SetWindowLongPtrW
+#else
+#define SetWindowLongPtr SetWindowLongPtrA
+#endif // !UNICODE
+
+#endif /* _WIN64 */
+
+WINUSERAPI
+WORD
+WINAPI
+GetClassWord(
+ IN HWND hWnd,
+ IN int nIndex);
+
+WINUSERAPI
+WORD
+WINAPI
+SetClassWord(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN WORD wNewWord);
+
+WINUSERAPI
+DWORD
+WINAPI
+GetClassLongA(
+ IN HWND hWnd,
+ IN int nIndex);
+WINUSERAPI
+DWORD
+WINAPI
+GetClassLongW(
+ IN HWND hWnd,
+ IN int nIndex);
+#ifdef UNICODE
+#define GetClassLong GetClassLongW
+#else
+#define GetClassLong GetClassLongA
+#endif // !UNICODE
+
+WINUSERAPI
+DWORD
+WINAPI
+SetClassLongA(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG dwNewLong);
+WINUSERAPI
+DWORD
+WINAPI
+SetClassLongW(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG dwNewLong);
+#ifdef UNICODE
+#define SetClassLong SetClassLongW
+#else
+#define SetClassLong SetClassLongA
+#endif // !UNICODE
+
+#ifdef _WIN64
+
+WINUSERAPI
+ULONG_PTR
+WINAPI
+GetClassLongPtrA(
+ IN HWND hWnd,
+ IN int nIndex);
+WINUSERAPI
+ULONG_PTR
+WINAPI
+GetClassLongPtrW(
+ IN HWND hWnd,
+ IN int nIndex);
+#ifdef UNICODE
+#define GetClassLongPtr GetClassLongPtrW
+#else
+#define GetClassLongPtr GetClassLongPtrA
+#endif // !UNICODE
+
+WINUSERAPI
+ULONG_PTR
+WINAPI
+SetClassLongPtrA(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG_PTR dwNewLong);
+WINUSERAPI
+ULONG_PTR
+WINAPI
+SetClassLongPtrW(
+ IN HWND hWnd,
+ IN int nIndex,
+ IN LONG_PTR dwNewLong);
+#ifdef UNICODE
+#define SetClassLongPtr SetClassLongPtrW
+#else
+#define SetClassLongPtr SetClassLongPtrA
+#endif // !UNICODE
+
+#else /* _WIN64 */
+
+#define GetClassLongPtrA GetClassLongA
+#define GetClassLongPtrW GetClassLongW
+#ifdef UNICODE
+#define GetClassLongPtr GetClassLongPtrW
+#else
+#define GetClassLongPtr GetClassLongPtrA
+#endif // !UNICODE
+
+#define SetClassLongPtrA SetClassLongA
+#define SetClassLongPtrW SetClassLongW
+#ifdef UNICODE
+#define SetClassLongPtr SetClassLongPtrW
+#else
+#define SetClassLongPtr SetClassLongPtrA
+#endif // !UNICODE
+
+#endif /* _WIN64 */
+
+#endif /* !NOWINOFFSETS */
+
+#if(WINVER >= 0x0500)
+WINUSERAPI
+BOOL
+WINAPI
+GetProcessDefaultLayout(
+ OUT DWORD *pdwDefaultLayout);
+
+WINUSERAPI
+BOOL
+WINAPI
+SetProcessDefaultLayout(
+ IN DWORD dwDefaultLayout);
+#endif /* WINVER >= 0x0500 */
+
+WINUSERAPI
+HWND
+WINAPI
+GetDesktopWindow(
+ VOID);
+
+
+WINUSERAPI
+HWND
+WINAPI
+GetParent(
+ IN HWND hWnd);
+
+WINUSERAPI
+HWND
+WINAPI
+SetParent(
+ IN HWND hWndChild,
+ IN HWND hWndNewParent);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumChildWindows(
+ IN HWND hWndParent,
+ IN WNDENUMPROC lpEnumFunc,
+ IN LPARAM lParam);
+
+WINUSERAPI
+HWND
+WINAPI
+FindWindowA(
+ IN LPCSTR lpClassName,
+ IN LPCSTR lpWindowName);
+WINUSERAPI
+HWND
+WINAPI
+FindWindowW(
+ IN LPCWSTR lpClassName,
+ IN LPCWSTR lpWindowName);
+#ifdef UNICODE
+#define FindWindow FindWindowW
+#else
+#define FindWindow FindWindowA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI HWND WINAPI FindWindowExA( IN HWND, IN HWND, IN LPCSTR, IN LPCSTR);
+WINUSERAPI HWND WINAPI FindWindowExW( IN HWND, IN HWND, IN LPCWSTR, IN LPCWSTR);
+#ifdef UNICODE
+#define FindWindowEx FindWindowExW
+#else
+#define FindWindowEx FindWindowExA
+#endif // !UNICODE
+
+WINUSERAPI HWND WINAPI GetShellWindow(void);
+#endif /* WINVER >= 0x0400 */
+
+
+WINUSERAPI BOOL WINAPI RegisterShellHookWindow( IN HWND);
+WINUSERAPI BOOL WINAPI DeregisterShellHookWindow( IN HWND);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumWindows(
+ IN WNDENUMPROC lpEnumFunc,
+ IN LPARAM lParam);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumThreadWindows(
+ IN DWORD dwThreadId,
+ IN WNDENUMPROC lpfn,
+ IN LPARAM lParam);
+
+#define EnumTaskWindows(hTask, lpfn, lParam) EnumThreadWindows(HandleToUlong(hTask), lpfn, lParam)
+
+WINUSERAPI
+int
+WINAPI
+GetClassNameA(
+ IN HWND hWnd,
+ OUT LPSTR lpClassName,
+ IN int nMaxCount);
+WINUSERAPI
+int
+WINAPI
+GetClassNameW(
+ IN HWND hWnd,
+ OUT LPWSTR lpClassName,
+ IN int nMaxCount);
+#ifdef UNICODE
+#define GetClassName GetClassNameW
+#else
+#define GetClassName GetClassNameA
+#endif // !UNICODE
+
+WINUSERAPI
+HWND
+WINAPI
+GetTopWindow(
+ IN HWND hWnd);
+
+#define GetNextWindow(hWnd, wCmd) GetWindow(hWnd, wCmd)
+#define GetSysModalWindow() (NULL)
+#define SetSysModalWindow(hWnd) (NULL)
+
+WINUSERAPI
+DWORD
+WINAPI
+GetWindowThreadProcessId(
+ IN HWND hWnd,
+ OUT LPDWORD lpdwProcessId);
+
+#if(_WIN32_WINNT >= 0x0501)
+WINUSERAPI
+BOOL
+WINAPI
+IsGUIThread(
+ BOOL bConvert);
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#define GetWindowTask(hWnd) \
+ ((HANDLE)(DWORD_PTR)GetWindowThreadProcessId(hWnd, NULL))
+
+WINUSERAPI
+HWND
+WINAPI
+GetLastActivePopup(
+ IN HWND hWnd);
+
+/*
+ * GetWindow() Constants
+ */
+#define GW_HWNDFIRST 0
+#define GW_HWNDLAST 1
+#define GW_HWNDNEXT 2
+#define GW_HWNDPREV 3
+#define GW_OWNER 4
+#define GW_CHILD 5
+#if(WINVER <= 0x0400)
+#define GW_MAX 5
+#else
+#define GW_ENABLEDPOPUP 6
+#define GW_MAX 6
+#endif
+
+WINUSERAPI
+HWND
+WINAPI
+GetWindow(
+ IN HWND hWnd,
+ IN UINT uCmd);
+
+
+
+#ifndef NOWH
+
+#ifdef STRICT
+
+WINUSERAPI
+HHOOK
+WINAPI
+SetWindowsHookA(
+ IN int nFilterType,
+ IN HOOKPROC pfnFilterProc);
+WINUSERAPI
+HHOOK
+WINAPI
+SetWindowsHookW(
+ IN int nFilterType,
+ IN HOOKPROC pfnFilterProc);
+#ifdef UNICODE
+#define SetWindowsHook SetWindowsHookW
+#else
+#define SetWindowsHook SetWindowsHookA
+#endif // !UNICODE
+
+#else /* !STRICT */
+
+WINUSERAPI
+HOOKPROC
+WINAPI
+SetWindowsHookA(
+ IN int nFilterType,
+ IN HOOKPROC pfnFilterProc);
+WINUSERAPI
+HOOKPROC
+WINAPI
+SetWindowsHookW(
+ IN int nFilterType,
+ IN HOOKPROC pfnFilterProc);
+#ifdef UNICODE
+#define SetWindowsHook SetWindowsHookW
+#else
+#define SetWindowsHook SetWindowsHookA
+#endif // !UNICODE
+
+#endif /* !STRICT */
+
+WINUSERAPI
+BOOL
+WINAPI
+UnhookWindowsHook(
+ IN int nCode,
+ IN HOOKPROC pfnFilterProc);
+
+WINUSERAPI
+HHOOK
+WINAPI
+SetWindowsHookExA(
+ IN int idHook,
+ IN HOOKPROC lpfn,
+ IN HINSTANCE hmod,
+ IN DWORD dwThreadId);
+WINUSERAPI
+HHOOK
+WINAPI
+SetWindowsHookExW(
+ IN int idHook,
+ IN HOOKPROC lpfn,
+ IN HINSTANCE hmod,
+ IN DWORD dwThreadId);
+#ifdef UNICODE
+#define SetWindowsHookEx SetWindowsHookExW
+#else
+#define SetWindowsHookEx SetWindowsHookExA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+UnhookWindowsHookEx(
+ IN HHOOK hhk);
+
+WINUSERAPI
+LRESULT
+WINAPI
+CallNextHookEx(
+ IN HHOOK hhk,
+ IN int nCode,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+
+/*
+ * Macros for source-level compatibility with old functions.
+ */
+#ifdef STRICT
+#define DefHookProc(nCode, wParam, lParam, phhk)\
+ CallNextHookEx(*phhk, nCode, wParam, lParam)
+#else
+#define DefHookProc(nCode, wParam, lParam, phhk)\
+ CallNextHookEx((HHOOK)*phhk, nCode, wParam, lParam)
+#endif /* STRICT */
+#endif /* !NOWH */
+
+#ifndef NOMENUS
+
+
+/* ;win40 -- A lot of MF_* flags have been renamed as MFT_* and MFS_* flags */
+/*
+ * Menu flags for Add/Check/EnableMenuItem()
+ */
+#define MF_INSERT 0x00000000L
+#define MF_CHANGE 0x00000080L
+#define MF_APPEND 0x00000100L
+#define MF_DELETE 0x00000200L
+#define MF_REMOVE 0x00001000L
+
+#define MF_BYCOMMAND 0x00000000L
+#define MF_BYPOSITION 0x00000400L
+
+#define MF_SEPARATOR 0x00000800L
+
+#define MF_ENABLED 0x00000000L
+#define MF_GRAYED 0x00000001L
+#define MF_DISABLED 0x00000002L
+
+#define MF_UNCHECKED 0x00000000L
+#define MF_CHECKED 0x00000008L
+#define MF_USECHECKBITMAPS 0x00000200L
+
+#define MF_STRING 0x00000000L
+#define MF_BITMAP 0x00000004L
+#define MF_OWNERDRAW 0x00000100L
+
+#define MF_POPUP 0x00000010L
+#define MF_MENUBARBREAK 0x00000020L
+#define MF_MENUBREAK 0x00000040L
+
+#define MF_UNHILITE 0x00000000L
+#define MF_HILITE 0x00000080L
+
+#if(WINVER >= 0x0400)
+#define MF_DEFAULT 0x00001000L
+#endif /* WINVER >= 0x0400 */
+#define MF_SYSMENU 0x00002000L
+#define MF_HELP 0x00004000L
+#if(WINVER >= 0x0400)
+#define MF_RIGHTJUSTIFY 0x00004000L
+#endif /* WINVER >= 0x0400 */
+
+#define MF_MOUSESELECT 0x00008000L
+#if(WINVER >= 0x0400)
+#define MF_END 0x00000080L /* Obsolete -- only used by old RES files */
+#endif /* WINVER >= 0x0400 */
+
+
+#if(WINVER >= 0x0400)
+#define MFT_STRING MF_STRING
+#define MFT_BITMAP MF_BITMAP
+#define MFT_MENUBARBREAK MF_MENUBARBREAK
+#define MFT_MENUBREAK MF_MENUBREAK
+#define MFT_OWNERDRAW MF_OWNERDRAW
+#define MFT_RADIOCHECK 0x00000200L
+#define MFT_SEPARATOR MF_SEPARATOR
+#define MFT_RIGHTORDER 0x00002000L
+#define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY
+
+/* Menu flags for Add/Check/EnableMenuItem() */
+#define MFS_GRAYED 0x00000003L
+#define MFS_DISABLED MFS_GRAYED
+#define MFS_CHECKED MF_CHECKED
+#define MFS_HILITE MF_HILITE
+#define MFS_ENABLED MF_ENABLED
+#define MFS_UNCHECKED MF_UNCHECKED
+#define MFS_UNHILITE MF_UNHILITE
+#define MFS_DEFAULT MF_DEFAULT
+#endif /* WINVER >= 0x0400 */
+
+
+#if(WINVER >= 0x0400)
+
+WINUSERAPI
+BOOL
+WINAPI
+CheckMenuRadioItem(
+ IN HMENU,
+ IN UINT,
+ IN UINT,
+ IN UINT,
+ IN UINT);
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Menu item resource format
+ */
+typedef struct {
+ WORD versionNumber;
+ WORD offset;
+} MENUITEMTEMPLATEHEADER, *PMENUITEMTEMPLATEHEADER;
+
+typedef struct { // version 0
+ WORD mtOption;
+ WORD mtID;
+ WCHAR mtString[1];
+} MENUITEMTEMPLATE, *PMENUITEMTEMPLATE;
+#define MF_END 0x00000080L
+
+#endif /* !NOMENUS */
+
+#ifndef NOSYSCOMMANDS
+
+/*
+ * System Menu Command Values
+ */
+#define SC_SIZE 0xF000
+#define SC_MOVE 0xF010
+#define SC_MINIMIZE 0xF020
+#define SC_MAXIMIZE 0xF030
+#define SC_NEXTWINDOW 0xF040
+#define SC_PREVWINDOW 0xF050
+#define SC_CLOSE 0xF060
+#define SC_VSCROLL 0xF070
+#define SC_HSCROLL 0xF080
+#define SC_MOUSEMENU 0xF090
+#define SC_KEYMENU 0xF100
+#define SC_ARRANGE 0xF110
+#define SC_RESTORE 0xF120
+#define SC_TASKLIST 0xF130
+#define SC_SCREENSAVE 0xF140
+#define SC_HOTKEY 0xF150
+#if(WINVER >= 0x0400)
+#define SC_DEFAULT 0xF160
+#define SC_MONITORPOWER 0xF170
+#define SC_CONTEXTHELP 0xF180
+#define SC_SEPARATOR 0xF00F
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Obsolete names
+ */
+#define SC_ICON SC_MINIMIZE
+#define SC_ZOOM SC_MAXIMIZE
+
+#endif /* !NOSYSCOMMANDS */
+
+/*
+ * Resource Loading Routines
+ */
+
+WINUSERAPI
+HBITMAP
+WINAPI
+LoadBitmapA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpBitmapName);
+WINUSERAPI
+HBITMAP
+WINAPI
+LoadBitmapW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpBitmapName);
+#ifdef UNICODE
+#define LoadBitmap LoadBitmapW
+#else
+#define LoadBitmap LoadBitmapA
+#endif // !UNICODE
+
+WINUSERAPI
+HCURSOR
+WINAPI
+LoadCursorA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpCursorName);
+WINUSERAPI
+HCURSOR
+WINAPI
+LoadCursorW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpCursorName);
+#ifdef UNICODE
+#define LoadCursor LoadCursorW
+#else
+#define LoadCursor LoadCursorA
+#endif // !UNICODE
+
+WINUSERAPI
+HCURSOR
+WINAPI
+LoadCursorFromFileA(
+ IN LPCSTR lpFileName);
+WINUSERAPI
+HCURSOR
+WINAPI
+LoadCursorFromFileW(
+ IN LPCWSTR lpFileName);
+#ifdef UNICODE
+#define LoadCursorFromFile LoadCursorFromFileW
+#else
+#define LoadCursorFromFile LoadCursorFromFileA
+#endif // !UNICODE
+
+WINUSERAPI
+HCURSOR
+WINAPI
+CreateCursor(
+ IN HINSTANCE hInst,
+ IN int xHotSpot,
+ IN int yHotSpot,
+ IN int nWidth,
+ IN int nHeight,
+ IN CONST VOID *pvANDPlane,
+ IN CONST VOID *pvXORPlane);
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyCursor(
+ IN HCURSOR hCursor);
+
+#ifndef _MAC
+#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
+#else
+WINUSERAPI
+HCURSOR
+WINAPI
+CopyCursor(
+ IN HCURSOR hCursor);
+#endif
+
+/*
+ * Standard Cursor IDs
+ */
+#define IDC_ARROW MAKEINTRESOURCE(32512)
+#define IDC_IBEAM MAKEINTRESOURCE(32513)
+#define IDC_WAIT MAKEINTRESOURCE(32514)
+#define IDC_CROSS MAKEINTRESOURCE(32515)
+#define IDC_UPARROW MAKEINTRESOURCE(32516)
+#define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */
+#define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */
+#define IDC_SIZENWSE MAKEINTRESOURCE(32642)
+#define IDC_SIZENESW MAKEINTRESOURCE(32643)
+#define IDC_SIZEWE MAKEINTRESOURCE(32644)
+#define IDC_SIZENS MAKEINTRESOURCE(32645)
+#define IDC_SIZEALL MAKEINTRESOURCE(32646)
+#define IDC_NO MAKEINTRESOURCE(32648) /*not in win3.1 */
+#if(WINVER >= 0x0500)
+#define IDC_HAND MAKEINTRESOURCE(32649)
+#endif /* WINVER >= 0x0500 */
+#define IDC_APPSTARTING MAKEINTRESOURCE(32650) /*not in win3.1 */
+#if(WINVER >= 0x0400)
+#define IDC_HELP MAKEINTRESOURCE(32651)
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+BOOL
+WINAPI
+SetSystemCursor(
+ IN HCURSOR hcur,
+ IN DWORD id);
+
+typedef struct _ICONINFO {
+ BOOL fIcon;
+ DWORD xHotspot;
+ DWORD yHotspot;
+ HBITMAP hbmMask;
+ HBITMAP hbmColor;
+} ICONINFO;
+typedef ICONINFO *PICONINFO;
+
+WINUSERAPI
+HICON
+WINAPI
+LoadIconA(
+ IN HINSTANCE hInstance,
+ IN LPCSTR lpIconName);
+WINUSERAPI
+HICON
+WINAPI
+LoadIconW(
+ IN HINSTANCE hInstance,
+ IN LPCWSTR lpIconName);
+#ifdef UNICODE
+#define LoadIcon LoadIconW
+#else
+#define LoadIcon LoadIconA
+#endif // !UNICODE
+
+
+WINUSERAPI UINT PrivateExtractIconsA(
+ IN LPCSTR szFileName,
+ IN int nIconIndex,
+ IN int cxIcon,
+ IN int cyIcon,
+ OUT HICON *phicon,
+ OUT UINT *piconid,
+ IN UINT nIcons,
+ IN UINT flags);
+WINUSERAPI UINT PrivateExtractIconsW(
+ IN LPCWSTR szFileName,
+ IN int nIconIndex,
+ IN int cxIcon,
+ IN int cyIcon,
+ OUT HICON *phicon,
+ OUT UINT *piconid,
+ IN UINT nIcons,
+ IN UINT flags);
+#ifdef UNICODE
+#define PrivateExtractIcons PrivateExtractIconsW
+#else
+#define PrivateExtractIcons PrivateExtractIconsA
+#endif // !UNICODE
+
+WINUSERAPI
+HICON
+WINAPI
+CreateIcon(
+ IN HINSTANCE hInstance,
+ IN int nWidth,
+ IN int nHeight,
+ IN BYTE cPlanes,
+ IN BYTE cBitsPixel,
+ IN CONST BYTE *lpbANDbits,
+ IN CONST BYTE *lpbXORbits);
+
+WINUSERAPI
+BOOL
+WINAPI
+DestroyIcon(
+ IN HICON hIcon);
+
+WINUSERAPI
+int
+WINAPI
+LookupIconIdFromDirectory(
+ IN PBYTE presbits,
+ IN BOOL fIcon);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+int
+WINAPI
+LookupIconIdFromDirectoryEx(
+ IN PBYTE presbits,
+ IN BOOL fIcon,
+ IN int cxDesired,
+ IN int cyDesired,
+ IN UINT Flags);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+HICON
+WINAPI
+CreateIconFromResource(
+ IN PBYTE presbits,
+ IN DWORD dwResSize,
+ IN BOOL fIcon,
+ IN DWORD dwVer);
+
+#if(WINVER >= 0x0400)
+WINUSERAPI
+HICON
+WINAPI
+CreateIconFromResourceEx(
+ IN PBYTE presbits,
+ IN DWORD dwResSize,
+ IN BOOL fIcon,
+ IN DWORD dwVer,
+ IN int cxDesired,
+ IN int cyDesired,
+ IN UINT Flags);
+
+/* Icon/Cursor header */
+typedef struct tagCURSORSHAPE
+{
+ int xHotSpot;
+ int yHotSpot;
+ int cx;
+ int cy;
+ int cbWidth;
+ BYTE Planes;
+ BYTE BitsPixel;
+} CURSORSHAPE, FAR *LPCURSORSHAPE;
+#endif /* WINVER >= 0x0400 */
+
+#define IMAGE_BITMAP 0
+#define IMAGE_ICON 1
+#define IMAGE_CURSOR 2
+#if(WINVER >= 0x0400)
+#define IMAGE_ENHMETAFILE 3
+
+#define LR_DEFAULTCOLOR 0x0000
+#define LR_MONOCHROME 0x0001
+#define LR_COLOR 0x0002
+#define LR_COPYRETURNORG 0x0004
+#define LR_COPYDELETEORG 0x0008
+#define LR_LOADFROMFILE 0x0010
+#define LR_LOADTRANSPARENT 0x0020
+#define LR_DEFAULTSIZE 0x0040
+#define LR_VGACOLOR 0x0080
+#define LR_LOADMAP3DCOLORS 0x1000
+#define LR_CREATEDIBSECTION 0x2000
+#define LR_COPYFROMRESOURCE 0x4000
+#define LR_SHARED 0x8000
+
+WINUSERAPI
+HANDLE
+WINAPI
+LoadImageA(
+ IN HINSTANCE,
+ IN LPCSTR,
+ IN UINT,
+ IN int,
+ IN int,
+ IN UINT);
+WINUSERAPI
+HANDLE
+WINAPI
+LoadImageW(
+ IN HINSTANCE,
+ IN LPCWSTR,
+ IN UINT,
+ IN int,
+ IN int,
+ IN UINT);
+#ifdef UNICODE
+#define LoadImage LoadImageW
+#else
+#define LoadImage LoadImageA
+#endif // !UNICODE
+
+WINUSERAPI
+HANDLE
+WINAPI
+CopyImage(
+ IN HANDLE,
+ IN UINT,
+ IN int,
+ IN int,
+ IN UINT);
+
+#define DI_MASK 0x0001
+#define DI_IMAGE 0x0002
+#define DI_NORMAL 0x0003
+#define DI_COMPAT 0x0004
+#define DI_DEFAULTSIZE 0x0008
+#if(_WIN32_WINNT >= 0x0501)
+#define DI_NOMIRROR 0x0010
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI BOOL WINAPI DrawIconEx( IN HDC hdc, IN int xLeft, IN int yTop,
+ IN HICON hIcon, IN int cxWidth, IN int cyWidth,
+ IN UINT istepIfAniCur, IN HBRUSH hbrFlickerFreeDraw, IN UINT diFlags);
+#endif /* WINVER >= 0x0400 */
+
+WINUSERAPI
+HICON
+WINAPI
+CreateIconIndirect(
+ IN PICONINFO piconinfo);
+
+WINUSERAPI
+HICON
+WINAPI
+CopyIcon(
+ IN HICON hIcon);
+
+WINUSERAPI
+BOOL
+WINAPI
+GetIconInfo(
+ IN HICON hIcon,
+ OUT PICONINFO piconinfo);
+
+#if(WINVER >= 0x0400)
+#define RES_ICON 1
+#define RES_CURSOR 2
+#endif /* WINVER >= 0x0400 */
+
+#ifdef OEMRESOURCE
+
+
+/*
+ * OEM Resource Ordinal Numbers
+ */
+#define OBM_CLOSE 32754
+#define OBM_UPARROW 32753
+#define OBM_DNARROW 32752
+#define OBM_RGARROW 32751
+#define OBM_LFARROW 32750
+#define OBM_REDUCE 32749
+#define OBM_ZOOM 32748
+#define OBM_RESTORE 32747
+#define OBM_REDUCED 32746
+#define OBM_ZOOMD 32745
+#define OBM_RESTORED 32744
+#define OBM_UPARROWD 32743
+#define OBM_DNARROWD 32742
+#define OBM_RGARROWD 32741
+#define OBM_LFARROWD 32740
+#define OBM_MNARROW 32739
+#define OBM_COMBO 32738
+#define OBM_UPARROWI 32737
+#define OBM_DNARROWI 32736
+#define OBM_RGARROWI 32735
+#define OBM_LFARROWI 32734
+
+#define OBM_OLD_CLOSE 32767
+#define OBM_SIZE 32766
+#define OBM_OLD_UPARROW 32765
+#define OBM_OLD_DNARROW 32764
+#define OBM_OLD_RGARROW 32763
+#define OBM_OLD_LFARROW 32762
+#define OBM_BTSIZE 32761
+#define OBM_CHECK 32760
+#define OBM_CHECKBOXES 32759
+#define OBM_BTNCORNERS 32758
+#define OBM_OLD_REDUCE 32757
+#define OBM_OLD_ZOOM 32756
+#define OBM_OLD_RESTORE 32755
+
+
+#define OCR_NORMAL 32512
+#define OCR_IBEAM 32513
+#define OCR_WAIT 32514
+#define OCR_CROSS 32515
+#define OCR_UP 32516
+#define OCR_SIZE 32640 /* OBSOLETE: use OCR_SIZEALL */
+#define OCR_ICON 32641 /* OBSOLETE: use OCR_NORMAL */
+#define OCR_SIZENWSE 32642
+#define OCR_SIZENESW 32643
+#define OCR_SIZEWE 32644
+#define OCR_SIZENS 32645
+#define OCR_SIZEALL 32646
+#define OCR_ICOCUR 32647 /* OBSOLETE: use OIC_WINLOGO */
+#define OCR_NO 32648
+#if(WINVER >= 0x0500)
+#define OCR_HAND 32649
+#endif /* WINVER >= 0x0500 */
+#if(WINVER >= 0x0400)
+#define OCR_APPSTARTING 32650
+#endif /* WINVER >= 0x0400 */
+
+
+#define OIC_SAMPLE 32512
+#define OIC_HAND 32513
+#define OIC_QUES 32514
+#define OIC_BANG 32515
+#define OIC_NOTE 32516
+#if(WINVER >= 0x0400)
+#define OIC_WINLOGO 32517
+#define OIC_WARNING OIC_BANG
+#define OIC_ERROR OIC_HAND
+#define OIC_INFORMATION OIC_NOTE
+#endif /* WINVER >= 0x0400 */
+
+
+
+#endif /* OEMRESOURCE */
+
+#define ORD_LANGDRIVER 1 /* The ordinal number for the entry point of
+ ** language drivers.
+ */
+
+#ifndef NOICONS
+
+/*
+ * Standard Icon IDs
+ */
+#ifdef RC_INVOKED
+#define IDI_APPLICATION 32512
+#define IDI_HAND 32513
+#define IDI_QUESTION 32514
+#define IDI_EXCLAMATION 32515
+#define IDI_ASTERISK 32516
+#if(WINVER >= 0x0400)
+#define IDI_WINLOGO 32517
+#endif /* WINVER >= 0x0400 */
+#else
+#define IDI_APPLICATION MAKEINTRESOURCE(32512)
+#define IDI_HAND MAKEINTRESOURCE(32513)
+#define IDI_QUESTION MAKEINTRESOURCE(32514)
+#define IDI_EXCLAMATION MAKEINTRESOURCE(32515)
+#define IDI_ASTERISK MAKEINTRESOURCE(32516)
+#if(WINVER >= 0x0400)
+#define IDI_WINLOGO MAKEINTRESOURCE(32517)
+#endif /* WINVER >= 0x0400 */
+#endif /* RC_INVOKED */
+
+#if(WINVER >= 0x0400)
+#define IDI_WARNING IDI_EXCLAMATION
+#define IDI_ERROR IDI_HAND
+#define IDI_INFORMATION IDI_ASTERISK
+#endif /* WINVER >= 0x0400 */
+
+
+#endif /* !NOICONS */
+
+WINUSERAPI
+int
+WINAPI
+LoadStringA(
+ IN HINSTANCE hInstance,
+ IN UINT uID,
+ OUT LPSTR lpBuffer,
+ IN int nBufferMax);
+WINUSERAPI
+int
+WINAPI
+LoadStringW(
+ IN HINSTANCE hInstance,
+ IN UINT uID,
+ OUT LPWSTR lpBuffer,
+ IN int nBufferMax);
+#ifdef UNICODE
+#define LoadString LoadStringW
+#else
+#define LoadString LoadStringA
+#endif // !UNICODE
+
+
+/*
+ * Dialog Box Command IDs
+ */
+#define IDOK 1
+#define IDCANCEL 2
+#define IDABORT 3
+#define IDRETRY 4
+#define IDIGNORE 5
+#define IDYES 6
+#define IDNO 7
+#if(WINVER >= 0x0400)
+#define IDCLOSE 8
+#define IDHELP 9
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+#define IDTRYAGAIN 10
+#define IDCONTINUE 11
+#endif /* WINVER >= 0x0500 */
+
+#if(WINVER >= 0x0501)
+#ifndef IDTIMEOUT
+#define IDTIMEOUT 32000
+#endif
+#endif /* WINVER >= 0x0501 */
+
+
+#ifndef NOCTLMGR
+
+/*
+ * Control Manager Structures and Definitions
+ */
+
+#ifndef NOWINSTYLES
+
+
+/*
+ * Edit Control Styles
+ */
+#define ES_LEFT 0x0000L
+#define ES_CENTER 0x0001L
+#define ES_RIGHT 0x0002L
+#define ES_MULTILINE 0x0004L
+#define ES_UPPERCASE 0x0008L
+#define ES_LOWERCASE 0x0010L
+#define ES_PASSWORD 0x0020L
+#define ES_AUTOVSCROLL 0x0040L
+#define ES_AUTOHSCROLL 0x0080L
+#define ES_NOHIDESEL 0x0100L
+#define ES_OEMCONVERT 0x0400L
+#define ES_READONLY 0x0800L
+#define ES_WANTRETURN 0x1000L
+#if(WINVER >= 0x0400)
+#define ES_NUMBER 0x2000L
+#endif /* WINVER >= 0x0400 */
+
+
+#endif /* !NOWINSTYLES */
+
+/*
+ * Edit Control Notification Codes
+ */
+#define EN_SETFOCUS 0x0100
+#define EN_KILLFOCUS 0x0200
+#define EN_CHANGE 0x0300
+#define EN_UPDATE 0x0400
+#define EN_ERRSPACE 0x0500
+#define EN_MAXTEXT 0x0501
+#define EN_HSCROLL 0x0601
+#define EN_VSCROLL 0x0602
+
+#if(_WIN32_WINNT >= 0x0500)
+#define EN_ALIGN_LTR_EC 0x0700
+#define EN_ALIGN_RTL_EC 0x0701
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(WINVER >= 0x0400)
+/* Edit control EM_SETMARGIN parameters */
+#define EC_LEFTMARGIN 0x0001
+#define EC_RIGHTMARGIN 0x0002
+#define EC_USEFONTINFO 0xffff
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+/* wParam of EM_GET/SETIMESTATUS */
+#define EMSIS_COMPOSITIONSTRING 0x0001
+
+/* lParam for EMSIS_COMPOSITIONSTRING */
+#define EIMES_GETCOMPSTRATONCE 0x0001
+#define EIMES_CANCELCOMPSTRINFOCUS 0x0002
+#define EIMES_COMPLETECOMPSTRKILLFOCUS 0x0004
+#endif /* WINVER >= 0x0500 */
+
+#ifndef NOWINMESSAGES
+
+
+/*
+ * Edit Control Messages
+ */
+#define EM_GETSEL 0x00B0
+#define EM_SETSEL 0x00B1
+#define EM_GETRECT 0x00B2
+#define EM_SETRECT 0x00B3
+#define EM_SETRECTNP 0x00B4
+#define EM_SCROLL 0x00B5
+#define EM_LINESCROLL 0x00B6
+#define EM_SCROLLCARET 0x00B7
+#define EM_GETMODIFY 0x00B8
+#define EM_SETMODIFY 0x00B9
+#define EM_GETLINECOUNT 0x00BA
+#define EM_LINEINDEX 0x00BB
+#define EM_SETHANDLE 0x00BC
+#define EM_GETHANDLE 0x00BD
+#define EM_GETTHUMB 0x00BE
+#define EM_LINELENGTH 0x00C1
+#define EM_REPLACESEL 0x00C2
+#define EM_GETLINE 0x00C4
+#define EM_LIMITTEXT 0x00C5
+#define EM_CANUNDO 0x00C6
+#define EM_UNDO 0x00C7
+#define EM_FMTLINES 0x00C8
+#define EM_LINEFROMCHAR 0x00C9
+#define EM_SETTABSTOPS 0x00CB
+#define EM_SETPASSWORDCHAR 0x00CC
+#define EM_EMPTYUNDOBUFFER 0x00CD
+#define EM_GETFIRSTVISIBLELINE 0x00CE
+#define EM_SETREADONLY 0x00CF
+#define EM_SETWORDBREAKPROC 0x00D0
+#define EM_GETWORDBREAKPROC 0x00D1
+#define EM_GETPASSWORDCHAR 0x00D2
+#if(WINVER >= 0x0400)
+#define EM_SETMARGINS 0x00D3
+#define EM_GETMARGINS 0x00D4
+#define EM_SETLIMITTEXT EM_LIMITTEXT /* ;win40 Name change */
+#define EM_GETLIMITTEXT 0x00D5
+#define EM_POSFROMCHAR 0x00D6
+#define EM_CHARFROMPOS 0x00D7
+#endif /* WINVER >= 0x0400 */
+
+#if(WINVER >= 0x0500)
+#define EM_SETIMESTATUS 0x00D8
+#define EM_GETIMESTATUS 0x00D9
+#endif /* WINVER >= 0x0500 */
+
+
+#endif /* !NOWINMESSAGES */
+
+/*
+ * EDITWORDBREAKPROC code values
+ */
+#define WB_LEFT 0
+#define WB_RIGHT 1
+#define WB_ISDELIMITER 2
+
+
+/*
+ * Button Control Styles
+ */
+#define BS_PUSHBUTTON 0x00000000L
+#define BS_DEFPUSHBUTTON 0x00000001L
+#define BS_CHECKBOX 0x00000002L
+#define BS_AUTOCHECKBOX 0x00000003L
+#define BS_RADIOBUTTON 0x00000004L
+#define BS_3STATE 0x00000005L
+#define BS_AUTO3STATE 0x00000006L
+#define BS_GROUPBOX 0x00000007L
+#define BS_USERBUTTON 0x00000008L
+#define BS_AUTORADIOBUTTON 0x00000009L
+#define BS_PUSHBOX 0x0000000AL
+#define BS_OWNERDRAW 0x0000000BL
+#define BS_TYPEMASK 0x0000000FL
+#define BS_LEFTTEXT 0x00000020L
+#if(WINVER >= 0x0400)
+#define BS_TEXT 0x00000000L
+#define BS_ICON 0x00000040L
+#define BS_BITMAP 0x00000080L
+#define BS_LEFT 0x00000100L
+#define BS_RIGHT 0x00000200L
+#define BS_CENTER 0x00000300L
+#define BS_TOP 0x00000400L
+#define BS_BOTTOM 0x00000800L
+#define BS_VCENTER 0x00000C00L
+#define BS_PUSHLIKE 0x00001000L
+#define BS_MULTILINE 0x00002000L
+#define BS_NOTIFY 0x00004000L
+#define BS_FLAT 0x00008000L
+#define BS_RIGHTBUTTON BS_LEFTTEXT
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * User Button Notification Codes
+ */
+#define BN_CLICKED 0
+#define BN_PAINT 1
+#define BN_HILITE 2
+#define BN_UNHILITE 3
+#define BN_DISABLE 4
+#define BN_DOUBLECLICKED 5
+#if(WINVER >= 0x0400)
+#define BN_PUSHED BN_HILITE
+#define BN_UNPUSHED BN_UNHILITE
+#define BN_DBLCLK BN_DOUBLECLICKED
+#define BN_SETFOCUS 6
+#define BN_KILLFOCUS 7
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Button Control Messages
+ */
+#define BM_GETCHECK 0x00F0
+#define BM_SETCHECK 0x00F1
+#define BM_GETSTATE 0x00F2
+#define BM_SETSTATE 0x00F3
+#define BM_SETSTYLE 0x00F4
+#if(WINVER >= 0x0400)
+#define BM_CLICK 0x00F5
+#define BM_GETIMAGE 0x00F6
+#define BM_SETIMAGE 0x00F7
+
+#define BST_UNCHECKED 0x0000
+#define BST_CHECKED 0x0001
+#define BST_INDETERMINATE 0x0002
+#define BST_PUSHED 0x0004
+#define BST_FOCUS 0x0008
+#endif /* WINVER >= 0x0400 */
+
+/*
+ * Static Control Constants
+ */
+#define SS_LEFT 0x00000000L
+#define SS_CENTER 0x00000001L
+#define SS_RIGHT 0x00000002L
+#define SS_ICON 0x00000003L
+#define SS_BLACKRECT 0x00000004L
+#define SS_GRAYRECT 0x00000005L
+#define SS_WHITERECT 0x00000006L
+#define SS_BLACKFRAME 0x00000007L
+#define SS_GRAYFRAME 0x00000008L
+#define SS_WHITEFRAME 0x00000009L
+#define SS_USERITEM 0x0000000AL
+#define SS_SIMPLE 0x0000000BL
+#define SS_LEFTNOWORDWRAP 0x0000000CL
+#if(WINVER >= 0x0400)
+#define SS_OWNERDRAW 0x0000000DL
+#define SS_BITMAP 0x0000000EL
+#define SS_ENHMETAFILE 0x0000000FL
+#define SS_ETCHEDHORZ 0x00000010L
+#define SS_ETCHEDVERT 0x00000011L
+#define SS_ETCHEDFRAME 0x00000012L
+#define SS_TYPEMASK 0x0000001FL
+#endif /* WINVER >= 0x0400 */
+#if(WINVER >= 0x0501)
+#define SS_REALSIZECONTROL 0x00000040L
+#endif /* WINVER >= 0x0501 */
+#define SS_NOPREFIX 0x00000080L /* Don't do "&" character translation */
+#if(WINVER >= 0x0400)
+#define SS_NOTIFY 0x00000100L
+#define SS_CENTERIMAGE 0x00000200L
+#define SS_RIGHTJUST 0x00000400L
+#define SS_REALSIZEIMAGE 0x00000800L
+#define SS_SUNKEN 0x00001000L
+#define SS_EDITCONTROL 0x00002000L
+#define SS_ENDELLIPSIS 0x00004000L
+#define SS_PATHELLIPSIS 0x00008000L
+#define SS_WORDELLIPSIS 0x0000C000L
+#define SS_ELLIPSISMASK 0x0000C000L
+#endif /* WINVER >= 0x0400 */
+
+
+
+#ifndef NOWINMESSAGES
+/*
+ * Static Control Mesages
+ */
+#define STM_SETICON 0x0170
+#define STM_GETICON 0x0171
+#if(WINVER >= 0x0400)
+#define STM_SETIMAGE 0x0172
+#define STM_GETIMAGE 0x0173
+#define STN_CLICKED 0
+#define STN_DBLCLK 1
+#define STN_ENABLE 2
+#define STN_DISABLE 3
+#endif /* WINVER >= 0x0400 */
+#define STM_MSGMAX 0x0174
+#endif /* !NOWINMESSAGES */
+
+/*
+ * Dialog window class
+ */
+#define WC_DIALOG (MAKEINTATOM(0x8002))
+
+/*
+ * Get/SetWindowWord/Long offsets for use with WC_DIALOG windows
+ */
+#define DWL_MSGRESULT 0
+#define DWL_DLGPROC 4
+#define DWL_USER 8
+
+#ifdef _WIN64
+
+#undef DWL_MSGRESULT
+#undef DWL_DLGPROC
+#undef DWL_USER
+
+#endif /* _WIN64 */
+
+#define DWLP_MSGRESULT 0
+#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT)
+#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
+
+/*
+ * Dialog Manager Routines
+ */
+
+#ifndef NOMSG
+
+WINUSERAPI
+BOOL
+WINAPI
+IsDialogMessageA(
+ IN HWND hDlg,
+ IN LPMSG lpMsg);
+WINUSERAPI
+BOOL
+WINAPI
+IsDialogMessageW(
+ IN HWND hDlg,
+ IN LPMSG lpMsg);
+#ifdef UNICODE
+#define IsDialogMessage IsDialogMessageW
+#else
+#define IsDialogMessage IsDialogMessageA
+#endif // !UNICODE
+
+#endif /* !NOMSG */
+
+WINUSERAPI
+BOOL
+WINAPI
+MapDialogRect(
+ IN HWND hDlg,
+ IN OUT LPRECT lpRect);
+
+WINUSERAPI
+int
+WINAPI
+DlgDirListA(
+ IN HWND hDlg,
+ IN OUT LPSTR lpPathSpec,
+ IN int nIDListBox,
+ IN int nIDStaticPath,
+ IN UINT uFileType);
+WINUSERAPI
+int
+WINAPI
+DlgDirListW(
+ IN HWND hDlg,
+ IN OUT LPWSTR lpPathSpec,
+ IN int nIDListBox,
+ IN int nIDStaticPath,
+ IN UINT uFileType);
+#ifdef UNICODE
+#define DlgDirList DlgDirListW
+#else
+#define DlgDirList DlgDirListA
+#endif // !UNICODE
+
+/*
+ * DlgDirList, DlgDirListComboBox flags values
+ */
+#define DDL_READWRITE 0x0000
+#define DDL_READONLY 0x0001
+#define DDL_HIDDEN 0x0002
+#define DDL_SYSTEM 0x0004
+#define DDL_DIRECTORY 0x0010
+#define DDL_ARCHIVE 0x0020
+
+#define DDL_POSTMSGS 0x2000
+#define DDL_DRIVES 0x4000
+#define DDL_EXCLUSIVE 0x8000
+
+WINUSERAPI
+BOOL
+WINAPI
+DlgDirSelectExA(
+ IN HWND hDlg,
+ OUT LPSTR lpString,
+ IN int nCount,
+ IN int nIDListBox);
+WINUSERAPI
+BOOL
+WINAPI
+DlgDirSelectExW(
+ IN HWND hDlg,
+ OUT LPWSTR lpString,
+ IN int nCount,
+ IN int nIDListBox);
+#ifdef UNICODE
+#define DlgDirSelectEx DlgDirSelectExW
+#else
+#define DlgDirSelectEx DlgDirSelectExA
+#endif // !UNICODE
+
+WINUSERAPI
+int
+WINAPI
+DlgDirListComboBoxA(
+ IN HWND hDlg,
+ IN OUT LPSTR lpPathSpec,
+ IN int nIDComboBox,
+ IN int nIDStaticPath,
+ IN UINT uFiletype);
+WINUSERAPI
+int
+WINAPI
+DlgDirListComboBoxW(
+ IN HWND hDlg,
+ IN OUT LPWSTR lpPathSpec,
+ IN int nIDComboBox,
+ IN int nIDStaticPath,
+ IN UINT uFiletype);
+#ifdef UNICODE
+#define DlgDirListComboBox DlgDirListComboBoxW
+#else
+#define DlgDirListComboBox DlgDirListComboBoxA
+#endif // !UNICODE
+
+WINUSERAPI
+BOOL
+WINAPI
+DlgDirSelectComboBoxExA(
+ IN HWND hDlg,
+ OUT LPSTR lpString,
+ IN int nCount,
+ IN int nIDComboBox);
+WINUSERAPI
+BOOL
+WINAPI
+DlgDirSelectComboBoxExW(
+ IN HWND hDlg,
+ OUT LPWSTR lpString,
+ IN int nCount,
+ IN int nIDComboBox);
+#ifdef UNICODE
+#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExW
+#else
+#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExA
+#endif // !UNICODE
+
+
+
+/*
+ * Dialog Styles
+ */
+#define DS_ABSALIGN 0x01L
+#define DS_SYSMODAL 0x02L
+#define DS_LOCALEDIT 0x20L /* Edit items get Local storage. */
+#define DS_SETFONT 0x40L /* User specified font for Dlg controls */
+#define DS_MODALFRAME 0x80L /* Can be combined with WS_CAPTION */
+#define DS_NOIDLEMSG 0x100L /* WM_ENTERIDLE message will not be sent */
+#define DS_SETFOREGROUND 0x200L /* not in win3.1 */
+
+
+#if(WINVER >= 0x0400)
+#define DS_3DLOOK 0x0004L
+#define DS_FIXEDSYS 0x0008L
+#define DS_NOFAILCREATE 0x0010L
+#define DS_CONTROL 0x0400L
+#define DS_CENTER 0x0800L
+#define DS_CENTERMOUSE 0x1000L
+#define DS_CONTEXTHELP 0x2000L
+
+#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS)
+#endif /* WINVER >= 0x0400 */
+
+#if(_WIN32_WCE >= 0x0500)
+#define DS_USEPIXELS 0x8000L
+#endif
+
+
+#define DM_GETDEFID (WM_USER+0)
+#define DM_SETDEFID (WM_USER+1)
+
+#if(WINVER >= 0x0400)
+#define DM_REPOSITION (WM_USER+2)
+#endif /* WINVER >= 0x0400 */
+/*
+ * Returned in HIWORD() of DM_GETDEFID result if msg is supported
+ */
+#define DC_HASDEFID 0x534B
+
+/*
+ * Dialog Codes
+ */
+#define DLGC_WANTARROWS 0x0001 /* Control wants arrow keys */
+#define DLGC_WANTTAB 0x0002 /* Control wants tab keys */
+#define DLGC_WANTALLKEYS 0x0004 /* Control wants all keys */
+#define DLGC_WANTMESSAGE 0x0004 /* Pass message to control */
+#define DLGC_HASSETSEL 0x0008 /* Understands EM_SETSEL message */
+#define DLGC_DEFPUSHBUTTON 0x0010 /* Default pushbutton */
+#define DLGC_UNDEFPUSHBUTTON 0x0020 /* Non-default pushbutton */
+#define DLGC_RADIOBUTTON 0x0040 /* Radio button */
+#define DLGC_WANTCHARS 0x0080 /* Want WM_CHAR messages */
+#define DLGC_STATIC 0x0100 /* Static item: don't include */
+#define DLGC_BUTTON 0x2000 /* Button item: can be checked */
+
+#define LB_CTLCODE 0L
+
+/*
+ * Listbox Return Values
+ */
+#define LB_OKAY 0
+#define LB_ERR (-1)
+#define LB_ERRSPACE (-2)
+
+/*
+** The idStaticPath parameter to DlgDirList can have the following values
+** ORed if the list box should show other details of the files along with
+** the name of the files;
+*/
+ /* all other details also will be returned */
+
+
+/*
+ * Listbox Notification Codes
+ */
+#define LBN_ERRSPACE (-2)
+#define LBN_SELCHANGE 1
+#define LBN_DBLCLK 2
+#define LBN_SELCANCEL 3
+#define LBN_SETFOCUS 4
+#define LBN_KILLFOCUS 5
+
+
+
+#ifndef NOWINMESSAGES
+
+/*
+ * Listbox messages
+ */
+#define LB_ADDSTRING 0x0180
+#define LB_INSERTSTRING 0x0181
+#define LB_DELETESTRING 0x0182
+#define LB_SELITEMRANGEEX 0x0183
+#define LB_RESETCONTENT 0x0184
+#define LB_SETSEL 0x0185
+#define LB_SETCURSEL 0x0186
+#define LB_GETSEL 0x0187
+#define LB_GETCURSEL 0x0188
+#define LB_GETTEXT 0x0189
+#define LB_GETTEXTLEN 0x018A
+#define LB_GETCOUNT 0x018B
+#define LB_SELECTSTRING 0x018C
+#define LB_DIR 0x018D
+#define LB_GETTOPINDEX 0x018E
+#define LB_FINDSTRING 0x018F
+#define LB_GETSELCOUNT 0x0190
+#define LB_GETSELITEMS 0x0191
+#define LB_SETTABSTOPS 0x0192
+#define LB_GETHORIZONTALEXTENT 0x0193
+#define LB_SETHORIZONTALEXTENT 0x0194
+#define LB_SETCOLUMNWIDTH 0x0195
+#define LB_ADDFILE 0x0196
+#define LB_SETTOPINDEX 0x0197
+#define LB_GETITEMRECT 0x0198
+#define LB_GETITEMDATA 0x0199
+#define LB_SETITEMDATA 0x019A
+#define LB_SELITEMRANGE 0x019B
+#define LB_SETANCHORINDEX 0x019C
+#define LB_GETANCHORINDEX 0x019D
+#define LB_SETCARETINDEX 0x019E
+#define LB_GETCARETINDEX 0x019F
+#define LB_SETITEMHEIGHT 0x01A0
+#define LB_GETITEMHEIGHT 0x01A1
+#define LB_FINDSTRINGEXACT 0x01A2
+#define LB_SETLOCALE 0x01A5
+#define LB_GETLOCALE 0x01A6
+#define LB_SETCOUNT 0x01A7
+#if(WINVER >= 0x0400)
+#define LB_INITSTORAGE 0x01A8
+#define LB_ITEMFROMPOINT 0x01A9
+#endif /* WINVER >= 0x0400 */
+#if(_WIN32_WCE >= 0x0400)
+#define LB_MULTIPLEADDSTRING 0x01B1
+#endif
+
+
+#if(_WIN32_WINNT >= 0x0501)
+#define LB_GETLISTBOXINFO 0x01B2
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define LB_MSGMAX 0x01B3
+#elif(_WIN32_WCE >= 0x0400)
+#define LB_MSGMAX 0x01B1
+#elif(WINVER >= 0x0400)
+#define LB_MSGMAX 0x01B0
+#else
+#define LB_MSGMAX 0x01A8
+#endif
+
+#endif /* !NOWINMESSAGES */
+
+#ifndef NOWINSTYLES
+
+
+/*
+ * Listbox Styles
+ */
+#define LBS_NOTIFY 0x0001L
+#define LBS_SORT 0x0002L
+#define LBS_NOREDRAW 0x0004L
+#define LBS_MULTIPLESEL 0x0008L
+#define LBS_OWNERDRAWFIXED 0x0010L
+#define LBS_OWNERDRAWVARIABLE 0x0020L
+#define LBS_HASSTRINGS 0x0040L
+#define LBS_USETABSTOPS 0x0080L
+#define LBS_NOINTEGRALHEIGHT 0x0100L
+#define LBS_MULTICOLUMN 0x0200L
+#define LBS_WANTKEYBOARDINPUT 0x0400L
+#define LBS_EXTENDEDSEL 0x0800L
+#define LBS_DISABLENOSCROLL 0x1000L
+#define LBS_NODATA 0x2000L
+#if(WINVER >= 0x0400)
+#define LBS_NOSEL 0x4000L
+#endif /* WINVER >= 0x0400 */
+#define LBS_COMBOBOX 0x8000L
+
+#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
+
+
+#endif /* !NOWINSTYLES */
+
+
+/*
+ * Combo Box return Values
+ */
+#define CB_OKAY 0
+#define CB_ERR (-1)
+#define CB_ERRSPACE (-2)
+
+
+/*
+ * Combo Box Notification Codes
+ */
+#define CBN_ERRSPACE (-1)
+#define CBN_SELCHANGE 1
+#define CBN_DBLCLK 2
+#define CBN_SETFOCUS 3
+#define CBN_KILLFOCUS 4
+#define CBN_EDITCHANGE 5
+#define CBN_EDITUPDATE 6
+#define CBN_DROPDOWN 7
+#define CBN_CLOSEUP 8
+#define CBN_SELENDOK 9
+#define CBN_SELENDCANCEL 10
+
+#ifndef NOWINSTYLES
+
+/*
+ * Combo Box styles
+ */
+#define CBS_SIMPLE 0x0001L
+#define CBS_DROPDOWN 0x0002L
+#define CBS_DROPDOWNLIST 0x0003L
+#define CBS_OWNERDRAWFIXED 0x0010L
+#define CBS_OWNERDRAWVARIABLE 0x0020L
+#define CBS_AUTOHSCROLL 0x0040L
+#define CBS_OEMCONVERT 0x0080L
+#define CBS_SORT 0x0100L
+#define CBS_HASSTRINGS 0x0200L
+#define CBS_NOINTEGRALHEIGHT 0x0400L
+#define CBS_DISABLENOSCROLL 0x0800L
+#if(WINVER >= 0x0400)
+#define CBS_UPPERCASE 0x2000L
+#define CBS_LOWERCASE 0x4000L
+#endif /* WINVER >= 0x0400 */
+
+#endif /* !NOWINSTYLES */
+
+
+/*
+ * Combo Box messages
+ */
+#ifndef NOWINMESSAGES
+#define CB_GETEDITSEL 0x0140
+#define CB_LIMITTEXT 0x0141
+#define CB_SETEDITSEL 0x0142
+#define CB_ADDSTRING 0x0143
+#define CB_DELETESTRING 0x0144
+#define CB_DIR 0x0145
+#define CB_GETCOUNT 0x0146
+#define CB_GETCURSEL 0x0147
+#define CB_GETLBTEXT 0x0148
+#define CB_GETLBTEXTLEN 0x0149
+#define CB_INSERTSTRING 0x014A
+#define CB_RESETCONTENT 0x014B
+#define CB_FINDSTRING 0x014C
+#define CB_SELECTSTRING 0x014D
+#define CB_SETCURSEL 0x014E
+#define CB_SHOWDROPDOWN 0x014F
+#define CB_GETITEMDATA 0x0150
+#define CB_SETITEMDATA 0x0151
+#define CB_GETDROPPEDCONTROLRECT 0x0152
+#define CB_SETITEMHEIGHT 0x0153
+#define CB_GETITEMHEIGHT 0x0154
+#define CB_SETEXTENDEDUI 0x0155
+#define CB_GETEXTENDEDUI 0x0156
+#define CB_GETDROPPEDSTATE 0x0157
+#define CB_FINDSTRINGEXACT 0x0158
+#define CB_SETLOCALE 0x0159
+#define CB_GETLOCALE 0x015A
+#if(WINVER >= 0x0400)
+#define CB_GETTOPINDEX 0x015b
+#define CB_SETTOPINDEX 0x015c
+#define CB_GETHORIZONTALEXTENT 0x015d
+#define CB_SETHORIZONTALEXTENT 0x015e
+#define CB_GETDROPPEDWIDTH 0x015f
+#define CB_SETDROPPEDWIDTH 0x0160
+#define CB_INITSTORAGE 0x0161
+#if(_WIN32_WCE >= 0x0400)
+#define CB_MULTIPLEADDSTRING 0x0163
+#endif
+#endif /* WINVER >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define CB_GETCOMBOBOXINFO 0x0164
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define CB_MSGMAX 0x0165
+#elif(_WIN32_WCE >= 0x0400)
+#define CB_MSGMAX 0x0163
+#elif(WINVER >= 0x0400)
+#define CB_MSGMAX 0x0162
+#else
+#define CB_MSGMAX 0x015B
+#endif
+#endif /* !NOWINMESSAGES */
+
+
+
+#ifndef NOWINSTYLES
+
+
+/*
+ * Scroll Bar Styles
+ */
+#define SBS_HORZ 0x0000L
+#define SBS_VERT 0x0001L
+#define SBS_TOPALIGN 0x0002L
+#define SBS_LEFTALIGN 0x0002L
+#define SBS_BOTTOMALIGN 0x0004L
+#define SBS_RIGHTALIGN 0x0004L
+#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L
+#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
+#define SBS_SIZEBOX 0x0008L
+#if(WINVER >= 0x0400)
+#define SBS_SIZEGRIP 0x0010L
+#endif /* WINVER >= 0x0400 */
+
+
+#endif /* !NOWINSTYLES */
+
+/*
+ * Scroll bar messages
+ */
+#ifndef NOWINMESSAGES
+#define SBM_SETPOS 0x00E0 /*not in win3.1 */
+#define SBM_GETPOS 0x00E1 /*not in win3.1 */
+#define SBM_SETRANGE 0x00E2 /*not in win3.1 */
+#define SBM_SETRANGEREDRAW 0x00E6 /*not in win3.1 */
+#define SBM_GETRANGE 0x00E3 /*not in win3.1 */
+#define SBM_ENABLE_ARROWS 0x00E4 /*not in win3.1 */
+#if(WINVER >= 0x0400)
+#define SBM_SETSCROLLINFO 0x00E9
+#define SBM_GETSCROLLINFO 0x00EA
+#endif /* WINVER >= 0x0400 */
+
+#if(_WIN32_WINNT >= 0x0501)
+#define SBM_GETSCROLLBARINFO 0x00EB
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#if(WINVER >= 0x0400)
+#define SIF_RANGE 0x0001
+#define SIF_PAGE 0x0002
+#define SIF_POS 0x0004
+#define SIF_DISABLENOSCROLL 0x0008
+#define SIF_TRACKPOS 0x0010
+#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+
+typedef struct tagSCROLLINFO
+{
+ UINT cbSize;
+ UINT fMask;
+ int nMin;
+ int nMax;
+ UINT nPage;
+ int nPos;
+ int nTrackPos;
+} SCROLLINFO, FAR *LPSCROLLINFO;
+typedef SCROLLINFO CONST FAR *LPCSCROLLINFO;
+
+WINUSERAPI int WINAPI SetScrollInfo(IN HWND, IN int, IN LPCSCROLLINFO, IN BOOL);
+WINUSERAPI BOOL WINAPI GetScrollInfo(IN HWND, IN int, IN OUT LPSCROLLINFO);
+
+#endif /* WINVER >= 0x0400 */
+#endif /* !NOWINMESSAGES */
+#endif /* !NOCTLMGR */
+
+#ifndef NOMDI
+
+/*
+ * MDI client style bits
+ */
+#define MDIS_ALLCHILDSTYLES 0x0001
+
+/*
+ * wParam Flags for WM_MDITILE and WM_MDICASCADE messages.
+ */
+#define MDITILE_VERTICAL 0x0000 /*not in win3.1 */
+#define MDITILE_HORIZONTAL 0x0001 /*not in win3.1 */
+#define MDITILE_SKIPDISABLED 0x0002 /*not in win3.1 */
+#if(_WIN32_WINNT >= 0x0500)
+#define MDITILE_ZORDER 0x0004
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+typedef struct tagMDICREATESTRUCTA {
+ LPCSTR szClass;
+ LPCSTR szTitle;
+ HANDLE hOwner;
+ int x;
+ int y;
+ int cx;
+ int cy;
+ DWORD style;
+ LPARAM lParam; /* app-defined stuff */
+} MDICREATESTRUCTA, *LPMDICREATESTRUCTA;
+typedef struct tagMDICREATESTRUCTW {
+ LPCWSTR szClass;
+ LPCWSTR szTitle;
+ HANDLE hOwner;
+ int x;
+ int y;
+ int cx;
+ int cy;
+ DWORD style;
+ LPARAM lParam; /* app-defined stuff */
+} MDICREATESTRUCTW, *LPMDICREATESTRUCTW;
+#ifdef UNICODE
+typedef MDICREATESTRUCTW MDICREATESTRUCT;
+typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT;
+#else
+typedef MDICREATESTRUCTA MDICREATESTRUCT;
+typedef LPMDICREATESTRUCTA LPMDICREATESTRUCT;
+#endif // UNICODE
+
+typedef struct tagCLIENTCREATESTRUCT {
+ HANDLE hWindowMenu;
+ UINT idFirstChild;
+} CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT;
+
+WINUSERAPI
+LRESULT
+WINAPI
+DefFrameProcA(
+ IN HWND hWnd,
+ IN HWND hWndMDIClient,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+LRESULT
+WINAPI
+DefFrameProcW(
+ IN HWND hWnd,
+ IN HWND hWndMDIClient,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define DefFrameProc DefFrameProcW
+#else
+#define DefFrameProc DefFrameProcA
+#endif // !UNICODE
+
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefMDIChildProcA(
+ IN HWND hWnd,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+WINUSERAPI
+#ifndef _MAC
+LRESULT
+WINAPI
+#else
+LRESULT
+CALLBACK
+#endif
+DefMDIChildProcW(
+ IN HWND hWnd,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam);
+#ifdef UNICODE
+#define DefMDIChildProc DefMDIChildProcW
+#else
+#define DefMDIChildProc DefMDIChildProcA
+#endif // !UNICODE
+
+#ifndef NOMSG
+
+WINUSERAPI
+BOOL
+WINAPI
+TranslateMDISysAccel(
+ IN HWND hWndClient,
+ IN LPMSG lpMsg);
+
+#endif /* !NOMSG */
+
+WINUSERAPI
+UINT
+WINAPI
+ArrangeIconicWindows(
+ IN HWND hWnd);
+
+WINUSERAPI
+HWND
+WINAPI
+CreateMDIWindowA(
+ IN LPCSTR lpClassName,
+ IN LPCSTR lpWindowName,
+ IN DWORD dwStyle,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight,
+ IN HWND hWndParent,
+ IN HINSTANCE hInstance,
+ IN LPARAM lParam
+ );
+WINUSERAPI
+HWND
+WINAPI
+CreateMDIWindowW(
+ IN LPCWSTR lpClassName,
+ IN LPCWSTR lpWindowName,
+ IN DWORD dwStyle,
+ IN int X,
+ IN int Y,
+ IN int nWidth,
+ IN int nHeight,
+ IN HWND hWndParent,
+ IN HINSTANCE hInstance,
+ IN LPARAM lParam
+ );
+#ifdef UNICODE
+#define CreateMDIWindow CreateMDIWindowW
+#else
+#define CreateMDIWindow CreateMDIWindowA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0400)
+WINUSERAPI WORD WINAPI TileWindows( IN HWND hwndParent, IN UINT wHow, IN CONST RECT * lpRect, IN UINT cKids, IN const HWND FAR * lpKids);
+WINUSERAPI WORD WINAPI CascadeWindows( IN HWND hwndParent, IN UINT wHow, IN CONST RECT * lpRect, IN UINT cKids, IN const HWND FAR * lpKids);
+#endif /* WINVER >= 0x0400 */
+#endif /* !NOMDI */
+
+#endif /* !NOUSER */
+
+/****** Help support ********************************************************/
+
+#ifndef NOHELP
+
+typedef DWORD HELPPOLY;
+typedef struct tagMULTIKEYHELPA {
+#ifndef _MAC
+ DWORD mkSize;
+#else
+ WORD mkSize;
+#endif
+ CHAR mkKeylist;
+ CHAR szKeyphrase[1];
+} MULTIKEYHELPA, *PMULTIKEYHELPA, *LPMULTIKEYHELPA;
+typedef struct tagMULTIKEYHELPW {
+#ifndef _MAC
+ DWORD mkSize;
+#else
+ WORD mkSize;
+#endif
+ WCHAR mkKeylist;
+ WCHAR szKeyphrase[1];
+} MULTIKEYHELPW, *PMULTIKEYHELPW, *LPMULTIKEYHELPW;
+#ifdef UNICODE
+typedef MULTIKEYHELPW MULTIKEYHELP;
+typedef PMULTIKEYHELPW PMULTIKEYHELP;
+typedef LPMULTIKEYHELPW LPMULTIKEYHELP;
+#else
+typedef MULTIKEYHELPA MULTIKEYHELP;
+typedef PMULTIKEYHELPA PMULTIKEYHELP;
+typedef LPMULTIKEYHELPA LPMULTIKEYHELP;
+#endif // UNICODE
+
+typedef struct tagHELPWININFOA {
+ int wStructSize;
+ int x;
+ int y;
+ int dx;
+ int dy;
+ int wMax;
+ CHAR rgchMember[2];
+} HELPWININFOA, *PHELPWININFOA, *LPHELPWININFOA;
+typedef struct tagHELPWININFOW {
+ int wStructSize;
+ int x;
+ int y;
+ int dx;
+ int dy;
+ int wMax;
+ WCHAR rgchMember[2];
+} HELPWININFOW, *PHELPWININFOW, *LPHELPWININFOW;
+#ifdef UNICODE
+typedef HELPWININFOW HELPWININFO;
+typedef PHELPWININFOW PHELPWININFO;
+typedef LPHELPWININFOW LPHELPWININFO;
+#else
+typedef HELPWININFOA HELPWININFO;
+typedef PHELPWININFOA PHELPWININFO;
+typedef LPHELPWININFOA LPHELPWININFO;
+#endif // UNICODE
+
+
+/*
+ * Commands to pass to WinHelp()
+ */
+#define HELP_CONTEXT 0x0001L /* Display topic in ulTopic */
+#define HELP_QUIT 0x0002L /* Terminate help */
+#define HELP_INDEX 0x0003L /* Display index */
+#define HELP_CONTENTS 0x0003L
+#define HELP_HELPONHELP 0x0004L /* Display help on using help */
+#define HELP_SETINDEX 0x0005L /* Set current Index for multi index help */
+#define HELP_SETCONTENTS 0x0005L
+#define HELP_CONTEXTPOPUP 0x0008L
+#define HELP_FORCEFILE 0x0009L
+#define HELP_KEY 0x0101L /* Display topic for keyword in offabData */
+#define HELP_COMMAND 0x0102L
+#define HELP_PARTIALKEY 0x0105L
+#define HELP_MULTIKEY 0x0201L
+#define HELP_SETWINPOS 0x0203L
+#if(WINVER >= 0x0400)
+#define HELP_CONTEXTMENU 0x000a
+#define HELP_FINDER 0x000b
+#define HELP_WM_HELP 0x000c
+#define HELP_SETPOPUP_POS 0x000d
+
+#define HELP_TCARD 0x8000
+#define HELP_TCARD_DATA 0x0010
+#define HELP_TCARD_OTHER_CALLER 0x0011
+
+// These are in winhelp.h in Win95.
+#define IDH_NO_HELP 28440
+#define IDH_MISSING_CONTEXT 28441 // Control doesn't have matching help context
+#define IDH_GENERIC_HELP_BUTTON 28442 // Property sheet help button
+#define IDH_OK 28443
+#define IDH_CANCEL 28444
+#define IDH_HELP 28445
+
+#endif /* WINVER >= 0x0400 */
+
+
+
+WINUSERAPI
+BOOL
+WINAPI
+WinHelpA(
+ IN HWND hWndMain,
+ IN LPCSTR lpszHelp,
+ IN UINT uCommand,
+ IN ULONG_PTR dwData
+ );
+WINUSERAPI
+BOOL
+WINAPI
+WinHelpW(
+ IN HWND hWndMain,
+ IN LPCWSTR lpszHelp,
+ IN UINT uCommand,
+ IN ULONG_PTR dwData
+ );
+#ifdef UNICODE
+#define WinHelp WinHelpW
+#else
+#define WinHelp WinHelpA
+#endif // !UNICODE
+
+#endif /* !NOHELP */
+
+#if(WINVER >= 0x0500)
+
+#define GR_GDIOBJECTS 0 /* Count of GDI objects */
+#define GR_USEROBJECTS 1 /* Count of USER objects */
+
+WINUSERAPI
+DWORD
+WINAPI
+GetGuiResources(
+ IN HANDLE hProcess,
+ IN DWORD uiFlags);
+
+#endif /* WINVER >= 0x0500 */
+
+
+#ifndef NOSYSPARAMSINFO
+
+/*
+ * Parameter for SystemParametersInfo()
+ */
+
+#define SPI_GETBEEP 0x0001
+#define SPI_SETBEEP 0x0002
+#define SPI_GETMOUSE 0x0003
+#define SPI_SETMOUSE 0x0004
+#define SPI_GETBORDER 0x0005
+#define SPI_SETBORDER 0x0006
+#define SPI_GETKEYBOARDSPEED 0x000A
+#define SPI_SETKEYBOARDSPEED 0x000B
+#define SPI_LANGDRIVER 0x000C
+#define SPI_ICONHORIZONTALSPACING 0x000D
+#define SPI_GETSCREENSAVETIMEOUT 0x000E
+#define SPI_SETSCREENSAVETIMEOUT 0x000F
+#define SPI_GETSCREENSAVEACTIVE 0x0010
+#define SPI_SETSCREENSAVEACTIVE 0x0011
+#define SPI_GETGRIDGRANULARITY 0x0012
+#define SPI_SETGRIDGRANULARITY 0x0013
+#define SPI_SETDESKWALLPAPER 0x0014
+#define SPI_SETDESKPATTERN 0x0015
+#define SPI_GETKEYBOARDDELAY 0x0016
+#define SPI_SETKEYBOARDDELAY 0x0017
+#define SPI_ICONVERTICALSPACING 0x0018
+#define SPI_GETICONTITLEWRAP 0x0019
+#define SPI_SETICONTITLEWRAP 0x001A
+#define SPI_GETMENUDROPALIGNMENT 0x001B
+#define SPI_SETMENUDROPALIGNMENT 0x001C
+#define SPI_SETDOUBLECLKWIDTH 0x001D
+#define SPI_SETDOUBLECLKHEIGHT 0x001E
+#define SPI_GETICONTITLELOGFONT 0x001F
+#define SPI_SETDOUBLECLICKTIME 0x0020
+#define SPI_SETMOUSEBUTTONSWAP 0x0021
+#define SPI_SETICONTITLELOGFONT 0x0022
+#define SPI_GETFASTTASKSWITCH 0x0023
+#define SPI_SETFASTTASKSWITCH 0x0024
+#if(WINVER >= 0x0400)
+#define SPI_SETDRAGFULLWINDOWS 0x0025
+#define SPI_GETDRAGFULLWINDOWS 0x0026
+#define SPI_GETNONCLIENTMETRICS 0x0029
+#define SPI_SETNONCLIENTMETRICS 0x002A
+#define SPI_GETMINIMIZEDMETRICS 0x002B
+#define SPI_SETMINIMIZEDMETRICS 0x002C
+#define SPI_GETICONMETRICS 0x002D
+#define SPI_SETICONMETRICS 0x002E
+#define SPI_SETWORKAREA 0x002F
+#define SPI_GETWORKAREA 0x0030
+#define SPI_SETPENWINDOWS 0x0031
+
+#define SPI_GETHIGHCONTRAST 0x0042
+#define SPI_SETHIGHCONTRAST 0x0043
+#define SPI_GETKEYBOARDPREF 0x0044
+#define SPI_SETKEYBOARDPREF 0x0045
+#define SPI_GETSCREENREADER 0x0046
+#define SPI_SETSCREENREADER 0x0047
+#define SPI_GETANIMATION 0x0048
+#define SPI_SETANIMATION 0x0049
+#define SPI_GETFONTSMOOTHING 0x004A
+#define SPI_SETFONTSMOOTHING 0x004B
+#define SPI_SETDRAGWIDTH 0x004C
+#define SPI_SETDRAGHEIGHT 0x004D
+#define SPI_SETHANDHELD 0x004E
+#define SPI_GETLOWPOWERTIMEOUT 0x004F
+#define SPI_GETPOWEROFFTIMEOUT 0x0050
+#define SPI_SETLOWPOWERTIMEOUT 0x0051
+#define SPI_SETPOWEROFFTIMEOUT 0x0052
+#define SPI_GETLOWPOWERACTIVE 0x0053
+#define SPI_GETPOWEROFFACTIVE 0x0054
+#define SPI_SETLOWPOWERACTIVE 0x0055
+#define SPI_SETPOWEROFFACTIVE 0x0056
+#define SPI_SETCURSORS 0x0057
+#define SPI_SETICONS 0x0058
+#define SPI_GETDEFAULTINPUTLANG 0x0059
+#define SPI_SETDEFAULTINPUTLANG 0x005A
+#define SPI_SETLANGTOGGLE 0x005B
+#define SPI_GETWINDOWSEXTENSION 0x005C
+#define SPI_SETMOUSETRAILS 0x005D
+#define SPI_GETMOUSETRAILS 0x005E
+#define SPI_SETSCREENSAVERRUNNING 0x0061
+#define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING
+#endif /* WINVER >= 0x0400 */
+#define SPI_GETFILTERKEYS 0x0032
+#define SPI_SETFILTERKEYS 0x0033
+#define SPI_GETTOGGLEKEYS 0x0034
+#define SPI_SETTOGGLEKEYS 0x0035
+#define SPI_GETMOUSEKEYS 0x0036
+#define SPI_SETMOUSEKEYS 0x0037
+#define SPI_GETSHOWSOUNDS 0x0038
+#define SPI_SETSHOWSOUNDS 0x0039
+#define SPI_GETSTICKYKEYS 0x003A
+#define SPI_SETSTICKYKEYS 0x003B
+#define SPI_GETACCESSTIMEOUT 0x003C
+#define SPI_SETACCESSTIMEOUT 0x003D
+#if(WINVER >= 0x0400)
+#define SPI_GETSERIALKEYS 0x003E
+#define SPI_SETSERIALKEYS 0x003F
+#endif /* WINVER >= 0x0400 */
+#define SPI_GETSOUNDSENTRY 0x0040
+#define SPI_SETSOUNDSENTRY 0x0041
+#if(_WIN32_WINNT >= 0x0400)
+#define SPI_GETSNAPTODEFBUTTON 0x005F
+#define SPI_SETSNAPTODEFBUTTON 0x0060
+#endif /* _WIN32_WINNT >= 0x0400 */
+#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
+#define SPI_GETMOUSEHOVERWIDTH 0x0062
+#define SPI_SETMOUSEHOVERWIDTH 0x0063
+#define SPI_GETMOUSEHOVERHEIGHT 0x0064
+#define SPI_SETMOUSEHOVERHEIGHT 0x0065
+#define SPI_GETMOUSEHOVERTIME 0x0066
+#define SPI_SETMOUSEHOVERTIME 0x0067
+#define SPI_GETWHEELSCROLLLINES 0x0068
+#define SPI_SETWHEELSCROLLLINES 0x0069
+#define SPI_GETMENUSHOWDELAY 0x006A
+#define SPI_SETMENUSHOWDELAY 0x006B
+
+
+#define SPI_GETSHOWIMEUI 0x006E
+#define SPI_SETSHOWIMEUI 0x006F
+#endif
+
+
+#if(WINVER >= 0x0500)
+#define SPI_GETMOUSESPEED 0x0070
+#define SPI_SETMOUSESPEED 0x0071
+#define SPI_GETSCREENSAVERRUNNING 0x0072
+#define SPI_GETDESKWALLPAPER 0x0073
+#endif /* WINVER >= 0x0500 */
+
+
+#if(WINVER >= 0x0500)
+#define SPI_GETACTIVEWINDOWTRACKING 0x1000
+#define SPI_SETACTIVEWINDOWTRACKING 0x1001
+#define SPI_GETMENUANIMATION 0x1002
+#define SPI_SETMENUANIMATION 0x1003
+#define SPI_GETCOMBOBOXANIMATION 0x1004
+#define SPI_SETCOMBOBOXANIMATION 0x1005
+#define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006
+#define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007
+#define SPI_GETGRADIENTCAPTIONS 0x1008
+#define SPI_SETGRADIENTCAPTIONS 0x1009
+#define SPI_GETKEYBOARDCUES 0x100A
+#define SPI_SETKEYBOARDCUES 0x100B
+#define SPI_GETMENUUNDERLINES SPI_GETKEYBOARDCUES
+#define SPI_SETMENUUNDERLINES SPI_SETKEYBOARDCUES
+#define SPI_GETACTIVEWNDTRKZORDER 0x100C
+#define SPI_SETACTIVEWNDTRKZORDER 0x100D
+#define SPI_GETHOTTRACKING 0x100E
+#define SPI_SETHOTTRACKING 0x100F
+#define SPI_GETMENUFADE 0x1012
+#define SPI_SETMENUFADE 0x1013
+#define SPI_GETSELECTIONFADE 0x1014
+#define SPI_SETSELECTIONFADE 0x1015
+#define SPI_GETTOOLTIPANIMATION 0x1016
+#define SPI_SETTOOLTIPANIMATION 0x1017
+#define SPI_GETTOOLTIPFADE 0x1018
+#define SPI_SETTOOLTIPFADE 0x1019
+#define SPI_GETCURSORSHADOW 0x101A
+#define SPI_SETCURSORSHADOW 0x101B
+#if(_WIN32_WINNT >= 0x0501)
+#define SPI_GETMOUSESONAR 0x101C
+#define SPI_SETMOUSESONAR 0x101D
+#define SPI_GETMOUSECLICKLOCK 0x101E
+#define SPI_SETMOUSECLICKLOCK 0x101F
+#define SPI_GETMOUSEVANISH 0x1020
+#define SPI_SETMOUSEVANISH 0x1021
+#define SPI_GETFLATMENU 0x1022
+#define SPI_SETFLATMENU 0x1023
+#define SPI_GETDROPSHADOW 0x1024
+#define SPI_SETDROPSHADOW 0x1025
+#define SPI_GETBLOCKSENDINPUTRESETS 0x1026
+#define SPI_SETBLOCKSENDINPUTRESETS 0x1027
+#endif /* _WIN32_WINNT >= 0x0501 */
+#define SPI_GETUIEFFECTS 0x103E
+#define SPI_SETUIEFFECTS 0x103F
+
+#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
+#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
+#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002
+#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003
+#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
+#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
+#define SPI_GETCARETWIDTH 0x2006
+#define SPI_SETCARETWIDTH 0x2007
+
+#if(_WIN32_WINNT >= 0x0501)
+#define SPI_GETMOUSECLICKLOCKTIME 0x2008
+#define SPI_SETMOUSECLICKLOCKTIME 0x2009
+#define SPI_GETFONTSMOOTHINGTYPE 0x200A
+#define SPI_SETFONTSMOOTHINGTYPE 0x200B
+
+/* constants for SPI_GETFONTSMOOTHINGTYPE and SPI_SETFONTSMOOTHINGTYPE: */
+#define FE_FONTSMOOTHINGSTANDARD 0x0001
+#define FE_FONTSMOOTHINGCLEARTYPE 0x0002
+#define FE_FONTSMOOTHINGDOCKING 0x8000
+
+#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C
+#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D
+
+#define SPI_GETFOCUSBORDERWIDTH 0x200E
+#define SPI_SETFOCUSBORDERWIDTH 0x200F
+#define SPI_GETFOCUSBORDERHEIGHT 0x2010
+#define SPI_SETFOCUSBORDERHEIGHT 0x2011
+
+#define SPI_GETFONTSMOOTHINGORIENTATION 0x2012
+#define SPI_SETFONTSMOOTHINGORIENTATION 0x2013
+
+/* constants for SPI_GETFONTSMOOTHINGORIENTATION and SPI_SETFONTSMOOTHINGORIENTATION: */
+#define FE_FONTSMOOTHINGORIENTATIONBGR 0x0000
+#define FE_FONTSMOOTHINGORIENTATIONRGB 0x0001
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#endif /* WINVER >= 0x0500 */
+
+/*
+ * Flags
+ */
+#define SPIF_UPDATEINIFILE 0x0001
+#define SPIF_SENDWININICHANGE 0x0002
+#define SPIF_SENDCHANGE SPIF_SENDWININICHANGE
+
+
+#define METRICS_USEDEFAULT -1
+#ifdef _WINGDI_
+#ifndef NOGDI
+typedef struct tagNONCLIENTMETRICSA
+{
+ UINT cbSize;
+ int iBorderWidth;
+ int iScrollWidth;
+ int iScrollHeight;
+ int iCaptionWidth;
+ int iCaptionHeight;
+ LOGFONTA lfCaptionFont;
+ int iSmCaptionWidth;
+ int iSmCaptionHeight;
+ LOGFONTA lfSmCaptionFont;
+ int iMenuWidth;
+ int iMenuHeight;
+ LOGFONTA lfMenuFont;
+ LOGFONTA lfStatusFont;
+ LOGFONTA lfMessageFont;
+} NONCLIENTMETRICSA, *PNONCLIENTMETRICSA, FAR* LPNONCLIENTMETRICSA;
+typedef struct tagNONCLIENTMETRICSW
+{
+ UINT cbSize;
+ int iBorderWidth;
+ int iScrollWidth;
+ int iScrollHeight;
+ int iCaptionWidth;
+ int iCaptionHeight;
+ LOGFONTW lfCaptionFont;
+ int iSmCaptionWidth;
+ int iSmCaptionHeight;
+ LOGFONTW lfSmCaptionFont;
+ int iMenuWidth;
+ int iMenuHeight;
+ LOGFONTW lfMenuFont;
+ LOGFONTW lfStatusFont;
+ LOGFONTW lfMessageFont;
+} NONCLIENTMETRICSW, *PNONCLIENTMETRICSW, FAR* LPNONCLIENTMETRICSW;
+#ifdef UNICODE
+typedef NONCLIENTMETRICSW NONCLIENTMETRICS;
+typedef PNONCLIENTMETRICSW PNONCLIENTMETRICS;
+typedef LPNONCLIENTMETRICSW LPNONCLIENTMETRICS;
+#else
+typedef NONCLIENTMETRICSA NONCLIENTMETRICS;
+typedef PNONCLIENTMETRICSA PNONCLIENTMETRICS;
+typedef LPNONCLIENTMETRICSA LPNONCLIENTMETRICS;
+#endif // UNICODE
+#endif /* NOGDI */
+#endif /* _WINGDI_ */
+
+#define ARW_BOTTOMLEFT 0x0000L
+#define ARW_BOTTOMRIGHT 0x0001L
+#define ARW_TOPLEFT 0x0002L
+#define ARW_TOPRIGHT 0x0003L
+#define ARW_STARTMASK 0x0003L
+#define ARW_STARTRIGHT 0x0001L
+#define ARW_STARTTOP 0x0002L
+
+#define ARW_LEFT 0x0000L
+#define ARW_RIGHT 0x0000L
+#define ARW_UP 0x0004L
+#define ARW_DOWN 0x0004L
+#define ARW_HIDE 0x0008L
+
+typedef struct tagMINIMIZEDMETRICS
+{
+ UINT cbSize;
+ int iWidth;
+ int iHorzGap;
+ int iVertGap;
+ int iArrange;
+} MINIMIZEDMETRICS, *PMINIMIZEDMETRICS, *LPMINIMIZEDMETRICS;
+
+#ifdef _WINGDI_
+#ifndef NOGDI
+typedef struct tagICONMETRICSA
+{
+ UINT cbSize;
+ int iHorzSpacing;
+ int iVertSpacing;
+ int iTitleWrap;
+ LOGFONTA lfFont;
+} ICONMETRICSA, *PICONMETRICSA, *LPICONMETRICSA;
+typedef struct tagICONMETRICSW
+{
+ UINT cbSize;
+ int iHorzSpacing;
+ int iVertSpacing;
+ int iTitleWrap;
+ LOGFONTW lfFont;
+} ICONMETRICSW, *PICONMETRICSW, *LPICONMETRICSW;
+#ifdef UNICODE
+typedef ICONMETRICSW ICONMETRICS;
+typedef PICONMETRICSW PICONMETRICS;
+typedef LPICONMETRICSW LPICONMETRICS;
+#else
+typedef ICONMETRICSA ICONMETRICS;
+typedef PICONMETRICSA PICONMETRICS;
+typedef LPICONMETRICSA LPICONMETRICS;
+#endif // UNICODE
+#endif /* NOGDI */
+#endif /* _WINGDI_ */
+
+typedef struct tagANIMATIONINFO
+{
+ UINT cbSize;
+ int iMinAnimate;
+} ANIMATIONINFO, *LPANIMATIONINFO;
+
+typedef struct tagSERIALKEYSA
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPSTR lpszActivePort;
+ LPSTR lpszPort;
+ UINT iBaudRate;
+ UINT iPortState;
+ UINT iActive;
+} SERIALKEYSA, *LPSERIALKEYSA;
+typedef struct tagSERIALKEYSW
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPWSTR lpszActivePort;
+ LPWSTR lpszPort;
+ UINT iBaudRate;
+ UINT iPortState;
+ UINT iActive;
+} SERIALKEYSW, *LPSERIALKEYSW;
+#ifdef UNICODE
+typedef SERIALKEYSW SERIALKEYS;
+typedef LPSERIALKEYSW LPSERIALKEYS;
+#else
+typedef SERIALKEYSA SERIALKEYS;
+typedef LPSERIALKEYSA LPSERIALKEYS;
+#endif // UNICODE
+
+/* flags for SERIALKEYS dwFlags field */
+#define SERKF_SERIALKEYSON 0x00000001
+#define SERKF_AVAILABLE 0x00000002
+#define SERKF_INDICATOR 0x00000004
+
+
+typedef struct tagHIGHCONTRASTA
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPSTR lpszDefaultScheme;
+} HIGHCONTRASTA, *LPHIGHCONTRASTA;
+typedef struct tagHIGHCONTRASTW
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPWSTR lpszDefaultScheme;
+} HIGHCONTRASTW, *LPHIGHCONTRASTW;
+#ifdef UNICODE
+typedef HIGHCONTRASTW HIGHCONTRAST;
+typedef LPHIGHCONTRASTW LPHIGHCONTRAST;
+#else
+typedef HIGHCONTRASTA HIGHCONTRAST;
+typedef LPHIGHCONTRASTA LPHIGHCONTRAST;
+#endif // UNICODE
+
+/* flags for HIGHCONTRAST dwFlags field */
+#define HCF_HIGHCONTRASTON 0x00000001
+#define HCF_AVAILABLE 0x00000002
+#define HCF_HOTKEYACTIVE 0x00000004
+#define HCF_CONFIRMHOTKEY 0x00000008
+#define HCF_HOTKEYSOUND 0x00000010
+#define HCF_INDICATOR 0x00000020
+#define HCF_HOTKEYAVAILABLE 0x00000040
+
+/* Flags for ChangeDisplaySettings */
+#define CDS_UPDATEREGISTRY 0x00000001
+#define CDS_TEST 0x00000002
+#define CDS_FULLSCREEN 0x00000004
+#define CDS_GLOBAL 0x00000008
+#define CDS_SET_PRIMARY 0x00000010
+#define CDS_VIDEOPARAMETERS 0x00000020
+#define CDS_RESET 0x40000000
+#define CDS_NORESET 0x10000000
+
+#include
+
+/* Return values for ChangeDisplaySettings */
+#define DISP_CHANGE_SUCCESSFUL 0
+#define DISP_CHANGE_RESTART 1
+#define DISP_CHANGE_FAILED -1
+#define DISP_CHANGE_BADMODE -2
+#define DISP_CHANGE_NOTUPDATED -3
+#define DISP_CHANGE_BADFLAGS -4
+#define DISP_CHANGE_BADPARAM -5
+#if(_WIN32_WINNT >= 0x0501)
+#define DISP_CHANGE_BADDUALVIEW -6
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+#ifdef _WINGDI_
+#ifndef NOGDI
+
+WINUSERAPI
+LONG
+WINAPI
+ChangeDisplaySettingsA(
+ IN LPDEVMODEA lpDevMode,
+ IN DWORD dwFlags);
+WINUSERAPI
+LONG
+WINAPI
+ChangeDisplaySettingsW(
+ IN LPDEVMODEW lpDevMode,
+ IN DWORD dwFlags);
+#ifdef UNICODE
+#define ChangeDisplaySettings ChangeDisplaySettingsW
+#else
+#define ChangeDisplaySettings ChangeDisplaySettingsA
+#endif // !UNICODE
+
+WINUSERAPI
+LONG
+WINAPI
+ChangeDisplaySettingsExA(
+ IN LPCSTR lpszDeviceName,
+ IN LPDEVMODEA lpDevMode,
+ IN HWND hwnd,
+ IN DWORD dwflags,
+ IN LPVOID lParam);
+WINUSERAPI
+LONG
+WINAPI
+ChangeDisplaySettingsExW(
+ IN LPCWSTR lpszDeviceName,
+ IN LPDEVMODEW lpDevMode,
+ IN HWND hwnd,
+ IN DWORD dwflags,
+ IN LPVOID lParam);
+#ifdef UNICODE
+#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW
+#else
+#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA
+#endif // !UNICODE
+
+#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
+#define ENUM_REGISTRY_SETTINGS ((DWORD)-2)
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplaySettingsA(
+ IN LPCSTR lpszDeviceName,
+ IN DWORD iModeNum,
+ OUT LPDEVMODEA lpDevMode);
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplaySettingsW(
+ IN LPCWSTR lpszDeviceName,
+ IN DWORD iModeNum,
+ OUT LPDEVMODEW lpDevMode);
+#ifdef UNICODE
+#define EnumDisplaySettings EnumDisplaySettingsW
+#else
+#define EnumDisplaySettings EnumDisplaySettingsA
+#endif // !UNICODE
+
+#if(WINVER >= 0x0500)
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplaySettingsExA(
+ IN LPCSTR lpszDeviceName,
+ IN DWORD iModeNum,
+ OUT LPDEVMODEA lpDevMode,
+ IN DWORD dwFlags);
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplaySettingsExW(
+ IN LPCWSTR lpszDeviceName,
+ IN DWORD iModeNum,
+ OUT LPDEVMODEW lpDevMode,
+ IN DWORD dwFlags);
+#ifdef UNICODE
+#define EnumDisplaySettingsEx EnumDisplaySettingsExW
+#else
+#define EnumDisplaySettingsEx EnumDisplaySettingsExA
+#endif // !UNICODE
+
+/* Flags for EnumDisplaySettingsEx */
+#define EDS_RAWMODE 0x00000002
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplayDevicesA(
+ IN LPCSTR lpDevice,
+ IN DWORD iDevNum,
+ OUT PDISPLAY_DEVICEA lpDisplayDevice,
+ IN DWORD dwFlags);
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplayDevicesW(
+ IN LPCWSTR lpDevice,
+ IN DWORD iDevNum,
+ OUT PDISPLAY_DEVICEW lpDisplayDevice,
+ IN DWORD dwFlags);
+#ifdef UNICODE
+#define EnumDisplayDevices EnumDisplayDevicesW
+#else
+#define EnumDisplayDevices EnumDisplayDevicesA
+#endif // !UNICODE
+#endif /* WINVER >= 0x0500 */
+
+#endif /* NOGDI */
+#endif /* _WINGDI_ */
+
+
+WINUSERAPI
+BOOL
+WINAPI
+SystemParametersInfoA(
+ IN UINT uiAction,
+ IN UINT uiParam,
+ IN OUT PVOID pvParam,
+ IN UINT fWinIni);
+WINUSERAPI
+BOOL
+WINAPI
+SystemParametersInfoW(
+ IN UINT uiAction,
+ IN UINT uiParam,
+ IN OUT PVOID pvParam,
+ IN UINT fWinIni);
+#ifdef UNICODE
+#define SystemParametersInfo SystemParametersInfoW
+#else
+#define SystemParametersInfo SystemParametersInfoA
+#endif // !UNICODE
+
+
+#endif /* !NOSYSPARAMSINFO */
+
+/*
+ * Accessibility support
+ */
+typedef struct tagFILTERKEYS
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD iWaitMSec; // Acceptance Delay
+ DWORD iDelayMSec; // Delay Until Repeat
+ DWORD iRepeatMSec; // Repeat Rate
+ DWORD iBounceMSec; // Debounce Time
+} FILTERKEYS, *LPFILTERKEYS;
+
+/*
+ * FILTERKEYS dwFlags field
+ */
+#define FKF_FILTERKEYSON 0x00000001
+#define FKF_AVAILABLE 0x00000002
+#define FKF_HOTKEYACTIVE 0x00000004
+#define FKF_CONFIRMHOTKEY 0x00000008
+#define FKF_HOTKEYSOUND 0x00000010
+#define FKF_INDICATOR 0x00000020
+#define FKF_CLICKON 0x00000040
+
+typedef struct tagSTICKYKEYS
+{
+ UINT cbSize;
+ DWORD dwFlags;
+} STICKYKEYS, *LPSTICKYKEYS;
+
+/*
+ * STICKYKEYS dwFlags field
+ */
+#define SKF_STICKYKEYSON 0x00000001
+#define SKF_AVAILABLE 0x00000002
+#define SKF_HOTKEYACTIVE 0x00000004
+#define SKF_CONFIRMHOTKEY 0x00000008
+#define SKF_HOTKEYSOUND 0x00000010
+#define SKF_INDICATOR 0x00000020
+#define SKF_AUDIBLEFEEDBACK 0x00000040
+#define SKF_TRISTATE 0x00000080
+#define SKF_TWOKEYSOFF 0x00000100
+#if(_WIN32_WINNT >= 0x0500)
+#define SKF_LALTLATCHED 0x10000000
+#define SKF_LCTLLATCHED 0x04000000
+#define SKF_LSHIFTLATCHED 0x01000000
+#define SKF_RALTLATCHED 0x20000000
+#define SKF_RCTLLATCHED 0x08000000
+#define SKF_RSHIFTLATCHED 0x02000000
+#define SKF_LWINLATCHED 0x40000000
+#define SKF_RWINLATCHED 0x80000000
+#define SKF_LALTLOCKED 0x00100000
+#define SKF_LCTLLOCKED 0x00040000
+#define SKF_LSHIFTLOCKED 0x00010000
+#define SKF_RALTLOCKED 0x00200000
+#define SKF_RCTLLOCKED 0x00080000
+#define SKF_RSHIFTLOCKED 0x00020000
+#define SKF_LWINLOCKED 0x00400000
+#define SKF_RWINLOCKED 0x00800000
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+typedef struct tagMOUSEKEYS
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD iMaxSpeed;
+ DWORD iTimeToMaxSpeed;
+ DWORD iCtrlSpeed;
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+} MOUSEKEYS, *LPMOUSEKEYS;
+
+/*
+ * MOUSEKEYS dwFlags field
+ */
+#define MKF_MOUSEKEYSON 0x00000001
+#define MKF_AVAILABLE 0x00000002
+#define MKF_HOTKEYACTIVE 0x00000004
+#define MKF_CONFIRMHOTKEY 0x00000008
+#define MKF_HOTKEYSOUND 0x00000010
+#define MKF_INDICATOR 0x00000020
+#define MKF_MODIFIERS 0x00000040
+#define MKF_REPLACENUMBERS 0x00000080
+#if(_WIN32_WINNT >= 0x0500)
+#define MKF_LEFTBUTTONSEL 0x10000000
+#define MKF_RIGHTBUTTONSEL 0x20000000
+#define MKF_LEFTBUTTONDOWN 0x01000000
+#define MKF_RIGHTBUTTONDOWN 0x02000000
+#define MKF_MOUSEMODE 0x80000000
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+typedef struct tagACCESSTIMEOUT
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD iTimeOutMSec;
+} ACCESSTIMEOUT, *LPACCESSTIMEOUT;
+
+/*
+ * ACCESSTIMEOUT dwFlags field
+ */
+#define ATF_TIMEOUTON 0x00000001
+#define ATF_ONOFFFEEDBACK 0x00000002
+
+/* values for SOUNDSENTRY iFSGrafEffect field */
+#define SSGF_NONE 0
+#define SSGF_DISPLAY 3
+
+/* values for SOUNDSENTRY iFSTextEffect field */
+#define SSTF_NONE 0
+#define SSTF_CHARS 1
+#define SSTF_BORDER 2
+#define SSTF_DISPLAY 3
+
+/* values for SOUNDSENTRY iWindowsEffect field */
+#define SSWF_NONE 0
+#define SSWF_TITLE 1
+#define SSWF_WINDOW 2
+#define SSWF_DISPLAY 3
+#define SSWF_CUSTOM 4
+
+typedef struct tagSOUNDSENTRYA
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD iFSTextEffect;
+ DWORD iFSTextEffectMSec;
+ DWORD iFSTextEffectColorBits;
+ DWORD iFSGrafEffect;
+ DWORD iFSGrafEffectMSec;
+ DWORD iFSGrafEffectColor;
+ DWORD iWindowsEffect;
+ DWORD iWindowsEffectMSec;
+ LPSTR lpszWindowsEffectDLL;
+ DWORD iWindowsEffectOrdinal;
+} SOUNDSENTRYA, *LPSOUNDSENTRYA;
+typedef struct tagSOUNDSENTRYW
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD iFSTextEffect;
+ DWORD iFSTextEffectMSec;
+ DWORD iFSTextEffectColorBits;
+ DWORD iFSGrafEffect;
+ DWORD iFSGrafEffectMSec;
+ DWORD iFSGrafEffectColor;
+ DWORD iWindowsEffect;
+ DWORD iWindowsEffectMSec;
+ LPWSTR lpszWindowsEffectDLL;
+ DWORD iWindowsEffectOrdinal;
+} SOUNDSENTRYW, *LPSOUNDSENTRYW;
+#ifdef UNICODE
+typedef SOUNDSENTRYW SOUNDSENTRY;
+typedef LPSOUNDSENTRYW LPSOUNDSENTRY;
+#else
+typedef SOUNDSENTRYA SOUNDSENTRY;
+typedef LPSOUNDSENTRYA LPSOUNDSENTRY;
+#endif // UNICODE
+
+/*
+ * SOUNDSENTRY dwFlags field
+ */
+#define SSF_SOUNDSENTRYON 0x00000001
+#define SSF_AVAILABLE 0x00000002
+#define SSF_INDICATOR 0x00000004
+
+typedef struct tagTOGGLEKEYS
+{
+ UINT cbSize;
+ DWORD dwFlags;
+} TOGGLEKEYS, *LPTOGGLEKEYS;
+
+/*
+ * TOGGLEKEYS dwFlags field
+ */
+#define TKF_TOGGLEKEYSON 0x00000001
+#define TKF_AVAILABLE 0x00000002
+#define TKF_HOTKEYACTIVE 0x00000004
+#define TKF_CONFIRMHOTKEY 0x00000008
+#define TKF_HOTKEYSOUND 0x00000010
+#define TKF_INDICATOR 0x00000020
+
+/*
+ * Set debug level
+ */
+
+WINUSERAPI
+VOID
+WINAPI
+SetDebugErrorLevel(
+ IN DWORD dwLevel
+ );
+
+/*
+ * SetLastErrorEx() types.
+ */
+
+#define SLE_ERROR 0x00000001
+#define SLE_MINORERROR 0x00000002
+#define SLE_WARNING 0x00000003
+
+WINUSERAPI
+VOID
+WINAPI
+SetLastErrorEx(
+ IN DWORD dwErrCode,
+ IN DWORD dwType
+ );
+
+WINUSERAPI
+int
+WINAPI
+InternalGetWindowText(
+ IN HWND hWnd,
+ OUT LPWSTR lpString,
+ IN int nMaxCount);
+
+#if defined(WINNT)
+WINUSERAPI
+BOOL
+WINAPI
+EndTask(
+ IN HWND hWnd,
+ IN BOOL fShutDown,
+ IN BOOL fForce);
+#endif
+
+
+#if(WINVER >= 0x0500)
+
+/*
+ * Multimonitor API.
+ */
+
+#define MONITOR_DEFAULTTONULL 0x00000000
+#define MONITOR_DEFAULTTOPRIMARY 0x00000001
+#define MONITOR_DEFAULTTONEAREST 0x00000002
+
+WINUSERAPI
+HMONITOR
+WINAPI
+MonitorFromPoint(
+ IN POINT pt,
+ IN DWORD dwFlags);
+
+WINUSERAPI
+HMONITOR
+WINAPI
+MonitorFromRect(
+ IN LPCRECT lprc,
+ IN DWORD dwFlags);
+
+WINUSERAPI
+HMONITOR
+WINAPI
+MonitorFromWindow( IN HWND hwnd, IN DWORD dwFlags);
+
+#define MONITORINFOF_PRIMARY 0x00000001
+
+#ifndef CCHDEVICENAME
+#define CCHDEVICENAME 32
+#endif
+
+typedef struct tagMONITORINFO
+{
+ DWORD cbSize;
+ RECT rcMonitor;
+ RECT rcWork;
+ DWORD dwFlags;
+} MONITORINFO, *LPMONITORINFO;
+
+#ifdef __cplusplus
+typedef struct tagMONITORINFOEXA : public tagMONITORINFO
+{
+ CHAR szDevice[CCHDEVICENAME];
+} MONITORINFOEXA, *LPMONITORINFOEXA;
+typedef struct tagMONITORINFOEXW : public tagMONITORINFO
+{
+ WCHAR szDevice[CCHDEVICENAME];
+} MONITORINFOEXW, *LPMONITORINFOEXW;
+#ifdef UNICODE
+typedef MONITORINFOEXW MONITORINFOEX;
+typedef LPMONITORINFOEXW LPMONITORINFOEX;
+#else
+typedef MONITORINFOEXA MONITORINFOEX;
+typedef LPMONITORINFOEXA LPMONITORINFOEX;
+#endif // UNICODE
+#else // ndef __cplusplus
+typedef struct tagMONITORINFOEXA
+{
+ MONITORINFO;
+ CHAR szDevice[CCHDEVICENAME];
+} MONITORINFOEXA, *LPMONITORINFOEXA;
+typedef struct tagMONITORINFOEXW
+{
+ MONITORINFO;
+ WCHAR szDevice[CCHDEVICENAME];
+} MONITORINFOEXW, *LPMONITORINFOEXW;
+#ifdef UNICODE
+typedef MONITORINFOEXW MONITORINFOEX;
+typedef LPMONITORINFOEXW LPMONITORINFOEX;
+#else
+typedef MONITORINFOEXA MONITORINFOEX;
+typedef LPMONITORINFOEXA LPMONITORINFOEX;
+#endif // UNICODE
+#endif
+
+WINUSERAPI BOOL WINAPI GetMonitorInfoA( IN HMONITOR hMonitor, OUT LPMONITORINFO lpmi);
+WINUSERAPI BOOL WINAPI GetMonitorInfoW( IN HMONITOR hMonitor, OUT LPMONITORINFO lpmi);
+#ifdef UNICODE
+#define GetMonitorInfo GetMonitorInfoW
+#else
+#define GetMonitorInfo GetMonitorInfoA
+#endif // !UNICODE
+
+typedef BOOL (CALLBACK* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM);
+
+WINUSERAPI
+BOOL
+WINAPI
+EnumDisplayMonitors(
+ IN HDC hdc,
+ IN LPCRECT lprcClip,
+ IN MONITORENUMPROC lpfnEnum,
+ IN LPARAM dwData);
+
+
+#ifndef NOWINABLE
+
+/*
+ * WinEvents - Active Accessibility hooks
+ */
+
+WINUSERAPI
+VOID
+WINAPI
+NotifyWinEvent(
+ IN DWORD event,
+ IN HWND hwnd,
+ IN LONG idObject,
+ IN LONG idChild);
+
+typedef VOID (CALLBACK* WINEVENTPROC)(
+ HWINEVENTHOOK hWinEventHook,
+ DWORD event,
+ HWND hwnd,
+ LONG idObject,
+ LONG idChild,
+ DWORD idEventThread,
+ DWORD dwmsEventTime);
+
+WINUSERAPI
+HWINEVENTHOOK
+WINAPI
+SetWinEventHook(
+ IN DWORD eventMin,
+ IN DWORD eventMax,
+ IN HMODULE hmodWinEventProc,
+ IN WINEVENTPROC pfnWinEventProc,
+ IN DWORD idProcess,
+ IN DWORD idThread,
+ IN DWORD dwFlags);
+
+#if(_WIN32_WINNT >= 0x0501)
+WINUSERAPI
+BOOL
+WINAPI
+IsWinEventHookInstalled(
+ IN DWORD event);
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+/*
+ * dwFlags for SetWinEventHook
+ */
+#define WINEVENT_OUTOFCONTEXT 0x0000 // Events are ASYNC
+#define WINEVENT_SKIPOWNTHREAD 0x0001 // Don't call back for events on installer's thread
+#define WINEVENT_SKIPOWNPROCESS 0x0002 // Don't call back for events on installer's process
+#define WINEVENT_INCONTEXT 0x0004 // Events are SYNC, this causes your dll to be injected into every process
+
+WINUSERAPI
+BOOL
+WINAPI
+UnhookWinEvent(
+ IN HWINEVENTHOOK hWinEventHook);
+
+/*
+ * idObject values for WinEventProc and NotifyWinEvent
+ */
+
+/*
+ * hwnd + idObject can be used with OLEACC.DLL's OleGetObjectFromWindow()
+ * to get an interface pointer to the container. indexChild is the item
+ * within the container in question. Setup a VARIANT with vt VT_I4 and
+ * lVal the indexChild and pass that in to all methods. Then you
+ * are raring to go.
+ */
+
+
+/*
+ * Common object IDs (cookies, only for sending WM_GETOBJECT to get at the
+ * thing in question). Positive IDs are reserved for apps (app specific),
+ * negative IDs are system things and are global, 0 means "just little old
+ * me".
+ */
+#define CHILDID_SELF 0
+#define INDEXID_OBJECT 0
+#define INDEXID_CONTAINER 0
+
+/*
+ * Reserved IDs for system objects
+ */
+#define OBJID_WINDOW ((LONG)0x00000000)
+#define OBJID_SYSMENU ((LONG)0xFFFFFFFF)
+#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE)
+#define OBJID_MENU ((LONG)0xFFFFFFFD)
+#define OBJID_CLIENT ((LONG)0xFFFFFFFC)
+#define OBJID_VSCROLL ((LONG)0xFFFFFFFB)
+#define OBJID_HSCROLL ((LONG)0xFFFFFFFA)
+#define OBJID_SIZEGRIP ((LONG)0xFFFFFFF9)
+#define OBJID_CARET ((LONG)0xFFFFFFF8)
+#define OBJID_CURSOR ((LONG)0xFFFFFFF7)
+#define OBJID_ALERT ((LONG)0xFFFFFFF6)
+#define OBJID_SOUND ((LONG)0xFFFFFFF5)
+#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4)
+#define OBJID_NATIVEOM ((LONG)0xFFFFFFF0)
+
+/*
+ * EVENT DEFINITION
+ */
+#define EVENT_MIN 0x00000001
+#define EVENT_MAX 0x7FFFFFFF
+
+
+/*
+ * EVENT_SYSTEM_SOUND
+ * Sent when a sound is played. Currently nothing is generating this, we
+ * this event when a system sound (for menus, etc) is played. Apps
+ * generate this, if accessible, when a private sound is played. For
+ * example, if Mail plays a "New Mail" sound.
+ *
+ * System Sounds:
+ * (Generated by PlaySoundEvent in USER itself)
+ * hwnd is NULL
+ * idObject is OBJID_SOUND
+ * idChild is sound child ID if one
+ * App Sounds:
+ * (PlaySoundEvent won't generate notification; up to app)
+ * hwnd + idObject gets interface pointer to Sound object
+ * idChild identifies the sound in question
+ * are going to be cleaning up the SOUNDSENTRY feature in the control panel
+ * and will use this at that time. Applications implementing WinEvents
+ * are perfectly welcome to use it. Clients of IAccessible* will simply
+ * turn around and get back a non-visual object that describes the sound.
+ */
+#define EVENT_SYSTEM_SOUND 0x0001
+
+/*
+ * EVENT_SYSTEM_ALERT
+ * System Alerts:
+ * (Generated by MessageBox() calls for example)
+ * hwnd is hwndMessageBox
+ * idObject is OBJID_ALERT
+ * App Alerts:
+ * (Generated whenever)
+ * hwnd+idObject gets interface pointer to Alert
+ */
+#define EVENT_SYSTEM_ALERT 0x0002
+
+/*
+ * EVENT_SYSTEM_FOREGROUND
+ * Sent when the foreground (active) window changes, even if it is changing
+ * to another window in the same thread as the previous one.
+ * hwnd is hwndNewForeground
+ * idObject is OBJID_WINDOW
+ * idChild is INDEXID_OBJECT
+ */
+#define EVENT_SYSTEM_FOREGROUND 0x0003
+
+/*
+ * Menu
+ * hwnd is window (top level window or popup menu window)
+ * idObject is ID of control (OBJID_MENU, OBJID_SYSMENU, OBJID_SELF for popup)
+ * idChild is CHILDID_SELF
+ *
+ * EVENT_SYSTEM_MENUSTART
+ * EVENT_SYSTEM_MENUEND
+ * For MENUSTART, hwnd+idObject+idChild refers to the control with the menu bar,
+ * or the control bringing up the context menu.
+ *
+ * Sent when entering into and leaving from menu mode (system, app bar, and
+ * track popups).
+ */
+#define EVENT_SYSTEM_MENUSTART 0x0004
+#define EVENT_SYSTEM_MENUEND 0x0005
+
+/*
+ * EVENT_SYSTEM_MENUPOPUPSTART
+ * EVENT_SYSTEM_MENUPOPUPEND
+ * Sent when a menu popup comes up and just before it is taken down. Note
+ * that for a call to TrackPopupMenu(), a client will see EVENT_SYSTEM_MENUSTART
+ * followed almost immediately by EVENT_SYSTEM_MENUPOPUPSTART for the popup
+ * being shown.
+ *
+ * For MENUPOPUP, hwnd+idObject+idChild refers to the NEW popup coming up, not the
+ * parent item which is hierarchical. You can get the parent menu/popup by
+ * asking for the accParent object.
+ */
+#define EVENT_SYSTEM_MENUPOPUPSTART 0x0006
+#define EVENT_SYSTEM_MENUPOPUPEND 0x0007
+
+
+/*
+ * EVENT_SYSTEM_CAPTURESTART
+ * EVENT_SYSTEM_CAPTUREEND
+ * Sent when a window takes the capture and releases the capture.
+ */
+#define EVENT_SYSTEM_CAPTURESTART 0x0008
+#define EVENT_SYSTEM_CAPTUREEND 0x0009
+
+/*
+ * Move Size
+ * EVENT_SYSTEM_MOVESIZESTART
+ * EVENT_SYSTEM_MOVESIZEEND
+ * Sent when a window enters and leaves move-size dragging mode.
+ */
+#define EVENT_SYSTEM_MOVESIZESTART 0x000A
+#define EVENT_SYSTEM_MOVESIZEEND 0x000B
+
+/*
+ * Context Help
+ * EVENT_SYSTEM_CONTEXTHELPSTART
+ * EVENT_SYSTEM_CONTEXTHELPEND
+ * Sent when a window enters and leaves context sensitive help mode.
+ */
+#define EVENT_SYSTEM_CONTEXTHELPSTART 0x000C
+#define EVENT_SYSTEM_CONTEXTHELPEND 0x000D
+
+/*
+ * Drag & Drop
+ * EVENT_SYSTEM_DRAGDROPSTART
+ * EVENT_SYSTEM_DRAGDROPEND
+ * Send the START notification just before going into drag&drop loop. Send
+ * the END notification just after canceling out.
+ * Note that it is up to apps and OLE to generate this, since the system
+ * doesn't know. Like EVENT_SYSTEM_SOUND, it will be a while before this
+ * is prevalent.
+ */
+#define EVENT_SYSTEM_DRAGDROPSTART 0x000E
+#define EVENT_SYSTEM_DRAGDROPEND 0x000F
+
+/*
+ * Dialog
+ * Send the START notification right after the dialog is completely
+ * initialized and visible. Send the END right before the dialog
+ * is hidden and goes away.
+ * EVENT_SYSTEM_DIALOGSTART
+ * EVENT_SYSTEM_DIALOGEND
+ */
+#define EVENT_SYSTEM_DIALOGSTART 0x0010
+#define EVENT_SYSTEM_DIALOGEND 0x0011
+
+/*
+ * EVENT_SYSTEM_SCROLLING
+ * EVENT_SYSTEM_SCROLLINGSTART
+ * EVENT_SYSTEM_SCROLLINGEND
+ * Sent when beginning and ending the tracking of a scrollbar in a window,
+ * and also for scrollbar controls.
+ */
+#define EVENT_SYSTEM_SCROLLINGSTART 0x0012
+#define EVENT_SYSTEM_SCROLLINGEND 0x0013
+
+/*
+ * Alt-Tab Window
+ * Send the START notification right after the switch window is initialized
+ * and visible. Send the END right before it is hidden and goes away.
+ * EVENT_SYSTEM_SWITCHSTART
+ * EVENT_SYSTEM_SWITCHEND
+ */
+#define EVENT_SYSTEM_SWITCHSTART 0x0014
+#define EVENT_SYSTEM_SWITCHEND 0x0015
+
+/*
+ * EVENT_SYSTEM_MINIMIZESTART
+ * EVENT_SYSTEM_MINIMIZEEND
+ * Sent when a window minimizes and just before it restores.
+ */
+#define EVENT_SYSTEM_MINIMIZESTART 0x0016
+#define EVENT_SYSTEM_MINIMIZEEND 0x0017
+
+
+#if(_WIN32_WINNT >= 0x0501)
+#define EVENT_CONSOLE_CARET 0x4001
+#define EVENT_CONSOLE_UPDATE_REGION 0x4002
+#define EVENT_CONSOLE_UPDATE_SIMPLE 0x4003
+#define EVENT_CONSOLE_UPDATE_SCROLL 0x4004
+#define EVENT_CONSOLE_LAYOUT 0x4005
+#define EVENT_CONSOLE_START_APPLICATION 0x4006
+#define EVENT_CONSOLE_END_APPLICATION 0x4007
+
+/*
+ * Flags for EVENT_CONSOLE_START/END_APPLICATION.
+ */
+#define CONSOLE_APPLICATION_16BIT 0x0001
+
+/*
+ * Flags for EVENT_CONSOLE_CARET
+ */
+#define CONSOLE_CARET_SELECTION 0x0001
+#define CONSOLE_CARET_VISIBLE 0x0002
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+/*
+ * Object events
+ *
+ * The system AND apps generate these. The system generates these for
+ * real windows. Apps generate these for objects within their window which
+ * act like a separate control, e.g. an item in a list view.
+ *
+ * When the system generate them, dwParam2 is always WMOBJID_SELF. When
+ * apps generate them, apps put the has-meaning-to-the-app-only ID value
+ * in dwParam2.
+ * For all events, if you want detailed accessibility information, callers
+ * should
+ * * Call AccessibleObjectFromWindow() with the hwnd, idObject parameters
+ * of the event, and IID_IAccessible as the REFIID, to get back an
+ * IAccessible* to talk to
+ * * Initialize and fill in a VARIANT as VT_I4 with lVal the idChild
+ * parameter of the event.
+ * * If idChild isn't zero, call get_accChild() in the container to see
+ * if the child is an object in its own right. If so, you will get
+ * back an IDispatch* object for the child. You should release the
+ * parent, and call QueryInterface() on the child object to get its
+ * IAccessible*. Then you talk directly to the child. Otherwise,
+ * if get_accChild() returns you nothing, you should continue to
+ * use the child VARIANT. You will ask the container for the properties
+ * of the child identified by the VARIANT. In other words, the
+ * child in this case is accessible but not a full-blown object.
+ * Like a button on a titlebar which is 'small' and has no children.
+ */
+
+/*
+ * For all EVENT_OBJECT events,
+ * hwnd is the dude to Send the WM_GETOBJECT message to (unless NULL,
+ * see above for system things)
+ * idObject is the ID of the object that can resolve any queries a
+ * client might have. It's a way to deal with windowless controls,
+ * controls that are just drawn on the screen in some larger parent
+ * window (like SDM), or standard frame elements of a window.
+ * idChild is the piece inside of the object that is affected. This
+ * allows clients to access things that are too small to have full
+ * blown objects in their own right. Like the thumb of a scrollbar.
+ * The hwnd/idObject pair gets you to the container, the dude you
+ * probably want to talk to most of the time anyway. The idChild
+ * can then be passed into the acc properties to get the name/value
+ * of it as needed.
+ *
+ * Example #1:
+ * System propagating a listbox selection change
+ * EVENT_OBJECT_SELECTION
+ * hwnd == listbox hwnd
+ * idObject == OBJID_WINDOW
+ * idChild == new selected item, or CHILDID_SELF if
+ * nothing now selected within container.
+ * Word '97 propagating a listbox selection change
+ * hwnd == SDM window
+ * idObject == SDM ID to get at listbox 'control'
+ * idChild == new selected item, or CHILDID_SELF if
+ * nothing
+ *
+ * Example #2:
+ * System propagating a menu item selection on the menu bar
+ * EVENT_OBJECT_SELECTION
+ * hwnd == top level window
+ * idObject == OBJID_MENU
+ * idChild == ID of child menu bar item selected
+ *
+ * Example #3:
+ * System propagating a dropdown coming off of said menu bar item
+ * EVENT_OBJECT_CREATE
+ * hwnd == popup item
+ * idObject == OBJID_WINDOW
+ * idChild == CHILDID_SELF
+ *
+ * Example #4:
+ *
+ * For EVENT_OBJECT_REORDER, the object referred to by hwnd/idObject is the
+ * PARENT container in which the zorder is occurring. This is because if
+ * one child is zordering, all of them are changing their relative zorder.
+ */
+#define EVENT_OBJECT_CREATE 0x8000 // hwnd + ID + idChild is created item
+#define EVENT_OBJECT_DESTROY 0x8001 // hwnd + ID + idChild is destroyed item
+#define EVENT_OBJECT_SHOW 0x8002 // hwnd + ID + idChild is shown item
+#define EVENT_OBJECT_HIDE 0x8003 // hwnd + ID + idChild is hidden item
+#define EVENT_OBJECT_REORDER 0x8004 // hwnd + ID + idChild is parent of zordering children
+/*
+ * NOTE:
+ * Minimize the number of notifications!
+ *
+ * When you are hiding a parent object, obviously all child objects are no
+ * longer visible on screen. They still have the same "visible" status,
+ * but are not truly visible. Hence do not send HIDE notifications for the
+ * children also. One implies all. The same goes for SHOW.
+ */
+
+
+#define EVENT_OBJECT_FOCUS 0x8005 // hwnd + ID + idChild is focused item
+#define EVENT_OBJECT_SELECTION 0x8006 // hwnd + ID + idChild is selected item (if only one), or idChild is OBJID_WINDOW if complex
+#define EVENT_OBJECT_SELECTIONADD 0x8007 // hwnd + ID + idChild is item added
+#define EVENT_OBJECT_SELECTIONREMOVE 0x8008 // hwnd + ID + idChild is item removed
+#define EVENT_OBJECT_SELECTIONWITHIN 0x8009 // hwnd + ID + idChild is parent of changed selected items
+
+/*
+ * NOTES:
+ * There is only one "focused" child item in a parent. This is the place
+ * keystrokes are going at a given moment. Hence only send a notification
+ * about where the NEW focus is going. A NEW item getting the focus already
+ * implies that the OLD item is losing it.
+ *
+ * SELECTION however can be multiple. Hence the different SELECTION
+ * notifications. Here's when to use each:
+ *
+ * (1) Send a SELECTION notification in the simple single selection
+ * case (like the focus) when the item with the selection is
+ * merely moving to a different item within a container. hwnd + ID
+ * is the container control, idChildItem is the new child with the
+ * selection.
+ *
+ * (2) Send a SELECTIONADD notification when a new item has simply been added
+ * to the selection within a container. This is appropriate when the
+ * number of newly selected items is very small. hwnd + ID is the
+ * container control, idChildItem is the new child added to the selection.
+ *
+ * (3) Send a SELECTIONREMOVE notification when a new item has simply been
+ * removed from the selection within a container. This is appropriate
+ * when the number of newly selected items is very small, just like
+ * SELECTIONADD. hwnd + ID is the container control, idChildItem is the
+ * new child removed from the selection.
+ *
+ * (4) Send a SELECTIONWITHIN notification when the selected items within a
+ * control have changed substantially. Rather than propagate a large
+ * number of changes to reflect removal for some items, addition of
+ * others, just tell somebody who cares that a lot happened. It will
+ * be faster an easier for somebody watching to just turn around and
+ * query the container control what the new bunch of selected items
+ * are.
+ */
+
+#define EVENT_OBJECT_STATECHANGE 0x800A // hwnd + ID + idChild is item w/ state change
+/*
+ * Examples of when to send an EVENT_OBJECT_STATECHANGE include
+ * * It is being enabled/disabled (USER does for windows)
+ * * It is being pressed/released (USER does for buttons)
+ * * It is being checked/unchecked (USER does for radio/check buttons)
+ */
+#define EVENT_OBJECT_LOCATIONCHANGE 0x800B // hwnd + ID + idChild is moved/sized item
+
+/*
+ * Note:
+ * A LOCATIONCHANGE is not sent for every child object when the parent
+ * changes shape/moves. Send one notification for the topmost object
+ * that is changing. For example, if the user resizes a top level window,
+ * USER will generate a LOCATIONCHANGE for it, but not for the menu bar,
+ * title bar, scrollbars, etc. that are also changing shape/moving.
+ *
+ * In other words, it only generates LOCATIONCHANGE notifications for
+ * real windows that are moving/sizing. It will not generate a LOCATIONCHANGE
+ * for every non-floating child window when the parent moves (the children are
+ * logically moving also on screen, but not relative to the parent).
+ *
+ * Now, if the app itself resizes child windows as a result of being
+ * sized, USER will generate LOCATIONCHANGEs for those dudes also because
+ * it doesn't know better.
+ *
+ * Note also that USER will generate LOCATIONCHANGE notifications for two
+ * non-window sys objects:
+ * (1) System caret
+ * (2) Cursor
+ */
+
+#define EVENT_OBJECT_NAMECHANGE 0x800C // hwnd + ID + idChild is item w/ name change
+#define EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D // hwnd + ID + idChild is item w/ desc change
+#define EVENT_OBJECT_VALUECHANGE 0x800E // hwnd + ID + idChild is item w/ value change
+#define EVENT_OBJECT_PARENTCHANGE 0x800F // hwnd + ID + idChild is item w/ new parent
+#define EVENT_OBJECT_HELPCHANGE 0x8010 // hwnd + ID + idChild is item w/ help change
+#define EVENT_OBJECT_DEFACTIONCHANGE 0x8011 // hwnd + ID + idChild is item w/ def action change
+#define EVENT_OBJECT_ACCELERATORCHANGE 0x8012 // hwnd + ID + idChild is item w/ keybd accel change
+
+/*
+ * Child IDs
+ */
+
+/*
+ * System Sounds (idChild of system SOUND notification)
+ */
+#define SOUND_SYSTEM_STARTUP 1
+#define SOUND_SYSTEM_SHUTDOWN 2
+#define SOUND_SYSTEM_BEEP 3
+#define SOUND_SYSTEM_ERROR 4
+#define SOUND_SYSTEM_QUESTION 5
+#define SOUND_SYSTEM_WARNING 6
+#define SOUND_SYSTEM_INFORMATION 7
+#define SOUND_SYSTEM_MAXIMIZE 8
+#define SOUND_SYSTEM_MINIMIZE 9
+#define SOUND_SYSTEM_RESTOREUP 10
+#define SOUND_SYSTEM_RESTOREDOWN 11
+#define SOUND_SYSTEM_APPSTART 12
+#define SOUND_SYSTEM_FAULT 13
+#define SOUND_SYSTEM_APPEND 14
+#define SOUND_SYSTEM_MENUCOMMAND 15
+#define SOUND_SYSTEM_MENUPOPUP 16
+#define CSOUND_SYSTEM 16
+
+/*
+ * System Alerts (indexChild of system ALERT notification)
+ */
+#define ALERT_SYSTEM_INFORMATIONAL 1 // MB_INFORMATION
+#define ALERT_SYSTEM_WARNING 2 // MB_WARNING
+#define ALERT_SYSTEM_ERROR 3 // MB_ERROR
+#define ALERT_SYSTEM_QUERY 4 // MB_QUESTION
+#define ALERT_SYSTEM_CRITICAL 5 // HardSysErrBox
+#define CALERT_SYSTEM 6
+
+typedef struct tagGUITHREADINFO
+{
+ DWORD cbSize;
+ DWORD flags;
+ HWND hwndActive;
+ HWND hwndFocus;
+ HWND hwndCapture;
+ HWND hwndMenuOwner;
+ HWND hwndMoveSize;
+ HWND hwndCaret;
+ RECT rcCaret;
+} GUITHREADINFO, *PGUITHREADINFO, FAR * LPGUITHREADINFO;
+
+#define GUI_CARETBLINKING 0x00000001
+#define GUI_INMOVESIZE 0x00000002
+#define GUI_INMENUMODE 0x00000004
+#define GUI_SYSTEMMENUMODE 0x00000008
+#define GUI_POPUPMENUMODE 0x00000010
+#if(_WIN32_WINNT >= 0x0501)
+#define GUI_16BITTASK 0x00000020
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+WINUSERAPI
+BOOL
+WINAPI
+GetGUIThreadInfo(
+ IN DWORD idThread,
+ OUT PGUITHREADINFO pgui);
+
+
+WINUSERAPI
+UINT
+WINAPI
+GetWindowModuleFileNameA(
+ IN HWND hwnd,
+ OUT LPSTR pszFileName,
+ IN UINT cchFileNameMax);
+WINUSERAPI
+UINT
+WINAPI
+GetWindowModuleFileNameW(
+ IN HWND hwnd,
+ OUT LPWSTR pszFileName,
+ IN UINT cchFileNameMax);
+#ifdef UNICODE
+#define GetWindowModuleFileName GetWindowModuleFileNameW
+#else
+#define GetWindowModuleFileName GetWindowModuleFileNameA
+#endif // !UNICODE
+
+#ifndef NO_STATE_FLAGS
+#define STATE_SYSTEM_UNAVAILABLE 0x00000001 // Disabled
+#define STATE_SYSTEM_SELECTED 0x00000002
+#define STATE_SYSTEM_FOCUSED 0x00000004
+#define STATE_SYSTEM_PRESSED 0x00000008
+#define STATE_SYSTEM_CHECKED 0x00000010
+#define STATE_SYSTEM_MIXED 0x00000020 // 3-state checkbox or toolbar button
+#define STATE_SYSTEM_INDETERMINATE STATE_SYSTEM_MIXED
+#define STATE_SYSTEM_READONLY 0x00000040
+#define STATE_SYSTEM_HOTTRACKED 0x00000080
+#define STATE_SYSTEM_DEFAULT 0x00000100
+#define STATE_SYSTEM_EXPANDED 0x00000200
+#define STATE_SYSTEM_COLLAPSED 0x00000400
+#define STATE_SYSTEM_BUSY 0x00000800
+#define STATE_SYSTEM_FLOATING 0x00001000 // Children "owned" not "contained" by parent
+#define STATE_SYSTEM_MARQUEED 0x00002000
+#define STATE_SYSTEM_ANIMATED 0x00004000
+#define STATE_SYSTEM_INVISIBLE 0x00008000
+#define STATE_SYSTEM_OFFSCREEN 0x00010000
+#define STATE_SYSTEM_SIZEABLE 0x00020000
+#define STATE_SYSTEM_MOVEABLE 0x00040000
+#define STATE_SYSTEM_SELFVOICING 0x00080000
+#define STATE_SYSTEM_FOCUSABLE 0x00100000
+#define STATE_SYSTEM_SELECTABLE 0x00200000
+#define STATE_SYSTEM_LINKED 0x00400000
+#define STATE_SYSTEM_TRAVERSED 0x00800000
+#define STATE_SYSTEM_MULTISELECTABLE 0x01000000 // Supports multiple selection
+#define STATE_SYSTEM_EXTSELECTABLE 0x02000000 // Supports extended selection
+#define STATE_SYSTEM_ALERT_LOW 0x04000000 // This information is of low priority
+#define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 // This information is of medium priority
+#define STATE_SYSTEM_ALERT_HIGH 0x10000000 // This information is of high priority
+#define STATE_SYSTEM_PROTECTED 0x20000000 // access to this is restricted
+#define STATE_SYSTEM_VALID 0x3FFFFFFF
+#endif
+
+#define CCHILDREN_TITLEBAR 5
+#define CCHILDREN_SCROLLBAR 5
+
+/*
+ * Information about the global cursor.
+ */
+typedef struct tagCURSORINFO
+{
+ DWORD cbSize;
+ DWORD flags;
+ HCURSOR hCursor;
+ POINT ptScreenPos;
+} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
+
+#define CURSOR_SHOWING 0x00000001
+
+WINUSERAPI
+BOOL
+WINAPI
+GetCursorInfo(
+ OUT PCURSORINFO pci
+);
+
+/*
+ * Window information snapshot
+ */
+typedef struct tagWINDOWINFO
+{
+ DWORD cbSize;
+ RECT rcWindow;
+ RECT rcClient;
+ DWORD dwStyle;
+ DWORD dwExStyle;
+ DWORD dwWindowStatus;
+ UINT cxWindowBorders;
+ UINT cyWindowBorders;
+ ATOM atomWindowType;
+ WORD wCreatorVersion;
+} WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO;
+
+#define WS_ACTIVECAPTION 0x0001
+
+WINUSERAPI
+BOOL
+WINAPI
+GetWindowInfo(
+ IN HWND hwnd,
+ OUT PWINDOWINFO pwi
+);
+
+/*
+ * Titlebar information.
+ */
+typedef struct tagTITLEBARINFO
+{
+ DWORD cbSize;
+ RECT rcTitleBar;
+ DWORD rgstate[CCHILDREN_TITLEBAR+1];
+} TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetTitleBarInfo(
+ IN HWND hwnd,
+ OUT PTITLEBARINFO pti
+);
+
+/*
+ * Menubar information
+ */
+typedef struct tagMENUBARINFO
+{
+ DWORD cbSize;
+ RECT rcBar; // rect of bar, popup, item
+ HMENU hMenu; // real menu handle of bar, popup
+ HWND hwndMenu; // hwnd of item submenu if one
+ BOOL fBarFocused:1; // bar, popup has the focus
+ BOOL fFocused:1; // item has the focus
+} MENUBARINFO, *PMENUBARINFO, *LPMENUBARINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetMenuBarInfo(
+ IN HWND hwnd,
+ IN LONG idObject,
+ IN LONG idItem,
+ OUT PMENUBARINFO pmbi
+);
+
+/*
+ * Scrollbar information
+ */
+typedef struct tagSCROLLBARINFO
+{
+ DWORD cbSize;
+ RECT rcScrollBar;
+ int dxyLineButton;
+ int xyThumbTop;
+ int xyThumbBottom;
+ int reserved;
+ DWORD rgstate[CCHILDREN_SCROLLBAR+1];
+} SCROLLBARINFO, *PSCROLLBARINFO, *LPSCROLLBARINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetScrollBarInfo(
+ IN HWND hwnd,
+ IN LONG idObject,
+ OUT PSCROLLBARINFO psbi
+);
+
+/*
+ * Combobox information
+ */
+typedef struct tagCOMBOBOXINFO
+{
+ DWORD cbSize;
+ RECT rcItem;
+ RECT rcButton;
+ DWORD stateButton;
+ HWND hwndCombo;
+ HWND hwndItem;
+ HWND hwndList;
+} COMBOBOXINFO, *PCOMBOBOXINFO, *LPCOMBOBOXINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetComboBoxInfo(
+ IN HWND hwndCombo,
+ OUT PCOMBOBOXINFO pcbi
+);
+
+/*
+ * The "real" ancestor window
+ */
+#define GA_PARENT 1
+#define GA_ROOT 2
+#define GA_ROOTOWNER 3
+
+WINUSERAPI
+HWND
+WINAPI
+GetAncestor(
+ IN HWND hwnd,
+ IN UINT gaFlags
+);
+
+
+/*
+ * This gets the REAL child window at the point. If it is in the dead
+ * space of a group box, it will try a sibling behind it. But static
+ * fields will get returned. In other words, it is kind of a cross between
+ * ChildWindowFromPointEx and WindowFromPoint.
+ */
+WINUSERAPI
+HWND
+WINAPI
+RealChildWindowFromPoint(
+ IN HWND hwndParent,
+ IN POINT ptParentClientCoords
+);
+
+
+/*
+ * This gets the name of the window TYPE, not class. This allows us to
+ * recognize ThunderButton32 et al.
+ */
+WINUSERAPI
+UINT
+WINAPI
+RealGetWindowClassA(
+ IN HWND hwnd,
+ OUT LPSTR pszType,
+ IN UINT cchType
+);
+/*
+ * This gets the name of the window TYPE, not class. This allows us to
+ * recognize ThunderButton32 et al.
+ */
+WINUSERAPI
+UINT
+WINAPI
+RealGetWindowClassW(
+ IN HWND hwnd,
+ OUT LPWSTR pszType,
+ IN UINT cchType
+);
+#ifdef UNICODE
+#define RealGetWindowClass RealGetWindowClassW
+#else
+#define RealGetWindowClass RealGetWindowClassA
+#endif // !UNICODE
+
+/*
+ * Alt-Tab Switch window information.
+ */
+typedef struct tagALTTABINFO
+{
+ DWORD cbSize;
+ int cItems;
+ int cColumns;
+ int cRows;
+ int iColFocus;
+ int iRowFocus;
+ int cxItem;
+ int cyItem;
+ POINT ptStart;
+} ALTTABINFO, *PALTTABINFO, *LPALTTABINFO;
+
+WINUSERAPI
+BOOL
+WINAPI
+GetAltTabInfoA(
+ IN HWND hwnd,
+ IN int iItem,
+ OUT PALTTABINFO pati,
+ OUT LPSTR pszItemText,
+ IN UINT cchItemText
+);
+WINUSERAPI
+BOOL
+WINAPI
+GetAltTabInfoW(
+ IN HWND hwnd,
+ IN int iItem,
+ OUT PALTTABINFO pati,
+ OUT LPWSTR pszItemText,
+ IN UINT cchItemText
+);
+#ifdef UNICODE
+#define GetAltTabInfo GetAltTabInfoW
+#else
+#define GetAltTabInfo GetAltTabInfoA
+#endif // !UNICODE
+
+/*
+ * Listbox information.
+ * Returns the number of items per row.
+ */
+WINUSERAPI
+DWORD
+WINAPI
+GetListBoxInfo(
+ IN HWND hwnd
+);
+
+#endif /* NOWINABLE */
+#endif /* WINVER >= 0x0500 */
+
+
+#if(_WIN32_WINNT >= 0x0500)
+WINUSERAPI
+BOOL
+WINAPI
+LockWorkStation(
+ VOID);
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0500)
+
+WINUSERAPI
+BOOL
+WINAPI
+UserHandleGrantAccess(
+ HANDLE hUserHandle,
+ HANDLE hJob,
+ BOOL bGrant);
+
+#endif /* _WIN32_WINNT >= 0x0500 */
+
+#if(_WIN32_WINNT >= 0x0501)
+
+/*
+ * Raw Input Messages.
+ */
+
+DECLARE_HANDLE(HRAWINPUT);
+
+/*
+ * WM_INPUT wParam
+ */
+
+/*
+ * Use this macro to get the input code from wParam.
+ */
+#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
+
+/*
+ * The input is in the regular message flow,
+ * the app is required to call DefWindowProc
+ * so that the system can perform clean ups.
+ */
+#define RIM_INPUT 0
+
+/*
+ * The input is sink only. The app is expected
+ * to behave nicely.
+ */
+#define RIM_INPUTSINK 1
+
+
+/*
+ * Raw Input data header
+ */
+typedef struct tagRAWINPUTHEADER {
+ DWORD dwType;
+ DWORD dwSize;
+ HANDLE hDevice;
+ WPARAM wParam;
+} RAWINPUTHEADER, *PRAWINPUTHEADER, *LPRAWINPUTHEADER;
+
+/*
+ * Type of the raw input
+ */
+#define RIM_TYPEMOUSE 0
+#define RIM_TYPEKEYBOARD 1
+#define RIM_TYPEHID 2
+
+/*
+ * Raw format of the mouse input
+ */
+typedef struct tagRAWMOUSE {
+ /*
+ * Indicator flags.
+ */
+ USHORT usFlags;
+
+ /*
+ * The transition state of the mouse buttons.
+ */
+ union {
+ ULONG ulButtons;
+ struct {
+ USHORT usButtonFlags;
+ USHORT usButtonData;
+ };
+ };
+
+
+ /*
+ * The raw state of the mouse buttons.
+ */
+ ULONG ulRawButtons;
+
+ /*
+ * The signed relative or absolute motion in the X direction.
+ */
+ LONG lLastX;
+
+ /*
+ * The signed relative or absolute motion in the Y direction.
+ */
+ LONG lLastY;
+
+ /*
+ * Device-specific additional information for the event.
+ */
+ ULONG ulExtraInformation;
+
+} RAWMOUSE, *PRAWMOUSE, *LPRAWMOUSE;
+
+/*
+ * Define the mouse button state indicators.
+ */
+
+#define RI_MOUSE_LEFT_BUTTON_DOWN 0x0001 // Left Button changed to down.
+#define RI_MOUSE_LEFT_BUTTON_UP 0x0002 // Left Button changed to up.
+#define RI_MOUSE_RIGHT_BUTTON_DOWN 0x0004 // Right Button changed to down.
+#define RI_MOUSE_RIGHT_BUTTON_UP 0x0008 // Right Button changed to up.
+#define RI_MOUSE_MIDDLE_BUTTON_DOWN 0x0010 // Middle Button changed to down.
+#define RI_MOUSE_MIDDLE_BUTTON_UP 0x0020 // Middle Button changed to up.
+
+#define RI_MOUSE_BUTTON_1_DOWN RI_MOUSE_LEFT_BUTTON_DOWN
+#define RI_MOUSE_BUTTON_1_UP RI_MOUSE_LEFT_BUTTON_UP
+#define RI_MOUSE_BUTTON_2_DOWN RI_MOUSE_RIGHT_BUTTON_DOWN
+#define RI_MOUSE_BUTTON_2_UP RI_MOUSE_RIGHT_BUTTON_UP
+#define RI_MOUSE_BUTTON_3_DOWN RI_MOUSE_MIDDLE_BUTTON_DOWN
+#define RI_MOUSE_BUTTON_3_UP RI_MOUSE_MIDDLE_BUTTON_UP
+
+#define RI_MOUSE_BUTTON_4_DOWN 0x0040
+#define RI_MOUSE_BUTTON_4_UP 0x0080
+#define RI_MOUSE_BUTTON_5_DOWN 0x0100
+#define RI_MOUSE_BUTTON_5_UP 0x0200
+
+/*
+ * If usButtonFlags has RI_MOUSE_WHEEL, the wheel delta is stored in usButtonData.
+ * Take it as a signed value.
+ */
+#define RI_MOUSE_WHEEL 0x0400
+
+/*
+ * Define the mouse indicator flags.
+ */
+#define MOUSE_MOVE_RELATIVE 0
+#define MOUSE_MOVE_ABSOLUTE 1
+#define MOUSE_VIRTUAL_DESKTOP 0x02 // the coordinates are mapped to the virtual desktop
+#define MOUSE_ATTRIBUTES_CHANGED 0x04 // requery for mouse attributes
+
+
+/*
+ * Raw format of the keyboard input
+ */
+typedef struct tagRAWKEYBOARD {
+ /*
+ * The "make" scan code (key depression).
+ */
+ USHORT MakeCode;
+
+ /*
+ * The flags field indicates a "break" (key release) and other
+ * miscellaneous scan code information defined in ntddkbd.h.
+ */
+ USHORT Flags;
+
+ USHORT Reserved;
+
+ /*
+ * Windows message compatible information
+ */
+ USHORT VKey;
+ UINT Message;
+
+ /*
+ * Device-specific additional information for the event.
+ */
+ ULONG ExtraInformation;
+
+
+} RAWKEYBOARD, *PRAWKEYBOARD, *LPRAWKEYBOARD;
+
+
+/*
+ * Define the keyboard overrun MakeCode.
+ */
+
+#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
+
+/*
+ * Define the keyboard input data Flags.
+ */
+#define RI_KEY_MAKE 0
+#define RI_KEY_BREAK 1
+#define RI_KEY_E0 2
+#define RI_KEY_E1 4
+#define RI_KEY_TERMSRV_SET_LED 8
+#define RI_KEY_TERMSRV_SHADOW 0x10
+
+
+/*
+ * Raw format of the input from Human Input Devices
+ */
+typedef struct tagRAWHID {
+ DWORD dwSizeHid; // byte size of each report
+ DWORD dwCount; // number of input packed
+ BYTE bRawData[1];
+} RAWHID, *PRAWHID, *LPRAWHID;
+
+/*
+ * RAWINPUT data structure.
+ */
+typedef struct tagRAWINPUT {
+ RAWINPUTHEADER header;
+ union {
+ RAWMOUSE mouse;
+ RAWKEYBOARD keyboard;
+ RAWHID hid;
+ } data;
+} RAWINPUT, *PRAWINPUT, *LPRAWINPUT;
+
+#ifdef _WIN64
+#define RAWINPUT_ALIGN(x) (((x) + sizeof(QWORD) - 1) & ~(sizeof(QWORD) - 1))
+#else // _WIN64
+#define RAWINPUT_ALIGN(x) (((x) + sizeof(DWORD) - 1) & ~(sizeof(DWORD) - 1))
+#endif // _WIN64
+
+#define NEXTRAWINPUTBLOCK(ptr) ((PRAWINPUT)RAWINPUT_ALIGN((ULONG_PTR)((PBYTE)(ptr) + (ptr)->header.dwSize)))
+
+/*
+ * Flags for GetRawInputData
+ */
+
+#define RID_INPUT 0x10000003
+#define RID_HEADER 0x10000005
+
+WINUSERAPI
+UINT
+WINAPI
+GetRawInputData(
+ IN HRAWINPUT hRawInput,
+ IN UINT uiCommand,
+ OUT LPVOID pData,
+ IN OUT PUINT pcbSize,
+ IN UINT cbSizeHeader);
+
+/*
+ * Raw Input Device Information
+ */
+#define RIDI_PREPARSEDDATA 0x20000005
+#define RIDI_DEVICENAME 0x20000007 // the return valus is the character length, not the byte size
+#define RIDI_DEVICEINFO 0x2000000b
+
+typedef struct tagRID_DEVICE_INFO_MOUSE {
+ DWORD dwId;
+ DWORD dwNumberOfButtons;
+ DWORD dwSampleRate;
+} RID_DEVICE_INFO_MOUSE, *PRID_DEVICE_INFO_MOUSE;
+
+typedef struct tagRID_DEVICE_INFO_KEYBOARD {
+ DWORD dwType;
+ DWORD dwSubType;
+ DWORD dwKeyboardMode;
+ DWORD dwNumberOfFunctionKeys;
+ DWORD dwNumberOfIndicators;
+ DWORD dwNumberOfKeysTotal;
+} RID_DEVICE_INFO_KEYBOARD, *PRID_DEVICE_INFO_KEYBOARD;
+
+typedef struct tagRID_DEVICE_INFO_HID {
+ DWORD dwVendorId;
+ DWORD dwProductId;
+ DWORD dwVersionNumber;
+
+ /*
+ * Top level collection UsagePage and Usage
+ */
+ USHORT usUsagePage;
+ USHORT usUsage;
+} RID_DEVICE_INFO_HID, *PRID_DEVICE_INFO_HID;
+
+typedef struct tagRID_DEVICE_INFO {
+ DWORD cbSize;
+ DWORD dwType;
+ union {
+ RID_DEVICE_INFO_MOUSE mouse;
+ RID_DEVICE_INFO_KEYBOARD keyboard;
+ RID_DEVICE_INFO_HID hid;
+ };
+} RID_DEVICE_INFO, *PRID_DEVICE_INFO, *LPRID_DEVICE_INFO;
+
+WINUSERAPI
+UINT
+WINAPI
+GetRawInputDeviceInfoA(
+ IN HANDLE hDevice,
+ IN UINT uiCommand,
+ OUT LPVOID pData,
+ IN OUT PUINT pcbSize);
+WINUSERAPI
+UINT
+WINAPI
+GetRawInputDeviceInfoW(
+ IN HANDLE hDevice,
+ IN UINT uiCommand,
+ OUT LPVOID pData,
+ IN OUT PUINT pcbSize);
+#ifdef UNICODE
+#define GetRawInputDeviceInfo GetRawInputDeviceInfoW
+#else
+#define GetRawInputDeviceInfo GetRawInputDeviceInfoA
+#endif // !UNICODE
+
+
+/*
+ * Raw Input Bulk Read: GetRawInputBuffer
+ */
+WINUSERAPI
+UINT
+WINAPI
+GetRawInputBuffer(
+ OUT PRAWINPUT pData,
+ IN OUT PUINT pcbSize,
+ IN UINT cbSizeHeader);
+
+/*
+ * Raw Input request APIs
+ */
+typedef struct tagRAWINPUTDEVICE {
+ USHORT usUsagePage; // Toplevel collection UsagePage
+ USHORT usUsage; // Toplevel collection Usage
+ DWORD dwFlags;
+ HWND hwndTarget; // Target hwnd. NULL = follows keyboard focus
+} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;
+
+typedef CONST RAWINPUTDEVICE* PCRAWINPUTDEVICE;
+
+#define RIDEV_REMOVE 0x00000001
+#define RIDEV_EXCLUDE 0x00000010
+#define RIDEV_PAGEONLY 0x00000020
+#define RIDEV_NOLEGACY 0x00000030
+#define RIDEV_INPUTSINK 0x00000100
+#define RIDEV_CAPTUREMOUSE 0x00000200 // effective when mouse nolegacy is specified, otherwise it would be an error
+#define RIDEV_NOHOTKEYS 0x00000200 // effective for keyboard.
+#define RIDEV_APPKEYS 0x00000400 // effective for keyboard.
+#define RIDEV_EXMODEMASK 0x000000F0
+
+#define RIDEV_EXMODE(mode) ((mode) & RIDEV_EXMODEMASK)
+
+WINUSERAPI
+BOOL
+WINAPI
+RegisterRawInputDevices(
+ IN PCRAWINPUTDEVICE pRawInputDevices,
+ IN UINT uiNumDevices,
+ IN UINT cbSize);
+
+WINUSERAPI
+UINT
+WINAPI
+GetRegisteredRawInputDevices(
+ OUT PRAWINPUTDEVICE pRawInputDevices,
+ IN OUT PUINT puiNumDevices,
+ IN UINT cbSize);
+
+
+typedef struct tagRAWINPUTDEVICELIST {
+ HANDLE hDevice;
+ DWORD dwType;
+} RAWINPUTDEVICELIST, *PRAWINPUTDEVICELIST;
+
+WINUSERAPI
+UINT
+WINAPI
+GetRawInputDeviceList(
+ OUT PRAWINPUTDEVICELIST pRawInputDeviceList,
+ IN OUT PUINT puiNumDevices,
+ IN UINT cbSize);
+
+
+WINUSERAPI
+LRESULT
+WINAPI
+DefRawInputProc(
+ IN PRAWINPUT* paRawInput,
+ IN INT nInput,
+ IN UINT cbSizeHeader);
+
+
+#endif /* _WIN32_WINNT >= 0x0501 */
+
+
+
+
+#if !defined(RC_INVOKED) /* RC complains about long symbols in #ifs */
+#if defined(ISOLATION_AWARE_ENABLED) && (ISOLATION_AWARE_ENABLED != 0)
+#include "winuser.inl"
+#endif /* ISOLATION_AWARE_ENABLED */
+#endif /* RC */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !_WINUSER_ */
+
+
+
+
diff --git a/contrib/x11/concurrent-widgets.factor b/contrib/x11/concurrent-widgets.factor
new file mode 100644
index 0000000000..d7427dc485
--- /dev/null
+++ b/contrib/x11/concurrent-widgets.factor
@@ -0,0 +1,373 @@
+
+IN: concurrent-widgets
+USING: io namespaces kernel hashtables math generic threads concurrency
+ lists sequences arrays xlib x ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: window display id ;
+
+! dpy get create-window
+
+! window-object [ { 100 100 } move-window ] with-window-object
+
+: create-window-object
+ dpy get create-window ;
+
+: with-window-object ( quot -- )
+[ swap dup window-display dpy set window-id win set call ] with-scope ; inline
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! window-table add-to-window-table
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: window-table
+
+10 window-table set
+
+: add-to-window-table ( -- )
+dup window-id window-table get set-hash ;
+
+! The window-table is keyed on window ids. If support is added for
+! multiple displays, then perhaps there should be a window table for
+! each open display.
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! handle-event
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: handle-key-press-event
+GENERIC: handle-key-release-event
+GENERIC: handle-button-press-event
+GENERIC: handle-button-release-event
+GENERIC: handle-expose-event
+GENERIC: handle-configure-event
+GENERIC: handle-enter-window-event
+GENERIC: handle-leave-window-event
+GENERIC: handle-destroy-window-event
+GENERIC: handle-map-request-event
+GENERIC: handle-map-event
+GENERIC: handle-configure-request-event
+GENERIC: handle-unmap-event
+GENERIC: handle-property-event
+
+: handle-event ( event obj -- )
+ over XAnyEvent-type
+ { { [ dup Expose = ] [ drop handle-expose-event ] }
+ { [ dup KeyPress = ] [ drop handle-key-press-event ] }
+ { [ dup KeyRelease = ] [ drop handle-key-release-event ] }
+ { [ dup ButtonPress = ] [ drop handle-button-press-event ] }
+ { [ dup ButtonRelease = ] [ drop handle-button-release-event ] }
+ { [ dup ConfigureNotify = ] [ drop handle-configure-event ] }
+ { [ dup EnterNotify = ] [ drop handle-enter-window-event ] }
+ { [ dup LeaveNotify = ] [ drop handle-leave-window-event ] }
+ { [ dup DestroyNotify = ] [ drop handle-destroy-window-event ] }
+ { [ dup MapRequest = ] [ drop handle-map-request-event ] }
+ { [ dup MapNotify = ] [ drop handle-map-event ] }
+ { [ dup ConfigureRequest = ] [ drop handle-configure-request-event ] }
+ { [ dup UnmapNotify = ] [ drop handle-unmap-event ] }
+ { [ dup PropertyNotify = ] [ drop handle-property-event ] }
+ { [ t ] [ "handle-event ignoring event" print 3drop ] } }
+ cond ;
+
+M: window handle-configure-event ( event obj -- )
+ "Basic handle-configure-event called" print drop drop ;
+
+M: window handle-destroy-window-event ( event obj -- )
+ "Basic handle-destroy-window-event called" print drop drop ;
+
+M: window handle-map-event ( event obj -- )
+ "Basic handle-map-event called" print drop drop ;
+
+M: window handle-expose-event ( event obj -- )
+ "Basic handle-expose-event called" print drop drop ;
+
+M: window handle-button-release-event ( event obj -- )
+ "Basic handle-button-release-event called" print drop drop ;
+
+M: window handle-unmap-event ( event obj -- )
+ "Basic handle-unmap-event called" print drop drop ;
+
+M: window handle-key-press-event ( event obj -- )
+ "Basic handle-key-press-event called" print drop drop ;
+
+M: window handle-key-release-event ( event obj -- )
+ "Basic handle-key-release-event called" print drop drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: label text ;
+
+: create-label ( text -- )
+ >r create-window-object r> dup >r set-delegate r>
+ dup add-to-window-table
+ dup >r
+ >r ExposureMask r> [ select-input ] with-window-object
+ r> ;
+
+DEFER: draw-string%
+DEFER: window-size%
+DEFER: window-children%
+DEFER: set-window-width%
+DEFER: set-window-height%
+DEFER: vertical-layout%
+DEFER: map-subwindows%
+DEFER: reparent-window%
+DEFER: unmap-window%
+
+! M: label handle-expose-event ( event -- )
+! nip dup window-size% { 1/2 1/2 } v* swap
+! dup label-text swap
+! [ draw-string-middle-center ] with-window-object ;
+
+M: label handle-expose-event ( event -- )
+ nip
+ [ window-size% { 1/2 1/2 } v* ] keep
+ [ label-text ] keep
+ [ draw-string-middle-center ] with-window-object ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: button action ;
+
+: create-button ( text action -- )
+swap create-label swap dup >r set-delegate r>
+dup add-to-window-table
+>r ExposureMask ButtonPressMask bitor r>
+dup >r [ select-input ] with-window-object
+r> ;
+
+M: button handle-button-press-event ( event -- )
+nip button-action call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: menu item-width item-height space ;
+
+: create-menu ( -- )
+ create-window-object 100 20 1 [ set-delegate ] keep ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-menu-children-height ( menu -- )
+ dup menu-item-height swap window-children%
+ [ set-window-height+ ]
+ each-with ;
+
+: set-menu-children-width ( menu -- )
+ dup menu-item-width swap window-children%
+ [ set-window-width+ ]
+ each-with ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: center-menu-items ( menu -- )
+ window-children% [ center-window-horizontally+ ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-menu-width ( menu -- )
+ dup menu-space 2 *
+ over menu-item-width +
+ swap set-window-width% ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: menu-items-height ( menu -- height )
+ dup window-children% length swap menu-item-height * ;
+
+: menu-space-height ( menu -- height )
+ dup window-children% length 1 - 2 +
+ swap menu-space * ;
+
+: menu-height ( menu -- height )
+ dup menu-items-height swap menu-space-height + ;
+
+: set-menu-height ( menu -- )
+ dup menu-height swap set-window-height% ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: refresh-menu ( menu -- )
+ dup set-menu-children-height
+ dup set-menu-children-width
+ dup set-menu-width
+ dup set-menu-height
+ dup menu-space over vertical-layout%
+ dup center-menu-items
+ map-subwindows% ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: add-menu-item ( text action menu -- )
+ -rot create-button dupd reparent-window%
+ refresh-menu ;
+
+: modify-action-to-unmap ( action menu -- action )
+ [ unmap-window% ] cons append ;
+
+: add-popup-menu-item ( text action menu -- )
+ tuck modify-action-to-unmap
+ swap add-menu-item ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! window with parameterizable responses to events
+
+TUPLE: pwindow resize-action last-size move-action last-position
+key-action button-action motion-action expose-action ;
+
+! resize-action ( { width height } -- )
+! move-action ( { x y } -- )
+
+: create-pwindow ( -- )
+create-window-object f f f f f f f f dup >r set-delegate r>
+dup add-to-window-table ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: XConfigureEvent-size ( event -- { width height } )
+dup XConfigureEvent-width swap XConfigureEvent-height 2array ;
+
+: XConfigureEvent-position ( event -- { x y } )
+dup XConfigureEvent-x swap XConfigureEvent-y 2array ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: size-changed? ( event obj -- ? )
+pwindow-last-size swap XConfigureEvent-size = not ;
+
+: update-last-size ( event obj -- )
+swap XConfigureEvent-size swap set-pwindow-last-size ;
+
+: call-resize-action ( event obj -- ? )
+swap XConfigureEvent-size swap dup pwindow-resize-action call ;
+
+: maybe-handle-resize ( event obj -- )
+2dup size-changed? [ 2dup update-last-size call-resize-action ] [ 2drop ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: position-changed? ( event obj -- ? )
+pwindow-last-position swap XConfigureEvent-position = not ;
+
+: update-last-position ( event obj -- )
+swap XConfigureEvent-position swap set-pwindow-last-position ;
+
+: call-move-action ( event obj -- ? )
+swap XConfigureEvent-position swap dup pwindow-move-action call ;
+
+: maybe-handle-move ( event obj )
+2dup position-changed?
+[ 2dup update-last-position call-move-action ] [ 2drop ] if ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: pwindow handle-configure-event ( event obj -- )
+2dup maybe-handle-resize maybe-handle-move ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: pwindow handle-key-press-event ( event obj -- )
+dup pwindow-key-action call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: pwindow handle-button-press-event ( event obj -- )
+dup pwindow-button-action call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: pwindow handle-expose-event ( event obj -- )
+dup pwindow-expose-action call ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! event-loop
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! : event-loop ( -- )
+! next-event ! event
+! dup ! event event
+! XAnyEvent-window ! event window
+! window-table get ! event window table
+! hash ! event obj-or-f
+! dup ! event obj-or-f obj-or-f
+! [ handle-event ]
+! [ drop drop ] ! event obj-or-f obj-or-f [ handle-event ] [ drop drop ]
+! if
+! event-loop ;
+
+! It's possible to have multiple displays open simultaneously.
+! Maybe there can be an event loop for each display. Each event loop
+! would run in it's own thread.
+
+: concurrent-next-event ( -- event )
+ ! QueuedAlready events-queued 0 >
+ QueuedAfterFlush events-queued 0 >
+ [ next-event ]
+ [ 100 sleep concurrent-next-event ]
+ if ;
+
+: concurrent-event-loop ( -- )
+ concurrent-next-event ! event
+ dup ! event event
+ XAnyEvent-window ! event window
+ window-table get ! event window table
+ hash ! event obj-or-f
+ dup ! event obj-or-f obj-or-f
+ [ handle-event ]
+ [ drop drop ] ! event obj-or-f obj-or-f [ handle-event ] [ drop drop ]
+ if
+ concurrent-event-loop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Not categorized
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-window-width% [ set-window-width ] with-window-object ;
+: set-window-height% [ set-window-height ] with-window-object ;
+
+: select-input% [ select-input ] with-window-object ;
+: set-input-focus% [ set-input-focus ] with-window-object ;
+: move-window% [ move-window ] with-window-object ;
+: resize-window% [ resize-window ] with-window-object ;
+: set-window-border-width% [ set-window-border-width ] with-window-object ;
+: map-window% [ map-window ] with-window-object ;
+: map-subwindows% [ map-subwindows ] with-window-object ;
+: valid-window?% [ valid-window? ] with-window-object ;
+: window-position% [ window-position ] with-window-object ;
+: window-size% [ window-size ] with-window-object ;
+: window-map-state% [ window-map-state ] with-window-object ;
+
+: reparent-window% ( parent window -- )
+ >r window-id r> [ reparent-window ] with-window-object ;
+
+: destroy-window% [ destroy-window ] with-window-object ;
+: raise-window% [ raise-window ] with-window-object ;
+: window-override-redirect% [ window-override-redirect ] with-window-object ;
+: add-to-save-set% [ add-to-save-set ] with-window-object ;
+: window-x% [ window-x ] with-window-object ;
+: window-y% [ window-y ] with-window-object ;
+: window-width% [ window-width ] with-window-object ;
+: window-height% [ window-height ] with-window-object ;
+: unmap-window% [ unmap-window ] with-window-object ;
+: set-window-background% [ set-window-background ] with-window-object ;
+: grab-pointer% [ grab-pointer ] with-window-object ;
+: mouse-sensor% [ mouse-sensor ] with-window-object ;
+: window-children% [ window-children ] with-window-object ;
+
+: vertical-layout% [ vertical-layout ] with-window-object ;
+
+: draw-string% [ draw-string ] with-window-object ;
+
+: get-transient-for-hint% [ get-transient-for-hint ] with-window-object ;
+
+: fetch-name% [ fetch-name ] with-window-object ;
\ No newline at end of file
diff --git a/contrib/x11/draw-string.factor b/contrib/x11/draw-string.factor
new file mode 100644
index 0000000000..4237d9cdc8
--- /dev/null
+++ b/contrib/x11/draw-string.factor
@@ -0,0 +1,34 @@
+
+IN: x
+
+USING: kernel math arrays namespaces sequences xlib x rectangle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: text-width ( string -- width ) font get swap dup length XTextWidth ;
+
+: string-size ( string -- size ) text-width font get font-height 2array ;
+
+: string-rect ( string -- rect ) string-size { 0 0 } swap ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: base-point ( rect -- )
+ top-left font get XFontStruct-ascent 0 swap 2array v+ ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: draw-string-top-left ( point string -- )
+ dup string-rect swapd move-top-left base-point swap draw-string ;
+
+: draw-string-top-right ( point string -- )
+ dup string-rect swapd move-top-right base-point swap draw-string ;
+
+: draw-string-bottom-left ( point string -- )
+ dup string-rect swapd move-bottom-left base-point swap draw-string ;
+
+: draw-string-bottom-right ( point string -- )
+ dup string-rect swapd move-bottom-right base-point swap draw-string ;
+
+: draw-string-middle-center ( point string -- )
+ dup string-rect swapd move-middle-center base-point swap draw-string ;
diff --git a/contrib/x11/automata.factor b/contrib/x11/examples/automata.factor
similarity index 86%
rename from contrib/x11/automata.factor
rename to contrib/x11/examples/automata.factor
index 755f04a671..b9255503d6 100644
--- a/contrib/x11/automata.factor
+++ b/contrib/x11/examples/automata.factor
@@ -3,7 +3,7 @@
IN: automata
USING: parser kernel hashtables namespaces sequences lists math io
- threads strings vectors prettyprint xlib xobj ;
+ threads strings arrays prettyprint xlib x ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! set-rule
@@ -11,6 +11,8 @@ USING: parser kernel hashtables namespaces sequences lists math io
SYMBOL: rule
+8 rule set
+
SYMBOL: char-0
48 char-0 set
@@ -27,7 +29,7 @@ SYMBOL: char-0
: rule-values ( n -- { ... } )
>bin 8 char-0 get pad-left
- >vector
+ >array
[ 48 - ] map ;
: set-rule ( n -- )
@@ -40,15 +42,15 @@ SYMBOL: char-0
: 3nth ( n seq -- slice ) >r dup 3 + r> ;
: next-chunk ( << slice: a b c >> - value )
- >vector rule get hash ;
+ >array rule get hash ;
+
+: (step) ( line -- new-line )
+ dup length 2 - [ swap 3nth next-chunk ] map-with ;
: step-line ( line -- new-line )
>r { 0 } r> { 0 } append append
(step) ;
-: (step) ( line -- new-line )
- dup length 2 - [ swap 3nth next-chunk ] map-with ;
-
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Display the rule
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -57,14 +59,14 @@ SYMBOL: char-0
: setup-window
":0.0" initialize-x
- create-window* win set
- 400 400 resize-window*
- map-window*
+ create-window win set
+ { 400 400 } resize-window
+ map-window
flush-dpy ;
: random-line ( -- line )
0 400
- [ drop 0 1 random-int ]
+ [ drop 2 random-int ]
map ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -72,20 +74,20 @@ SYMBOL: char-0
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: show-point ( { x y } p -- )
-1 = [ draw-point* ] [ drop ] ifte ;
+1 = [ draw-point ] [ drop ] if ;
: (show-line) ( { x y } line -- )
[ >r dup r> show-point { 1 0 } v+ ] each drop ;
: show-line ( y line -- )
- >r >r 0 r> 2vector r> (show-line) ;
+ >r >r 0 r> 2array r> (show-line) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Go
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: run-rule
- clear-window*
+ clear-window
0 random-line
400
[ drop
@@ -95,7 +97,7 @@ SYMBOL: char-0
flush-dpy ;
: random-gallery
- 1 255 random-int
+ 255 random-int 1 +
dup unparse print
set-rule
run-rule
diff --git a/contrib/x11/boids.factor b/contrib/x11/examples/boids.factor
similarity index 94%
rename from contrib/x11/boids.factor
rename to contrib/x11/examples/boids.factor
index bbb76ceb2a..c55fc9f1f6 100644
--- a/contrib/x11/boids.factor
+++ b/contrib/x11/examples/boids.factor
@@ -2,7 +2,7 @@
IN: boids
-USING: namespaces math kernel sequences vectors xlib x ;
+USING: namespaces math kernel sequences arrays xlib x ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -38,18 +38,22 @@ SYMBOL: time-slice 0.5 time-slice set
! random-boid and random-boids
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-: random-n ( n -- random-0-to-n-1 )
- 1 - 0 swap random-int ;
+! : random-range dupd swap - random-int + ;
+
+: random-range ( a b -- n ) 1 + dupd swap - random-int + ;
+
+! : random-n ( n -- random-0-to-n-1 )
+! 1 - 0 swap random-int ;
: random-pos ( -- pos )
- world-size get [ random-n ] map ;
+ world-size get [ random-int ] map ;
: random-vel ( -- vel )
- 2 >vector [ drop -10 10 random-int ] map ;
+ 2 >array [ drop -10 10 random-range ] map ;
: random-boid ( -- boid ) random-pos random-vel ;
-: random-boids ( n -- boids ) >vector [ drop random-boid ] map ;
+: random-boids ( n -- boids ) >array [ drop random-boid ] map ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -179,7 +183,7 @@ SYMBOL: boids
normalize
separation-weight get
v*n ]
- ifte ;
+ if ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -192,7 +196,7 @@ SYMBOL: boids
normalize
alignment-weight get
v*n ]
- ifte ;
+ if ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -207,7 +211,7 @@ SYMBOL: boids
normalize
cohesion-weight get
v*n ]
- ifte ;
+ if ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -248,7 +252,7 @@ SYMBOL: boids
: wrap-pos ( pos -- pos )
[ ] each
- wrap-y swap wrap-x swap 2vector ;
+ wrap-y swap wrap-x swap 2array ;
: iterate-boid ( self -- self )
dup >r new-pos wrap-pos r> new-vel ;
diff --git a/contrib/x11/examples/cube.factor b/contrib/x11/examples/cube.factor
new file mode 100644
index 0000000000..e0dc742853
--- /dev/null
+++ b/contrib/x11/examples/cube.factor
@@ -0,0 +1,63 @@
+USING: kernel sequences namespaces math threads io opengl concurrency
+x xlib x11 gl concurrent-widgets ;
+
+SYMBOL: pval
+
+: p pval get ;
+: -p pval get neg ;
+
+: wire-cube ( size -- )
+2.0 / pval set
+GL_LINE_LOOP glBegin
+-p -p -p glVertex3f
+ p -p -p glVertex3f
+ p p -p glVertex3f
+-p p -p glVertex3f
+glEnd
+GL_LINE_LOOP glBegin
+-p -p p glVertex3f
+ p -p p glVertex3f
+ p p p glVertex3f
+-p p p glVertex3f
+glEnd
+GL_LINES glBegin
+-p -p -p glVertex3f
+-p -p p glVertex3f
+ p -p -p glVertex3f
+ p -p p glVertex3f
+-p p -p glVertex3f
+-p p p glVertex3f
+ p p -p glVertex3f
+ p p p glVertex3f
+glEnd ;
+
+: init ( -- ) 0.0 0.0 0.0 0.0 glClearColor GL_FLAT glShadeModel ;
+
+: display ( -- )
+GL_COLOR_BUFFER_BIT glClear
+1.0 1.0 1.0 glColor3f
+glLoadIdentity
+0.0 0.0 5.0 0.0 0.0 0.0 0.0 1.0 0.0 gluLookAt
+1.0 2.0 1.0 glScalef
+1.0 wire-cube
+glFlush ;
+
+: reshape ( { width height } -- )
+>r 0 0 r> [ ] each glViewport
+GL_PROJECTION glMatrixMode
+glLoadIdentity
+-1.0 1.0 -1.0 1.0 1.5 20.0 glFrustum
+GL_MODELVIEW glMatrixMode
+display ;
+
+f initialize-x
+
+create-pwindow
+[ drop reshape ] over set-pwindow-resize-action
+window-id win set
+StructureNotifyMask select-input
+{ 500 500 } resize-window { 100 100 } move-window map-window
+
+[ GLX_RGBA ] choose-visual create-context make-current
+
+init [ concurrent-event-loop ] spawn display
\ No newline at end of file
diff --git a/contrib/x11/examples/double.factor b/contrib/x11/examples/double.factor
new file mode 100644
index 0000000000..40394240e6
--- /dev/null
+++ b/contrib/x11/examples/double.factor
@@ -0,0 +1,49 @@
+USING: kernel sequences namespaces math threads io opengl concurrency
+x xlib x11 gl concurrent-widgets ;
+
+SYMBOL: loop-action [ ] loop-action set
+
+SYMBOL: spin 0.0 spin set
+
+: init ( -- ) 0.0 0.0 0.0 0.0 glClearColor GL_FLAT glShadeModel ;
+
+: display ( -- )
+GL_COLOR_BUFFER_BIT glClear
+glPushMatrix
+spin get 0.0 0.0 1.0 glRotatef
+1.0 1.0 1.0 glColor3f
+-25.0 -25.0 25.0 25.0 glRectf
+glPopMatrix
+swap-buffers ;
+
+: spin-display ( -- )
+spin get 2.0 + spin set
+spin get 360.0 > [ spin get 360.0 - spin set ] when display ;
+
+: reshape ( { width height } -- )
+>r 0 0 r> [ ] each glViewport
+GL_PROJECTION glMatrixMode glLoadIdentity
+-50.0 50.0 -50.0 50.0 -1.0 1.0 glOrtho
+GL_MODELVIEW glMatrixMode glLoadIdentity ;
+
+: mouse ( event -- )
+{ { [ dup XButtonEvent-button Button1 = ]
+ [ global [ [ spin-display ] loop-action set ] bind drop ] }
+ { [ dup XButtonEvent-button Button2 = ]
+ [ global [ [ ] loop-action set ] bind drop ] }
+ { [ t ] [ drop ] } } cond ;
+
+: loop ( -- ) loop-action get call 10 sleep loop ;
+
+f initialize-x
+
+create-pwindow
+[ drop reshape ] over set-pwindow-resize-action
+[ drop mouse ] over set-pwindow-button-action
+window-id win set
+StructureNotifyMask ButtonPressMask bitor select-input
+{ 250 250 } resize-window { 100 100 } move-window map-window
+
+[ GLX_RGBA GLX_DOUBLEBUFFER ] choose-visual create-context make-current
+
+init [ concurrent-event-loop ] spawn [ loop ] spawn
\ No newline at end of file
diff --git a/contrib/x11/examples/example-01.factor b/contrib/x11/examples/example-01.factor
new file mode 100644
index 0000000000..293198d0a0
--- /dev/null
+++ b/contrib/x11/examples/example-01.factor
@@ -0,0 +1,12 @@
+
+USING: io concurrency x concurrent-widgets ;
+
+f initialize-x
+
+"Hey Hey" create-label
+[ map-window ] with-window-object
+
+"Yo Yo Yo" [ "button pressed" print ] create-button
+[ map-window ] with-window-object
+
+[ concurrent-event-loop ] spawn
\ No newline at end of file
diff --git a/contrib/x11/examples/example-02.factor b/contrib/x11/examples/example-02.factor
new file mode 100644
index 0000000000..4c2768b95f
--- /dev/null
+++ b/contrib/x11/examples/example-02.factor
@@ -0,0 +1,48 @@
+
+USING: kernel namespaces sequences x concurrency concurrent-widgets ;
+
+SYMBOL: win-a SYMBOL: win-b SYMBOL: win-c SYMBOL: win-d
+
+f initialize-x
+
+[ win-a win-b win-c win-d ] [ create-window swap set ] each
+[ win-a win-b win-c win-d ] [ "black" "red" "green" "blue" ]
+[ lookup-color swap get win set set-window-background ] 2each
+
+[ win-b win-c win-d ] [ get win set win-a get reparent-window ] each
+
+[ win-a win-b win-c win-d ] [ get win set map-window ] each
+
+win-a get [ { 300 300 } resize-window ] with-win
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: button-horizontal
+
+"Horizontal"
+[ win-a get
+ [ stack-children arrange-children-horizontally ] with-win
+] create-button
+button-horizontal set
+button-horizontal get
+[ { 100 20 } resize-window
+ map-window
+] with-window-object
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: button-vertical
+
+"Vertical"
+[ win-a get
+ [ stack-children arrange-children-vertically ] with-win
+] create-button
+button-vertical set
+button-vertical get
+[ { 100 20 } resize-window
+ map-window
+] with-window-object
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+[ concurrent-event-loop ] spawn
\ No newline at end of file
diff --git a/contrib/x11/examples/example-03.factor b/contrib/x11/examples/example-03.factor
new file mode 100644
index 0000000000..b4e8eafc46
--- /dev/null
+++ b/contrib/x11/examples/example-03.factor
@@ -0,0 +1,38 @@
+
+USING: kernel namespaces sequences io xlib x concurrency concurrent-widgets ;
+
+SYMBOL: win-a
+SYMBOL: button-a
+SYMBOL: button-b
+SYMBOL: button-c
+
+f initialize-x
+
+create-window-object win-a set
+
+win-a get [ "black" lookup-color set-window-background ] with-window-object
+
+"Hey Hey Hey" [ "button pressed" print ] create-button button-a set
+"Yo Yo Yo" [ "button pressed" print ] create-button button-b set
+"Foo" [ "button pressed" print ] create-button button-c set
+
+[ button-a button-b button-c ] [ "red" "green" "blue" ]
+[ lookup-color swap get [ set-window-background ] with-window-object ]
+2each
+
+[ button-a button-b button-c ]
+[ get [ { 100 20 } resize-window ] with-window-object ]
+each
+
+[ button-a button-b button-c ]
+[ get [ win-a get window-id reparent-window ] with-window-object ]
+each
+
+win-a get [ map-window ] with-window-object
+
+[ button-a button-b button-c ] [ get [ map-window ] with-window-object ]
+each
+
+win-a get [ arrange-children-vertically ] with-window-object
+
+[ concurrent-event-loop ] spawn
\ No newline at end of file
diff --git a/contrib/x11/examples/hello.factor b/contrib/x11/examples/hello.factor
new file mode 100644
index 0000000000..ddb3f35a67
--- /dev/null
+++ b/contrib/x11/examples/hello.factor
@@ -0,0 +1,22 @@
+USING: kernel words namespaces sequences x x11 opengl gl ;
+
+: display ( -- )
+GL_COLOR_BUFFER_BIT glClear
+1.0 1.0 1.0 glColor3f
+GL_POLYGON glBegin
+0.25 0.25 0.0 glVertex3f
+0.75 0.25 0.0 glVertex3f
+0.75 0.75 0.0 glVertex3f
+0.25 0.75 0.0 glVertex3f
+glEnd
+glFlush ;
+
+: init ( -- )
+0.0 0.0 0.0 0.0 glClearColor
+GL_PROJECTION glMatrixMode
+glLoadIdentity
+0.0 1.0 0.0 1.0 -1.0 1.0 glOrtho
+;
+
+f initialize-x create-window win set { 250 250 } resize-window map-window
+[ GLX_RGBA ] choose-visual create-context make-current init display
\ No newline at end of file
diff --git a/contrib/x11/examples/lindenmayer/lindenmayer-viewer.factor b/contrib/x11/examples/lindenmayer/lindenmayer-viewer.factor
new file mode 100644
index 0000000000..e70c2f3c3f
--- /dev/null
+++ b/contrib/x11/examples/lindenmayer/lindenmayer-viewer.factor
@@ -0,0 +1,55 @@
+USING: kernel alien math arrays sequences opengl namespaces concurrency
+xlib x x11 gl concurrent-widgets lindenmayer ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: sequences
+
+: >float-array ( seq -- )
+dup length swap dup length >array [ pick set-float-nth ] 2each ;
+
+USE: lindenmayer
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: camera-position { 5 5 5 } camera-position set
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: display ( -- )
+GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
+camera-position get glLoadIdentity [ ] each 0.0 0.0 0.0 0.0 1.0 0.0 gluLookAt
+reset result get interpret glFlush ;
+
+: reshape ( { width height } -- )
+>r 0 0 r> [ ] each glViewport
+GL_PROJECTION glMatrixMode
+glLoadIdentity -1.0 1.0 -1.0 1.0 1.5 200.0 glFrustum
+GL_MODELVIEW glMatrixMode
+display ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+f initialize-x
+
+create-pwindow
+[ drop reshape ] over set-pwindow-resize-action
+[ 2drop display ] over set-pwindow-expose-action
+window-id win set
+ExposureMask StructureNotifyMask bitor select-input
+{ 500 500 } resize-window { 0 0 } move-window map-window
+
+[ GLX_RGBA ] choose-visual create-context make-current
+
+0.0 0.0 0.0 0.0 glClearColor
+GL_SMOOTH glShadeModel
+
+GL_FRONT_AND_BACK GL_SPECULAR { 1.0 1.0 1.0 1.0 } >float-array glMaterialfv
+GL_FRONT_AND_BACK GL_SHININESS { 50.0 } >float-array glMaterialfv
+GL_LIGHT0 GL_POSITION { 1.0 1.0 1.0 0.0 } >float-array glLightfv
+
+GL_LIGHTING glEnable
+GL_LIGHT0 glEnable
+GL_DEPTH_TEST glEnable
+
+[ concurrent-event-loop ] spawn
\ No newline at end of file
diff --git a/contrib/x11/examples/lindenmayer/lindenmayer.factor b/contrib/x11/examples/lindenmayer/lindenmayer.factor
new file mode 100644
index 0000000000..84423b9cd1
--- /dev/null
+++ b/contrib/x11/examples/lindenmayer/lindenmayer.factor
@@ -0,0 +1,342 @@
+USING: kernel alien namespaces arrays vectors math opengl math-contrib
+lists parser sequences hashtables strings ;
+
+IN: lindenmayer
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: make-matrix >r { } make r> swap group ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: RU ( angle -- RU ) deg>rad
+[ dup cos , dup sin , 0 ,
+ dup sin neg , dup cos , 0 ,
+ 0 , 0 , 1 , ] 3 make-matrix nip ;
+
+: RL ( angle -- RL ) deg>rad
+[ dup cos , 0 , dup sin neg ,
+ 0 , 1 , 0 ,
+ dup sin , 0 , dup cos , ] 3 make-matrix nip ;
+
+: RH ( angle -- RH ) deg>rad
+[ 1 , 0 , 0 ,
+ 0 , dup cos , dup sin neg ,
+ 0 , dup sin , dup cos , ] 3 make-matrix nip ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: position
+SYMBOL: orientation
+
+: rotate-U ( angle -- ) RU orientation get swap m. orientation set ;
+: rotate-L ( angle -- ) RL orientation get swap m. orientation set ;
+: rotate-H ( angle -- ) RH orientation get swap m. orientation set ;
+
+: step ( length -- )
+>r position get orientation get 0 0 r> 3array m.v v+ position set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: record-vertex ( -- ) position get first3 glVertex3f ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: rotate-z rotate-U ;
+: rotate-y neg rotate-L ;
+: rotate-x neg rotate-H ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: reset ( -- ) { 0 0 0 } position set 3 identity-matrix orientation set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: polygon-vertex
+
+: draw-forward ( length -- )
+GL_LINES glBegin record-vertex step record-vertex glEnd ;
+
+: move-forward ( length -- ) step polygon-vertex ;
+
+: sneak-forward ( length -- ) step ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! (v0 - v1) x (v1 - v2)
+
+: polygon-normal ( { v0 v1 v2 } -- normal )
+0 over nth over 1 swap nth v- swap
+1 over nth swap 2 swap nth v- cross ;
+
+: polygon ( vertices -- )
+GL_POLYGON glBegin dup polygon-normal first3 glNormal3f
+[ first3 glVertex3f ] each glEnd ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: vertices
+
+V{ } vertices set
+
+: start-polygon ( -- ) 0 vertices set ;
+
+: finish-polygon ( -- ) vertices get polygon ;
+
+: polygon-vertex ( -- ) position get vertices get push ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: sequences : length* length ; USE: lindenmayer
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Lindenmayer string rewriting
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: rules
+
+: segment ( str -- seq )
+{ { [ dup "" = ] [ drop [ ] ] }
+ { [ dup length* 1 = ] [ f cons ] }
+ { [ dup 1 swap nth CHAR: ( = ]
+ [ dup CHAR: ) swap index 1 + ! str i
+ swap ! i str
+ 2dup head ! i str head
+ -rot tail ! head tail
+ segment cons ] }
+ { [ t ] [ 1 over head swap 1 swap tail segment cons ] } }
+cond ;
+
+: lookup ( str -- str ) 1 over head rules get hash dup [ nip ] [ drop ] if ;
+
+: rewrite ( str -- str ) segment [ lookup ] map concat ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Lindenmayer string interpretation
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: command-table
+
+: segment-command ( seg -- command ) 1 swap head ;
+
+: segment-parameter ( seg -- parameter )
+dup length* 1 - 2 swap rot subseq parse call ;
+
+: segment-parts ( seg -- param command )
+dup segment-parameter swap segment-command ;
+
+: exec-command ( str -- ) command-table get hash dup [ call ] [ drop ] if ;
+
+: exec-command-with-param ( param command -- )
+command-table get hash dup [ last call ] [ 2drop ] if ;
+
+: (interpret) ( seg -- )
+dup length* 1 = [ exec-command ] [ segment-parts exec-command-with-param ] if ;
+
+: interpret ( str -- ) segment [ (interpret) ] each ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Lparser dialect
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: angle
+SYMBOL: length
+SYMBOL: thickness
+SYMBOL: color-index
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+DEFER: set-thickness
+DEFER: set-color-index
+
+TUPLE: state position orientation angle length thickness color-index ;
+
+SYMBOL: states V{ } states set
+
+: save-state ( -- )
+position get orientation get angle get length get thickness get
+color-index get
+states get push ;
+
+: restore-state ( -- )
+states get pop
+dup state-position position set
+dup state-orientation orientation set
+dup state-length length set
+dup state-angle angle set
+dup state-color-index set-color-index
+dup state-thickness set-thickness
+drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: scale-length ( m -- ) length get * length set ;
+
+: scale-angle ( m -- ) angle get * angle set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: color-table
+
+{ { 0 0 0 } ! black
+ { 0.5 0.5 0.5 } ! grey
+ { 1 0 0 } ! red
+ { 1 1 0 } ! yellow
+ { 0 1 0 } ! green
+ { 0.250 0.878 0.815 } ! turquoise
+ { 0 0 1 } ! blue
+ { 0.627 0.125 0.941 } ! purple
+ { 0 0.392 0 } ! dark green
+ { 0.0 0.807 0.819 } ! dark turquoise
+ { 0.0 0.0 0.545 } ! dark blue
+ { 0.580 0.0 0.827 } ! dark purple
+ { 0.545 0.0 0.0 } ! dark red
+ { 0.25 0.25 0.25 } ! dark grey
+ { 0.75 0.75 0.75 } ! medium grey
+ { 1 1 1 } ! white
+} color-table set
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+USE: sequences
+
+: >float-array ( seq -- )
+dup length swap dup length >array [ pick set-float-nth ] 2each ;
+
+USE: lindenmayer
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: material-color ( r g b -- )
+3array 1.0 add >float-array
+GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot glMaterialfv ;
+
+: set-color-index ( i -- )
+dup color-index set color-table get nth dup
+first3 glColor3f first3 material-color ;
+
+: inc-color-index ( -- ) color-index get 1 + set-color-index ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-thickness ( i -- ) dup thickness set glLineWidth ;
+
+: scale-thickness ( m -- ) thickness get * 0.5 max set-thickness ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: -rotate-y neg rotate-y ;
+: -rotate-x neg rotate-x ;
+: -rotate-z neg rotate-z ;
+
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: lparser-dialect ( -- )
+
+1 length set 45 angle set 1 thickness set 2 set-color-index
+
+H{ [[ "+" [ angle get rotate-y ] ]]
+! [[ "-" [ angle get neg rotate-y ] ]]
+ [[ "-" [ angle get -rotate-y ] ]]
+ [[ "&" [ angle get rotate-x ] ]]
+! [[ "^" [ angle get neg rotate-x ] ]]
+ [[ "^" [ angle get -rotate-x ] ]]
+ [[ "<" [ angle get rotate-z ] ]]
+! [[ ">" [ angle get neg rotate-z ] ]]
+ [[ ">" [ angle get -rotate-z ] ]]
+ [[ "|" [ 180.0 rotate-y ] ]]
+ [[ "%" [ 180.0 rotate-z ] ]]
+
+ [[ "F" [ length get draw-forward ] ]]
+ [[ "Z" [ length get 2 / draw-forward ] ]]
+ [[ "f" [ length get move-forward ] ]]
+ [[ "z" [ length get 2 / move-forward ] ]]
+ [[ "g" [ length get sneak-forward ] ]]
+
+ [[ "." [ polygon-vertex ] ]]
+ [[ "[" [ save-state ] ]]
+ [[ "]" [ restore-state ] ]]
+ [[ "{" [ start-polygon ] ]]
+ [[ "}" [ finish-polygon ] ]]
+
+ [[ "/" [ 1.1 scale-length ] ]]
+ [[ "'" [ 0.9 scale-length ] ]]
+ [[ ";" [ 1.1 scale-angle ] ]]
+ [[ ":" [ 0.9 scale-angle ] ]]
+! [[ "?" [ thickness get 1.4 * thickness set ] ]]
+! [[ "!" [ thickness get 0.7 * thickness set ] ]]
+ [[ "?" [ 1.4 scale-thickness ] ]]
+ [[ "!" [ 0.7 scale-thickness ] ]]
+
+! [[ "c" [ inc-color-index ] ]]
+ [[ "c" [ color-index get 1 + set-color-index ] ]]
+
+} command-table set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Examples
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+SYMBOL: axiom
+SYMBOL: result
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: koch ( -- ) lparser-dialect 90 angle set
+
+H{ [[ "K" "[[a|b] '(0.41)f'(2.439) |<(60) [a|b]]" ]]
+ [[ "k" "[ c'(0.5) K]" ]]
+ [[ "a" "[d <(120) d <(120) d ]" ]]
+ [[ "b" "e" ]]
+ [[ "e" "[^ '(.2887)f'(3.4758) &(180) +z{.-(120)f-(120)f}]" ]]
+ [[ "d" "[^ '(.2887)f'(3.4758) &(109.5111) +zk{.-(120)f-(120)f}]" ]]
+} rules set
+
+"K" axiom set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: spiral-0 ( -- ) lparser-dialect 10 angle set 5 thickness set
+
+"[P]|[P]" axiom set
+
+H{ [[ "P" "[A]>>>>>>>>>[cB]>>>>>>>>>[ccC]>>>>>>>>>[cccD]" ]]
+ [[ "A" "F+;'A" ]]
+ [[ "B" "F!+F+;'B" ]]
+ [[ "C" "F!^+F^+;'C" ]]
+ [[ "D" "F!>^+F>^+;'D" ]]
+} rules set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: tree-5 ( -- ) lparser-dialect 5 angle set 1 thickness set
+
+"c(4)FFS" axiom set
+
+H{ [[ "S" "FFR>(60)R>(60)R>(60)R>(60)R>(60)R>(30)S" ]]
+ [[ "R" "[Ba]" ]]
+ [[ "a" "$tF[Cx]Fb" ]]
+ [[ "b" "$tF[Dy]Fa" ]]
+ [[ "B" "&B" ]]
+ [[ "C" "+C" ]]
+ [[ "D" "-D" ]]
+
+ [[ "x" "a" ]]
+ [[ "y" "b" ]]
+
+ [[ "F" "'(1.25)F'(.8)" ]]
+} rules set ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: abop-1 ( -- ) lparser-dialect 45 angle set 5 thickness set
+
+H{ [[ "A" "F[&'(.8)!BL]>(137)'!(.9)A" ]]
+ [[ "B" "F[-'(.8)!(.9)$CL]'!(.9)C" ]]
+ [[ "C" "F[+'(.8)!(.9)$BL]'!(.9)B" ]]
+
+ [[ "L" "~c(8){+(30)f-(120)f-(120)f}" ]]
+} rules set
+
+"c(12)FFAL" axiom set ;
\ No newline at end of file
diff --git a/contrib/x11/examples/lindenmayer/load.factor b/contrib/x11/examples/lindenmayer/load.factor
new file mode 100644
index 0000000000..66326d6ab7
--- /dev/null
+++ b/contrib/x11/examples/lindenmayer/load.factor
@@ -0,0 +1,5 @@
+USING: kernel parser words compiler sequences ;
+
+"/contrib/x11/examples/lindenmayer/lindenmayer.factor" run-resource
+
+"lindenmayer" words [ try-compile ] each clear
diff --git a/contrib/x11/gl.factor b/contrib/x11/gl.factor
new file mode 100644
index 0000000000..3ebe83ce38
--- /dev/null
+++ b/contrib/x11/gl.factor
@@ -0,0 +1,17 @@
+IN: gl USING: kernel words sequences alien arrays namespaces x xlib x11 ;
+
+: >int-array ( seq -- )
+dup length "int-array" swap dup length >array [ pick set-int-nth ] 2each ;
+
+: >attributes ( seq -- attributes )
+0 add [ dup word? [ execute ] [ ] if ] map ;
+
+: choose-visual ( attributes -- XVisualInfo* )
+>attributes >int-array dpy get scr get rot glXChooseVisual ;
+
+: create-context ( XVisualInfo* -- GLXContext )
+>r dpy get r> 0 True glXCreateContext ;
+
+: make-current ( GLXContext -- Bool ) >r dpy get win get r> glXMakeCurrent ;
+
+: swap-buffers ( -- ) dpy get win get glXSwapBuffers ;
diff --git a/contrib/x11/glx.factor b/contrib/x11/glx.factor
new file mode 100644
index 0000000000..9c6f3be4db
--- /dev/null
+++ b/contrib/x11/glx.factor
@@ -0,0 +1,84 @@
+#! based on glx.h from xfree86, and some of glxtokens.h
+IN: x11
+USING: alien ;
+
+LIBRARY: gl
+
+! Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib)
+: GLX_USE_GL 1 ; ! support GLX rendering
+: GLX_BUFFER_SIZE 2 ; ! depth of the color buffer
+: GLX_LEVEL 3 ; ! level in plane stacking
+: GLX_RGBA 4 ; ! true if RGBA mode
+: GLX_DOUBLEBUFFER 5 ; ! double buffering supported
+: GLX_STEREO 6 ; ! stereo buffering supported
+: GLX_AUX_BUFFERS 7 ; ! number of aux buffers
+: GLX_RED_SIZE 8 ; ! number of red component bits
+: GLX_GREEN_SIZE 9 ; ! number of green component bits
+: GLX_BLUE_SIZE 10 ; ! number of blue component bits
+: GLX_ALPHA_SIZE 11 ; ! number of alpha component bits
+: GLX_DEPTH_SIZE 12 ; ! number of depth bits
+: GLX_STENCIL_SIZE 13 ; ! number of stencil bits
+: GLX_ACCUM_RED_SIZE 14 ; ! number of red accum bits
+: GLX_ACCUM_GREEN_SIZE 15 ; ! number of green accum bits
+: GLX_ACCUM_BLUE_SIZE 16 ; ! number of blue accum bits
+: GLX_ACCUM_ALPHA_SIZE 17 ; ! number of alpha accum bits
+
+TYPEDEF: XID GLXContextID
+TYPEDEF: XID GLXPixmap
+TYPEDEF: XID GLXDrawable
+TYPEDEF: XID GLXPbuffer
+TYPEDEF: XID GLXWindow
+TYPEDEF: XID GLXFBConfigID
+TYPEDEF: void* GLXContext ! typedef struct __GLXcontextRec *GLXContext;
+TYPEDEF: void* GLXFBConfig ! typedef struct __GLXFBConfigRec *GLXFBConfig;
+
+FUNCTION: XVisualInfo* glXChooseVisual ( Display* dpy, int screen, int* attribList ) ;
+FUNCTION: void glXCopyContext ( Display* dpy, GLXContext src, GLXContext dst, ulong mask ) ;
+FUNCTION: GLXContext glXCreateContext ( Display* dpy, XVisualInfo* vis, GLXContext shareList, bool direct ) ;
+FUNCTION: GLXPixmap glXCreateGLXPixmap ( Display* dpy, XVisualInfo* vis, Pixmap pixmap ) ;
+FUNCTION: void glXDestroyContext ( Display* dpy, GLXContext ctx ) ;
+FUNCTION: void glXDestroyGLXPixmap ( Display* dpy, GLXPixmap pix ) ;
+FUNCTION: int glXGetConfig ( Display* dpy, XVisualInfo* vis, int attrib, int* value) ;
+FUNCTION: GLXContext glXGetCurrentContext ( ) ;
+FUNCTION: GLXDrawable glXGetCurrentDrawable ( ) ;
+FUNCTION: bool glXIsDirect ( Display* dpy, GLXContext ctx ) ;
+FUNCTION: bool glXMakeCurrent ( Display* dpy, GLXDrawable drawable, GLXContext ctx ) ;
+FUNCTION: bool glXQueryExtension ( Display* dpy, int* errorBase, int* eventBase ) ;
+FUNCTION: bool glXQueryVersion ( Display* dpy, int* major, int* minor ) ;
+FUNCTION: void glXSwapBuffers ( Display* dpy, GLXDrawable drawable ) ;
+FUNCTION: void glXUseXFont ( Font font, int first, int count, int listBase ) ;
+FUNCTION: void glXWaitGL ( ) ;
+FUNCTION: void glXWaitX ( ) ;
+FUNCTION: char* glXGetClientString ( Display* dpy, int name ) ;
+FUNCTION: char* glXQueryServerString ( Display* dpy, int screen, int name ) ;
+FUNCTION: char* glXQueryExtensionsString ( Display* dpy, int screen ) ;
+
+! New for GLX 1.3
+FUNCTION: GLXFBConfig* glXGetFBConfigs ( Display* dpy, int screen, int* nelements ) ;
+FUNCTION: GLXFBConfig* glXChooseFBConfig ( Display* dpy, int screen, int* attrib_list, int* nelements ) ;
+FUNCTION: int glXGetFBConfigAttrib ( Display* dpy, GLXFBConfig config, int attribute, int* value ) ;
+FUNCTION: XVisualInfo* glXGetVisualFromFBConfig ( Display* dpy, GLXFBConfig config ) ;
+FUNCTION: GLXWindow glXCreateWindow ( Display* dpy, GLXFBConfig config, Window win, int* attrib_list ) ;
+FUNCTION: void glXDestroyWindow ( Display* dpy, GLXWindow win ) ;
+FUNCTION: GLXPixmap glXCreatePixmap ( Display* dpy, GLXFBConfig config, Pixmap pixmap, int* attrib_list ) ;
+FUNCTION: void glXDestroyPixmap ( Display* dpy, GLXPixmap pixmap ) ;
+FUNCTION: GLXPbuffer glXCreatePbuffer ( Display* dpy, GLXFBConfig config, int* attrib_list ) ;
+FUNCTION: void glXDestroyPbuffer ( Display* dpy, GLXPbuffer pbuf ) ;
+FUNCTION: void glXQueryDrawable ( Display* dpy, GLXDrawable draw, int attribute, uint* value ) ;
+FUNCTION: GLXContext glXCreateNewContext ( Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, bool direct ) ;
+FUNCTION: bool glXMakeContextCurrent ( Display* display, GLXDrawable draw, GLXDrawable read, GLXContext ctx ) ;
+FUNCTION: GLXDrawable glXGetCurrentReadDrawable ( ) ;
+FUNCTION: Display* glXGetCurrentDisplay ( ) ;
+FUNCTION: int glXQueryContext ( Display* dpy, GLXContext ctx, int attribute, int* value ) ;
+FUNCTION: void glXSelectEvent ( Display* dpy, GLXDrawable draw, ulong event_mask ) ;
+FUNCTION: void glXGetSelectedEvent ( Display* dpy, GLXDrawable draw, ulong* event_mask ) ;
+
+! GLX 1.4 and later
+! extern void (*glXGetProcAddress(const GLubyte* procname))(void ) ;
+
+! glxext stuff skipped
+
+
+! GLX Events
+! (also skipped for now. only has GLXPbufferClobberEvent, the rest is handled by xlib methinks
+
diff --git a/contrib/x11/keysymdef.factor b/contrib/x11/keysymdef.factor
new file mode 100644
index 0000000000..a93fbf40b5
--- /dev/null
+++ b/contrib/x11/keysymdef.factor
@@ -0,0 +1,69 @@
+! remarkably similar to parts of keysymdef.h
+IN: x11
+
+: XK_BackSpace HEX: FF08 ; ! back space, back char
+: XK_Tab HEX: FF09 ;
+: XK_Linefeed HEX: FF0A ; ! Linefeed, LF
+: XK_Clear HEX: FF0B ;
+: XK_Return HEX: FF0D ; ! Return, enter
+: XK_Pause HEX: FF13 ; ! Pause, hold
+: XK_Scroll_Lock HEX: FF14 ;
+: XK_Sys_Req HEX: FF15 ;
+: XK_Escape HEX: FF1B ;
+: XK_Delete HEX: FFFF ; ! Delete, rubout
+
+! Cursor control & motion
+
+: XK_Home HEX: FF50 ;
+: XK_Left HEX: FF51 ; ! Move left, left arrow
+: XK_Up HEX: FF52 ; ! Move up, up arrow
+: XK_Right HEX: FF53 ; ! Move right, right arrow
+: XK_Down HEX: FF54 ; ! Move down, down arrow
+: XK_Prior HEX: FF55 ; ! Prior, previous
+: XK_Page_Up HEX: FF55 ;
+: XK_Next HEX: FF56 ; ! Next
+: XK_Page_Down HEX: FF56 ;
+: XK_End HEX: FF57 ; ! EOL
+: XK_Begin HEX: FF58 ; ! BOL
+
+! Keypad Functions, keypad numbers cleverly chosen to map to ascii
+
+: XK_KP_Space HEX: FF80 ; ! space
+: XK_KP_Tab HEX: FF89 ;
+: XK_KP_Enter HEX: FF8D ; ! enter
+: XK_KP_F1 HEX: FF91 ; ! PF1, KP_A, ...
+: XK_KP_F2 HEX: FF92 ;
+: XK_KP_F3 HEX: FF93 ;
+: XK_KP_F4 HEX: FF94 ;
+: XK_KP_Home HEX: FF95 ;
+: XK_KP_Left HEX: FF96 ;
+: XK_KP_Up HEX: FF97 ;
+: XK_KP_Right HEX: FF98 ;
+: XK_KP_Down HEX: FF99 ;
+: XK_KP_Prior HEX: FF9A ;
+: XK_KP_Page_Up HEX: FF9A ;
+: XK_KP_Next HEX: FF9B ;
+: XK_KP_Page_Down HEX: FF9B ;
+: XK_KP_End HEX: FF9C ;
+: XK_KP_Begin HEX: FF9D ;
+: XK_KP_Insert HEX: FF9E ;
+: XK_KP_Delete HEX: FF9F ;
+: XK_KP_Equal HEX: FFBD ; ! equals
+: XK_KP_Multiply HEX: FFAA ;
+: XK_KP_Add HEX: FFAB ;
+: XK_KP_Separator HEX: FFAC ; ! separator, often comma
+: XK_KP_Subtract HEX: FFAD ;
+: XK_KP_Decimal HEX: FFAE ;
+: XK_KP_Divide HEX: FFAF ;
+
+: XK_KP_0 HEX: FFB0 ;
+: XK_KP_1 HEX: FFB1 ;
+: XK_KP_2 HEX: FFB2 ;
+: XK_KP_3 HEX: FFB3 ;
+: XK_KP_4 HEX: FFB4 ;
+: XK_KP_5 HEX: FFB5 ;
+: XK_KP_6 HEX: FFB6 ;
+: XK_KP_7 HEX: FFB7 ;
+: XK_KP_8 HEX: FFB8 ;
+: XK_KP_9 HEX: FFB9 ;
+
diff --git a/contrib/x11/lesson2.factor b/contrib/x11/lesson2.factor
new file mode 100644
index 0000000000..6b070cab38
--- /dev/null
+++ b/contrib/x11/lesson2.factor
@@ -0,0 +1,167 @@
+IN: nehe
+USING: opengl x11 xlib syntax kernel sequences alien namespaces math threads generic io prettyprint ;
+
+TUPLE: gl-window dpy screen win ctx x y width height depth ;
+SYMBOL: current-window
+
+SYMBOL: dpy
+SYMBOL: screen
+SYMBOL: root
+SYMBOL: win
+SYMBOL: ctx
+SYMBOL: title
+SYMBOL: vi
+SYMBOL: x
+SYMBOL: y
+SYMBOL: width
+SYMBOL: height
+
+: >int-array ( seq -- int-array )
+ dup length dup "int" -rot [
+ pick set-int-nth
+ ] 2each ;
+
+: attr-list ( -- c-array )
+ [
+ GLX_RGBA , GLX_DOUBLEBUFFER ,
+ GLX_RED_SIZE , 4 ,
+ GLX_GREEN_SIZE , 4 ,
+ GLX_BLUE_SIZE , 4 ,
+ GLX_DEPTH_SIZE , 16 ,
+ None ,
+ ] f make >int-array ;
+
+: resize-gl-scene ( glwin -- )
+ 0 0 rot [ gl-window-width ] keep [ gl-window-height ] keep >r glViewport
+ GL_PROJECTION glMatrixMode
+ glLoadIdentity
+ 45 r> [ gl-window-width ] keep gl-window-height / 0.1 100 gluPerspective
+ GL_MODELVIEW glMatrixMode ;
+
+: gl-init ( glwin -- )
+ GL_SMOOTH glShadeModel
+ 0 0 0 0 glClearColor
+ 1 glClearDepth
+ GL_DEPTH_TEST glEnable
+ GL_LEQUAL glDepthFunc
+ GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
+ resize-gl-scene
+ glFlush ;
+
+: normal-XSetWindowAttributes ( cmap -- valuemask attr )
+ [
+ set-XSetWindowAttributes-colormap
+ ] keep
+ ExposureMask KeyPressMask bitor ButtonPressMask bitor StructureNotifyMask bitor
+ over set-XSetWindowAttributes-event_mask
+ dup 1 swap set-XSetWindowAttributes-border_pixel
+ CWBorderPixel CWColormap bitor CWEventMask bitor swap ;
+
+: make-display ( display-num -- display )
+ XOpenDisplay dup dpy set ;
+
+: make-screen ( display -- screen )
+ XDefaultScreen dup screen set ;
+
+: make-vi ( display screen -- vi )
+ attr-list glXChooseVisual dup vi set ;
+
+: make-ctx ( display vi -- )
+ 0 GL_TRUE glXCreateContext ctx set ;
+
+: make-colormap ( -- cmap )
+ dpy get vi get 2dup XVisualInfo-screen XRootWindow dup root set
+ swap XVisualInfo-visual AllocNone XCreateColormap ;
+
+: make-win ( valuemask attr -- win )
+ >r >r dpy get root get x get y get width get height get 0 vi get
+ dup XVisualInfo-depth InputOutput rot XVisualInfo-visual r> r> XCreateWindow dup win set ;
+
+: make-gl-window ( display-num x y width height depth title -- glwin )
+ [
+ title set depth set height set width set y set x set
+ make-display dup dup make-screen make-vi make-ctx
+ make-colormap normal-XSetWindowAttributes make-win
+ dpy get swap 2dup over "WM_DELETE_WINDOW" 1 XInternAtom 1 XSetWMProtocols drop
+ 2dup title get dup None 0 0 over XSetStandardProperties drop
+ 2dup XMapRaised drop
+ 2dup ctx get glXMakeCurrent 2drop
+ screen get win get ctx get x get y get width get height get depth get
+ dup gl-init
+ dup global [ current-window set ] bind
+ ] with-scope ;
+
+: draw-gl-scene ( -- )
+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
+ glLoadIdentity
+ -1.5 0 -6 glTranslatef
+ GL_TRIANGLES [
+ 0 1 0 glVertex3f
+ -1 -1 0 glVertex3f
+ 1 -1 0 glVertex3f
+ ] do-state
+ 3 0 0 glTranslatef
+ GL_QUADS [
+ -1 1 1 glVertex3f
+ 1 1 0 glVertex3f
+ 1 -1 0 glVertex3f
+ -1 -1 0 glVertex3f
+ ] do-state
+ current-window get dup gl-window-dpy swap gl-window-win glXSwapBuffers ;
+
+: kill-gl-window ( glwin -- )
+ dup gl-window-ctx [
+ over gl-window-dpy dup None 0 glXMakeCurrent drop
+ swap glXDestroyContext
+ 0 over set-gl-window-ctx
+ ] when*
+ gl-window-dpy XCloseDisplay ;
+
+GENERIC: (handle-event) ( glwin xevent -- continue? )
+
+M: x-expose-event (handle-event)
+ nip XExposeEvent-count 0 = [ draw-gl-scene ] when t ;
+
+M: x-configure-notify-event (handle-event)
+ #! resize if the width or height has changed
+ [ XConfigureEvent-width swap gl-window-width = ] 2keep
+ [ XConfigureEvent-height swap gl-window-height = and ] 2keep rot [
+ 2drop
+ ] [
+ [ XConfigureEvent-width swap set-gl-window-width ] 2keep
+ [ XConfigureEvent-height swap set-gl-window-height ] 2keep
+ drop resize-gl-scene
+ ] if t ;
+
+M: x-button-press-event (handle-event)
+ #! quit if a mouse button is pressed
+ 2drop f ;
+
+PREDICATE: x-key-press-event quit-key-event
+ 0 XLookupKeysym dup CHAR: q = swap XK_Escape = or ;
+
+M: quit-key-event (handle-event)
+ 2drop f ;
+
+M: x-client-message-event (handle-event)
+ swap gl-window-dpy swap XClientMessageEvent-message_type XGetAtomName
+ "WM_PROTOCOLS" = not ;
+
+M: object (handle-event)
+ #! unknown event, ignore and continue
+ 2drop t ;
+
+: handle-event ( glwin xevent -- continue? )
+ over gl-window-dpy over XNextEvent drop (handle-event) ;
+
+: (loop) ( glwin xevent -- continue? )
+ over gl-window-dpy XPending 0 > [
+ 2dup handle-event [ (loop) ] [ 2drop f ] if
+ ] [ 2drop t ] if ;
+
+: loop ( glwin xevent -- )
+ 2dup (loop) [ draw-gl-scene loop ] [ 2drop ] if ;
+
+: main ( -- )
+ ":0.0" 10 10 640 480 16 "NeHe Lesson 2" make-gl-window
+ dup loop kill-gl-window ;
diff --git a/contrib/x11/load.factor b/contrib/x11/load.factor
new file mode 100644
index 0000000000..9c5307ac5c
--- /dev/null
+++ b/contrib/x11/load.factor
@@ -0,0 +1,16 @@
+IN: scratchpad
+USING: alien compiler kernel parser sequences words ;
+
+"X11" "libX11" add-simple-library
+
+{
+ "xlib"
+ "x"
+ "rectangle"
+ "draw-string"
+ "concurrent-widgets"
+ "glx"
+ "gl"
+} [ "/contrib/x11/" swap ".factor" append3 run-resource ] each
+
+! { "xlib" "x11" } [ words [ try-compile ] each ] each
diff --git a/contrib/x11/load2.factor b/contrib/x11/load2.factor
new file mode 100644
index 0000000000..e105e90bd9
--- /dev/null
+++ b/contrib/x11/load2.factor
@@ -0,0 +1,15 @@
+USING: kernel alien parser sequences words compiler ;
+
+"X11" "libX11.so" "cdecl" add-library
+
+[
+ "x-constants.factor"
+ "xlib.factor"
+ "keysymdef.factor"
+ "x-events.factor"
+ "glx.factor"
+] [ "/contrib/x11/" swap append run-resource ] each
+
+"x11" words [ try-compile ] each
+"xlib" words [ try-compile ] each
+clear
diff --git a/contrib/x11/rectangle.factor b/contrib/x11/rectangle.factor
new file mode 100644
index 0000000000..37bb89610a
--- /dev/null
+++ b/contrib/x11/rectangle.factor
@@ -0,0 +1,62 @@
+
+IN: rectangle
+USING: kernel math ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+TUPLE: rect corner size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+GENERIC: top-left
+
+GENERIC: move-top-left
+GENERIC: move-top-right
+GENERIC: move-bottom-left
+GENERIC: move-bottom-right
+
+GENERIC: move-middle-center
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+M: rect top-left ( rect -- point ) rect-corner ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-top-left:new-corner ( point rect -- corner )
+ drop ;
+
+M: rect move-top-left ( point rect -- corner )
+ tuck move-top-left:new-corner swap rect-size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-bottom-right:new-corner ( point rect -- corner )
+ rect-size { -1 -1 } v+ v- ;
+
+M: rect move-bottom-right ( point rect -- rect )
+ tuck move-bottom-right:new-corner swap rect-size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-top-right:new-corner ( point rect -- corner )
+ rect-size { -1 -1 } v+ { 1 0 } v* v- ;
+
+M: rect move-top-right ( point rect -- rect )
+ tuck move-top-right:new-corner swap rect-size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-bottom-left:new-corner ( point rect -- corner )
+ rect-size { -1 -1 } v+ { 0 1 } v* v- ;
+
+M: rect move-bottom-left ( point rect -- rect )
+ tuck move-bottom-left:new-corner swap rect-size ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: move-middle-center:new-corner ( point rect -- coener )
+ rect-size { 1/2 1/2 } v* { -1 -1 } v+ v- ;
+
+M: rect move-middle-center ( point rect -- rect )
+ tuck move-middle-center:new-corner swap rect-size ;
diff --git a/contrib/x11/x-constants.factor b/contrib/x11/x-constants.factor
new file mode 100644
index 0000000000..e110611f87
--- /dev/null
+++ b/contrib/x11/x-constants.factor
@@ -0,0 +1,419 @@
+! Based on X.h
+IN: x11
+USING: alien math ;
+
+TYPEDEF: ulong Mask
+TYPEDEF: ulong Atom
+TYPEDEF: uchar KeyCode
+
+! Reserved Resource and Constant Definitions
+: None 0 ;
+: ParentRelative 1 ;
+: CopyFromParent 0 ;
+: PointerWindow 0 ;
+: InputFocus 1 ;
+: PointerRoot 1 ;
+: AnyPropertyType 0 ;
+: AnyKey 0 ;
+: AnyButton 0 ;
+: AllTemporary 0 ;
+: CurrentTime 0 ;
+: NoSymbol 0 ;
+
+! Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
+! state in various key-, mouse-, and button-related events.
+
+: ShiftMask 1 0 shift ;
+: LockMask 1 1 shift ;
+: ControlMask 1 2 shift ;
+: Mod1Mask 1 3 shift ;
+: Mod2Mask 1 4 shift ;
+: Mod3Mask 1 5 shift ;
+: Mod4Mask 1 6 shift ;
+: Mod5Mask 1 7 shift ;
+
+! modifier names. Used to build a SetModifierMapping request or
+! to read a GetModifierMapping request. These correspond to the
+! masks defined above.
+: ShiftMapIndex 0 ;
+: LockMapIndex 1 ;
+: ControlMapIndex 2 ;
+: Mod1MapIndex 3 ;
+: Mod2MapIndex 4 ;
+: Mod3MapIndex 5 ;
+: Mod4MapIndex 6 ;
+: Mod5MapIndex 7 ;
+
+
+! button masks. Used in same manner as Key masks above. Not to be confused
+! with button names below.
+
+: Button1Mask 1 8 shift ;
+: Button2Mask 1 9 shift ;
+: Button3Mask 1 10 shift ;
+: Button4Mask 1 11 shift ;
+: Button5Mask 1 12 shift ;
+
+: AnyModifier 1 15 shift ; ! used in GrabButton, GrabKey
+
+! button names. Used as arguments to GrabButton and as detail in ButtonPress
+! and ButtonRelease events. Not to be confused with button masks above.
+! Note that 0 is already defined above as "AnyButton".
+
+: Button1 1 ;
+: Button2 2 ;
+: Button3 3 ;
+: Button4 4 ;
+: Button5 5 ;
+
+! Notify modes
+
+: NotifyNormal 0 ;
+: NotifyGrab 1 ;
+: NotifyUngrab 2 ;
+: NotifyWhileGrabbed 3 ;
+
+: NotifyHint 1 ; ! for MotionNotify events
+
+! Notify detail
+
+: NotifyAncestor 0 ;
+: NotifyVirtual 1 ;
+: NotifyInferior 2 ;
+: NotifyNonlinear 3 ;
+: NotifyNonlinearVirtual 4 ;
+: NotifyPointer 5 ;
+: NotifyPointerRoot 6 ;
+: NotifyDetailNone 7 ;
+
+! Visibility notify
+
+: VisibilityUnobscured 0 ;
+: VisibilityPartiallyObscured 1 ;
+: VisibilityFullyObscured 2 ;
+
+! Circulation request
+
+: PlaceOnTop 0 ;
+: PlaceOnBottom 1 ;
+
+! protocol families
+
+: FamilyInternet 0 ; ( IPv4 )
+: FamilyDECnet 1 ;
+: FamilyChaos 2 ;
+: FamilyInternet6 6 ; ( IPv6 )
+
+! authentication families not tied to a specific protocol
+: FamilyServerInterpreted 5 ;
+
+! Property notification
+
+: PropertyNewValue 0 ;
+: PropertyDelete 1 ;
+
+! Color Map notification
+
+: ColormapUninstalled 0 ;
+: ColormapInstalled 1 ;
+
+! GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes
+
+: GrabModeSync 0 ;
+: GrabModeAsync 1 ;
+
+! GrabPointer, GrabKeyboard reply status
+
+: GrabSuccess 0 ;
+: AlreadyGrabbed 1 ;
+: GrabInvalidTime 2 ;
+: GrabNotViewable 3 ;
+: GrabFrozen 4 ;
+
+! AllowEvents modes
+
+: AsyncPointer 0 ;
+: SyncPointer 1 ;
+: ReplayPointer 2 ;
+: AsyncKeyboard 3 ;
+: SyncKeyboard 4 ;
+: ReplayKeyboard 5 ;
+: AsyncBoth 6 ;
+: SyncBoth 7 ;
+
+! Used in SetInputFocus, GetInputFocus
+
+: RevertToNone None ;
+: RevertToPointerRoot PointerRoot ;
+: RevertToParent 2 ;
+
+! *****************************************************************
+! * ERROR CODES
+! *****************************************************************
+
+: Success 0 ; ! everything's okay
+: BadRequest 1 ; ! bad request code
+: BadValue 2 ; ! int parameter out of range
+: BadWindow 3 ; ! parameter not a Window
+: BadPixmap 4 ; ! parameter not a Pixmap
+: BadAtom 5 ; ! parameter not an Atom
+: BadCursor 6 ; ! parameter not a Cursor
+: BadFont 7 ; ! parameter not a Font
+: BadMatch 8 ; ! parameter mismatch
+: BadDrawable 9 ; ! parameter not a Pixmap or Window
+: BadAccess 10 ; ! depending on context:
+ ! - key/button already grabbed
+ ! - attempt to free an illegal
+ ! cmap entry
+ ! - attempt to store into a read-only
+ ! color map entry.
+ ! - attempt to modify the access control
+ ! list from other than the local host.
+: BadAlloc 11 ; ! insufficient resources
+: BadColor 12 ; ! no such colormap
+: BadGC 13 ; ! parameter not a GC
+: BadIDChoice 14 ; ! choice not in range or already used
+: BadName 15 ; ! font or color name doesn't exist
+: BadLength 16 ; ! Request length incorrect
+: BadImplementation 17 ; ! server is defective
+
+: FirstExtensionError 128 ;
+: LastExtensionError 255 ;
+
+! *****************************************************************
+! * WINDOW DEFINITIONS
+! *****************************************************************
+
+! Window classes used by CreateWindow
+! Note that CopyFromParent is already defined as 0 above
+
+: InputOutput 1 ;
+: InputOnly 2 ;
+
+! Used in CreateWindow for backing-store hint
+
+: NotUseful 0 ;
+: WhenMapped 1 ;
+: Always 2 ;
+
+! Used in ChangeSaveSet
+
+: SetModeInsert 0 ;
+: SetModeDelete 1 ;
+
+! Used in ChangeCloseDownMode
+
+: DestroyAll 0 ;
+: RetainPermanent 1 ;
+: RetainTemporary 2 ;
+
+! Window stacking method (in configureWindow)
+
+: Above 0 ;
+: Below 1 ;
+: TopIf 2 ;
+: BottomIf 3 ;
+: Opposite 4 ;
+
+! Circulation direction
+
+: RaiseLowest 0 ;
+: LowerHighest 1 ;
+
+! Property modes
+
+: PropModeReplace 0 ;
+: PropModePrepend 1 ;
+: PropModeAppend 2 ;
+
+! *****************************************************************
+! * GRAPHICS DEFINITIONS
+! *****************************************************************
+
+! LineStyle
+
+: LineSolid 0 ;
+: LineOnOffDash 1 ;
+: LineDoubleDash 2 ;
+
+! capStyle
+
+: CapNotLast 0 ;
+: CapButt 1 ;
+: CapRound 2 ;
+: CapProjecting 3 ;
+
+! joinStyle
+
+: JoinMiter 0 ;
+: JoinRound 1 ;
+: JoinBevel 2 ;
+
+! fillStyle
+
+: FillSolid 0 ;
+: FillTiled 1 ;
+: FillStippled 2 ;
+: FillOpaqueStippled 3 ;
+
+! fillRule
+
+: EvenOddRule 0 ;
+: WindingRule 1 ;
+
+! subwindow mode
+
+: ClipByChildren 0 ;
+: IncludeInferiors 1 ;
+
+! SetClipRectangles ordering
+
+: Unsorted 0 ;
+: YSorted 1 ;
+: YXSorted 2 ;
+: YXBanded 3 ;
+
+! CoordinateMode for drawing routines
+
+: CoordModeOrigin 0 ; ! relative to the origin
+: CoordModePrevious 1 ; ! relative to previous point
+
+! Polygon shapes
+
+: Complex 0 ; ! paths may intersect
+: Nonconvex 1 ; ! no paths intersect, but not convex
+: Convex 2 ; ! wholly convex
+
+! Arc modes for PolyFillArc
+
+: ArcChord 0 ; ! join endpoints of arc
+: ArcPieSlice 1 ; ! join endpoints to center of arc
+
+! *****************************************************************
+! * FONTS
+! *****************************************************************
+
+! used in QueryFont -- draw direction
+
+: FontLeftToRight 0 ;
+: FontRightToLeft 1 ;
+
+: FontChange 255 ;
+
+! *****************************************************************
+! * IMAGING
+! *****************************************************************
+
+! ImageFormat -- PutImage, GetImage
+
+: XYBitmap 0 ; ! depth 1, XYFormat
+: XYPixmap 1 ; ! depth == drawable depth
+: ZPixmap 2 ; ! depth == drawable depth
+
+! *****************************************************************
+! * COLOR MAP STUFF
+! *****************************************************************
+
+! For CreateColormap
+
+: AllocNone 0 ; ! create map with no entries
+: AllocAll 1 ; ! allocate entire map writeable
+
+
+! Flags used in StoreNamedColor, StoreColors
+
+: DoRed 1 0 shift ;
+: DoGreen 1 1 shift ;
+: DoBlue 1 2 shift ;
+
+! *****************************************************************
+! * CURSOR STUFF
+! *****************************************************************
+
+! QueryBestSize Class
+
+: CursorShape 0 ; ! largest size that can be displayed
+: TileShape 1 ; ! size tiled fastest
+: StippleShape 2 ; ! size stippled fastest
+
+! *****************************************************************
+! * KEYBOARD/POINTER STUFF
+! *****************************************************************
+
+: AutoRepeatModeOff 0 ;
+: AutoRepeatModeOn 1 ;
+: AutoRepeatModeDefault 2 ;
+
+: LedModeOff 0 ;
+: LedModeOn 1 ;
+
+! masks for ChangeKeyboardControl
+
+: KBKeyClickPercent 1 0 shift ;
+: KBBellPercent 1 1 shift ;
+: KBBellPitch 1 2 shift ;
+: KBBellDuration 1 3 shift ;
+: KBLed 1 4 shift ;
+: KBLedMode 1 5 shift ;
+: KBKey 1 6 shift ;
+: KBAutoRepeatMode 1 7 shift ;
+
+: MappingSuccess 0 ;
+: MappingBusy 1 ;
+: MappingFailed 2 ;
+
+: MappingModifier 0 ;
+: MappingKeyboard 1 ;
+: MappingPointer 2 ;
+
+! *****************************************************************
+! * SCREEN SAVER STUFF
+! *****************************************************************
+
+: DontPreferBlanking 0 ;
+: PreferBlanking 1 ;
+: DefaultBlanking 2 ;
+
+: DisableScreenSaver 0 ;
+: DisableScreenInterval 0 ;
+
+: DontAllowExposures 0 ;
+: AllowExposures 1 ;
+: DefaultExposures 2 ;
+
+! for ForceScreenSaver
+
+: ScreenSaverReset 0 ;
+: ScreenSaverActive 1 ;
+
+! *****************************************************************
+! * HOSTS AND CONNECTIONS
+! *****************************************************************
+
+! for ChangeHosts
+
+: HostInsert 0 ;
+: HostDelete 1 ;
+
+! for ChangeAccessControl
+
+: EnableAccess 1 ;
+: DisableAccess 0 ;
+
+! Display classes used in opening the connection
+! Note that the statically allocated ones are even numbered and the
+! dynamically changeable ones are odd numbered
+
+: StaticGray 0 ;
+: GrayScale 1 ;
+: StaticColor 2 ;
+: PseudoColor 3 ;
+: TrueColor 4 ;
+: DirectColor 5 ;
+
+
+! Byte order used in imageByteOrder and bitmapBitOrder
+
+: LSBFirst 0 ;
+: MSBFirst 1 ;
+
diff --git a/contrib/x11/x-events.factor b/contrib/x11/x-events.factor
new file mode 100644
index 0000000000..3286c79e58
--- /dev/null
+++ b/contrib/x11/x-events.factor
@@ -0,0 +1,40 @@
+IN: x11
+USING: alien kernel sequences namespaces strings syntax math generic parser ;
+
+: x-event-type
+ #! XEvent is a union of the various X*Event structs. All of them have
+ #! 'int type' as their first field.
+ 0 alien-signed-4 ;
+
+PREDICATE: integer upper
+ dup CHAR: A >= swap CHAR: Z <= and ;
+
+: uncapitalise ( "Capitalised" | "capitalised" -- "capitalised" )
+ dup first ch>lower swap >sbuf 0 swap [ set-nth ] keep >string ;
+
+GENERIC: (camel>dashed)
+M: upper (camel>dashed) ( CHAR: X -- )
+ CHAR: - , ch>lower , ;
+M: object (camel>dashed) ( CHAR: x -- ) , ;
+
+: camel>dashed ( "SomeName" -- "some-name" )
+ uncapitalise [ [ (camel>dashed) ] each ] "" make ;
+
+: x-event-predicate ( EventName -- )
+ #! creates a predicate for x-event-name-event
+ #! EventName should be a valid XEvent.type (defined in x.factor)
+ #! note: c structs are represented as byte-arrays in factor
+ [ "IN: x11 PREDICATE: byte-array x-" % dup camel>dashed % "-event x-event-type " %
+ % " = ;" % ] "" make eval ;
+
+[
+ "KeyPress" "KeyRelease" "ButtonPress" "ButtonRelease" "MotionNotify"
+ "EnterNotify" "LeaveNotify" "FocusIn" "FocusOut" "KeymapNotify"
+ "Expose" "GraphicsExpose" "NoExpose" "VisibilityNotify" "CreateNotify"
+ "DestroyNotify" "UnmapNotify" "MapNotify" "MapRequest" "ReparentNotify"
+ "ConfigureNotify" "ConfigureRequest" "GravityNotify" "ResizeRequest"
+ "CirculateNotify" "CirculateRequest" "PropertyNotify" "SelectionClear"
+ "SelectionRequest" "SelectionNotify" "ColormapNotify" "ClientMessage"
+ "MappingNotify"
+] [ x-event-predicate ] each
+
diff --git a/contrib/x11/x.factor b/contrib/x11/x.factor
index 4627883c7a..12859342db 100644
--- a/contrib/x11/x.factor
+++ b/contrib/x11/x.factor
@@ -1,5 +1,5 @@
-IN: x USING: namespaces kernel sequences xlib ;
+IN: x USING: namespaces kernel math arrays strings alien sequences xlib ;
SYMBOL: dpy
SYMBOL: scr
@@ -8,6 +8,21 @@ SYMBOL: gcontext
SYMBOL: win
SYMBOL: black-pixel
SYMBOL: white-pixel
+SYMBOL: colormap
+
+SYMBOL: font
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: ;
+: ;
+: ;
+: ;
+
+: *ulong *uint ;
+: *XID *ulong ;
+: *Window *XID ;
+: *Drawable *XID ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 3.3 - Creating Windows
@@ -20,27 +35,118 @@ SYMBOL: white-pixel
! arguments.
: create-window ( -- win )
- dpy get root get 0 0 100 100 10 black-pixel get white-pixel get
+ dpy get root get 0 0 100 100 0 black-pixel get white-pixel get
XCreateSimpleWindow ;
: destroy-window ( -- ) dpy get win get XDestroyWindow drop ;
: map-window ( -- ) dpy get win get XMapWindow drop ;
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+: map-subwindows ( -- ) dpy get win get XMapSubwindows drop ;
+
+: unmap-window ( -- ) dpy get win get XUnmapWindow drop ;
+
+: unmap-subwindows ( -- ) dpy get win get XUnmapSubwindows drop ;
+
! 3.7 - Configuring Windows
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: move-window ( { x y } -- ) >r dpy get win get r> [ ] each XMoveWindow drop ;
+DEFER: window-position
+DEFER: window-width
+DEFER: window-height
+DEFER: window-parent
+DEFER: with-win
+
+: set-window-x ( x -- ) 0 window-position dup >r set-nth r> move-window ;
+
+: set-window-y ( y -- ) 1 window-position dup >r set-nth r> move-window ;
+
+: set-window-center-x ( x -- ) window-width 2 / - set-window-x ;
+
+: center-window-horizontally
+ window-parent [ window-width ] with-win
+ 2 / set-window-center-x ;
+
: resize-window ( { width height } -- )
>r dpy get win get r> [ ] each XResizeWindow drop ;
+: set-window-width ( width -- )
+ window-height 2array resize-window ;
+
+: set-window-height ( height -- )
+ window-width swap 2array resize-window ;
+
+: set-window-border-width ( width -- )
+ >r dpy get win get r> XSetWindowBorderWidth drop ;
+
! 3.8 Changing Window Stacking Order
: raise-window ( -- ) dpy get win get XRaiseWindow drop ;
: lower-window ( -- ) dpy get win get XLowerWindow drop ;
+! 3.9 - Changing Window Attributes
+
+: set-window-background ( pixel -- )
+ >r dpy get win get r> XSetWindowBackground drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 4 - Window Information Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 4.1 - Obtaining Window Information
+
+: window-children ( -- [ child child ... child ] )
+ dpy get win get 0 0
+ 0 0 2dup >r >r
+ XQueryTree drop
+ r> r> ! children-return nchildren-return
+ swap *void* swap *uint ! children nchildren
+ [ over uint-nth ] map
+ swap drop ;
+
+: window-parent ( -- parent )
+ dpy get win get 0 0 dup >r 0 0
+ XQueryTree drop
+ r> *Window ;
+
+: window-size ( -- { width height } )
+ dpy get win get 0 0 0
+ 0 0 2dup 2array >r
+ 0 0
+ XGetGeometry drop r> [ *uint ] map ;
+
+: window-width 0 window-size nth ;
+
+: window-height 1 window-size nth ;
+
+: window-position ( -- { x y } )
+ dpy get win get 0
+ 0 0 2dup 2array >r
+ 0 0 0 0
+ XGetGeometry drop r> [ *int ] map ;
+
+: window-x 0 window-position nth ;
+: window-y 1 window-position nth ;
+
+: get-window-attributes ( -- )
+ dpy get win get "XWindowAttributes" dup >r XGetWindowAttributes drop r> ;
+
+: window-map-state
+ get-window-attributes XWindowAttributes-map_state ;
+
+: window-override-redirect
+ get-window-attributes XWindowAttributes-override_redirect ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 6 - Color Management Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: lookup-color ( name -- pixel )
+ >r dpy get colormap get r> "XColor" dup >r "XColor" XLookupColor drop
+ dpy get colormap get r> dup >r XAllocColor drop
+ r> XColor-pixel ;
+
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 8 - Graphics Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -53,6 +159,17 @@ SYMBOL: white-pixel
: draw-line ( { x1 y1 } { x2 y2 } -- )
>r >r dpy get win get gcontext get r> [ ] each r> [ ] each XDrawLine drop ;
+! 8.5 - Font Metrics
+
+: load-query-font ( name -- ) dpy get swap XLoadQueryFont ;
+
+! : text-width ( string -- width ) dup length XTextWidth ;
+
+! : text-width ( string -- width ) font get swap dup length XTextWidth ;
+
+: font-height ( -- height )
+ dup XFontStruct-ascent swap XFontStruct-descent + ;
+
! 8.6 - Drawing Text
: draw-string ( { x y } string -- )
@@ -62,7 +179,13 @@ SYMBOL: white-pixel
! 9 - Window and Session Manager Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-: reparent-window ( parent -- ) >r dpy get win get r> 0 0 XReparentWindow ;
+: reparent-window ( parent -- ) >r dpy get win get r> 0 0 XReparentWindow drop ;
+
+: add-to-save-set ( -- ) dpy get win get XAddToSaveSet drop ;
+
+: grab-server ( -- ) dpy get XGrabServer drop ;
+
+: ungrab-server ( -- ) dpy get XUngrabServer drop ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 11 - Event Handling Functions
@@ -72,12 +195,61 @@ SYMBOL: white-pixel
: flush-dpy ( -- ) dpy get XFlush drop ;
-: next-event ( -- event ) dpy get dup XNextEvent drop ;
+: sync-dpy ( discard -- ) >r dpy get r> XSync ;
+
+: next-event ( -- event ) dpy get "XEvent" dup >r XNextEvent drop r> ;
+
+: mask-event ( mask -- event )
+ >r dpy get r> "XEvent" dup >r XMaskEvent drop r> ;
+
+: events-queued ( mode -- n ) >r dpy get r> XEventsQueued ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 12 - Input Device Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: set-input-focus ( revert-to time -- )
+ >r >r dpy get win get r> r> XSetInputFocus drop ;
+
+: grab-pointer ( mask -- )
+ >r dpy get win get False r> GrabModeAsync GrabModeAsync None None CurrentTime
+ XGrabPointer drop ;
+
+: ungrab-pointer ( time -- )
+ >r dpy get r> XUngrabPointer drop ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 14 - Inter-Client Communication Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: fetch-name ( -- name-or-f )
+ dpy get win get 0 dup >r XFetchName drop r>
+ dup *void* alien-address 0 = [ drop f ] [ *char* ] if ;
+
+: get-transient-for-hint ( -- win-or-f )
+ dpy get win get 0 dup >r XGetTransientForHint r>
+ swap 0 = [ drop f ] [ *Window ] if ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Not Categorized Yet
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+: window-width+ [ window-width ] with-win ;
+: window-height+ [ window-height ] with-win ;
+: move-window+ [ move-window ] with-win ;
+: resize-window+ [ resize-window ] with-win ;
+: set-window-y+ [ set-window-y ] with-win ;
+: set-window-width+ [ set-window-width ] with-win ;
+: set-window-height+ [ set-window-height ] with-win ;
+: center-window-horizontally+ [ center-window-horizontally ] with-win ;
+: window-children+ [ window-children ] with-win ;
+: window-map-state+ [ window-map-state ] with-win ;
+: destroy-window+ [ destroy-window ] with-win ;
+: map-window+ [ map-window ] with-win ;
+: unmap-window+ [ unmap-window ] with-win ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
: with-dpy ( dpy quot -- ) [ swap dpy set call ] with-scope ; inline
: with-win ( win quot -- ) [ swap win set call ] with-scope ; inline
@@ -87,4 +259,87 @@ SYMBOL: white-pixel
dpy get scr get XRootWindow root set
dpy get scr get XBlackPixel black-pixel set
dpy get scr get XWhitePixel white-pixel set
- dpy get scr get XDefaultGC gcontext set ;
\ No newline at end of file
+ dpy get scr get XDefaultGC gcontext set
+ dpy get scr get XDefaultColormap colormap set
+ "6x13" load-query-font font set
+ dpy get gcontext get font get XFontStruct-fid XSetFont drop ;
+
+: stack-children ( -- )
+ window-children
+ [ [ { 0 0 } move-window ] with-win ]
+ each ;
+
+: arrange-children-horizontally ( -- )
+ 0
+ window-children
+ [ [ dup set-window-x window-width + ] with-win ]
+ each ;
+
+: arrange-children-vertically ( -- )
+ 0
+ window-children
+ [ [ dup set-window-y window-height + ] with-win ]
+ each ;
+
+: vertical-layout ( space -- )
+ dup ! space y
+ window-children
+ ! space y child
+ [ 2dup ! space y child y child
+ set-window-y+ ! space y child
+ window-height+ ! space y height
+ + ! space new-y
+ dupd ! space space new-y
+ + ] ! space new-y
+ each
+ drop drop ;
+
+: valid-window? ( -- ? )
+ dpy get win get "XWindowAttributes" XGetWindowAttributes 0 = not ;
+
+: mouse-sensor ( -- { root-x root-y } )
+ dpy get win get 0 0 0 0 2dup >r >r
+ 0 0 0 XQueryPointer drop r> *int r> *int 2array ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Windows and their children
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: seq-max ( v -- item ) dup 0 swap nth [ max ] reduce ;
+
+: seq-last ( v -- item ) dup length 1 - swap nth ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: widest-child-width ( window -- width )
+ window-children+ [ window-width+ ] map seq-max ;
+
+: tallest-child-height ( window -- height )
+ window-children+ [ window-height+ ] map seq-max ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: compare-window-width ( w w -- -1/0/1 )
+ window-width+ swap window-width+ swap < ;
+
+: sort-by-width ( window-seq -- seq ) [ compare-window-width ] sort ;
+
+: widest-child ( window -- child ) window-children+ sort-by-width seq-last ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: compare-window-height ( w w -- -1/0/1 )
+ window-height+ swap window-height+ swap < ;
+
+: sort-by-height ( window-seq -- seq ) [ compare-window-height ] sort ;
+
+: tallest-child ( window -- child ) window-children+ sort-by-height seq-last ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: char-array>string ( n -- string )
+swap >array [ swap char-nth ] map-with >string ;
+
+: lookup-string ( event -- string )
+10 "char" dup >r 10 0 0 XLookupString r>
+char-array>string ;
diff --git a/contrib/x11/x11-wrunt/xlib.factor b/contrib/x11/x11-wrunt/xlib.factor
new file mode 100644
index 0000000000..6fbeb890d3
--- /dev/null
+++ b/contrib/x11/x11-wrunt/xlib.factor
@@ -0,0 +1,540 @@
+! based on Xlib.h from x.org, incomplete
+IN: x11
+USING: alien ;
+
+LIBRARY: X11
+
+TYPEDEF: char* XPointer
+TYPEDEF: void* Display*
+TYPEDEF: void* XExtData*
+TYPEDEF: int Status
+TYPEDEF: void* GC
+
+BEGIN-STRUCT: XSetWindowAttributes
+ FIELD: Pixmap background_pixmap
+ FIELD: ulong background_pixel
+ FIELD: Pixmap border_pixmap
+ FIELD: ulong border_pixel
+ FIELD: int bit_gravity
+ FIELD: int win_gravity
+ FIELD: int backing_store
+ FIELD: ulong backing_planes
+ FIELD: ulong backing_pixel
+ FIELD: bool save_under
+ FIELD: long event_mask
+ FIELD: long do_not_propagate_mask
+ FIELD: bool override_redirect
+ FIELD: Colormap colormap
+ FIELD: Cursor cursor
+END-STRUCT
+
+BEGIN-STRUCT: XColor
+ FIELD: ulong pixel
+ FIELD: ushort red
+ FIELD: ushort green
+ FIELD: ushort blue
+ FIELD: char flags ! do_red, do_green, do_blue
+ FIELD: char pad
+END-STRUCT
+
+BEGIN-STRUCT: XKeyEvent
+ FIELD: int type ! of event
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! "event" window it is reported relative to
+ FIELD: Window root ! root window that the event occurred on
+ FIELD: Window subwindow ! child window
+ FIELD: Time time ! milliseconds
+ FIELD: int x ! pointer x, y coordinates in event window
+ FIELD: int y
+ FIELD: int x_root ! coordinates relative to root
+ FIELD: int y_root
+ FIELD: uint state ! key or button mask
+ FIELD: uint keycode ! detail
+ FIELD: bool same_screen ! same screen flag
+END-STRUCT
+
+TYPEDEF: XKeyEvent XKeyPressedEvent
+TYPEDEF: XKeyEvent XKeyReleasedEvent
+
+BEGIN-STRUCT: XButtonEvent
+ FIELD: int type ! of event
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! "event" window it is reported relative to
+ FIELD: Window root ! root window that the event occurred on
+ FIELD: Window subwindow ! child window
+ FIELD: Time time ! milliseconds
+ FIELD: int x ! pointer x, y coordinates in event window
+ FIELD: int y
+ FIELD: int x_root ! coordinates relative to root
+ FIELD: int y_root
+ FIELD: uint state ! key or button mask
+ FIELD: uint button ! detail
+ FIELD: bool same_screen ! same screen flag
+END-STRUCT
+
+TYPEDEF: XButtonEvent XButtonPressedEvent
+TYPEDEF: XButtonEvent XButtonReleasedEvent
+
+BEGIN-STRUCT: XMotionEvent
+ FIELD: int type ! of event
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! "event" window reported relative to
+ FIELD: Window root ! root window that the event occurred on
+ FIELD: Window subwindow ! child window
+ FIELD: Time time ! milliseconds
+ FIELD: int x ! pointer x, y coordinates in event window
+ FIELD: int y
+ FIELD: int x_root ! coordinates relative to root
+ FIELD: int y_root
+ FIELD: uint state ! key or button mask
+ FIELD: char is_hint ! detail
+ FIELD: bool same_screen ! same screen flag
+END-STRUCT
+
+TYPEDEF: XMotionEvent XPointerMovedEvent
+
+BEGIN-STRUCT: XCrossingEvent
+ FIELD: int type ! of event
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! "event" window reported relative to
+ FIELD: Window root ! root window that the event occurred on
+ FIELD: Window subwindow ! child window
+ FIELD: Time time ! milliseconds
+ FIELD: int x ! pointer x, y coordinates in event window
+ FIELD: int y
+ FIELD: int x_root ! coordinates relative to root
+ FIELD: int y_root
+ FIELD: int mode ! NotifyNormal, NotifyGrab, NotifyUngrab
+ FIELD: int detail
+ ! NotifyAncestor, NotifyVirtual, NotifyInferior,
+ ! NotifyNonlinear,NotifyNonlinearVirtual
+ FIELD: bool same_screen ! same screen flag
+ FIELD: bool focus ! boolean focus
+ FIELD: uint state ! key or button mask
+END-STRUCT
+
+TYPEDEF: XCrossingEvent XEnterWindowEvent
+TYPEDEF: XCrossingEvent XLeaveWindowEvent
+
+BEGIN-STRUCT: XFocusChangeEvent
+ FIELD: int type ! FocusIn or FocusOut
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! window of event
+ FIELD: int mode ! NotifyNormal, NotifyGrab, NotifyUngrab
+ FIELD: int detail
+ ! NotifyAncestor, NotifyVirtual, NotifyInferior,
+ ! NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
+ ! NotifyPointerRoot, NotifyDetailNone
+END-STRUCT
+
+TYPEDEF: XFocusChangeEvent XFocusInEvent
+TYPEDEF: XFocusChangeEvent XFocusOutEvent
+
+! generated on EnterWindow and FocusIn when KeyMapState selected
+BEGIN-STRUCT: XKeymapEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ ! char key_vector[32];
+ FIELD: int pad ( TODO: get rid of this padding )
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+END-STRUCT
+
+BEGIN-STRUCT: XExposeEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server */
+ FIELD: bool send_event ! true if this came from a SendEvent request */
+ FIELD: Display* display ! Display the event was read from */
+ FIELD: Window window
+ FIELD: int x
+ FIELD: int y
+ FIELD: int width
+ FIELD: int height
+ FIELD: int count ! if non-zero, at least this many more */
+END-STRUCT
+
+BEGIN-STRUCT: XGraphicsExposeEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Drawable drawable
+ FIELD: int x
+ FIELD: int y
+ FIELD: int width
+ FIELD: int height
+ FIELD: int count ! if non-zero, at least this many more
+ FIELD: int major_code ! core is CopyArea or CopyPlane
+ FIELD: int minor_code ! not defined in the core
+END-STRUCT
+
+BEGIN-STRUCT: XNoExposeEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Drawable drawable
+ FIELD: int major_code ! core is CopyArea or CopyPlane
+ FIELD: int minor_code ! not defined in the core
+END-STRUCT
+
+BEGIN-STRUCT: XVisibilityEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: int state ! Visibility state
+END-STRUCT
+
+BEGIN-STRUCT: XCreateWindowEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window parent ! parent of the window
+ FIELD: Window window ! window id of window created
+ FIELD: int x ! window location
+ FIELD: int y
+ FIELD: int width ! size of window
+ FIELD: int height
+ FIELD: int border_width ! border width
+ FIELD: bool override_redirect ! creation should be overridden
+END-STRUCT
+
+BEGIN-STRUCT: XDestroyWindowEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+END-STRUCT
+
+BEGIN-STRUCT: XUnmapEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: bool from_configure
+END-STRUCT
+
+BEGIN-STRUCT: XMapEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: bool override_redirect ! boolean, is override set...
+END-STRUCT
+
+BEGIN-STRUCT: XMapRequestEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window parent
+ FIELD: Window window
+END-STRUCT
+
+BEGIN-STRUCT: XReparentEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: Window parent
+ FIELD: int x
+ FIELD: int y
+ FIELD: bool override_redirect
+END-STRUCT
+
+BEGIN-STRUCT: XConfigureEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: int x
+ FIELD: int y
+ FIELD: int width
+ FIELD: int height
+ FIELD: int border_width
+ FIELD: Window above
+ FIELD: bool override_redirect
+END-STRUCT
+
+BEGIN-STRUCT: XGravityEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: int x
+ FIELD: int y
+END-STRUCT
+
+BEGIN-STRUCT: XResizeRequestEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: int width
+ FIELD: int height
+END-STRUCT
+
+BEGIN-STRUCT: XConfigureRequestEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window parent
+ FIELD: Window window
+ FIELD: int x
+ FIELD: int y
+ FIELD: int width
+ FIELD: int height
+ FIELD: int border_width
+ FIELD: Window above
+ FIELD: int detail ! Above, Below, TopIf, BottomIf, Opposite
+ FIELD: ulong value_mask
+END-STRUCT
+
+BEGIN-STRUCT: XCirculateEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window event
+ FIELD: Window window
+ FIELD: int place ! PlaceOnTop, PlaceOnBottom
+END-STRUCT
+
+BEGIN-STRUCT: XCirculateRequestEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window parent
+ FIELD: Window window
+ FIELD: int place ! PlaceOnTop, PlaceOnBottom
+END-STRUCT
+
+BEGIN-STRUCT: XPropertyEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: Atom atom
+ FIELD: Time time
+ FIELD: int state ! NewValue, Deleted
+END-STRUCT
+
+BEGIN-STRUCT: XSelectionClearEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: Atom selection
+ FIELD: Time time
+END-STRUCT
+
+BEGIN-STRUCT: XSelectionRequestEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window owner
+ FIELD: Window requestor
+ FIELD: Atom selection
+ FIELD: Atom target
+ FIELD: Atom property
+ FIELD: Time time
+END-STRUCT
+
+BEGIN-STRUCT: XSelectionEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window requestor
+ FIELD: Atom selection
+ FIELD: Atom target
+ FIELD: Atom property ! ATOM or None
+ FIELD: Time time
+END-STRUCT
+
+BEGIN-STRUCT: XColormapEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: Colormap colormap ! COLORMAP or None
+! #if defined(__cplusplus) || defined(c_plusplus)
+! Bool c_new; /* C++ */
+! #else
+ FIELD: bool new
+! #endif
+ FIELD: int state ! ColormapInstalled, ColormapUninstalled
+END-STRUCT
+
+BEGIN-STRUCT: XClientMessageEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window
+ FIELD: Atom message_type
+ FIELD: int format
+ ! union { char b[20]; short s[10]; long l[5]; } data;
+ FIELD: int pad ! TODO
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+ FIELD: int pad
+END-STRUCT
+
+BEGIN-STRUCT: XMappingEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! unused
+ FIELD: int request ! one of MappingModifier, MappingKeyboard, MappingPointer
+ FIELD: int first_keycode ! first keycode
+ FIELD: int count ! defines range of change w. first_keycod
+END-STRUCT
+
+BEGIN-STRUCT: XErrorEvent
+ FIELD: int type
+ FIELD: Display* display ! Display the event was read from
+ FIELD: XID resourceid ! resource id
+ FIELD: ulong serial ! serial number of failed request
+ FIELD: uchar error_code ! error code of failed request
+ FIELD: uchar request_code ! Major op-code of failed request
+ FIELD: uchar minor_code ! Minor op-code of failed request
+END-STRUCT
+
+BEGIN-STRUCT: XAnyEvent
+ FIELD: int type
+ FIELD: ulong serial ! # of last request processed by server
+ FIELD: bool send_event ! true if this came from a SendEvent request
+ FIELD: Display* display ! Display the event was read from
+ FIELD: Window window ! window on which event was requested in event mask
+END-STRUCT
+
+! this union is defined so Xlib can always use the same sized
+! event structure internally, to avoid memory fragmentation.
+BEGIN-UNION: XEvent
+ MEMBER: int
+ MEMBER: XAnyEvent
+ MEMBER: XKeyEvent
+ MEMBER: XButtonEvent
+ MEMBER: XMotionEvent
+ MEMBER: XCrossingEvent
+ MEMBER: XFocusChangeEvent
+ MEMBER: XExposeEvent
+ MEMBER: XGraphicsExposeEvent
+ MEMBER: XNoExposeEvent
+ MEMBER: XVisibilityEvent
+ MEMBER: XCreateWindowEvent
+ MEMBER: XDestroyWindowEvent
+ MEMBER: XUnmapEvent
+ MEMBER: XMapEvent
+ MEMBER: XMapRequestEvent
+ MEMBER: XReparentEvent
+ MEMBER: XConfigureEvent
+ MEMBER: XGravityEvent
+ MEMBER: XResizeRequestEvent
+ MEMBER: XConfigureRequestEvent
+ MEMBER: XCirculateEvent
+ MEMBER: XCirculateRequestEvent
+ MEMBER: XPropertyEvent
+ MEMBER: XSelectionClearEvent
+ MEMBER: XSelectionRequestEvent
+ MEMBER: XSelectionEvent
+ MEMBER: XColormapEvent
+ MEMBER: XClientMessageEvent
+ MEMBER: XMappingEvent
+ MEMBER: XErrorEvent
+ MEMBER: XKeymapEvent
+! long pad[24]
+ MEMBER: long ! TODO: fixme
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+ MEMBER: long
+END-UNION
+
+BEGIN-STRUCT: Visual
+ FIELD: XExtData* ext_data ! hook for extension to hang data
+ FIELD: VisualID visualid ! visual id of this visual
+! #if defined(__cplusplus) || defined(c_plusplus)
+! int c_class; /* C++ class of screen (monochrome, etc.)
+! #else
+ FIELD: int class ! class of screen (monochrome, etc.)
+! #endif
+ FIELD: ulong red_mask ! mask values
+ FIELD: ulong green_mask
+ FIELD: ulong blue_mask
+ FIELD: int bits_per_rgb ! log base 2 of distinct color values
+ FIELD: int map_entries ! color map entries
+END-STRUCT
+
+FUNCTION: int XCloseDisplay ( Display* display ) ;
+FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
+FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
+FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, bool only_if_exists ) ;
+FUNCTION: int XMapRaised ( Display* display, Window w ) ;
+FUNCTION: Status XGetGeometry ( Display* display, Drawable d, Window* root_return, int* x_return, int* y_return, uint* width_return, uint* height_return, uint* border_width_return, uint* depth_return ) ;
+FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
+FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
+FUNCTION: Status XSetWMProtocols ( Display* display, Window w, Atom* protocols, int count ) ;
+
diff --git a/contrib/x11/xlib.factor b/contrib/x11/xlib.factor
index 4b70d2b678..aaaa659407 100644
--- a/contrib/x11/xlib.factor
+++ b/contrib/x11/xlib.factor
@@ -9,12 +9,9 @@
! and are wondering what part of the file to modify, just find the
! function or data structure in the manual and note the section.
-IN: xlib
-USE: alien
-USE: math
-LIBRARY: xlib
+IN: xlib USING: kernel arrays alien math words sequences ;
-! "X11" "libX11.so" "cdecl" add-library
+LIBRARY: xlib
"xlib" "libX11.so" "cdecl" add-library
@@ -30,19 +27,27 @@ TYPEDEF: XID KeySym
TYPEDEF: ulong Atom
+TYPEDEF: char* XPointer
TYPEDEF: void* Display*
TYPEDEF: void* Screen*
TYPEDEF: void* GC
TYPEDEF: void* Visual*
TYPEDEF: void* XExtData*
TYPEDEF: void* XFontProp*
+TYPEDEF: void* XComposeStatus*
TYPEDEF: int Status
TYPEDEF: int Bool
+TYPEDEF: ulong VisualID
TYPEDEF: ulong Time
+TYPEDEF: void* Window**
+
+: False 0 ;
+: True 1 ;
+
!
! 2 - Display Functions
!
@@ -65,6 +70,9 @@ FUNCTION: int XQLength ( Display* display ) ;
FUNCTION: int XScreenCount ( Display* display ) ;
FUNCTION: int XConnectionNumber ( Display* display ) ;
+! 2.5 Closing the Display
+FUNCTION: int XCloseDisplay ( Display* display ) ;
+
!
! 3 - Window Functions
!
@@ -121,6 +129,7 @@ END-STRUCT
! 3.3 - Creating Windows
+FUNCTION: Window XCreateWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, int depth, uint class, Visual* visual, ulong valuemask, XSetWindowAttributes* attributes ) ;
FUNCTION: Window XCreateSimpleWindow ( Display* display, Window parent, int x, int y, uint width, uint height, uint border_width, ulong border, ulong background ) ;
FUNCTION: Status XDestroyWindow ( Display* display, Window w ) ;
FUNCTION: Status XMapWindow ( Display* display, Window window ) ;
@@ -128,6 +137,10 @@ FUNCTION: Status XMapSubwindows ( Display* display, Window window ) ;
FUNCTION: Status XUnmapWindow ( Display* display, Window w ) ;
FUNCTION: Status XUnmapSubwindows ( Display* display, Window w ) ;
+! 3.5 Mapping Windows
+
+FUNCTION: int XMapRaised ( Display* display, Window w ) ;
+
! 3.7 - Configuring Windows
: CWX 1 0 shift ;
@@ -170,7 +183,14 @@ FUNCTION: Status XUndefineCursor ( Display* display, Window w ) ;
! 4 - Window Information Functions
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-FUNCTION: Status XQueryTree ( Display* display, Window w, Window* root_return, Window* parent_return, Window** children_return, uint* nchildren_return ) ;
+! 4.1 - Obtaining Window Information
+
+FUNCTION: Status XQueryTree (
+ Display* display,
+ Window w,
+ Window* root_return,
+ Window* parent_return,
+ Window** children_return, uint* nchildren_return ) ;
BEGIN-STRUCT: XWindowAttributes
FIELD: int x
@@ -204,7 +224,32 @@ FUNCTION: Status XGetWindowAttributes ( Display* display, Window w, XWindowAttri
: IsUnviewable 1 ;
: IsViewable 2 ;
-FUNCTION: boolean XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
+FUNCTION: Status XGetGeometry (
+ Display* display,
+ Drawable d,
+ Window* root_return,
+ int* x_return,
+ int* y_return,
+ uint* width_return,
+ uint* height_return,
+ uint* border_width_return,
+ uint* depth_return ) ;
+
+! 4.2 - Translating Screen Coordinates
+
+FUNCTION: Bool XQueryPointer ( Display* display, Window w, Window* root_return, Window* child_return, int* root_x_return, int* root_y_return, int* win_x_return, int* win_y_return, uint* mask_return ) ;
+
+! 4.3 - Properties and Atoms
+
+FUNCTION: Atom XInternAtom ( Display* display, char* atom_name, Bool only_if_exists ) ;
+
+FUNCTION: char* XGetAtomName ( Display* display, Atom atom ) ;
+
+! 4.4 - Obtaining and Changing Window Properties
+
+FUNCTION: int XGetWindowProperty ( Display* display, Window w, Atom property, long long_offset, long long_length, Bool delete, Atom req_type, Atom* actual_type_return, int* actual_format_return, ulong* nitems_return, ulong* bytes_after_return, char** prop_return ) ;
+
+FUNCTION: int XChangeProperty ( Display* display, Window w, Atom property, Atom type, int format, int mode, char* data, int nelements ) ;
! 4.5 Selections
@@ -214,9 +259,9 @@ FUNCTION: Window XGetSelectionOwner ( Display* display, Atom selection ) ;
FUNCTION: int XConvertSelection ( Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time ) ;
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 6 - Color Management Functions
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
BEGIN-STRUCT: XColor
FIELD: ulong pixel
@@ -231,9 +276,13 @@ FUNCTION: Status XLookupColor ( Display* display, Colormap colormap, char* color
FUNCTION: Status XAllocColor ( Display* display, Colormap colormap, XColor* screen_in_out ) ;
FUNCTION: Status XQueryColor ( Display* display, Colormap colormap, XColor* def_in_out ) ;
-!
+! 6.4 Creating, Copying, and Destroying Colormaps
+
+FUNCTION: Colormap XCreateColormap ( Display* display, Window w, Visual* visual, int alloc ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 7 - Graphics Context Functions
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: GCFunction 1 0 shift ;
: GCPlaneMask 1 1 shift ;
@@ -315,9 +364,9 @@ FUNCTION: Status XSetSubwindowMode ( Display* display, GC gc, int subwindow_mode
FUNCTION: Status XSetFont ( Display* display, GC gc, Font font ) ;
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 8 - Graphics Functions
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: Status XClearWindow ( Display* display, Window w ) ;
FUNCTION: Status XDrawPoint ( Display* display, Drawable d, GC gc, int x, int y ) ;
@@ -325,7 +374,6 @@ FUNCTION: Status XDrawLine ( Display* display, Drawable d, GC gc, int x1, int y1
FUNCTION: Status XDrawArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
FUNCTION: Status XFillArc ( Display* display, Drawable d, GC gc, int x, int y, uint width, uint height, int angle1, int angle2 ) ;
-
! 8.5 - Font Metrics
BEGIN-STRUCT: XCharStruct
@@ -338,6 +386,7 @@ BEGIN-STRUCT: XCharStruct
END-STRUCT
FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
+FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
BEGIN-STRUCT: XFontStruct
@@ -363,7 +412,14 @@ FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
! 8.6 - Drawing Text
-FUNCTION: Status XDrawString ( Display* display, Drawable d, GC gc, int x, int y, char* string, int length ) ;
+FUNCTION: Status XDrawString (
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ char* string,
+ int length ) ;
!
! 9 - Window and Session Manager Functions
@@ -456,6 +512,12 @@ END-STRUCT
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+: Button1 1 ;
+: Button2 2 ;
+: Button3 3 ;
+: Button4 4 ;
+: Button5 5 ;
+
BEGIN-STRUCT: XButtonEvent
FIELD: int type
FIELD: ulong serial
@@ -477,6 +539,13 @@ END-STRUCT
TYPEDEF: XButtonEvent XButtonPressedEvent
TYPEDEF: XButtonEvent XButtonReleasedEvent
+: XButtonEvent-position ( event -- { x y } )
+ dup XButtonEvent-x swap XButtonEvent-y 2array ;
+
+: XButtonEvent-root-position ( event -- { x y } )
+ dup XButtonEvent-x swap XButtonEvent-y 2array ;
+
+
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
BEGIN-STRUCT: XKeyEvent
@@ -973,9 +1042,9 @@ BEGIN-UNION: XEvent
! long pad[24];
END-UNION
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 11 - Event Handling Functions
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION: Status XSelectInput ( Display* display, Window w, long event_mask ) ;
FUNCTION: Status XFlush ( Display* display ) ;
@@ -984,25 +1053,231 @@ FUNCTION: int XPending ( Display* display ) ;
FUNCTION: Status XNextEvent ( Display* display, XEvent* event ) ;
FUNCTION: Status XMaskEvent ( Display* display, long event_mask, XEvent* event_return ) ;
-!
-! 12 - Input Device Functions
-!
+! 11.3 - Event Queue Management
+
+: QueuedAlready 0 ;
+: QueuedAfterReading 1 ;
+: QueuedAfterFlush 2 ;
+
+FUNCTION: int XEventsQueued ( Display* display, int mode ) ;
+FUNCTION: int XPending ( Display* display ) ;
+
+! 11.6 - Sending Events to Other Applications
+
+FUNCTION: Status XSendEvent ( Display* display, Window w, Bool propagate, long event_mask, XEvent* event_send ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 12 - Input Device Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: None 0 ;
+: PointerRoot 1 ;
+
+: RevertToNone None ;
+: RevertToPointerRoot PointerRoot ;
+: RevertToParent 2 ;
+
+: GrabModeSync 0 ;
+: GrabModeAsync 1 ;
+
+
+FUNCTION: int XGrabPointer (
+ Display* display,
+ Window grab_window,
+ Bool owner_events,
+ uint event_mask,
+ int pointer_mode,
+ int keyboard_mode,
+ Window confine_to,
+ Cursor cursor,
+ Time time ) ;
-FUNCTION: int XGrabPointer ( Display* display, Window grab_window, Bool owner_events, uint event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time ) ;
FUNCTION: Status XUngrabPointer ( Display* display, Time time ) ;
FUNCTION: Status XChangeActivePointerGrab ( Display* display, uint event_mask, Cursor cursor, Time time ) ;
FUNCTION: Status XGrabKey ( Display* display, int keycode, uint modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode ) ;
FUNCTION: Status XSetInputFocus ( Display* display, Window focus, int revert_to, Time time ) ;
FUNCTION: Status XWarpPointer ( Display* display, Window src_w, Window dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y ) ;
-!
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 14 - Inter-Client Communication Functions
-!
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 14.1 Client to Window Manager Communication
+
+FUNCTION: Status XSetWMProtocols ( Display* display, Window w, Atom* protocols, int count ) ;
FUNCTION: Status XFetchName ( Display* display, Window w, char** window_name_return ) ;
FUNCTION: Status XGetTransientForHint ( Display* display, Window w, Window* prop_window_return ) ;
-!
-! 16 - Application Utility Functions
-!
+! 14.1.6 - Setting and Reading the WM_HINTS Property
-FUNCTION: int XLookupString ( XKeyEvent* event_struct, char* buffer_return, int bytes_buffer, KeySym* keysym_return, XComposeStatus* status_in_out ) ;
+! 17.1.7 - Setting and Reading the WM_NORMAL_HINTS Property
+
+: USPosition 1 0 shift ;
+: USSize 1 1 shift ;
+: PPosition 1 2 shift ;
+: PSize 1 3 shift ;
+: PMinSize 1 4 shift ;
+: PMaxSize 1 5 shift ;
+: PResizeInc 1 6 shift ;
+: PAspect 1 7 shift ;
+: PBaseSize 1 8 shift ;
+: PWinGravity 1 9 shift ;
+: PAllHints [ PPosition PSize PMinSize PMaxSize PResizeInc PAspect ]
+0 [ execute bitor ] reduce ;
+
+BEGIN-STRUCT: XSizeHints
+ FIELD: long flags
+ FIELD: int x
+ FIELD: int y
+ FIELD: int width
+ FIELD: int height
+ FIELD: int min_width
+ FIELD: int min_height
+ FIELD: int max_width
+ FIELD: int max_height
+ FIELD: int width_inc
+ FIELD: int height_inc
+ FIELD: int min_aspect_x
+ FIELD: int min_aspect_y
+ FIELD: int max_aspect_x
+ FIELD: int max_aspect_y
+ FIELD: int base_width
+ FIELD: int base_height
+ FIELD: int win_gravity;
+END-STRUCT
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! 16 - Application Utility Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+! 16.1 Keyboard Utility Functions
+
+FUNCTION: KeySym XLookupKeysym ( XKeyEvent* key_event, int index ) ;
+
+FUNCTION: int XLookupString (
+ XKeyEvent* event_struct,
+ char* buffer_return,
+ int bytes_buffer,
+ KeySym* keysym_return,
+ XComposeStatus* status_in_out ) ;
+
+! 16.7 Determining the Appropriate Visual Type
+
+: VisualNoMask HEX: 0 ;
+: VisualIDMask HEX: 1 ;
+: VisualScreenMask HEX: 2 ;
+: VisualDepthMask HEX: 4 ;
+: VisualClassMask HEX: 8 ;
+: VisualRedMaskMask HEX: 10 ;
+: VisualGreenMaskMask HEX: 20 ;
+: VisualBlueMaskMask HEX: 40 ;
+: VisualColormapSizeMask HEX: 80 ;
+: VisualBitsPerRGBMask HEX: 100 ;
+: VisualAllMask HEX: 1FF ;
+
+BEGIN-STRUCT: XVisualInfo
+ FIELD: Visual* visual
+ FIELD: VisualID visualid
+ FIELD: int screen
+ FIELD: uint depth
+ FIELD: int class
+ FIELD: ulong red_mask
+ FIELD: ulong green_mask
+ FIELD: ulong blue_mask
+ FIELD: int colormap_size
+ FIELD: int bits_per_rgb
+END-STRUCT
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Appendix D - Compatibility Functions
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+FUNCTION: Status XSetStandardProperties (
+ Display* display,
+ Window w,
+ char* window_name,
+ char* icon_name,
+ Pixmap icon_pixmap,
+ char** argv,
+ int argc,
+ XSizeHints* hints ) ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: CurrentTime 0 ;
+
+: XA_PRIMARY 1 ;
+: XA_SECONDARY 2 ;
+: XA_ARC 3 ;
+: XA_ATOM 4 ;
+: XA_BITMAP 5 ;
+: XA_CARDINAL 6 ;
+: XA_COLORMAP 7 ;
+: XA_CURSOR 8 ;
+: XA_CUT_BUFFER0 9 ;
+: XA_CUT_BUFFER1 10 ;
+: XA_CUT_BUFFER2 11 ;
+: XA_CUT_BUFFER3 12 ;
+: XA_CUT_BUFFER4 13 ;
+: XA_CUT_BUFFER5 14 ;
+: XA_CUT_BUFFER6 15 ;
+: XA_CUT_BUFFER7 16 ;
+: XA_DRAWABLE 17 ;
+: XA_FONT 18 ;
+: XA_INTEGER 19 ;
+: XA_PIXMAP 20 ;
+: XA_POINT 21 ;
+: XA_RECTANGLE 22 ;
+: XA_RESOURCE_MANAGER 23 ;
+: XA_RGB_COLOR_MAP 24 ;
+: XA_RGB_BEST_MAP 25 ;
+: XA_RGB_BLUE_MAP 26 ;
+: XA_RGB_DEFAULT_MAP 27 ;
+: XA_RGB_GRAY_MAP 28 ;
+: XA_RGB_GREEN_MAP 29 ;
+: XA_RGB_RED_MAP 30 ;
+: XA_STRING 31 ;
+: XA_VISUALID 32 ;
+: XA_WINDOW 33 ;
+: XA_WM_COMMAND 34 ;
+: XA_WM_HINTS 35 ;
+: XA_WM_CLIENT_MACHINE 36 ;
+: XA_WM_ICON_NAME 37 ;
+: XA_WM_ICON_SIZE 38 ;
+: XA_WM_NAME 39 ;
+: XA_WM_NORMAL_HINTS 40 ;
+: XA_WM_SIZE_HINTS 41 ;
+: XA_WM_ZOOM_HINTS 42 ;
+: XA_MIN_SPACE 43 ;
+: XA_NORM_SPACE 44 ;
+: XA_MAX_SPACE 45 ;
+: XA_END_SPACE 46 ;
+: XA_SUPERSCRIPT_X 47 ;
+: XA_SUPERSCRIPT_Y 48 ;
+: XA_SUBSCRIPT_X 49 ;
+: XA_SUBSCRIPT_Y 50 ;
+: XA_UNDERLINE_POSITION 51 ;
+: XA_UNDERLINE_THICKNESS 52 ;
+: XA_STRIKEOUT_ASCENT 53 ;
+: XA_STRIKEOUT_DESCENT 54 ;
+: XA_ITALIC_ANGLE 55 ;
+: XA_X_HEIGHT 56 ;
+: XA_QUAD_WIDTH 57 ;
+: XA_WEIGHT 58 ;
+: XA_POINT_SIZE 59 ;
+: XA_RESOLUTION 60 ;
+: XA_COPYRIGHT 61 ;
+: XA_NOTICE 62 ;
+: XA_FONT_NAME 63 ;
+: XA_FAMILY_NAME 64 ;
+: XA_FULL_NAME 65 ;
+: XA_CAP_HEIGHT 66 ;
+: XA_WM_CLASS 67 ;
+: XA_WM_TRANSIENT_FOR 68 ;
+
+: XA_LAST_PREDEFINED 68 ;
+
+: PropModeReplace 0 ;
+: PropModePrepend 1 ;
+: PropModeAppend 2 ;
diff --git a/debian/architecture.sh b/debian/architecture.sh
new file mode 100644
index 0000000000..2b3c841a76
--- /dev/null
+++ b/debian/architecture.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Translate arch names into what factor expects.
+
+case `dpkg-architecture -qDEB_HOST_ARCH` in
+ powerpc|ppc) echo 'ppc';;
+ ?86|i?86) echo 'x86';;
+ amd64|x86_64) echo 'amd64';;
+esac
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000000..2bcac75095
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,24 @@
+factor (0.79+cvs20060120-1) unstable; urgency=low
+
+ * Refactored wrapper scripts and reduced build time.
+
+ -- Trent Buck Fri, 20 Jan 2006 12:18:21 +1100
+
+factor (0.79+cvs20060119-1) unstable; urgency=low
+
+ * Make an extended.image.
+
+ -- Trent Buck Wed, 18 Jan 2006 00:14:02 +1100
+
+factor (0.79+cvs20060117-1) unstable; urgency=low
+
+ * Bootstrap from an already-installed binary.
+
+ -- Trent Buck Tue, 17 Jan 2006 10:24:10 +1100
+
+factor (0.79+cvs20060114-1) unstable; urgency=low
+
+ * Initial release Closes: #nnnn (nnnn is the bug number of your ITP)
+
+ -- Trent Buck Sat, 14 Jan 2006 10:17:28 +1100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000000..d3de23ba0d
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,23 @@
+Source: factor
+Section: devel
+Priority: optional
+Maintainer: Trent Buck
+Build-Depends: factor, debhelper (>= 4.0.0), rubber, tetex-bin, tetex-extra, gs, sqlite3, libsdl1.2-dev, libfreetype6-dev, libsdl-gfx1.2-dev, libcairo2-dev, libsqlite3-dev, libx11-dev, libpq-dev
+Standards-Version: 3.6.2
+
+Package: factor
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libsdl1.2-dev, libfreetype6-dev, libcairo2-dev, libsqlite3-dev, libx11-dev, libpq-dev
+Suggests: rlwrap
+Description: compiler for the concatenative language Factor
+ Factor is a dynamic programming language. The end goal is to have a high
+ performance, robust language for general-purpose client-side and server-side
+ application development.
+ .
+ Factor is a natural evolution of Forth, combining Forth's simplicity and
+ minimalism with a dynamically typed runtime supporting a Lisp-style object
+ model and meta-programming. Factor also builds upon ideas from Joy, K, and
+ Slate.
+ .
+ http://factorcode.org
diff --git a/factor/FactorExternalizable.java b/debian/copyright
similarity index 82%
rename from factor/FactorExternalizable.java
rename to debian/copyright
index a04cd9443e..d8a74a8ecb 100644
--- a/factor/FactorExternalizable.java
+++ b/debian/copyright
@@ -1,9 +1,14 @@
-/* :folding=explicit:collapseFolds=1: */
+This package was debianized by Trent Buck on
+Thu, 12 Jan 2006 22:07:12 +1100.
+
+It was downloaded from http://factorcode.org
+
+Copyright Holder: Slava Pestov
+
+License:
/*
- * $Id$
- *
- * Copyright (C) 2003 Slava Pestov.
+ * Copyright (C) 2003, 2004 Slava Pestov.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -26,14 +31,3 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-package factor;
-
-/**
- * Called if the object has a string representation that is understood
- * by the parser.
- */
-public interface FactorExternalizable
-{
- String toString();
-}
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000000..9a22bace1c
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,3 @@
+usr/bin
+usr/lib/factor
+usr/share/factor
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000000..b873b8cdfe
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,8 @@
+README.txt
+TODO.FACTOR.txt
+doc/UI_HOWTO.txt
+doc/cont-responder-tutorial.txt
+doc/handbook.pdf
+doc/internals.txt
+doc/theory.pdf
+doc/handbook
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 0000000000..ab4ab5f649
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,82 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# SITE_CFLAGS=-fPIC -ffast-math -funsigned-char -mpowerpc -mpowerpc-gpopt -mpowerpc-gfxopt -maltivec -mabi=altivec -mtune=G4 -mcpu=G4 -pipe
+# SITE_CFLAGS=-march=pentium4
+
+VERSION=0.80
+FARCH=$(shell sh debian/architecture.sh)
+
+configure: configure-stamp
+
+configure-stamp:
+ dh_testdir
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+ $(MAKE) linux-$(FARCH)
+ mv f runtime
+ # Build the bootstrap image
+ echo 'USE: image "$(FARCH)" make-image' | factor-run --basic -resource-path=. # || wget http://factorcode.org/boot.image.$(FARCH)
+ mv boot.image.$(FARCH) boot.image
+ # Build the factor image
+ ./runtime boot.image -libraries:sdl:name=libSDL.so -libraries:freetype:name=libfreetype.so
+ mv factor.image basic.image
+ # Build the extended image
+ sqlite3 contrib/sqlite/test.db < contrib/sqlite/test.txt
+ $(CC) $(CFLAGS) -L /usr/X11R6/lib -shared -o contrib/factory/simple-error-handler.so contrib/factory/simple-error-handler.c -lX11
+ echo 'USING: image kernel ; "contrib/load.factor" run-file compile-all "extended.image" save-image 0 exit' | ./runtime basic.image +X8
+ # Build the documentation
+ cd doc && for i in *.eps; do epstopdf $$i; done
+ cd doc && rubber --pdf theory
+ cd doc && sh makedoc
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ -$(MAKE) clean
+ -rm -f f runtime factor.image boot.image boot.image.$(FARCH) basic.image extended.image
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+ # Install binary files
+ install -m 755 -o root -g root runtime $(CURDIR)/debian/factor/usr/lib/factor
+ install -m 644 -o root -g root boot.image basic.image extended.image $(CURDIR)/debian/factor/usr/lib/factor
+ # Install source files
+ cp -r contrib examples fonts library version.factor $(CURDIR)/debian/factor/usr/share/factor
+ find $(CURDIR)/debian/factor/usr/share/factor -type d -exec chmod 755 {} \;
+ find $(CURDIR)/debian/factor/usr/share/factor -type f -exec chmod 644 {} \;
+ chown -R root.root $(CURDIR)/debian/factor/usr/share/factor
+ # Install wrapper scripts
+ install -m 755 -o root -g root debian/scripts/factor-* $(CURDIR)/debian/factor/usr/bin
+
+binary-indep: build install
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs CHANGES.html
+ dh_installdocs
+ dh_installexamples
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/scripts/factor-export b/debian/scripts/factor-export
new file mode 100644
index 0000000000..a1af34b075
--- /dev/null
+++ b/debian/scripts/factor-export
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Help function
+###############
+help () {
+ cat <= 2
+ +Yn Size of n-1 youngest generations, megabytes
+ +An Size of tenured and semi-spaces, megabytes
+ +Xn Code heap size, megabytes
+EOF
+ exit 0
+}
+
+# Default values
+################
+BINARY_PATH='/usr/lib/factor'
+RESOURCE_PATH='/usr/share/factor'
+IMAGE="$BINARY_PATH/basic.image"
+RUNTIME="$BINARY_PATH/runtime"
+
+# Logic
+#######
+if test 0 -eq $#
+then
+ # As a 'quick start' behaviour, so that new users can
+ # get something to play with immediately.
+ echo "Launching the Factor runtime with a read-only basic image."
+ echo "Use \`\"filename\" save-image' to write an editable image."
+ exec "$RUNTIME" "$IMAGE" -resource-path="$RESOURCE_PATH"
+else
+ case "$1" in
+ -h|--help)
+ help
+ ;;
+ -b|--basic)
+ IMAGE="$BINARY_PATH/basic.image"
+ ;;
+ -e|--extended)
+ IMAGE="$BINARY_PATH/extended.image"
+ ;;
+ *)
+ IMAGE="$1"
+ ;;
+ esac
+ shift
+ exec "$RUNTIME" "$IMAGE" -resource-path="$RESOURCE_PATH" "$@"
+fi
diff --git a/doc/UI_HOWTO.txt b/doc/UI_HOWTO.txt
new file mode 100644
index 0000000000..d45a771909
--- /dev/null
+++ b/doc/UI_HOWTO.txt
@@ -0,0 +1,35 @@
+How To Set up Factor's UI on Linux
+by Daniel Ehrenberg
+
+On the ideal system, Factor's UI works all by itself after bootstrapping. To
+get to the REPL, just run
+ ./f factor.image -shell=ui
+But on many Linux systems, that doesn't work properly the whole time. The
+problem may be an underlying issue with Factor; to test that, try doing just
+ ./f factor.image
+and make sure a console REPL sucessfully appears. But it also may be that the
+libraries needed to make the UI work aren't properly in place. You'll need four
+libraries: libGL, libGLU, libfreetype, and libSDL. If you are missing any of these,
+download them. But remember that on any linux system with X11, you should already
+have these already. Once you've downloaded these, start
+ ./f factor.image
+and type in the following commands:
+ "gl" load-library drop
+ "glu" load-library drop
+ "sdl" load-library drop
+ "freetype" load-library drop
+See which ones of these fail. Each one that failed is a library that isn't on
+your computer or is in the wrong place. To fix this, you need to first double
+check that you have the library, and then, if you do, get it in the right place.
+The directory the libraries should be in varies by the system, but it's usually
+/usr/lib or /usr/local/lib. Find one most libraries seem to be in on your system.
+Next, you need to use the right name for the file. For your OpenGL library, the
+name is libGL.so.1. For GLU, it's libGLU.so.1. For SDL, the name is libSDL.so.
+For FreeType, the name is libfreetype.so.6. Make a symbolic link from the current
+location of the misplaced library to this new location, under the proper name in
+the proper folder. You can do this with the command
+ ln -s oldlocation newlocation
+The old file stays there and the new file mirrors the old one, reflecting all
+future changes. Once this link is set up, rebootstrap and all should be well.
+If things still do not work, don't hesitate to ask us at #concatenative on
+freenode.net.
diff --git a/doc/comparison.tex b/doc/comparison.tex
index 0c4e7999e0..b94dff1c95 100644
--- a/doc/comparison.tex
+++ b/doc/comparison.tex
@@ -16,19 +16,19 @@ In many ways, Factor is just like Forth, but with a few additional features: gar
\subsection{Data}
-Dealing with strings is a bit easier in Factor than Forth because of garbage collection. Forth uses parsing words that Factor doesn't is when using words that take strings as arguments. Factor doesn't need a parsing word here because it has garbage collection. Unlike Forth, Factor makes a special exception for strings in its syntax, making " recognized as a seperate word, even if it's not followed by a space, as long as it is preceded with a space. Where Forth would write \verb|s" string"| (or sometimes \verb|" string"|) for the syntax of a string, Factor would write \verb|"string"|, a much more conventional notation. Strings, rather than being untyped pointers, are considered string objects. For characters, Factor says \verb|CHAR: c| for Forth's \verb|char c|. As in Forth, Factor characters are integers.
+Dealing with strings is a bit easier in Factor than Forth because of garbage collection. Forth uses parsing words that Factor doesn't when using words that take strings as arguments. Factor doesn't need a parsing word here because it has garbage collection. Unlike Forth, Factor makes a special exception for strings in its syntax, making " recognized as a seperate word, even if it's not followed by a space, as long as it is preceded with a space. Where Forth would write \verb|s" string"| (or sometimes \verb|" string"|) for the syntax of a string, Factor would write \verb|"string"|, a much more conventional notation. Strings, rather than being untyped pointers, are considered string objects. For characters, Factor says \verb|CHAR: c| for Forth's \verb|char c|. As in Forth, Factor characters are integers.
For many of the obvious math words, such as \texttt{+}, \texttt{-}, \texttt{*}, and \texttt{/}, Factor and Forth just share the same name. But in Factor, these work not only on small integers but also on arbitrarily large integers, floating point numbers, fractions, and complex numbers. Factor has a rich math library in the \verb|math| vocabulary.
-Unlike Forth, Factor has a large number of datastructures in its standard library, most of which are bounds-checked. These include linked lists, vectors, hashtables, and sometimes-unsafe arrays. But even arrays have their length stored, since it is needed for garbage collection. This is a major change from Forth's anarchy and flexibility when it comes to datastructures.
+Unlike Forth, Factor has a large number of data structures in its standard library, most of which are bounds-checked. These include linked lists, vectors, hashtables, and sometimes-unsafe arrays. But even arrays have their length stored, since it is needed for garbage collection. This is a major change from Forth's anarchy and flexibility when it comes to datastructures.
\subsection{Controlling Flow and Stack}
You can put any code as these lists, and you can move it to the return stack for execution using the word call. This technique is used very often for higher-order functions, largely the same way \texttt{[']} or \texttt{'} is used. \texttt{[ word ]} is the Factor equivalent of \texttt{['] word} for most purposes, but for other operations, prefix it with a backslash (\texttt{\char'134 word}). For executing a plain word (prefixed with a backslash in Factor), you can use \texttt{execute} just like Forth. But this is not used very often. Normally, you want to use a whole quotation (surrounded by square brackets) since it can be longer than a word, and to execute that, use \texttt{call}.
-One of the most visible differences between Factor and Forth is the tendency to use these code quotations where one would use immediate words in Forth. For example, instead of Forth's \verb|if true stuff else false action then|, in Factor you would write \verb|[ true stuff ] [ false action ] ifte|. In order to do \verb|if true stuff then| in Factor, you can't just do \verb|[ true stuff ] ifte|; you have to use a different word instead of ifte, specifically \texttt{when}, in this case: \verb|[ true stuff ] when|. While Factor doesn't have words like \texttt{<>if}, it has a whole range of other if-related words, including \texttt{unless}, \texttt{when*}, \texttt{unless*}, \texttt{?ifte}, and \texttt{?}. Similarly, for a Forth construct like \verb|for blah next|, the Factor code is \verb|[ blah ] repeat|, and the Factor code \verb|[ test ] [ action ] while| is for the Forth construct \verb|begin test while action repeat|.
+One of the most visible differences between Factor and Forth is the tendency to use these code quotations where one would use immediate words in Forth. For example, instead of Forth's \verb|if true stuff else false action then|, in Factor you would write \verb|[ true stuff ] [ false action ] if|. In order to do \verb|if true stuff then| in Factor, you can't just do \verb|[ true stuff ] if|; you have to use a different word instead of if, specifically \texttt{when}, in this case: \verb|[ true stuff ] when|. While Factor doesn't have words like \texttt{<>if}, it has a whole range of other if-related words, including \texttt{unless}, \texttt{when*}, \texttt{unless*}, \texttt{?if}, and \texttt{?}. Similarly, for a Forth construct like \verb|for blah next|, the Factor code is \verb|[ blah ] repeat|, and the Factor code \verb|[ test ] [ action ] while| is for the Forth construct \verb|begin test while action repeat|.
-For obvious reasons, Factor shares many of Forth's stack manipulation words. These include \texttt{dup}, \texttt{drop}, \texttt{swap}, \texttt{rot}, \texttt{-rot}, \texttt{2dup}, \texttt{2drop}, \texttt{>r} and \texttt{r>}. Factor doesn't have \texttt{r@}, but somehow, the need never seems to come up in Factor code. Factor adds some new stack shuffling words, such as \texttt{swapd} ( a b c -- b a c ) and \texttt{dupd} ( a b -- a a b )
+For obvious reasons, Factor shares many of Forth's stack manipulation words. These include \texttt{dup}, \texttt{drop}, \texttt{swap}, \texttt{rot}, \texttt{-rot}, \texttt{2dup}, \texttt{2drop}, \texttt{>r} and \texttt{r>}. Factor doesn't have \texttt{r@}, but somehow, the need never seems to come up in Factor code. Factor adds some new stack shuffling words, such as \texttt{swapd} ( a b c -- b a c ) and \texttt{dupd} ( a b -- a a b ).
\subsection{Words, Variables and Parsing}
@@ -99,7 +99,7 @@ but in Factor, you dip like
\end{verbatim}
This is not new syntax; you are just pushing the top of the stack onto the return stack. But if you do this wrong, taking more than you leave or leaving more than you take, the results are unpredictable and sometimes result in a crash. \texttt{dip} could be implemented very easily in Factor (\verb|: dip swap slip ;|) but that would just be redundant and less flexible.
-A big difference between Factor and Joy is the way that Factor encourages you to factor your program into tiny pieces, like Forth. So some words that may have been considered good style in Joy can be considered horrible in Factor. The optimal Factor word contains 7 words. This stylistic difference makes Factor's library very different in order to encourage factoring. For most of Joy's recursive combinators, Factor just uses recursion. Factor does away with some of Joy's words like cond, which usually just lead to words that are too big. Factor does port certain combinators, such as \texttt{times}, \texttt{while} and \texttt{ifte} (but \texttt{ifte} takes a boolean to make the decision, not a quotation).
+A big difference between Factor and Joy is the way that Factor encourages you to factor your program into tiny pieces, like Forth. So some words that may have been considered good style in Joy can be considered horrible in Factor. The optimal Factor word contains 7 words. This stylistic difference makes Factor's library very different in order to encourage factoring. For most of Joy's recursive combinators, Factor just uses recursion. Factor does away with some of Joy's words like cond, which usually just lead to words that are too big. Factor does port certain combinators, such as \texttt{times}, \texttt{while} and \texttt{ifte}, remamed \texttt{if} (but \texttt{if} takes a boolean to make the decision, not a quotation).
\subsection{Words and Variables}
@@ -142,7 +142,7 @@ In Factor, code is represented as lists, just like in Scheme and Lisp. But when
\end{verbatim}
is
\begin{verbatim}
-x [ y ] [ z ] ifte
+x [ y ] [ z ] if
\end{verbatim}
Factor's \texttt{callcc0} and \texttt{callcc1} is \texttt{call-with-current-continuation} (aka \texttt{call/cc}) in Scheme, basically. The two versions in Factor exist because you need to explicitly specify the arity of your continuation, since factor has no variable argument mechanism. But usually in Factor, you would wrap up continuations in a library rather than use them directly. There is no equivalent of \texttt{dynamic-wind}, and instead, \texttt{catch} (the error handler) is used for most of those resource-handing places.
@@ -200,9 +200,9 @@ if(x, lambda: y, lambda: z)
\end{verbatim}
This is essentially what Factor does, in the syntax
\begin{verbatim}
-x [ y ] [ z ] ifte
+x [ y ] [ z ] if
\end{verbatim}
-Words like ifte are used for everything from the equivalents of \verb|[x+1 for x in list]| to
+Words like if are used for everything from the equivalents of \verb|[x+1 for x in list]| to
\begin{verbatim}
while x==y:
do(something)
diff --git a/doc/cont-responder-tutorial.txt b/doc/cont-responder-tutorial.txt
index 8f247a1c9d..26a8deeaa1 100644
--- a/doc/cont-responder-tutorial.txt
+++ b/doc/cont-responder-tutorial.txt
@@ -22,13 +22,12 @@ vocabulary:
The responders that you will be writing will require an instance of
the httpd server to be running. It will be run in a background thread
to enable the interactive development of the applications. The
-following is a simple function to start the server on port 8888 and
-restart it if an error occurs:
+following is a simple function to start the server on port 8888:
USE: httpd
USE: threads
- : start-httpd [ 8888 httpd ] [ dup . flush [ start-httpd ] when* ] catch ;
- [ start-httpd ] in-thread
+ : start-httpd [ 8888 httpd ] in-thread ;
+ start-httpd
Responders
==========
@@ -582,7 +581,7 @@ The 'cont-testing.factor' file (in the contrib/cont-responder
directory) contains some simple words that maintains this state for
you in such a way that you can test the words from the console:
- "cont-testing.factor" run-file
+ "/contrib/cont-testing/load.factor" run-resource
For this example we'll call the 'subroutine-example1' responder from
above. First we need to put a 'testing state' object on the stack. All
@@ -671,4 +670,4 @@ Now we submit the post data along to the 'action' url:
-As you can see the post data was sent correctly.
\ No newline at end of file
+As you can see the post data was sent correctly.
diff --git a/doc/handbook/collections.facts b/doc/handbook/collections.facts
new file mode 100644
index 0000000000..faa99ff71a
--- /dev/null
+++ b/doc/handbook/collections.facts
@@ -0,0 +1,172 @@
+USING: hashtables hashtables-internals help io-internals kernel
+namespaces queues ;
+
+GLOSSARY: "collection" "an object whose primary purpose is to aggregate other objects; examples include sequences, queues and hashtables" ;
+
+ARTICLE: "collections" "Collections"
+"Classical data structures:"
+{ $subsection "sequences" }
+{ $subsection "queues" }
+{ $subsection "hashtables" }
+"An abstraction on hashtables:"
+{ $subsection "namespaces" }
+"A low-level facility:"
+{ $subsection "buffers" } ;
+
+ARTICLE: "queues" "Queues"
+"A simple last-in-first-out queue data structure."
+{ $subsection queue? }
+{ $subsection }
+{ $subsection queue-empty? }
+{ $subsection enque }
+{ $subsection deque } ;
+
+GLOSSARY: "hashtable"
+"An instance of the " { $link hashtable } " class, implementing a mutable mapping from keys to values with expected constant lookup time" ;
+
+GLOSSARY: "hashcode"
+"an integer chosen so that equal objects have equal hashcodes, and unequal objects' hashcodes are distributed as evently as possible" ;
+
+ARTICLE: "hashtables" "Hashtables"
+"A hashtable provides efficient (expected constant time) lookup and storage of key/value pairs. Keys are compared for equality, and a hashing function is used to reduce the number of comparisons made."
+$terpri
+"Hashtable words are in the " { $snippet "hashtables" } " vocabulary. Unsafe implementation words are in the " { $snippet "hashtables-internals" } " vocabulary."
+$terpri
+"Hashtables form a class of objects."
+{ $subsection hashcode }
+{ $subsection hashtable? }
+{ $subsection }
+"There are some primitive operations on hashes, and many utilities."
+{ $subsection "hashtables-lookup" }
+{ $subsection "hashtables-mutation" }
+{ $subsection "hashtables-combinators" }
+{ $subsection "hashtables-utilities" }
+{ $subsection "hashtables-internals" } ;
+
+ARTICLE: "hashtables-lookup" "Looking up keys in hashtables"
+{ $subsection hash }
+{ $subsection hash* }
+{ $subsection ?hash }
+{ $subsection ?hash* }
+{ $subsection hash-member? } ;
+
+ARTICLE: "hashtables-mutation" "Storing keys in hashtables"
+{ $subsection set-hash }
+{ $subsection ?set-hash }
+{ $subsection remove-hash }
+{ $subsection clear-hash } ;
+
+ARTICLE: "hashtables-combinators" "Hashtable combinators"
+"We have the standard functional programming idioms."
+{ $subsection hash-each }
+{ $subsection hash-all? }
+{ $subsection hash-subset }
+"There are curried forms of the above."
+{ $subsection hash-each-with }
+{ $subsection hash-all-with? }
+{ $subsection hash-subset-with }
+"Two oddball combinators."
+{ $subsection cache }
+{ $subsection map>hash } ;
+
+ARTICLE: "hashtables-utilities" "Hashtable utilities"
+"Set-theoretic operations exploit the expected constant lookup time of a hashtable."
+{ $subsection hash-intersect }
+{ $subsection hash-diff }
+{ $subsection hash-union }
+{ $subsection hash-concat }
+{ $subsection hash-update }
+{ $subsection remove-all }
+"A combinator used to implement notions of nested scope. This includes various fundamental abstractions like variables, vocabulary search and cascading styles."
+{ $subsection hash-stack } ;
+
+ARTICLE: "hashtables-internals" "Hashtable implementation details"
+"This hashtable implementation uses only one auxilliary array in addition to the hashtable tuple itself. The array stores keys in even slots and values in odd slots. Values are looked up with a hashing strategy that uses linear probing to resolve collisions."
+{ $terpri }
+"There are two special objects: the " { $link ((tombstone)) } " marker and the " { $link ((empty)) } " marker. Neither of these markers can be used as hashtable keys."
+{ $terpri }
+"The " { $link hash-count } " slot is the number of entries including deleted entries, and " { $link hash-deleted } " is the number of deleted entries."
+{ $subsection }
+{ $subsection nth-pair }
+{ $subsection set-nth-pair }
+{ $subsection each-pair }
+{ $subsection all-pairs? } ;
+
+GLOSSARY: "namestack" "a stack holding namespaces. Entering a dynamic scope pushes the name stack, leaving a scope pops it" ;
+
+GLOSSARY: "namespace" "a hashtable pushed on the name stack and used as a set of variable bindings" ;
+
+GLOSSARY: "dynamic scope" "a variable binding policy where bindings established in a scope are visible to all code executed while the scope is active" ;
+
+ARTICLE: "namespaces" "Variables and namespaces"
+"A variable is an entry in a hashtable of bindings, with the hashtable being implicit rather than passed on the stack. These hashtables are termed " { $emphasis "namespaces" } ". Nesting of scopes is implemented with a search order on namespaces, defined by a " { $emphasis "namestack" } ". Since namespaces are just hashtables, any object can be used as a variable, however by convention, variables are keyed by symbols (see " { $link "symbols" } ")."
+$terpri
+"The " { $snippet "get" } " and " { $snippet "set" } " words read and write variable values. The " { $snippet "get" } " word searches up the chain of nested namespaces, while " { $snippet "set" } " always sets variable values in the current namespace only. Namespaces are dynamically scoped; when a quotation is called from a nested scope, any words called by the quotation also execute in that scope."
+{ $subsection get }
+{ $subsection set }
+"Various utility words abstract away common variable access patterns:"
+{ $subsection "namespaces-change" }
+{ $subsection "namespaces-combinators" }
+{ $subsection "namespaces-utilities" }
+"A useful facility for constructing sequences by holding an accumulator sequence in a variable:"
+{ $subsection "namespaces-make" }
+"Implementation details your code probably does not care about:"
+{ $subsection "namespaces-internals" } ;
+
+ARTICLE: "namespaces-combinators" "Namespace combinators"
+{ $subsection make-hash }
+{ $subsection with-scope }
+{ $subsection bind } ;
+
+ARTICLE: "namespaces-change" "Ways to change variable values"
+{ $subsection on }
+{ $subsection off }
+{ $subsection inc }
+{ $subsection dec }
+{ $subsection change } ;
+
+ARTICLE: "namespaces-utilities" "Namespace utilities"
+{ $subsection namespace }
+{ $subsection nest }
+{ $subsection global }
+{ $subsection set-global } ;
+
+ARTICLE: "namespaces-make" "Constructing sequences"
+"There is a lexicon of words for constructing sequences without passing the partial sequence being built on the stack. This reduces stack noise."
+{ $subsection make }
+{ $subsection , }
+{ $subsection % }
+{ $subsection # } ;
+
+ARTICLE: "namespaces-internals" "Namespace implementation details"
+"The namestack holds namespaces."
+{ $subsection namestack* }
+{ $subsection namestack }
+{ $subsection set-namestack }
+"A pair of words push and pop namespaces on the namestack."
+{ $subsection >n }
+{ $subsection n> } ;
+
+ARTICLE: "buffers" "Locked I/O buffers"
+"I/O buffers are a circular ring structure, a fixed-size queue of characters. Their key feature is that they are backed by manually allocated storage that does not get moved by the garbage collector. They are typically used for asynchronous I/O in conjunction with the C library interface in Factor's implementation."
+$terpri
+"Buffer words are in the " { $snippet "io-internals" } " vocabulary."
+{ $subsection buffer }
+{ $subsection }
+"Buffers must be manually deallocated:"
+{ $subsection buffer-free }
+"Buffer operations:"
+{ $subsection buffer-reset }
+{ $subsection buffer-length }
+{ $subsection buffer-empty? }
+{ $subsection buffer-capacity }
+"Reading from the buffer:"
+{ $subsection buffer-peek }
+{ $subsection buffer-pop }
+{ $subsection buffer> }
+{ $subsection buffer>> }
+{ $subsection buffer-contents }
+"Writing to the buffer:"
+{ $subsection buffer-extend }
+{ $subsection ch>buffer }
+{ $subsection >buffer } ;
diff --git a/doc/handbook/dataflow.facts b/doc/handbook/dataflow.facts
new file mode 100644
index 0000000000..870ffefb42
--- /dev/null
+++ b/doc/handbook/dataflow.facts
@@ -0,0 +1,196 @@
+USING: errors help kernel lists namespaces threads words ;
+
+GLOSSARY: "stack" "see datastack" ;
+
+GLOSSARY: "datastack" "the primary means of passing values between words" ;
+
+ARTICLE: "dataflow" "Data and control flow"
+{ $subsection "shuffle-words" }
+{ $subsection "quotations" }
+{ $subsection "conditionals" }
+{ $subsection "continuations" } ;
+
+ARTICLE: "shuffle-words" "Shuffle words"
+"Shuffle words rearrange items at the top of the stack. They control the flow of data between words that perform actions."
+$terpri
+"Removing stack elements:"
+{ $subsection drop }
+{ $subsection 2drop }
+{ $subsection 3drop }
+{ $subsection nip }
+{ $subsection 2nip }
+"Duplicating stack elements:"
+{ $subsection dup }
+{ $subsection 2dup }
+{ $subsection 3dup }
+{ $subsection dupd }
+{ $subsection over }
+{ $subsection pick }
+{ $subsection tuck }
+"Permuting stack elements:"
+{ $subsection swap }
+{ $subsection rot }
+{ $subsection -rot }
+{ $subsection 2swap }
+{ $subsection swapd } ;
+
+GLOSSARY: "return stack" "see callstack" ;
+
+GLOSSARY: "callstack" "holds quotations waiting to be called. When a quotation is called with \texttt{call}, or when a compound word is executed, the previous call frame is pushed on the call stack, and the new quotation becomes the current call frame" ;
+
+GLOSSARY: "callframe" "the currently executing quotation" ;
+
+GLOSSARY: "evaluation" "the abstract process by which quotations are executed. There are multiple possible ways to implement an evaluator; namely, interpretation, and compilation" ;
+
+GLOSSARY: "interpreter" "executes quotations by iterating them and recursing into nested definitions. See compiler" ;
+
+GLOSSARY: "quotation" "a list containing Factor code intended for evaluation" ;
+
+GLOSSARY: "combinator" "a word taking quotations or other words as input" ;
+
+ARTICLE: "quotations" "Quotations and combinators"
+"An evaluator executes quotations. Quotations are lists, and since lists can contain any Factor object, they can contain words. It is words that give quotations their operational behavior, as you can see in the following description of the evaluator algorithm."
+{ $list
+ { "If the callframe is " { $link f } ", the callstack is popped and becomes the new call frame." }
+ { "If the " { $link car } " of the callframe is a word, the word is executed:"
+ { $list
+ { "If the word is a symbol, it is pushed on the datastack. See " { $link "symbols" } }
+ { "If the word is a compound definition, the current callframe is pushed on the callstack, and the new callframe becomes the word definition. See " { $link "colon-definition" } }
+ { "If the word is compiled or primitive, the interpreter jumps to a machine code definition. See " { $link "primitives" } }
+ { "If the word is undefined, an error is raised. See " { $link "deferred" } }
+ }
+ }
+ { "If the " { $link car } " of the callframe is a wrapper, the wrapped object is pushed on the datastack. Wrappers arise from the " { $link POSTPONE: \ } " parsing word." }
+ { "Otherwise, the " { $link car } " of the call frame is pushed on the datastack." }
+ { "The callframe is set to the " { $link cdr } ", and the loop continues." }
+}
+"The interpreter performs the above steps literally. The compiler generates machine code which perform the steps in a more efficient manner than the interpreter."
+$terpri
+"The following pair of words are central. They invoke the evaluator reflectively, allowing higher-order programming and meta-programming techniques that lie at the heart of Factor's expressive power."
+{ $subsection call }
+{ $subsection execute }
+"These words are used to implement " { $emphasis "combinators" } ", which are words that take code from the stack. Combinator definitions must be followed by the " { $link POSTPONE: inline } " declaration in order to compile; for example:"
+{ $code
+ ": keep ( x quot -- x | quot: x -- )"
+ " over >r call r> ; inline"
+}
+"Word inlining is documented in " { $link "declarations" } "."
+{ $subsection "tail-call-optimization" }
+{ $subsection "callstack-manipulation" }
+{ $subsection "quotation-variants" } ;
+
+GLOSSARY: "tail call" "the last call in a quotation" ;
+
+GLOSSARY: "tail call optimization" "the elimination of call stack pushes when making a tail call" ;
+
+ARTICLE: "tail-call-optimization" "Tail call optimization"
+"When a call is made to a quotation from the last word in the call frame, there is no purpose in pushing the empty call frame on the call stack. Therefore the last call in a quotation does not grow the call stack, and tail recursion executes in bounded space." ;
+
+ARTICLE: "callstack-manipulation" "Callstack manipulation"
+"The top of the callstack is not accessed during the execution of a quotation; the callstack is only popped when the end of the quotation is reached. In effect, the callstack can be used as a temporary storage area, as long as pushes and pops are balanced out within a single quotation."
+{ $subsection >r }
+{ $subsection r> }
+"The top of the datastack is ``hidden'' between " { $link >r } " and " { $link r> } ":"
+{ $example "1 2 3 >r .s r>" "2\n1" }
+"It is crucial that usages of " { $link >r } " and " { $link r> } " are balanced within a single quotation or word definition."
+{ $code
+ ": the-good >r 2 + r> * ; ! Okay"
+ ": the-bad >r 2 + ; ! Runtime error"
+ ": the-ugly r> ; ! Runtime error"
+}
+"Basically, the rule is you must leave the callstack in the same state as you found it, so that when the current quotation finishes executing, the interpreter can return to the caller."
+$terpri
+"One exception is that when " { $link if } " occurs as the last word in a definition, values may be pushed on the callstack before the condition value is computed, as long as both branches of the " { $link if } " pop the values off the call stack before returning:"
+{ $code
+ ": foo ( m ? n -- m+n/n )"
+ " >r [ r> + ] [ drop r> ] if ; ! Okay"
+} ;
+
+ARTICLE: "quotation-variants" "Quotation variants"
+"There are some words that combine shuffle words with " { $link call } ". They are useful for implementing combinators."
+{ $subsection slip }
+{ $subsection 2slip }
+{ $subsection keep }
+{ $subsection 2keep }
+{ $subsection 3keep }
+{ $subsection 2apply } ;
+
+ARTICLE: "conditionals" "Conditionals and boolean logic"
+"In Factor, any object that is not " { $link f } " has a true boolean value, and " { $link f } " has a false boolean value."
+$terpri
+"The basic conditionals:"
+{ $subsection if }
+{ $subsection when }
+{ $subsection unless }
+"A form encapsulating a common stack shuffle pattern:"
+{ $subsection if* }
+{ $subsection when* }
+{ $subsection unless* }
+"Another form encapsulating a common stack shuffle pattern:"
+{ $subsection ?if }
+"Sometimes instead of executing one of two quotations, you just need to pick one of two values:"
+{ $subsection ? }
+"There are some logical operations on booleans:"
+{ $subsection >boolean }
+{ $subsection and }
+{ $subsection or } ;
+
+GLOSSARY: "continuation" "an object representing the future of the computation. Continuations are reified by " { $link callcc0 } " and " { $link callcc1 } ", and resumed with " { $link continue } ;
+
+ARTICLE: "continuations" "Continuations"
+"At any point in the execution of a program, the " { $emphasis "current continuation" } " represents the future of the computation. This object can be reified with the following two words:"
+{ $subsection callcc0 }
+{ $subsection callcc1 }
+"Another two words resume continuations:"
+{ $subsection continue }
+{ $subsection continue-with }
+"Continuations serve as the building block for a number of higher-level abstractions."
+{ $subsection "errors" }
+{ $subsection "threads" }
+{ $subsection "continuations-internals" } ;
+
+ARTICLE: "errors" "Handling errors"
+"Support for handling exceptional situations such as bad user input, implementation bugs, and input/output errors is provided by a set of words built using continuations."
+$terpri
+"Two words raise an error in the innermost error handler for the current dynamic extent:"
+{ $subsection throw }
+{ $subsection rethrow }
+"A set of words establish an error handler:"
+{ $subsection cleanup }
+{ $subsection recover }
+{ $subsection catch }
+"Caught errors can be logged in human-readable form:"
+{ $subsection error. }
+{ $subsection try }
+"Information relating to the most recently thrown error is stored in a pair of global variables:"
+{ $subsection error }
+{ $subsection error-continuation }
+"When an error is thrown and caught by the listener, a number of words facilitate interactive debugging of the error:"
+{ $subsection :s }
+{ $subsection :r }
+{ $subsection :get } ;
+
+ARTICLE: "threads" "Multitasking"
+"Continuations are used to implements co-operative multitasking, where the runtime switches between threads during I/O calls, and explicit yields."
+{ $subsection in-thread }
+{ $subsection yield }
+{ $subsection sleep }
+{ $subsection stop }
+"Multitasking relies on a very simple round-robin scheduler:"
+{ $subsection run-queue }
+{ $subsection sleep-queue }
+{ $subsection schedule-thread }
+{ $subsection next-thread } ;
+
+ARTICLE: "continuations-internals" "Continuation implementation details"
+"A continuation is simply a tuple holding the contents of the four stacks:"
+{ $subsection continuation }
+"The four stacks can be read and written:"
+{ $subsection datastack }
+{ $subsection set-datastack }
+{ $subsection callstack }
+{ $subsection set-callstack }
+{ $subsection namestack }
+{ $subsection set-namestack }
+{ $subsection catchstack }
+{ $subsection set-catchstack } ;
diff --git a/doc/handbook/handbook.facts b/doc/handbook/handbook.facts
new file mode 100644
index 0000000000..e4326a68a9
--- /dev/null
+++ b/doc/handbook/handbook.facts
@@ -0,0 +1,48 @@
+USING: help parser prettyprint ;
+
+ARTICLE: "handbook" "Factor documentation"
+"Welcome to Factor! Factor documentation is takes the form of an outline, with cross-referencing hyperlinks between topics. You can click the triangle next to a topic heading to expand the topic."
+$terpri
+"There is some introductory material you will find useful when starting out:"
+{ $subsection "presentation-intro" }
+{ $subsection "tutorial" }
+{ $subsection "quickref" }
+"Detailed reference documentation:"
+{ $subsection "syntax" }
+{ $subsection "dataflow" }
+{ $subsection "words" }
+{ $subsection "objects" }
+{ $subsection "math" }
+{ $subsection "collections" }
+{ $subsection "streams" }
+{ $subsection "parser" }
+{ $subsection "prettyprint" }
+;
+
+ARTICLE: "presentation-intro" "The presentation-based UI"
+"Factor provides a " { $emphasis "presentation-based" } " user interface. A " { $emphasis "presentation" } " is a graphical representation of a live object. You can see presentations everywhere; help links, words, and code examples are all presentations."
+$terpri
+"When you place the mouse over a presentation, it is highlighted with a surrounding border."
+$terpri
+"Clicking a presentation with the left mouse button invokes a default command. Clicking the right mouse button displays a menu of applicable commands." ;
+
+ARTICLE: "quickref" "Quick reference"
+"Some words for performing common operations at the listener:"
+{ $list
+ {
+ "You can read the documentation for a word with " { $link help } ":"
+ { $code "\\ reverse help" }
+ }
+ { "You can print the top of the stack with " { $link . } }
+ {
+ "Source files are loaded with " { $link run-file } ":"
+ { $code "\"tetris.factor\" run-file" }
+ }
+}
+"If you enter an invalid word name, you will get a \"not a number\" error:"
+{ $example
+ "fdafasfa"
+ "An unhandled error was caught:\n\nParsing :1\nfdafasfa\n ^\n\"Not a number\"\n\n:s :r show stacks at time of error.\n:get ( var -- value ) inspects the error namestack."
+}
+"Sometimes, the word " { $emphasis "does" } " exist, but you might need to " { $link POSTPONE: USE: } " its vocabulary first. The " { $link apropos } " word can help locate the correct vocabulary:"
+{ $example "\"\" apropos" "IN: gadgets-labels : \nIN: compiler-backend : " } ;
diff --git a/doc/handbook/math.facts b/doc/handbook/math.facts
new file mode 100644
index 0000000000..25663002d2
--- /dev/null
+++ b/doc/handbook/math.facts
@@ -0,0 +1,225 @@
+USING: help math prettyprint sequences ;
+
+ARTICLE: "math" "Mathematics"
+"Factor attempts to preserve natural mathematical semantics for numbers. Multiplying two large integers never results in overflow, and dividing two integers yields an exact ratio. Floating point numbers are also supported, along with complex numbers."
+$terpri
+"Math words are in the " { $snippet "math" } " vocabulary. Implementation details are in the " { $snippet "math-internals" } " vocabulary."
+{ $subsection "number-protocol" }
+{ $subsection "number-types" }
+{ $subsection "math-functions" }
+{ $subsection "math-constants" }
+{ $subsection "math-vectors" } ;
+
+ARTICLE: "number-types" "Types of numbers"
+{ $subsection "integers" }
+{ $subsection "rationals" }
+{ $subsection "floats" }
+{ $subsection "complex-numbers" } ;
+
+ARTICLE: "number-protocol" "Number protocol"
+"Math operations obey certain numerical upgrade rules. If one of the inputs is a bignum and the other is a fixnum, the latter is first coerced to a bignum; if one of the inputs is a float, the other is coerced to a float."
+$terpri
+"Two examples where you should note the types of the inputs and outputs:"
+{ $example "3 >fixnum 6 >bignum * class ." "bignum" }
+{ $example "1/2 2.0 + ." "4.5" }
+"The following usual operations are supported by all numbers."
+{ $subsection + }
+{ $subsection - }
+{ $subsection * }
+{ $subsection / }
+"Non-commutative operations take operands from the stack in the natural order; " { $snippet "6 2 /" } " divides 6 by 2."
+$terpri
+"Real numbers (but not complex numbers) can be ordered:"
+{ $subsection < }
+{ $subsection <= }
+{ $subsection > }
+{ $subsection >= } ;
+
+ARTICLE: "integers" "Integers"
+{ $subsection integer }
+"Integers come in two varieties -- fixnums and bignums. Fixnums fit in a machine word and are faster to manipulate; if the result of a fixnum operation is too large to fit in a fixnum, the result is upgraded to a bignum. Here is an example where two fixnums are multiplied yielding a bignum:"
+{ $example "134217728 class ." "fixnum" }
+{ $example "128 class ." "fixnum" }
+{ $example "134217728 128 * ." "17179869184" }
+{ $example "134217728 128 * class ." "bignum" }
+"Integers can be entered using a different base; see " { $link "syntax-numbers" } "."
+$terpri
+"Integers can be tested for, and real numbers can be converted to integers:"
+{ $subsection fixnum? }
+{ $subsection bignum? }
+{ $subsection >fixnum }
+{ $subsection >bignum }
+"The " { $link . } " word prints numbers in decimal. A set of words in the " { $snippet "prettyprint" } " vocabulary is provided to print integers using another base."
+{ $subsection .b }
+{ $subsection .o }
+{ $subsection .h }
+"Some mathematical operations are only supported on integers."
+{ $subsection "modular-arithmetic" }
+{ $subsection "bitwise-arithmetic" }
+{ $subsection "random-numbers" } ;
+
+ARTICLE: "modular-arithmetic" "Modular arithmetic"
+{ $subsection mod }
+{ $subsection rem }
+{ $subsection /mod }
+{ $subsection /i }
+{ $subsection gcd } ;
+
+ARTICLE: "bitwise-arithmetic" "Bitwise arithmetic"
+"There are two ways of looking at an integer -- as an abstract mathematical entity, or as a string of bits. The latter representation motivates " { $emphasis "bitwise operations" } "."
+{ $subsection bitand }
+{ $subsection bitor }
+{ $subsection bitxor }
+{ $subsection bitnot }
+{ $subsection shift }
+{ $subsection log2 }
+{ $subsection power-of-2? }
+{ $subsection next-power-of-2 }
+{ $subsection each-bit } ;
+
+ARTICLE: "random-numbers" "Generating random integers"
+{ $subsection (random-int) }
+{ $subsection random-int } ;
+
+ARTICLE: "rationals" "Rational numbers"
+{ $subsection ratio }
+"When we add, subtract or multiply any two integers, the result is always an integer. However, dividing a numerator by a denominator that is not an integral divisor of the denominator yields a ratio:"
+{ $example "1210 11 / ." "110" }
+{ $example "100 330 / ." "10/33" }
+"Ratios are printed and can be input literally in the form above. Ratios are always reduced to lowest terms by factoring out the greatest common divisor of the numerator and denominator. A ratio with a denominator of 1 becomes an integer. Division with a denominator of 0 throws an error."
+$terpri
+"Ratios behave just like any other number -- all numerical operations work as you would expect."
+{ $example "1/2 1/3 + ." "5/6" }
+{ $example "100 6 / 3 * ." "50" }
+"Ratios can be taken apart:"
+{ $subsection numerator }
+{ $subsection denominator }
+{ $subsection >fraction } ;
+
+ARTICLE: "floats" "Floats"
+"Rational numbers represent " { $emphasis "exact" } " quantities. On the other hand, a floating point number is an " { $emphasis "approximation" } ". While rationals can grow to any required precision, floating point numbers are fixed-width, and manipulating them is usually faster than manipulating ratios or bignums (but slower than manipulating fixnums). Floating point numbers are often used to represent irrational numbers, which have no exact representation as a ratio of two integers."
+$terpri
+"Floating point literals are input with a decimal point."
+{ $example "1.23 1.5 + ." "1.73" }
+"Introducing a floating point number in a computation forces the result to be expressed in floating point."
+{ $example "5/4 1/2 + ." "7/4" }
+{ $example "5/4 0.5 + ." "1.75" }
+"Integers and rationals can be converted to floats:"
+{ $subsection >float }
+"Two real numbers can be divided yielding a float result:"
+{ $subsection /f }
+"Floating point numbers are represented internally in IEEE 754 double-precision format. This internal representation can be accessed for advanced operations and input/output purposes."
+{ $subsection float>bits }
+{ $subsection double>bits }
+{ $subsection bits>float }
+{ $subsection bits>double } ;
+
+ARTICLE: "complex-numbers" "Complex numbers"
+{ $subsection complex }
+"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "syntax-complex-numbers" } "."
+$terpri
+"Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero."
+$terpri
+"Complex numbers can be taken apart:"
+{ $subsection real }
+{ $subsection imaginary }
+{ $subsection >rect }
+"Complex numbers can be constructed from real numbers:"
+{ $subsection rect> }
+"The polar form can be computed:"
+{ $subsection abs }
+{ $subsection absq }
+{ $subsection arg }
+{ $subsection >polar }
+{ $subsection polar> }
+"Reflection in the " { $snippet "x" } " axis:"
+{ $subsection conjugate } ;
+
+ARTICLE: "math-functions" "Mathematical functions"
+{ $subsection "arithmetic-functions" }
+{ $subsection "power-functions" }
+{ $subsection "trig-hyp-functions" } ;
+
+ARTICLE: "arithmetic-functions" "Arithmetic functions"
+"Computing additive and multiplicative inverses:"
+{ $subsection neg }
+{ $subsection recip }
+"Rounding:"
+{ $subsection ceiling }
+{ $subsection floor }
+{ $subsection truncate } ;
+
+ARTICLE: "power-functions" "Powers and logarithms"
+"Squares:"
+{ $subsection sq }
+{ $subsection sqrt }
+"Exponential and natural logarithm:"
+{ $subsection exp }
+{ $subsection cis }
+{ $subsection log }
+"Raising a number to a power:"
+{ $subsection ^ } ;
+
+ARTICLE: "trig-hyp-functions" "Trigonometric and hyperbolic functions"
+"Trigonometric functions:"
+{ $subsection cos }
+{ $subsection sin }
+{ $subsection tan }
+"Reciprocals:"
+{ $subsection sec }
+{ $subsection cosec }
+{ $subsection cot }
+"Inverses:"
+{ $subsection acos }
+{ $subsection asin }
+{ $subsection atan }
+"Inverse reciprocals:"
+{ $subsection asec }
+{ $subsection acosec }
+{ $subsection acot }
+"Hyperbolic functions:"
+{ $subsection cosh }
+{ $subsection sinh }
+{ $subsection tanh }
+"Reciprocals:"
+{ $subsection sech }
+{ $subsection cosech }
+{ $subsection coth }
+"Inverses:"
+{ $subsection acosh }
+{ $subsection asinh }
+{ $subsection atanh }
+"Inverse reciprocals:"
+{ $subsection asech }
+{ $subsection acosech }
+{ $subsection acoth } ;
+
+ARTICLE: "math-constants" "Constants"
+{ $subsection i }
+{ $subsection -i }
+{ $subsection e }
+{ $subsection pi }
+{ $subsection most-positive-fixnum }
+{ $subsection most-negative-fixnum } ;
+
+ARTICLE: "math-vectors" "Vector arithmetic"
+"Any Factor sequence can be used to represent a mathematical vector."
+$terpri
+"Acting on vectors by a scalar:"
+{ $subsection vneg }
+{ $subsection v*n }
+{ $subsection n*v }
+{ $subsection v/n }
+{ $subsection n/v }
+"Combining two vectors to form another vector using " { $link 2map } ":"
+{ $subsection v+ }
+{ $subsection v- }
+{ $subsection v* }
+{ $subsection v/ }
+{ $subsection vmax }
+{ $subsection vmin }
+"Inner product and norm:"
+{ $subsection v. }
+{ $subsection norm }
+{ $subsection norm-sq }
+{ $subsection normalize } ;
diff --git a/doc/handbook/objects.facts b/doc/handbook/objects.facts
new file mode 100644
index 0000000000..e9149b67ad
--- /dev/null
+++ b/doc/handbook/objects.facts
@@ -0,0 +1,189 @@
+USING: generic help kernel lists sequences ;
+GLOSSARY: "object" "a datum which may appear on the stack" ;
+
+ARTICLE: "objects" "Objects"
+"Objects model data in Factor. Objects have unique identity, and either hold intrinsic value -- for example, an integer object -- or are composed from named slots, each slot holding an object."
+{ $subsection "equality" }
+{ $subsection "generic" }
+{ $subsection "classes" }
+{ $subsection "tuples" } ;
+
+GLOSSARY: "equal" "two objects are equal if they have the same class and if their slots are equal, or alternatively, if both are numbers denoting the same value" ;
+
+ARTICLE: "equality" "Equality and comparison testing"
+"There are two distinct notions of ``sameness'' when it comes to objects. You can test if two references point to the same object, or you can test if two objects are equal in some sense, usually by being instances of the same class, and having equal slot values. Both notions of equality are equality relations in the mathematical sense."
+{ $subsection eq? }
+{ $subsection = }
+"Some types of objects also have an intrinsic order allowing sorting using " { $link natural-sort } ":"
+{ $subsection <=> }
+"An object can be cloned; the clone has distinct identity but equal value:"
+{ $subsection clone } ;
+
+GLOSSARY: "generic word" "a word defined via the " { $link POSTPONE: GENERIC: } " or " { $link POSTPONE: G: } " parsing word. A generic word is comprised of a set of methods and a method combination. Methods are keyed by classes, and the method combination determines which stack element is inspected and which methods are called when the generic word executes." ;
+
+GLOSSARY: "method"
+"gives the behavior of a generic word when dispatching on a specific class" ;
+
+ARTICLE: "generic" "Generic words and methods"
+"A generic word's behavior depends on the class of the object at the top of the stack, although this can be generalized using custom method combination. A specific behavior of a generic word on a class is called a " { $emphasis "method" } "."
+$terpri
+"The key advantage of a generic word over a set of conditional tests is that methods are defined in a decentralized manner, thus adding new methods does not force unnecessary coupling between code."
+$terpri
+"In the overwhelming majority of cases, your interaction with the generic word system centers on two parsing words:"
+{ $subsection POSTPONE: GENERIC: }
+{ $subsection POSTPONE: M: }
+"Since classes are not linearly ordered, method ordering is an issue to keep in mind."
+{ $subsection "method-order" }
+{ $subsection "method-combination" } ;
+
+ARTICLE: "method-order" "Method ordering"
+"If two classes have a non-empty intersection, there is no guarantee that one is a subclass of the other. This means there is no canonical linear ordering of classes."
+$terpri
+"Consider the following set of definitions:"
+{ $code
+ "GENERIC: explain"
+ "M: general-t explain drop \"a true value\" print ;"
+ "M: general-list explain drop \"a list\" print ;"
+ "M: object explain drop \"an object\" print ;"
+}
+"Neither " { $link general-t } " nor " { $link general-list } " contains the other, yet their intersection is the non-empty " { $link cons } " class. So the generic word system will place " { $link object } " first in the method order, however either " { $link general-t } " or " { $link general-list } " may come next, and it is pretty much a random choice that depends on hashing:"
+{ $example "\\ bar order ." "{ object general-list general-t }" }
+"Therefore, the outcome of calling " { $snippet "bar" } " with a cons cell as input is undefined."
+$terpri
+"As you can see above, the " { $link order } " word can be useful to clarify method dispatch."
+{ $subsection order } ;
+
+GLOSSARY: "method combination" "control flow glue between methods in a generic word" ;
+
+ARTICLE: "method-combination" "Method combination"
+"Abstractly, a generic word can be thought of as a big chain of type conditional tests applied to the top of the stack, with methods as the bodies of each test. The " { $emphasis "method combination" } " is this control flow glue between the set of methods, and several aspects of it can be customized:"
+{ $list
+ "which stack item(s) the generic word dispatches upon,"
+ "which methods out of the set of applicable methods are called"
+}
+"The " { $link POSTPONE: GENERIC: } " parsing word creates a generic word using the " { $emphasis "simple method combination" } ". Most generic words that come up in practice use this method combination:"
+{ $subsection simple-combination }
+"The " { $link POSTPONE: G: } " parsing word allows a different method combination to be specified:"
+{ $subsection POSTPONE: G: }
+"The simple method combination is a special case of the standard method combination:"
+{ $subsection standard-combination }
+"Another combination for arithmetic operators:"
+{ $subsection math-combination }
+"If nothing else will do:"
+{ $subsection "custom-combination" } ;
+
+ARTICLE: "custom-combination" "Custom method combination"
+"Developing a custom method combination requires a good understanding of higher-order programming (code that writes code) and Factor internals. Custom method combination has not been fully explored at this stage of Factor development, and this section can only give a brief sketch of what is involved."
+$terpri
+"A method combination quotation has stack effect " { $snippet "( word -- quot )" } "."
+$terpri
+"Generic words can be introspected:"
+{ $subsection methods }
+"Code generation utilities:"
+{ $subsection alist>quot }
+{ $subsection curry }
+"Generic word generation utilities:"
+{ $subsection class-predicates }
+{ $subsection simplify-alist }
+{ $subsection math-upgrade }
+{ $subsection object-method } ;
+
+GLOSSARY: "class" "a set of objects on which generic words can specialize methods" ;
+
+ARTICLE: "classes" "Classes"
+"A class is a set of objects on which generic words can specialize methods. Each class has a membership predicate named after the class with a \"?\" suffix, with the following two exceptions:"
+{ $list
+ { { $link object } " - there is no need for a predicate word, since every object is an instance of this class" }
+ { { $link general-t } " - there is no need for a predicate word, since the " { $link if } " combinator makes an implicit test for instances of this class" }
+}
+{ $subsection object }
+{ $subsection "builtin-classes" }
+{ $subsection "unions" }
+{ $subsection "predicates" }
+{ $subsection "class-operations" } ;
+
+GLOSSARY: "type" "an object invariant that describes its shape. An object's type is constant for the lifetime of the object, and there is only a fixed number of types built-in to the run-time. See class" ;
+
+GLOSSARY: "built-in class" "see type" ;
+
+ARTICLE: "builtin-classes" "Built-in classes"
+"Every object is an instance of to exactly one type, and the type is constant for the lifetime of the object. There is only a fixed number of types built-in to the run-time, and corresponding to each type is a " { $emphasis "built-in class" } ":"
+{ $code
+ "alien"
+ "array"
+ "bignum"
+ "byte-array"
+ "complex"
+ "cons"
+ "displaced-alien"
+ "dll"
+ "f"
+ "fixnum"
+ "float"
+ "ratio"
+ "sbuf"
+ "string"
+ "t"
+ "tuple"
+ "vector"
+ "word"
+ "wrapper"
+}
+{ $subsection type }
+{ $subsection class } ;
+
+GLOSSARY: "union" "a class whose set of instances is the union of the set of instances of a list of member classes" ;
+
+ARTICLE: "unions" "Union classes"
+"An object is an instance of a union class if it is an instance of one of its members. Union classes are used to associate the same method with several different classes, as well as to conveniently define predicates."
+{ $subsection POSTPONE: UNION: }
+{ $subsection define-union }
+{ $subsection union } ;
+
+GLOSSARY: "predicate" "a word with stack effect " { $snippet "( object -- ? )" } ", or alternatively, a class whose instances are the instances of a superclass that satisfy an arbitrary predicate" ;
+
+ARTICLE: "predicates" "Predicate classes"
+"Predicate classes allow fine-grained control over method dispatch."
+{ $subsection POSTPONE: PREDICATE: }
+{ $subsection define-predicate-class }
+{ $subsection predicate } ;
+
+ARTICLE: "class-operations" "Class operations"
+{ $subsection class< }
+{ $subsection class-compare }
+{ $subsection class-and }
+{ $subsection types } ;
+
+ARTICLE: "tuples" "Tuples"
+"Tuples are user-defined classes composed of named slots. All tuples have the same type, however distinct classes of tuples are defined."
+$terpri
+"A parsing word defines tuple classes."
+{ $subsection POSTPONE: TUPLE: }
+{ $subsection "tuple-constructors" }
+{ $subsection "tuple-delegation" } ;
+
+GLOSSARY: "constructor" "a word whose primary role is to create new instances of a class" ;
+
+ARTICLE: "tuple-constructors" "Constructors and slots"
+"New instances of tuple classes are created by calling a constructor word, whose name is the tuple's name surrounded by angle brackets:"
+{ $code "TUPLE: point x y z ;\n1 2 3 " }
+"The default constructor stores stack elements into consecutive slots, with the top of the stack going into the rightmost slot."
+$terpri
+"After construction, slots are read and written using various automatically-defined words with names of the form " { $snippet { $emphasis "class-slot" } } " and " { $snippet "set-" { $emphasis "class-slot" } } "."
+$terpri
+"Custom constructors can be defined:"
+{ $subsection POSTPONE: C: } ;
+
+GLOSSARY: "delegate" "an object acting as a sink for unhandled method calls on behalf of another object" ;
+
+ARTICLE: "tuple-delegation" "Delegation"
+"Each tuple can have an optional delegate tuple. Most generic words called on the tuple that do not have a method for the tuple's class will be passed on to the delegate."
+$terpri
+"More precisely, any generic word using " { $link simple-combination } " delegates, and this includes all generic words defined via the " { $link POSTPONE: GENERIC: } " parsing word."
+$terpri
+"Factor uses delegation in place of implementation inheritance, but it is not a direct substitute; in particular, the semantics differ in that a delegated method call receives the delegate on the stack, not the original object."
+{ $warning "Delegation to objects that are not tuples is not fully supported. Generic words support delegation to arbitrary types, as do slot accessors which are built from generic words. However, type-specific primitives do not." }
+{ $subsection delegate }
+{ $subsection set-delegate }
+"There is a combinator to recursively apply a predicate to a delegate chain:"
+{ $subsection is? } ;
diff --git a/doc/handbook/parser.facts b/doc/handbook/parser.facts
new file mode 100644
index 0000000000..b039a3f188
--- /dev/null
+++ b/doc/handbook/parser.facts
@@ -0,0 +1,121 @@
+USING: help io parser words ;
+
+ARTICLE: "parser" "The parser"
+"This section concerns itself with reflective access and extension of the Factor parser. The parser algorithm and standard syntax is described in " { $link "syntax" } ". Before the parser proper is documented, we draw attention to a set of words for parsing numbers. They are called by the parser, and are useful in their own right."
+$terpri
+"The set of words making up the parser are found in the " { $snippet "parser" } " and " { $snippet "syntax" } " vocabularies."
+$terpri
+"As documented in " { $link "vocabulary-search" } ", the parser looks up words in the vocabulary search path. New word definitions are added to the current vocabulary. These two parameters are stored in a pair of variables:"
+{ $subsection use }
+{ $subsection in }
+"There are two simple ways to call the parser:"
+{ $subsection parse }
+{ $subsection eval }
+"More sophisticated facilities exist, too."
+{ $subsection "parse-stream" }
+{ $subsection "parsing-words" } ;
+
+ARTICLE: "parse-stream" "Parsing from streams"
+"By convention, words for parsing input from streams use a certain default vocabulary search path:"
+{ $subsection file-vocabs }
+"The central word for parsing input from a stream:"
+{ $subsection parse-stream }
+"Utilities for working with files:"
+{ $subsection parse-file }
+{ $subsection run-file }
+"Utilities for working with Factor libarary files:"
+{ $subsection resource-path }
+{ $subsection parse-resource }
+{ $subsection run-resource } ;
+
+ARTICLE: "parsing-words" "Parsing words"
+"Parsing words execute at parse time, and therefore can access and modify the state of the parser, as well as add objects to the parse tree. Parsing words are a difficult concept to grasp, so this section has several examples and explains the workings of some of the parsing words provided in the library."
+$terpri
+"Parsing words are marked by suffixing the definition with a declaration:"
+{ $subsection POSTPONE: parsing }
+{ $subsection "parsing-word-nest" }
+{ $subsection "reading-ahead" }
+{ $subsection "defining-words" }
+{ $subsection "string-mode" } ;
+
+ARTICLE: "parsing-word-nest" "Nested structure"
+"The first thing to look at is how the parse tree is built. When parsing begins, the empty list is pushed on the data stack; whenever the parser algorithm appends an object to the parse tree, it conses the object onto the quotation at the top of the stack. This builds the quotation in reverse order, so when parsing is done, the quotation is reversed before it is called."
+$terpri
+"Lets look at a simple example; the parsing of " { $snippet "1 2 3" } ":"
+$terpri
+{ $list
+ { "Token: " { $snippet "1" } " - stack: " { $snippet "[ 1 ]" } }
+ { "Token: " { $snippet "2" } " - stack: " { $snippet "[ 2 1 ]" } }
+ { "Token: " { $snippet "3" } " - stack: " { $snippet "[ 3 2 1 ]" } }
+}
+"Once the end of the string has been reached, the quotation is reversed, leaving the following output:"
+{ $code "[ 1 2 3 ]" }
+"Nested structure is a bit more involved. The basic idea is that parsing words can push an empty list on the stack, then all subsequent tokens are consed onto this list, until another parsing word adds this list to the list underneath."
+$terpri
+"The parsing words that delimit the beginning and the end of a quotation illustrate the idiom:"
+{ $subsection POSTPONE: [ }
+{ $subsection POSTPONE: ] }
+"Let us ponder, then, how one particular string will parse::"
+{ $snippet "\"1 [ 2 3 ] 4\"" }
+{ $list
+ { "Token: " { $snippet "1" } " - stack: " { $snippet "[ 1 ]" } }
+ { "Token: " { $snippet "[" } " - stack: " { $snippet "[ ] [ 1 ]" } }
+ { "Token: " { $snippet "2" } " - stack: " { $snippet "[ 2 ] [ 1 ]" } }
+ { "Token: " { $snippet "3" } " - stack: " { $snippet "[ 3 2 ] [ 1 ]" } }
+ { "Token: " { $snippet "]" } " - stack: " { $snippet "[ [ 2 3 ] 1 ]" } }
+ { "Token: " { $snippet "4" } " - stack: " { $snippet "[ 4 [ 2 3 ] 1 ]" } }
+}
+"Having done all that, the parser reverses the original quotation, and the expected output is now on the stack:"
+{ $code "[ 1 [ 2 3 ] 4 ]" }
+"Notice how in the definition of the list parsing words, the final word " { $link POSTPONE: ] } " does all the work. A closely related set of parsing words for reading various other literal types implements another useful idiom."
+$terpri
+"The word set in question consists of various start delimiters, such a " { $link POSTPONE: { } " for arrays and " { $link POSTPONE: H{ } " for hashtables, together with one end delimiter " { $link POSTPONE: } } ". The start words push a quotation in addition to an empty list; the end word reverses the empty list, and applies the quotation to the newly-parsed list; the quotation converts it to the appropriate type of literal."
+{ $subsection POSTPONE: { }
+{ $subsection POSTPONE: H{ }
+{ $subsection POSTPONE: } } ;
+
+GLOSSARY: "reading ahead" "a parsing word reads ahead of it scans following tokens from the input string" ;
+
+ARTICLE: "reading-ahead" "Reading ahead"
+"Parsing words can consume input from the current line to implement various forms of custom syntax."
+{ $subsection scan }
+{ $subsection scan-word }
+"For example, the " { $link POSTPONE: HEX: } " word, for reading hexadecimal literals, uses this facility. It is defined in terms of a lower-level " { $link (BASE) } " word that takes the numerical base on the data stack, but reads the number from the parser and then adds it to the parse tree:"
+{ $subsection POSTPONE: HEX: }
+{ $subsection (BASE) }
+"Another simple example is the " { $link POSTPONE: \ } " word:"
+{ $subsection POSTPONE: \ } ;
+
+ARTICLE: "defining-words" "Defining words"
+"Defining words add definitions to the dictionary without modifying the parse tree. The simplest example is the " { $link POSTPONE: SYMBOL: } " word:"
+{ $subsection POSTPONE: SYMBOL: }
+"The key factor the above definition is " { $link CREATE } ", which reads a token from the input and creates a word with that name. This word is then passed to " { $link define-symbol } "."
+{ $subsection CREATE }
+"Colon definitions are defined in a more elaborate way. The definition of " { $link POSTPONE: : } " introduces the next idiom, and that is building a quotation and then adding a definition using " { $link POSTPONE: ; } "."
+$terpri
+"Recall the colon definition syntax. When the " { $link POSTPONE: : } " word executes, it reads ahead from the input and defines a word. Then, it places a quotation and an empty list on the stack. The parser conses tokens onto the empty list, and the quotation is called by " { $link POSTPONE: ; } "."
+{ $subsection POSTPONE: : }
+{ $subsection POSTPONE: ; }
+"There are additional parsing words whose syntax is delimited by " { $link POSTPONE: ; } ", and they are all implemented in the same way -- first they read some input, then they leave a quotation followed by an empty list on the stack."
+{ $subsection POSTPONE: M: }
+{ $subsection POSTPONE: C: } ;
+
+ARTICLE: "string-mode" "String mode and parser internals"
+"String mode allows custom parsing of tokenized input. For even more esoteric situations, the input text can be accessed directly."
+$terpri
+"String mode is controlled by a boolean variable in the parser scope:"
+{ $subsection string-mode }
+"An illustration of this idiom is found in the " { $link POSTPONE: USING: } " parsing word. It reads a list of vocabularies, terminated by " { $link POSTPONE: ; } ". However, the vocabulary names do not name words, except by coincidence; so string mode is used to read them."
+{ $subsection POSTPONE: USING: }
+"Make note of the quotation that is left in position for " { $link POSTPONE: ; } " to call. It switches off string mode, so that normal parsing can resume, then adds the given vocabularies to the search path."
+$terpri
+"Some additional variables that encapsulate internal parser state:"
+{ $subsection file }
+{ $subsection line-number }
+{ $subsection line-text }
+{ $subsection column }
+"Some utilities used when parsing comments:"
+{ $subsection until }
+{ $subsection until-eol }
+"A utility used when parsing string literals:"
+{ $subsection parse-string } ;
diff --git a/doc/handbook/prettyprinter.facts b/doc/handbook/prettyprinter.facts
new file mode 100644
index 0000000000..ce9567657f
--- /dev/null
+++ b/doc/handbook/prettyprinter.facts
@@ -0,0 +1,65 @@
+USING: help io prettyprint ;
+
+GLOSSARY: "prettyprinter" "a set of words for printing objects in readable form" ;
+
+ARTICLE: "prettyprint" "The prettyprinter"
+"One of Factor's key features is the ability to print almost any object as a valid source literal expression. This greatly aids debugging and provides the building blocks for light-weight object serialization facilities."
+$terpri
+"Prettyprinter words are found in the " { $snippet "prettyprint" } " vocabulary."
+$terpri
+"The key words to print an object to the " { $link stdio } " stream; the first two emit a trailing newline, the second two do not:"
+{ $subsection . }
+{ $subsection short. }
+{ $subsection pprint }
+{ $subsection pprint-short }
+"The string representation of an object can be requested:"
+{ $subsection unparse }
+{ $subsection unparse-short }
+"The prettyprinter is flexible and extensible."
+{ $subsection "prettyprint-limitations" }
+{ $subsection "prettyprint-variables" }
+{ $subsection "prettyprint-extension" }
+;
+
+ARTICLE: "prettyprint-limitations" "Prettyprinter limitations"
+"The prettyprinter has some limitations; namely, the following objects may not print in a readable form:"
+{ $list
+ { "When printing words, no " { $link POSTPONE: USE: } " declarations are output, hence the result may not be immediately readable without prefixing appropriate declarations." }
+ "Shared structure is not reflected in the printed output; if the output is parsed back in, fresh objects are created for all literal denotations."
+ { "Circular structure is not printed in a readable way. Circular references print as " { $snippet "#" } "." }
+ "Floating point numbers might not equal themselves after being printed and read, since a decimal representation of a float is inexact."
+}
+"On a final note, the " { $link short. } ", " { $link pprint-short } " and " { $link unparse-short } " words restrict the length and nesting of printed sequences, their output will very likely not be valid syntax. They are only intended for interactive use." ;
+
+ARTICLE: "prettyprint-variables" "Prettyprint control variables"
+"The following variables affect the " { $link . } " and " { $link pprint } " words if set in the current dynamic scope:"
+{ $subsection tab-size }
+{ $subsection margin }
+{ $subsection nesting-limit }
+{ $subsection length-limit }
+{ $subsection line-limit }
+{ $subsection string-limit }
+"Note that the " { $link short. } " and " { $link pprint-short } " variables override some of these variables."
+{
+ $warning "Treat the global variables as essentially being constants. Only ever rebind them in a nested scope."
+ $terpri
+ "Some of the globals are safe to change, like the tab size and wrap margin. However setting limits globally could break code which uses the prettyprinter as a serialization mechanism."
+} ;
+
+ARTICLE: "prettyprint-extension" "Extending the prettyprinter"
+"It is possible to define literal syntax for a new class using the " { $link "parser" } ", and then define a corresponding prettyprint method for the class which reproduces the literal syntax."
+$terpri
+"The prettyprinter maintains some internal state while prettyprinting. First, the object graph is traversed and a tree of " { $emphasis "sections" } " is produced. A section is either a text node or a " { $emphasis "block" } " which itself consists of sections."
+$terpri
+"Once the output is divided into sections, the tree is traversed and intelligent decisions are made about indentation and line breaks. If a block does not fit on the remainder of the current line, a newline is output before and after the block, and additional indentation is used when printing the block."
+$terpri
+"The following generic word is called to output a prettyprinting section for an object:"
+{ $subsection pprint* }
+"Two types of leaf sections:"
+{ $subsection text }
+{ $subsection newline }
+"Nesting and denesting is done using three words. There are two words to denest a block; they vary in indentation policy:"
+{ $subsection }
+{ $subsection block; }
+"Recall that since " { $link text } " sections take style hashtables as input, any type of formatted text can be output, including presentations. See " { $link "styles" } " to explore the possibility." ;
diff --git a/doc/handbook/sequences.facts b/doc/handbook/sequences.facts
new file mode 100644
index 0000000000..68a35edc7b
--- /dev/null
+++ b/doc/handbook/sequences.facts
@@ -0,0 +1,294 @@
+IN: sequences
+USING: arrays help kernel kernel-internals sequences-internals
+strings vectors words ;
+
+GLOSSARY: "sequence"
+"a linearly-ordered finite collection of elements responding to the " { $link "sequence-protocol" "sequence protocol" } "." ;
+
+ARTICLE: "sequences" "Sequences"
+"A sequence is a linearly-ordered finite collection of elements."
+$terpri
+"Sequence utility words can operate on any object whose class implements the sequence protocol."
+{ $subsection "sequence-protocol" }
+"There are a number of implementations of sequences in the core library, and you can write new implementations yourself."
+{ $subsection "sequence-implementations" }
+"Much of the power of sequences lies in the polymorphic utility words that allow computations to be expressed as bulk operations without loops, recursion or micro-management of elements."
+{ $subsection "sequences-utilities" }
+{ $subsection "sequences-iteration" }
+{ $subsection "sequences-tests" }
+{ $subsection "sequences-adding" }
+{ $subsection "sequences-indices" }
+{ $subsection "sequences-sets" }
+{ $subsection "sequences-slicing" }
+{ $subsection "sequences-sorting" }
+{ $subsection "sequences-stacks" }
+{ $subsection "sequences-comparing" }
+"Some implementation details which your code should probably not care about:"
+{ $subsection "sequences-unsafe" }
+{ $subsection "sequences-growable" }
+{ $see-also "namespaces-make" } ;
+
+ARTICLE: "sequence-implementations" "Sequence implementations"
+"There are two main categories of sequences. Concrete sequences are backed by actual storage:"
+{ $subsection "arrays" }
+{ $subsection "vectors" }
+{ $subsection "strings" }
+{ $subsection "sbufs" }
+"Virtual sequences wrap an underlying sequence to present an alternative view of its elements:"
+{ $subsection }
+{ $subsection reverse-slice }
+"Integers support the sequence protocol:"
+{ $subsection "sequences-integers" } ;
+
+ARTICLE: "sequences-integers" "Integer sequences and counted loops"
+"Integers support the sequence protocol in a trivial fashion; a non-negative integer presents its non-negative predecessors as elements. For example, the integer 3, when viewed as a sequence, contains the elements 0, 1, and 2. This is very useful for performing counted loops."
+$terpri
+"For example, the " { $link each } " combinator, given an integer, simply calls a quotation that number of times, pushing a counter on each iteration that ranges from 0 up to that integer:"
+{ $example "3 [ . ] each" "0\n1\n2" }
+"A common idiom is to iterate over a sequence, while also maintaining a loop counter. This can be done using " { $link 2each } ":"
+{ $example "{ \"a\" \"b\" \"c\" } dup length [\n \"Index: \" write . \"Element: \" write .\n] 2each" "Index: 0\nElement: \"a\"\nIndex: 1\nElement: \"b\"\nIndex: 2\nElement: \"c\"" }
+"Combinators that produce new sequences, such as " { $snippet map } ", will output an array if the input is an integer." ;
+
+GLOSSARY: "slice" "an instance of the " { $link slice } " class, which is a virtual sequence sharing structure with a subrange of some underlying sequence" ;
+
+ARTICLE: "sequences-utilities" "Basic utilities"
+"Some utilities for accessing various common indices:"
+{ $subsection first }
+{ $subsection second }
+{ $subsection third }
+{ $subsection fourth }
+{ $subsection first2 }
+{ $subsection first3 }
+{ $subsection first4 }
+"A forgiving wrapper for " { $link nth } ":"
+{ $subsection ?nth }
+{ $subsection bounds-check? } ;
+
+ARTICLE: "sequences-iteration" "Iteration and collection"
+"Iteration combinators:"
+{ $subsection each }
+{ $subsection reduce }
+{ $subsection interleave }
+{ $subsection 2each }
+{ $subsection 2reduce }
+"Collection combinators:"
+{ $subsection map }
+{ $subsection 2map }
+"A combinator that modifies elements in-place:"
+{ $subsection inject } ;
+
+ARTICLE: "sequences-tests" "Testing sequences"
+{ $subsection empty? }
+{ $subsection member? }
+{ $subsection memq? }
+{ $subsection head? }
+{ $subsection tail? }
+{ $subsection subseq? }
+{ $subsection contains? }
+{ $subsection all? }
+{ $subsection monotonic? }
+{ $subsection all-eq? }
+{ $subsection all-equal? } ;
+
+ARTICLE: "sequences-slicing" "Slicing and splitting"
+"The first set of words are concerned with taking subsequences of a sequence. Each of the below words comes in dual pairs; the first of the pair outputs a new copied sequence, the second outputs a virtual sequence sharing structure with the underlying sequence."
+{ $subsection subseq }
+{ $subsection }
+{ $subsection head }
+{ $subsection head-slice }
+{ $subsection tail }
+{ $subsection tail-slice }
+{ $subsection head* }
+{ $subsection head-slice* }
+{ $subsection tail* }
+{ $subsection tail-slice* }
+"Finally, some words for splitting sequences."
+{ $subsection ?head }
+{ $subsection ?tail }
+{ $subsection group }
+{ $subsection (split1) }
+{ $subsection split1 }
+{ $subsection split }
+{ $subsection unpair } ;
+
+ARTICLE: "sequences-indices" "Order-sensitive operations"
+"Searching for the index of an element and or beginning of a subsequence:"
+{ $subsection index }
+{ $subsection index* }
+{ $subsection start }
+{ $subsection start* }
+"Two combinators the above are based on:"
+{ $subsection find }
+{ $subsection find* }
+"Memoization:"
+{ $subsection cache-nth } ;
+
+ARTICLE: "sequences-adding" "Adding and appending"
+"New sequences can be constructed by adding elements to existing sequences."
+{ $subsection add }
+{ $subsection append }
+{ $subsection append3 }
+{ $subsection concat }
+{ $subsection join }
+"Mutable sequences can have elements added in-place."
+{ $subsection push }
+{ $subsection nappend }
+"Subsequences can be replaced:"
+{ $subsection replace-slice }
+{ $subsection copy-into } ;
+
+ARTICLE: "sequences-sets" "Order-insensitive operations"
+"New sequences can be constructed by removing elements from an existing sequence:"
+{ $subsection remove }
+{ $subsection diff }
+"Mutable sequences can have elements removed in-place:"
+{ $subsection delete }
+"A combinator for filtering on arbitrary predicates:"
+{ $subsection subset } ;
+
+ARTICLE: "sequences-stacks" "Stack operations"
+"The classical stack operations, modifying a sequence in place:"
+{ $subsection empty? }
+{ $subsection peek }
+{ $subsection push }
+{ $subsection pop }
+{ $subsection pop* }
+"Lazy instantiation of stacks:"
+{ $subsection ?push } ;
+
+ARTICLE: "sequences-comparing" "Comparing sequences"
+"Element equality:"
+{ $subsection sequence= }
+{ $subsection mismatch }
+"Lexicographic order:"
+{ $subsection <=> } ;
+
+GLOSSARY: "resizable sequence"
+"a sequence implementing the " { $link set-length } " generic word. For example, vectors and string buffers" ;
+
+GLOSSARY: "mutable sequence"
+"a sequence implementing the " { $link set-nth } " generic word. For example, arrays and strings" ;
+
+ARTICLE: "sequence-protocol" "Sequence protocol"
+"All sequences must know their length, and provide a way to access elements:"
+{ $subsection length }
+{ $subsection nth }
+"Mutable sequences:"
+{ $subsection set-nth }
+"Resizable sequences:"
+{ $subsection set-length }
+"An optional generic word for creating sequences of the same class as a given sequence:"
+{ $subsection like }
+"Another optional generic word for optimization purposes:"
+{ $subsection thaw } ;
+
+GLOSSARY: "array"
+"an instance of the" { $link array } "class, implementing a fixed-length mutable sequence of objects" ;
+
+ARTICLE: "arrays" "Arrays"
+"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "syntax-arrays" } ". Sometimes you need a growable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "."
+$terpri
+"Array words are in the " { $snippet "arrays" } " vocabulary. Unsafe implementation words are in the " { $snippet "kernel-internals" } " vocabulary."
+$terpri
+"Arrays form a class of objects."
+{ $subsection array }
+{ $subsection array? }
+"There are several ways to construct arrays."
+{ $subsection >array }
+{ $subsection }
+{ $subsection 1array }
+{ $subsection 2array }
+{ $subsection 3array }
+"Arrays can be accessed without bounds checks in a pointer unsafe way."
+{ $subsection array-nth }
+{ $subsection set-array-nth } ;
+
+GLOSSARY: "string" "an instance of the " { $link "string" } " class, representing a fixed-size mutable sequence of characters" ;
+
+GLOSSARY: "character" "an integer between 0 and 63335, inclusive" ;
+
+ARTICLE: "strings" "Strings"
+"A string is a fixed-size mutable sequence of characters."
+$terpri
+"String words are found in the " { $snippet "strings" } " vocabulary."
+{ $subsection string? }
+{ $subsection >string }
+{ $subsection }
+"A pair of words are used to nicely format columns of text."
+{ $subsection pad-left }
+{ $subsection pad-right }
+"Characters are not a first-class type; they are simply represented as integers between 0 and 65535. A few words operate on characters:"
+{ $subsection blank? }
+{ $subsection letter? }
+{ $subsection LETTER? }
+{ $subsection digit? }
+{ $subsection printable? }
+{ $subsection control? }
+{ $subsection quotable? }
+{ $subsection ch>lower }
+{ $subsection ch>upper } ;
+
+GLOSSARY: "string buffer" "an instance of the " { $link "sbuf" } " class, representing a mutable and growable sequence of characters" ;
+
+GLOSSARY: "sbuf" "see string buffer" ;
+
+ARTICLE: "sbufs" "String buffers"
+"A string buffer is a resizable mutable sequence of characters. String buffers can be used to construct new strings by accumilating substrings and characters, however usually they are only used indirectly, since the sequence construction words are more convenient to use in most cases (see " { $link "sequences-make" } ")."
+$terpri
+"String buffer words are found in the " { $snippet "strings" } " vocabulary."
+{ $subsection sbuf? }
+{ $subsection >sbuf }
+{ $subsection } ;
+
+GLOSSARY: "vector" "an instance of the " { $link "vector" } " class, representing a resizable mutable sequence of objects" ;
+
+ARTICLE: "vectors" "Vectors"
+"A vector is a resizable mutable sequence of objects. Vector words are found in the " { $snippet "vectors" } " vocabulary."
+{ $subsection vector? }
+{ $subsection >vector }
+{ $subsection } ;
+
+GLOSSARY: "comparator"
+"a quotation with stack effect " { $snippet "( elt1 elt2 -- n )" } " that orders the two given elements and outputs a value whose sign denotes the result. See " { $link "sequence-sorting" } ;
+
+ARTICLE: "sequences-sorting" "Sorting and binary search"
+"Sorting and binary search combinators all take comparator quotations with stack effect " { $snippet "( elt1 elt2 -- n )" } " that order the two given elements and output a value whose sign denotes the result:"
+{ $list
+ { "positive - indicates that " { $snippet "elt1" } " follows " { $snippet "elt2" } }
+ { "zero - indicates that " { $snippet "elt1" } " is ordered equivalently to " { $snippet "elt2" } }
+ { "negative - indicates that " { $snippet "elt1" } " precedes " { $snippet "elt2" } }
+}
+"In-place sorting:"
+{ $subsection nsort }
+"Sorting elements in a new sequence:"
+{ $subsection sort }
+"Using the default comparator:"
+{ $subsection natural-sort } ;
+
+ARTICLE: "sequences-unsafe" "Unsafe sequence operations"
+"The unsafe sequence protocol bypasses bounds checks for increased performance:"
+{ $subsection nth-unsafe }
+{ $subsection set-nth-unsafe }
+"These words assume the sequence index given is within bounds; if it is not, memory corruption can occur. Please think twice before using them; first, make sure the code in question is actually a bottleneck; next, try improving the algorithm first. If all else fails, then use these words and test your code very carefully."
+$terpri
+"There is a very important invariant these word must preserve: if at some point in time, the length of a sequence was " { $snippet "n" } ", then any future lookups of elements with indices below " { $snippet "n" } " must not crash the runtime, even if the sequence length is now less than " { $snippet "n" } ". For example, vectors preserve this invariant by never shrinking the underlying storage, only growing it as necessary."
+$terpri
+"The justification for this is that the runtime should not crash if a resizable sequence is resized during the execution of an iteration combinator."
+$terpri
+"Indeed, iteration combinators are the primary use-case for these words; if the iteration index is already guarded by a loop test which ensures it is within bounds, then additional bounds checks are redundant. For example, see the implementation of " { $link each } "." ;
+
+ARTICLE: "sequences-growable" "Growable sequence protocol"
+"Growable sequences are implementing by having a wrapper object hold a reference to an underlying sequence, together with a fill pointer indicating how many elements of the underlying sequence are occupied. When the fill pointer exceeds the underlying sequence capacity, the underlying sequence grows."
+$terpri
+"There is a growable sequence protocol:"
+{ $subsection underlying }
+{ $subsection set-underlying }
+{ $subsection set-fill }
+"Any instance of a class implementing the above generics can make use of several utility words:"
+{ $subsection capacity }
+{ $subsection ensure }
+{ $subsection grow-length }
+{ $subsection clone-growable }
+"This protocol and the above words are unsafe; they do not perform bounds checks for performance reasons, and thus a mistake can lead to memory corruption due to an underlying sequence being shorter than the fill pointer."
+$terpri
+"Vectors and string buffers are implemented using the growable sequence facility (and they perform full bounds-checks and thus are safe)." ;
diff --git a/doc/handbook/streams.facts b/doc/handbook/streams.facts
new file mode 100644
index 0000000000..16bf07225a
--- /dev/null
+++ b/doc/handbook/streams.facts
@@ -0,0 +1,195 @@
+USING:
+help
+io
+styles ;
+
+GLOSSARY: "stream" "an endpoint for input/output operations, supporting the " { $link "stream-protocol" } ;
+
+ARTICLE: "streams" "Streams"
+"Input and output centers on the concept of a " { $emphasis "stream" } ", which is a source or sink of characters. Streams also support formatted output, which may be used to present styled text in a manner independent of output medium."
+$terpri
+"Stream words are in the " { $snippet "io" } " vocabulary."
+{ $subsection "stream-protocol" }
+{ $subsection "stream-utils" }
+{ $subsection "stdio" }
+{ $subsection "styles" }
+{ $subsection "stream-binary" }
+{ $subsection "stream-impls" }
+;
+
+GLOSSARY: "input stream" "an object responding to the input words of the " { $link "stream-protocol" } ;
+
+GLOSSARY: "output stream" "an object responding to the output words of the " { $link "stream-protocol" } ;
+
+GLOSSARY: "bidirectional stream" "an object that is both an input and output stream" ;
+
+ARTICLE: "stream-protocol" "Stream protocol"
+"The stream protocol consits of a large number of generic words, many of which are optional."
+$terpri
+"A word required to be implemented for all streams:"
+{ $subsection stream-close }
+"Three words are required for input streams:"
+{ $subsection stream-read1 }
+{ $subsection stream-read }
+{ $subsection stream-readln }
+"If your stream supports the first two but not the last one, wrap it in a " { $link } " to get a default implementation."
+$terpri
+"Seven words are required for output streams:"
+{ $subsection stream-flush }
+{ $subsection stream-write1 }
+{ $subsection stream-write }
+{ $subsection stream-terpri }
+{ $subsection stream-format }
+{ $subsection with-nested-stream }
+"If your stream supports the first three but not the rest, wrap it in a " { $link } ", which provides plain text implementations of the stream formatting words (the so called " { $emphasis "extended stream output protocol" } ")." ;
+
+ARTICLE: "stream-utils" "Stream utilities"
+"There are a few useful stream-related words which are not generic, but merely built up from the stream protocol."
+$terpri
+"First, a simple composition of " { $link stream-write } " and " { $link stream-terpri } ":"
+{ $subsection stream-print }
+"Next up, a pair of words for reading the entire contents of a stream as an array of lines, or a single string:"
+{ $subsection lines }
+{ $subsection contents }
+"Finally, a word to copy the contents of one stream to another:"
+{ $subsection stream-copy } ;
+
+GLOSSARY: "default stream" "see " { $link stdio } ;
+
+ARTICLE: "stdio" "The default stream"
+"Various words take an implicit stream parameter from the " { $link stdio } " variable to reduce stack shuffling. Unless rebound in a child namespace, this variable will be set to a console stream for interacting with the user."
+{ $link close }
+{ $subsection read1 }
+{ $subsection read }
+{ $subsection readln }
+{ $subsection flush }
+{ $subsection write1 }
+{ $subsection write }
+{ $subsection print }
+{ $subsection terpri }
+{ $subsection format }
+{ $subsection with-nesting }
+"A pair of combinators support rebinding the " { $link stdio } " variable:"
+{ $subsection with-stream }
+{ $subsection with-stream* } ;
+
+ARTICLE: "styles" "Formatted output"
+"The " { $link stream-format } " and " { $link with-nested-stream } " words take a hashtable of style attributes. The former acts on character styles, and the latter acts on paragraph styles. Output stream implementations are free to ignore style information."
+$terpri
+"Style hashtables are keyed by symbols from the " { $snippet "styles" } " vocabulary."
+{ $subsection "character-styles" }
+{ $subsection "paragraph-styles" }
+{ $subsection "style-stack" }
+{ $subsection "presentations" } ;
+
+ARTICLE: "character-styles" "Character styles"
+"Character styles for " { $link stream-format } ":"
+{ $subsection foreground }
+{ $subsection background }
+{ $subsection foreground }
+{ $subsection background }
+{ $subsection font }
+{ $subsection font-size }
+{ $subsection font-style }
+{ $subsection presented }
+{ $subsection file } ;
+
+ARTICLE: "paragraph-styles" "Paragraph styles"
+"Paragraph styles for " { $link with-nested-stream } ":"
+{ $subsection page-color }
+{ $subsection border-color }
+{ $subsection border-width }
+{ $subsection wrap-margin }
+{ $subsection outline }
+{ $subsection presented } ;
+
+ARTICLE: "style-stack" "The style stack"
+"The style stack provides a convenient facility for implementing logical nesting of character and paragraph styles."
+$terpri
+"A combinator pushes a style onto the style stack and calls a quotaiton:"
+{ $subsection with-style }
+"The contents of the style stack can be combined to form one style hashtable:"
+{ $subsection current-style }
+"A pair of words corresponding to " { $link format } " and " { $link with-nesting } ", but taking the current style from the style stack:"
+{ $subsection format* }
+{ $subsection with-nesting* } ;
+
+ARTICLE: "presentations" "Presentations and outliners"
+"The " { $link presented } " and " { $link outline } " styles can be used to build sophisticated user interfaces in the Factor UI."
+$terpri
+"Associating the " { $link presented } " character style with a run of text displayed in a pane makes it a clickable presentation of an object. Two useful utility words wrap presentation output:"
+{ $subsection write-object }
+{ $subsection simple-object }
+"Associating the " { $link outline } " paragraph style with a nested block displays it as an expandable outliner gadget, whose contents are lazily generated by a quotation. Two useful utility words wrap outliner output:"
+{ $subsection write-outliner }
+{ $subsection simple-outliner } ;
+
+GLOSSARY: "big endian" "a representation of an integer as a sequence of bytes, ordered from most significant to least significant. This is the native byte ordering for PowerPC processors" ;
+
+GLOSSARY: "little endian" "a representation of an integer as a sequence of bytes, ordered from least significant to most significant. This is the native byte ordering for x86 and AMD64 processors" ;
+
+ARTICLE: "stream-binary" "Working with binary data"
+"The core stream words read and write strings. Packed binary integers can be read and written by converting to and from sequences of bytes. Floating point numbers can be read and written by converting them into a their bitwise integer representation (" { $link "floats" } ")."
+$terpri
+"There are two ways to order the bytes making up an integer; " { $emphasis "little endian" } " byte order outputs the least significant byte first, and the most significant byte last, whereas " { $emphasis "big endian" } " is the other way around."
+$terpri
+"Consider the hexadecimal integer "{ $snippet "HEX: cafebabe" } ". Big endian byte order yields the following sequence of bytes:"
+{ $code
+ "Byte: 1 2 3 4"
+ "Value: be ba fe ca"
+}
+"Compare this with little endian byte order:"
+{ $code
+ "Byte: 1 2 3 4"
+ "Value: ca fe ba be"
+}
+"Two words convert a sequence of bytes into an integer:"
+{ $subsection be> }
+{ $subsection le> }
+"Two words convert an integer into a sequence of bytes:"
+{ $subsection >be }
+{ $subsection >le } ;
+
+ARTICLE: "stream-impls" "Stream implementations"
+"External resource streams communicate with the outside world:"
+{ $subsection "file-streams" }
+{ $subsection "network-streams" }
+"Virtual streams serve as glue:"
+{ $subsection "string-streams" }
+"Wrapper streams convert partial implementations of the stream protocol into full-fledged streams:"
+{ $subsection }
+{ $subsection }
+"A utility to combine a complementary input and output stream pair into a single stream:"
+{ $subsection }
+"As a final note, the " { $link f } " object implements the stream protocol, by yielding end-of-file on input and discarding all output." ;
+
+ARTICLE: "file-streams" "Reading and writing files"
+{ $subsection }
+{ $subsection }
+"File system meta-data:"
+{ $subsection exists? }
+{ $subsection directory? }
+{ $subsection file-length }
+{ $subsection stat } ;
+
+GLOSSARY: "server stream" "a stream listening on a TCP/IP socket" ;
+
+GLOSSARY: "client stream" "a bidirectional stream for an to end-point of a TCP/IP connection" ;
+
+ARTICLE: "network-streams" "TCP/IP networking"
+"Client connections are bidirectional streams opened with this word:"
+{ $subsection }
+"Network servers are implemented by first opening a server socket, then waiting for connections:"
+{ $subsection }
+{ $subsection accept }
+"Some information can be obtained about incoming client connections:"
+{ $subsection client-stream-host }
+{ $subsection client-stream-port } ;
+
+ARTICLE: "string-streams" "String streams"
+"Streams:"
+{ $subsection }
+{ $subsection }
+"Utility combinators:"
+{ $subsection string-in }
+{ $subsection string-out } ;
diff --git a/doc/handbook/syntax.facts b/doc/handbook/syntax.facts
new file mode 100644
index 0000000000..137a13865d
--- /dev/null
+++ b/doc/handbook/syntax.facts
@@ -0,0 +1,257 @@
+USING: help kernel math parser words ;
+
+GLOSSARY: "parser" "a facility for creating objects from printed representations, and for defining words from Factor source code" ;
+
+ARTICLE: "syntax" "Syntax"
+"In Factor, an " { $emphasis "object" } " is a piece of data that can be identified. Code is data, so Factor syntax is actually a syntax for describing objects, of which code is a special case. Factor syntax is read by the parser. The parser performs two kinds of tasks -- it creates objects from their " { $emphasis "printed representations" } ", and it adds " { $emphasis "word definitions" } " to the dictionary (see " { $link "words" } "). The parser can be extended (see " { $link "parser" } ")."
+{ $subsection "parser-algorithm" }
+{ $subsection "vocabulary-search" }
+{ $subsection "syntax-comments" }
+{ $subsection "syntax-literals" } ;
+
+GLOSSARY: "token" "a whitespace-delimited piece of text, the primary unit of Factor syntax" ;
+
+GLOSSARY: "whitespace" "a space (ASCII 32), newline (ASCII 10) or carriage-return (ASCII 13)" ;
+
+GLOSSARY: "string mode" "a parser mode where token are added to the parse tree as strings, without being looked up in the dictionary or converted into numbers first. Activated by switching on the " { $link string-mode } " variable" ;
+
+GLOSSARY: "parsing word" "a word that is run at parse time. Parsing words can be defined by suffixing the compound definition with " { $link POSTPONE: parsing } ". Parsing words have the " { $snippet "parsing" } " word property set to true, and satisfy the " { $link parsing? } " predicate." ;
+
+ARTICLE: "parser-algorithm" "Parser algorithm"
+"At the most abstract level, Factor syntax consists of whitespace-separated tokens. The parser tokenizes the input on whitespace boundaries. The parser is case-sensitive and whitesapce between tokens is significant, so the following three expressions tokenize differently:"
+{ $code "2X+\n2 X +\n2 x +" }
+"As the parser reads tokens it makes a distinction between numbers, ordinary words, and parsing words. Tokens are appended to the parse tree, the top level of which is a list returned by the original parser invocation. Nested levels of the parse tree are created by parsing words."
+$terpri
+"The parser iterates through the input text, checking each character in turn. Here is the parser algorithm in more detail -- some of the concepts therein will be defined shortly:"
+{ $list
+ { "If the current character is a double-quote (\"), the " { $link POSTPONE: " } " parsing word is executed, causing a string to be read." }
+ {
+ "Otherwise, the next token is taken from the input. The parser searches for a word named by the token in the currently used set of vocabularies. If the word is found, one of the following two actions is taken:"
+ { $list
+ "If the word is an ordinary word, it is appended to the parse tree."
+ "If the word is a parsing word, it is executed."
+ }
+ }
+ "Otherwise if the token does not represent a known word, the parser attempts to parse it as a number. If the token is a number, the number object is added to the parse tree. Otherwise, an error is raised and parsing halts."
+}
+"There is one exception to the above process; the parser might be placed in " { $emphasis "string mode" } ", in which case it simply reads tokens and appends them to the parse tree as strings. String mode is activated and deactivated by certain parsing words wishing to read input in an unstructured but tokenized manner -- see " { $link "string-mode" } "."
+$terpri
+"Parsing words play a key role in parsing; while ordinary words and numbers are simply added to the parse tree, parsing words execute in the context of the parser, and can do their own parsing and create nested data structures in the parse tree. Parsing words are also able to define new words."
+$terpri
+"While parsing words supporting arbitrary syntax can be defined, the default set is found in the " { $snippet "syntax" } " vocabulary and provides the basis for all further syntactic interaction with Factor." ;
+
+GLOSSARY: "word" "an object holding a code definition and set of properties. Words are organized into vocabularies, and are uniquely identified by name within a vocabulary" ;
+
+GLOSSARY: "vocabulary" "a collection of words, uniquely identified by name. The hashtable of vocabularies is stored in the " { $link vocabularies } " global variable, and the " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " parsing words add vocabularies to the parser's search path" ;
+
+ARTICLE: "vocabulary-search" "Vocabulary search"
+"A " { $emphasis "word" } " is a code definition identified by a name. Words are sorted into " { $emphasis "vocabularies" } ". Words are discussed in depth in " { $link "words" } "."
+$terpri
+"When the parser reads a token, it attempts to look up a word named by that token. The lookup is performed by searching each vocabulary in the search path, in order."
+$terpri
+"Due to the way the parser works, words cannot be referenced before they are defined; that is, source files must order definitions in a strictly bottom-up fashion. Use the " { $link POSTPONE: DEFER: } " parsing word to get around this limitation, for example when defining mutually-recursive words."
+$terpri
+"For a source file the vocabulary search path starts off with two vocabularies:"
+{ $code "syntax\nscratchpad" }
+"The " { $snippet "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words. The " { $snippet "scratchpad" } " vocabulary is the default vocabulary for new word definitions."
+$terpri
+"At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "."
+$terpri
+"Three parsing words deal with the vocabulary search path:"
+{ $subsection POSTPONE: USE: }
+{ $subsection POSTPONE: USING: }
+{ $subsection POSTPONE: IN: }
+"Here is an example demonstrating the vocabulary search path. If you can understand this example, then you have grasped vocabularies."
+{ $code
+ "IN: foe"
+ "USE: sequences"
+ ""
+ ": append"
+ " #! Prints a message, then calls sequences::append."
+ " \"foe::append calls sequences::append\" print append ;"
+ ""
+ "IN: fee"
+ ""
+ ": append"
+ " #! Loops, calling fee::append."
+ " \"fee::append calls fee::append\" print append ;"
+ ""
+ "USE: foe"
+ ""
+ ": append"
+ " #! Redefining fee::append to call foe::append."
+ " \"fee::append calls foe::append\" print append ;"
+ ""
+ "\"1234\" \"5678\" append print"
+}
+"When placed in a source file and run, the above code produces the following output:"
+{ $code
+ "fee::append calls foe::append"
+ "foe::append calls sequences::append"
+ "12345678"
+} ;
+
+GLOSSARY: "stack effect" "a string of the form " { $snippet "( inputs -- outputs )" } ", where the inputs and outputs are a whitespace-separated list of names or types. The top of the stack is the right-most token on both sides" ;
+
+ARTICLE: "syntax-comments" "Comments"
+"Stack effect comments:"
+{ $subsection POSTPONE: ( }
+"End of line comments:"
+{ $subsection POSTPONE: ! }
+{ $subsection POSTPONE: #! } ;
+
+GLOSSARY: "mutable object" "an object whose slot values can be changed. Mutable built-in types are arrays, strings, vectors, string buffers, and tuples" ;
+
+GLOSSARY: "immutable object" "an object whose slot values cannot be changed. Immutable built-in types are numbers, booleans, and lists" ;
+
+ARTICLE: "syntax-literals" "Literals"
+"Many different types of objects can be constructed at parse time via literal syntax. Numbers are a special case since support for reading them is built-in to the parser. All other literals are constructed via parsing words."
+$terpri
+"If a quotation contains a literal object, the same literal object instance is used each time the quotation executes; that is, literals are ``live''."
+$terpri
+"Using mutable object literals in word definitions requires care, since if those objects are mutated, the actual word definition will be changed, which is in most cases not what you would expect."
+{ $subsection "syntax-numbers" }
+{ $subsection "syntax-words" }
+{ $subsection "syntax-booleans" }
+{ $subsection "syntax-strings" }
+{ $subsection "syntax-sbufs" }
+{ $subsection "syntax-lists" } ;
+
+GLOSSARY: "number" "an instance of the " { $link number } " class" ;
+
+ARTICLE: "syntax-numbers" "Number syntax"
+"If a vocabulary lookup of a token fails, the parser attempts to parse it as a number."
+{ $subsection "syntax-integers" }
+{ $subsection "syntax-ratios" }
+{ $subsection "syntax-floats" }
+{ $subsection "syntax-complex-numbers" } ;
+
+GLOSSARY: "integer" "an instance of the " { $link integer } " class, a fixnum or a bignum" ;
+
+GLOSSARY: "fixnum" "an instance of the " { $link fixnum } " class, representing a fixed precision integer. On 32-bit systems, an element of the interval (-2^-29,2^29], and on 64-bit systems, the interval (-2^-61,2^61]" ;
+
+GLOSSARY: "bignum" "an instance of the " { $link bignum } " class, representing an arbitrary-precision integer whose value is bounded by available object memory" ;
+
+ARTICLE: "syntax-integers" "Integer syntax"
+"The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign."
+{ $code
+ "123456"
+ "-10"
+ "2432902008176640000"
+}
+"Integers are entered in base 10 unless prefixed with a base change parsing word."
+{ $subsection POSTPONE: BIN: }
+{ $subsection POSTPONE: OCT: }
+{ $subsection POSTPONE: HEX: }
+"More information on integers can be found in " { $link "integers" } "." ;
+
+GLOSSARY: "ratio" "an instance of the " { $link ratio } " class, representing an exact ratio of two integers" ;
+
+ARTICLE: "syntax-ratios" "Ratio syntax"
+"The printed representation of a ratio is a pair of integers separated by a slash (/). No intermediate whitespace is permitted. Either integer may be signed, however the ratio will be normalized into a form where the denominator is positive and the greatest common divisor of the two terms is 1."
+{ $code
+ "75/33"
+ "1/10"
+ "-5/-6"
+}
+"More information on ratios can be found in " { $link "rationals" } ;
+
+GLOSSARY: "float" "an instance of the " { $link float } " class, representing an IEEE 754 double-precision floating point number" ;
+
+ARTICLE: "syntax-floats" "Float syntax"
+"Floating point numbers contain an optional decimal part, an optional exponent, with an optional sign prefix on either the mantissa or exponent."
+{ $code
+ "10.5"
+ "-3.1456"
+ "7e13"
+ "1e-5"
+}
+"More information on floats can be found in " { $link "floats" } "." ;
+
+GLOSSARY: "complex" "an instance of the " { $link complex } " class, representing a complex number with real and imaginary components, where both components are real numbers" ;
+
+ARTICLE: "syntax-complex-numbers" "Complex number syntax"
+"A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats."
+{ $code
+ "C{ 1/2 1/3 } ! the complex number 1/2+1/3i"
+ "C{ 0 1 } ! the imaginary unit"
+}
+"More information on complex numbers can be found in " { $link "complex-numbers" } "." ;
+
+GLOSSARY: "wrapper" "an instance of the " { $link wrapper } " class, holding a reference to a single object. When the evaluator encounters a wrapper, it pushes the wrapped object on the data stack. Wrappers are used to push words literally on the data stack" ;
+
+ARTICLE: "syntax-words" "Word syntax"
+"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
+{ $subsection POSTPONE: \ }
+{ $subsection POSTPONE: POSTPONE: }
+"The implementation of the " { $link POSTPONE: \ } " word is discussed in detail in " { $link "reading-ahead" } ". Words are documented in " { $link "words" } "." ;
+
+GLOSSARY: "boolean" "either the " { $link f } " or the " { $link t } " object. See generalized boolean" ;
+
+GLOSSARY: "generalized boolean" "an object used as a truth vlaue. The " { $link f } " object is false and anything else is true. See boolean" ;
+
+GLOSSARY: "t" "the canonical truth value, the symbol " { $link t } ;
+
+GLOSSARY: "f" "the singleton false value, or the " { $link f } " class whose sole instance is the singleton false value; the two are distinct" ;
+
+ARTICLE: "syntax-booleans" "Booleans"
+"Any Factor object may be used as a truth value in a conditional expression. The " { $link f } " object is false and anything else is true. The " { $link f } " object is also used to represent the empty list, as well as the concept of a missing value. The canonical truth value is the " { $link t } " object."
+{ $subsection POSTPONE: f }
+{ $subsection t } ;
+
+GLOSSARY: "escape" "a sequence allowing a non-literal character to be inserted in a string. For a list of escapes, see " { $link "escape" } ;
+
+ARTICLE: "syntax-strings" "Character and string syntax"
+"Factor has no distinct character type, however Unicode character value integers can be read by specifying a literal character, or an escaped representation thereof."
+{ $subsection POSTPONE: CHAR: }
+{ $subsection POSTPONE: " }
+{ $subsection "escape" }
+"Strings are documented in " { $link "strings" } "." ;
+
+ARTICLE: "escape" "Character escape codes"
+"The following escape codes may be used:"
+{ $list
+ { { $snippet "\\\\" } " - " { $snippet "\\" } }
+ { { $snippet "\\s" } " - a space" }
+ { { $snippet "\\t" } " - a tab" }
+ { { $snippet "\\n" } " - a newline" }
+ { { $snippet "\\r" } " - a carriage return" }
+ { { $snippet "\\0" } " - a null byte (ASCII 0)" }
+ { { $snippet "\\e" } " - escape (ASCII 27)" }
+ { { $snippet "\\\"" } " - " { $snippet "\"" } }
+}
+"A Unicode character can be specified by its code number by writing " { $snippet "\\u" } " followed by a four-digit hexadecimal number. That is, the following two expressions are equivalent:"
+{ $code
+ "CHAR: \\u0078"
+ "78"
+}
+"While not useful for single characters, this syntax is also permitted inside strings." ;
+
+ARTICLE: "syntax-sbufs" "String buffer syntax"
+{ $subsection POSTPONE: SBUF" }
+"String buffers are documented in " { $link "sbufs" } "." ;
+
+ARTICLE: "syntax-arrays" "Array syntax"
+{ $subsection POSTPONE: { }
+{ $subsection POSTPONE: } }
+"Arrays are documented in " { $link "arrays" } "." ;
+
+ARTICLE: "syntax-vectors" "Vector syntax"
+{ $subsection POSTPONE: V{ }
+{ $subsection POSTPONE: } }
+"Vectors are documented in " { $link "vectors" } "." ;
+
+ARTICLE: "syntax-hashtables" "Hashtable syntax"
+{ $subsection POSTPONE: H{ }
+{ $subsection POSTPONE: } }
+"Hashtables are documented in " { $link "hashtables" } "." ;
+
+ARTICLE: "syntax-tuples" "Tuple syntax"
+{ $subsection POSTPONE: T{ }
+{ $subsection POSTPONE: } }
+"Tuples are documented in " { $link "tuples" } "." ;
+
+ARTICLE: "syntax-lists" "Quotation syntax"
+{ $subsection POSTPONE: [ }
+{ $subsection POSTPONE: ] }
+"Quotations are documented in " { $link "quotations" } "." ;
diff --git a/doc/handbook/tutorial.facts b/doc/handbook/tutorial.facts
new file mode 100644
index 0000000000..ca2f57c468
--- /dev/null
+++ b/doc/handbook/tutorial.facts
@@ -0,0 +1,198 @@
+IN: help
+USING: io ;
+
+ARTICLE: "tutorial-overview" "The view from 10,000 feet"
+{ $list
+ "Everything is an object"
+ "A word is a basic unit of code"
+ "Words are identified by names, and organized in vocabularies"
+ "Words pass parameters on the stack"
+ "Code blocks can be passed as parameters to words"
+ "Word definitions are very short with very high code reuse"
+} ;
+
+ARTICLE: "tutorial-syntax" "Basic syntax"
+"Factor code is made up of whitespace-separated tokens. Recall the example from the first page:"
+{ $code "\"hello world\" print" }
+{ $list
+ { "The first token (" { $snippet "\"hello world\"" } ") is a string." }
+ { "The second token (" { $snippet "print" } ") is a word." }
+ "The string is pushed on the stack, and the print word prints it."
+} ;
+
+ARTICLE: "tutorial-stack" "The stack"
+"The stack is like a pile of papers. You can ``push'' papers on the top of the pile and ``pop'' papers from the top of the pile. Here is another code example:"
+{ $code "2 3 + ." }
+"Try running it in the listener now." ;
+
+ARTICLE: "tutorial-postfix" "Postfix arithmetic"
+"What happened when you ran it? The two numbers (2 3) are pushed on the stack. Then, the + word pops them and pushes the result (5). Then, the . word prints this result."
+{ $list
+ "This is called postfix arithmetic."
+ { "Traditional arithmetic is called infix: " { $snippet "3 + (6 * 2)" } }
+ { "Lets translate this into postfix: " { $snippet "3 6 2 * + ." } }
+} ;
+
+ARTICLE: "tutorial-colon-def" "Colon definitions"
+"We can define new words in terms of existing words."
+{ $code ": twice 2 * ;" }
+"This defines a new word named " { $snippet "twice" } " that calls " { $snippet "2 *" } ". Try the following in the listener:"
+{ $code "3 twice twice ." }
+"The result is the same as if you wrote:"
+{ $code "3 2 * 2 * ." } ;
+
+ARTICLE: "tutorial-stack-effects" "Stack effects"
+"When we look at the definition of the " { $snippet "twice" } " word, it is intuitively obvious that it takes one value from the stack, and leaves one value behind. However, with more complex definitions, it is better to document this so-called " { $emphasis "stack effect" } ". A stack effect comment is written between ( and ). Factor ignores stack effect comments. Don't you!"
+$terpri
+"The stack effect of " { $snippet "twice" } " is " { $snippet "( x -- 2*x )" } "."
+$terpri
+"The stack effect of " { $snippet "+" } " is " { $snippet "( x y -- x+y )" } "."
+$terpri
+"The stack effect of " { $snippet "." } " is " { $snippet "( object -- )" } "." ;
+
+ARTICLE: "tutorial-input" "Reading user input"
+"User input is read using the " { $snippet "readln ( -- string )" } " word. Note its stack effect; it puts a string on the stack."
+"This program will ask your name, then greet you:"
+{ $code "\"What is your name?\" print\nreadln \"Hello, \" write print" } ;
+
+ARTICLE: "tutorial-shuffle" "Shuffle words"
+"The word " { $snippet "twice" } " we defined is useless. Let's try something more useful: squaring a number."
+$terpri
+"We want a word with stack effect " { $snippet "( n -- n*n )" } ". We cannot use " { $snippet "*" } " by itself, since its stack effect is " { $snippet "( x y -- x*y )" } "; it expects two inputs."
+$terpri
+"However, we can use the word " { $snippet "dup ( object -- object object )" } ". The " { $snippet "dup" } " word is known as a shuffle word." ;
+
+ARTICLE: "tutorial-squared" "The squared word"
+"Try entering the following word definition:"
+{ $code ": square ( n -- n*n ) dup * ;" }
+"Shuffle words solve the problem where we need to compose two words, but their stack effects do not ``fit''."
+$terpri
+"Some of the most commonly-used shuffle words:"
+{ $code "drop ( object -- )\nswap ( obj1 obj2 -- obj2 obj1 )\nover ( obj1 obj2 -- obj1 obj2 obj1 )" } ;
+
+ARTICLE: "tutorial-shuffle-again" "Another shuffle example"
+"Now let us write a word that negates a number."
+"Start by entering the following in the listener"
+{ $code "0 10 - ." }
+"It will print -10, as expected. Now notice that this the same as:"
+{ $code "10 0 swap - ." }
+"So indeed, we can factor out the definition " { $snippet "0 swap -" } ":"
+{ $code ": negate ( n -- -n ) 0 swap - ;" } ;
+
+ARTICLE: "tutorial-see" "Seeing words"
+"If you have entered every definition in this tutorial, you will now have several new colon definitions:"
+{ $code "twice\nsquare\nnegate" }
+"You can look at previously-entered word definitions using " { $snippet "see" } ". Try the following:"
+{ $code "\\ negate see" }
+"Prefixing a word with " { $snippet "\\" } " pushes it on the stack, instead of executing it. So the see word has stack effect " { $snippet "( word -- )" } "." ;
+
+ARTICLE: "tutorial-branches" "Branches"
+"Now suppose we want to write a word that computes the absolute value of a number; that is, if it is less than 0, the number will be negated to yield a positive result."
+{ $code ": absolute ( x -- |x| ) dup 0 < [ negate ] when ;" }
+"If the top of the stack is negative, the word negates it again, making it positive. The < ( x y -- x explain" }
+"A tuple is a collection of named slots. Tuples support custom constructors, delegation... see the developer's handbook for details." ;
+
+ARTICLE: "tutorial-library" "The library"
+"Offers a good selection of highly-reusable words:"
+{ $list
+ "Operations on sequences"
+ "Variety of mathematical functions"
+ "Web server and web application framework"
+ "Graphical user interface framework"
+}
+"Browsing the library:"
+{ $list
+ {
+ "To list all vocabularies:"
+ { $code "vocabs." }
+ }
+ {
+ "To list all words in a vocabulary:"
+ { $code "\"sequences\" words." }
+ }
+ {
+ "To show a word definition:"
+ { $code "\\ reverse see" }
+ }
+} ;
+
+ARTICLE: "tutorial-more" "Learning more"
+"Hopefully this tutorial has sparked your interest in Factor."
+"You can learn more by reading the Factor developer's handbook:"
+$terpri
+{ $url "http://factorcode.org/handbook.pdf" }
+$terpri
+"Also, point your IRC client to irc.freenode.net and hop in the #concatenative channel to chat with other Factor geeks." ;
+
+ARTICLE: "tutorial" "Factor tutorial"
+"Welcome to the Factor tutorial!"
+$terpri
+"Factor is interactive, which means you can test out the code in this tutorial immediately."
+$terpri
+"Code examples will insert themselves in the listener's input area when clicked:"
+{ $code "\"hello world\" print" }
+"You can then press ENTER to execute the code, or edit it first."
+{ $url "http://factorcode.org" }
+{ $subsection "tutorial-overview" }
+{ $subsection "tutorial-syntax" }
+{ $subsection "tutorial-stack" }
+{ $subsection "tutorial-postfix" }
+{ $subsection "tutorial-colon-def" }
+{ $subsection "tutorial-stack-effects" }
+{ $subsection "tutorial-input" }
+{ $subsection "tutorial-shuffle" }
+{ $subsection "tutorial-squared" }
+{ $subsection "tutorial-shuffle-again" }
+{ $subsection "tutorial-see" }
+{ $subsection "tutorial-branches" }
+{ $subsection "tutorial-combinators" }
+{ $subsection "tutorial-sequences" }
+{ $subsection "tutorial-seq-combinators" }
+{ $subsection "tutorial-rationals" }
+{ $subsection "tutorial-oop" }
+{ $subsection "tutorial-classes" }
+{ $subsection "tutorial-library" }
+{ $subsection "tutorial-more" } ;
diff --git a/doc/handbook/words.facts b/doc/handbook/words.facts
new file mode 100644
index 0000000000..cdd4f2faf7
--- /dev/null
+++ b/doc/handbook/words.facts
@@ -0,0 +1,158 @@
+USING: help kernel parser words ;
+
+GLOSSARY: "defining word" "a word that adds definitions to the dictionary" ;
+
+GLOSSARY: "dictionary" "the collection of vocabularies making up the code in the Factor image" ;
+
+ARTICLE: "words" "Words"
+"Words are the fundamental unit of code in Factor, analogous to functions or procedures in other languages. Words are also objects, and this concept forms the basis for Factor's meta-programming facilities. A word consists of several parts:"
+{ $list
+ "a word name,"
+ "a vocabulary name,"
+ "a definition, specifying the behavior of the word when executed,"
+ "a set of word properties, including documentation strings and other meta-data."
+}
+"Words for working with words are in the " { $snippet "words" } " vocabulary, and words form a class of objects."
+{ $subsection word }
+{ $subsection word? }
+{ $subsection word-name }
+{ $subsection word-vocabulary }
+{ $subsection "vocabularies" }
+{ $subsection "word-definition" }
+{ $subsection "word-crossref" }
+{ $subsection "word-internals" } ;
+
+GLOSSARY: "interned word" "a word that is a member of the vocabulary named by its vocabulary slot. Interned words are created by calls to " { $link create } ;
+
+GLOSSARY: "uninterned word" "a word whose vocabulary slot is either set to " { $link f } ", or that does not belong to the vocabulary named by its vocabulary slot. Uninterned words are created by calls to " { $link gensym } ", and interned words can become uninterned via calls to " { $link forget } ;
+
+ARTICLE: "vocabularies" "Vocabularies"
+"Words are organized into named vocabularies, stored in a global variable."
+{ $subsection vocabularies }
+"A word is said to be " { $emphasis "interned" } " if it is a member of the vocabulary named by its vocabulary slot. Otherwise, the word is " { $emphasis "uninterned" } "."
+$terpri
+"Words whose names are known at parse time -- that is, most words making up your program -- can be referenced in source code by stating their name. However, the parser itself, and sometimes code you write, will need to create look up words dynamically."
+$terpri
+"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $snippet "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
+{ $subsection create }
+{ $subsection create-in }
+{ $subsection gensym }
+{ $subsection lookup } ;
+
+ARTICLE: "word-definition" "Defining words"
+"There are two approaches to creating word definitions:"
+{ $list
+ "using parsing words at parse time,"
+ "using defining words at run-time."
+}
+"The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse-time defining words are implemented in terms of run-time defining words."
+{ $subsection "colon-definition" }
+{ $subsection "symbols" }
+{ $subsection "primitives" }
+{ $subsection "deferred" }
+{ $subsection "undefining" }
+{ $subsection "declarations" } ;
+
+GLOSSARY: "compound definition" "a word that calls a quotation when executed" ;
+
+GLOSSARY: "colon definition" "see compound definition" ;
+
+ARTICLE: "colon-definition" "Compound definitions"
+"A compound definition associates a word name with a quotation that is called when the word is executed."
+{ $subsection POSTPONE: : }
+{ $subsection define-compound }
+{ $subsection compound? }
+{ $subsection compound } ;
+
+GLOSSARY: "symbol" "a word defined to push itself on the stack when executed, created by the " { $link POSTPONE: SYMBOL: } " parsing word" ;
+
+ARTICLE: "symbols" "Symbols"
+{ $subsection POSTPONE: SYMBOL: }
+{ $subsection define-symbol }
+{ $subsection symbol? }
+{ $subsection symbol } ;
+
+ARTICLE: "primitives" "Primitives"
+"Executing a primitive invokes native code in the Factor runtime. Primitives cannot be defined through Factor code. Compiled definitions behave similarly to primitives in that the interpreter jumps to native code upon encountering them."
+{ $subsection primitive? }
+{ $subsection primitive } ;
+
+ARTICLE: "deferred" "Deferred words and mutual recursion"
+{ $subsection POSTPONE: DEFER: }
+{ $subsection undefined? }
+{ $subsection undefined } ;
+
+ARTICLE: "undefining" "Undefining words"
+{ $subsection POSTPONE: FORGET: }
+{ $subsection forget }
+{ $subsection interned? } ;
+
+GLOSSARY: "inline word" "calls to inline words are replaced with the inline word's body by the compiler. Inline words are declared via the " { $link POSTPONE: inline } " parsing word" ;
+
+GLOSSARY: "flushable word" "calls to flushable words may be removed from compiled code if their outputs are subsequently discarded by calls to " { $link drop } ". Flushable words are declared via the " { $link POSTPONE: flushable } " parsing word" ;
+
+GLOSSARY: "foldable word" "calls to foldable words may be evaluated at compile time if all inputs are literal. Foldable words are declared via the " { $link POSTPONE: foldable } " parsing word" ;
+
+ARTICLE: "declarations" "Declarations"
+"Declarations give special behavior to a word. Declarations are parsing words that set a word property in the most recently defined word."
+$terpri
+"The first declaration specifies the time when a word runs. It affects both interpreted and compiled definitions."
+{ $subsection POSTPONE: parsing }
+"The remaining declarations only affect compiled definitions. They do not change evaluation semantics of a word, but instead declare that the word follows a certain contract, and thus may be compiled differently."
+$terpri
+{ $warning "If a generic word is defined as " { $link POSTPONE: flushable } " or " { $link POSTPONE: foldable } ", all methods must satisfy the contract, otherwise unpredicable behavior will occur." }
+{ $subsection POSTPONE: inline }
+{ $subsection POSTPONE: flushable }
+{ $subsection POSTPONE: foldable } ;
+
+GLOSSARY: "word property" "a name/value pair stored in the word properties of a word" ;
+
+GLOSSARY: "word properties" "a hashtable associated with each word storing various sundry properties" ;
+
+ARTICLE: "word-props" "Word properties"
+"Each word has a hashtable of properties."
+{ $subsection word-prop }
+{ $subsection set-word-prop }
+{ $subsection word-props }
+{ $subsection set-word-props }
+"The stack effect of the above two words is designed so that it is most convenient when " { $snippet "name" } " is a literal pushed on the stack right before executing this word."
+$terpri
+"The following properties are set by the library:"
+{ $list
+ { { $snippet "\"parsing\"" } ", " { $snippet "\"inline\"" } ", " { $snippet "\"flushable\"" } ", " { $snippet "\"fondable\"" } " - declarations (see " { $link "declarations" } ")" }
+ { { $snippet "\"file\"" } " - the source file storing the word definition" }
+ { { $snippet "\"line\"" } " - the line number in the source file storing the word definition" }
+ { { $snippet "\"methods\"" } ", " { $snippet "\"combination\"" } " - only defined on generic words (see " { $link "generic" } ")" }
+ { { $snippet "\"predicate\"" } " - only defined on class words, stores a quotation that tests if the top of the stack is an instance of that class" }
+ { { $snippet "\"predicating\"" } " - only defined on class predicate words, stores the corresponding class word" }
+} ;
+
+ARTICLE: "word-crossref" "Cross-referencing"
+"The cross-reference database is updated every time a word is redefined."
+{ $subsection crossref }
+"You can find all words called by a given word:"
+{ $subsection uses }
+"As well as all words calling a given word:"
+{ $subsection usage }
+{ $subsection usages }
+"In most cases the cross-reference database is maintained automatically, but if you do something unusual you might need to update it manually."
+{ $subsection recrossref } ;
+
+ARTICLE: "word-internals" "Word implementation details"
+"The behavior of a word when executed depends on the values of two slots:"
+{ $list
+ "the primitive number"
+ "the primitive parameter"
+}
+"The primitive number is an index into an array of native functions in the Factor runtime."
+$terpri
+"Primitive number accessors:"
+{ $subsection word-primitive }
+{ $subsection set-word-primitive }
+"Primitive parameter accessors:"
+{ $subsection word-def }
+{ $subsection set-word-def }
+"A lower-level facility for inspecting the machine code address of a word:"
+{ $subsection word-xt }
+{ $subsection set-word-xt }
+{ $subsection update-xt } ;
diff --git a/doc/jedit/complete.png b/doc/jedit/complete.png
deleted file mode 100644
index 9f1742bf4d..0000000000
Binary files a/doc/jedit/complete.png and /dev/null differ
diff --git a/doc/jedit/describe.png b/doc/jedit/describe.png
deleted file mode 100644
index aece8d3f3e..0000000000
Binary files a/doc/jedit/describe.png and /dev/null differ
diff --git a/doc/jedit/edit-word.png b/doc/jedit/edit-word.png
deleted file mode 100644
index dd22a3b8b3..0000000000
Binary files a/doc/jedit/edit-word.png and /dev/null differ
diff --git a/doc/jedit/error.png b/doc/jedit/error.png
deleted file mode 100644
index 4786cd4280..0000000000
Binary files a/doc/jedit/error.png and /dev/null differ
diff --git a/doc/jedit/extract-after.png b/doc/jedit/extract-after.png
deleted file mode 100644
index a2e6d9cd5f..0000000000
Binary files a/doc/jedit/extract-after.png and /dev/null differ
diff --git a/doc/jedit/extract-before.png b/doc/jedit/extract-before.png
deleted file mode 100644
index 8c4d60ee07..0000000000
Binary files a/doc/jedit/extract-before.png and /dev/null differ
diff --git a/doc/jedit/index.html b/doc/jedit/index.html
deleted file mode 100644
index 6ec2d63ece..0000000000
--- a/doc/jedit/index.html
+++ /dev/null
@@ -1,211 +0,0 @@
-
-
-Factor plugin
-
-
-
-
-
-
-
-
-Factor plugin
-
-Factor is a programming language with postfix syntax. The Factor plugin for