Add pdynload hierarchical name test from Alistair Bayley
This commit is contained in:
parent
d380755047
commit
06f2abce6b
34
examples/pdynload/bayley1/Load.hs
Normal file
34
examples/pdynload/bayley1/Load.hs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
module Load where
|
||||||
|
|
||||||
|
import API
|
||||||
|
import System.Plugins
|
||||||
|
|
||||||
|
testload = do
|
||||||
|
|
||||||
|
s <- make "../Plugin1.hs" ["-i../api"]
|
||||||
|
o1 <- case s of
|
||||||
|
MakeSuccess _ o -> return o
|
||||||
|
MakeFailure e -> mapM_ putStrLn e >> fail "o1"
|
||||||
|
|
||||||
|
s <- make "../Sub/Plugin2.hs" ["-i../api"]
|
||||||
|
o2 <- case s of
|
||||||
|
MakeSuccess _ o -> return o
|
||||||
|
MakeFailure e -> mapM_ putStrLn e >> fail "o2"
|
||||||
|
|
||||||
|
fc <- pdynload o1 ["..","../api"] [] "API.PluginAPI" "action"
|
||||||
|
|
||||||
|
case fc of
|
||||||
|
LoadFailure msg -> mapM_ putStrLn msg
|
||||||
|
LoadSuccess modul proc -> do
|
||||||
|
let ac :: API.PluginAPI; ac = proc
|
||||||
|
let s = proc 42
|
||||||
|
print s
|
||||||
|
|
||||||
|
print o2
|
||||||
|
fc <- pdynload o2 ["..","../api"] [] "API.PluginAPI" "action"
|
||||||
|
case fc of
|
||||||
|
LoadFailure msg -> mapM_ putStrLn msg
|
||||||
|
LoadSuccess modul proc -> do
|
||||||
|
let ac :: API.PluginAPI; ac = proc
|
||||||
|
let s = proc 42
|
||||||
|
print s
|
5
examples/pdynload/bayley1/Makefile
Normal file
5
examples/pdynload/bayley1/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
TEST=pdynload/bayley1
|
||||||
|
|
||||||
|
TOP=../../..
|
||||||
|
include ../../build.mk
|
6
examples/pdynload/bayley1/Plugin1.hs
Normal file
6
examples/pdynload/bayley1/Plugin1.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module Plugin1 where
|
||||||
|
|
||||||
|
import qualified API
|
||||||
|
action :: API.PluginAPI
|
||||||
|
action i = show i
|
||||||
|
|
6
examples/pdynload/bayley1/Sub/Plugin2.hs
Normal file
6
examples/pdynload/bayley1/Sub/Plugin2.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module Sub.Plugin2 where
|
||||||
|
|
||||||
|
import qualified API
|
||||||
|
action :: API.PluginAPI
|
||||||
|
action i = show i
|
||||||
|
|
6
examples/pdynload/bayley1/api/API.hs
Normal file
6
examples/pdynload/bayley1/api/API.hs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module API where
|
||||||
|
|
||||||
|
type PluginAPI = Int -> String
|
||||||
|
action :: PluginAPI
|
||||||
|
action i = show i
|
||||||
|
|
4
examples/pdynload/bayley1/prog/Main.hs
Normal file
4
examples/pdynload/bayley1/prog/Main.hs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
module Main where
|
||||||
|
import Load
|
||||||
|
main = testload
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user