[project @ 2001-01-26 17:51:54 by rrt]
authorrrt <unknown>
Fri, 26 Jan 2001 17:51:54 +0000 (17:51 +0000)
committerrrt <unknown>
Fri, 26 Jan 2001 17:51:54 +0000 (17:51 +0000)
Windows fixes and tidying up.

ghc/lib/std/Makefile
ghc/lib/std/PrelCError.lhs
ghc/lib/std/Time.hsc

index 91cc785..69e1f18 100644 (file)
@@ -45,21 +45,19 @@ HS_SRCS := $(HSC_HS) $(filter-out $(HSC_HS),$(HS_SRCS))
 #      Setting the GHC compile options
 
 SRC_HC_OPTS += -recomp -cpp -fvia-C -fglasgow-exts $(GhcLibHcOpts) $(PACKAGE)
-ifneq "$(DLLized)" "YES"
-SRC_HC_OPTS += -static
-endif
 
 ifdef USE_REPORT_PRELUDE
 SRC_HC_OPTS += -DUSE_REPORT_PRELUDE=1
 endif
 
-#
 # Object and interface files have suffixes tagged with their ways
-#
 ifneq "$(way)" ""
 SRC_HC_OPTS += -hisuf $(way_)hi
 endif
 
+# Special options
+PrelStorable_HC_OPTS = -monly-3-regs
+
 #-----------------------------------------------------------------------------
 #      Dependency generation
 
@@ -83,11 +81,8 @@ DLL_DESCRIPTION="GHC-compiled Haskell Prelude"
 
 ifeq "$(DLLized)" "YES"
 HS_SRCS := $(filter-out PrelMain.lhs PrelHugs.lhs, $(HS_SRCS))
-endif
-
 # PrelMain.dll_o isn't to be included in the final .a, 
 # but it needs to be generated
-ifeq "$(DLLized)" "YES"
 all :: PrelMain.dll_o
 endif
 
@@ -98,19 +93,6 @@ CLEAN_FILES +=  \
        $(patsubst %.hsc, %.hs.c, $(HSC_SRCS)) \
        $(patsubst %.hsc, %.hs.h, $(HSC_SRCS))
 
-#
-# If we're building the unregisterised way, it may well be for Hugs.
-# In that case, remember to bind the cbits objects into a single file
-# which hugs can load as an auxiliary object file when loading the Prelude.
-#
-ifeq "$(way)" "u"
-all :: libHSstd_cbits.u_o
-CLEAN_FILES += libHSstd_cbits.u_o
-libHSstd_cbits.u_o:
-       $(RM) libHSstd_cbits.u_o
-       ld -r -o libHSstd_cbits.u_o cbits/*.o
-endif
-
 #-----------------------------------------------------------------------------
 #      Installation; need to install .hi files as well as libraries
 #
index 0169233..6fae07d 100644 (file)
@@ -1,5 +1,5 @@
 % -----------------------------------------------------------------------------
-% $Id: PrelCError.lhs,v 1.4 2001/01/16 06:02:29 qrczak Exp $
+% $Id: PrelCError.lhs,v 1.5 2001/01/26 17:51:54 rrt Exp $
 %
 % (c) The FFI task force, 2000
 %
@@ -7,7 +7,7 @@
 C-specific Marshalling support: Handling of C "errno" error codes
 
 \begin{code}
-{-# OPTIONS -fno-implicit-prelude #-}
+{-# OPTIONS -fno-implicit-prelude -#include "cbits/errno.h" #-}
 
 -- this is were we get the CCONST_XXX definitions from that configure
 -- calculated for us
@@ -135,6 +135,10 @@ data IOErrorType
 -- "errno" type
 -- ------------
 
+-- import of C function that gives address of errno
+--
+foreign import "ghcErrno" unsafe _errno :: Ptr CInt
+
 -- Haskell representation for "errno" values
 --
 newtype Errno = Errno CInt
@@ -594,9 +598,4 @@ errnoToIOError loc errno@(Errno no) maybeHdl maybeName =
       | otherwise                 = (OtherError, 
                                     "unexpected error (error code: " 
                                     ++ show no ++")")
-
-foreign label "errno" _errno :: Ptr CInt
-  -- FIXME: this routine should eventually be provided by the Haskell runtime
-  --       and guarantee that the "errno" of the last operation performed by
-  --       the current thread is returned 
 \end{code}
index 95d7139..f687944 100644 (file)
@@ -3,7 +3,7 @@
 -- to compile on sparc-solaris.  Blargh.
 
 -- -----------------------------------------------------------------------------
--- $Id: Time.hsc,v 1.7 2001/01/26 16:16:19 rrt Exp $
+-- $Id: Time.hsc,v 1.8 2001/01/26 17:51:54 rrt Exp $
 --
 -- (c) The University of Glasgow, 1995-2001
 --
@@ -346,6 +346,11 @@ gmtoff x    = (#peek struct tm,tm_gmtoff) x
 #  endif
 #  ifndef mingw32_TARGET_OS
 foreign label tzname :: Ptr (Ptr CChar)
+#  else
+foreign import "ghcTimezone" unsafe timezone :: Ptr CLong
+foreign import "ghcTzname" unsafe tzname :: Ptr (Ptr CChar)
+#   def inline long  *ghcTimezone(void) { return &_timezone; }
+#   def inline char **ghcTzname(void) { return _tzname; }
 #  endif
 zone x = do 
   dst <- (#peek struct tm,tm_isdst) x
@@ -625,5 +630,9 @@ foreign import unsafe gettimeofday :: Ptr CTimeVal -> Ptr () -> IO CInt
 
 #if HAVE_FTIME
 type CTimeB = ()
+#ifndef mingw32_TARGET_OS
 foreign import unsafe ftime :: Ptr CTimeB -> IO CInt
+#else
+foreign import unsafe ftime :: Ptr CTimeB -> IO ()
+#endif
 #endif