Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
A
array
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rinat Striungis
array
Commits
5f2b610a
Commit
5f2b610a
authored
Feb 02, 2009
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update for new IO library (TEMPORARY: hGetArray/hPutArray not implemented)
parent
0494b894
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
Data/Array/Base.hs
Data/Array/Base.hs
+6
-0
Data/Array/IO.hs
Data/Array/IO.hs
+17
-7
Data/Array/IO/Internals.hs
Data/Array/IO/Internals.hs
+4
-0
No files found.
Data/Array/Base.hs
View file @
5f2b610a
...
...
@@ -43,8 +43,14 @@ import GHC.Float ( Float(..), Double(..) )
import
GHC.Stable
(
StablePtr
(
..
)
)
import
GHC.Int
(
Int8
(
..
),
Int16
(
..
),
Int32
(
..
),
Int64
(
..
)
)
import
GHC.Word
(
Word8
(
..
),
Word16
(
..
),
Word32
(
..
),
Word64
(
..
)
)
#
if
__GLASGOW_HASKELL__
>=
611
import
GHC.IO
(
IO
(
..
),
stToIO
)
import
GHC.IOArray
(
IOArray
(
..
),
newIOArray
,
unsafeReadIOArray
,
unsafeWriteIOArray
)
#
else
import
GHC.IOBase
(
IO
(
..
),
IOArray
(
..
),
stToIO
,
newIOArray
,
unsafeReadIOArray
,
unsafeWriteIOArray
)
#
endif
#
else
import
Data.Int
import
Data.Word
...
...
Data/Array/IO.hs
View file @
5f2b610a
{-# OPTIONS_GHC -#include "HsBase.h" #-}
{-# OPTIONS_GHC -w #-}
--tmp
-----------------------------------------------------------------------------
-- |
-- Module : Data.Array.IO
...
...
@@ -39,9 +40,11 @@ import Foreign
import
Foreign.C
import
GHC.Arr
import
GHC.IORef
import
GHC.IO.Handle
import
GHC.IO.Buffer
import
GHC.IO.Exception
import
GHC.IOBase
import
GHC.Handle
#
else
import
Data.Char
import
Data.Word
(
Word8
)
...
...
@@ -63,6 +66,10 @@ hGetArray
-- read, which might be smaller than the number requested
-- if the end of file was reached.
hGetArray
=
undefined
#
if
0
hGetArray
handle
(
IOUArray
(
STUArray
_l
_u
n
ptr
))
count
|
count
==
0
=
return
0
...
...
@@ -105,6 +112,8 @@ readChunk fd is_stream ptr init_off bytes0 = loop init_off bytes0
then
return
(
off
-
init_off
)
else
loop
(
off
+
r
)
(
bytes
-
r
)
#
endif
-- ---------------------------------------------------------------------------
-- hPutArray
...
...
@@ -115,6 +124,10 @@ hPutArray
->
Int
-- ^ Number of 'Word8's to write
->
IO
()
hPutArray
=
undefined
#
if
0
hPutArray
handle
(
IOUArray
(
STUArray
_l
_u
n
raw
))
count
|
count
==
0
=
return
()
...
...
@@ -144,14 +157,11 @@ hPutArray handle (IOUArray (STUArray _l _u n raw)) count
flushWriteBuffer
fd
stream
this_buf
return
()
#
endif
-- ---------------------------------------------------------------------------
-- Internal Utils
foreign
import
ccall
unsafe
"__hscore_memcpy_dst_off"
memcpy_baoff_ba
::
RawBuffer
->
CInt
->
RawBuffer
->
CSize
->
IO
(
Ptr
()
)
foreign
import
ccall
unsafe
"__hscore_memcpy_src_off"
memcpy_ba_baoff
::
RawBuffer
->
RawBuffer
->
CInt
->
CSize
->
IO
(
Ptr
()
)
illegalBufferSize
::
Handle
->
String
->
Int
->
IO
a
illegalBufferSize
handle
fn
sz
=
ioException
(
ioeSetErrorString
...
...
Data/Array/IO/Internals.hs
View file @
5f2b610a
...
...
@@ -38,7 +38,11 @@ import Data.Array.Base
import
Data.Ix
#
ifdef
__GLASGOW_HASKELL__
#
if
__GLASGOW_HASKELL__
>=
611
import
GHC.IOArray
(
IOArray
(
..
))
#
else
import
GHC.IOBase
(
IOArray
(
..
))
#
endif
#
endif
/*
__GLASGOW_HASKELL__
*/
#
include
"Typeable.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment