Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/GreenCard/GreenCard.gc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module NHC.GreenCard
  ( PackedString
  , toCString
  , fromCString
  , ForeignObj
  , Addr
  , StablePtr
  , newStablePtr
  , deRefStablePtr
  ) where

import NHC.FFI (ForeignObj,StablePtr,Addr,newStablePtr,deRefStablePtr)
--import DIO (IO(..))
import NHC.PackedString (PackedString)
import CString (toCString, fromCString)

%dis int x          = declare "int" x in (%%Int x)
%dis char x         = declare "char" x in (%%Char x)
%dis bool x         = declare "int" x in (%%Bool x)
%dis float x        = declare "float" x in (%%Float x)
%dis double x       = declare "double" x in (%%Double x)
%dis string x       = <toCString/fromCString> (packedString x)
%dis packedString x = declare "char*" x in (%%PackedString x)
%dis foreign f x    = declare "void*" x in (%%Foreign "%f" x)
%dis word x         = declare "unsigned int" x in (%%Word x)
%dis addr x         = declare "void *" x in (%%Addr x)

%dis filePath x     = string x

%dis integer i      = <fromInteger/toInteger> (int i)

%dis stable x       = stableptr x
%dis stableptr x    = declare "StablePtr" x in <<newStablePtr/deRefStablePtr>> (%%StablePtr x)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].