From 471837cacf74589b7dcf6f94bd37a5a6db703463 Mon Sep 17 00:00:00 2001 From: ross Date: Tue, 22 Jul 2003 09:55:06 +0000 Subject: [PATCH] [project @ 2003-07-22 09:55:05 by ross] jiggle to make System.Posix.Directory work for Hugs --- System/Directory.hs | 12 ------------ System/Posix/Internals.hs | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 17672c5..abccc68 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -618,18 +618,6 @@ unionCMode = (+) foreign import ccall unsafe "__hscore_path_max" path_max :: Int -foreign import ccall unsafe "__hscore_readdir" - readdir :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt - -foreign import ccall unsafe "__hscore_free_dirent" - freeDirEnt :: Ptr CDirent -> IO () - -foreign import ccall unsafe "__hscore_end_of_dir" - end_of_dir :: CInt - -foreign import ccall unsafe "__hscore_d_name" - d_name :: Ptr CDirent -> IO CString - foreign import ccall unsafe "__hscore_R_OK" r_OK :: CMode foreign import ccall unsafe "__hscore_W_OK" w_OK :: CMode foreign import ccall unsafe "__hscore_X_OK" x_OK :: CMode diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index 575ec66..931aec2 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -44,7 +44,7 @@ import System.IO #ifdef __HUGS__ import Hugs.Prelude (IOException(..), IOErrorType(..)) -{-# CBITS PrelIOUtils.c #-} +{-# CBITS PrelIOUtils.c dirUtils.c #-} #endif -- --------------------------------------------------------------------------- @@ -438,6 +438,19 @@ foreign import ccall unsafe "HsBase.h _setmode" -- printf( "'stdin' successfully changed to binary mode\n" ); #endif +-- traversing directories +foreign import ccall unsafe "dirUtils.h __hscore_readdir" + readdir :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt + +foreign import ccall unsafe "HsBase.h __hscore_free_dirent" + freeDirEnt :: Ptr CDirent -> IO () + +foreign import ccall unsafe "HsBase.h __hscore_end_of_dir" + end_of_dir :: CInt + +foreign import ccall unsafe "HsBase.h __hscore_d_name" + d_name :: Ptr CDirent -> IO CString + -- POSIX flags only: foreign import ccall unsafe "HsBase.h __hscore_o_rdonly" o_RDONLY :: CInt foreign import ccall unsafe "HsBase.h __hscore_o_wronly" o_WRONLY :: CInt -- 1.7.10.4