diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 17:53:36 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 17:53:36 -0700 |
commit | 3cbc5823a9ab63337f144395eefea5ff18eee416 (patch) | |
tree | 0eb29c70b15f90952d6a03f12f99d51d487386e4 | |
parent | d1ef7fab6edb3550f46f65803fe53f027cfb5dd8 (diff) | |
download | wetterhorn-3cbc5823a9ab63337f144395eefea5ff18eee416.tar.gz wetterhorn-3cbc5823a9ab63337f144395eefea5ff18eee416.tar.bz2 wetterhorn-3cbc5823a9ab63337f144395eefea5ff18eee416.zip |
Added some more comments
-rw-r--r-- | src/Wetterhorn/FFI.hs | 8 | ||||
-rw-r--r-- | src/harness_adapter.c | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Wetterhorn/FFI.hs b/src/Wetterhorn/FFI.hs index c27c129..bfb3cbd 100644 --- a/src/Wetterhorn/FFI.hs +++ b/src/Wetterhorn/FFI.hs @@ -1,6 +1,6 @@ -- | This module does not export anything. It exists simply to provide C-symbols -- for the plugin. -module Wetterhorn.FFI() where +module Wetterhorn.FFI () where import Control.Monad (forM_) import qualified Data.ByteString as BS @@ -18,6 +18,8 @@ import Foreign import Foreign.C (CChar) import Wetterhorn.Core +-- | This function should be defined somewhere in the code. This is kind of like +-- the "main" function in XMonad. foreign import ccall wetterhorn :: IO Wetterhorn -- | This function is the implementation of the "hotstart" mechanism. It gives a @@ -35,12 +37,16 @@ pluginHotStart chars len = do freeStablePtr wtrPtr newStablePtr . (conf,) =<< readWState bs +-- | This function is called when a "coldstart" request is receieved. It just +-- calles the function "wetterhorn". This function should be defined in the main +-- code as it's sort-of the equivalent of XMonad's "main" function. foreign export ccall "plugin_cold_start" pluginColdStart :: IO Wetterhorn pluginColdStart :: IO Wetterhorn pluginColdStart = wetterhorn +-- | Marshals the opaque state to a C-style byte array and size pointer. foreign export ccall "plugin_marshal_state" pluginMarshalState :: Wetterhorn -> Ptr Word32 -> IO (Ptr Word8) diff --git a/src/harness_adapter.c b/src/harness_adapter.c index 15a2269..82e8caf 100644 --- a/src/harness_adapter.c +++ b/src/harness_adapter.c @@ -1,3 +1,8 @@ +// This file provides functions for the wetterhorn harness that are not +// expressible directly in haskell. +// +// Currently these functions exclusively enable/disable the Haskell runtime. + #include "HsFFI.h" #include "plugin_interface.h" |