windows.errors, debugger.windows: improve description of Windows error objects
parent
c167646e3b
commit
7e2d32b7d2
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs debugger io kernel literals math.parser namespaces
|
USING: accessors assocs debugger io kernel literals math.parser
|
||||||
prettyprint sequences system windows.kernel32 ;
|
namespaces prettyprint sequences system windows.kernel32
|
||||||
|
windows.ole32 windows.errors math ;
|
||||||
IN: debugger.windows
|
IN: debugger.windows
|
||||||
|
|
||||||
CONSTANT: seh-names
|
CONSTANT: seh-names
|
||||||
|
@ -41,3 +42,14 @@ CONSTANT: seh-names
|
||||||
M: windows signal-error.
|
M: windows signal-error.
|
||||||
"Windows exception 0x" write
|
"Windows exception 0x" write
|
||||||
third [ >hex write ] [ seh-name. ] bi nl ;
|
third [ >hex write ] [ seh-name. ] bi nl ;
|
||||||
|
|
||||||
|
M: ole32-error error.
|
||||||
|
"COM error 0x" write
|
||||||
|
dup code>> HEX: ffff,ffff bitand >hex write ": " write
|
||||||
|
message>> write ;
|
||||||
|
|
||||||
|
M: windows-error error.
|
||||||
|
"Win32 error 0x" write
|
||||||
|
dup n>> HEX: ffff,ffff bitand >hex write ": " write
|
||||||
|
string>> write ;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
USING: alien.data kernel locals math math.bitwise
|
USING: alien.data kernel locals math math.bitwise
|
||||||
windows.kernel32 sequences byte-arrays unicode.categories
|
windows.kernel32 sequences byte-arrays unicode.categories
|
||||||
io.encodings.string io.encodings.utf16n alien.strings
|
io.encodings.string io.encodings.utf16n alien.strings
|
||||||
arrays literals windows.types specialized-arrays ;
|
arrays literals windows.types specialized-arrays
|
||||||
|
math.parser ;
|
||||||
SPECIALIZED-ARRAY: TCHAR
|
SPECIALIZED-ARRAY: TCHAR
|
||||||
IN: windows.errors
|
IN: windows.errors
|
||||||
|
|
||||||
|
@ -703,7 +704,6 @@ CONSTANT: FORMAT_MESSAGE_MAX_WIDTH_MASK HEX: 000000FF
|
||||||
: make-lang-id ( lang1 lang2 -- n )
|
: make-lang-id ( lang1 lang2 -- n )
|
||||||
10 shift bitor ; inline
|
10 shift bitor ; inline
|
||||||
|
|
||||||
ERROR: error-message-failed id ;
|
|
||||||
:: n>win32-error-string ( id -- string )
|
:: n>win32-error-string ( id -- string )
|
||||||
flags{
|
flags{
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_SYSTEM
|
||||||
|
@ -713,8 +713,10 @@ ERROR: error-message-failed id ;
|
||||||
id
|
id
|
||||||
LANG_NEUTRAL SUBLANG_DEFAULT make-lang-id
|
LANG_NEUTRAL SUBLANG_DEFAULT make-lang-id
|
||||||
32768 [ TCHAR <c-array> ] [ ] bi
|
32768 [ TCHAR <c-array> ] [ ] bi
|
||||||
f pick [ FormatMessage 0 = [ id error-message-failed ] when ] dip
|
f pick [ FormatMessage ] dip
|
||||||
utf16n alien>string [ blank? ] trim ;
|
swap zero?
|
||||||
|
[ drop "Unknown error 0x" id HEX: ffff,ffff bitand >hex append ]
|
||||||
|
[ utf16n alien>string [ blank? ] trim ] if ;
|
||||||
|
|
||||||
: win32-error-string ( -- str )
|
: win32-error-string ( -- str )
|
||||||
GetLastError n>win32-error-string ;
|
GetLastError n>win32-error-string ;
|
||||||
|
|
Loading…
Reference in New Issue