removed fasls
[objcffi.git] / cocoa.lisp
blob8f153d6ad4b34929817445a4386eef4b5353ef50
1 (in-package :objcffi)
3 (cffi:defcstruct NSRange (location :unsigned-int) (length :unsigned-int))
4 (cffi:defcstruct NSPoint (x :float) (y :float)) ;; NO
5 (cffi:defcstruct NSSize (width :float) (height :float))
6 (cffi:defcstruct NSRect (origin nspoint) (size nssize))
8 (name-objc-struct "_NSRange" 'NSRange)
9 (name-objc-struct "_NSPoint" 'NSPoint)
10 (name-objc-struct "_NSSize" 'NSSize)
11 (name-objc-struct "_NSRect" 'NSRect)
13 (defun NSMakeRange (location length)
14 (let ((range (cffi:foreign-alloc 'NSRange)))
15 (setf (cffi:foreign-slot-value range 'NSRange 'location) location
16 (cffi:foreign-slot-value range 'NSRange 'length) length)
17 range))
19 (defun NSMakePoint (x y)
20 (let ((point (cffi:foreign-alloc 'NSPoint)))
21 (setf (cffi:foreign-slot-value point 'NSPoint 'x) x
22 (cffi:foreign-slot-value point 'NSPoint 'y) y)
23 point))
25 (defun NSMakeSize (width height)
26 (let ((size (cffi:foreign-alloc 'NSSize)))
27 (setf (cffi:foreign-slot-value size 'NSSize 'width) width
28 (cffi:foreign-slot-value size 'NSSize 'height) height)
29 size))
31 (defun NSMakeRect (x y width height)
32 (let ((rect (cffi:foreign-alloc 'nsrect)))
33 (setf (cffi:foreign-slot-value (cffi:foreign-slot-value rect 'nsrect 'origin) 'nspoint 'x) x
34 (cffi:foreign-slot-value (cffi:foreign-slot-value rect 'nsrect 'origin) 'nspoint 'y) y
35 (cffi:foreign-slot-value (cffi:foreign-slot-value rect 'nsrect 'size) 'nssize 'width) width
36 (cffi:foreign-slot-value (cffi:foreign-slot-value rect 'nsrect 'size) 'nssize 'height) height)
37 rect))