bindings (empty) → 0.0.1
raw patch · 15 files changed
+1927/−0 lines, 15 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +29/−0
- Setup.hs +4/−0
- bindings.cabal +55/−0
- packageCode/include/sqlite3.h +3/−0
- packageCode/sqlite3.c too large to diff
- src/Bindings.c +24/−0
- src/Bindings.hs +123/−0
- src/Bindings/Sqlite3.c +11/−0
- src/Bindings/Sqlite3.hs +657/−0
- src/Bindings/StandardC.c +134/−0
- src/Bindings/StandardC.hs +726/−0
- src/Bindings/Utilities.hs +83/−0
- traduttoreTraditore/Setup.hs +4/−0
- traduttoreTraditore/sqlite3/5minutes.hs +50/−0
- traduttoreTraditore/tt.cabal +24/−0
+ LICENSE view
@@ -0,0 +1,29 @@+Copyright (c) <2009>, <Maurício C. Antunes>+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ * Neither the name of the author nor the names of its contributors+ may be used to endorse or promote products derived from this+ software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,4 @@+#!/usr/bin/env runhaskell++module Main (main) where { import Distribution.Simple ; main =+defaultMain }
+ bindings.cabal view
@@ -0,0 +1,55 @@+cabal-version: >= 1.2+name: bindings+synopsis:+ Low level bindings for foreign libraries+ following community driven guidelines+description: + This package aims at beeing a wide collection of low-level bindings+ covering as much as possible of the functionality of good quality+ libraries, following a common set of community driven guidelines.+ (The current set of guidelines is shown at "Bindings" module+ documentation.) It has been created as an attempt to relieve the+ common situation where developers of high-level modules can't waste+ effort with all details of low-level work, and for those writing+ compreensive and reliable low-level bindings little time is left to+ get the best of Haskell. Developers with good understanding of their+ favorite foreign language libraries and Haskell FFI can benefict+ from contributing to this package by sharing guidelines, tests and+ code facilities, and help each other in issues of reliability and+ portability; and developers of higher-level modules can put their+ efforts where they are needed, with a reliable set of low-level code+ at hand.+version: 0.0.1+license: BSD3+license-file: LICENSE+maintainer: Maurício C. Antunes+author: Maurício C. Antunes+build-type: Simple+category: FFI++library+ hs-source-dirs: src+ extensions:+ ForeignFunctionInterface+ TypeSynonymInstances+ ScopedTypeVariables+ build-depends: base+ exposed-modules:+ Bindings+ Bindings.Utilities+ Bindings.Sqlite3+ Bindings.StandardC+ c-sources:+ src/Bindings.c+ src/Bindings/Sqlite3.c+ src/Bindings/StandardC.c+ packageCode/sqlite3.c+ include-dirs:+ packageCode/include+ cc-options:+ -D SQLITE_ENABLE_FTS3+ -D SQLITE_ENABLE_FTS3_PARENTHESIS+ -D SQLITE_ENABLE_LOCKING_STYLE+ -D SQLITE_ENABLE_MEMORY_MANAGEMENT+ -D SQLITE_ENABLE_MEMSYS5+ -D SQLITE_ENABLE_RTREE
+ packageCode/include/sqlite3.h view
@@ -0,0 +1,3 @@+#define SQLITE_VERSION "3.6.10"+#define SQLITE_VERSION_NUMBER 3006010+extern const char sqlite3_version[];
+ packageCode/sqlite3.c view
file too large to diff
+ src/Bindings.c view
@@ -0,0 +1,24 @@+int sqlite3_initialize(void);+int sqlite3_shutdown(void);++/* Members are set to 1 when libraries+** are initialized, 0 if they are not.+*/+static struct {+ int sqlite3 ;+} bindings_init_info = { 0 } ;++/* Initialization functions should return+** 1 when successfull, 0 otherwise+*/+int bindings_init_sqlite3 () {+ bindings_init_info.sqlite3 = 1 ;+ return (sqlite3_initialize()==0)?1:0 ;+}++void bindings_shutdown () {+ if (bindings_init_info.sqlite3) {+ bindings_init_info.sqlite3 = 0 ;+ sqlite3_shutdown () ;+ }+}
+ src/Bindings.hs view
@@ -0,0 +1,123 @@+{-|++ Modules under "Bindings" are supposed to be low level links to+ non-Haskell packages, sharing a set of community driven guidelines on+ procedures, goals and style. (Note that, until others get interested+ in this work, \"community\" means just the author.) This is the+ current set of guidelines:++ * Code should be portable and easy to build.++ * There should be a one-to-one relashionship between names in the+ original library and its bindings. Also, the behavior of elements+ should be what would be expected from the element of the original+ library it represents.++ * As a planed consequence of the former item, the reference+ documentation for all modules should be the documentation available+ for the original libraries. Documentation and comments to Haskell+ binding code should be restricted to explain decisions that had to be+ made to solve ambiguities or provide functionality that could not be+ mapped to an exact Haskell equivalent.++ * All foreign functions are declared @safe@. Also, they should+ all result in a 'System.IO.IO', even when they are supposed to+ be effect-free. This is both for consistency and security, since+ otherwise it would be difficult to inspect all the code to check which+ functions are actually guaranteed to be effect-free. Constant values,+ however, may be represented by pure functions.++ * Global variables whose values can be changed by a library user+ are wrapped throw type 'Bindings.Utilities.GlobalVar'. When their+ values can't be changed by the user, but still they can change as+ the execution goes, they are wrapped throw functions returning an+ 'System.IO.IO'. (This last case, of course, may need helper functions+ written in the foreign language.)++ * Names in Haskell should match the corresponding names in original+ libraries, prefixed with \'@_@\' when starting with an uppercase+ letter, or with first letter uppercased when naming types. Exception+ is made to prefixes used to emulate namespaces. In this case, prefixes+ are stripped, and they are expected to be replaced by qualified+ imports, e.g., a function named @somepkg_anyfun@ should be named just+ @anyfun@ and may be used as @SomePkg.anyfun@. Also names for basic+ types, like fixed size integers or pointers, should be consistent with+ style used in "Foreign.C.Types".++ * Module "Bindings.Utilities" has an enumeration of function types+ ('Bindings.Utilities.CB0001', 'Bindings.Utilities.CB0002' etc.) which are+ supposed to be used (and incremented when necessary) to type callback+ functions. Foreign functions parameters expecting callback pointers+ should be typed as pointers to function types in that enumeration;+ except when those callbacks are just data destructors, when they+ should be typed as 'Foreign.ForeignPtr.FinalizerPtr'.++ * Users can suggest tests using "Test.HUnit" or "Test.QuickCheck"+ using the bug tracking system. Test shown to be valid will be included+ with a test program included in this package.++ The names for files and directories in the source pack follow the+ usual convention of mapping module names to file names. A similar+ convention is followed by C files that support those modules. There+ are also a few special directories:++ [@packageCode@] This directory contains the source code for the+ foreign libraries. Whe appropriate, steps necessary to build a library+ will be listed in a file here.++ [@packageCode\/include@] Support files needed by this package to+ properly wrapp libraries (like @C@ include files) are placed here.+ They should be simplified as much as possible to contain only the+ required information.++ [@traduttoreTraditore@] Here example code for wrapped libraries can be+ found. However, only Haskell translations for code already available+ for those libraries in \"official\" places (like the homepage for the+ library, or inside its source code distribution) are allowed. Best+ effort should be made to keep those translations faithfull to the+ original code, so that readers could follow then side by side.++-}++module Bindings where+import Foreign+import Foreign.C+import Control.Monad+import Control.Exception++data License = ApacheLicenseV2 | BSD3 | GPL | GPLv3 | LGPL | LGPLv3+ | MIT | MPL | CDDL | CPL | EPL | ArtisticLicenseV2 | OSLv3 | Zlib |+ AfferoGNUv3 | SimPLv2 | Proprietary | Private++data Package = Sqlite3 deriving (Eq, Show)++-- | Given the license you have choosen for your+-- work, this function tells you which libraries+-- in this package you're allowed to use.++whatCanBeUsedWithThisLicense :: License -> [Package]+whatCanBeUsedWithThisLicense _ = [Sqlite3]++-- | When libraries require an initialization call to+-- be made at startup, the related functions are not+-- wrapped. Instead, we use 'initialize' as a common+-- initialization point for all libraries. You can+-- use 'initialize' at the beginning of 'main' and+-- 'shutdown' at the end. Repeated calls to 'initialize'+-- cause no harm.++initialize :: [Package] -> IO ()+initialize p = do+ when (Sqlite3 `elem` p) $ do+ status <- bindings_init_sqlite3+ when (status == 0) $ (throwIO $ AssertionFailed "Failed \+ \initialization of libraries in package 'bindings'.") >> return ()++initializeAll = initialize [Sqlite3]+shutdown = bindings_shutdown++foreign import ccall "bindings_init_sqlite3" bindings_init_sqlite3+ :: IO CInt+foreign import ccall "bindings_shutdown" bindings_shutdown+ :: IO ()+
+ src/Bindings/Sqlite3.c view
@@ -0,0 +1,11 @@+#include <sqlite3.h>++const char* bindings_sqlite3_version (void) {+ return sqlite3_version ;+}+const char* bindings_SQLITE_VERSION (void) {+ return SQLITE_VERSION ;+}+int bindings_VERSION_NUMBER (void) {+ return SQLITE_VERSION_NUMBER ;+}
+ src/Bindings/Sqlite3.hs view
@@ -0,0 +1,657 @@+{-|++ Sqlite is a database API with direct file+ access, instead of network access. You can find+ information and documentation about it at:+ + <www.sqlite.org>+ + Translation notes:+ + * Although the general rule is to type preprocessor constant+ definitions as CInt, _STATIC and _TRANSIENT have been typed as+ pointers to @'Foreign.ForeignPtr.FinalizerPtr' ()@ to be+ consistent with their use.++ * These compile time macros have been defined: @SQLITE_ENABLE_FTS3@,+ @SQLITE_ENABLE_FTS3_PARENTHESIS@, @SQLITE_ENABLE_LOCKING_STYLE@,+ @SQLITE_ENABLE_MEMORY_MANAGEMENT@, @SQLITE_ENABLE_MEMSYS5@ and+ @SQLITE_ENABLE_RTREE@.++-}++module Bindings.Sqlite3 where+import Bindings.Utilities+import Bindings.StandardC+import Foreign+import Foreign.C++-- * Objects++data Sqlite3 = Sqlite3+data Blob = Blob+data Context = Context+data File = File+data IoMethods = IoMethods+data Mutex = Mutex+data Stmt = Stmt+data Value = Value+data Vfs = Vfs++foreign import ccall "&sqlite3_temp_directory" temp_directory+ :: GlobalVar CString++-- * Error codes++_OK, _ERROR, _INTERNAL, _PERM, _ABORT,+ _BUSY, _LOCKED, _NOMEM, _READONLY,+ _INTERRUPT, _IOERR, _CORRUPT, _NOTFOUND,+ _FULL, _CANTOPEN, _PROTOCOL, _EMPTY,+ _SCHEMA, _TOOBIG, _CONSTRAINT, _MISMATCH,+ _MISUSE, _NOLFS, _AUTH, _FORMAT, _RANGE,+ _NOTADB, _ROW, _DONE :: CInt++[_OK, _ERROR, _INTERNAL, _PERM, _ABORT,+ _BUSY, _LOCKED, _NOMEM, _READONLY,+ _INTERRUPT, _IOERR, _CORRUPT, _NOTFOUND,+ _FULL, _CANTOPEN, _PROTOCOL, _EMPTY,+ _SCHEMA, _TOOBIG, _CONSTRAINT, _MISMATCH,+ _MISUSE, _NOLFS, _AUTH, _FORMAT, _RANGE,+ _NOTADB, _ROW, _DONE] = [0..26] ++ [100,101]++-- * Flags for the xAccess VFS method++_ACCESS_EXISTS, _ACCESS_READWRITE, _ACCESS_READ :: CInt++[_ACCESS_EXISTS, _ACCESS_READWRITE, _ACCESS_READ] = [0..2]++-- * Authorizer Action Codes++_CREATE_INDEX, _CREATE_TABLE, _CREATE_TEMP_INDEX,+ _CREATE_TEMP_TABLE, _CREATE_TEMP_TRIGGER,+ _CREATE_TEMP_VIEW, _CREATE_TRIGGER, _CREATE_VIEW,+ _DELETE, _DROP_INDEX, _DROP_TABLE,+ _DROP_TEMP_INDEX, _DROP_TEMP_TABLE, _DROP_TEMP_TRIGGER,+ _DROP_TEMP_VIEW, _DROP_TRIGGER, _DROP_VIEW,+ _INSERT, _PRAGMA, _READ, _SELECT,+ _TRANSACTION, _UPDATE, _ATTACH, _DETACH,+ _ALTERTABLE, _REINDEX, _ANALYZE,+ _CREATE_VTABLE, _DROP_VTABLE, _FUNCTION :: CInt++[_CREATE_INDEX, _CREATE_TABLE, _CREATE_TEMP_INDEX,+ _CREATE_TEMP_TABLE, _CREATE_TEMP_TRIGGER,+ _CREATE_TEMP_VIEW, _CREATE_TRIGGER, _CREATE_VIEW,+ _DELETE, _DROP_INDEX, _DROP_TABLE,+ _DROP_TEMP_INDEX, _DROP_TEMP_TABLE, _DROP_TEMP_TRIGGER,+ _DROP_TEMP_VIEW, _DROP_TRIGGER, _DROP_VIEW,+ _INSERT, _PRAGMA, _READ, _SELECT,+ _TRANSACTION, _UPDATE, _ATTACH, _DETACH,+ _ALTERTABLE, _REINDEX, _ANALYZE,+ _CREATE_VTABLE, _DROP_VTABLE, _FUNCTION] = [1..31]++-- * Text Encodings++_UTF8, _UTF16LE, _UTF16BE, _UTF16, _ANY,+ _UTF16_ALIGNED :: CInt++[_UTF8, _UTF16LE, _UTF16BE, _UTF16, _ANY,+ _UTF16_ALIGNED] = [1..5]++[8]++-- * Fundamental Datatypes++_INTEGER, _FLOAT, _TEXT, _BLOB, _NULL :: CInt++[_INTEGER, _FLOAT, _TEXT, _BLOB, _NULL] = [1..5]++-- * Authorizer Return Codes++_DENY, _IGNORE :: CInt++[_DENY, _IGNORE] = [1,2]++-- * Standard File Control Opcodes++_FCNTL_LOCKSTATE, _GET_LOCKPROXYFILE, _SET_LOCKPROXYFILE,+ _LAST_ERRNO :: CInt++[_FCNTL_LOCKSTATE, _GET_LOCKPROXYFILE, _SET_LOCKPROXYFILE,+ _LAST_ERRNO] = [1..4]++-- * Device Characteristics++_IOCAP_ATOMIC, _IOCAP_ATOMIC512, _IOCAP_ATOMIC1K,+ _IOCAP_ATOMIC2K, _IOCAP_ATOMIC4K, _IOCAP_ATOMIC8K,+ _IOCAP_ATOMIC16K, _IOCAP_ATOMIC32K, _IOCAP_ATOMIC64K,+ _IOCAP_SAFE_APPEND, _IOCAP_SEQUENTIAL :: CInt++[_IOCAP_ATOMIC, _IOCAP_ATOMIC512, _IOCAP_ATOMIC1K,+ _IOCAP_ATOMIC2K, _IOCAP_ATOMIC4K, _IOCAP_ATOMIC8K,+ _IOCAP_ATOMIC16K, _IOCAP_ATOMIC32K, _IOCAP_ATOMIC64K,+ _IOCAP_SAFE_APPEND, _IOCAP_SEQUENTIAL] =+ take 11 $ iterate (* 2) 1++-- * Extended Result Codes++_IOERR_READ, _IOERR_SHORT_READ, _IOERR_WRITE,+ _IOERR_FSYNC, _IOERR_DIR_FSYNC, _IOERR_TRUNCATE,+ _IOERR_FSTAT, _IOERR_UNLOCK, _IOERR_RDLOCK,+ _IOERR_DELETE, _IOERR_BLOCKED, _IOERR_NOMEM,+ _IOERR_ACCESS, _IOERR_CHECKRESERVEDLOCK, _IOERR_LOCK,+ _IOERR_CLOSE, _IOERR_DIR_CLOSE :: CInt++[_IOERR_READ, _IOERR_SHORT_READ, _IOERR_WRITE,+ _IOERR_FSYNC, _IOERR_DIR_FSYNC, _IOERR_TRUNCATE,+ _IOERR_FSTAT, _IOERR_UNLOCK, _IOERR_RDLOCK,+ _IOERR_DELETE, _IOERR_BLOCKED, _IOERR_NOMEM,+ _IOERR_ACCESS, _IOERR_CHECKRESERVEDLOCK, _IOERR_LOCK,+ _IOERR_CLOSE, _IOERR_DIR_CLOSE]+ = map ( (+ _IOERR) . (* 256) ) [1..17]++-- * Run-Time Limit Categories++_LIMIT_LENGTH, _LIMIT_SQL_LENGTH, _LIMIT_COLUMN,+ _LIMIT_EXPR_DEPTH, _LIMIT_COMPOUND_SELECT,+ _LIMIT_VDBE_OP, _LIMIT_FUNCTION_ARG, _LIMIT_ATTACHED,+ _LIMIT_LIKE_PATTERN_LENGTH, _LIMIT_VARIABLE_NUMBER :: CInt++[_LIMIT_LENGTH, _LIMIT_SQL_LENGTH, _LIMIT_COLUMN,+ _LIMIT_EXPR_DEPTH, _LIMIT_COMPOUND_SELECT,+ _LIMIT_VDBE_OP, _LIMIT_FUNCTION_ARG, _LIMIT_ATTACHED,+ _LIMIT_LIKE_PATTERN_LENGTH, _LIMIT_VARIABLE_NUMBER] = [0..9]++-- * File Locking Levels++_LOCK_NONE, _LOCK_SHARED, _LOCK_RESERVED,+ _LOCK_PENDING, _LOCK_EXCLUSIVE :: CInt++[_LOCK_NONE, _LOCK_SHARED, _LOCK_RESERVED,+ _LOCK_PENDING, _LOCK_EXCLUSIVE] = [0..4]++-- * Mutex Types++_MUTEX_FAST, _MUTEX_RECURSIVE, _MUTEX_STATIC_MASTER,+ _MUTEX_STATIC_MEM, _MUTEX_STATIC_MEM2, _MUTEX_STATIC_PRNG,+ _MUTEX_STATIC_LRU, _MUTEX_STATIC_LRU2 :: CInt++[_MUTEX_FAST, _MUTEX_RECURSIVE, _MUTEX_STATIC_MASTER,+ _MUTEX_STATIC_MEM, _MUTEX_STATIC_MEM2, _MUTEX_STATIC_PRNG,+ _MUTEX_STATIC_LRU, _MUTEX_STATIC_LRU2] = [0..7]++-- * Flags For File Open Operations++_OPEN_READONLY, _OPEN_READWRITE, _OPEN_CREATE,+ _OPEN_DELETEONCLOSE, _OPEN_EXCLUSIVE, _OPEN_MAIN_DB,+ _OPEN_TEMP_DB, _OPEN_TRANSIENT_DB, _OPEN_MAIN_JOURNAL,+ _OPEN_TEMP_JOURNAL, _OPEN_SUBJOURNAL,+ _OPEN_MASTER_JOURNAL, _OPEN_NOMUTEX, _OPEN_FULLMUTEX :: CInt++[_OPEN_READONLY, _OPEN_READWRITE, _OPEN_CREATE,+ _OPEN_DELETEONCLOSE, _OPEN_EXCLUSIVE, _OPEN_MAIN_DB,+ _OPEN_TEMP_DB, _OPEN_TRANSIENT_DB, _OPEN_MAIN_JOURNAL,+ _OPEN_TEMP_JOURNAL, _OPEN_SUBJOURNAL,+ _OPEN_MASTER_JOURNAL, _OPEN_NOMUTEX, _OPEN_FULLMUTEX] =+ map bit $ [0..4] ++ [8..16]++-- * Constants Defining Special Destructor Behavior++_STATIC, _TRANSIENT :: FinalizerPtr ()++[_STATIC, _TRANSIENT] = map cast [0,(-1)]+ where+ cast :: IntPtr -> FinalizerPtr ()+ cast n = castPtrToFunPtr $ intPtrToPtr n++-- * Synchronization Type Flags++_SYNC_NORMAL, _SYNC_FULL, _SYNC_DATAONLY :: CInt++[_SYNC_NORMAL, _SYNC_FULL, _SYNC_DATAONLY] = [0x2, 0x3, 0x10]++-- * Compile-Time Library Version Numbers++foreign import ccall "bindings_sqlite3_version" version+ :: CString++foreign import ccall "bindings_SQLITE_VERSION" _VERSION+ :: CString++foreign import ccall "bindings_VERSION_NUMBER" _VERSION_NUMBER+ :: CInt++-- * Functions++foreign import ccall "sqlite3_aggregate_context" aggregate_context+ :: Ptr Context -> CInt -> IO (Ptr a)++foreign import ccall "sqlite3_auto_extension" auto_extension+ :: Ptr a -> IO CInt++foreign import ccall "sqlite3_bind_blob" bind_blob+ :: Ptr Stmt -> CInt -> Ptr a -> CInt -> FinalizerPtr a+ -> IO CInt++foreign import ccall "sqlite3_bind_double" bind_double+ :: Ptr Stmt -> CInt -> CDouble -> IO CInt++foreign import ccall "sqlite3_bind_int" bind_int+ :: Ptr Stmt -> CInt -> CInt -> IO CInt++foreign import ccall "sqlite3_bind_int64" bind_int64+ :: Ptr Stmt -> CInt -> CInt64 -> IO CInt++foreign import ccall "sqlite3_bind_null" bind_null+ :: Ptr Stmt -> CInt -> IO CInt++foreign import ccall "sqlite3_bind_parameter_count" bind_parameter_count+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_bind_parameter_index" bind_parameter_index+ :: Ptr Stmt -> CString -> IO CInt++foreign import ccall "sqlite3_bind_parameter_name" bind_parameter_name+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_bind_text" bind_text+ :: Ptr Stmt -> CInt -> CString -> CInt -> FinalizerPtr CString+ -> IO CInt++foreign import ccall "sqlite3_bind_text16" bind_text16+ :: Ptr Stmt -> CInt -> CString -> CInt -> FinalizerPtr CString+ -> IO CInt++foreign import ccall "sqlite3_bind_value" bind_value+ :: Ptr Stmt -> CInt -> Ptr Value -> IO CInt++foreign import ccall "sqlite3_bind_zeroblob" bind_zeroblob+ :: Ptr Stmt -> CInt -> CInt -> IO CInt++foreign import ccall "sqlite3_blob_bytes" blob_bytes+ :: Ptr Blob -> IO CInt++foreign import ccall "sqlite3_blob_close" blob_close+ :: Ptr Blob -> IO CInt++foreign import ccall "sqlite3_blob_open" blob_open+ :: Ptr Sqlite3 -> CString -> CString -> CString -> CInt64 -> CInt+ -> Ptr (Ptr Blob) -> IO CInt++foreign import ccall "sqlite3_blob_read" blob_read+ :: Ptr Blob -> Ptr a -> CInt -> CInt -> IO CInt++foreign import ccall "sqlite3_blob_write" blob_write+ :: Ptr Blob -> Ptr a -> CInt -> CInt -> IO CInt++foreign import ccall "sqlite3_busy_handler" busy_handler+ :: Ptr Sqlite3 -> FunPtr (CB0003 a) -> Ptr a -> IO CInt++foreign import ccall "sqlite3_busy_timeout" busy_timeout+ :: Ptr Sqlite3 -> CInt -> IO CInt++foreign import ccall "sqlite3_changes" changes+ :: Ptr Sqlite3 -> IO CInt++foreign import ccall "sqlite3_clear_bindings" clear_bindings+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_close" close+ :: Ptr Sqlite3 -> IO CInt++foreign import ccall "sqlite3_collation_needed" collation_needed+ :: Ptr Sqlite3 -> Ptr a -> FunPtr (CB0004 a Sqlite3)+ -> IO CInt++foreign import ccall "sqlite3_collation_needed16" collation_needed16+ :: Ptr Sqlite3 -> Ptr a -> FunPtr (CB0004 a Sqlite3)+ -> IO CInt++foreign import ccall "sqlite3_column_blob" column_blob+ :: Ptr Stmt -> CInt -> IO (Ptr a)++foreign import ccall "sqlite3_column_bytes" column_bytes+ :: Ptr Stmt -> CInt -> IO CInt++foreign import ccall "sqlite3_column_bytes16" column_bytes16+ :: Ptr Stmt -> CInt -> IO CInt++foreign import ccall "sqlite3_column_count" column_count+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_column_decltype" column_decltype+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_decltype16" column_decltype16+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_double" column_double+ :: Ptr Stmt -> CInt -> IO Double++foreign import ccall "sqlite3_column_int" column_int+ :: Ptr Stmt -> CInt -> IO CInt++foreign import ccall "sqlite3_column_int64" column_int64+ :: Ptr Stmt -> CInt -> IO CInt64++foreign import ccall "sqlite3_column_name" column_name+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_name16" column_name16+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_text" column_text+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_text16" column_text16+ :: Ptr Stmt -> CInt -> IO CString++foreign import ccall "sqlite3_column_type" column_type+ :: Ptr Stmt -> CInt -> IO CInt++foreign import ccall "sqlite3_column_value" column_value+ :: Ptr Stmt -> CInt -> IO (Ptr Value)++foreign import ccall "sqlite3_commit_hook" commit_hook+ :: Ptr Stmt -> FunPtr (CB0005 a) -> Ptr a -> IO (Ptr b)++foreign import ccall "sqlite3_complete" complete+ :: CString -> IO CInt++foreign import ccall "sqlite3_complete16" complete16+ :: CString -> IO CInt++foreign import ccall "sqlite3_context_db_handle" context_db_handle+ :: Ptr Context -> IO (Ptr Sqlite3)++foreign import ccall "sqlite3_create_collation" create_collation+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr a -> FunPtr+ (CB0006 a) -> IO CInt++foreign import ccall "sqlite3_create_collation16" create_collation16+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr a -> FunPtr+ (CB0006 a) -> IO CInt++foreign import ccall "sqlite3_create_collation_v2" create_collation_v2+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr a -> FunPtr+ (CB0006 a) -> FinalizerPtr a -> IO CInt++foreign import ccall "sqlite3_create_function" create_function+ :: Ptr Sqlite3 -> CString -> CInt -> CInt -> Ptr a -> FunPtr+ (CB0007 Context Value) -> FunPtr (CB0007 Context Value)+ -> FunPtr (CB0008 Context) -> IO CInt++foreign import ccall "sqlite3_create_function16" createFunction16+ :: Ptr Sqlite3 -> CString -> CInt -> CInt -> Ptr a -> FunPtr+ (CB0007 Context Value) -> FunPtr (CB0007 Context Value)+ -> FunPtr (CB0008 Context) -> IO CInt++foreign import ccall "sqlite3_data_count" data_count+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_db_handle" db_handle+ :: Ptr Stmt -> IO (Ptr Sqlite3)++foreign import ccall "sqlite3_db_mutex" db_mutex+ :: Ptr Sqlite3 -> IO (Ptr Mutex)++foreign import ccall "sqlite3_enable_load_extension" enable_load_extension+ :: Ptr Sqlite3 -> CInt -> IO CInt++foreign import ccall "sqlite3_enable_shared_cache" enable_shared_cache+ :: CInt -> IO CInt++foreign import ccall "sqlite3_errcode" errcode+ :: Ptr Sqlite3 -> IO CInt++foreign import ccall "sqlite3_errmsg" errmsg+ :: Ptr Sqlite3 -> IO CString++foreign import ccall "sqlite3_errmsg16" errmsg16+ :: Ptr Sqlite3 -> IO CString++foreign import ccall "sqlite3_exec" exec+ :: Ptr Sqlite3 -> CString -> FunPtr (CB0001 a)+ -> Ptr a -> Ptr CString -> IO CInt++foreign import ccall "sqlite3_extended_result_codes" extended_result_codes+ :: Ptr Sqlite3 -> CInt -> IO CInt++foreign import ccall "sqlite3_file_control" file_control+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr a -> IO CInt++foreign import ccall "sqlite3_finalize" finalize+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_free" free+ :: Ptr a -> IO ()++foreign import ccall "sqlite3_free_table" free_table+ :: Ptr CString -> IO ()++foreign import ccall "sqlite3_get_autocommit" get_autocommit+ :: Ptr Sqlite3 -> IO CInt++foreign import ccall "sqlite3_get_auxdata" get_aux_data+ :: Ptr Sqlite3 -> CInt -> IO (Ptr a)++foreign import ccall "sqlite3_get_table" get_table+ :: Ptr Sqlite3 -> CString -> Ptr (Ptr CString) -> Ptr CInt+ -> Ptr CInt -> Ptr CString++foreign import ccall "sqlite3_interrupt" interrupt+ :: Ptr Sqlite3 -> IO ()++foreign import ccall "sqlite3_last_insert_rowid" last_insert_rowid+ :: Ptr Sqlite3 -> IO CInt64++foreign import ccall "sqlite3_libversion" libversion+ :: IO CString++foreign import ccall "sqlite3_libversion_number" libversion_number+ :: IO CInt++foreign import ccall "sqlite3_limit" limit+ :: Ptr Sqlite3 -> CInt -> CInt -> IO CInt++foreign import ccall "sqlite3_load_extension" load_extension+ :: Ptr Sqlite3 -> CString -> CString -> Ptr CString -> IO CInt++foreign import ccall "sqlite3_malloc" malloc+ :: CInt -> IO (Ptr a)++foreign import ccall "sqlite3_memory_highwater" memory_highwater+ :: CInt -> IO CInt64++foreign import ccall "sqlite3_memory_used" memory_used+ :: IO CInt64++foreign import ccall "sqlite3_mutex_alloc" mutex_alloc+ :: CInt -> IO (Ptr Mutex)++foreign import ccall "sqlite3_mutex_enter" mutex_enter+ :: Ptr Mutex -> IO ()++foreign import ccall "sqlite3_mutex_free" mutex_free+ :: Ptr Mutex -> IO ()++foreign import ccall "sqlite3_mutex_leave" mutex_leave+ :: Ptr Mutex -> IO ()++foreign import ccall "sqlite3_mutex_try" mutex_try+ :: Ptr Mutex -> IO CInt++foreign import ccall "sqlite3_next_stmt" next_stmt+ :: Ptr Sqlite3 -> Ptr Stmt -> IO (Ptr Stmt)++foreign import ccall "sqlite3_open" open+ :: CString -> Ptr (Ptr Sqlite3) -> IO CInt++foreign import ccall "sqlite3_open16" open16+ :: CString -> Ptr (Ptr Sqlite3) -> IO CInt++foreign import ccall "sqlite3_open_v2" open_v2+ :: CString -> Ptr (Ptr Sqlite3) -> CInt -> CString -> IO CInt++foreign import ccall "sqlite3_prepare" prepare+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr (Ptr Stmt) -> Ptr CString+ -> IO CInt++foreign import ccall "sqlite3_prepare16" prepare16+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr (Ptr Stmt) -> Ptr CString+ -> IO CInt++foreign import ccall "sqlite3_prepare16_v2" prepare16_v2+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr (Ptr Stmt) -> Ptr CString+ -> IO CInt++foreign import ccall "sqlite3_prepare_v2" prepare_v2+ :: Ptr Sqlite3 -> CString -> CInt -> Ptr (Ptr Stmt) -> Ptr CString+ -> IO CInt++foreign import ccall "sqlite3_progress_handler" progress_handler+ :: Ptr Sqlite3 -> CInt -> FunPtr (CB0005 a) -> Ptr a+ -> IO ()++foreign import ccall "sqlite3_randomness" randomness+ :: CInt -> Ptr a -> IO ()++foreign import ccall "sqlite3_realloc" realloc+ :: Ptr a -> CInt -> IO (Ptr a)++foreign import ccall "sqlite3_release_memory" release_memory+ :: CInt -> IO CInt++foreign import ccall "sqlite3_reset" reset+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_reset_auto_extension" reset_auto_extension+ :: IO ()++foreign import ccall "sqlite3_result_blob" result_blob+ :: Ptr Context -> Ptr a -> CInt -> FinalizerPtr a -> IO ()++foreign import ccall "sqlite3_result_double" result_double+ :: Ptr Context -> CDouble -> IO ()++foreign import ccall "sqlite3_result_error" result_error+ :: Ptr Context -> CString -> IO ()++foreign import ccall "sqlite3_result_error16" result_error16+ :: Ptr Context -> CString -> IO ()++foreign import ccall "sqlite3_result_error_code" result_error_code+ :: Ptr Context -> CInt -> IO ()++foreign import ccall "sqlite3_result_error_nomem" result_error_nomem+ :: Ptr Context -> IO ()++foreign import ccall "sqlite3_result_error_toobig" result_error_toobig+ :: Ptr Context -> IO ()++foreign import ccall "sqlite3_result_int" result_int+ :: Ptr Context -> CInt -> IO ()++foreign import ccall "sqlite3_result_int64" result_int64+ :: Ptr Context -> CInt64 -> IO ()++foreign import ccall "sqlite3_result_null" result_null+ :: Ptr Context -> IO ()++foreign import ccall "sqlite3_result_text" result_text+ :: Ptr Context -> CString -> CInt -> FinalizerPtr CString+ -> IO ()++foreign import ccall "sqlite3_result_text16" result_text16+ :: Ptr Context -> CString -> CInt -> FinalizerPtr CString+ -> IO ()++foreign import ccall "sqlite3_result_text16be" result_text16be+ :: Ptr Context -> CString -> CInt -> FinalizerPtr CString+ -> IO ()++foreign import ccall "sqlite3_result_text16le" result_text16le+ :: Ptr Context -> CString -> CInt -> FinalizerPtr CString+ -> IO ()++foreign import ccall "sqlite3_result_value" result_value+ :: Ptr Context -> Ptr Value -> IO ()++foreign import ccall "sqlite3_result_zeroblob" result_zeroblob+ :: Ptr Context -> CInt -> IO ()++foreign import ccall "sqlite3_rollback_hook" rollback_hook+ :: Ptr Sqlite3 -> FunPtr (CB0008 a) -> Ptr a+ -> IO (Ptr a)++foreign import ccall "sqlite3_set_authorizer" set_authorizer+ :: Ptr Sqlite3 -> FunPtr (CB0009 a) -> Ptr a -> IO CInt++foreign import ccall "sqlite3_set_auxdata" set_auxdata+ :: Ptr Context -> CInt -> Ptr a -> FinalizerPtr a -> IO ()++foreign import ccall "sqlite3_sleep" sleep+ :: CInt -> IO CInt++foreign import ccall "sqlite3_soft_heap_limit" soft_heap_limit+ :: CInt -> IO ()++foreign import ccall "sqlite3_sql" sql+ :: Ptr Stmt -> IO CString++foreign import ccall "sqlite3_step" step+ :: Ptr Stmt -> IO CInt++foreign import ccall "sqlite3_threadsafe" threadsafe+ :: IO CInt++foreign import ccall "sqlite3_total_changes" total_changes+ :: Ptr Sqlite3 -> IO CInt++foreign import ccall "sqlite3_update_hook" update_hook+ :: Ptr Sqlite3 -> FunPtr (CB000A a) -> Ptr a -> IO (Ptr a)++foreign import ccall "sqlite3_user_data" user_data+ :: Ptr Context -> IO (Ptr a)++foreign import ccall "sqlite3_value_blob" value_blob+ :: Ptr Value -> IO (Ptr a)++foreign import ccall "sqlite3_value_bytes" value_bytes+ :: Ptr Value -> IO CInt++foreign import ccall "sqlite3_value_bytes16" value_bytes16+ :: Ptr Value -> IO CInt++foreign import ccall "sqlite3_value_double" value_double+ :: Ptr Value -> IO CDouble++foreign import ccall "sqlite3_value_int" value_int+ :: Ptr Value -> IO CInt++foreign import ccall "sqlite3_value_int64" value_int64+ :: Ptr Value -> IO CInt64++foreign import ccall "sqlite3_value_numeric_type" value_numeric_type+ :: Ptr Value -> IO CInt++foreign import ccall "sqlite3_value_text" value_text+ :: Ptr Value -> IO CString++foreign import ccall "sqlite3_value_text16" value_text16+ :: Ptr Value -> IO CString++foreign import ccall "sqlite3_value_text16be" value_text16be+ :: Ptr Value -> IO CString++foreign import ccall "sqlite3_value_text16le" value_text16le+ :: Ptr Value -> IO CString++foreign import ccall "sqlite3_value_type" value_type+ :: Ptr Value -> IO CInt++foreign import ccall "sqlite3_vfs_find" vfs_find+ :: CString -> IO (Ptr Vfs)++foreign import ccall "sqlite3_vfs_register" vfs_register+ :: Ptr Vfs -> CInt -> IO CInt++foreign import ccall "sqlite3_vfs_unregister" vfs_unregister+ :: Ptr Vfs -> IO CInt
+ src/Bindings/StandardC.c view
@@ -0,0 +1,134 @@+#include <limits.h>++int bindings_sc_CHAR_BIT (void) {+ return CHAR_BIT ;+}+int bindings_sc_MB_LEN_MAX (void) {+ return MB_LEN_MAX ;+}++#include <locale.h>++int bindings_sc_LC_ALL (void) {+ return LC_ALL ;+}+int bindings_sc_LC_COLLATE (void) {+ return LC_COLLATE ;+}+int bindings_sc_LC_CTYPE (void) {+ return LC_CTYPE ;+}+int bindings_sc_LC_MONETARY (void) {+ return LC_MONETARY ;+}+int bindings_sc_LC_NUMERIC (void) {+ return LC_NUMERIC ;+}+int bindings_sc_LC_TIME (void) {+ return LC_TIME ;+}++#include <math.h>++double bindings_sc_HUGE_VAL (void) {+ return HUGE_VAL ;+}++#include <signal.h>++void (*bindings_cs_SIG_DFL (int sig, void (*func)(int))) (int) {+ return SIG_DFL ;+}+void (*bindings_cs_SIG_ERR (int sig, void (*func)(int))) (int) {+ return SIG_ERR ;+}+void (*bindings_cs_SIG_IGN (int sig, void (*func)(int))) (int) {+ return SIG_IGN ;+}+int bindings_cs_SIGABRT (void) {+ return SIGABRT ;+}+int bindings_cs_SIGFPE (void) {+ return SIGFPE ;+}+int bindings_cs_SIGILL (void) {+ return SIGILL ;+}+int bindings_cs_SIGINT (void) {+ return SIGINT ;+}+int bindings_cs_SIGSEGV (void) {+ return SIGSEGV ;+}+int bindings_cs_SIGTERM (void) {+ return SIGTERM ;+}++#include <stdio.h>++int bindings_cs_IOFBF (void) {+ return _IOFBF ;+}+int bindings_cs_IOLBF (void) {+ return _IOLBF ;+}+int bindings_cs_IONBF (void) {+ return _IONBF ;+}+int bindings_cs_BUFSIZ (void) {+ return BUFSIZ ;+}+int bindings_cs_EOF (void) {+ return EOF ;+}+int bindings_cs_FOPEN_MAX (void) {+ return FOPEN_MAX ;+}+int bindings_cs_FILENAME_MAX (void) {+ return FILENAME_MAX ;+}+int bindings_cs_L_tmpnam (void) {+ return L_tmpnam ;+}+int bindings_cs_SEEK_CUR (void) {+ return SEEK_CUR ;+}+int bindings_cs_SEEK_END (void) {+ return SEEK_END ;+}+int bindings_cs_SEEK_SET (void) {+ return SEEK_SET ;+}+int bindings_cs_TMP_MAX (void) {+ return TMP_MAX ;+}+FILE* bindings_cs_stderr (void) {+ return stderr ;+}+FILE* bindings_cs_stdin (void) {+ return stdin ;+}+FILE* bindings_cs_stdout (void) {+ return stdout ;+}++#include <stdlib.h>++int bindings_cs_EXIT_FAILURE (void) {+ return EXIT_FAILURE ;+}+int bindings_cs_EXIT_SUCCESS (void) {+ return EXIT_SUCCESS ;+}+int bindings_cs_RAND_MAX (void) {+ return RAND_MAX ;+}+size_t bindings_cs_MB_CUR_MAX (void) {+ return MB_CUR_MAX ;+}++#include <time.h>++clock_t bindings_cs_CLOCKS_PER_SEC (void) {+ return CLOCKS_PER_SEC ;+}
+ src/Bindings/StandardC.hs view
@@ -0,0 +1,726 @@+module Bindings.StandardC where+import Bindings.Utilities+import Foreign+import Foreign.C+import qualified Data.Int+import qualified Data.Word++-- * @ctype.h@++foreign import ccall "isalnum" isalnum+ :: CInt -> IO CInt+foreign import ccall "isalpha" isalpha+ :: CInt -> IO CInt+foreign import ccall "isblank" isblank+ :: CInt -> IO CInt+foreign import ccall "iscntrl" iscntrl+ :: CInt -> IO CInt+foreign import ccall "isdigit" isdigit+ :: CInt -> IO CInt+foreign import ccall "isgraph" isgraph+ :: CInt -> IO CInt+foreign import ccall "islower" islower+ :: CInt -> IO CInt+foreign import ccall "isprint" isprint+ :: CInt -> IO CInt+foreign import ccall "ispunct" ispunct+ :: CInt -> IO CInt+foreign import ccall "isspace" isspace+ :: CInt -> IO CInt+foreign import ccall "isupper" isupper+ :: CInt -> IO CInt+foreign import ccall "isxdigit" isxdigit+ :: CInt -> IO CInt+foreign import ccall "tolower" tolower+ :: CInt -> IO CInt+foreign import ccall "toupper" toupper+ :: CInt -> IO CInt+foreign import ccall "bindings_sc_CHAR_BIT" _CHAR_BIT+ :: CInt+foreign import ccall "bindings_sc_MB_LEN_MAX" _MB_LEN_MAX+ :: CInt++-- * @locale.h@++foreign import ccall "bindings_sc_LC_ALL" _LC_ALL+ :: CInt+foreign import ccall "bindings_sc_LC_COLLATE" _LC_COLLATE+ :: CInt+foreign import ccall "bindings_sc_LC_CTYPE" _LC_CTYPE+ :: CInt+foreign import ccall "bindings_sc_LC_MONETARY" _LC_MONETARY+ :: CInt+foreign import ccall "bindings_sc_LC_NUMERIC" _LC_NUMERIC+ :: CInt+foreign import ccall "bindings_sc_LC_TIME" _LC_TIME+ :: CInt+foreign import ccall "setlocale" setlocale+ :: CInt -> CString -> IO CString++-- * @math.h@++foreign import ccall "acos" acos+ :: CDouble -> IO CDouble+foreign import ccall "acosf" acosf+ :: CFloat -> IO CFloat+foreign import ccall "acosl" acosl+ :: CLDouble -> IO CLDouble+foreign import ccall "asin" asin+ :: CDouble -> IO CDouble+foreign import ccall "asinf" asinf+ :: CFloat -> IO CFloat+foreign import ccall "asinl" asinl+ :: CLDouble -> IO CLDouble+foreign import ccall "atan" atan+ :: CDouble -> IO CDouble+foreign import ccall "atanf" atanf+ :: CFloat -> IO CFloat+foreign import ccall "atanl" atanl+ :: CLDouble -> IO CLDouble+foreign import ccall "atan2" atan2+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "atan2f" atan2f+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "atan2l" atan2l+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "cos" cos+ :: CDouble -> IO CDouble+foreign import ccall "cosf" cosf+ :: CFloat -> IO CFloat+foreign import ccall "cosl" cosl+ :: CLDouble -> IO CLDouble+foreign import ccall "sin" sin+ :: CDouble -> IO CDouble+foreign import ccall "sinf" sinf+ :: CFloat -> IO CFloat+foreign import ccall "sinl" sinl+ :: CLDouble -> IO CLDouble+foreign import ccall "tan" tan+ :: CDouble -> IO CDouble+foreign import ccall "tanf" tanf+ :: CFloat -> IO CFloat+foreign import ccall "tanl" tanl+ :: CLDouble -> IO CLDouble+foreign import ccall "acosh" acosh+ :: CDouble -> IO CDouble+foreign import ccall "acoshf" acoshf+ :: CFloat -> IO CFloat+foreign import ccall "acoshl" acoshl+ :: CLDouble -> IO CLDouble+foreign import ccall "asinh" asinh+ :: CDouble -> IO CDouble+foreign import ccall "asinhf" asinhf+ :: CFloat -> IO CFloat+foreign import ccall "asinhl" asinhl+ :: CLDouble -> IO CLDouble+foreign import ccall "atanh" atanh+ :: CDouble -> IO CDouble+foreign import ccall "atanhf" atanhf+ :: CFloat -> IO CFloat+foreign import ccall "atanhl" atanhl+ :: CLDouble -> IO CLDouble+foreign import ccall "cosh" cosh+ :: CDouble -> IO CDouble+foreign import ccall "coshf" coshf+ :: CFloat -> IO CFloat+foreign import ccall "coshl" coshl+ :: CLDouble -> IO CLDouble+foreign import ccall "sinh" sinh+ :: CDouble -> IO CDouble+foreign import ccall "sinhf" sinhf+ :: CFloat -> IO CFloat+foreign import ccall "sinhl" sinhl+ :: CLDouble -> IO CLDouble+foreign import ccall "tanh" tanh+ :: CDouble -> IO CDouble+foreign import ccall "tanhf" tanhf+ :: CFloat -> IO CFloat+foreign import ccall "tanhl" tanhl+ :: CLDouble -> IO CLDouble+foreign import ccall "exp" exp+ :: CDouble -> IO CDouble+foreign import ccall "expf" expf+ :: CFloat -> IO CFloat+foreign import ccall "expl" expl+ :: CLDouble -> IO CLDouble+foreign import ccall "exp2" exp2+ :: CDouble -> IO CDouble+foreign import ccall "exp2f" exp2f+ :: CFloat -> IO CFloat+foreign import ccall "exp2l" exp2l+ :: CLDouble -> IO CLDouble+foreign import ccall "expm1" expm1+ :: CDouble -> IO CDouble+foreign import ccall "expm1f" expm1f+ :: CFloat -> IO CFloat+foreign import ccall "expm1l" expm1l+ :: CLDouble -> IO CLDouble+foreign import ccall "frexp" frexp+ :: CDouble -> Ptr CInt -> IO CDouble+foreign import ccall "frexpf" frexpf+ :: CFloat -> Ptr CInt -> IO CFloat+foreign import ccall "frexpl" frexpl+ :: CLDouble -> Ptr CInt -> IO CLDouble+foreign import ccall "ilogb" ilogb+ :: CDouble -> IO CInt+foreign import ccall "ilogbf" ilogbf+ :: CFloat -> IO CFloat+foreign import ccall "ilogbl" ilogbl+ :: CLDouble -> IO CLDouble+foreign import ccall "ldexp" ldexp+ :: CDouble -> CInt -> IO CDouble+foreign import ccall "ldexpf" ldexpf+ :: CFloat -> CInt -> IO CFloat+foreign import ccall "ldexpl" ldexpl+ :: CLDouble -> CInt -> IO CLDouble+foreign import ccall "log" log+ :: CDouble -> IO CDouble+foreign import ccall "logf" logf+ :: CFloat -> IO CFloat+foreign import ccall "logl" logl+ :: CLDouble -> IO CLDouble+foreign import ccall "log10" log10+ :: CDouble -> IO CDouble+foreign import ccall "log10f" log10f+ :: CFloat -> IO CFloat+foreign import ccall "log10l" log10l+ :: CLDouble -> IO CLDouble+foreign import ccall "log1p" log1p+ :: CDouble -> IO CDouble+foreign import ccall "log1pf" log1pf+ :: CFloat -> IO CFloat+foreign import ccall "log1pl" log1pl+ :: CLDouble -> IO CLDouble+foreign import ccall "log2" log2+ :: CDouble -> IO CDouble+foreign import ccall "log2f" log2f+ :: CFloat -> IO CFloat+foreign import ccall "log2l" log2l+ :: CLDouble -> IO CLDouble+foreign import ccall "logb" logb+ :: CDouble -> IO CDouble+foreign import ccall "logbf" logbf+ :: CFloat -> IO CFloat+foreign import ccall "logbl" logbl+ :: CLDouble -> IO CLDouble+foreign import ccall "modf" modf+ :: CDouble -> Ptr CDouble -> IO CDouble+foreign import ccall "modff" modff+ :: CFloat -> Ptr CFloat -> IO CFloat+foreign import ccall "modfl" modfl+ :: CLDouble -> Ptr CLDouble -> IO CLDouble+foreign import ccall "scalbn" scalbn+ :: CDouble -> CInt -> IO CDouble+foreign import ccall "scalbnf" scalbnf+ :: CFloat -> CInt -> IO CFloat+foreign import ccall "scalbnl" scalbnl+ :: CLDouble -> CInt -> IO CLDouble+foreign import ccall "scalbln" scalbln+ :: CDouble -> CLong -> IO CDouble+foreign import ccall "scalblnf" scalblnf+ :: CFloat -> CLong -> IO CFloat+foreign import ccall "scalblnl" scalblnl+ :: CLDouble -> CLong -> IO CLDouble+foreign import ccall "cbrt" cbrt+ :: CDouble -> IO CDouble+foreign import ccall "cbrtf" cbrtf+ :: CFloat -> IO CFloat+foreign import ccall "cbrtl" cbrtl+ :: CLDouble -> IO CLDouble+foreign import ccall "fabs" fabs+ :: CDouble -> IO CDouble+foreign import ccall "fabsf" fabsf+ :: CFloat -> IO CFloat+foreign import ccall "fabsl" fabsl+ :: CLDouble -> IO CLDouble+foreign import ccall "hypot" hypot+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "hypotf" hypotf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "hypotl" hypotl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "pow" pow+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "powf" powf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "powl" powl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "sqrt" sqrt+ :: CDouble -> IO CDouble+foreign import ccall "sqrtf" sqrtf+ :: CFloat -> IO CFloat+foreign import ccall "sqrtl" sqrtl+ :: CLDouble -> IO CLDouble+foreign import ccall "erf" erf+ :: CDouble -> IO CDouble+foreign import ccall "erff" erff+ :: CFloat -> IO CFloat+foreign import ccall "erfl" erfl+ :: CLDouble -> IO CLDouble+foreign import ccall "erfc" erfc+ :: CDouble -> IO CDouble+foreign import ccall "erfcf" erfcf+ :: CFloat -> IO CFloat+foreign import ccall "erfcl" erfcl+ :: CLDouble -> IO CLDouble+foreign import ccall "lgamma" lgamma+ :: CDouble -> IO CDouble+foreign import ccall "lgammaf" lgammaf+ :: CFloat -> IO CFloat+foreign import ccall "lgammal" lgammal+ :: CLDouble -> IO CLDouble+foreign import ccall "tgamma" tgamma+ :: CDouble -> IO CDouble+foreign import ccall "tgammaf" tgammaf+ :: CFloat -> IO CFloat+foreign import ccall "tgammal" tgammal+ :: CLDouble -> IO CLDouble+foreign import ccall "ceil" ceil+ :: CDouble -> IO CDouble+foreign import ccall "ceilf" ceilf+ :: CFloat -> IO CFloat+foreign import ccall "ceill" ceill+ :: CLDouble -> IO CLDouble+foreign import ccall "floor" floor+ :: CDouble -> IO CDouble+foreign import ccall "floorf" floorf+ :: CFloat -> IO CFloat+foreign import ccall "floorl" floorl+ :: CLDouble -> IO CLDouble+foreign import ccall "nearbyint" nearbyint+ :: CDouble -> IO CDouble+foreign import ccall "nearbyintf" nearbyintf+ :: CFloat -> IO CFloat+foreign import ccall "nearbyintl" nearbyintl+ :: CLDouble -> IO CLDouble+foreign import ccall "rint" rint+ :: CDouble -> IO CDouble+foreign import ccall "rintf" rintf+ :: CFloat -> IO CFloat+foreign import ccall "rintl" rintl+ :: CLDouble -> IO CLDouble+foreign import ccall "lrint" lrint+ :: CDouble -> IO CLong+foreign import ccall "lrintf" lrintf+ :: CFloat -> IO CLong+foreign import ccall "lrintl" lrintl+ :: CLDouble -> IO CLong+foreign import ccall "llrint" llrint+ :: CDouble -> IO CLLong+foreign import ccall "llrintf" llrintf+ :: CFloat -> IO CLLong+foreign import ccall "llrintl" llrintl+ :: CLDouble -> IO CLLong+foreign import ccall "round" round+ :: CDouble -> IO CDouble+foreign import ccall "roundf" roundf+ :: CFloat -> IO CFloat+foreign import ccall "roundl" roundl+ :: CLDouble -> IO CLDouble+foreign import ccall "lround" lround+ :: CDouble -> IO CLong+foreign import ccall "lroundf" lroundf+ :: CFloat -> IO CLong+foreign import ccall "lroundl" lroundl+ :: CLDouble -> IO CLDouble+foreign import ccall "llround" llround+ :: CDouble -> IO CLLong+foreign import ccall "llroundf" llroundf+ :: CFloat -> IO CLLong+foreign import ccall "llroundl" llroundl+ :: CLDouble -> IO CLLong+foreign import ccall "trunc" trunc+ :: CDouble -> IO CDouble+foreign import ccall "truncf" truncf+ :: CFloat -> IO CFloat+foreign import ccall "truncl" truncl+ :: CLDouble -> IO CLDouble+foreign import ccall "fmod" fmod+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "fmodf" fmodf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "fmodl" fmodl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "remainder" remainder+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "remainderf" remainderf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "remainderl" remainderl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "remquo" remquo+ :: CDouble -> CDouble -> Ptr CInt -> IO CDouble+foreign import ccall "remquof" remquof+ :: CFloat -> CFloat -> Ptr CInt -> IO CFloat+foreign import ccall "remquol" remquol+ :: CLDouble -> CLDouble -> Ptr CInt -> IO CLDouble+foreign import ccall "nan" nan+ :: CString -> IO CDouble+foreign import ccall "nanf" nanf+ :: CString -> IO CFloat+foreign import ccall "nanl" nanl+ :: CString -> IO CLDouble+foreign import ccall "nextafter" nextafter+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "nextafterf" nextafterf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "nextafterl" nextafterl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "nexttoward" nexttoward+ :: CDouble -> CLDouble -> IO CDouble+foreign import ccall "nexttowardf" nexttowardf+ :: CFloat -> CLDouble -> IO CFloat+foreign import ccall "nexttowardl" nexttowardl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "fdim" fdim+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "fdimf" fdimf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "fdiml" fdiml+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "fmax" fmax+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "fmaxf" fmaxf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "fmaxl" fmaxl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "fmin" fmin+ :: CDouble -> CDouble -> IO CDouble+foreign import ccall "fminf" fminf+ :: CFloat -> CFloat -> IO CFloat+foreign import ccall "fminl" fminl+ :: CLDouble -> CLDouble -> IO CLDouble+foreign import ccall "fma" fma+ :: CDouble -> CDouble -> CDouble -> IO CDouble+foreign import ccall "fmaf" fmaf+ :: CFloat -> CFloat -> CFloat -> IO CFloat+foreign import ccall "fmal" fmal+ :: CLDouble -> CLDouble -> CLDouble -> IO CLDouble++-- * @signal.h@++foreign import ccall "bindings_cs_SIG_DFL" _SIG_DFL+ :: Ptr _SignalCallback+foreign import ccall "bindings_cs_SIG_ERR" _SIG_ERR+ :: Ptr _SignalCallback+foreign import ccall "bindings_cs_SIG_IGN" _SIG_IGN+ :: Ptr _SignalCallback+foreign import ccall "bindings_cs_SIGABRT" _SIGABRT+ :: CInt+foreign import ccall "bindings_cs_SIGFPE" _SIGFPE+ :: CInt+foreign import ccall "bindings_cs_SIGILL" _SIGILL+ :: CInt+foreign import ccall "bindings_cs_SIGINT" _SIGINT+ :: CInt+foreign import ccall "bindings_cs_SIGSEGV" _SIGSEGV+ :: CInt+foreign import ccall "bindings_cs_SIGTERM" _SIGTERM+ :: CInt+foreign import ccall "signal" signal+ :: CInt -> Ptr CB000B -> IO ()+foreign import ccall "raise" raise+ :: CInt -> IO CInt++-- * @stdint.h@++type CInt8 = Data.Int.Int8+type CInt16 = Data.Int.Int16+type CInt32 = Data.Int.Int32+type CInt64 = Data.Int.Int64+type CUInt8 = Data.Word.Word8+type CUInt16 = Data.Word.Word16+type CUInt32 = Data.Word.Word32+type CUInt64 = Data.Word.Word64++-- * @stdio.h@++foreign import ccall "bindings_cs_IOFBF" _IOFBF+ :: CInt+foreign import ccall "bindings_cs_IOLBF" _IOLBF+ :: CInt+foreign import ccall "bindings_cs_IONBF" _IONBF+ :: CInt+foreign import ccall "bindings_cs_BUFSIZ" _BUFSIZ+ :: CInt+foreign import ccall "bindings_cs_EOF" _EOF+ :: CInt+foreign import ccall "bindings_cs_FOPEN_MAX" _FOPEN_MAX+ :: CInt+foreign import ccall "bindings_cs_FILENAME_MAX" _FILENAME_MAX+ :: CInt+foreign import ccall "bindings_cs_L_tmpnam" _L_tmpnam+ :: CInt+foreign import ccall "bindings_cs_SEEK_CUR" _SEEK_CUR+ :: CInt+foreign import ccall "bindings_cs_SEEK_END" _SEEK_END+ :: CInt+foreign import ccall "bindings_cs_SEEK_SET" _SEEK_SET+ :: CInt+foreign import ccall "bindings_cs_TMP_MAX" _TMP_MAX+ :: CInt+foreign import ccall "bindings_cs_stderr" stderr+ :: Ptr CFile+foreign import ccall "bindings_cs_stdin" stdin+ :: Ptr CFile+foreign import ccall "bindings_cs_stdout" stdout+ :: Ptr CFile+foreign import ccall "remove" remove+ :: CString -> IO CInt+foreign import ccall "rename" rename+ :: CString -> CString -> IO CInt+foreign import ccall "tmpfile" tmpfile+ :: IO (Ptr CFile)+foreign import ccall "fclose" fclose+ :: Ptr CFile -> IO CInt+foreign import ccall "fflush" fflush+ :: Ptr CFile -> IO CInt+foreign import ccall "fopen" fopen+ :: CString -> CString -> IO (Ptr CFile)+foreign import ccall "freopen" freopen+ :: CString -> CString -> Ptr CFile -> IO (Ptr CFile)+foreign import ccall "setbuf" setbuf+ :: Ptr CFile -> CString -> IO ()+foreign import ccall "setvbuf" setvbuf+ :: Ptr CFile -> CString -> CInt -> CSize -> IO CInt+foreign import ccall "fgetc" fgetc+ :: Ptr CFile -> IO CInt+foreign import ccall "fgets" fgets+ :: CString -> CInt -> Ptr CFile -> IO CString+foreign import ccall "fputc" fputc+ :: CInt -> Ptr CFile -> IO CInt+foreign import ccall "fputs" fputs+ :: CString -> Ptr CFile -> IO CInt+foreign import ccall "getc" getc+ :: Ptr CFile -> IO CInt+foreign import ccall "getchar" getchar+ :: IO CInt+foreign import ccall "putchar" putchar+ :: CInt -> IO CInt+foreign import ccall "puts" puts+ :: CString -> IO CInt+foreign import ccall "ungetc" ungetc+ :: CInt -> Ptr CFile -> IO CInt+foreign import ccall "fread" fread+ :: Ptr () -> CSize -> CSize -> Ptr CFile -> IO CSize+foreign import ccall "fwrite" fwrite+ :: Ptr () -> CSize -> CSize -> Ptr CFile -> IO CSize+foreign import ccall "fgetpos" fgetpos+ :: Ptr CFile -> Ptr CFpos -> IO CInt+foreign import ccall "fseek" fseek+ :: Ptr CFile -> CLong -> CInt -> IO CInt+foreign import ccall "fsetpos" fsetpos+ :: Ptr CFile -> Ptr CFpos -> IO CInt+foreign import ccall "ftell" ftell+ :: Ptr CFile -> IO CLong+foreign import ccall "rewind" rewind+ :: Ptr CFile -> IO ()+foreign import ccall "clearerr" clearerr+ :: Ptr CFile -> IO ()+foreign import ccall "feof" feof+ :: Ptr CFile -> IO CInt+foreign import ccall "ferror" ferror+ :: Ptr CFile -> IO CInt+foreign import ccall "perror" perror+ :: CString -> IO ()++-- * @stdlib.h@++foreign import ccall "bindings_cs_EXIT_FAILURE" _EXIT_FAILURE+ :: CInt+foreign import ccall "bindings_cs_EXIT_SUCCESS" _EXIT_SUCCESS+ :: CInt+foreign import ccall "bindings_cs_RAND_MAX" _RAND_MAX+ :: CInt+foreign import ccall "bindings_cs_MB_CUR_MAX" _MB_CUR_MAX+ :: IO CSize+foreign import ccall "atof" atof+ :: CString -> IO CDouble+foreign import ccall "atoi" atoi+ :: CString -> IO CInt+foreign import ccall "atol" atol+ :: CString -> IO CLong+foreign import ccall "atoll" atoll+ :: CString -> IO CLLong+foreign import ccall "strtod" strtod+ :: CString -> Ptr CString -> IO CDouble+foreign import ccall "strtof" strtof+ :: CString -> Ptr CString -> IO CFloat+foreign import ccall "strtold" strtold+ :: CString -> Ptr CString -> IO CLDouble+foreign import ccall "strtol" strtol+ :: CString -> Ptr CString -> CInt -> IO CLong+foreign import ccall "strtoll" strtoll+ :: CString -> Ptr CString -> CInt -> IO CLLong+foreign import ccall "strtoul" strtoul+ :: CString -> Ptr CString -> CInt -> IO CULong+foreign import ccall "strtoull" strtoull+ :: CString -> Ptr CString -> CInt -> IO CULLong+foreign import ccall "rand" rand+ :: IO CInt+foreign import ccall "srand" srand+ :: CUInt -> IO ()+foreign import ccall "calloc" calloc+ :: CSize -> CSize -> Ptr ()+foreign import ccall "free" free+ :: Ptr () -> IO ()+foreign import ccall "malloc" malloc+ :: CSize -> IO (Ptr ())+foreign import ccall "realloc" realloc+ :: Ptr () -> CSize -> IO (Ptr ())+foreign import ccall "abort" abort+ :: IO ()+foreign import ccall "atexit" atexit+ :: FunPtr CB000C -> IO CInt+foreign import ccall "exit" exit+ :: CInt -> IO ()+foreign import ccall "_Exit" _Exit+ :: CInt -> IO ()+foreign import ccall "getenv" getenv+ :: CString -> IO CString+foreign import ccall "system" system+ :: CString -> IO CInt+foreign import ccall "bsearch" bsearch+ :: Ptr () -> Ptr () -> CSize -> CSize -> FunPtr CB0002 -> IO (Ptr ())+foreign import ccall "qsort" qsort+ :: Ptr () -> CSize -> CSize -> FunPtr CB0002 -> IO ()+foreign import ccall "abs" abs+ :: CInt -> IO CInt+foreign import ccall "labs" labs+ :: CLong -> IO CLong+foreign import ccall "llabs" llabs+ :: CLLong -> IO CLLong+foreign import ccall "mblen" mblen+ :: CString -> CSize -> IO CInt+foreign import ccall "mbtowc" mbtowc+ :: CWString -> CString -> CSize -> IO CInt+foreign import ccall "wctomb" wctomb+ :: CString -> CWchar -> IO CInt+foreign import ccall "mbstowcs" mbstowcs+ :: CWString -> CString -> CSize -> IO CSize+foreign import ccall "wcstombs" wcstombs+ :: CString -> CWString -> CSize -> IO CSize++-- * @string.h@++foreign import ccall "memcpy" memcpy+ :: Ptr () -> Ptr () -> CSize -> IO (Ptr ())+foreign import ccall "memmove" memmove+ :: Ptr () -> Ptr () -> CSize -> IO (Ptr ())+foreign import ccall "strcpy" strcpy+ :: CString -> CString -> IO CString+foreign import ccall "strncpy" strncpy+ :: CString -> CString -> CSize -> IO CString+foreign import ccall "strcat" strcat+ :: CString -> CString -> IO CString+foreign import ccall "strncat" strncat+ :: CString -> CString -> CSize -> IO CString+foreign import ccall "memcmp" memcmp+ :: Ptr () -> Ptr () -> CSize -> IO CInt+foreign import ccall "strcmp" strcmp+ :: CString -> CString -> IO CInt+foreign import ccall "strcoll" strcoll+ :: CString -> CString -> IO CInt+foreign import ccall "strncmp" strncmp+ :: CString -> CString -> CSize -> IO CInt+foreign import ccall "strxfrm" strxfrm+ :: CString -> CString -> CSize -> IO CSize+foreign import ccall "memchr" memchr+ :: Ptr () -> CInt -> CSize -> IO (Ptr ())+foreign import ccall "strchr" strchr+ :: CString -> CInt -> IO CString+foreign import ccall "strcspn" strcspn+ :: CString -> CString -> IO CSize+foreign import ccall "strpbrk" strpbrk+ :: CString -> CString -> IO CString+foreign import ccall "strrchr" strrchr+ :: CString -> CInt -> IO CString+foreign import ccall "strspn" strspn+ :: CString -> CString -> IO CSize+foreign import ccall "strstr" strstr+ :: CString -> CString -> IO CString+foreign import ccall "strtok" strtok+ :: CString -> CString -> IO CString+foreign import ccall "memset" memset+ :: Ptr () -> CInt -> CSize -> IO (Ptr ())+foreign import ccall "strerror" strerror+ :: CInt -> IO CString+foreign import ccall "strlen" strlen+ :: CString -> IO CSize++-- * @time.h@++foreign import ccall "bindings_cs_CLOCKS_PER_SEC" _CLOCKS_PER_SEC+ :: CClock+foreign import ccall "clock" clock+ :: IO CClock+foreign import ccall "difftime" difftime+ :: CTime -> CTime -> IO CDouble+foreign import ccall "time" time+ :: Ptr CTime -> IO CTime+foreign import ccall "ctime" ctime+ :: Ptr CTime -> IO CString++-- * @wchar.h@++foreign import ccall "fgetws" fgetws+ :: CWString -> CInt -> Ptr CFile -> IO CWString+foreign import ccall "fputws" fputws+ :: CWString -> Ptr CFile -> IO CInt+foreign import ccall "fwide" fwide+ :: Ptr CFile -> CInt -> IO CInt+foreign import ccall "wcstod" wcstod+ :: CWString -> Ptr CString -> IO CDouble+foreign import ccall "wcstof" wcstof+ :: CWString -> Ptr CString -> IO CFloat+foreign import ccall "wcstold" wcstold+ :: CWString -> Ptr CString -> IO CLDouble+foreign import ccall "wcstol" wcstol+ :: CWString -> Ptr CWString -> CInt -> IO CLong+foreign import ccall "wcstoll" wcstoll+ :: CWString -> Ptr CWString -> CInt -> IO CLLong+foreign import ccall "wcstoul" wcstoul+ :: CWString -> Ptr CWString -> CInt -> IO CULong+foreign import ccall "wcstoull" wcstoull+ :: CWString -> Ptr CWString -> CInt -> IO CULLong+foreign import ccall "wcscpy" wcscpy+ :: CWString -> CWString -> IO CWString+foreign import ccall "wcsncpy" wcsncpy+ :: CWString -> CWString -> CSize -> IO CWString+foreign import ccall "wmemcpy" wmemcpy+ :: CWString -> CWString -> CSize -> IO CWString+foreign import ccall "wmemmove" wmemmove+ :: CWString -> CWString -> CSize -> IO CWString+foreign import ccall "wcscat" wcscat+ :: CWString -> CWString -> IO CWString+foreign import ccall "wcsncat" wcsncat+ :: CWString -> CWString -> CSize -> IO CWString+foreign import ccall "wcscmp" wcscmp+ :: CWString -> CWString -> IO CInt+foreign import ccall "wcscoll" wcscoll+ :: CWString -> CWString -> IO CInt+foreign import ccall "wcsncmp" wcsncmp+ :: CWString -> CWString -> CSize -> IO CInt+foreign import ccall "wcsxfrm" wcsxfrm+ :: CWString -> CWString -> CSize -> IO CSize+foreign import ccall "wmemcmp" wmemcmp+ :: CWString -> CWString -> CSize -> IO CInt+foreign import ccall "wcschr" wcschr+ :: CWString -> CWchar -> IO CWchar+foreign import ccall "wcscspn" wcscspn+ :: CWString -> CWString -> IO CSize+foreign import ccall "wcspbrk" wcspbrk+ :: CWString -> CWString -> IO CWString+foreign import ccall "wcsrchr" wcsrchr+ :: CWString -> CWchar -> IO CWString+foreign import ccall "wcsspn" wcsspn+ :: CWString -> CWString -> IO CSize+foreign import ccall "wcsstr" wcsstr+ :: CWString -> CWString -> IO CWString+foreign import ccall "wcstok" wcstok+ :: CWString -> CWString -> CWString -> IO CWString+foreign import ccall "wmemchr" wmemchr+ :: CWString -> CWchar -> CSize -> IO CWString+foreign import ccall "wcslen" wcslen+ :: CWString -> IO CSize+foreign import ccall "wmemset" wmemset+ :: CWString -> CWchar -> CSize -> IO CWString
+ src/Bindings/Utilities.hs view
@@ -0,0 +1,83 @@+module Bindings.Utilities where+import Foreign.C+import Foreign+import Data.Int++newtype (Storable a) => GlobalVar a = GlobalVar (Ptr a)+setGlobalVar(GlobalVar p) v = poke p v+getGlobalVar (GlobalVar p) = peek p++class Callback f where+ makeCallback :: f -> IO (FunPtr f)+ freeCallback :: FunPtr f -> IO ()+ withCallback :: f -> (FunPtr f -> IO a) -> IO a+ freeCallback = freeHaskellFunPtr+ withCallback fun action = do+ funPtr <- makeCallback fun+ result <- action funPtr+ freeHaskellFunPtr funPtr+ return result++type CallbackMaker a = a -> IO (FunPtr a)++type CB0001 a = Ptr a -> CInt -> Ptr CString -> Ptr CString -> IO CInt+foreign import ccall "wrapper" mkCB0001 :: CallbackMaker (CB0001 a)+instance Callback (CB0001 a) where+ makeCallback = mkCB0001++type CB0002 = Ptr () -> Ptr () -> IO CInt+foreign import ccall "wrapper" mkCB0002 :: CallbackMaker CB0002+instance Callback CB0002 where+ makeCallback = mkCB0002++type CB0003 a = Ptr a -> CInt -> IO CInt+foreign import ccall "wrapper" mkCB0003 :: CallbackMaker (CB0003 a)+instance Callback (CB0003 a) where+ makeCallback = mkCB0003++type CB0004 a b = Ptr a -> Ptr b -> CInt -> CString -> IO ()+foreign import ccall "wrapper" mkCB0004 :: CallbackMaker (CB0004 a b)+instance Callback (CB0004 a b) where+ makeCallback = mkCB0004++type CB0005 a = Ptr a -> IO CInt+foreign import ccall "wrapper" mkCB0005 :: CallbackMaker (CB0005 a)+instance Callback (CB0005 a) where+ makeCallback = mkCB0005++type CB0006 a = Ptr a -> CInt -> CString -> CInt -> CString -> IO CInt+foreign import ccall "wrapper" mkCB0006 :: CallbackMaker (CB0006 a)+instance Callback (CB0006 a) where+ makeCallback = mkCB0006++type CB0007 a b = Ptr a -> CInt -> Ptr (Ptr b) -> IO ()+foreign import ccall "wrapper" mkCB0007 :: CallbackMaker (CB0007 a b)+instance Callback (CB0007 a b) where+ makeCallback = mkCB0007++type CB0008 a = Ptr a -> IO ()+foreign import ccall "wrapper" mkCB0008 :: CallbackMaker (CB0008 a)+instance Callback (CB0008 a) where+ makeCallback = mkCB0008++type CB0009 a = Ptr a -> CInt -> CString -> CString ->+ CString -> CString -> IO CInt+foreign import ccall "wrapper" mkCB0009 :: CallbackMaker (CB0009 a)+instance Callback (CB0009 a) where+ makeCallback = mkCB0009++type CB000A a = Ptr a -> CInt -> CString -> CString ->+ Data.Int.Int64 -> IO ()+foreign import ccall "wrapper" mkCB000A :: CallbackMaker (CB000A a)+instance Callback (CB000A a) where+ makeCallback = mkCB000A++type CB000B = CInt -> IO ()+foreign import ccall "wrapper" mkCB000B :: CallbackMaker CB000B+instance Callback CB000B where+ makeCallback = mkCB000B++type CB000C = IO ()+foreign import ccall "wrapper" mkCB000C :: CallbackMaker CB000C+instance Callback CB000C where+ makeCallback = mkCB000C
+ traduttoreTraditore/Setup.hs view
@@ -0,0 +1,4 @@+#!/usr/bin/env runhaskell++module Main (main) where { import Distribution.Simple ; main =+defaultMain }
+ traduttoreTraditore/sqlite3/5minutes.hs view
@@ -0,0 +1,50 @@+-- This is a translation of the C code example found in sqlite web site+-- page "SQLite in 5 Minutes Or Less". Due to the conversion of String+-- and CString and vice versa, problems related to international input+-- are to be expected.++module Main (main) where+import Foreign+import Foreign.C+import System.IO+import System.Environment+import Control.Monad+import qualified Bindings.Sqlite3 as Sqlite3+import qualified Bindings.Utilities as U++callback :: U.CB0001 ()+callback _ argc argv azColName =+ do mapM write [0..(fromIntegral $ argc - 1)]+ putStrLn ""+ return 0+ where write n = do aCN' <- peekElemOff azColName n+ aCN <- peekCString aCN'+ v' <- peekElemOff argv n+ v <- maybePeek peekCString v'+ putStrLn $ aCN ++ " " ++ (maybe "NULL" id v)++main :: IO CInt+main = do+ argv' <- getArgs+ argv <- mapM newCString argv'+ dbPtr <- new nullPtr+ zErrMsgPtr <- new nullPtr+ case argv of+ database:sql:[] ->+ do rc <- Sqlite3.open database dbPtr+ db <- peek dbPtr+ if (rc == Sqlite3._OK)+ then U.withCallback callback $ \cb ->+ do rc <- Sqlite3.exec db sql cb nullPtr zErrMsgPtr+ when (rc /= Sqlite3._OK) $+ do zErrMsg' <- peek zErrMsgPtr+ zErrMsg <- peekCString zErrMsg'+ putStrLn $ "SQL error: " ++ zErrMsg+ Sqlite3.free zErrMsg'+ else putStrLn $ "Can't open database: " ++ (show database)+ Sqlite3.close db+ return ()+ _ ->+ do programName <- getProgName+ putStrLn $ "Usage: " ++ programName ++ " DATABASE SQL-STATEMENT"+ return 1
+ traduttoreTraditore/tt.cabal view
@@ -0,0 +1,24 @@+cabal-version: >= 1.2+name: code-translations+synopsis:+ Translation of canonical example code from original+ package language to Haskell.+description: + This package joins translations of canonical (i.e., found in libraries+ source package or web homepage) pieces of code, like example programs+ or demonstration usage. They are not supposed to represent the+ best way to code in Haskell what they achieve, but to be faithfull+ translations of the original code, so that both can be compared side+ by side to the possible extent.+version: 0.0.1+license: BSD3+license-file: LICENSE+maintainer: Maurício C. Antunes+author: Maurício C. Antunes+build-type: Simple+category: FFI++executable 5minutes+ hs-source-dirs: sqlite3+ main-is: 5minutes.hs+ build-depends: base, bindings