Skip to content

Commit

Permalink
[project @ 2003-07-31 10:48:50 by panne]
Browse files Browse the repository at this point in the history
Merge Foreign.C.TypesISO into Foreign.C.Types
  • Loading branch information
panne committed Jul 31, 2003
1 parent 9cee858 commit b21d4af
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 103 deletions.
29 changes: 28 additions & 1 deletion Foreign/C/Types.hs
Expand Up @@ -58,7 +58,6 @@ import NHC.FFI
)
#else

import Foreign.C.TypesISO
import Foreign.Storable
import Data.Bits ( Bits(..) )
import Data.Int ( Int8, Int16, Int32, Int64 )
Expand Down Expand Up @@ -128,4 +127,32 @@ FLOATING_TYPE(CDouble,tyConCDouble,"CDouble",HTYPE_DOUBLE)
-- HACK: Currently no long double in the FFI, so we simply re-use double
FLOATING_TYPE(CLDouble,tyConCLDouble,"CLDouble",HTYPE_DOUBLE)

INTEGRAL_TYPE(CPtrdiff,tyConCPtrdiff,"CPtrdiff",HTYPE_PTRDIFF_T)
INTEGRAL_TYPE(CSize,tyConCSize,"CSize",HTYPE_SIZE_T)
INTEGRAL_TYPE(CWchar,tyConCWchar,"CWchar",HTYPE_WCHAR_T)
INTEGRAL_TYPE(CSigAtomic,tyConCSigAtomic,"CSigAtomic",HTYPE_SIG_ATOMIC_T)

{-# RULES
"fromIntegral/a->CPtrdiff" fromIntegral = \x -> CPtrdiff (fromIntegral x)
"fromIntegral/a->CSize" fromIntegral = \x -> CSize (fromIntegral x)
"fromIntegral/a->CWchar" fromIntegral = \x -> CWchar (fromIntegral x)
"fromIntegral/a->CSigAtomic" fromIntegral = \x -> CSigAtomic (fromIntegral x)

"fromIntegral/CPtrdiff->a" fromIntegral = \(CPtrdiff x) -> fromIntegral x
"fromIntegral/CSize->a" fromIntegral = \(CSize x) -> fromIntegral x
"fromIntegral/CWchar->a" fromIntegral = \(CWchar x) -> fromIntegral x
"fromIntegral/CSigAtomic->a" fromIntegral = \(CSigAtomic x) -> fromIntegral x
#-}

INTEGRAL_TYPE(CClock,tyConCClock,"CClock",HTYPE_CLOCK_T)
INTEGRAL_TYPE(CTime,tyConCTime,"CTime",HTYPE_TIME_T)

-- FIXME: Implement and provide instances for Eq and Storable
data CFile = CFile
data CFpos = CFpos
data CJmpBuf = CJmpBuf

-- C99 types which are still missing include:
-- intptr_t, uintptr_t, intmax_t, uintmax_t, wint_t, wctrans_t, wctype_t

#endif
101 changes: 0 additions & 101 deletions Foreign/C/TypesISO.hs

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile.nhc98
Expand Up @@ -18,7 +18,7 @@ SRCS = \
System/Directory.hs System/Mem.hs System/Cmd.hs System/Info.hs \
System/Console/GetOpt.hs System/Random.hs \
Foreign/Ptr.hs Foreign/StablePtr.hs Foreign/Storable.hs \
Foreign/ForeignPtr.hs Foreign/C/Types.hs Foreign/C/TypesISO.hs \
Foreign/ForeignPtr.hs Foreign/C/Types.hs \
Foreign/Marshal/Alloc.hs Foreign/Marshal/Array.hs \
Foreign/Marshal/Utils.hs Foreign/Marshal/Error.hs \
Foreign/Marshal/Pool.hs Foreign/Marshal.hs \
Expand Down

0 comments on commit b21d4af

Please sign in to comment.