aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-05-21 03:09:50 +0200
committerCamil Staps2016-05-21 03:09:50 +0200
commit5eb4267e9481d37b8d3ebf9796f9a2cfebc063d3 (patch)
treef79db47fe351d20cf822b73296508f1e7314602f
parentReadme; license (diff)
80 chars
-rw-r--r--Inotify.dcl5
-rw-r--r--Inotify.icl11
-rw-r--r--inotify_c.c3
3 files changed, 13 insertions, 6 deletions
diff --git a/Inotify.dcl b/Inotify.dcl
index f340df0..e021c45 100644
--- a/Inotify.dcl
+++ b/Inotify.dcl
@@ -15,8 +15,11 @@ from Data.Maybe import ::Maybe
inotify_init :: st -> Maybe *(Inotify st)
inotify_close :: *(Inotify st) -> st
-inotify_add_watch :: (INCallback st) !Int !String !*(Inotify st) -> *(Either Int INWatch, *Inotify st)
+
+inotify_add_watch :: (INCallback st) !Int !String !*(Inotify st)
+ -> *(Either Int INWatch, *Inotify st)
inotify_rm_watch :: !INWatch !*(Inotify st) -> *(Bool, *Inotify st)
+
inotify_poll :: *(Inotify st) -> *Inotify st
inotify_check :: *(Inotify st) *World -> *(*Inotify st, *World)
diff --git a/Inotify.icl b/Inotify.icl
index cd927fe..20ce3e9 100644
--- a/Inotify.icl
+++ b/Inotify.icl
@@ -26,7 +26,7 @@ import code from "inotify_c.o"
inotify_init :: st -> Maybe *(Inotify st)
inotify_init st
- = let fd = c_init 0 in if (fd < 0) Nothing (Just {fd=fd, watches=[], state=st})
+ = let fd=c_init 0 in if (fd<0) Nothing (Just {fd=fd, watches=[], state=st})
where
c_init :: !Int -> *Int
c_init i = code {
@@ -41,7 +41,8 @@ where
ccall close "I:V:A"
}
-inotify_add_watch :: (INCallback st) !Int !String !*(Inotify st) -> *(Either Int INWatch, *Inotify st)
+inotify_add_watch :: (INCallback st) !Int !String !*(Inotify st)
+ -> *(Either Int INWatch, *Inotify st)
inotify_add_watch f mask fname inot=:{fd,watches}
= let (w, fd`) = c_add_watch fd fname mask in
( if (w == -1) (Left errno) (Right w)
@@ -83,9 +84,11 @@ inotify_check inot=:{fd,watches,state} w
# (fd,st,w`) = seq (map (check wdsmasks) watches) (inot.fd, state, w)
= ({ inot & fd=fd, state=st }, w`)
where
- check :: [(Int,Int)] (INWatch, INCallback st) *(*Int, st, *World) -> *(*Int, st, *World)
+ check :: [(Int,Int)] (INWatch, INCallback st) *(*Int, st, *World)
+ -> *(*Int, st, *World)
check wdsmasks (watch,f) (fd,st,w)
- # (st,w) = seq [\(st,w) -> f mask st w \\ (wd,mask) <- wdsmasks | wd == watch] (st,w)
+ # (st,w) = seq [\(st,w) -> f mask st w
+ \\ (wd,mask) <- wdsmasks | wd == watch] (st,w)
= (fd,st,w)
bytesToInt :: {#Char} -> Int
diff --git a/inotify_c.c b/inotify_c.c
index 5784285..f178fa6 100644
--- a/inotify_c.c
+++ b/inotify_c.c
@@ -33,7 +33,8 @@ int clean_inotify_init(int ignored) {
return fd;
}
-void clean_inotify_add_watch(int fd, CleanString* fname_, int mask, int *re_watch, int *re_fd) {
+void clean_inotify_add_watch(int fd, CleanString* fname_, int mask,
+ int *re_watch, int *re_fd) {
char* fname = clstocs(fname_);
*re_watch = inotify_add_watch(fd, fname, mask);
free(fname);