Browse Source

bye

master
Tiago Carvalho 3 years ago
parent
commit
d2378812ce
6 changed files with 18 additions and 10 deletions
  1. +2
    -5
      IRC/Plugins/Loader.hs
  2. +8
    -0
      IRC/Plugins/Plugin.hs
  3. +2
    -1
      IRC/Plugins/Tupfile
  4. +2
    -2
      Tupfile
  5. +1
    -1
      Tuprules.tup
  6. +3
    -1
      make.sh

+ 2
- 5
IRC/Plugins/Loader.hs View File

@@ -5,6 +5,8 @@ module IRC.Plugins.Loader ( load ) where

import qualified Data.HashMap.Lazy as M

import IRC.Plugins.Plugin

import Control.Exception ( catch, ErrorCall )
import GHC.Exts ( addrToAny# )
import GHC.Ptr ( Ptr(..) )
@@ -12,11 +14,6 @@ import System.Info ( os, arch )
import GHCi.ObjLink
import Encoding

type PluginSet = M.HashMap String Plugin

data Plugin = Plugin { pluginEvent :: String, -- e.g. PRIVMSG
pluginEntry :: Int }

load :: PluginSet -> String -> IO (Either String PluginSet)
load set path = do
initObjLinker RetainCAFs


+ 8
- 0
IRC/Plugins/Plugin.hs View File

@@ -0,0 +1,8 @@
module IRC.Plugins.Plugin ( PluginSet, Plugin(..) ) where

import qualified Data.HashMap.Lazy as M

type PluginSet = M.HashMap String Plugin

data Plugin = Plugin { pluginEvent :: String, -- e.g. PRIVMSG
pluginEntry :: Int }

+ 2
- 1
IRC/Plugins/Tupfile View File

@@ -1,3 +1,4 @@
include_rules

: foreach *.hs |> ghc $(GHCFLAGS) -c %f |> %B.o %B.hi
: Plugin.hs |> ghc $(GHCFLAGS) -c %f |> %B.o %B.hi
: Loader.hs | Plugin.hi |> ghc $(GHCFLAGS) -c %f |> %B.o %B.hi

+ 2
- 2
Tupfile View File

@@ -1,4 +1,4 @@
include_rules

: foreach *.hs | IRC/*.hi |> ghc $(GHCFLAGS) -c %f |> %B.o %B.hi
: *.o IRC/*.o |> ghc -o Main %f |> Main
: foreach *.hs | IRC/*.hi IRC/Plugins/*.hi |> ghc $(GHCFLAGS) -c %f |> %B.o %B.hi
: *.o IRC/*.o IRC/Plugins/*.o |> ghc -o Main %f |> Main

+ 1
- 1
Tuprules.tup View File

@@ -1 +1 @@
GHCFLAGS += -Wall -O3
GHCFLAGS += -i$(CWD) -Wall -O3

+ 3
- 1
make.sh View File

@@ -9,6 +9,8 @@ if ! command -v tup >/dev/null; then
exit 1
fi

export CWD="$(readlink -f .)"

case $1 in
run)
$0 build >&2 || exit 1
@@ -22,7 +24,7 @@ case $1 in
tup >&2
;;
clean)
rm -f Main *.o *.hi IRC/*.o IRC/*.hi
rm -f Main *.o *.hi IRC/*.o IRC/*.hi IRC/Plugins/*.o IRC/Plugins/*.hi
;;
*)
usage


Loading…
Cancel
Save