yup, more type bugs

db4
Joe Groff 2008-09-12 20:01:07 -07:00
parent eb77923e09
commit f6ac828f46
3 changed files with 20 additions and 18 deletions

View File

@ -117,7 +117,7 @@ H{
{ "*" "char*" } { "*" "char*" }
{ "?" "unknown_type" } { "?" "unknown_type" }
{ "@" "id" } { "@" "id" }
{ "#" "id" } { "#" "Class" }
{ ":" "SEL" } { ":" "SEL" }
} }
"ptrdiff_t" heap-size { "ptrdiff_t" heap-size {

View File

@ -9,15 +9,17 @@ IN: cocoa.subclassing
: init-method ( method -- sel imp types ) : init-method ( method -- sel imp types )
first3 swap first3 swap
[ sel_registerName ] [ execute ] [ ascii string>alien ] [ sel_registerName ] [ execute ] [ ascii string>alien ] ;
tri* ;
: throw-if-false ( YES/NO -- )
zero? [ "Failed to add method or protocol to class" throw ] when ;
: add-methods ( methods class -- ) : add-methods ( methods class -- )
swap swap
[ init-method class_addMethod drop ] with each ; [ init-method class_addMethod throw-if-false ] with each ;
: add-protocols ( protocols class -- ) : 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 -- ) : (define-objc-class) ( protocols superclass name imeth -- )
-rot -rot

View File

@ -133,7 +133,7 @@ CLASS: {
} }
! Events ! Events
{ "acceptsFirstMouse:" "bool" { "id" "SEL" "id" } { "acceptsFirstMouse:" "char" { "id" "SEL" "id" }
[ 3drop 1 ] [ 3drop 1 ]
} }
@ -251,7 +251,7 @@ CLASS: {
! "rotateWithEvent:" "void" { "id" "SEL" "id" }} ! "rotateWithEvent:" "void" { "id" "SEL" "id" }}
{ "acceptsFirstResponder" "bool" { "id" "SEL" } { "acceptsFirstResponder" "char" { "id" "SEL" }
[ 2drop 1 ] [ 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? [ CF>string-array NSStringPboardType swap member? [
>r drop window-focus gadget-selection dup [ >r drop window-focus gadget-selection dup [
r> set-pasteboard-string t r> set-pasteboard-string 1
] [ ] [
r> 2drop f r> 2drop 0
] if ] if
] [ ] [
3drop f 3drop 0
] if ] if
] ]
} }
{ "readSelectionFromPasteboard:" "bool" { "id" "SEL" "id" } { "readSelectionFromPasteboard:" "char" { "id" "SEL" "id" }
[ [
pasteboard-string dup [ 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 ] if
] ]
} }
@ -293,7 +293,7 @@ CLASS: {
[ [ nip send-user-input ] ui-try ] [ [ nip send-user-input ] ui-try ]
} }
{ "hasMarkedText" "bool" { "id" "SEL" } { "hasMarkedText" "char" { "id" "SEL" }
[ 2drop 0 ] [ 2drop 0 ]
} }
@ -321,7 +321,7 @@ CLASS: {
[ 3drop f ] [ 3drop f ]
} }
{ "characterIndexForPoint:" "uint" { "id" "SEL" "NSPoint" } { "characterIndexForPoint:" "NSUInteger" { "id" "SEL" "NSPoint" }
[ 3drop 0 ] [ 3drop 0 ]
} }
@ -394,9 +394,9 @@ CLASS: {
] ]
} }
{ "windowShouldClose:" "bool" { "id" "SEL" "id" } { "windowShouldClose:" "char" { "id" "SEL" "id" }
[ [
3drop t 3drop 1
] ]
} }