Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
40906d02
Commit
40906d02
authored
26 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-06-29 16:33:11 by sof]
Added indexAddrOffAddr
parent
7df87d16
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/lib/std/PrelAddr.lhs
+12
-50
12 additions, 50 deletions
ghc/lib/std/PrelAddr.lhs
with
12 additions
and
50 deletions
ghc/lib/std/PrelAddr.lhs
+
12
−
50
View file @
40906d02
%
% (c) The AQUA Project, Glasgow University, 1994-199
6
% (c) The AQUA Project, Glasgow University, 1994-199
8
%
\section[PrelAddr]{Module @PrelAddr@}
...
...
@@ -8,9 +8,11 @@
{-# OPTIONS -fno-implicit-prelude #-}
module PrelAddr (
Addr(..),
nullAddr, -- :: Addr
plusAddr, -- :: Addr -> Int -> Addr
Addr(..)
, nullAddr -- :: Addr
, plusAddr -- :: Addr -> Int -> Addr
, indexAddrOffAddr -- :: Addr -> Int -> Addr
) where
import PrelGHC
...
...
@@ -33,52 +35,12 @@ plusAddr (A# addr) (I# off) = A# (int2Addr# (addr2Int# addr +# off))
instance CCallable Addr
instance CCallable Addr#
instance CReturnable Addr
\end{code}
ToDo:
-- read value out of _immutable_ memory
indexCharOffAddr :: Addr -> Int -> Char
indexIntOffAddr :: Addr -> Int -> Int -- should we drop this?
indexAddrOffAddr :: Addr -> Int -> Addr
indexFloatOffAddr :: Addr -> Int -> Float
indexDoubleOffAddr :: Addr -> Int -> Double
indexWord8OffAddr :: Addr -> Int -> Word8
indexWord16OffAddr :: Addr -> Int -> Word16
indexWord32OffAddr :: Addr -> Int -> Word32
indexWord64OffAddr :: Addr -> Int -> Word64
indexInt8OffAddr :: Addr -> Int -> Int8
indexInt16OffAddr :: Addr -> Int -> Int16
indexInt32OffAddr :: Addr -> Int -> Int32
indexInt64OffAddr :: Addr -> Int -> Int64
indexAddrOffAddr :: Addr -> Int -> Addr
indexAddrOffAddr (A# addr#) n
= case n of { I# n# ->
case indexAddrOffAddr# addr# n# of { r# ->
(A# r#)}}
-- read value out of mutable memory
readCharOffAddr :: Addr -> Int -> IO Char
readIntOffAddr :: Addr -> Int -> IO Int -- should we drop this?
readAddrOffAddr :: Addr -> Int -> IO Addr
readFloatOffAddr :: Addr -> Int -> IO Float
readDoubleOffAddr :: Addr -> Int -> IO Double
readWord8OffAddr :: Addr -> Int -> IO Word8
readWord16OffAddr :: Addr -> Int -> IO Word16
readWord32OffAddr :: Addr -> Int -> IO Word32
readWord64OffAddr :: Addr -> Int -> IO Word64
readInt8OffAddr :: Addr -> Int -> IO Int8
readInt16OffAddr :: Addr -> Int -> IO Int16
readInt32OffAddr :: Addr -> Int -> IO Int32
readInt64OffAddr :: Addr -> Int -> IO Int64
-- write value into mutable memory
writeCharOffAddr :: Addr -> Int -> Char -> IO ()
writeIntOffAddr :: Addr -> Int -> Int -> IO () -- should we drop this?
writeAddrOffAddr :: Addr -> Int -> Addr -> IO ()
writeFloatOffAddr :: Addr -> Int -> Float -> IO ()
writeDoubleOffAddr :: Addr -> Int -> Double -> IO ()
writeWord8OffAddr :: Addr -> Int -> Word8 -> IO ()
writeWord16OffAddr :: Addr -> Int -> Word16 -> IO ()
writeWord32OffAddr :: Addr -> Int -> Word32 -> IO ()
writeWord64OffAddr :: Addr -> Int -> Word64 -> IO ()
writeInt8OffAddr :: Addr -> Int -> Int8 -> IO ()
writeInt16OffAddr :: Addr -> Int -> Int16 -> IO ()
writeInt32OffAddr :: Addr -> Int -> Int32 -> IO ()
writeInt64OffAddr :: Addr -> Int -> Int64 -> IO ()
\end{code}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment