diff options
author | MauricioAntunes <> | 2010-06-20 14:32:46 (GMT) |
---|---|---|
committer | Luite Stegeman <luite@luite.com> | 2010-06-20 14:32:46 (GMT) |
commit | 61e0da003f6f572cc39f0ff16585d54338f16947 (patch) | |
tree | 7aad7a721e7a64785080aa8c906e7c5121979042 | |
parent | 6f612bf7852d4f577e5ee31be41e7c2a8cb0abd2 (diff) |
version 1.2.21.2.2
-rw-r--r-- | bindings-posix.cabal | 10 | ||||
-rw-r--r-- | src/Bindings/Posix.hs | 1 | ||||
-rw-r--r-- | src/Bindings/Posix.hsc | 18 | ||||
-rw-r--r-- | src/Bindings/Posix/Errno.hsc | 2 | ||||
-rw-r--r-- | src/Bindings/Posix/Locale.hsc | 24 | ||||
-rw-r--r-- | src/Bindings/Posix/Signal.hsc | 7 | ||||
-rw-r--r-- | src/Bindings/Posix/Sys.hs | 1 | ||||
-rw-r--r-- | src/Bindings/Posix/Sys/Select.hsc | 2 | ||||
-rw-r--r-- | src/Bindings/Posix/Sys/Types.hsc | 2 | ||||
-rw-r--r-- | src/Bindings/Posix/Sys/Utsname.hsc | 2 | ||||
-rw-r--r-- | src/Bindings/Posix/Time.hsc | 56 | ||||
-rw-r--r-- | src/Bindings/Posix/Unistd.hsc | 2 | ||||
-rw-r--r-- | src/inlines.c | 36 |
13 files changed, 103 insertions, 60 deletions
diff --git a/bindings-posix.cabal b/bindings-posix.cabal index 30e32b7..e926913 100644 --- a/bindings-posix.cabal +++ b/bindings-posix.cabal @@ -1,14 +1,13 @@ cabal-version: >= 1.2.3 name: bindings-posix -homepage: http://bitbucket.org/mauricio/bindings-posix synopsis: Low level bindings to posix. -version: 1.2 +version: 1.2.2 license: BSD3 license-file: LICENSE maintainer: MaurĂcio C. Antunes <mauricio.antunes@gmail.com> author: MaurĂcio C. Antunes -bug-reports: http://bitbucket.org/mauricio/bindings-posix/issues +bug-reports: http://bitbucket.org/mauricio/bindings-dsl/issues build-type: Simple category: FFI library @@ -17,12 +16,13 @@ library ForeignFunctionInterface build-depends: base >= 3 && < 5, - bindings-common >= 1.3 && < 1.4 + bindings-DSL >= 1.0.7 && < 1.1 exposed-modules: - -- Time incompleto! Bindings.Posix Bindings.Posix.Errno + Bindings.Posix.Locale Bindings.Posix.Signal + Bindings.Posix.Sys Bindings.Posix.Sys.Select Bindings.Posix.Sys.Types Bindings.Posix.Sys.Utsname diff --git a/src/Bindings/Posix.hs b/src/Bindings/Posix.hs new file mode 100644 index 0000000..b09d189 --- /dev/null +++ b/src/Bindings/Posix.hs @@ -0,0 +1 @@ +module Bindings.Posix (module Bindings.Posix.Errno,module Bindings.Posix.Locale,module Bindings.Posix.Signal,module Bindings.Posix.Sys,module Bindings.Posix.Time,module Bindings.Posix.Unistd) where {import Bindings.Posix.Errno;import Bindings.Posix.Locale;import Bindings.Posix.Signal;import Bindings.Posix.Sys;import Bindings.Posix.Time;import Bindings.Posix.Unistd} diff --git a/src/Bindings/Posix.hsc b/src/Bindings/Posix.hsc deleted file mode 100644 index b1afd90..0000000 --- a/src/Bindings/Posix.hsc +++ /dev/null @@ -1,18 +0,0 @@ -module Bindings.Posix ( - module Bindings.Posix.Errno, - module Bindings.Posix.Signal, - module Bindings.Posix.Sys.Select, - module Bindings.Posix.Sys.Types, - module Bindings.Posix.Sys.Utsname, - module Bindings.Posix.Time, - module Bindings.Posix.Unistd, - ) where -import Prelude () -import Bindings.Posix.Errno -import Bindings.Posix.Signal -import Bindings.Posix.Sys.Select -import Bindings.Posix.Sys.Types -import Bindings.Posix.Sys.Utsname -import Bindings.Posix.Time -import Bindings.Posix.Unistd - diff --git a/src/Bindings/Posix/Errno.hsc b/src/Bindings/Posix/Errno.hsc index 202a422..5a61327 100644 --- a/src/Bindings/Posix/Errno.hsc +++ b/src/Bindings/Posix/Errno.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <errno.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html> diff --git a/src/Bindings/Posix/Locale.hsc b/src/Bindings/Posix/Locale.hsc new file mode 100644 index 0000000..6b4cf36 --- /dev/null +++ b/src/Bindings/Posix/Locale.hsc @@ -0,0 +1,24 @@ +#include <bindings.dsl.h> +#include <locale.h> + +-- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html> + +module Bindings.Posix.Locale where +#strict_import + +#num LC_MESSAGES +-- #num LC_COLLATE_MASK +-- #num LC_CTYPE_MASK +-- #num LC_MESSAGES_MASK +-- #num LC_MONETARY_MASK +-- #num LC_NUMERIC_MASK +-- #num LC_TIME_MASK +-- #num LC_ALL_MASK + +-- #integral_t locale_t + +-- #ccall duplocale , <locale_t> -> IO <locale_t> +-- #ccall freelocale , <locale_t> -> IO () +-- #ccall newlocale , CInt -> CString -> <locale_t> -> IO <locale_t> +-- #ccall uselocale , <locale_t> -> IO <locale_t> + diff --git a/src/Bindings/Posix/Signal.hsc b/src/Bindings/Posix/Signal.hsc index dbcfdb0..a7eba38 100644 --- a/src/Bindings/Posix/Signal.hsc +++ b/src/Bindings/Posix/Signal.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <signal.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html> @@ -6,7 +6,6 @@ module Bindings.Posix.Signal where #strict_import import Bindings.Posix.Sys.Types -import Bindings.Posix.Time #starttype sigset_t #stoptype @@ -147,8 +146,8 @@ import Bindings.Posix.Time Ptr <sigset_t> -> IO CInt -- ccall sigqueue , <pid_t> -> CInt -> <sigval> -> IO CInt #ccall sigsuspend , Ptr <sigset_t> -> IO CInt -#ccall sigtimedwait , Ptr <sigset_t> -> \ - Ptr <siginfo_t> -> Ptr <timespec> -> IO CInt +-- ccall sigtimedwait , Ptr <sigset_t> -> \ +-- Ptr <siginfo_t> -> Ptr <timespec> -> IO CInt #ccall sigwait , Ptr <sigset_t> -> Ptr CInt -> IO CInt #ccall sigwaitinfo , Ptr <sigset_t> -> Ptr <siginfo_t> -> \ IO CInt diff --git a/src/Bindings/Posix/Sys.hs b/src/Bindings/Posix/Sys.hs new file mode 100644 index 0000000..46d9a8e --- /dev/null +++ b/src/Bindings/Posix/Sys.hs @@ -0,0 +1 @@ +module Bindings.Posix.Sys (module Bindings.Posix.Sys.Select,module Bindings.Posix.Sys.Types,module Bindings.Posix.Sys.Utsname) where {import Bindings.Posix.Sys.Select;import Bindings.Posix.Sys.Types;import Bindings.Posix.Sys.Utsname} diff --git a/src/Bindings/Posix/Sys/Select.hsc b/src/Bindings/Posix/Sys/Select.hsc index aa63548..b08051c 100644 --- a/src/Bindings/Posix/Sys/Select.hsc +++ b/src/Bindings/Posix/Sys/Select.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <sys/select.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html> diff --git a/src/Bindings/Posix/Sys/Types.hsc b/src/Bindings/Posix/Sys/Types.hsc index 6b2c867..fc41054 100644 --- a/src/Bindings/Posix/Sys/Types.hsc +++ b/src/Bindings/Posix/Sys/Types.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <sys/types.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html> diff --git a/src/Bindings/Posix/Sys/Utsname.hsc b/src/Bindings/Posix/Sys/Utsname.hsc index 1b67bb8..41c4aa3 100644 --- a/src/Bindings/Posix/Sys/Utsname.hsc +++ b/src/Bindings/Posix/Sys/Utsname.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <sys/utsname.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html> diff --git a/src/Bindings/Posix/Time.hsc b/src/Bindings/Posix/Time.hsc index 0d0c4e5..0ff8ae2 100644 --- a/src/Bindings/Posix/Time.hsc +++ b/src/Bindings/Posix/Time.hsc @@ -1,15 +1,67 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <time.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html> module Bindings.Posix.Time where #strict_import +import Bindings.Posix.Sys.Types +import Bindings.Posix.Locale +import Bindings.Posix.Signal + +#starttype struct tm +#field tm_sec , CInt +#field tm_min , CInt +#field tm_hour , CInt +#field tm_mday , CInt +#field tm_mon , CInt +#field tm_year , CInt +#field tm_wday , CInt +#field tm_yday , CInt +#field tm_isdst , CInt +#stoptype #starttype struct timespec #field tv_sec , CTime #field tv_nsec , CLong #stoptype -#globalvar tzname , Ptr CString +#starttype struct itimerspec +#field it_interval , <timespec> +#field it_value , <timespec> +#stoptype + +#num CLOCKS_PER_SEC +#num CLOCK_REALTIME +#num TIMER_ABSTIME + +#cinline getdate_err , IO CInt + +#ccall clock_getres , <clockid_t> -> Ptr <timespec> -> IO CInt +#ccall clock_gettime , <clockid_t> -> Ptr <timespec> -> IO CInt +#ccall clock_nanosleep , <clockid_t> -> CInt -> Ptr <timespec> -> Ptr <timespec> -> IO CInt +#ccall clock_settime , <clockid_t> -> Ptr <timespec> -> IO CInt +#ccall difftime , <time_t> -> <time_t> -> IO CDouble +#ccall getdate , CString -> IO (Ptr <tm>) +#ccall gmtime , Ptr <time_t> -> IO (Ptr <tm>) +#ccall gmtime_r , Ptr <time_t> -> Ptr <tm> -> IO (Ptr <tm>) +#ccall localtime , Ptr <time_t> -> IO (Ptr <tm>) +#ccall localtime_r , Ptr <time_t> -> Ptr <tm> -> IO (Ptr <tm>) +#ccall mktime , Ptr <tm> -> IO <time_t> +#ccall nanosleep , Ptr <timespec> -> Ptr <timespec> -> IO CInt + +#ccall strftime , CString -> CSize -> CString -> Ptr <tm> -> IO CSize +-- #ccall strftime_l , CString -> CSize -> CString -> Ptr <tm> -> <locale_t> -> IO CSize +#ccall strptime , CString -> CString -> Ptr <tm> -> IO CString +#ccall time , Ptr <time_t> -> IO <time_t> +#ccall timer_create , <clockid_t> -> Ptr <sigevent> -> Ptr <timer_t> -> IO CInt +#ccall timer_delete , <timer_t> -> IO CInt +#ccall timer_getoverrun , <timer_t> -> IO CInt +#ccall timer_gettime , <timer_t> -> Ptr <itimerspec> -> IO CInt +#ccall timer_settime , <timer_t> -> CInt -> Ptr <itimerspec> -> Ptr <itimerspec> -> IO CInt +#ccall tzset , IO () + +#globalvar daylight , CInt +#globalvar timezone , CLong +#globalarray tzname , CString diff --git a/src/Bindings/Posix/Unistd.hsc b/src/Bindings/Posix/Unistd.hsc index fd643c3..98d5877 100644 --- a/src/Bindings/Posix/Unistd.hsc +++ b/src/Bindings/Posix/Unistd.hsc @@ -1,4 +1,4 @@ -#include <bindings.macros.h> +#include <bindings.dsl.h> #include <unistd.h> -- | <http://www.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html> diff --git a/src/inlines.c b/src/inlines.c index b1e874b..a1c6b90 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -1,27 +1,11 @@ -#include <sys/select.h> - -void -inline_FD_CLR(int a, fd_set *b) -{ - FD_CLR(a,b); -} - -int -inline_FD_ISSET(int a, fd_set *b) -{ - return FD_ISSET(a,b); -} - -void -inline_FD_SET(int a, fd_set *b) -{ - FD_SET(a,b); -} - -void -inline_FD_ZERO(fd_set *b) -{ - FD_ZERO(b); -} - +#include<bindings.cmacros.h> +#include<sys/select.h> +#include<time.h> + +BC_INLINE2VOID(FD_CLR,int,fd_set*) +BC_INLINE2(FD_ISSET,int,fd_set*,int) +BC_INLINE2VOID(FD_SET,int,fd_set*) +BC_INLINE1VOID(FD_ZERO,fd_set*) +BC_INLINE_(getdate_err,int) +BC_GLOBALARRAY(tzname,char*) |