HGamer3D-Enet-Binding (empty) → 0.2.0
raw patch · 17 files changed
+1054/−0 lines, 17 filesdep +HGamer3D-Datadep +basesetup-changed
Dependencies added: HGamer3D-Data, base
Files
- HGamer3D-Enet-Binding.cabal +35/−0
- HGamer3D/Bindings/Enet/ClassEnet.hs +98/−0
- HGamer3D/Bindings/Enet/ClassEnetClient.hs +129/−0
- HGamer3D/Bindings/Enet/ClassEnetPacket.hs +100/−0
- HGamer3D/Bindings/Enet/ClassEnetServer.hs +102/−0
- HGamer3D/Bindings/Enet/ClassPtr.hs +58/−0
- HGamer3D/Bindings/Enet/StructHG3DClass.hs +57/−0
- HGamer3D/Bindings/Enet/Utils.hs +136/−0
- LICENSE +13/−0
- Setup.hs +22/−0
- include/ClassEnet.h +45/−0
- include/ClassEnetClient.h +50/−0
- include/ClassEnetPacket.h +43/−0
- include/ClassEnetServer.h +44/−0
- include/ClassPtr.h +51/−0
- include/EnetDllDefines.h +41/−0
- include/StructHG3DClass.h +30/−0
+ HGamer3D-Enet-Binding.cabal view
@@ -0,0 +1,35 @@+Name: HGamer3D-Enet-Binding +Version: 0.2.0 +Synopsis: Windows Game Engine for the Haskell Programmer - Enet Bindings +Description: + HGamer3D is a game engine for developing 3D games in the programming + language Haskell. The game engine uses available libraries for 3D graphics, + sound, input device handling, gui programming and other areas and make + those functions available for the Haskell programmer by providing + a Haskell API on top of that. HGamer3D is available on Windows only. + + + +License: OtherLicense +License-file: LICENSE +Author: Peter Althainz +Maintainer: althainz@gmail.com +Build-Type: Simple +Cabal-Version: >=1.4 +Homepage: http://www.hgamer3d.org +Category: Game Engine, Network +Extra-source-files: Setup.hs, include/ClassEnet.h, include/ClassEnetClient.h, include/ClassEnetPacket.h, include/ClassEnetServer.h, include/ClassPtr.h, include/EnetDllDefines.h, include/StructHG3DClass.h + +Library + Build-Depends: base >= 3 && < 5, HGamer3D-Data >= 0.2.0 + + Exposed-modules: HGamer3D.Bindings.Enet.Utils, HGamer3D.Bindings.Enet.ClassPtr, HGamer3D.Bindings.Enet.StructHG3DClass, HGamer3D.Bindings.Enet.ClassEnet, HGamer3D.Bindings.Enet.ClassEnetClient, HGamer3D.Bindings.Enet.ClassEnetPacket, HGamer3D.Bindings.Enet.ClassEnetServer + Other-modules: + + ghc-options: + cc-options: -Wno-attributes + hs-source-dirs: . + Include-dirs: include + Build-tools: + build-depends: + extra-libraries:
+ HGamer3D/Bindings/Enet/ClassEnet.hs view
@@ -0,0 +1,98 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- ClassEnet.chs + +-- + +module HGamer3D.Bindings.Enet.ClassEnet where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +import HGamer3D.Bindings.Enet.Utils +{-# LINE 40 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} +import HGamer3D.Bindings.Enet.ClassPtr +{-# LINE 41 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} +import HGamer3D.Bindings.Enet.StructHG3DClass +{-# LINE 42 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} + +{- function HG3DEnet -} +new :: IO (HG3DClass) +new = + alloca $ \a1' -> + new'_ a1' >>= \res -> + peek a1'>>= \a1'' -> + return (a1'') +{-# LINE 47 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} + +{- function ~HG3DEnet -} +delete :: HG3DClass -> IO () +delete a1 = + withHG3DClass a1 $ \a1' -> + delete'_ a1' >>= \res -> + return () +{-# LINE 51 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} + +{- function createServer -} +createServer :: Int -> IO (HG3DClass) +createServer a1 = + let {a1' = fromIntegral a1} in + alloca $ \a2' -> + createServer'_ a1' a2' >>= \res -> + peek a2'>>= \a2'' -> + return (a2'') +{-# LINE 56 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} + +{- function createClient -} +createClient :: IO (HG3DClass) +createClient = + alloca $ \a1' -> + createClient'_ a1' >>= \res -> + peek a1'>>= \a1'' -> + return (a1'') +{-# LINE 60 ".\\HGamer3D\\Bindings\\Enet\\ClassEnet.chs" #-} + + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnet.chs.h enet_enet_construct" + new'_ :: ((HG3DClassPtr) -> (IO ())) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnet.chs.h enet_enet_destruct" + delete'_ :: ((HG3DClassPtr) -> (IO ())) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnet.chs.h enet_enet_createServer" + createServer'_ :: (CInt -> ((HG3DClassPtr) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnet.chs.h enet_enet_createClient" + createClient'_ :: ((HG3DClassPtr) -> (IO ()))
+ HGamer3D/Bindings/Enet/ClassEnetClient.hs view
@@ -0,0 +1,129 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- ClassEnetClient.chs + +-- + +module HGamer3D.Bindings.Enet.ClassEnetClient where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +import HGamer3D.Bindings.Enet.Utils +{-# LINE 40 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} +import HGamer3D.Bindings.Enet.ClassPtr +{-# LINE 41 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} +import HGamer3D.Bindings.Enet.StructHG3DClass +{-# LINE 42 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function ~EnetClient -} +delete :: HG3DClass -> IO () +delete a1 = + withHG3DClass a1 $ \a1' -> + delete'_ a1' >>= \res -> + return () +{-# LINE 47 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function connect -} +connect :: HG3DClass -> String -> Int -> IO (Bool) +connect a1 a2 a3 = + withHG3DClass a1 $ \a1' -> + withCString a2 $ \a2' -> + let {a3' = fromIntegral a3} in + alloca $ \a4' -> + connect'_ a1' a2' a3' a4' >>= \res -> + peekBoolUtil a4'>>= \a4'' -> + return (a4'') +{-# LINE 54 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function disconnect -} +disconnect :: HG3DClass -> IO (Bool) +disconnect a1 = + withHG3DClass a1 $ \a1' -> + alloca $ \a2' -> + disconnect'_ a1' a2' >>= \res -> + peekBoolUtil a2'>>= \a2'' -> + return (a2'') +{-# LINE 59 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function serve -} +serve :: HG3DClass -> Int -> IO (Bool) +serve a1 a2 = + withHG3DClass a1 $ \a1' -> + let {a2' = fromIntegral a2} in + alloca $ \a3' -> + serve'_ a1' a2' a3' >>= \res -> + peekBoolUtil a3'>>= \a3'' -> + return (a3'') +{-# LINE 65 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function getPacket -} +getPacket :: HG3DClass -> IO (HG3DClass) +getPacket a1 = + withHG3DClass a1 $ \a1' -> + alloca $ \a2' -> + getPacket'_ a1' a2' >>= \res -> + peek a2'>>= \a2'' -> + return (a2'') +{-# LINE 70 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + +{- function send -} +send :: HG3DClass -> String -> Int -> IO () +send a1 a2 a3 = + withHG3DClass a1 $ \a1' -> + withCString a2 $ \a2' -> + let {a3' = fromIntegral a3} in + send'_ a1' a2' a3' >>= \res -> + return () +{-# LINE 76 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs" #-} + + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_destruct" + delete'_ :: ((HG3DClassPtr) -> (IO ())) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_connect" + connect'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (CInt -> ((Ptr CInt) -> (IO ()))))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_disconnect" + disconnect'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_serve" + serve'_ :: ((HG3DClassPtr) -> (CInt -> ((Ptr CInt) -> (IO ())))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_getPacket" + getPacket'_ :: ((HG3DClassPtr) -> ((HG3DClassPtr) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetClient.chs.h enet_clnt_send" + send'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (CInt -> (IO ()))))
+ HGamer3D/Bindings/Enet/ClassEnetPacket.hs view
@@ -0,0 +1,100 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- ClassEnetPacket.chs + +-- + +module HGamer3D.Bindings.Enet.ClassEnetPacket where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +import HGamer3D.Bindings.Enet.Utils +{-# LINE 40 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} +import HGamer3D.Bindings.Enet.ClassPtr +{-# LINE 41 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} +import HGamer3D.Bindings.Enet.StructHG3DClass +{-# LINE 42 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} + +{- function getData -} +getData :: HG3DClass -> IO (String) +getData a1 = + withHG3DClass a1 $ \a1' -> + alloc64k $ \a2' -> + getData'_ a1' a2' >>= \res -> + peekCString a2'>>= \a2'' -> + return (a2'') +{-# LINE 48 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} + +{- function getPeer -} +getPeer :: HG3DClass -> IO (String) +getPeer a1 = + withHG3DClass a1 $ \a1' -> + alloc64k $ \a2' -> + getPeer'_ a1' a2' >>= \res -> + peekCString a2'>>= \a2'' -> + return (a2'') +{-# LINE 53 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} + +{- function getChannel -} +getChannel :: HG3DClass -> IO (Int) +getChannel a1 = + withHG3DClass a1 $ \a1' -> + alloca $ \a2' -> + getChannel'_ a1' a2' >>= \res -> + peekIntConv a2'>>= \a2'' -> + return (a2'') +{-# LINE 58 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} + +{- function ~EnetPacket -} +delete :: HG3DClass -> IO () +delete a1 = + withHG3DClass a1 $ \a1' -> + delete'_ a1' >>= \res -> + return () +{-# LINE 62 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs" #-} + + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs.h enet_pck_getData" + getData'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs.h enet_pck_getPeer" + getPeer'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs.h enet_pck_getChannel" + getChannel'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetPacket.chs.h enet_pck_destruct" + delete'_ :: ((HG3DClassPtr) -> (IO ()))
+ HGamer3D/Bindings/Enet/ClassEnetServer.hs view
@@ -0,0 +1,102 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- ClassEnetServer.chs + +-- + +module HGamer3D.Bindings.Enet.ClassEnetServer where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +import HGamer3D.Bindings.Enet.Utils +{-# LINE 40 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} +import HGamer3D.Bindings.Enet.ClassPtr +{-# LINE 41 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} +import HGamer3D.Bindings.Enet.StructHG3DClass +{-# LINE 42 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} + +{- function ~EnetServer -} +delete :: HG3DClass -> IO () +delete a1 = + withHG3DClass a1 $ \a1' -> + delete'_ a1' >>= \res -> + return () +{-# LINE 47 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} + +{- function serve -} +serve :: HG3DClass -> Int -> IO (Bool) +serve a1 a2 = + withHG3DClass a1 $ \a1' -> + let {a2' = fromIntegral a2} in + alloca $ \a3' -> + serve'_ a1' a2' a3' >>= \res -> + peekBoolUtil a3'>>= \a3'' -> + return (a3'') +{-# LINE 53 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} + +{- function getPacket -} +getPacket :: HG3DClass -> IO (HG3DClass) +getPacket a1 = + withHG3DClass a1 $ \a1' -> + alloca $ \a2' -> + getPacket'_ a1' a2' >>= \res -> + peek a2'>>= \a2'' -> + return (a2'') +{-# LINE 58 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} + +{- function send -} +send :: HG3DClass -> String -> String -> Int -> IO () +send a1 a2 a3 a4 = + withHG3DClass a1 $ \a1' -> + withCString a2 $ \a2' -> + withCString a3 $ \a3' -> + let {a4' = fromIntegral a4} in + send'_ a1' a2' a3' a4' >>= \res -> + return () +{-# LINE 65 ".\\HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs" #-} + + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs.h enet_srv_destruct" + delete'_ :: ((HG3DClassPtr) -> (IO ())) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs.h enet_srv_serve" + serve'_ :: ((HG3DClassPtr) -> (CInt -> ((Ptr CInt) -> (IO ())))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs.h enet_srv_getPacket" + getPacket'_ :: ((HG3DClassPtr) -> ((HG3DClassPtr) -> (IO ()))) + +foreign import ccall safe "HGamer3D\\Bindings\\Enet\\ClassEnetServer.chs.h enet_srv_send" + send'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> ((Ptr CChar) -> (CInt -> (IO ())))))
+ HGamer3D/Bindings/Enet/ClassPtr.hs view
@@ -0,0 +1,58 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- ClassPtr.chs + +-- Class Ptr Utilities + +module HGamer3D.Bindings.Enet.ClassPtr where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + +import HGamer3D.Bindings.Enet.Utils +{-# LINE 40 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-} + +{- class ClassEnetClient -} +type ClassEnetClient = Ptr (()) +{-# LINE 44 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-} +{- class ClassEnetPacket -} +type ClassEnetPacket = Ptr (()) +{-# LINE 46 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-} +{- class ClassEnetServer -} +type ClassEnetServer = Ptr (()) +{-# LINE 48 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-} +{- class ClassEnet -} +type ClassEnet = Ptr (()) +{-# LINE 50 ".\\HGamer3D\\Bindings\\Enet\\ClassPtr.chs" #-}
+ HGamer3D/Bindings/Enet/StructHG3DClass.hs view
@@ -0,0 +1,57 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\StructHG3DClass.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- StructHG3DClass.chs + +-- + +module HGamer3D.Bindings.Enet.StructHG3DClass where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + + +import Data.Bits +import HGamer3D.Data.HG3DClass + +type HG3DClassPtr = Ptr (HG3DClass) +{-# LINE 46 ".\\HGamer3D\\Bindings\\Enet\\StructHG3DClass.chs" #-} + +withHG3DClass :: HG3DClass -> (HG3DClassPtr -> IO b) -> IO b +withHG3DClass = with + +peekHG3DClass :: HG3DClassPtr -> IO HG3DClass +peekHG3DClass = peek +
+ HGamer3D/Bindings/Enet/Utils.hs view
@@ -0,0 +1,136 @@+-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) +-- Edit the ORIGNAL .chs file instead! + + +{-# LINE 1 ".\\HGamer3D\\Bindings\\Enet\\Utils.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE TypeSynonymInstances #-} + +-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- + +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + + +-- Utils.hs + +-- Marshalling Utilities + +module HGamer3D.Bindings.Enet.Utils where + +import Foreign +import Foreign.Ptr +import Foreign.C + +import HGamer3D.Data.HG3DClass +import HGamer3D.Data.Vector +import HGamer3D.Data.Colour +import HGamer3D.Data.Angle + + + +import Control.Monad (liftM) + +-- Strings with explicit length +-- +withCStringLenIntConv :: Num n => String -> ((CString, n) -> IO a) -> IO a +withCStringLenIntConv s f = withCStringLen s $ \(p, n) -> f (p, fromIntegral n) + +peekCStringLenIntConv :: Integral n => (CString, n) -> IO String +peekCStringLenIntConv (s, n) = peekCStringLen (s, fromIntegral n) + +-- Marshalling of numerals +-- + +withIntConv :: (Storable b, Integral a, Integral b) + => a -> (Ptr b -> IO c) -> IO c +withIntConv = with . fromIntegral + +withFloatConv :: (Storable b, RealFloat a, RealFloat b) + => a -> (Ptr b -> IO c) -> IO c +withFloatConv = with . realToFrac + +peekIntConv :: (Storable a, Integral a, Integral b) + => Ptr a -> IO b +peekIntConv = liftM fromIntegral . peek + +peekFloatConv :: (Storable a, RealFloat a, RealFloat b) + => Ptr a -> IO b +peekFloatConv = liftM realToFrac . peek + + +-- String Conversion functions +-- + +withCUString b f = withCWString b (f . castPtr) +peekCUString = peekCWString . castPtr +alloc64k = allocaBytes (1024 * 64) + +-- c2hs replacements of utility functions, to get rid of annoying c2hs +-- deprecated messages + +-- Passing Enums + +cIntFromEnum :: Enum a => a -> CInt +cIntFromEnum = cIntConv . fromEnum + +cIntToEnum :: Enum a => CInt -> a +cIntToEnum = toEnum . cIntConv + + +-- Passing Booleans by reference +-- + +withBoolUtil :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b +withBoolUtil = with . fromBool + +peekBoolUtil :: (Integral a, Storable a) => Ptr a -> IO Bool +peekBoolUtil = liftM toBool . peek + + +-- Passing enums by reference +-- + +withEnumUtil :: (Enum a, Integral b, Storable b) => a -> (Ptr b -> IO c) -> IO c +withEnumUtil = with . cFromEnum + +peekEnumUtil :: (Enum a, Integral b, Storable b) => Ptr b -> IO a +peekEnumUtil = liftM cToEnum . peek + +-- Conversion routines +-- ------------------- + +-- |Integral conversion +-- +cIntConv :: (Integral a, Integral b) => a -> b +cIntConv = fromIntegral + +-- |Floating conversion +-- +cFloatConv :: (RealFloat a, RealFloat b) => a -> b +cFloatConv = realToFrac + +-- |Convert a C enumeration to Haskell. +-- +cToEnum :: (Integral i, Enum e) => i -> e +cToEnum = toEnum . fromIntegral + +-- |Convert a Haskell enumeration to C. +-- +cFromEnum :: (Enum e, Integral i) => e -> i +cFromEnum = fromIntegral . fromEnum +
+ LICENSE view
@@ -0,0 +1,13 @@+(c) 2011, 2012 Peter Althainz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+ Setup.hs view
@@ -0,0 +1,22 @@+-- This source file is part of HGamer3D +-- (A project to enable 3D game development in Haskell) +-- For the latest info, see http://www.althainz.de/HGamer3D.html +-- +-- (c) 2011, 2012 Peter Althainz +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Setup.hs + +import Distribution.Simple +main = defaultMain
+ include/ClassEnet.h view
@@ -0,0 +1,45 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// ClassEnet.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_ClassEnet +#define _DEFINED_HG3D_ClassEnet + +#include "ClassPtr.h" +#include "ClassEnetServer.h" +#include "ClassEnetClient.h" + + +// +void enet_enet_construct(struct hg3dclass_struct * result_c); + +// +void enet_enet_destruct(struct hg3dclass_struct * thisclass_c); + +// +void enet_enet_createServer(int port_c, struct hg3dclass_struct * result_c); + +// +void enet_enet_createClient(struct hg3dclass_struct * result_c); + +#endif
+ include/ClassEnetClient.h view
@@ -0,0 +1,50 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// ClassEnetClient.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_ClassEnetClient +#define _DEFINED_HG3D_ClassEnetClient + +#include "ClassPtr.h" +#include "ClassEnetPacket.h" + + +// +void enet_clnt_destruct(struct hg3dclass_struct * thisclass_c); + +// +void enet_clnt_connect(struct hg3dclass_struct * thisclass_c, char * server_c, int port_c, int * result_c); + +// +void enet_clnt_disconnect(struct hg3dclass_struct * thisclass_c, int * result_c); + +// +void enet_clnt_serve(struct hg3dclass_struct * thisclass_c, int msWait_c, int * result_c); + +// +void enet_clnt_getPacket(struct hg3dclass_struct * thisclass_c, struct hg3dclass_struct * result_c); + +// +void enet_clnt_send(struct hg3dclass_struct * thisclass_c, char * message_c, int channel_c); + +#endif
+ include/ClassEnetPacket.h view
@@ -0,0 +1,43 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// ClassEnetPacket.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_ClassEnetPacket +#define _DEFINED_HG3D_ClassEnetPacket + +#include "ClassPtr.h" + + +// +void enet_pck_getData(struct hg3dclass_struct * thisclass_c, char * result_c); + +// +void enet_pck_getPeer(struct hg3dclass_struct * thisclass_c, char * result_c); + +// +void enet_pck_getChannel(struct hg3dclass_struct * thisclass_c, int * result_c); + +// +void enet_pck_destruct(struct hg3dclass_struct * thisclass_c); + +#endif
+ include/ClassEnetServer.h view
@@ -0,0 +1,44 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// ClassEnetServer.h + +// + +#include "wchar.h" +#ifndef _DEFINED_HG3D_ClassEnetServer +#define _DEFINED_HG3D_ClassEnetServer + +#include "ClassPtr.h" +#include "ClassEnetPacket.h" + + +// +void enet_srv_destruct(struct hg3dclass_struct * thisclass_c); + +// +void enet_srv_serve(struct hg3dclass_struct * thisclass_c, int msWait_c, int * result_c); + +// +void enet_srv_getPacket(struct hg3dclass_struct * thisclass_c, struct hg3dclass_struct * result_c); + +// +void enet_srv_send(struct hg3dclass_struct * thisclass_c, char * peer_c, char * message_c, int channel_c); + +#endif
+ include/ClassPtr.h view
@@ -0,0 +1,51 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// ClassPtr.h + +// Here are the methods defined, which do the class pointer +// marshalling and the casting of subclasses to higher classes + +#include "wchar.h" + + +#ifndef CLASSPTR_INCLUDE_H +#define CLASSPTR_INCLUDE_H + +typedef struct hg3dclass_struct { + void *ptr; + void *fptr; +} hg3dclass_struct; + +void *getHG3DClassPtr(hg3dclass_struct inSt, const char* className); + + +typedef void ClassEnetClient; +hg3dclass_struct getHG3DClass_EnetClient(void *ptrIn); + +typedef void ClassEnetPacket; +hg3dclass_struct getHG3DClass_EnetPacket(void *ptrIn); + +typedef void ClassEnetServer; +hg3dclass_struct getHG3DClass_EnetServer(void *ptrIn); + +typedef void ClassHG3DEnet; +hg3dclass_struct getHG3DClass_HG3DEnet(void *ptrIn); + +#endif
+ include/EnetDllDefines.h view
@@ -0,0 +1,41 @@+// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +// EnetDllDefines.h + +#ifndef _HGamer3DEnet020_DLLDEFINES_H_ +#define _HGamer3DEnet020_DLLDEFINES_H_ + +/* Cmake will define HGamer3DEnet020_EXPORTS on Windows when it +configures to build a shared library. If you are going to use +another build system on windows or create the visual studio +projects by hand you need to define MyLibrary_EXPORTS when +building a DLL on windows. +*/ + +// We are using the Visual Studio Compiler and building Shared libraries + +#if (defined (_WIN32)) && !(defined (__GNUC__)) + #if defined(HGamer3DEnet020_EXPORTS) + #define Enet_LIB_EXPORT __declspec(dllexport) + #else + #define Enet_LIB_EXPORT __declspec(dllimport) + #endif /* HGamer3DEnet020_EXPORTS */ +#else /* defined (_WIN32) */ + #define Enet_LIB_EXPORT +#endif + +#endif /* _HGamer3DEnet020_DLLDEFINES_H_ */
+ include/StructHG3DClass.h view
@@ -0,0 +1,30 @@+// This source file is part of HGamer3D +// (A project to enable 3D game development in Haskell) +// For the latest info, see http://www.althainz.de/HGamer3D.html +// +// (c) 2011, 2012 Peter Althainz +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// StructHG3DClass.h + +// + +#include "wchar.h" + + +typedef struct hg3dclass_struct { + void *ptr; + void *fptr; +} hg3dclass_struct;