From f6ac828f4628babb638e309a6ca81fd674e5bca8 Mon Sep 17 00:00:00 2001 From: Joe Groff <arcata@gmail.com> Date: Fri, 12 Sep 2008 20:01:07 -0700 Subject: [PATCH] yup, more type bugs --- basis/cocoa/messages/messages.factor | 2 +- basis/cocoa/subclassing/subclassing.factor | 10 +++++---- basis/ui/cocoa/views/views.factor | 26 +++++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index 93de7658ef..3ec42ee65d 100755 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -117,7 +117,7 @@ H{ { "*" "char*" } { "?" "unknown_type" } { "@" "id" } - { "#" "id" } + { "#" "Class" } { ":" "SEL" } } "ptrdiff_t" heap-size { diff --git a/basis/cocoa/subclassing/subclassing.factor b/basis/cocoa/subclassing/subclassing.factor index 3f8e709df0..ec15c0b514 100755 --- a/basis/cocoa/subclassing/subclassing.factor +++ b/basis/cocoa/subclassing/subclassing.factor @@ -9,15 +9,17 @@ IN: cocoa.subclassing : init-method ( method -- sel imp types ) first3 swap - [ sel_registerName ] [ execute ] [ ascii string>alien ] - tri* ; + [ sel_registerName ] [ execute ] [ ascii string>alien ] ; + +: throw-if-false ( YES/NO -- ) + zero? [ "Failed to add method or protocol to class" throw ] when ; : add-methods ( methods class -- ) swap - [ init-method class_addMethod drop ] with each ; + [ init-method class_addMethod throw-if-false ] with each ; : add-protocols ( protocols class -- ) - swap [ objc-protocol class_addProtocol drop ] with each ; + swap [ objc-protocol class_addProtocol throw-if-false ] with each ; : (define-objc-class) ( protocols superclass name imeth -- ) -rot diff --git a/basis/ui/cocoa/views/views.factor b/basis/ui/cocoa/views/views.factor index a13d8f86df..c6942a8158 100755 --- a/basis/ui/cocoa/views/views.factor +++ b/basis/ui/cocoa/views/views.factor @@ -133,7 +133,7 @@ CLASS: { } ! Events -{ "acceptsFirstMouse:" "bool" { "id" "SEL" "id" } +{ "acceptsFirstMouse:" "char" { "id" "SEL" "id" } [ 3drop 1 ] } @@ -251,7 +251,7 @@ CLASS: { ! "rotateWithEvent:" "void" { "id" "SEL" "id" }} -{ "acceptsFirstResponder" "bool" { "id" "SEL" } +{ "acceptsFirstResponder" "char" { "id" "SEL" } [ 2drop 1 ] } @@ -264,26 +264,26 @@ CLASS: { ] } -{ "writeSelectionToPasteboard:types:" "bool" { "id" "SEL" "id" "id" } +{ "writeSelectionToPasteboard:types:" "char" { "id" "SEL" "id" "id" } [ CF>string-array NSStringPboardType swap member? [ >r drop window-focus gadget-selection dup [ - r> set-pasteboard-string t + r> set-pasteboard-string 1 ] [ - r> 2drop f + r> 2drop 0 ] if ] [ - 3drop f + 3drop 0 ] if ] } -{ "readSelectionFromPasteboard:" "bool" { "id" "SEL" "id" } +{ "readSelectionFromPasteboard:" "char" { "id" "SEL" "id" } [ pasteboard-string dup [ - >r drop window-focus r> swap user-input t + >r drop window-focus r> swap user-input 1 ] [ - 3drop f + 3drop 0 ] if ] } @@ -293,7 +293,7 @@ CLASS: { [ [ nip send-user-input ] ui-try ] } -{ "hasMarkedText" "bool" { "id" "SEL" } +{ "hasMarkedText" "char" { "id" "SEL" } [ 2drop 0 ] } @@ -321,7 +321,7 @@ CLASS: { [ 3drop f ] } -{ "characterIndexForPoint:" "uint" { "id" "SEL" "NSPoint" } +{ "characterIndexForPoint:" "NSUInteger" { "id" "SEL" "NSPoint" } [ 3drop 0 ] } @@ -394,9 +394,9 @@ CLASS: { ] } -{ "windowShouldClose:" "bool" { "id" "SEL" "id" } +{ "windowShouldClose:" "char" { "id" "SEL" "id" } [ - 3drop t + 3drop 1 ] }