|
From: <cod...@go...> - 2008-10-15 23:25:19
|
Author: wol...@gm...
Date: Wed Oct 15 16:24:36 2008
New Revision: 337
Modified:
trunk/hoc/Bindings/AdditionalCode/Foundation/NSGeometry.hs
trunk/hoc/Bindings/AdditionalCode/Foundation/NSRange.hs
trunk/hoc/Bindings/binding-script.txt
Log:
we now have auto-generated structs!
Modified: trunk/hoc/Bindings/AdditionalCode/Foundation/NSGeometry.hs
==============================================================================
--- trunk/hoc/Bindings/AdditionalCode/Foundation/NSGeometry.hs (original)
+++ trunk/hoc/Bindings/AdditionalCode/Foundation/NSGeometry.hs Wed Oct 15
16:24:36 2008
@@ -1,11 +1,6 @@
--- above NSGeometry
--- CUT HERE
--- below NSGeometry
+import Prelude
-- CUT HERE
--- above NSGeometry.Forward
---X NSPoint(..)
---X NSSize(..)
---X NSRect(..)
+
--X nsMaxX
--X nsMaxY
--X nsMidX
@@ -15,23 +10,6 @@
--X nsWidth
--X nsHeight
-
-import Foreign
-import Prelude
--- CUT HERE
--- below NSGeometry.Forward
-
-data NSPoint = NSPoint Float Float deriving(Read, Show, Eq)
-data NSSize = NSSize Float Float deriving(Read, Show, Eq)
-data NSRect = NSRect NSPoint NSSize deriving(Read, Show, Eq)
-
-{-
--- They're imported automatically now.
-nsZeroPoint = NSPoint 0 0
-nsZeroSize = NSSize 0 0
-nsZeroRect = NSRect nsZeroPoint nsZeroSize
--}
-
nsMaxX (NSRect (NSPoint x y) (NSSize w h)) = x + w
nsMaxY (NSRect (NSPoint x y) (NSSize w h)) = y + h
nsMidX (NSRect (NSPoint x y) (NSSize w h)) = x + w / 2.0
@@ -40,53 +18,3 @@
nsMinY (NSRect (NSPoint x y) (NSSize w h)) = y
nsWidth (NSRect (NSPoint x y) (NSSize w h)) = w
nsHeight (NSRect (NSPoint x y) (NSSize w h)) = h
-
-instance Storable NSPoint where
- alignment _ = alignment (undefined :: Float)
- sizeOf _ = 2 * sizeOf (undefined :: Float)
- peek p = do x <- peekElemOff (castPtr p) 0
- y <- peekElemOff (castPtr p) 1
- return (NSPoint x y)
- poke p (NSPoint x y) = do pokeElemOff (castPtr p) 0 x
- pokeElemOff (castPtr p) 1 y
-
-
-
-instance Storable NSSize where
- alignment _ = alignment (undefined :: Float)
- sizeOf _ = 2 * sizeOf (undefined :: Float)
- peek p = do w <- peekElemOff (castPtr p) 0
- h <- peekElemOff (castPtr p) 1
- return (NSSize w h)
- poke p (NSSize w h) = do pokeElemOff (castPtr p) 0 w
- pokeElemOff (castPtr p) 1 h
-
-instance Storable NSRect where
- alignment _ = alignment (undefined :: NSPoint)
- sizeOf _ = 2 * sizeOf (undefined :: NSPoint)
- peek p = do o <- peekElemOff (castPtr p) 0
- s <- peekElemOff (castPtr p) 1
- return (NSRect o s)
- poke p (NSRect o s) = do pokeElemOff (castPtr p) 0 o
- pokeElemOff (castPtr p) 1 s
-
-instance FFITypeable NSPoint where
- makeFFIType _ = do float <- makeFFIType (undefined :: Float)
- makeStructType [float, float]
- isStructType _ = True
-
-instance FFITypeable NSSize where
- makeFFIType _ = do float <- makeFFIType (undefined :: Float)
- makeStructType [float, float]
- isStructType _ = True
-
-instance FFITypeable NSRect where
- makeFFIType _ = do point <- makeFFIType (undefined :: NSPoint)
- size <- makeFFIType (undefined :: NSSize)
- makeStructType [point, size]
- isStructType _ = True
-
-
-$(declareStorableObjCArgument [t| NSPoint |] "{_NSPoint=ff}")
-$(declareStorableObjCArgument [t| NSSize |] "{_NSSize=ff}")
-$(declareStorableObjCArgument [t| NSRect |
] "{_NSRect={_NSPoint=ff}{_NSSize=ff}}")
Modified: trunk/hoc/Bindings/AdditionalCode/Foundation/NSRange.hs
==============================================================================
--- trunk/hoc/Bindings/AdditionalCode/Foundation/NSRange.hs (original)
+++ trunk/hoc/Bindings/AdditionalCode/Foundation/NSRange.hs Wed Oct 15
16:24:36 2008
@@ -1,23 +1,18 @@
--- above NSRange
--- CUT HERE
--- below NSRange
--- CUT HERE
--- above NSRange.Forward
---X NSRange(..)
--X nsMaxRange
--X nsLocationInRange
-import Foreign
-import Foreign.C.Types
+{-import Foreign
+import Foreign.C.Types-}
import Prelude
-- CUT HERE
-- below NSRange.Forward
-data NSRange = NSRange CUInt CUInt deriving(Read, Show, Eq)
+-- data NSRange = NSRange CUInt CUInt deriving(Read, Show, Eq)
nsMaxRange (NSRange loc len) = loc + len
nsLocationInRange x (NSRange loc len) = x >= loc && x < loc+len
+{-
instance Storable NSRange where
alignment _ = alignment (undefined :: CUInt)
sizeOf _ = 2 * sizeOf (undefined :: CUInt)
@@ -34,3 +29,4 @@
isStructType _ = True
$(declareStorableObjCArgument [t| NSRange |] "{_NSRange=II}")
+-}
\ No newline at end of file
Modified: trunk/hoc/Bindings/binding-script.txt
==============================================================================
--- trunk/hoc/Bindings/binding-script.txt (original)
+++ trunk/hoc/Bindings/binding-script.txt Wed Oct 15 16:24:36 2008
@@ -62,10 +62,10 @@
- (void) setContentView: (NSView*) view;
}
-type NSPoint Foundation.NSGeometry;
-type NSSize Foundation.NSGeometry;
-type NSRect Foundation.NSGeometry;
-type NSRange Foundation.NSRange;
+-- type NSPoint Foundation.NSGeometry;
+-- type NSSize Foundation.NSGeometry;
+-- type NSRect Foundation.NSGeometry;
+-- type NSRange Foundation.NSRange;
-- GNUstep specifics:
{-
|