packages feed

Hs2lib 0.5.7 → 0.5.8

raw patch · 25 files changed

+24/−308 lines, 25 filesbinary-added

Files

Hs2lib.cabal view
@@ -1,5 +1,5 @@ Name:           Hs2lib
-Version:        0.5.7
+Version:        0.5.8
 Cabal-Version:  >= 1.10
 Build-Type:     Custom
 License:        BSD3
− TODO.txt
@@ -1,15 +0,0 @@-** fix http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html (includes, include-install and fix the libpaths so the files are found at runtime)
--** fix unix code compile
-
-** fix selecPreTyp selection error (unit test: cabal file)
-** fix qualified names used in original source file
-** fix the type synonym resolver. It's really buggy and needs complete rewrite
-** fix Storable error with embedded structues e.g. (Maybe [String]) doesn't work inside a data declare.
-   -- data Foo = Foo (Maybe [String]) (Maybe (Int,[String]))
-** fixed type applications with typles e.g type Field a = (Int, [a]) and Field (String, String)
-** Find the bug in the c# codegen for tuples
-** update type to IO
-** change codegens ** partually
-** change where it detects lists, IO is now supported
-** test something ending in IO []
− Templates/.svn/all-wcprops
@@ -1,5 +0,0 @@-K 25-svn:wc:ra_dav:version-url-V 46-/svn/WinDll/!svn/ver/37/trunk/WinDLL/Templates-END
− Templates/.svn/dir-prop-base
@@ -1,14 +0,0 @@-K 10-svn:ignore-V 52-*.hi-*.aux-*.blg-*.out-*.log-*.gz-*.idx-*.toc-*.bbl--END
− Templates/.svn/entries
@@ -1,164 +0,0 @@-10--dir-52-https://svn.zhox.com:3690/svn/WinDll/trunk/WinDLL/Templates-https://svn.zhox.com:3690/svn/WinDll----2011-05-19T19:13:35.523032Z-37-Phyx-has-props--------------73766c1b-e474-454a-a9e1-e490cd0c8aae--main.template-unix.c-file-----2010-03-15T21:24:21.372005Z-48af026cf6e2f6f682e78360f0cdced1-2010-03-16T03:01:07.297910Z-26-Phyx----------------------568--nomain.template-win.c-file-----2010-12-23T14:42:20.271212Z-72a799eec8f13f10992c6f1456c6320b-2011-04-10T16:33:09.493305Z-31-Phyx----------------------415--main.template-win.c-file-----2009-12-28T13:02:40.000000Z-ea42dcc8177275209a57ca29aaf11901-2010-01-13T00:31:41.317428Z-18-Phyx----------------------486--nomain.template-unix.c-file-----2010-12-23T14:42:40.732382Z-b1be51667a0006cbeb60ffbf5916aae4-2011-04-10T16:33:09.493305Z-31-Phyx----------------------373-
− Templates/.svn/text-base/main.template-unix.c.svn-base
@@ -1,26 +0,0 @@-#include <Rts.h>--extern void __stginit_%name(void);--HsBool __attribute__ ((constructor)) %name_load(void);-void __attribute__ ((destructor)) %name_unload(void);--HsBool %name_load(void){-  int argc = 1;-  char *argv[] = { "ghcDll", NULL };-  /* N.B. argv arrays must end with NULL */--  // Initialize Haskell runtime-  hs_init(&argc, &argv);--  // Tell Haskell about all root modules-  hs_add_root(__stginit_%name);--  // do any other initialization here and-  // return false if there was a problem-  return HS_BOOL_TRUE;-}--void %name_unload(void){-  hs_exit();-}
− Templates/.svn/text-base/main.template-win.c.svn-base
@@ -1,23 +0,0 @@-#include <windows.h>-#include <Rts.h>--extern void __stginit_%name(void);--static char* args[] = { "ghcDll", NULL };-                       /* N.B. argv arrays must end with NULL */-BOOL-%callconv-DllMain-   ( HANDLE hModule-   , DWORD reason-   , void* reserved-   )-{-  if (reason == DLL_PROCESS_ATTACH) {-      /* By now, the RTS DLL should have been hoisted in, but we need to start it up. */-      startupHaskell(1, args, __stginit_%name);-      return TRUE;-  }-  return TRUE;-}-
− Templates/.svn/text-base/nomain.template-unix.c.svn-base
@@ -1,21 +0,0 @@-#include <Rts.h>
-
-extern void __stginit_%name(void);
-
-void HsStart(void)
-{
-   int argc = 1;
-   char* argv[] = {"ghcDll", NULL}; // argv must end with NULL
-
-   // Initialize Haskell runtime
-   char** args = argv;
-   hs_init(&argc, &args);
-
-   // Tell Haskell about all root modules
-   hs_add_root(__stginit_%name);
-}
-
-void HsEnd(void)
-{
-   hs_exit();
-}
− Templates/.svn/text-base/nomain.template-win.c.svn-base
@@ -1,22 +0,0 @@-#include <windows.h>
-#include <Rts.h>
-
-extern void __stginit_%name(void);
-
-void %callconv HsStart(void)
-{
-   int argc = 1;
-   char* argv[] = {"ghcDll", NULL}; // argv must end with NULL
-
-   // Initialize Haskell runtime
-   char** args = argv;
-   hs_init(&argc, &args);
-
-   // Tell Haskell about all root modules
-   hs_add_root(__stginit_%name);
-}
-
-void %callconv HsEnd(void)
-{
-   hs_exit();
-}
+ Tests/Exec/Default.hi view

binary file changed (absent → 1503 bytes)

+ Tests/Exec/Default.o view

binary file changed (absent → 1957 bytes)

+ Tests/Exec/Example.hi view

binary file changed (absent → 1821 bytes)

+ Tests/FindFiles.hi view

binary file changed (absent → 1357 bytes)

+ Tests/FindFiles.o view

binary file changed (absent → 8683 bytes)

+ Tests/Src/Test_Validation.hi view

binary file changed (absent → 2253 bytes)

+ Tests/TestRunner.hi view

binary file changed (absent → 1614 bytes)

+ Tests/TestRunner.o view

binary file changed (absent → 8039 bytes)

WinDll/CodeGen/CSharp/CSharp.hs view
@@ -142,6 +142,7 @@                               ,LibInclude "System.Runtime.InteropServices"                               ,LibInclude "WinDll"                               ,LocalInclude "Utils"+                              ,LocalInclude "Generated.Types"                               ]               , _structs    = map upgradeField (join structs)               , _typeDecls  = []
WinDll/Identifier.hs view
@@ -104,6 +104,7 @@                                 mcallbacks
                                 mstableptr
 
+            -- liftIO $ print f
             -- liftIO $ print mdep
             -- liftIO $ print mcallbacks
             
@@ -136,7 +137,7 @@         fn'  = resolveCallback True cl fn
         
 -- | Generates callbacks for an Export type. This hides the original type
---   b  ecause if we don't, it'll generate too many specifications.
+--   because if we don't, it'll generate too many specifications.
 generateCallbacksFromExports :: Ann -> [Export] -> Exec [Callback]
 generateCallbacksFromExports defs xs = fmap concat $ mapM gen (zip xs [1..(length xs)])
   where gen :: (Export,Int) -> Exec [Callback]
+ WinDll/Lib/InstancesTypes.hi view

binary file changed (absent → 1173 bytes)

+ WinDll/Lib/InstancesTypes.o view

binary file changed (absent → 1357 bytes)

WinDll/Lib/NativeMapping_Base.cpphs view
@@ -288,7 +288,7 @@       where from f x = fromFFI _ST_ (f (toFFI _ST_ x))
     
 
--- | I decided to use a CAString because on windows this gives me a constant 16 value
+-- | I decided to use a CWString because on windows this gives me a constant 16 value
 instance FFIType String CWString where
     toNative   = RECORDM(__FILE__, __LINE__, "newCWString" , newCWString)
     fromNative _ST_ ptr = do {(RECORD( __FILE__, __LINE__, "peekCWString", id)) _ST_ ptr;
WinDll/Utils/DepScanner.hs view
@@ -64,7 +64,7 @@ -- | Get the module dependency graph of the given file getGraph :: String -> IO ModuleGraph getGraph file = -#if __GLASGOW_HASKELL__ >= 704+#if __GLASGOW_HASKELL__ >= 706     defaultErrorHandler defaultFatalMessager defaultFlushOut $ do #elif __GLASGOW_HASKELL__ >= 702     defaultErrorHandler defaultLogAction $ do
WinDll/Utils/ListTypes.hs view
@@ -22,9 +22,11 @@ 
 import WinDll.Structs.Structures hiding (Module)
 import qualified WinDll.Structs.Structures as WinDll
+import WinDll.Structs.MShow.MShow
 import WinDll.Structs.MShow.HaskellSrcExts
 import WinDll.Structs.Folds.HaskellSrcExts
 import WinDll.Utils.Types
+import qualified Debug.Trace as D
 
 -- | Upgrade a type by performing actions such as identifying list 
 --   and changing the type to also pass along list counters
@@ -52,7 +54,7 @@                                                             (Exts.TyCon $ Exts.UnQual $ Exts.Ident $ if esc then "CInt" else "Int"))
                                                       _                                            -> val) t'
                  else t'
-   in ty' -- D.trace ("IN:  " ++ mshowM 2 t') $ D.trace ("OUT: " ++ mshowM 2 ty') $ D.trace (show arr' ++ " - " ++ show lst) ty'
+   in ty' -- D.trace (show t') $ D.trace ("IN:  " ++ mshowM 2 t') $ D.trace ("OUT: " ++ mshowM 2 ty') $ D.trace (show arr' ++ " - " ++ show lst ++ " (" ++ show arr' ++ ")") ty' 
   where embedded :: Exts.Type -> Exts.Type
         embedded (Exts.TyParen a) = (Exts.TyParen (analyzeType esc a))
         embedded x                = x
@@ -103,17 +105,7 @@ updateType esc ann = everywhere (mkT pushType)
   where -- | Types to update
         pushType :: Exts.Type -> Exts.Type
-        pushType (Exts.TyFun a b) = let f x = case isIOList x of
-                                                True  -> Exts.TyFun
-                                                          (Exts.TyCon $ Exts.UnQual $ Exts.Ident "Int")
-                                                False -> id
-                                        g x = case isIOList x of
-                                                True  -> Exts.TyFun 
-                                                            (Exts.TyApp 
-                                                                (Exts.TyCon $ Exts.UnQual $ Exts.Ident "Ptr")
-                                                                (Exts.TyCon $ Exts.UnQual $ Exts.Ident $ if esc then "CInt" else "Int"))
-                                                             x
-                                                False -> x
+        pushType (Exts.TyFun a b) = let 
                                     in f a $ Exts.TyFun a (g b)
         -- pushType (Exts.TyApp a b) = let f x = case isList x of
                                                 -- True  -> Exts.TyFun
@@ -122,8 +114,20 @@                                      -- in if isIO a 
                                            -- then simplify (move a $ f b)
                                            -- else Exts.TyApp a b
-        pushType x                = x
+        pushType x                = g x
         
+        f x = case isIOList x of
+                True  -> Exts.TyFun
+                          (Exts.TyCon $ Exts.UnQual $ Exts.Ident "Int")
+                False -> id
+        g x = case isIOList x of
+                True  -> Exts.TyFun 
+                            (Exts.TyApp 
+                                (Exts.TyCon $ Exts.UnQual $ Exts.Ident "Ptr")
+                                (Exts.TyCon $ Exts.UnQual $ Exts.Ident $ if esc then "CInt" else "Int"))
+                             x
+                False -> x
+                                                
         -- | Move an IO declaration inwards.
         move :: Exts.Type -> Exts.Type -> Exts.Type
         move io (Exts.TyFun a b) = Exts.TyFun a (Exts.TyApp io b)
WinDll/Version/Hs2lib.hs view
@@ -19,7 +19,7 @@ 
 -- | Version Number
 verNum :: [Int]
-verNum = [0,5,6]
+verNum = [0,5,8]
 
 -- | Version string
 verStr :: String