From 58485af60b8aaa3bdb57791f18cc7975fda11e6a Mon Sep 17 00:00:00 2001 From: Erik Charlebois Date: Mon, 22 Feb 2010 00:45:54 -0800 Subject: [PATCH 1/2] Fix CALLBACK: effect return type also not a string. Added accompanying unit test. --- basis/alien/parser/parser-tests.factor | 9 +++++++-- basis/alien/parser/parser.factor | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/basis/alien/parser/parser-tests.factor b/basis/alien/parser/parser-tests.factor index 2fec2d9a4c..84eefe9df6 100644 --- a/basis/alien/parser/parser-tests.factor +++ b/basis/alien/parser/parser-tests.factor @@ -34,9 +34,14 @@ CONSTANT: eleven 11 ] with-file-vocabs -FUNCTION: void* alien-parser-effect-test ( int *arg1 float arg2 ) ; +FUNCTION: void* alien-parser-function-effect-test ( int *arg1 float arg2 ) ; [ (( arg1 arg2 -- void* )) ] [ - \ alien-parser-effect-test "declared-effect" word-prop + \ alien-parser-function-effect-test "declared-effect" word-prop +] unit-test + +CALLBACK: void* alien-parser-callback-effect-test ( int *arg1 float arg2 ) ; +[ (( arg1 arg2 -- void* )) ] [ + \ alien-parser-callback-effect-test "callback-effect" word-prop ] unit-test ! Reported by mnestic diff --git a/basis/alien/parser/parser.factor b/basis/alien/parser/parser.factor index dc0a1701f2..d073a4caac 100644 --- a/basis/alien/parser/parser.factor +++ b/basis/alien/parser/parser.factor @@ -93,15 +93,15 @@ IN: alien.parser : library-abi ( lib -- abi ) library [ abi>> ] [ "cdecl" ] if* ; -:: make-callback-type ( lib return! type-name! parameters -- word quot effect ) - return type-name normalize-c-arg type-name! return! +:: make-callback-type ( lib return type-name parameters -- word quot effect ) + return type-name normalize-c-arg :> ( return-c-type type-name ) type-name current-vocab create :> type-word type-word [ reset-generic ] [ reset-c-type ] bi void* type-word typedef parameters return parse-arglist :> ( types callback-effect ) type-word callback-effect "callback-effect" set-word-prop type-word lib "callback-library" set-word-prop - type-word return types lib library-abi callback-quot (( quot -- alien )) ; + type-word return-c-type types lib library-abi callback-quot (( quot -- alien )) ; : (CALLBACK:) ( -- word quot effect ) "c-library" get From a15c09b3968a5620bc59652a8cb535baa63534c7 Mon Sep 17 00:00:00 2001 From: Erik Charlebois Date: Mon, 22 Feb 2010 10:39:50 -0800 Subject: [PATCH 2/2] Add some additional error masks and codes --- basis/windows/errors/errors.factor | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/basis/windows/errors/errors.factor b/basis/windows/errors/errors.factor index a7a41433f7..c5dedb090a 100644 --- a/basis/windows/errors/errors.factor +++ b/basis/windows/errors/errors.factor @@ -5,6 +5,12 @@ arrays literals windows.types specialized-arrays ; SPECIALIZED-ARRAY: TCHAR IN: windows.errors +CONSTANT: APPLICATION_ERROR_MASK HEX: 20000000 +CONSTANT: ERROR_SEVERITY_SUCCESS HEX: 00000000 +CONSTANT: ERROR_SEVERITY_INFORMATIONAL HEX: 40000000 +CONSTANT: ERROR_SEVERITY_WARNING HEX: 80000000 +CONSTANT: ERROR_SEVERITY_ERROR HEX: C0000000 + CONSTANT: ERROR_SUCCESS 0 CONSTANT: ERROR_INVALID_FUNCTION 1 CONSTANT: ERROR_FILE_NOT_FOUND 2